summaryrefslogtreecommitdiffstats
path: root/Lib/io.py
Commit message (Expand)AuthorAgeFilesLines
* add myselfBenjamin Peterson2009-05-011-1/+2
* add UnsupportedOperation to __all__Benjamin Peterson2009-04-291-1/+1
* Merged revisions 70992,70995 via svnmerge fromBenjamin Peterson2009-04-011-1/+7
* simplify and beautify codeBenjamin Peterson2009-03-061-23/+12
* Fix failures introduced by buggy merge (2)Antoine Pitrou2009-03-041-1/+1
* merge the io-c branch: C implementation of the io moduleBenjamin Peterson2009-03-041-2077/+41
* Merged revisions 69846 via svnmerge fromMark Dickinson2009-02-211-2/+2
* Issue #4631: Fix urlopen() result when an HTTP response uses chunked encoding.Antoine Pitrou2009-02-111-2/+0
* Issue #4604: Some objects of the I/O library could still be used afterAntoine Pitrou2009-01-091-36/+38
* Merged revisions 67889-67892,67895,67898,67904-67907,67912,67918,67920-67921,...Benjamin Peterson2008-12-271-1/+1
* Issue #4663: increase the chunk size to improve TextIOWrapper performance on ...Antoine Pitrou2008-12-151-1/+1
* Issue #4574: reading an UTF16-encoded text file crashes if \r on 64-char boun...Antoine Pitrou2008-12-141-15/+12
* Fix for bug 4362 "FileIO object in io module"; Patch by amaury.forgeotdarc.Barry Warsaw2008-11-201-10/+16
* Issue #3187: Better support for "undecodable" filenames. Code by VictorGuido van Rossum2008-10-021-8/+7
* Merged revisions 65791 via svnmerge fromBrett Cannon2008-08-181-1/+0
* Removed some unused imports to decrease the amount of loaded modules during s...Christian Heimes2008-08-151-2/+6
* Fix build from a blank checkout by using the _thread module instead of thread...Antoine Pitrou2008-08-151-3/+3
* Merged revisions 65686 via svnmerge fromAntoine Pitrou2008-08-141-39/+63
* #2523: binary buffered reading is quadraticAntoine Pitrou2008-07-281-30/+61
* Fixed test_tempfile.Alexandre Vassalotti2008-06-121-0/+16
* Issue 2918: Merge StringIO and cStringIO.Alexandre Vassalotti2008-06-111-10/+278
* Create the dbm package from PEP 3108. #2881.Georg Brandl2008-05-261-1/+1
* Merged revisions 62998-63003,63005-63006,63009-63012,63014-63017,63019-63020,...Alexandre Vassalotti2008-05-161-6/+6
* Removed redundant max() call.Alexandre Vassalotti2008-05-091-1/+1
* Fixed the negative value check in io._BytesIO.seek().Alexandre Vassalotti2008-05-081-1/+1
* Cleaned how _BytesIO.read() returns an empty bytes object.Alexandre Vassalotti2008-05-071-1/+1
* Fixed a small bug introduced by r62778.Alexandre Vassalotti2008-05-061-1/+1
* Added fast alternate io.BytesIO implementation and its test suite.Alexandre Vassalotti2008-05-061-9/+66
* Merged revisions 62713,62715,62728,62737,62740,62744,62749,62756 via svnmerge...Christian Heimes2008-05-061-45/+38
* Fix problems in the io docs noted by Alexandre VassalottiBenjamin Peterson2008-04-141-7/+4
* Fleshed out docstrings in the io module, improving the reST one as I went.Benjamin Peterson2008-04-131-144/+296
* Remove __repr__ that doesn't have any advantage compared to the standard one.Georg Brandl2008-04-091-3/+0
* More docstring fixes, and an XXX.Georg Brandl2008-04-091-4/+5
* fixed outdated annotation of readinto in ioBenjamin Peterson2008-04-071-4/+4
* Docstring fix.Georg Brandl2008-04-061-2/+2
* fix typo in doc stringBenjamin Peterson2008-04-061-2/+2
* Clean up the TextIOWrapper code; pick better names; improve documentation.Ka-Ping Yee2008-03-201-123/+121
* This is r61508 plus additional fixes to the handling of 'limit'Ka-Ping Yee2008-03-201-64/+84
* Revert r61508: it caused test_mailbox to fail on all platforms.Neal Norwitz2008-03-181-82/+64
* In TextIOWrapper:Ka-Ping Yee2008-03-181-64/+82
* Make TextIOWrapper's seek/tell work properly with stateful decoders;Ka-Ping Yee2008-03-181-102/+182
* Patch from jbalogh fixes issue #2282 (misnamed seekable() method).Ka-Ping Yee2008-03-171-1/+1
* Remove the "unsafe" flag on peek() -- it is no longer used, becauseKa-Ping Yee2008-03-171-13/+8
* Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,...Christian Heimes2008-02-091-0/+1
* Fix issue1753: TextIOWrapper.write writes utf BOM for every string.Alexandre Vassalotti2008-01-071-4/+8
* Fix the reset() method of IncrementalNewlineDecoder toAlexandre Vassalotti2007-12-281-0/+1
* Added descriptor for builtins.open.__doc__Christian Heimes2007-12-081-0/+10
* Fix the rest of issue 1400, by introducing a proper implementation ofGuido van Rossum2007-12-061-6/+14
* Add an errors parameter to open() and TextIOWrapper() to specify error handling.Guido van Rossum2007-12-031-9/+27
* #1535: rename __builtin__ module to builtins.Georg Brandl2007-12-021-1/+1
tat' width='100%'> -rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.cpp41
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h200
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h603
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp265
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h123
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp174
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp545
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSRetainPtr.h173
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.cpp112
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h145
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSStringRefBSTR.cpp42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSStringRefCF.cpp57
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp327
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp55
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.h81
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog23436
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/Info.plist24
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi447
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order1963
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri111
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro232
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/JavaScriptCorePrefix.h35
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp378
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h835
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h1887
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h534
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBuffer.h171
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h316
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/CodeLocation.h185
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/LinkBuffer.h193
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MIPSAssembler.h935
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h342
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp95
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h955
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h1186
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h192
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerMIPS.h1658
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h202
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h1038
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h451
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/RepatchBuffer.h134
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h2064
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp1719
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h656
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h77
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h169
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.cpp45
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h103
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.cpp186
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h254
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp406
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h414
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.cpp80
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h185
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp2017
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h531
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecompiler/NodesCodegen.cpp1999
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecompiler/RegisterID.h121
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/config.h89
-rwxr-xr-xsrc/3rdparty/webkit/JavaScriptCore/create_hash_table277
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/create_jit_stubs69
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp112
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h65
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp104
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h66
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp90
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h67
-rwxr-xr-xsrc/3rdparty/webkit/JavaScriptCore/docs/make-bytecode-docs.pl42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h34
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h59
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h1199
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp5604
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h173
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h15
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h49
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h31
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h18
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h34
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h18
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h48
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/generated/chartables.c96
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/CachedCall.h78
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.cpp52
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h155
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrameClosure.h60
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp4357
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h169
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h220
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp61
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h292
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.cpp38
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h319
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp447
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp85
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorSymbian.cpp75
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorWin.cpp63
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp626
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JIT.h1002
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITArithmetic.cpp2808
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp726
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITCode.h116
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h866
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp3126
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp1058
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess32_64.cpp1145
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubCall.h235
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp3152
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h376
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jsc.cpp560
-rwxr-xr-xsrc/3rdparty/webkit/JavaScriptCore/make-generated-sources.sh11
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/os-win32/stdint.h67
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y2099
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp1044
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h147
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h908
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp195
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h1593
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Parser.cpp78
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Parser.h103
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp124
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.h130
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/SourceProvider.h85
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/AUTHORS12
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/COPYING35
-rwxr-xr-xsrc/3rdparty/webkit/JavaScriptCore/pcre/dftables273
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre.h68
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre.pri12
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre_compile.cpp2706
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre_exec.cpp2177
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre_internal.h455
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre_tables.cpp72
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp99
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/pcre_xclass.cpp115
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/ucpinternal.h126
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/pcre/ucptable.cpp2968
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/CallIdentifier.h98
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/Profile.cpp136
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.cpp170
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.h77
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.cpp348
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.h168
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.cpp161
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.h75
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/profiler/ProfilerServer.mm115
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.cpp79
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.h238
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.cpp304
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h253
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.cpp97
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.h40
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.cpp1054
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.h42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h55
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.cpp78
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.h44
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.cpp35
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.h51
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.cpp83
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.h35
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/CallData.cpp42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/CallData.h65
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp1269
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h300
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/CollectorHeapIterator.h140
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.cpp39
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h105
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp72
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Completion.h63
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.h63
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp184
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.h43
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DateConversion.cpp102
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp87
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h82
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h94
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp1027
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h52
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Error.cpp134
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Error.h66
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.cpp73
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.h44
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.cpp33
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.h38
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.cpp67
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.h37
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp196
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.h58
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp280
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h356
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.cpp113
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.h44
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp146
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.h46
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.cpp46
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.h74
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.cpp48
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.h54
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.cpp298
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.h206
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/InitializeThreading.cpp72
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.cpp71
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.h68
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.cpp31
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.h62
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp172
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.h108
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp1074
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h226
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp116
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h123
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.cpp227
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h366
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.cpp269
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h135
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp282
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h204
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp476
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h476
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp440
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.h60
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.cpp26
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.h721
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.cpp254
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.h104
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp129
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h101
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.cpp113
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.h359
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.cpp879
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.h64
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp689
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h714
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp108
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h109
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.cpp77
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.h71
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp228
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSString.h535
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSStringBuilder.h133
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSType.h44
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSTypeInfo.h80
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp184
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.h851
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp71
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h169
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.cpp36
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.h69
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.cpp48
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.h78
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp455
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.h110
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.cpp82
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h323
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.cpp40
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h187
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackNone.cpp49
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp52
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackSymbian.cpp48
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackWin.cpp55
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.cpp238
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.h49
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.cpp73
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.h51
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp39
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h35
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NativeFunctionWrapper.h39
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.cpp128
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.h59
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.cpp51
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.h56
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.cpp454
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.h35
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/NumericStrings.h97
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp317
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.h41
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.cpp155
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.h43
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Operations.cpp111
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Operations.h451
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PropertyMapHashTable.h90
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.cpp53
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h99
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.cpp44
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.h268
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h215
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.cpp57
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.h45
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/PutPropertySlot.h77
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp212
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h82
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp354
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.h133
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.cpp173
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.h87
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp123
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.h38
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.cpp68
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.h242
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChainMark.h36
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.cpp141
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.h75
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringBuilder.h82
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.cpp91
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.h40
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp99
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h69
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h57
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp1067
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.h43
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp1269
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h296
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp49
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h53
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h71
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/SymbolTable.h130
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp155
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp738
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/UString.h686
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp192
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h343
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h122
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h136
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wscript106
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ASCIICType.h165
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/AVLTree.h959
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h67
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp208
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h307
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.cpp38
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h93
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h46
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h171
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp309
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h67
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp996
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h223
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Deque.h669
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h413
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp4494
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h240
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h44
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h228
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/HashIterators.h216
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h410
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h290
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h1169
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/HashTraits.h115
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h616
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h47
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp155
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h61
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/MallocZoneSupport.h65
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h200
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h220
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h52
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h75
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h52
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h139
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrBrew.cpp53
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h76
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp76
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/PassOwnPtr.h177
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h267
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h1086
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp139
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.h42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h88
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h137
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RefCountedLeakCounter.cpp100
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h220
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h336
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RetainPtr.h203
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h81
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h113
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h157
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/TCPageMap.h316
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h240
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp522
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h77
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h309
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecificWin.cpp54
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp98
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h350
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp393
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp493
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp134
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h373
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/UnusedParam.h29
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h90
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h1139
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h138
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h103
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp2466
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h47
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.cpp67
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.h148
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.cpp38
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.h187
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp72
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp295
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp132
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h120
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp111
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h69
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h67
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp304
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.h75
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h42
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp215
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h69
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp150
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h407
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp176
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h216
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h176
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp728
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.h43
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp1607
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.h335
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp1421
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h96
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexParser.h852
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h355
-rw-r--r--src/3rdparty/webkit/Source/CMakeLists.txt138
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/APICast.h153
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/APIShims.h104
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSBase.cpp113
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSBase.h138
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSBasePrivate.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSBasePrivate.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.cpp90
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.h59
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.cpp81
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.h57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.cpp54
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.h200
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h603
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.cpp261
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.h128
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRef.cpp176
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRef.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRefPrivate.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSContextRefPrivate.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRef.cpp547
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRef.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRefPrivate.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSObjectRefPrivate.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSProfilerPrivate.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSProfilerPrivate.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSProfilerPrivate.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSProfilerPrivate.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSRetainPtr.h208
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRef.cpp112
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRef.h145
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefBSTR.cpp42
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefBSTR.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSStringRefBSTR.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefCF.cpp57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefCF.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSStringRefCF.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSValueRef.cpp334
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSValueRef.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h68
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp87
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h92
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JavaScript.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JavaScript.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/JavaScriptCore.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/JavaScriptCore.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/OpaqueJSString.cpp55
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/OpaqueJSString.h81
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/API/WebKitAvailability.h (renamed from src/3rdparty/webkit/JavaScriptCore/API/WebKitAvailability.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/AUTHORS (renamed from src/3rdparty/webkit/JavaScriptCore/AUTHORS)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/CMakeLists.txt250
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsEfl.txt20
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsWinCE.txt22
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/COPYING.LIB (renamed from src/3rdparty/webkit/JavaScriptCore/COPYING.LIB)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog11889
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2002-12-03 (renamed from src/3rdparty/webkit/JavaScriptCore/ChangeLog-2002-12-03)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2003-10-25 (renamed from src/3rdparty/webkit/JavaScriptCore/ChangeLog-2003-10-25)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2007-10-14 (renamed from src/3rdparty/webkit/JavaScriptCore/ChangeLog-2007-10-14)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2008-08-10 (renamed from src/3rdparty/webkit/JavaScriptCore/ChangeLog-2008-08-10)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2009-06-16 (renamed from src/3rdparty/webkit/JavaScriptCore/ChangeLog-2009-06-16)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2010-05-2428211
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2011-02-1624628
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APIShims.h1
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h (renamed from src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/GNUmakefile.list.am609
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/Info.plist24
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp1
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp1
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.gypi731
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.order2130
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pri111
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pro237
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCorePrefix.h36
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/THANKS (renamed from src/3rdparty/webkit/JavaScriptCore/THANKS)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMAssembler.cpp378
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMAssembler.h891
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMv7Assembler.cpp41
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMv7Assembler.h2222
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h582
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBuffer.h184
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h342
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/CodeLocation.h184
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/LinkBuffer.h360
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MIPSAssembler.h912
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssembler.h353
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp99
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.h1031
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h1351
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h224
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h1795
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp52
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h1747
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86.h196
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h1282
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h482
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/RepatchBuffer.h129
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/SH4Assembler.h2005
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/assembler/X86Assembler.h2055
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.cpp1662
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.h658
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/EvalCodeCache.h83
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Instruction.h185
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/JumpTable.cpp47
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/JumpTable.h103
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Opcode.cpp191
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Opcode.h275
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/SamplingTool.cpp406
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/SamplingTool.h421
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp112
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.h173
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp2248
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h579
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/Label.h (renamed from src/3rdparty/webkit/JavaScriptCore/bytecompiler/Label.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/LabelScope.h (renamed from src/3rdparty/webkit/JavaScriptCore/bytecompiler/LabelScope.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp2055
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/RegisterID.h121
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/config.h126
-rwxr-xr-xsrc/3rdparty/webkit/Source/JavaScriptCore/create_hash_table296
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/create_jit_stubs75
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/create_regex_tables121
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/debugger/Debugger.cpp145
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/debugger/Debugger.h65
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerActivation.cpp104
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerActivation.h66
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp107
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerCallFrame.h67
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGAliasTracker.h121
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp1198
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.h47
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGFPRInfo.h96
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGPRInfo.h108
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGenerationInfo.h230
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.cpp168
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.h176
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp568
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h957
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp452
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.h260
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNode.h404
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp692
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h250
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.cpp245
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.h90
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGRegisterBank.h350
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGScoreBoard.h149
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp956
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h386
-rwxr-xr-xsrc/3rdparty/webkit/Source/JavaScriptCore/docs/make-bytecode-docs.pl43
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/ArrayPrototype.lut.h40
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/DatePrototype.lut.h65
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_MSVC.asm1086
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h1287
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/JSONObject.lut.h21
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/Lexer.lut.h55
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/MathObject.lut.h37
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/NumberConstructor.lut.h24
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/ObjectConstructor.lut.h32
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpConstructor.lut.h40
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpJitTables.h2715
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpObject.lut.h24
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/generated/StringPrototype.lut.h54
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/gyp/JavaScriptCore.gyp228
-rwxr-xr-xsrc/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-derived-sources.sh9
-rwxr-xr-xsrc/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-dtrace-header.sh9
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/gyp/gtk.gyp18
-rwxr-xr-xsrc/3rdparty/webkit/Source/JavaScriptCore/gyp/run-if-exists.sh5
-rwxr-xr-xsrc/3rdparty/webkit/Source/JavaScriptCore/gyp/update-info-plist.sh4
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/headers.pri (renamed from src/3rdparty/webkit/JavaScriptCore/headers.pri)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.cpp58
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.h101
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/Handle.h219
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.cpp174
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.h277
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.cpp63
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.h129
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.cpp436
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.h179
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/Local.h153
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/LocalScope.h78
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp493
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.h73
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.cpp135
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.h290
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackPosix.cpp43
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackSymbian.cpp38
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackWin.cpp44
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.cpp89
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.h223
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.cpp166
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.h188
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/Strong.h164
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/heap/Weak.h155
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CachedCall.h77
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.cpp53
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.h158
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrameClosure.h60
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Interpreter.cpp4907
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Interpreter.h170
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Register.h172
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.cpp101
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.h220
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocator.cpp128
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocator.h378
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp531
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.cpp633
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.h1045
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITArithmetic.cpp1244
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp1424
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall.cpp264
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall32_64.cpp348
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCode.h117
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITInlineMethods.h858
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes.cpp1750
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp1847
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess.cpp1038
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp1112
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubCall.h237
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp3613
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.h440
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/JSInterfaceJIT.h352
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/SpecializedThunkJIT.h165
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp162
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jit/ThunkGenerators.h45
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/jsc.cpp575
-rwxr-xr-xsrc/3rdparty/webkit/Source/JavaScriptCore/make-generated-sources.sh12
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/os-win32/WinMain.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/os-win32/WinMain.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/os-win32/inttypes.h261
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/os-win32/stdbool.h (renamed from src/3rdparty/webkit/JavaScriptCore/os-win32/stdbool.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/os-win32/stdint.h67
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/ASTBuilder.h977
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/JSParser.cpp2173
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/JSParser.h164
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/Keywords.table (renamed from src/3rdparty/webkit/JavaScriptCore/parser/Keywords.table)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.cpp1205
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.h172
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/NodeConstructors.h908
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/NodeInfo.h (renamed from src/3rdparty/webkit/JavaScriptCore/parser/NodeInfo.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/Nodes.cpp196
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/Nodes.h1619
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.cpp75
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.h130
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/ParserArena.cpp125
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/ParserArena.h132
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/ResultType.h (renamed from src/3rdparty/webkit/JavaScriptCore/parser/ResultType.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceCode.h (renamed from src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProvider.h105
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.cpp56
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.h48
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCacheItem.h66
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/parser/SyntaxChecker.h252
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/CallIdentifier.h101
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profile.cpp136
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profile.h (renamed from src/3rdparty/webkit/JavaScriptCore/profiler/Profile.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileGenerator.cpp181
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileGenerator.h80
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileNode.cpp351
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileNode.h172
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.cpp185
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.h80
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfilerServer.h (renamed from src/3rdparty/webkit/JavaScriptCore/profiler/ProfilerServer.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfilerServer.mm115
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.cpp81
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.h246
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.cpp353
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.h257
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayConstructor.cpp101
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayConstructor.h40
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.cpp1147
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.h49
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h56
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanConstructor.cpp79
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanConstructor.h44
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.cpp36
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.h50
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanPrototype.cpp85
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanPrototype.h35
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h103
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/CallData.cpp41
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/CallData.h64
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ClassInfo.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/ClassInfo.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp40
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/CommonIdentifiers.h100
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Completion.cpp78
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Completion.h63
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ConstructData.cpp42
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ConstructData.h64
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConstructor.cpp202
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConstructor.h43
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConversion.cpp107
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConversion.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/DateConversion.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.cpp83
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.h77
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstanceCache.h94
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.cpp1096
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.h53
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Error.cpp211
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Error.h78
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorConstructor.cpp68
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorConstructor.h42
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.cpp56
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.h56
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorPrototype.cpp70
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorPrototype.h37
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp150
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.h63
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.cpp405
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.h441
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionConstructor.cpp118
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionConstructor.h44
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.cpp149
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.h44
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallback.cpp54
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallback.h82
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp110
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/GetterSetter.cpp48
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/GetterSetter.h74
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.cpp314
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.h148
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/InitializeThreading.cpp78
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/InitializeThreading.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/InitializeThreading.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.cpp76
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.h71
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp33
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h64
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.cpp236
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.h105
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.cpp1328
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.h216
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.cpp114
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.h121
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.cpp224
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.h408
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.cpp28
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.h31
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.cpp333
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.h121
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.cpp445
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.h290
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.cpp462
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.h465
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp599
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h62
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.cpp265
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.h108
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSNotAnObject.cpp122
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSNotAnObject.h79
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.cpp856
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.h58
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.cpp789
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.h869
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp55
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h62
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp105
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h108
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp92
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.h62
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp371
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.h614
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStringBuilder.h134
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSType.h45
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSTypeInfo.h93
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.cpp197
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.h471
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h532
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSVariableObject.cpp71
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSVariableObject.h160
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSWrapperObject.cpp36
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSWrapperObject.h72
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.cpp40
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.h84
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/LiteralParser.cpp462
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/LiteralParser.h110
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.cpp95
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.h339
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.cpp243
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.h48
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.cpp50
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.h45
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp83
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.h56
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp42
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorPrototype.h36
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.cpp131
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.h57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.cpp52
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.h47
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberPrototype.cpp309
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberPrototype.h35
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumericStrings.h98
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.cpp404
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.h54
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectPrototype.cpp164
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectPrototype.h43
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Operations.cpp111
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Operations.h491
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyDescriptor.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyMapHashTable.h557
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyNameArray.cpp55
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyNameArray.h99
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertySlot.cpp40
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertySlot.h243
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Protect.h66
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/PutPropertySlot.h81
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.cpp269
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.h88
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpCache.cpp77
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpCache.h68
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpConstructor.cpp373
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpConstructor.h133
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpKey.h111
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpMatchesArray.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/RegExpMatchesArray.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.cpp181
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.h102
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpPrototype.cpp143
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpPrototype.h36
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RopeImpl.cpp62
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/RopeImpl.h97
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.cpp79
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.h148
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChainMark.h30
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.cpp146
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.h87
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp51
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StrictEvalActivation.h43
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringConstructor.cpp96
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringConstructor.h40
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.cpp102
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.h68
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.cpp1150
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.h53
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.cpp38
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.h79
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.cpp879
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.h316
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.cpp63
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.h60
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureTransitionTable.h173
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/SymbolTable.h134
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Terminator.h47
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/TimeoutChecker.cpp158
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/TimeoutChecker.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/Tracing.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/Tracing.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/UString.cpp366
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/UString.h260
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/UStringBuilder.h43
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/UStringConcatenate.h125
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/WeakGCMap.h191
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/WeakRandom.h (renamed from src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/runtime/WriteBarrier.h190
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeLists.txt25
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeListsEfl.txt8
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeListsWinCE.txt3
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wscript85
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ASCIICType.h179
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/AVLTree.h960
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Alignment.h36
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/AlwaysInline.h75
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.cpp298
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.h382
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Atomics.h117
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Bitmap.h162
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/BlockStack.h95
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/BloomFilter.h139
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/BumpPointerAllocator.h250
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ByteArray.cpp39
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ByteArray.h104
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeLists.txt172
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeListsEfl.txt46
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeListsWinCE.txt27
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32 (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Complex.h49
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h175
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp187
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.h45
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CurrentTime.cpp297
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/CurrentTime.h68
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.cpp1160
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.h233
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DecimalNumber.cpp199
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DecimalNumber.h108
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Decoder.h57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Deque.h688
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DisallowCType.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/DisallowCType.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DoublyLinkedList.h104
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp35
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.h96
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Encoder.h57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ExportMacros.h46
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastAllocBase.h421
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp4652
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.h281
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/FixedArray.h58
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Forward.h64
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/GetPtr.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/GetPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashCountedSet.h228
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashFunctions.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/HashFunctions.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashIterators.h218
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashMap.h411
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h260
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTable.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTable.h1183
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTraits.h117
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/HexNumber.h107
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ListHashSet.h709
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ListRefPtr.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Locker.h48
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MD5.cpp309
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MD5.h61
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MainThread.cpp241
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MainThread.h71
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MallocZoneSupport.h73
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h258
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MessageQueue.h219
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/NonCopyingSort.h89
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Noncopyable.h44
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/NotFound.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/NotFound.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.cpp34
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.h52
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocator.h101
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp133
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp202
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorWin.cpp80
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.cpp87
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.h41
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnArrayPtr.h176
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h52
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnPtr.h183
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnPtrCommon.h84
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocation.h129
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocationAligned.cpp87
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocationAligned.h70
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h100
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageBlock.cpp84
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageBlock.h83
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageReservation.h143
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobs.h116
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp98
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.h138
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsLibdispatch.h85
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsOpenMP.h81
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h227
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnPtr.h226
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassRefPtr.h313
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassTraits.h63
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h1224
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/PossiblyNull.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/PossiblyNull.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumber.cpp103
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumber.h39
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumberSeed.h83
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCounted.h172
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp100
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCountedLeakCounter.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/RefCountedLeakCounter.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtr.h232
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtrHashMap.h342
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/RetainPtr.h256
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.cpp219
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.h66
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/SegmentedVector.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/SegmentedVector.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/SentinelLinkedList.h109
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/SinglyLinkedList.h72
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/SizeLimits.cpp57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp285
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.h114
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/StaticConstructors.h80
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/StdLibExtras.h167
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringExtras.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringExtras.h126
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringHasher.h178
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCPackedCache.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/TCPackedCache.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCPageMap.h316
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSpinLock.h284
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp525
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h49
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h77
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h153
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecific.h332
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp53
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Threading.cpp100
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Threading.h118
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingNone.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingNone.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPrimitives.h169
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp398
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingWin.cpp499
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.cpp142
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.h386
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/UnusedParam.h37
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/VMTags.h75
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/ValueCheck.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/Vector.h1168
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/VectorTraits.h99
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/WTFThreadData.cpp58
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/WTFThreadData.h170
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/dtoa.cpp1834
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/dtoa.h51
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp57
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp66
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h143
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp86
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GRefPtr.h229
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GTypedefs.h98
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp52
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp248
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp77
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/StringQt.cpp73
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp288
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.cpp368
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.h204
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicStringHash.h62
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicStringImpl.h38
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/CString.cpp104
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/CString.h87
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuffer.h86
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuilder.cpp172
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuilder.h139
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringConcatenate.h583
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringHash.h190
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.cpp1081
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.h415
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImplBase.h100
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringStatics.cpp82
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/TextPosition.h150
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.cpp1012
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.h531
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/CharacterNames.h144
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/Collator.h69
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/unicode/CollatorDefault.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UTF8.cpp407
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UTF8.h80
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/Unicode.h44
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h100
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp181
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h194
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp192
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp149
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h375
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp181
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h177
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp90
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/ParsedURL.h62
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/URLString.h55
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h71
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLBuffer.h136
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp173
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h61
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLComponent.h77
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLEscape.cpp39
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLEscape.h49
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLParser.h575
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h107
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLSegments.cpp110
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLSegments.h105
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/wtfurl.gyp58
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h175
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/MemoryManager.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/MemoryManager.h (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.h)0
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri52
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/Yarr.h66
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.cpp1909
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.h373
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.cpp2280
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.h87
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrParser.h872
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.cpp1011
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.h422
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp59
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h38
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/yarr/yarr.pri7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj618
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/ChangeLog1260
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/ANGLE.xcconfig5
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig40
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/CompilerVersion.xcconfig56
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/egl.h329
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglext.h222
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h110
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2.h621
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h831
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2platform.h30
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h256
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/KHR/khrplatform.h269
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj601
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/angleutils.h18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.cpp44
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h65
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/BaseTypes.h147
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenGLSL.cpp25
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenHLSL.cpp25
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Common.h89
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp189
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h290
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ExtensionBehavior.h21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.cpp59
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.h115
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.cpp631
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.h35
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.cpp115
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.h16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeGlobals.h15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeParseContext.h16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/IntermTraverse.cpp293
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp1454
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/MMap.h56
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp690
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h49
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp2194
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h127
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp1530
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h116
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.cpp304
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.h300
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.cpp58
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.h7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.cpp77
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.h7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.cpp38
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.h33
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h104
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp254
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp232
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h348
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp37
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.h20
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.cpp22
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.h20
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Types.h293
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.cpp65
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.h37
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.cpp468
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.h62
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp210
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h38
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp108
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h50
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.cpp36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.h53
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_lexer.sh11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_parser.sh12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.h16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.l570
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.y2072
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp3186
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp4710
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h274
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermOut.cpp417
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermediate.h529
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/localintermediate.h58
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/osinclude.h70
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_nspr.cpp43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_posix.cpp64
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_win.cpp57
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/parseConst.cpp238
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c735
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h63
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h99
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c1061
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h86
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c152
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c154
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h56
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h93
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h51
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c687
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h84
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h82
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c284
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h112
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c436
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h89
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.cpp33
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.h21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp390
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.h118
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp659
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.h105
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp497
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.h94
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp1115
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.cpp161
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.h60
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp563
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h90
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp106
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h59
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp3582
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h543
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp134
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp471
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h96
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp2830
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h228
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.cpp52
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.h70
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp478
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h178
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp340
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h92
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp509
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h157
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp2467
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h315
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.cpp382
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.h120
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.cpp769
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.h170
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/vertexconversion.h208
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp5765
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def163
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp143
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.h47
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h66
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp827
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h80
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/LICENSE.txt31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/README.webkit42
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/glu.gyp36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/gluos.h48
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/internal_glu.h141
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/GNUmakefile110
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/Imakefile61
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/README447
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/alg-outline229
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict-list.h107
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.c117
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.h107
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.c271
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.h90
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.c62
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.h61
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.c796
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.h273
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.c259
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.h52
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.c260
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.h114
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-sort.h124
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.c267
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.h124
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.c505
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.h59
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.c1362
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.h84
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.c639
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.h173
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.c209
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.h78
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/CHANGES98
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/CMakeLists.txt384
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/CONTRIBUTORS36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/COPYING28
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/README417
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/README.WebKit3
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.cbproj138
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.groupproj54
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_all.cc38
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_link.cc40
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_main.cbproj82
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_unittest.cbproj88
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/configure.ac67
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-death-test.h283
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-message.h230
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h1392
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h.pump457
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-spi.h232
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-test-part.h176
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-typed-test.h259
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest.h2052
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_pred_impl.h368
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_prod.h58
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-death-test-internal.h275
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-filepath.h210
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-internal.h923
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-linked_ptr.h242
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h4820
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h.pump301
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util.h619
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-port.h1497
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-string.h350
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h968
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h.pump336
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h3321
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h.pump287
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/m4/acx_pthread.m4363
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/m4/gtest.m474
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/run_tests.py60
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/prime_tables.h123
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.cc68
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.h43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample10_unittest.cc145
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1_unittest.cc153
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.cc56
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.h86
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2_unittest.cc109
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3-inl.h173
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3_unittest.cc151
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.cc46
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.h53
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4_unittest.cc45
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample5_unittest.cc199
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample6_unittest.cc224
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample7_unittest.cc132
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample8_unittest.cc173
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample9_unittest.cc160
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/scripts/fuse_gtest_files.py250
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gen_gtest_pred_impl.py733
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gtest-config.in274
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/scripts/pump.py835
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload.py1387
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload_gtest.py78
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-all.cc47
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-death-test.cc1172
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-filepath.cc380
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-internal-inl.h1074
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-port.cc711
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-test-part.cc110
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-typed-test.cc110
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest.cc4704
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest_main.cc39
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-death-test_test.cc1230
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-filepath_test.cc690
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-linked_ptr_test.cc154
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-listener_test.cc313
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-message_test.cc167
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-options_test.cc212
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test2_test.cc65
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.cc835
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.h55
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-port_test.cc1018
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-test-part_test.cc208
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-tuple_test.cc320
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test2_test.cc45
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.cc360
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.h66
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-unittest-api_test.cc343
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_all_test.cc48
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest.py218
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest_.cc86
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test.py130
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test_.cc71
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test.py105
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test_.cc126
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_environment_test.cc186
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest.py633
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest_.cc140
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test.py169
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test_.cc46
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest.py177
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest_.cc85
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_main_unittest.cc45
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc.cc234
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc_test.py106
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_no_test_unittest.cc54
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test.py327
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_.cc1135
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_lin.txt696
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_win.txt605
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_pred_impl_unittest.cc2432
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_prod_test.cc57
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_repeat_test.cc253
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test.py325
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test_.cc104
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_sole_header_test.cc57
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_stress_test.cc257
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_test_utils.py309
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_ex_test.cc92
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test.py171
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test_.cc56
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test.py70
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test_.cc43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_unittest.cc6718
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile1_test_.cc49
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile2_test_.cc49
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfiles_test.py132
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest.py224
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest_.cc145
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_test_utils.py172
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.cc36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.h55
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util.py466
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util_test.py676
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/DebugProject.xcconfig30
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/FrameworkTarget.xcconfig17
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/General.xcconfig41
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/ReleaseProject.xcconfig32
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/StaticLibraryTarget.xcconfig18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/TestTarget.xcconfig8
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Resources/Info.plist30
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/Info.plist28
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj457
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/runtests.sh62
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.cc63
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.h59
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget_test.cc68
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/runtests.sh65
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/versiongenerate.py100
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/gtest.xcodeproj/project.pbxproj1080
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/AUTHORS5
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/DEPS8
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/LICENSE27
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/MANIFEST21
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/PRESUBMIT.py53
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/README.WebKit1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/codereview.settings10
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/gyp18
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/gyp.bat5
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/gyp_dummy.c7
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/gyptest.py255
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSNew.py341
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSProject.py245
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py980
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings_test.py1478
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSToolFile.py81
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSUserFile.py182
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSVersion.py200
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/SCons.py200
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/__init__.py461
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/common.py345
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml.py121
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml_test.py92
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/__init__.py (renamed from src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceListener.h)0
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/filelist.py45
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypd.py88
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypsh.py57
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/make.py1423
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/msvs.py1541
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/scons.py1045
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/xcode.py1201
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/input.py2250
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/system_test.py70
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xcodeproj_file.py2840
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xml_fix.py70
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples81
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples.bat5
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/setup.py26
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/gyptest-bare.py23
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.gyp25
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.py11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/gyptest-all.py42
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/actions.gyp165
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/copy.py9
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/filter.py12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/foo.c11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/input.txt1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/main.c22
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/gyptest-action.py26
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/make-file.py11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/none.gyp31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/make-subdir-file.py11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/subdir.gyp28
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-all.py94
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-default.py61
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-errors.py24
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/action_missing_name.gyp24
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/actions.gyp114
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/confirm-dep-files.py16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/counter.py46
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/executable.gyp74
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog1.py20
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog2.py20
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/program.c12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/make-file.py11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/none.gyp33
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/generate_main.py21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/null_input.gyp29
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/gyptest-additional.py55
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/all.gyp13
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/actions.gyp56
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/emit.py11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/lib1.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/gyptest-assembly.py31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/as.bat4
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/assembly.gyp59
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.S10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.c3
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/program.c12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-all.py77
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-default.py77
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/builddir.gypi21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func1.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func2.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func3.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func4.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func5.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.gyp30
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.c15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/gyptest-cflags.py65
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/gyptest-headers.py29
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/headers.gyp26
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.cpp7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.hpp6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/program.cpp9
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.c15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.gyp32
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/gyptest-configurations.py29
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.c21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.gyp40
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/gyptest-inheritance.py33
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/actions.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/all_dependent_settings.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/configurations.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/dependencies.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/direct_dependent_settings.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/gyptest-configurations.py38
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/libraries.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/link_settings.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/sources.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/target_name.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/type.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/configurations.gyp58
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/front.c8
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/gyptest-target_platform.py40
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/left.c3
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/right.c3
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.c12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.gyp26
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/gyptest-x86.py29
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/gyptest-copies-link.py21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copies-link.gyp61
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copy.py21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/func1.c5
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/main.c9
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-all.py40
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-default.py40
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/copies.gyp70
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file41
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/subdir/file51
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/parentdir/subdir/file61
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.cc15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/gyptest-cxxflags.py65
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.c11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/gyptest-defines-escaping.py182
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines-env.gyp22
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.c14
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.gyp36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-define-override.py34
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env-regyp.py49
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env.py85
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines.py25
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/a.c9
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.c3
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.c4
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.gyp22
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/d.c3
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/extra_targets.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-extra-targets.py21
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-lib-only.py33
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/lib_only.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/gyptest-copy.py26
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/copies.gyp25
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file1.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file2.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/exclusion.gyp23
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/gyptest-exclusion.py22
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/hello.c15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/actions.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/actions-out/README.txt4
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/executable.gyp44
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog1.py20
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog2.py20
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/program.c12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/actions-out/README.txt4
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/make-file.py11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/none.gyp31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies-out/README.txt4
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies.gyp50
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/copies-out/README.txt4
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file41
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/subdir.gyp32
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-actions.py57
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-copies.py57
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-relocate.py59
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-rules.py58
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-subdir2-deep.py36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-top-all.py53
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/copy-file.py12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/rules.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define3.in01
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define4.in01
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/executable.gyp59
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function1.in16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function2.in16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/program.c18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file1.in01
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file2.in01
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file3.in11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file4.in11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/none.gyp49
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/rules-out/README.txt4
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc1/include1.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.c18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.gyp28
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/inc2/include2.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.c18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.gyp28
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/inc3/include3.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.c18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.gyp25
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/symroot.gypi16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-all.py24
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-default.py24
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-disable-regyp.py32
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-regyp.py32
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-target.py24
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.c11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.c11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py44
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes.py30
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home/.gyp/include.gypi5
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home2/.gyp/include.gypi5
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/all.gyp22
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/printfoo.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-all.py46
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-default.py46
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc1/include1.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.c19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.gyp27
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow1/shadow.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow2/shadow.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc2/include2.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.c14
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.gyp20
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/README.txt17
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCmd.py1591
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCommon.py581
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestGyp.py724
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared-obj-install-path.py37
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared.py84
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-static.py84
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1_moveable.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2_moveable.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/library.gyp58
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/program.c15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/shared_dependency.gyp33
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/base.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/extra.c5
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/gyptest-all.py25
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/link-objects.gyp24
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/dependencies.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-dependencies.py31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-noload.py57
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/main.cc12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/main.h (renamed from src/3rdparty/webkit/WebCore/dom/PositionCreationFunctions.h)0
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/all.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.c3
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.h1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/main.c9
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/gyptest-default.py28
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib1.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib2.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/module.gyp55
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/program.c111
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/base/base.gyp22
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/express.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/gyptest-express.py29
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/gyptest-all.py23
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.c14
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello2.c13
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/precomp.c8
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-all.py35
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-default.py35
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/common.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/multiple.gyp24
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog1.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog2.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/gyptest-no-output.py19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/src/nooutput.gyp17
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/gyptest-product.py43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/hello.c15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/product.gyp128
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/gyptest-all.py70
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/gyptest-default.py70
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/src/main.c12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/src/make-sources.py15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/src/prog1.in7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/src/prog2.in7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/src/same_target.gyp31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/gyptest-all.py50
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/gyptest-default.py50
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/actions.gyp19
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/copy-file.py11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir1/executable.gyp37
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir1/function1.in6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir1/function2.in6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir1/program.c12
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir2/file1.in1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir2/file2.in1
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir2/never_used.gyp31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir2/no_inputs.gyp32
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir2/none.gyp33
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir3/executable2.gyp37
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir3/function3.in6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules/src/subdir3/program.c10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-gyp-name/gyptest-all.py34
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-gyp-name/gyptest-default.py34
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-gyp-name/src/all.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-gyp-name/src/subdir1/executable.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-gyp-name/src/subdir1/main1.cc6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-gyp-name/src/subdir2/executable.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-gyp-name/src/subdir2/main2.cc6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/gyptest-all.py34
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/gyptest-default.py34
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/src/all.gyp38
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/src/func.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/src/prog1.c16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/src/prog2.c16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/src/subdir1/func.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-name/src/subdir2/func.c6
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-target-name/gyptest-same-target-name.py18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-target-name/src/all.gyp16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-target-name/src/executable1.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/same-target-name/src/executable2.gyp15
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/scons_tools/gyptest-tools.py26
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/scons_tools/site_scons/site_tools/this_tool.py10
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/scons_tools/tools.c13
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/scons_tools/tools.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/sibling/gyptest-all.py39
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/sibling/gyptest-relocate.py41
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/sibling/src/prog1/prog1.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/sibling/src/prog1/prog1.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/sibling/src/prog2/prog2.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/sibling/src/prog2/prog2.gyp15
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/small/gyptest-small.py49
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/gyptest-SYMROOT-all.py36
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/gyptest-SYMROOT-default.py37
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/gyptest-subdir-all.py33
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/gyptest-subdir-default.py32
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/gyptest-subdir2-deep.py25
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/gyptest-top-all.py43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/gyptest-top-default.py43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/src/prog1.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/src/prog1.gyp21
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/src/subdir/prog2.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/src/subdir/prog2.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/src/subdir/subdir2/prog3.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/subdirectory/src/symroot.gypi16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toolsets/gyptest-toolsets.py23
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toolsets/main.cc11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toolsets/toolsets.cc11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toolsets/toolsets.gyp38
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toplevel-dir/gyptest-toplevel-dir.py31
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toplevel-dir/src/sub1/main.gyp18
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toplevel-dir/src/sub1/prog1.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toplevel-dir/src/sub2/prog2.c7
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/toplevel-dir/src/sub2/prog2.gyp15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands-repeated.gyp128
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands-repeated.gyp.stdout405
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands-repeated.gypd.golden72
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands.gyp84
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands.gyp.ignore-env.stdout254
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands.gyp.stdout254
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands.gypd.golden54
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/commands.gypi16
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/gyptest-commands-ignore-env.py51
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/gyptest-commands-repeated.py45
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/gyptest-commands.py44
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/update_golden11
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/filelist/filelist.gyp.stdout174
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/filelist/filelist.gypd.golden43
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/filelist/gyptest-filelist.py55
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/filelist/src/filelist.gyp93
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/filelist/update_golden8
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variants/gyptest-variants.py45
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variants/src/variants.c13
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/test/variants/src/variants.gyp27
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/tools/README15
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/gyp/tools/pretty_gyp.py142
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/tools/pretty_sln.py167
-rwxr-xr-xsrc/3rdparty/webkit/Source/ThirdParty/gyp/tools/pretty_vcproj.py316
-rw-r--r--src/3rdparty/webkit/Source/ThirdParty/mt19937ar.c (renamed from src/3rdparty/webkit/JavaScriptCore/wtf/wince/mt19937ar.c)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/CMakeLists.txt2142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/CMakeListsEfl.txt272
-rw-r--r--src/3rdparty/webkit/Source/WebCore/CMakeListsWinCE.txt143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog64936
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2002-12-03 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2002-12-03)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2003-10-25 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2003-10-25)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2005-08-23 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2005-08-23)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2005-12-19 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2005-12-19)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2006-05-10 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2006-05-10)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2006-12-31 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2006-12-31)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2007-10-14 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2007-10-14)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2008-08-10 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2008-08-10)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2009-06-16 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2009-06-16)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2010-01-29 (renamed from src/3rdparty/webkit/WebCore/ChangeLog-2010-01-29)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2010-05-2455179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2010-12-06135224
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog-2011-02-1647896
-rw-r--r--src/3rdparty/webkit/Source/WebCore/CodeGenerators.pri771
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/debugger/Debugger.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/debugger/Debugger.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/debugger/DebuggerActivation.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/debugger/DebuggerActivation.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/debugger/DebuggerCallFrame.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/debugger/DebuggerCallFrame.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/heap/Heap.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/heap/Strong.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/heap/Weak.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/interpreter/CallFrame.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/interpreter/CallFrame.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/interpreter/Interpreter.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/interpreter/Interpreter.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/jit/JITCode.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/jit/JITCode.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/masm/X86Assembler.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/masm/X86Assembler.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/parser/SourceCode.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/parser/SourceCode.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/parser/SourceProvider.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/parser/SourceProvider.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/profiler/Profile.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/profiler/Profile.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/profiler/ProfileNode.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/profiler/ProfileNode.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/profiler/Profiler.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/profiler/Profiler.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/ArgList.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/ArgList.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/ArrayPrototype.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/ArrayPrototype.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/BooleanObject.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/BooleanObject.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/CallData.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/CallData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/Completion.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Completion.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/ConstructData.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/ConstructData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/DateInstance.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/DateInstance.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/Error.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Error.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/ExceptionHelpers.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/ExceptionHelpers.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/FunctionConstructor.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/FunctionConstructor.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/FunctionPrototype.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/FunctionPrototype.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/Identifier.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Identifier.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/InitializeThreading.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/InternalFunction.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/InternalFunction.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSAPIValueWrapper.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSAPIValueWrapper.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSArray.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSArray.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSByteArray.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSByteArray.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSCell.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSCell.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSFunction.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSFunction.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSGlobalData.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSGlobalData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSGlobalObject.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSGlobalObject.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSLock.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSLock.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSObject.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSObject.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSObjectWithGlobalObject.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSString.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSString.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/JSValue.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/Lookup.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Lookup.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/ObjectPrototype.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/ObjectPrototype.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/Operations.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Operations.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/PropertyNameArray.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/PropertyNameArray.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/Protect.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Protect.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/PrototypeFunction.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/PrototypeFunction.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/RegExp.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/RegExpObject.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/RopeImpl.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/ScopeChain.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/StringObject.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StringObject.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/StringObjectThatMasqueradesAsUndefined.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StringObjectThatMasqueradesAsUndefined.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/StringPrototype.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StringPrototype.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/Structure.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Structure.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/StructureChain.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StructureChain.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/SymbolTable.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/SymbolTable.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/UString.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/UString.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/UStringBuilder.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/UStringImpl.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/UStringImpl.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/WeakGCMap.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/WeakGCMap.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/runtime/WriteBarrier.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ASCIICType.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ASCIICType.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/AVLTree.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Alignment.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/AlwaysInline.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/AlwaysInline.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Assertions.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Assertions.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Atomics.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Bitmap.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/BloomFilter.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/BumpPointerAllocator.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ByteArray.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ByteArray.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Complex.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/CrossThreadRefCounted.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/CrossThreadRefCounted.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/CryptographicallyRandomNumber.h5
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/CurrentTime.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/CurrentTime.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/DateInstanceCache.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/DateInstanceCache.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/DateMath.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/DateMath.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/DecimalNumber.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Decoder.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Deque.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Deque.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/DisallowCType.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/DisallowCType.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/DoublyLinkedList.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/DynamicAnnotations.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Encoder.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/FastAllocBase.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/FastAllocBase.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/FastMalloc.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/FastMalloc.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/FixedArray.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Forward.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Forward.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/GetPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/GetPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/HashCountedSet.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/HashCountedSet.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/HashFunctions.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/HashFunctions.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/HashMap.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/HashMap.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/HashSet.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/HashSet.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/HashTable.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/HashTable.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/HashTraits.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/HashTraits.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/HexNumber.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ListHashSet.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ListHashSet.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ListRefPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ListRefPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Locker.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Locker.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/MD5.h5
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/MainThread.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/MainThread.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/MathExtras.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/MathExtras.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/MessageQueue.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/MessageQueue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/NonCopyingSort.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Noncopyable.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Noncopyable.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/NotFound.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/NotFound.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/OSAllocator.h1
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/OwnArrayPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/OwnArrayPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/OwnFastMallocPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/OwnFastMallocPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/OwnPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/OwnPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/OwnPtrCommon.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/OwnPtrCommon.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PageAllocation.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PageAllocationAligned.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PageBlock.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PageReservation.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ParallelJobs.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PassOwnArrayPtr.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PassOwnPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/PassOwnPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PassRefPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/PassRefPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Platform.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Platform.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/PossiblyNull.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/PossiblyNull.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/RandomNumber.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/RandomNumber.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/RefCounted.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/RefCounted.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/RefCountedLeakCounter.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/RefCountedLeakCounter.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/RefPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/RefPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/RetainPtr.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/RetainPtr.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/SHA1.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/StackBounds.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/StaticConstructors.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/StdLibExtras.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/StdLibExtras.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/StringExtras.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/StringExtras.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/StringHasher.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ThreadSafeRefCounted.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ThreadSpecific.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ThreadSpecific.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Threading.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Threading.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ThreadingPrimitives.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/TypeTraits.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/TypeTraits.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/UnusedParam.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/UnusedParam.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/VMTags.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/VMTags.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/ValueCheck.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ValueCheck.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/Vector.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/Vector.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/VectorTraits.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/VectorTraits.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/WTFThreadData.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/dtoa.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/dtoa.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/AtomicString.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/AtomicStringHash.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/AtomicStringImpl.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/CString.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/StringBuffer.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/StringBuilder.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StringBuilder.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/StringConcatenate.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/StringHash.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/StringImpl.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/StringImplBase.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/TextPosition.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/text/WTFString.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/unicode/CharacterNames.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/unicode/Collator.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/unicode/Collator.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/unicode/UTF8.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/unicode/UTF8.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/unicode/Unicode.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/unicode/Unicode.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h (renamed from src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/wtf/unicode/wince/UnicodeWince.h4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/yarr/Yarr.h5
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/yarr/YarrInterpreter.h5
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/yarr/YarrPattern.h5
-rw-r--r--src/3rdparty/webkit/Source/WebCore/GNUmakefile.list.am4593
-rw-r--r--src/3rdparty/webkit/Source/WebCore/Info.plist24
-rw-r--r--src/3rdparty/webkit/Source/WebCore/LICENSE-APPLE (renamed from src/3rdparty/webkit/WebCore/LICENSE-APPLE)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/LICENSE-LGPL-2 (renamed from src/3rdparty/webkit/WebCore/LICENSE-LGPL-2)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/LICENSE-LGPL-2.1 (renamed from src/3rdparty/webkit/WebCore/LICENSE-LGPL-2.1)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/aliasCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/aliasCursor.png)bin752 -> 752 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/cellCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/cellCursor.png)bin183 -> 183 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/contextMenuCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/contextMenuCursor.png)bin523 -> 523 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/copyCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/copyCursor.png)bin1652 -> 1652 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/crossHairCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/crossHairCursor.png)bin319 -> 319 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/deleteButton.png (renamed from src/3rdparty/webkit/WebCore/Resources/deleteButton.png)bin2230 -> 2230 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/deleteButton.tiff (renamed from src/3rdparty/webkit/WebCore/Resources/deleteButton.tiff)bin2546 -> 2546 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/deleteButtonPressed.png (renamed from src/3rdparty/webkit/WebCore/Resources/deleteButtonPressed.png)bin2319 -> 2319 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/deleteButtonPressed.tiff (renamed from src/3rdparty/webkit/WebCore/Resources/deleteButtonPressed.tiff)bin2550 -> 2550 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/eastResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/eastResizeCursor.png)bin123 -> 123 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/eastWestResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/eastWestResizeCursor.png)bin126 -> 126 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/helpCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/helpCursor.png)bin239 -> 239 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/inputSpeech.pngbin0 -> 1685 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/inputSpeech.tiffbin0 -> 5184 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/linkCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/linkCursor.png)bin341 -> 341 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/missingImage.png (renamed from src/3rdparty/webkit/WebCore/Resources/missingImage.png)bin411 -> 411 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/missingImage.tiff (renamed from src/3rdparty/webkit/WebCore/Resources/missingImage.tiff)bin654 -> 654 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/moveCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/moveCursor.png)bin175 -> 175 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/noDropCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/noDropCursor.png)bin1455 -> 1455 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/noneCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/noneCursor.png)bin90 -> 90 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/northEastResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/northEastResizeCursor.png)bin209 -> 209 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/northEastSouthWestResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/northEastSouthWestResizeCursor.png)bin212 -> 212 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/northResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/northResizeCursor.png)bin125 -> 125 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/northSouthResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/northSouthResizeCursor.png)bin144 -> 144 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/northWestResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/northWestResizeCursor.png)bin174 -> 174 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/northWestSouthEastResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/northWestSouthEastResizeCursor.png)bin193 -> 193 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/notAllowedCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/notAllowedCursor.png)bin1101 -> 1101 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/nullPlugin.png (renamed from src/3rdparty/webkit/WebCore/Resources/nullPlugin.png)bin1286 -> 1286 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/panIcon.png (renamed from src/3rdparty/webkit/WebCore/Resources/panIcon.png)bin175 -> 175 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/progressCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/progressCursor.png)bin1791 -> 1791 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/southEastResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/southEastResizeCursor.png)bin166 -> 166 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/southResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/southResizeCursor.png)bin128 -> 128 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/southWestResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/southWestResizeCursor.png)bin177 -> 177 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/textAreaResizeCorner.png (renamed from src/3rdparty/webkit/WebCore/Resources/textAreaResizeCorner.png)bin146 -> 146 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/textAreaResizeCorner.tiff (renamed from src/3rdparty/webkit/WebCore/Resources/textAreaResizeCorner.tiff)bin254 -> 254 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/urlIcon.png (renamed from src/3rdparty/webkit/WebCore/Resources/urlIcon.png)bin819 -> 819 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/verticalTextCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/verticalTextCursor.png)bin120 -> 120 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/waitCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/waitCursor.png)bin125 -> 125 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/westResizeCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/westResizeCursor.png)bin122 -> 122 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/zoomInCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/zoomInCursor.png)bin199 -> 199 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/Resources/zoomOutCursor.png (renamed from src/3rdparty/webkit/WebCore/Resources/zoomOutCursor.png)bin182 -> 182 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/UseJSC.cmake202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCore.exp.in1860
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCore.gypi7913
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCore.order29850
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCore.pri368
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCore.pro3524
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCore.qrc18
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCorePrefix.cpp (renamed from src/3rdparty/webkit/WebCore/WebCorePrefix.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/WebCorePrefix.h160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AXObjectCache.cpp640
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AXObjectCache.h198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityARIAGrid.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityARIAGridCell.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityARIAGridCell.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityARIAGridRow.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityARIAGridRow.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityAllInOne.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityImageMapLink.cpp150
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityImageMapLink.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityList.cpp (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityList.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityListBox.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityListBox.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityListBoxOption.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMediaControls.cpp331
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMediaControls.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityMediaControls.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMenuList.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMenuList.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMenuListOption.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMenuListOption.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityMenuListPopup.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListPopup.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityObject.cpp1102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityObject.h617
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityProgressIndicator.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityRenderObject.cpp3742
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityRenderObject.h330
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityScrollView.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityScrollView.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityScrollbar.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityScrollbar.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilitySlider.cpp203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilitySlider.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTable.cpp567
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTable.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableCell.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableCell.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableCell.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableColumn.cpp200
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableColumn.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableColumn.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableHeaderContainer.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableRow.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityTableRow.h (renamed from src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableRow.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/efl/AccessibilityObjectEfl.cpp36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/accessibility/qt/AccessibilityObjectQt.cpp (renamed from src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/ScriptControllerBase.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/ScriptControllerBase.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMCString.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMCString.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMCustomVoidCallback.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMCustomVoidCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMDOMWindowCustom.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMEventTarget.cpp206
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMEventTarget.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMHTMLCollectionCustom.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMHTMLOptionsCollectionCustom.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMNodeCustom.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMNodeFilterCustom.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMObject.h32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMString.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebDOMString.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebExceptionHandler.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebExceptionHandler.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebNativeEventListener.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebNativeEventListener.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebNativeNodeFilterCondition.cpp40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/cpp/WebNativeNodeFilterCondition.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/ActiveDOMCallback.cpp142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/ActiveDOMCallback.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/BindingSecurity.h156
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/BindingSecurityBase.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/BindingSecurityBase.h (renamed from src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurityBase.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/GenericBinding.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/ConvertToUTF8String.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/ConvertToUTF8String.h35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/DOMObjectCache.cpp154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/DOMObjectCache.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/GNUmakefile.am438
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/GObjectEventListener.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/GObjectEventListener.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitDOMBinding.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitDOMObject.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitDOMObject.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp556
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/CachedScriptSourceProvider.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/CallbackFunction.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/CallbackFunction.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/DOMObjectHashTableMap.cpp (renamed from src/3rdparty/webkit/WebCore/bindings/js/DOMObjectHashTableMap.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/DOMObjectHashTableMap.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/DOMWrapperWorld.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/DOMWrapperWorld.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/GCController.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/GCController.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/IDBBindingUtilities.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/IDBBindingUtilities.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSAttrCustom.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSAudioConstructor.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSAudioConstructor.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSAudioContextCustom.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSAudioNodeCustom.cpp75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCDATASectionCustom.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSFontFaceRuleCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSImportRuleCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSMediaRuleCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSPageRuleCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp199
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSCSSStyleDeclarationCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSStyleRuleCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCSSValueCustom.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCallbackData.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCallbackData.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp448
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSClipboardCustom.cpp131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSConsoleCustom.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSConvolverNodeCustom.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCoordinatesCustom.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomPositionCallback.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomPositionCallback.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSCustomPositionCallback.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomPositionErrorCallback.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSCustomPositionErrorCallback.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomVoidCallback.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomVoidCallback.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSCustomXPathNSResolver.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMBinding.cpp347
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMBinding.h305
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMGlobalObject.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMImplementationCustom.cpp32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMPluginCustom.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMStringMapCustom.h31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMTokenListCustom.cpp37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWindowBase.cpp223
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWindowBase.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp789
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWindowCustom.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWindowShell.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWindowShell.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWrapper.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWrapper.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDataViewCustom.cpp159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDirectoryEntryCustom.cpp142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDirectoryEntrySyncCustom.cpp101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSDocumentCustom.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSElementCustom.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEntryCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEntrySyncCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSErrorHandler.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSErrorHandler.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEventCustom.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEventListener.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEventListener.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEventSourceCustom.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEventTarget.cpp243
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSEventTarget.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSExceptionBase.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSExceptionBase.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSExceptionBase.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSFileReaderCustom.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSGeolocationCustom.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAppletElementCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSHTMLEmbedElementCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLInputElementCustom.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLInputElementCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSHTMLInputElementCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSHTMLObjectElementCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLOutputElementCustom.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLSelectElementCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSHTMLSelectElementCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHTMLStyleElementCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHistoryCustom.cpp213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSHistoryCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSHistoryCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSIDBKeyCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSImageConstructor.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSImageConstructor.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSImageDataCustom.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSLazyEventListener.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSLazyEventListener.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSLocationCustom.cpp289
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSLocationCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSLocationCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMainThreadExecState.cpp33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMainThreadExecState.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMediaListCustom.cpp36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMemoryInfoCustom.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMessageChannelCustom.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMessageEventCustom.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMessagePortCustom.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSMessagePortCustom.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNavigatorCustom.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNodeCustom.cpp278
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNodeCustom.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNodeFilterCondition.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNodeIteratorCustom.cpp40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSNodeListCustom.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSOptionConstructor.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSOptionConstructor.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSPluginElementFunctions.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSProcessingInstructionCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSSVGPathSegCustom.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSScriptProfileNodeCustom.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSStorageCustom.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSStorageCustom.h (renamed from src/3rdparty/webkit/WebCore/bindings/js/JSStorageCustom.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSTextCustom.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSTouchCustom.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSTouchListCustom.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSTreeWalkerCustom.cpp40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp711
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebKitAnimationCustom.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebKitAnimationListCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebKitPointCustom.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWebSocketCustom.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWorkerContextBase.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWorkerContextBase.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWorkerContextCustom.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSWorkerCustom.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JSXSLTProcessorCustom.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/JavaScriptCallFrame.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/OptionsObject.h31
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/bindings/js/PageScriptDebugServer.cpp215
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/bindings/js/PageScriptDebugServer.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScheduledAction.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScheduledAction.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptCachedFrameData.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptCallStackFactory.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptController.cpp520
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptController.h206
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerBrew.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerEfl.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerGtk.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerHaiku.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerMac.mm171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerQt.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerWin.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptControllerWx.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptDebugServer.cpp452
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptDebugServer.h143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptEventListener.cpp114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptEventListener.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptFunctionCall.cpp226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptFunctionCall.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptGCEvent.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptGCEvent.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptHeapSnapshot.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptInstance.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptObject.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptObject.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptProfile.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptProfile.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptProfileNode.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptProfiler.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptProfiler.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptSourceCode.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptSourceProvider.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptState.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptState.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptValue.cpp172
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptValue.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptWrappable.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/SerializedScriptValue.cpp1447
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/SerializedScriptValue.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/StringSourceProvider.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/WebCoreJSClientData.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/WorkerScriptController.cpp176
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/js/WorkerScriptController.h96
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp55
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/bindings/js/WorkerScriptDebugServer.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/CodeGenerator.pm580
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm961
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm1356
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm3046
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm1815
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm3300
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/IDLParser.pm439
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/IDLStructure.pm112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/InFilesParser.pm154
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/bindings/scripts/generate-bindings.pl83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/gobject-generate-headers.pl77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestMediaQueryListListener.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestMediaQueryListListener.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp834
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h174
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp235
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackPrivate.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfacePrivate.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListenerPrivate.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp1807
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h318
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObjPrivate.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterfacePrivate.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp1643
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h205
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackInternal.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceInternal.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestMediaQueryListListener.h37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestMediaQueryListListener.mm95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestMediaQueryListListenerInternal.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm712
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObjInternal.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterfaceInternal.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/TestCallback.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/TestInterface.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/TestMediaQueryListListener.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/TestObj.idl175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp164
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp1393
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/Bridge.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/IdentifierRep.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/IdentifierRep.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/NP_jsobject.cpp533
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/NP_jsobject.h (renamed from src/3rdparty/webkit/WebCore/bridge/NP_jsobject.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/CRuntimeObject.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/CRuntimeObject.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_class.cpp122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_class.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_instance.cpp325
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_instance.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_runtime.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_runtime.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_utility.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/c/c_utility.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JNIUtility.cpp401
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JNIUtility.h260
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JavaMethod.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JavaMethodJobject.cpp159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JavaMethodJobject.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JavaString.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JavaType.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JobjectWrapper.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/JobjectWrapper.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jni_jsobject.h133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jni_jsobject.mm705
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jni_objc.mm84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp320
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaArrayJSC.cpp246
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaArrayJSC.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaClassJSC.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaClassJSC.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaFieldJSC.cpp244
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaFieldJSC.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp335
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jni/jsc/JavaStringJSC.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jsc/BridgeJSC.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/jsc/BridgeJSC.h156
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/bridge/make_testbindings (renamed from src/3rdparty/webkit/WebCore/bridge/make_testbindings)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/npapi.h901
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/npruntime.cpp (renamed from src/3rdparty/webkit/WebCore/bridge/npruntime.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/npruntime.h393
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/npruntime_impl.h (renamed from src/3rdparty/webkit/WebCore/bridge/npruntime_impl.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/npruntime_internal.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/npruntime_priv.h (renamed from src/3rdparty/webkit/WebCore/bridge/npruntime_priv.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/nptypes.h121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_class.cpp225
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_class.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_instance.cpp395
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_instance.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_pixmapruntime.cpp367
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_pixmapruntime.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_runtime.cpp1929
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/qt/qt_runtime.h242
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_array.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_array.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_method.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_method.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_object.cpp317
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_object.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_root.cpp195
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/runtime_root.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/test.js (renamed from src/3rdparty/webkit/WebCore/bridge/test.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/testC.js (renamed from src/3rdparty/webkit/WebCore/bridge/testC.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/testM.js (renamed from src/3rdparty/webkit/WebCore/bridge/testM.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/testbindings.cpp419
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/testbindings.mm287
-rw-r--r--src/3rdparty/webkit/Source/WebCore/bridge/testqtbindings.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/config.h255
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSBorderImageValue.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSBorderImageValue.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSCanvasValue.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSCanvasValue.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSCharsetRule.cpp (renamed from src/3rdparty/webkit/WebCore/css/CSSCharsetRule.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSCharsetRule.h (renamed from src/3rdparty/webkit/WebCore/css/CSSCharsetRule.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSCharsetRule.idl (renamed from src/3rdparty/webkit/WebCore/css/CSSCharsetRule.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSComputedStyleDeclaration.cpp1889
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSComputedStyleDeclaration.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSCursorImageValue.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSCursorImageValue.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFace.cpp133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFace.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFaceRule.cpp (renamed from src/3rdparty/webkit/WebCore/css/CSSFontFaceRule.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFaceRule.h (renamed from src/3rdparty/webkit/WebCore/css/CSSFontFaceRule.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFaceRule.idl (renamed from src/3rdparty/webkit/WebCore/css/CSSFontFaceRule.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFaceSource.cpp211
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFaceSource.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFaceSrcValue.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontFaceSrcValue.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontSelector.cpp565
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFontSelector.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFunctionValue.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSFunctionValue.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSGradientValue.cpp860
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSGradientValue.h173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSGrammar.y1658
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSHelper.h36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSImageGeneratorValue.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSImageGeneratorValue.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSImageValue.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSImageValue.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSImportRule.cpp173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSImportRule.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSImportRule.idl30
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSInheritedValue.cpp (renamed from src/3rdparty/webkit/WebCore/css/CSSInheritedValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSInheritedValue.h (renamed from src/3rdparty/webkit/WebCore/css/CSSInheritedValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSInitialValue.cpp (renamed from src/3rdparty/webkit/WebCore/css/CSSInitialValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSInitialValue.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSLineBoxContainValue.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSLineBoxContainValue.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSMediaRule.cpp135
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSMediaRule.h (renamed from src/3rdparty/webkit/WebCore/css/CSSMediaRule.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSMediaRule.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSMutableStyleDeclaration.cpp883
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSMutableStyleDeclaration.h235
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSMutableValue.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSNamespace.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSOMUtils.cpp123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSOMUtils.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPageRule.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPageRule.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPageRule.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSParser.cpp6816
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSParser.h390
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSParserValues.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSParserValues.h138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPrimitiveValue.cpp840
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPrimitiveValue.h244
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPrimitiveValue.idl (renamed from src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPrimitiveValueCache.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPrimitiveValueCache.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPrimitiveValueMappings.h3057
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSProperty.cpp285
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSProperty.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPropertyLonghand.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPropertyLonghand.h (renamed from src/3rdparty/webkit/WebCore/css/CSSPropertyLonghand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPropertyNames.in327
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPropertySourceData.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSPropertySourceData.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSQuirkPrimitiveValue.h (renamed from src/3rdparty/webkit/WebCore/css/CSSQuirkPrimitiveValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSReflectValue.cpp (renamed from src/3rdparty/webkit/WebCore/css/CSSReflectValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSReflectValue.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSReflectionDirection.h (renamed from src/3rdparty/webkit/WebCore/css/CSSReflectionDirection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSRule.cpp (renamed from src/3rdparty/webkit/WebCore/css/CSSRule.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSRule.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSRule.idl52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSRuleList.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSRuleList.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSRuleList.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSSegmentedFontFace.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSSegmentedFontFace.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSSelector.cpp831
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSSelector.h361
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSSelectorList.cpp173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSSelectorList.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleApplyProperty.cpp511
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleApplyProperty.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleDeclaration.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleDeclaration.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleDeclaration.idl53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleRule.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleRule.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleRule.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleSelector.cpp7141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleSelector.h363
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleSheet.cpp300
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleSheet.h125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSStyleSheet.idl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSTimingFunctionValue.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSTimingFunctionValue.h125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSUnicodeRangeValue.cpp (renamed from src/3rdparty/webkit/WebCore/css/CSSUnicodeRangeValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSUnicodeRangeValue.h (renamed from src/3rdparty/webkit/WebCore/css/CSSUnicodeRangeValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSUnknownRule.h (renamed from src/3rdparty/webkit/WebCore/css/CSSUnknownRule.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSUnknownRule.idl (renamed from src/3rdparty/webkit/WebCore/css/CSSUnknownRule.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSValue.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSValue.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSValueKeywords.in806
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSValueList.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSValueList.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/CSSValueList.idl (renamed from src/3rdparty/webkit/WebCore/css/CSSValueList.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/Counter.h (renamed from src/3rdparty/webkit/WebCore/css/Counter.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/Counter.idl (renamed from src/3rdparty/webkit/WebCore/css/Counter.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/DashboardRegion.h (renamed from src/3rdparty/webkit/WebCore/css/DashboardRegion.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/DashboardSupportCSSPropertyNames.in (renamed from src/3rdparty/webkit/WebCore/css/DashboardSupportCSSPropertyNames.in)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/FontFamilyValue.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/FontFamilyValue.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/FontValue.cpp (renamed from src/3rdparty/webkit/WebCore/css/FontValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/FontValue.h (renamed from src/3rdparty/webkit/WebCore/css/FontValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaFeatureNames.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaFeatureNames.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaList.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaList.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaList.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQuery.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQuery.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryEvaluator.cpp540
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryEvaluator.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryExp.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryExp.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryList.cpp94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryList.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryList.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryListListener.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryListListener.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryListListener.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryMatcher.cpp156
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/MediaQueryMatcher.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/Pair.h (renamed from src/3rdparty/webkit/WebCore/css/Pair.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/RGBColor.cpp (renamed from src/3rdparty/webkit/WebCore/css/RGBColor.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/RGBColor.h (renamed from src/3rdparty/webkit/WebCore/css/RGBColor.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/RGBColor.idl (renamed from src/3rdparty/webkit/WebCore/css/RGBColor.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/Rect.h (renamed from src/3rdparty/webkit/WebCore/css/Rect.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/Rect.idl (renamed from src/3rdparty/webkit/WebCore/css/Rect.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/SVGCSSParser.cpp356
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/SVGCSSPropertyNames.in51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/SVGCSSStyleSelector.cpp613
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/SVGCSSValueKeywords.in278
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/ShadowValue.cpp (renamed from src/3rdparty/webkit/WebCore/css/ShadowValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/ShadowValue.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleBase.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleBase.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleList.cpp (renamed from src/3rdparty/webkit/WebCore/css/StyleList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleList.h (renamed from src/3rdparty/webkit/WebCore/css/StyleList.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleMedia.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleMedia.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleMedia.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleSheet.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleSheet.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleSheet.idl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleSheetList.cpp (renamed from src/3rdparty/webkit/WebCore/css/StyleSheetList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleSheetList.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/StyleSheetList.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WCSSPropertyNames.in6
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WCSSValueKeywords.in (renamed from src/3rdparty/webkit/WebCore/css/WCSSValueKeywords.in)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSKeyframeRule.cpp (renamed from src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframeRule.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSKeyframeRule.h (renamed from src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframeRule.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSKeyframeRule.idl (renamed from src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframeRule.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSKeyframesRule.cpp160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSKeyframesRule.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSKeyframesRule.idl (renamed from src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSMatrix.cpp188
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSMatrix.h159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSMatrix.idl99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSTransformValue.cpp (renamed from src/3rdparty/webkit/WebCore/css/WebKitCSSTransformValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSTransformValue.h (renamed from src/3rdparty/webkit/WebCore/css/WebKitCSSTransformValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/WebKitCSSTransformValue.idl63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/fullscreen.css45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/fullscreenQuickTime.css154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/html.css895
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/css/make-css-file-arrays.pl (renamed from src/3rdparty/webkit/WebCore/css/make-css-file-arrays.pl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/makegrammar.pl (renamed from src/3rdparty/webkit/WebCore/css/makegrammar.pl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/makeprop.pl153
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/maketokenizer (renamed from src/3rdparty/webkit/WebCore/css/maketokenizer)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/makevalues.pl137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mathml.css238
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mediaControls.css187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mediaControlsChromium.css170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mediaControlsEfl.css182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mediaControlsGtk.css105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mediaControlsQt.css260
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mediaControlsQtFullscreen.css101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/mediaControlsQuickTime.css233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/quirks.css54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/svg.css (renamed from src/3rdparty/webkit/WebCore/css/svg.css)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/themeChromiumLinux.css41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/themeChromiumSkia.css37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/themeQtNoListboxes.css36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/themeWin.css127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/themeWinQuirks.css (renamed from src/3rdparty/webkit/WebCore/css/themeWinQuirks.css)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/tokenizer.flex125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/css/view-source.css158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ActiveDOMObject.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ActiveDOMObject.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Attr.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Attr.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Attr.idl51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Attribute.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Attribute.h121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeLoadEvent.h (renamed from src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeLoadEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeProcessEvent.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeProcessEvent.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeProcessEvent.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeTextInsertedEvent.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeTextInsertedEvent.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeUnloadEvent.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/BeforeUnloadEvent.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CDATASection.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CDATASection.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CDATASection.idl (renamed from src/3rdparty/webkit/WebCore/dom/CDATASection.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp (renamed from src/3rdparty/webkit/WebCore/dom/CSSMappedAttributeDeclaration.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CSSMappedAttributeDeclaration.h (renamed from src/3rdparty/webkit/WebCore/dom/CSSMappedAttributeDeclaration.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CharacterData.cpp232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CharacterData.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CharacterData.idl (renamed from src/3rdparty/webkit/WebCore/dom/CharacterData.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CheckedRadioButtons.cpp90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CheckedRadioButtons.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ChildNodeList.cpp (renamed from src/3rdparty/webkit/WebCore/dom/ChildNodeList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ChildNodeList.h (renamed from src/3rdparty/webkit/WebCore/dom/ChildNodeList.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClassNodeList.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClassNodeList.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClientRect.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClientRect.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClientRect.idl (renamed from src/3rdparty/webkit/WebCore/dom/ClientRect.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClientRectList.cpp (renamed from src/3rdparty/webkit/WebCore/dom/ClientRectList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClientRectList.h (renamed from src/3rdparty/webkit/WebCore/dom/ClientRectList.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClientRectList.idl (renamed from src/3rdparty/webkit/WebCore/dom/ClientRectList.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Clipboard.cpp161
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Clipboard.h121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Clipboard.idl49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClipboardAccessPolicy.h (renamed from src/3rdparty/webkit/WebCore/dom/ClipboardAccessPolicy.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClipboardEvent.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ClipboardEvent.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Comment.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Comment.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Comment.idl (renamed from src/3rdparty/webkit/WebCore/dom/Comment.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CompositionEvent.cpp (renamed from src/3rdparty/webkit/WebCore/dom/CompositionEvent.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CompositionEvent.h (renamed from src/3rdparty/webkit/WebCore/dom/CompositionEvent.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CompositionEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/CompositionEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ContainerNode.cpp1131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ContainerNode.h175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ContainerNodeAlgorithms.h (renamed from src/3rdparty/webkit/WebCore/dom/ContainerNodeAlgorithms.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CrossThreadTask.h477
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CustomEvent.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CustomEvent.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/CustomEvent.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMAllInOne.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMCoreException.h (renamed from src/3rdparty/webkit/WebCore/dom/DOMCoreException.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMCoreException.idl79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMImplementation.cpp366
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMImplementation.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMImplementation.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMStringList.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMStringList.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMStringList.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMStringMap.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMStringMap.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMStringMap.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DOMTimeStamp.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DataTransferItem.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DataTransferItem.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DataTransferItem.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DataTransferItems.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DataTransferItems.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DataTransferItems.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DatasetDOMStringMap.cpp209
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DatasetDOMStringMap.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DecodedDataDocumentParser.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DecodedDataDocumentParser.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionClient.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionController.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionController.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionData.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionData.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionEvent.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionEvent.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceMotionEvent.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientation.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientation.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientationClient.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientationController.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientationController.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientationEvent.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientationEvent.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DeviceOrientationEvent.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Document.cpp5050
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Document.h1421
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Document.idl339
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentFragment.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentFragment.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentFragment.idl30
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentMarker.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentMarkerController.cpp652
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentMarkerController.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentOrderedMap.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentOrderedMap.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentParser.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentParser.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentTiming.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentType.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentType.h (renamed from src/3rdparty/webkit/WebCore/dom/DocumentType.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DocumentType.idl (renamed from src/3rdparty/webkit/WebCore/dom/DocumentType.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DynamicNodeList.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/DynamicNodeList.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EditingText.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EditingText.h (renamed from src/3rdparty/webkit/WebCore/dom/EditingText.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Element.cpp1946
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Element.h552
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Element.idl216
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ElementRareData.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Entity.h (renamed from src/3rdparty/webkit/WebCore/dom/Entity.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Entity.idl (renamed from src/3rdparty/webkit/WebCore/dom/Entity.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EntityReference.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EntityReference.h (renamed from src/3rdparty/webkit/WebCore/dom/EntityReference.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EntityReference.idl (renamed from src/3rdparty/webkit/WebCore/dom/EntityReference.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ErrorEvent.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ErrorEvent.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ErrorEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/ErrorEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Event.cpp316
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Event.h230
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Event.idl91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventContext.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventContext.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.cpp396
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventException.h (renamed from src/3rdparty/webkit/WebCore/dom/EventException.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventException.idl51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventListener.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventListener.idl (renamed from src/3rdparty/webkit/WebCore/dom/EventListener.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventNames.cpp (renamed from src/3rdparty/webkit/WebCore/dom/EventNames.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventNames.h204
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventQueue.cpp148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventQueue.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventTarget.cpp420
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventTarget.h284
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/EventTarget.idl (renamed from src/3rdparty/webkit/WebCore/dom/EventTarget.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ExceptionBase.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ExceptionBase.h (renamed from src/3rdparty/webkit/WebCore/dom/ExceptionBase.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ExceptionCode.cpp355
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ExceptionCode.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/FragmentScriptingPermission.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/HashChangeEvent.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/HashChangeEvent.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/IconURL.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/IconURL.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/InputElement.cpp414
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/InputElement.h166
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/KeyboardEvent.cpp173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/KeyboardEvent.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/KeyboardEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/KeyboardEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MappedAttributeEntry.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessageChannel.cpp (renamed from src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessageChannel.h (renamed from src/3rdparty/webkit/WebCore/dom/MessageChannel.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessageChannel.idl42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessageEvent.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessageEvent.h (renamed from src/3rdparty/webkit/WebCore/dom/MessageEvent.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessageEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/MessageEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessagePort.cpp258
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessagePort.h131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessagePort.idl59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessagePortChannel.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MessagePortChannel.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MouseEvent.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MouseEvent.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MouseEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/MouseEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MouseRelatedEvent.cpp267
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MouseRelatedEvent.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MutationEvent.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MutationEvent.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/MutationEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/MutationEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NameNodeList.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NameNodeList.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NamedNodeMap.cpp363
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NamedNodeMap.h160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NamedNodeMap.idl59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Node.cpp2960
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Node.h746
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Node.idl163
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeFilter.cpp (renamed from src/3rdparty/webkit/WebCore/dom/NodeFilter.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeFilter.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeFilter.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeFilterCondition.cpp (renamed from src/3rdparty/webkit/WebCore/dom/NodeFilterCondition.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeFilterCondition.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeIterator.cpp234
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeIterator.h (renamed from src/3rdparty/webkit/WebCore/dom/NodeIterator.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeIterator.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeList.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeList.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeRareData.h147
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeRenderStyle.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/NodeWithIndex.h (renamed from src/3rdparty/webkit/WebCore/dom/NodeWithIndex.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Notation.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Notation.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Notation.idl (renamed from src/3rdparty/webkit/WebCore/dom/Notation.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/OptionElement.cpp148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/OptionElement.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/OptionGroupElement.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/OptionGroupElement.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/OverflowEvent.cpp (renamed from src/3rdparty/webkit/WebCore/dom/OverflowEvent.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/OverflowEvent.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/OverflowEvent.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PageTransitionEvent.cpp (renamed from src/3rdparty/webkit/WebCore/dom/PageTransitionEvent.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PageTransitionEvent.h (renamed from src/3rdparty/webkit/WebCore/dom/PageTransitionEvent.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PageTransitionEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/PageTransitionEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PendingScript.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PendingScript.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PopStateEvent.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PopStateEvent.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PopStateEvent.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Position.cpp1295
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Position.h264
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PositionCreationFunctions.h0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PositionIterator.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/PositionIterator.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ProcessingInstruction.cpp300
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ProcessingInstruction.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ProcessingInstruction.idl (renamed from src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ProgressEvent.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ProgressEvent.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ProgressEvent.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/QualifiedName.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/QualifiedName.h150
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Range.cpp2013
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Range.h173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Range.idl (renamed from src/3rdparty/webkit/WebCore/dom/Range.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RangeBoundaryPoint.h (renamed from src/3rdparty/webkit/WebCore/dom/RangeBoundaryPoint.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RangeException.h (renamed from src/3rdparty/webkit/WebCore/dom/RangeException.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RangeException.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RawDataDocumentParser.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RegisteredEventListener.cpp (renamed from src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RegisteredEventListener.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RenderedDocumentMarker.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RequestAnimationFrameCallback.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/RequestAnimationFrameCallback.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScopedEventQueue.cpp103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScopedEventQueue.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptElement.cpp384
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptElement.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptExecutionContext.cpp453
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptExecutionContext.h214
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptRunner.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptRunner.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptableDocumentParser.cpp37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptableDocumentParser.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptedAnimationController.cpp134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ScriptedAnimationController.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/SelectElement.cpp1091
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/SelectElement.h196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/SelectorNodeList.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/SelectorNodeList.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ShadowRoot.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ShadowRoot.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/SpaceSplitString.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/SpaceSplitString.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StaticHashSetNodeList.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StaticHashSetNodeList.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StaticNodeList.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StaticNodeList.h (renamed from src/3rdparty/webkit/WebCore/dom/StaticNodeList.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StringCallback.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StringCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StringCallback.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StyleElement.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StyleElement.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StyledElement.cpp466
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/StyledElement.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TagNodeList.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TagNodeList.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Text.cpp323
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Text.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Text.idl (renamed from src/3rdparty/webkit/WebCore/dom/Text.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TextEvent.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TextEvent.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TextEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/TextEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TextEventInputType.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Touch.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Touch.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Touch.idl (renamed from src/3rdparty/webkit/WebCore/dom/Touch.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TouchEvent.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TouchEvent.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TouchEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/TouchEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TouchList.cpp (renamed from src/3rdparty/webkit/WebCore/dom/TouchList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TouchList.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TouchList.idl (renamed from src/3rdparty/webkit/WebCore/dom/TouchList.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TransformSource.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TransformSourceLibxslt.cpp (renamed from src/3rdparty/webkit/WebCore/dom/TransformSourceLibxslt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TransformSourceQt.cpp (renamed from src/3rdparty/webkit/WebCore/dom/TransformSourceQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Traversal.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/Traversal.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TreeDepthLimit.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TreeScope.cpp141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TreeScope.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TreeWalker.cpp279
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TreeWalker.h (renamed from src/3rdparty/webkit/WebCore/dom/TreeWalker.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/TreeWalker.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UIEvent.cpp97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UIEvent.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UIEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/UIEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UIEventWithKeyState.cpp (renamed from src/3rdparty/webkit/WebCore/dom/UIEventWithKeyState.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UIEventWithKeyState.h (renamed from src/3rdparty/webkit/WebCore/dom/UIEventWithKeyState.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UserGestureIndicator.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UserGestureIndicator.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UserTypingGestureIndicator.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/UserTypingGestureIndicator.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ViewportArguments.cpp390
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/ViewportArguments.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WebKitAnimationEvent.cpp (renamed from src/3rdparty/webkit/WebCore/dom/WebKitAnimationEvent.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WebKitAnimationEvent.h (renamed from src/3rdparty/webkit/WebCore/dom/WebKitAnimationEvent.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WebKitAnimationEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/WebKitAnimationEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WebKitTransitionEvent.cpp (renamed from src/3rdparty/webkit/WebCore/dom/WebKitTransitionEvent.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WebKitTransitionEvent.h (renamed from src/3rdparty/webkit/WebCore/dom/WebKitTransitionEvent.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WebKitTransitionEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/WebKitTransitionEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WheelEvent.cpp126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WheelEvent.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WheelEvent.idl (renamed from src/3rdparty/webkit/WebCore/dom/WheelEvent.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WindowEventContext.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/WindowEventContext.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParser.cpp388
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParser.h233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp1518
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserQt.cpp722
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserScope.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserScope.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/default/PlatformMessagePortChannel.cpp244
-rw-r--r--src/3rdparty/webkit/Source/WebCore/dom/default/PlatformMessagePortChannel.h116
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/dom/make_names.pl1151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/AppendNodeCommand.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/AppendNodeCommand.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ApplyBlockElementCommand.cpp286
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ApplyBlockElementCommand.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ApplyStyleCommand.cpp1500
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ApplyStyleCommand.h137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/BreakBlockquoteCommand.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/BreakBlockquoteCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/BreakBlockquoteCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/CompositeEditCommand.cpp1250
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/CompositeEditCommand.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/CreateLinkCommand.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/CreateLinkCommand.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteButton.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteButton.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteButtonController.cpp358
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteButtonController.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteFromTextNodeCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/DeleteFromTextNodeCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteSelectionCommand.cpp839
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/DeleteSelectionCommand.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditAction.h (renamed from src/3rdparty/webkit/WebCore/editing/EditAction.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditCommand.cpp232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditCommand.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditingAllInOne.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditingBehavior.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditingBehaviorTypes.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditingBoundary.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditingStyle.cpp1085
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditingStyle.h210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/Editor.cpp3243
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/Editor.h454
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditorCommand.cpp1695
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditorDeleteAction.h (renamed from src/3rdparty/webkit/WebCore/editing/EditorDeleteAction.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/EditorInsertAction.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/FindOptions.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/FormatBlockCommand.cpp163
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/FormatBlockCommand.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/HTMLInterchange.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/HTMLInterchange.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/IndentOutdentCommand.cpp235
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/IndentOutdentCommand.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertIntoTextNodeCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/InsertIntoTextNodeCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertLineBreakCommand.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertLineBreakCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/InsertLineBreakCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertListCommand.cpp396
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertListCommand.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertNodeBeforeCommand.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertNodeBeforeCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/InsertNodeBeforeCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp388
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertParagraphSeparatorCommand.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertTextCommand.cpp248
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/InsertTextCommand.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/JoinTextNodesCommand.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/JoinTextNodesCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/JoinTextNodesCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/MarkupAccumulator.cpp473
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/MarkupAccumulator.h120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/MergeIdenticalElementsCommand.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/MergeIdenticalElementsCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/MergeIdenticalElementsCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ModifySelectionListLevel.cpp295
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ModifySelectionListLevel.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/MoveSelectionCommand.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/MoveSelectionCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/MoveSelectionCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveCSSPropertyCommand.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveFormatCommand.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveFormatCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/RemoveFormatCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveNodeCommand.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveNodeCommand.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp (renamed from src/3rdparty/webkit/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/RemoveNodePreservingChildrenCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ReplaceNodeWithSpanCommand.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ReplaceSelectionCommand.cpp1297
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/ReplaceSelectionCommand.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SelectionController.cpp1885
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SelectionController.h277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SetNodeAttributeCommand.cpp (renamed from src/3rdparty/webkit/WebCore/editing/SetNodeAttributeCommand.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SetNodeAttributeCommand.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SetSelectionCommand.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SetSelectionCommand.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SmartReplace.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SmartReplace.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SmartReplaceCF.cpp (renamed from src/3rdparty/webkit/WebCore/editing/SmartReplaceCF.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SmartReplaceICU.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SpellChecker.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SpellChecker.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SpellingCorrectionCommand.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SpellingCorrectionCommand.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SpellingCorrectionController.cpp507
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SpellingCorrectionController.h147
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SplitElementCommand.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SplitElementCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/SplitElementCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SplitTextNodeCommand.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SplitTextNodeCommand.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SplitTextNodeContainingElementCommand.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/SplitTextNodeContainingElementCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/SplitTextNodeContainingElementCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TextAffinity.h (renamed from src/3rdparty/webkit/WebCore/editing/TextAffinity.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TextCheckingHelper.cpp592
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TextCheckingHelper.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TextGranularity.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TextIterator.cpp2581
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TextIterator.h327
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TypingCommand.cpp680
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/TypingCommand.h136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/UnlinkCommand.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/UnlinkCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/UnlinkCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/VisiblePosition.cpp720
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/VisiblePosition.h149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/VisibleSelection.cpp675
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/VisibleSelection.h154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/WrapContentsInDummySpanCommand.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/WrapContentsInDummySpanCommand.h (renamed from src/3rdparty/webkit/WebCore/editing/WrapContentsInDummySpanCommand.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/WritingDirection.h31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/brew/EditorBrew.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/htmlediting.cpp1136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/htmlediting.h241
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/markup.cpp924
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/markup.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/qt/EditorQt.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/qt/SmartReplaceQt.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/visible_units.cpp1587
-rw-r--r--src/3rdparty/webkit/Source/WebCore/editing/visible_units.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/features.pri233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/AsyncFileWriter.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/AsyncFileWriterClient.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Blob.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Blob.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Blob.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/BlobURL.cpp76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/BlobURL.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFilePath.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFilePath.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystem.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystem.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystem.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystemBase.cpp248
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystemBase.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystemSync.cpp270
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystemSync.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DOMFileSystemSync.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryEntry.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryEntry.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryEntry.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryEntrySync.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryEntrySync.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryEntrySync.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryReader.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryReader.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryReader.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryReaderBase.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryReaderSync.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryReaderSync.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/DirectoryReaderSync.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntriesCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntriesCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Entry.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Entry.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Entry.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryArray.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryArray.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryArray.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryArraySync.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryArraySync.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryArraySync.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryBase.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryBase.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntryCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntrySync.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntrySync.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/EntrySync.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/ErrorCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/ErrorCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/File.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/File.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/File.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileCallback.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileEntry.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileEntry.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileEntry.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileEntrySync.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileEntrySync.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileEntrySync.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileError.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileError.idl53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileException.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileException.idl61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileList.cpp (renamed from src/3rdparty/webkit/WebCore/html/FileList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileList.h (renamed from src/3rdparty/webkit/WebCore/html/FileList.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileList.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReader.cpp260
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReader.h145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReader.idl68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReaderLoader.cpp327
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReaderLoader.h119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReaderLoaderClient.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReaderSync.cpp101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReaderSync.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileReaderSync.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileStreamProxy.cpp225
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileStreamProxy.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileSystemCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileSystemCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileSystemCallbacks.cpp318
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileSystemCallbacks.h173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileThread.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileThread.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileThreadTask.h227
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriter.cpp203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriter.h145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriter.idl64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterBase.cpp76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterBase.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterBaseCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterSync.cpp148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterSync.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/FileWriterSync.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/LocalFileSystem.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/LocalFileSystem.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Metadata.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/Metadata.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/MetadataCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/MetadataCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/SyncCallbackHelper.h187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/ThreadableBlobRegistry.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/WebKitBlobBuilder.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/WebKitBlobBuilder.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/WebKitBlobBuilder.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/WebKitFlags.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/fileapi/WebKitFlags.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/CSSGrammar.cpp4974
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/CSSGrammar.h170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/CSSPropertyNames.cpp1284
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/CSSPropertyNames.h679
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/CSSValueKeywords.cpp3182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/CSSValueKeywords.h687
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/ColorData.cpp599
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/DocTypeStrings.cpp1157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/HTMLElementFactory.cpp654
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/HTMLElementFactory.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/HTMLEntityTable.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/HTMLNames.cpp1376
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/HTMLNames.h484
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/InjectedScriptSource.h3
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/Inspector.idl240
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/InspectorBackendDispatcher.cpp4305
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/InspectorBackendDispatcher.h304
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/InspectorBackendStub.js344
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/InspectorBackendStub.qrc6
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/InspectorFrontend.cpp708
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/InspectorFrontend.h239
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAbstractWorker.cpp291
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAbstractWorker.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSArrayBuffer.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSArrayBuffer.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSArrayBufferView.cpp142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSArrayBufferView.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAttr.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAttr.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioBuffer.cpp267
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioBuffer.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioBufferSourceNode.cpp298
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioBufferSourceNode.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioChannelMerger.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioChannelMerger.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioChannelSplitter.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioChannelSplitter.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioContext.cpp479
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioContext.h145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioDestinationNode.cpp173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioDestinationNode.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioGain.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioGain.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioGainNode.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioGainNode.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioListener.cpp298
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioListener.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioNode.cpp233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioNode.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioPannerNode.cpp453
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioPannerNode.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioParam.cpp248
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioParam.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioProcessingEvent.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioProcessingEvent.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioSourceNode.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSAudioSourceNode.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBarInfo.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBarInfo.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBeforeLoadEvent.cpp203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBeforeLoadEvent.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBeforeProcessEvent.cpp213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBeforeProcessEvent.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBlob.cpp270
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSBlob.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCDATASection.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCDATASection.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSCharsetRule.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSCharsetRule.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSFontFaceRule.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSFontFaceRule.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSImportRule.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSImportRule.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSMediaRule.cpp231
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSMediaRule.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSPageRule.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSPageRule.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSPrimitiveValue.cpp547
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSPrimitiveValue.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSRule.cpp338
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSRule.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSRuleList.cpp262
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSRuleList.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSStyleDeclaration.cpp453
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSStyleDeclaration.h124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSStyleRule.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSStyleRule.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSStyleSheet.cpp294
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSStyleSheet.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSValue.cpp245
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSValue.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSValueList.cpp245
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCSSValueList.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasGradient.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasGradient.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasPattern.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasPattern.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasRenderingContext.cpp193
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasRenderingContext.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasRenderingContext2D.cpp1241
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCanvasRenderingContext2D.h169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCharacterData.cpp338
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCharacterData.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSClientRect.cpp228
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSClientRect.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSClientRectList.cpp259
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSClientRectList.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSClipboard.cpp309
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSClipboard.h103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSComment.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSComment.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCompositionEvent.cpp207
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCompositionEvent.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSConsole.cpp443
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSConsole.h124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSConvolverNode.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSConvolverNode.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCoordinates.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCoordinates.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCounter.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCounter.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCrypto.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCrypto.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCustomEvent.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSCustomEvent.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMApplicationCache.cpp496
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMApplicationCache.h134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMCoreException.cpp412
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMCoreException.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMFileSystem.cpp228
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMFileSystem.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMFileSystemSync.cpp203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMFileSystemSync.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMFormData.cpp174
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMFormData.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMImplementation.cpp318
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMImplementation.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMMimeType.cpp210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMMimeType.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMMimeTypeArray.cpp308
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMMimeTypeArray.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMParser.cpp211
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMParser.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMPlugin.cpp318
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMPlugin.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMPluginArray.cpp324
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMPluginArray.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMSelection.cpp535
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMSelection.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMSettableTokenList.cpp233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMSettableTokenList.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMStringList.cpp275
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMStringList.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMStringMap.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMStringMap.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMTokenList.cpp369
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMTokenList.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMURL.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMURL.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMWindow.cpp10741
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDOMWindow.h1063
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDataTransferItem.cpp239
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDataTransferItem.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDataTransferItems.cpp294
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDataTransferItems.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDataView.cpp562
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDataView.h117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDatabase.cpp263
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDatabase.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDatabaseCallback.cpp97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDatabaseCallback.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDatabaseSync.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDatabaseSync.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDedicatedWorkerContext.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDedicatedWorkerContext.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDelayNode.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDelayNode.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDeviceMotionEvent.cpp210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDeviceMotionEvent.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDeviceOrientationEvent.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDeviceOrientationEvent.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryEntry.cpp256
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryEntry.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryEntrySync.cpp243
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryEntrySync.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryReader.cpp218
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryReader.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryReaderSync.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDirectoryReaderSync.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDocument.cpp2623
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDocument.h274
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDocumentFragment.cpp212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDocumentFragment.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDocumentType.cpp226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSDocumentType.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSElement.cpp2076
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSElement.h234
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntity.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntity.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntityReference.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntityReference.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntriesCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntriesCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntry.cpp434
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntry.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntryArray.cpp274
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntryArray.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntryArraySync.cpp274
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntryArraySync.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntryCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntryCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntrySync.cpp352
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEntrySync.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSErrorCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSErrorCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSErrorEvent.cpp246
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSErrorEvent.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEvent.cpp570
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEvent.h126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEventException.cpp244
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEventException.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEventSource.cpp416
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSEventSource.h140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFile.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFile.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileEntry.cpp244
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileEntry.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileEntrySync.cpp225
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileEntrySync.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileError.cpp310
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileError.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileException.cpp337
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileException.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileList.cpp269
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileList.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileReader.cpp547
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileReader.h134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileReaderSync.cpp307
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileReaderSync.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileSystemCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileSystemCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileWriter.cpp527
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileWriter.h131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileWriterCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFileWriterCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFloat32Array.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSFloat32Array.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSGeolocation.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSGeolocation.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSGeoposition.cpp131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSGeoposition.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAllCollection.cpp297
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAllCollection.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAnchorElement.cpp587
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAnchorElement.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAppletElement.cpp376
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAppletElement.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAreaElement.cpp389
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAreaElement.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAudioElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLAudioElement.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBRElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBRElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBaseElement.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBaseElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBaseFontElement.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBaseFontElement.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBlockquoteElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBlockquoteElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBodyElement.cpp614
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLBodyElement.h110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLButtonElement.cpp479
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLButtonElement.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLCanvasElement.cpp230
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLCanvasElement.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLCollection.cpp293
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLCollection.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDListElement.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDListElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDataListElement.cpp170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDataListElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDetailsElement.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDetailsElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDirectoryElement.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDirectoryElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDivElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDivElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDocument.cpp507
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLDocument.h119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLElement.cpp556
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLElement.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLElementWrapperFactory.cpp685
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLElementWrapperFactory.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLEmbedElement.cpp314
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLEmbedElement.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFieldSetElement.cpp245
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFieldSetElement.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFontElement.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFontElement.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFormElement.cpp441
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFormElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFrameElement.cpp408
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFrameElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFrameSetElement.cpp549
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLFrameSetElement.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHRElement.cpp236
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHRElement.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHeadElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHeadElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHeadingElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHeadingElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHtmlElement.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLHtmlElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLIFrameElement.cpp426
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLIFrameElement.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLImageElement.cpp466
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLImageElement.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLInputElement.cpp1053
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLInputElement.h170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLIsIndexElement.cpp192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLIsIndexElement.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLKeygenElement.cpp371
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLKeygenElement.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLIElement.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLIElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLabelElement.cpp224
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLabelElement.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLegendElement.cpp211
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLegendElement.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLinkElement.cpp344
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLLinkElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMapElement.cpp192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMapElement.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMarqueeElement.cpp414
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMarqueeElement.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMediaElement.cpp700
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMediaElement.h132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMenuElement.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMenuElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMetaElement.cpp236
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMetaElement.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMeterElement.cpp315
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLMeterElement.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLModElement.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLModElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOListElement.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOListElement.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLObjectElement.cpp593
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLObjectElement.h122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOptGroupElement.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOptGroupElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOptionElement.cpp304
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOptionElement.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOptionsCollection.cpp237
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOptionsCollection.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOutputElement.cpp347
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLOutputElement.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLParagraphElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLParagraphElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLParamElement.cpp236
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLParamElement.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLPreElement.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLPreElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLProgressElement.cpp242
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLProgressElement.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLQuoteElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLQuoteElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLScriptElement.cpp312
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLScriptElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLSelectElement.cpp596
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLSelectElement.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLSourceElement.cpp222
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLSourceElement.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLStyleElement.cpp230
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLStyleElement.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableCaptionElement.cpp183
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableCaptionElement.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableCellElement.cpp437
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableCellElement.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableColElement.cpp274
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableColElement.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableElement.cpp555
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableElement.h110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableRowElement.cpp342
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableRowElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableSectionElement.cpp305
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTableSectionElement.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTextAreaElement.cpp587
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTextAreaElement.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTitleElement.cpp178
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTitleElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTrackElement.cpp260
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLTrackElement.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLUListElement.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLUListElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLVideoElement.cpp339
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHTMLVideoElement.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHashChangeEvent.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHashChangeEvent.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHighPass2FilterNode.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHighPass2FilterNode.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHistory.cpp234
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSHistory.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBAny.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBAny.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBCursor.cpp339
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBCursor.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBDatabase.cpp515
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBDatabase.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBDatabaseError.cpp212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBDatabaseError.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBDatabaseException.cpp343
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBDatabaseException.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBFactory.cpp204
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBFactory.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBIndex.cpp359
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBIndex.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBKey.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBKey.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBKeyRange.cpp341
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBKeyRange.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBObjectStore.cpp468
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBObjectStore.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBRequest.cpp417
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBRequest.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBTransaction.cpp435
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSIDBTransaction.h124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSImageData.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSImageData.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInjectedScriptHost.cpp331
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInjectedScriptHost.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInspectorFrontendHost.cpp472
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInspectorFrontendHost.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInt16Array.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInt16Array.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInt32Array.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInt32Array.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInt8Array.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSInt8Array.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSJavaScriptAudioNode.cpp205
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSJavaScriptAudioNode.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSJavaScriptCallFrame.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSJavaScriptCallFrame.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSKeyboardEvent.cpp291
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSKeyboardEvent.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSLocation.cpp365
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSLocation.h145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSLowPass2FilterNode.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSLowPass2FilterNode.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMathMLElementWrapperFactory.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMathMLElementWrapperFactory.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMediaError.cpp228
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMediaError.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMediaList.cpp339
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMediaList.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMediaQueryList.cpp232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMediaQueryList.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMemoryInfo.cpp132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMemoryInfo.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMessageChannel.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMessageChannel.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMessageEvent.cpp245
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMessageEvent.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMessagePort.cpp332
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMessagePort.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMetadata.cpp188
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMetadata.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMetadataCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMetadataCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMouseEvent.cpp417
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMouseEvent.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMutationEvent.cpp292
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSMutationEvent.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNamedNodeMap.cpp416
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNamedNodeMap.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigator.cpp327
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigator.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigatorUserMediaError.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigatorUserMediaError.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigatorUserMediaErrorCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigatorUserMediaErrorCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigatorUserMediaSuccessCallback.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNavigatorUserMediaSuccessCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNode.cpp831
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNode.h182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNodeFilter.cpp339
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNodeFilter.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNodeIterator.cpp294
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNodeIterator.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNodeList.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNodeList.h110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNotation.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNotation.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNotification.cpp377
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNotification.h121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNotificationCenter.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSNotificationCenter.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOESStandardDerivatives.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOESStandardDerivatives.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOESTextureFloat.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOESTextureFloat.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOESVertexArrayObject.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOESVertexArrayObject.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOverflowEvent.cpp251
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSOverflowEvent.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPageTransitionEvent.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPageTransitionEvent.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPerformance.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPerformance.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPerformanceNavigation.cpp169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPerformanceNavigation.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPerformanceTiming.cpp338
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPerformanceTiming.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPopStateEvent.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPopStateEvent.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPositionError.cpp232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSPositionError.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSProcessingInstruction.cpp203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSProcessingInstruction.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSProgressEvent.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSProgressEvent.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRGBColor.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRGBColor.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRange.cpp801
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRange.h125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRangeException.cpp242
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRangeException.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRealtimeAnalyserNode.cpp317
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRealtimeAnalyserNode.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRect.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSRect.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLError.cpp209
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLError.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLException.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLException.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLResultSet.cpp153
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLResultSet.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLResultSetRowList.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLResultSetRowList.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLStatementCallback.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLStatementCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLStatementErrorCallback.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLStatementErrorCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransaction.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransaction.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionErrorCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionErrorCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionSync.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionSync.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionSyncCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSQLTransactionSyncCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAElement.cpp452
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAltGlyphElement.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAltGlyphElement.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAngle.cpp382
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAngle.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimateColorElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimateColorElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimateElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimateElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimateTransformElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimateTransformElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedAngle.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedAngle.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedBoolean.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedBoolean.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedEnumeration.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedEnumeration.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedInteger.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedInteger.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedLength.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedLength.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedLengthList.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedLengthList.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedNumber.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedNumber.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedNumberList.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedNumberList.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedRect.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedRect.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedString.cpp204
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedString.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedTransformList.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimatedTransformList.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimationElement.cpp290
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGAnimationElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGCircleElement.cpp465
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGCircleElement.h103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGClipPathElement.cpp441
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGClipPathElement.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGColor.cpp303
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGColor.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGComponentTransferFunctionElement.cpp304
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGComponentTransferFunctionElement.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGCursorElement.cpp273
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGCursorElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGDefsElement.cpp428
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGDefsElement.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGDescElement.cpp261
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGDescElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGDocument.cpp204
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGDocument.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElement.cpp236
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElementInstance.cpp1419
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElementInstance.h182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElementInstanceList.cpp210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElementInstanceList.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElementWrapperFactory.cpp663
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGElementWrapperFactory.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGEllipseElement.cpp477
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGEllipseElement.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGException.cpp255
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGException.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEBlendElement.cpp364
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEBlendElement.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEColorMatrixElement.cpp357
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEColorMatrixElement.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEComponentTransferElement.cpp289
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEComponentTransferElement.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFECompositeElement.cpp421
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFECompositeElement.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEConvolveMatrixElement.cpp460
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEConvolveMatrixElement.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDiffuseLightingElement.cpp338
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDiffuseLightingElement.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDisplacementMapElement.cpp381
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDisplacementMapElement.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDistantLightElement.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDistantLightElement.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDropShadowElement.cpp357
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEDropShadowElement.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFloodElement.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFloodElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncAElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncAElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncBElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncBElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncGElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncGElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncRElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEFuncRElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEGaussianBlurElement.cpp333
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEGaussianBlurElement.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEImageElement.cpp360
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEImageElement.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEMergeElement.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEMergeElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEMergeNodeElement.cpp170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEMergeNodeElement.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEMorphologyElement.cpp372
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEMorphologyElement.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEOffsetElement.cpp314
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEOffsetElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEPointLightElement.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFEPointLightElement.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFESpecularLightingElement.cpp326
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFESpecularLightingElement.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFESpotLightElement.cpp254
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFESpotLightElement.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFETileElement.cpp289
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFETileElement.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFETurbulenceElement.cpp402
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFETurbulenceElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFilterElement.cpp404
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFilterElement.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceFormatElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceFormatElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceNameElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceNameElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceSrcElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceSrcElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceUriElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGFontFaceUriElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGForeignObjectElement.cpp477
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGForeignObjectElement.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGGElement.cpp428
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGGElement.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGGlyphElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGGlyphElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGGradientElement.cpp313
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGGradientElement.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGHKernElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGHKernElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGImageElement.cpp502
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGImageElement.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLength.cpp408
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLength.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLengthList.cpp347
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLengthList.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLineElement.cpp477
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLineElement.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLinearGradientElement.cpp206
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGLinearGradientElement.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMarkerElement.cpp479
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMarkerElement.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMaskElement.cpp400
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMaskElement.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMatrix.cpp604
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMatrix.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMetadataElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMetadataElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMissingGlyphElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGMissingGlyphElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGNumber.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGNumber.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGNumberList.cpp346
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGNumberList.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPaint.cpp335
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPaint.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathElement.cpp1005
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathElement.h127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSeg.cpp380
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSeg.h110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegArcAbs.cpp296
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegArcAbs.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegArcRel.cpp296
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegArcRel.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegClosePath.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegClosePath.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicRel.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicRel.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.cpp239
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.cpp239
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.cpp239
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.cpp239
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoAbs.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoAbs.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoRel.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoRel.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoVerticalRel.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegLinetoVerticalRel.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegList.cpp347
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegList.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegMovetoAbs.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegMovetoAbs.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegMovetoRel.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPathSegMovetoRel.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPatternElement.cpp451
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPatternElement.h103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPoint.cpp266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPoint.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPointList.cpp346
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPointList.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPolygonElement.cpp452
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPolygonElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPolylineElement.cpp452
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPolylineElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPreserveAspectRatio.cpp369
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGPreserveAspectRatio.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRadialGradientElement.cpp218
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRadialGradientElement.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRect.cpp273
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRect.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRectElement.cpp501
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRectElement.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRenderingIntent.cpp235
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGRenderingIntent.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSVGElement.cpp1070
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSVGElement.h149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGScriptElement.cpp209
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGScriptElement.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSetElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSetElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGStopElement.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGStopElement.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGStringList.cpp339
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGStringList.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGStyleElement.cpp265
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGStyleElement.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSwitchElement.cpp428
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSwitchElement.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSymbolElement.cpp300
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGSymbolElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTRefElement.cpp170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTRefElement.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTSpanElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTSpanElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextContentElement.cpp586
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextContentElement.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextElement.cpp272
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextElement.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextPathElement.cpp276
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextPathElement.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextPositioningElement.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTextPositioningElement.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTitleElement.cpp261
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTitleElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTransform.cpp445
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTransform.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTransformList.cpp387
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGTransformList.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGUnitTypes.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGUnitTypes.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGUseElement.cpp513
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGUseElement.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGVKernElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGVKernElement.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGViewElement.cpp274
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGViewElement.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGZoomEvent.cpp215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSVGZoomEvent.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSScreen.cpp215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSScreen.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSScriptProfile.cpp144
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSScriptProfile.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSScriptProfileNode.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSScriptProfileNode.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSharedWorker.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSharedWorker.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSharedWorkerContext.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSharedWorkerContext.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSpeechInputEvent.cpp170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSpeechInputEvent.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSpeechInputResult.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSpeechInputResult.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSpeechInputResultList.cpp264
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSSpeechInputResultList.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorage.cpp332
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorage.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageEvent.cpp266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageEvent.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageInfo.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageInfo.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageInfoErrorCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageInfoErrorCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageInfoUsageCallback.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStorageInfoUsageCallback.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStringCallback.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStringCallback.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStyleMedia.cpp230
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStyleMedia.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStyleSheet.cpp276
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStyleSheet.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStyleSheetList.cpp291
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSStyleSheetList.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSText.cpp221
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSText.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTextEvent.cpp207
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTextEvent.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTextMetrics.cpp173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTextMetrics.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTimeRanges.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTimeRanges.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTouch.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTouch.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTouchEvent.cpp302
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTouchEvent.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTouchList.cpp260
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTouchList.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTreeWalker.cpp361
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSTreeWalker.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUIEvent.cpp294
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUIEvent.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUint16Array.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUint16Array.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUint32Array.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUint32Array.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUint8Array.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSUint8Array.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSValidityState.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSValidityState.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSVoidCallback.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSVoidCallback.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLActiveInfo.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLActiveInfo.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLBuffer.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLBuffer.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLContextAttributes.cpp226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLContextAttributes.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLFramebuffer.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLFramebuffer.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLProgram.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLProgram.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLRenderbuffer.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLRenderbuffer.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLRenderingContext.cpp5486
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLRenderingContext.h543
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLShader.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLShader.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLTexture.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLTexture.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLUniformLocation.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLUniformLocation.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLVertexArrayObjectOES.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebGLVertexArrayObjectOES.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitAnimation.cpp370
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitAnimation.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitAnimationEvent.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitAnimationEvent.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitAnimationList.cpp255
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitAnimationList.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitBlobBuilder.cpp296
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitBlobBuilder.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSKeyframeRule.cpp192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSKeyframeRule.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSKeyframesRule.cpp304
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSKeyframesRule.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSMatrix.cpp787
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSMatrix.h155
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSTransformValue.cpp393
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitCSSTransformValue.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitFlags.cpp233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitFlags.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitLoseContext.cpp132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitLoseContext.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitPoint.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitPoint.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitTransitionEvent.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebKitTransitionEvent.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebSocket.cpp473
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWebSocket.h144
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWheelEvent.cpp377
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWheelEvent.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorker.cpp251
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorker.h127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorkerContext.cpp724
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorkerContext.h149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorkerLocation.cpp317
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorkerLocation.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorkerNavigator.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSWorkerNavigator.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequest.cpp693
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequest.h167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequestException.cpp252
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequestException.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequestProgressEvent.cpp184
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequestProgressEvent.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequestUpload.cpp399
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLHttpRequestUpload.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLSerializer.cpp210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXMLSerializer.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathEvaluator.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathEvaluator.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathException.cpp247
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathException.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathExpression.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathExpression.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathNSResolver.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathNSResolver.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathResult.cpp395
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXPathResult.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXSLTProcessor.cpp260
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/JSXSLTProcessor.h120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/MathMLElementFactory.cpp121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/MathMLElementFactory.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/MathMLNames.cpp206
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/MathMLNames.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/SVGElementFactory.cpp626
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/SVGElementFactory.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/SVGNames.cpp1076
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/SVGNames.h384
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/UserAgentStyleSheets.h11
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/UserAgentStyleSheetsData.cpp2028
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/WebKitVersion.h36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XLinkNames.cpp99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XLinkNames.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XMLNSNames.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XMLNSNames.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XMLNames.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XMLNames.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XPathGrammar.cpp2285
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/XPathGrammar.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/generated/tokenizer.cpp2087
-rw-r--r--src/3rdparty/webkit/Source/WebCore/gyp/WebCore.gyp295
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/gyp/copy-forwarding-and-icu-headers.sh4
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/gyp/copy-inspector-resources.sh14
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/gyp/generate-derived-sources.sh11
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/gyp/generate-webcore-export-file-generator.sh5
-rw-r--r--src/3rdparty/webkit/Source/WebCore/gyp/gtk.gyp17
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/gyp/run-if-exists.sh5
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/gyp/streamline-inspector-source.sh27
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/gyp/update-info-plist.sh4
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/BackForwardController.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/BackForwardController.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/BackForwardList.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/BackForwardListImpl.cpp288
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/BackForwardListImpl.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/CachedFrame.cpp278
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/CachedFrame.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/CachedFramePlatformData.h (renamed from src/3rdparty/webkit/WebCore/history/CachedFramePlatformData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/CachedPage.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/CachedPage.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/HistoryItem.cpp897
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/HistoryItem.h311
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/PageCache.cpp483
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/PageCache.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/history/qt/HistoryItemQt.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseButtonInputType.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseButtonInputType.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseCheckableInputType.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseCheckableInputType.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseDateAndTimeInputType.cpp215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseDateAndTimeInputType.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseTextInputType.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/BaseTextInputType.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ButtonInputType.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ButtonInputType.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/CheckboxInputType.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/CheckboxInputType.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ClassList.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ClassList.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/CollectionCache.cpp (renamed from src/3rdparty/webkit/WebCore/html/CollectionCache.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/CollectionCache.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/CollectionType.h (renamed from src/3rdparty/webkit/WebCore/html/CollectionType.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ColorInputType.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ColorInputType.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMFormData.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMFormData.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMFormData.idl44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMSettableTokenList.cpp101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMSettableTokenList.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMSettableTokenList.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMTokenList.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMTokenList.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMTokenList.idl44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMURL.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMURL.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DOMURL.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DateInputType.cpp99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DateInputType.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DateTimeInputType.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DateTimeInputType.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DateTimeLocalInputType.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DateTimeLocalInputType.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/DocTypeStrings.gperf103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/EmailInputType.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/EmailInputType.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FTPDirectoryDocument.cpp451
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FTPDirectoryDocument.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FileInputType.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FileInputType.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FormAssociatedElement.cpp181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FormAssociatedElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FormDataList.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/FormDataList.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAllCollection.cpp (renamed from src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAllCollection.h (renamed from src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAllCollection.idl (renamed from src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAnchorElement.cpp558
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAnchorElement.h140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAnchorElement.idl71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAppletElement.cpp183
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAppletElement.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAppletElement.idl49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAreaElement.cpp242
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAreaElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAreaElement.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAttributeNames.in305
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAudioElement.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAudioElement.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLAudioElement.idl (renamed from src/3rdparty/webkit/WebCore/html/HTMLAudioElement.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBRElement.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBRElement.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBRElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBaseElement.cpp75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBaseElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBaseElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBaseFontElement.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBaseFontElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBaseFontElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBlockquoteElement.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBlockquoteElement.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBlockquoteElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBodyElement.cpp373
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBodyElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLBodyElement.idl61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLButtonElement.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLButtonElement.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLButtonElement.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLCanvasElement.cpp498
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLCanvasElement.h169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLCanvasElement.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLCollection.cpp407
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLCollection.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLCollection.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDListElement.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDListElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDListElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDataListElement.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDataListElement.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDataListElement.idl (renamed from src/3rdparty/webkit/WebCore/html/HTMLDataListElement.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDetailsElement.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDetailsElement.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDetailsElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDirectoryElement.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDirectoryElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDirectoryElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDivElement.cpp76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDivElement.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDivElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDocument.cpp441
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDocument.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLDocument.idl64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLElement.cpp964
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLElement.h133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLElement.idl73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLElementsAllInOne.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLEmbedElement.cpp279
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLEmbedElement.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLEmbedElement.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFieldSetElement.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFieldSetElement.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFieldSetElement.idl (renamed from src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFontElement.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFontElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFontElement.idl28
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFormCollection.cpp250
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFormCollection.h (renamed from src/3rdparty/webkit/WebCore/html/HTMLFormCollection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFormControlElement.cpp729
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFormControlElement.h249
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFormElement.cpp668
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFormElement.h177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFormElement.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameElement.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameElement.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameElement.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameElementBase.cpp302
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameElementBase.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameOwnerElement.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameOwnerElement.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameSetElement.cpp223
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameSetElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLFrameSetElement.idl59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHRElement.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHRElement.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHRElement.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHeadElement.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHeadElement.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHeadElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHeadingElement.cpp38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHeadingElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHeadingElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHtmlElement.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHtmlElement.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLHtmlElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLIFrameElement.cpp165
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLIFrameElement.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLIFrameElement.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp403
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLImageLoader.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLImageLoader.h (renamed from src/3rdparty/webkit/WebCore/html/HTMLImageLoader.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLInputElement.cpp1572
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLInputElement.h330
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLInputElement.idl112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLIsIndexElement.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLIsIndexElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLIsIndexElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLKeygenElement.cpp134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLKeygenElement.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLKeygenElement.idl52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLIElement.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLIElement.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLIElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLabelElement.cpp168
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLabelElement.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLabelElement.idl30
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLegendElement.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLegendElement.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLegendElement.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp534
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.h141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMapElement.cpp145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMapElement.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMapElement.idl28
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMarqueeElement.cpp200
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMarqueeElement.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMarqueeElement.idl44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.cpp2710
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.h430
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.idl91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMenuElement.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMenuElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMenuElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMetaElement.cpp94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMetaElement.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMetaElement.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMeterElement.cpp238
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMeterElement.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLMeterElement.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLModElement.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLModElement.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLModElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLNameCollection.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLNameCollection.h (renamed from src/3rdparty/webkit/WebCore/html/HTMLNameCollection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLNoScriptElement.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLNoScriptElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOListElement.cpp97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOListElement.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOListElement.idl28
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLObjectElement.cpp555
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLObjectElement.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLObjectElement.idl66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptGroupElement.cpp144
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptGroupElement.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptGroupElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptionElement.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptionElement.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptionElement.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptionsCollection.cpp (renamed from src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptionsCollection.h (renamed from src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOptionsCollection.idl (renamed from src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOutputElement.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOutputElement.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLOutputElement.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParagraphElement.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParagraphElement.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParagraphElement.idl26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParamElement.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParamElement.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParamElement.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParserErrorCodes.cpp28
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParserErrorCodes.h26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLParserQuirks.h26
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLPlugInElement.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLPlugInElement.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLPlugInImageElement.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLPlugInImageElement.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLPreElement.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLPreElement.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLPreElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLProgressElement.cpp150
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLProgressElement.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLProgressElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLQuoteElement.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLQuoteElement.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLQuoteElement.idl25
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLScriptElement.cpp193
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLScriptElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLScriptElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSelectElement.cpp541
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSelectElement.h154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSelectElement.idl72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSourceElement.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSourceElement.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSourceElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLStyleElement.cpp123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLStyleElement.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLStyleElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSummaryElement.cpp114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLSummaryElement.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableCaptionElement.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableCaptionElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableCaptionElement.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableCellElement.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableCellElement.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableCellElement.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableColElement.cpp103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableColElement.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableColElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableElement.cpp665
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableElement.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableElement.idl53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTablePartElement.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTablePartElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableRowElement.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableRowElement.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableRowElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableRowsCollection.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableRowsCollection.h (renamed from src/3rdparty/webkit/WebCore/html/HTMLTableRowsCollection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableSectionElement.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableSectionElement.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTableSectionElement.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTagNames.in139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTextAreaElement.cpp430
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTextAreaElement.h117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTextAreaElement.idl55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTitleElement.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTitleElement.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTitleElement.idl (renamed from src/3rdparty/webkit/WebCore/html/HTMLTitleElement.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTrackElement.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTrackElement.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLTrackElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLUListElement.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLUListElement.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLUListElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLVideoElement.cpp291
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLVideoElement.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLVideoElement.idl56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLViewSourceDocument.cpp319
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HTMLViewSourceDocument.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HiddenInputType.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/HiddenInputType.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ImageData.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ImageData.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ImageData.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ImageDocument.cpp420
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ImageDocument.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ImageInputType.cpp168
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ImageInputType.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/InputType.cpp795
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/InputType.h277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/IsIndexInputType.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/IsIndexInputType.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/LabelsNodeList.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/LabelsNodeList.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/MediaDocument.cpp232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/MediaDocument.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/MediaError.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/MediaError.idl (renamed from src/3rdparty/webkit/WebCore/html/MediaError.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/MonthInputType.cpp145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/MonthInputType.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/NumberInputType.cpp272
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/NumberInputType.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/PasswordInputType.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/PasswordInputType.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/PluginDocument.cpp184
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/PluginDocument.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/RadioInputType.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/RadioInputType.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/RangeInputType.cpp281
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/RangeInputType.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ResetInputType.cpp76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ResetInputType.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/SearchInputType.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/SearchInputType.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/StepRange.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/StepRange.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/SubmitInputType.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/SubmitInputType.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TelephoneInputType.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TelephoneInputType.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextDocument.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextDocument.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextFieldInputType.cpp132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextFieldInputType.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextInputType.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextInputType.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextMetrics.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TextMetrics.idl (renamed from src/3rdparty/webkit/WebCore/html/TextMetrics.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TimeInputType.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TimeInputType.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TimeRanges.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TimeRanges.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/TimeRanges.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/URLInputType.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/URLInputType.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ValidationMessage.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ValidationMessage.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ValidityState.cpp216
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ValidityState.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/ValidityState.idl (renamed from src/3rdparty/webkit/WebCore/html/ValidityState.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/VoidCallback.h (renamed from src/3rdparty/webkit/WebCore/html/VoidCallback.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/VoidCallback.idl (renamed from src/3rdparty/webkit/WebCore/html/VoidCallback.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/WeekInputType.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/WeekInputType.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/ArrayBuffer.cpp99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/ArrayBuffer.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/ArrayBuffer.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/ArrayBufferView.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/ArrayBufferView.h132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/ArrayBufferView.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasContextAttributes.cpp (renamed from src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasContextAttributes.h (renamed from src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasGradient.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasGradient.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasGradient.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasPattern.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasPattern.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasPattern.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasPixelArray.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasPixelArray.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasPixelArray.idl42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasRenderingContext.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasRenderingContext.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasRenderingContext.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp2016
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasRenderingContext2D.h311
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasStyle.cpp304
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CanvasStyle.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/CheckedInt.h588
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/html/canvas/DataView.cpp230
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/html/canvas/DataView.h92
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/html/canvas/DataView.idl82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Float32Array.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Float32Array.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Float32Array.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int16Array.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int16Array.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int16Array.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int32Array.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int32Array.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int32Array.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int8Array.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int8Array.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Int8Array.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/IntegralTypedArrayBase.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESStandardDerivatives.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESStandardDerivatives.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESStandardDerivatives.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESTextureFloat.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESTextureFloat.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESTextureFloat.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESVertexArrayObject.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESVertexArrayObject.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/OESVertexArrayObject.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/TypedArrayBase.h122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint16Array.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint16Array.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint16Array.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint32Array.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint32Array.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint32Array.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint8Array.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint8Array.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/Uint8Array.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLActiveInfo.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLActiveInfo.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLBuffer.cpp210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLBuffer.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLBuffer.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLContextAttributes.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLContextAttributes.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLContextAttributes.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLContextEvent.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLContextEvent.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLContextEvent.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLExtension.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLExtension.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLFramebuffer.cpp357
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLFramebuffer.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLFramebuffer.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLGetInfo.cpp245
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLGetInfo.h138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLObject.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLObject.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLProgram.cpp160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLProgram.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLProgram.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLRenderbuffer.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLRenderbuffer.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLRenderbuffer.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLRenderingContext.cpp4835
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLRenderingContext.h617
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLRenderingContext.idl669
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLShader.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLShader.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLShader.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLTexture.cpp356
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLTexture.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLTexture.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLUniformLocation.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLUniformLocation.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLUniformLocation.idl30
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebKitLoseContext.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebKitLoseContext.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/canvas/WebKitLoseContext.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/CSSPreloadScanner.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/CSSPreloadScanner.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLConstructionSite.cpp500
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLConstructionSite.h159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLDocumentParser.cpp585
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLDocumentParser.h162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLElementStack.cpp596
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLElementStack.h184
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLEntityNames.in2138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLEntityParser.cpp272
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLEntityParser.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLEntitySearch.cpp134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLEntitySearch.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLEntityTable.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLFormattingElementList.cpp134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLFormattingElementList.h135
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLInputStream.h156
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp209
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLMetaCharsetParser.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLParserIdioms.cpp222
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLParserIdioms.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLParserScheduler.cpp123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLParserScheduler.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLPreloadScanner.cpp205
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLPreloadScanner.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLScriptRunner.cpp316
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLScriptRunner.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLScriptRunnerHost.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLSourceTracker.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLSourceTracker.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLToken.h565
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLTokenizer.cpp1698
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLTokenizer.h318
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLTreeBuilder.cpp2841
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLTreeBuilder.h265
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLViewSourceParser.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/HTMLViewSourceParser.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/NestingLevelIncrementer.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/TextDocumentParser.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/TextDocumentParser.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/TextViewSourceParser.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/TextViewSourceParser.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/XSSFilter.cpp473
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/parser/XSSFilter.h89
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/html/parser/create-html-entity-table179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/DetailsMarkerControl.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/DetailsMarkerControl.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.cpp1076
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.h477
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.cpp543
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.h143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp295
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElementChromium.h110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControls.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControls.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MeterShadowElement.cpp103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/MeterShadowElement.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/ProgressShadowElement.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/ProgressShadowElement.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/ShadowContentElement.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/SliderThumbElement.cpp214
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/SliderThumbElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/TextControlInnerElements.cpp512
-rw-r--r--src/3rdparty/webkit/Source/WebCore/html/shadow/TextControlInnerElements.h165
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/CodeGeneratorInspector.pm1080
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ConsoleMessage.cpp192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ConsoleMessage.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/DOMNodeHighlighter.cpp306
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/DOMNodeHighlighter.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/EventsCollector.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/EventsCollector.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScript.cpp243
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScript.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScriptHost.cpp180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScriptHost.h127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScriptHost.idl53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScriptManager.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScriptManager.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InjectedScriptSource.js664
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/Inspector.json1711
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorAgent.cpp462
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorAgent.h236
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorApplicationCacheAgent.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorCSSAgent.cpp572
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorCSSAgent.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorClient.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorClient.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorConsoleAgent.cpp263
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorConsoleAgent.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorConsoleInstrumentation.h127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorController.cpp337
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorController.h119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMAgent.cpp1429
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMAgent.h240
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp388
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMStorageAgent.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMStorageResource.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDOMStorageResource.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDatabaseAgent.cpp360
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDatabaseAgent.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDatabaseInstrumentation.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDatabaseResource.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDatabaseResource.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDebuggerAgent.cpp456
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorDebuggerAgent.h181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendChannel.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendClient.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendClientLocal.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendHost.cpp267
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendHost.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendHost.idl61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendProxy.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorFrontendProxy.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorInstrumentation.cpp818
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorInstrumentation.h973
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorPageAgent.cpp530
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorPageAgent.h129
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorProfilerAgent.cpp381
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorProfilerAgent.h122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorResourceAgent.cpp389
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorResourceAgent.h136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorRuntimeAgent.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorRuntimeAgent.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorState.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorState.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorStyleSheet.cpp1279
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorStyleSheet.h264
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorTimelineAgent.cpp418
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorTimelineAgent.h171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorValues.cpp768
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorValues.h317
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorWorkerAgent.cpp131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorWorkerAgent.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InspectorWorkerResource.h (renamed from src/3rdparty/webkit/WebCore/inspector/InspectorWorkerResource.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/InstrumentingAgents.h169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/JavaScriptCallFrame.idl54
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/PageDebuggerAgent.cpp72
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/PageDebuggerAgent.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptArguments.cpp99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptArguments.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptBreakpoint.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptCallFrame.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptCallFrame.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptCallStack.cpp90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptCallStack.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptDebugListener.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptGCEventListener.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptProfile.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/ScriptProfileNode.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/TimelineRecordFactory.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/TimelineRecordFactory.h87
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/WorkerDebuggerAgent.cpp72
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/WorkerDebuggerAgent.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/WorkerInspectorController.cpp161
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/WorkerInspectorController.h81
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/combine-javascript-resources.pl81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js313
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/AuditCategories.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/AuditCategories.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/AuditFormatters.js92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/AuditLauncherView.js254
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/AuditResultView.js114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/AuditRules.js1053
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/AuditsPanel.js477
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/BinarySearch.js70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js606
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/CSSCompletions.js125
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js438
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/CSSStyleModel.js713
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/CallStackSidebarPane.js170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Checkbox.js63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Color.js663
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ConsolePanel.js86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ConsoleView.js1164
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ContextMenu.js91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/CookieItemsView.js255
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/front-end/CookieParser.js210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/CookiesTable.js205
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DOMAgent.js636
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js310
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DOMStorage.js89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DOMStorageItemsView.js159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DOMSyntaxHighlighter.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/DOMSyntaxHighlighter.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DataGrid.js1479
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Database.js146
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DatabaseQueryView.js196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DatabaseTableView.js90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DebuggerModel.js244
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js754
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js746
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/DetailedHeapshotView.js1155
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Drawer.js362
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ElementsPanel.js1153
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ElementsTreeOutline.js1506
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js241
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ExtensionAPI.js494
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/front-end/ExtensionAPISchema.json445
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ExtensionAuditCategory.js111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ExtensionCommon.js46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ExtensionPanel.js128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ExtensionRegistryStub.js45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ExtensionServer.js484
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/FontView.js134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/GoToLineDialog.js134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/HAREntry.js241
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/HeapSnapshot.js1422
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js442
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/HeapSnapshotView.js1032
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/HeapSnapshotWorker.js44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/HeapSnapshotWorkerDispatcher.js85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/HelpScreen.js88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ImageView.js124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/applicationCache.pngbin0 -> 1735 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/back.pngbin0 -> 216 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/breakpointBorder.pngbin0 -> 261 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/breakpointConditionalBorder.pngbin0 -> 262 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/breakpointConditionalCounterBorder.pngbin0 -> 422 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/breakpointCounterBorder.pngbin0 -> 414 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/checker.pngbin0 -> 82 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/closeButtons.pngbin0 -> 369 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/cookie.pngbin0 -> 2189 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/database.pngbin0 -> 1461 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/databaseTable.pngbin0 -> 308 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/debuggerContinue.pngbin0 -> 203 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/debuggerPause.pngbin0 -> 120 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/debuggerStepInto.pngbin0 -> 253 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/debuggerStepOut.pngbin0 -> 246 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/debuggerStepOver.pngbin0 -> 312 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDown.pngbin0 -> 235 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownBlack.pngbin0 -> 138 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownWhite.pngbin0 -> 145 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRight.pngbin0 -> 216 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightBlack.pngbin0 -> 125 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDown.pngbin0 -> 262 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownBlack.pngbin0 -> 160 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownWhite.pngbin0 -> 169 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightWhite.pngbin0 -> 135 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/errorIcon.pngbin0 -> 375 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/errorMediumIcon.pngbin0 -> 652 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/errorRedDot.pngbin0 -> 434 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/forward.pngbin0 -> 214 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/frame.pngbin0 -> 482 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/glossyHeader.pngbin0 -> 103 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/glossyHeaderPressed.pngbin0 -> 103 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/glossyHeaderSelected.pngbin0 -> 121 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/glossyHeaderSelectedPressed.pngbin0 -> 121 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/goArrow.pngbin0 -> 146 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/graphLabelCalloutLeft.pngbin0 -> 160 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/graphLabelCalloutRight.pngbin0 -> 161 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/localStorage.pngbin0 -> 1053 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/paneAddButtons.pngbin0 -> 738 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/paneBottomGrow.pngbin0 -> 85 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/paneBottomGrowActive.pngbin0 -> 85 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/paneGrowHandleLine.pngbin0 -> 69 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/paneSettingsButtons.pngbin0 -> 1122 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/popoverArrows.pngbin0 -> 546 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/popoverBackground.pngbin0 -> 2231 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/profileGroupIcon.pngbin0 -> 1486 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/profileIcon.pngbin0 -> 1295 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/profileSmallIcon.pngbin0 -> 568 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/profilesSilhouette.pngbin0 -> 42067 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/programCounterBorder.pngbin0 -> 331 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/radioDot.pngbin0 -> 224 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourceCSSIcon.pngbin0 -> 1057 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourceDocumentIcon.pngbin0 -> 979 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourceDocumentIconSmall.pngbin0 -> 158 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourceJSIcon.pngbin0 -> 859 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourcePlainIcon.pngbin0 -> 378 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourcePlainIconSmall.pngbin0 -> 130 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourcesSizeGraphIcon.pngbin0 -> 1640 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/resourcesTimeGraphIcon.pngbin0 -> 1427 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/scriptsSilhouette.pngbin0 -> 43110 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/searchSmallBlue.pngbin0 -> 311 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/searchSmallBrightBlue.pngbin0 -> 304 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/searchSmallGray.pngbin0 -> 264 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/searchSmallWhite.pngbin0 -> 217 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/segment.pngbin0 -> 297 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/segmentEnd.pngbin0 -> 141 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/segmentHover.pngbin0 -> 320 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/segmentHoverEnd.pngbin0 -> 145 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/segmentSelected.pngbin0 -> 309 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/segmentSelectedEnd.pngbin0 -> 139 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/sessionStorage.pngbin0 -> 1069 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/spinner.gif (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/Images/spinner.gif)bin1684 -> 1684 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/splitviewDimple.pngbin0 -> 189 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/splitviewDividerBackground.pngbin0 -> 147 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarBackground.png (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/Images/statusbarBackground.png)bin4024 -> 4024 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarBottomBackground.png (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/Images/statusbarBottomBackground.png)bin4021 -> 4021 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.pngbin0 -> 6384 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarButtons.pngbin0 -> 216 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.pngbin0 -> 328 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.pngbin0 -> 295 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarResizerHorizontal.pngbin0 -> 90 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/statusbarResizerVertical.pngbin0 -> 92 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/successGreenDot.pngbin0 -> 492 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/thumbActiveHoriz.pngbin0 -> 663 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/thumbActiveVert.pngbin0 -> 567 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/thumbHoriz.pngbin0 -> 665 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/thumbHoverHoriz.pngbin0 -> 667 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/thumbHoverVert.pngbin0 -> 565 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/thumbVert.pngbin0 -> 567 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineBarBlue.pngbin0 -> 403 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineBarGray.pngbin0 -> 366 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineBarGreen.pngbin0 -> 404 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineBarOrange.pngbin0 -> 376 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineBarPurple.pngbin0 -> 403 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineBarRed.pngbin0 -> 401 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineBarYellow.pngbin0 -> 382 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.pngbin0 -> 3284 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineDots.pngbin0 -> 2294 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineHollowPillBlue.pngbin0 -> 806 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineHollowPillGray.pngbin0 -> 713 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineHollowPillGreen.pngbin0 -> 806 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineHollowPillOrange.pngbin0 -> 807 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineHollowPillPurple.pngbin0 -> 810 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineHollowPillRed.pngbin0 -> 810 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelineHollowPillYellow.pngbin0 -> 804 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelinePillBlue.pngbin0 -> 706 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelinePillGray.pngbin0 -> 636 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelinePillGreen.pngbin0 -> 712 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelinePillOrange.pngbin0 -> 712 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelinePillPurple.pngbin0 -> 716 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelinePillRed.pngbin0 -> 706 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/timelinePillYellow.pngbin0 -> 699 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/toolbarIcons.pngbin0 -> 30943 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/toolbarIconsSmall.pngbin0 -> 23586 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/toolbarItemSelected.pngbin0 -> 266 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/trackHoriz.pngbin0 -> 530 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/trackVert.pngbin0 -> 565 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/treeDownTriangleBlack.pngbin0 -> 166 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/treeDownTriangleWhite.pngbin0 -> 148 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/treeRightTriangleBlack.pngbin0 -> 155 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/treeRightTriangleWhite.pngbin0 -> 142 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/treeUpTriangleBlack.pngbin0 -> 180 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/treeUpTriangleWhite.pngbin0 -> 162 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/userInputIcon.pngbin0 -> 189 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/userInputPreviousIcon.pngbin0 -> 162 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/userInputResultIcon.pngbin0 -> 221 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/warningIcon.pngbin0 -> 273 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/warningMediumIcon.pngbin0 -> 592 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/warningOrangeDot.pngbin0 -> 484 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Images/warningsErrors.pngbin0 -> 1832 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/InjectedFakeWorker.js345
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/InspectorBackendStub.qrc6
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/JavaScriptFormatter.js897
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/KeyboardShortcut.js169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/MetricsSidebarPane.js439
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/NetworkItemView.js112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/NetworkManager.js302
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/NetworkPanel.js1763
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Object.js97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js316
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Panel.js451
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/PanelEnablerView.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/PanelEnablerView.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Placard.js106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/PleaseWaitMessage.js102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Popover.js259
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ProfileDataGridTree.js399
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ProfileView.js624
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ProfilesPanel.js917
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/PropertiesSection.js44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/RemoteObject.js270
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Resource.js982
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourceCategory.js41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourceCookiesView.js87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourceHeadersView.js361
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourceJSONView.js75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourceTimingView.js157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourceTreeModel.js380
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourceView.js220
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ResourcesPanel.js1431
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ScopeChainSidebarPane.js172
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Script.js65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ScriptFormatter.js75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ScriptsPanel.js1114
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/front-end/SearchController.js269
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Section.js178
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ShortcutsHelp.js159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SidebarPane.js133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SidebarTreeElement.js203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js1423
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js268
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceFile.js328
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceFrame.js1017
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js799
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js375
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SourceTokenizer.js97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/StatusBarButton.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/StatusBarButton.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/StylesSidebarPane.js2068
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/SummaryBar.js363
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TabbedPane.js84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TestController.js60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TextEditorHighlighter.js238
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TextEditorModel.js322
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TextPrompt.js470
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TextViewer.js1940
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TimelineAgent.js63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TimelineGrid.js179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TimelineOverviewPane.js600
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TimelinePanel.js1182
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/front-end/Toolbar.js230
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/TopDownProfileDataGridTree.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/TopDownProfileDataGridTree.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/UglifyJS/parse-js.js1247
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/View.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/View.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js271
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/WebKit.qrc271
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/WelcomeView.js (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/WelcomeView.js)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/WorkerManager.js100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/WorkersSidebarPane.js102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/audits.css281
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/goToLineDialog.css39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/heapProfiler.css265
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/helpScreen.css153
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/inspector.css4540
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/inspector.html185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/inspector.js1643
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/inspectorSyntaxHighlight.css (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/inspectorSyntaxHighlight.css)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/networkPanel.css842
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/popover.css (renamed from src/3rdparty/webkit/WebCore/inspector/front-end/popover.css)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/textViewer.css203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/treeoutline.js911
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/front-end/utilities.js1044
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/generate-inspector-idl159
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/inspector/inline-javascript-imports.py81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/inspector/xxd.pl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/CachedMetadata.h125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/CrossOriginAccessControl.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/CrossOriginAccessControl.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/CrossOriginPreflightResultCache.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentLoadTiming.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentLoader.cpp886
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentLoader.h361
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentThreadableLoader.cpp402
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentThreadableLoader.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentThreadableLoaderClient.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentWriter.cpp259
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/DocumentWriter.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/EmptyClients.h614
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FTPDirectoryParser.cpp1715
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FTPDirectoryParser.h (renamed from src/3rdparty/webkit/WebCore/loader/FTPDirectoryParser.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FormState.cpp (renamed from src/3rdparty/webkit/WebCore/loader/FormState.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FormState.h (renamed from src/3rdparty/webkit/WebCore/loader/FormState.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FormSubmission.cpp246
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FormSubmission.h129
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp3607
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.h516
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FrameLoaderClient.h318
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FrameLoaderStateMachine.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FrameLoaderStateMachine.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FrameLoaderTypes.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/FrameNetworkingContext.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/HistoryController.cpp827
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/HistoryController.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.cpp384
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/MainResourceLoader.cpp645
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/MainResourceLoader.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/NavigationAction.cpp (renamed from src/3rdparty/webkit/WebCore/loader/NavigationAction.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/NavigationAction.h (renamed from src/3rdparty/webkit/WebCore/loader/NavigationAction.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/NavigationScheduler.cpp442
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/NavigationScheduler.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/NetscapePlugInStreamLoader.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PingLoader.cpp133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PingLoader.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PlaceholderDocument.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PlaceholderDocument.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PolicyCallback.cpp135
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PolicyCallback.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PolicyChecker.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/PolicyChecker.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ProgressTracker.cpp265
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ProgressTracker.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ResourceLoadNotifier.cpp169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ResourceLoadNotifier.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ResourceLoadScheduler.cpp293
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ResourceLoadScheduler.h120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ResourceLoader.cpp515
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ResourceLoader.h186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SinkDocument.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SinkDocument.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SubframeLoader.cpp385
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SubframeLoader.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SubresourceLoader.cpp294
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SubresourceLoader.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SubresourceLoaderClient.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SubstituteData.h (renamed from src/3rdparty/webkit/WebCore/loader/SubstituteData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/SubstituteResource.h (renamed from src/3rdparty/webkit/WebCore/loader/SubstituteResource.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/TextResourceDecoder.cpp694
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/TextResourceDecoder.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ThreadableLoader.cpp (renamed from src/3rdparty/webkit/WebCore/loader/ThreadableLoader.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ThreadableLoader.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ThreadableLoaderClient.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/ThreadableLoaderClientWrapper.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/WorkerThreadableLoader.cpp265
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/WorkerThreadableLoader.h149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCache.cpp224
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCache.h120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp1135
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheGroup.h215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp468
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheHost.h212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheResource.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheResource.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp1519
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.h159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/DOMApplicationCache.cpp131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/DOMApplicationCache.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/DOMApplicationCache.idl70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ManifestParser.cpp188
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/appcache/ManifestParser.h (renamed from src/3rdparty/webkit/WebCore/loader/appcache/ManifestParser.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/archive/Archive.h (renamed from src/3rdparty/webkit/WebCore/loader/archive/Archive.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/archive/ArchiveFactory.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/archive/ArchiveFactory.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/archive/ArchiveResource.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/archive/ArchiveResource.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp (renamed from src/3rdparty/webkit/WebCore/loader/archive/ArchiveResourceCollection.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/archive/ArchiveResourceCollection.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachePolicy.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedCSSStyleSheet.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedFont.cpp207
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedFont.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedImage.cpp381
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedImage.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.cpp622
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.h301
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceClient.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceClientWalker.cpp (renamed from src/3rdparty/webkit/WebCore/loader/CachedResourceClientWalker.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceClientWalker.h (renamed from src/3rdparty/webkit/WebCore/loader/CachedResourceClientWalker.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceHandle.cpp (renamed from src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceHandle.h (renamed from src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceLoader.cpp746
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceLoader.h154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceRequest.cpp287
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResourceRequest.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedScript.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedScript.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/CachedXSLStyleSheet.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/MemoryCache.cpp696
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/cache/MemoryCache.h232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconDatabase.cpp2250
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconDatabase.h255
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconDatabaseBase.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconDatabaseBase.h221
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconDatabaseClient.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconLoader.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconLoader.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.h126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/PageURLRecord.cpp (renamed from src/3rdparty/webkit/WebCore/loader/icon/PageURLRecord.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/loader/icon/PageURLRecord.h90
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/make-export-file-generator57
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/make-generated-sources.sh (renamed from src/3rdparty/webkit/WebCore/make-generated-sources.sh)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/make-hash-tools.pl53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLElement.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLElement.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLInlineContainerElement.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLInlineContainerElement.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLMathElement.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLMathElement.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLTextElement.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/MathMLTextElement.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/mathattrs.in24
-rw-r--r--src/3rdparty/webkit/Source/WebCore/mathml/mathtags.in27
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/move-js-headers.sh6
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/Notification.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/Notification.h155
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/Notification.idl62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/NotificationCenter.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/NotificationCenter.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/NotificationCenter.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/NotificationContents.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/notifications/NotificationPresenter.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/AbstractView.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/BarInfo.cpp (renamed from src/3rdparty/webkit/WebCore/page/BarInfo.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/BarInfo.h (renamed from src/3rdparty/webkit/WebCore/page/BarInfo.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/BarInfo.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Chrome.cpp574
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Chrome.h189
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/ChromeClient.h329
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Console.cpp366
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Console.h135
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Console.idl63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/ContentSecurityPolicy.cpp744
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/ContentSecurityPolicy.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/ContextMenuClient.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/ContextMenuController.cpp1256
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/ContextMenuController.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/ContextMenuProvider.h (renamed from src/3rdparty/webkit/WebCore/page/ContextMenuProvider.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Coordinates.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Coordinates.idl (renamed from src/3rdparty/webkit/WebCore/page/Coordinates.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Crypto.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Crypto.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Crypto.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMSelection.cpp517
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMSelection.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMSelection.idl91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMTimer.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMTimer.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMWindow.cpp1873
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMWindow.h497
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DOMWindow.idl802
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DragActions.h (renamed from src/3rdparty/webkit/WebCore/page/DragActions.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DragClient.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DragController.cpp860
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/DragController.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/EditorClient.h180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/EventHandler.cpp3201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/EventHandler.h458
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/EventSource.cpp360
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/EventSource.h131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/EventSource.idl70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FocusController.cpp628
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FocusController.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FocusDirection.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Frame.cpp1106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Frame.h380
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FrameActionScheduler.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FrameActionScheduler.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FrameLoadRequest.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FrameTree.cpp337
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FrameTree.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FrameView.cpp2768
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/FrameView.h432
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Geolocation.cpp769
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Geolocation.h221
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Geolocation.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GeolocationClient.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GeolocationController.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GeolocationController.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GeolocationError.h (renamed from src/3rdparty/webkit/WebCore/page/GeolocationError.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GeolocationPosition.h (renamed from src/3rdparty/webkit/WebCore/page/GeolocationPosition.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GeolocationPositionCache.cpp261
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GeolocationPositionCache.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Geoposition.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Geoposition.idl (renamed from src/3rdparty/webkit/WebCore/page/Geoposition.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GroupSettings.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/GroupSettings.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/HaltablePlugin.h (renamed from src/3rdparty/webkit/WebCore/page/HaltablePlugin.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/History.cpp143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/History.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/History.idl51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Location.cpp278
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Location.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Location.idl76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MediaCanStartListener.h (renamed from src/3rdparty/webkit/WebCore/page/MediaCanStartListener.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MediaStreamClient.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MediaStreamController.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MediaStreamController.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MediaStreamFrameController.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MediaStreamFrameController.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MemoryInfo.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MemoryInfo.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MemoryInfo.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MouseEventWithHitTestResults.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/MouseEventWithHitTestResults.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Navigator.cpp256
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Navigator.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Navigator.idl63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorBase.cpp (renamed from src/3rdparty/webkit/WebCore/page/NavigatorBase.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorBase.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorUserMediaError.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorUserMediaError.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorUserMediaErrorCallback.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorUserMediaErrorCallback.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorUserMediaSuccessCallback.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/NavigatorUserMediaSuccessCallback.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/OriginAccessEntry.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/OriginAccessEntry.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Page.cpp955
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Page.h412
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PageGroup.cpp425
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PageGroup.h139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PageGroupLoadDeferrer.cpp86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PageGroupLoadDeferrer.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PageSerializer.cpp350
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PageSerializer.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Performance.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Performance.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Performance.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PerformanceNavigation.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PerformanceNavigation.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PerformanceNavigation.idl44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PerformanceTiming.cpp407
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PerformanceTiming.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PerformanceTiming.idl58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PluginHalter.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PluginHalter.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PluginHalterClient.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PositionCallback.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PositionError.h (renamed from src/3rdparty/webkit/WebCore/page/PositionError.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PositionError.idl (renamed from src/3rdparty/webkit/WebCore/page/PositionError.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PositionErrorCallback.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PositionOptions.h (renamed from src/3rdparty/webkit/WebCore/page/PositionOptions.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PrintContext.cpp376
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/PrintContext.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Screen.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Screen.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Screen.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SecurityOrigin.cpp589
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SecurityOrigin.h222
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SecurityOriginHash.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Settings.cpp745
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/Settings.h531
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpatialNavigation.cpp743
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpatialNavigation.h155
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInput.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInput.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputClient.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputEvent.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputEvent.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputEvent.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputListener.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputResult.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputResult.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputResult.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputResultList.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputResultList.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SpeechInputResultList.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SuspendableTimer.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/SuspendableTimer.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/UserContentTypes.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/UserContentURLPattern.cpp231
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/UserContentURLPattern.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/UserScript.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/UserScriptTypes.h (renamed from src/3rdparty/webkit/WebCore/page/UserScriptTypes.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/UserStyleSheet.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/UserStyleSheetTypes.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebCoreKeyboardUIMode.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitAnimation.cpp120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitAnimation.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitAnimation.idl58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitAnimationList.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitAnimationList.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitAnimationList.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitPoint.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WebKitPoint.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WindowFeatures.cpp266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WindowFeatures.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WorkerNavigator.cpp (renamed from src/3rdparty/webkit/WebCore/page/WorkerNavigator.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WorkerNavigator.h (renamed from src/3rdparty/webkit/WebCore/page/WorkerNavigator.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/WorkerNavigator.idl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/AnimationBase.cpp1431
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/AnimationBase.h249
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/AnimationController.cpp593
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/AnimationController.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/AnimationControllerPrivate.h137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/CompositeAnimation.cpp592
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/CompositeAnimation.h110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/ImplicitAnimation.cpp303
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/ImplicitAnimation.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/KeyframeAnimation.cpp461
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/animation/KeyframeAnimation.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/qt/DragControllerQt.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/qt/EventHandlerQt.cpp133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/qt/FrameQt.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/win/DragControllerWin.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/win/EventHandlerWin.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/win/FrameCGWin.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/win/FrameCairoWin.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/win/FrameWin.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/page/win/FrameWin.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Arena.cpp258
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Arena.h139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/AsyncFileStream.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/AsyncFileSystem.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/AsyncFileSystem.h153
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/AsyncFileSystemCallbacks.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/AutodrainedPool.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ColorData.gperf175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ContentType.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ContentType.h (renamed from src/3rdparty/webkit/WebCore/platform/ContentType.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ContextMenu.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ContextMenu.h121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ContextMenuItem.cpp122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ContextMenuItem.h302
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Cookie.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/CookieJar.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/CookiesStrategy.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/CrossThreadCopier.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/CrossThreadCopier.h159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Cursor.cpp526
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Cursor.h242
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DateComponents.cpp728
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DateComponents.h204
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DefaultLocalizationStrategy.cpp918
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DefaultLocalizationStrategy.h187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DragData.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DragData.h140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DragImage.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/DragImage.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/EventLoop.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileChooser.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileChooser.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileMetadata.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileStream.cpp150
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileStream.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileStreamClient.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileSystem.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FileSystem.h222
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/FloatConversion.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/GeolocationService.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/GeolocationService.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/HashTools.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/HostWindow.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/KURL.cpp1986
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/KURL.h404
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/KURLGoogle.cpp984
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/KURLGooglePrivate.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/KURLHash.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/KillRing.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/KillRingNone.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Language.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Language.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Length.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Length.h226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/LengthBox.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/LengthSize.h (renamed from src/3rdparty/webkit/WebCore/platform/LengthSize.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/LinkHash.cpp284
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/LinkHash.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/LocalizationStrategy.h203
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/LocalizedStrings.cpp709
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/LocalizedStrings.h205
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Logging.cpp141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Logging.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/MIMETypeRegistry.cpp569
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/MIMETypeRegistry.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/NotImplemented.h (renamed from src/3rdparty/webkit/WebCore/platform/NotImplemented.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Pasteboard.h150
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformGestureEvent.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformGestureRecognizer.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformGestureRecognizer.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformKeyboardEvent.h249
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformMenuDescription.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformMouseEvent.h208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformScreen.h (renamed from src/3rdparty/webkit/WebCore/platform/PlatformScreen.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformStrategies.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformStrategies.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformTouchEvent.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformTouchPoint.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PlatformWheelEvent.h204
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PopupMenu.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PopupMenuClient.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PopupMenuStyle.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PurgePriority.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/PurgeableBuffer.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/RunLoopTimer.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/RuntimeApplicationChecks.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/RuntimeApplicationChecks.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SSLKeyGenerator.h (renamed from src/3rdparty/webkit/WebCore/platform/SSLKeyGenerator.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SchemeRegistry.cpp195
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SchemeRegistry.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollAnimator.cpp132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollAnimator.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollAnimatorWin.cpp310
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollAnimatorWin.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollTypes.h163
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollView.cpp1352
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollView.h430
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollableArea.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollableArea.h179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Scrollbar.cpp527
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Scrollbar.h178
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollbarTheme.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollbarThemeComposite.cpp316
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ScrollbarThemeComposite.h (renamed from src/3rdparty/webkit/WebCore/platform/ScrollbarThemeComposite.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SearchPopupMenu.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SecureTextInput.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SecureTextInput.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SharedBuffer.cpp279
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SharedBuffer.h149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SharedBufferCRLFLineReader.cpp90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SharedBufferCRLFLineReader.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SharedTimer.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Sound.h (renamed from src/3rdparty/webkit/WebCore/platform/Sound.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SuddenTermination.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/SystemTime.h (renamed from src/3rdparty/webkit/WebCore/platform/SystemTime.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Theme.cpp (renamed from src/3rdparty/webkit/WebCore/platform/Theme.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Theme.h (renamed from src/3rdparty/webkit/WebCore/platform/Theme.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ThemeTypes.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ThreadCheck.h (renamed from src/3rdparty/webkit/WebCore/platform/ThreadCheck.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ThreadGlobalData.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ThreadGlobalData.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ThreadTimers.cpp (renamed from src/3rdparty/webkit/WebCore/platform/ThreadTimers.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/ThreadTimers.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Timer.cpp (renamed from src/3rdparty/webkit/WebCore/platform/Timer.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Timer.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/TreeShared.h148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/URLString.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/UUID.cpp123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/UUID.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/VisitedLinkStrategy.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Widget.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/Widget.h333
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/WindowsKeyboardCodes.h278
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/animation/Animation.cpp133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/animation/Animation.h165
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/animation/AnimationList.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/animation/AnimationList.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/animation/TimingFunction.h162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioArray.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioBus.cpp454
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioBus.h154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioChannel.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioChannel.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioDSPKernel.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioDSPKernelProcessor.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioDSPKernelProcessor.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioDestination.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioFileReader.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioProcessor.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioResampler.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioResampler.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioResamplerKernel.cpp143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioResamplerKernel.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioSourceProvider.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioUtilities.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/AudioUtilities.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Biquad.cpp282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Biquad.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Cone.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Cone.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Distance.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Distance.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/EqualPowerPanner.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/EqualPowerPanner.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/FFTConvolver.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/FFTConvolver.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/FFTFrame.cpp273
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/FFTFrame.h182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/FFTFrameStub.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFDatabase.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFDatabase.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFDatabaseLoader.cpp140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFDatabaseLoader.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFElevation.cpp266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFElevation.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFKernel.cpp142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFKernel.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFPanner.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/HRTFPanner.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Panner.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Panner.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Reverb.cpp227
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/Reverb.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbAccumulationBuffer.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbAccumulationBuffer.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbConvolver.cpp230
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbConvolver.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbConvolverStage.cpp165
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbConvolverStage.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbInputBuffer.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ReverbInputBuffer.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/SincResampler.cpp342
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/SincResampler.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/VectorMath.cpp94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/VectorMath.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp218
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/fftw/FFTFrameFFTW.cpp305
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/mac/AudioBusMac.mm66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/mac/AudioDestinationMac.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp258
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp199
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/mkl/FFTFrameMKL.cpp268
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T000_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T015_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T030_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T045_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T060_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T075_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T090_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T105_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T120_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T135_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T150_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T165_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T180_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T195_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T210_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T225_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T240_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T255_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T270_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T285_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T300_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T315_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T330_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P000.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P015.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P030.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P045.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P060.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P075.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P090.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P315.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P330.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/audio/resources/IRC_Composite_C_R0195_T345_P345.wavbin0 -> 1068 bytes-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/BinaryPropertyList.cpp832
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/BinaryPropertyList.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/FileSystemCF.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/KURLCFNet.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/RunLoopTimerCF.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/SchedulePair.cpp (renamed from src/3rdparty/webkit/WebCore/platform/cf/SchedulePair.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/SchedulePair.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/SharedBufferCF.cpp120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/win/CertificateCFWin.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cf/win/CertificateCFWin.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cocoa/KeyEventCocoa.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/cocoa/KeyEventCocoa.mm584
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/BitmapImage.cpp469
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/BitmapImage.h303
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Color.cpp426
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Color.h190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ColorSpace.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ContextShadow.cpp266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ContextShadow.h145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/DashArray.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Extensions3D.h126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatPoint.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatPoint.h212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatPoint3D.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatPoint3D.h187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatQuad.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/FloatQuad.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatQuad.h152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatRect.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatRect.h225
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatSize.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatSize.h160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Font.cpp588
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Font.h273
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontBaseline.h35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontCache.cpp469
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontCache.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontData.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/FontData.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontData.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontDescription.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontDescription.h195
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontFallbackList.cpp122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontFallbackList.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontFamily.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/FontFamily.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontFamily.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontFastPath.cpp525
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontMetrics.h127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontOrientation.h35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontPlatformData.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontPlatformData.h352
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontRenderingMode.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/FontRenderingMode.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontSelector.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontSmoothingMode.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/FontSmoothingMode.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontTraitsMask.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/FontTraitsMask.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FontWidthVariant.h35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GeneratedImage.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GeneratedImage.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/GeneratedImage.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Generator.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/Generator.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Glyph.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GlyphBuffer.h214
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GlyphMetricsMap.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GlyphPage.h145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp440
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GlyphPageTreeNode.h139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Gradient.cpp231
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Gradient.h173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsContext.cpp742
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsContext.h594
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsContext3D.cpp1623
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsContext3D.h940
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsLayer.cpp546
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsLayer.h434
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsLayerClient.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayerClient.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsTypes.cpp189
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsTypes.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/GraphicsTypes3D.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Icon.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Image.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Image.h183
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ImageBuffer.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ImageBuffer.h138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ImageBufferData.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ImageObserver.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/ImageObserver.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ImageSource.cpp192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ImageSource.h202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/IntPoint.h227
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/IntPointHash.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/IntRect.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/IntRect.h248
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/IntRectHash.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/IntSize.h192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/IntSizeHash.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/MediaPlayer.cpp861
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/MediaPlayer.h348
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/MediaPlayerPrivate.h154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Path.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Path.h156
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/PathTraversalState.cpp207
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/PathTraversalState.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Pattern.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Pattern.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/RoundedIntRect.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/RoundedIntRect.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/SVGGlyph.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/SVGGlyph.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/SegmentedFontData.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/SegmentedFontData.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/SegmentedFontData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ShadowBlur.cpp834
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ShadowBlur.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/SimpleFontData.cpp273
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/SimpleFontData.h320
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/StringTruncator.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/StringTruncator.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/StrokeStyleApplier.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/StrokeStyleApplier.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/TextRenderingMode.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/TextRenderingMode.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/TextRun.h148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/Tile.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/TiledBackingStore.cpp412
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/TiledBackingStore.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/TiledBackingStoreClient.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/TypesettingFeatures.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/TypesettingFeatures.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/UnitBezier.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/UnitBezier.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/WOFFFileFormat.cpp254
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/WOFFFileFormat.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/WidthIterator.cpp261
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/WidthIterator.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp775
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h284
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm919
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp2382
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h414
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h161
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/PlatformCALayer.h226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/TransformationMatrixCA.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm563
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm752
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/AbstractCACFLayerTreeHost.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp327
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHostClient.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.cpp402
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp531
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp744
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp486
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ColorCG.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/FloatPointCG.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/FloatRectCG.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/FloatSizeCG.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/GradientCG.cpp145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp280
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp1513
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp391
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp391
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageCG.cpp366
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp359
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageSourceCG.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageSourceCGMac.mm48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/ImageSourceCGWin.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/IntPointCG.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/IntRectCG.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/IntSizeCG.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp193
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/PathCG.cpp315
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/PatternCG.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/DistantLightSource.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/DistantLightSource.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEBlend.cpp180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEBlend.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp249
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEColorMatrix.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp250
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEComposite.cpp307
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEComposite.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp491
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp183
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEDisplacementMap.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEDropShadow.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEFlood.cpp101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEFlood.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FELighting.cpp377
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FELighting.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEMerge.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEMerge.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEMorphology.cpp210
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEMorphology.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEOffset.cpp114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FEOffset.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FESpecularLighting.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FESpecularLighting.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FETile.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FETile.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FETurbulence.cpp454
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FETurbulence.h127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/Filter.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FilterEffect.cpp268
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/FilterEffect.h157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/LightSource.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/LightSource.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/PointLightSource.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/PointLightSource.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/SourceAlpha.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/SourceGraphic.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/SpotLightSource.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/SpotLightSource.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FEGaussianBlurNEON.cpp343
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FEGaussianBlurNEON.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp498
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.h174
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/freetype/FontPlatformData.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp287
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp161
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/BicubicShader.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/BicubicShader.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/ConvolutionShader.cpp126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/ConvolutionShader.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp301
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h155
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/GraphicsContextGPU.cpp931
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/GraphicsContextGPU.h140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnConstants.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp279
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h270
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnMathUtils.cpp670
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnMathUtils.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnPathCache.cpp86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnPathCache.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnPathProcessor.cpp1233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnPathProcessor.h126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnShader.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnShader.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnSolidFillShader.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnSolidFillShader.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnTextureCoords.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/LoopBlinnTextureCoords.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/PODArena.h212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/PODInterval.h165
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h224
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h759
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/Shader.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/Shader.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp494
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/SolidFillShader.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/SolidFillShader.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/TexShader.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/TexShader.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/Texture.cpp216
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/Texture.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/TilingData.cpp251
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/TilingData.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp230
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerQt.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp1753
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h195
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowEfl.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowMac.mm49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp129
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp374
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp847
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/ColorMac.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/ColorMac.mm112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp532
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/ComplexTextController.h201
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp343
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FloatPointMac.mm45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FloatRectMac.mm45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FloatSizeMac.mm45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FontCacheMac.mm214
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/FontMac.mm252
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm176
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/IconMac.mm81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/ImageMac.mm124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/IntPointMac.mm44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/IntRectMac.mm49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/IntSizeMac.mm44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm1793
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerProxy.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm418
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/WebGLLayer.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/WebGLLayer.mm167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/WebLayer.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/WebLayer.mm225
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/WebTiledLayer.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp1527
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp663
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opentype/OpenTypeSanitizer.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeSanitizer.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opentype/OpenTypeUtilities.cpp447
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/opentype/OpenTypeUtilities.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeUtilities.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/EGLUtils.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLUtils.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp531
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/ImageOpenVG.cpp199
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/PainterOpenVG.cpp1242
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/PathOpenVG.cpp497
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/PlatformPathOpenVG.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/openvg/PlatformPathOpenVG.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/SharedResourceOpenVG.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/openvg/SharedResourceOpenVG.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/SharedResourceOpenVG.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/openvg/SharedResourceOpenVG.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/TiledImageOpenVG.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/TiledImageOpenVG.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/VGUtils.cpp235
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/openvg/VGUtils.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/pango/FontCachePango.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/pango/FontPlatformData.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/pango/FontPlatformDataPango.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/pango/GlyphPageTreeNodePango.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp163
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/ColorQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/ColorQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp168
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/Extensions3DQt.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FloatPointQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/FloatPointQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FloatRectQt.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FontPlatformData.h181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/FontQt.cpp483
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GlyphPageTreeNodeQt.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GradientQt.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp1762
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp1407
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp1777
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/IconQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/IconQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp427
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp250
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/ImageDecoderQt.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/ImageQt.cpp271
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/IntPointQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/IntPointQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/IntRectQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/IntRectQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/IntSizeQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/IntSizeQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp671
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/PathQt.cpp439
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/PatternQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/PatternQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/StillImageQt.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/StillImageQt.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp214
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/TextureMapperQt.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/TileQt.cpp183
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/TransparencyLayer.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp380
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/texmap/TextureMapper.h137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp877
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h252
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp378
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/AffineTransform.h193
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/IdentityTransformOperation.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/ScaleTransformOperation.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/TransformOperation.h (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/TransformOperation.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/transforms/TransformOperations.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/TransformOperations.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp1129
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h360
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/DIBPixelData.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/DIBPixelData.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontCGWin.cpp396
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontCacheWin.cpp603
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp218
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FontWin.cpp148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FullScreenController.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FullScreenController.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GDIExtras.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GDIExtras.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp174
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp757
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/GraphicsLayerCACF.h139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/IconWin.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/ImageCGWin.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/ImageCairoWin.cpp114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/ImageWin.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/win/ImageWin.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/IntPointWin.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/win/IntPointWin.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/IntRectWin.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/IntSizeWin.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/win/IntSizeWin.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/LocalWindowsContext.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp205
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp1274
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp936
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h193
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateTaskTimer.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/MediaPlayerPrivateTaskTimer.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTCFDictionary.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTCFDictionary.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTDecompressionSession.cpp170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTDecompressionSession.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovie.cpp920
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovie.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieGWorld.cpp465
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieGWorld.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieTask.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieTask.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieVisualContext.cpp224
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieVisualContext.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieWinTimer.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWinTimer.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTMovieWinTimer.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTPixelBuffer.cpp256
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTPixelBuffer.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTTrack.cpp120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/QTTrack.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/RefCountedGDIHandle.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/TransformationMatrixWin.cpp (renamed from src/3rdparty/webkit/WebCore/platform/graphics/win/TransformationMatrixWin.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/UniscribeController.cpp418
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/UniscribeController.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/WKCAImageQueue.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/WKCAImageQueue.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/WebLayer.cpp143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/WebLayer.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/WebTiledLayer.cpp303
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/win/WebTiledLayer.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/ImageDecoder.cpp321
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/ImageDecoder.h358
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/cg/ImageDecoderCG.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/openvg/ImageDecoderOpenVG.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp135
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-encoders/JPEGImageEncoder.h33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-encoders/PNGImageEncoder.cpp126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/image-encoders/PNGImageEncoder.h33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/leveldb/LevelDBComparator.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/leveldb/LevelDBDatabase.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/leveldb/LevelDBIterator.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/leveldb/LevelDBIterator.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/leveldb/LevelDBSlice.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/AutodrainedPool.mm (renamed from src/3rdparty/webkit/WebCore/platform/mac/AutodrainedPool.mm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/BlockExceptions.h (renamed from src/3rdparty/webkit/WebCore/platform/mac/BlockExceptions.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/BlockExceptions.mm (renamed from src/3rdparty/webkit/WebCore/platform/mac/BlockExceptions.mm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ClipboardMac.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ClipboardMac.mm425
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ContextMenuItemMac.mm192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ContextMenuMac.mm113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/CookieJar.mm274
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/CursorMac.mm226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/DragDataMac.mm160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/DragImageMac.mm312
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/EventLoopMac.mm42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/FileChooserMac.mm55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/FileSystemMac.mm81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/FoundationExtras.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/HTMLConverter.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/HTMLConverter.mm1768
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/KURLMac.mm72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/KeyEventMac.mm266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/KillRingMac.mm83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/Language.mm120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm (renamed from src/3rdparty/webkit/WebCore/platform/mac/LocalCurrentGraphicsContext.mm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/LocalizedStringsMac.mm50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/LoggingMac.mm77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/PasteboardHelper.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/PasteboardMac.mm597
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/PlatformMouseEventMac.mm (renamed from src/3rdparty/webkit/WebCore/platform/mac/PlatformMouseEventMac.mm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/PlatformScreenMac.mm113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/PopupMenuMac.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/PopupMenuMac.mm232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/PurgeableBufferMac.cpp156
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SSLKeyGeneratorMac.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SchedulePairMac.mm (renamed from src/3rdparty/webkit/WebCore/platform/mac/SchedulePairMac.mm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ScrollAnimatorMac.h162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ScrollAnimatorMac.mm1234
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ScrollViewMac.mm213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ScrollbarThemeMac.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ScrollbarThemeMac.mm556
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SearchPopupMenuMac.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SearchPopupMenuMac.mm80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SharedBufferMac.mm124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SharedTimerMac.mm196
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SoftLinking.h137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SoundMac.mm (renamed from src/3rdparty/webkit/WebCore/platform/mac/SoundMac.mm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SuddenTermination.mm45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/SystemTimeMac.cpp (renamed from src/3rdparty/webkit/WebCore/platform/mac/SystemTimeMac.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ThemeMac.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ThemeMac.mm748
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/ThreadCheck.mm118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm (renamed from src/3rdparty/webkit/WebCore/platform/mac/WebCoreNSStringExtras.mm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreObjCExtras.h (renamed from src/3rdparty/webkit/WebCore/platform/mac/WebCoreObjCExtras.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreObjCExtras.mm82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.h297
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.mm185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreView.h (renamed from src/3rdparty/webkit/WebCore/platform/mac/WebCoreView.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreView.m (renamed from src/3rdparty/webkit/WebCore/platform/mac/WebCoreView.m)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebFontCache.h (renamed from src/3rdparty/webkit/WebCore/platform/mac/WebFontCache.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebFontCache.mm310
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebNSAttributedStringExtras.h30
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WebNSAttributedStringExtras.mm59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WheelEventMac.mm120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mac/WidgetMac.mm426
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/DeviceOrientationClientMock.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/DeviceOrientationClientMock.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/GeolocationClientMock.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/GeolocationClientMock.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/GeolocationServiceMock.cpp140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/GeolocationServiceMock.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/SpeechInputClientMock.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/mock/SpeechInputClientMock.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/AuthenticationChallengeBase.cpp (renamed from src/3rdparty/webkit/WebCore/platform/network/AuthenticationChallengeBase.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/AuthenticationChallengeBase.h (renamed from src/3rdparty/webkit/WebCore/platform/network/AuthenticationChallengeBase.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/AuthenticationClient.h (renamed from src/3rdparty/webkit/WebCore/platform/network/AuthenticationClient.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobData.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobData.h185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobRegistry.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobRegistryImpl.cpp180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobRegistryImpl.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobResourceHandle.cpp618
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobResourceHandle.h119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/BlobStorageData.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/CookieStorage.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/Credential.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/Credential.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/CredentialStorage.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/CredentialStorage.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/DNS.h38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/DataURL.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/DataURL.h37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/FormData.cpp475
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/FormData.h158
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/FormDataBuilder.cpp217
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/FormDataBuilder.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/HTTPHeaderMap.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/HTTPHeaderMap.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/HTTPParsers.cpp375
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/HTTPParsers.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/HTTPStatusCodes.h27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/MIMESniffing.cpp495
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/MIMESniffing.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/NetworkStateNotifier.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/NetworkStateNotifier.h124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/NetworkingContext.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ProtectionSpace.cpp (renamed from src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ProtectionSpace.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ProtectionSpaceHash.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ProxyServer.cpp75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ProxyServer.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceErrorBase.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceErrorBase.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceHandle.cpp231
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceHandle.h238
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceHandleClient.h117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceHandleInternal.h221
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceLoadInfo.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceLoadPriority.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceLoadTiming.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceRequestBase.cpp457
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceRequestBase.h246
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.cpp688
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.h208
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/SocketStreamErrorBase.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/SocketStreamErrorBase.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/SocketStreamHandleBase.cpp (renamed from src/3rdparty/webkit/WebCore/platform/network/SocketStreamHandleBase.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/SocketStreamHandleBase.h (renamed from src/3rdparty/webkit/WebCore/platform/network/SocketStreamHandleBase.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/SocketStreamHandleClient.h (renamed from src/3rdparty/webkit/WebCore/platform/network/SocketStreamHandleClient.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/AuthenticationChallenge.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/CredentialStorageQt.cpp38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/DnsPrefetchHelper.cpp (renamed from src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/DnsPrefetchHelper.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/ProxyServerQt.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp683
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h189
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/ResourceError.h (renamed from src/3rdparty/webkit/WebCore/platform/network/qt/ResourceError.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/ResourceRequest.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/ResourceResponse.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/SocketStreamError.h (renamed from src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamError.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/SocketStreamHandle.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp205
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/posix/FileSystemPOSIX.cpp258
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ClipboardQt.cpp386
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ClipboardQt.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ContextMenuItemQt.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ContextMenuQt.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/CookieJarQt.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/CursorQt.cpp209
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/DataTransferItemQt.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/DataTransferItemQt.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/DataTransferItemsQt.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/DataTransferItemsQt.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/DragDataQt.cpp141
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/DragImageQt.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/EventLoopQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/qt/EventLoopQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/FileChooserQt.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/FileSystemQt.cpp223
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/KURLQt.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/LanguageQt.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/LoggingQt.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PasteboardQt.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PlatformBridge.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PlatformBridgeQt.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp667
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PlatformMouseEventQt.cpp132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PlatformScreenQt.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PlatformTouchEventQt.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/PlatformTouchPointQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/qt/PlatformTouchPointQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/QWebPageClient.h110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/QtMobileWebStyle.cpp381
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/QtMobileWebStyle.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/QtStyleOptionWebComboBox.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/RenderThemeQt.cpp1504
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/RenderThemeQt.h226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ScreenQt.cpp99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ScrollViewQt.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ScrollbarQt.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp264
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/ScrollbarThemeQt.h (renamed from src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/SharedBufferQt.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/SharedTimerQt.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/SoundQt.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/TemporaryLinkStubsQt.cpp143
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.mm45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/WheelEventQt.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/qt/WidgetQt.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLValue.cpp (renamed from src/3rdparty/webkit/WebCore/platform/sql/SQLValue.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLValue.h (renamed from src/3rdparty/webkit/WebCore/platform/sql/SQLValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteAuthorizer.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp476
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteDatabase.h160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteFileSystem.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteFileSystem.h117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteStatement.cpp538
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteStatement.h107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteTransaction.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteTransaction.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/AtomicStringKeyedMRUCache.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/Base64.cpp212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/Base64.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/BidiContext.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/BidiContext.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/BidiResolver.h875
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/BidiRunList.h209
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/Hyphenation.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/Hyphenation.h39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/LineEnding.cpp231
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/LineEnding.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/LocalizedDate.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/LocalizedDateNone.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/LocalizedNumber.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/LocalizedNumberICU.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/LocalizedNumberNone.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/ParserUtilities.h (renamed from src/3rdparty/webkit/WebCore/platform/text/ParserUtilities.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/PlatformString.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/RegularExpression.cpp173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/RegularExpression.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/SegmentedString.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/SegmentedString.h288
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/String.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/StringWithDirection.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/SuffixTree.h122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextBoundaries.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextBoundaries.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextBreakIterator.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextBreakIteratorICU.cpp259
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextBreakIteratorInternalICU.h (renamed from src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorInternalICU.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCheckerClient.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextChecking.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodec.cpp (renamed from src/3rdparty/webkit/WebCore/platform/text/TextCodec.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodec.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecASCIIFastPath.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecICU.cpp473
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecICU.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecLatin1.cpp214
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecLatin1.h (renamed from src/3rdparty/webkit/WebCore/platform/text/TextCodecLatin1.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecUTF16.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecUTF16.h (renamed from src/3rdparty/webkit/WebCore/platform/text/TextCodecUTF16.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecUTF8.cpp316
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecUTF8.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecUserDefined.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextCodecUserDefined.h (renamed from src/3rdparty/webkit/WebCore/platform/text/TextCodecUserDefined.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextDirection.h (renamed from src/3rdparty/webkit/WebCore/platform/text/TextDirection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextEncoding.cpp265
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextEncoding.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextEncodingDetector.h (renamed from src/3rdparty/webkit/WebCore/platform/text/TextEncodingDetector.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextEncodingDetectorICU.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextEncodingDetectorNone.cpp (renamed from src/3rdparty/webkit/WebCore/platform/text/TextEncodingDetectorNone.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextEncodingRegistry.cpp389
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextEncodingRegistry.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextOrientation.h35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextStream.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/TextStream.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/UnicodeBidi.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/UnicodeRange.cpp (renamed from src/3rdparty/webkit/WebCore/platform/text/UnicodeRange.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/UnicodeRange.h (renamed from src/3rdparty/webkit/WebCore/platform/text/UnicodeRange.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/cf/HyphenationCF.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/cf/StringCF.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/cf/StringImplCF.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/CharsetData.h (renamed from src/3rdparty/webkit/WebCore/platform/text/mac/CharsetData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/HyphenationMac.mm70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/LocalizedNumberMac.mm77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/ShapeArabic.c (renamed from src/3rdparty/webkit/WebCore/platform/text/mac/ShapeArabic.c)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/ShapeArabic.h (renamed from src/3rdparty/webkit/WebCore/platform/text/mac/ShapeArabic.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/StringImplMac.mm33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/StringMac.mm42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/TextBoundaries.mm78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/TextCodecMac.cpp329
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/TextCodecMac.h (renamed from src/3rdparty/webkit/WebCore/platform/text/mac/TextCodecMac.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/character-sets.txt (renamed from src/3rdparty/webkit/WebCore/platform/text/mac/character-sets.txt)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/mac/mac-encodings.txt (renamed from src/3rdparty/webkit/WebCore/platform/text/mac/mac-encodings.txt)0
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebCore/platform/text/mac/make-charset-table.pl (renamed from src/3rdparty/webkit/WebCore/platform/text/mac/make-charset-table.pl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/qt/TextBoundariesQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundariesQt.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/qt/TextCodecQt.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/qt/TextCodecQt.h (renamed from src/3rdparty/webkit/WebCore/platform/text/qt/TextCodecQt.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/transcoder/FontTranscoder.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/transcoder/FontTranscoder.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp (renamed from src/3rdparty/webkit/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp325
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/wince/TextCodecWinCE.cpp308
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/text/wince/TextCodecWinCE.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/win/BitmapInfo.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/win/BitmapInfo.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/win/SystemInfo.cpp181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/win/SystemInfo.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/win/SystemTimeWin.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/win/WebCoreInstanceHandle.cpp (renamed from src/3rdparty/webkit/WebCore/platform/win/WebCoreInstanceHandle.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/win/WebCoreInstanceHandle.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMMimeType.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMMimeType.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMMimeType.idl30
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMMimeTypeArray.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMMimeTypeArray.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMMimeTypeArray.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMPlugin.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMPlugin.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMPlugin.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMPluginArray.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMPluginArray.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/DOMPluginArray.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/IFrameShimSupport.cpp167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/IFrameShimSupport.h34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginData.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginData.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginDataNone.cpp40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginDatabase.cpp665
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginDatabase.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginDebug.cpp176
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginDebug.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginMainThreadScheduler.cpp (renamed from src/3rdparty/webkit/WebCore/plugins/PluginMainThreadScheduler.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginMainThreadScheduler.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginPackage.cpp397
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginPackage.h149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginPackageNone.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginQuirkSet.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginStrategy.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginStream.cpp472
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginStream.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginView.cpp1530
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginView.h470
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginViewBase.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/PluginViewNone.cpp169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp307
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginViewMac.mm821
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/npapi.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/npfunctions.h223
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginContainerQt.cpp150
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginContainerQt.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp199
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/qt/PluginViewQt.cpp1041
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/symbian/PluginContainerSymbian.cpp (renamed from src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/symbian/PluginContainerSymbian.h (renamed from src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/symbian/PluginDatabaseSymbian.cpp (renamed from src/3rdparty/webkit/WebCore/plugins/symbian/PluginDatabaseSymbian.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/symbian/PluginPackageSymbian.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp518
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/symbian/npinterface.h37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/win/PaintHooks.asm (renamed from src/3rdparty/webkit/WebCore/plugins/win/PaintHooks.asm)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/win/PluginDatabaseWin.cpp451
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/win/PluginMessageThrottlerWin.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/win/PluginMessageThrottlerWin.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/win/PluginPackageWin.cpp345
-rw-r--r--src/3rdparty/webkit/Source/WebCore/plugins/win/PluginViewWin.cpp1079
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/AutoTableLayout.cpp748
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/AutoTableLayout.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/BidiRun.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/BidiRun.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/BidiRun.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/ColumnInfo.h103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/CounterNode.cpp331
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/CounterNode.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/EllipsisBox.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/EllipsisBox.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/FixedTableLayout.cpp332
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/FixedTableLayout.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/GapRects.h (renamed from src/3rdparty/webkit/WebCore/rendering/GapRects.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/HitTestRequest.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/HitTestResult.cpp619
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/HitTestResult.h167
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/InlineBox.cpp382
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/InlineBox.h397
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/InlineFlowBox.cpp1463
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/InlineFlowBox.h322
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/InlineIterator.h337
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/InlineTextBox.cpp1320
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/InlineTextBox.h192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/LayoutState.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/LayoutState.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/OverlapTestRequestClient.h (renamed from src/3rdparty/webkit/WebCore/rendering/OverlapTestRequestClient.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/PaintInfo.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/PaintPhase.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/PointerEventsHitRules.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/PointerEventsHitRules.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderApplet.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderApplet.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderArena.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderArena.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBR.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBR.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBlock.cpp6372
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBlock.h849
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBlockLineLayout.cpp2461
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBox.cpp3485
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBox.h526
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBoxModelObject.cpp2254
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderBoxModelObject.h195
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderButton.cpp178
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderButton.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderCombineText.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderCombineText.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderCounter.cpp708
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderCounter.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderDetails.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderDetails.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderDetailsMarker.cpp159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderDetailsMarker.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderEmbeddedObject.cpp310
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderEmbeddedObject.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFieldset.cpp200
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFieldset.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp336
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFlexibleBox.cpp1087
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFlexibleBox.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFrame.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFrame.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFrameBase.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFrameBase.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFrameSet.cpp788
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFrameSet.h142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFullScreen.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderFullScreen.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderHTMLCanvas.cpp90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderHTMLCanvas.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderIFrame.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderIFrame.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderImage.cpp528
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderImage.h122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderImageResource.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderImageResource.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderImageResourceStyleImage.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderImageResourceStyleImage.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderInline.cpp1549
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderInline.h192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderInputSpeech.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderInputSpeech.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLayer.cpp4142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLayer.h737
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLayerBacking.cpp1478
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLayerBacking.h220
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLayerCompositor.cpp1828
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLayerCompositor.h307
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLineBoxList.cpp398
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderLineBoxList.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderListBox.cpp845
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderListBox.h162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderListItem.cpp463
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderListItem.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderListMarker.cpp1720
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderListMarker.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMarquee.cpp319
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMarquee.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMedia.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMedia.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMediaControls.cpp198
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMediaControls.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMediaControlsChromium.cpp303
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMediaControlsChromium.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMenuList.cpp571
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMenuList.h152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMeter.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderMeter.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.cpp2686
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderObject.h1148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderObjectChildList.cpp474
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderObjectChildList.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderOverflow.h164
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderPart.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderPart.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderProgress.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderProgress.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderQuote.cpp331
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderQuote.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderReplaced.cpp408
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderReplaced.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderReplica.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderReplica.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.cpp312
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRuby.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRubyBase.cpp215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRubyBase.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRubyRun.cpp308
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRubyRun.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRubyText.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderRubyText.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbar.cpp366
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbar.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbarPart.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbarPart.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbarTheme.cpp140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderScrollbarTheme.h (renamed from src/3rdparty/webkit/WebCore/rendering/RenderScrollbarTheme.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderSelectionInfo.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderSlider.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderSlider.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderSummary.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderSummary.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTable.cpp1226
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTable.h282
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableCell.cpp1068
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableCell.h180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableCol.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableCol.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableRow.cpp235
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableRow.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp1218
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.h185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderText.cpp1600
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderText.h211
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextControl.cpp663
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextControl.h138
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextControlMultiLine.cpp161
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextControlMultiLine.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextControlSingleLine.cpp1160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextControlSingleLine.h192
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextFragment.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTextFragment.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTheme.cpp1109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTheme.h339
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp346
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumLinux.h103
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumMac.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumMac.mm189
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp591
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumSkia.h162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumWin.cpp789
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeChromiumWin.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeMac.h245
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeSafari.cpp1211
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeSafari.h186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeWin.cpp1115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeWin.h183
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeWinCE.cpp648
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderThemeWinCE.h142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTreeAsText.cpp828
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderTreeAsText.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderVideo.cpp287
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderVideo.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderView.cpp807
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderView.h332
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderWidget.cpp404
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderWidget.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderWidgetProtector.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderWordBreak.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/RenderWordBreak.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderWordBreak.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RenderingAllInOne.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RootInlineBox.cpp823
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/RootInlineBox.h211
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/ScrollBehavior.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/ScrollBehavior.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/ScrollBehavior.h (renamed from src/3rdparty/webkit/WebCore/rendering/ScrollBehavior.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/ShadowElement.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/ShadowElement.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/TableLayout.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/TrailingFloatsRootInlineBox.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/TransformState.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/TransformState.h135
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/VerticalPositionCache.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/break_lines.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/break_lines.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (renamed from src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp147
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLFenced.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLFraction.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp (renamed from src/3rdparty/webkit/WebCore/mathml/RenderMathMLMath.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLMath.h (renamed from src/3rdparty/webkit/WebCore/mathml/RenderMathMLMath.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp344
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLOperator.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLRoot.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLRow.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp299
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/BorderData.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/BorderValue.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/CollapsedBorderValue.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/ContentData.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/ContentData.h127
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/CounterContent.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/CounterDirectives.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/style/CounterDirectives.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/CounterDirectives.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/CursorData.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/CursorList.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/DataRef.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/DataRef.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/FillLayer.cpp268
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/FillLayer.h202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/KeyframeList.cpp97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/KeyframeList.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/LineClampValue.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/LineClampValue.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/NinePieceImage.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/style/NinePieceImage.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/NinePieceImage.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/OutlineValue.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/QuotesData.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/QuotesData.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/RenderStyle.cpp1499
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/RenderStyle.h1381
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/RenderStyleConstants.h435
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/SVGRenderStyle.cpp223
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/SVGRenderStyle.h447
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp225
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/SVGRenderStyleDefs.h268
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/ShadowData.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/ShadowData.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleAllInOne.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleBackgroundData.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleBackgroundData.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleBackgroundData.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleBoxData.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleBoxData.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleCachedImage.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleCachedImage.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleDashboardRegion.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleDashboardRegion.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleFlexibleBoxData.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleFlexibleBoxData.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleFlexibleBoxData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleGeneratedImage.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleGeneratedImage.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleImage.h84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleInheritedData.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleInheritedData.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleMarqueeData.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleMarqueeData.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleMarqueeData.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleMarqueeData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleMultiColData.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleMultiColData.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StylePendingImage.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleRareInheritedData.cpp156
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleRareInheritedData.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleRareNonInheritedData.h140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleReflection.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleReflection.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleSurroundData.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleSurroundData.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleSurroundData.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleSurroundData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleTransformData.cpp (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleTransformData.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleTransformData.h (renamed from src/3rdparty/webkit/WebCore/rendering/style/StyleTransformData.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleVisualData.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/style/StyleVisualData.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGAllInOne.cpp76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGBlock.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGBlock.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGContainer.cpp184
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGContainer.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGForeignObject.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGGradientStop.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGGradientStop.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGHiddenContainer.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGHiddenContainer.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGImage.cpp193
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGImage.h99
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGInline.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGInline.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp260
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGInlineText.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGModelObject.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGPath.cpp335
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGPath.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResource.cpp164
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResource.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp346
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp366
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp281
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceLinearGradient.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceLinearGradient.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp174
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp223
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp292
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGRoot.cpp358
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGRoot.h121
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGShadowTreeRootContainer.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGShadowTreeRootContainer.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGTSpan.cpp37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGTSpan.h37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGText.cpp287
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGText.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGTextPath.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGTransformableContainer.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGTransformableContainer.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGImageBufferTools.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGInlineFlowBox.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp716
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGInlineTextBox.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGMarkerData.h134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.cpp132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGRenderSupport.cpp351
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGRenderSupport.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp755
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGResources.cpp676
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGResources.h180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGResourcesCache.cpp169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGResourcesCache.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.cpp213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp323
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGRootInlineBox.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGShadowTreeElements.cpp94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGShadowTreeElements.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextChunk.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextChunk.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextChunkBuilder.cpp264
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextFragment.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutAttributes.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp296
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp679
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp237
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextMetrics.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextMetrics.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextQuery.cpp562
-rw-r--r--src/3rdparty/webkit/Source/WebCore/rendering/svg/SVGTextQuery.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/AbstractDatabase.cpp497
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/AbstractDatabase.h132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/ChangeVersionWrapper.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/ChangeVersionWrapper.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/Database.cpp420
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/Database.h120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/Database.idl42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseAuthorizer.cpp438
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseAuthorizer.h126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseCallback.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseCallback.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseDetails.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseSync.cpp199
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseSync.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseSync.idl44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseTask.cpp184
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseTask.h177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseThread.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseThread.h95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseTracker.cpp1108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseTracker.h180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/DatabaseTrackerClient.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBAny.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBAny.h126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBAny.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBBackingStore.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCallbacks.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursor.cpp122
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursor.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursor.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursorBackendImpl.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursorBackendImpl.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursorBackendInterface.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursorWithValue.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursorWithValue.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBCursorWithValue.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabase.cpp227
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabase.h125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabase.idl63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseBackendImpl.cpp277
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseBackendImpl.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseBackendInterface.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseCallbacks.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseCallbacksImpl.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseCallbacksImpl.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseError.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseError.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseException.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBDatabaseException.idl58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBEventDispatcher.cpp92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBEventDispatcher.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBFactory.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBFactory.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBFactory.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBFactoryBackendImpl.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBFactoryBackendImpl.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBFactoryBackendInterface.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBFactoryBackendInterface.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBIndex.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBIndex.h80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBIndex.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBIndexBackendImpl.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBIndexBackendImpl.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBIndexBackendInterface.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKey.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKey.h119
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKey.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKeyPath.cpp269
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKeyPath.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKeyPathBackendImpl.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKeyPathBackendImpl.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKeyRange.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKeyRange.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBKeyRange.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBLevelDBBackingStore.cpp1273
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBLevelDBBackingStore.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBLevelDBCoding.cpp1279
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBLevelDBCoding.h278
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBObjectStore.cpp171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBObjectStore.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBObjectStore.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp537
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBObjectStoreBackendImpl.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBObjectStoreBackendInterface.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBPendingTransactionMonitor.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBPendingTransactionMonitor.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBRequest.cpp334
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBRequest.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBRequest.idl65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBSQLiteBackingStore.cpp1020
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBSQLiteBackingStore.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransaction.cpp207
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransaction.h115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransaction.idl60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransactionBackendImpl.cpp215
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransactionBackendImpl.h96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransactionBackendInterface.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransactionCallbacks.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransactionCoordinator.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBTransactionCoordinator.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBVersionChangeEvent.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBVersionChangeEvent.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBVersionChangeEvent.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBVersionChangeRequest.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBVersionChangeRequest.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/IDBVersionChangeRequest.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/LocalStorageTask.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/LocalStorageTask.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/LocalStorageThread.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/LocalStorageThread.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/OriginQuotaManager.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/OriginQuotaManager.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/OriginUsageRecord.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/OriginUsageRecord.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLCallbackWrapper.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLError.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLError.idl49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLException.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLException.idl51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLResultSet.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLResultSet.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLResultSet.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLResultSetRowList.cpp (renamed from src/3rdparty/webkit/WebCore/storage/SQLResultSetRowList.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLResultSetRowList.h (renamed from src/3rdparty/webkit/WebCore/storage/SQLResultSetRowList.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLResultSetRowList.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatement.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatement.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatementCallback.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatementCallback.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatementErrorCallback.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatementErrorCallback.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatementSync.cpp126
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLStatementSync.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransaction.cpp593
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransaction.h137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransaction.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionCallback.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionCallback.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionClient.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionClient.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionCoordinator.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionCoordinator.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionErrorCallback.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionErrorCallback.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionSync.cpp212
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionSync.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionSync.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionSyncCallback.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/SQLTransactionSyncCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/Storage.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/Storage.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/Storage.idl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageArea.h (renamed from src/3rdparty/webkit/WebCore/storage/StorageArea.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageAreaImpl.cpp264
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageAreaImpl.h89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageAreaSync.cpp477
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageAreaSync.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageEvent.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageEvent.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageEvent.idl42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageEventDispatcher.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageEventDispatcher.h (renamed from src/3rdparty/webkit/WebCore/storage/StorageEventDispatcher.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfo.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfo.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfo.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfoErrorCallback.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfoErrorCallback.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfoQuotaCallback.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfoUsageCallback.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageInfoUsageCallback.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageMap.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageMap.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageNamespace.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageNamespace.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageNamespaceImpl.cpp176
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageNamespaceImpl.h82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageSyncManager.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageSyncManager.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageTracker.cpp564
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageTracker.h118
-rw-r--r--src/3rdparty/webkit/Source/WebCore/storage/StorageTrackerClient.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/ColorDistance.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/ColorDistance.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/ElementTimeControl.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/ElementTimeControl.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/GradientAttributes.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/LinearGradientAttributes.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/PatternAttributes.h166
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/RadialGradientAttributes.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAElement.cpp241
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAElement.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAElement.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAllInOne.cpp160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAltGlyphElement.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAltGlyphElement.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAltGlyphElement.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAngle.cpp238
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAngle.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAngle.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateColorElement.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateColorElement.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateColorElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateElement.cpp520
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateElement.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateMotionElement.cpp263
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateMotionElement.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateTransformElement.cpp240
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateTransformElement.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimateTransformElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedAngle.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedAngle.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedBoolean.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedBoolean.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedEnumeration.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedEnumeration.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedInteger.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedInteger.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedLength.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedLength.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedLengthList.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedLengthList.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedNumber.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedNumber.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedNumberList.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedNumberList.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedRect.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedRect.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedString.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedString.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedTransformList.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimatedTransformList.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimationElement.cpp569
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimationElement.h125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGAnimationElement.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGCircleElement.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGCircleElement.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGCircleElement.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGClipPathElement.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGClipPathElement.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGClipPathElement.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGColor.cpp153
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGColor.h92
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGColor.idl44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp159
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGComponentTransferFunctionElement.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGComponentTransferFunctionElement.idl49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGCursorElement.cpp160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGCursorElement.h77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGCursorElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDefsElement.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDefsElement.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDefsElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDescElement.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDescElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDescElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDocument.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDocument.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDocument.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.cpp281
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGDocumentExtensions.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElement.cpp382
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElement.h142
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElementInstance.cpp163
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElementInstance.h174
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElementInstance.idl100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElementInstanceList.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElementInstanceList.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElementInstanceList.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGElementRareData.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGEllipseElement.cpp181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGEllipseElement.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGEllipseElement.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGException.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGException.idl42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGExternalResourcesRequired.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGExternalResourcesRequired.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGExternalResourcesRequired.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEBlendElement.cpp148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEBlendElement.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEBlendElement.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEColorMatrixElement.cpp174
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEColorMatrixElement.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEColorMatrixElement.idl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEComponentTransferElement.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEComponentTransferElement.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEComponentTransferElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFECompositeElement.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFECompositeElement.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFECompositeElement.idl51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp261
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEConvolveMatrixElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDiffuseLightingElement.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDiffuseLightingElement.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDisplacementMapElement.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDisplacementMapElement.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDistantLightElement.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDistantLightElement.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDistantLightElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDropShadowElement.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDropShadowElement.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEDropShadowElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFloodElement.cpp86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFloodElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFloodElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncAElement.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncAElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncAElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncBElement.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncBElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncBElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncGElement.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncGElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncGElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncRElement.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncRElement.h40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEFuncRElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEGaussianBlurElement.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEGaussianBlurElement.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEImageElement.cpp184
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEImageElement.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEImageElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFELightElement.cpp213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFELightElement.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMergeElement.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMergeElement.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMergeElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMergeNodeElement.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMergeNodeElement.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMergeNodeElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMorphologyElement.cpp170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMorphologyElement.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEMorphologyElement.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEOffsetElement.cpp120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEOffsetElement.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEOffsetElement.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEPointLightElement.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEPointLightElement.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFEPointLightElement.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFESpecularLightingElement.cpp231
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFESpecularLightingElement.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFESpecularLightingElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFESpotLightElement.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFESpotLightElement.h41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFESpotLightElement.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFETileElement.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFETileElement.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFETileElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFETurbulenceElement.cpp178
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFETurbulenceElement.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFETurbulenceElement.idl51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFilterElement.cpp263
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFilterElement.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFilterElement.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp181
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFitToViewBox.cpp115
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFitToViewBox.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFitToViewBox.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFont.cpp452
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontData.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontData.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontElement.cpp195
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontElement.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceElement.cpp356
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceElement.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceFormatElement.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceFormatElement.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceFormatElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceNameElement.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceNameElement.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceNameElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceSrcElement.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceSrcElement.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceSrcElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceUriElement.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceUriElement.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGFontFaceUriElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGForeignObjectElement.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGForeignObjectElement.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGForeignObjectElement.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGElement.cpp120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGElement.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGlyphElement.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGlyphElement.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGlyphElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGlyphMap.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGradientElement.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGradientElement.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGGradientElement.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGHKernElement.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGHKernElement.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGHKernElement.idl25
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGImageElement.cpp239
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGImageElement.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGImageElement.idl42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGImageLoader.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGImageLoader.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLangSpace.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLangSpace.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLangSpace.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLength.cpp560
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLength.h131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLength.idl56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLengthList.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLengthList.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLengthList.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLineElement.cpp170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLineElement.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLineElement.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLinearGradientElement.cpp222
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLinearGradientElement.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLinearGradientElement.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLocatable.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLocatable.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGLocatable.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMPathElement.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMPathElement.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMarkerElement.cpp250
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMarkerElement.h101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMarkerElement.idl55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMaskElement.cpp213
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMaskElement.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMaskElement.idl42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMatrix.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMatrix.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMetadataElement.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMetadataElement.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMetadataElement.idl27
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMissingGlyphElement.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMissingGlyphElement.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGMissingGlyphElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGNumber.idl29
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGNumberList.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGNumberList.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGNumberList.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPaint.cpp177
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPaint.h113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPaint.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGParserUtilities.cpp374
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGParserUtilities.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathBlender.cpp374
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathBlender.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathBuilder.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathBuilder.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathByteStream.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathByteStreamBuilder.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathByteStreamBuilder.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathByteStreamSource.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathByteStreamSource.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathConsumer.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathElement.cpp362
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathElement.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathElement.idl116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathParser.cpp488
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathParser.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathParserFactory.cpp272
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathParserFactory.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSeg.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSeg.idl56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegArc.h140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegArcAbs.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegArcRel.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegClosePath.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegClosePath.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoCubic.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoCubicAbs.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoCubicRel.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoCubicSmooth.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoQuadratic.h112
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoQuadraticAbs.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoQuadraticRel.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLineto.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoAbs.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoHorizontal.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoHorizontalAbs.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoHorizontalRel.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoRel.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoVertical.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoVerticalAbs.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegLinetoVerticalRel.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegList.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegList.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegList.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegListBuilder.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegListBuilder.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegListSource.cpp154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegListSource.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegMoveto.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegMovetoAbs.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegMovetoRel.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSegWithContext.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathSource.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathStringBuilder.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathStringBuilder.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathStringSource.cpp243
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathStringSource.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathTraversalStateBuilder.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPathTraversalStateBuilder.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPatternElement.cpp302
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPatternElement.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPatternElement.idl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPoint.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPointList.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPointList.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPointList.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolyElement.cpp155
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolyElement.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolygonElement.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolygonElement.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolygonElement.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolylineElement.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolylineElement.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPolylineElement.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPreserveAspectRatio.cpp343
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPreserveAspectRatio.h98
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGPreserveAspectRatio.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRadialGradientElement.cpp262
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRadialGradientElement.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRadialGradientElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRect.h51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRect.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRectElement.cpp222
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRectElement.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRectElement.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRenderingIntent.h49
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGRenderingIntent.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSVGElement.cpp663
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSVGElement.h182
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSVGElement.idl86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGScriptElement.cpp258
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGScriptElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGScriptElement.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSetElement.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSetElement.h43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSetElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStopElement.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStopElement.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStopElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStringList.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStringList.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStringList.idl47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStylable.cpp1
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStylable.h44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStylable.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyleElement.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyleElement.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyleElement.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.cpp509
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyledElement.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyledLocatableElement.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyledLocatableElement.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyledTransformableElement.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGStyledTransformableElement.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSwitchElement.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSwitchElement.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSwitchElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSymbolElement.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSymbolElement.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGSymbolElement.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTRefElement.cpp131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTRefElement.h59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTRefElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTSpanElement.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTSpanElement.h47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTSpanElement.idl31
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTests.cpp172
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTests.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTests.idl37
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextContentElement.cpp297
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextContentElement.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextContentElement.idl60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextElement.cpp162
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextElement.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextElement.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextPathElement.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextPathElement.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextPathElement.idl45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextPositioningElement.cpp197
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextPositioningElement.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTextPositioningElement.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTitleElement.cpp75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTitleElement.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTitleElement.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransform.cpp169
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransform.h93
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransform.idl46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformDistance.cpp266
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformDistance.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformList.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformList.h54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformList.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformable.cpp216
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformable.h58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGTransformable.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGURIReference.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGURIReference.h48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGURIReference.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGUnitTypes.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGUnitTypes.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGUseElement.cpp1113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGUseElement.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGUseElement.idl44
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGVKernElement.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGVKernElement.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGVKernElement.idl25
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGViewElement.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGViewElement.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGViewElement.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGViewSpec.cpp168
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGViewSpec.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGViewSpec.idl38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGZoomAndPan.cpp71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGZoomAndPan.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGZoomAndPan.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGZoomEvent.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGZoomEvent.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/SVGZoomEvent.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/animation/SMILTime.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/animation/SMILTime.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/animation/SMILTimeContainer.cpp322
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/animation/SMILTimeContainer.h102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/animation/SVGSMILElement.cpp999
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/animation/SVGSMILElement.h232
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/SVGImage.cpp299
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/SVGImage.h79
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/filters/SVGFEImage.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/filters/SVGFilter.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/filters/SVGFilter.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h116
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedProperty.h105
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedPropertyDescription.h88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h151
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h71
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h64
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGListProperty.h428
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGListPropertyTearOff.h190
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h160
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGProperty.h45
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGPropertyTearOff.h130
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGPropertyTraits.h65
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h67
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGStaticPropertyWithParentTearOff.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/svgattrs.in253
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/svgtags.in107
-rw-r--r--src/3rdparty/webkit/Source/WebCore/svg/xlinkattrs.in (renamed from src/3rdparty/webkit/WebCore/svg/xlinkattrs.in)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBasicProcessorNode.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBasicProcessorNode.h68
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBuffer.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBuffer.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBuffer.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBufferSourceNode.cpp455
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBufferSourceNode.h147
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioBufferSourceNode.idl41
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioChannelMerger.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioChannelMerger.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioChannelMerger.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioChannelSplitter.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioChannelSplitter.h52
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioChannelSplitter.idl30
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioContext.cpp611
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioContext.h294
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioContext.idl78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioDestinationNode.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioDestinationNode.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioDestinationNode.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioGain.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioGain.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioGainNode.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioGainNode.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioGainNode.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioListener.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioListener.h94
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioListener.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioNode.cpp317
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioNode.h171
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioNode.idl39
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioNodeInput.cpp270
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioNodeInput.h125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioNodeOutput.cpp216
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioNodeOutput.h134
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioPannerNode.cpp317
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioPannerNode.h148
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioPannerNode.idl59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioParam.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioParam.h100
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioParam.idl43
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioProcessingEvent.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioProcessingEvent.h57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioProcessingEvent.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioSourceNode.h46
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/AudioSourceNode.idl34
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/BiquadDSPKernel.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/BiquadDSPKernel.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/BiquadProcessor.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/BiquadProcessor.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/ConvolverNode.cpp154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/ConvolverNode.h69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/ConvolverNode.idl33
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DefaultAudioDestinationNode.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DefaultAudioDestinationNode.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DelayDSPKernel.cpp140
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DelayDSPKernel.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DelayNode.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DelayNode.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DelayNode.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DelayProcessor.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/DelayProcessor.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/HighPass2FilterNode.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/HighPass2FilterNode.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/HighPass2FilterNode.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/JavaScriptAudioNode.cpp272
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/JavaScriptAudioNode.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/JavaScriptAudioNode.idl40
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/LowPass2FilterNode.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/LowPass2FilterNode.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/LowPass2FilterNode.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/OfflineAudioCompletionEvent.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/OfflineAudioCompletionEvent.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/OfflineAudioCompletionEvent.idl32
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/OfflineAudioDestinationNode.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/OfflineAudioDestinationNode.h78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/RealtimeAnalyser.cpp301
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/RealtimeAnalyser.h104
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/RealtimeAnalyserNode.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/RealtimeAnalyserNode.h76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/webaudio/RealtimeAnalyserNode.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/ThreadableWebSocketChannel.cpp (renamed from src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannel.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/ThreadableWebSocketChannel.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h173
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocket.cpp307
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocket.h120
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocket.idl73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketChannel.cpp407
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketChannel.h108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketChannelClient.h (renamed from src/3rdparty/webkit/WebCore/websockets/WebSocketChannelClient.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketHandshake.cpp613
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketHandshake.h114
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketHandshakeRequest.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketHandshakeRequest.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketHandshakeResponse.cpp110
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WebSocketHandshakeResponse.h75
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp439
-rw-r--r--src/3rdparty/webkit/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h170
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/AbstractWorker.cpp101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/AbstractWorker.h83
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/AbstractWorker.idl53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/DedicatedWorkerContext.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/DedicatedWorkerContext.h74
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/DedicatedWorkerContext.idl57
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/DedicatedWorkerThread.cpp (renamed from src/3rdparty/webkit/WebCore/workers/DedicatedWorkerThread.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/DedicatedWorkerThread.h (renamed from src/3rdparty/webkit/WebCore/workers/DedicatedWorkerThread.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp420
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/DefaultSharedWorkerRepository.h91
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorker.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorker.h60
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorker.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorkerContext.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorkerContext.h (renamed from src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorkerContext.idl (renamed from src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorkerRepository.h70
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorkerThread.cpp (renamed from src/3rdparty/webkit/WebCore/workers/SharedWorkerThread.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/SharedWorkerThread.h (renamed from src/3rdparty/webkit/WebCore/workers/SharedWorkerThread.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/Worker.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/Worker.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/Worker.idl54
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerContext.cpp488
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerContext.h216
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerContext.idl132
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerContextInspectorProxy.h55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerContextProxy.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerLoaderProxy.h63
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerLocation.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerLocation.h72
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerLocation.idl48
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerMessagingProxy.cpp385
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerMessagingProxy.h111
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerObjectProxy.h (renamed from src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerReportingProxy.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerRunLoop.cpp211
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerRunLoop.h97
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerScriptLoader.cpp178
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerScriptLoader.h87
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerScriptLoaderClient.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerThread.cpp247
-rw-r--r--src/3rdparty/webkit/Source/WebCore/workers/WorkerThread.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/DOMParser.cpp38
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/DOMParser.h42
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/DOMParser.idl (renamed from src/3rdparty/webkit/WebCore/xml/DOMParser.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/NativeXPathNSResolver.cpp (renamed from src/3rdparty/webkit/WebCore/xml/NativeXPathNSResolver.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/NativeXPathNSResolver.h (renamed from src/3rdparty/webkit/WebCore/xml/NativeXPathNSResolver.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequest.cpp1131
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequest.h233
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequest.idl124
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestException.h (renamed from src/3rdparty/webkit/WebCore/xml/XMLHttpRequestException.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestException.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestProgressEvent.h61
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestProgressEvent.idl36
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp154
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestUpload.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestUpload.h81
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLHttpRequestUpload.idl55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLSerializer.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XMLSerializer.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLSerializer.h (renamed from src/3rdparty/webkit/WebCore/xml/XMLSerializer.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLSerializer.idl (renamed from src/3rdparty/webkit/WebCore/xml/XMLSerializer.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLTreeViewer.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLTreeViewer.h53
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLViewer.css76
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XMLViewer.js434
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathEvaluator.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XPathEvaluator.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathEvaluator.h62
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathEvaluator.idl35
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathException.h (renamed from src/3rdparty/webkit/WebCore/xml/XPathException.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathException.idl50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathExpression.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XPathExpression.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathExpression.h66
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathExpression.idl (renamed from src/3rdparty/webkit/WebCore/xml/XPathExpression.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathExpressionNode.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XPathExpressionNode.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathExpressionNode.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathFunctions.cpp737
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathFunctions.h (renamed from src/3rdparty/webkit/WebCore/xml/XPathFunctions.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathGrammar.y (renamed from src/3rdparty/webkit/WebCore/xml/XPathGrammar.y)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathNSResolver.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XPathNSResolver.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathNSResolver.h50
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathNSResolver.idl (renamed from src/3rdparty/webkit/WebCore/xml/XPathNSResolver.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathNodeSet.cpp206
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathNodeSet.h85
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathParser.cpp638
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathParser.h133
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathPath.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XPathPath.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathPath.h (renamed from src/3rdparty/webkit/WebCore/xml/XPathPath.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathPredicate.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XPathPredicate.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathPredicate.h128
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathResult.cpp221
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathResult.h90
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathResult.idl (renamed from src/3rdparty/webkit/WebCore/xml/XPathResult.idl)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathStep.cpp398
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathStep.h109
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathUtil.cpp101
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathUtil.h56
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathValue.cpp145
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathValue.h106
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathVariableReference.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XPathVariableReference.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XPathVariableReference.h (renamed from src/3rdparty/webkit/WebCore/xml/XPathVariableReference.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLImportRule.cpp117
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLImportRule.h73
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLStyleSheet.h123
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp321
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLStyleSheetQt.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTExtensions.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XSLTExtensions.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTExtensions.h (renamed from src/3rdparty/webkit/WebCore/xml/XSLTExtensions.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTProcessor.cpp180
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTProcessor.h86
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTProcessor.idl55
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTProcessorLibxslt.cpp374
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTProcessorQt.cpp183
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTUnicodeSort.cpp (renamed from src/3rdparty/webkit/WebCore/xml/XSLTUnicodeSort.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/XSLTUnicodeSort.h (renamed from src/3rdparty/webkit/WebCore/xml/XSLTUnicodeSort.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/xmlattrs.in (renamed from src/3rdparty/webkit/WebCore/xml/xmlattrs.in)0
-rw-r--r--src/3rdparty/webkit/Source/WebCore/xml/xmlnsattrs.in (renamed from src/3rdparty/webkit/WebCore/xml/xmlnsattrs.in)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit.pri190
-rw-r--r--src/3rdparty/webkit/Source/WebKit.pro42
-rw-r--r--src/3rdparty/webkit/Source/WebKit/CMakeLists.txt82
-rw-r--r--src/3rdparty/webkit/Source/WebKit/ChangeLog3908
-rw-r--r--src/3rdparty/webkit/Source/WebKit/LICENSE (renamed from src/3rdparty/webkit/WebKit/LICENSE)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/mac/Configurations/Version.xcconfig59
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/headers.pri15
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qgraphicswebview.cpp1200
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qgraphicswebview.h167
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebdatabase.cpp (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebdatabase.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebdatabase_p.h37
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebelement.cpp2092
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebelement.h283
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebframe.cpp1950
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebframe.h240
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebframe_p.h157
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebhistory.cpp563
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebhistory.h116
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebhistory_p.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebhistoryinterface.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebhistoryinterface.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp231
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector_p.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebkitglobal.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebkitplatformplugin.h157
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebkitversion.cpp114
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebkitversion.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp4219
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.h451
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage_p.h217
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebplugindatabase.cpp393
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebplugindatabase_p.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpluginfactory.cpp (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpluginfactory.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebscriptworld.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebscriptworld.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebscriptworld_p.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebsecurityorigin.cpp269
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebsecurityorigin.h70
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebsecurityorigin_p.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin_p.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebsettings.cpp1129
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebsettings.h165
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebview.cpp1256
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/Api/qwebview.h167
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/ChangeLog3363
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/ChangeLog-2011-02-1629927
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro375
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp748
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h216
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp75
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DragClientQt.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp1213
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h223
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/EditCommandQt.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/EditCommandQt.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp674
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h130
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp1687
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h287
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp256
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h116
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp124
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h73
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp408
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h112
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp388
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h112
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp466
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h137
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp482
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PageClientQt.h239
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.h59
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp201
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h89
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h89
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp749
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h159
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h31
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.mm62
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/declarative/declarative.pro77
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/declarative/plugin.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/declarative/qdeclarativewebview.cpp1100
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/declarative/qdeclarativewebview_p.h384
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/declarative/qmldir (renamed from src/3rdparty/webkit/WebKit/qt/declarative/qmldir)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/docs.pri (renamed from src/3rdparty/webkit/WebKit/qt/docs/docs.pri)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc423
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/qtwebkit.qdoc191
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/qtwebkit.qdocconf193
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/qwebview-diagram.png (renamed from src/3rdparty/webkit/WebKit/qt/docs/qwebview-diagram.png)bin9036 -> 9036 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp174
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_build_snippet.qdoc (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_build_snippet.qdoc)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/simple/main.cpp (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/main.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/simple/simple.pro (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/simple.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/webelement/main.cpp (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/webpage/main.cpp (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/main.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro (renamed from src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/examples.pro2
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/platformplugin/README14
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp318
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/platformplugin/WebPlugin.h143
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/platformplugin/platformplugin.pro33
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h159
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/qt_webkit_version.pri16
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/backup_registration.xml (renamed from src/3rdparty/webkit/WebKit/qt/symbian/backup_registration.xml)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/bwins/QtWebKitu.def653
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/eabi/QtWebKitu.def847
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/HTML5VideoPlugin.cpp149
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/HTML5VideoPlugin.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/HTML5VideoWidget.cpp103
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/HTML5VideoWidget.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/OverlayWidget.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/OverlayWidget.h85
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/PlayerButton.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/PlayerButton.h38
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/PlayerLabel.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/PlayerLabel.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/WebPlugin.cpp263
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/WebPlugin.h109
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/button_cannotplay.pngbin0 -> 1177 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/button_close.pngbin0 -> 1903 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/button_pause.pngbin0 -> 1052 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/button_play.pngbin0 -> 1412 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/button_sound_off.pngbin0 -> 1787 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/button_sound_on.pngbin0 -> 1768 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/loading_buffering_1.pngbin0 -> 1083 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/loading_buffering_2.pngbin0 -> 1128 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/loading_buffering_3.pngbin0 -> 1121 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/images/loading_buffering_4.pngbin0 -> 1094 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/platformplugin.pro64
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/platformplugin.qrc15
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/qss/OverlayWidget.qss59
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/symbian/platformplugin/qwebkitplatformplugin.h157
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/MIMESniffing.pro19
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/TestData.h984
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources.qrc23
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_atom+xml17
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_oggbin0 -> 382185 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_pdfbin0 -> 218882 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_postscript137
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_rdf+xml50
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_rss+xml45
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_x-gzipbin0 -> 268 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_x-rar-compressedbin0 -> 1478 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/application_zipbin0 -> 411 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/audio_x-wavebin0 -> 184320 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/image_bmpbin0 -> 46182 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/image_gifbin0 -> 245 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/image_jpegbin0 -> 10874 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/image_pngbin0 -> 850 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/image_vnd.microsoft.iconbin0 -> 9662 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/image_webpbin0 -> 10474 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/text_html3
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/text_xml19
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/resources/video_webmbin0 -> 388027 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/MIMESniffing/tst_MIMESniffing.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/loading/loading.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/loading.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/loading/tst_loading.cpp (renamed from src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/painting/painting.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/painting.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp (renamed from src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/webgl/10000_triangles.html59
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.qrc5
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/benchmarks/webgl/webgl.pro4
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/resources.qrc (renamed from src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/resources.qrc)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/test.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/test.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp (renamed from src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/widget.cpp (renamed from src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/widget.h72
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/hybridPixmap/widget.ui (renamed from src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/qdeclarativewebview.pro6
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.html17
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.pngbin0 -> 3961 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.qml5
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.html14
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.qml7
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.html12
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.pngbin0 -> 2377 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.html11
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.qml12
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/loadError.qml5
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.html20
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.qml51
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/propertychanges.qml34
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/sample.html6
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/sethtml.qml5
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml10
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtest.qml24
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtestdefault.qml22
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp548
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc22
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro6
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html8
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qgraphicswebview/resources/input_types.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_right.html45
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_up.html46
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp612
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc8
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebelement/qwebelement.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebelement/resources/image.png (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image.png)bin14743 -> 14743 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebelement/resources/style.css (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/style.css)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebelement/resources/style2.css (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/style2.css)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp1044
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.qrc (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.qrc)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/qwebframe.pro11
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/resources/image.png (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/image.png)bin14743 -> 14743 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/resources/style.css (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/style.css)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/resources/test1.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/test1.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/resources/test2.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/test2.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/resources/testiframe.html53
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/resources/testiframe2.html20
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp3662
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/qwebhistory.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/resources/page1.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page1.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/resources/page2.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page2.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/resources/page3.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page3.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/resources/page4.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page4.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/resources/page5.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page5.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/resources/page6.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page6.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp397
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebinspector/qwebinspector.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/qwebinspector.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebinspector/tst_qwebinspector.cpp (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/tst_qwebinspector.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/qwebpage.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/content.html6
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/frame_a.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/frame_a.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/frame_c.html1
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/framedindex.html6
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/iframe.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/iframe2.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe2.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/iframe3.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe3.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/resources/index.html6
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp3039
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc13
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebview/.gitignore (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebview/.gitignore)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebview/qwebview.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebview/resources/frame_a.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/frame_a.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebview/resources/index.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/index.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebview/resources/input_types.html (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp519
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebview/tst_qwebview.qrc (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/resources/image2.png (renamed from src/3rdparty/webkit/WebKit/qt/tests/resources/image2.png)bin14743 -> 14743 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/resources/test.swf (renamed from src/3rdparty/webkit/WebKit/qt/tests/resources/test.swf)bin10085 -> 10085 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/tests.pri39
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/tests.pro15
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/util.h (renamed from src/3rdparty/webkit/WebKit/qt/tests/util.h)0
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/CMakeListsWinCE.txt26
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/ChangeLog778
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.cpp403
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.h186
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/ContextMenuClientWinCE.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/ContextMenuClientWinCE.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/DragClientWinCE.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/DragClientWinCE.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp504
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h113
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp665
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h205
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/InspectorClientWinCE.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/InspectorClientWinCE.h59
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp677
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h154
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebView.cpp458
-rw-r--r--src/3rdparty/webkit/Source/WebKit/wince/WebView.h100
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/ChangeLog17012
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/ChangeLog-2011-02-1645403
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/Base.xcconfig98
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/BaseTarget.xcconfig38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/CompilerVersion.xcconfig56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/DebugRelease.xcconfig45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/FeatureDefines.xcconfig137
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/PluginProcess.xcconfig29
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/PluginProcessShim.xcconfig30
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/Version.xcconfig56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/WebKit2.xcconfig34
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Configurations/WebProcess.xcconfig29
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/DerivedSources.make116
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/DerivedSources.pro171
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/English.lproj/InfoPlist.strings2
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/GNUmakefile.am958
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Info.plist24
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h301
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp239
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h162
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp168
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h127
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/Arguments.h401
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/Attachment.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/Attachment.h105
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/Connection.cpp717
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/Connection.h428
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/CoreIPCMessageKinds.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/DataReference.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/DataReference.h70
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/HandleMessage.h315
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/MessageID.h179
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/MessageSender.h73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp425
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp401
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/win/BinarySemaphoreWin.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp322
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/Logging.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/Logging.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/Module.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/Module.h92
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/PlatformProcessIdentifier.h53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/Region.cpp456
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/Region.h144
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/RunLoop.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/RunLoop.h169
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/SharedMemory.h116
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/WorkItem.h187
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/WorkQueue.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/WorkQueue.h184
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/cg/CGUtilities.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/cg/CGUtilities.h36
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/gtk/ModuleGtk.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp221
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/mac/Logging.mac.mm49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/mac/MachUtilities.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/mac/MachUtilities.h36
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/mac/ModuleMac.mm80
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/mac/RunLoopMac.mm147
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp205
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/mac/WorkQueueMac.cpp203
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/qt/ModuleQt.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/qt/RunLoopQt.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/qt/WorkQueueQt.cpp127
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp238
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/win/ModuleWin.cpp121
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/win/RunLoopWin.cpp221
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/win/SharedMemoryWin.cpp241
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Platform/win/WorkQueueWin.cpp291
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/Info.plist30
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp527
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/PluginControllerProxy.h199
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in110
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/PluginProcess.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/PluginProcess.h108
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/PluginProcess.messages.in43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/PluginProcessMain.h41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/WebProcessConnection.cpp187
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/WebProcessConnection.h82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in33
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm103
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm233
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm105
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/mac/PluginProcessShim.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm161
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/qt/PluginControllerProxyQt.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/PluginProcess/qt/PluginProcessQt.cpp44
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/Scripts/generate-forwarding-headers.pl112
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Scripts/generate-message-receiver.py41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Scripts/generate-messages-header.py41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Scripts/webkit2/__init__.py23
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Scripts/webkit2/messages.py639
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Scripts/webkit2/messages_unittest.py714
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKArray.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKArray.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKBase.h132
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKCertificateInfo.h41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp101
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKContextMenuItem.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h132
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKData.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKData.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKDictionary.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKDictionary.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKError.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKError.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKEvent.h55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKFindOptions.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKGeometry.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKGraphicsContext.h41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKImage.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKImage.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKMutableArray.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKMutableArray.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKMutableDictionary.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKNumber.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKNumber.h54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKSerializedScriptValuePrivate.h42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKSharedAPICast.h749
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKString.cpp95
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKString.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKStringPrivate.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKType.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKType.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKURL.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKURL.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKURLRequest.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKURLRequest.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKURLResponse.cpp38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKURLResponse.h41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKErrorCF.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKErrorCF.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKStringCF.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKURLCF.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.cpp38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.h42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/cg/WKImageCG.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/win/WKBaseWin.h38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/APIClient.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/APIObject.h127
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/CacheModel.h39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ChildProcess.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ChildProcess.h85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/CommandLine.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ContextMenuState.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h0
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/DictionaryPopupInfo.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/DictionaryPopupInfo.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/DragControllerAction.h40
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/DrawingAreaInfo.h41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/EditorState.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/FontInfo.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/FontInfo.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/FontSmoothingLevel.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/HTTPCookieAcceptPolicy.h40
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ImageOptions.h37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ImmutableArray.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ImmutableArray.h77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ImmutableDictionary.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ImmutableDictionary.h95
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/LayerTreeContext.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/MutableArray.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/MutableArray.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/MutableDictionary.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/MutableDictionary.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/NativeWebKeyboardEvent.h82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/NativeWebMouseEvent.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/NativeWebWheelEvent.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/OriginAndDatabases.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/OriginAndDatabases.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/PlatformPopupMenuData.cpp103
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/PlatformPopupMenuData.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPIdentifierData.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp236
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp347
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPObjectProxy.h96
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp233
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.h85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPVariantData.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/NPVariantData.h120
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp263
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h96
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm402
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp122
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/PluginQuirks.h92
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/PrintInfo.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/PrintInfo.h59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ResourceCachesToClear.h38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/SameDocumentNavigationType.h40
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/SandboxExtension.h105
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/SecurityOriginData.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/SecurityOriginData.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/SessionState.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/SessionState.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ShareableBitmap.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/ShareableBitmap.h137
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/StringPairVector.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/TextCheckerState.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/UpdateInfo.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/UpdateInfo.h68
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/UserMessageCoders.h334
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/VisitedLinkTable.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/VisitedLinkTable.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebBackForwardListItem.cpp97
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebBackForwardListItem.h84
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebCertificateInfo.h59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebContextMenuItem.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebContextMenuItem.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebContextMenuItemData.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebContextMenuItemData.h82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebCoreArgumentCoders.h485
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebData.h99
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebError.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebError.h77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebEvent.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebEvent.h333
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebEventConversion.cpp269
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebEventConversion.h72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebFindOptions.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebGeolocationPosition.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebGeolocationPosition.h74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebGestureEvent.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebGraphicsContext.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebGraphicsContext.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebImage.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebImage.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebKeyboardEvent.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebMemorySampler.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebMemorySampler.h112
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebMouseEvent.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebNavigationDataStore.h59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebNumber.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebOpenPanelParameters.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebOpenPanelParameters.h69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPageCreationParameters.cpp121
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPageCreationParameters.h87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPageGroupData.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPageGroupData.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPopupItem.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPopupItem.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPreferencesStore.cpp202
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebPreferencesStore.h184
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebProcessCreationParameters.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebProcessCreationParameters.h111
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebSecurityOrigin.h74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebSerializedScriptValue.h80
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebString.h106
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebTouchEvent.cpp69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebURL.h87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebURLRequest.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebURLRequest.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebURLResponse.cpp36
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebURLResponse.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebUserContentURLPattern.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/WebWheelEvent.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp501
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/cf/ArgumentCodersCF.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/cg/win/ShareableBitmapCGWin.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/NativeWebWheelEventGtk.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/UpdateChunk.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/UpdateChunk.h67
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/WebEventFactory.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/gtk/WebEventFactory.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/ArgumentCodersMac.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm343
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/AttributedString.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/AttributedString.mm53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/CommandLineMac.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm100
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/NativeWebWheelEventMac.mm39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/PasteboardTypes.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/PasteboardTypes.mm78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm92
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/PrintInfoMac.mm39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm235
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/ShareableSurface.cpp215
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/ShareableSurface.h98
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/UpdateChunk.cpp93
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/UpdateChunk.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm195
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/WebEventFactory.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/WebEventFactory.mm1149
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm182
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/WebURLRequestMac.mm41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/mac/WebURLResponseMac.mm41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/LayerTreeContextQt.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/NativeWebWheelEventQt.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/UpdateChunk.cpp135
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/UpdateChunk.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp210
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/WebEventFactoryQt.h54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/CommandLineWin.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/NativeWebMouseEventWin.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/NativeWebWheelEventWin.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp160
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/PlatformCertificateInfo.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/UpdateChunk.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/UpdateChunk.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp157
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/WebEventFactory.cpp464
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/WebEventFactory.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/WebKitBundle.cpp63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/WebKitBundle.h37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/WebURLRequestWin.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/Shared/win/WebURLResponseWin.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKAPICast.h338
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKContext.cpp234
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKContext.h139
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKCookieManager.h73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKCredential.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKCredential.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp154
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h106
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKDownload.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKDownload.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKFrame.cpp185
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKFrame.h95
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKInspector.cpp111
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKInspector.h70
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKNavigationData.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPage.cpp564
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPage.h407
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPageGroup.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp563
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPreferences.h169
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h136
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/WebKit2.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/gtk/WKView.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/mac/WKInspectorMac.h39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/qt/WKNativeEvent.h35
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKView.cpp116
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKView.h88
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h218
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h30
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h31
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp501
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h108
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp328
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.h68
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm247
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/PDFViewController.h95
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm636
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h132
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm468
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm622
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm164
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKView.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKView.mm2542
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h90
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h40
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp190
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/ClientImpl.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/WKView.h29
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp450
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h101
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp68
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkcontext.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkcontext_p.h37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkhistory.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkhistory.h81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkhistory_p.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp825
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkpage.h156
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h151
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp219
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/qwkpreferences_p.h28
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html1
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/qgraphicswkview.pro1
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/qwkpage.pro1
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/tests.pri16
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/tests.pro2
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/API/qt/tests/util.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h80
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/WebCredential.h77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/BackingStore.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/BackingStore.h97
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h111
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp191
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h92
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in35
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/DrawingAreaProxy.h117
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in30
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp356
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h113
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/FindIndicator.cpp179
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/FindIndicator.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/GenericCallback.h210
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp97
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h95
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp40
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm311
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp166
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp125
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp70
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/PageClient.h175
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp236
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h99
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp257
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h161
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp295
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.h88
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm191
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp408
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/ProcessModel.h39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/ResponsivenessTimer.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/TextChecker.h80
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp628
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h187
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h89
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp182
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/VisitedLinkProvider.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp99
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.messages.in25
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebBackForwardList.cpp245
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebBackForwardList.h102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContext.cpp768
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContext.h291
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContext.messages.in43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContextMenuProxy.h54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h141
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp163
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebCookieManagerProxy.h102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in28
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp233
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in28
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebDownloadClient.cpp126
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebDownloadClient.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp152
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebEditCommandProxy.h69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFindClient.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFindClient.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFormClient.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFormClient.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.h54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFrameListenerProxy.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.h54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFrameProxy.cpp331
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFrameProxy.h163
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h110
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h79
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.messages.in26
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebGeolocationProvider.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebHistoryClient.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebHistoryClient.h53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebIconDatabase.cpp272
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebIconDatabase.h118
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebIconDatabase.messages.in35
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebIconDatabaseClient.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebInspectorProxy.cpp238
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebInspectorProxy.h179
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp98
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.messages.in25
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebLoaderClient.cpp242
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebLoaderClient.h87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h83
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.messages.in25
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebNavigationData.cpp40
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebNavigationData.h59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPageContextMenuClient.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPageGroup.cpp131
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPageGroup.h72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPageProxy.cpp3166
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPageProxy.h876
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPageProxy.messages.in252
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPolicyClient.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPolicyClient.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPopupMenuProxy.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPreferences.cpp106
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebPreferences.h98
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebProcessProxy.cpp428
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebProcessProxy.h195
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebProcessProxy.messages.in34
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h83
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.messages.in25
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebResourceLoadClient.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebUIClient.cpp383
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/WebUIClient.h116
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp164
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp227
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp94
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp86
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm143
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm109
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/CorrectionPanel.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm166
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm392
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm626
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebContextMac.mm139
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm234
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm103
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm248
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm372
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm177
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm128
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/BackingStoreQt.cpp75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp119
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp161
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp153
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebContextQt.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/BackingStoreWin.cpp109
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp140
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp107
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebContextWin.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebFullScreenManagerProxyWin.cpp102
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebGrammarDetail.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebGrammarDetail.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp311
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp961
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h143
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebProcessProxyWin.cpp36
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebTextChecker.cpp84
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebTextChecker.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebTextCheckerClient.h61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebUndoClient.cpp69
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebUndoClient.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebView.cpp1764
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/UIProcess/win/WebView.h285
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebKit2.pri100
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebKit2.pro548
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj4662
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebKit2API.pri140
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebKit2Prefix.cpp26
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebKit2Prefix.h34
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess.pro55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp108
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.messages.in27
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp139
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h76
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.messages.in27
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Authentication/mac/AuthenticationManager.mac.mm65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in36
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/cf/WebCookieManagerCFNet.cpp50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/curl/WebCookieManagerCurl.cpp47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/gtk/WebCookieManagerGtk.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/mac/WebCookieManagerMac.mm45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Cookies/qt/WebCookieManagerQt.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/Download.cpp158
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/Download.h133
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.cpp62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/DownloadManager.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFWin.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/cfnet/DownloadCFNet.cpp263
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm310
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp80
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp146
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h91
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in32
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/gtk/WebFullScreenManagerGtk.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/gtk/WebFullScreenManagerGtk.h50
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.h68
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm293
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/win/WebFullScreenManagerWin.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/win/WebFullScreenManagerWin.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp91
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp112
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in26
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp151
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.h89
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.messages.in26
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Info.plist30
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp194
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h132
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp227
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp90
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h49
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp283
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h310
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp144
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/win/WKBundlePrivateWin.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/win/WKBundlePrivateWin.h42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp229
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h90
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp78
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp339
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h148
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp113
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h76
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp105
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp128
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp103
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp211
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp90
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h63
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h141
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp141
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/KeyValueStorage/WebKeyValueStorageManager.cpp100
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/KeyValueStorage/WebKeyValueStorageManager.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/KeyValueStorage/WebKeyValueStorageManager.messages.in27
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/MediaCache/WebMediaCacheManager.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/MediaCache/WebMediaCacheManager.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/MediaCache/WebMediaCacheManager.messages.in27
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp415
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp384
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h98
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp279
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h95
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp135
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp975
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.h38
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp742
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h250
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp357
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h112
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm976
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm59
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/qt/PluginProxyQt.cpp43
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp364
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp430
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Plugin.cpp77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/Plugin.h181
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginController.h148
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp145
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp118
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp484
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginProxy.h159
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in65
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginView.cpp1087
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/Plugins/PluginView.h195
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp137
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.messages.in27
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp58
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp761
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h232
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp88
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h68
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp183
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h73
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in30
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp458
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h157
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp1407
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h231
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h66
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp114
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h77
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp104
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp130
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h71
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp138
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp79
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp57
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp129
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp82
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameNetworkingContext.h51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm86
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm305
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm264
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm177
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.h31
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm171
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp87
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.h46
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp81
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp20
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp147
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebKitMain.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp208
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h75
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp83
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp74
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/DrawingArea.h96
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in28
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp624
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h117
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp89
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h62
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/FindController.cpp335
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/FindController.h79
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h91
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp175
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/PageOverlay.h105
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp236
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h93
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp225
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h69
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp96
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h53
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebEditCommand.h55
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp670
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebFrame.h155
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp176
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebInspector.h103
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in37
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebPage.cpp2329
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebPage.h674
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in223
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp265
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h106
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm147
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp293
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp56
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp45
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp136
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.h47
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm195
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm41
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm715
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp51
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp60
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp299
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/win/LayerTreeHostWin.cpp44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp48
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp467
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebProcess.cpp854
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebProcess.h243
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebProcess.messages.in70
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/WebProcessMain.h39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/com.apple.WebProcess.sb180
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp54
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp72
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h42
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.h40
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.mm70
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/mac/WebProcessMac.mm244
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm115
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp178
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp64
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp85
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/WebProcess/win/WebProcessWin.cpp186
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/config.h154
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/gtk/MainGtk.cpp32
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/gtk/webkit2.pc.in11
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/mac/MainMac.cpp61
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/qt/MainQt.cpp39
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/version.plist16
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/MainWin.cpp67
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2.def134
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/win/WebKit2.make21
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2.rc52
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2Apple.vsprops17
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2CFLite.def127
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2CFLite.vsprops13
-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/win/WebKit2Common.vsprops27
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2Debug.vsprops14
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2DebugAll.vsprops15
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2DebugCairoCFLite.vsprops16
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2DirectX.vsprops15
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2Generated.make107
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2GeneratedCommon.vsprops15
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2Production.vsprops15
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2Release.vsprops15
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2ReleaseCairoCFLite.vsprops16
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcess.resources/Info.plist20
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops15
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessDebug.vsprops12
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessDebugAll.vsprops13
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessDebugCairoCFLite.vsprops13
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd5
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd6
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessProduction.vsprops13
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessRelease.vsprops13
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKit2WebProcessReleaseCairoCFLite.vsprops14
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKitPostBuild.cmd2
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKitPreBuild.cmd11
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/WebKitPreLink.cmd9
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/build-generated-files.sh34
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/deleteButton.pngbin0 -> 2231 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/deleteButtonPressed.pngbin0 -> 2323 bytes-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/win/fsVideoAudioVolumeHigh.pngbin0 -> 3026 bytes-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/win/fsVideoAudioVolumeLow.pngbin0 -> 2913 bytes-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/win/fsVideoExitFullscreen.pngbin0 -> 2940 bytes-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/win/fsVideoPause.pngbin0 -> 2832 bytes-rwxr-xr-xsrc/3rdparty/webkit/Source/WebKit2/win/fsVideoPlay.pngbin0 -> 2906 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/missingImage.pngbin0 -> 456 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/nullplugin.pngbin0 -> 1286 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panEastCursor.pngbin0 -> 123 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panIcon.pngbin0 -> 175 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panNorthCursor.pngbin0 -> 125 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panNorthEastCursor.pngbin0 -> 209 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panNorthWestCursor.pngbin0 -> 174 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panSouthCursor.pngbin0 -> 128 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panSouthEastCursor.pngbin0 -> 166 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panSouthWestCursor.pngbin0 -> 177 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/panWestCursor.pngbin0 -> 122 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/resource.h44
-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/searchCancel.pngbin0 -> 908 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/searchCancelPressed.pngbin0 -> 895 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/searchMagnifier.pngbin0 -> 1028 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/searchMagnifierResults.pngbin0 -> 1224 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/textAreaResizeCorner.pngbin0 -> 195 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/verticalTextCursor.pngbin0 -> 120 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/zoomInCursor.pngbin0 -> 199 bytes-rw-r--r--src/3rdparty/webkit/Source/WebKit2/win/zoomOutCursor.pngbin0 -> 182 bytes-rw-r--r--src/3rdparty/webkit/Source/autotools/acinclude.m4178
-rw-r--r--src/3rdparty/webkit/Source/autotools/dolt.m4181
-rw-r--r--src/3rdparty/webkit/Source/autotools/gsettings.m493
-rw-r--r--src/3rdparty/webkit/Source/autotools/symbols.filter32
-rw-r--r--src/3rdparty/webkit/Source/autotools/webkit.m4166
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindCFLite.cmake22
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindCairo.cmake33
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindEFL.cmake16
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindFontconfig.cmake69
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindFreetype.cmake31
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGDK-PixBuf.cmake32
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGDK.cmake43
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGIO.cmake27
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGStreamer-App.cmake34
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGStreamer-Base.cmake33
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGStreamer-Interfaces.cmake33
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGStreamer-Pbutils.cmake33
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGStreamer-Plugins-Base.cmake33
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGStreamer-Video.cmake34
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGStreamer.cmake31
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGlib.cmake43
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGperf.cmake19
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindGthread.cmake4
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindICU.cmake77
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindLibSoup2.cmake191
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindLibXlst.cmake68
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindPango.cmake34
-rw-r--r--src/3rdparty/webkit/Source/cmake/FindSqlite.cmake50
-rw-r--r--src/3rdparty/webkit/Source/cmake/LibFindMacros.cmake99
-rw-r--r--src/3rdparty/webkit/Source/cmake/OptionsCommon.cmake19
-rw-r--r--src/3rdparty/webkit/Source/cmake/OptionsEfl.cmake164
-rw-r--r--src/3rdparty/webkit/Source/cmake/OptionsWinCE.cmake59
-rw-r--r--src/3rdparty/webkit/Source/cmake/OptionsWindows.cmake14
-rw-r--r--src/3rdparty/webkit/Source/cmake/WebKitEfl.cmake6
-rw-r--r--src/3rdparty/webkit/Source/cmake/WebKitFS.cmake4
-rw-r--r--src/3rdparty/webkit/Source/cmake/WebKitFeatures.cmake91
-rw-r--r--src/3rdparty/webkit/Source/cmake/WebKitHelpers.cmake85
-rw-r--r--src/3rdparty/webkit/Source/cmake/WebKitMacros.cmake130
-rw-r--r--src/3rdparty/webkit/Source/cmake/WebKitPackaging.cmake181
-rw-r--r--src/3rdparty/webkit/Source/cmake/eflsymbols.filter6
-rw-r--r--src/3rdparty/webkit/Source/cmakeconfig.h.cmake45
-rw-r--r--src/3rdparty/webkit/Source/common.pri15
-rw-r--r--src/3rdparty/webkit/Source/gyp/common.gypi10
-rwxr-xr-xsrc/3rdparty/webkit/Source/gyp/configure152
-rw-r--r--src/3rdparty/webkit/Source/sync.profile18
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog27611
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/pcre/pcre.h5
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/Collector.h4
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/InitializeThreading.h4
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSNumberCell.h4
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/PropertyMap.h5
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/WeakGCPtr.h4
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/wrec/WREC.h4
-rw-r--r--src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/StringHashFunctions.h4
-rw-r--r--src/3rdparty/webkit/WebCore/Info.plist24
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.3DRendering.exp1
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.ClientBasedGeolocation.exp2
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.DashboardSupport.exp3
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.Geolocation.exp2
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.JNI.exp10
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.NPAPI.exp30
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.SVG.Animation.exp2
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.SVG.Filters.exp25
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.SVG.ForeignObject.exp1
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.SVG.exp95
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.Tiger.exp13
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.Video.exp17
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.VideoProxy.exp4
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.gypi4026
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.order23966
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pri723
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pro3003
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.qrc17
-rw-r--r--src/3rdparty/webkit/WebCore/WebCorePrefix.h156
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AXObjectCache.cpp524
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AXObjectCache.h160
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityARIAGrid.cpp153
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityARIAGrid.h63
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityARIAGridCell.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityARIAGridRow.cpp141
-rwxr-xr-xsrc/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityImageMapLink.cpp160
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityImageMapLink.h83
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityList.h62
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBox.cpp197
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBox.h65
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBoxOption.cpp227
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBoxOption.h81
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityMediaControls.cpp331
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuList.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuList.h59
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListOption.cpp113
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListOption.h69
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListPopup.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.cpp985
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h574
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp3308
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h311
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityScrollbar.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityScrollbar.h64
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilitySlider.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilitySlider.h92
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityTable.cpp497
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityTable.h94
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableCell.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableColumn.cpp197
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp98
-rw-r--r--src/3rdparty/webkit/WebCore/accessibility/AccessibilityTableRow.cpp124
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/ScriptControllerBase.cpp109
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/generic/BindingDOMWindow.h126
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/generic/BindingElement.h102
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurity.h132
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurityBase.cpp108
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/generic/GenericBinding.h52
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/generic/RuntimeEnabledFeatures.h113
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/CachedScriptSourceProvider.h69
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/DOMObjectHashTableMap.h60
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/DOMWrapperWorld.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/DOMWrapperWorld.h88
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/GCController.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/GCController.h55
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSAttrCustom.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSAudioConstructor.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSAudioConstructor.h52
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSBindingsAllInOne.cpp149
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCDATASectionCustom.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCSSRuleCustom.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCSSRuleListCustom.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCSSValueCustom.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.h71
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCanvasNumberArrayCustom.cpp46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp436
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSClipboardCustom.cpp142
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSConsoleCustom.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCoordinatesCustom.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomPositionCallback.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp59
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementCallback.h63
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.h66
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLTransactionCallback.h68
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.h64
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomVoidCallback.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomVoidCallback.h60
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp110
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp750
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h337
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMFormDataCustom.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp129
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h117
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp211
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h106
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp1003
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.h83
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp184
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h97
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWrapper.cpp51
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWrapper.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDataGridColumnListCustom.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDataGridDataSource.h76
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDatabaseCallback.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDatabaseCallback.h65
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDatabaseCustom.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDebugWrapperSet.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDebugWrapperSet.h88
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDocumentCustom.cpp125
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDocumentFragmentCustom.cpp40
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSElementCustom.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventCustom.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h112
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceConstructor.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceConstructor.h55
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp203
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSExceptionBase.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSGeolocationCustom.cpp184
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp157
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDataGridElementCustom.cpp60
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDocumentCustom.cpp170
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLElementCustom.cpp51
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFormElementCustom.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp76
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLIFrameElementCustom.cpp59
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLInputElementCustom.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp98
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHistoryCustom.cpp213
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSImageConstructor.h40
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSImageDataCustom.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp234
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp136
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSLocationCustom.cpp371
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMessageChannelConstructor.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMessageChannelConstructor.h47
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMessageChannelCustom.cpp46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMessageEventCustom.cpp79
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp116
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.h65
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMimeTypeArrayCustom.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNamedNodeMapCustom.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNavigatorCustom.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp305
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.h62
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeFilterCondition.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeFilterCondition.h49
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeFilterCustom.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeIteratorCustom.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeListCustom.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSOptionConstructor.cpp79
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSOptionConstructor.h41
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSPluginArrayCustom.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSPluginCustom.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSPluginElementFunctions.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSPluginElementFunctions.h48
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSPopStateEventCustom.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSQLTransactionCustom.cpp121
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGContextCache.h97
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGLengthCustom.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGMatrixCustom.cpp82
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGPODListCustom.h199
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGPODTypeWrapper.h410
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGPathSegCustom.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGPathSegListCustom.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp89
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.h56
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSStorageCustom.cpp102
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSStyleSheetCustom.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSStyleSheetListCustom.cpp63
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSTextCustom.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSTreeWalkerCustom.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayBufferConstructor.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayBufferConstructor.h104
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayCustom.cpp93
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayHelper.h71
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayConstructor.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayCustom.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayConstructor.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayConstructor.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayCustom.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp835
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayConstructor.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayCustom.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayConstructor.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayConstructor.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayConstructor.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebKitPointConstructor.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebKitPointConstructor.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketConstructor.cpp93
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketConstructor.h54
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerConstructor.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerConstructor.h51
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.h73
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp172
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerCustom.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp59
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestConstructor.h38
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp181
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXSLTProcessorConstructor.h49
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXSLTProcessorCustom.cpp121
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfile.cpp183
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfile.h46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfileNode.cpp236
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfileNode.h48
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.cpp152
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.h72
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptArray.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptArray.h59
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptCachedFrameData.cpp109
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptCachedFrameData.h61
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptCallFrame.cpp61
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptCallFrame.h74
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptCallStack.cpp109
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptCallStack.h69
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp464
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h202
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerBrew.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerGtk.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerHaiku.cpp46
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm171
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp63
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWin.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWx.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.cpp586
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.h153
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp124
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.h52
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp199
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.h86
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptInstance.h44
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.cpp207
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.h85
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptProfile.h41
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.h48
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceProvider.h48
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h56
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptString.h85
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.h70
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptWrappable.h65
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.cpp999
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.h233
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/StringSourceProvider.h63
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/WebCoreJSClientData.h78
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp152
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h88
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/CodeGenerator.pm366
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm2380
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorObjC.pm1688
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm2834
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/IDLParser.pm432
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/IDLStructure.pm105
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/InFilesParser.pm150
-rwxr-xr-xsrc/3rdparty/webkit/WebCore/bindings/scripts/generate-bindings.pl70
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/Bridge.h48
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/IdentifierRep.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h76
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp533
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/CRuntimeObject.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/CRuntimeObject.h55
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_class.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_class.h60
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp318
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_instance.h93
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp83
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h68
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_utility.cpp153
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/c/c_utility.h58
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.cpp181
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h123
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.cpp343
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.h275
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.h130
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm705
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm84
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp445
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h89
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp316
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h53
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h62
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp381
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.h112
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaRuntimeObject.h52
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h84
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h153
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/npapi.h913
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/npruntime.h357
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/npruntime_internal.h51
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp226
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h59
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp400
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h96
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp369
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.h54
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp1877
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h242
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_array.h70
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp127
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_method.h67
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp324
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_object.h85
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp187
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/runtime_root.h100
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/testbindings.cpp419
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/testbindings.mm287
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/testqtbindings.cpp139
-rwxr-xr-xsrc/3rdparty/webkit/WebCore/combine-javascript-resources79
-rw-r--r--src/3rdparty/webkit/WebCore/config.h235
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSBorderImageValue.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSBorderImageValue.h62
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSCanvasValue.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSCanvasValue.h69
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp1534
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h82
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSCursorImageValue.cpp134
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSCursorImageValue.h63
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontFace.cpp122
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontFace.h98
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontFaceSource.cpp193
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontFaceSource.h83
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontFaceSrcValue.cpp79
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontFaceSrcValue.h92
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontSelector.cpp538
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFontSelector.h77
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFunctionValue.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSFunctionValue.h58
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSGradientValue.cpp162
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSGradientValue.h112
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSGrammar.y1512
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSHelper.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSHelper.h43
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSImageGeneratorValue.cpp115
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSImageGeneratorValue.h76
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSImageValue.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSImageValue.h59
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSImportRule.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSImportRule.h77
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSImportRule.idl30
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSInitialValue.h58
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSMediaRule.cpp131
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSMediaRule.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp838
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.h222
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSNamespace.h57
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPageRule.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPageRule.h60
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPageRule.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSParser.cpp5432
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSParser.h325
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSParserValues.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSParserValues.h100
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.cpp993
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.h218
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h2530
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSProperty.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSProperty.h79
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPropertyLonghand.cpp222
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in259
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSReflectValue.h70
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSRule.h72
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSRule.idl51
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSRuleList.cpp110
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSRuleList.h66
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSRuleList.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSegmentedFontFace.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSegmentedFontFace.h70
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSelector.cpp627
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSelector.h280
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSelectorList.cpp139
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSSelectorList.h57
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleDeclaration.cpp163
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleDeclaration.h83
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleDeclaration.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleRule.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleRule.h78
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleRule.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp6385
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h352
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleSheet.cpp266
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleSheet.h124
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSStyleSheet.idl45
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSTimingFunctionValue.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSTimingFunctionValue.h67
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSValue.h78
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSValue.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in718
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSValueList.cpp141
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSValueList.h80
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariableDependentValue.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariableDependentValue.h57
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariablesDeclaration.cpp175
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariablesDeclaration.h82
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariablesDeclaration.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariablesRule.cpp61
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariablesRule.h70
-rw-r--r--src/3rdparty/webkit/WebCore/css/CSSVariablesRule.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/css/FontFamilyValue.cpp107
-rw-r--r--src/3rdparty/webkit/WebCore/css/FontFamilyValue.h50
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaFeatureNames.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaFeatureNames.h84
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaList.cpp258
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaList.h92
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaList.idl45
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQuery.cpp97
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQuery.h61
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp552
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h90
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryExp.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryExp.h75
-rw-r--r--src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp350
-rw-r--r--src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in50
-rw-r--r--src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp565
-rw-r--r--src/3rdparty/webkit/WebCore/css/SVGCSSValueKeywords.in282
-rw-r--r--src/3rdparty/webkit/WebCore/css/ShadowValue.h65
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleBase.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleBase.h86
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleMedia.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleMedia.h55
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleMedia.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleSheet.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleSheet.h85
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleSheet.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleSheetList.h63
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleSheetList.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/css/WCSSPropertyNames.in4
-rw-r--r--src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.cpp146
-rw-r--r--src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.h95
-rw-r--r--src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h159
-rw-r--r--src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.idl86
-rw-r--r--src/3rdparty/webkit/WebCore/css/WebKitCSSTransformValue.idl62
-rw-r--r--src/3rdparty/webkit/WebCore/css/html.css669
-rw-r--r--src/3rdparty/webkit/WebCore/css/makeprop.pl119
-rw-r--r--src/3rdparty/webkit/WebCore/css/makevalues.pl108
-rw-r--r--src/3rdparty/webkit/WebCore/css/mathml.css198
-rw-r--r--src/3rdparty/webkit/WebCore/css/mediaControls.css133
-rw-r--r--src/3rdparty/webkit/WebCore/css/mediaControlsChromium.css192
-rw-r--r--src/3rdparty/webkit/WebCore/css/mediaControlsGtk.css65
-rw-r--r--src/3rdparty/webkit/WebCore/css/mediaControlsQt.css140
-rw-r--r--src/3rdparty/webkit/WebCore/css/mediaControlsQuickTime.css187
-rw-r--r--src/3rdparty/webkit/WebCore/css/quirks.css54
-rw-r--r--src/3rdparty/webkit/WebCore/css/themeChromiumLinux.css36
-rw-r--r--src/3rdparty/webkit/WebCore/css/themeQtMaemo5.css86
-rw-r--r--src/3rdparty/webkit/WebCore/css/themeQtNoListboxes.css36
-rw-r--r--src/3rdparty/webkit/WebCore/css/themeWin.css102
-rw-r--r--src/3rdparty/webkit/WebCore/css/tokenizer.flex111
-rw-r--r--src/3rdparty/webkit/WebCore/css/view-source.css158
-rw-r--r--src/3rdparty/webkit/WebCore/css/wml.css256
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ActiveDOMObject.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ActiveDOMObject.h80
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Attr.cpp181
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Attr.h97
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Attr.idl49
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Attribute.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Attribute.h91
-rw-r--r--src/3rdparty/webkit/WebCore/dom/BeforeTextInsertedEvent.cpp38
-rw-r--r--src/3rdparty/webkit/WebCore/dom/BeforeTextInsertedEvent.h53
-rw-r--r--src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.h51
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CDATASection.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CDATASection.h46
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CanvasSurface.cpp31
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CanvasSurface.h41
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CharacterData.cpp224
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CharacterData.h68
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CheckedRadioButtons.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CheckedRadioButtons.h47
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ClassNodeList.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ClassNodeList.h55
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ClientRect.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ClientRect.h59
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Clipboard.cpp161
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Clipboard.h107
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Clipboard.idl47
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ClipboardEvent.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ClipboardEvent.h56
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Comment.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Comment.h46
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp981
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ContainerNode.h136
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CustomEvent.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CustomEvent.h57
-rw-r--r--src/3rdparty/webkit/WebCore/dom/CustomEvent.idl39
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMCoreException.idl76
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp370
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMImplementation.h70
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMImplementation.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.cpp4907
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.h1258
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.idl316
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DocumentFragment.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DocumentFragment.h46
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DocumentFragment.idl30
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DocumentMarker.h64
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DocumentType.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h82
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EditingText.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.cpp1553
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.h391
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.idl205
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ElementRareData.h63
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Entity.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EntityReference.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ErrorEvent.cpp76
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ErrorEvent.h74
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Event.cpp278
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Event.h195
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Event.idl84
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EventException.idl50
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EventListener.h75
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EventNames.h179
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EventTarget.cpp349
-rw-r--r--src/3rdparty/webkit/WebCore/dom/EventTarget.h245
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ExceptionBase.cpp50
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ExceptionCode.cpp226
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ExceptionCode.h88
-rw-r--r--src/3rdparty/webkit/WebCore/dom/InputElement.cpp258
-rw-r--r--src/3rdparty/webkit/WebCore/dom/InputElement.h125
-rw-r--r--src/3rdparty/webkit/WebCore/dom/KeyboardEvent.cpp163
-rw-r--r--src/3rdparty/webkit/WebCore/dom/KeyboardEvent.h116
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MappedAttribute.cpp34
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MappedAttribute.h68
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MappedAttributeEntry.h55
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessageChannel.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessageEvent.cpp93
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePort.cpp246
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePort.h130
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePort.idl57
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h114
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MouseEvent.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MouseEvent.h86
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp195
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.h87
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MutationEvent.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MutationEvent.h78
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NameNodeList.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NameNodeList.h52
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp322
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NamedAttrMap.h151
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NamedMappedAttrMap.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NamedMappedAttrMap.h62
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NamedNodeMap.h1
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NamedNodeMap.idl58
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.cpp3008
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.h659
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.idl147
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeFilter.h88
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeFilter.idl50
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeFilterCondition.h48
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeIterator.cpp228
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeIterator.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeList.h46
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeList.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeRareData.h123
-rw-r--r--src/3rdparty/webkit/WebCore/dom/NodeRenderStyle.h40
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Notation.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Notation.h51
-rw-r--r--src/3rdparty/webkit/WebCore/dom/OptionElement.cpp159
-rw-r--r--src/3rdparty/webkit/WebCore/dom/OptionElement.h82
-rw-r--r--src/3rdparty/webkit/WebCore/dom/OptionGroupElement.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/dom/OptionGroupElement.h41
-rw-r--r--src/3rdparty/webkit/WebCore/dom/OverflowEvent.h69
-rw-r--r--src/3rdparty/webkit/WebCore/dom/OverflowEvent.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp50
-rw-r--r--src/3rdparty/webkit/WebCore/dom/PopStateEvent.h57
-rw-r--r--src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Position.cpp1205
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Position.h256
-rw-r--r--src/3rdparty/webkit/WebCore/dom/PositionIterator.cpp170
-rw-r--r--src/3rdparty/webkit/WebCore/dom/PositionIterator.h74
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp288
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h100
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ProgressEvent.cpp63
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ProgressEvent.h69
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ProgressEvent.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/dom/QualifiedName.h175
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Range.cpp1971
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Range.h167
-rw-r--r--src/3rdparty/webkit/WebCore/dom/RangeException.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/dom/RegisteredEventListener.h51
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp312
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ScriptElement.h107
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp284
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h171
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectElement.cpp994
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectElement.h195
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectorNodeList.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectorNodeList.h42
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SpaceSplitString.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SpaceSplitString.h89
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StaticNodeList.cpp60
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StyleElement.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StyleElement.h54
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StyledElement.cpp500
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StyledElement.h112
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TagNodeList.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TagNodeList.h51
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Text.cpp361
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Text.h67
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TextEvent.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TextEvent.h71
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Tokenizer.h84
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Touch.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Touch.h75
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TouchEvent.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TouchEvent.h82
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TouchList.h60
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TransformSource.h51
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Traversal.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Traversal.h57
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TreeWalker.cpp277
-rw-r--r--src/3rdparty/webkit/WebCore/dom/TreeWalker.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/dom/UIEvent.cpp97
-rw-r--r--src/3rdparty/webkit/WebCore/dom/UIEvent.h75
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ViewportArguments.cpp120
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ViewportArguments.h74
-rw-r--r--src/3rdparty/webkit/WebCore/dom/WheelEvent.cpp95
-rw-r--r--src/3rdparty/webkit/WebCore/dom/WheelEvent.h87
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp353
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h215
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp1459
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp717
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerScope.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerScope.h62
-rw-r--r--src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp244
-rw-r--r--src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.h116
-rwxr-xr-xsrc/3rdparty/webkit/WebCore/dom/make_names.pl1062
-rw-r--r--src/3rdparty/webkit/WebCore/editing/AppendNodeCommand.cpp63
-rw-r--r--src/3rdparty/webkit/WebCore/editing/AppendNodeCommand.h52
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp1888
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.h131
-rw-r--r--src/3rdparty/webkit/WebCore/editing/BreakBlockquoteCommand.cpp205
-rw-r--r--src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp1201
-rw-r--r--src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h125
-rw-r--r--src/3rdparty/webkit/WebCore/editing/CreateLinkCommand.cpp60
-rw-r--r--src/3rdparty/webkit/WebCore/editing/CreateLinkCommand.h51
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteButton.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteButton.h42
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteButtonController.cpp358
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteButtonController.h77
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteFromTextNodeCommand.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteSelectionCommand.cpp823
-rw-r--r--src/3rdparty/webkit/WebCore/editing/DeleteSelectionCommand.h100
-rw-r--r--src/3rdparty/webkit/WebCore/editing/EditCommand.cpp220
-rw-r--r--src/3rdparty/webkit/WebCore/editing/EditCommand.h95
-rw-r--r--src/3rdparty/webkit/WebCore/editing/Editor.cpp2898
-rw-r--r--src/3rdparty/webkit/WebCore/editing/Editor.h336
-rw-r--r--src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp1579
-rw-r--r--src/3rdparty/webkit/WebCore/editing/EditorInsertAction.h40
-rw-r--r--src/3rdparty/webkit/WebCore/editing/FormatBlockCommand.cpp134
-rw-r--r--src/3rdparty/webkit/WebCore/editing/FormatBlockCommand.h52
-rw-r--r--src/3rdparty/webkit/WebCore/editing/HTMLInterchange.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/editing/HTMLInterchange.h46
-rw-r--r--src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp320
-rw-r--r--src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h61
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertIntoTextNodeCommand.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertLineBreakCommand.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertListCommand.cpp269
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertListCommand.h63
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertNodeBeforeCommand.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.cpp400
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.h61
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertTextCommand.cpp261
-rw-r--r--src/3rdparty/webkit/WebCore/editing/InsertTextCommand.h61
-rw-r--r--src/3rdparty/webkit/WebCore/editing/JoinTextNodesCommand.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/editing/MergeIdenticalElementsCommand.cpp89
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ModifySelectionListLevel.cpp295
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ModifySelectionListLevel.h80
-rw-r--r--src/3rdparty/webkit/WebCore/editing/MoveSelectionCommand.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/editing/RemoveCSSPropertyCommand.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/editing/RemoveCSSPropertyCommand.h56
-rw-r--r--src/3rdparty/webkit/WebCore/editing/RemoveFormatCommand.cpp83
-rw-r--r--src/3rdparty/webkit/WebCore/editing/RemoveNodeCommand.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/editing/RemoveNodeCommand.h53
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp89
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.h62
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ReplaceSelectionCommand.cpp1274
-rw-r--r--src/3rdparty/webkit/WebCore/editing/ReplaceSelectionCommand.h98
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SelectionController.cpp1472
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SelectionController.h215
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SetNodeAttributeCommand.h55
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SmartReplace.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SmartReplace.h35
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SmartReplaceICU.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SplitElementCommand.cpp102
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SplitTextNodeCommand.cpp93
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SplitTextNodeCommand.h55
-rw-r--r--src/3rdparty/webkit/WebCore/editing/SplitTextNodeContainingElementCommand.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/editing/TextGranularity.h47
-rw-r--r--src/3rdparty/webkit/WebCore/editing/TextIterator.cpp2250
-rw-r--r--src/3rdparty/webkit/WebCore/editing/TextIterator.h288
-rw-r--r--src/3rdparty/webkit/WebCore/editing/TypingCommand.cpp621
-rw-r--r--src/3rdparty/webkit/WebCore/editing/TypingCommand.h106
-rw-r--r--src/3rdparty/webkit/WebCore/editing/UnlinkCommand.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/editing/VisiblePosition.cpp690
-rw-r--r--src/3rdparty/webkit/WebCore/editing/VisiblePosition.h151
-rw-r--r--src/3rdparty/webkit/WebCore/editing/VisibleSelection.cpp649
-rw-r--r--src/3rdparty/webkit/WebCore/editing/VisibleSelection.h151
-rw-r--r--src/3rdparty/webkit/WebCore/editing/WrapContentsInDummySpanCommand.cpp93
-rw-r--r--src/3rdparty/webkit/WebCore/editing/htmlediting.cpp1171
-rw-r--r--src/3rdparty/webkit/WebCore/editing/htmlediting.h238
-rw-r--r--src/3rdparty/webkit/WebCore/editing/markup.cpp1290
-rw-r--r--src/3rdparty/webkit/WebCore/editing/markup.h59
-rw-r--r--src/3rdparty/webkit/WebCore/editing/qt/EditorQt.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/editing/visible_units.cpp1249
-rw-r--r--src/3rdparty/webkit/WebCore/editing/visible_units.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp4560
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSGrammar.h155
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp1339
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h299
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c2809
-rw-r--r--src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.h626
-rw-r--r--src/3rdparty/webkit/WebCore/generated/ColorData.c441
-rw-r--r--src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp1083
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLElementFactory.cpp619
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLElementFactory.h56
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c550
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLNames.cpp1277
-rw-r--r--src/3rdparty/webkit/WebCore/generated/HTMLNames.h451
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp251
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSAttr.cpp229
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSAttr.h91
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp115
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSBarInfo.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSBeforeLoadEvent.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSBeforeLoadEvent.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSBlob.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSBlob.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCDATASection.cpp149
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCDATASection.h73
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSCharsetRule.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSCharsetRule.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSFontFaceRule.cpp162
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSFontFaceRule.h73
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSImportRule.cpp184
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSImportRule.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSMediaRule.cpp219
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSMediaRule.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSPageRule.cpp187
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSPageRule.h76
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSPrimitiveValue.cpp478
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSPrimitiveValue.h112
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp300
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSRule.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp251
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp413
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.h107
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleRule.cpp187
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleRule.h76
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleSheet.cpp273
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSStyleSheet.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp235
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSValue.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSValueList.cpp237
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSValueList.h81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp334
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.h97
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSVariablesRule.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCSSVariablesRule.h74
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp110
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp171
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext2D.cpp1053
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext2D.h170
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCharacterData.cpp312
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCharacterData.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp224
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClientRect.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp256
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClientRectList.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp273
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSClipboard.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSComment.cpp149
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSComment.h72
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCompositionEvent.cpp191
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCompositionEvent.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSConsole.cpp365
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSConsole.h104
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp164
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCoordinates.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCounter.cpp195
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCounter.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCustomEvent.cpp187
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSCustomEvent.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp430
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.h124
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp377
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.h113
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMFormData.cpp193
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMFormData.h89
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp270
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMParser.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp461
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMSelection.h109
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp8713
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h969
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp332
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.h108
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp353
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp163
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDatabase.h96
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDedicatedWorkerContext.cpp153
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDedicatedWorkerContext.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocument.cpp2190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocument.h265
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocumentFragment.cpp199
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocumentFragment.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocumentType.cpp217
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDocumentType.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSElement.cpp1780
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSElement.h240
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEntity.cpp180
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEntity.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEntityReference.cpp149
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEntityReference.h72
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSErrorEvent.cpp225
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSErrorEvent.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEvent.cpp509
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEvent.h128
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEventException.cpp238
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEventException.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp305
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSEventSource.h111
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSFile.cpp200
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSFile.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSFileList.cpp256
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSFileList.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp131
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSGeolocation.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp133
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSGeoposition.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp293
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAnchorElement.cpp498
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAnchorElement.h115
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAppletElement.cpp351
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAppletElement.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAreaElement.cpp346
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAreaElement.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAudioElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLAudioElement.h76
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBRElement.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBRElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBaseElement.cpp191
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBaseElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBaseFontElement.cpp209
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBaseFontElement.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBlockquoteElement.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBlockquoteElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp459
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.cpp364
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLButtonElement.h97
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.cpp229
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp271
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDListElement.cpp171
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDListElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.cpp247
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridCellElement.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.cpp247
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridColElement.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.cpp234
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridElement.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.cpp210
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataGridRowElement.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataListElement.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDataListElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDirectoryElement.cpp171
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDirectoryElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDivElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDivElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDocument.cpp480
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLDocument.h120
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLElement.cpp461
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLElement.h114
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLElementWrapperFactory.cpp656
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLElementWrapperFactory.h49
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLEmbedElement.cpp298
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLEmbedElement.h96
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.cpp234
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFieldSetElement.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFontElement.cpp207
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFontElement.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFormElement.cpp414
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFormElement.h106
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFrameElement.cpp381
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFrameElement.h104
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp401
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.h98
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHRElement.cpp224
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHRElement.h81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHeadElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHeadElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHeadingElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHeadingElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHtmlElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLHtmlElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLIFrameElement.cpp396
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLIFrameElement.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLImageElement.cpp429
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLImageElement.h104
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.cpp864
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLInputElement.h161
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLIsIndexElement.cpp185
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLIsIndexElement.h76
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLIElement.cpp191
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLIElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLabelElement.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLabelElement.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLegendElement.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLegendElement.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLinkElement.cpp321
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLLinkElement.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMapElement.cpp185
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMapElement.h76
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMarqueeElement.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMarqueeElement.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMediaElement.cpp643
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMediaElement.h134
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMenuElement.cpp171
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMenuElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMetaElement.cpp224
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLMetaElement.h81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLModElement.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLModElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOListElement.cpp208
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOListElement.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLObjectElement.cpp501
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLObjectElement.h119
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptGroupElement.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptGroupElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptionElement.cpp287
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptionElement.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptionsCollection.cpp231
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLOptionsCollection.h99
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLParagraphElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLParagraphElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLParamElement.cpp224
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLParamElement.h81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLPreElement.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLPreElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLProgressElement.cpp216
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLProgressElement.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLQuoteElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLQuoteElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLScriptElement.cpp275
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLScriptElement.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.cpp526
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.h113
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLSourceElement.cpp212
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLSourceElement.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLStyleElement.cpp219
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLStyleElement.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableCaptionElement.cpp177
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableCaptionElement.h81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableCellElement.cpp405
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableCellElement.h102
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableColElement.cpp259
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableColElement.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableElement.cpp519
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableElement.h111
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableRowElement.cpp320
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableRowElement.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableSectionElement.cpp286
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTableSectionElement.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.cpp529
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTextAreaElement.h115
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTitleElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLTitleElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLUListElement.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLUListElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLVideoElement.cpp320
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHTMLVideoElement.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHistory.cpp199
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSHistory.h99
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSImageData.cpp180
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSImageData.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSInjectedScriptHost.cpp360
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSInjectedScriptHost.h114
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp1039
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.h148
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSInspectorFrontendHost.cpp383
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSInspectorFrontendHost.h107
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSKeyboardEvent.cpp258
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSKeyboardEvent.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSLocation.cpp297
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSLocation.h129
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp219
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMediaError.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp306
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMediaList.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessageChannel.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessageEvent.cpp235
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessageEvent.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp289
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMessagePort.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp207
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMimeType.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp277
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMouseEvent.cpp366
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMouseEvent.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMutationEvent.cpp259
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMutationEvent.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp356
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp325
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNavigator.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNode.cpp737
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNode.h174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp294
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeFilter.h109
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp272
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeIterator.h100
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp267
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNodeList.h96
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNotation.cpp170
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSNotation.h74
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSOverflowEvent.cpp230
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSOverflowEvent.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPageTransitionEvent.cpp187
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPageTransitionEvent.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp309
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPlugin.h97
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp291
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPluginArray.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPopStateEvent.cpp181
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPopStateEvent.h81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp224
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSPositionError.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSProcessingInstruction.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSProcessingInstruction.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSProgressEvent.cpp210
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSProgressEvent.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp195
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRGBColor.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRange.cpp731
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRange.h127
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp237
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRangeException.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRect.cpp205
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSRect.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp133
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLError.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp144
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp142
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp107
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAElement.cpp424
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAElement.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAltGlyphElement.cpp211
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAltGlyphElement.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp325
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAngle.h107
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateColorElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateColorElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateTransformElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimateTransformElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp204
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimationElement.cpp277
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGAnimationElement.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGCircleElement.cpp436
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGCircleElement.h104
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGClipPathElement.cpp414
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGClipPathElement.h102
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGColor.cpp269
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGColor.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGComponentTransferFunctionElement.cpp288
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGComponentTransferFunctionElement.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGCursorElement.cpp259
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGCursorElement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDefsElement.cpp402
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDefsElement.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDescElement.cpp248
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDescElement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDocument.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGDocument.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElement.cpp227
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp1188
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.h190
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp207
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementWrapperFactory.cpp634
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGElementWrapperFactory.h52
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGEllipseElement.cpp447
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGEllipseElement.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp250
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGException.h99
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEBlendElement.cpp341
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEBlendElement.h100
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEColorMatrixElement.cpp335
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEColorMatrixElement.h99
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEComponentTransferElement.cpp274
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEComponentTransferElement.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFECompositeElement.cpp393
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFECompositeElement.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDiffuseLightingElement.cpp319
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDiffuseLightingElement.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDisplacementMapElement.cpp357
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDisplacementMapElement.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDistantLightElement.cpp177
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEDistantLightElement.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFloodElement.cpp263
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFloodElement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncAElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncAElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncBElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncBElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncGElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncGElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncRElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEFuncRElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEGaussianBlurElement.cpp312
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEGaussianBlurElement.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEImageElement.cpp339
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEImageElement.h97
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeElement.cpp263
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeElement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeNodeElement.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMergeNodeElement.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMorphologyElement.cpp347
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEMorphologyElement.h99
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEOffsetElement.cpp297
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEOffsetElement.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEPointLightElement.cpp188
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFEPointLightElement.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFESpecularLightingElement.cpp308
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFESpecularLightingElement.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFESpotLightElement.cpp243
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFESpotLightElement.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFETileElement.cpp274
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFETileElement.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFETurbulenceElement.cpp376
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFETurbulenceElement.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFilterElement.cpp377
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFilterElement.h100
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceFormatElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceFormatElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceNameElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceNameElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceSrcElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceSrcElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceUriElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGFontFaceUriElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGForeignObjectElement.cpp447
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGForeignObjectElement.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGElement.cpp402
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGElement.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGlyphElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGlyphElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGradientElement.cpp295
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGGradientElement.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGHKernElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGHKernElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGImageElement.cpp470
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGImageElement.h107
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp358
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLength.h119
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp264
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.h98
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLineElement.cpp447
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLineElement.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLinearGradientElement.cpp199
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGLinearGradientElement.h81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMarkerElement.cpp436
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMarkerElement.h109
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMaskElement.cpp375
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMaskElement.h100
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp458
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.h119
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMetadataElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMetadataElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMissingGlyphElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGMissingGlyphElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp193
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGNumber.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp263
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.h98
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPaint.cpp293
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPaint.h97
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathElement.cpp857
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathElement.h128
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp340
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.h112
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcAbs.cpp286
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcAbs.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcRel.cpp286
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegArcRel.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegClosePath.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegClosePath.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.cpp268
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicAbs.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicRel.cpp268
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicRel.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.cpp232
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothAbs.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.cpp232
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoCubicSmoothRel.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.cpp232
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticAbs.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.cpp232
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticRel.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothAbs.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegCurvetoQuadraticSmoothRel.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoAbs.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoAbs.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalAbs.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoHorizontalRel.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoRel.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoRel.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalAbs.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalRel.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegLinetoVerticalRel.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp262
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.h107
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoAbs.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoAbs.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoRel.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPathSegMovetoRel.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPatternElement.cpp422
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPatternElement.h104
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp242
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPoint.h96
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp263
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPointList.h98
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPolygonElement.cpp424
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPolygonElement.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPolylineElement.cpp424
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPolylineElement.h103
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp323
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.h109
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRadialGradientElement.cpp210
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRadialGradientElement.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp250
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRect.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRectElement.cpp469
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRectElement.h107
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp223
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.h96
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSVGElement.cpp953
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSVGElement.h149
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGScriptElement.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGScriptElement.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSetElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSetElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStopElement.cpp219
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStopElement.h85
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp312
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStringList.h98
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStyleElement.cpp252
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGStyleElement.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSwitchElement.cpp402
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSwitchElement.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSymbolElement.cpp284
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGSymbolElement.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTRefElement.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTRefElement.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTSpanElement.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTSpanElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextContentElement.cpp537
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextContentElement.h110
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextElement.cpp260
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextElement.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextPathElement.cpp255
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextPathElement.h91
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextPositioningElement.cpp211
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTextPositioningElement.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTitleElement.cpp248
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTitleElement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp363
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTransform.h108
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp294
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.h100
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGUseElement.cpp480
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGUseElement.h108
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGViewElement.cpp258
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGViewElement.h91
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGZoomEvent.cpp207
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSVGZoomEvent.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSScreen.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSScreen.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSharedWorker.cpp116
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSharedWorker.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSharedWorkerContext.cpp144
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSSharedWorkerContext.h83
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStorage.cpp296
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStorage.h102
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStorageEvent.cpp240
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStorageEvent.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleMedia.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleMedia.h87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp247
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleSheet.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp262
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSText.cpp212
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSText.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTextEvent.cpp191
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTextEvent.h78
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTextMetrics.h82
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTimeRanges.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTouch.cpp251
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTouch.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTouchEvent.cpp264
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTouchEvent.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTouchList.cpp256
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTouchList.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp313
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSTreeWalker.h110
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSUIEvent.cpp271
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSUIEvent.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp195
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSValidityState.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSVoidCallback.h80
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLActiveInfo.cpp143
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLActiveInfo.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLArray.cpp170
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLArray.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLArrayBuffer.cpp121
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLArrayBuffer.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLBuffer.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLBuffer.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLByteArray.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLByteArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLContextAttributes.cpp200
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLContextAttributes.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLFloatArray.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLFloatArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLFramebuffer.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLFramebuffer.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLIntArray.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLIntArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLProgram.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLProgram.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLRenderbuffer.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLRenderbuffer.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLRenderingContext.cpp4252
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLRenderingContext.h546
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLShader.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLShader.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLShortArray.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLShortArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLTexture.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLTexture.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUniformLocation.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUniformLocation.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedByteArray.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedByteArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedIntArray.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedIntArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedShortArray.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedShortArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitAnimationEvent.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitAnimationEvent.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframeRule.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframeRule.h76
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframesRule.cpp289
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSKeyframesRule.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp629
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.h136
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSTransformValue.cpp368
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitCSSTransformValue.h101
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp145
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitTransitionEvent.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebKitTransitionEvent.h79
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp347
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWebSocket.h116
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWheelEvent.cpp336
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWheelEvent.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorker.cpp167
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorker.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp395
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerContext.h125
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp283
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.h98
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp170
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.h88
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp500
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.h135
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp245
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.h93
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestProgressEvent.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestProgressEvent.h74
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp340
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.h105
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp203
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.h86
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp265
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.h92
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp242
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathException.h97
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathExpression.h90
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp115
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.h84
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp364
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXPathResult.h110
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.h99
-rw-r--r--src/3rdparty/webkit/WebCore/generated/SVGElementFactory.cpp609
-rw-r--r--src/3rdparty/webkit/WebCore/generated/SVGElementFactory.h55
-rw-r--r--src/3rdparty/webkit/WebCore/generated/SVGNames.cpp1052
-rw-r--r--src/3rdparty/webkit/WebCore/generated/SVGNames.h376
-rw-r--r--src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheets.h11
-rw-r--r--src/3rdparty/webkit/WebCore/generated/UserAgentStyleSheetsData.cpp1404
-rw-r--r--src/3rdparty/webkit/WebCore/generated/WebKitVersion.h36
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XLinkNames.cpp99
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XLinkNames.h60
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XMLNSNames.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XMLNSNames.h54
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XMLNames.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XMLNames.h56
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp2236
-rw-r--r--src/3rdparty/webkit/WebCore/generated/XPathGrammar.h95
-rw-r--r--src/3rdparty/webkit/WebCore/generated/tokenizer.cpp2208
-rw-r--r--src/3rdparty/webkit/WebCore/history/BackForwardList.cpp314
-rw-r--r--src/3rdparty/webkit/WebCore/history/BackForwardList.h126
-rw-r--r--src/3rdparty/webkit/WebCore/history/BackForwardListChromium.cpp153
-rw-r--r--src/3rdparty/webkit/WebCore/history/CachedFrame.cpp253
-rw-r--r--src/3rdparty/webkit/WebCore/history/CachedFrame.h94
-rw-r--r--src/3rdparty/webkit/WebCore/history/CachedPage.cpp102
-rw-r--r--src/3rdparty/webkit/WebCore/history/CachedPage.h63
-rw-r--r--src/3rdparty/webkit/WebCore/history/HistoryItem.cpp586
-rw-r--r--src/3rdparty/webkit/WebCore/history/HistoryItem.h280
-rw-r--r--src/3rdparty/webkit/WebCore/history/PageCache.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/history/PageCache.h87
-rw-r--r--src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/html/Blob.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/html/Blob.h99
-rw-r--r--src/3rdparty/webkit/WebCore/html/Blob.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/html/CollectionCache.h70
-rw-r--r--src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h69
-rw-r--r--src/3rdparty/webkit/WebCore/html/DOMFormData.cpp60
-rw-r--r--src/3rdparty/webkit/WebCore/html/DOMFormData.h58
-rw-r--r--src/3rdparty/webkit/WebCore/html/DOMFormData.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumn.h117
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumn.idl48
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumnList.h63
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl45
-rw-r--r--src/3rdparty/webkit/WebCore/html/DataGridDataSource.h49
-rw-r--r--src/3rdparty/webkit/WebCore/html/DateComponents.cpp681
-rw-r--r--src/3rdparty/webkit/WebCore/html/DateComponents.h190
-rw-r--r--src/3rdparty/webkit/WebCore/html/DocTypeStrings.gperf89
-rw-r--r--src/3rdparty/webkit/WebCore/html/File.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/html/File.h58
-rw-r--r--src/3rdparty/webkit/WebCore/html/File.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/html/FileList.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/html/FormDataList.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/html/FormDataList.h70
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp561
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.h121
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.idl66
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAppletElement.cpp191
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h64
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAppletElement.idl49
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAreaElement.cpp239
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAreaElement.h80
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAreaElement.idl47
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in278
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAudioElement.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h49
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBRElement.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBRElement.h49
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBRElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp86
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseElement.idl27
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h44
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBlockquoteElement.cpp38
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBlockquoteElement.h41
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBlockquoteElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBodyElement.cpp331
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h99
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLBodyElement.idl61
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLButtonElement.cpp192
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLButtonElement.h71
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp361
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.h143
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.idl45
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLCollection.cpp407
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLCollection.h90
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLCollection.idl39
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDListElement.cpp46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDListElement.h42
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDListElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h62
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp171
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h79
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h71
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp83
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataListElement.cpp60
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDataListElement.h55
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.cpp46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h42
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDivElement.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDivElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDivElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDocument.cpp421
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDocument.h112
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLDocument.idl64
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLElement.cpp1022
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLElement.h124
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLElement.idl68
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLElementsAllInOne.cpp106
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLEmbedElement.cpp245
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLEmbedElement.h67
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLEmbedElement.idl51
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLEntityNames.gperf296
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.h56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFontElement.cpp177
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFontElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFontElement.idl28
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormCollection.cpp248
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp548
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h196
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp617
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormElement.h165
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFormElement.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameElement.cpp105
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameElement.h61
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameElement.idl53
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameElementBase.cpp301
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameElementBase.h99
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameOwnerElement.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameOwnerElement.h72
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.cpp243
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.h109
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLFrameSetElement.idl59
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp143
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHRElement.h55
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHRElement.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHeadElement.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h47
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHeadElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHeadingElement.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHeadingElement.h43
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHeadingElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.cpp89
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h50
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.idl28
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLIFrameElement.cpp168
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLIFrameElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLIFrameElement.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLImageElement.cpp438
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLImageElement.h125
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLImageElement.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLImageLoader.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp2785
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLInputElement.h351
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl100
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.idl27
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLKeygenElement.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLKeygenElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLIElement.cpp129
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLIElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLIElement.idl27
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLabelElement.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLabelElement.h65
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLabelElement.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLegendElement.cpp115
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLegendElement.h56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLegendElement.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp449
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLinkElement.h119
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLLinkElement.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMapElement.cpp134
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMapElement.h61
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMapElement.idl28
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp149
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.h63
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp1991
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h355
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMediaElement.idl86
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMenuElement.cpp46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h42
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMenuElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMetaElement.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h61
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLMetaElement.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLModElement.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLModElement.h47
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLModElement.idl27
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLNameCollection.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLNoScriptElement.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLNoScriptElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOListElement.cpp105
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOListElement.h55
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOListElement.idl28
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLObjectElement.cpp364
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLObjectElement.h92
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLObjectElement.idl63
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOptGroupElement.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOptGroupElement.h72
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOptGroupElement.idl27
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp255
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOptionElement.h98
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLOptionElement.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParagraphElement.cpp82
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParagraphElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParagraphElement.idl26
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParamElement.cpp115
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParamElement.h65
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParamElement.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParser.cpp1731
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParser.h205
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParserErrorCodes.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParserErrorCodes.h60
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLParserQuirks.h49
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLPlugInElement.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLPlugInElement.h85
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLPlugInImageElement.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLPlugInImageElement.h50
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLPreElement.cpp83
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLPreElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLPreElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLProgressElement.cpp108
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLProgressElement.h56
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLProgressElement.idl30
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.idl25
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLScriptElement.cpp241
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLScriptElement.h97
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLScriptElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp461
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSelectElement.h146
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl73
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSourceElement.cpp113
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSourceElement.h68
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLSourceElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLStyleElement.cpp146
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h73
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLStyleElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h49
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.cpp271
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h115
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableColElement.cpp163
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h74
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableColElement.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableElement.cpp759
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableElement.h131
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableElement.idl63
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTablePartElement.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTablePartElement.h45
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableRowElement.cpp229
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableRowElement.h72
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableRowElement.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableRowsCollection.cpp167
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.h66
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTagNames.in132
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.cpp416
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.h118
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl55
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTitleElement.cpp94
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h49
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp2159
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h435
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLUListElement.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLUListElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLUListElement.idl27
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp250
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h94
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLVideoElement.idl46
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLViewSourceDocument.cpp311
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLViewSourceDocument.h69
-rw-r--r--src/3rdparty/webkit/WebCore/html/ImageData.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/html/ImageData.h55
-rw-r--r--src/3rdparty/webkit/WebCore/html/ImageData.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/html/MediaError.h52
-rw-r--r--src/3rdparty/webkit/WebCore/html/PreloadScanner.cpp859
-rw-r--r--src/3rdparty/webkit/WebCore/html/PreloadScanner.h144
-rw-r--r--src/3rdparty/webkit/WebCore/html/StepRange.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/html/StepRange.h68
-rw-r--r--src/3rdparty/webkit/WebCore/html/TextMetrics.h50
-rw-r--r--src/3rdparty/webkit/WebCore/html/TimeRanges.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/html/TimeRanges.h111
-rw-r--r--src/3rdparty/webkit/WebCore/html/TimeRanges.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/html/ValidityState.cpp180
-rw-r--r--src/3rdparty/webkit/WebCore/html/ValidityState.h68
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasGradient.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasGradient.h71
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasGradient.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasNumberArray.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasNumberArray.h55
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasNumberArray.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.h72
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasPattern.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasPattern.h62
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasPattern.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.h75
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h56
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp1595
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.h271
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.idl120
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasStyle.cpp221
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasStyle.h89
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.h62
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.h114
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.h55
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.idl30
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.h94
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.cpp88
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.h100
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.h82
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.h95
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.h50
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.cpp215
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.h131
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.h97
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.h50
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.h55
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.cpp2532
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.h360
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.idl676
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.h50
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.cpp89
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.h94
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.h66
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.idl29
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.h58
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.idl30
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.h95
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.h95
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.h96
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp149
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h79
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InjectedScript.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InjectedScript.h66
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.cpp225
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.h112
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.idl65
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp530
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h158
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl120
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorClient.h55
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp1888
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorController.h393
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp1205
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h200
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.cpp121
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorDOMStorageResource.h90
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorDatabaseResource.cpp76
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorDatabaseResource.h75
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp761
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h174
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontendClient.h69
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontendClientLocal.cpp235
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontendClientLocal.h80
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.h89
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.idl55
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp382
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorResource.h184
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp275
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h155
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp114
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h89
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/ScriptBreakpoint.h57
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/ScriptDebugListener.h53
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h84
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js514
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/AuditLauncherView.js281
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/AuditResultView.js91
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/AuditRules.js1023
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/AuditsPanel.js483
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Breakpoint.js96
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js163
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js165
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Callback.js56
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ChangesView.js80
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Checkbox.js56
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Color.js661
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ConsolePanel.js88
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js1048
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ContextMenu.js83
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/CookieItemsView.js303
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/DOMAgent.js690
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js78
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js157
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/DataGrid.js1282
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Database.js103
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js194
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseTableView.js90
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Drawer.js316
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js1117
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js1244
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/EventListenersSidebarPane.js222
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/FontView.js104
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ImageView.js75
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/auditsIcon.pngbin3815 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/back.pngbin4205 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/breakpointBorder.pngbin377 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/breakpointConditionalBorder.pngbin379 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/breakpointConditionalCounterBorder.pngbin529 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/breakpointCounterBorder.pngbin526 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/breakpointsActivateButtonGlyph.pngbin250 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/breakpointsDeactivateButtonGlyph.pngbin426 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/checker.pngbin3471 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/clearConsoleButtonGlyph.pngbin396 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/closeButtons.pngbin4355 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/consoleButtonGlyph.pngbin183 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/consoleIcon.pngbin2930 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/cookie.pngbin2246 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/database.pngbin2329 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/databaseTable.pngbin4325 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/debuggerContinue.pngbin4190 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/debuggerPause.pngbin4081 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/debuggerStepInto.pngbin4282 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/debuggerStepOut.pngbin4271 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/debuggerStepOver.pngbin4366 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallDown.pngbin3919 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownBlack.pngbin3802 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownWhite.pngbin3820 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallRight.pngbin3898 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightBlack.pngbin3807 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDown.pngbin3953 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownBlack.pngbin3816 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownWhite.pngbin3838 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightWhite.pngbin3818 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/dockButtonGlyph.pngbin164 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/elementsIcon.pngbin6639 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/enableOutlineButtonGlyph.pngbin363 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/enableSolidButtonGlyph.pngbin302 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/errorIcon.pngbin4337 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/errorMediumIcon.pngbin4059 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/errorRedDot.pngbin549 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/excludeButtonGlyph.pngbin212 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/focusButtonGlyph.pngbin285 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/forward.pngbin4202 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/gearButtonGlyph.pngbin323 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/glossyHeader.pngbin3720 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/glossyHeaderPressed.pngbin3721 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/glossyHeaderSelected.pngbin3738 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/glossyHeaderSelectedPressed.pngbin3739 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/goArrow.pngbin3591 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/graphLabelCalloutLeft.pngbin3790 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/graphLabelCalloutRight.pngbin3789 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/grayConnectorPoint.pngbin236 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/largerResourcesButtonGlyph.pngbin192 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/localStorage.pngbin1081 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/nodeSearchButtonGlyph.pngbin283 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/paneBottomGrow.pngbin3457 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/paneBottomGrowActive.pngbin3457 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/paneGrowHandleLine.pngbin3443 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/paneSettingsButtons.pngbin1422 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/pauseOnExceptionButtonGlyph.pngbin331 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/percentButtonGlyph.pngbin357 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/popoverArrows.pngbin784 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/popoverBackground.pngbin2233 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/profileGroupIcon.pngbin5126 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/profileIcon.pngbin4953 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/profileSmallIcon.pngbin579 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/profilesIcon.pngbin4158 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/profilesSilhouette.pngbin48600 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/programCounterBorder.pngbin352 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/radioDot.pngbin235 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/recordButtonGlyph.pngbin213 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/recordToggledButtonGlyph.pngbin510 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/reloadButtonGlyph.pngbin267 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourceCSSIcon.pngbin1066 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourceDocumentIcon.pngbin4959 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourceDocumentIconSmall.pngbin787 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourceJSIcon.pngbin879 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcePlainIcon.pngbin4321 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcePlainIconSmall.pngbin731 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcesIcon.pngbin6431 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcesSilhouette.pngbin42925 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcesSizeGraphIcon.pngbin5606 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/resourcesTimeGraphIcon.pngbin5743 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/scriptsIcon.pngbin7428 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/scriptsSilhouette.pngbin49028 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/searchSmallBlue.pngbin3968 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/searchSmallBrightBlue.pngbin3966 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/searchSmallGray.pngbin3936 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/searchSmallWhite.pngbin3844 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/segment.pngbin4349 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/segmentEnd.pngbin4070 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/segmentHover.pngbin4310 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/segmentHoverEnd.pngbin4074 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/segmentSelected.pngbin4302 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/segmentSelectedEnd.pngbin4070 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/sessionStorage.pngbin1097 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/splitviewDimple.pngbin216 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/splitviewDividerBackground.pngbin149 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/statusbarButtons.pngbin4175 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/statusbarMenuButton.pngbin4293 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.pngbin4291 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/statusbarResizerHorizontal.pngbin4026 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/statusbarResizerVertical.pngbin4036 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/storageIcon.pngbin7148 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/successGreenDot.pngbin585 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbActiveHoriz.pngbin647 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbActiveVert.pngbin599 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoriz.pngbin657 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoverHoriz.pngbin667 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoverVert.pngbin583 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbVert.pngbin568 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarBlue.pngbin419 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGray.pngbin378 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGreen.pngbin414 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarOrange.pngbin394 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarPurple.pngbin420 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarRed.pngbin408 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarYellow.pngbin400 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineCheckmarks.pngbin3528 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineDots.pngbin2436 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineHollowPillBlue.pngbin3450 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineHollowPillGray.pngbin3392 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineHollowPillGreen.pngbin3452 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineHollowPillOrange.pngbin3452 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineHollowPillPurple.pngbin3453 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineHollowPillRed.pngbin3460 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineHollowPillYellow.pngbin3444 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineIcon.pngbin4419 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelinePillBlue.pngbin3346 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelinePillGray.pngbin3297 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelinePillGreen.pngbin3350 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelinePillOrange.pngbin3352 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelinePillPurple.pngbin3353 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelinePillRed.pngbin3343 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelinePillYellow.pngbin3336 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/toolbarItemSelected.pngbin4197 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/trackHoriz.pngbin520 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/trackVert.pngbin523 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/treeDownTriangleBlack.pngbin3570 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/treeDownTriangleWhite.pngbin3531 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/treeRightTriangleBlack.pngbin3561 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/treeRightTriangleWhite.pngbin3535 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/treeUpTriangleBlack.pngbin3584 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/treeUpTriangleWhite.pngbin3558 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/undockButtonGlyph.pngbin179 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/userInputIcon.pngbin777 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/userInputPreviousIcon.pngbin765 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/userInputResultIcon.pngbin259 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningIcon.pngbin4244 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningMediumIcon.pngbin3833 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningOrangeDot.pngbin580 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/warningsErrors.pngbin5192 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Images/whiteConnectorPoint.pngbin225 -> 0 bytes-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/InjectedFakeWorker.js299
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js974
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScriptAccess.js103
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/InspectorBackendStub.js271
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/InspectorFrontendHostStub.js111
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/KeyboardShortcut.js116
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/MetricsSidebarPane.js217
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Object.js82
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ObjectPropertiesSection.js267
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ObjectProxy.js70
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Panel.js392
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Placard.js106
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Popover.js238
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ProfileDataGridTree.js408
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js623
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js581
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/PropertiesSection.js43
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/PropertiesSidebarPane.js65
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Resource.js624
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ResourceCategory.js65
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js365
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js1346
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ScopeChainSidebarPane.js148
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Script.js61
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ScriptView.js98
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/ScriptsPanel.js974
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Section.js140
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/Settings.js103
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SidebarPane.js133
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SidebarTreeElement.js201
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceCSSTokenizer.js1473
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceCSSTokenizer.re2js318
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js701
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.js687
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js303
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceTokenizer.js104
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceView.js238
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js505
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/StylesSidebarPane.js1424
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SummaryBar.js363
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TestController.js78
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TextEditorHighlighter.js126
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TextEditorModel.js309
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TextPrompt.js429
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TextViewer.js732
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TimelineAgent.js69
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TimelineGrid.js144
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TimelineOverviewPane.js391
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/TimelinePanel.js859
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js281
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc253
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/WorkersSidebarPane.js114
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/audits.css279
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css3930
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html145
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js1935
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/textViewer.css162
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js863
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js920
-rw-r--r--src/3rdparty/webkit/WebCore/loader/Cache.cpp750
-rw-r--r--src/3rdparty/webkit/WebCore/loader/Cache.h210
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachePolicy.h41
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.h68
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedFont.cpp208
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedFont.h90
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedImage.cpp385
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedImage.h106
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedResource.cpp488
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedResource.h264
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedResourceClient.h83
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedScript.cpp129
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedScript.h67
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedXBLDocument.cpp110
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedXBLDocument.h67
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedXSLStyleSheet.cpp99
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedXSLStyleSheet.h64
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CrossOriginAccessControl.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CrossOriginAccessControl.h41
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CrossOriginPreflightResultCache.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CrossOriginPreflightResultCache.h84
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocLoader.cpp497
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocLoader.h135
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp758
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocumentLoader.h309
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.cpp358
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.h103
-rw-r--r--src/3rdparty/webkit/WebCore/loader/EmptyClients.h487
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FTPDirectoryDocument.cpp452
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FTPDirectoryDocument.h48
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FTPDirectoryParser.cpp1711
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp4079
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoader.h534
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h276
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h119
-rw-r--r--src/3rdparty/webkit/WebCore/loader/HistoryController.cpp672
-rw-r--r--src/3rdparty/webkit/WebCore/loader/HistoryController.h99
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp401
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ImageDocument.h76
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp341
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ImageLoader.h86
-rw-r--r--src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp581
-rw-r--r--src/3rdparty/webkit/WebCore/loader/MainResourceLoader.h114
-rw-r--r--src/3rdparty/webkit/WebCore/loader/MediaDocument.cpp238
-rw-r--r--src/3rdparty/webkit/WebCore/loader/MediaDocument.h61
-rw-r--r--src/3rdparty/webkit/WebCore/loader/NetscapePlugInStreamLoader.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/loader/NetscapePlugInStreamLoader.h70
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.h48
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PluginDocument.cpp180
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PluginDocument.h53
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PolicyCallback.cpp133
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PolicyCallback.h80
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PolicyChecker.cpp197
-rw-r--r--src/3rdparty/webkit/WebCore/loader/PolicyChecker.h97
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp261
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ProgressTracker.h80
-rw-r--r--src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp403
-rw-r--r--src/3rdparty/webkit/WebCore/loader/RedirectScheduler.h81
-rw-r--r--src/3rdparty/webkit/WebCore/loader/Request.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/loader/Request.h64
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.cpp182
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h74
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ResourceLoader.cpp499
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ResourceLoader.h157
-rw-r--r--src/3rdparty/webkit/WebCore/loader/SubresourceLoader.cpp276
-rw-r--r--src/3rdparty/webkit/WebCore/loader/SubresourceLoader.h67
-rw-r--r--src/3rdparty/webkit/WebCore/loader/SubresourceLoaderClient.h61
-rw-r--r--src/3rdparty/webkit/WebCore/loader/TextDocument.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/loader/TextDocument.h51
-rw-r--r--src/3rdparty/webkit/WebCore/loader/TextResourceDecoder.cpp854
-rw-r--r--src/3rdparty/webkit/WebCore/loader/TextResourceDecoder.h96
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ThreadableLoader.h85
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ThreadableLoaderClient.h57
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ThreadableLoaderClientWrapper.h117
-rw-r--r--src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.cpp248
-rw-r--r--src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.h147
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCache.cpp203
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCache.h117
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp1010
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.h189
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp406
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h157
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheResource.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheResource.h75
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.cpp1128
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.h126
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp130
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h98
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl68
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ManifestParser.cpp185
-rw-r--r--src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.h50
-rw-r--r--src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/loader/archive/ArchiveResource.h65
-rw-r--r--src/3rdparty/webkit/WebCore/loader/archive/ArchiveResourceCollection.h59
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp2073
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h243
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseClient.h51
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp218
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconFetcher.cpp229
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconFetcher.h78
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconLoader.cpp172
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconLoader.h69
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconRecord.cpp105
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/IconRecord.h117
-rw-r--r--src/3rdparty/webkit/WebCore/loader/icon/PageURLRecord.h85
-rw-r--r--src/3rdparty/webkit/WebCore/loader/loader.cpp591
-rw-r--r--src/3rdparty/webkit/WebCore/loader/loader.h117
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLElement.h50
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp51
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.cpp113
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLFraction.cpp208
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLFraction.h54
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLOperator.cpp328
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLOperator.h72
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLRow.cpp157
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLRow.h48
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLSubSup.cpp213
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLSubSup.h60
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLUnderOver.cpp274
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/RenderMathMLUnderOver.h54
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/mathattrs.in13
-rw-r--r--src/3rdparty/webkit/WebCore/mathml/mathtags.in21
-rwxr-xr-xsrc/3rdparty/webkit/WebCore/move-js-headers.sh6
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/Notification.cpp114
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/Notification.h108
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/Notification.idl56
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h90
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/NotificationCenter.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/NotificationContents.h60
-rw-r--r--src/3rdparty/webkit/WebCore/notifications/NotificationPresenter.h82
-rw-r--r--src/3rdparty/webkit/WebCore/page/AbstractView.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/page/BarInfo.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/page/Chrome.cpp495
-rw-r--r--src/3rdparty/webkit/WebCore/page/Chrome.h156
-rw-r--r--src/3rdparty/webkit/WebCore/page/ChromeClient.h257
-rw-r--r--src/3rdparty/webkit/WebCore/page/Console.cpp464
-rw-r--r--src/3rdparty/webkit/WebCore/page/Console.h130
-rw-r--r--src/3rdparty/webkit/WebCore/page/Console.idl65
-rw-r--r--src/3rdparty/webkit/WebCore/page/ContextMenuClient.h60
-rw-r--r--src/3rdparty/webkit/WebCore/page/ContextMenuController.cpp379
-rw-r--r--src/3rdparty/webkit/WebCore/page/ContextMenuController.h70
-rw-r--r--src/3rdparty/webkit/WebCore/page/Coordinates.h86
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMSelection.cpp474
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMSelection.h104
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMSelection.idl86
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMTimer.cpp204
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMTimer.h80
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.cpp1462
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.h410
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.idl726
-rw-r--r--src/3rdparty/webkit/WebCore/page/DragClient.h81
-rw-r--r--src/3rdparty/webkit/WebCore/page/DragController.cpp825
-rw-r--r--src/3rdparty/webkit/WebCore/page/DragController.h129
-rw-r--r--src/3rdparty/webkit/WebCore/page/EditorClient.h185
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.cpp2850
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.h437
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventSource.cpp319
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventSource.h134
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventSource.idl66
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusController.cpp642
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusController.h80
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusDirection.h41
-rw-r--r--src/3rdparty/webkit/WebCore/page/Frame.cpp1866
-rw-r--r--src/3rdparty/webkit/WebCore/page/Frame.h377
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameLoadRequest.h66
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameTree.cpp310
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameTree.h88
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.cpp2171
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.h368
-rw-r--r--src/3rdparty/webkit/WebCore/page/Geolocation.cpp661
-rw-r--r--src/3rdparty/webkit/WebCore/page/Geolocation.h183
-rw-r--r--src/3rdparty/webkit/WebCore/page/Geolocation.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/page/GeolocationController.cpp93
-rw-r--r--src/3rdparty/webkit/WebCore/page/GeolocationController.h67
-rw-r--r--src/3rdparty/webkit/WebCore/page/GeolocationControllerClient.h47
-rw-r--r--src/3rdparty/webkit/WebCore/page/GeolocationPositionCache.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/page/GeolocationPositionCache.h58
-rw-r--r--src/3rdparty/webkit/WebCore/page/Geoposition.h61
-rw-r--r--src/3rdparty/webkit/WebCore/page/History.cpp124
-rw-r--r--src/3rdparty/webkit/WebCore/page/History.h68
-rw-r--r--src/3rdparty/webkit/WebCore/page/History.idl50
-rw-r--r--src/3rdparty/webkit/WebCore/page/Location.cpp141
-rw-r--r--src/3rdparty/webkit/WebCore/page/Location.h71
-rw-r--r--src/3rdparty/webkit/WebCore/page/Location.idl67
-rw-r--r--src/3rdparty/webkit/WebCore/page/MouseEventWithHitTestResults.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/page/MouseEventWithHitTestResults.h50
-rw-r--r--src/3rdparty/webkit/WebCore/page/Navigator.cpp264
-rw-r--r--src/3rdparty/webkit/WebCore/page/Navigator.h78
-rw-r--r--src/3rdparty/webkit/WebCore/page/Navigator.idl57
-rw-r--r--src/3rdparty/webkit/WebCore/page/NavigatorBase.h54
-rw-r--r--src/3rdparty/webkit/WebCore/page/OriginAccessEntry.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/page/OriginAccessEntry.h61
-rw-r--r--src/3rdparty/webkit/WebCore/page/Page.cpp834
-rw-r--r--src/3rdparty/webkit/WebCore/page/Page.h317
-rw-r--r--src/3rdparty/webkit/WebCore/page/PageGroup.cpp350
-rw-r--r--src/3rdparty/webkit/WebCore/page/PageGroup.h111
-rw-r--r--src/3rdparty/webkit/WebCore/page/PageGroupLoadDeferrer.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/page/PageGroupLoadDeferrer.h41
-rw-r--r--src/3rdparty/webkit/WebCore/page/PluginHalter.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/page/PluginHalter.h60
-rw-r--r--src/3rdparty/webkit/WebCore/page/PluginHalterClient.h44
-rw-r--r--src/3rdparty/webkit/WebCore/page/PositionCallback.h43
-rw-r--r--src/3rdparty/webkit/WebCore/page/PositionErrorCallback.h43
-rw-r--r--src/3rdparty/webkit/WebCore/page/PrintContext.cpp204
-rw-r--r--src/3rdparty/webkit/WebCore/page/PrintContext.h67
-rw-r--r--src/3rdparty/webkit/WebCore/page/Screen.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/page/Screen.h64
-rw-r--r--src/3rdparty/webkit/WebCore/page/Screen.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/page/SecurityOrigin.cpp656
-rw-r--r--src/3rdparty/webkit/WebCore/page/SecurityOrigin.h218
-rw-r--r--src/3rdparty/webkit/WebCore/page/SecurityOriginHash.h81
-rw-r--r--src/3rdparty/webkit/WebCore/page/Settings.cpp592
-rw-r--r--src/3rdparty/webkit/WebCore/page/Settings.h386
-rw-r--r--src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp563
-rw-r--r--src/3rdparty/webkit/WebCore/page/SpatialNavigation.h140
-rw-r--r--src/3rdparty/webkit/WebCore/page/UserContentURLPattern.cpp226
-rw-r--r--src/3rdparty/webkit/WebCore/page/UserContentURLPattern.h72
-rw-r--r--src/3rdparty/webkit/WebCore/page/UserScript.h66
-rw-r--r--src/3rdparty/webkit/WebCore/page/UserStyleSheet.h62
-rw-r--r--src/3rdparty/webkit/WebCore/page/UserStyleSheetTypes.h42
-rw-r--r--src/3rdparty/webkit/WebCore/page/WebKitPoint.h63
-rw-r--r--src/3rdparty/webkit/WebCore/page/WebKitPoint.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/page/WindowFeatures.cpp188
-rw-r--r--src/3rdparty/webkit/WebCore/page/WindowFeatures.h83
-rw-r--r--src/3rdparty/webkit/WebCore/page/WorkerNavigator.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp396
-rw-r--r--src/3rdparty/webkit/WebCore/page/XSSAuditor.h165
-rw-r--r--src/3rdparty/webkit/WebCore/page/ZoomMode.h32
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp1291
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/AnimationBase.h232
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/AnimationController.cpp559
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/AnimationController.h80
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/AnimationControllerPrivate.h125
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.cpp547
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/CompositeAnimation.h108
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/ImplicitAnimation.cpp284
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/ImplicitAnimation.h96
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/KeyframeAnimation.cpp407
-rw-r--r--src/3rdparty/webkit/WebCore/page/animation/KeyframeAnimation.h100
-rw-r--r--src/3rdparty/webkit/WebCore/page/qt/DragControllerQt.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp142
-rw-r--r--src/3rdparty/webkit/WebCore/page/qt/FrameQt.cpp35
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/DragControllerWin.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/EventHandlerWin.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/FrameCGWin.cpp116
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/FrameCairoWin.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/FrameWin.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/page/win/FrameWin.h44
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Arena.cpp258
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Arena.h130
-rw-r--r--src/3rdparty/webkit/WebCore/platform/AutodrainedPool.h67
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ColorData.gperf151
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ContentType.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ContextMenu.cpp813
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ContextMenu.h90
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ContextMenuItem.h274
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Cookie.h82
-rw-r--r--src/3rdparty/webkit/WebCore/platform/CookieJar.h49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/CrossThreadCopier.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/platform/CrossThreadCopier.h122
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Cursor.h171
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DeprecatedPtrList.h114
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DeprecatedPtrListImpl.cpp515
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DeprecatedPtrListImpl.h122
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DragData.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DragData.h119
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DragImage.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/platform/DragImage.h103
-rw-r--r--src/3rdparty/webkit/WebCore/platform/EventLoop.h49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/FileChooser.cpp94
-rw-r--r--src/3rdparty/webkit/WebCore/platform/FileChooser.h88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/FileSystem.h170
-rw-r--r--src/3rdparty/webkit/WebCore/platform/FloatConversion.h60
-rw-r--r--src/3rdparty/webkit/WebCore/platform/GeolocationService.cpp76
-rw-r--r--src/3rdparty/webkit/WebCore/platform/GeolocationService.h77
-rw-r--r--src/3rdparty/webkit/WebCore/platform/HostWindow.h67
-rw-r--r--src/3rdparty/webkit/WebCore/platform/KURL.cpp1827
-rw-r--r--src/3rdparty/webkit/WebCore/platform/KURL.h384
-rw-r--r--src/3rdparty/webkit/WebCore/platform/KURLGoogle.cpp1165
-rw-r--r--src/3rdparty/webkit/WebCore/platform/KURLGooglePrivate.h115
-rw-r--r--src/3rdparty/webkit/WebCore/platform/KURLHash.h61
-rw-r--r--src/3rdparty/webkit/WebCore/platform/KeyboardCodes.h572
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Language.h37
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Length.cpp151
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Length.h198
-rw-r--r--src/3rdparty/webkit/WebCore/platform/LengthBox.h85
-rw-r--r--src/3rdparty/webkit/WebCore/platform/LinkHash.cpp221
-rw-r--r--src/3rdparty/webkit/WebCore/platform/LinkHash.h73
-rw-r--r--src/3rdparty/webkit/WebCore/platform/LocalizedStrings.h158
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Logging.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Logging.h66
-rw-r--r--src/3rdparty/webkit/WebCore/platform/MIMETypeRegistry.cpp456
-rw-r--r--src/3rdparty/webkit/WebCore/platform/MIMETypeRegistry.h85
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Pasteboard.h134
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PlatformKeyboardEvent.h225
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PlatformMenuDescription.h68
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PlatformMouseEvent.h186
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PlatformTouchEvent.h83
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PlatformTouchPoint.h68
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PlatformWheelEvent.h163
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PopupMenu.h198
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PopupMenuClient.h79
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PopupMenuStyle.h66
-rw-r--r--src/3rdparty/webkit/WebCore/platform/PurgeableBuffer.h76
-rw-r--r--src/3rdparty/webkit/WebCore/platform/RunLoopTimer.h79
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollTypes.h85
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollView.cpp1077
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollView.h356
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp503
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Scrollbar.h173
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollbarClient.h73
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollbarTheme.h97
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollbarThemeComposite.cpp305
-rw-r--r--src/3rdparty/webkit/WebCore/platform/SearchPopupMenu.h46
-rw-r--r--src/3rdparty/webkit/WebCore/platform/SecureTextInput.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/SecureTextInput.h50
-rw-r--r--src/3rdparty/webkit/WebCore/platform/SharedBuffer.cpp272
-rw-r--r--src/3rdparty/webkit/WebCore/platform/SharedBuffer.h138
-rw-r--r--src/3rdparty/webkit/WebCore/platform/SharedTimer.h75
-rw-r--r--src/3rdparty/webkit/WebCore/platform/StaticConstructors.h80
-rw-r--r--src/3rdparty/webkit/WebCore/platform/SuddenTermination.h44
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ThemeTypes.h79
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ThreadGlobalData.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ThreadGlobalData.h112
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ThreadTimers.h65
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Timer.h112
-rw-r--r--src/3rdparty/webkit/WebCore/platform/TreeShared.h117
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Widget.cpp177
-rw-r--r--src/3rdparty/webkit/WebCore/platform/Widget.h234
-rw-r--r--src/3rdparty/webkit/WebCore/platform/animation/Animation.cpp133
-rw-r--r--src/3rdparty/webkit/WebCore/platform/animation/Animation.h163
-rw-r--r--src/3rdparty/webkit/WebCore/platform/animation/AnimationList.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/platform/animation/AnimationList.h60
-rw-r--r--src/3rdparty/webkit/WebCore/platform/animation/TimingFunction.h84
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cf/BinaryPropertyList.cpp832
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cf/BinaryPropertyList.h110
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cf/FileSystemCF.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cf/KURLCFNet.cpp95
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cf/RunLoopTimerCF.cpp84
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cf/SchedulePair.h88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cf/SharedBufferCF.cpp94
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cocoa/KeyEventCocoa.h40
-rw-r--r--src/3rdparty/webkit/WebCore/platform/cocoa/KeyEventCocoa.mm700
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp428
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h284
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Color.cpp389
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Color.h166
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/ColorSpace.h35
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/DashArray.h39
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.cpp59
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint.h160
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint3D.cpp63
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatPoint3D.h64
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatQuad.h152
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.cpp134
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatRect.h204
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FloatSize.h139
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Font.cpp362
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Font.h227
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontCache.cpp473
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontCache.h116
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontData.h65
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontDescription.h154
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontFallbackList.cpp139
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontFallbackList.h91
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontFamily.h88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontFastPath.cpp321
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/FontSelector.h47
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GeneratedImage.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GlyphBuffer.h201
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GlyphMetricsMap.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GlyphMetricsMap.h104
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.cpp422
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GlyphPageTreeNode.h239
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Gradient.cpp205
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Gradient.h153
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.cpp544
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext.h427
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.cpp153
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.h734
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContextPrivate.h101
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp492
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h412
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsTypes.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsTypes.h88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Icon.h85
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Image.cpp179
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Image.h183
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/ImageBuffer.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/ImageBuffer.h112
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h165
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntPoint.h215
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntPointHash.h48
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntRect.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h215
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntSize.h185
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/IntSizeHash.h46
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.cpp629
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayer.h280
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/MediaPlayerPrivate.h128
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Path.cpp278
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Path.h161
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/PathTraversalState.cpp207
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/PathTraversalState.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Pattern.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Pattern.h105
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Pen.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Pen.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.cpp209
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/SimpleFontData.h256
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/StringTruncator.cpp198
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/StringTruncator.h46
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/TextRun.h126
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/Tile.h78
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/TiledBackingStore.cpp403
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/TiledBackingStore.h127
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/TiledBackingStoreClient.h41
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/WidthIterator.cpp268
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/WidthIterator.h70
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEBlend.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEBlend.h67
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEColorMatrix.cpp200
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEColorMatrix.h67
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComponentTransfer.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComponentTransfer.h100
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComposite.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComposite.h84
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.cpp144
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.h57
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/Filter.h65
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FilterEffect.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/FilterEffect.h117
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/ImageBufferFilter.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/ImageBufferFilter.h57
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/SourceAlpha.cpp79
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/SourceAlpha.h49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/SourceGraphic.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/filters/SourceGraphic.h50
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.cpp243
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h54
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp35
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h33
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/ImageGStreamer.h62
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp1404
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h177
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp372
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h79
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp757
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.h52
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp68
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeUtilities.cpp447
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp577
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/openvg/PainterOpenVG.cpp1178
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/openvg/PainterOpenVG.h141
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/openvg/PathOpenVG.cpp502
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/openvg/SurfaceOpenVG.h157
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/openvg/VGUtils.cpp123
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/openvg/VGUtils.h90
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FloatRectQt.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCustomPlatformData.h46
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h167
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp128
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp337
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GlyphPageTreeNodeQt.cpp36
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp1619
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp1341
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp1492
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.h88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferData.h48
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp297
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp251
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h80
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp226
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp542
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.h153
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp571
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h133
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp424
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/StillImageQt.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/StillImageQt.h59
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/TileQt.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/AffineTransform.cpp378
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/AffineTransform.h187
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/MatrixTransformOperation.h99
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h71
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/RotateTransformOperation.h87
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/SkewTransformOperation.h74
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/TransformOperations.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/TransformationMatrix.cpp1116
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/TransformationMatrix.h356
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/transforms/TranslateTransformOperation.h88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontCGWin.cpp386
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontCacheWin.cpp557
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformData.cpp203
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformData.h54
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp61
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp131
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp143
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataWin.cpp95
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/FontWin.cpp113
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp253
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp147
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextWin.cpp211
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp836
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsLayerCACF.h142
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/IconWin.cpp101
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/ImageCGWin.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/ImageCairoWin.cpp114
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/IntRectWin.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp972
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h191
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWin.cpp1178
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWin.h127
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWinTimer.h39
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/RefCountedHFONT.h56
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp156
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp122
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataWin.cpp222
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/UniscribeController.cpp455
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/UniscribeController.h93
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp88
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFContextFlusher.h60
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayer.cpp557
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayer.h264
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp597
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayerRenderer.h115
-rw-r--r--src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.cpp262
-rw-r--r--src/3rdparty/webkit/WebCore/platform/image-decoders/ImageDecoder.h357
-rw-r--r--src/3rdparty/webkit/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.h93
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ClipboardMac.mm423
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ContextMenuItemMac.mm159
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ContextMenuMac.mm158
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/CookieJar.mm180
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/CursorMac.mm356
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/DragDataMac.mm133
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/DragImageMac.mm104
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/EventLoopMac.mm39
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/FileChooserMac.mm55
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/FileSystemMac.mm40
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/FoundationExtras.h75
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/GeolocationServiceMac.h77
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/GeolocationServiceMac.mm221
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/KURLMac.mm71
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/KeyEventMac.mm250
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/Language.mm43
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/LocalCurrentGraphicsContext.h44
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/LocalizedStringsMac.mm830
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/LoggingMac.mm74
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/MIMETypeRegistryMac.mm64
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/PasteboardHelper.h60
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/PasteboardMac.mm397
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/PlatformScreenMac.mm104
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/PopupMenuMac.mm221
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/PurgeableBufferMac.cpp165
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.h38
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/RuntimeApplicationChecks.mm56
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/SSLKeyGeneratorMac.mm49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ScrollViewMac.mm205
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ScrollbarThemeMac.mm406
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/SearchPopupMenuMac.mm74
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/SharedBufferMac.mm124
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/SharedTimerMac.mm119
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/SoftLinking.h119
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/SuddenTermination.mm45
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.h56
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ThemeMac.mm596
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/ThreadCheck.mm118
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreKeyGenerator.h32
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreKeyGenerator.m63
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreNSStringExtras.h51
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreObjCExtras.mm87
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.h182
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebCoreSystemInterface.mm115
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WebFontCache.mm315
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WheelEventMac.mm54
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mac/WidgetMac.mm365
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mock/GeolocationServiceMock.cpp140
-rw-r--r--src/3rdparty/webkit/WebCore/platform/mock/GeolocationServiceMock.h80
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/Credential.cpp162
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/Credential.h90
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/CredentialStorage.cpp158
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/CredentialStorage.h52
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/DNS.h38
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/FormData.cpp303
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/FormData.h140
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.cpp255
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.h77
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/HTTPHeaderMap.cpp98
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/HTTPHeaderMap.h68
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/HTTPParsers.cpp298
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/HTTPParsers.h61
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/NetworkStateNotifier.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/NetworkStateNotifier.h127
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ProtectionSpace.h86
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ProtectionSpaceHash.h75
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceErrorBase.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceErrorBase.h91
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceHandle.cpp148
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceHandle.h216
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceHandleClient.h94
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceHandleInternal.h229
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.cpp403
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h204
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.cpp578
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/ResourceResponseBase.h168
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/SocketStreamErrorBase.cpp48
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/SocketStreamErrorBase.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/AuthenticationChallenge.h46
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.h86
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h61
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp539
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.h117
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp221
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h73
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/ResourceResponse.h47
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandle.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandlePrivate.h72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleQt.cpp208
-rw-r--r--src/3rdparty/webkit/WebCore/platform/posix/FileSystemPOSIX.cpp166
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.cpp314
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ClipboardQt.h89
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ContextMenuItemQt.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ContextMenuQt.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/CookieJarQt.cpp142
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp372
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp143
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/DragImageQt.cpp63
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/FileChooserQt.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp171
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp533
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/LoggingQt.cpp56
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/MIMETypeRegistryQt.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/Maemo5Webstyle.cpp268
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/Maemo5Webstyle.h47
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PasteboardQt.cpp185
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PlatformKeyboardEventQt.cpp565
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PlatformMouseEventQt.cpp131
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PlatformScreenQt.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PlatformTouchEventQt.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h108
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/QtAbstractWebPopup.cpp82
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/QtAbstractWebPopup.h75
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/QtStyleOptionWebComboBox.h59
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp1254
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h218
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ScreenQt.cpp99
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ScrollbarQt.cpp98
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp251
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/SearchPopupMenuQt.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/SharedBufferQt.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/SharedTimerQt.cpp148
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/SoundQt.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubsQt.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/WidgetQt.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteAuthorizer.cpp39
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.cpp382
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteDatabase.h143
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.cpp123
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.h114
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteStatement.cpp453
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteStatement.h102
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.cpp103
-rw-r--r--src/3rdparty/webkit/WebCore/platform/sql/SQLiteTransaction.h56
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/AtomicString.cpp330
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/AtomicString.h176
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/AtomicStringHash.h64
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/AtomicStringImpl.h36
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/Base64.cpp185
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/Base64.h42
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/BidiContext.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/BidiContext.h62
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/BidiResolver.h982
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/CString.cpp102
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/CString.h79
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/CharacterNames.h70
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/PlatformString.h422
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/RegularExpression.cpp168
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/RegularExpression.h55
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/SegmentedString.cpp202
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/SegmentedString.h176
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/String.cpp966
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/StringBuffer.h77
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/StringBuilder.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/StringBuilder.h60
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/StringHash.h266
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/StringImpl.cpp988
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/StringImpl.h329
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextBoundaries.cpp79
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextBoundaries.h43
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextBreakIterator.h62
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextBreakIteratorICU.cpp242
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextCodec.h85
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextCodecICU.cpp473
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextCodecICU.h81
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextCodecLatin1.cpp249
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextCodecUTF16.cpp139
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextCodecUserDefined.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextEncoding.cpp292
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextEncoding.h99
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextEncodingDetectorICU.cpp129
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextEncodingRegistry.cpp319
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextEncodingRegistry.h51
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextStream.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextStream.h61
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/cf/StringCF.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/cf/StringImplCF.cpp162
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/mac/StringImplMac.mm33
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/mac/StringMac.mm42
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/mac/TextBoundaries.mm56
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm110
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/mac/TextCodecMac.cpp329
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/qt/StringQt.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/qt/TextBreakIteratorQt.cpp139
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/qt/TextCodecQt.cpp140
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/wince/TextBoundariesWince.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/wince/TextBreakIteratorWince.cpp312
-rw-r--r--src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.h43
-rw-r--r--src/3rdparty/webkit/WebCore/platform/win/SystemTimeWin.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/win/WebCoreInstanceHandle.h41
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/MimeType.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/MimeType.h52
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/MimeType.idl30
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/MimeTypeArray.cpp95
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/MimeTypeArray.h56
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/MimeTypeArray.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/Plugin.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/Plugin.h57
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/Plugin.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginArray.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginArray.h58
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginArray.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginData.cpp63
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginData.h74
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginDataNone.cpp40
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginDatabase.cpp434
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginDatabase.h107
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginDatabaseClient.h42
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginDebug.cpp168
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginDebug.h54
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginInfoStore.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginInfoStore.h48
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginMainThreadScheduler.h86
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp342
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginPackage.h137
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginPackageNone.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginQuirkSet.h63
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginStream.cpp478
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginStream.h123
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginView.cpp1397
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginView.h400
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginViewNone.cpp139
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/PluginWidget.h55
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/mac/PluginDataMac.mm76
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/mac/PluginPackageMac.cpp307
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.mm836
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/mac/PluginWidgetMac.mm49
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/npapi.cpp177
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/npfunctions.h213
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/qt/PluginContainerQt.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/qt/PluginContainerQt.h63
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/qt/PluginDataQt.cpp105
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp173
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp909
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/symbian/PluginPackageSymbian.cpp182
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp434
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/symbian/npinterface.h37
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginDataWin.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginDatabaseWin.cpp400
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginMessageThrottlerWin.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginMessageThrottlerWin.h72
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp342
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp1081
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/AutoTableLayout.cpp787
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/AutoTableLayout.h85
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/BidiRun.h65
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/CounterNode.cpp267
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/CounterNode.h98
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/EllipsisBox.cpp124
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/EllipsisBox.h60
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/FixedTableLayout.cpp334
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/FixedTableLayout.h47
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/HitTestRequest.h54
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/HitTestResult.cpp365
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/HitTestResult.h94
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineBox.cpp292
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineBox.h316
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.cpp1123
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineFlowBox.h236
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineIterator.h266
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineTextBox.cpp1076
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/InlineTextBox.h167
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/LayoutState.cpp122
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/LayoutState.h80
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp747
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h288
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/PointerEventsHitRules.cpp108
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/PointerEventsHitRules.h48
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderApplet.cpp90
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderApplet.h60
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderArena.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderArena.h65
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBR.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBR.h67
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp5187
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlock.h549
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlockLineLayout.cpp1970
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBox.cpp2914
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBox.h422
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBoxModelObject.cpp1482
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBoxModelObject.h138
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderButton.cpp198
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderButton.h94
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderCounter.cpp484
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderCounter.h69
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.cpp250
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderDataGrid.h86
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderEmbeddedObject.cpp427
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderEmbeddedObject.h69
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFieldset.cpp277
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFieldset.h66
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp322
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h93
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFlexibleBox.cpp1084
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFlexibleBox.h66
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderForeignObject.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderForeignObject.h73
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFrame.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFrame.h57
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.cpp787
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderFrameSet.h141
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderHTMLCanvas.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderHTMLCanvas.h61
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderImage.cpp661
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderImage.h127
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderImageGeneratedContent.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderImageGeneratedContent.h64
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp1132
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderInline.h176
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp3555
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayer.h675
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.cpp1248
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerBacking.h189
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.cpp1166
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayerCompositor.h203
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLineBoxList.cpp334
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLineBoxList.h86
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListBox.cpp727
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListBox.h143
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListItem.cpp367
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListItem.h93
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListMarker.cpp1522
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderListMarker.h100
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMarquee.cpp316
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMarquee.h98
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp619
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMedia.h165
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMediaControls.cpp160
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMediaControls.h43
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.cpp306
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.h46
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMenuList.cpp552
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderMenuList.h146
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderObject.cpp2595
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderObject.h1070
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderObjectChildList.cpp432
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderObjectChildList.h68
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderOverflow.h153
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPart.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPart.h65
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPartObject.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPartObject.h59
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPath.cpp328
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderPath.h100
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderProgress.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderProgress.h62
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderReplaced.cpp362
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderReplaced.h81
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderReplica.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderReplica.h57
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRuby.cpp197
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRuby.h91
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRubyBase.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRubyBase.h67
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRubyRun.cpp228
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRubyRun.h85
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRubyText.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderRubyText.h56
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGBlock.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGBlock.h45
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGContainer.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGContainer.h101
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGGradientStop.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGGradientStop.h59
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGHiddenContainer.cpp82
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGHiddenContainer.h62
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGImage.cpp211
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGImage.h85
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGInline.h63
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGInlineText.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGInlineText.h67
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGModelObject.cpp99
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGModelObject.h75
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGResource.h85
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceClipper.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceClipper.h61
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceMasker.cpp196
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceMasker.h79
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGRoot.cpp327
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGRoot.h112
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGShadowTreeRootContainer.cpp101
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGShadowTreeRootContainer.h50
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGTSpan.cpp38
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGTSpan.h38
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGText.cpp245
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGText.h86
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGTextPath.cpp83
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGTextPath.h64
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGTransformableContainer.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGTransformableContainer.h46
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGViewportContainer.cpp128
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSVGViewportContainer.h72
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.cpp336
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderScrollbar.h94
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderScrollbarPart.cpp179
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderScrollbarPart.h68
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderScrollbarTheme.cpp140
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSelectionInfo.h104
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSlider.cpp426
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderSlider.h83
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTable.cpp1157
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTable.h216
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableCell.cpp898
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableCell.h154
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableCol.cpp107
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableCol.h86
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableRow.cpp206
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableRow.h87
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableSection.cpp1172
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTableSection.h172
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderText.cpp1422
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderText.h200
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControl.cpp600
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControl.h136
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControlMultiLine.cpp147
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControlMultiLine.h66
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControlSingleLine.cpp863
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextControlSingleLine.h150
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTextFragment.h64
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTheme.cpp988
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTheme.h311
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumLinux.cpp179
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumLinux.h95
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.h198
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumMac.mm1623
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.cpp771
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumSkia.h156
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp656
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.h107
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeMac.h200
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.cpp1215
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeSafari.h186
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeWin.cpp1017
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeWin.h169
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeWince.cpp668
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderThemeWince.h147
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.cpp657
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.h55
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderVideo.cpp282
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderVideo.h91
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderView.cpp713
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderView.h284
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp378
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderWidget.h99
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderWidgetProtector.h53
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderWordBreak.h46
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RootInlineBox.cpp433
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RootInlineBox.h165
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.cpp535
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGCharacterLayoutInfo.h385
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGInlineFlowBox.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGInlineFlowBox.h55
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGInlineTextBox.cpp594
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGInlineTextBox.h96
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGMarkerData.h134
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGMarkerLayoutInfo.cpp124
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGMarkerLayoutInfo.h74
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGRenderSupport.cpp333
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGRenderSupport.h94
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGRenderTreeAsText.cpp630
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGRenderTreeAsText.h116
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGRootInlineBox.cpp1811
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGRootInlineBox.h109
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGShadowTreeElements.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/SVGShadowTreeElements.h67
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TableLayout.h48
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.cpp214
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TextControlInnerElements.h73
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TrailingFloatsRootInlineBox.h48
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TransformState.cpp175
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/TransformState.h135
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/break_lines.cpp142
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/break_lines.h39
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/BindingURI.cpp71
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/BindingURI.h59
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/BorderData.h109
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/BorderValue.h75
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/CollapsedBorderValue.h66
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/ContentData.cpp96
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/ContentData.h106
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/CounterContent.h62
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/CounterDirectives.h54
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/CursorData.h56
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/CursorList.h59
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/FillLayer.cpp284
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/FillLayer.h199
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/KeyframeList.cpp88
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/KeyframeList.h90
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/NinePieceImage.h70
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/OutlineValue.h56
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.cpp970
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/RenderStyle.h1207
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/RenderStyleConstants.h408
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.h217
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.cpp235
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h314
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/ShadowData.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/ShadowData.h80
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleBackgroundData.h59
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleBoxData.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleBoxData.h67
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleCachedImage.cpp92
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleCachedImage.h67
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleGeneratedImage.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleGeneratedImage.h69
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleImage.h81
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleInheritedData.cpp88
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleInheritedData.h79
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleMultiColData.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleMultiColData.h75
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleRareInheritedData.cpp99
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleRareInheritedData.h77
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleRareNonInheritedData.cpp209
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleRareNonInheritedData.h132
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleVisualData.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/style/StyleVisualData.h67
-rw-r--r--src/3rdparty/webkit/WebCore/storage/ChangeVersionWrapper.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/storage/ChangeVersionWrapper.h59
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Database.cpp814
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Database.h195
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Database.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseAuthorizer.cpp393
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseAuthorizer.h112
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseCallback.h53
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseDetails.h82
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseTask.cpp184
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseTask.h170
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp175
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseThread.h95
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp1051
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseTracker.h181
-rw-r--r--src/3rdparty/webkit/WebCore/storage/DatabaseTrackerClient.h49
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBDatabaseError.h64
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBDatabaseError.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBDatabaseException.h64
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBDatabaseException.idl48
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBDatabaseRequest.h50
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBDatabaseRequest.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBRequest.cpp64
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBRequest.h88
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IDBRequest.idl45
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IndexedDatabase.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IndexedDatabase.h56
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IndexedDatabaseImpl.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IndexedDatabaseImpl.h56
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.h65
-rw-r--r--src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/storage/LocalStorageTask.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/storage/LocalStorageTask.h65
-rw-r--r--src/3rdparty/webkit/WebCore/storage/LocalStorageThread.cpp104
-rw-r--r--src/3rdparty/webkit/WebCore/storage/LocalStorageThread.h70
-rw-r--r--src/3rdparty/webkit/WebCore/storage/OriginQuotaManager.cpp137
-rw-r--r--src/3rdparty/webkit/WebCore/storage/OriginQuotaManager.h75
-rw-r--r--src/3rdparty/webkit/WebCore/storage/OriginUsageRecord.cpp104
-rw-r--r--src/3rdparty/webkit/WebCore/storage/OriginUsageRecord.h71
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLError.h56
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLError.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLResultSet.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLResultSet.h67
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLResultSet.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLResultSetRowList.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLStatement.cpp205
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLStatement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLStatementCallback.h50
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLStatementErrorCallback.h51
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp590
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransaction.h142
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransaction.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransactionCallback.h51
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransactionClient.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransactionClient.h54
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.cpp132
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransactionCoordinator.h69
-rw-r--r--src/3rdparty/webkit/WebCore/storage/SQLTransactionErrorCallback.h50
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Storage.cpp113
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Storage.h70
-rw-r--r--src/3rdparty/webkit/WebCore/storage/Storage.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.cpp236
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.h84
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageAreaSync.cpp373
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageAreaSync.h99
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageEvent.cpp75
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageEvent.h71
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageEvent.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageEventDispatcher.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageMap.cpp187
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageMap.h77
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespace.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespace.h59
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.cpp147
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.h74
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageSyncManager.cpp105
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageSyncManager.h71
-rw-r--r--src/3rdparty/webkit/WebCore/svg/ColorDistance.cpp94
-rw-r--r--src/3rdparty/webkit/WebCore/svg/ColorDistance.h53
-rw-r--r--src/3rdparty/webkit/WebCore/svg/ElementTimeControl.h49
-rw-r--r--src/3rdparty/webkit/WebCore/svg/ElementTimeControl.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/GradientAttributes.h71
-rw-r--r--src/3rdparty/webkit/WebCore/svg/LinearGradientAttributes.h75
-rw-r--r--src/3rdparty/webkit/WebCore/svg/PatternAttributes.h100
-rw-r--r--src/3rdparty/webkit/WebCore/svg/RadialGradientAttributes.h82
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp226
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAElement.h75
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAElement.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp158
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.cpp97
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.h60
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAltGlyphElement.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAngle.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAngle.h69
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAngle.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateColorElement.cpp37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateColorElement.h41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateColorElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateElement.cpp287
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateElement.h71
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateMotionElement.cpp247
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateMotionElement.h78
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateTransformElement.cpp208
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateTransformElement.h67
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimateTransformElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedAngle.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedBoolean.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedEnumeration.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedInteger.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedLength.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedLengthList.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedNumber.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedNumberList.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.cpp40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.h46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPathData.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.cpp40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.h44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPoints.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPreserveAspectRatio.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedProperty.h217
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h98
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertyTraits.h186
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedRect.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedString.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedTemplate.h175
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedTransformList.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.cpp548
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.h125
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimationElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGCircleElement.cpp120
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h63
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGCircleElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.cpp109
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.h59
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGClipPathElement.idl39
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGColor.cpp118
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGColor.h95
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGColor.idl46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGComponentTransferFunctionElement.cpp129
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGComponentTransferFunctionElement.h55
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGComponentTransferFunctionElement.idl46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGCursorElement.cpp128
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h68
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGCursorElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDefsElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDescElement.cpp46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDescElement.h44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDescElement.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDocument.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDocument.h68
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDocument.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDocumentExtensions.cpp149
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGDocumentExtensions.h79
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElement.cpp346
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElement.h114
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElement.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstance.cpp160
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstance.h166
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstance.idl103
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstanceList.cpp60
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstanceList.h48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementInstanceList.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGElementRareData.h78
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.cpp130
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.h64
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGEllipseElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGException.h58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGException.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.h52
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGExternalResourcesRequired.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.h49
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEBlendElement.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.cpp134
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.h49
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEColorMatrixElement.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.cpp97
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEComponentTransferElement.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.cpp122
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.h52
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFECompositeElement.idl48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.cpp129
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.h59
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDiffuseLightingElement.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.h51
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDisplacementMapElement.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.cpp44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.h38
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEDistantLightElement.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.cpp59
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFloodElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.h37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncAElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.h37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncBElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.h37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncGElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.h37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEFuncRElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.cpp98
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEGaussianBlurElement.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.cpp146
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.h70
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEImageElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFELightElement.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFELightElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.h41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMergeElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMergeNodeElement.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMergeNodeElement.h45
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMergeNodeElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.cpp88
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEOffsetElement.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.cpp47
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.h38
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFEPointLightElement.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.cpp132
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpecularLightingElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.h38
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFESpotLightElement.idl39
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFETileElement.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFETileElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFETileElement.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFETurbulenceElement.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFETurbulenceElement.h60
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFETurbulenceElement.idl48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFilterElement.cpp227
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h83
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFilterElement.idl47
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp127
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFilterPrimitiveStandardAttributes.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h50
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFont.cpp594
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontData.cpp45
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontData.h65
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp251
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontElement.h67
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceElement.cpp351
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceElement.h73
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceFormatElement.cpp55
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceFormatElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceFormatElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceNameElement.cpp43
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceNameElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceNameElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceSrcElement.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceSrcElement.h42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceSrcElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceUriElement.cpp105
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceUriElement.h55
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGFontFaceUriElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.cpp138
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.h66
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGForeignObjectElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGElement.h58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGlyphElement.cpp179
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGlyphElement.h131
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGlyphElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGlyphMap.h109
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGradientElement.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGradientElement.h76
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGGradientElement.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGHKernElement.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGHKernElement.h66
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGHKernElement.idl25
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGImageElement.cpp190
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGImageElement.h83
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGImageElement.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGImageLoader.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGImageLoader.h44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLangSpace.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLangSpace.h54
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLangSpace.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLength.cpp324
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLength.h103
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLength.idl50
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLengthList.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLengthList.h46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLengthList.idl48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLineElement.h68
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLineElement.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLinearGradientElement.cpp207
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLinearGradientElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLinearGradientElement.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGList.h280
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGListTraits.h73
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLocatable.cpp139
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLocatable.h62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGLocatable.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMPathElement.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h54
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.cpp231
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h95
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.idl55
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp168
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h71
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMaskElement.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMatrix.idl50
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.cpp36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.h39
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMetadataElement.idl27
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMissingGlyphElement.cpp34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMissingGlyphElement.h39
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGMissingGlyphElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGNumber.idl30
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGNumberList.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGNumberList.h48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGNumberList.idl48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPaint.cpp115
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPaint.h100
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPaint.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGParserUtilities.cpp862
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGParserUtilities.h71
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp256
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathElement.h113
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathElement.idl113
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSeg.h93
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl56
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegArc.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegArc.h102
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegArcAbs.idl46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegArcRel.idl46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.h47
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegClosePath.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubic.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubic.h96
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubicAbs.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubicRel.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubicSmooth.h83
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadratic.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadratic.h83
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadraticAbs.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadraticRel.idl40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLineto.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLineto.h57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoAbs.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoHorizontal.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoHorizontal.h70
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoHorizontalAbs.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoHorizontalRel.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoRel.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoVertical.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoVertical.h70
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoVerticalAbs.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegLinetoVerticalRel.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegList.cpp269
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegList.h51
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegList.idl48
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegMoveto.cpp41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegMoveto.h56
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegMovetoAbs.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPathSegMovetoRel.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPatternElement.cpp355
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPatternElement.h92
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPatternElement.idl45
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPoint.idl34
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPointList.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPointList.h47
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPointList.idl47
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp122
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h64
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolygonElement.cpp59
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolygonElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolygonElement.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolylineElement.cpp58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolylineElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPolylineElement.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPreserveAspectRatio.cpp332
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPreserveAspectRatio.h95
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGPreserveAspectRatio.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRadialGradientElement.cpp248
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRadialGradientElement.h58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRadialGradientElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRect.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp156
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRectElement.h66
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRectElement.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRenderingIntent.h49
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGRenderingIntent.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp599
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h165
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSVGElement.idl85
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGScriptElement.cpp237
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h89
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGScriptElement.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSetElement.cpp35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSetElement.h39
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSetElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStopElement.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStopElement.h50
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStopElement.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStringList.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStringList.h45
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStringList.idl47
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStylable.cpp38
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStylable.h46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStylable.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyleElement.cpp134
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyleElement.h67
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyleElement.idl39
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp333
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyledElement.h83
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyledLocatableElement.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyledLocatableElement.h51
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyledTransformableElement.cpp126
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGStyledTransformableElement.h71
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.cpp70
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h54
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h56
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp98
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTRefElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTSpanElement.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTSpanElement.h41
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTSpanElement.idl31
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTests.cpp121
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTests.h59
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTests.idl37
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.cpp548
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.h77
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextContentElement.idl60
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextElement.cpp144
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextElement.h64
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextElement.idl32
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.cpp125
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.h78
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPathElement.idl45
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPositioningElement.cpp112
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPositioningElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTextPositioningElement.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTitleElement.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTitleElement.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransform.cpp153
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransform.h91
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransform.idl46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformDistance.cpp280
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformDistance.h58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformList.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformList.h53
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformList.idl50
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformable.cpp236
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformable.h61
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGTransformable.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGURIReference.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGURIReference.h49
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGURIReference.idl33
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGUnitTypes.h46
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGUnitTypes.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp973
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGUseElement.h121
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGUseElement.idl44
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGViewElement.h62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGViewElement.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp172
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h71
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGViewSpec.idl38
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.h58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.idl39
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGZoomEvent.cpp82
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGZoomEvent.h68
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGZoomEvent.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SMILTime.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SMILTime.h72
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SMILTimeContainer.cpp318
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SMILTimeContainer.h101
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.cpp963
-rw-r--r--src/3rdparty/webkit/WebCore/svg/animation/SVGSMILElement.h197
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp278
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.h81
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServer.cpp239
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServer.h96
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerGradient.cpp276
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerGradient.h98
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerLinearGradient.h62
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerPattern.cpp183
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerPattern.h85
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerRadialGradient.h66
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerSolid.cpp93
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGPaintServerSolid.h60
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGResource.cpp139
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGResource.h96
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.cpp228
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceFilter.h110
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceMarker.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceMarker.h79
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGDistantLightSource.h59
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp178
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h96
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp136
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h80
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp167
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h74
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.cpp91
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEFlood.h57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEImage.cpp79
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEImage.h51
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMerge.cpp109
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMerge.h54
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.cpp185
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEMorphology.h67
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEOffset.cpp111
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEOffset.h58
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp148
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFESpecularLighting.h83
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFETile.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFETile.h50
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFETurbulence.cpp146
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFETurbulence.h80
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilter.h60
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp79
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFilterBuilder.h56
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGLightSource.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGLightSource.h59
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGPointLightSource.h57
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGSpotLightSource.h70
-rw-r--r--src/3rdparty/webkit/WebCore/svg/svgattrs.in252
-rw-r--r--src/3rdparty/webkit/WebCore/svg/svgtags.in110
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannel.h69
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h127
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp283
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocket.h119
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocket.idl69
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.cpp286
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.h92
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocketHandshake.cpp504
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocketHandshake.h115
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocketHandshakeRequest.cpp95
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WebSocketHandshakeRequest.h73
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp362
-rw-r--r--src/3rdparty/webkit/WebCore/websockets/WorkerThreadableWebSocketChannel.h155
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp171
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAElement.h54
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAccessElement.cpp72
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAccessElement.h44
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAnchorElement.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAnchorElement.h49
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAttributeNames.in24
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLBRElement.cpp77
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLBRElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp347
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLCardElement.h76
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLDoElement.cpp189
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLDoElement.h66
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp128
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLDocument.h59
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLElement.cpp127
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLElement.h56
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLErrorHandling.cpp106
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLErrorHandling.h51
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.cpp97
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLFieldSetElement.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLFieldSetElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.h54
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLGoElement.cpp222
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLGoElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLImageElement.cpp148
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLImageElement.h58
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLImageLoader.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLImageLoader.h45
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInputElement.cpp513
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInputElement.h110
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.cpp39
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.h38
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLIntrinsicEvent.cpp53
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLIntrinsicEvent.h59
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLIntrinsicEventHandler.cpp61
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLIntrinsicEventHandler.h59
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLMetaElement.cpp65
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLMetaElement.h45
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLNoopElement.cpp66
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLNoopElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOnEventElement.cpp99
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOnEventElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.cpp170
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.h66
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptionElement.cpp175
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptionElement.h69
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPElement.cpp113
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPElement.h48
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp269
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPageState.h79
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp83
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.h46
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPrevElement.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPrevElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLRefreshElement.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLRefreshElement.h40
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp550
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h116
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp89
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.h45
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTableElement.cpp270
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTableElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTagNames.in35
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTaskElement.cpp119
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTaskElement.h58
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.cpp115
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.h43
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTimerElement.cpp156
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTimerElement.h57
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLVariables.cpp286
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLVariables.h46
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp104
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.h83
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl51
-rw-r--r--src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.cpp87
-rw-r--r--src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.h74
-rw-r--r--src/3rdparty/webkit/WebCore/workers/DedicatedWorkerContext.idl54
-rw-r--r--src/3rdparty/webkit/WebCore/workers/DefaultSharedWorkerRepository.cpp417
-rw-r--r--src/3rdparty/webkit/WebCore/workers/DefaultSharedWorkerRepository.h90
-rw-r--r--src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h481
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.h64
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.idl43
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorkerContext.cpp69
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorkerRepository.h70
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.cpp135
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.h90
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.idl50
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp291
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.h164
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.idl95
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h67
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h64
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerLocation.cpp85
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerLocation.h73
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerLocation.idl47
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp382
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h110
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerReportingProxy.h61
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp210
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.h96
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerScriptLoader.cpp168
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerScriptLoader.h84
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerScriptLoaderClient.h49
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerThread.cpp233
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerThread.h106
-rw-r--r--src/3rdparty/webkit/WebCore/xml/DOMParser.cpp42
-rw-r--r--src/3rdparty/webkit/WebCore/xml/DOMParser.h41
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp1003
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h199
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl104
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestException.idl49
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h61
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.idl36
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp154
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEventThrottle.h81
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp62
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h82
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl55
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathEvaluator.h62
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathEvaluator.idl35
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathException.idl49
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathExpression.h66
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathExpressionNode.h103
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp733
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathNSResolver.h51
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathNamespace.cpp81
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathNamespace.h63
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathNodeSet.cpp206
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathNodeSet.h84
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathParser.cpp636
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathParser.h131
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathPredicate.h127
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathResult.cpp219
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathResult.h90
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathStep.cpp398
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathStep.h107
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathUtil.cpp100
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathUtil.h56
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathValue.cpp150
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathValue.h115
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLImportRule.cpp117
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLImportRule.h72
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLStyleSheet.h116
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLStyleSheetLibxslt.cpp313
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLStyleSheetQt.cpp103
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp174
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLTProcessor.h85
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLTProcessor.idl53
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLTProcessorLibxslt.cpp335
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLTProcessorQt.cpp180
-rw-r--r--src/3rdparty/webkit/WebKit.pri83
-rw-r--r--src/3rdparty/webkit/WebKit.pro36
-rw-r--r--src/3rdparty/webkit/WebKit/ChangeLog2212
-rw-r--r--src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig58
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro107
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/headers.pri14
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp1445
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h157
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase_p.h37
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp2025
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h267
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp1931
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h234
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h128
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp557
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h115
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h69
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp127
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp204
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebinspector_p.h46
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h49
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp114
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp3956
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h380
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h198
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp389
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp276
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h69
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp1069
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h159
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp1218
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.h163
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog22273
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp614
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h187
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp87
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h53
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp116
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.h46
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditCommandQt.cpp57
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditCommandQt.h50
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp643
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.h122
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp1410
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h231
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp263
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.h94
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp250
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h76
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp220
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h89
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebKit_pch.h80
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro73
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/plugin.cpp43
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp1073
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h373
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc427
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc191
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf197
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_bridge_snippets.cpp174
-rw-r--r--src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def653
-rw-r--r--src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def772
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.h70
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp230
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp1017
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe.html54
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe2.html21
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp3035
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp374
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp94
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/index.html4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp2159
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc10
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp326
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/tests.pri23
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/tests.pro4
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/ChangeLog3465
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/WebCoreSQLite3/sqlite3.h5488
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/WebCoreSQLite3/sqlite3ext.h380
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/WebKitSystemInterface.h462
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h242
-rwxr-xr-xsrc/3rdparty/webkit/WebKitLibraries/win/tools/WinTools.make3
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/scripts/COPYRIGHT-END-YEAR1
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/scripts/VERSION1
-rwxr-xr-xsrc/3rdparty/webkit/WebKitLibraries/win/tools/scripts/auto-version.sh115
-rwxr-xr-xsrc/3rdparty/webkit/WebKitLibraries/win/tools/scripts/feature-defines.sh31
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops259
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops259
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/WinCairo.vsprops17
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/cURL.vsprops13
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/common.vsprops67
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/debug.vsprops35
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/debug_all.vsprops26
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/debug_wincairo.vsprops35
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/production.vsprops28
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/release.vsprops12
-rw-r--r--src/3rdparty/webkit/WebKitLibraries/win/tools/vsprops/releaseproduction.vsprops38
-rw-r--r--src/3rdparty/webkit/wscript355
-rw-r--r--src/corelib/codecs/qtextcodec_symbian.cpp4
-rw-r--r--src/corelib/global/qglobal.h63
-rw-r--r--src/corelib/global/qnamespace.qdoc16
-rw-r--r--src/corelib/io/qprocess.cpp11
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp37
-rw-r--r--src/corelib/kernel/qabstractitemmodel.h3
-rw-r--r--src/corelib/kernel/qobject.cpp4
-rw-r--r--src/corelib/tools/qscopedpointer.h4
-rw-r--r--src/declarative/debugger/qjsdebuggeragent.cpp42
-rw-r--r--src/declarative/debugger/qjsdebuggeragent_p.h12
-rw-r--r--src/declarative/debugger/qjsdebugservice.cpp53
-rw-r--r--src/declarative/debugger/qjsdebugservice_p.h24
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp136
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p_p.h15
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp97
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp133
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout.cpp15
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout_p.h2
-rw-r--r--src/gui/accessible/qaccessible_mac.mm2
-rw-r--r--src/gui/dialogs/qerrormessage.cpp16
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm5
-rw-r--r--src/gui/dialogs/qmessagebox.cpp18
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h1
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp75
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/gui/kernel/qwidget_mac.mm5
-rw-r--r--src/gui/painting/qgraphicssystemfactory.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp16
-rw-r--r--src/gui/styles/qs60style.cpp360
-rw-r--r--src/gui/styles/qs60style.h88
-rw-r--r--src/gui/styles/qs60style_p.h108
-rw-r--r--src/gui/styles/qs60style_s60.cpp127
-rw-r--r--src/gui/text/qfontengine_qpf.cpp12
-rw-r--r--src/gui/text/qfontengine_qws.cpp216
-rw-r--r--src/gui/text/qstatictext.cpp10
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
-rw-r--r--src/network/access/qhttpnetworkreply.cpp12
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp2
-rw-r--r--src/opengl/qgl.cpp1
-rw-r--r--src/opengl/qgl_symbian.cpp109
-rw-r--r--src/opengl/qpixmapdata_gl_p.h15
-rw-r--r--src/opengl/qpixmapdata_symbiangl.cpp632
-rw-r--r--src/opengl/qwindowsurface_gl.cpp64
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp19
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp9
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp14
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp54
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstracttool.h85
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp611
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h178
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp17
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h104
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool_p.h119
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp11
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h115
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter_p.h121
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp45
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h92
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool_p.h99
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h67
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem_p.h73
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h96
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator_p.h102
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp11
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h80
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator_p.h86
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h77
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle_p.h83
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp35
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h120
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool_p.h126
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h89
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator_p.h95
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h132
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar_p.h138
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h71
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem_p.h77
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h81
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox_p.h87
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp16
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h107
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool_p.h113
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp7
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp755
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h100
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h126
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p_p.h152
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro36
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h77
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants_p.h90
-rw-r--r--src/s60installs/bwins/QtGuiu.def18
-rwxr-xr-x[-rw-r--r--]src/s60installs/s60installs.pro19
-rw-r--r--src/src.pro15
13868 files changed, 2122968 insertions, 1043384 deletions
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index fff71f4..f786b78 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-6e15c3404d15a8ab72242152ec966e5e388161a2
+a52dbae362a295e0adfb7ee4fdc21734ae4b7b45
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog
index f438655..96ef591 100644
--- a/src/3rdparty/webkit/ChangeLog
+++ b/src/3rdparty/webkit/ChangeLog
@@ -1,3 +1,5587 @@
+2011-06-27 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove Phonon MediaPlayer from the tree.
+ https://bugs.webkit.org/show_bug.cgi?id=63448
+
+ Remvove from the build.
+
+ * Source/WebKit.pri:
+
+2011-06-07 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Fix Symbian build with RVCT 2.x
+ https://bugs.webkit.org/show_bug.cgi?id=62205
+
+ RVCT 2.x doesn't support (or need) the --signed_bitfields command-line
+ option, so restrict it to version 4.x of the compiler.
+
+ * Source/WebKit.pri:
+
+2011-06-03 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Benjamin Poulain.
+
+ [Qt] Build fix of QtWebKit 2.2 when inside Qt tree with GCC 4.6.
+ https://bugs.webkit.org/show_bug.cgi?id=61957
+
+ When building inside the Qt source tree, qmake always append the mkspecs
+ defines after ours. We have to workaround and make sure that we append
+ our flags after the qmake variable used inside Qt. This workaround was provided
+ by our qmake folks. We need to append in both case because qmake behave differently
+ when called with -spec or via SUBDIR+=.
+
+ * Source/WebKit.pri:
+
+2011-06-02 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Build fix of QtWebKit 2.2 when inside Qt tree with GCC 4.6.
+ https://bugs.webkit.org/show_bug.cgi?id=61957
+
+ When building inside the Qt source tree, qmake always append the mkspecs
+ defines after ours. We have to workaround and make sure that we append
+ our flags after the qmake variable used inside Qt. This workaround was provided
+ by our qmake folks.
+
+ * Source/WebKit.pri:
+
+2011-05-05 Prasanth Ullattil <prasanth.ullattil@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Install correct header files for webkit.
+
+ Since WebKit is no longer inside Qt, we can remove the detection for
+ that.
+
+ [Qt] Install targets are not working correctly for modularized Qt and QtWebkit
+ https://bugs.webkit.org/show_bug.cgi?id=57621
+
+ * Source/sync.profile:
+
+2011-05-09 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Fix the build on Embedded Linux.
+ https://bugs.webkit.org/show_bug.cgi?id=60347
+
+ qpa is the name for lighthouse but the old name for Qt for Embedded Linux should
+ still be used in order to build properly.
+
+ * Source/WebKit.pri:
+
+2011-05-05 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Benjamin Poulain.
+
+ [Qt] Make QtWebKit build when using gcc 4.6.0
+ https://bugs.webkit.org/show_bug.cgi?id=60265
+
+ If QtWebKit is compiled with gcc 4.6.0 and the build is not done
+ with c++0x support we need to deactivate warnings about compatibility.
+ Some WebKit types have names which conflicts with upcoming c++0x
+ types. If QtWebKit is built with c++0x support, WebKit has code to
+ fallback to the standard type rather than the WebKit implementation.
+ For example nullptr will be the one of the std if build options turns on
+ c++0x support.
+
+ * Source/WebKit.pri:
+
+2011-05-04 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Fix warnings in webkit.m4 with autoconf 2.68
+ https://bugs.webkit.org/show_bug.cgi?id=60189
+
+ Use AC_LANG_SOURCE when passing source code to AC_COMPILE_IFELSE
+ to remove warnings.
+
+ * Source/autotools/webkit.m4: ditto.
+
+2011-05-04 Martin Robinson <mrobinson@igalia.com>
+
+ Fix the WebKitGTK+ build.
+
+ * configure.ac: Added option parsing code for loading touch icons.
+
+2011-05-03 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Xan Lopez.
+
+ [CMAKE] Remove C++0x compat mode warnings for GCC >= 4.6.0
+ https://bugs.webkit.org/show_bug.cgi?id=60041
+
+ Hardcode -Wno-c++0x-compat for the default compiler (if version >=
+ 4.6.0) until our codebase is ready. This is the same as done for
+ autotools.
+
+ * Source/cmake/WebKitHelpers.cmake: ditto.
+
+2011-05-03 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Unreviewed, rolling out r85624.
+ http://trac.webkit.org/changeset/85624
+
+ The same command is used also for make_names.pl, which breaks
+ the build.
+
+ * Source/cmake/OptionsCommon.cmake: ditto.
+
+2011-05-03 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Unreviewed build fix for NETWORK_BACKEND=curl.
+
+ Force linking with zlib so that uncompress() exists.
+
+ * Source/cmake/OptionsEfl.cmake: Find zlib.
+
+2011-05-03 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ [CMAKE] Unreviewed build fix for gcc >= 4.6
+
+ Same fix as done in r84123. CMake explicitly pass the arguments to
+ make_names.pl, so let's make them the same.
+
+ * Source/cmake/OptionsCommon.cmake: ditto.
+
+2011-05-02 Adam Klein <adamk@chromium.org>
+
+ Reviewed by Tony Chang.
+
+ Roll chromium DEPS to r83722, add new crypto directory to DEPS
+ https://bugs.webkit.org/show_bug.cgi?id=59992
+
+ * .gitignore:
+ Ignore new chromium/crypto directory.
+
+2011-05-03 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Eric Seidel.
+
+ [GTK] Build webkit1 even when webkit2 is enabled
+ https://bugs.webkit.org/show_bug.cgi?id=59695
+
+ * GNUmakefile.am:
+ * configure.ac:
+
+2011-05-01 ojab <ojab@ojab.ru>
+
+ Reviewed by Eric Seidel.
+
+ --disable-video-track if --disable-video
+ https://bugs.webkit.org/show_bug.cgi?id=59605
+
+ * configure.ac:
+
+2011-04-29 Dean Jackson <dino@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Add ENABLE macro for WebKitAnimation
+ https://bugs.webkit.org/show_bug.cgi?id=59729
+
+ Add new feature to toggle WebKit Animation API.
+
+ * configure.ac:
+
+2011-04-29 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Unreviewed build fix. Fix library copying logic for wxMSW 2.9.x.
+
+ * wscript:
+
+2011-04-28 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove WML
+ https://bugs.webkit.org/show_bug.cgi?id=59678
+
+ Remove WML configuration option from the CMake build system.
+
+ * Source/cmake/OptionsEfl.cmake:
+ * Source/cmake/OptionsWinCE.cmake:
+ * Source/cmakeconfig.h.cmake:
+
+2011-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [Gtk] Split JSC and WebCore builds
+ https://bugs.webkit.org/show_bug.cgi?id=19428
+
+ Add a pkg-config file for JavaScriptCoreGTK+.
+
+ * configure.ac: generate the final pkg-config file from our .in
+ file.
+
+2011-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [Gtk] Split JSC and WebCore builds
+ https://bugs.webkit.org/show_bug.cgi?id=19428
+
+ Build JavaScriptCore as a libtool shared library instead of a
+ private convenience library.
+
+ * GNUmakefile.am: remove convenience library definition for jsc.
+
+2011-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Remove C++0x compat mode warnings for GCC >= 4.6.0
+ https://bugs.webkit.org/show_bug.cgi?id=59718
+
+ Hardcode -Wno-c++0x-compat for the default compiler (if version >=
+ 4.6.0) until our codebase is ready.
+
+ * configure.ac: do that.
+
+2011-04-27 Yi Shen <yi.4.shen@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Upstream Symbian platform plugin
+ https://bugs.webkit.org/show_bug.cgi?id=58435
+
+ Upstream Symbian platform plugin.
+
+ * Source/WebKit.pro: Add platformplugin path to the SUBDIRS.
+
+2011-04-27 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Remove Android build system
+ https://bugs.webkit.org/show_bug.cgi?id=48111
+
+ This is to avoid the maintenance burden until the Android port is
+ fully upstreamed.
+
+ * Source/Android.mk: Removed.
+
+2011-04-26 Kevin Ollivier <kevino@theolliviers.com>
+
+ Rubberstamped by Eric Seidel.
+
+ Enable waf to be used to build other ports
+ https://bugs.webkit.org/show_bug.cgi?id=58213
+
+ * wscript:
+
+2011-04-22 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r84627.
+ http://trac.webkit.org/changeset/84627
+ https://bugs.webkit.org/show_bug.cgi?id=59271
+
+ It broke Symbian build (Requested by Ossy on #webkit).
+
+ * Source/WebKit.pro:
+
+2011-04-22 Yi Shen <yi.4.shen@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Upstream Symbian platform plugin
+ https://bugs.webkit.org/show_bug.cgi?id=58435
+
+ Upstream Symbian platform plugin.
+
+ * Source/WebKit.pro: Add platformplugin path to the SUBDIRS.
+
+2011-04-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add a feature define to allow <details> and <summary> to be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=59118
+ <rdar://problem/9257045>
+
+ * configure.ac:
+
+2011-04-18 Evan Martin <evan@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ [chromium] expose title direction to webkit client
+ https://bugs.webkit.org/show_bug.cgi?id=58823
+
+ * Tools/DumpRenderTree/chromium/LayoutTestController.cpp:
+ * Tools/DumpRenderTree/chromium/LayoutTestController.h:
+ Adapt to new API. Expose title direction to JS so it can be tested.
+
+ * Tools/DumpRenderTree/chromium/WebViewHost.cpp:
+ * Tools/DumpRenderTree/chromium/WebViewHost.h:
+ Provide new API.
+
+2011-04-18 Hans Wennborg <hans@chromium.org>
+
+ Reviewed by Steve Block.
+
+ LevelDB backend for IndexedDB
+ https://bugs.webkit.org/show_bug.cgi?id=57372
+
+ Add LevelDB wrappers to Android.mk.
+
+ * Source/Android.mk:
+
+2011-04-18 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Pavel Feldman.
+
+ REGRESSION (r81479): generate-inspector-idl fails on native win32
+ https://bugs.webkit.org/show_bug.cgi?id=58315
+
+ Disable git autocrlf for Inspector.json.
+
+ * .gitattributes:
+
+2011-04-16 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Rename PLATFORM(CAIRO) to USE(CAIRO)
+ https://bugs.webkit.org/show_bug.cgi?id=55192
+
+ * Source/cmake/OptionsEfl.cmake:
+
+2011-04-15 Shishir Agrawal <shishir@chromium.org>
+
+ Reviewed by James Robinson.
+
+ Add a flag to guard Page Visibility API changes.
+ https://bugs.webkit.org/show_bug.cgi?id=58464
+
+ Initial draft at:
+ http://lists.w3.org/Archives/Public/public-webapps/2011JanMar/0175.html
+
+ * configure.ac:
+
+2011-04-15 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ * configure.ac: bump to 1.5.0, 1.4.0 will be released from a
+ branch and was already cut off.
+
+2011-04-15 Anna Cavender <annacc@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Renaming TRACK feature define to VIDEO_TRACK
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+ * configure.ac:
+
+2011-04-13 Dmitry Lomov <dslomov@google.com>
+
+ Reviewed by David Levin.
+
+ Add GTest unit-testing framework to WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=58507
+
+ * Source/ThirdParty/gtest/CHANGES: Added.
+ * Source/ThirdParty/gtest/CMakeLists.txt: Added.
+ * Source/ThirdParty/gtest/CONTRIBUTORS: Added.
+ * Source/ThirdParty/gtest/COPYING: Added.
+ * Source/ThirdParty/gtest/Makefile.am: Added.
+ * Source/ThirdParty/gtest/README: Added.
+ * Source/ThirdParty/gtest/README.WebKit: Added.
+ * Source/ThirdParty/gtest/codegear/gtest.cbproj: Added.
+ * Source/ThirdParty/gtest/codegear/gtest.groupproj: Added.
+ * Source/ThirdParty/gtest/codegear/gtest_all.cc: Added.
+ * Source/ThirdParty/gtest/codegear/gtest_link.cc: Added.
+ * Source/ThirdParty/gtest/codegear/gtest_main.cbproj: Added.
+ * Source/ThirdParty/gtest/codegear/gtest_unittest.cbproj: Added.
+ * Source/ThirdParty/gtest/configure.ac: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest-death-test.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest-message.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest-param-test.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest-param-test.h.pump: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest-spi.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest-test-part.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest-typed-test.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest_pred_impl.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/gtest_prod.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-death-test-internal.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-filepath.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-internal.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-linked_ptr.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h.pump: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-port.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-string.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h.pump: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h: Added.
+ * Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h.pump: Added.
+ * Source/ThirdParty/gtest/m4/acx_pthread.m4: Added.
+ * Source/ThirdParty/gtest/m4/gtest.m4: Added.
+ * Source/ThirdParty/gtest/make/Makefile: Added.
+ * Source/ThirdParty/gtest/msvc/gtest-md.sln: Added.
+ * Source/ThirdParty/gtest/msvc/gtest-md.vcproj: Added.
+ * Source/ThirdParty/gtest/msvc/gtest.sln: Added.
+ * Source/ThirdParty/gtest/msvc/gtest.vcproj: Added.
+ * Source/ThirdParty/gtest/msvc/gtest_main-md.vcproj: Added.
+ * Source/ThirdParty/gtest/msvc/gtest_main.vcproj: Added.
+ * Source/ThirdParty/gtest/msvc/gtest_prod_test-md.vcproj: Added.
+ * Source/ThirdParty/gtest/msvc/gtest_prod_test.vcproj: Added.
+ * Source/ThirdParty/gtest/msvc/gtest_unittest-md.vcproj: Added.
+ * Source/ThirdParty/gtest/msvc/gtest_unittest.vcproj: Added.
+ * Source/ThirdParty/gtest/run_tests.py: Added.
+ * Source/ThirdParty/gtest/samples/prime_tables.h: Added.
+ * Source/ThirdParty/gtest/samples/sample1.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample1.h: Added.
+ * Source/ThirdParty/gtest/samples/sample10_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample1_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample2.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample2.h: Added.
+ * Source/ThirdParty/gtest/samples/sample2_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample3-inl.h: Added.
+ * Source/ThirdParty/gtest/samples/sample3_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample4.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample4.h: Added.
+ * Source/ThirdParty/gtest/samples/sample4_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample5_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample6_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample7_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample8_unittest.cc: Added.
+ * Source/ThirdParty/gtest/samples/sample9_unittest.cc: Added.
+ * Source/ThirdParty/gtest/scripts/fuse_gtest_files.py: Added.
+ * Source/ThirdParty/gtest/scripts/gen_gtest_pred_impl.py: Added.
+ * Source/ThirdParty/gtest/scripts/gtest-config.in: Added.
+ * Source/ThirdParty/gtest/scripts/pump.py: Added.
+ * Source/ThirdParty/gtest/scripts/test/Makefile: Added.
+ * Source/ThirdParty/gtest/scripts/upload.py: Added.
+ * Source/ThirdParty/gtest/scripts/upload_gtest.py: Added.
+ * Source/ThirdParty/gtest/src/gtest-all.cc: Added.
+ * Source/ThirdParty/gtest/src/gtest-death-test.cc: Added.
+ * Source/ThirdParty/gtest/src/gtest-filepath.cc: Added.
+ * Source/ThirdParty/gtest/src/gtest-internal-inl.h: Added.
+ * Source/ThirdParty/gtest/src/gtest-port.cc: Added.
+ * Source/ThirdParty/gtest/src/gtest-test-part.cc: Added.
+ * Source/ThirdParty/gtest/src/gtest-typed-test.cc: Added.
+ * Source/ThirdParty/gtest/src/gtest.cc: Added.
+ * Source/ThirdParty/gtest/src/gtest_main.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-death-test_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-filepath_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-linked_ptr_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-listener_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-message_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-options_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-param-test2_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-param-test_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-param-test_test.h: Added.
+ * Source/ThirdParty/gtest/test/gtest-port_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-test-part_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-tuple_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-typed-test2_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-typed-test_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest-typed-test_test.h: Added.
+ * Source/ThirdParty/gtest/test/gtest-unittest-api_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_all_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_color_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_color_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_env_var_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_env_var_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_environment_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_filter_unittest.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_filter_unittest_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_help_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_help_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_list_tests_unittest.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_list_tests_unittest_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_main_unittest.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_nc.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_nc_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_no_test_unittest.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_output_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_output_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_output_test_golden_lin.txt: Added.
+ * Source/ThirdParty/gtest/test/gtest_output_test_golden_win.txt: Added.
+ * Source/ThirdParty/gtest/test/gtest_pred_impl_unittest.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_prod_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_repeat_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_shuffle_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_shuffle_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_sole_header_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_stress_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_test_utils.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_throw_on_failure_ex_test.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_throw_on_failure_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_throw_on_failure_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_uninitialized_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_uninitialized_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_unittest.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_xml_outfile1_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_xml_outfile2_test_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_xml_outfiles_test.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_xml_output_unittest.py: Added.
+ * Source/ThirdParty/gtest/test/gtest_xml_output_unittest_.cc: Added.
+ * Source/ThirdParty/gtest/test/gtest_xml_test_utils.py: Added.
+ * Source/ThirdParty/gtest/test/production.cc: Added.
+ * Source/ThirdParty/gtest/test/production.h: Added.
+ * Source/ThirdParty/gtest/test/run_tests_util.py: Added.
+ * Source/ThirdParty/gtest/test/run_tests_util_test.py: Added.
+ * Source/ThirdParty/gtest/xcode/Config/DebugProject.xcconfig: Added.
+ * Source/ThirdParty/gtest/xcode/Config/FrameworkTarget.xcconfig: Added.
+ * Source/ThirdParty/gtest/xcode/Config/General.xcconfig: Added.
+ * Source/ThirdParty/gtest/xcode/Config/ReleaseProject.xcconfig: Added.
+ * Source/ThirdParty/gtest/xcode/Config/StaticLibraryTarget.xcconfig: Added.
+ * Source/ThirdParty/gtest/xcode/Config/TestTarget.xcconfig: Added.
+ * Source/ThirdParty/gtest/xcode/Resources/Info.plist: Added.
+ * Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/Info.plist: Added.
+ * Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj: Added.
+ * Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/runtests.sh: Added.
+ * Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.cc: Added.
+ * Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.h: Added.
+ * Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget_test.cc: Added.
+ * Source/ThirdParty/gtest/xcode/Scripts/runtests.sh: Added.
+ * Source/ThirdParty/gtest/xcode/Scripts/versiongenerate.py: Added.
+ * Source/ThirdParty/gtest/xcode/gtest.xcodeproj/project.pbxproj: Added.
+
+2011-04-13 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [CMAKE] Separate DerivedSources.
+ https://bugs.webkit.org/show_bug.cgi?id=58427
+
+ Seperate DerivedSources/ to DerivedSources/WebCore and
+ DerivedSources/JavaScriptCore.
+
+ * Source/CMakeLists.txt:
+ * Source/cmake/OptionsCommon.cmake:
+ * Source/cmake/WebKitFS.cmake:
+ * Source/cmake/WebKitHelpers.cmake:
+ * Source/cmake/WebKitMacros.cmake:
+
+2011-04-13 Tony Chang <tony@chromium.org>
+
+ Ignore files generated from glu.gyp.
+
+ * .gitignore:
+
+2011-03-28 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Kenneth Russell.
+
+ Move libtess from WebCore/thirdparty to ThirdParty
+ https://bugs.webkit.org/show_bug.cgi?id=57288
+
+ We're putting third party code in Source/ThirdParty these days.
+
+ * Source/ThirdParty/glu: Copied from Source/WebCore/thirdparty/glu.
+ * Source/ThirdParty/glu/glu.gyp: Added.
+
+2011-04-12 Thouraya ANDOLSI <thouraya.andolsi@st.com>
+
+ Reviewed by Eric Seidel.
+
+ [QT] Enable JIT build for SH4 platforms.
+ https://bugs.webkit.org/show_bug.cgi?id=58317
+ add disable_uitools for SH4 platforms.
+
+ * Source/WebKit.pri:
+
+2011-04-11 Anna Cavender <annacc@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Setup ENABLE(TRACK) feature define
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+ * configure.ac:
+
+2011-04-11 Varun Jain <varunjain@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Resolving FIXME to make new WebWidget method pure virtual since all downstream classes have implemented the method.
+ https://bugs.webkit.org/show_bug.cgi?id=58245
+
+ * Source/WebKit/chromium/public/WebWidget.h:
+
+2011-04-11 Thouraya ANDOLSI <thouraya.andolsi@st.com>
+
+ Reviewed by Oliver Hunt.
+
+ SH4 JIT SUPPORT.
+ https://bugs.webkit.org/show_bug.cgi?id=44329
+
+ Enable JIT support for SH4 platforms.
+
+ * configure.ac:
+
+2011-04-11 Andreas Kling <andreas.kling@nokia.com>
+
+ Unreviewed Qt build fix, QT_CONFIG doesn't have uitools on bots.
+
+ * Source/WebKit.pri:
+
+2011-04-09 Keith Kyzivat <keith.kyzivat@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Don't link against fontconfig or X11 if embedded
+ https://bugs.webkit.org/show_bug.cgi?id=58104
+
+ * Source/WebKit.pri: Add qpa=>embedded as it should be across all builds.
+
+2011-04-08 Alpha Lam <hclam@chromium.org>
+
+ Unreviewed, rolling out r83335.
+ http://trac.webkit.org/changeset/83335
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+ GTK and QT bots are broken.
+
+ * configure.ac:
+
+2011-04-08 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Remove modular references after support for the flag was removed.
+ https://bugs.webkit.org/show_bug.cgi?id=57018
+
+ Removed modular references after support for the flag was removed.
+
+ Support was removed because the Qt Modularization project decided we
+ don't need it. It's better to base decisions on the available
+ information, as demonstrated in the patch by checking
+ QT.phonon.includes.
+
+ * Source/WebKit.pri:
+
+2011-04-07 Anna Cavender <annacc@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Setup ENABLE(TRACK) feature define
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+ * configure.ac:
+
+2011-04-08 Varun Jain <varunjain@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Need to extend WebKit chromium API to access text selection
+ https://bugs.webkit.org/show_bug.cgi?id=57888
+
+ * Source/WebKit/chromium/public/WebFrame.h:
+ * Source/WebKit/chromium/public/WebWidget.h:
+ * Source/WebKit/chromium/src/WebFrameImpl.cpp:
+ * Source/WebKit/chromium/src/WebFrameImpl.h:
+ * Source/WebKit/chromium/src/WebPopupMenuImpl.h:
+ * Source/WebKit/chromium/src/WebViewImpl.cpp:
+ * Source/WebKit/chromium/src/WebViewImpl.h:
+ * Source/WebKit/chromium/tests/PopupMenuTest.cpp:
+
+2011-04-08 Jon Lee <jonlee@apple.com>
+
+ Reviewed by David Levin.
+
+ adding *.vcproj.*.user to .gitignore for Visual Studio development
+ https://bugs.webkit.org/show_bug.cgi?id=58097
+
+ * .gitignore:
+
+2011-04-07 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add stub support for generating Gtk build system from gyp
+ https://bugs.webkit.org/show_bug.cgi?id=58086
+
+ This adds support for a new --port argument and plumbs through
+ the necessary paths to allow generating for a port other than Mac.
+
+ * Source/gyp/configure:
+
+2011-04-07 Andrew Scherkus <scherkus@chromium.org>
+
+ Revert ENABLE_TRACK patch due to compile failures.
+
+ * configure.ac:
+
+2011-04-06 Dai Mikurube <dmikurube@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add QUOTA build flag for unified quota API
+ https://bugs.webkit.org/show_bug.cgi?id=57918
+
+ * configure.ac: Added QUOTA build flag
+
+2011-04-04 Martin Robinson <mrobinson@igalia.com>
+
+ Build fix for GTK+ after r82876.
+
+ * Source/autotools/symbols.filter: Update the symbol filter to include new symbols
+ from WTF that DRT uses.
+
+2011-04-04 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] WebGL support
+ https://bugs.webkit.org/show_bug.cgi?id=31517
+
+ * configure.ac: Update configure.ac to ensure that GL/GLX headers exist.
+
+2011-04-04 Jon Lee <jonlee@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ add some directories to .gitignore (and svn:ignore) when opening projects in xcode4
+ https://bugs.webkit.org/show_bug.cgi?id=57646
+
+ * .gitignore: added xcode 4 related project and workspace directories that are not needed for checkin
+
+2011-03-31 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Link explicitly with XRender on Linux/Unix
+ https://bugs.webkit.org/show_bug.cgi?id=57558
+
+ Some linkers, like GNU Gold, require explicit linkage of all the
+ libraries used instead of relying on our dependencies to bring
+ them in. In this case, the build fails because we use XRender in
+ the plugin code but don't link directly to it.
+
+ * configure.ac: check for XRender on UNIX.
+
+2011-03-31 Vamshikrishna.Yellenki <vamshi@motorola.com> and Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Implement MiniBrowser for Gtk port.
+ https://bugs.webkit.org/show_bug.cgi?id=48512
+
+ Initial implementation of the Gtk MiniBrowser.
+
+ * GNUmakefile.am:
+
+2011-03-30 Csaba Osztrogonác <ossy@webkit.org>
+
+ [Qt] Typo fix, remove an accidentally added line.
+
+ * Source/WebKit.pri:
+
+2011-03-30 Csaba Osztrogonác <ossy@webkit.org>
+
+ [Qt] Rollout r82240 and r82232, because they broke 2 plugin tests.
+
+ * Source/WebKit.pri:
+
+2011-03-29 Csaba Osztrogonác <ossy@webkit.org>
+
+ Rubber-stamped by Andreas Kling.
+
+ [Qt] Remove modular references after support for the flag was removed.
+ https://bugs.webkit.org/show_bug.cgi?id=57018
+
+ Symbian buildfix after r82232.
+
+ * Source/WebKit.pri: Readd uitools option.
+
+2011-03-29 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ Removed modular references after support for the flag was removed.
+
+ Support was removed because the Qt Modularization project decided we
+ don't need it. It's better to base decisions on the available
+ information, as demonstrated in the patch by checking
+ QT.phonon.includes.
+
+ In addition, remove the reference to uitools. It has been moved to
+ QtKernel now, and therefore is always available.
+
+ [Qt] Remove modular references after support for the flag was removed.
+ https://bugs.webkit.org/show_bug.cgi?id=57018
+
+ * Source/WebKit.pri:
+
+2011-03-28 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] QtWebKit will not compile with QT_ASCII_CAST_WARNINGS enabled
+ https://bugs.webkit.org/show_bug.cgi?id=57087
+
+ Enable QT_ASCII_CAST_WARNINGS by default in webkit.pri to catch the errors early on.
+
+ * Source/WebKit.pri:
+
+2011-03-26 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ We shouldn't bother running GYP if the generated files are newer than the GYP files
+ https://bugs.webkit.org/show_bug.cgi?id=57146
+
+ In the common case, this check will avoid any overhead from processing
+ the GYP files. Another approach to doing this is to add the feature to
+ GYP directly, but GYP's approach to this problem is to compute the
+ output in its entirety and compare it byte-for-byte against the output
+ file. In the future, it might make sense to add this approach as an
+ alternative approach for GYP itself.
+
+ I also removed JavaScriptGlue from the script because we're not really
+ going to change JavaScriptGlue over to GYP. We were using
+ JavaScriptGlue as a learning experience.
+
+ * Source/gyp/configure:
+
+2011-03-25 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, don't use the new FPD implementation yet, until we can merge ours with it.
+
+ * wscript:
+
+2011-03-23 George Guo <George.Guo@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Webkit warning: converting to 'unsigned int' from 'double'
+ https://bugs.webkit.org/show_bug.cgi?id=56865
+
+ With -Werr enabled, this cause the build failure on RedHat Linux.
+ Add a cast helped.
+
+ * Source/JavaScriptCore/runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+
+2011-03-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ GYP build should default to Production configuration
+ https://bugs.webkit.org/show_bug.cgi?id=56899
+
+ * Source/gyp/common.gypi:
+
+2011-03-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ gyp/configure shouldn&apos;t require GYP to be in your path
+ https://bugs.webkit.org/show_bug.cgi?id=56873
+
+ Now that GYP is on Source/ThirdParty/gyp, we can just use that copy
+ instead of requiring GYP to be in the user's path.
+
+ * Source/gyp/configure:
+
+2011-03-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add GYP to Source/ThirdParty
+ https://bugs.webkit.org/show_bug.cgi?id=56870
+
+ We probably don't need all the test files, but it seems cleaner to just
+ check in the whole GYP tree. GYP is BSD licensed, so it is compatible
+ with the WebKit license.
+
+ * Source/ThirdParty/gyp: Added.
+
+2011-03-21 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] 1.3.13 release bump
+ https://bugs.webkit.org/show_bug.cgi?id=56795
+
+ Version bump for 1.3.13 and updated NEWS file with release notes.
+
+ * configure.ac:
+
+2011-03-21 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [CMAKE] Add exception handling when PORT was missing.
+ https://bugs.webkit.org/show_bug.cgi?id=56728
+
+ * Source/CMakeLists.txt:
+
+2011-03-10 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Text layout is broken on Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=56046
+
+ Change integers included into bitfields to be signed by default on RVCT
+ compiler as a lot of other compilers do (gcc, msvc, winsc).
+ There are a lot of places in webkit where integers included in bitfield
+ are assumed to be signed.
+
+ * Source/WebKit.pri:
+
+2011-03-10 Alejandro G. Castro <alex@igalia.com>
+
+ Unreviewed, fixed Efl compilation after r80744.
+
+ * Source/cmake/OptionsEfl.cmake:
+
+2011-03-10 Martin Robinson <mrobinson@igalia.com>
+
+ Fixed the help message for WebGL support on GTK+ to reflect the fact that
+ it's turned off by default and is experimental.
+
+ * configure.ac: Fix WebGL help message.
+
+2011-03-04 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add skeletal WebCore.gyp
+ https://bugs.webkit.org/show_bug.cgi?id=55802
+
+ * Source/gyp/configure: Added WebCore.
+
+2011-03-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add a basic configure script for the GYP build
+ https://bugs.webkit.org/show_bug.cgi?id=55791
+
+ This script just calls GYP on the various gyp projects. As we add more
+ build systems, this script should be able to select which of them you'd
+ like to generate the project for.
+
+ * Source/gyp/configure: Added.
+
+2011-03-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Use target_defaults to reduce boilerplate in GYP build system
+ https://bugs.webkit.org/show_bug.cgi?id=55790
+
+ This file contains GYP declarations that are shared by all the modules.
+ Currently, we use this to set up the configurations, albeit primitively.
+
+ * Source/gyp/common.gypi: Added.
+
+2011-03-03 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix. Ensure the ICU include dir comes before JavaScriptCore/wtf on Win
+ to make sure the proper unicode/utf8.h header is included.
+
+ * wscript:
+
+2011-03-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, don't use LocalizedNumberICU.cpp yet, headers that it needs are not
+ included in the ICU headers used by WebKit.
+
+ * wscript:
+
+2011-03-02 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add feature define for data transfer items
+ https://bugs.webkit.org/show_bug.cgi?id=55510
+
+ * Source/cmake/OptionsEfl.cmake:
+ * Source/cmake/OptionsWinCE.cmake:
+ * Source/cmakeconfig.h.cmake:
+ * configure.ac:
+
+>>>>>>> .r80188
+2011-03-02 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt][WK2] generate-forwarding-headers.pl should generate paths with framework names
+ https://bugs.webkit.org/show_bug.cgi?id=55478
+
+ On case insensitive systems the generated forwarding headers cause build problems.
+
+ * Source/WebKit.pri: Adjust INCLUDEPATH for the project.
+
+2011-03-01 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r80079.
+ http://trac.webkit.org/changeset/80079
+ https://bugs.webkit.org/show_bug.cgi?id=55547
+
+ "Broke the Win debug build?" (Requested by dcheng on #webkit).
+
+ * Source/cmake/OptionsEfl.cmake:
+ * Source/cmake/OptionsWinCE.cmake:
+ * Source/cmakeconfig.h.cmake:
+
+2011-03-01 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add feature define for data transfer items
+ https://bugs.webkit.org/show_bug.cgi?id=55510
+
+ * Source/cmake/OptionsEfl.cmake:
+ * Source/cmake/OptionsWinCE.cmake:
+ * Source/cmakeconfig.h.cmake:
+
+2011-03-01 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Clean up the project files and move common options to WebKit.pri.
+
+ Mac related changes suggested by Prasanth Ullattil <prasanth.ullattil@nokia.com>
+
+ * Source/WebKit.pri: Common options should be here.
+ Also move Mac options to this file to fix the Mac build.
+
+2011-03-01 Andras Becsi <abecsi@webkit.org>
+
+ Unreviewed build fix.
+
+ [Qt] Fix minimal build.
+
+ * Source/WebKit.pri: Move the XP_UNIX define back to WebCore.pri.
+
+2011-02-28 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Teach JavaScriptGlue gyp build about DEPTH
+ https://bugs.webkit.org/show_bug.cgi?id=55421
+
+ Moves the previously JavaScriptGlue-specific GYP helper shell scripts
+ to the gyp directory in Source, where they can be shared by multiple
+ frameworks.
+
+ * Source/gyp: Added.
+ * Source/gyp/remove-headers-if-needed.sh: Copied from Source/JavaScriptGlue/gyp/remove-headers-if-needed.sh.
+ * Source/gyp/run-if-exists.sh: Copied from Source/JavaScriptGlue/gyp/run-if-exists.sh.
+ * Source/gyp/update-info-plist.sh: Copied from Source/JavaScriptGlue/gyp/update-info-plist.sh.
+
+2011-02-28 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt][WK2] Add a way to test the WebKit 2 APIs
+ https://bugs.webkit.org/show_bug.cgi?id=55408
+
+ Add the build file for test to the build system.
+
+ * Source/WebKit.pri: Add the include path for WebKit 2 APIs.
+ * Source/WebKit.pro: Add the dependency to build the new test project.
+
+2011-02-28 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ [Qt][WK2] Plugin initialization
+ https://bugs.webkit.org/show_bug.cgi?id=48127
+
+ * Source/WebKit.pri: Lift the definition of the XP_UNIX macro
+ from WebCore.pri to WebKit.pri to apply it to WebKit2 as well.
+
+2011-02-28 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ Added full webkit module profile and a syncqt profile.
+
+ This is for modularized Qt.
+
+ [Qt] WebKit patches required to work with a modularized version of Qt
+ https://bugs.webkit.org/show_bug.cgi?id=53916
+
+ * Source/sync.profile: Added.
+
+2011-02-26 Dihan Wickremasuriya <dihan.wickremasuriya@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] [Symbian] Disable dependency to a specific version of a Qt package for
+ non-production builds.
+ https://bugs.webkit.org/show_bug.cgi?id=55313
+
+ * Source/WebKit.pri:
+
+2011-02-24 Alejandro G. Castro <alex@igalia.com>
+
+ Rubber-stamped by Martin Robinson.
+
+ Fixed compilation after r79537, added a bug to solve webkit2
+ translations:
+ https://bugs.webkit.org/show_bug.cgi?id=55153
+
+ * GNUmakefile.am:
+
+2011-02-24 Christian Dywan <christian@lanedo.com>
+
+ Rubber-stamped by Eric Seidel.
+
+ [GTK] webkitgtk 1.3.7 build without translations
+ https://bugs.webkit.org/show_bug.cgi?id=50612
+
+ * GNUmakefile.am: Require stamp-po target for all-local so
+ that po files are built before they install.
+
+2011-02-22 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] 1.3.12 release preparation
+ https://bugs.webkit.org/show_bug.cgi?id=54967
+
+ Version bump for 1.3.12 and updated NEWS file with release notes.
+ Also bumped libsoup requirement to 2.33.6 as agreed with Sergio
+ and Martin.
+
+ * Source/WebKit/gtk/NEWS:
+ * configure.ac:
+
+2011-02-22 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Redesign the build system
+ https://bugs.webkit.org/show_bug.cgi?id=51339
+
+ Part 2.
+
+ Build WebCore as a static library, compile the WebKit API and WebKit2 API
+ in a final step and link to WebKit2, WebCore and JSC libraries to fix
+ linking issues resulting from stripped away symbols.
+
+ * Source/WebKit.pri: Add common include paths
+ * Source/WebKit.pro: Add new project file to SUBDIRS
+
+2011-02-20 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Bump GTK+3 dependency to 3.0
+ https://bugs.webkit.org/show_bug.cgi?id=54394
+
+ * configure.ac:
+
+2011-02-19 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Remove mandatory Enchant dependency
+ https://bugs.webkit.org/show_bug.cgi?id=51587
+
+ Add enable-spellcheck option which decides whether to use enchant.
+ If disabled, WebKitGTK+ will not use enchant library.
+
+ * configure.ac:
+
+2011-02-18 Zan Dobersek <zandobersek@gmail.com>
+
+ Reviewed by Martin Robinson.
+
+ [Gtk] Re-enable meter tag support
+ https://bugs.webkit.org/show_bug.cgi?id=54762
+
+ Enable meter tag support in the configure.ac. This feature was
+ previously enabled by default in the makefile, but should be
+ enabled here after changes in r78981.
+
+ * configure.ac:
+
+2011-02-18 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Avoided UiTools dependency if the module is not present.
+
+ [Qt] WebKit patches required to work with a modularized version of Qt
+ https://bugs.webkit.org/show_bug.cgi?id=53916
+
+ * Source/WebKit.pri:
+
+2011-02-18 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Kent Tamura.
+
+ [EFL] Remove GDK dependency.
+ https://bugs.webkit.org/show_bug.cgi?id=53978
+
+ Remove checking GDK library.
+
+ * Source/cmake/OptionsEfl.cmake:
+
+2011-02-18 Philippe Normand <pnormand@igalia.com>
+
+ Unreviewed, build fix after r78981
+
+ * configure.ac: datagrid is datagrid, it is not database. Also
+ meter is not progress. Fixed copy/paste mistakes.
+
+2011-02-18 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] minimal build unrecognized options
+ https://bugs.webkit.org/show_bug.cgi?id=50890
+
+ * configure.ac: added new configure options to enable/disable the
+ meter element, progress element, datagrid and client-based
+ geolocation support.
+
+2011-02-17 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix after introduction of JavaScriptCore/collector.
+
+ * wscript:
+
+2011-02-17 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ Updated include paths for phonon.
+
+ [Qt] WebKit patches required to work with a modularized version of Qt
+ https://bugs.webkit.org/show_bug.cgi?id=53916
+
+ * Source/WebKit.pri:
+
+2011-02-13 Hayato Ito <hayato@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ Update .gitignore to ignore files which Ninja build system generates.
+
+ https://bugs.webkit.org/show_bug.cgi?id=54378
+
+ * .gitignore:
+
+2011-02-10 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Remove PCRE source from trunk
+ https://bugs.webkit.org/show_bug.cgi?id=54188
+
+ * Source/cmake/WebKitFS.cmake:
+
+2011-02-09 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Steve Block.
+
+ Move Android.mk into Source
+ https://bugs.webkit.org/show_bug.cgi?id=53751
+
+ A somewhat blind attempt to move Android.mk into the Source directory.
+ I'm sure I've goofed this up in some way. The Android folks have
+ kindly volunteered to fix this up once they merge past this revision.
+
+ * Android.mk: Removed.
+ * Source/Android.mk: Copied from Android.mk.
+
+2011-02-08 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ WebKit2 GTK Fails to Build #include nested too deeply
+ https://bugs.webkit.org/show_bug.cgi?id=52219
+
+ Removed the __STDC_FORMAT_MACROS definition, it is already defined
+ in the file where PRIxx64 is used before the inclusion so we are
+ safe.
+
+ * configure.ac:
+
+2011-02-08 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Added include paths for QtScript.
+
+ WebKit patches required to work with a modularized version of Qt
+ https://bugs.webkit.org/show_bug.cgi?id=53916
+
+ * Source/WebKit.pri:
+
+2011-02-03 Martin Robinson <mrobinson@igalia.com>
+
+ Fix GTK+ WebGL build after r76600.
+
+ * configure.ac: Make sure to respect configure.ac conventions
+ consistently when it comes to capitalization. Remove an old
+ reference to enable_3d_canvas.
+
+2011-02-02 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Bump the WebKitGTK+ versions in preparation for development release.
+
+ * configure.ac: Bump the library, libtool and user agent version.
+
+2011-02-02 Steve Lacey <sjl@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Implement basic media statistics on media elements.
+ https://bugs.webkit.org/show_bug.cgi?id=53322
+
+ * configure.ac:
+
+2011-02-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fixes for wxWebKit.
+
+ * wscript:
+
+2010-01-28 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-01-28 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-01-28 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2011-01-31 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] REGRESSION: http/tests/media/video-{cookie,referer}.html failing
+ https://bugs.webkit.org/show_bug.cgi?id=53379
+
+ Remove left over mentions of HAVE_SOUP_2_29_90, and apply the
+ dependency on newer soup to efl as well.
+
+ * Source/cmake/OptionsEfl.cmake:
+
+2011-01-29 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Remove reference to ${CMAKE_SOURCE_DIR}/Source in CMake files
+ https://bugs.webkit.org/show_bug.cgi?id=53382
+
+ Our file system hierarchy ensures that CMAKE_SOURCE_DIR is defined to be /Source.
+ So, ${CMAKE_SOURCE_DIR}/Source evaluates to the non-existent directory /Source/Source.
+ Therefore, we should remove such references.
+
+ * Source/cmake/OptionsCommon.cmake:
+
+2011-01-29 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Eric Seidel.
+
+ Move wince/mt19937ar.c to ThirdParty and make it a policy choice
+ https://bugs.webkit.org/show_bug.cgi?id=53253
+
+ Move implementation of Mersenne Twister pseudorandom number generator to
+ ThirdParty since it is a third party library.
+
+ * Source/ThirdParty/mt19937ar.c: Copied from Source/JavaScriptCore/wtf/wince/mt19937ar.c.
+
+2011-01-29 Dan Winship <danw@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Require the latest glib and libsoup, and remove conditional
+ support for older versions
+ https://bugs.webkit.org/show_bug.cgi?id=50675
+
+ * autotools/webkit.m4: use AM_PATH_GLIB_2_0 rather than doing
+ basically the same work by hand
+ * configure.ac:
+
+2011-01-28 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] Build failure with --enable-indexed-database
+ https://bugs.webkit.org/show_bug.cgi?id=50954
+
+ Build fix for IndexedDB support.
+
+ * configure.ac: Change the autogen.sh option --enable-indexeddb to
+ --enable-indexed-database to match the build-webkit option.
+
+2010-01-28 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-01-28 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2011-01-26 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt][Symbian] Fix --minimal build
+ https://bugs.webkit.org/show_bug.cgi?id=52839
+
+ Move definition of USE_SYSTEM_MALLOC out of pri file.
+ Put it in platform.h instead.
+
+ * Source/WebKit.pri:
+
+2011-01-26 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Fix qt_minimal build
+ https://bugs.webkit.org/show_bug.cgi?id=53172
+
+ * Source/WebKit.pri:
+
+2011-01-25 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Move main CMakeLists.txt into Source directory
+ https://bugs.webkit.org/show_bug.cgi?id=52888
+
+ * CMakeLists.txt: Removed.
+ * Source/CMakeLists.txt: Copied from CMakeLists.txt.
+ * Source/cmakeconfig.h.cmake: Copied from cmakeconfig.h.cmake.
+ * cmakeconfig.h.cmake: Removed.
+
+2011-01-24 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Change ENABLE_3D_CANVAS to ENABLE_WEBGL
+ https://bugs.webkit.org/show_bug.cgi?id=53041
+
+ * configure.ac:
+
+2011-01-24 Peter Gal <galpeter@inf.u-szeged.hu>
+
+ Rubber-stamped by Csaba Osztrogonác.
+
+ * runtime: Removed. It was accidentally created by r76457.
+
+2011-01-24 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Move project files into Source
+ https://bugs.webkit.org/show_bug.cgi?id=52891
+
+ * Source/DerivedSources.pro: Copied from DerivedSources.pro.
+ * Source/WebKit.pri: Renamed from WebKit.pri.
+ * Source/WebKit.pro: Added.
+ * Source/common.pri: Renamed from common.pri.
+ * WebKit.pro: Removed.
+
+2011-01-20 Siddharth Mathur <siddharth.mathur@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt][Symbian] Smaller debug symbol size when using RVCT 4.x
+ https://bugs.webkit.org/show_bug.cgi?id=52835
+
+ * WebKit.pri: Use --remove_unneeded_entities for RVCT 4.x compilers
+
+2011-01-20 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Andreas Kling.
+
+ [GTK] Fix typo in the webkit2 section of the configure.ac file
+ https://bugs.webkit.org/show_bug.cgi?id=52801
+
+ Fixed typo in the GTK WebKit2 compilation.
+
+ * configure.ac:
+
+2011-01-19 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ Enable usage of Google ld if it exist but is not on by default.
+
+ [Qt] Enable the google ld if it exist but is not on by default
+ https://bugs.webkit.org/show_bug.cgi?id=52625
+
+ * common.pri: flip the test.
+
+2011-01-18 Mihai Parparita <mihaip@chromium.org>
+
+ Unreviewed. Update .gitignore to reflect that WebKit is now in Source.
+
+ * .gitignore:
+
+2011-01-18 Krithigassree Sambamurthy <krithigassree.sambamurthy@nokia.com>
+
+ Reviewed by Simon Fraser.
+
+ Support background-clip: content-box
+ https://bugs.webkit.org/show_bug.cgi?id=48771
+
+ Addded content-box as a valid background-clip value.
+
+ * WebCore/css/CSSParser.cpp:
+ (WebCore::parseBackgroundClip):
+
+2011-01-18 Hayato Ito <hayato@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ Update .gitignore file to reflect a recent WebKit directory movement.
+
+ https://bugs.webkit.org/show_bug.cgi?id=52618
+
+ * .gitignore:
+
+2011-01-16 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move WebKit into Source
+ https://bugs.webkit.org/show_bug.cgi?id=52530
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * DerivedSources.pro:
+ * GNUmakefile.am:
+ * Makefile:
+ * WebKit.pri:
+ * WebKit.pro:
+ * configure.ac:
+ * wscript:
+
+2011-01-15 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move WebKit2 into Source
+ https://bugs.webkit.org/show_bug.cgi?id=52438
+
+ Update reference to WebKit2.
+
+ * DerivedSources.pro:
+ * GNUmakefile.am:
+ * Makefile:
+ * Source/cmake/WebKitPackaging.cmake:
+ * WebKit.pro:
+ * configure.ac:
+
+2011-01-14 Ahmad Sharif <asharif.tools@gmail.com>
+
+ Reviewed by Darin Fisher.
+
+ When inlining is performed, the progress variable is
+ declared as uninitialized.
+ https://bugs.webkit.org/show_bug.cgi?id=51084
+
+ * WebCore: Copied from WebCore.
+ * WebCore/page/animation/KeyframeAnimation.cpp:
+ (WebCore::KeyframeAnimation::animate):
+ (WebCore::KeyframeAnimation::getAnimatedStyle):
+
+2011-01-11 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Add QT_NO_CONCURRENT to the qt_minimal configuration
+ https://bugs.webkit.org/show_bug.cgi?id=52223
+
+ Add QT_NO_CONCURRENT to the qt_minimal configuration to make sure
+ that QtWebKit builds with QT_NO_CONCURRENT defined.
+
+ * WebKit.pri:
+
+2011-01-11 Mihai Parparita <mihaip@chromium.org>
+
+ Unreviewed. Update .gitignore with new Chromium dependency.
+
+ ui/ was added with http://crrev.com/70743, we picked that up with a
+ Chromium roll in r75311.
+
+ Also alphabetizes the dependency list.
+
+ * .gitignore:
+
+2011-01-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Baseline qt_minimal configuration
+ https://bugs.webkit.org/show_bug.cgi?id=51313
+
+ * WebKit.pri: List the supported QT_NO_FEATURE flags
+ under qt_minimal configuration.
+
+2011-01-10 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Reviewed by Eric Seidel.
+
+ [EFL] Enable JIT for WebKit EFL
+ https://bugs.webkit.org/show_bug.cgi?id=52140
+
+ Enable JIT option for WebKit EFL. Enabled JIT's JS performance is
+ 3 ~ 6 times faster than before.
+
+ * Source/cmake/OptionsEfl.cmake:
+
+2011-01-10 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Bump the WebKitGTK+ versions in preparation for development release.
+
+ * configure.ac: Bump the library, libtool and user agent version.
+
+2011-01-10 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Create intermediate libWebCore library
+ https://bugs.webkit.org/show_bug.cgi?id=52116
+
+ * GNUmakefile.am: add XP_UNIX to the global CPP flags, since it's
+ used by both libWebCore and libwebkitgtk now.
+
+2011-01-08 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed wx build fix for r75313.
+
+ * wscript: Added missing brace.
+
+2011-01-07 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move WebCore to Source
+ https://bugs.webkit.org/show_bug.cgi?id=52050
+
+ Update build files and metadata to point to WebCore's new location.
+
+ * .gitattributes:
+ * .gitignore:
+ * Android.mk:
+ * CMakeLists.txt:
+ * DerivedSources.pro:
+ * GNUmakefile.am:
+ * Makefile:
+ * Source/autotools/webkit.m4:
+ * Source/cmake/OptionsEfl.cmake:
+ * WebKit.pri:
+ * WebKit.pro:
+ * configure.ac:
+ * wscript:
+
+2011-01-06 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Eric Seidel.
+
+ [GTK] Initial build support for WebGL
+ https://bugs.webkit.org/show_bug.cgi?id=51716
+
+ * configure.ac: Add a configure option for WebGL.
+
+2011-01-06 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Enhancement: Add Regexp Debug Compare between JIT and Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=51834
+
+ * JavaScriptCore: Copied from JavaScriptCore.
+
+2011-01-06 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Enable blob support by default
+ https://bugs.webkit.org/show_bug.cgi?id=51994
+
+ * configure.ac: Enable Blob support by default.
+
+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
+
+ * Source/cmake/WebKitMacros.cmake:
+
+2011-01-05 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [WINCE] Remove CMake warning
+ https://bugs.webkit.org/show_bug.cgi?id=51921
+
+ * Source/cmake/WebKitHelpers.cmake:
+
+2011-01-04 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by David Levin.
+
+ .gitignore should be updated to reflect Sources rename to Source
+ https://bugs.webkit.org/show_bug.cgi?id=51893
+
+ * .gitignore: Change all paths that reference the "Sources" directory to say "Source".
+
+2011-01-04 Dihan Wickremasuriya <dihan.wickremasuriya@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] [Symbian] Build system cleanup
+
+ After r74811 special handling for the Symbian build is no longer needed.
+ This patch reverts r58756.
+
+ * WebKit.pri:
+
+2011-01-03 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ * autogen.sh: also pass $ACLOCAL_FLAGS for tools that set that env
+ variable (like jhbuild).
+
+2011-01-03 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ [WINCE] Provide third party directory via environment variable
+ https://bugs.webkit.org/show_bug.cgi?id=51643
+
+ * Source/cmake/OptionsWinCE.cmake:
+
+2011-01-03 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Use autoreconf instead of calling manually all the usual commands.
+
+ * autogen.sh: call autoreconf instead of
+ aclocal/autoheader/autoconf/automake/libtoolize.
+
+2011-01-03 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Disable superfluous GNU make built-in implicit rules
+ https://bugs.webkit.org/show_bug.cgi?id=51826
+
+ GNU make ships some superflous built-in rules that we never use
+ and that end up adding up to a very significant portion of our
+ total Makefile processing time. Disable them completely by
+ defining the rule without any recipe, as suggested by the GNU make
+ manual (10.5.6, Cancelling Implicit Rules).
+
+ In my system the null-build goes from:
+
+ make 43.51s user 12.77s system 99% cpu 56.628 total
+
+ to:
+
+ make 31.45s user 11.59s system 99% cpu 43.227 total
+
+ * GNUmakefile.am: disable implicit built-in rules.
+
+2011-01-03 Mihai Parparita <mihaip@chromium.org>
+
+ Unreviewed. Update .gitignore with new JavaScriptCore location.
+
+ * .gitignore:
+
+2011-01-02 Patrick Gansterer <paroga@webkit.org>
+
+ [CMake] Unreviewed build fix.
+
+ * CMakeLists.txt:
+ * Source/cmake/OptionsCommon.cmake:
+
+2011-01-01 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move JavaScriptCore to Source
+ https://bugs.webkit.org/show_bug.cgi?id=51604
+
+ Update references to JavaScriptCore to point to the new location.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * DerivedSources.pro:
+ * GNUmakefile.am:
+ * Makefile:
+ * WebKit.pri:
+ * WebKit.pro:
+ * wscript:
+
+2011-01-01 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move Sources to Source
+ https://bugs.webkit.org/show_bug.cgi?id=51794
+
+ Update build files to point to the new location.
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * Makefile:
+ * autogen.sh:
+ * configure.ac:
+
+2010-12-31 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move HTML and XML parser benchmarks into PerformanceTests/Parser
+ https://bugs.webkit.org/show_bug.cgi?id=51772
+
+ Actually move the directory.
+
+ * PerformanceTests/Parser: Copied from WebCore/benchmarks/parser.
+
+2010-12-31 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move PageLoadTests to PerformanceTests/PageLoad
+ https://bugs.webkit.org/show_bug.cgi?id=51771
+
+ Actually move the directory.
+
+ * PageLoadTests: Removed.
+ * PageLoadTests/svg: Removed.
+ * PageLoadTests/svg/LICENSES: Removed.
+ * PageLoadTests/svg/files: Removed.
+ * PageLoadTests/svg/files/33041-Samurai.svg: Removed.
+ * PageLoadTests/svg/files/42450-under the see.svg: Removed.
+ * PageLoadTests/svg/files/42470-flower_from_my_garden_v2.svg: Removed.
+ * PageLoadTests/svg/files/44057-drops on a blade.svg: Removed.
+ * PageLoadTests/svg/files/Harvey_Rayner.svg: Removed.
+ * PageLoadTests/svg/files/az-lizard_benji_park_01.svg: Removed.
+ * PageLoadTests/svg/files/bamboo_01.svg: Removed.
+ * PageLoadTests/svg/files/cacuts_01.svg: Removed.
+ * PageLoadTests/svg/files/cowboy.svg: Removed.
+ * PageLoadTests/svg/files/crawfish2_ganson.svg: Removed.
+ * PageLoadTests/svg/files/deb9frac1.svg: Removed.
+ * PageLoadTests/svg/files/food_leif_lodahl_01.svg: Removed.
+ * PageLoadTests/svg/files/france.svg: Removed.
+ * PageLoadTests/svg/files/francobollo_gnome_ezechi_02.svg: Removed.
+ * PageLoadTests/svg/files/gearflowers.svg: Removed.
+ * PageLoadTests/svg/files/hereGear4.svg: Removed.
+ * PageLoadTests/svg/files/mtsthelens.svg: Removed.
+ * PageLoadTests/svg/files/mtsthelens0.jpg: Removed.
+ * PageLoadTests/svg/files/world-iso.svg: Removed.
+ * PageLoadTests/svg/files/worldcup.svg: Removed.
+ * PageLoadTests/svg/svg.pltsuite: Removed.
+ * PerformanceTests/PageLoad: Copied from PageLoadTests.
+ * Sources/cmake/WebKitPackaging.cmake:
+
+2010-12-31 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move SunSpider into PerformanceTests
+ https://bugs.webkit.org/show_bug.cgi?id=51769
+
+ Actually move the directory.
+
+ * PerformanceTests: Added.
+ * PerformanceTests/SunSpider: Copied from SunSpider.
+ * Sources/cmake/WebKitPackaging.cmake:
+ * SunSpider: Removed.
+ * SunSpider/SunSpider.make: Removed.
+ * SunSpider/TODO: Removed.
+ * SunSpider/UNCOVERED: Removed.
+ * SunSpider/hosted: Removed.
+ * SunSpider/hosted/json2.js: Removed.
+ * SunSpider/hosted/sunspider.css: Removed.
+ * SunSpider/hosted/sunspider.html: Removed.
+ * SunSpider/hosted/versions.html: Removed.
+ * SunSpider/make-hosted: Removed.
+ * SunSpider/resources: Removed.
+ * SunSpider/resources/TEMPLATE.html: Removed.
+ * SunSpider/resources/driver-TEMPLATE.html: Removed.
+ * SunSpider/resources/results-TEMPLATE.html: Removed.
+ * SunSpider/resources/sunspider-analyze-results.js: Removed.
+ * SunSpider/resources/sunspider-compare-results.js: Removed.
+ * SunSpider/resources/sunspider-standalone-compare.js: Removed.
+ * SunSpider/resources/sunspider-standalone-driver.js: Removed.
+ * SunSpider/sunspider: Removed.
+ * SunSpider/sunspider-compare-results: Removed.
+ * SunSpider/tests: Removed.
+ * SunSpider/tests/parse-only: Removed.
+ * SunSpider/tests/parse-only/LIST: Removed.
+ * SunSpider/tests/parse-only/concat-jquery-mootools-prototype.js: Removed.
+ * SunSpider/tests/parse-only/jquery-1.3.2.js: Removed.
+ * SunSpider/tests/parse-only/mootools-1.2.2-core-nc.js: Removed.
+ * SunSpider/tests/parse-only/prototype-1.6.0.3.js: Removed.
+ * SunSpider/tests/sunspider-0.9: Removed.
+ * SunSpider/tests/sunspider-0.9.1: Removed.
+ * SunSpider/tests/sunspider-0.9.1/3d-cube.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/3d-morph.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/3d-raytrace.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/LIST: Removed.
+ * SunSpider/tests/sunspider-0.9.1/access-binary-trees.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/access-fannkuch.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/access-nbody.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/access-nsieve.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/bitops-3bit-bits-in-byte.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/bitops-bits-in-byte.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/bitops-bitwise-and.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/bitops-nsieve-bits.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/controlflow-recursive.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/crypto-aes.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/crypto-md5.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/crypto-sha1.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/date-format-tofte.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/date-format-xparb.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/math-cordic.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/math-partial-sums.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/math-spectral-norm.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/regexp-dna.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/string-base64.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/string-fasta.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/string-tagcloud.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/string-unpack-code.js: Removed.
+ * SunSpider/tests/sunspider-0.9.1/string-validate-input.js: Removed.
+ * SunSpider/tests/sunspider-0.9/3d-cube.js: Removed.
+ * SunSpider/tests/sunspider-0.9/3d-morph.js: Removed.
+ * SunSpider/tests/sunspider-0.9/3d-raytrace.js: Removed.
+ * SunSpider/tests/sunspider-0.9/LIST: Removed.
+ * SunSpider/tests/sunspider-0.9/access-binary-trees.js: Removed.
+ * SunSpider/tests/sunspider-0.9/access-fannkuch.js: Removed.
+ * SunSpider/tests/sunspider-0.9/access-nbody.js: Removed.
+ * SunSpider/tests/sunspider-0.9/access-nsieve.js: Removed.
+ * SunSpider/tests/sunspider-0.9/bitops-3bit-bits-in-byte.js: Removed.
+ * SunSpider/tests/sunspider-0.9/bitops-bits-in-byte.js: Removed.
+ * SunSpider/tests/sunspider-0.9/bitops-bitwise-and.js: Removed.
+ * SunSpider/tests/sunspider-0.9/bitops-nsieve-bits.js: Removed.
+ * SunSpider/tests/sunspider-0.9/controlflow-recursive.js: Removed.
+ * SunSpider/tests/sunspider-0.9/crypto-aes.js: Removed.
+ * SunSpider/tests/sunspider-0.9/crypto-md5.js: Removed.
+ * SunSpider/tests/sunspider-0.9/crypto-sha1.js: Removed.
+ * SunSpider/tests/sunspider-0.9/date-format-tofte.js: Removed.
+ * SunSpider/tests/sunspider-0.9/date-format-xparb.js: Removed.
+ * SunSpider/tests/sunspider-0.9/math-cordic.js: Removed.
+ * SunSpider/tests/sunspider-0.9/math-partial-sums.js: Removed.
+ * SunSpider/tests/sunspider-0.9/math-spectral-norm.js: Removed.
+ * SunSpider/tests/sunspider-0.9/regexp-dna.js: Removed.
+ * SunSpider/tests/sunspider-0.9/string-base64.js: Removed.
+ * SunSpider/tests/sunspider-0.9/string-fasta.js: Removed.
+ * SunSpider/tests/sunspider-0.9/string-tagcloud.js: Removed.
+ * SunSpider/tests/sunspider-0.9/string-unpack-code.js: Removed.
+ * SunSpider/tests/sunspider-0.9/string-validate-input.js: Removed.
+ * SunSpider/tests/ubench: Removed.
+ * SunSpider/tests/ubench/LIST: Removed.
+ * SunSpider/tests/ubench/function-closure.js: Removed.
+ * SunSpider/tests/ubench/function-correct-args.js: Removed.
+ * SunSpider/tests/ubench/function-empty.js: Removed.
+ * SunSpider/tests/ubench/function-excess-args.js: Removed.
+ * SunSpider/tests/ubench/function-missing-args.js: Removed.
+ * SunSpider/tests/ubench/function-sum.js: Removed.
+ * SunSpider/tests/ubench/loop-empty-resolve.js: Removed.
+ * SunSpider/tests/ubench/loop-empty.js: Removed.
+ * SunSpider/tests/ubench/loop-sum.js: Removed.
+ * SunSpider/tests/v8-v4: Removed.
+ * SunSpider/tests/v8-v4/LIST: Removed.
+ * SunSpider/tests/v8-v4/v8-crypto.js: Removed.
+ * SunSpider/tests/v8-v4/v8-deltablue.js: Removed.
+ * SunSpider/tests/v8-v4/v8-earley-boyer.js: Removed.
+ * SunSpider/tests/v8-v4/v8-raytrace.js: Removed.
+ * SunSpider/tests/v8-v4/v8-regexp.js: Removed.
+ * SunSpider/tests/v8-v4/v8-richards.js: Removed.
+ * SunSpider/tests/v8-v4/v8-splay.js: Removed.
+ * SunSpider/tests/v8-v5: Removed.
+ * SunSpider/tests/v8-v5/LIST: Removed.
+ * SunSpider/tests/v8-v5/v8-crypto.js: Removed.
+ * SunSpider/tests/v8-v5/v8-deltablue.js: Removed.
+ * SunSpider/tests/v8-v5/v8-earley-boyer.js: Removed.
+ * SunSpider/tests/v8-v5/v8-raytrace.js: Removed.
+ * SunSpider/tests/v8-v5/v8-regexp.js: Removed.
+ * SunSpider/tests/v8-v5/v8-richards.js: Removed.
+ * SunSpider/tests/v8-v5/v8-splay.js: Removed.
+ * SunSpider/tests/v8-v6: Removed.
+ * SunSpider/tests/v8-v6/LIST: Removed.
+ * SunSpider/tests/v8-v6/v8-crypto.js: Removed.
+ * SunSpider/tests/v8-v6/v8-deltablue.js: Removed.
+ * SunSpider/tests/v8-v6/v8-earley-boyer.js: Removed.
+ * SunSpider/tests/v8-v6/v8-raytrace.js: Removed.
+ * SunSpider/tests/v8-v6/v8-regexp.js: Removed.
+ * SunSpider/tests/v8-v6/v8-richards.js: Removed.
+ * SunSpider/tests/v8-v6/v8-splay.js: Removed.
+ * SunSpider/xcopy.excludes: Removed.
+
+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
+
+ * WebKit.pri: Replaced USE_SYSTEM_MALLOC with USE_SYSTEM_MALLOC=1
+
+2010-12-29 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] minimal build fails at link time due to missing sqlite3 symbols
+ https://bugs.webkit.org/show_bug.cgi?id=51327
+
+ * configure.ac: Error out if SQLite3 wasn't found while at least
+ one of the features depending on it has been enabled.
+
+2010-12-29 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed. Use gcc as default preprocessor.
+
+ * Sources/cmake/OptionsCommon.cmake:
+
+2010-12-27 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by David Levin.
+
+ [EFL] Change path of eflsymbols.filter
+ https://bugs.webkit.org/show_bug.cgi?id=51659
+
+ * Sources/cmake/OptionsEfl.cmake:
+
+2010-12-26 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Siedel.
+
+ Move autotools into Sources
+ https://bugs.webkit.org/show_bug.cgi?id=51630
+
+ * .gitignore:
+ * GNUmakefile.am:
+ * Sources/autotools: Copied from autotools.
+ * autogen.sh:
+ * autotools: Removed.
+ * autotools/acinclude.m4: Removed.
+ * autotools/dolt.m4: Removed.
+ * autotools/gsettings.m4: Removed.
+ * autotools/symbols.filter: Removed.
+ * autotools/webkit.m4: Removed.
+ * configure.ac:
+
+2010-12-26 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move cmake into Sources
+ https://bugs.webkit.org/show_bug.cgi?id=51631
+
+ * CMakeLists.txt:
+ * Sources/cmake: Copied from cmake.
+ * cmake: Removed.
+ * cmake/FindCFLite.cmake: Removed.
+ * cmake/FindCairo.cmake: Removed.
+ * cmake/FindEFL.cmake: Removed.
+ * cmake/FindFontconfig.cmake: Removed.
+ * cmake/FindFreetype.cmake: Removed.
+ * cmake/FindGDK-PixBuf.cmake: Removed.
+ * cmake/FindGDK.cmake: Removed.
+ * cmake/FindGIO.cmake: Removed.
+ * cmake/FindGStreamer-App.cmake: Removed.
+ * cmake/FindGStreamer-Base.cmake: Removed.
+ * cmake/FindGStreamer-Interfaces.cmake: Removed.
+ * cmake/FindGStreamer-Pbutils.cmake: Removed.
+ * cmake/FindGStreamer-Plugins-Base.cmake: Removed.
+ * cmake/FindGStreamer-Video.cmake: Removed.
+ * cmake/FindGStreamer.cmake: Removed.
+ * cmake/FindGlib.cmake: Removed.
+ * cmake/FindGperf.cmake: Removed.
+ * cmake/FindGthread.cmake: Removed.
+ * cmake/FindICU.cmake: Removed.
+ * cmake/FindLibSoup2.cmake: Removed.
+ * cmake/FindLibXlst.cmake: Removed.
+ * cmake/FindPango.cmake: Removed.
+ * cmake/FindSqlite.cmake: Removed.
+ * cmake/LibFindMacros.cmake: Removed.
+ * cmake/OptionsCommon.cmake: Removed.
+ * cmake/OptionsEfl.cmake: Removed.
+ * cmake/OptionsWinCE.cmake: Removed.
+ * cmake/OptionsWindows.cmake: Removed.
+ * cmake/WebKitEfl.cmake: Removed.
+ * cmake/WebKitFS.cmake: Removed.
+ * cmake/WebKitFeatures.cmake: Removed.
+ * cmake/WebKitHelpers.cmake: Removed.
+ * cmake/WebKitMacros.cmake: Removed.
+ * cmake/WebKitPackaging.cmake: Removed.
+ * cmake/eflsymbols.filter: Removed.
+
+2010-12-26 Adam Barth <abarth@webkit.org>
+
+ Fix some references to the old location of the WebKit website in git
+ metadata files.
+
+ * .gitattributes:
+
+2010-12-25 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move ANGLE to Sources/ThirdParty
+ https://bugs.webkit.org/show_bug.cgi?id=51605
+
+ Actually move ANGLE and update the Makefile.
+
+ * ANGLE: Removed.
+ * ANGLE/ANGLE.xcodeproj: Removed.
+ * ANGLE/ANGLE.xcodeproj/project.pbxproj: Removed.
+ * ANGLE/Configurations: Removed.
+ * ANGLE/Configurations/ANGLE.xcconfig: Removed.
+ * ANGLE/Configurations/Base.xcconfig: Removed.
+ * ANGLE/Configurations/DebugRelease.xcconfig: Removed.
+ * ANGLE/Makefile: Removed.
+ * ANGLE/include: Removed.
+ * ANGLE/include/EGL: Removed.
+ * ANGLE/include/EGL/egl.h: Removed.
+ * ANGLE/include/EGL/eglext.h: Removed.
+ * ANGLE/include/EGL/eglplatform.h: Removed.
+ * ANGLE/include/GLES2: Removed.
+ * ANGLE/include/GLES2/gl2.h: Removed.
+ * ANGLE/include/GLES2/gl2ext.h: Removed.
+ * ANGLE/include/GLES2/gl2platform.h: Removed.
+ * ANGLE/include/GLSLANG: Removed.
+ * ANGLE/include/GLSLANG/ShaderLang.h: Removed.
+ * ANGLE/include/KHR: Removed.
+ * ANGLE/include/KHR/khrplatform.h: Removed.
+ * ANGLE/src: Removed.
+ * ANGLE/src/build_angle.xcodeproj: Removed.
+ * ANGLE/src/build_angle.xcodeproj/project.pbxproj: Removed.
+ * ANGLE/src/common: Removed.
+ * ANGLE/src/common/angleutils.h: Removed.
+ * ANGLE/src/common/debug.cpp: Removed.
+ * ANGLE/src/common/debug.h: Removed.
+ * ANGLE/src/compiler: Removed.
+ * ANGLE/src/compiler/BaseTypes.h: Removed.
+ * ANGLE/src/compiler/CodeGenGLSL.cpp: Removed.
+ * ANGLE/src/compiler/CodeGenHLSL.cpp: Removed.
+ * ANGLE/src/compiler/Common.h: Removed.
+ * ANGLE/src/compiler/ConstantUnion.h: Removed.
+ * ANGLE/src/compiler/InfoSink.cpp: Removed.
+ * ANGLE/src/compiler/InfoSink.h: Removed.
+ * ANGLE/src/compiler/Initialize.cpp: Removed.
+ * ANGLE/src/compiler/Initialize.h: Removed.
+ * ANGLE/src/compiler/InitializeDll.cpp: Removed.
+ * ANGLE/src/compiler/InitializeDll.h: Removed.
+ * ANGLE/src/compiler/InitializeGlobals.h: Removed.
+ * ANGLE/src/compiler/InitializeParseContext.h: Removed.
+ * ANGLE/src/compiler/IntermTraverse.cpp: Removed.
+ * ANGLE/src/compiler/Intermediate.cpp: Removed.
+ * ANGLE/src/compiler/MMap.h: Removed.
+ * ANGLE/src/compiler/OutputGLSL.cpp: Removed.
+ * ANGLE/src/compiler/OutputGLSL.h: Removed.
+ * ANGLE/src/compiler/OutputHLSL.cpp: Removed.
+ * ANGLE/src/compiler/OutputHLSL.h: Removed.
+ * ANGLE/src/compiler/ParseHelper.cpp: Removed.
+ * ANGLE/src/compiler/ParseHelper.h: Removed.
+ * ANGLE/src/compiler/PoolAlloc.cpp: Removed.
+ * ANGLE/src/compiler/PoolAlloc.h: Removed.
+ * ANGLE/src/compiler/QualifierAlive.cpp: Removed.
+ * ANGLE/src/compiler/QualifierAlive.h: Removed.
+ * ANGLE/src/compiler/RemoveTree.cpp: Removed.
+ * ANGLE/src/compiler/RemoveTree.h: Removed.
+ * ANGLE/src/compiler/ShHandle.h: Removed.
+ * ANGLE/src/compiler/ShaderLang.cpp: Removed.
+ * ANGLE/src/compiler/SymbolTable.cpp: Removed.
+ * ANGLE/src/compiler/SymbolTable.h: Removed.
+ * ANGLE/src/compiler/TranslatorGLSL.cpp: Removed.
+ * ANGLE/src/compiler/TranslatorGLSL.h: Removed.
+ * ANGLE/src/compiler/TranslatorHLSL.cpp: Removed.
+ * ANGLE/src/compiler/TranslatorHLSL.h: Removed.
+ * ANGLE/src/compiler/Types.h: Removed.
+ * ANGLE/src/compiler/UnfoldSelect.cpp: Removed.
+ * ANGLE/src/compiler/UnfoldSelect.h: Removed.
+ * ANGLE/src/compiler/debug.cpp: Removed.
+ * ANGLE/src/compiler/debug.h: Removed.
+ * ANGLE/src/compiler/glslang.l: Removed.
+ * ANGLE/src/compiler/glslang.y: Removed.
+ * ANGLE/src/compiler/intermOut.cpp: Removed.
+ * ANGLE/src/compiler/intermediate.h: Removed.
+ * ANGLE/src/compiler/localintermediate.h: Removed.
+ * ANGLE/src/compiler/osinclude.h: Removed.
+ * ANGLE/src/compiler/ossource_posix.cpp: Removed.
+ * ANGLE/src/compiler/ossource_win.cpp: Removed.
+ * ANGLE/src/compiler/parseConst.cpp: Removed.
+ * ANGLE/src/compiler/preprocessor: Removed.
+ * ANGLE/src/compiler/preprocessor/atom.c: Removed.
+ * ANGLE/src/compiler/preprocessor/atom.h: Removed.
+ * ANGLE/src/compiler/preprocessor/compile.h: Removed.
+ * ANGLE/src/compiler/preprocessor/cpp.c: Removed.
+ * ANGLE/src/compiler/preprocessor/cpp.h: Removed.
+ * ANGLE/src/compiler/preprocessor/cppstruct.c: Removed.
+ * ANGLE/src/compiler/preprocessor/memory.c: Removed.
+ * ANGLE/src/compiler/preprocessor/memory.h: Removed.
+ * ANGLE/src/compiler/preprocessor/parser.h: Removed.
+ * ANGLE/src/compiler/preprocessor/preprocess.h: Removed.
+ * ANGLE/src/compiler/preprocessor/scanner.c: Removed.
+ * ANGLE/src/compiler/preprocessor/scanner.h: Removed.
+ * ANGLE/src/compiler/preprocessor/slglobals.h: Removed.
+ * ANGLE/src/compiler/preprocessor/symbols.c: Removed.
+ * ANGLE/src/compiler/preprocessor/symbols.h: Removed.
+ * ANGLE/src/compiler/preprocessor/tokens.c: Removed.
+ * ANGLE/src/compiler/preprocessor/tokens.h: Removed.
+ * ANGLE/src/compiler/tools: Removed.
+ * ANGLE/src/compiler/unistd.h: Removed.
+ * ANGLE/src/libEGL: Removed.
+ * ANGLE/src/libEGL/Config.cpp: Removed.
+ * ANGLE/src/libEGL/Config.h: Removed.
+ * ANGLE/src/libEGL/Display.cpp: Removed.
+ * ANGLE/src/libEGL/Display.h: Removed.
+ * ANGLE/src/libEGL/Surface.cpp: Removed.
+ * ANGLE/src/libEGL/Surface.h: Removed.
+ * ANGLE/src/libEGL/libEGL.cpp: Removed.
+ * ANGLE/src/libEGL/libEGL.def: Removed.
+ * ANGLE/src/libEGL/libEGL.vcproj: Removed.
+ * ANGLE/src/libEGL/main.cpp: Removed.
+ * ANGLE/src/libEGL/main.h: Removed.
+ * ANGLE/src/libGLESv2: Removed.
+ * ANGLE/src/libGLESv2/Blit.cpp: Removed.
+ * ANGLE/src/libGLESv2/Blit.h: Removed.
+ * ANGLE/src/libGLESv2/Buffer.cpp: Removed.
+ * ANGLE/src/libGLESv2/Buffer.h: Removed.
+ * ANGLE/src/libGLESv2/Context.cpp: Removed.
+ * ANGLE/src/libGLESv2/Context.h: Removed.
+ * ANGLE/src/libGLESv2/Framebuffer.cpp: Removed.
+ * ANGLE/src/libGLESv2/Framebuffer.h: Removed.
+ * ANGLE/src/libGLESv2/Program.cpp: Removed.
+ * ANGLE/src/libGLESv2/Program.h: Removed.
+ * ANGLE/src/libGLESv2/RefCountObject.cpp: Removed.
+ * ANGLE/src/libGLESv2/RefCountObject.h: Removed.
+ * ANGLE/src/libGLESv2/Renderbuffer.cpp: Removed.
+ * ANGLE/src/libGLESv2/Renderbuffer.h: Removed.
+ * ANGLE/src/libGLESv2/ResourceManager.cpp: Removed.
+ * ANGLE/src/libGLESv2/ResourceManager.h: Removed.
+ * ANGLE/src/libGLESv2/Shader.cpp: Removed.
+ * ANGLE/src/libGLESv2/Shader.h: Removed.
+ * ANGLE/src/libGLESv2/Texture.cpp: Removed.
+ * ANGLE/src/libGLESv2/Texture.h: Removed.
+ * ANGLE/src/libGLESv2/geometry: Removed.
+ * ANGLE/src/libGLESv2/geometry/IndexDataManager.cpp: Removed.
+ * ANGLE/src/libGLESv2/geometry/IndexDataManager.h: Removed.
+ * ANGLE/src/libGLESv2/geometry/VertexDataManager.cpp: Removed.
+ * ANGLE/src/libGLESv2/geometry/VertexDataManager.h: Removed.
+ * ANGLE/src/libGLESv2/geometry/backend.cpp: Removed.
+ * ANGLE/src/libGLESv2/geometry/backend.h: Removed.
+ * ANGLE/src/libGLESv2/geometry/dx9.cpp: Removed.
+ * ANGLE/src/libGLESv2/geometry/dx9.h: Removed.
+ * ANGLE/src/libGLESv2/geometry/vertexconversion.h: Removed.
+ * ANGLE/src/libGLESv2/libGLESv2.cpp: Removed.
+ * ANGLE/src/libGLESv2/libGLESv2.def: Removed.
+ * ANGLE/src/libGLESv2/libGLESv2.vcproj: Removed.
+ * ANGLE/src/libGLESv2/main.cpp: Removed.
+ * ANGLE/src/libGLESv2/main.h: Removed.
+ * ANGLE/src/libGLESv2/mathutil.h: Removed.
+ * ANGLE/src/libGLESv2/utilities.cpp: Removed.
+ * ANGLE/src/libGLESv2/utilities.h: Removed.
+ * Makefile:
+ * Sources/ThirdParty: Added.
+ * Sources/ThirdParty/ANGLE: Copied from ANGLE.
+
+2010-12-26 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed WinCE buildfix after r74626.
+
+ * cmake/OptionsWinCE.cmake:
+
+2010-12-24 Darin Adler <darin@apple.com>
+
+ Updated makefiles used by Apple engineers to fix build with the
+ new JavaScriptGlue location.
+
+ * Makefile: Told this to build JavaScriptGlue. Some day we might
+ want it to descend into Sources instead and use the Makefile there,
+ but there are problems with sequencing the project builds, so that
+ can wait.
+ * Sources/Makefile.shared: Added.
+
+2010-12-24 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [EFL] Add option to enable Touch Events.
+ https://bugs.webkit.org/show_bug.cgi?id=49125
+
+ Add ENABLE_TOUCH_EVENTS option.
+
+ * cmake/OptionsEfl.cmake:
+ * cmakeconfig.h.cmake:
+
+2010-12-23 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move JavaScriptGlue into Sources
+ https://bugs.webkit.org/show_bug.cgi?id=51583
+
+ Actually perform the move.
+
+ * JavaScriptGlue: Removed.
+ * JavaScriptGlue/Configurations: Removed.
+ * JavaScriptGlue/Configurations/Base.xcconfig: Removed.
+ * JavaScriptGlue/Configurations/DebugRelease.xcconfig: Removed.
+ * JavaScriptGlue/Configurations/JavaScriptGlue.xcconfig: Removed.
+ * JavaScriptGlue/Configurations/Version.xcconfig: Removed.
+ * JavaScriptGlue/English.lproj: Removed.
+ * JavaScriptGlue/English.lproj/InfoPlist.strings: Removed.
+ * JavaScriptGlue/ForwardingHeaders: Removed.
+ * JavaScriptGlue/ForwardingHeaders/masm: Removed.
+ * JavaScriptGlue/ForwardingHeaders/masm/X86Assembler.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/profiler: Removed.
+ * JavaScriptGlue/ForwardingHeaders/profiler/Profiler.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/runtime: Removed.
+ * JavaScriptGlue/ForwardingHeaders/runtime/CallFrame.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/ASCIICType.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/AlwaysInline.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Assertions.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Atomics.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Bitmap.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/BumpPointerAllocator.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/CrossThreadRefCounted.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/CurrentTime.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/DateInstanceCache.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/DateMath.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/FastAllocBase.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/FastMalloc.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/FixedArray.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Forward.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/HashCountedSet.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/HashFunctions.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/HashMap.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/HashSet.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/HashTraits.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/ListHashSet.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/ListRefPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Locker.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/MainThread.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/MathExtras.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Noncopyable.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/NotFound.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/OSAllocator.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/OwnArrayPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/OwnArrayPtrCommon.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/OwnFastMallocPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/OwnPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/OwnPtrCommon.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PageAllocation.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PageAllocationAligned.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PageBlock.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PageReservation.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PassOwnArrayPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PassOwnPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PassRefPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Platform.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PossiblyNull.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/PtrAndFlags.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/RandomNumber.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/RefCounted.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/RefPtr.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/StackBounds.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/StdLibExtras.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/StringHasher.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/ThreadSafeShared.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/ThreadSpecific.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Threading.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/ThreadingPrimitives.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/UnusedParam.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/VMTags.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/ValueCheck.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/Vector.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/VectorTraits.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/WTFThreadData.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/text: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/text/CString.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/text/StringHash.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/text/StringImpl.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/text/StringImplBase.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/text/TextPosition.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/text/WTFString.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/unicode: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/unicode/Unicode.h: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/unicode/icu: Removed.
+ * JavaScriptGlue/ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h: Removed.
+ * JavaScriptGlue/Info.plist: Removed.
+ * JavaScriptGlue/JSBase.cpp: Removed.
+ * JavaScriptGlue/JSBase.h: Removed.
+ * JavaScriptGlue/JSObject.cpp: Removed.
+ * JavaScriptGlue/JSObject.h: Removed.
+ * JavaScriptGlue/JSRun.cpp: Removed.
+ * JavaScriptGlue/JSRun.h: Removed.
+ * JavaScriptGlue/JSUtils.cpp: Removed.
+ * JavaScriptGlue/JSUtils.h: Removed.
+ * JavaScriptGlue/JSValueWrapper.cpp: Removed.
+ * JavaScriptGlue/JSValueWrapper.h: Removed.
+ * JavaScriptGlue/JavaScriptGlue.cpp: Removed.
+ * JavaScriptGlue/JavaScriptGlue.exp: Removed.
+ * JavaScriptGlue/JavaScriptGlue.h: Removed.
+ * JavaScriptGlue/JavaScriptGlue.xcodeproj: Removed.
+ * JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj: Removed.
+ * JavaScriptGlue/LICENSE: Removed.
+ * JavaScriptGlue/Makefile: Removed.
+ * JavaScriptGlue/UserObjectImp.cpp: Removed.
+ * JavaScriptGlue/UserObjectImp.h: Removed.
+ * JavaScriptGlue/config.h: Removed.
+ * JavaScriptGlue/icu: Removed.
+ * JavaScriptGlue/icu/LICENSE: Removed.
+ * JavaScriptGlue/icu/README: Removed.
+ * JavaScriptGlue/icu/unicode: Removed.
+ * JavaScriptGlue/icu/unicode/platform.h: Removed.
+ * JavaScriptGlue/icu/unicode/putil.h: Removed.
+ * JavaScriptGlue/icu/unicode/uchar.h: Removed.
+ * JavaScriptGlue/icu/unicode/ucnv.h: Removed.
+ * JavaScriptGlue/icu/unicode/ucnv_err.h: Removed.
+ * JavaScriptGlue/icu/unicode/uconfig.h: Removed.
+ * JavaScriptGlue/icu/unicode/uenum.h: Removed.
+ * JavaScriptGlue/icu/unicode/uiter.h: Removed.
+ * JavaScriptGlue/icu/unicode/umachine.h: Removed.
+ * JavaScriptGlue/icu/unicode/urename.h: Removed.
+ * JavaScriptGlue/icu/unicode/ustring.h: Removed.
+ * JavaScriptGlue/icu/unicode/utf.h: Removed.
+ * JavaScriptGlue/icu/unicode/utf16.h: Removed.
+ * JavaScriptGlue/icu/unicode/utf8.h: Removed.
+ * JavaScriptGlue/icu/unicode/utf_old.h: Removed.
+ * JavaScriptGlue/icu/unicode/utypes.h: Removed.
+ * JavaScriptGlue/icu/unicode/uversion.h: Removed.
+ * JavaScriptGlue/testjsglue.cpp: Removed.
+ * Makefile:
+ * Sources: Added.
+ * Sources/JavaScriptGlue: Copied from JavaScriptGlue.
+ * Sources/Makefile: Added.
+
+2010-12-23 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [EFL] Fix ContextMenu removal
+ https://bugs.webkit.org/show_bug.cgi?id=51530
+
+ Fix ContextMenu removal
+
+ In r74207 the support for ContextMenu was removed from EFL while the
+ code is being ported to the new CROSS_PLATFORM_MENUS due to build
+ breakage. However there were some missing removals in the shutdown
+ logic that introduced a bug, leading to a segmentation fault when
+ ContexController was destroyed.
+
+ The best way to effectively disable the ContextMenu is to conditionally
+ compile the meaningful stuff by surrounding with "#if
+ ENABLE(CONTEXT_MENUS)" and then disabling it in CMake.
+
+ * cmake/OptionsEfl.cmake: Disable ContextMenu and don't pretend we
+ implement CROSS_PLATFORM_MENUS yet.
+
+2010-12-22 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ * configure.ac: bump version to 1.3.9.
+
+2010-12-22 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Compilation fixes with GTK+ 2.91.7
+ https://bugs.webkit.org/show_bug.cgi?id=51487
+
+ * configure.ac: depend on GTK+ 2.91.7 when using GTK+ 3.x.
+
+2010-12-22 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Sets default user agent
+ https://bugs.webkit.org/show_bug.cgi?id=47903
+
+ Add macros for WebKit EFL and User Agent.
+
+ * cmake/OptionsEfl.cmake:
+ * cmakeconfig.h.cmake:
+
+2010-12-20 Adam Barth <abarth@webkit.org>
+
+ Move web sites to Websites directory
+ https://bugs.webkit.org/show_bug.cgi?id=51323
+
+ This patch was never officially reviewed (because it was too large to
+ upload to bugs.webkit.org), but it was discussed on webkit-dev and Mark
+ Rowe gave me the green light.
+
+ * BugsSite: Removed.
+ * BugsSite/.cvsignore: Removed.
+ * BugsSite/.htaccess: Removed.
+ * BugsSite/Bugzilla: Removed.
+ * BugsSite/Bugzilla.pm: Removed.
+ * BugsSite/Bugzilla/.cvsignore: Removed.
+ * BugsSite/Bugzilla/.htaccess: Removed.
+ * BugsSite/Bugzilla/Attachment: Removed.
+ * BugsSite/Bugzilla/Attachment.pm: Removed.
+ * BugsSite/Bugzilla/Attachment/PatchReader.pm: Removed.
+ * BugsSite/Bugzilla/Auth: Removed.
+ * BugsSite/Bugzilla/Auth.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Login: Removed.
+ * BugsSite/Bugzilla/Auth/Login.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Login/CGI.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Login/Cookie.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Login/Env.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Login/Stack.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Login/WWW: Removed.
+ * BugsSite/Bugzilla/Auth/Login/WWW/CGI: Removed.
+ * BugsSite/Bugzilla/Auth/Persist: Removed.
+ * BugsSite/Bugzilla/Auth/Persist/Cookie.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Verify: Removed.
+ * BugsSite/Bugzilla/Auth/Verify.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Verify/DB.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Verify/LDAP.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Verify/RADIUS.pm: Removed.
+ * BugsSite/Bugzilla/Auth/Verify/Stack.pm: Removed.
+ * BugsSite/Bugzilla/Bug.pm: Removed.
+ * BugsSite/Bugzilla/BugMail.pm: Removed.
+ * BugsSite/Bugzilla/CGI.pm: Removed.
+ * BugsSite/Bugzilla/Chart.pm: Removed.
+ * BugsSite/Bugzilla/Classification.pm: Removed.
+ * BugsSite/Bugzilla/Component.pm: Removed.
+ * BugsSite/Bugzilla/Config: Removed.
+ * BugsSite/Bugzilla/Config.pm: Removed.
+ * BugsSite/Bugzilla/Config/Admin.pm: Removed.
+ * BugsSite/Bugzilla/Config/Attachment.pm: Removed.
+ * BugsSite/Bugzilla/Config/Auth.pm: Removed.
+ * BugsSite/Bugzilla/Config/BugChange.pm: Removed.
+ * BugsSite/Bugzilla/Config/BugFields.pm: Removed.
+ * BugsSite/Bugzilla/Config/BugMove.pm: Removed.
+ * BugsSite/Bugzilla/Config/Common.pm: Removed.
+ * BugsSite/Bugzilla/Config/Core.pm: Removed.
+ * BugsSite/Bugzilla/Config/DependencyGraph.pm: Removed.
+ * BugsSite/Bugzilla/Config/GroupSecurity.pm: Removed.
+ * BugsSite/Bugzilla/Config/LDAP.pm: Removed.
+ * BugsSite/Bugzilla/Config/MTA.pm: Removed.
+ * BugsSite/Bugzilla/Config/PatchViewer.pm: Removed.
+ * BugsSite/Bugzilla/Config/Query.pm: Removed.
+ * BugsSite/Bugzilla/Config/RADIUS.pm: Removed.
+ * BugsSite/Bugzilla/Config/ShadowDB.pm: Removed.
+ * BugsSite/Bugzilla/Config/UserMatch.pm: Removed.
+ * BugsSite/Bugzilla/Constants.pm: Removed.
+ * BugsSite/Bugzilla/DB: Removed.
+ * BugsSite/Bugzilla/DB.pm: Removed.
+ * BugsSite/Bugzilla/DB/Mysql.pm: Removed.
+ * BugsSite/Bugzilla/DB/Oracle.pm: Removed.
+ * BugsSite/Bugzilla/DB/Pg.pm: Removed.
+ * BugsSite/Bugzilla/DB/Schema: Removed.
+ * BugsSite/Bugzilla/DB/Schema.pm: Removed.
+ * BugsSite/Bugzilla/DB/Schema/Mysql.pm: Removed.
+ * BugsSite/Bugzilla/DB/Schema/Oracle.pm: Removed.
+ * BugsSite/Bugzilla/DB/Schema/Pg.pm: Removed.
+ * BugsSite/Bugzilla/Error.pm: Removed.
+ * BugsSite/Bugzilla/Field.pm: Removed.
+ * BugsSite/Bugzilla/Flag.pm: Removed.
+ * BugsSite/Bugzilla/FlagType.pm: Removed.
+ * BugsSite/Bugzilla/Group.pm: Removed.
+ * BugsSite/Bugzilla/Hook.pm: Removed.
+ * BugsSite/Bugzilla/Install: Removed.
+ * BugsSite/Bugzilla/Install.pm: Removed.
+ * BugsSite/Bugzilla/Install/CPAN.pm: Removed.
+ * BugsSite/Bugzilla/Install/DB.pm: Removed.
+ * BugsSite/Bugzilla/Install/Filesystem.pm: Removed.
+ * BugsSite/Bugzilla/Install/Localconfig.pm: Removed.
+ * BugsSite/Bugzilla/Install/Requirements.pm: Removed.
+ * BugsSite/Bugzilla/Install/Util.pm: Removed.
+ * BugsSite/Bugzilla/Keyword.pm: Removed.
+ * BugsSite/Bugzilla/Mailer.pm: Removed.
+ * BugsSite/Bugzilla/Milestone.pm: Removed.
+ * BugsSite/Bugzilla/Object.pm: Removed.
+ * BugsSite/Bugzilla/Product.pm: Removed.
+ * BugsSite/Bugzilla/Search: Removed.
+ * BugsSite/Bugzilla/Search.pm: Removed.
+ * BugsSite/Bugzilla/Search/Quicksearch.pm: Removed.
+ * BugsSite/Bugzilla/Search/Saved.pm: Removed.
+ * BugsSite/Bugzilla/Series.pm: Removed.
+ * BugsSite/Bugzilla/Status.pm: Removed.
+ * BugsSite/Bugzilla/Template: Removed.
+ * BugsSite/Bugzilla/Template.pm: Removed.
+ * BugsSite/Bugzilla/Template/Parser.pm: Removed.
+ * BugsSite/Bugzilla/Template/Plugin: Removed.
+ * BugsSite/Bugzilla/Template/Plugin/Bugzilla.pm: Removed.
+ * BugsSite/Bugzilla/Template/Plugin/Hook.pm: Removed.
+ * BugsSite/Bugzilla/Template/Plugin/User.pm: Removed.
+ * BugsSite/Bugzilla/Token.pm: Removed.
+ * BugsSite/Bugzilla/Update.pm: Removed.
+ * BugsSite/Bugzilla/User: Removed.
+ * BugsSite/Bugzilla/User.pm: Removed.
+ * BugsSite/Bugzilla/User/Setting: Removed.
+ * BugsSite/Bugzilla/User/Setting.pm: Removed.
+ * BugsSite/Bugzilla/User/Setting/Lang.pm: Removed.
+ * BugsSite/Bugzilla/User/Setting/Skin.pm: Removed.
+ * BugsSite/Bugzilla/Util.pm: Removed.
+ * BugsSite/Bugzilla/Version.pm: Removed.
+ * BugsSite/Bugzilla/WebService: Removed.
+ * BugsSite/Bugzilla/WebService.pm: Removed.
+ * BugsSite/Bugzilla/WebService/Bug.pm: Removed.
+ * BugsSite/Bugzilla/WebService/Bugzilla.pm: Removed.
+ * BugsSite/Bugzilla/WebService/Constants.pm: Removed.
+ * BugsSite/Bugzilla/WebService/Product.pm: Removed.
+ * BugsSite/Bugzilla/WebService/User.pm: Removed.
+ * BugsSite/PrettyPatch: Removed.
+ * BugsSite/PrettyPatch/PrettyPatch.rb: Removed.
+ * BugsSite/PrettyPatch/diff.rb: Removed.
+ * BugsSite/PrettyPatch/prettify.rb: Removed.
+ * BugsSite/QUICKSTART: Removed.
+ * BugsSite/README: Removed.
+ * BugsSite/UPGRADING: Removed.
+ * BugsSite/UPGRADING-pre-2.8: Removed.
+ * BugsSite/admin.cgi: Removed.
+ * BugsSite/attachment.cgi: Removed.
+ * BugsSite/buglist.cgi: Removed.
+ * BugsSite/bugzilla.dtd: Removed.
+ * BugsSite/chart.cgi: Removed.
+ * BugsSite/checksetup.pl: Removed.
+ * BugsSite/code-review.js: Removed.
+ * BugsSite/colchange.cgi: Removed.
+ * BugsSite/collectstats.pl: Removed.
+ * BugsSite/committers-autocomplete.js: Removed.
+ * BugsSite/config.cgi: Removed.
+ * BugsSite/contrib: Removed.
+ * BugsSite/contrib/README: Removed.
+ * BugsSite/contrib/bugzilla-submit: Removed.
+ * BugsSite/contrib/bugzilla-submit/README: Removed.
+ * BugsSite/contrib/bugzilla-submit/bugdata.txt: Removed.
+ * BugsSite/contrib/bugzilla-submit/bugzilla-submit: Removed.
+ * BugsSite/contrib/bugzilla-submit/bugzilla-submit.xml: Removed.
+ * BugsSite/contrib/bugzilla_ldapsync.rb: Removed.
+ * BugsSite/contrib/bz_webservice_demo.pl: Removed.
+ * BugsSite/contrib/bzdbcopy.pl: Removed.
+ * BugsSite/contrib/cmdline: Removed.
+ * BugsSite/contrib/cmdline/bugcount: Removed.
+ * BugsSite/contrib/cmdline/bugids: Removed.
+ * BugsSite/contrib/cmdline/buglist: Removed.
+ * BugsSite/contrib/cmdline/bugs: Removed.
+ * BugsSite/contrib/cmdline/bugslink: Removed.
+ * BugsSite/contrib/cmdline/makequery: Removed.
+ * BugsSite/contrib/cmdline/query.conf: Removed.
+ * BugsSite/contrib/cvs-update.pl: Removed.
+ * BugsSite/contrib/gnats2bz.pl: Removed.
+ * BugsSite/contrib/gnatsparse: Removed.
+ * BugsSite/contrib/gnatsparse/README: Removed.
+ * BugsSite/contrib/gnatsparse/gnatsparse.py: Removed.
+ * BugsSite/contrib/gnatsparse/magic.py: Removed.
+ * BugsSite/contrib/gnatsparse/specialuu.py: Removed.
+ * BugsSite/contrib/jb2bz.py: Removed.
+ * BugsSite/contrib/merge-users.pl: Removed.
+ * BugsSite/contrib/mysqld-watcher.pl: Removed.
+ * BugsSite/contrib/recode-overrides.txt: Removed.
+ * BugsSite/contrib/recode.pl: Removed.
+ * BugsSite/contrib/sendbugmail.pl: Removed.
+ * BugsSite/contrib/sendunsentbugmail.pl: Removed.
+ * BugsSite/contrib/syncLDAP.pl: Removed.
+ * BugsSite/contrib/yp_nomail.sh: Removed.
+ * BugsSite/createaccount.cgi: Removed.
+ * BugsSite/data: Removed.
+ * BugsSite/data/.htaccess: Removed.
+ * BugsSite/data/attachments: Removed.
+ * BugsSite/data/attachments/.htaccess: Removed.
+ * BugsSite/data/duplicates: Removed.
+ * BugsSite/data/mail: Removed.
+ * BugsSite/data/mimedump-tmp: Removed.
+ * BugsSite/data/mining: Removed.
+ * BugsSite/data/params: Removed.
+ * BugsSite/data/template: Removed.
+ * BugsSite/data/webdot: Removed.
+ * BugsSite/data/webdot/.htaccess: Removed.
+ * BugsSite/describecomponents.cgi: Removed.
+ * BugsSite/describekeywords.cgi: Removed.
+ * BugsSite/docs: Removed.
+ * BugsSite/docs/en: Removed.
+ * BugsSite/docs/en/.cvsignore: Removed.
+ * BugsSite/docs/en/README.docs: Removed.
+ * BugsSite/docs/en/images: Removed.
+ * BugsSite/docs/en/images/bzLifecycle.png: Removed.
+ * BugsSite/docs/en/images/bzLifecycle.xml: Removed.
+ * BugsSite/docs/en/images/callouts: Removed.
+ * BugsSite/docs/en/images/callouts/1.gif: Removed.
+ * BugsSite/docs/en/images/callouts/2.gif: Removed.
+ * BugsSite/docs/en/images/callouts/3.gif: Removed.
+ * BugsSite/docs/en/images/caution.gif: Removed.
+ * BugsSite/docs/en/images/note.gif: Removed.
+ * BugsSite/docs/en/images/tip.gif: Removed.
+ * BugsSite/docs/en/images/warning.gif: Removed.
+ * BugsSite/docs/en/rel_notes.txt: Removed.
+ * BugsSite/docs/en/xml: Removed.
+ * BugsSite/docs/en/xml/.cvsignore: Removed.
+ * BugsSite/docs/en/xml/Bugzilla-Guide.xml: Removed.
+ * BugsSite/docs/en/xml/about.xml: Removed.
+ * BugsSite/docs/en/xml/administration.xml: Removed.
+ * BugsSite/docs/en/xml/conventions.xml: Removed.
+ * BugsSite/docs/en/xml/customization.xml: Removed.
+ * BugsSite/docs/en/xml/gfdl.xml: Removed.
+ * BugsSite/docs/en/xml/glossary.xml: Removed.
+ * BugsSite/docs/en/xml/index.xml: Removed.
+ * BugsSite/docs/en/xml/installation.xml: Removed.
+ * BugsSite/docs/en/xml/integration.xml: Removed.
+ * BugsSite/docs/en/xml/introduction.xml: Removed.
+ * BugsSite/docs/en/xml/modules.xml: Removed.
+ * BugsSite/docs/en/xml/patches.xml: Removed.
+ * BugsSite/docs/en/xml/requiredsoftware.xml: Removed.
+ * BugsSite/docs/en/xml/security.xml: Removed.
+ * BugsSite/docs/en/xml/troubleshooting.xml: Removed.
+ * BugsSite/docs/en/xml/using.xml: Removed.
+ * BugsSite/docs/html: Removed.
+ * BugsSite/docs/html/api: Removed.
+ * BugsSite/docs/images: Removed.
+ * BugsSite/docs/images/callouts: Removed.
+ * BugsSite/docs/lib: Removed.
+ * BugsSite/docs/lib/Pod: Removed.
+ * BugsSite/docs/lib/Pod/Simple: Removed.
+ * BugsSite/docs/lib/Pod/Simple/HTML: Removed.
+ * BugsSite/docs/lib/Pod/Simple/HTML/Bugzilla.pm: Removed.
+ * BugsSite/docs/lib/Pod/Simple/HTMLBatch: Removed.
+ * BugsSite/docs/lib/Pod/Simple/HTMLBatch/Bugzilla.pm: Removed.
+ * BugsSite/docs/makedocs.pl: Removed.
+ * BugsSite/docs/pdf: Removed.
+ * BugsSite/docs/style.css: Removed.
+ * BugsSite/docs/txt: Removed.
+ * BugsSite/docs/xml: Removed.
+ * BugsSite/duplicates.cgi: Removed.
+ * BugsSite/editclassifications.cgi: Removed.
+ * BugsSite/editcomponents.cgi: Removed.
+ * BugsSite/editfields.cgi: Removed.
+ * BugsSite/editflagtypes.cgi: Removed.
+ * BugsSite/editgroups.cgi: Removed.
+ * BugsSite/editkeywords.cgi: Removed.
+ * BugsSite/editmilestones.cgi: Removed.
+ * BugsSite/editparams.cgi: Removed.
+ * BugsSite/editproducts.cgi: Removed.
+ * BugsSite/editsettings.cgi: Removed.
+ * BugsSite/editusers.cgi: Removed.
+ * BugsSite/editvalues.cgi: Removed.
+ * BugsSite/editversions.cgi: Removed.
+ * BugsSite/editwhines.cgi: Removed.
+ * BugsSite/editworkflow.cgi: Removed.
+ * BugsSite/email_in.pl: Removed.
+ * BugsSite/enter_bug.cgi: Removed.
+ * BugsSite/extensions: Removed.
+ * BugsSite/extensions/example: Removed.
+ * BugsSite/extensions/example/code: Removed.
+ * BugsSite/extensions/example/code/bug-end_of_update.pl: Removed.
+ * BugsSite/extensions/example/code/buglist-columns.pl: Removed.
+ * BugsSite/extensions/example/code/colchange-columns.pl: Removed.
+ * BugsSite/extensions/example/code/config.pl: Removed.
+ * BugsSite/extensions/example/code/flag-end_of_update.pl: Removed.
+ * BugsSite/extensions/example/code/install-before_final_checks.pl: Removed.
+ * BugsSite/extensions/example/code/product-confirm_delete.pl: Removed.
+ * BugsSite/extensions/example/code/webservice-error_codes.pl: Removed.
+ * BugsSite/extensions/example/code/webservice.pl: Removed.
+ * BugsSite/extensions/example/disabled: Removed.
+ * BugsSite/extensions/example/info.pl: Removed.
+ * BugsSite/extensions/example/lib: Removed.
+ * BugsSite/extensions/example/lib/ConfigExample.pm: Removed.
+ * BugsSite/extensions/example/lib/WSExample.pm: Removed.
+ * BugsSite/extensions/example/template: Removed.
+ * BugsSite/extensions/example/template/en: Removed.
+ * BugsSite/extensions/example/template/en/default: Removed.
+ * BugsSite/extensions/example/template/en/default/admin: Removed.
+ * BugsSite/extensions/example/template/en/default/admin/params: Removed.
+ * BugsSite/extensions/example/template/en/default/admin/params/example.html.tmpl: Removed.
+ * BugsSite/extensions/example/template/en/global: Removed.
+ * BugsSite/extensions/example/template/en/global/user-error-errors.html.tmpl: Removed.
+ * BugsSite/graphs: Removed.
+ * BugsSite/images: Removed.
+ * BugsSite/images/favicon.ico: Removed.
+ * BugsSite/images/padlock.png: Removed.
+ * BugsSite/importxml.pl: Removed.
+ * BugsSite/index.cgi: Removed.
+ * BugsSite/install-module.pl: Removed.
+ * BugsSite/js: Removed.
+ * BugsSite/js/TUI.js: Removed.
+ * BugsSite/js/attachment.js: Removed.
+ * BugsSite/js/expanding-tree.js: Removed.
+ * BugsSite/js/field.js: Removed.
+ * BugsSite/js/help.js: Removed.
+ * BugsSite/js/params.js: Removed.
+ * BugsSite/js/productform.js: Removed.
+ * BugsSite/js/util.js: Removed.
+ * BugsSite/js/yui: Removed.
+ * BugsSite/js/yui/calendar.js: Removed.
+ * BugsSite/js/yui/yahoo-dom-event.js: Removed.
+ * BugsSite/lib: Removed.
+ * BugsSite/lib/.htaccess: Removed.
+ * BugsSite/lib/README: Removed.
+ * BugsSite/long_list.cgi: Removed.
+ * BugsSite/mod_perl.pl: Removed.
+ * BugsSite/page.cgi: Removed.
+ * BugsSite/post_bug.cgi: Removed.
+ * BugsSite/process_bug.cgi: Removed.
+ * BugsSite/query.cgi: Removed.
+ * BugsSite/quips.cgi: Removed.
+ * BugsSite/relogin.cgi: Removed.
+ * BugsSite/report.cgi: Removed.
+ * BugsSite/reports.cgi: Removed.
+ * BugsSite/request.cgi: Removed.
+ * BugsSite/robots.txt: Removed.
+ * BugsSite/runtests.pl: Removed.
+ * BugsSite/sanitycheck.cgi: Removed.
+ * BugsSite/sanitycheck.pl: Removed.
+ * BugsSite/search_plugin.cgi: Removed.
+ * BugsSite/show_activity.cgi: Removed.
+ * BugsSite/show_bug.cgi: Removed.
+ * BugsSite/showattachment.cgi: Removed.
+ * BugsSite/showdependencygraph.cgi: Removed.
+ * BugsSite/showdependencytree.cgi: Removed.
+ * BugsSite/sidebar.cgi: Removed.
+ * BugsSite/skins: Removed.
+ * BugsSite/skins/.cvsignore: Removed.
+ * BugsSite/skins/contrib: Removed.
+ * BugsSite/skins/contrib/Dusk: Removed.
+ * BugsSite/skins/contrib/Dusk/.cvsignore: Removed.
+ * BugsSite/skins/contrib/Dusk/IE-fixes.css: Removed.
+ * BugsSite/skins/contrib/Dusk/admin.css: Removed.
+ * BugsSite/skins/contrib/Dusk/buglist.css: Removed.
+ * BugsSite/skins/contrib/Dusk/create_attachment.css: Removed.
+ * BugsSite/skins/contrib/Dusk/dependency-tree.css: Removed.
+ * BugsSite/skins/contrib/Dusk/duplicates.css: Removed.
+ * BugsSite/skins/contrib/Dusk/editusers.css: Removed.
+ * BugsSite/skins/contrib/Dusk/global.css: Removed.
+ * BugsSite/skins/contrib/Dusk/help.css: Removed.
+ * BugsSite/skins/contrib/Dusk/index.css: Removed.
+ * BugsSite/skins/contrib/Dusk/panel.css: Removed.
+ * BugsSite/skins/contrib/Dusk/params.css: Removed.
+ * BugsSite/skins/contrib/Dusk/release-notes.css: Removed.
+ * BugsSite/skins/contrib/Dusk/show_bug.css: Removed.
+ * BugsSite/skins/contrib/Dusk/show_multiple.css: Removed.
+ * BugsSite/skins/contrib/Dusk/summarize-time.css: Removed.
+ * BugsSite/skins/contrib/Dusk/voting.css: Removed.
+ * BugsSite/skins/contrib/Dusk/yui: Removed.
+ * BugsSite/skins/contrib/Dusk/yui/calendar.css: Removed.
+ * BugsSite/skins/custom: Removed.
+ * BugsSite/skins/custom/IE-fixes.css: Removed.
+ * BugsSite/skins/custom/admin.css: Removed.
+ * BugsSite/skins/custom/buglist.css: Removed.
+ * BugsSite/skins/custom/create_attachment.css: Removed.
+ * BugsSite/skins/custom/dependency-tree.css: Removed.
+ * BugsSite/skins/custom/duplicates.css: Removed.
+ * BugsSite/skins/custom/editusers.css: Removed.
+ * BugsSite/skins/custom/global.css: Removed.
+ * BugsSite/skins/custom/help.css: Removed.
+ * BugsSite/skins/custom/index.css: Removed.
+ * BugsSite/skins/custom/opendarwin.gif: Removed.
+ * BugsSite/skins/custom/panel.css: Removed.
+ * BugsSite/skins/custom/params.css: Removed.
+ * BugsSite/skins/custom/release-notes.css: Removed.
+ * BugsSite/skins/custom/show_bug.css: Removed.
+ * BugsSite/skins/custom/show_multiple.css: Removed.
+ * BugsSite/skins/custom/summarize-time.css: Removed.
+ * BugsSite/skins/custom/voting.css: Removed.
+ * BugsSite/skins/custom/yui: Removed.
+ * BugsSite/skins/custom/yui/calendar.css: Removed.
+ * BugsSite/skins/standard: Removed.
+ * BugsSite/skins/standard/IE-fixes.css: Removed.
+ * BugsSite/skins/standard/admin.css: Removed.
+ * BugsSite/skins/standard/buglist.css: Removed.
+ * BugsSite/skins/standard/create_attachment.css: Removed.
+ * BugsSite/skins/standard/dependency-tree: Removed.
+ * BugsSite/skins/standard/dependency-tree.css: Removed.
+ * BugsSite/skins/standard/dependency-tree/bug-item.png: Removed.
+ * BugsSite/skins/standard/dependency-tree/tree-closed.png: Removed.
+ * BugsSite/skins/standard/dependency-tree/tree-open.png: Removed.
+ * BugsSite/skins/standard/dependency-tree/tree.png: Removed.
+ * BugsSite/skins/standard/duplicates.css: Removed.
+ * BugsSite/skins/standard/editusers.css: Removed.
+ * BugsSite/skins/standard/global: Removed.
+ * BugsSite/skins/standard/global.css: Removed.
+ * BugsSite/skins/standard/global/body-back.gif: Removed.
+ * BugsSite/skins/standard/global/calendar.png: Removed.
+ * BugsSite/skins/standard/global/header.png: Removed.
+ * BugsSite/skins/standard/help.css: Removed.
+ * BugsSite/skins/standard/index: Removed.
+ * BugsSite/skins/standard/index.css: Removed.
+ * BugsSite/skins/standard/index/front.png: Removed.
+ * BugsSite/skins/standard/panel.css: Removed.
+ * BugsSite/skins/standard/params.css: Removed.
+ * BugsSite/skins/standard/release-notes.css: Removed.
+ * BugsSite/skins/standard/show_bug.css: Removed.
+ * BugsSite/skins/standard/show_multiple.css: Removed.
+ * BugsSite/skins/standard/summarize-time.css: Removed.
+ * BugsSite/skins/standard/voting.css: Removed.
+ * BugsSite/skins/standard/yui: Removed.
+ * BugsSite/skins/standard/yui/calendar.css: Removed.
+ * BugsSite/skins/standard/yui/sprite.png: Removed.
+ * BugsSite/summarize_time.cgi: Removed.
+ * BugsSite/t: Removed.
+ * BugsSite/t/001compile.t: Removed.
+ * BugsSite/t/002goodperl.t: Removed.
+ * BugsSite/t/003safesys.t: Removed.
+ * BugsSite/t/004template.t: Removed.
+ * BugsSite/t/005no_tabs.t: Removed.
+ * BugsSite/t/006spellcheck.t: Removed.
+ * BugsSite/t/007util.t: Removed.
+ * BugsSite/t/008filter.t: Removed.
+ * BugsSite/t/009bugwords.t: Removed.
+ * BugsSite/t/010dependencies.t: Removed.
+ * BugsSite/t/011pod.t: Removed.
+ * BugsSite/t/012throwables.t: Removed.
+ * BugsSite/t/Support: Removed.
+ * BugsSite/t/Support/Files.pm: Removed.
+ * BugsSite/t/Support/Systemexec.pm: Removed.
+ * BugsSite/t/Support/Templates.pm: Removed.
+ * BugsSite/template: Removed.
+ * BugsSite/template/.cvsignore: Removed.
+ * BugsSite/template/.htaccess: Removed.
+ * BugsSite/template/en: Removed.
+ * BugsSite/template/en/.cvsignore: Removed.
+ * BugsSite/template/en/custom: Removed.
+ * BugsSite/template/en/custom/account: Removed.
+ * BugsSite/template/en/custom/account/auth: Removed.
+ * BugsSite/template/en/custom/account/email: Removed.
+ * BugsSite/template/en/custom/account/password: Removed.
+ * BugsSite/template/en/custom/account/prefs: Removed.
+ * BugsSite/template/en/custom/admin: Removed.
+ * BugsSite/template/en/custom/admin/classifications: Removed.
+ * BugsSite/template/en/custom/admin/components: Removed.
+ * BugsSite/template/en/custom/admin/fieldvalues: Removed.
+ * BugsSite/template/en/custom/admin/flag-type: Removed.
+ * BugsSite/template/en/custom/admin/groups: Removed.
+ * BugsSite/template/en/custom/admin/keywords: Removed.
+ * BugsSite/template/en/custom/admin/milestones: Removed.
+ * BugsSite/template/en/custom/admin/products: Removed.
+ * BugsSite/template/en/custom/admin/products/groupcontrol: Removed.
+ * BugsSite/template/en/custom/admin/settings: Removed.
+ * BugsSite/template/en/custom/admin/users: Removed.
+ * BugsSite/template/en/custom/admin/versions: Removed.
+ * BugsSite/template/en/custom/attachment: Removed.
+ * BugsSite/template/en/custom/attachment/content-types.html.tmpl: Removed.
+ * BugsSite/template/en/custom/attachment/create.html.tmpl: Removed.
+ * BugsSite/template/en/custom/attachment/created.html.tmpl: Removed.
+ * BugsSite/template/en/custom/attachment/edit.html.tmpl: Removed.
+ * BugsSite/template/en/custom/attachment/list.html.tmpl: Removed.
+ * BugsSite/template/en/custom/attachment/review.html.tmpl: Removed.
+ * BugsSite/template/en/custom/attachment/reviewform.html.tmpl: Removed.
+ * BugsSite/template/en/custom/attachment/rietveldreview.html.tmpl: Removed.
+ * BugsSite/template/en/custom/bug: Removed.
+ * BugsSite/template/en/custom/bug/activity: Removed.
+ * BugsSite/template/en/custom/bug/create: Removed.
+ * BugsSite/template/en/custom/bug/edit.html.tmpl: Removed.
+ * BugsSite/template/en/custom/bug/navigate.html.tmpl: Removed.
+ * BugsSite/template/en/custom/bug/process: Removed.
+ * BugsSite/template/en/custom/bug/votes: Removed.
+ * BugsSite/template/en/custom/flag: Removed.
+ * BugsSite/template/en/custom/flag/list.html.tmpl: Removed.
+ * BugsSite/template/en/custom/global: Removed.
+ * BugsSite/template/en/custom/global/choose-product.html.tmpl: Removed.
+ * BugsSite/template/en/custom/global/header.html.tmpl: Removed.
+ * BugsSite/template/en/custom/list: Removed.
+ * BugsSite/template/en/custom/list/list.html.tmpl: Removed.
+ * BugsSite/template/en/custom/pages: Removed.
+ * BugsSite/template/en/custom/reports: Removed.
+ * BugsSite/template/en/custom/request: Removed.
+ * BugsSite/template/en/custom/request/email.txt.tmpl: Removed.
+ * BugsSite/template/en/custom/request/queue.html.tmpl: Removed.
+ * BugsSite/template/en/custom/search: Removed.
+ * BugsSite/template/en/custom/whine: Removed.
+ * BugsSite/template/en/default: Removed.
+ * BugsSite/template/en/default/account: Removed.
+ * BugsSite/template/en/default/account/auth: Removed.
+ * BugsSite/template/en/default/account/auth/login-small.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/auth/login.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/cancel-token.txt.tmpl: Removed.
+ * BugsSite/template/en/default/account/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/created.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/email: Removed.
+ * BugsSite/template/en/default/account/email/change-new.txt.tmpl: Removed.
+ * BugsSite/template/en/default/account/email/change-old.txt.tmpl: Removed.
+ * BugsSite/template/en/default/account/email/confirm-new.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/email/confirm.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/email/request-new.txt.tmpl: Removed.
+ * BugsSite/template/en/default/account/password: Removed.
+ * BugsSite/template/en/default/account/password/forgotten-password.txt.tmpl: Removed.
+ * BugsSite/template/en/default/account/password/set-forgotten-password.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/prefs: Removed.
+ * BugsSite/template/en/default/account/prefs/account.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/prefs/email.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/prefs/permissions.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/prefs/prefs.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/prefs/saved-searches.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/prefs/settings.html.tmpl: Removed.
+ * BugsSite/template/en/default/account/profile-activity.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin: Removed.
+ * BugsSite/template/en/default/admin/admin.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/classifications: Removed.
+ * BugsSite/template/en/default/admin/classifications/add.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/classifications/del.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/classifications/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/classifications/reclassify.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/classifications/select.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/components: Removed.
+ * BugsSite/template/en/default/admin/components/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/components/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/components/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/components/footer.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/components/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/components/select-product.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/confirm-action.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/custom_fields: Removed.
+ * BugsSite/template/en/default/admin/custom_fields/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/custom_fields/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/custom_fields/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/custom_fields/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/fieldvalues: Removed.
+ * BugsSite/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/fieldvalues/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/fieldvalues/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/fieldvalues/footer.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/fieldvalues/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/fieldvalues/select-field.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/flag-type: Removed.
+ * BugsSite/template/en/default/admin/flag-type/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/flag-type/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/flag-type/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/groups: Removed.
+ * BugsSite/template/en/default/admin/groups/confirm-remove.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/groups/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/groups/delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/groups/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/groups/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/keywords: Removed.
+ * BugsSite/template/en/default/admin/keywords/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/keywords/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/keywords/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/keywords/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/milestones: Removed.
+ * BugsSite/template/en/default/admin/milestones/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/milestones/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/milestones/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/milestones/footer.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/milestones/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/milestones/select-product.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params: Removed.
+ * BugsSite/template/en/default/admin/params/admin.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/attachment.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/auth.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/bugchange.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/bugfields.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/bugmove.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/common.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/core.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/dependencygraph.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/editparams.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/groupsecurity.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/index.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/ldap.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/mta.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/patchviewer.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/query.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/radius.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/shadowdb.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/params/usermatch.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products: Removed.
+ * BugsSite/template/en/default/admin/products/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/edit-common.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/footer.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/groupcontrol: Removed.
+ * BugsSite/template/en/default/admin/products/groupcontrol/confirm-edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/groupcontrol/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/groupcontrol/updated.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/list-classifications.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/products/updated.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/sanitycheck: Removed.
+ * BugsSite/template/en/default/admin/sanitycheck/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/sanitycheck/messages.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/settings: Removed.
+ * BugsSite/template/en/default/admin/settings/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/sudo.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/table.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users: Removed.
+ * BugsSite/template/en/default/admin/users/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users/listselectvars.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users/responsibilities.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users/search.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/users/userdata.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/versions: Removed.
+ * BugsSite/template/en/default/admin/versions/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/versions/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/versions/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/versions/footer.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/versions/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/versions/select-product.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/workflow: Removed.
+ * BugsSite/template/en/default/admin/workflow/comment.html.tmpl: Removed.
+ * BugsSite/template/en/default/admin/workflow/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment: Removed.
+ * BugsSite/template/en/default/attachment/cancel-create-dupe.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/choose.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/confirm-delete.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/content-types.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/created.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/createformcontents.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/delete_reason.txt.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/diff-file.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/diff-footer.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/diff-header.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/midair.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/show-multiple.html.tmpl: Removed.
+ * BugsSite/template/en/default/attachment/updated.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug: Removed.
+ * BugsSite/template/en/default/bug/activity: Removed.
+ * BugsSite/template/en/default/bug/activity/show.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/activity/table.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/choose.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/comments.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create: Removed.
+ * BugsSite/template/en/default/bug/create/comment-guided.txt.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create/comment.txt.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create/confirm-create-dupe.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create/create-guided.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create/create.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create/created.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create/make-template.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/create/user-message.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/dependency-graph.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/dependency-tree.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/edit.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/field.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/knob.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/navigate.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/process: Removed.
+ * BugsSite/template/en/default/bug/process/bugmail.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/process/confirm-duplicate.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/process/header.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/process/midair.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/process/results.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/process/verify-new-product.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/show-multiple.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/show.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/show.xml.tmpl: Removed.
+ * BugsSite/template/en/default/bug/summarize-time.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/time.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/votes: Removed.
+ * BugsSite/template/en/default/bug/votes/delete-all.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/votes/list-for-bug.html.tmpl: Removed.
+ * BugsSite/template/en/default/bug/votes/list-for-user.html.tmpl: Removed.
+ * BugsSite/template/en/default/config.js.tmpl: Removed.
+ * BugsSite/template/en/default/config.rdf.tmpl: Removed.
+ * BugsSite/template/en/default/email: Removed.
+ * BugsSite/template/en/default/email/newchangedmail.txt.tmpl: Removed.
+ * BugsSite/template/en/default/email/sanitycheck.txt.tmpl: Removed.
+ * BugsSite/template/en/default/email/sudo.txt.tmpl: Removed.
+ * BugsSite/template/en/default/email/votes-removed.txt.tmpl: Removed.
+ * BugsSite/template/en/default/email/whine.txt.tmpl: Removed.
+ * BugsSite/template/en/default/filterexceptions.pl: Removed.
+ * BugsSite/template/en/default/flag: Removed.
+ * BugsSite/template/en/default/flag/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/global: Removed.
+ * BugsSite/template/en/default/global/banner.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/choose-classification.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/choose-product.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/code-error.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/common-links.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/confirm-action.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/confirm-user-match.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/docslinks.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/field-descs.none.tmpl: Removed.
+ * BugsSite/template/en/default/global/footer.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/header.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/help.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/hidden-fields.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/initialize.none.tmpl: Removed.
+ * BugsSite/template/en/default/global/js-products.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/message.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/message.txt.tmpl: Removed.
+ * BugsSite/template/en/default/global/messages.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/per-bug-queries.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/select-menu.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/setting-descs.none.tmpl: Removed.
+ * BugsSite/template/en/default/global/site-navigation.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/tabs.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/textarea.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/useful-links.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/user-error.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/userselect.html.tmpl: Removed.
+ * BugsSite/template/en/default/global/variables.none.tmpl: Removed.
+ * BugsSite/template/en/default/index.html.tmpl: Removed.
+ * BugsSite/template/en/default/list: Removed.
+ * BugsSite/template/en/default/list/change-columns.html.tmpl: Removed.
+ * BugsSite/template/en/default/list/edit-multiple.html.tmpl: Removed.
+ * BugsSite/template/en/default/list/list-simple.html.tmpl: Removed.
+ * BugsSite/template/en/default/list/list.atom.tmpl: Removed.
+ * BugsSite/template/en/default/list/list.csv.tmpl: Removed.
+ * BugsSite/template/en/default/list/list.html.tmpl: Removed.
+ * BugsSite/template/en/default/list/list.ics.tmpl: Removed.
+ * BugsSite/template/en/default/list/list.js.tmpl: Removed.
+ * BugsSite/template/en/default/list/list.rdf.tmpl: Removed.
+ * BugsSite/template/en/default/list/quips.html.tmpl: Removed.
+ * BugsSite/template/en/default/list/server-push.html.tmpl: Removed.
+ * BugsSite/template/en/default/list/table.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages: Removed.
+ * BugsSite/template/en/default/pages/bug-writing.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/fields.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/linked.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/linkify.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/quicksearch.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/quicksearchhack.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/release-notes.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/sudo.html.tmpl: Removed.
+ * BugsSite/template/en/default/pages/voting.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports: Removed.
+ * BugsSite/template/en/default/reports/chart.csv.tmpl: Removed.
+ * BugsSite/template/en/default/reports/chart.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/chart.png.tmpl: Removed.
+ * BugsSite/template/en/default/reports/components.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/create-chart.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/duplicates-simple.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/duplicates-table.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/duplicates.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/edit-series.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/keywords.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/menu.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/old-charts.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report-bar.png.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report-line.png.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report-pie.png.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report-simple.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report-table.csv.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report-table.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report.csv.tmpl: Removed.
+ * BugsSite/template/en/default/reports/report.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/series-common.html.tmpl: Removed.
+ * BugsSite/template/en/default/reports/series.html.tmpl: Removed.
+ * BugsSite/template/en/default/request: Removed.
+ * BugsSite/template/en/default/request/email.txt.tmpl: Removed.
+ * BugsSite/template/en/default/request/queue.html.tmpl: Removed.
+ * BugsSite/template/en/default/search: Removed.
+ * BugsSite/template/en/default/search/boolean-charts.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/form.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/knob.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-advanced.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-create-series.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-help.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-plugin.xml.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-report-graph.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-report-select.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-report-table.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/search-specific.html.tmpl: Removed.
+ * BugsSite/template/en/default/search/tabs.html.tmpl: Removed.
+ * BugsSite/template/en/default/setup: Removed.
+ * BugsSite/template/en/default/setup/strings.txt.pl: Removed.
+ * BugsSite/template/en/default/sidebar.xul.tmpl: Removed.
+ * BugsSite/template/en/default/welcome-admin.html.tmpl: Removed.
+ * BugsSite/template/en/default/whine: Removed.
+ * BugsSite/template/en/default/whine/mail.html.tmpl: Removed.
+ * BugsSite/template/en/default/whine/mail.txt.tmpl: Removed.
+ * BugsSite/template/en/default/whine/multipart-mime.txt.tmpl: Removed.
+ * BugsSite/template/en/default/whine/schedule.html.tmpl: Removed.
+ * BugsSite/template/en/extension: Removed.
+ * BugsSite/template/en/extension/filterexceptions.pl: Removed.
+ * BugsSite/testagent.cgi: Removed.
+ * BugsSite/testserver.pl: Removed.
+ * BugsSite/token.cgi: Removed.
+ * BugsSite/userprefs.cgi: Removed.
+ * BugsSite/votes.cgi: Removed.
+ * BugsSite/whine.pl: Removed.
+ * BugsSite/whineatnews.pl: Removed.
+ * BugsSite/xml.cgi: Removed.
+ * BugsSite/xmlrpc.cgi: Removed.
+ * PlanetWebKit: Removed.
+ * PlanetWebKit/README: Removed.
+ * PlanetWebKit/config.ini: Removed.
+ * PlanetWebKit/planet: Removed.
+ * PlanetWebKit/planet/AUTHORS: Removed.
+ * PlanetWebKit/planet/INSTALL: Removed.
+ * PlanetWebKit/planet/LICENCE: Removed.
+ * PlanetWebKit/planet/NEWS: Removed.
+ * PlanetWebKit/planet/PKG-INFO: Removed.
+ * PlanetWebKit/planet/README: Removed.
+ * PlanetWebKit/planet/THANKS: Removed.
+ * PlanetWebKit/planet/TODO: Removed.
+ * PlanetWebKit/planet/examples: Removed.
+ * PlanetWebKit/planet/examples/atom.xml.tmpl: Removed.
+ * PlanetWebKit/planet/examples/basic: Removed.
+ * PlanetWebKit/planet/examples/basic/config.ini: Removed.
+ * PlanetWebKit/planet/examples/basic/index.html.tmpl: Removed.
+ * PlanetWebKit/planet/examples/fancy: Removed.
+ * PlanetWebKit/planet/examples/fancy/config.ini: Removed.
+ * PlanetWebKit/planet/examples/fancy/index.html.tmpl: Removed.
+ * PlanetWebKit/planet/examples/foafroll.xml.tmpl: Removed.
+ * PlanetWebKit/planet/examples/opml.xml.tmpl: Removed.
+ * PlanetWebKit/planet/examples/output: Removed.
+ * PlanetWebKit/planet/examples/output/images: Removed.
+ * PlanetWebKit/planet/examples/output/images/edd.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/evolution.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/feed-icon-10x10.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/jdub.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/keybuk.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/logo.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/opml.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/planet.png: Removed.
+ * PlanetWebKit/planet/examples/output/images/thom.png: Removed.
+ * PlanetWebKit/planet/examples/output/planet.css: Removed.
+ * PlanetWebKit/planet/examples/rss10.xml.tmpl: Removed.
+ * PlanetWebKit/planet/examples/rss20.xml.tmpl: Removed.
+ * PlanetWebKit/planet/planet: Removed.
+ * PlanetWebKit/planet/planet-cache.py: Removed.
+ * PlanetWebKit/planet/planet.py: Removed.
+ * PlanetWebKit/planet/planet/__init__.py: Removed.
+ * PlanetWebKit/planet/planet/atomstyler.py: Removed.
+ * PlanetWebKit/planet/planet/cache.py: Removed.
+ * PlanetWebKit/planet/planet/compat_logging: Removed.
+ * PlanetWebKit/planet/planet/compat_logging/__init__.py: Removed.
+ * PlanetWebKit/planet/planet/compat_logging/config.py: Removed.
+ * PlanetWebKit/planet/planet/compat_logging/handlers.py: Removed.
+ * PlanetWebKit/planet/planet/feedparser.py: Removed.
+ * PlanetWebKit/planet/planet/htmltmpl.py: Removed.
+ * PlanetWebKit/planet/planet/sanitize.py: Removed.
+ * PlanetWebKit/planet/planet/tests: Removed.
+ * PlanetWebKit/planet/planet/tests/__init__.py: Removed.
+ * PlanetWebKit/planet/planet/tests/data: Removed.
+ * PlanetWebKit/planet/planet/tests/data/simple.tmpl: Removed.
+ * PlanetWebKit/planet/planet/tests/data/simple2.tmpl: Removed.
+ * PlanetWebKit/planet/planet/tests/test_channel.py: Removed.
+ * PlanetWebKit/planet/planet/tests/test_main.py: Removed.
+ * PlanetWebKit/planet/planet/tests/test_sanitize.py: Removed.
+ * PlanetWebKit/planet/planet/tests/test_sub.py: Removed.
+ * PlanetWebKit/planet/planet/timeoutsocket.py: Removed.
+ * PlanetWebKit/planet/runtests.py: Removed.
+ * PlanetWebKit/planet/setup.py: Removed.
+ * PlanetWebKit/templates: Removed.
+ * PlanetWebKit/templates/atom.xml.tmpl: Removed.
+ * PlanetWebKit/templates/foafroll.xml.tmpl: Removed.
+ * PlanetWebKit/templates/index.html.tmpl: Removed.
+ * PlanetWebKit/templates/opml.xml.tmpl: Removed.
+ * PlanetWebKit/templates/rss10.xml.tmpl: Removed.
+ * PlanetWebKit/templates/rss20.xml.tmpl: Removed.
+ * PlanetWebKit/update.pl: Removed.
+ * PlanetWebKit/wwwroot: Removed.
+ * PlanetWebKit/wwwroot/ie.css: Removed.
+ * PlanetWebKit/wwwroot/images: Removed.
+ * PlanetWebKit/wwwroot/images/feed-icon-10x10.png: Removed.
+ * PlanetWebKit/wwwroot/images/ie-nav-blue.png: Removed.
+ * PlanetWebKit/wwwroot/images/planet-webkit.png: Removed.
+ * PlanetWebKit/wwwroot/images/planet.png: Removed.
+ * PlanetWebKit/wwwroot/planet.css: Removed.
+ * PlanetWebKit/wwwroot/planetwebkit.css: Removed.
+ * Sites: Added.
+ * Sites/bugs.webkit.org: Copied from BugsSite.
+ * Sites/planet.webkit.org: Copied from PlanetWebKit.
+ * Sites/webkit.org: Copied from WebKitSite.
+ * WebKitSite: Removed.
+ * WebKitSite/.htaccess: Removed.
+ * WebKitSite/asking_questions.html: Removed.
+ * WebKitSite/blog: Removed.
+ * WebKitSite/blog-files: Removed.
+ * WebKitSite/blog-files/3d-transforms: Removed.
+ * WebKitSite/blog-files/3d-transforms/image-flip.html: Removed.
+ * WebKitSite/blog-files/3d-transforms/mighty-cubes.png: Removed.
+ * WebKitSite/blog-files/3d-transforms/morphing-cubes.html: Removed.
+ * WebKitSite/blog-files/3d-transforms/perspective-by-example.html: Removed.
+ * WebKitSite/blog-files/3d-transforms/poster-circle.html: Removed.
+ * WebKitSite/blog-files/3d-transforms/poster-circle.png: Removed.
+ * WebKitSite/blog-files/3d-transforms/transform-style.html: Removed.
+ * WebKitSite/blog-files/InspectElementMenu.png: Removed.
+ * WebKitSite/blog-files/InspectorCSSEditing.png: Removed.
+ * WebKitSite/blog-files/InspectorDatabaseBrowser.png: Removed.
+ * WebKitSite/blog-files/InspectorFonts.png: Removed.
+ * WebKitSite/blog-files/acid3-100.png: Removed.
+ * WebKitSite/blog-files/acid3-full-rendering-pass.png: Removed.
+ * WebKitSite/blog-files/acid3-rendering-reference.png: Removed.
+ * WebKitSite/blog-files/acid3-screenshot.png: Removed.
+ * WebKitSite/blog-files/acid3-timing-screenshot.png: Removed.
+ * WebKitSite/blog-files/acid3-timing.png: Removed.
+ * WebKitSite/blog-files/animation-demo.svg: Removed.
+ * WebKitSite/blog-files/bounce.html: Removed.
+ * WebKitSite/blog-files/bounce.png: Removed.
+ * WebKitSite/blog-files/circle.svg: Removed.
+ * WebKitSite/blog-files/cubes-7.svg: Removed.
+ * WebKitSite/blog-files/gebcnspeedtest.html: Removed.
+ * WebKitSite/blog-files/gebcnwebkitonly.png: Removed.
+ * WebKitSite/blog-files/inspector: Removed.
+ * WebKitSite/blog-files/inspector-closure-scope.png: Removed.
+ * WebKitSite/blog-files/inspector-console-autocomplete.png: Removed.
+ * WebKitSite/blog-files/inspector-databases-panel-query-view.png: Removed.
+ * WebKitSite/blog-files/inspector-databases-panel.png: Removed.
+ * WebKitSite/blog-files/inspector-disabling-properties.png: Removed.
+ * WebKitSite/blog-files/inspector-elements-panel.png: Removed.
+ * WebKitSite/blog-files/inspector-event-scope.png: Removed.
+ * WebKitSite/blog-files/inspector-numeric-style-stepping.gif: Removed.
+ * WebKitSite/blog-files/inspector-profiles-panel.png: Removed.
+ * WebKitSite/blog-files/inspector-resources-panel.png: Removed.
+ * WebKitSite/blog-files/inspector-scripts-panel.png: Removed.
+ * WebKitSite/blog-files/inspector-searching-elements.png: Removed.
+ * WebKitSite/blog-files/inspector-searching-profiles.png: Removed.
+ * WebKitSite/blog-files/inspector-status-bar-with-errors.png: Removed.
+ * WebKitSite/blog-files/inspector-toolbar.png: Removed.
+ * WebKitSite/blog-files/inspector-with-scope.png: Removed.
+ * WebKitSite/blog-files/inspector/audits_launcher.png: Removed.
+ * WebKitSite/blog-files/inspector/audits_panel.png: Removed.
+ * WebKitSite/blog-files/inspector/breakpoints.png: Removed.
+ * WebKitSite/blog-files/inspector/colors.png: Removed.
+ * WebKitSite/blog-files/inspector/console_panel.png: Removed.
+ * WebKitSite/blog-files/inspector/context_menu.png: Removed.
+ * WebKitSite/blog-files/inspector/cookies.png: Removed.
+ * WebKitSite/blog-files/inspector/css_highlighted_line.png: Removed.
+ * WebKitSite/blog-files/inspector/css_line_number_snippet.png: Removed.
+ * WebKitSite/blog-files/inspector/css_line_numbers.png: Removed.
+ * WebKitSite/blog-files/inspector/css_selectors.png: Removed.
+ * WebKitSite/blog-files/inspector/css_syntax_highlight.png: Removed.
+ * WebKitSite/blog-files/inspector/deactivate_breakpoints.png: Removed.
+ * WebKitSite/blog-files/inspector/dom_storage.png: Removed.
+ * WebKitSite/blog-files/inspector/edit_attributes.png: Removed.
+ * WebKitSite/blog-files/inspector/enable.png: Removed.
+ * WebKitSite/blog-files/inspector/evaluate_on_hover.png: Removed.
+ * WebKitSite/blog-files/inspector/evaluate_on_hover_2.png: Removed.
+ * WebKitSite/blog-files/inspector/event_listeners.png: Removed.
+ * WebKitSite/blog-files/inspector/form_data.png: Removed.
+ * WebKitSite/blog-files/inspector/inherited_styles.png: Removed.
+ * WebKitSite/blog-files/inspector/inline_highlight.png: Removed.
+ * WebKitSite/blog-files/inspector/inorder.png: Removed.
+ * WebKitSite/blog-files/inspector/inspect_inspector.png: Removed.
+ * WebKitSite/blog-files/inspector/inspect_inspector_small.png: Removed.
+ * WebKitSite/blog-files/inspector/large_dom.png: Removed.
+ * WebKitSite/blog-files/inspector/large_resources.png: Removed.
+ * WebKitSite/blog-files/inspector/load_lines.png: Removed.
+ * WebKitSite/blog-files/inspector/nodelist.png: Removed.
+ * WebKitSite/blog-files/inspector/pseudo_elements.png: Removed.
+ * WebKitSite/blog-files/inspector/redirect_headers.png: Removed.
+ * WebKitSite/blog-files/inspector/redirect_headers_full.png: Removed.
+ * WebKitSite/blog-files/inspector/redirects.png: Removed.
+ * WebKitSite/blog-files/inspector/redirects_full.png: Removed.
+ * WebKitSite/blog-files/inspector/scope_bar.png: Removed.
+ * WebKitSite/blog-files/inspector/timeline_overview.png: Removed.
+ * WebKitSite/blog-files/inspector/timeline_panel.png: Removed.
+ * WebKitSite/blog-files/inspector/timeline_record_details.png: Removed.
+ * WebKitSite/blog-files/inspector/watched_expression.png: Removed.
+ * WebKitSite/blog-files/kate-circle.png: Removed.
+ * WebKitSite/blog-files/kate-gradient-rounded.png: Removed.
+ * WebKitSite/blog-files/kate-gradient.png: Removed.
+ * WebKitSite/blog-files/kate-reflected.png: Removed.
+ * WebKitSite/blog-files/kate-vignette-mask.png: Removed.
+ * WebKitSite/blog-files/kate.png: Removed.
+ * WebKitSite/blog-files/leaves: Removed.
+ * WebKitSite/blog-files/leaves-screenshot-small.jpg: Removed.
+ * WebKitSite/blog-files/leaves-screenshot.jpg: Removed.
+ * WebKitSite/blog-files/leaves/images: Removed.
+ * WebKitSite/blog-files/leaves/images/apple-touch-icon.png: Removed.
+ * WebKitSite/blog-files/leaves/images/backgroundLeaves.jpg: Removed.
+ * WebKitSite/blog-files/leaves/images/realLeaf1.png: Removed.
+ * WebKitSite/blog-files/leaves/images/realLeaf2.png: Removed.
+ * WebKitSite/blog-files/leaves/images/realLeaf3.png: Removed.
+ * WebKitSite/blog-files/leaves/images/realLeaf4.png: Removed.
+ * WebKitSite/blog-files/leaves/images/textBackground.png: Removed.
+ * WebKitSite/blog-files/leaves/index.html: Removed.
+ * WebKitSite/blog-files/leaves/leaves.css: Removed.
+ * WebKitSite/blog-files/leaves/leaves.js: Removed.
+ * WebKitSite/blog-files/load-unload-example.html: Removed.
+ * WebKitSite/blog-files/loader-diagram.svg: Removed.
+ * WebKitSite/blog-files/maskspeedracer.png: Removed.
+ * WebKitSite/blog-files/number-morph.svg: Removed.
+ * WebKitSite/blog-files/pageshow-pagehide-example.html: Removed.
+ * WebKitSite/blog-files/prototype-for-gebcn-test.js: Removed.
+ * WebKitSite/blog-files/pulse.html: Removed.
+ * WebKitSite/blog-files/pulse.png: Removed.
+ * WebKitSite/blog-files/riemann-screenshot.png: Removed.
+ * WebKitSite/blog-files/scrollbarpicture.png: Removed.
+ * WebKitSite/blog-files/sfx-perf.png: Removed.
+ * WebKitSite/blog-files/squirrelfish-link-animated.svg: Removed.
+ * WebKitSite/blog-files/squirrelfish-webkit-graph.png: Removed.
+ * WebKitSite/blog-files/squirrelfish.png: Removed.
+ * WebKitSite/blog-files/timeline-blocking-script.png: Removed.
+ * WebKitSite/blog-files/timeline-defer-script.png: Removed.
+ * WebKitSite/blog-files/touch-poster.png: Removed.
+ * WebKitSite/blog-files/vignette-mask.png: Removed.
+ * WebKitSite/blog-files/webgl: Removed.
+ * WebKitSite/blog-files/webgl/Earth.html: Removed.
+ * WebKitSite/blog-files/webgl/ManyPlanetsDeep.html: Removed.
+ * WebKitSite/blog-files/webgl/SpinningBox.html: Removed.
+ * WebKitSite/blog-files/webgl/SpiritBox.html: Removed.
+ * WebKitSite/blog-files/webgl/TeapotPerPixel.html: Removed.
+ * WebKitSite/blog-files/webgl/TeapotPerVertex.html: Removed.
+ * WebKitSite/blog-files/webgl/WebGL+CSS.html: Removed.
+ * WebKitSite/blog-files/webgl/resources: Removed.
+ * WebKitSite/blog-files/webgl/resources/BambooBridge.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/EarthThumb.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/J3DI.js: Removed.
+ * WebKitSite/blog-files/webgl/resources/J3DIMath.js: Removed.
+ * WebKitSite/blog-files/webgl/resources/ManyPlanetsDeepThumb.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/SpinningBoxThumb.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/SpiritBox.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/TeapotPerPixelThumb.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/TeapotPerVertexThumb.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/WebGL+CSSThumb.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/blogpost.css: Removed.
+ * WebKitSite/blog-files/webgl/resources/earthmap1k.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/mars500x250.png: Removed.
+ * WebKitSite/blog-files/webgl/resources/spirit.jpg: Removed.
+ * WebKitSite/blog-files/webgl/resources/teapot.obj: Removed.
+ * WebKitSite/blog-files/wsj-nopreload.png: Removed.
+ * WebKitSite/blog-files/wsj-preload.png: Removed.
+ * WebKitSite/blog-files/wsj-vs.png: Removed.
+ * WebKitSite/blog/.htaccess: Removed.
+ * WebKitSite/blog/index.php: Removed.
+ * WebKitSite/blog/license.txt: Removed.
+ * WebKitSite/blog/wp-admin: Removed.
+ * WebKitSite/blog/wp-admin/admin-ajax.php: Removed.
+ * WebKitSite/blog/wp-admin/admin-footer.php: Removed.
+ * WebKitSite/blog/wp-admin/admin-functions.php: Removed.
+ * WebKitSite/blog/wp-admin/admin-header.php: Removed.
+ * WebKitSite/blog/wp-admin/admin-post.php: Removed.
+ * WebKitSite/blog/wp-admin/admin.php: Removed.
+ * WebKitSite/blog/wp-admin/async-upload.php: Removed.
+ * WebKitSite/blog/wp-admin/categories.php: Removed.
+ * WebKitSite/blog/wp-admin/comment.php: Removed.
+ * WebKitSite/blog/wp-admin/css: Removed.
+ * WebKitSite/blog/wp-admin/css/colors-classic-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/colors-classic.css: Removed.
+ * WebKitSite/blog/wp-admin/css/colors-fresh-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/colors-fresh.css: Removed.
+ * WebKitSite/blog/wp-admin/css/dashboard-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/dashboard.css: Removed.
+ * WebKitSite/blog/wp-admin/css/farbtastic-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/farbtastic.css: Removed.
+ * WebKitSite/blog/wp-admin/css/global-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/global.css: Removed.
+ * WebKitSite/blog/wp-admin/css/ie-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/ie.css: Removed.
+ * WebKitSite/blog/wp-admin/css/install-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/install.css: Removed.
+ * WebKitSite/blog/wp-admin/css/login-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/login.css: Removed.
+ * WebKitSite/blog/wp-admin/css/media-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/media.css: Removed.
+ * WebKitSite/blog/wp-admin/css/plugin-install-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/plugin-install.css: Removed.
+ * WebKitSite/blog/wp-admin/css/press-this-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/press-this.css: Removed.
+ * WebKitSite/blog/wp-admin/css/theme-editor-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/theme-editor.css: Removed.
+ * WebKitSite/blog/wp-admin/css/theme-install.css: Removed.
+ * WebKitSite/blog/wp-admin/css/widgets-rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/css/widgets.css: Removed.
+ * WebKitSite/blog/wp-admin/custom-header.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-attachment-rows.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-category-form.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-comments.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-form-advanced.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-form-comment.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-link-categories.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-link-category-form.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-link-form.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-page-form.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-pages.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-post-rows.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-tag-form.php: Removed.
+ * WebKitSite/blog/wp-admin/edit-tags.php: Removed.
+ * WebKitSite/blog/wp-admin/edit.php: Removed.
+ * WebKitSite/blog/wp-admin/export.php: Removed.
+ * WebKitSite/blog/wp-admin/gears-manifest.php: Removed.
+ * WebKitSite/blog/wp-admin/images: Removed.
+ * WebKitSite/blog/wp-admin/images/align-center.png: Removed.
+ * WebKitSite/blog/wp-admin/images/align-left.png: Removed.
+ * WebKitSite/blog/wp-admin/images/align-none.png: Removed.
+ * WebKitSite/blog/wp-admin/images/align-right.png: Removed.
+ * WebKitSite/blog/wp-admin/images/archive-link.png: Removed.
+ * WebKitSite/blog/wp-admin/images/blue-grad.png: Removed.
+ * WebKitSite/blog/wp-admin/images/browse-happy.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/bubble_bg-rtl.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/bubble_bg.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/button-grad-active-vs.png: Removed.
+ * WebKitSite/blog/wp-admin/images/button-grad-active.png: Removed.
+ * WebKitSite/blog/wp-admin/images/button-grad-vs.png: Removed.
+ * WebKitSite/blog/wp-admin/images/button-grad.png: Removed.
+ * WebKitSite/blog/wp-admin/images/comment-grey-bubble.png: Removed.
+ * WebKitSite/blog/wp-admin/images/date-button.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/ed-bg-vs.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/ed-bg.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/fade-butt.png: Removed.
+ * WebKitSite/blog/wp-admin/images/fav-arrow-rtl.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/fav-arrow-vs.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/fav-arrow.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/fav-top-vs.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/fav-top.png: Removed.
+ * WebKitSite/blog/wp-admin/images/fav-vs.png: Removed.
+ * WebKitSite/blog/wp-admin/images/fav.png: Removed.
+ * WebKitSite/blog/wp-admin/images/generic.png: Removed.
+ * WebKitSite/blog/wp-admin/images/gray-grad.png: Removed.
+ * WebKitSite/blog/wp-admin/images/icons32-vs.png: Removed.
+ * WebKitSite/blog/wp-admin/images/icons32.png: Removed.
+ * WebKitSite/blog/wp-admin/images/list-vs.png: Removed.
+ * WebKitSite/blog/wp-admin/images/list.png: Removed.
+ * WebKitSite/blog/wp-admin/images/loading-publish.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/loading.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/logo-ghost.png: Removed.
+ * WebKitSite/blog/wp-admin/images/logo-login.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/logo.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/marker.png: Removed.
+ * WebKitSite/blog/wp-admin/images/mask.png: Removed.
+ * WebKitSite/blog/wp-admin/images/media-button-image.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/media-button-music.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/media-button-other.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/media-button-video.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-arrows.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-bits-rtl-vs.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-bits-rtl.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-bits-vs.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-bits.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-dark-rtl.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-dark.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/menu-vs.png: Removed.
+ * WebKitSite/blog/wp-admin/images/menu.png: Removed.
+ * WebKitSite/blog/wp-admin/images/no.png: Removed.
+ * WebKitSite/blog/wp-admin/images/required.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/resize.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/screen-options-left.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/screen-options-right-up.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/screen-options-right.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/se.png: Removed.
+ * WebKitSite/blog/wp-admin/images/star.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/toggle-arrow-rtl.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/toggle-arrow.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/visit-site-button-grad-vs.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/visit-site-button-grad.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/wheel.png: Removed.
+ * WebKitSite/blog/wp-admin/images/white-grad-active.png: Removed.
+ * WebKitSite/blog/wp-admin/images/white-grad.png: Removed.
+ * WebKitSite/blog/wp-admin/images/wordpress-logo.png: Removed.
+ * WebKitSite/blog/wp-admin/images/wp-logo-vs.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/wp-logo.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/wpspin_dark.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/wpspin_light.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/xit.gif: Removed.
+ * WebKitSite/blog/wp-admin/images/yes.png: Removed.
+ * WebKitSite/blog/wp-admin/import: Removed.
+ * WebKitSite/blog/wp-admin/import.php: Removed.
+ * WebKitSite/blog/wp-admin/import/blogger.php: Removed.
+ * WebKitSite/blog/wp-admin/import/blogware.php: Removed.
+ * WebKitSite/blog/wp-admin/import/dotclear.php: Removed.
+ * WebKitSite/blog/wp-admin/import/greymatter.php: Removed.
+ * WebKitSite/blog/wp-admin/import/livejournal.php: Removed.
+ * WebKitSite/blog/wp-admin/import/mt.php: Removed.
+ * WebKitSite/blog/wp-admin/import/opml.php: Removed.
+ * WebKitSite/blog/wp-admin/import/rss.php: Removed.
+ * WebKitSite/blog/wp-admin/import/stp.php: Removed.
+ * WebKitSite/blog/wp-admin/import/textpattern.php: Removed.
+ * WebKitSite/blog/wp-admin/import/utw.php: Removed.
+ * WebKitSite/blog/wp-admin/import/wordpress.php: Removed.
+ * WebKitSite/blog/wp-admin/import/wp-cat2tag.php: Removed.
+ * WebKitSite/blog/wp-admin/includes: Removed.
+ * WebKitSite/blog/wp-admin/includes/admin.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/bookmark.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-ftp-pure.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-ftp-sockets.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-ftp.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-pclzip.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-wp-filesystem-base.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-wp-filesystem-direct.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-wp-filesystem-ftpext.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-wp-filesystem-ftpsockets.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-wp-filesystem-ssh2.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/class-wp-upgrader.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/comment.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/continents-cities.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/dashboard.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/export.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/file.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/image.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/import.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/manifest.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/media.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/misc.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/plugin-install.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/plugin.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/post.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/schema.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/taxonomy.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/template.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/theme-install.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/theme.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/update-core.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/update.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/upgrade.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/user.php: Removed.
+ * WebKitSite/blog/wp-admin/includes/widgets.php: Removed.
+ * WebKitSite/blog/wp-admin/index-extra.php: Removed.
+ * WebKitSite/blog/wp-admin/index.php: Removed.
+ * WebKitSite/blog/wp-admin/install-helper.php: Removed.
+ * WebKitSite/blog/wp-admin/install.php: Removed.
+ * WebKitSite/blog/wp-admin/js: Removed.
+ * WebKitSite/blog/wp-admin/js/cat.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/cat.js: Removed.
+ * WebKitSite/blog/wp-admin/js/categories.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/categories.js: Removed.
+ * WebKitSite/blog/wp-admin/js/comment.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/comment.js: Removed.
+ * WebKitSite/blog/wp-admin/js/common.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/common.js: Removed.
+ * WebKitSite/blog/wp-admin/js/custom-fields.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/custom-fields.js: Removed.
+ * WebKitSite/blog/wp-admin/js/dashboard.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/dashboard.js: Removed.
+ * WebKitSite/blog/wp-admin/js/edit-comments.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/edit-comments.js: Removed.
+ * WebKitSite/blog/wp-admin/js/editor.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/editor.js: Removed.
+ * WebKitSite/blog/wp-admin/js/farbtastic.js: Removed.
+ * WebKitSite/blog/wp-admin/js/gallery.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/gallery.js: Removed.
+ * WebKitSite/blog/wp-admin/js/inline-edit-post.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/inline-edit-post.js: Removed.
+ * WebKitSite/blog/wp-admin/js/inline-edit-tax.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/inline-edit-tax.js: Removed.
+ * WebKitSite/blog/wp-admin/js/link.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/link.js: Removed.
+ * WebKitSite/blog/wp-admin/js/media-upload.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/media-upload.js: Removed.
+ * WebKitSite/blog/wp-admin/js/media.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/media.js: Removed.
+ * WebKitSite/blog/wp-admin/js/page.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/page.js: Removed.
+ * WebKitSite/blog/wp-admin/js/password-strength-meter.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/password-strength-meter.js: Removed.
+ * WebKitSite/blog/wp-admin/js/plugin-install.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/plugin-install.js: Removed.
+ * WebKitSite/blog/wp-admin/js/post.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/post.js: Removed.
+ * WebKitSite/blog/wp-admin/js/postbox.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/postbox.js: Removed.
+ * WebKitSite/blog/wp-admin/js/revisions-js.php: Removed.
+ * WebKitSite/blog/wp-admin/js/slug.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/slug.js: Removed.
+ * WebKitSite/blog/wp-admin/js/tags.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/tags.js: Removed.
+ * WebKitSite/blog/wp-admin/js/theme-preview.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/theme-preview.js: Removed.
+ * WebKitSite/blog/wp-admin/js/user-profile.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/user-profile.js: Removed.
+ * WebKitSite/blog/wp-admin/js/utils.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/utils.js: Removed.
+ * WebKitSite/blog/wp-admin/js/widgets.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/widgets.js: Removed.
+ * WebKitSite/blog/wp-admin/js/word-count.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/word-count.js: Removed.
+ * WebKitSite/blog/wp-admin/js/wp-gears.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/wp-gears.js: Removed.
+ * WebKitSite/blog/wp-admin/js/xfn.dev.js: Removed.
+ * WebKitSite/blog/wp-admin/js/xfn.js: Removed.
+ * WebKitSite/blog/wp-admin/link-add.php: Removed.
+ * WebKitSite/blog/wp-admin/link-category.php: Removed.
+ * WebKitSite/blog/wp-admin/link-manager.php: Removed.
+ * WebKitSite/blog/wp-admin/link-parse-opml.php: Removed.
+ * WebKitSite/blog/wp-admin/link.php: Removed.
+ * WebKitSite/blog/wp-admin/load-scripts.php: Removed.
+ * WebKitSite/blog/wp-admin/load-styles.php: Removed.
+ * WebKitSite/blog/wp-admin/media-new.php: Removed.
+ * WebKitSite/blog/wp-admin/media-upload.php: Removed.
+ * WebKitSite/blog/wp-admin/media.php: Removed.
+ * WebKitSite/blog/wp-admin/menu-header.php: Removed.
+ * WebKitSite/blog/wp-admin/menu.php: Removed.
+ * WebKitSite/blog/wp-admin/moderation.php: Removed.
+ * WebKitSite/blog/wp-admin/options-discussion.php: Removed.
+ * WebKitSite/blog/wp-admin/options-general.php: Removed.
+ * WebKitSite/blog/wp-admin/options-head.php: Removed.
+ * WebKitSite/blog/wp-admin/options-media.php: Removed.
+ * WebKitSite/blog/wp-admin/options-misc.php: Removed.
+ * WebKitSite/blog/wp-admin/options-permalink.php: Removed.
+ * WebKitSite/blog/wp-admin/options-privacy.php: Removed.
+ * WebKitSite/blog/wp-admin/options-reading.php: Removed.
+ * WebKitSite/blog/wp-admin/options-writing.php: Removed.
+ * WebKitSite/blog/wp-admin/options.php: Removed.
+ * WebKitSite/blog/wp-admin/page-new.php: Removed.
+ * WebKitSite/blog/wp-admin/page.php: Removed.
+ * WebKitSite/blog/wp-admin/plugin-editor.php: Removed.
+ * WebKitSite/blog/wp-admin/plugin-install.php: Removed.
+ * WebKitSite/blog/wp-admin/plugins.php: Removed.
+ * WebKitSite/blog/wp-admin/post-new.php: Removed.
+ * WebKitSite/blog/wp-admin/post.php: Removed.
+ * WebKitSite/blog/wp-admin/press-this.php: Removed.
+ * WebKitSite/blog/wp-admin/profile.php: Removed.
+ * WebKitSite/blog/wp-admin/revision.php: Removed.
+ * WebKitSite/blog/wp-admin/rtl.css: Removed.
+ * WebKitSite/blog/wp-admin/setup-config.php: Removed.
+ * WebKitSite/blog/wp-admin/sidebar.php: Removed.
+ * WebKitSite/blog/wp-admin/theme-editor.php: Removed.
+ * WebKitSite/blog/wp-admin/theme-install.php: Removed.
+ * WebKitSite/blog/wp-admin/themes.php: Removed.
+ * WebKitSite/blog/wp-admin/tools.php: Removed.
+ * WebKitSite/blog/wp-admin/update-core.php: Removed.
+ * WebKitSite/blog/wp-admin/update-links.php: Removed.
+ * WebKitSite/blog/wp-admin/update.php: Removed.
+ * WebKitSite/blog/wp-admin/upgrade-functions.php: Removed.
+ * WebKitSite/blog/wp-admin/upgrade.php: Removed.
+ * WebKitSite/blog/wp-admin/upload.php: Removed.
+ * WebKitSite/blog/wp-admin/user-edit.php: Removed.
+ * WebKitSite/blog/wp-admin/user-new.php: Removed.
+ * WebKitSite/blog/wp-admin/users.php: Removed.
+ * WebKitSite/blog/wp-admin/widgets.php: Removed.
+ * WebKitSite/blog/wp-admin/wp-admin.css: Removed.
+ * WebKitSite/blog/wp-app.php: Removed.
+ * WebKitSite/blog/wp-atom.php: Removed.
+ * WebKitSite/blog/wp-blog-header.php: Removed.
+ * WebKitSite/blog/wp-comments-post.php: Removed.
+ * WebKitSite/blog/wp-commentsrss2.php: Removed.
+ * WebKitSite/blog/wp-config-sample.php: Removed.
+ * WebKitSite/blog/wp-config.php: Removed.
+ * WebKitSite/blog/wp-content: Removed.
+ * WebKitSite/blog/wp-content/Picture9.png: Removed.
+ * WebKitSite/blog/wp-content/cache: Removed.
+ * WebKitSite/blog/wp-content/chrome.jpg: Removed.
+ * WebKitSite/blog/wp-content/chucknorris.png: Removed.
+ * WebKitSite/blog/wp-content/databaseexample.png: Removed.
+ * WebKitSite/blog/wp-content/drosera.png: Removed.
+ * WebKitSite/blog/wp-content/hitlist.png: Removed.
+ * WebKitSite/blog/wp-content/index.php: Removed.
+ * WebKitSite/blog/wp-content/plugins: Removed.
+ * WebKitSite/blog/wp-content/plugins/SK2: Removed.
+ * WebKitSite/blog/wp-content/plugins/SK2/sk2_plugins: Removed.
+ * WebKitSite/blog/wp-content/plugins/akismet: Removed.
+ * WebKitSite/blog/wp-content/plugins/akismet/akismet.gif: Removed.
+ * WebKitSite/blog/wp-content/plugins/akismet/akismet.php: Removed.
+ * WebKitSite/blog/wp-content/plugins/akismet/readme.txt: Removed.
+ * WebKitSite/blog/wp-content/plugins/commentcontrol.php: Removed.
+ * WebKitSite/blog/wp-content/plugins/hello.php: Removed.
+ * WebKitSite/blog/wp-content/plugins/index.php: Removed.
+ * WebKitSite/blog/wp-content/plugins/wp-cache: Removed.
+ * WebKitSite/blog/wp-content/rotate.png: Removed.
+ * WebKitSite/blog/wp-content/rotate.svg: Removed.
+ * WebKitSite/blog/wp-content/svgtext.png: Removed.
+ * WebKitSite/blog/wp-content/svgtextmini.png: Removed.
+ * WebKitSite/blog/wp-content/svgtextmini_01.png: Removed.
+ * WebKitSite/blog/wp-content/textfield_screenshot.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes: Removed.
+ * WebKitSite/blog/wp-content/themes/classic: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/comments-popup.php: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/comments.php: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/footer.php: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/functions.php: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/header.php: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/index.php: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/rtl.css: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/screenshot.png: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/sidebar.php: Removed.
+ * WebKitSite/blog/wp-content/themes/classic/style.css: Removed.
+ * WebKitSite/blog/wp-content/themes/default: Removed.
+ * WebKitSite/blog/wp-content/themes/default/404.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/archive.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/archives.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/comments-popup.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/comments.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/footer.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/functions.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/header.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/image.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/audio.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/header-img.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/kubrickbg-ltr.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/kubrickbg-rtl.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/kubrickbgcolor.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/kubrickbgwide.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/kubrickfooter.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes/default/images/kubrickheader.jpg: Removed.
+ * WebKitSite/blog/wp-content/themes/default/index.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/links.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/page.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/rtl.css: Removed.
+ * WebKitSite/blog/wp-content/themes/default/screenshot.png: Removed.
+ * WebKitSite/blog/wp-content/themes/default/search.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/sidebar.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/single.php: Removed.
+ * WebKitSite/blog/wp-content/themes/default/style.css: Removed.
+ * WebKitSite/blog/wp-content/themes/index.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/404.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/archive.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/archives.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/comments-popup.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/comments.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/footer.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/header.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/index.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/links.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/page.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/search.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/searchform.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/sidebar.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/single.php: Removed.
+ * WebKitSite/blog/wp-content/themes/webkit/style.css: Removed.
+ * WebKitSite/blog/wp-content/uploads: Removed.
+ * WebKitSite/blog/wp-content/uploads/2007: Removed.
+ * WebKitSite/blog/wp-content/uploads/2007/06: Removed.
+ * WebKitSite/blog/wp-content/uploads/2007/06/newinspector.png: Removed.
+ * WebKitSite/blog/wp-content/webInspector.png: Removed.
+ * WebKitSite/blog/wp-cron.php: Removed.
+ * WebKitSite/blog/wp-feed.php: Removed.
+ * WebKitSite/blog/wp-images: Removed.
+ * WebKitSite/blog/wp-images/smilies: Removed.
+ * WebKitSite/blog/wp-includes: Removed.
+ * WebKitSite/blog/wp-includes/Text: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff.php: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Engine: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Engine/native.php: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Engine/shell.php: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Engine/string.php: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Engine/xdiff.php: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Renderer: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Renderer.php: Removed.
+ * WebKitSite/blog/wp-includes/Text/Diff/Renderer/inline.php: Removed.
+ * WebKitSite/blog/wp-includes/atomlib.php: Removed.
+ * WebKitSite/blog/wp-includes/author-template.php: Removed.
+ * WebKitSite/blog/wp-includes/bookmark-template.php: Removed.
+ * WebKitSite/blog/wp-includes/bookmark.php: Removed.
+ * WebKitSite/blog/wp-includes/cache.php: Removed.
+ * WebKitSite/blog/wp-includes/canonical.php: Removed.
+ * WebKitSite/blog/wp-includes/capabilities.php: Removed.
+ * WebKitSite/blog/wp-includes/category-template.php: Removed.
+ * WebKitSite/blog/wp-includes/category.php: Removed.
+ * WebKitSite/blog/wp-includes/class-IXR.php: Removed.
+ * WebKitSite/blog/wp-includes/class-feed.php: Removed.
+ * WebKitSite/blog/wp-includes/class-phpass.php: Removed.
+ * WebKitSite/blog/wp-includes/class-phpmailer.php: Removed.
+ * WebKitSite/blog/wp-includes/class-pop3.php: Removed.
+ * WebKitSite/blog/wp-includes/class-simplepie.php: Removed.
+ * WebKitSite/blog/wp-includes/class-smtp.php: Removed.
+ * WebKitSite/blog/wp-includes/class-snoopy.php: Removed.
+ * WebKitSite/blog/wp-includes/class.wp-dependencies.php: Removed.
+ * WebKitSite/blog/wp-includes/class.wp-scripts.php: Removed.
+ * WebKitSite/blog/wp-includes/class.wp-styles.php: Removed.
+ * WebKitSite/blog/wp-includes/classes.php: Removed.
+ * WebKitSite/blog/wp-includes/comment-template.php: Removed.
+ * WebKitSite/blog/wp-includes/comment.php: Removed.
+ * WebKitSite/blog/wp-includes/compat.php: Removed.
+ * WebKitSite/blog/wp-includes/cron.php: Removed.
+ * WebKitSite/blog/wp-includes/default-filters.php: Removed.
+ * WebKitSite/blog/wp-includes/default-widgets.php: Removed.
+ * WebKitSite/blog/wp-includes/deprecated.php: Removed.
+ * WebKitSite/blog/wp-includes/feed-atom-comments.php: Removed.
+ * WebKitSite/blog/wp-includes/feed-atom.php: Removed.
+ * WebKitSite/blog/wp-includes/feed-rdf.php: Removed.
+ * WebKitSite/blog/wp-includes/feed-rss.php: Removed.
+ * WebKitSite/blog/wp-includes/feed-rss2-comments.php: Removed.
+ * WebKitSite/blog/wp-includes/feed-rss2.php: Removed.
+ * WebKitSite/blog/wp-includes/feed.php: Removed.
+ * WebKitSite/blog/wp-includes/formatting.php: Removed.
+ * WebKitSite/blog/wp-includes/functions.php: Removed.
+ * WebKitSite/blog/wp-includes/functions.wp-scripts.php: Removed.
+ * WebKitSite/blog/wp-includes/functions.wp-styles.php: Removed.
+ * WebKitSite/blog/wp-includes/general-template.php: Removed.
+ * WebKitSite/blog/wp-includes/gettext.php: Removed.
+ * WebKitSite/blog/wp-includes/http.php: Removed.
+ * WebKitSite/blog/wp-includes/images: Removed.
+ * WebKitSite/blog/wp-includes/images/blank.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/archive.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/audio.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/code.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/default.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/document.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/interactive.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/license.txt: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/spreadsheet.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/text.png: Removed.
+ * WebKitSite/blog/wp-includes/images/crystal/video.png: Removed.
+ * WebKitSite/blog/wp-includes/images/rss.png: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_arrow.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_biggrin.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_confused.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_cool.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_cry.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_eek.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_evil.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_exclaim.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_idea.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_lol.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_mad.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_mrgreen.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_neutral.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_question.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_razz.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_redface.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_rolleyes.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_sad.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_smile.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_surprised.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_twisted.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/smilies/icon_wink.gif: Removed.
+ * WebKitSite/blog/wp-includes/images/upload.png: Removed.
+ * WebKitSite/blog/wp-includes/images/wlw: Removed.
+ * WebKitSite/blog/wp-includes/images/wlw/wp-comments.png: Removed.
+ * WebKitSite/blog/wp-includes/images/wlw/wp-icon.png: Removed.
+ * WebKitSite/blog/wp-includes/images/wlw/wp-watermark.png: Removed.
+ * WebKitSite/blog/wp-includes/js: Removed.
+ * WebKitSite/blog/wp-includes/js/autosave.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/autosave.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/codepress.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/codepress.html: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/codepress.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/engines: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/engines/gecko.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/engines/khtml.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/engines/msie.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/engines/older.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/engines/opera.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/images: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/images/line-numbers.png: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/asp.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/asp.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/autoit.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/autoit.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/csharp.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/csharp.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/css.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/css.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/generic.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/generic.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/html.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/html.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/java.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/java.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/javascript.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/javascript.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/perl.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/perl.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/php.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/php.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/ruby.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/ruby.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/sql.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/sql.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/text.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/text.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/vbscript.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/vbscript.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/xsl.css: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/languages/xsl.js: Removed.
+ * WebKitSite/blog/wp-includes/js/codepress/license.txt: Removed.
+ * WebKitSite/blog/wp-includes/js/colorpicker.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/colorpicker.js: Removed.
+ * WebKitSite/blog/wp-includes/js/comment-reply.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/comment-reply.js: Removed.
+ * WebKitSite/blog/wp-includes/js/crop: Removed.
+ * WebKitSite/blog/wp-includes/js/crop/cropper.css: Removed.
+ * WebKitSite/blog/wp-includes/js/crop/cropper.js: Removed.
+ * WebKitSite/blog/wp-includes/js/crop/marqueeHoriz.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/crop/marqueeVert.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/hoverIntent.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/hoverIntent.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jcrop: Removed.
+ * WebKitSite/blog/wp-includes/js/jcrop/Jcrop.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/jcrop/jquery.Jcrop.css: Removed.
+ * WebKitSite/blog/wp-includes/js/jcrop/jquery.Jcrop.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jcrop/jquery.Jcrop.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/interface.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.color.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.color.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.form.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.form.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.hotkeys.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.hotkeys.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.schedule.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.table-hotkeys.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/jquery.table-hotkeys.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/suggest.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/suggest.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.core.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.dialog.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.draggable.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.droppable.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.resizable.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.selectable.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.sortable.js: Removed.
+ * WebKitSite/blog/wp-includes/js/jquery/ui.tabs.js: Removed.
+ * WebKitSite/blog/wp-includes/js/prototype.js: Removed.
+ * WebKitSite/blog/wp-includes/js/quicktags.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/quicktags.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/MIT-LICENSE: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/builder.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/controls.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/dragdrop.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/effects.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/prototype.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/scriptaculous.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/slider.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/sound.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/unittest.js: Removed.
+ * WebKitSite/blog/wp-includes/js/scriptaculous/wp-scriptaculous.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfobject.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/handlers.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/handlers.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/plugins: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/plugins/swfupload.cookies.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/plugins/swfupload.queue.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/plugins/swfupload.speed.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/plugins/swfupload.swfobject.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/swfupload-all.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/swfupload.js: Removed.
+ * WebKitSite/blog/wp-includes/js/swfupload/swfupload.swf: Removed.
+ * WebKitSite/blog/wp-includes/js/thickbox: Removed.
+ * WebKitSite/blog/wp-includes/js/thickbox/loadingAnimation.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/thickbox/macFFBgHack.png: Removed.
+ * WebKitSite/blog/wp-includes/js/thickbox/tb-close.png: Removed.
+ * WebKitSite/blog/wp-includes/js/thickbox/thickbox.css: Removed.
+ * WebKitSite/blog/wp-includes/js/thickbox/thickbox.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/blank.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/langs/wp-langs-en.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/langs/wp-langs.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/license.txt: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/autosave: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/autosave/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/directionality: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/directionality/images: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/directionality/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/fullscreen: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/images: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/jscripts: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/inlinepopups/template.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/css/content.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/css/media.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img/flash.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img/flv_player.swf: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img/quicktime.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img/realmedia.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img/shockwave.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img/trans.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/js/embed.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/js/media.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/media/media.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/blank.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/images: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/js/pastetext.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/js/pasteword.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/jscripts: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/pastetext.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/paste/pasteword.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/safari: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/safari/blank.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/safari/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/utils: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/config.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/css/content.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/images: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/includes: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/spellchecker/rpc.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/tabfocus: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/css/content.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/images: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/help.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/image.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/media.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/more.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/page.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/img/video.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wordpress/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery/img/delete.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery/img/edit.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wphelp: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wphelp/images: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/plugins/wphelp/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/about.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/anchor.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/charmap.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/color_picker.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/editor_template.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/image.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/images: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/images/xp: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/img/fm.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/img/icons.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/img/sflogo.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js/about.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js/anchor.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js/charmap.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js/color_picker.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js/image.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js/link.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/js/source_editor.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/jscripts: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/langs: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/link.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/content.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/themes/advanced/source_editor.htm: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/tiny_mce.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/tiny_mce_popup.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/utils: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/utils/editable_selects.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/utils/form_utils.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/utils/mctabs.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/utils/validate.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/wp-mce-help.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/wp-tinymce.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/wp-tinymce.js.gz: Removed.
+ * WebKitSite/blog/wp-includes/js/tinymce/wp-tinymce.php: Removed.
+ * WebKitSite/blog/wp-includes/js/tw-sack.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/tw-sack.js: Removed.
+ * WebKitSite/blog/wp-includes/js/wp-ajax-response.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/wp-ajax-response.js: Removed.
+ * WebKitSite/blog/wp-includes/js/wp-lists.dev.js: Removed.
+ * WebKitSite/blog/wp-includes/js/wp-lists.js: Removed.
+ * WebKitSite/blog/wp-includes/kses.php: Removed.
+ * WebKitSite/blog/wp-includes/l10n.php: Removed.
+ * WebKitSite/blog/wp-includes/link-template.php: Removed.
+ * WebKitSite/blog/wp-includes/locale.php: Removed.
+ * WebKitSite/blog/wp-includes/media.php: Removed.
+ * WebKitSite/blog/wp-includes/pluggable.php: Removed.
+ * WebKitSite/blog/wp-includes/plugin.php: Removed.
+ * WebKitSite/blog/wp-includes/pomo: Removed.
+ * WebKitSite/blog/wp-includes/pomo/entry.php: Removed.
+ * WebKitSite/blog/wp-includes/pomo/mo.php: Removed.
+ * WebKitSite/blog/wp-includes/pomo/po.php: Removed.
+ * WebKitSite/blog/wp-includes/pomo/streams.php: Removed.
+ * WebKitSite/blog/wp-includes/pomo/translations.php: Removed.
+ * WebKitSite/blog/wp-includes/post-template.php: Removed.
+ * WebKitSite/blog/wp-includes/post.php: Removed.
+ * WebKitSite/blog/wp-includes/query.php: Removed.
+ * WebKitSite/blog/wp-includes/registration-functions.php: Removed.
+ * WebKitSite/blog/wp-includes/registration.php: Removed.
+ * WebKitSite/blog/wp-includes/rewrite.php: Removed.
+ * WebKitSite/blog/wp-includes/rss-functions.php: Removed.
+ * WebKitSite/blog/wp-includes/rss.php: Removed.
+ * WebKitSite/blog/wp-includes/script-loader.php: Removed.
+ * WebKitSite/blog/wp-includes/shortcodes.php: Removed.
+ * WebKitSite/blog/wp-includes/streams.php: Removed.
+ * WebKitSite/blog/wp-includes/taxonomy.php: Removed.
+ * WebKitSite/blog/wp-includes/template-loader.php: Removed.
+ * WebKitSite/blog/wp-includes/theme.php: Removed.
+ * WebKitSite/blog/wp-includes/update.php: Removed.
+ * WebKitSite/blog/wp-includes/user.php: Removed.
+ * WebKitSite/blog/wp-includes/vars.php: Removed.
+ * WebKitSite/blog/wp-includes/version.php: Removed.
+ * WebKitSite/blog/wp-includes/widgets.php: Removed.
+ * WebKitSite/blog/wp-includes/wlwmanifest.xml: Removed.
+ * WebKitSite/blog/wp-includes/wp-db.php: Removed.
+ * WebKitSite/blog/wp-includes/wp-diff.php: Removed.
+ * WebKitSite/blog/wp-links-opml.php: Removed.
+ * WebKitSite/blog/wp-load.php: Removed.
+ * WebKitSite/blog/wp-login.php: Removed.
+ * WebKitSite/blog/wp-mail.php: Removed.
+ * WebKitSite/blog/wp-pass.php: Removed.
+ * WebKitSite/blog/wp-rdf.php: Removed.
+ * WebKitSite/blog/wp-register.php: Removed.
+ * WebKitSite/blog/wp-rss.php: Removed.
+ * WebKitSite/blog/wp-rss2.php: Removed.
+ * WebKitSite/blog/wp-settings.php: Removed.
+ * WebKitSite/blog/wp-trackback.php: Removed.
+ * WebKitSite/blog/xmlrpc.php: Removed.
+ * WebKitSite/building: Removed.
+ * WebKitSite/building/build-window.png: Removed.
+ * WebKitSite/building/build.html: Removed.
+ * WebKitSite/building/checkout.html: Removed.
+ * WebKitSite/building/custom-executable.png: Removed.
+ * WebKitSite/building/cygwin-downloader.zip: Removed.
+ * WebKitSite/building/debug.html: Removed.
+ * WebKitSite/building/debug.png: Removed.
+ * WebKitSite/building/info-tab.png: Removed.
+ * WebKitSite/building/launch-debugger-vs2005.png: Removed.
+ * WebKitSite/building/run.html: Removed.
+ * WebKitSite/building/set-as-startup-project-vs2005.png: Removed.
+ * WebKitSite/building/set-debugging-properties-vs2005.png: Removed.
+ * WebKitSite/building/tools.html: Removed.
+ * WebKitSite/coding: Removed.
+ * WebKitSite/coding/RefPtr.html: Removed.
+ * WebKitSite/coding/assertion-guidelines.html: Removed.
+ * WebKitSite/coding/bsd-license.html: Removed.
+ * WebKitSite/coding/coding-style.html: Removed.
+ * WebKitSite/coding/commit-review-policy.html: Removed.
+ * WebKitSite/coding/contributing.html: Removed.
+ * WebKitSite/coding/dom-element-attach.html: Removed.
+ * WebKitSite/coding/images: Removed.
+ * WebKitSite/coding/images/contribute_add_attachment.png: Removed.
+ * WebKitSite/coding/images/contribute_mark_review.png: Removed.
+ * WebKitSite/coding/images/dom-element-attach-large.png: Removed.
+ * WebKitSite/coding/images/dom-element-attach-small.png: Removed.
+ * WebKitSite/coding/images/dom-element-attach.graffle: Removed.
+ * WebKitSite/coding/lgpl-license.html: Removed.
+ * WebKitSite/coding/major-objects.html: Removed.
+ * WebKitSite/coding/scripts.html: Removed.
+ * WebKitSite/coding/technical-articles.html: Removed.
+ * WebKitSite/contact.html: Removed.
+ * WebKitSite/css: Removed.
+ * WebKitSite/css/blue.css: Removed.
+ * WebKitSite/css/gray.css: Removed.
+ * WebKitSite/css/green.css: Removed.
+ * WebKitSite/css/ie.css: Removed.
+ * WebKitSite/css/main.css: Removed.
+ * WebKitSite/css/pink.css: Removed.
+ * WebKitSite/css/purple.css: Removed.
+ * WebKitSite/css/yellow.css: Removed.
+ * WebKitSite/demos: Removed.
+ * WebKitSite/demos/accessible-ascii-art: Removed.
+ * WebKitSite/demos/accessible-ascii-art/butterfly-figure.html: Removed.
+ * WebKitSite/demos/accessible-ascii-art/butterfly.html: Removed.
+ * WebKitSite/demos/calendar: Removed.
+ * WebKitSite/demos/calendar/Boom.aiff: Removed.
+ * WebKitSite/demos/calendar/Calendar.css: Removed.
+ * WebKitSite/demos/calendar/Calendar.html: Removed.
+ * WebKitSite/demos/calendar/Calendar.js: Removed.
+ * WebKitSite/demos/calendar/Calendar.manifest: Removed.
+ * WebKitSite/demos/calendar/CalendarApp.icns: Removed.
+ * WebKitSite/demos/calendar/Images: Removed.
+ * WebKitSite/demos/calendar/Images/AirPort4.png: Removed.
+ * WebKitSite/demos/calendar/Images/AirPortError.png: Removed.
+ * WebKitSite/demos/calendar/Images/disclosureTriangleSmallDown.png: Removed.
+ * WebKitSite/demos/calendar/Images/disclosureTriangleSmallRight.png: Removed.
+ * WebKitSite/demos/calendar/Images/statusbarBackground.png: Removed.
+ * WebKitSite/demos/calendar/Images/statusbarResizerVertical.png: Removed.
+ * WebKitSite/demos/calendar/LocationImage.js: Removed.
+ * WebKitSite/demos/calendar/Utilities.js: Removed.
+ * WebKitSite/demos/calendar/favicon.ico: Removed.
+ * WebKitSite/demos/calendar/index.html: Removed.
+ * WebKitSite/demos/calendar/mime.types: Removed.
+ * WebKitSite/demos/canvas-perf: Removed.
+ * WebKitSite/demos/canvas-perf/canvas.html: Removed.
+ * WebKitSite/demos/canvas-perf/kraken.jpg: Removed.
+ * WebKitSite/demos/editingToolbar: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbar.css: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbar.js: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/button.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/buttonLeft.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/buttonMiddle.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/buttonPressed.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/buttonPressedLeft.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/buttonPressedMiddle.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/buttonPressedRight.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/buttonRight.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/camera.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/link.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/textAlign.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutline.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineBottom.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineBottomLeft.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineBottomRight.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineLeft.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineRight.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineTop.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineTopLeft.png: Removed.
+ * WebKitSite/demos/editingToolbar/FancyToolbarImages/toolbarOutlineTopRight.png: Removed.
+ * WebKitSite/demos/editingToolbar/content.html: Removed.
+ * WebKitSite/demos/editingToolbar/images: Removed.
+ * WebKitSite/demos/editingToolbar/images/safari.png: Removed.
+ * WebKitSite/demos/editingToolbar/index.html: Removed.
+ * WebKitSite/demos/hover-summary: Removed.
+ * WebKitSite/demos/hover-summary/details.css: Removed.
+ * WebKitSite/demos/hover-summary/details.js: Removed.
+ * WebKitSite/demos/hover-summary/example1.html: Removed.
+ * WebKitSite/demos/hover-summary/example2.html: Removed.
+ * WebKitSite/demos/hover-summary/horizontal-triangle.png: Removed.
+ * WebKitSite/demos/hover-summary/vertical-triangle.png: Removed.
+ * WebKitSite/demos/index.html: Removed.
+ * WebKitSite/demos/mathml: Removed.
+ * WebKitSite/demos/mathml/MathMLDemo.xhtml: Removed.
+ * WebKitSite/demos/sticky-notes: Removed.
+ * WebKitSite/demos/sticky-notes/StickyNotes.manifest: Removed.
+ * WebKitSite/demos/sticky-notes/deleteButton.png: Removed.
+ * WebKitSite/demos/sticky-notes/deleteButtonPressed.png: Removed.
+ * WebKitSite/demos/sticky-notes/index.html: Removed.
+ * WebKitSite/demos/transitions-and-transforms: Removed.
+ * WebKitSite/demos/transitions-and-transforms/Finder Coverflow.png: Removed.
+ * WebKitSite/demos/transitions-and-transforms/Horsehead.png: Removed.
+ * WebKitSite/demos/transitions-and-transforms/Mail Stationery.png: Removed.
+ * WebKitSite/demos/transitions-and-transforms/Quick Look.png: Removed.
+ * WebKitSite/demos/transitions-and-transforms/Spaces.png: Removed.
+ * WebKitSite/demos/transitions-and-transforms/Stacks.png: Removed.
+ * WebKitSite/demos/transitions-and-transforms/Time Machine.png: Removed.
+ * WebKitSite/demos/transitions-and-transforms/index.html: Removed.
+ * WebKitSite/demos/transitions-and-transforms/leopard.css: Removed.
+ * WebKitSite/demos/transitions-and-transforms/no-style.html: Removed.
+ * WebKitSite/favicon.ico: Removed.
+ * WebKitSite/footer.inc: Removed.
+ * WebKitSite/header.inc: Removed.
+ * WebKitSite/images: Removed.
+ * WebKitSite/images/DroseraPic.png: Removed.
+ * WebKitSite/images/blank.png: Removed.
+ * WebKitSite/images/blue-background.png: Removed.
+ * WebKitSite/images/blue-bullet.png: Removed.
+ * WebKitSite/images/download.png: Removed.
+ * WebKitSite/images/end.png: Removed.
+ * WebKitSite/images/gray-background.png: Removed.
+ * WebKitSite/images/green-background.png: Removed.
+ * WebKitSite/images/green-bullet.png: Removed.
+ * WebKitSite/images/icon-gold.png: Removed.
+ * WebKitSite/images/icon.png: Removed.
+ * WebKitSite/images/ie-nav.png: Removed.
+ * WebKitSite/images/middle.png: Removed.
+ * WebKitSite/images/nav.png: Removed.
+ * WebKitSite/images/pink-background.png: Removed.
+ * WebKitSite/images/pink-bullet.png: Removed.
+ * WebKitSite/images/purple-background.png: Removed.
+ * WebKitSite/images/purple-bullet.png: Removed.
+ * WebKitSite/images/surfin-safari.icns: Removed.
+ * WebKitSite/images/yellow-background.png: Removed.
+ * WebKitSite/images/yellow-bullet.png: Removed.
+ * WebKitSite/index.html: Removed.
+ * WebKitSite/misc: Removed.
+ * WebKitSite/misc/DatabaseExample.html: Removed.
+ * WebKitSite/misc/DatabaseTester.html: Removed.
+ * WebKitSite/misc/WebKitDetect.html: Removed.
+ * WebKitSite/misc/WebKitDetect.js: Removed.
+ * WebKitSite/misc/drosera: Removed.
+ * WebKitSite/misc/drosera/demo.js: Removed.
+ * WebKitSite/misc/drosera/drosera.png: Removed.
+ * WebKitSite/misc/drosera/index.html: Removed.
+ * WebKitSite/misc/gradient-input.html: Removed.
+ * WebKitSite/misc/morph.html: Removed.
+ * WebKitSite/nav.inc: Removed.
+ * WebKitSite/perf: Removed.
+ * WebKitSite/perf/slickspeed: Removed.
+ * WebKitSite/perf/slickspeed/config.ini: Removed.
+ * WebKitSite/perf/slickspeed/footer.html: Removed.
+ * WebKitSite/perf/slickspeed/frameworks: Removed.
+ * WebKitSite/perf/slickspeed/frameworks/DomQuery.js: Removed.
+ * WebKitSite/perf/slickspeed/frameworks/dummy.js: Removed.
+ * WebKitSite/perf/slickspeed/frameworks/jquery-1.2.3.js: Removed.
+ * WebKitSite/perf/slickspeed/frameworks/prototype.js: Removed.
+ * WebKitSite/perf/slickspeed/header.html: Removed.
+ * WebKitSite/perf/slickspeed/index.php: Removed.
+ * WebKitSite/perf/slickspeed/instructions.txt: Removed.
+ * WebKitSite/perf/slickspeed/logo.png: Removed.
+ * WebKitSite/perf/slickspeed/selectors.list: Removed.
+ * WebKitSite/perf/slickspeed/style.css: Removed.
+ * WebKitSite/perf/slickspeed/system: Removed.
+ * WebKitSite/perf/slickspeed/system/index.php: Removed.
+ * WebKitSite/perf/slickspeed/system/slickspeed.js: Removed.
+ * WebKitSite/perf/slickspeed/system/template.php: Removed.
+ * WebKitSite/perf/slickspeed/template.html: Removed.
+ * WebKitSite/perf/sunspider: Removed.
+ * WebKitSite/perf/sunspider-0.9: Removed.
+ * WebKitSite/perf/sunspider-0.9.1: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/json2.js: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9.1: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9.1/driver.html: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9.1/results.html: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9.1/sunspider-test-contents.js: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9.1/sunspider-test-prefix.js: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9/driver.html: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9/results.html: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9/sunspider-test-contents.js: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-0.9/sunspider-test-prefix.js: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-analyze-results.js: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider-compare-results.js: Removed.
+ * WebKitSite/perf/sunspider-0.9.1/sunspider.css: Removed.
+ * WebKitSite/perf/sunspider-0.9/3d-cube.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/3d-morph.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/3d-raytrace.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/access-binary-trees.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/access-fannkuch.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/access-nbody.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/access-nsieve.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/bitops-3bit-bits-in-byte.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/bitops-bits-in-byte.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/bitops-bitwise-and.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/bitops-nsieve-bits.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/controlflow-recursive.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/crypto-aes.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/crypto-md5.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/crypto-sha1.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/date-format-tofte.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/date-format-xparb.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/math-cordic.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/math-partial-sums.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/math-spectral-norm.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/regexp-dna.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/string-base64.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/string-fasta.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/string-tagcloud.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/string-unpack-code.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/string-validate-input.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/sunspider-analyze-results.js: Removed.
+ * WebKitSite/perf/sunspider-0.9/sunspider-compare-results.js: Removed.
+ * WebKitSite/perf/sunspider-0.9/sunspider-driver.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/sunspider-record-result.js: Removed.
+ * WebKitSite/perf/sunspider-0.9/sunspider-results.html: Removed.
+ * WebKitSite/perf/sunspider-0.9/sunspider-test-prefix.js: Removed.
+ * WebKitSite/perf/sunspider-0.9/sunspider.css: Removed.
+ * WebKitSite/perf/sunspider/sunspider.css: Removed.
+ * WebKitSite/perf/sunspider/sunspider.html: Removed.
+ * WebKitSite/pngbehavior.htc: Removed.
+ * WebKitSite/projects: Removed.
+ * WebKitSite/projects/accessibility: Removed.
+ * WebKitSite/projects/accessibility/index.html: Removed.
+ * WebKitSite/projects/cleanup: Removed.
+ * WebKitSite/projects/cleanup/index.html: Removed.
+ * WebKitSite/projects/compat: Removed.
+ * WebKitSite/projects/compat/index.html: Removed.
+ * WebKitSite/projects/css: Removed.
+ * WebKitSite/projects/css/index.html: Removed.
+ * WebKitSite/projects/documentation: Removed.
+ * WebKitSite/projects/documentation/index.html: Removed.
+ * WebKitSite/projects/dom: Removed.
+ * WebKitSite/projects/dom/index.html: Removed.
+ * WebKitSite/projects/editing: Removed.
+ * WebKitSite/projects/editing/index.html: Removed.
+ * WebKitSite/projects/forms: Removed.
+ * WebKitSite/projects/forms/index.html: Removed.
+ * WebKitSite/projects/goals.html: Removed.
+ * WebKitSite/projects/html: Removed.
+ * WebKitSite/projects/html/index.html: Removed.
+ * WebKitSite/projects/index.html: Removed.
+ * WebKitSite/projects/javascript: Removed.
+ * WebKitSite/projects/javascript/index.html: Removed.
+ * WebKitSite/projects/layout: Removed.
+ * WebKitSite/projects/layout/index.html: Removed.
+ * WebKitSite/projects/mathml: Removed.
+ * WebKitSite/projects/mathml/index.html: Removed.
+ * WebKitSite/projects/performance: Removed.
+ * WebKitSite/projects/performance/index.html: Removed.
+ * WebKitSite/projects/plugins: Removed.
+ * WebKitSite/projects/plugins/index.html: Removed.
+ * WebKitSite/projects/portability: Removed.
+ * WebKitSite/projects/portability/index.html: Removed.
+ * WebKitSite/projects/printing: Removed.
+ * WebKitSite/projects/printing/index.html: Removed.
+ * WebKitSite/projects/svg: Removed.
+ * WebKitSite/projects/svg/index.html: Removed.
+ * WebKitSite/projects/svg/status.xml: Removed.
+ * WebKitSite/projects/svg/svg-status.css: Removed.
+ * WebKitSite/projects/svg/svg-status.xsl: Removed.
+ * WebKitSite/projects/webkit: Removed.
+ * WebKitSite/projects/webkit/index.html: Removed.
+ * WebKitSite/projects/xml: Removed.
+ * WebKitSite/projects/xml/index.html: Removed.
+ * WebKitSite/projects/xslt: Removed.
+ * WebKitSite/projects/xslt/index.html: Removed.
+ * WebKitSite/quality: Removed.
+ * WebKitSite/quality/.htaccess: Removed.
+ * WebKitSite/quality/Ahem.ttf: Removed.
+ * WebKitSite/quality/bugpriorities.html: Removed.
+ * WebKitSite/quality/bugwriting.html: Removed.
+ * WebKitSite/quality/bugzilla.html: Removed.
+ * WebKitSite/quality/crashlogs.html: Removed.
+ * WebKitSite/quality/leakhunting.html: Removed.
+ * WebKitSite/quality/lifecycle.html: Removed.
+ * WebKitSite/quality/mac_reportbox.jpg: Removed.
+ * WebKitSite/quality/mac_viewtrace.jpg: Removed.
+ * WebKitSite/quality/reduction.html: Removed.
+ * WebKitSite/quality/reporting.html: Removed.
+ * WebKitSite/quality/testing.html: Removed.
+ * WebKitSite/quality/testwriting.html: Removed.
+ * WebKitSite/quality/win_installwatson.jpg: Removed.
+ * WebKitSite/quality/win_watsongui.jpg: Removed.
+ * WebKitSite/quality/win_watsoninstalled.jpg: Removed.
+ * WebKitSite/security: Removed.
+ * WebKitSite/security/index.html: Removed.
+ * WebKitSite/security/security-group-members.html: Removed.
+ * WebKitSite/specs: Removed.
+ * WebKitSite/specs/CSSVisualEffects: Removed.
+ * WebKitSite/specs/CSSVisualEffects/css3-2d-transforms: Removed.
+ * WebKitSite/specs/CSSVisualEffects/css3-3d-transforms: Removed.
+ * WebKitSite/specs/CSSVisualEffects/css3-animations: Removed.
+ * WebKitSite/specs/CSSVisualEffects/css3-transitions: Removed.
+ * WebKitSite/specs/CSSVisualEffects/index.html: Removed.
+ * WebKitSite/specs/HTML_Timed_Media_Elements.html: Removed.
+ * WebKitSite/specs/MediaQueriesExtensions.html: Removed.
+ * WebKitSite/specs/PointerEventsProperty.html: Removed.
+ * WebKitSite/specs/Timed_Media_CSS.html: Removed.
+ * WebKitSite/specs/Timed_Media_Elements-Open_Issues.html: Removed.
+ * WebKitSite/specs/index.html: Removed.
+ * WebKitSite/specs/mediaelement.css: Removed.
+ * WebKitSite/specs/movie-status-states.png: Removed.
+ * WebKitSite/specs/squirrelfish-bytecode.html: Removed.
+ * cmake/WebKitPackaging.cmake:
+
+2010-12-20 Joseph Pecoraro <joepeck@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Update .gitattributes for WebKitTools -> Tools change
+ https://bugs.webkit.org/show_bug.cgi?id=51365
+
+ * .gitattributes: WebKitTools -> Tools rename. Removed no longer existing file references.
+
+2010-12-20 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ * configure.ac: bump version for 1.3.8 release.
+
+2010-12-20 David Levin <levin@chromium.org>
+
+ Reviewed by Ariya Hidayat.
+
+ .gitignore and webkit-tools-completion.sh have references to WebKitTools that should be Tools.
+ https://bugs.webkit.org/show_bug.cgi?id=51343
+
+ Follow up from the WebKitTools -> Tools rename.
+
+ * .gitignore:
+
+2010-12-20 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [CMAKE] Rename WEBKITTOOLS_DIR to TOOLS_DIR
+ https://bugs.webkit.org/show_bug.cgi?id=51319
+
+ Change WEBKITTOOLS_DIR variable's name and value to TOOLS_DIR and tools/.
+
+ * CMakeLists.txt:
+
+2010-12-18 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ Move WebKitExamplePlugins to Examples
+ https://bugs.webkit.org/show_bug.cgi?id=51291
+
+ * Examples: Copied from WebKitExamplePlugins.
+ * WebKitExamplePlugins: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/English.lproj: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/English.lproj/InfoPlist.strings: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/Info.plist: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/MenuHandler.h: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/MenuHandler.m: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/main.m: Removed.
+ * WebKitExamplePlugins/NetscapeCocoaPlugin/test.html: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/English.lproj: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/English.lproj/InfoPlist.strings: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/Info.plist: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.h: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.m: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj/project.pbxproj: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/Pause.tiff: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/Play.tiff: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/SliderTrackCenter.tiff: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/SliderTrackLeft.tiff: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/SliderTrackRight.tiff: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/Thumb.tiff: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/main.m: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationMoviePlugin/test.html: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/Composition.qtz: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/English.lproj: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/English.lproj/InfoPlist.strings: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/Info.plist: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj/project.pbxproj: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/main.m: Removed.
+ * WebKitExamplePlugins/NetscapeCoreAnimationPlugin/test.html: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin/English.lproj: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin/English.lproj/InfoPlist.strings: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin/Info.plist: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj/project.pbxproj: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin/main.m: Removed.
+ * WebKitExamplePlugins/NetscapeInputMethodPlugin/test.html: Removed.
+ * cmake/WebKitPackaging.cmake:
+
+2010-12-17 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Rename WebKitTools to Tools
+ https://bugs.webkit.org/show_bug.cgi?id=49861
+
+ * DerivedSources.pro:
+ * GNUmakefile.am:
+ * MakeFile:
+ * MakeFile.shared:
+ * Tools: Renamed from WebKitTools.
+ * WebKit.pro:
+ * cmake/WebKitPackaging.cmake:
+ * wscript:
+
+2010-12-16 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Unreviewed build fix.
+
+ Disable ContextMenu support for now while support for
+ CROSS_PLATFORM_MENUS is written.
+
+ * cmake/OptionsEfl.cmake:
+
+2010-12-15 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r74117.
+ http://trac.webkit.org/changeset/74117
+ https://bugs.webkit.org/show_bug.cgi?id=51113
+
+ This broke the GTK1 build. (Requested by mrobinson on
+ #webkit).
+
+ * GNUmakefile.am:
+ * configure.ac:
+
+2010-12-15 Amruth Raj <amruthraj@motorola.com> and Ravi Kasibhatla <ravi.kasibhatla@motorola.com>
+
+ Reviewed by Martin Robinson.
+
+ Changes to enable building WebKit2 for Gtk port.
+ (https://bugs.webkit.org/show_bug.cgi?id=37369)
+
+ * GNUmakefile.am: Changes to build either of WebKit1 or WebKit2.
+ It basically excludes all WebKit/gtk/webkit/ files when building WebKit2.
+ Also, exludes Unittests, DumprenderTree, GtkLauncher etc for WebKit2.
+ * configure.ac: Option for enable or disable WebKit2.
+
+2010-12-14 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-12-14 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-12-14 Ryosuke Niwa <rniwa@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ [git].DS_Store should be in .gitignore
+ https://bugs.webkit.org/show_bug.cgi?id=51065
+
+ Added .DS_Store to .gitignore.
+
+ * .gitignore:
+
+2010-12-14 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Eric Seidel.
+
+ [EFL] Add linker script to export less symbols
+ https://bugs.webkit.org/show_bug.cgi?id=44609
+
+ Filter the exported symbols by using a linker script. Only symbols
+ starting with "ewk_" are exported.
+
+ * cmake/OptionsEfl.cmake: Pass linker option to use a version script
+ when linking webkit.
+ * cmake/eflsymbols.filter: Added. Export only symbols starting with
+ "ewk_" (C linkage).
+
+2010-12-13 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Unreviewed build fix for EFL.
+
+ Remove DataSourceGStreamer.cpp in WebCore/CMakeListsEfl.txt
+ Because, DataSourceGStreamer.cpp was removed by Bug 30007.
+
+ * ../WebCore/CMakeListsEfl.txt:
+
+2010-12-13 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt][WK2] Fix build if WebKitTools are not available
+ https://bugs.webkit.org/show_bug.cgi?id=50242
+
+ * DerivedSources.pro: add new DerivedSources.pro to SUBDIRS.
+
+2010-12-06 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Support the Mozilla-style Fullscreen Javascript API
+ https://bugs.webkit.org/show_bug.cgi?id=50572
+
+ * configure.ac: new configure flag to disable the new Javascript
+ Fullscreen API build. It is enabled by default.
+
+2010-12-09 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] configure: error out if video is enabled and gstreamer pkg-config check fails
+ https://bugs.webkit.org/show_bug.cgi?id=50741
+
+ * configure.ac:
+
+2010-12-07 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [CMake] Remove WebKitGenerators
+ https://bugs.webkit.org/show_bug.cgi?id=50445
+
+ * CMakeLists.txt:
+ * cmake/WebKitGenerators.cmake: Removed.
+
+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
+
+ * cmake/OptionsWinCE.cmake: Added.
+ * cmake/OptionsWindows.cmake: Added.
+
+2010-12-04 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [CMake] Better detection of ARM platform
+ https://bugs.webkit.org/show_bug.cgi?id=50452
+
+ * CMakeLists.txt:
+
+2010-12-03 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed build fix for GTK+.
+
+ Add configure.ac-fu for WebAudio.
+
+ * configure.ac:
+
+2010-12-02 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Eric Seidel.
+
+ [EFL] Fails to build with non-system cairo
+ https://bugs.webkit.org/show_bug.cgi?id=50395
+
+ Do not add 'cairo' as a suffix for the paths provided by
+ pkgconfig. The paths provided by pkgconfig already include it.
+
+ * cmake/FindCairo.cmake:
+
+2010-12-02 Xan Lopez <xlopez@igalia.com>
+
+ Third attempt to fix the build.
+
+ * autotools/symbols.filter: be more liberal in one more symbol.
+
+2010-12-02 Xan Lopez <xlopez@igalia.com>
+
+ Another attempt to fix the GTK+ build.
+
+ * autotools/symbols.filter: try to be more liberal with the
+ mangled names of some symbols.
+
+2010-12-02 Xan Lopez <xlopez@igalia.com>
+
+ Try to fix GTK+ build.
+
+ * autotools/symbols.filter: add missing ';'.
+
+2010-12-02 Martin Robinson <mrobinson@igalia.com>
+
+ Attempt to fix the GTK+ build. Add missing symbol the
+ list of unfiltered symbols for the linker.
+
+ * autotools/symbols.filter: Add symbol used in DumpRenderTree.
+
+2010-12-02 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] DumpRenderTree has two copies of JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=49877
+
+ Prevent the need to compile JSC into DumpRenderTree twice, by adjusting
+ the symbol visibility rules for libwebkit. Make all JSC symbols visible,
+ while hiding WebCore/WebKit symbols.
+
+ * GNUmakefile.am: Move the symbol visibility flags to the WebKit build.
+ * autotools/symbols.filter: Update the symbol filter list with the real
+ mangled names of the symbols and include other symbols that DRT needs.
+
+2010-12-02 Daniel Bates <dbates@rim.com>
+
+ Add autotools generated files to svn:ignore so that these
+ files do not show up in an svn stat.
+
+ * .: Added properties svn:ignore, svn:ignore and svn:ignore. Modified property svn:ignore.
+ * autotools: Added property svn:ignore.
+
+2010-12-01 Adam Roben <aroben@apple.com>
+
+ Teach git to ignore files installed by WebKitSupportLibrary and
+ WebKitAuxiliaryLibrary
+
+ Fixes <http://webkit.org/b/50348> Git complains about lots of
+ untracked files in WebKitLibraries/win
+
+ Reviewed by Steve Falkenburg.
+
+ * .gitignore: Added files from these libraries.
+
+2010-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
+
+ * .gitattributes:
+
+2010-11-30 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [CMake] Use preprocessor argument in GENERATE_DOM_NAMES
+ https://bugs.webkit.org/show_bug.cgi?id=49886
+
+ * cmake/WebKitMacros.cmake:
+
+2010-11-30 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Move generator logic into WebCore CMakeLists.txt file
+ https://bugs.webkit.org/show_bug.cgi?id=49885
+
+ * cmake/WebKitMacros.cmake:
+
+2010-11-29 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ * configure.ac: bump version for 1.3.7 release.
+
+2010-11-28 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Antonio Gomes.
+
+ [Qt] Remove unused BASE_DIR from the build system
+ https://bugs.webkit.org/show_bug.cgi?id=50132
+
+ * WebKit.pri:
+
+2010-11-24 Hayato Ito <hayato@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add files which Chromium port generates to .gitignore.
+
+ https://bugs.webkit.org/show_bug.cgi?id=49943
+
+ * .gitignore:
+
+2010-11-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Levin.
+
+ Add WebKit2 VisualStudio files to .gitattributes
+ https://bugs.webkit.org/show_bug.cgi?id=49969
+
+ * .gitattributes:
+
+2010-11-19 Mihai Parparita <mihaip@chromium.org>
+
+ Add recent upstream Chromium dependencies to .gitignore.
+
+ * .gitignore:
+
+2010-11-17 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Changing any GNUmakefile.am in the source tree forces a rebuld of the DOM bindings and WebKit APi
+ https://bugs.webkit.org/show_bug.cgi?id=49400
+
+ Move WebKit API build rules out of GNUmakefile.am. These are now in
+ WebKit/gtk/GNUmakefile.am.
+
+ * GNUmakefile.am: Remove WebKit API build rules.
+
+2010-11-17 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-11-16 Andreas Kling <kling@webkit.org>
+
+ Unreviewed typo fix for previous commit.
+
+ * common.pri:
+
+2010-11-16 Andreas Kling <kling@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt][Scratchbox] Use gold linker explicitly when available
+
+ gold is faster at linking QtWebKit than binutils ld, but it cannot be
+ enabled by default on a system that compiles other Qt projects.
+ This is due to gold not supporting the --add-needed flag.
+
+ Original patch by Kimmo Kinnunen.
+
+ * common.pri:
+
+2010-11-16 Andreas Kling <kling@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Add 'valgrind' build mode
+
+ Passing CONFIG+=valgrind to qmake will now build WebKit in a way
+ suitable for debugging with Valgrind.
+
+ Original patch by Christian Sejersen.
+
+ * WebKit.pri:
+
+2010-11-15 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [CMake] Add additional flags to cmakeconfig.h
+ https://bugs.webkit.org/show_bug.cgi?id=49556
+
+ * cmake/OptionsEfl.cmake:
+ * cmakeconfig.h.cmake:
+
+2010-11-14 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Martin Robinson.
+
+ [EFL] add pango support
+ https://bugs.webkit.org/show_bug.cgi?id=46029
+
+ Add FONT_BACKEND option to switch between pango and freetype.
+
+ * cmake/OptionsEfl.cmake:
+
+2010-11-11 Eric Seidel <eric@webkit.org>
+
+ Rubber-stamped by Adam Roben.
+
+ * .: Modified property svn:ignore.
+ - Add WebKitSupportLibrary.zip and WebKitBuild to the root ignore list.
+
+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.
+
+ * cmake/OptionsEfl.cmake:
+ * cmakeconfig.h.cmake:
+ * configure.ac:
+
+2010-11-09 Gavin Peters <gavinp@chromium.org>
+
+ Reviewed by Xan Lopez.
+
+ gtk platform doesn't support link prefetch
+ https://bugs.webkit.org/show_bug.cgi?id=49234
+
+ * configure.ac:
+
+2010-11-08 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Update version numbers for release.
+
+ * configure.ac:
+
+2010-11-04 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Reviewed by Adam Barth.
+
+ [EFL] Enable HTML5 Video
+ https://bugs.webkit.org/show_bug.cgi?id=48972
+
+ Enable HTML 5 Video option for WebKit EFL.
+
+ * cmake/OptionsEfl.cmake:
+
+2010-11-01 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt][Symbian] QtTestBrowser runs out of memory with most of javascript benchmarks.
+ https://bugs.webkit.org/show_bug.cgi?id=48730
+
+ Increase the maximum heap size on Symbian to 256 MB.
+
+ * WebKit.pri:
+
+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
+
+ * cmake/OptionsEfl.cmake: Remove unnecessary ENABLE_SANDBOX.
+ * cmakeconfig.h.cmake:
+ * configure.ac:
+
+2010-10-26 Antonio Gomes <agomes@rim.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Implement DumpRenderTreeSupportGtk (similarly to DumpRenderTreeSupportQt idea)
+ https://bugs.webkit.org/show_bug.cgi?id=48199
+
+ * GNUmakefile.am: Added WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp|h to GTK+'s build system;
+ * autotools/symbols.filter: Added DumpRenderTreeSupportGtk symbols to symbols.filter so they do not get
+ filtered and get visible by DRT.
+
+2010-10-24 Anders Bakken <agbakken@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Disable enable_fast_mobile_scrolling for QWS
+ https://bugs.webkit.org/show_bug.cgi?id=48006
+
+ Turning this on breaks the acidtests for QWS/DirectFB and QWS/QVFB
+
+ * WebKit.pri:
+
+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-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-19 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Unreviewed, adding missed additionalArguments.
+
+ [CMAKE] additional arguments was missed in GENERATE_DOM_NAMES
+ https://bugs.webkit.org/show_bug.cgi?id=47694
+
+ Pass additionalArguments for make_names.pl to choose enabled features.
+
+ * cmake/WebKitMacros.cmake:
+
+2010-10-19 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r70034.
+ http://trac.webkit.org/changeset/70034
+ https://bugs.webkit.org/show_bug.cgi?id=47889
+
+ "Gustavo's bot is lame" (Requested by xan_ on #webkit).
+
+ * configure.ac:
+
+2010-10-19 Prof. MAAD <himself@prof-maad.org>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Correct erroneous documentation for webkit_web_navigation_action_get_button()
+ https://bugs.webkit.org/show_bug.cgi?id=46723
+
+ * WebKit/gtk/webkit/webkitwebnavigationaction.cpp:
+
+2010-10-19 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Bump minimum requirement for libsoup to 2.30
+ https://bugs.webkit.org/show_bug.cgi?id=46176
+
+ Bump minimum libsoup to required version to 2.30.0.
+
+ * configure.ac:
+
+2010-10-18 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Bump version numbers for 1.3.5 release.
+
+ * configure.ac:
+
+2006-10-27 Brady Eidson <beidson@apple.com>
+
+ 70,000!
+
+2010-10-15 Sergio Villar Senin <svillar@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Fix introspection support
+ https://bugs.webkit.org/show_bug.cgi?id=47723
+
+ Added HTTP cache directory to the WebkitGtk+ GIR sources.
+
+ * GNUmakefile.am:
+
+2010-10-14 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Fix -Werror after r68637 on x86 platforms.
+ Qt's build system sets QT_ARCH statically to i386 or x86_64 accordingly,
+ so check for this instead of only checking for x86.
+
+ * WebKit.pri:
+
+2010-10-13 Sergio Villar Senin <svillar@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Add HTTP caching support
+ https://bugs.webkit.org/show_bug.cgi?id=44261
+
+ Bump the required version of GLib. The serialization/deserialization
+ code of libsoup caching code uses GVariant, which was added to GLib in
+ version 2.24.
+
+ * GNUmakefile.am: Add paths for soup HTTP cache code.
+ * autotools/webkit.m4: Increase required glib version.
+
+2010-10-13 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Remove more warnings from the g-i scanner run
+ https://bugs.webkit.org/show_bug.cgi?id=47255
+
+ Fixes almost all warnings coming from the g-i scanner.
+
+ * GNUmakefile.am: Add missing files and include dirs to the
+ scanner run.
+
+2010-10-08 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Turn on building WTR
+ https://bugs.webkit.org/show_bug.cgi?id=47349
+
+ * DerivedSources.pro:
+ * WebKit.pro:
+
+2010-10-07 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>, Andras Becsi <abecsi@webkit.org>, Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Add WTR's InjectedBundle build files.
+ https://bugs.webkit.org/show_bug.cgi?id=47333
+
+ * DerivedSources.pro:
+ * WebKit.pro:
+
+2010-10-07 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r69315.
+ http://trac.webkit.org/changeset/69315
+ https://bugs.webkit.org/show_bug.cgi?id=47363
+
+ Forgot to add the new files (Requested by kbalazs on #webkit).
+
+ * DerivedSources.pro:
+
+2010-10-07 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>, Andras Becsi <abecsi@webkit.org>, Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Add WTR's InjectedBundle build files.
+ https://bugs.webkit.org/show_bug.cgi?id=47333
+
+ * DerivedSources.pro:
+ * WebKit.pro:
+
+2010-10-07 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Turn on building WTR
+ https://bugs.webkit.org/show_bug.cgi?id=47349
+
+ * WebKit.pro:
+
+2010-10-07 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Fix the build for GTK+ 3
+ https://bugs.webkit.org/show_bug.cgi?id=47249
+
+ Bump required gtk+-3 version to 2.91.0
+
+ * configure.ac:
+
+2010-10-07 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Rubber-stamped by Tor Arne Vestbø.
+
+ [Qt] Re-enable the web inspector for maemo6 builds
+
+ Yeah, it's strange :), but they really want it.
+
+ * WebKit.pri:
+
+2010-10-06 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Add WebKitTestRunner's build files
+ https://bugs.webkit.org/show_bug.cgi?id=44155
+
+ Add the new subdirs.
+ * DerivedSources.pro:
+ * WebKit.pro:
+
+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.
+
+ * cmake/OptionsEfl.cmake:
+
+2010-10-03 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Add Chromium depot_tools to files that git should ignore.
+
+ * .gitignore: Added WebKit/chromium/depot_tools.
+
+2010-09-30 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Fix typo in build script.
+
+ * wscript:
+
+2010-09-29 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Fix the build on non-x86 platforms with gcc
+
+ Don't disable -Werror on arm, that doesn't work when QT_ARCH is
+ for example armv6. Instead change the condition as the comment says,
+ enable -Werror on x86/gcc where we know it passes. On other platforms
+ gcc produces difference warnings, and when they're fixed we can add
+ them to the whitelist of -Werror-supported architectures.
+
+ * WebKit.pri:
+
+2010-09-28 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ check USE(GSTREAMER) instead of ENABLE(VIDEO) in gstreamer/ files
+ https://bugs.webkit.org/show_bug.cgi?id=46717
+
+ Define WTF_USE_GSTREAMER if configure found the gstreamer
+ development files and add the macro in the gcc command-line if needed.
+
+ * GNUmakefile.am:
+ * configure.ac:
+
+2010-09-28 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, build sources that used to be built as part of other sources.
+
+ * wscript:
+
+2010-09-28 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] One more build fix for Win.
+
+ * wscript:
+
+2010-09-28 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, ignore Qt-specific (for now?) source in platform/graphics.
+
+ * wscript:
+
+2010-09-28 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Undefined reference errors when linking due to gperf and inlining.
+ webkit.org/b/29244
+
+ EFL CMake changes by Leandro Pereira <leandro@profusion.mobi>
+
+ Refactor gperf code generation and usage to fix the debug build with gcc>4.4.
+ Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore
+ to access the functionality provided. This resulted in debug build failure with newer gcc versions
+ because of a behaviour change of gcc, which disables C style inlining in debug mode.
+ The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled
+ in their own compilation unit.
+ The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need
+ for multiple inclusions of generated C files to access these functions.
+
+ * cmake/WebKitMacros.cmake:
+
+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
+
+ Enabling GLIB_SUPPORT on all ports that use GLib to simplify
+ checks.
+
+ * GNUmakefile.am: Enabled the GLIB_SUPPORT define.
+
2010-09-24 Romain Pokrzywka <romain@kdab.com>
Reviewed by Simon Hausmann.
@@ -6,6 +5590,1249 @@
* WebKit.pri: Apply msvc flags to wince, too.
+2010-09-23 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Enable warnings during build by default
+ https://bugs.webkit.org/show_bug.cgi?id=46351
+
+ Change default build to enable several warnings like other ports do.
+ We need to pay special attention to "-Wall" in order to produce better
+ code, so highlight this keyword, too.
+
+ * cmake/WebKitHelpers.cmake:
+
+2010-09-22 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Fix build with GCC 4.4.x
+ https://bugs.webkit.org/show_bug.cgi?id=40826
+
+ Change the -fstrict-aliasing flag to -fno-strict-aliasing as other
+ ports like GTK and QT are using in their build systems. It was failing
+ to execute when compiled with GCC 4.4.x in Release mode.
+
+ Refactor the flags in order to be more readable.
+
+ * cmake/WebKitHelpers.cmake:
+
+2010-09-22 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Move the accelerated compositing build flag to the right place
+ https://bugs.webkit.org/show_bug.cgi?id=43882
+
+ * WebKit.pri: Removed the redundant version check.
+
+2010-09-21 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Martin Robinson.
+
+ Fix linking issues of the GTK+ port on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=45844
+
+ * GNUmakefile.am: link on Windows with ole32.dll, winmm.dll and shlwapi.dll
+ * configure.ac: link on Windows with ole32.dll, winmm.dll and shlwapi.dll
+ and export correctly all needed symbols from the libwebkitgtk DLL.
+
+2010-09-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Generate correct WebKit gir file with g-i 0.9.5
+ https://bugs.webkit.org/show_bug.cgi?id=46173
+
+ Generate a correct gir file for WebKit with the
+ gobject-introspection 0.9.5 scanner.
+
+ * GNUmakefile.am:
+
+2010-09-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Update for 1.3.4 release.
+
+ * configure.ac:
+
+2010-09-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Configure flag for Opcode stats
+ https://bugs.webkit.org/show_bug.cgi?id=46081
+
+ Opcode stats won't work with JIT enabled, so bail out if both are
+ enabled at the same time.
+
+ * configure.ac:
+
+2010-09-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Fix --disable-jit
+ https://bugs.webkit.org/show_bug.cgi?id=46080
+
+ Manually define ENABLE_JIT to 0 when we want the feature disabled.
+
+ If the value is undefined Platform.h will enable it again
+ automatically in some platforms, which is probably not what the
+ user wanted if he passed --disable-jit.
+
+ * configure.ac:
+
+2010-09-18 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, fix use of wrong case in name.
+
+ * wscript:
+
+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
+
+ * configure.ac:
+
+2010-09-15 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-09-15 Eric Seidel <eric@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-09-15 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fixes for wxMSW.
+
+ * wscript:
+
+2010-09-14 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] qmake doesn't generate correct dependencies for rcc resource files
+ https://bugs.webkit.org/show_bug.cgi?id=45747
+
+ * WebKit.pri: add OUT_PWD to DEPENDPATH
+
+2010-09-11 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] V8 port: webkit project files changes
+ https://bugs.webkit.org/show_bug.cgi?id=45140
+
+ * WebKit.pro: Don't compile JavaScriptCore and jsc when
+ building with v8.
+
+2010-09-11 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Make introspection work with g-o-i 0.9.5
+ https://bugs.webkit.org/show_bug.cgi?id=45590
+
+ Bump required gobject-introspection version to 0.9.5.
+
+ * configure.ac:
+
+2010-09-09 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Unreviewed buildfix.
+
+ [Qt] Treat warnings as errors by default for gcc
+ https://bugs.webkit.org/show_bug.cgi?id=43191
+
+ The buildfix r66990 fixes the build for the Maemo
+ branch of Qt, but the symbols maemo5 and 6 are not defined
+ for regular branches on ARM.
+ This fixes the build by disabling -Werror for any ARM platform.
+
+ * WebKit.pri: Don't add -Werror for arm platforms.
+
+2010-09-08 Peter Kasting <pkasting@google.com>
+
+ Reviewed by David Hyatt.
+
+ Add smooth scrolling framework, and a Windows implementation.
+ https://bugs.webkit.org/show_bug.cgi?id=32356
+
+ * wscript: Add Windows ScrollAnimator.
+
+2010-09-08 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed buildfix after r66972.
+
+ [Qt] Treat warnings as errors by default for gcc
+ https://bugs.webkit.org/show_bug.cgi?id=43191
+
+ * WebKit.pri: Don't add -Werror for maemo platforms.
+
+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
+
+ * configure.ac: Enable WebSocket by default.
+
+2010-09-08 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [EFL] Support to enable HTML5's Video based on gstreamer in WebKit-EFL
+ https://bugs.webkit.org/show_bug.cgi?id=44098
+
+ To support video of HTML5 based on gstreamer, add cmake files for gstreamer.
+
+ * cmake/FindGStreamer-App.cmake: Added.
+ * cmake/FindGStreamer-Base.cmake: Added.
+ * cmake/FindGStreamer-Interfaces.cmake: Added.
+ * cmake/FindGStreamer-Pbutils.cmake: Added.
+ * cmake/FindGStreamer-Plugins-Base.cmake: Added.
+ * cmake/FindGStreamer-Video.cmake: Added.
+ * cmake/FindGStreamer.cmake: Added.
+ * cmake/OptionsEfl.cmake:
+
+2010-09-08 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Treat warnings as errors by default for gcc
+ https://bugs.webkit.org/show_bug.cgi?id=43191
+
+ * WebKit.pri: -Werror added to QMAKE_CXXFLAGS for x86 Linux platforms
+
+2010-09-07 Arno Renevier <arno@renevier.net>
+
+ Reviewed by Holger Freyther.
+
+ gitignore *~ files and gtk *.pot files
+ https://bugs.webkit.org/show_bug.cgi?id=45129
+
+ * .gitignore:
+
+2010-09-04 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [EFL] Move test browser to WebKitTools directory
+ https://bugs.webkit.org/show_bug.cgi?id=45212
+
+ Follow other ports like QT and GTK which moved the test browser to
+ WebKitTools directory.
+
+ * CMakeLists.txt: Include test browser if port defines one.
+
+2010-09-02 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Name install directories according to library name
+ https://bugs.webkit.org/show_bug.cgi?id=45126
+
+ * cmake/OptionsEfl.cmake: Use library name in order to define the data
+ directory.
+
+2010-09-02 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Do not override custom compile flags
+ https://bugs.webkit.org/show_bug.cgi?id=45125
+
+ Set a default build type if and only if user did not define one as
+ command line options and he did not give custom CFLAGS or CXXFLAGS.
+ Otherwise, flags from default build type would override user-defined
+ ones.
+
+ * CMakeLists.txt:
+
+2010-09-02 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Fix double addition of -fPIC
+ https://bugs.webkit.org/show_bug.cgi?id=45122
+
+ When SHARED_CORE=ON, -fPIC is automatically added because all
+ libraries are dynamic. Only when static libraries are built that
+ -fPIC needs to be manually inserted (because the final library,
+ libewebkit.so, is dynamic).
+
+ * cmake/OptionsCommon.cmake: Remove -fPIC flag.
+ * cmake/WebKitHelpers.cmake: Add -fPIC flags iff SHARED_CORE=ON.
+
+2010-09-01 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Need to check LibSoup version
+ https://bugs.webkit.org/show_bug.cgi?id=44658
+
+ Add version check of LibSoup.
+
+ * cmake/FindLibSoup2.cmake:
+
+2010-08-31 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Martin Robinson.
+
+ Preparations for the 1.3.4 release. Bump webkit version to 543.7,
+ as well.
+
+ * configure.ac:
+
+2010-08-30 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Adam Barth.
+
+ [EFL] Remove compiler optimization for gcc 4.5.1
+ https://bugs.webkit.org/show_bug.cgi?id=44520
+
+ GCC 4.5.1 generates wrong code because of -ftree-sra which is enabled
+ by default at any optimization level.
+
+ Newer and older versions are not affected, so check for compiler
+ version before disabling this.
+
+ * cmake/WebKitHelpers.cmake: add flag depending on compiler version.
+
+2010-08-30 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [Gtk] gdk_display_get_core_pointer and gdk_device_get_core_pointer
+ are deprecated
+ https://bugs.webkit.org/show_bug.cgi?id=44787
+
+ We have replaced GtkVersioning.cpp with GtkVersioning.c and
+ created a function (getDefaultGDKPointerDevice) to get the pointer
+ of the window with the new APIs. We added that function to DRT and
+ copyandpaste unit test.
+
+ * GNUmakefile.am:
+
+2010-08-30 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] WebKit DOM bindings build should not depend on output GNUMakefile
+ https://bugs.webkit.org/show_bug.cgi?id=44805
+
+ Move the DOM bindings source lists and generator rules to
+ WebCore/bindings/gobject/GNUmakefile.am. This will prevent a full WebKit API
+ rebuild whenever the automake files change, decreasing build times.
+
+ * GNUmakefile.am:
+
+2010-08-27 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Adam Barth.
+
+ <http://webkit.org/b/44802> REGRESSION (r65351): WebCore build fails due to attempting to directly access WebKitTools/Scripts
+
+ Move create-html-entity-table in to WebCore so that the build is again self-contained.
+ The script is also updated to take input as a CSV file rather than JSON as the former
+ can be parsed without requiring a third-party Python module be installed.
+
+ * cmake/WebKitMacros.cmake:
+
+2010-08-27 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kevin Ollivier.
+
+ [BREWMP] Add build system
+ https://bugs.webkit.org/show_bug.cgi?id=44645
+
+ Check wxpython option only when build_port is wx.
+
+ * wscript:
+
+2010-08-27 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Unreviewed. Fix compiling dependencies on EFL port due to r65891.
+
+ No new functionality so no new tests.
+
+ * cmake/WebKitGenerators.cmake:
+
+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: Make the comments describing the global_* variables more readable and
+ correct. Move WebKit-specific include lines and definitions out of webkitgtk_cppflags,
+ corekit_cppflags and webcoregtk_cppflags and straight to the appropriate CPPFLAGS definition.
+ Use global_cppflags for compiler flags that apply to both C++ and C code. Move some JavaScriptCore
+ specific includes to the appropriate sub-directory GNUmakefile.am. Make sure the tests build
+ with the global CPP flags as well.
+
+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 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] CodeGeneratorGObject not picking up FEATURE_DEFINES
+ https://bugs.webkit.org/show_bug.cgi?id=44608
+
+ Move FEATURE_DEFINES declaration here, since it's used by the
+ bindings code generator. Also, fix typo in the variable holding
+ the defines.
+
+ * GNUmakefile.am:
+
+2010-08-25 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Unreviewed build fix.
+
+ [EFL] Build fix for revision 65332
+ https://bugs.webkit.org/show_bug.cgi?id=44543
+
+ Generated variables are now returned from FindPkgConfig, so no need
+ to document the custom ones.
+
+ * cmake/FindGthread.cmake:
+
+2010-08-24 Xan Lopez <xlopez@igalia.com>
+
+ Build fix, strike 2.
+
+ The unit tests are C files, so put the flag in global_cflags.
+
+ * GNUmakefile.am:
+
+2010-08-24 Xan Lopez <xlopez@igalia.com>
+
+ Try to fix GTK+ build.
+
+ Move GTK_API_VERSION_2 define to here, since we want to use it
+ outside of WebCore/WebKit.
+
+ * GNUmakefile.am:
+
+2010-08-24 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ [EFL] Unreviewed build fix after r65891.
+
+ r65891 renamed RemoteInspectorFrontend to InspectorFrontend. Rename
+ accordingly in CMake build system.
+
+ * cmake/WebKitGenerators.cmake:
+
+2010-08-20 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Unreviewed. Fix build when using GNU gold.
+ When linking with GNU gold, some symbols are not found: explicitly
+ link with the required libraries.
+
+ * cmake/FindFontconfig.cmake: Added.
+ * cmake/OptionsEfl.cmake: Find Fontconfig, JPEG, and PNG libraries.
+
+2010-08-19 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GStreamer] GTK XOverlay support in GStreamerGWorld
+ https://bugs.webkit.org/show_bug.cgi?id=39474
+
+ * configure.ac: gst-interfaces link support needed for use of
+ GstXOverlay interface.
+ * GNUmakefile.am: Added new FullscreenVideoController files in the
+ build.
+
+2010-08-18 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Bump library dependencies
+ https://bugs.webkit.org/show_bug.cgi?id=44182
+
+ Prepare for EFL release. All the EFL dependencies were bumped to
+ 1.0.0. Eina and Ecore_X needed a bump because of API has changed and
+ the others were changed just to follow those two and because this is
+ a stable release.
+
+ * cmake/FindEFL.cmake: Bump dependencies.
+
+2010-08-17 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: replace hand written InspectorBackendStub.js with generated one.
+ https://bugs.webkit.org/show_bug.cgi?id=43791
+
+ * GNUmakefile.am:
+
+2010-08-18 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r65595.
+ http://trac.webkit.org/changeset/65595
+ https://bugs.webkit.org/show_bug.cgi?id=44161
+
+ qt build failed (Requested by loislo on #webkit).
+
+ * GNUmakefile.am:
+
+2010-08-17 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: replace hand written InspectorBackendStub.js by generated one.
+ https://bugs.webkit.org/show_bug.cgi?id=43791
+
+ * GNUmakefile.am:
+
+2010-08-17 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ Add NetworkingContext to avoid layer violations
+ https://bugs.webkit.org/show_bug.cgi?id=42292
+
+ Preparation: Just add the files to the build system.
+
+ * GNUmakefile.am: Added new files.
+
+2010-08-17 Gustavo Noronha Silva <gustavo.noronha@collabora.couk>
+
+ Reviewed by Martin Robinson.
+
+ WebBackForwardList.get_{back|forward}_list_with_limit not introspectable
+ https://bugs.webkit.org/show_bug.cgi?id=43054
+
+ * GNUmakefile.am: Give also API implementation files to the GIR
+ scanner.
+
+2010-08-17 Martin Robinson <mrobinson@igalia.com>
+
+ GTK+ Build fix for those having stable versions of GLib.
+
+ * configure.ac: Only invoke GLIB_GSETTINGS if we have the necessary gio version.
+
+2010-08-17 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r65500.
+ http://trac.webkit.org/changeset/65500
+ https://bugs.webkit.org/show_bug.cgi?id=44108
+
+ Qt bots failed to compile. (Requested by loislo on #webkit).
+
+ * GNUmakefile.am:
+
+2010-08-17 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: replace hand written InspectorBackendStub.js by generated one.
+ https://bugs.webkit.org/show_bug.cgi?id=43791
+
+ * GNUmakefile.am:
+
+2010-08-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] GSettings support adds annoying warnings on systems with older glib versions
+ https://bugs.webkit.org/show_bug.cgi?id=44056
+
+ Add file containing GLIB_GSETTINGS macro so that
+ configure doesn't spit warnings in older systems.
+
+ * autotools/gsettings.m4: Added.
+ * .gitignore: Ignore files that are generated inside autotools
+ explicitely, because we have some that are kept in version
+ control.
+
+2010-08-16 Paul Sawaya <psawaya@apple.com>
+
+ Reviewed by Chris Marrin.
+
+ Added shader validation via ANGLE
+ https://bugs.webkit.org/show_bug.cgi?id=42405
+
+ Added ANGLE build to Makefile
+
+ * Makefile:
+
+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: Copied from WebCore/wscript.
+
+2010-08-15 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Build error on r65378
+ https://bugs.webkit.org/show_bug.cgi?id=44019
+
+ Add GENERATE_JSON macro for HTMLEntityNames.json instead of HTMLEntityNames.gperf
+
+ * cmake/WebKitMacros.cmake:
+
+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
+
+ * cmake/OptionsCommon.cmake:
+
+2010-08-14 Adrienne Walker <enne@google.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Update .gitignore file for more files
+ https://bugs.webkit.org/show_bug.cgi?id=43991
+
+ * .gitignore:
+
+2010-08-13 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Unreviewed build fix.
+
+ * cmake/FindGthread.cmake: Fix warnings about obsolete PKGCONFIG macro.
+ * cmake/WebKitGenerators.cmake: FLEX_EXECUTABLE was defined already
+ by the root CMakeLists.txt file, so remove relevant lines that
+ depends on FIND_PACKAGE_HANDLE_STANDARD_ARGS macro, which isn't
+ available anymore.
+
+2010-08-13 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ We have to add the ACLOCAL_FLAGS in the env to the autogen.sh
+ ACLOCAL_FLAGS variable in order to honor the value already
+ defined, jhbuild uses it to pass parameters.
+
+ * autogen.sh:
+
+2010-08-13 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Introduce Maemo6 for mobile features
+ https://bugs.webkit.org/show_bug.cgi?id=43969
+
+ * WebKit.pri: Use maemo6 where we also use maemo5.
+
+2010-08-13 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Clean up mobile feature useage
+ https://bugs.webkit.org/show_bug.cgi?id=43968
+
+ * WebKit.pri: Set feature defaults here for some Nokia specific mobile platforms
+
+2010-08-13 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ [CMake] Cleanup generator code.
+ https://bugs.webkit.org/show_bug.cgi?id=39164
+
+ * cmake/WebKitGenerators.cmake:
+ * cmake/WebKitMacros.cmake:
+
+2010-08-13 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ [CMake] Add missing FIND_PACKAGE(Gperf)
+ https://bugs.webkit.org/show_bug.cgi?id=43937
+
+ * CMakeLists.txt:
+
+2010-08-12 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add more Chromium-related dependency directories to .gitignore.
+ https://bugs.webkit.org/show_bug.cgi?id=43940
+
+ * .gitignore: Added all existing that are created by update-webkit --chromium.
+
+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
+
+ * GNUmakefile.am: GSettings rules.
+ * configure.ac: GSettings infrastructure, and check if we should
+ use it by looking for an appropriate version of GIO.
+
+2010-08-12 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [EFL] Making CMake keep track of theme dependencies.
+ https://bugs.webkit.org/show_bug.cgi?id=43862
+
+ Removing unused macro GENERATE_EDJ.
+
+ * cmake/WebKitEfl.cmake:
+
+2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r65225.
+ http://trac.webkit.org/changeset/65225
+ https://bugs.webkit.org/show_bug.cgi?id=43918
+
+ Broke EFL port build (Requested by acidx on #webkit).
+
+ * cmake/WebKitGenerators.cmake:
+ * cmake/WebKitMacros.cmake:
+
+2010-08-12 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ [CMake] Cleanup generator code.
+ https://bugs.webkit.org/show_bug.cgi?id=39164
+
+ * cmake/WebKitGenerators.cmake:
+ * cmake/WebKitMacros.cmake:
+
+2010-08-10 Balazs Kelemen <kb@inf.u-szeged.hu>
+
+ Reviewed by Antonio Gomes.
+
+ [Qt] Build WebKit2 into a static lib
+
+ https://bugs.webkit.org/show_bug.cgi?id=43621
+
+ * WebKit.pro: Moved WebKit2 into the subdirs before WebCore since WebCore links against the WebKit2 lib.
+
+2010-08-07 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r64904.
+ http://trac.webkit.org/changeset/64904
+ https://bugs.webkit.org/show_bug.cgi?id=43671
+
+ Broke the Qt Windows builders. (Requested by bbandix on
+ #webkit).
+
+ * WebKit.pro:
+
+2010-08-07 Balazs Kelemen <kb@inf.u-szeged.hu>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Build WebKit2 into a static lib
+
+ https://bugs.webkit.org/show_bug.cgi?id=43621
+
+ * WebKit.pro: Moved WebKit2 into the subdirs before WebCore since WebCore links against the WebKit2 lib.
+
+2010-08-06 ryuan choi <ryuan.choi@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Regression (64763) build fix for efl.
+ https://bugs.webkit.org/show_bug.cgi?id=43597
+
+ change ENABLE_BLOB_SLICE to ENABLE_BLOB for fixing build break
+
+ * cmake/OptionsEfl.cmake:
+
+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
+
+ * cmakeconfig.h.cmake:
+ * configure.ac:
+
+2010-08-05 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ Move files that are generated by the configure script to
+ DISTCLEANFILES, where they should be. This fixes building after a
+ make clean.
+
+ * GNUmakefile.am:
+
+2010-08-04 Siddharth Mathur <siddharth.mathur@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt][Symbian] Variable max heap size between target/emulator
+ https://bugs.webkit.org/show_bug.cgi?id=41480
+
+ * WebKit.pri: Symbian-only code block for EPOCHEAPSIZE configuration
+
+2010-08-03 Eric Seidel <eric@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-08-03 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Fix DOM event dispatch
+ https://bugs.webkit.org/show_bug.cgi?id=40847
+
+ Add new files to the build.
+
+ * GNUmakefile.am:
+
+2010-08-03 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Silence JSCore gir "creation".
+
+ * GNUmakefile.am:
+
+2010-08-02 Chris Fleizach <cfleizach@apple.com>
+
+ Unreviewed, rolling out r64471.
+ http://trac.webkit.org/changeset/64471
+ https://bugs.webkit.org/show_bug.cgi?id=43005
+
+ Rolling out https://bugs.webkit.org/show_bug.cgi?id=43005
+ until further discussion
+
+ * GNUmakefile.am:
+
+2010-08-02 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Add support for the Audio element in the DOM bindings
+ https://bugs.webkit.org/show_bug.cgi?id=43313
+
+ Add new files to the build.
+
+ * GNUmakefile.am:
+
+2010-08-02 Chris Fleizach <cfleizach@apple.com>
+
+ Reviewed by David Kilzer.
+
+ AX: Support methods for web apps to interact with the native accessibility APIs
+ https://bugs.webkit.org/show_bug.cgi?id=43005
+
+ * GNUmakefile.am:
+
+2010-08-02 Balazs Kelemen <kb@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Generate forwarding headers for WebKit2
+
+ https://bugs.webkit.org/show_bug.cgi?id=43336
+
+ * DerivedSources.pro: Added WebKit2/DerivedSources.pro to SUBDIRS if webkit2 is on.
+
+2010-07-30 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ [CMake] Add FindGperf.cmake
+ https://bugs.webkit.org/show_bug.cgi?id=39163
+
+ Add a clean gperf dedection since we need it for building.
+
+ * CMakeLists.txt:
+ * cmake/FindGperf.cmake: Added.
+
+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
+
+ Make WebKit-EFL follow libtool soname versioning scheme.
+
+ * cmake/OptionsEfl.cmake: Added PROJECT_VERSION_PATCH to PROJECT_VERSION.
+
+2010-07-29 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed build fix.
+
+ Fix installation of autogenerated header files.
+
+ * GNUmakefile.am: Fix autogenerated header file installation.
+
+2010-07-27 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed build fix.
+
+ Add missing webkitdomdefines.h header to the sources list.
+
+ * GNUmakefile.am: Add missing header to the sources list.
+
+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
+
+ * configure.ac:
+
+2010-07-26 ryuan choi <ryuan.choi@samsung.com>
+
+ Unreviewed build fix.
+
+ [EFL]REGRESSION(r63952): build break because of InspectorBackendDispatcher.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=43021
+
+ Modify cmake script to fix build break as adding InspectorBackendDispatcher.
+
+ * cmake/WebKitGenerators.cmake:
+
+2010-07-27 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Changing library names (appending suffix "_efl")
+ https://bugs.webkit.org/show_bug.cgi?id=42902
+
+ Instead of having libwebcore.so, we will have libwebcore_efl.so.
+ Same for javascriptcore and wtf when compiled as shared, and for jsc.
+
+ * cmake/OptionsEfl.cmake:
+
+2010-07-26 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Get rid of libgdom
+ https://bugs.webkit.org/show_bug.cgi?id=42378
+
+ Remove the need to build the libgdom intermediate library.
+
+ * GNUmakefile.am: Move the source list for the GObject DOM bindings to
+ the top-level GNUmakefile.am, since they are logically part of WebKit, instead
+ of WebCore. List all auto-generated files statically and remove no-longer-
+ used variables. Fix an issue where some places expected webkitenumtypes.cpp
+ to be generated in different directories.
+
+2010-07-24 Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Enable jit compilation on arm
+ https://bugs.webkit.org/show_bug.cgi?id=42856
+
+ Add missing bits to configure.ac to build the arm jit.
+ Compile and tested on debian sid armel on a qemu vm.
+
+ * configure.ac:
+
+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
+
+ Fixing support for compiling EFL port without glib.
+
+ * cmake/FindGthread.cmake: Added.
+ * cmake/OptionsEfl.cmake:
+
+2010-07-23 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Add support for using libcurl network backend.
+ https://bugs.webkit.org/show_bug.cgi?id=42286
+
+ Instead of just libsoup, the EFL port now can use libcurl backend.
+ This is a step in the direction of removing dependency on glib. Just
+ need to pass the option -DNETWORK_BACKEND=curl to cmake in order to
+ enable it.
+
+ * cmake/OptionsEfl.cmake:
+
+2010-07-23 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Enable the build of MiniBrowser.
+
+ * WebKit.pro: add MiniBrowser.pro to SUBDIRS.
+
+2010-07-23 Balazs Kelemen <kb@inf.u-szeged.hu>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Setup the QtWebProcess
+
+ https://bugs.webkit.org/show_bug.cgi?id=42623
+
+ * WebKit.pro: Add WebKit2.pro to the build guarded by webkit2 config variable.
+
+2010-07-20 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Enable Ecore-X on compile time
+ https://bugs.webkit.org/show_bug.cgi?id=42600
+
+ Check for a flag received from cmake configure and disable it
+ if necessary. Also disable it if Ecore-X wasn't found.
+
+ EFL port does not support automated tests yet.
+
+ * cmake/FindEFL.cmake:
+ * cmake/OptionsEfl.cmake:
+
+2010-07-20 Hans Wennborg <hans@chromium.org>
+
+ Reviewed by Steve Block.
+
+ Add WebCore/bindings/generic/RuntimeEnabledFeatures.cpp to build files
+ https://bugs.webkit.org/show_bug.cgi?id=42380
+
+ RuntimeEnabledFeatures.cpp and .h were moved from bindings/v8 to
+ bindings/generic a while a go (in r54593), but need to
+ be added to the build in order to be used.
+
+ No new functionality so no new tests.
+
+ * Android.mk:
+
+2010-07-16 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Unreviewed build system cleanup.
+
+ Remove reference to "mediaControlsGtk.css".
+
+ * cmake/WebKitGenerators.cmake:
+
+2010-07-16 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Build with MathML enabled. Fix build when MathML is enabled and
+ make it the default.
+ https://bugs.webkit.org/show_bug.cgi?id=42453
+
+ * cmake/OptionsEfl.cmake: build with MathML enabled as default.
+
+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: Remove unused variables. Rely on WebCore/GNUmakefile.am
+ to handle distributing IDL files from WebCore and to modify EXTRA_DIST.
+
+2010-07-14 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Get rid of libWebCoreJS
+ https://bugs.webkit.org/show_bug.cgi?id=42083
+
+ * GNUmakefile.am: Remove the libWebCoreJS library from the extra
+ link libraries. Add IDL files to the distribution manually, as they
+ are no longer included in the header list. This prevents a good deal
+ of repetition in the source listings by avoiding listing both the IDL
+ files and their final targets.
+
+2010-07-14 Vincent Scheib <scheib@chromium.org>
+
+ Reviewed by Kent Tamura
+
+ Configure Git to ignore build files generated by Chromium .gyp on windows.
+
+ Bug 42205: Chromium build files on windows not ignored by git
+ https://bugs.webkit.org/show_bug.cgi?id=42205
+
+ * .gitignore: Updated
+
+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).
+
+ * WebKit.pro:
+
+2010-07-13 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Oliver Hunt.
+
+ Separate CoreFoundation specific tests in JSC's testapi.c
+
+ testapi.c depends on the Core Foundation.
+ https://bugs.webkit.org/show_bug.cgi?id=40058
+
+ * WebKit.pro: enable compilation of JSC C API test.
+
+2010-07-13 Scott Violet <sky@chromium.org>
+
+ Reviewed by David Levin.
+
+ [Chromium] Makes pressing tab accept the currently selected item in a popup.
+ https://bugs.webkit.org/show_bug.cgi?id=42172
+
+ * WebCore/platform/chromium/PopupMenuChromium.cpp:
+
+2010-07-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Bump to 1.3.3
+
+ * configure.ac:
+
+2010-07-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Suffix .mo files with the GTK+ API version so that they can be
+ parallel installable.
+
+ * configure.ac:
+
+2010-07-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Add another include path to the scanner to avoid warnings related
+ to undefined types. It wasn't picking up <webkit/foo.h>-like
+ headers.
+
+ * GNUmakefile.am:
+
+2010-07-07 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Reviewed by Adam Barth.
+
+ [EFL] Fix cmake build and libsoup detection
+ Some changes should be done to cmake build system to fix the detection of libsoup and correct some link paths:
+ - LINK_FLAGS should be set using quotes, otherwise some wrong
+ substitution takes place;
+ - we should use LIBSOUP24_* instead of LIBSOUP_* since this is the
+ version we are using;
+ - need to set HAVE_LIBSOUP_2_29_90 if we find a version equal or newer
+ than that.
+ https://bugs.webkit.org/show_bug.cgi?id=41717
+
+ * cmake/OptionsEfl.cmake:
+
+2010-07-06 Leandro Pereira <leandro@profusion.mobi>
+
+ Unreviewed build fix.
+
+ [EFL] Add macro to generate inspector code.
+
+ * cmake/WebKitGenerators.cmake:
+
+2010-07-06 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed.
+
+ Build fix after r62549.
+
+ * GNUmakefile.am: Remove new variable that is no longer used.
+
+2010-07-06 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ WebInspector: generator part of the patch for bug 40675.
+ On the way to Remote Debugging we want to support JSON serialization
+ on both sides of WebInspector transport.
+ As far as InspectorFrontend class is a simple proxy to WebInspector
+ it would be better to generate it from an IDL file.
+ We have generator infrastructure for binding and will reuse it for
+ new generator.
+ https://bugs.webkit.org/show_bug.cgi?id=41692
+
+ * GNUmakefile.am:
+
+2010-07-05 Antti Koivisto <koivisto@iki.fi>
+
+ Revert unplanned project file change.
+
+ * WebKit.pro:
+
+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
+
+ Separate WebKitGTK+ DerivedSources into per-project subdirectories to prepare
+ for properly building WebKit2.
+
+ * GNUmakefile.am:
+
+2010-07-01 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix a comment in WebKit.pri.
+
+ * WebKit.pri:
+
+2010-06-16 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix qmake vcproj generation for QtWebKit.
+
+ qmake use TARGET=/LIBS+= -lTARGET to create dependencies
+ between projects in a subdir template.
+
+ Since when compiling outside of Qt we hijack the target name of
+ QtWebKit to add the configuration and version suffix to the binary
+ filename, qmake can't establish the WebCore project as a dependency
+ to QtTestBrowser.
+
+ This patch makes sure that the target is not hijacked on the
+ first of the three passes where the dependencies are determined.
+
+ * WebKit.pri:
+
2010-07-01 Simon Hausmann <simon.hausmann@nokia.com>
Rubber-stamped by Laszlo Gombos.
@@ -14,6 +6841,190 @@
* WebKit.pri:
+2010-06-30 Leandro Pereira <leandro@profusion.mobi>
+
+ Unreviewed.
+
+ Generate CSSValueKeywords.cpp instead of CSSValueKeywords.c to avoid
+ recompilation and relinking of WebCore when no files were changed.
+
+ * cmake/WebKitGenerators.cmake:
+
+2010-06-29 Antoine Labour <piman@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Only call Windows-specific PlatformSkiaContext functions on Windows.
+
+ * WebCore/platform/graphics/chromium/LayerChromium.cpp:
+ * WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:
+
+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
+
+ * configure.ac:
+
+2010-06-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Bump version to 1.3.2.
+
+ * configure.ac:
+
+2010-06-28 Xan Lopez <xlopez@igalia.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Bump gobject-introspection required version to 0.6.15, since we
+ are now shipping version 1.1 gir files.
+
+ * configure.ac:
+
+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.
+
+ * cmake/FindEFL.cmake: Bump version of Ecore dependency.
+
+2010-06-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Does not compile with -DGSEAL_ENABLE
+ https://bugs.webkit.org/show_bug.cgi?id=37851
+
+ Add automake flag to signal whether we are building with GTK+ 2.x
+ or 3.x.
+
+ * configure.ac:
+
+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
+
+ Add --with-gtk configure flag, defaulting to support for GTK+ 2.x.
+
+ * GNUmakefile.am:
+ * configure.ac:
+
+2010-06-26 Tony Gentilcore <tonyg@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add an --enable-web-timing flag which guards Web Timing support.
+ https://bugs.webkit.org/show_bug.cgi?id=38924
+
+ This flag is disabled by default.
+ See: http://dev.w3.org/2006/webapi/WebTiming/
+
+ * configure.ac:
+
+2010-06-25 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Introduce to 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
+
+ * WebKit.pro:
+
+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
+
+ * cmake/OptionsEfl.cmake: add new -DENABLE_JIT option.
+ * cmakeconfig.h.cmake: use new -DENABLE_JIT option.
+
+2010-06-23 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [EFL] Add support to CPack (to generate source tarballs)
+ https://bugs.webkit.org/show_bug.cgi?id=41009
+
+ * CMakeLists.txt:
+ * cmake/OptionsEfl.cmake: Define the default source generator for
+ the EFL port.
+ * cmake/WebKitPackaging.cmake: Added. This file filters the source
+ files so that only files relevant to the selected port are included
+ in the source tarball. See comments for details.
+
+2010-06-22 Eric Seidel <eric@webkit.org>
+
+ Unreviewed. Test commit for commit-queue@webkit.org.
+
+2010-06-21 Prasad Tammana <prasadt@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ DumpRenderTree should allow tests with modal dialogs
+ https://bugs.webkit.org/show_bug.cgi?id=35350
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (abortModalCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::abortModal):
+ Add abortModal method to LayoutTestController and make it available from script.
+
+ * DumpRenderTree/mac/UIDelegate.mm: Add support for showModalDialog.
+ (-[UIDelegate modalWindowWillClose:]): Observer for NSWindowWillCloseNotifications to call
+ abortModal from when modal window closes.
+ (-[UIDelegate webViewRunModal:]): Delegate method for showModalDialog to run the modal loop.
+
+2010-06-21 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Unreviewed debug build fix.
+
+ [CMake] Do not force build type to Release
+ https://bugs.webkit.org/show_bug.cgi?id=40566
+
+ * CMakeLists.txt:
+
+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
+
+ * configure.ac:
+
+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
+
+ * common.pri: Added.
+
2010-06-17 Alexis Menard <alexis.menard@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
@@ -25,6 +7036,16 @@
* WebKit.pro:
+2010-06-17 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Gustavo Noronha.
+
+ Update CMake build system to use new script for generating source files
+ with gperf (r61091).
+ https://bugs.webkit.org/show_bug.cgi?id=40628
+
+ * cmake/WebKitGenerators.cmake:
+
2010-06-17 Mark Brand <mabrand@mabrand.nl>
Reviewed by Simon Hausmann.
@@ -38,17 +7059,180 @@
* WebKit.pri:
-2010-05-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+2010-06-15 Xan Lopez <xlopez@igalia.com>
- Unreviewed, build fix for Symbian.
+ Unreviewed build fix.
- [Symbian] Symbian builds does not support shadow builds
+ Remove GSEAL from the debug config since the bots have a GTK+
+ version too old, duh.
- Revision r54715 broke the Symbian build. For Symbian
- the include directory is generated in the root of the source tree.
- This patch sets the INCLUDEPATH accordingly for Symbian.
+ * GNUmakefile.am:
- * WebKit.pri:
+2010-06-15 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Does not compile with -DGSEAL_ENABLE
+ https://bugs.webkit.org/show_bug.cgi?id=37851
+
+ Add GSEAL_ENABLE flag when doing debug builds.
+
+ * GNUmakefile.am:
+
+2010-06-13 Tony Chang <tony@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Chromium shouldn't build inside the source directory
+ https://bugs.webkit.org/show_bug.cgi?id=40489
+
+ Ignore Chromium Linux build files.
+
+ * .: Added property svn:ignore. Modified property svn:ignore.
+
+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: Add SHARED_CORE option.
+ * cmake/FindGlib.cmake: Add GObject to the list of GLib libraries to
+ search.
+ * cmake/OptionsEfl.cmake: Remove default library type definitions.
+ * cmake/WebKitHelpers.cmake: -fvisibility=hidden did not behave well
+ when SHARED_CORE is used.
+
+2010-06-08 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Unit testing for WebKitDOMNode hierarchy walk
+ https://bugs.webkit.org/show_bug.cgi?id=40171
+
+ Add DOM node test to the build system.
+
+ * GNUmakefile.am:
+
+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
+
+ * configure.ac:
+
+2010-05-31 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Copy the NEWS file to the toplevel when creating the release
+ tarballs, otherwise it's a bit hard to find.
+
+ * GNUmakefile.am:
+
+2010-05-27 Gustavo Noronha Silva <gns@gnome.org>
+
+ Final make distcheck fix - clean up generated GDOM files on distclean.
+
+ * GNUmakefile.am:
+
+2010-05-27 Xan Lopez <xlopez@igalia.com>
+
+ More GTK+ distcheck fixes.
+
+ * GNUmakefile.am:
+
+2010-05-27 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Bump for 1.3.1 release.
+
+ * configure.ac:
+
+2010-05-27 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ Build fix for introspection support - make sure DOM headers are
+ included by the GI scanner.
+
+ * GNUmakefile.am:
+
+2010-05-26 Gustavo Noronha Silva <gns@gnome.org>
+
+ Build fixes for make distcheck.
+
+ * GNUmakefile.am:
+
+2010-05-26 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Add support for DOM events in the GObject DOM bindings
+ https://bugs.webkit.org/show_bug.cgi?id=38844
+
+ Add new test to the build.
+
+ * GNUmakefile.am:
+
+2010-05-22 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Eric Seidel.
+
+ [EFL] Build fix (always compile libraries with -fPIC when compiler
+ is gcc; always define WTF_USE_PTHREADS).
+ http://webkit.org/b/39235
+
+ * cmake/OptionsCommon.cmake:
+ * cmake/OptionsEfl.cmake:
+ * cmake/WebKitHelpers.cmake:
+
+2010-05-19 Dan Winship <danw@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Install introspection files in our prefix, not
+ gobject-introspection's prefix
+
+ * GNUmakefile.am:
+ * configure.ac:
+
+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.
+ * cmake/FindCFLite.cmake: Added.
+ * cmake/FindCairo.cmake: Added.
+ * cmake/FindEFL.cmake: Added.
+ * cmake/FindFreetype.cmake: Added.
+ * cmake/FindGDK-PixBuf.cmake: Added.
+ * cmake/FindGDK.cmake: Added.
+ * cmake/FindGIO.cmake: Added.
+ * cmake/FindGlib.cmake: Added.
+ * cmake/FindICU.cmake: Added.
+ * cmake/FindLibSoup2.cmake: Added.
+ * cmake/FindLibXlst.cmake: Added.
+ * cmake/FindPango.cmake: Added.
+ * cmake/FindSqlite.cmake: Added.
+ * cmake/LibFindMacros.cmake: Added.
+ * cmake/OptionsCommon.cmake: Added.
+ * cmake/OptionsEfl.cmake: Added.
+ * cmake/WebKitEfl.cmake: Added.
+ * cmake/WebKitFS.cmake: Added.
+ * cmake/WebKitFeatures.cmake: Added.
+ * cmake/WebKitGenerators.cmake: Added.
+ * cmake/WebKitHelpers.cmake: Added.
+ * cmake/WebKitMacros.cmake: Added.
+ * cmakeconfig.h.cmake: Added.
2010-05-14 Simon Hausmann <simon.hausmann@nokia.com>
@@ -59,6 +7243,15 @@
* WebKit.pro:
+2010-05-12 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Link error in debug mode without debug_and_release config
+ https://bugs.webkit.org/show_bug.cgi?id=39006
+
+ * WebKit.pri: Unnecessary build_pass guard removed.
+
2010-05-12 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
@@ -68,6 +7261,140 @@
* WebKit.pri:
+2010-05-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Build the ImageDiff tool for all platforms including Windows and Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=38706
+
+ * WebKit.pro:
+
+2010-05-07 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Add a few more files with Windows linefeeds to the .gitattributes file.
+
+ * .gitattributes:
+
+2010-05-05 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ Fixed the gobject introspection compilation with the new DOM
+ bindings, we needed to add DOM objects.
+
+ * GNUmakefile.am:
+
+2010-05-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed, build fix for Symbian.
+
+ [Symbian] Symbian builds does not support shadow builds
+
+ Revision r54715 broke the Symbian build. For Symbian
+ the include directory is generated in the root of the source tree.
+ This patch sets the INCLUDEPATH accordingly for Symbian.
+
+ * WebKit.pri:
+
+2010-05-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add some more Chromium-specific files to gitignore
+ https://bugs.webkit.org/show_bug.cgi?id=38469
+
+ These files are generated as part of the update-webkit --chromium
+ script.
+
+ * .gitignore:
+
+2010-05-02 Geoff Levand <geoff.levand@am.sony.com>
+
+ Reviewed by Eric Seidel.
+
+ [GTK] Fix out of source build failure
+ https://bugs.webkit.org/show_bug.cgi?id=38051
+
+ Add a preprocessor include path for generated GTK header files.
+ Fixes build errors like these when building GTK out of source:
+
+ webkit.h: error: webkit/webkitversion.h: No such file or directory
+
+ * GNUmakefile.am:
+
+2010-05-02 Kartikaya Gupta <kagupta@rim.com>
+
+ Reviewed by George Staikos.
+
+ When running the IDL file through the preprocessor, wait for the preprocessor subcommand to fully terminate before continuing. Without this, if multiple IDL files are parsed in a tight loop, the code dies after 64 IDL files because it exhausts the available system resources.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37888
+
+ No new tests. None needed.
+
+ * bindings/scripts/IDLParser.pm:
+
+2010-04-29 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] GObject DOM bindings
+ https://bugs.webkit.org/show_bug.cgi?id=33590
+
+ Add WebKitDOMDocument tests to the build.
+
+ * GNUmakefile.am:
+
+2010-04-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Add WebKit2 to the lists of modules to build.
+
+ * Makefile:
+
+2010-04-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Adam Barth.
+
+ [GTK] GObject DOM bindings
+ https://bugs.webkit.org/show_bug.cgi?id=33590
+
+ Add build bits for the GObject DOM bindings.
+
+ * GNUmakefile.am:
+
+2010-04-20 Xan Lopez <xlopez@igalia.com>
+
+ Build fix?
+
+ * autotools/webkit.m4:
+
+2010-04-19 Diego Escalante Urrelo <descalante@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [Gtk] Evaluate and create tests for all the AtkRole's implemented by
+ WebKitGtk
+ https://bugs.webkit.org/show_bug.cgi?id=34449
+
+ Add and enable the build of testatkroles to test ATK non form roles.
+
+ * GNUmakefile.am:
+
+2010-04-18 Michael Forney <michael@mforney.org>
+
+ Reviewed by Laszlo Gombos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37762
+
+ Fixes the sandbox option in configure.
+
+ * configure.ac: Fix cut and paste error in the sandbox option causing
+ --{enable,disable}-sandbox to be ineffective, and it to be controlled
+ by the ruby flag.
+
2010-04-09 Simon Hausmann <simon.hausmann@nokia.com>
Unreviewed crash fix.
@@ -97,6 +7424,46 @@
* WebKit.pro:
+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 EANBEL_FILE_READER and ENABLE_FILE_WRITER flags.
+
+ * configure.ac:
+
+2010-04-01 Ojan Vafai <ojan@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ autoinstalled should be git ignored
+ https://bugs.webkit.org/show_bug.cgi?id=36970
+
+ * .gitignore:
+
+2010-04-01 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt]Add -Wextra warning level to the QtWebKit build
+ https://bugs.webkit.org/show_bug.cgi?id=36971
+
+ * WebKit.pri:
+
+2010-04-01 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Holger Freyther.
+
+ [GTK] webkit_get_default_session() should make sure webkit_init() is called
+ https://bugs.webkit.org/show_bug.cgi?id=36754
+
+ New API test.
+
+ * GNUmakefile.am:
+
2010-03-26 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/Examples/ChangeLog b/src/3rdparty/webkit/Examples/ChangeLog
new file mode 100644
index 0000000..80cf1da
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/ChangeLog
@@ -0,0 +1,384 @@
+2011-03-17 Jeff Miller <jeffm@apple.com>
+
+ Use a consistent set of file patterns in the svn:ignore property for all .xcodeproj directories, specifically:
+
+ *.mode*
+ *.pbxuser
+ *.perspective*
+ project.xcworkspace
+ xcuserdata
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj: Modified property svn:ignore.
+ * NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj: Modified property svn:ignore.
+ * NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj: Modified property svn:ignore.
+ * NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj: Modified property svn:ignore.
+
+2011-01-17 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Update xcodeproj svn:ignore to include xcuserdata.
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj: Modified property svn:ignore.
+ * NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj: Modified property svn:ignore.
+ * NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj: Modified property svn:ignore.
+ * NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj: Modified property svn:ignore.
+
+2010-11-03 Darin Adler <darin@apple.com>
+
+ Updated Xcode projects by opening them with Xcode 3.2.4.
+ Updated svn:ignore for Xcode projects.
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj: Added property svn:ignore.
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj: Updated with Xcode 3.2.4.
+ * NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj: Added property svn:ignore.
+ * NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj/project.pbxproj:
+ * NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj: Added property svn:ignore.
+ * NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj/project.pbxproj:
+ * NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj: Added property svn:ignore.
+ * NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj/project.pbxproj: Updated with Xcode 3.2.4.
+
+2010-06-16 Anders Carlsson <andersca@apple.com>
+
+ Fix build.
+
+ * NetscapeCoreAnimationMoviePlugin/main.m:
+ (NPP_New):
+ (NPP_WriteReady):
+ (NPP_Write):
+ (NPP_HandleEvent):
+
+2010-06-10 Anders Carlsson <andersca@apple.com>
+
+ Fix build.
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj:
+ * NetscapeCocoaPlugin/main.m:
+ (NPP_New):
+ (NPP_NewStream):
+ (NPP_WriteReady):
+ (NPP_Write):
+ (NPP_HandleEvent):
+
+2010-03-02 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ NPWindow is now null in the Cocoa event model.
+
+ * NetscapeInputMethodPlugin/main.m:
+ (handleDraw):
+ (NPP_HandleEvent):
+
+2009-07-10 Adam Roben <aroben@apple.com>
+
+ Sort all our Xcode projects
+
+ Accomplished using sort-Xcode-project-file.
+
+ Requested by Dave Kilzer.
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj:
+ * NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj/project.pbxproj:
+ * NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj/project.pbxproj:
+
+2009-06-15 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ Add Core Animation movie plug-in example.
+
+ * NetscapeCoreAnimationMoviePlugin: Added.
+ * NetscapeCoreAnimationMoviePlugin/English.lproj: Added.
+ * NetscapeCoreAnimationMoviePlugin/English.lproj/InfoPlist.strings: Added.
+ * NetscapeCoreAnimationMoviePlugin/Info.plist: Added.
+ * NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.h: Added.
+ * NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.m: Added.
+ (createImageNamed):
+ (-[MovieControllerLayer init]):
+ (-[MovieControllerLayer dealloc]):
+ (-[MovieControllerLayer _playPauseButtonRect]):
+ (-[MovieControllerLayer _sliderRect]):
+ (-[MovieControllerLayer _sliderThumbRect]):
+ (-[MovieControllerLayer _innerSliderRect]):
+ (-[MovieControllerLayer _drawPlayPauseButtonInContext:]):
+ (-[MovieControllerLayer _drawSliderInContext:]):
+ (-[MovieControllerLayer drawInContext:]):
+ (-[MovieControllerLayer _currentTime]):
+ (-[MovieControllerLayer _duration]):
+ (-[MovieControllerLayer _isPlaying]):
+ (-[MovieControllerLayer _updateTime:]):
+ (-[MovieControllerLayer _rateDidChange:]):
+ (-[MovieControllerLayer _timeDidChange:]):
+ (-[MovieControllerLayer actionForKey:]):
+ (-[MovieControllerLayer setMovie:]):
+ (-[MovieControllerLayer _setNewTimeForThumbCenterX:]):
+ (-[MovieControllerLayer handleMouseDown:]):
+ (-[MovieControllerLayer handleMouseUp:]):
+ (-[MovieControllerLayer handleMouseDragged:]):
+ * NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj: Added.
+ * NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj/project.pbxproj: Added.
+ * NetscapeCoreAnimationMoviePlugin/Pause.tiff: Added.
+ * NetscapeCoreAnimationMoviePlugin/Play.tiff: Added.
+ * NetscapeCoreAnimationMoviePlugin/SliderTrackCenter.tiff: Added.
+ * NetscapeCoreAnimationMoviePlugin/SliderTrackLeft.tiff: Added.
+ * NetscapeCoreAnimationMoviePlugin/SliderTrackRight.tiff: Added.
+ * NetscapeCoreAnimationMoviePlugin/Thumb.tiff: Added.
+ * NetscapeCoreAnimationMoviePlugin/main.m: Added.
+ (NP_Initialize):
+ (NP_GetEntryPoints):
+ (NP_Shutdown):
+ (NPP_New):
+ (NPP_Destroy):
+ (NPP_SetWindow):
+ (NPP_NewStream):
+ (NPP_DestroyStream):
+ (NPP_WriteReady):
+ (NPP_Write):
+ (NPP_StreamAsFile):
+ (NPP_Print):
+ (handleMouseDown):
+ (togglePlayPause):
+ (handleMouseUp):
+ (handleMouseDragged):
+ (handleMouseEntered):
+ (handleMouseExited):
+ (handleKeyDown):
+ (handleScrollEvent):
+ (NPP_HandleEvent):
+ (NPP_URLNotify):
+ (NPP_GetValue):
+ (NPP_SetValue):
+ * NetscapeCoreAnimationMoviePlugin/test.html: Added.
+
+2009-04-27 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Update the example plug-in for new changes to the Cocoa event model.
+
+ * NetscapeCocoaPlugin/main.m:
+ (handleDraw):
+ (handleMouseEvent):
+ (NPP_HandleEvent):
+
+2009-03-13 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ Update to match new API.
+
+ * NetscapeInputMethodPlugin/main.m:
+ (NPP_New):
+ (NPP_Destroy):
+ (NPP_SetWindow):
+ (handleDraw):
+ (invalidatePlugin):
+ (handleFocusChanged):
+ (handleMouseMoved):
+ (handleMouseDown):
+ (handleTextFieldKeyDown):
+ (handleTextInput):
+ (NPP_HandleEvent):
+ (NPP_URLNotify):
+ (NPP_GetValue):
+ (NPP_SetValue):
+
+2008-12-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin Adler.
+
+ There's no need to hold on to the QCComposition. Also, toggle between a gold and silver compass
+ when a mouse button is pressed.
+
+ * NetscapeCoreAnimationPlugin/Composition.qtz:
+ * NetscapeCoreAnimationPlugin/main.m:
+ (NPP_Destroy):
+ (handleMouseClick):
+ (NPP_GetValue):
+
+2008-12-12 Anders Carlsson <andersca@apple.com>
+
+ Revert some accidentally committed changes.
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj:
+ * NetscapeCocoaPlugin/main.m:
+ (handleDraw):
+ (handleMouseEvent):
+ (NPP_HandleEvent):
+
+2008-12-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ Add a sample Core Animation NPAPI plug-in.
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj:
+ * NetscapeCocoaPlugin/main.m:
+ (handleDraw):
+ (handleMouseEvent):
+ (NPP_HandleEvent):
+ * NetscapeCoreAnimationPlugin: Added.
+ * NetscapeCoreAnimationPlugin/Composition.qtz: Added.
+ * NetscapeCoreAnimationPlugin/English.lproj: Added.
+ * NetscapeCoreAnimationPlugin/English.lproj/InfoPlist.strings: Added.
+ * NetscapeCoreAnimationPlugin/Info.plist: Added.
+ * NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj: Added.
+ * NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj/project.pbxproj: Added.
+ * NetscapeCoreAnimationPlugin/main.m: Added.
+ (NP_Initialize):
+ (NP_GetEntryPoints):
+ (NP_Shutdown):
+ (NPP_New):
+ (NPP_Destroy):
+ (NPP_SetWindow):
+ (NPP_NewStream):
+ (NPP_DestroyStream):
+ (NPP_WriteReady):
+ (NPP_Write):
+ (NPP_StreamAsFile):
+ (NPP_Print):
+ (handleMouseClick):
+ (NPP_HandleEvent):
+ (NPP_URLNotify):
+ (NPP_GetValue):
+ (NPP_SetValue):
+ * NetscapeCoreAnimationPlugin/test.html: Added.
+
+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.
+
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj: Sorted.
+
+2008-08-20 Josh Aas <joshmoz@gmail.com>
+
+ Reviewed and landed by Anders.
+
+ <rdar://problem/6163636>
+ rename NPCocoaEvent's "event" struct to "data" (20446)
+
+ * NetscapeCocoaPlugin/main.m:
+ (handleMouseEvent):
+ (handleKeyboardEvent):
+ (NPP_HandleEvent):
+
+2008-05-22 Josh Aas <joshmoz@gmail.com>
+
+ Reviewed by Anders.
+
+ Use correct enum.
+
+ * NetscapeCocoaPlugin/main.m:
+ (NPP_New):
+ * NetscapeInputMethodPlugin/main.m:
+ (NPP_New):
+
+2008-05-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Alexey.
+
+ Add input method test plug-in.
+
+ * NetscapeInputMethodPlugin: Added.
+ * NetscapeInputMethodPlugin/English.lproj: Added.
+ * NetscapeInputMethodPlugin/English.lproj/InfoPlist.strings: Added.
+ * NetscapeInputMethodPlugin/Info.plist: Added.
+ * NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj: Added.
+ * NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj/project.pbxproj: Added.
+ * NetscapeInputMethodPlugin/main.m: Added.
+ (NP_Initialize):
+ (NP_GetEntryPoints):
+ (NP_Shutdown):
+ (NPP_New):
+ (NPP_Destroy):
+ (NPP_SetWindow):
+ (NPP_NewStream):
+ (NPP_DestroyStream):
+ (NPP_WriteReady):
+ (NPP_Write):
+ (NPP_StreamAsFile):
+ (NPP_Print):
+ (handleDraw):
+ (invalidatePlugin):
+ (handleFocusChanged):
+ (handleMouseMoved):
+ (handleMouseDown):
+ (NPP_HandleEvent):
+ (NPP_URLNotify):
+ (selectionRange):
+ (NPP_InsertText):
+ (NPP_DoCommandBySelector):
+ (markedTextAttributes):
+ (NPP_SetMarkedText):
+ (NPP_UnmarkText):
+ (NPP_HasMarkedText):
+ (NPP_AttributedSubstringFromRange):
+ (NPP_MarkedRange):
+ (NPP_SelectedRange):
+ (NPP_FirstRectForCharacterRange):
+ (pluginTextInputFuncs):
+ (NPP_GetValue):
+ (NPP_SetValue):
+ * NetscapeInputMethodPlugin/test.html: Added.
+
+2008-05-06 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Mitz.
+
+ Add NPN_PopUpContextMenu example.
+
+ * NetscapeCocoaPlugin/MenuHandler.h: Added.
+ * NetscapeCocoaPlugin/MenuHandler.m: Added.
+ (-[MenuHandler _openURL:]):
+ (-[MenuHandler _disabledItem:]):
+ (-[MenuHandler validateUserInterfaceItem:]):
+ (-[MenuHandler initWithBrowserFuncs:instance:]):
+ (-[MenuHandler dealloc]):
+ (-[MenuHandler menu]):
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj:
+ * NetscapeCocoaPlugin/main.m:
+ (NPP_Destroy):
+ (handleMouseEvent):
+
+2008-05-06 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Jon, Tim and Mark.
+
+ Add a sample NPAPI plugin that uses the Cocoa event model.
+
+ * .: Added.
+ * ChangeLog: Added.
+ * NetscapeCocoaPlugin: Added.
+ * NetscapeCocoaPlugin/English.lproj: Added.
+ * NetscapeCocoaPlugin/English.lproj/InfoPlist.strings: Added.
+ * NetscapeCocoaPlugin/Info.plist: Added.
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj: Added.
+ * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj: Added.
+ * NetscapeCocoaPlugin/main.m: Added.
+ (NP_Initialize):
+ (NP_GetEntryPoints):
+ (NP_Shutdown):
+ (NPP_New):
+ (NPP_Destroy):
+ (NPP_SetWindow):
+ (NPP_NewStream):
+ (NPP_DestroyStream):
+ (NPP_WriteReady):
+ (NPP_Write):
+ (NPP_StreamAsFile):
+ (NPP_Print):
+ (handleDraw):
+ (eventType):
+ (invalidatePlugin):
+ (handleMouseEvent):
+ (handleKeyboardEvent):
+ (NPP_HandleEvent):
+ (NPP_URLNotify):
+ (NPP_GetValue):
+ (NPP_SetValue):
+ * NetscapeCocoaPlugin/test.html: Added.
diff --git a/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/English.lproj/InfoPlist.strings b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/English.lproj/InfoPlist.strings
new file mode 100644
index 0000000..5e45963
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/Info.plist b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/Info.plist
new file mode 100644
index 0000000..47ae1a5
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/Info.plist
@@ -0,0 +1,36 @@
+<?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>NetscapeCocoaPlugin</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.netscapecocoaplugin</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>BRPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>WebPluginDescription</key>
+ <string>Simple Netscape plug-in that draws using CoreGraphics and handles events using the Cocoa event model</string>
+ <key>WebPluginMIMETypes</key>
+ <dict>
+ <key>test/x-netscape-cocoa-plugin</key>
+ <dict>
+ <key>WebPluginTypeDescription</key>
+ <string>Netscape Cocoa Plug-in</string>
+ </dict>
+ </dict>
+ <key>WebPluginName</key>
+ <string>Netscape Cocoa Plug-in</string>
+</dict>
+</plist>
diff --git a/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/MenuHandler.h b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/MenuHandler.h
new file mode 100644
index 0000000..19070f0
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/MenuHandler.h
@@ -0,0 +1,47 @@
+/*
+ IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import <WebKit/npfunctions.h>
+
+@interface MenuHandler : NSObject {
+ NSMenu *menu;
+ NPNetscapeFuncs *browserFuncs;
+ NPP instance;
+}
+
+- (id)initWithBrowserFuncs:(NPNetscapeFuncs *)theBrowserFuncs instance:(NPP)theInstance;
+
+- (NSMenu *)menu;
+
+@end
diff --git a/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/MenuHandler.m b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/MenuHandler.m
new file mode 100644
index 0000000..b9feb1c
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/MenuHandler.m
@@ -0,0 +1,99 @@
+/*
+ IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "MenuHandler.h"
+
+@implementation MenuHandler
+
+- (void)_openURL:(id)sender
+{
+ browserFuncs->geturl(instance, "http://www.apple.com/", "_blank");
+}
+
+- (void)_disabledItem:(id)sender
+{
+ // This should never be called
+}
+
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
+{
+ SEL sel = [anItem action];
+
+ if (sel == @selector(_openURL:))
+ return YES;
+
+ if (sel == @selector(_disabledItem:))
+ return NO;
+
+ return NO;
+}
+
+- (id)initWithBrowserFuncs:(NPNetscapeFuncs *)theBrowserFuncs instance:(NPP)theInstance;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ browserFuncs = theBrowserFuncs;
+ instance = theInstance;
+
+ // Create the menu
+ menu = [[NSMenu alloc] initWithTitle:@"Menu"];
+
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"Open URL" action:@selector(_openURL:) keyEquivalent:@""];
+ [item setTarget:self];
+ [menu addItem:item];
+ [item release];
+
+ item = [[NSMenuItem alloc] initWithTitle:@"Disabled Item" action:@selector(_disabledItem:) keyEquivalent:@""];
+ [item setTarget:self];
+ [menu addItem:item];
+ [item release];
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [menu release];
+
+ [super dealloc];
+}
+
+
+- (NSMenu *)menu
+{
+ return menu;
+}
+
+@end
diff --git a/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..c9a0b70
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj
@@ -0,0 +1,247 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A624E580DCBC7F6006898C8 /* main.m */; };
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6250410DCBC81B006898C8 /* Cocoa.framework */; };
+ 1AAD6A090DD0DC52003985DA /* MenuHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AAD6A080DD0DC52003985DA /* MenuHandler.m */; };
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1A624E580DCBC7F6006898C8 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 1AAD6A070DD0DC52003985DA /* MenuHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuHandler.h; sourceTree = "<group>"; };
+ 1AAD6A080DD0DC52003985DA /* MenuHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuHandler.m; sourceTree = "<group>"; };
+ 8D576316048677EA00EA77CD /* NetscapeCocoaPlugin.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetscapeCocoaPlugin.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D576313048677EA00EA77CD /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 089C166AFE841209C02AAC07 /* NetscapeCocoaPlugin */ = {
+ isa = PBXGroup;
+ children = (
+ 08FB77AFFE84173DC02AAC07 /* Source */,
+ 089C167CFE841241C02AAC07 /* Resources */,
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+ 19C28FB6FE9D52B211CA2CBB /* Products */,
+ );
+ name = NetscapeCocoaPlugin;
+ sourceTree = "<group>";
+ };
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */,
+ );
+ name = "External Frameworks and Libraries";
+ sourceTree = "<group>";
+ };
+ 089C167CFE841241C02AAC07 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D576317048677EA00EA77CD /* Info.plist */,
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 08FB77AFFE84173DC02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 1A624E580DCBC7F6006898C8 /* main.m */,
+ 1AAD6A070DD0DC52003985DA /* MenuHandler.h */,
+ 1AAD6A080DD0DC52003985DA /* MenuHandler.m */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ 19C28FB6FE9D52B211CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D576316048677EA00EA77CD /* NetscapeCocoaPlugin.plugin */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D57630D048677EA00EA77CD /* NetscapeCocoaPlugin */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeCocoaPlugin" */;
+ buildPhases = (
+ 8D576311048677EA00EA77CD /* Sources */,
+ 8D57630F048677EA00EA77CD /* Resources */,
+ 8D576313048677EA00EA77CD /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = NetscapeCocoaPlugin;
+ productInstallPath = "$(HOME)/Library/Bundles";
+ productName = NetscapeCocoaPlugin;
+ productReference = 8D576316048677EA00EA77CD /* NetscapeCocoaPlugin.plugin */;
+ productType = "com.apple.product-type.bundle";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 089C1669FE841209C02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeCocoaPlugin" */;
+ compatibilityVersion = "Xcode 2.4";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 089C166AFE841209C02AAC07 /* NetscapeCocoaPlugin */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D57630D048677EA00EA77CD /* NetscapeCocoaPlugin */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D57630F048677EA00EA77CD /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D576311048677EA00EA77CD /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */,
+ 1AAD6A090DD0DC52003985DA /* MenuHandler.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C167EFE841241C02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 149C298408902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeCocoaPlugin;
+ WRAPPER_EXTENSION = plugin;
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ 149C298508902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeCocoaPlugin;
+ WRAPPER_EXTENSION = plugin;
+ };
+ name = Release;
+ };
+ 149C298808902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ };
+ name = Debug;
+ };
+ 149C298908902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeCocoaPlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298408902C53008A9EFC /* Debug */,
+ 149C298508902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeCocoaPlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298808902C53008A9EFC /* Debug */,
+ 149C298908902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/main.m b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/main.m
new file mode 100644
index 0000000..3f0396a
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/main.m
@@ -0,0 +1,368 @@
+/*
+ IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/npapi.h>
+#import <WebKit/npfunctions.h>
+#import <WebKit/npruntime.h>
+
+#import <Cocoa/Cocoa.h>
+
+#import "MenuHandler.h"
+
+// Browser function table
+static NPNetscapeFuncs* browser;
+
+// Structure for per-instance storage
+typedef struct PluginObject
+{
+ NPP npp;
+
+ NPWindow window;
+
+ NSString *string;
+ bool hasFocus;
+ bool mouseIsInsidePlugin;
+
+ MenuHandler *menuHandler;
+} PluginObject;
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+int32_t NPP_WriteReady(NPP instance, NPStream* stream);
+int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void NPP_Print(NPP instance, NPPrint* platformPrint);
+int16_t NPP_HandleEvent(NPP instance, void* event);
+void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
+
+#pragma export on
+// Mach-o entry points
+NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
+NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
+void NP_Shutdown(void);
+#pragma export off
+
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs)
+{
+ browser = browserFuncs;
+ return NPERR_NO_ERROR;
+}
+
+NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
+{
+ pluginFuncs->version = 11;
+ pluginFuncs->size = sizeof(pluginFuncs);
+ pluginFuncs->newp = NPP_New;
+ pluginFuncs->destroy = NPP_Destroy;
+ pluginFuncs->setwindow = NPP_SetWindow;
+ pluginFuncs->newstream = NPP_NewStream;
+ pluginFuncs->destroystream = NPP_DestroyStream;
+ pluginFuncs->asfile = NPP_StreamAsFile;
+ pluginFuncs->writeready = NPP_WriteReady;
+ pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
+ pluginFuncs->print = NPP_Print;
+ pluginFuncs->event = NPP_HandleEvent;
+ pluginFuncs->urlnotify = NPP_URLNotify;
+ pluginFuncs->getvalue = NPP_GetValue;
+ pluginFuncs->setvalue = NPP_SetValue;
+
+ return NPERR_NO_ERROR;
+}
+
+void NP_Shutdown(void)
+{
+
+}
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ // Create per-instance storage
+ PluginObject *obj = (PluginObject *)malloc(sizeof(PluginObject));
+ bzero(obj, sizeof(PluginObject));
+
+ obj->npp = instance;
+ instance->pdata = obj;
+
+ // Ask the browser if it supports the CoreGraphics drawing model
+ NPBool supportsCoreGraphics;
+ if (browser->getvalue(instance, NPNVsupportsCoreGraphicsBool, &supportsCoreGraphics) != NPERR_NO_ERROR)
+ supportsCoreGraphics = FALSE;
+
+ if (!supportsCoreGraphics)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ // If the browser supports the CoreGraphics drawing model, enable it.
+ browser->setvalue(instance, NPPVpluginDrawingModel, (void *)NPDrawingModelCoreGraphics);
+
+ // If the browser supports the Cocoa event model, enable it.
+ NPBool supportsCocoa;
+ if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
+ supportsCocoa = FALSE;
+
+ if (!supportsCocoa)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ browser->setvalue(instance, NPPVpluginEventModel, (void *)NPEventModelCocoa);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_Destroy(NPP instance, NPSavedData** save)
+{
+ // Free per-instance storage
+ PluginObject *obj = instance->pdata;
+
+ [obj->string release];
+ [obj->menuHandler release];
+
+ free(obj);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ PluginObject *obj = instance->pdata;
+ obj->window = *window;
+
+ return NPERR_NO_ERROR;
+}
+
+
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
+{
+ *stype = NP_ASFILEONLY;
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+int32_t NPP_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
+{
+ return 0;
+}
+
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+}
+
+void NPP_Print(NPP instance, NPPrint* platformPrint)
+{
+
+}
+
+static void handleDraw(PluginObject *obj, NPCocoaEvent *event)
+{
+ NSGraphicsContext *oldContext = [[NSGraphicsContext currentContext] retain];
+
+ NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithGraphicsPort:event->data.draw.context
+ flipped:YES];
+
+ [NSGraphicsContext setCurrentContext:context];
+
+ NSRect rect = NSMakeRect(0, 0, obj->window.width, obj->window.height);
+
+ [[NSColor lightGrayColor] set];
+ [NSBezierPath fillRect:rect];
+
+ // If the plugin has focus, draw a focus indicator
+ if (obj->hasFocus) {
+ [[NSColor blackColor] set];
+ NSBezierPath *path = [NSBezierPath bezierPathWithRect:rect];
+ [path setLineWidth:5];
+ [path stroke];
+ }
+
+ [obj->string drawAtPoint:NSMakePoint(10, 10) withAttributes:nil];
+
+ [NSGraphicsContext setCurrentContext:oldContext];
+}
+
+static NSString *eventType(NPCocoaEventType type)
+{
+ switch (type) {
+ case NPCocoaEventScrollWheel:
+ return @"NPCocoaEventScrollWheel";
+ case NPCocoaEventMouseDown:
+ return @"NPCocoaEventMouseDown";
+ case NPCocoaEventMouseUp:
+ return @"NPCocoaEventMouseUp";
+ case NPCocoaEventMouseMoved:
+ return @"NPCocoaEventMouseMoved";
+ case NPCocoaEventMouseDragged:
+ return @"NPCocoaEventMouseDragged";
+ case NPCocoaEventMouseEntered:
+ return @"NPCocoaEventMouseEntered";
+ case NPCocoaEventMouseExited:
+ return @"NPCocoaEventMouseExited";
+ case NPCocoaEventKeyDown:
+ return @"NPCocoaEventKeyDown";
+ case NPCocoaEventKeyUp:
+ return @"NPCocoaEventKeyUp";
+ case NPCocoaEventFlagsChanged:
+ return @"NPCocoaEventFlagsChanged";
+ default:
+ return @"unknown";
+ }
+}
+
+static void invalidatePlugin(PluginObject *obj)
+{
+ NPRect rect;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = obj->window.width;
+ rect.bottom = obj->window.height;
+
+ browser->invalidaterect(obj->npp, &rect);
+}
+
+
+static void handleMouseEvent(PluginObject *obj, NPCocoaEvent *event)
+{
+ NSString *string = [NSString stringWithFormat:@"Type: %@\n"
+ "Modifier flags: 0x%x\n"
+ "Coordinates: (%g, %g)\n"
+ "Button number: %d\n"
+ "Click count: %d\n"
+ "Delta: (%g, %g, %g)",
+ eventType(event->type),
+ event->data.mouse.modifierFlags,
+ event->data.mouse.pluginX,
+ event->data.mouse.pluginY,
+ event->data.mouse.buttonNumber,
+ event->data.mouse.clickCount,
+ event->data.mouse.deltaX, event->data.mouse.deltaY, event->data.mouse.deltaZ];
+
+
+ [obj->string release];
+ obj->string = [string retain];
+
+ invalidatePlugin(obj);
+
+ if (event->data.mouse.buttonNumber == 1) {
+ if (!obj->menuHandler)
+ obj->menuHandler = [[MenuHandler alloc] initWithBrowserFuncs:browser instance:obj->npp];
+
+ browser->popupcontextmenu(obj->npp, (NPNSMenu *)[obj->menuHandler menu]);
+ }
+}
+
+static void handleKeyboardEvent(PluginObject *obj, NPCocoaEvent *event)
+{
+ NSString *string = [NSString stringWithFormat:@"Type: %@\n"
+ "Modifier flags: 0x%x\n"
+ "Characters: %@\n"
+ "Characters ignoring modifiers: %@\n"
+ "Is a repeat: %@\n"
+ "Key code: %d",
+ eventType(event->type),
+ event->data.key.modifierFlags,
+ event->data.key.characters,
+ event->data.key.charactersIgnoringModifiers,
+ event->data.key.isARepeat ? @"YES" : @"NO",
+ event->data.key.keyCode];
+
+
+ [obj->string release];
+ obj->string = [string retain];
+
+ invalidatePlugin(obj);
+}
+
+int16_t NPP_HandleEvent(NPP instance, void* event)
+{
+ PluginObject *obj = instance->pdata;
+
+ NPCocoaEvent *cocoaEvent = event;
+
+ switch(cocoaEvent->type) {
+ case NPCocoaEventFocusChanged:
+ obj->hasFocus = cocoaEvent->data.focus.hasFocus;
+ invalidatePlugin(obj);
+ return 1;
+
+ case NPCocoaEventDrawRect:
+ handleDraw(obj, cocoaEvent);
+ return 1;
+
+ case NPCocoaEventKeyDown:
+ case NPCocoaEventKeyUp:
+ case NPCocoaEventFlagsChanged:
+ handleKeyboardEvent(obj, cocoaEvent);
+ return 1;
+
+ case NPCocoaEventMouseDown:
+ case NPCocoaEventMouseUp:
+
+ // FIXME: NPCocoaEventMouseMoved is currently disabled in order to see other events more clearly
+ // without "drowning" in mouse moved events.
+// case NPCocoaEventMouseMoved:
+ case NPCocoaEventMouseEntered:
+ case NPCocoaEventMouseExited:
+ case NPCocoaEventMouseDragged:
+ case NPCocoaEventScrollWheel:
+ handleMouseEvent(obj, cocoaEvent);
+ return 1;
+ }
+
+ return 0;
+}
+
+void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
+{
+
+}
+
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
+{
+ return NPERR_GENERIC_ERROR;
+}
+
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
+{
+ return NPERR_GENERIC_ERROR;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/test.html b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/test.html
new file mode 100644
index 0000000..368cb1c
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCocoaPlugin/test.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html>
+<head>
+<title>Cocoa Netscape Plug-In</title>
+</head>
+<body>
+<div>
+ <embed width="400" height="400" type="test/x-netscape-cocoa-plugin"></embed>
+</div>
+</body>
+</html>
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/English.lproj/InfoPlist.strings b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/English.lproj/InfoPlist.strings
new file mode 100644
index 0000000..5e45963
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Info.plist b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Info.plist
new file mode 100644
index 0000000..5809a146
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Info.plist
@@ -0,0 +1,36 @@
+<?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>NetscapeCoreAnimationMoviePlugin</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.netscapecoreanimationmovieplugin</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>BRPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>WebPluginDescription</key>
+ <string>Simple Netscape plug-in that draws using Core Animation and handles events using the Cocoa event model</string>
+ <key>WebPluginMIMETypes</key>
+ <dict>
+ <key>test/x-netscape-core-animation-movie-plugin</key>
+ <dict>
+ <key>WebPluginTypeDescription</key>
+ <string>Netscape Core Animation Movie Plug-in</string>
+ </dict>
+ </dict>
+ <key>WebPluginName</key>
+ <string>Netscape Core Animation Movie Plug-in</string>
+</dict>
+</plist>
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.h b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.h
new file mode 100644
index 0000000..d29c916
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.h
@@ -0,0 +1,75 @@
+/*
+ File: MovieControllerLayer.h
+
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
+ Inc. ("Apple") in consideration of your agreement to the following
+ terms, and your use, installation, modification or redistribution of
+ this Apple software constitutes acceptance of these terms. If you do
+ not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and
+ subject to these terms, Apple grants you a personal, non-exclusive
+ license, under Apple's copyrights in this original Apple software (the
+ "Apple Software"), to use, reproduce, modify and redistribute the Apple
+ Software, with or without modifications, in source and/or binary forms;
+ provided that if you redistribute the Apple Software in its entirety and
+ without modifications, you must retain this notice and the following
+ text and disclaimers in all such redistributions of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may
+ be used to endorse or promote products derived from the Apple Software
+ without specific prior written permission from Apple. Except as
+ expressly stated in this notice, no other rights or licenses, express or
+ implied, are granted by Apple herein, including but not limited to any
+ patent rights that may be infringed by your derivative works or by other
+ works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE
+ MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
+ THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
+ OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
+ MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
+ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
+ STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2009 Apple Inc. All Rights Reserved.
+
+ */
+
+
+#import <QuartzCore/QuartzCore.h>
+
+@class QTMovie;
+
+@interface MovieControllerLayer : CALayer {
+ CGImageRef _playImage;
+ CGImageRef _pauseImage;
+
+ CGImageRef _sliderTrackLeft;
+ CGImageRef _sliderTrackRight;
+ CGImageRef _sliderTrackCenter;
+
+ CGImageRef _thumb;
+
+ QTMovie *_movie;
+ NSTimer *_updateTimeTimer;
+
+ BOOL _wasPlayingBeforeMouseDown;
+ BOOL _isScrubbing;
+ CGFloat _mouseDownXDelta;
+}
+
+- (void)setMovie:(QTMovie *)movie;
+
+- (void)handleMouseDown:(CGPoint)point;
+- (void)handleMouseUp:(CGPoint)point;
+- (void)handleMouseDragged:(CGPoint)point;
+
+@end
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.m b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.m
new file mode 100644
index 0000000..171dab4
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/MovieControllerLayer.m
@@ -0,0 +1,355 @@
+/*
+ File: MovieControllerLayer.m
+
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
+ Inc. ("Apple") in consideration of your agreement to the following
+ terms, and your use, installation, modification or redistribution of
+ this Apple software constitutes acceptance of these terms. If you do
+ not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and
+ subject to these terms, Apple grants you a personal, non-exclusive
+ license, under Apple's copyrights in this original Apple software (the
+ "Apple Software"), to use, reproduce, modify and redistribute the Apple
+ Software, with or without modifications, in source and/or binary forms;
+ provided that if you redistribute the Apple Software in its entirety and
+ without modifications, you must retain this notice and the following
+ text and disclaimers in all such redistributions of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may
+ be used to endorse or promote products derived from the Apple Software
+ without specific prior written permission from Apple. Except as
+ expressly stated in this notice, no other rights or licenses, express or
+ implied, are granted by Apple herein, including but not limited to any
+ patent rights that may be infringed by your derivative works or by other
+ works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE
+ MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
+ THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
+ OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
+ MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
+ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
+ STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2009 Apple Inc. All Rights Reserved.
+
+ */
+
+#import "MovieControllerLayer.h"
+
+#import <QTKit/QTKit.h>
+
+@interface MovieControllerLayer ()
+- (BOOL)_isPlaying;
+- (NSTimeInterval)_currentTime;
+- (NSTimeInterval)_duration;
+@end
+
+@implementation MovieControllerLayer
+
+static CGImageRef createImageNamed(NSString *name)
+{
+ NSURL *url = [[NSBundle bundleForClass:[MovieControllerLayer class]] URLForResource:name withExtension:@"tiff"];
+
+ if (!url)
+ return NULL;
+
+ CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
+ if (!imageSource)
+ return NULL;
+
+ CGImageRef image = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
+ CFRelease(imageSource);
+
+ return image;
+}
+
+- (id)init
+{
+ if (self = [super init]) {
+ self.needsDisplayOnBoundsChange = YES;
+ self.frame = CGRectMake(0, 0, 0, 25);
+ self.autoresizingMask = kCALayerWidthSizable;
+
+ _playImage = createImageNamed(@"Play");
+ _pauseImage = createImageNamed(@"Pause");
+ _sliderTrackLeft = createImageNamed(@"SliderTrackLeft");
+ _sliderTrackRight = createImageNamed(@"SliderTrackRight");
+ _sliderTrackCenter = createImageNamed(@"SliderTrackCenter");
+
+ _thumb = createImageNamed(@"Thumb");
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ CGImageRelease(_playImage);
+ CGImageRelease(_pauseImage);
+
+ CGImageRelease(_sliderTrackLeft);
+ CGImageRelease(_sliderTrackRight);
+ CGImageRelease(_sliderTrackCenter);
+
+ CGImageRelease(_thumb);
+
+ [self setMovie:nil];
+ [_updateTimeTimer invalidate];
+
+ [super dealloc];
+}
+
+#pragma mark Drawing
+
+- (CGRect)_playPauseButtonRect
+{
+ return CGRectMake(0, 0, 25, 25);
+}
+
+- (CGRect)_sliderRect
+{
+ CGFloat sliderYPosition = (self.bounds.size.height - CGImageGetHeight(_sliderTrackLeft)) / 2.0;
+ CGFloat playPauseButtonWidth = [self _playPauseButtonRect].size.width;
+
+ return CGRectMake(playPauseButtonWidth, sliderYPosition,
+ self.bounds.size.width - playPauseButtonWidth - 7, CGImageGetHeight(_sliderTrackLeft));
+}
+
+- (CGRect)_sliderThumbRect
+{
+ CGRect sliderRect = [self _sliderRect];
+
+ CGFloat fraction = 0.0;
+ if (_movie)
+ fraction = [self _currentTime] / [self _duration];
+
+ CGFloat x = fraction * (CGRectGetWidth(sliderRect) - CGImageGetWidth(_thumb));
+
+ return CGRectMake(CGRectGetMinX(sliderRect) + x, CGRectGetMinY(sliderRect) - 1,
+ CGImageGetWidth(_thumb), CGImageGetHeight(_thumb));
+}
+
+- (CGRect)_innerSliderRect
+{
+ return CGRectInset([self _sliderRect], CGRectGetWidth([self _sliderThumbRect]) / 2, 0);
+}
+
+- (void)_drawPlayPauseButtonInContext:(CGContextRef)context
+{
+ CGContextDrawImage(context, [self _playPauseButtonRect], [self _isPlaying] ? _pauseImage : _playImage);
+}
+
+- (void)_drawSliderInContext:(CGContextRef)context
+{
+ // Draw the thumb
+ CGRect sliderThumbRect = [self _sliderThumbRect];
+ CGContextDrawImage(context, sliderThumbRect, _thumb);
+
+ CGRect sliderRect = [self _sliderRect];
+
+ // Draw left part
+ CGRect sliderLeftTrackRect = CGRectMake(CGRectGetMinX(sliderRect), CGRectGetMinY(sliderRect),
+ CGImageGetWidth(_sliderTrackLeft), CGImageGetHeight(_sliderTrackLeft));
+ CGContextDrawImage(context, sliderLeftTrackRect, _sliderTrackLeft);
+
+ // Draw center part
+ CGRect sliderCenterTrackRect = CGRectInset(sliderRect, CGImageGetWidth(_sliderTrackLeft), 0);
+ CGContextDrawImage(context, sliderCenterTrackRect, _sliderTrackCenter);
+
+ // Draw right part
+ CGRect sliderRightTrackRect = CGRectMake(CGRectGetMaxX(sliderCenterTrackRect), CGRectGetMinY(sliderRect),
+ CGImageGetWidth(_sliderTrackRight), CGImageGetHeight(_sliderTrackRight));
+ CGContextDrawImage(context, sliderRightTrackRect, _sliderTrackRight);
+
+}
+
+- (void)drawInContext:(CGContextRef)context
+{
+ CGContextSaveGState(context);
+ CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorBlack));
+ CGContextFillRect(context, self.bounds);
+ CGContextRestoreGState(context);
+
+ [self _drawPlayPauseButtonInContext:context];
+ [self _drawSliderInContext:context];
+}
+
+#pragma mark Movie handling
+
+- (NSTimeInterval)_currentTime
+{
+ if (!_movie)
+ return 0;
+
+ QTTime time = [_movie currentTime];
+ NSTimeInterval timeInterval;
+ if (!QTGetTimeInterval(time, &timeInterval))
+ return 0;
+
+ return timeInterval;
+}
+
+- (NSTimeInterval)_duration
+{
+ if (!_movie)
+ return 0;
+
+ QTTime time = [_movie duration];
+ NSTimeInterval timeInterval;
+ if (!QTGetTimeInterval(time, &timeInterval))
+ return 0;
+
+ return timeInterval;
+}
+
+- (BOOL)_isPlaying
+{
+ return [_movie rate] != 0.0;
+}
+
+- (void)_updateTime:(NSTimer *)timer
+{
+ [self setNeedsDisplay];
+}
+
+- (void)_rateDidChange:(NSNotification *)notification
+{
+ float rate = [[[notification userInfo] objectForKey:QTMovieRateDidChangeNotificationParameter] floatValue];
+
+ if (rate == 0.0) {
+ [_updateTimeTimer invalidate];
+ _updateTimeTimer = nil;
+ } else
+ _updateTimeTimer = [NSTimer scheduledTimerWithTimeInterval:0.035 target:self selector:@selector(_updateTime:) userInfo:nil repeats:YES];
+
+ [self setNeedsDisplay];
+}
+
+- (void)_timeDidChange:(NSNotification *)notification
+{
+ [self setNeedsDisplay];
+}
+
+- (id<CAAction>)actionForKey:(NSString *)key
+{
+ // We don't want to animate the contents of the layer.
+ if ([key isEqualToString:@"contents"])
+ return nil;
+
+ return [super actionForKey:key];
+}
+
+- (void)setMovie:(QTMovie *)movie
+{
+ if (_movie == movie)
+ return;
+
+ if (_movie) {
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:QTMovieRateDidChangeNotification
+ object:_movie];
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:QTMovieTimeDidChangeNotification
+ object:_movie];
+ [_movie release];
+ }
+
+ _movie = [movie retain];
+
+ if (_movie) {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(_rateDidChange:)
+ name:QTMovieRateDidChangeNotification
+ object:_movie];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(_timeDidChange:)
+ name:QTMovieTimeDidChangeNotification
+ object:_movie];
+ [self setNeedsDisplay];
+ }
+
+}
+
+# pragma mark Event handling
+
+- (void)_setNewTimeForThumbCenterX:(CGFloat)centerX
+{
+ CGRect innerRect = [self _innerSliderRect];
+
+ CGFloat fraction = (centerX - CGRectGetMinX(innerRect)) / CGRectGetWidth(innerRect);
+ if (fraction > 1.0)
+ fraction = 1.0;
+ else if (fraction < 0.0)
+ fraction = 0.0;
+
+ NSTimeInterval newTime = fraction * [self _duration];
+
+ [_movie setCurrentTime:QTMakeTimeWithTimeInterval(newTime)];
+ [self setNeedsDisplay];
+}
+
+- (void)handleMouseDown:(CGPoint)point
+{
+ if (!_movie)
+ return;
+
+ if (CGRectContainsPoint([self _sliderRect], point)) {
+ _wasPlayingBeforeMouseDown = [self _isPlaying];
+ _isScrubbing = YES;
+
+ [_movie stop];
+ if (CGRectContainsPoint([self _sliderThumbRect], point))
+ _mouseDownXDelta = point.x - CGRectGetMidX([self _sliderThumbRect]);
+ else {
+ [self _setNewTimeForThumbCenterX:point.x];
+ _mouseDownXDelta = 0;
+ }
+ }
+}
+
+- (void)handleMouseUp:(CGPoint)point
+{
+ if (!_movie)
+ return;
+
+ if (_isScrubbing) {
+ _isScrubbing = NO;
+ _mouseDownXDelta = 0;
+
+ if (_wasPlayingBeforeMouseDown)
+ [_movie play];
+ return;
+ }
+
+ if (CGRectContainsPoint([self _playPauseButtonRect], point)) {
+ if ([self _isPlaying])
+ [_movie stop];
+ else
+ [_movie play];
+ return;
+ }
+}
+
+- (void)handleMouseDragged:(CGPoint)point
+{
+ if (!_movie)
+ return;
+
+ if (!_isScrubbing)
+ return;
+
+ point.x -= _mouseDownXDelta;
+
+ [self _setNewTimeForThumbCenterX:point.x];
+}
+
+@end
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..fef3db9
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/NetscapeCoreAnimationMoviePlugin.xcodeproj/project.pbxproj
@@ -0,0 +1,279 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A624E580DCBC7F6006898C8 /* main.m */; };
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6250410DCBC81B006898C8 /* Cocoa.framework */; };
+ 1A80001B0FDB2C85000F3646 /* MovieControllerLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A80001A0FDB2C85000F3646 /* MovieControllerLayer.m */; };
+ 1A80011A0FDB2CB2000F3646 /* Pause.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1A8001140FDB2CB2000F3646 /* Pause.tiff */; };
+ 1A80011B0FDB2CB2000F3646 /* Play.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1A8001150FDB2CB2000F3646 /* Play.tiff */; };
+ 1A80011C0FDB2CB2000F3646 /* SliderTrackCenter.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1A8001160FDB2CB2000F3646 /* SliderTrackCenter.tiff */; };
+ 1A80011D0FDB2CB2000F3646 /* SliderTrackLeft.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1A8001170FDB2CB2000F3646 /* SliderTrackLeft.tiff */; };
+ 1A80011E0FDB2CB2000F3646 /* SliderTrackRight.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1A8001180FDB2CB2000F3646 /* SliderTrackRight.tiff */; };
+ 1A80011F0FDB2CB2000F3646 /* Thumb.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1A8001190FDB2CB2000F3646 /* Thumb.tiff */; };
+ 1A8001470FDB2E65000F3646 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A8001460FDB2E65000F3646 /* QTKit.framework */; };
+ 1A8C87AA0EF2FBB3003F6E81 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A8C87A90EF2FBB3003F6E81 /* QuartzCore.framework */; };
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1A624E580DCBC7F6006898C8 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 1A8000190FDB2C85000F3646 /* MovieControllerLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MovieControllerLayer.h; sourceTree = "<group>"; };
+ 1A80001A0FDB2C85000F3646 /* MovieControllerLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MovieControllerLayer.m; sourceTree = "<group>"; };
+ 1A8001140FDB2CB2000F3646 /* Pause.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Pause.tiff; sourceTree = "<group>"; };
+ 1A8001150FDB2CB2000F3646 /* Play.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Play.tiff; sourceTree = "<group>"; };
+ 1A8001160FDB2CB2000F3646 /* SliderTrackCenter.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = SliderTrackCenter.tiff; sourceTree = "<group>"; };
+ 1A8001170FDB2CB2000F3646 /* SliderTrackLeft.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = SliderTrackLeft.tiff; sourceTree = "<group>"; };
+ 1A8001180FDB2CB2000F3646 /* SliderTrackRight.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = SliderTrackRight.tiff; sourceTree = "<group>"; };
+ 1A8001190FDB2CB2000F3646 /* Thumb.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Thumb.tiff; sourceTree = "<group>"; };
+ 1A8001460FDB2E65000F3646 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = "<absolute>"; };
+ 1A8C87A90EF2FBB3003F6E81 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
+ 8D576316048677EA00EA77CD /* NetscapeCoreAnimationMoviePlugin.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetscapeCoreAnimationMoviePlugin.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D576313048677EA00EA77CD /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */,
+ 1A8001470FDB2E65000F3646 /* QTKit.framework in Frameworks */,
+ 1A8C87AA0EF2FBB3003F6E81 /* QuartzCore.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 089C166AFE841209C02AAC07 /* NetscapeCoreAnimationMoviePlugin */ = {
+ isa = PBXGroup;
+ children = (
+ 08FB77AFFE84173DC02AAC07 /* Source */,
+ 089C167CFE841241C02AAC07 /* Resources */,
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+ 19C28FB6FE9D52B211CA2CBB /* Products */,
+ 1A8001460FDB2E65000F3646 /* QTKit.framework */,
+ );
+ name = NetscapeCoreAnimationMoviePlugin;
+ sourceTree = "<group>";
+ };
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */,
+ 1A8C87A90EF2FBB3003F6E81 /* QuartzCore.framework */,
+ );
+ name = "External Frameworks and Libraries";
+ sourceTree = "<group>";
+ };
+ 089C167CFE841241C02AAC07 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D576317048677EA00EA77CD /* Info.plist */,
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
+ 1A8001140FDB2CB2000F3646 /* Pause.tiff */,
+ 1A8001150FDB2CB2000F3646 /* Play.tiff */,
+ 1A8001160FDB2CB2000F3646 /* SliderTrackCenter.tiff */,
+ 1A8001170FDB2CB2000F3646 /* SliderTrackLeft.tiff */,
+ 1A8001180FDB2CB2000F3646 /* SliderTrackRight.tiff */,
+ 1A8001190FDB2CB2000F3646 /* Thumb.tiff */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 08FB77AFFE84173DC02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 1A624E580DCBC7F6006898C8 /* main.m */,
+ 1A8000190FDB2C85000F3646 /* MovieControllerLayer.h */,
+ 1A80001A0FDB2C85000F3646 /* MovieControllerLayer.m */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ 19C28FB6FE9D52B211CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D576316048677EA00EA77CD /* NetscapeCoreAnimationMoviePlugin.plugin */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D57630D048677EA00EA77CD /* NetscapeCoreAnimationMoviePlugin */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeCoreAnimationMoviePlugin" */;
+ buildPhases = (
+ 8D576311048677EA00EA77CD /* Sources */,
+ 8D57630F048677EA00EA77CD /* Resources */,
+ 8D576313048677EA00EA77CD /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = NetscapeCoreAnimationMoviePlugin;
+ productInstallPath = "$(HOME)/Library/Bundles";
+ productName = NetscapeCoreAnimationMoviePlugin;
+ productReference = 8D576316048677EA00EA77CD /* NetscapeCoreAnimationMoviePlugin.plugin */;
+ productType = "com.apple.product-type.bundle";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 089C1669FE841209C02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeCoreAnimationMoviePlugin" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 089C166AFE841209C02AAC07 /* NetscapeCoreAnimationMoviePlugin */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D57630D048677EA00EA77CD /* NetscapeCoreAnimationMoviePlugin */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D57630F048677EA00EA77CD /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
+ 1A80011A0FDB2CB2000F3646 /* Pause.tiff in Resources */,
+ 1A80011B0FDB2CB2000F3646 /* Play.tiff in Resources */,
+ 1A80011C0FDB2CB2000F3646 /* SliderTrackCenter.tiff in Resources */,
+ 1A80011D0FDB2CB2000F3646 /* SliderTrackLeft.tiff in Resources */,
+ 1A80011E0FDB2CB2000F3646 /* SliderTrackRight.tiff in Resources */,
+ 1A80011F0FDB2CB2000F3646 /* Thumb.tiff in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D576311048677EA00EA77CD /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */,
+ 1A80001B0FDB2C85000F3646 /* MovieControllerLayer.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C167EFE841241C02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 149C298408902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeCoreAnimationMoviePlugin;
+ WRAPPER_EXTENSION = plugin;
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ 149C298508902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeCoreAnimationMoviePlugin;
+ WRAPPER_EXTENSION = plugin;
+ };
+ name = Release;
+ };
+ 149C298808902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.6;
+ };
+ name = Debug;
+ };
+ 149C298908902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = i386;
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeCoreAnimationMoviePlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298408902C53008A9EFC /* Debug */,
+ 149C298508902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeCoreAnimationMoviePlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298808902C53008A9EFC /* Debug */,
+ 149C298908902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Pause.tiff b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Pause.tiff
new file mode 100644
index 0000000..b46fa57
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Pause.tiff
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Play.tiff b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Play.tiff
new file mode 100644
index 0000000..3071a6f
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Play.tiff
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackCenter.tiff b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackCenter.tiff
new file mode 100644
index 0000000..bef6508
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackCenter.tiff
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackLeft.tiff b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackLeft.tiff
new file mode 100644
index 0000000..1609297
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackLeft.tiff
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackRight.tiff b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackRight.tiff
new file mode 100644
index 0000000..270c42b
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/SliderTrackRight.tiff
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Thumb.tiff b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Thumb.tiff
new file mode 100644
index 0000000..392ce56
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/Thumb.tiff
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/main.m b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/main.m
new file mode 100644
index 0000000..b23283f
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/main.m
@@ -0,0 +1,393 @@
+/*
+ File: MovieControllerLayer.m
+
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
+ Inc. ("Apple") in consideration of your agreement to the following
+ terms, and your use, installation, modification or redistribution of
+ this Apple software constitutes acceptance of these terms. If you do
+ not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and
+ subject to these terms, Apple grants you a personal, non-exclusive
+ license, under Apple's copyrights in this original Apple software (the
+ "Apple Software"), to use, reproduce, modify and redistribute the Apple
+ Software, with or without modifications, in source and/or binary forms;
+ provided that if you redistribute the Apple Software in its entirety and
+ without modifications, you must retain this notice and the following
+ text and disclaimers in all such redistributions of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may
+ be used to endorse or promote products derived from the Apple Software
+ without specific prior written permission from Apple. Except as
+ expressly stated in this notice, no other rights or licenses, express or
+ implied, are granted by Apple herein, including but not limited to any
+ patent rights that may be infringed by your derivative works or by other
+ works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE
+ MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
+ THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
+ OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
+ MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
+ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
+ STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2009 Apple Inc. All Rights Reserved.
+
+ */
+
+#import <WebKit/npapi.h>
+#import <WebKit/npfunctions.h>
+#import <WebKit/npruntime.h>
+
+#import <QuartzCore/QuartzCore.h>
+#import <QTKit/QTKit.h>
+
+#import "MovieControllerLayer.h"
+
+// Browser function table
+static NPNetscapeFuncs* browser;
+
+// Structure for per-instance storage
+typedef struct PluginObject
+{
+ NPP npp;
+
+ NPWindow window;
+
+ CALayer *rootLayer;
+ MovieControllerLayer *controllerLayer;
+ QTMovieLayer *movieLayer;
+
+ CALayer *mouseDownLayer;
+
+ NSURL *movieURL;
+ QTMovie *movie;
+} PluginObject;
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+int32_t NPP_WriteReady(NPP instance, NPStream* stream);
+int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void NPP_Print(NPP instance, NPPrint* platformPrint);
+int16_t NPP_HandleEvent(NPP instance, void* event);
+void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
+
+#pragma export on
+// Mach-o entry points
+NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
+NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
+void NP_Shutdown(void);
+#pragma export off
+
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs)
+{
+ browser = browserFuncs;
+ return NPERR_NO_ERROR;
+}
+
+NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
+{
+ pluginFuncs->version = 11;
+ pluginFuncs->size = sizeof(pluginFuncs);
+ pluginFuncs->newp = NPP_New;
+ pluginFuncs->destroy = NPP_Destroy;
+ pluginFuncs->setwindow = NPP_SetWindow;
+ pluginFuncs->newstream = NPP_NewStream;
+ pluginFuncs->destroystream = NPP_DestroyStream;
+ pluginFuncs->asfile = NPP_StreamAsFile;
+ pluginFuncs->writeready = NPP_WriteReady;
+ pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
+ pluginFuncs->print = NPP_Print;
+ pluginFuncs->event = NPP_HandleEvent;
+ pluginFuncs->urlnotify = NPP_URLNotify;
+ pluginFuncs->getvalue = NPP_GetValue;
+ pluginFuncs->setvalue = NPP_SetValue;
+
+ return NPERR_NO_ERROR;
+}
+
+void NP_Shutdown(void)
+{
+
+}
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ // Create per-instance storage
+ PluginObject *obj = (PluginObject *)malloc(sizeof(PluginObject));
+ bzero(obj, sizeof(PluginObject));
+
+ obj->npp = instance;
+ instance->pdata = obj;
+
+ // Ask the browser if it supports the Core Animation drawing model
+ NPBool supportsCoreAnimation;
+ if (browser->getvalue(instance, NPNVsupportsCoreAnimationBool, &supportsCoreAnimation) != NPERR_NO_ERROR)
+ supportsCoreAnimation = FALSE;
+
+ if (!supportsCoreAnimation)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ // If the browser supports the Core Animation drawing model, enable it.
+ browser->setvalue(instance, NPPVpluginDrawingModel, (void *)NPDrawingModelCoreAnimation);
+
+ // If the browser supports the Cocoa event model, enable it.
+ NPBool supportsCocoa;
+ if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
+ supportsCocoa = FALSE;
+
+ if (!supportsCocoa)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ browser->setvalue(instance, NPPVpluginEventModel, (void *)NPEventModelCocoa);
+
+ for (int16_t i = 0; i < argc; i++) {
+ if (strcasecmp(argn[i], "movieurl") == 0) {
+ NSString *urlString = [NSString stringWithUTF8String:argv[i]];
+ if (urlString)
+ obj->movieURL = [[NSURL URLWithString:urlString] retain];
+ break;
+ }
+
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_Destroy(NPP instance, NPSavedData** save)
+{
+ // Free per-instance storage
+ PluginObject *obj = instance->pdata;
+
+ [obj->movie stop];
+ [obj->rootLayer release];
+
+ free(obj);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ PluginObject *obj = instance->pdata;
+ obj->window = *window;
+
+ return NPERR_NO_ERROR;
+}
+
+
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
+{
+ *stype = NP_ASFILEONLY;
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+int32_t NPP_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
+{
+ return 0;
+}
+
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+}
+
+void NPP_Print(NPP instance, NPPrint* platformPrint)
+{
+
+}
+
+static void handleMouseDown(PluginObject *obj, NPCocoaEvent *event)
+{
+ CGPoint point = CGPointMake(event->data.mouse.pluginX,
+ // Flip the y coordinate
+ obj->window.height - event->data.mouse.pluginY);
+
+ obj->mouseDownLayer = [obj->rootLayer hitTest:point];
+ if (obj->mouseDownLayer == obj->controllerLayer) {
+ [obj->controllerLayer handleMouseDown:[obj->rootLayer convertPoint:point toLayer:obj->controllerLayer]];
+ return;
+ }
+}
+
+static void togglePlayPause(PluginObject *obj)
+{
+ if (!obj->movie)
+ return;
+
+ if ([obj->movie rate] == 0)
+ [obj->movie play];
+ else
+ [obj->movie stop];
+
+}
+
+static void handleMouseUp(PluginObject *obj, NPCocoaEvent *event)
+{
+ CGPoint point = CGPointMake(event->data.mouse.pluginX,
+ // Flip the y coordinate
+ obj->window.height - event->data.mouse.pluginY);
+
+ CALayer *mouseDownLayer = obj->mouseDownLayer;
+ obj->mouseDownLayer = nil;
+ if (mouseDownLayer == obj->controllerLayer) {
+ [obj->controllerLayer handleMouseUp:[obj->rootLayer convertPoint:point toLayer:obj->controllerLayer]];
+ return;
+ }
+}
+
+static void handleMouseDragged(PluginObject *obj, NPCocoaEvent *event)
+{
+ CGPoint point = CGPointMake(event->data.mouse.pluginX,
+ // Flip the y coordinate
+ obj->window.height - event->data.mouse.pluginY);
+
+ if (obj->mouseDownLayer == obj->controllerLayer) {
+ [obj->controllerLayer handleMouseDragged:[obj->rootLayer convertPoint:point toLayer:obj->controllerLayer]];
+ return;
+ }
+}
+
+static void handleMouseEntered(PluginObject *obj)
+{
+ // Show the controller layer.
+ obj->controllerLayer.opacity = 1.0;
+}
+
+static void handleMouseExited(PluginObject *obj)
+{
+ // Hide the controller layer if the movie is playing.
+ if ([obj->movie rate])
+ obj->controllerLayer.opacity = 0.0;
+}
+
+static int handleKeyDown(PluginObject *obj, NPCocoaEvent *event)
+{
+ NSString *characters = (NSString *)event->data.key.characters;
+
+ if ([characters length] == 1 && [characters characterAtIndex:0] == ' ') {
+ togglePlayPause(obj);
+ return 1;
+ }
+
+ return 0;
+}
+
+
+static int handleScrollEvent(PluginObject *obj, NPCocoaEvent *event)
+{
+ double delta = event->data.mouse.deltaY;
+ if (delta < 0)
+ [obj->movie stepForward];
+ else
+ [obj->movie stepBackward];
+ return 0;
+}
+
+
+
+int16_t NPP_HandleEvent(NPP instance, void* event)
+{
+ PluginObject *obj = instance->pdata;
+
+ NPCocoaEvent *cocoaEvent = event;
+
+ switch(cocoaEvent->type) {
+ case NPCocoaEventMouseDown:
+ handleMouseDown(obj, cocoaEvent);
+ return 1;
+ case NPCocoaEventMouseUp:
+ handleMouseUp(obj, cocoaEvent);
+ return 1;
+ case NPCocoaEventMouseDragged:
+ handleMouseDragged(obj, cocoaEvent);
+ return 1;
+ case NPCocoaEventMouseEntered:
+ handleMouseEntered(obj);
+ return 1;
+ case NPCocoaEventMouseExited:
+ handleMouseExited(obj);
+ return 1;
+ case NPCocoaEventKeyDown:
+ return handleKeyDown(obj, cocoaEvent);
+ case NPCocoaEventScrollWheel:
+ return handleScrollEvent(obj, cocoaEvent);
+ }
+
+ return 0;
+}
+
+void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
+{
+
+}
+
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
+{
+ PluginObject *obj = instance->pdata;
+
+ switch (variable) {
+ case NPPVpluginCoreAnimationLayer:
+ if (!obj->rootLayer) {
+ // Setup layer hierarchy.
+ obj->rootLayer = [[CALayer layer] retain];
+
+ obj->movieLayer = [QTMovieLayer layer];
+ obj->movieLayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
+ [obj->rootLayer addSublayer:obj->movieLayer];
+
+ obj->controllerLayer = [MovieControllerLayer layer];
+ [obj->rootLayer addSublayer:obj->controllerLayer];
+
+ if (obj->movieURL) {
+ NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:obj->movieURL, QTMovieURLAttribute,
+ [NSNumber numberWithBool:YES], QTMovieOpenForPlaybackAttribute,
+ [NSNumber numberWithBool:YES], QTMovieLoopsAttribute,
+ nil];
+ obj->movie = [QTMovie movieWithAttributes:attributes error:nil];
+
+ if (obj->movie) {
+ obj->movieLayer.movie = obj->movie;
+ [obj->controllerLayer setMovie:obj->movie];
+ }
+ }
+
+ }
+
+ // Make sure to return a retained layer
+ *((CALayer **)value) = [obj->rootLayer retain];
+
+ return NPERR_NO_ERROR;
+
+ default:
+ return NPERR_GENERIC_ERROR;
+ }
+}
+
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
+{
+ return NPERR_GENERIC_ERROR;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/test.html b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/test.html
new file mode 100644
index 0000000..0ffb77b
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationMoviePlugin/test.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html>
+<head>
+<title>Netscape Core Animation Movie Plug-In</title>
+</head>
+<body>
+<div>
+<!--
+ <embed width="848" height="480" movieurl="http://movies.apple.com/movies/disney/up/up-tlr2_480p.mov"
+ type="test/x-netscape-core-animation-movie-plugin"></embed>
+-->
+ <embed width="1280" height="720" movieurl="http://movies.apple.com/movies/disney/up/up-tlr2_720p.mov"
+ type="test/x-netscape-core-animation-movie-plugin"></embed>
+
+
+</div>
+</body>
+</html>
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/Composition.qtz b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/Composition.qtz
new file mode 100644
index 0000000..53c0843
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/Composition.qtz
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/English.lproj/InfoPlist.strings b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/English.lproj/InfoPlist.strings
new file mode 100644
index 0000000..5e45963
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/Info.plist b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/Info.plist
new file mode 100644
index 0000000..146bc0d
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/Info.plist
@@ -0,0 +1,36 @@
+<?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>NetscapeCoreAnimationPlugin</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.netscapecoreanimationplugin</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>BRPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>WebPluginDescription</key>
+ <string>Simple Netscape plug-in that draws using Core Animation and handles events using the Cocoa event model</string>
+ <key>WebPluginMIMETypes</key>
+ <dict>
+ <key>test/x-netscape-core-animation-plugin</key>
+ <dict>
+ <key>WebPluginTypeDescription</key>
+ <string>Netscape Core Animation Plug-in</string>
+ </dict>
+ </dict>
+ <key>WebPluginName</key>
+ <string>Netscape Core Animation Plug-in</string>
+</dict>
+</plist>
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..a1e3390
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/NetscapeCoreAnimationPlugin.xcodeproj/project.pbxproj
@@ -0,0 +1,251 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1A1BA1760EF2FB3200754486 /* Composition.qtz in Resources */ = {isa = PBXBuildFile; fileRef = 1A1BA1750EF2FB3200754486 /* Composition.qtz */; };
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A624E580DCBC7F6006898C8 /* main.m */; };
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6250410DCBC81B006898C8 /* Cocoa.framework */; };
+ 1A8C86AA0EF2FB8F003F6E81 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A8C86A90EF2FB8F003F6E81 /* Quartz.framework */; };
+ 1A8C87AA0EF2FBB3003F6E81 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A8C87A90EF2FBB3003F6E81 /* QuartzCore.framework */; };
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1A1BA1750EF2FB3200754486 /* Composition.qtz */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = Composition.qtz; sourceTree = "<group>"; };
+ 1A624E580DCBC7F6006898C8 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 1A8C86A90EF2FB8F003F6E81 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = "<absolute>"; };
+ 1A8C87A90EF2FBB3003F6E81 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
+ 8D576316048677EA00EA77CD /* NetscapeCoreAnimationPlugin.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetscapeCoreAnimationPlugin.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D576313048677EA00EA77CD /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */,
+ 1A8C86AA0EF2FB8F003F6E81 /* Quartz.framework in Frameworks */,
+ 1A8C87AA0EF2FBB3003F6E81 /* QuartzCore.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 089C166AFE841209C02AAC07 /* NetscapeCoreAnimationPlugin */ = {
+ isa = PBXGroup;
+ children = (
+ 08FB77AFFE84173DC02AAC07 /* Source */,
+ 089C167CFE841241C02AAC07 /* Resources */,
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+ 19C28FB6FE9D52B211CA2CBB /* Products */,
+ );
+ name = NetscapeCoreAnimationPlugin;
+ sourceTree = "<group>";
+ };
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */,
+ 1A8C86A90EF2FB8F003F6E81 /* Quartz.framework */,
+ 1A8C87A90EF2FBB3003F6E81 /* QuartzCore.framework */,
+ );
+ name = "External Frameworks and Libraries";
+ sourceTree = "<group>";
+ };
+ 089C167CFE841241C02AAC07 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 1A1BA1750EF2FB3200754486 /* Composition.qtz */,
+ 8D576317048677EA00EA77CD /* Info.plist */,
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 08FB77AFFE84173DC02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 1A624E580DCBC7F6006898C8 /* main.m */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ 19C28FB6FE9D52B211CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D576316048677EA00EA77CD /* NetscapeCoreAnimationPlugin.plugin */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D57630D048677EA00EA77CD /* NetscapeCoreAnimationPlugin */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeCoreAnimationPlugin" */;
+ buildPhases = (
+ 8D576311048677EA00EA77CD /* Sources */,
+ 8D57630F048677EA00EA77CD /* Resources */,
+ 8D576313048677EA00EA77CD /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = NetscapeCoreAnimationPlugin;
+ productInstallPath = "$(HOME)/Library/Bundles";
+ productName = NetscapeCoreAnimationPlugin;
+ productReference = 8D576316048677EA00EA77CD /* NetscapeCoreAnimationPlugin.plugin */;
+ productType = "com.apple.product-type.bundle";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 089C1669FE841209C02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeCoreAnimationPlugin" */;
+ compatibilityVersion = "Xcode 2.4";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 089C166AFE841209C02AAC07 /* NetscapeCoreAnimationPlugin */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D57630D048677EA00EA77CD /* NetscapeCoreAnimationPlugin */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D57630F048677EA00EA77CD /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A1BA1760EF2FB3200754486 /* Composition.qtz in Resources */,
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D576311048677EA00EA77CD /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C167EFE841241C02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 149C298408902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeCoreAnimationPlugin;
+ WRAPPER_EXTENSION = plugin;
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ 149C298508902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeCoreAnimationPlugin;
+ WRAPPER_EXTENSION = plugin;
+ };
+ name = Release;
+ };
+ 149C298808902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = i386;
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ };
+ name = Debug;
+ };
+ 149C298908902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = i386;
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeCoreAnimationPlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298408902C53008A9EFC /* Debug */,
+ 149C298508902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeCoreAnimationPlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298808902C53008A9EFC /* Debug */,
+ 149C298908902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/main.m b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/main.m
new file mode 100644
index 0000000..1f9e96b
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/main.m
@@ -0,0 +1,246 @@
+/*
+ IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/npapi.h>
+#import <WebKit/npfunctions.h>
+#import <WebKit/npruntime.h>
+
+#import <Cocoa/Cocoa.h>
+#import <Quartz/Quartz.h>
+#import <QuartzCore/QuartzCore.h>
+
+// Browser function table
+static NPNetscapeFuncs* browser;
+
+// Structure for per-instance storage
+typedef struct PluginObject
+{
+ NPP npp;
+
+ NPWindow window;
+
+ QCCompositionLayer *layer;
+ bool gold;
+} PluginObject;
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+int32 NPP_WriteReady(NPP instance, NPStream* stream);
+int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void NPP_Print(NPP instance, NPPrint* platformPrint);
+int16 NPP_HandleEvent(NPP instance, void* event);
+void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
+
+#pragma export on
+// Mach-o entry points
+NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
+NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
+void NP_Shutdown(void);
+#pragma export off
+
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs)
+{
+ browser = browserFuncs;
+ return NPERR_NO_ERROR;
+}
+
+NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
+{
+ pluginFuncs->version = 11;
+ pluginFuncs->size = sizeof(pluginFuncs);
+ pluginFuncs->newp = NPP_New;
+ pluginFuncs->destroy = NPP_Destroy;
+ pluginFuncs->setwindow = NPP_SetWindow;
+ pluginFuncs->newstream = NPP_NewStream;
+ pluginFuncs->destroystream = NPP_DestroyStream;
+ pluginFuncs->asfile = NPP_StreamAsFile;
+ pluginFuncs->writeready = NPP_WriteReady;
+ pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
+ pluginFuncs->print = NPP_Print;
+ pluginFuncs->event = NPP_HandleEvent;
+ pluginFuncs->urlnotify = NPP_URLNotify;
+ pluginFuncs->getvalue = NPP_GetValue;
+ pluginFuncs->setvalue = NPP_SetValue;
+
+ return NPERR_NO_ERROR;
+}
+
+void NP_Shutdown(void)
+{
+
+}
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ // Create per-instance storage
+ PluginObject *obj = (PluginObject *)malloc(sizeof(PluginObject));
+ bzero(obj, sizeof(PluginObject));
+
+ obj->npp = instance;
+ instance->pdata = obj;
+
+ // Ask the browser if it supports the Core Animation drawing model
+ NPBool supportsCoreAnimation;
+ if (browser->getvalue(instance, NPNVsupportsCoreAnimationBool, &supportsCoreAnimation) != NPERR_NO_ERROR)
+ supportsCoreAnimation = FALSE;
+
+ if (!supportsCoreAnimation)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ // If the browser supports the Core Animation drawing model, enable it.
+ browser->setvalue(instance, NPPVpluginDrawingModel, (void *)NPDrawingModelCoreAnimation);
+
+ // If the browser supports the Cocoa event model, enable it.
+ NPBool supportsCocoa;
+ if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
+ supportsCocoa = FALSE;
+
+ if (!supportsCocoa)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ browser->setvalue(instance, NPPVpluginEventModel, (void *)NPEventModelCocoa);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_Destroy(NPP instance, NPSavedData** save)
+{
+ // Free per-instance storage
+ PluginObject *obj = instance->pdata;
+
+ [obj->layer release];
+
+ free(obj);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ PluginObject *obj = instance->pdata;
+ obj->window = *window;
+
+ return NPERR_NO_ERROR;
+}
+
+
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
+{
+ *stype = NP_ASFILEONLY;
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+int32 NPP_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
+{
+ return 0;
+}
+
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+}
+
+void NPP_Print(NPP instance, NPPrint* platformPrint)
+{
+
+}
+
+static void handleMouseClick(PluginObject *obj, NPCocoaEvent *event)
+{
+ obj->gold = !obj->gold;
+
+ [obj->layer setValue:[NSNumber numberWithBool:obj->gold] forInputKey:@"gold"];
+}
+
+int16 NPP_HandleEvent(NPP instance, void* event)
+{
+ PluginObject *obj = instance->pdata;
+
+ NPCocoaEvent *cocoaEvent = event;
+
+ switch(cocoaEvent->type) {
+ case NPCocoaEventMouseDown:
+ handleMouseClick(obj, cocoaEvent);
+ return 1;
+ }
+
+ return 0;
+}
+
+void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
+{
+
+}
+
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
+{
+ PluginObject *obj = instance->pdata;
+
+ switch (variable) {
+ case NPPVpluginCoreAnimationLayer:
+ if (!obj->layer) {
+ NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.netscapecoreanimationplugin"] pathForResource:@"Composition" ofType:@"qtz"];
+
+ QCComposition *composition = [QCComposition compositionWithFile:path];
+ obj->layer = [[QCCompositionLayer compositionLayerWithComposition:composition] retain];
+ }
+
+ // Make sure to return a retained layer
+ *((CALayer **)value) = [obj->layer retain];
+
+ return NPERR_NO_ERROR;
+
+ default:
+ return NPERR_GENERIC_ERROR;
+ }
+}
+
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
+{
+ return NPERR_GENERIC_ERROR;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/test.html b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/test.html
new file mode 100644
index 0000000..8e0b4be
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeCoreAnimationPlugin/test.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html>
+<head>
+<title>Cocoa Netscape Plug-In</title>
+</head>
+<body>
+<div>
+ <embed width="400" height="400" type="test/x-netscape-core-animation-plugin"></embed>
+</div>
+</body>
+</html>
diff --git a/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/English.lproj/InfoPlist.strings b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/English.lproj/InfoPlist.strings
new file mode 100644
index 0000000..5e45963
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/Info.plist b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/Info.plist
new file mode 100644
index 0000000..a09cb1f
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/Info.plist
@@ -0,0 +1,36 @@
+<?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>NetscapeInputMethodPlugin</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.netscapeinputmethodplugin</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>BRPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>WebPluginDescription</key>
+ <string>Simple Netscape plug-in that shows how to use input methods</string>
+ <key>WebPluginMIMETypes</key>
+ <dict>
+ <key>test/x-netscape-input-method-plugin</key>
+ <dict>
+ <key>WebPluginTypeDescription</key>
+ <string>Netscape Input Method Plug-in</string>
+ </dict>
+ </dict>
+ <key>WebPluginName</key>
+ <string>Netscape Input Method Plug-in</string>
+</dict>
+</plist>
diff --git a/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..474c2cb
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/NetscapeInputMethodPlugin.xcodeproj/project.pbxproj
@@ -0,0 +1,243 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A624E580DCBC7F6006898C8 /* main.m */; };
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A6250410DCBC81B006898C8 /* Cocoa.framework */; };
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1A624E580DCBC7F6006898C8 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 8D576316048677EA00EA77CD /* NetscapeInputMethodPlugin.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetscapeInputMethodPlugin.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D576313048677EA00EA77CD /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A6250420DCBC81B006898C8 /* Cocoa.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 089C166AFE841209C02AAC07 /* NetscapeInputMethodPlugin */ = {
+ isa = PBXGroup;
+ children = (
+ 08FB77AFFE84173DC02AAC07 /* Source */,
+ 089C167CFE841241C02AAC07 /* Resources */,
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+ 19C28FB6FE9D52B211CA2CBB /* Products */,
+ );
+ name = NetscapeInputMethodPlugin;
+ sourceTree = "<group>";
+ };
+ 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 1A6250410DCBC81B006898C8 /* Cocoa.framework */,
+ );
+ name = "External Frameworks and Libraries";
+ sourceTree = "<group>";
+ };
+ 089C167CFE841241C02AAC07 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D576317048677EA00EA77CD /* Info.plist */,
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 08FB77AFFE84173DC02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 1A624E580DCBC7F6006898C8 /* main.m */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ 19C28FB6FE9D52B211CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D576316048677EA00EA77CD /* NetscapeInputMethodPlugin.plugin */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D57630D048677EA00EA77CD /* NetscapeInputMethodPlugin */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeInputMethodPlugin" */;
+ buildPhases = (
+ 8D576311048677EA00EA77CD /* Sources */,
+ 8D57630F048677EA00EA77CD /* Resources */,
+ 8D576313048677EA00EA77CD /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = NetscapeInputMethodPlugin;
+ productInstallPath = "$(HOME)/Library/Bundles";
+ productName = NetscapeInputMethodPlugin;
+ productReference = 8D576316048677EA00EA77CD /* NetscapeInputMethodPlugin.plugin */;
+ productType = "com.apple.product-type.bundle";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 089C1669FE841209C02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeInputMethodPlugin" */;
+ compatibilityVersion = "Xcode 2.4";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 089C166AFE841209C02AAC07 /* NetscapeInputMethodPlugin */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D57630D048677EA00EA77CD /* NetscapeInputMethodPlugin */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D57630F048677EA00EA77CD /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D576311048677EA00EA77CD /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A624E590DCBC7F6006898C8 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C167EFE841241C02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 149C298408902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeInputMethodPlugin;
+ WRAPPER_EXTENSION = plugin;
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ 149C298508902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
+ GCC_DEBUGGING_SYMBOLS = full;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_NAME = NetscapeInputMethodPlugin;
+ WRAPPER_EXTENSION = plugin;
+ };
+ name = Release;
+ };
+ 149C298808902C53008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
+ };
+ name = Debug;
+ };
+ 149C298908902C53008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 149C298308902C53008A9EFC /* Build configuration list for PBXNativeTarget "NetscapeInputMethodPlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298408902C53008A9EFC /* Debug */,
+ 149C298508902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 149C298708902C53008A9EFC /* Build configuration list for PBXProject "NetscapeInputMethodPlugin" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C298808902C53008A9EFC /* Debug */,
+ 149C298908902C53008A9EFC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/main.m b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/main.m
new file mode 100644
index 0000000..0adc21b
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/main.m
@@ -0,0 +1,398 @@
+/*
+ IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/npapi.h>
+#import <WebKit/npfunctions.h>
+#import <WebKit/npruntime.h>
+
+#import <Cocoa/Cocoa.h>
+
+// Browser function table
+static NPNetscapeFuncs* browser;
+
+// Structure for per-instance storage
+typedef struct PluginObject
+{
+ NPP npp;
+
+ NPWindow window;
+
+ bool pluginHasFocus;
+
+ bool textFieldHasFocus;
+ NSRect textFieldRect;
+
+ NSRange selectedRange;
+ NSTextStorage *textStorage;
+ NSLayoutManager *layoutManager;
+ NSTextContainer *textContainer;
+
+} PluginObject;
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+int32 NPP_WriteReady(NPP instance, NPStream* stream);
+int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void NPP_Print(NPP instance, NPPrint* platformPrint);
+int16 NPP_HandleEvent(NPP instance, void* event);
+void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void* value);
+
+#pragma export on
+// Mach-o entry points
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs);
+NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs);
+void NP_Shutdown(void);
+#pragma export off
+
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs)
+{
+ browser = browserFuncs;
+ return NPERR_NO_ERROR;
+}
+
+NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
+{
+ pluginFuncs->version = 11;
+ pluginFuncs->size = sizeof(pluginFuncs);
+ pluginFuncs->newp = NPP_New;
+ pluginFuncs->destroy = NPP_Destroy;
+ pluginFuncs->setwindow = NPP_SetWindow;
+ pluginFuncs->newstream = NPP_NewStream;
+ pluginFuncs->destroystream = NPP_DestroyStream;
+ pluginFuncs->asfile = NPP_StreamAsFile;
+ pluginFuncs->writeready = NPP_WriteReady;
+ pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
+ pluginFuncs->print = NPP_Print;
+ pluginFuncs->event = NPP_HandleEvent;
+ pluginFuncs->urlnotify = NPP_URLNotify;
+ pluginFuncs->getvalue = NPP_GetValue;
+ pluginFuncs->setvalue = NPP_SetValue;
+
+ return NPERR_NO_ERROR;
+}
+
+void NP_Shutdown(void)
+{
+}
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ // Create per-instance storage
+ PluginObject* obj = (PluginObject*)malloc(sizeof(PluginObject));
+ bzero(obj, sizeof(PluginObject));
+
+ obj->npp = instance;
+ instance->pdata = obj;
+
+ // Ask the browser if it supports the CoreGraphics drawing model
+ NPBool supportsCoreGraphics;
+ if (browser->getvalue(instance, NPNVsupportsCoreGraphicsBool, &supportsCoreGraphics) != NPERR_NO_ERROR)
+ supportsCoreGraphics = FALSE;
+
+ if (!supportsCoreGraphics)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ // If the browser supports the CoreGraphics drawing model, enable it.
+ browser->setvalue(instance, NPPVpluginDrawingModel, (void*)NPDrawingModelCoreGraphics);
+
+ // If the browser supports the Cocoa event model, enable it.
+ NPBool supportsCocoa;
+ if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
+ supportsCocoa = FALSE;
+
+ if (!supportsCocoa)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ browser->setvalue(instance, NPPVpluginEventModel, (void*)NPEventModelCocoa);
+
+ obj->textFieldRect = NSMakeRect(10, 10, 200, 100);
+
+ obj->textStorage = [[NSTextStorage alloc] initWithString:@""];
+ obj->layoutManager = [[NSLayoutManager alloc] init];
+ [obj->textStorage addLayoutManager:obj->layoutManager];
+
+ obj->textContainer = [[NSTextContainer alloc] initWithContainerSize:obj->textFieldRect.size];
+ [obj->layoutManager addTextContainer:obj->textContainer];
+
+ obj->selectedRange.location = [obj->textStorage length];
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_Destroy(NPP instance, NPSavedData** save)
+{
+ // Free per-instance storage
+ PluginObject* obj = instance->pdata;
+
+ [obj->textStorage release];
+ [obj->layoutManager release];
+
+ free(obj);
+
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ PluginObject* obj = instance->pdata;
+ obj->window = *window;
+
+ return NPERR_NO_ERROR;
+}
+
+
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
+{
+ *stype = NP_ASFILEONLY;
+ return NPERR_NO_ERROR;
+}
+
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+int32 NPP_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
+{
+ return 0;
+}
+
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+}
+
+void NPP_Print(NPP instance, NPPrint* platformPrint)
+{
+
+}
+
+static void handleDraw(PluginObject* obj, NPCocoaEvent *event)
+{
+ NSGraphicsContext *oldContext = [[NSGraphicsContext currentContext] retain];
+
+ NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithGraphicsPort:event->data.draw.context
+ flipped:YES];
+
+
+ [NSGraphicsContext setCurrentContext:context];
+
+ NSRect rect = NSMakeRect(0, 0, obj->window.width, obj->window.height);
+
+ [[NSColor lightGrayColor] set];
+ [NSBezierPath fillRect:rect];
+
+ if (obj->pluginHasFocus) {
+ [[NSColor blackColor] set];
+ [NSBezierPath strokeRect:rect];
+ }
+
+ [[NSColor whiteColor] set];
+ [NSBezierPath fillRect:obj->textFieldRect];
+
+ // Draw the text
+ NSRange glyphRange = [obj->layoutManager glyphRangeForTextContainer:obj->textContainer];
+ if (glyphRange.length > 0) {
+ [obj->layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:obj->textFieldRect.origin];
+ [obj->layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:obj->textFieldRect.origin];
+ }
+
+ NSBezierPath *textInputBorder = [NSBezierPath bezierPathWithRect:obj->textFieldRect];
+ [[NSColor blackColor] set];
+
+ if (obj->pluginHasFocus && obj->textFieldHasFocus)
+ [textInputBorder setLineWidth:2];
+ else
+ [textInputBorder setLineWidth:1];
+
+ [textInputBorder stroke];
+
+ if (obj->pluginHasFocus && obj->textFieldHasFocus) {
+ NSUInteger rectCount;
+ NSRect *rectArray = [obj->layoutManager rectArrayForCharacterRange:obj->selectedRange
+ withinSelectedCharacterRange:obj->selectedRange
+ inTextContainer:obj->textContainer
+ rectCount:&rectCount];
+
+ [[NSColor blackColor] set];
+ for (unsigned i = 0; i < rectCount; i++) {
+ NSRect rect = rectArray[i];
+ rect.origin.x += obj->textFieldRect.origin.x;
+ rect.origin.y += obj->textFieldRect.origin.y;
+
+ [NSBezierPath strokeRect:rect];
+ }
+ }
+
+ [NSGraphicsContext setCurrentContext:oldContext];
+}
+
+static void invalidatePlugin(PluginObject* obj)
+{
+ NPRect rect;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = obj->window.width;
+ rect.bottom = obj->window.height;
+
+ browser->invalidaterect(obj->npp, &rect);
+}
+
+static void handleFocusChanged(NPCocoaEvent* cocoaEvent, PluginObject* obj)
+{
+ obj->pluginHasFocus = cocoaEvent->data.focus.hasFocus;
+
+ invalidatePlugin(obj);
+}
+
+static void handleMouseMoved(NPCocoaEvent* cocoaEvent, PluginObject* obj)
+{
+ NSPoint point = NSMakePoint(cocoaEvent->data.mouse.pluginX, cocoaEvent->data.mouse.pluginY);
+
+ if (NSPointInRect(point, obj->textFieldRect))
+ [[NSCursor IBeamCursor] set];
+ else
+ [[NSCursor arrowCursor] set];
+}
+
+static void handleMouseDown(NPCocoaEvent* cocoaEvent, PluginObject* obj)
+{
+ NSPoint point = NSMakePoint(cocoaEvent->data.mouse.pluginX, cocoaEvent->data.mouse.pluginY);
+
+ obj->textFieldHasFocus = NSPointInRect(point, obj->textFieldRect);
+
+ invalidatePlugin(obj);
+}
+
+static int16_t handleTextFieldKeyDown(NPCocoaEvent* event, PluginObject* obj)
+{
+ NSString *string = (NSString *)event->data.key.charactersIgnoringModifiers;
+
+ unichar c = [string length] > 0 ? [string characterAtIndex:0] : 0;
+
+ switch (c) {
+ case NSLeftArrowFunctionKey:
+ if (obj->selectedRange.location > 0) {
+ obj->selectedRange.location--;
+ invalidatePlugin(obj);
+ }
+ return 1;
+
+ case NSRightArrowFunctionKey:
+ if (obj->selectedRange.location < [obj->textStorage length]) {
+ obj->selectedRange.location++;
+ invalidatePlugin(obj);
+ }
+
+ return 1;
+
+ default:
+ // Return 0 and let the text input system handle it.
+ return 0;
+ }
+}
+
+
+static int16_t handleTextInput(NPCocoaEvent* event, PluginObject* obj)
+{
+ NSString *string = (NSString *)event->data.text.text;
+ NSRange range = obj->selectedRange;
+
+ [obj->textStorage replaceCharactersInRange:range withString:string];
+
+ obj->selectedRange.location = range.location + [string length];
+ obj->selectedRange.length = 0;
+
+ invalidatePlugin(obj);
+
+ return 1;
+}
+
+int16 NPP_HandleEvent(NPP instance, void* event)
+{
+ PluginObject* obj = instance->pdata;
+
+ NPCocoaEvent* cocoaEvent = event;
+
+ switch (cocoaEvent->type) {
+ case NPCocoaEventDrawRect:
+ handleDraw(obj, cocoaEvent);
+ return 1;
+ case NPCocoaEventFocusChanged:
+ handleFocusChanged(cocoaEvent, obj);
+ return 1;
+ case NPCocoaEventMouseMoved:
+ handleMouseMoved(cocoaEvent, obj);
+ return 1;
+ case NPCocoaEventMouseDown:
+ handleMouseDown(cocoaEvent, obj);
+ return 1;
+ case NPCocoaEventKeyDown:
+ // If the text field has focus we ignore the event, causing it
+ // to be sent to the input manager.
+ if (obj->textFieldHasFocus)
+ return handleTextFieldKeyDown(cocoaEvent, obj);
+ else
+ return 1;
+ case NPCocoaEventTextInput:
+ return handleTextInput(cocoaEvent, obj);
+ return 1;
+
+ }
+
+ return 0;
+}
+
+void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
+{
+}
+
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value)
+{
+ return NPERR_GENERIC_ERROR;
+}
+
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void* value)
+{
+ return NPERR_GENERIC_ERROR;
+}
diff --git a/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/test.html b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/test.html
new file mode 100644
index 0000000..d41a4c0
--- /dev/null
+++ b/src/3rdparty/webkit/Examples/NetscapeInputMethodPlugin/test.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html>
+<head>
+<title>Netscape Input Method Plug-In</title>
+</head>
+<body>
+<div>
+ <embed width="400" height="400" type="test/x-netscape-input-method-plugin"></embed>
+</div>
+</body>
+</html>
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h b/src/3rdparty/webkit/JavaScriptCore/API/APICast.h
deleted file mode 100644
index ba00d02..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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>(asCell(JSC::jsAPIValueWrapper(exec, v)));
- return reinterpret_cast<JSValueRef>(asCell(v));
-#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/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h b/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h
deleted file mode 100644
index 9a6cacb..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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 "JSLock.h"
-
-namespace JSC {
-
-class APIEntryShimWithoutLock {
-protected:
- APIEntryShimWithoutLock(JSGlobalData* globalData, bool registerThread)
- : m_globalData(globalData)
- , m_entryIdentifierTable(setCurrentIdentifierTable(globalData->identifierTable))
- {
- if (registerThread)
- globalData->heap.registerThread();
- m_globalData->timeoutChecker.start();
- }
-
- ~APIEntryShimWithoutLock()
- {
- m_globalData->timeoutChecker.stop();
- 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())
- {
- resetCurrentIdentifierTable();
- }
-
- ~APICallbackShim()
- {
- setCurrentIdentifierTable(m_globalData->identifierTable);
- }
-
-private:
- JSLock::DropAllLocks m_dropAllLocks;
- JSGlobalData* m_globalData;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp
deleted file mode 100644
index ebfeafa..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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>
-
-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/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h
deleted file mode 100644
index 2e16720..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp
deleted file mode 100644
index 9c5f6d7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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/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(NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
- : JSObject(structure)
- , m_class(jsClass)
- , m_callback(callback)
-{
- if (m_class)
- JSClassRetain(jsClass);
-}
-
-JSCallbackConstructor::~JSCallbackConstructor()
-{
- if (m_class)
- JSClassRelease(m_class);
-}
-
-static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, const ArgList& args)
-{
- JSContextRef ctx = toRef(exec);
- JSObjectRef constructorRef = toRef(constructor);
-
- JSObjectCallAsConstructorCallback callback = static_cast<JSCallbackConstructor*>(constructor)->callback();
- if (callback) {
- int argumentCount = static_cast<int>(args.size());
- Vector<JSValueRef, 16> arguments(argumentCount);
- for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, args.at(i));
-
- JSValueRef exception = 0;
- JSObjectRef result;
- {
- APICallbackShim callbackShim(exec);
- result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
- }
- if (exception)
- exec->setException(toJS(exec, exception));
- return toJS(result);
- }
-
- return 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/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h
deleted file mode 100644
index e529947..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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/JSObject.h>
-
-namespace JSC {
-
-class JSCallbackConstructor : public JSObject {
-public:
- JSCallbackConstructor(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/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp
deleted file mode 100644
index 63c8add..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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 "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, JSObjectCallAsFunctionCallback callback, const Identifier& name)
- : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject()->callbackFunctionStructure(), name)
- , m_callback(callback)
-{
-}
-
-JSValue JSCallbackFunction::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args)
-{
- JSContextRef execRef = toRef(exec);
- JSObjectRef functionRef = toRef(functionObject);
- JSObjectRef thisObjRef = toRef(thisValue.toThisObject(exec));
-
- int argumentCount = static_cast<int>(args.size());
- Vector<JSValueRef, 16> arguments(argumentCount);
- for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, args.at(i));
-
- JSValueRef exception = 0;
- JSValueRef result;
- {
- APICallbackShim callbackShim(exec);
- result = static_cast<JSCallbackFunction*>(functionObject)->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
- }
- if (exception)
- exec->setException(toJS(exec, exception));
-
- return toJS(exec, result);
-}
-
-CallType JSCallbackFunction::getCallData(CallData& callData)
-{
- callData.native.function = call;
- return CallTypeHost;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h
deleted file mode 100644
index 10dae6b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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*, 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 JSValue JSC_HOST_CALL call(ExecState*, JSObject*, JSValue, const ArgList&);
-
- JSObjectCallAsFunctionCallback m_callback;
-};
-
-} // namespace JSC
-
-#endif // JSCallbackFunction_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.cpp
deleted file mode 100644
index 2fde0f8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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"
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSObject>);
-ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSGlobalObject>);
-
-// Define the two types of JSCallbackObjects we support.
-template <> const ClassInfo JSCallbackObject<JSObject>::info = { "CallbackObject", 0, 0, 0 };
-template <> const ClassInfo JSCallbackObject<JSGlobalObject>::info = { "CallbackGlobalObject", 0, 0, 0 };
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h
deleted file mode 100644
index 1cf7a02..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 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.
- */
-
-#ifndef JSCallbackObject_h
-#define JSCallbackObject_h
-
-#include "JSObjectRef.h"
-#include "JSValueRef.h"
-#include "JSObject.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.set(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.ustring().rep());
- if (location == m_propertyMap.end())
- return JSValue();
- return location->second;
- }
-
- void setPrivateProperty(const Identifier& propertyName, JSValue value)
- {
- m_propertyMap.set(propertyName.ustring().rep(), value);
- }
-
- void deletePrivateProperty(const Identifier& propertyName)
- {
- m_propertyMap.remove(propertyName.ustring().rep());
- }
-
- 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<UString::Rep>, JSValue, IdentifierRepHash> PrivatePropertyMap;
- PrivatePropertyMap m_propertyMap;
- };
- OwnPtr<JSPrivatePropertyMap> m_privateProperties;
-};
-
-
-template <class Base>
-class JSCallbackObject : public Base {
-public:
- JSCallbackObject(ExecState*, NonNullPassRefPtr<Structure>, JSClassRef, void* data);
- JSCallbackObject(JSClassRef);
- 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 JSValue JSC_HOST_CALL call(ExecState*, JSObject* functionObject, JSValue thisValue, const ArgList&);
- static JSObject* construct(ExecState*, JSObject* constructor, const ArgList&);
-
- 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/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h
deleted file mode 100644
index 6c83eb4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * 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 "JSCallbackFunction.h"
-#include "JSClassRef.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, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, void* data)
- : Base(structure)
- , m_callbackObjectData(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)
- : Base()
- , m_callbackObjectData(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) {
- exec->setException(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.ustring().rep())) {
- slot.setCustom(this, staticValueGetter);
- return true;
- }
- }
-
- if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
- if (staticFunctions->contains(propertyName.ustring().rep())) {
- 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)
- exec->setException(toJS(exec, exception));
- if (result || exception)
- return;
- }
-
- if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
- if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) {
- 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)
- exec->setException(toJS(exec, exception));
- if (result || exception)
- return;
- } else
- throwError(exec, ReferenceError, "Attempt to set a property that is not settable.");
- }
- }
-
- if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
- if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) {
- 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)
- exec->setException(toJS(exec, exception));
- if (result || exception)
- return true;
- }
-
- if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
- if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) {
- if (entry->attributes & kJSPropertyAttributeDontDelete)
- return false;
- return true;
- }
- }
-
- if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
- if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) {
- 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>
-JSObject* JSCallbackObject<Base>::construct(ExecState* exec, JSObject* constructor, const ArgList& args)
-{
- 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>(args.size());
- Vector<JSValueRef, 16> arguments(argumentCount);
- for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, args.at(i));
- JSValueRef exception = 0;
- JSObject* result;
- {
- APICallbackShim callbackShim(exec);
- result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception));
- }
- if (exception)
- exec->setException(toJS(exec, exception));
- return result;
- }
- }
-
- ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here
- return 0;
-}
-
-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)
- exec->setException(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>
-JSValue JSCallbackObject<Base>::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args)
-{
- JSContextRef execRef = toRef(exec);
- JSObjectRef functionRef = toRef(functionObject);
- JSObjectRef thisObjRef = toRef(thisValue.toThisObject(exec));
-
- for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(functionObject)->classRef(); jsClass; jsClass = jsClass->parentClass) {
- if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) {
- int argumentCount = static_cast<int>(args.size());
- Vector<JSValueRef, 16> arguments(argumentCount);
- for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, args.at(i));
- JSValueRef exception = 0;
- JSValue result;
- {
- APICallbackShim callbackShim(exec);
- result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception));
- }
- if (exception)
- exec->setException(toJS(exec, exception));
- return result;
- }
- }
-
- ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
- return 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) {
- UString::Rep* 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) {
- UString::Rep* 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) {
- exec->setException(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) {
- exec->setException(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.ustring().rep()))
- 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) {
- exec->setException(toJS(exec, exception));
- return jsUndefined();
- }
- if (value)
- return toJS(exec, value);
- }
-
- return throwError(exec, ReferenceError, "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.ustring().rep())) {
- if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
- JSObject* o = new (exec) JSCallbackFunction(exec, callAsFunction, propertyName);
- thisObj->putDirect(propertyName, o, entry->attributes);
- return o;
- }
- }
- }
- }
-
- return throwError(exec, ReferenceError, "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) {
- exec->setException(toJS(exec, exception));
- return jsUndefined();
- }
- if (value)
- return toJS(exec, value);
- }
-
- return throwError(exec, ReferenceError, "hasProperty callback returned true for a property that doesn't exist.");
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp
deleted file mode 100644
index 3c2133d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * 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/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::null();
-
- 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::null();
-
- 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);
- UStringImpl* impl = valueName.rep();
- 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);
- UStringImpl* impl = functionName.rep();
- 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.size() || !m_className.rep()->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(UString::Rep::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(UString::Rep::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.data(), m_className.size());
-}
-
-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<JSObject>(exec, 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/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h
deleted file mode 100644
index ae60aad..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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>
-#include <wtf/RefCounted.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<JSC::UString::Rep>, StaticValueEntry*> OpaqueJSClassStaticValuesTable;
-typedef HashMap<RefPtr<JSC::UString::Rep>, 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/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp
deleted file mode 100644
index 9d4f38c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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"
-
-#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::createNonDefault().releaseRef());
-}
-
-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::createNonDefault();
-
- 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);
- 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 = 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();
-
- 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/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp
deleted file mode 100644
index 8fdbdab..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * 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().releaseRef();
-}
-
-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<JSObject>* object = new (exec) JSCallbackObject<JSObject>(exec, 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, 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()->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);
-
- MarkedArgumentBuffer argList;
- for (size_t i = 0; i < argumentCount; ++i)
- argList.append(toJS(exec, arguments[i]));
-
- JSObject* result = constructError(exec, argList);
- 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->setPrototype(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<JSObject>::info))
- return static_cast<JSCallbackObject<JSObject>*>(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<JSObject>::info)) {
- static_cast<JSCallbackObject<JSObject>*>(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<JSObject>::info))
- result = static_cast<JSCallbackObject<JSObject>*>(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 = toJS(exec, value);
- 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<JSObject>::info)) {
- static_cast<JSCallbackObject<JSObject>*>(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<JSObject>::info)) {
- static_cast<JSCallbackObject<JSObject>*>(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()).releaseRef()));
-
- 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/src/3rdparty/webkit/JavaScriptCore/API/JSRetainPtr.h b/src/3rdparty/webkit/JavaScriptCore/API/JSRetainPtr.h
deleted file mode 100644
index 69c6de1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSRetainPtr.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2005, 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.
- * 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& o) : m_ptr(o.m_ptr) { if (T ptr = m_ptr) JSRetain(ptr); }
-
- ~JSRetainPtr() { if (T ptr = m_ptr) JSRelease(ptr); }
-
- template <typename U> JSRetainPtr(const JSRetainPtr<U>& o) : m_ptr(o.get()) { if (T ptr = m_ptr) JSRetain(ptr); }
-
- T get() const { return m_ptr; }
-
- T releaseRef() { T tmp = m_ptr; m_ptr = 0; return tmp; }
-
- 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&);
-
-private:
- T m_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 <class T> inline void JSRetainPtr<T>::swap(JSRetainPtr<T>& o)
-{
- std::swap(m_ptr, o.m_ptr);
-}
-
-template <class 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/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.cpp
deleted file mode 100644
index 8e236e4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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).releaseRef();
-}
-
-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()).releaseRef();
- }
-
- // Null string.
- return OpaqueJSString::create().releaseRef();
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h
deleted file mode 100644
index 92135b1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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__)) /* 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/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefBSTR.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefBSTR.cpp
deleted file mode 100644
index a7d3e99..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefBSTR.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefCF.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefCF.cpp
deleted file mode 100644
index d1f6fe3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefCF.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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).releaseRef();
- } else {
- return OpaqueJSString::create(0, 0).releaseRef();
- }
-}
-
-CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string)
-{
- return CFStringCreateWithCharacters(alloc, reinterpret_cast<const UniChar*>(string->characters()), string->length());
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp
deleted file mode 100644
index ced8203..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * 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 <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<JSObject>::info))
- return static_cast<JSCallbackObject<JSObject>*>(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);
-
- return toRef(exec, jsNumber(exec, 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).releaseRef();
-}
-
-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().releaseRef();
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp b/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp
deleted file mode 100644
index f740abe..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.data(), ustring.size()));
- return 0;
-}
-
-UString OpaqueJSString::ustring() const
-{
- if (this && m_characters)
- return UString(m_characters, m_length);
- return UString::null();
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.h b/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.h
deleted file mode 100644
index 473c815..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
deleted file mode 100644
index c7e0fc2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ /dev/null
@@ -1,23436 +0,0 @@
-2010-06-18 Tucker Jay <jay.tucker@nokia.com>
-
- Reviewed by NOBODY (OOPS!).
-
- [Symbian] Lazy commit of memory required in JSC register file
- https://bugs.webkit.org/show_bug.cgi?id=34349
-
- * JavaScriptCore.pro: Added 1 new Symbian source file
- * interpreter/RegisterFile.cpp:
- (JSC::RegisterFile::~RegisterFile):
- * interpreter/RegisterFile.h:
- (JSC::RegisterFile::):
- (JSC::RegisterFile::start):
- (JSC::RegisterFile::end):
- (JSC::RegisterFile::size):
- (JSC::RegisterFile::setNumGlobals):
- (JSC::RegisterFile::numGlobals):
- (JSC::RegisterFile::maxGlobals):
- (JSC::RegisterFile::lastGlobal):
- (JSC::RegisterFile::markGlobals):
- (JSC::RegisterFile::markCallFrames):
- (JSC::isPageAligned):
- (JSC::RegisterFile::RegisterFile):
- (JSC::RegisterFile::shrink):
- (JSC::RegisterFile::grow):
- * wtf/symbian/RegisterFileAllocatorSymbian.cpp: Added.
- (WTF::RegisterFileAllocator::RegisterFileAllocator):
- Helper class to allocate memory required by RegisterFile
- more efficiently.
- (WTF::RegisterFileAllocator::~RegisterFileAllocator):
- (WTF::RegisterFileAllocator::buffer):
- (WTF::RegisterFileAllocator::grow):
- (WTF::RegisterFileAllocator::shrink):
- * wtf/symbian/RegisterFileAllocatorSymbian.h: Added.
- * wtf/symbian/SymbianDefines.h: Added.
-
-2010-06-16 Thiago Macieira <thiago.macieira@nokia.com>
-
- Reviewed by NOBODY (OOPS!).
-
- Reindent the asm code I've moved to inside the function
- (previous commit)
-
- * jit/JITStubs.cpp:
-
-2010-06-16 Thiago Macieira <thiago.macieira@nokia.com>
-
- Reviewed by NOBODY (OOPS!).
-
- Fix the JIT compilation with the Intel 32-bit C++ compiler.
-
- ICC doesn't understand the use of "asm" statements outside of
- function bodies, so move the assembly code inside a dummy
- function (and mark it so that the compiler doesn't remove it
- altogether).
-
- Also removed the ".text" entry that I had added because now
- the assembly code is properly inside a code section (fixes
- compilation with -ffunction-sections).
-
- * jit/JITStubs.cpp:
-
-2010-06-16 Thiago Macieira <thiago.macieira@nokia.com>
-
- Reviewed by NOBODY (OOPS!).
-
- Don't use __attribute__((may_alias)) with the Intel compiler,
- as it doesn't understand it.
-
- * wtf/Vector.h:
-
-2010-06-16 Thiago Macieira <thiago.macieira@nokia.com>
-
- Reviewed by NOBODY (OOPS!).
-
- 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-16 Thiago Macieira <thiago.macieira@nokia.com>
-
- Reviewed by NOBODY (OOPS!).
-
- 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-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-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-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-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 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-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):
-
-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-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-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-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-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-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-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 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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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 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-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 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-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 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/src/3rdparty/webkit/JavaScriptCore/Info.plist b/src/3rdparty/webkit/JavaScriptCore/Info.plist
deleted file mode 100644
index 77c9eb8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/Info.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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-2010 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/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi
deleted file mode 100644
index e5f3408..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi
+++ /dev/null
@@ -1,447 +0,0 @@
-{
- '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/ExecutableAllocatorPosix.cpp',
- 'jit/ExecutableAllocatorWin.cpp',
- 'jit/JIT.cpp',
- 'jit/JIT.h',
- 'jit/JITArithmetic.cpp',
- 'jit/JITCall.cpp',
- 'jit/JITCode.h',
- 'jit/JITInlineMethods.h',
- 'jit/JITOpcodes.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/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',
- '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/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/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/RegExpConstructor.cpp',
- 'runtime/RegExpConstructor.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/TimeoutChecker.cpp',
- 'runtime/TimeoutChecker.h',
- 'runtime/Tracing.h',
- 'runtime/UString.cpp',
- 'runtime/UString.h',
- 'runtime/WeakRandom.h',
- 'wtf/AlwaysInline.h',
- 'wtf/ASCIICType.h',
- 'wtf/Assertions.cpp',
- 'wtf/Assertions.h',
- 'wtf/AVLTree.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/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/MainThread.cpp',
- 'wtf/MainThread.h',
- 'wtf/MallocZoneSupport.h',
- 'wtf/MathExtras.h',
- 'wtf/MessageQueue.h',
- 'wtf/Noncopyable.h',
- 'wtf/NotFound.h',
- 'wtf/OwnArrayPtr.h',
- 'wtf/OwnFastMallocPtr.h',
- 'wtf/OwnPtr.h',
- 'wtf/OwnPtrCommon.h',
- 'wtf/OwnPtrWin.cpp',
- '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/StdLibExtras.h',
- 'wtf/StringExtras.h',
- 'wtf/StringHashFunctions.h',
- 'wtf/TCPackedCache.h',
- 'wtf/qt/MainThreadQt.cpp',
- 'wtf/qt/ThreadingQt.cpp',
- 'wtf/TCPageMap.h',
- 'wtf/TCSpinLock.h',
- 'wtf/TCSystemAlloc.cpp',
- 'wtf/TCSystemAlloc.h',
- 'wtf/ThreadIdentifierDataPthreads.cpp',
- 'wtf/ThreadIdentifierDataPthreads.h',
- 'wtf/Threading.cpp',
- 'wtf/Threading.h',
- 'wtf/ThreadingNone.cpp',
- 'wtf/ThreadingPthreads.cpp',
- 'wtf/ThreadingWin.cpp',
- 'wtf/ThreadSpecific.h',
- 'wtf/ThreadSpecificWin.cpp',
- 'wtf/TypeTraits.cpp',
- 'wtf/TypeTraits.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/win/MainThreadWin.cpp',
- 'wtf/wx/MainThreadWx.cpp',
- 'yarr/RegexCompiler.cpp',
- 'yarr/RegexCompiler.h',
- 'yarr/RegexInterpreter.cpp',
- 'yarr/RegexInterpreter.h',
- 'yarr/RegexJIT.cpp',
- 'yarr/RegexJIT.h',
- 'yarr/RegexParser.h',
- 'yarr/RegexPattern.h',
- ]
- }
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order
deleted file mode 100644
index d6f6caa..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order
+++ /dev/null
@@ -1,1963 +0,0 @@
-__ZN3WTF10fastMallocEm
-__ZN3WTF10fastMallocILb1EEEPvm
-__ZN3WTF20TCMalloc_ThreadCache10InitModuleEv
-__ZN3WTFL15InitSizeClassesEv
-__Z20TCMalloc_SystemAllocmPmm
-__ZN3WTFL13MetaDataAllocEm
-__ZN3WTF20TCMalloc_ThreadCache22CreateCacheIfNecessaryEv
-__ZN3WTF25TCMalloc_Central_FreeList11RemoveRangeEPPvS2_Pi
-__ZN3WTF25TCMalloc_Central_FreeList18FetchFromSpansSafeEv
-__ZN3WTF17TCMalloc_PageHeap10AllocLargeEm
-__ZN3WTF17TCMalloc_PageHeap8GrowHeapEm
-__ZN3WTF19initializeThreadingEv
-__ZN3WTF20initializeMainThreadEv
-__ZN3WTF5MutexC1Ev
-__ZN3WTF28initializeMainThreadPlatformEv
-__ZN3WTF36lockAtomicallyInitializedStaticMutexEv
-__ZN3WTF8fastFreeEPv
-__ZN3WTF38unlockAtomicallyInitializedStaticMutexEv
-__ZN3JSC19initializeThreadingEv
-__ZN3JSCL23initializeThreadingOnceEv
-__ZN3JSC17initializeUStringEv
-__ZN3JSC12initDateMathEv
-__ZN3WTF11currentTimeEv
-__ZN3WTF15ThreadConditionC1Ev
-__ZN3WTF5Mutex4lockEv
-__ZN3WTF5Mutex6unlockEv
-__ZN3WTF12createThreadEPFPvS0_ES0_PKc
-__ZN3WTF20createThreadInternalEPFPvS0_ES0_PKc
-__ZN3WTFL35establishIdentifierForPthreadHandleERP17_opaque_pthread_t
-__ZN3WTF9HashTableIjSt4pairIjP17_opaque_pthread_tENS_18PairFirstExtractorIS4_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTrai
-__ZN3WTFL16threadEntryPointEPv
-__ZN3WTF16fastZeroedMallocEm
-__ZN3WTF21setThreadNameInternalEPKc
-__ZN3WTF5MutexD1Ev
-__ZN3WTF25TCMalloc_Central_FreeList11InsertRangeEPvS1_i
-__ZN3WTF25TCMalloc_Central_FreeList18ReleaseListToSpansEPv
-__ZN3WTF12isMainThreadEv
-__ZN3WTF14FastMallocZone4sizeEP14_malloc_zone_tPKv
-__ZN3WTF13currentThreadEv
-__ZN3WTF16callOnMainThreadEPFvPvES0_
-__ZN3WTF5DequeINS_19FunctionWithContextEE14expandCapacityEv
-__ZN3WTF37scheduleDispatchFunctionsOnMainThreadEv
-__ZN3WTF15ThreadCondition4waitERNS_5MutexE
-__ZN3JSC8DebuggerC2Ev
-__ZN3WTF6strtodEPKcPPc
-__ZN3WTF15ThreadCondition6signalEv
-__ZN3WTF15ThreadCondition9timedWaitERNS_5MutexEd
-__ZN3WTF15ThreadCondition9broadcastEv
--[WTFMainThreadCaller call]
-__ZN3WTF31dispatchFunctionsFromMainThreadEv
-__ZN3WTF14FastMallocZone9forceLockEP14_malloc_zone_t
-__ZN3WTF11fastReallocEPvm
-__ZN3WTF11fastReallocILb1EEEPvS1_m
-__ZN3JSC7UStringC1EPKti
-__ZN3JSC7UStringC2EPKti
-__ZN3JSC12JSGlobalData12createLeakedEv
-__ZN3JSC9Structure18startIgnoringLeaksEv
-__ZN3JSC7VPtrSetC2Ev
-__ZN3JSC9StructureC1ENS_7JSValueERKNS_8TypeInfoE
-__ZN3JSC7JSArrayC1EN3WTF10PassRefPtrINS_9StructureEEE
-__ZN3JSC7JSArrayD1Ev
-__ZN3JSC7JSArrayD2Ev
-__ZN3WTF10RefCountedIN3JSC9StructureEE5derefEv
-__ZN3JSC9StructureD1Ev
-__ZN3JSC9StructureD2Ev
-__ZN3JSC11JSByteArray15createStructureENS_7JSValueE
-__ZN3JSC11JSByteArrayD1Ev
-__ZN3JSC8JSStringD1Ev
-__ZN3JSC10JSFunctionD1Ev
-__ZN3JSC10JSFunctionD2Ev
-__ZN3JSC8JSObjectD2Ev
-__ZN3JSC12JSGlobalDataC2EbRKNS_7VPtrSetE
-__ZN3JSC21createIdentifierTableEv
-__ZN3JSC17CommonIdentifiersC1EPNS_12JSGlobalDataE
-__ZN3JSC17CommonIdentifiersC2EPNS_12JSGlobalDataE
-__ZN3JSC10Identifier3addEPNS_12JSGlobalDataEPKc
-__ZN3WTF7HashSetIPN3JSC7UString3RepENS_7StrHashIS4_EENS_10HashTraitsIS4_EEE3addIPKcNS1_17CStringTranslatorEEESt4pairINS_24HashT
-__ZN3WTF9HashTableIPN3JSC7UString3RepES4_NS_17IdentityExtractorIS4_EENS_7StrHashIS4_EENS_10HashTraitsIS4_EESA_E6rehashEi
-__ZN3WTF9HashTableIPKcSt4pairIS2_NS_6RefPtrIN3JSC7UString3RepEEEENS_18PairFirstExtractorIS9_EENS_7PtrHashIS2_EENS_14PairHashTra
-__ZN3WTF6RefPtrIN3JSC7UString3RepEED1Ev
-__ZN3JSC12SmallStringsC1Ev
-__ZN3JSC19ExecutableAllocator17intializePageSizeEv
-__ZN3JSC14ExecutablePool11systemAllocEm
-__ZN3JSC5LexerC1EPNS_12JSGlobalDataE
-__ZN3JSC5LexerC2EPNS_12JSGlobalDataE
-__ZN3JSC11InterpreterC1Ev
-__ZN3JSC11InterpreterC2Ev
-__ZN3JSC11Interpreter14privateExecuteENS0_13ExecutionFlagEPNS_12RegisterFileEPNS_9ExecStateEPNS_7JSValueE
-__ZN3WTF7HashMapIPvN3JSC8OpcodeIDENS_7PtrHashIS1_EENS_10HashTraitsIS1_EENS6_IS3_EEE3addERKS1_RKS3_
-__ZN3WTF9HashTableIPvSt4pairIS1_N3JSC8OpcodeIDEENS_18PairFirstExtractorIS5_EENS_7PtrHashIS1_EENS_14PairHashTraitsINS_10HashTrai
-__ZN3JSC8JITStubsC1EPNS_12JSGlobalDataE
-__ZN3JSC3JITC1EPNS_12JSGlobalDataEPNS_9CodeBlockE
-__ZN3JSC3JITC2EPNS_12JSGlobalDataEPNS_9CodeBlockE
-__ZN3JSC3JIT35privateCompileCTIMachineTrampolinesEPN3WTF6RefPtrINS_14ExecutablePoolEEEPNS_12JSGlobalDataEPPvS9_S9_S9_S9_S9_
-__ZN3JSC12X86Assembler23X86InstructionFormatter11oneByteOp64ENS0_15OneByteOpcodeIDEiNS_3X8610RegisterIDE
-__ZN3JSC12X86Assembler3jCCENS0_9ConditionE
-__ZN3JSC23MacroAssemblerX86Common4moveENS_22AbstractMacroAssemblerINS_12X86AssemblerEE6ImmPtrENS_3X8610RegisterIDE
-__ZN3JSC12X86Assembler23X86InstructionFormatter11oneByteOp64ENS0_15OneByteOpcodeIDEiNS_3X8610RegisterIDEi
-__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDEiNS_3X8610RegisterIDE
-__ZN3JSC15AssemblerBuffer11ensureSpaceEi
-__ZN3JSC20MacroAssemblerX86_6413branchTestPtrENS_23MacroAssemblerX86Common9ConditionENS_3X8610RegisterIDENS_22AbstractMacroAsse
-__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDENS_3X8610RegisterIDE
-__ZN3JSC20MacroAssemblerX86_644callEv
-__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDEiNS_3X8610RegisterIDEi
-__ZN3JSC3JIT32compileOpCallInitializeCallFrameEv
-__ZN3JSC12X86Assembler23X86InstructionFormatter11memoryModRMEiNS_3X8610RegisterIDEi
-__ZN3JSC20MacroAssemblerX86_6421makeTailRecursiveCallENS_22AbstractMacroAssemblerINS_12X86AssemblerEE4JumpE
-__ZN3JSC14TimeoutCheckerC1Ev
-__ZN3JSC4HeapC1EPNS_12JSGlobalDataE
-__ZN3JSC27startProfilerServerIfNeededEv
-+[ProfilerServer sharedProfileServer]
--[ProfilerServer init]
-__ZN3JSC9Structure17stopIgnoringLeaksEv
-__ZN3JSC4Heap8allocateEm
-__ZN3JSCL13allocateBlockILNS_8HeapTypeE0EEEPNS_14CollectorBlockEv
-__ZN3JSC4Heap4heapENS_7JSValueE
-__ZN3JSC4Heap7protectENS_7JSValueE
-__ZN3WTF7HashMapIPN3JSC6JSCellEjNS_7PtrHashIS3_EENS_10HashTraitsIS3_EENS6_IjEEE3addERKS3_RKj
-__ZN3WTF9HashTableIPN3JSC6JSCellESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTraits
-__ZN3JSC14JSGlobalObjectnwEmPNS_12JSGlobalDataE
-__ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE
-__ZN3JSC14JSGlobalObject5resetENS_7JSValueE
-__ZN3JSC4Heap12heapAllocateILNS_8HeapTypeE0EEEPvm
-__ZN3JSC8jsStringEPNS_12JSGlobalDataERKNS_7UStringE
-__ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
-__ZN3JSC7UStringC1EPKc
-__ZN3JSCL9createRepEPKc
-__ZN3JSC8JSObject9putDirectERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
-__ZN3JSC9Structure40addPropertyTransitionToExistingStructureEPS0_RKNS_10IdentifierEjRm
-__ZN3JSC9Structure3getERKNS_10IdentifierERj
-__ZN3JSC9Structure21addPropertyTransitionEPS0_RKNS_10IdentifierEjRm
-__ZN3JSC9Structure3putERKNS_10IdentifierEj
-__ZN3JSC8JSObject26putDirectWithoutTransitionERKNS_10IdentifierENS_7JSValueEj
-__ZN3JSC9Structure28addPropertyWithoutTransitionERKNS_10IdentifierEj
-__ZN3JSC17FunctionPrototype21addFunctionPropertiesEPNS_9ExecStateEPNS_9StructureEPPNS_10JSFunctionES7_
-__ZN3JSC10JSFunctionC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RK
-__ZN3JSC12JSGlobalData17createNativeThunkEv
-__ZN3JSC16FunctionBodyNode17createNativeThunkEPNS_12JSGlobalDataE
-__ZN3WTF6VectorINS_6RefPtrIN3JSC21ParserArenaRefCountedEEELm0EE15reserveCapacityEm
-__ZN3JSC11ParserArena5resetEv
-__ZN3JSC8JSObject34putDirectFunctionWithoutTransitionEPNS_9ExecStateEPNS_16InternalFunctionEj
-__ZN3JSC15ObjectPrototypeC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPS5_
-__ZN3JSC9Structure26rehashPropertyMapHashTableEj
-__ZN3JSC15StringPrototypeC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEE
-__ZN3JSC16BooleanPrototypeC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPS5_
-__ZN3JSC15NumberPrototypeC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPS5_
-__ZN3JSC15RegExpPrototypeC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPS5_
-__ZN3JSC14ErrorPrototypeC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPS5_
-__ZN3JSC20NativeErrorPrototypeC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEERKNS_7UStringES9_
-__ZN3JSC17ObjectConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_15ObjectPrototypeE
-__ZN3JSC19FunctionConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_17FunctionPrototypeE
-__ZNK3JSC16InternalFunction9classInfoEv
-__ZN3JSC16ArrayConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_14ArrayPrototypeE
-__ZNK3JSC14ArrayPrototype9classInfoEv
-__ZN3JSC17StringConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPS5_PNS_15StringPrototypeE
-__ZNK3JSC15StringPrototype9classInfoEv
-__ZN3JSC18BooleanConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_16BooleanPrototypeE
-__ZNK3JSC13BooleanObject9classInfoEv
-__ZN3JSC17NumberConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_15NumberPrototypeE
-__ZN3JSC15DateConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPS5_PNS_13DatePrototypeE
-__ZNK3JSC13DatePrototype9classInfoEv
-__ZN3JSC17RegExpConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_15RegExpPrototypeE
-__ZN3JSC16ErrorConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_14ErrorPrototypeE
-__ZNK3JSC13ErrorInstance9classInfoEv
-__ZN3JSC22NativeErrorConstructorC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS_20NativeErrorPrototypeE
-__ZN3JSC10Identifier11addSlowCaseEPNS_12JSGlobalDataEPNS_7UString3RepE
-__ZN3WTF7HashSetIPN3JSC7UString3RepENS_7StrHashIS4_EENS_10HashTraitsIS4_EEE3addERKS4_
-__ZN3JSC10MathObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEE
-__ZN3JSC12SmallStrings24singleCharacterStringRepEh
-__ZN3WTF7HashMapINS_6RefPtrIN3JSC7UString3RepEEENS2_16SymbolTableEntryENS2_17IdentifierRepHashENS_10HashTraitsIS5_EENS2_26Symbo
-__ZN3WTF9HashTableINS_6RefPtrIN3JSC7UString3RepEEESt4pairIS5_NS2_16SymbolTableEntryEENS_18PairFirstExtractorIS8_EENS2_17Identif
-__ZN3JSC17PrototypeFunctionC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjec
-__ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE
-__ZN3JSC9Structure17copyPropertyTableEv
-__ZN3JSC14JSGlobalObject10globalExecEv
-__ZN3JSC10Identifier3addEPNS_9ExecStateEPKc
-__ZN3JSC4Heap9unprotectENS_7JSValueE
-__ZN3JSC6JSCellnwEmPNS_9ExecStateE
-__ZN3JSC14TimeoutChecker5resetEv
-__ZN3JSC8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_10SourceCodeENS_7JSValueE
-__ZN3JSC6JSLock4lockEb
-__ZN3JSC6Parser5parseINS_11ProgramNodeEEEN3WTF10PassRefPtrIT_EEPNS_9ExecStateEPNS_8DebuggerERKNS_10SourceCodeEPiPNS_7UStringE
-__ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE
-__ZN3JSC7UStringaSEPKc
-__Z10jscyyparsePv
-__ZN3JSC5Lexer3lexEPvS1_
-__ZN3JSC10Identifier3addEPNS_12JSGlobalDataEPKti
-__ZN3WTF7HashSetIPN3JSC7UString3RepENS_7StrHashIS4_EENS_10HashTraitsIS4_EEE3addINS1_11UCharBufferENS1_21UCharBufferTranslatorEE
-__ZN3WTF15SegmentedVectorINS_10IdentifierELm64EE6appendIS1_EEvRKT_
-__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
-__ZN3JSC20ParserArenaDeletablenwEmPNS_12JSGlobalDataE
-__ZN3WTF6VectorIPN3JSC20ParserArenaDeletableELm0EE15reserveCapacityEm
-__ZN3JSC5Lexer10sourceCodeEiii
-__ZN3JSC16FunctionBodyNode13finishParsingERKNS_10SourceCodeEPNS_13ParameterNodeE
-__ZN3WTF6VectorIN3JSC10IdentifierELm0EE14expandCapacityEm
-__ZN3WTF6VectorIPN3JSC12FuncDeclNodeELm0EE14expandCapacityEm
-__ZN3JSC14SourceElements6appendEPNS_13StatementNodeE
-__ZNK3JSC13StatementNode16isEmptyStatementEv
-__ZN3WTF6VectorIPN3JSC13StatementNodeELm0EE14expandCapacityEm
-__ZL20makeFunctionCallNodePvN3JSC8NodeInfoIPNS0_14ExpressionNodeEEENS1_IPNS0_13ArgumentsNodeEEEiii
-__ZNK3JSC11ResolveNode10isLocationEv
-__ZNK3JSC11ResolveNode13isResolveNodeEv
-__ZN3JSC5Lexer7record8Ei
-__ZN3JSC5Lexer10scanRegExpEv
-__ZN3JSC7UStringC2ERKN3WTF6VectorItLm0EEE
-__ZN3JSC7UString3Rep7destroyEv
-__ZN3JSC5Lexer5clearEv
-__ZN3JSC10Identifier6removeEPNS_7UString3RepE
-__ZN3WTF6VectorIN3JSC10IdentifierELm64EE14shrinkCapacityEm
-__ZN3JSC9ScopeNodeC2EPNS_12JSGlobalDataERKNS_10SourceCodeEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPN
-__ZN3WTF6VectorIPN3JSC13StatementNodeELm0EE14shrinkCapacityEm
-__ZN3JSC11ParserArena10removeLastEv
-__ZNK3JSC8JSObject8toObjectEPNS_9ExecStateE
-__ZN3JSC11Interpreter7executeEPNS_11ProgramNodeEPNS_9ExecStateEPNS_14ScopeChainNodeEPNS_8JSObjectEPNS_7JSValueE
-__ZN3JSC11ProgramNode16generateBytecodeEPNS_14ScopeChainNodeE
-__ZN3JSC9CodeBlockC2EPNS_9ScopeNodeENS_8CodeTypeEN3WTF10PassRefPtrINS_14SourceProviderEEEj
-__ZN3WTF7HashSetIPN3JSC16ProgramCodeBlockENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
-__ZN3WTF9HashTableIPN3JSC16ProgramCodeBlockES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
-__ZN3JSC17BytecodeGeneratorC2EPNS_11ProgramNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrINS_7UString3RepEEEN
-__ZN3WTF6VectorIN3JSC11InstructionELm0EE14expandCapacityEm
-__ZN3JSC9Structure22toDictionaryTransitionEPS0_
-__ZN3JSC8JSObject12removeDirectERKNS_10IdentifierE
-__ZN3JSC9Structure31removePropertyWithoutTransitionERKNS_10IdentifierE
-__ZN3JSC9Structure6removeERKNS_10IdentifierE
-__ZN3JSC17BytecodeGenerator12addGlobalVarERKNS_10IdentifierEbRPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator15emitNewFunctionEPNS_10RegisterIDEPNS_12FuncDeclNodeE
-__ZN3JSC9CodeBlock25createRareDataIfNecessaryEv
-__ZN3JSC17BytecodeGenerator11newRegisterEv
-__ZN3JSC9Structure24fromDictionaryTransitionEPS0_
-__ZN3JSC17BytecodeGenerator8generateEv
-__ZN3JSC11ProgramNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator13emitDebugHookENS_11DebugHookIDEii
-__ZN3JSC17BytecodeGenerator11addConstantENS_7JSValueE
-__ZN3WTF9HashTableIPvSt4pairIS1_jENS_18PairFirstExtractorIS3_EENS_7PtrHashIS1_EENS_14PairHashTraitsIN3JSC17JSValueHashTraitsENS
-__ZN3WTF6VectorIN3JSC8RegisterELm0EE14expandCapacityEm
-__ZN3JSC17BytecodeGenerator8emitMoveEPNS_10RegisterIDES2_
-__ZN3JSC17BytecodeGenerator8emitNodeEPNS_10RegisterIDEPNS_4NodeE
-__ZN3WTF6VectorIN3JSC8LineInfoELm0EE14expandCapacityEm
-__ZN3JSC12FuncDeclNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17ExprStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC23FunctionCallResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator11registerForERKNS_10IdentifierE
-__ZN3JSC17BytecodeGenerator8emitCallENS_8OpcodeIDEPNS_10RegisterIDES3_S3_PNS_13ArgumentsNodeEjjj
-__ZN3JSC16ArgumentListNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC12FuncExprNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator25emitNewFunctionExpressionEPNS_10RegisterIDEPNS_12FuncExprNodeE
-__ZN3WTF6VectorIN3JSC19ExpressionRangeInfoELm0EE14expandCapacityEm
-__ZN3WTF6VectorIN3JSC12CallLinkInfoELm0EE14expandCapacityEm
-__ZN3JSC11ResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC12JSGlobalData22numericCompareFunctionEPNS_9ExecStateE
-__ZNK3JSC21UStringSourceProvider6lengthEv
-__ZNK3JSC21UStringSourceProvider4dataEv
-__ZN3JSC19extractFunctionBodyEPNS_11ProgramNodeE
-__ZNK3JSC17ExprStatementNode15isExprStatementEv
-__ZNK3JSC12FuncExprNode14isFuncExprNodeEv
-__ZN3JSC16FunctionBodyNode16generateBytecodeEPNS_14ScopeChainNodeE
-__ZN3JSC6Parser14reparseInPlaceEPNS_12JSGlobalDataEPNS_16FunctionBodyNodeE
-__ZL11makeSubNodePvPN3JSC14ExpressionNodeES2_b
-__ZN3JSC14ExpressionNode14stripUnaryPlusEv
-__ZNK3JSC14ExpressionNode8isNumberEv
-__ZN3JSC9CodeBlockC1EPNS_9ScopeNodeENS_8CodeTypeEN3WTF10PassRefPtrINS_14SourceProviderEEEj
-__ZN3JSC17BytecodeGeneratorC2EPNS_16FunctionBodyNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrINS_7UString3Re
-__ZN3JSC17BytecodeGenerator12addParameterERKNS_10IdentifierE
-__ZN3JSC16FunctionBodyNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC9BlockNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC10ReturnNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC12BinaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZNK3JSC11ResolveNode6isPureERNS_17BytecodeGeneratorE
-__ZN3JSC17BytecodeGenerator12newTemporaryEv
-__ZN3JSC17BytecodeGenerator12emitBinaryOpENS_8OpcodeIDEPNS_10RegisterIDES3_S3_NS_12OperandTypesE
-__ZN3JSC17BytecodeGenerator10emitReturnEPNS_10RegisterIDE
-__ZNK3JSC9BlockNode7isBlockEv
-__ZNK3JSC10ReturnNode12isReturnNodeEv
-__ZN3JSC9CodeBlock11shrinkToFitEv
-__ZN3WTF6VectorIN3JSC11InstructionELm0EE14shrinkCapacityEm
-__ZN3WTF6VectorIN3JSC17StructureStubInfoELm0EE14shrinkCapacityEm
-__ZN3WTF6VectorIPN3JSC12CallLinkInfoELm0EE14shrinkCapacityEm
-__ZN3WTF6VectorIN3JSC10IdentifierELm0EE14shrinkCapacityEm
-__ZN3JSC11ParserArenaD1Ev
-__ZN3JSC11ResolveNodeD0Ev
-__ZN3JSC7SubNodeD0Ev
-__ZN3JSC10ReturnNodeD0Ev
-__ZN3JSC14SourceElementsD0Ev
-__ZN3JSC9BlockNodeD0Ev
-__ZN3JSC17BytecodeGeneratorD2Ev
-__ZN3WTF6VectorIN3JSC11InstructionELm0EEaSERKS3_
-__ZThn16_N3JSC11ProgramNodeD0Ev
-__ZN3JSC11ProgramNodeD0Ev
-__ZN3JSC13ParameterNodeD0Ev
-__ZN3JSC17ExprStatementNodeD0Ev
-__ZThn16_N3JSC12FuncExprNodeD0Ev
-__ZN3JSC12FuncExprNodeD0Ev
-__ZThn16_N3JSC16FunctionBodyNodeD0Ev
-__ZN3JSC16FunctionBodyNodeD0Ev
-__ZN3JSC9CodeBlockD1Ev
-__ZN3JSC9CodeBlockD2Ev
-__ZN3JSC21UStringSourceProviderD0Ev
-__ZN3WTF6VectorIN3JSC19ExpressionRangeInfoELm0EE14shrinkCapacityEm
-__ZN3WTF6VectorIN3JSC8LineInfoELm0EE14shrinkCapacityEm
-__ZN3WTF6VectorINS_6RefPtrIN3JSC12FuncDeclNodeEEELm0EE14shrinkCapacityEm
-__ZN3WTF6VectorIN3JSC15SimpleJumpTableELm0EE14shrinkCapacityEm
-__ZN3WTF6VectorIN3JSC15StringJumpTableELm0EE14shrinkCapacityEm
-__ZN3JSC15ParserArenaDataIN3WTF6VectorIPNS_12FuncDeclNodeELm0EEEED0Ev
-__ZN3JSC16ArgumentListNodeD0Ev
-__ZN3JSC13ArgumentsNodeD0Ev
-__ZN3JSC23FunctionCallResolveNodeD0Ev
-__ZN3JSC14JSGlobalObject13copyGlobalsToERNS_12RegisterFileE
-__ZN3JSC3JIT14privateCompileEv
-__ZN3JSC3JIT22privateCompileMainPassEv
-__ZN3JSC3JIT13emit_op_enterEPNS_11InstructionE
-__ZN3JSC3JIT16emit_op_new_funcEPNS_11InstructionE
-__ZN3JSC20MacroAssemblerX86_648storePtrENS_22AbstractMacroAssemblerINS_12X86AssemblerEE6ImmPtrENS3_15ImplicitAddressE
-__ZN3JSC11JITStubCall4callEj
-__ZN3WTF6VectorIN3JSC10CallRecordELm0EE14expandCapacityEm
-__ZN3JSC3JIT11emit_op_movEPNS_11InstructionE
-__ZN3JSC3JIT20emit_op_new_func_expEPNS_11InstructionE
-__ZN3JSC3JIT12emit_op_callEPNS_11InstructionE
-__ZN3JSC3JIT13compileOpCallENS_8OpcodeIDEPNS_11InstructionEj
-__ZN3WTF6VectorIN3JSC13SlowCaseEntryELm0EE14expandCapacityEm
-__ZN3JSC3JIT11emit_op_endEPNS_11InstructionE
-__ZN3JSC11JITStubCall4callEv
-__ZN3WTF6VectorIN3JSC9JumpTableELm0EE14shrinkCapacityEm
-__ZN3JSC3JIT23privateCompileSlowCasesEv
-__ZN3JSC3JIT16emitSlow_op_callEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT21compileOpCallSlowCaseEPNS_11InstructionERPNS_13SlowCaseEntryEjNS_8OpcodeIDE
-__ZN3JSC3JIT22compileOpCallSetupArgsEPNS_11InstructionE
-__ZN3JSC9CodeBlock10setJITCodeERNS_10JITCodeRefE
-__ZN3JSC17BytecodeGenerator18dumpsGeneratedCodeEv
-__ZN3WTF10RefCountedIN3JSC14ExecutablePoolEE5derefEv
-_ctiTrampoline
-__ZN3JSC8JITStubs15cti_op_new_funcEPPv
-__ZN3JSC12FuncDeclNode12makeFunctionEPNS_9ExecStateEPNS_14ScopeChainNodeE
-__ZN3JSC8JITStubs19cti_op_new_func_expEPPv
-__ZN3JSC12FuncExprNode12makeFunctionEPNS_9ExecStateEPNS_14ScopeChainNodeE
-__ZN3JSC8JITStubs22cti_op_call_JSFunctionEPPv
-__ZN3JSC16FunctionBodyNode15generateJITCodeEPNS_14ScopeChainNodeE
-__ZN3JSC10IfElseNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator8newLabelEv
-__ZN3JSC15DotAccessorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator11emitResolveEPNS_10RegisterIDERKNS_10IdentifierE
-__ZN3JSC17BytecodeGenerator18findScopedPropertyERKNS_10IdentifierERiRmbRPNS_8JSObjectE
-__ZNK3JSC16JSVariableObject16isVariableObjectEv
-__ZN3JSC17BytecodeGenerator16emitGetScopedVarEPNS_10RegisterIDEmiNS_7JSValueE
-__ZN3JSC17BytecodeGenerator11emitGetByIdEPNS_10RegisterIDES2_RKNS_10IdentifierE
-__ZN3WTF6VectorIN3JSC17StructureStubInfoELm0EE14expandCapacityEm
-__ZN3JSC17BytecodeGenerator11addConstantERKNS_10IdentifierE
-__ZN3WTF7HashMapINS_6RefPtrIN3JSC7UString3RepEEEiNS2_17IdentifierRepHashENS_10HashTraitsIS5_EENS2_17BytecodeGenerator28Identifi
-__ZN3WTF9HashTableINS_6RefPtrIN3JSC7UString3RepEEESt4pairIS5_iENS_18PairFirstExtractorIS7_EENS2_17IdentifierRepHashENS_14PairHa
-__ZN3JSC17BytecodeGenerator15emitJumpIfFalseEPNS_10RegisterIDEPNS_5LabelE
-__ZNK3JSC14JSGlobalObject14isDynamicScopeEv
-__ZN3JSC17BytecodeGenerator19emitResolveFunctionEPNS_10RegisterIDES2_RKNS_10IdentifierE
-__ZN3JSC10StringNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator8emitLoadEPNS_10RegisterIDERKNS_10IdentifierE
-__ZN3WTF9HashTableIPN3JSC7UString3RepESt4pairIS4_PNS1_8JSStringEENS_18PairFirstExtractorIS8_EENS1_17IdentifierRepHashENS_14Pair
-__ZN3JSC11BooleanNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator8emitJumpEPNS_5LabelE
-__ZN3JSC17BytecodeGenerator9emitLabelEPNS_5LabelE
-__ZN3WTF6VectorIjLm0EE15reserveCapacityEm
-__ZN3JSC6IfNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZNK3JSC13StatementNode12isReturnNodeEv
-__ZN3JSC15DotAccessorNodeD0Ev
-__ZN3JSC10StringNodeD0Ev
-__ZN3JSC11BooleanNodeD0Ev
-__ZN3JSC6IfNodeD0Ev
-__ZN3JSC10IfElseNodeD0Ev
-__ZN3JSC3JIT22emit_op_get_global_varEPNS_11InstructionE
-__ZN3JSC3JIT29emitGetVariableObjectRegisterENS_3X8610RegisterIDEiS2_
-__ZN3JSC3JIT17emit_op_get_by_idEPNS_11InstructionE
-__ZN3JSC3JIT21compileGetByIdHotPathEiiPNS_10IdentifierEj
-__ZN3WTF6VectorIN3JSC13SlowCaseEntryELm0EE14expandCapacityEmPKS2_
-__ZN3JSC3JIT14emit_op_jfalseEPNS_11InstructionE
-__ZN3JSC20MacroAssemblerX86_649branchPtrENS_23MacroAssemblerX86Common9ConditionENS_3X8610RegisterIDENS_22AbstractMacroAssembler
-__ZN3JSC20MacroAssemblerX86_649branchPtrENS_23MacroAssemblerX86Common9ConditionENS_3X8610RegisterIDES4_
-__ZN3WTF6VectorIN3JSC9JumpTableELm0EE14expandCapacityEmPKS2_
-__ZN3WTF6VectorIN3JSC9JumpTableELm0EE14expandCapacityEm
-__ZN3JSC3JIT20emit_op_resolve_funcEPNS_11InstructionE
-__ZN3JSC3JIT11emit_op_jmpEPNS_11InstructionE
-__ZN3JSC3JIT11emit_op_retEPNS_11InstructionE
-__ZN3JSC3JIT21emitSlow_op_get_by_idEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT22compileGetByIdSlowCaseEiiPNS_10IdentifierERPNS_13SlowCaseEntryEj
-__ZN3JSC3JIT18emitSlow_op_jfalseEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC23MacroAssemblerX86Common12branchTest32ENS0_9ConditionENS_3X8610RegisterIDENS_22AbstractMacroAssemblerINS_12X86Assemble
-__ZN3JSC8JITStubs23cti_vm_dontLazyLinkCallEPPv
-__ZN3JSC31ctiPatchNearCallByReturnAddressENS_22AbstractMacroAssemblerINS_12X86AssemblerEE22ProcessorReturnAddressEPv
-__ZN3JSC8JITStubs23cti_register_file_checkEPPv
-__ZN3JSC8JITStubs16cti_op_get_by_idEPPv
-__ZNK3JSC7JSValue3getEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC27ctiPatchCallByReturnAddressENS_22AbstractMacroAssemblerINS_12X86AssemblerEE22ProcessorReturnAddressEPv
-__ZN3JSC8JITStubs12cti_op_jtrueEPPv
-__ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
-__ZN3JSC8JITStubs19cti_op_resolve_funcEPPv
-__ZNK3JSC8JSObject12toThisObjectEPNS_9ExecStateE
-__ZNK3JSC8JSString8toStringEPNS_9ExecStateE
-__ZN3JSC8JITStubs23cti_op_get_by_id_secondEPPv
-__ZN3JSC8JITStubs15tryCacheGetByIDEPNS_9ExecStateEPNS_9CodeBlockEPvNS_7JSValueERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSC3JIT26privateCompileGetByIdProtoEPNS_17StructureStubInfoEPNS_9StructureES4_mNS_22AbstractMacroAssemblerINS_12X86Assembl
-__ZN3JSC3JIT22compileGetDirectOffsetEPNS_8JSObjectENS_3X8610RegisterIDES4_m
-__ZN3JSC8JITStubs19cti_vm_lazyLinkCallEPPv
-__ZN3JSC3JIT8linkCallEPNS_10JSFunctionEPNS_9CodeBlockENS_7JITCodeEPNS_12CallLinkInfoEi
-__ZN3JSC8JITStubs10cti_op_endEPPv
-__ZThn16_N3JSC12FuncDeclNodeD0Ev
-__ZN3JSC12FuncDeclNodeD0Ev
-__ZN3WTF25TCMalloc_Central_FreeList11ShrinkCacheEib
-__ZN3JSC10JSFunction18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC10JSFunction11getCallDataERNS_8CallDataE
-__ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE
-__ZN3JSC11Interpreter7executeEPNS_16FunctionBodyNodeEPNS_9ExecStateEPNS_10JSFunctionEPNS_8JSObjectERKNS_7ArgListEPNS_14ScopeCha
-__ZNK3JSC15DotAccessorNode10isLocationEv
-__ZNK3JSC14ExpressionNode13isResolveNodeEv
-__ZNK3JSC14ExpressionNode21isBracketAccessorNodeEv
-__ZN3JSC19FunctionCallDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC19FunctionCallDotNodeD0Ev
-__ZL26appendToVarDeclarationListPvRPN3JSC15ParserArenaDataIN3WTF6VectorISt4pairINS0_10IdentifierEjELm0EEEEERKS5_j
-__ZN3WTF6VectorISt4pairIN3JSC10IdentifierEjELm0EE14expandCapacityEm
-__ZL14makeAssignNodePvPN3JSC14ExpressionNodeENS0_8OperatorES2_bbiii
-__ZL11makeAddNodePvPN3JSC14ExpressionNodeES2_b
-__ZN3JSC16VarStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17AssignResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC11UnaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC10RegExpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC6RegExp6createEPNS_12JSGlobalDataERKNS_7UStringES5_
-__ZN3JSC4Yarr15jitCompileRegexEPNS_12JSGlobalDataERNS0_14RegexCodeBlockERKNS_7UStringERjRPKcbb
-__ZN3JSC4Yarr12compileRegexERKNS_7UStringERNS0_12RegexPatternE
-__ZN3JSC4Yarr18PatternDisjunction17addNewAlternativeEv
-__ZN3WTF6VectorIPN3JSC4Yarr18PatternAlternativeELm0EE14expandCapacityEm
-__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE11parseTokensEv
-__ZN3WTF6VectorIN3JSC4Yarr11PatternTermELm0EE14expandCapacityEmPKS3_
-__ZN3WTF6VectorIN3JSC4Yarr11PatternTermELm0EE14expandCapacityEm
-__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE11parseEscapeILb0ES2_EEbRT0_
-__ZN3JSC4Yarr23RegexPatternConstructor25atomBuiltInCharacterClassENS0_23BuiltInCharacterClassIDEb
-__ZN3JSC4Yarr14wordcharCreateEv
-__ZN3WTF6VectorItLm0EE14expandCapacityEm
-__ZN3WTF6VectorIN3JSC4Yarr14CharacterRangeELm0EE14expandCapacityEmPKS3_
-__ZN3WTF6VectorIN3JSC4Yarr14CharacterRangeELm0EE14expandCapacityEm
-__ZN3WTF6VectorIPN3JSC4Yarr14CharacterClassELm0EE14expandCapacityEmPKS4_
-__ZN3WTF6VectorIPN3JSC4Yarr14CharacterClassELm0EE14expandCapacityEm
-__ZN3JSC4Yarr14RegexGenerator19generateDisjunctionEPNS0_18PatternDisjunctionE
-__ZN3JSC12X86Assembler7addl_irEiNS_3X8610RegisterIDE
-__ZN3JSC23MacroAssemblerX86Common8branch32ENS0_9ConditionENS_3X8610RegisterIDES3_
-__ZN3JSC22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpList6appendENS2_4JumpE
-__ZN3JSC4Yarr14RegexGenerator12generateTermERNS1_19TermGenerationStateE
-__ZN3JSC23MacroAssemblerX86Common8branch32ENS0_9ConditionENS_3X8610RegisterIDENS_22AbstractMacroAssemblerINS_12X86AssemblerEE5I
-__ZN3JSC4Yarr14RegexGenerator19TermGenerationState15jumpToBacktrackENS_22AbstractMacroAssemblerINS_12X86AssemblerEE4JumpEPNS_14
-__ZN3JSC4Yarr14RegexGenerator13readCharacterEiNS_3X8610RegisterIDE
-__ZN3JSC4Yarr14RegexGenerator19matchCharacterClassENS_3X8610RegisterIDERNS_22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpLis
-__ZN3JSC4Yarr14RegexGenerator24matchCharacterClassRangeENS_3X8610RegisterIDERNS_22AbstractMacroAssemblerINS_12X86AssemblerEE8Ju
-__ZN3JSC22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpList4linkEPS2_
-__ZN3JSC23MacroAssemblerX86Common4jumpEv
-__ZN3WTF6VectorIN3JSC22AbstractMacroAssemblerINS1_12X86AssemblerEE4JumpELm16EED1Ev
-__ZN3JSC4Yarr14RegexGenerator28generateCharacterClassGreedyERNS1_19TermGenerationStateE
-__ZN3JSC12X86Assembler7subl_irEiNS_3X8610RegisterIDE
-__ZN3JSC15AssemblerBuffer4growEv
-__ZN3WTF15deleteAllValuesIPN3JSC4Yarr14CharacterClassELm0EEEvRKNS_6VectorIT_XT0_EEE
-__ZN3JSC17BytecodeGenerator13emitNewRegExpEPNS_10RegisterIDEPNS_6RegExpE
-__ZN3JSC15ConditionalNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC9EqualNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZNK3JSC14ExpressionNode6isNullEv
-__ZNK3JSC10StringNode6isPureERNS_17BytecodeGeneratorE
-__ZN3JSC19BracketAccessorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZNK3JSC10NumberNode6isPureERNS_17BytecodeGeneratorE
-__ZN3JSC10NumberNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator8emitLoadEPNS_10RegisterIDEd
-__ZN3JSC17BytecodeGenerator12emitGetByValEPNS_10RegisterIDES2_S2_
-__ZN3JSC17BytecodeGenerator14emitEqualityOpENS_8OpcodeIDEPNS_10RegisterIDES3_S3_
-__ZN3JSC19ReverseBinaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZNK3JSC14ExpressionNode5isAddEv
-__ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh
-__ZN3JSC13AssignDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator11emitPutByIdEPNS_10RegisterIDERKNS_10IdentifierES2_
-__ZN3JSC17AssignResolveNodeD0Ev
-__ZN3JSC15ParserArenaDataIN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEED0Ev
-__ZN3JSC16VarStatementNodeD0Ev
-__ZN3JSC14LogicalNotNodeD0Ev
-__ZN3JSC10RegExpNodeD0Ev
-__ZN3JSC10NumberNodeD0Ev
-__ZN3JSC19BracketAccessorNodeD0Ev
-__ZN3JSC9EqualNodeD0Ev
-__ZN3JSC15ConditionalNodeD0Ev
-__ZN3JSC7AddNodeD0Ev
-__ZN3JSC13GreaterEqNodeD0Ev
-__ZN3JSC13AssignDotNodeD0Ev
-__ZN3JSC3JIT13emit_op_jtrueEPNS_11InstructionE
-__ZN3JSC3JIT18emit_op_new_regexpEPNS_11InstructionE
-__ZN3JSC3JIT18emit_op_get_by_valEPNS_11InstructionE
-__ZN3JSC3JIT10emit_op_eqEPNS_11InstructionE
-__ZN3JSC3JIT11emit_op_addEPNS_11InstructionE
-__ZN3JSC11JITStubCall11addArgumentEjNS_3X8610RegisterIDE
-__ZN3JSC3JIT16emit_op_jnlesseqEPNS_11InstructionE
-__ZN3JSC3JIT17emit_op_put_by_idEPNS_11InstructionE
-__ZN3JSC3JIT21compilePutByIdHotPathEiPNS_10IdentifierEij
-__ZN3JSC3JIT17emitSlow_op_jtrueEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT22emitSlow_op_get_by_valEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT14emitSlow_op_eqEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT20emitSlow_op_jnlesseqEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC20MacroAssemblerX86_6413branchTestPtrENS_23MacroAssemblerX86Common9ConditionENS_3X8610RegisterIDES4_
-__ZN3JSC12X86Assembler23X86InstructionFormatter9twoByteOpENS0_15TwoByteOpcodeIDEiNS_3X8610RegisterIDE
-__ZN3JSC23MacroAssemblerX86Common12branchDoubleENS0_15DoubleConditionENS_3X8613XMMRegisterIDES3_
-__ZN3JSC3JIT21emitSlow_op_put_by_idEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT22compilePutByIdSlowCaseEiPNS_10IdentifierEiRPNS_13SlowCaseEntryEj
-__ZN3JSC13LogicalOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3WTF6VectorIN3JSC17GlobalResolveInfoELm0EE14expandCapacityEm
-__ZN3JSC17BytecodeGenerator14emitJumpIfTrueEPNS_10RegisterIDEPNS_5LabelE
-__ZN3JSC13LogicalOpNodeD0Ev
-__ZN3JSC3JIT22emit_op_resolve_globalEPNS_11InstructionE
-__ZN3JSC8JITStubs21cti_op_resolve_globalEPPv
-__ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE
-__ZN3JSC8JSString18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC15StringPrototype18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSCL20stringProtoFuncMatchEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC8JSString12toThisStringEPNS_9ExecStateE
-__ZNK3JSC6JSCell8isObjectEPKNS_9ClassInfoE
-__ZNK3JSC6JSCell9classInfoEv
-__ZN3JSC4Yarr23RegexPatternConstructor20atomPatternCharacterEt
-__ZN3JSC4Yarr25CharacterClassConstructor7putCharEt
-__ZN3JSC4Yarr25CharacterClassConstructor9addSortedERN3WTF6VectorItLm0EEEt
-__ZN3JSC4Yarr23RegexPatternConstructor21atomCharacterClassEndEv
-__ZN3JSC4Yarr23RegexPatternConstructor23setupDisjunctionOffsetsEPNS0_18PatternDisjunctionEjj
-__ZN3JSC4Yarr14RegexGenerator25generateParenthesesSingleERNS1_19TermGenerationStateE
-__ZN3JSC4Yarr14RegexGenerator30generateParenthesesDisjunctionERNS0_11PatternTermERNS1_19TermGenerationStateEj
-__ZN3WTF6VectorIN3JSC4Yarr14RegexGenerator26AlternativeBacktrackRecordELm0EE14expandCapacityEm
-__ZN3JSC4Yarr14RegexGenerator19jumpIfCharNotEqualsEti
-__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDEiNS_3X8610RegisterIDES4_ii
-__ZN3JSC4Yarr14RegexGenerator19TermGenerationState15jumpToBacktrackERNS_22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpListEP
-__ZN3JSC17RegExpConstructor12performMatchEPNS_6RegExpERKNS_7UStringEiRiS6_PPi
-__ZN3JSC6RegExp5matchERKNS_7UStringEiPN3WTF11OwnArrayPtrIiEE
-__ZN3JSC4Yarr12executeRegexERNS0_14RegexCodeBlockEPKtjjPii
-__ZN3JSC8JITStubs17cti_op_new_regexpEPPv
-__ZN3JSC12RegExpObjectC1EN3WTF10PassRefPtrINS_9StructureEEENS2_INS_6RegExpEEE
-__ZNK3JSC12RegExpObject9classInfoEv
-__ZN3JSC18RegExpMatchesArrayC2EPNS_9ExecStateEPNS_24RegExpConstructorPrivateE
-__ZN3JSC8JITStubs17cti_op_get_by_valEPPv
-__ZN3JSC18RegExpMatchesArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
-__ZN3JSC18RegExpMatchesArray17fillArrayInstanceEPNS_9ExecStateE
-__ZN3JSC11jsSubstringEPNS_12JSGlobalDataERKNS_7UStringEjj
-__ZN3JSC7JSArray3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC8JSObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC7JSArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
-__ZN3JSC8JITStubs9cti_op_eqEPPv
-__ZN3JSCeqERKNS_7UStringES2_
-__ZN3JSC8JITStubs10cti_op_addEPPv
-__ZN3JSC11concatenateEPNS_7UString3RepES2_
-__ZN3JSCL22stringProtoFuncIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC7UString4findERKS0_i
-__ZN3JSC8JITStubs16cti_op_put_by_idEPPv
-__ZNK3JSC7UString8toUInt32EPbb
-__ZNK3JSC7UString8toDoubleEbb
-__ZNK3JSC7UString10getCStringERN3WTF6VectorIcLm32EEE
-__ZN3WTF14FastMallocZone11forceUnlockEP14_malloc_zone_t
-__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
-__ZL30calculateCompiledPatternLengthPKti24JSRegExpIgnoreCaseOptionR11CompileDataR9ErrorCode
-__ZL11checkEscapePPKtS0_P9ErrorCodeib
-__ZL13compileBranchiPiPPhPPKtS3_P9ErrorCodeS_S_R11CompileData
-__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
-__ZL5matchPKtPKhiR9MatchData
-__ZNK3JSC7UString14toStrictUInt32EPb
-__ZN3JSC17ObjectLiteralNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC16PropertyListNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC7TryNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator9emitCatchEPNS_10RegisterIDEPNS_5LabelES4_
-__ZN3WTF6VectorIN3JSC11HandlerInfoELm0EE14expandCapacityEm
-__ZN3JSC17BytecodeGenerator16emitPushNewScopeEPNS_10RegisterIDERNS_10IdentifierES2_
-__ZN3WTF6VectorIN3JSC18ControlFlowContextELm0EE14expandCapacityEm
-__ZNK3JSC14ExpressionNode6isPureERNS_17BytecodeGeneratorE
-__ZN3JSC12PropertyNodeD0Ev
-__ZN3JSC16PropertyListNodeD0Ev
-__ZN3JSC17ObjectLiteralNodeD0Ev
-__ZN3JSC7TryNodeD0Ev
-__ZN3JSC3JIT18emit_op_new_objectEPNS_11InstructionE
-__ZN3JSC3JIT13emit_op_catchEPNS_11InstructionE
-__ZN3JSC3JIT22emit_op_push_new_scopeEPNS_11InstructionE
-__ZN3JSC3JIT15emit_op_resolveEPNS_11InstructionE
-__ZN3JSC3JIT17emit_op_pop_scopeEPNS_11InstructionE
-__ZN3JSC8JITStubs17cti_op_new_objectEPPv
-__ZN3JSC20constructEmptyObjectEPNS_9ExecStateE
-__ZN3JSC17StructureStubInfo5derefEv
-__ZN3WTF9HashTableINS_6RefPtrIN3JSC7UString3RepEEES5_NS_17IdentityExtractorIS5_EENS2_17IdentifierRepHashENS_10HashTraitsIS5_EES
-__ZN3JSC8ThisNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC21ThrowableBinaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC8ThisNodeD0Ev
-__ZN3JSC6InNodeD0Ev
-__ZN3JSC3JIT29emit_op_enter_with_activationEPNS_11InstructionE
-__ZN3JSC3JIT20emit_op_convert_thisEPNS_11InstructionE
-__ZN3JSC3JIT27emit_op_tear_off_activationEPNS_11InstructionE
-__ZN3JSC3JIT24emitSlow_op_convert_thisEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs22cti_op_push_activationEPPv
-__ZN3JSC12JSActivationC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_16FunctionBodyNodeEEE
-__ZN3JSC12JSActivationC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_16FunctionBodyNodeEEE
-__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE11parseEscapeILb1ENS3_28CharacterClassParserDelegateEEEbRT0_
-__ZN3JSC4Yarr12digitsCreateEv
-__ZN3JSC4Yarr25CharacterClassConstructor6appendEPKNS0_14CharacterClassE
-__ZN3JSC4Yarr25CharacterClassConstructor14addSortedRangeERN3WTF6VectorINS0_14CharacterRangeELm0EEEtt
-__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE28CharacterClassParserDelegate20atomPatternCharacterEt
-__ZN3JSC11GreaterNodeD0Ev
-__ZN3JSCL26stringProtoFuncToLowerCaseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JSString14toThisJSStringEPNS_9ExecStateE
-__ZN3JSC7UStringC2EPtib
-__ZN3JSC18globalFuncParseIntEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC11JSImmediate12nonInlineNaNEv
-__ZN3JSC8JITStubs11cti_op_lessEPPv
-__ZN3JSC8JITStubs9cti_op_inEPPv
-__ZNK3JSC6JSCell9getUInt32ERj
-__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZL14makePrefixNodePvPN3JSC14ExpressionNodeENS0_8OperatorEiii
-__ZN3JSC7ForNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator13newLabelScopeENS_10LabelScope4TypeEPKNS_10IdentifierE
-__ZN3JSC12ContinueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator14continueTargetERKNS_10IdentifierE
-__ZN3JSC17BytecodeGenerator14emitJumpScopesEPNS_5LabelEi
-__ZN3JSC17PrefixResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC21ReadModifyResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC11NewExprNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator13emitConstructEPNS_10RegisterIDES2_PNS_13ArgumentsNodeEjjj
-__ZN3WTF6VectorIN3JSC20GetByIdExceptionInfoELm0EE14expandCapacityEm
-__ZN3JSC8LessNodeD0Ev
-__ZN3JSC17PrefixResolveNodeD0Ev
-__ZN3JSC12ContinueNodeD0Ev
-__ZN3JSC7ForNodeD0Ev
-__ZN3JSC21ReadModifyResolveNodeD0Ev
-__ZN3JSC11NewExprNodeD0Ev
-__ZN3JSC3JIT11emit_op_notEPNS_11InstructionE
-__ZN3JSC3JIT15emit_op_pre_incEPNS_11InstructionE
-__ZN3JSC3JIT20emit_op_loop_if_lessEPNS_11InstructionE
-__ZN3JSC3JIT16emitTimeoutCheckEv
-__ZN3JSC3JIT20compileBinaryArithOpENS_8OpcodeIDEjjjNS_12OperandTypesE
-__ZN3JSC3JIT11emit_op_subEPNS_11InstructionE
-__ZN3JSC3JIT17emit_op_constructEPNS_11InstructionE
-__ZN3JSC3JIT24emit_op_construct_verifyEPNS_11InstructionE
-__ZN3JSC3JIT15emitSlow_op_notEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT19emitSlow_op_pre_incEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT24emitSlow_op_loop_if_lessEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT15emitSlow_op_addEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT28compileBinaryArithOpSlowCaseENS_8OpcodeIDERPNS_13SlowCaseEntryEjjjNS_12OperandTypesE
-__ZN3JSC15AssemblerBuffer7putByteEi
-__ZN3JSC12X86Assembler23X86InstructionFormatter11twoByteOp64ENS0_15TwoByteOpcodeIDEiNS_3X8610RegisterIDE
-__ZN3JSC3JIT15emitSlow_op_subEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT21emitSlow_op_constructEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT27compileOpConstructSetupArgsEPNS_11InstructionE
-__ZN3JSC3JIT28emitSlow_op_construct_verifyEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC7UString4fromEj
-__ZN3JSC10Identifier11addSlowCaseEPNS_9ExecStateEPNS_7UString3RepE
-__ZN3JSC8JITStubs10cti_op_notEPPv
-__ZN3JSC8JITStubs24cti_op_get_by_id_genericEPPv
-__ZN3JSC7JSArrayC2EN3WTF10PassRefPtrINS_9StructureEEERKNS_7ArgListE
-__ZN3JSC7JSArray18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSCL24stringProtoFuncSubstringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs31cti_op_construct_NotJSConstructEPPv
-__ZN3JSC3JIT33privateCompilePatchGetArrayLengthENS_22AbstractMacroAssemblerINS_12X86AssemblerEE22ProcessorReturnAddressE
-__ZN3JSC8JITStubs27cti_op_get_by_id_proto_listEPPv
-__ZN3JSC3JIT30privateCompileGetByIdProtoListEPNS_17StructureStubInfoEPNS_30PolymorphicAccessStructureListEiPNS_9StructureES6_mP
-__ZN3JSC3JIT16patchGetByIdSelfEPNS_17StructureStubInfoEPNS_9StructureEmNS_22AbstractMacroAssemblerINS_12X86AssemblerEE22Process
-__ZN3JSC14StructureChainC1EPNS_9StructureE
-__ZN3JSC14StructureChainC2EPNS_9StructureE
-__ZN3JSC3JIT26privateCompileGetByIdChainEPNS_17StructureStubInfoEPNS_9StructureEPNS_14StructureChainEmmNS_22AbstractMacroAssemb
-__ZN3JSC8JITStubs23cti_op_put_by_id_secondEPPv
-__ZN3JSC8JITStubs15tryCachePutByIDEPNS_9ExecStateEPNS_9CodeBlockEPvNS_7JSValueERKNS_15PutPropertySlotE
-__ZN3JSC8JITStubs24cti_op_put_by_id_genericEPPv
-__ZN3JSC8JITStubs26cti_op_tear_off_activationEPPv
-__ZN3JSC8JITStubs21cti_op_ret_scopeChainEPPv
-__ZN3JSC17BytecodeGenerator16emitPutScopedVarEmiPNS_10RegisterIDENS_7JSValueE
-__ZN3JSC3JIT22emit_op_get_scoped_varEPNS_11InstructionE
-__ZN3JSC3JIT22emit_op_put_scoped_varEPNS_11InstructionE
-__ZN3JSC3JIT29emitPutVariableObjectRegisterENS_3X8610RegisterIDES2_i
-__ZN3JSC12X86Assembler7movq_rrENS_3X8610RegisterIDENS1_13XMMRegisterIDE
-__ZN3WTF20TCMalloc_ThreadCache18DestroyThreadCacheEPv
-__ZN3WTF20TCMalloc_ThreadCache11DeleteCacheEPS0_
-__ZN3JSC15StrictEqualNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC15StrictEqualNodeD0Ev
-__ZN3JSC3JIT16emit_op_stricteqEPNS_11InstructionE
-__ZN3JSC3JIT17compileOpStrictEqEPNS_11InstructionENS0_21CompileOpStrictEqTypeE
-__ZN3JSC3JIT20emitSlow_op_stricteqEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs15cti_op_stricteqEPPv
-__ZN3WTF12detachThreadEj
-__ZN3WTFL26pthreadHandleForIdentifierEj
-__ZN3WTFL31clearPthreadHandleForIdentifierEj
-__ZN3WTF6VectorIPNS0_IN3JSC10IdentifierELm64EEELm32EE14expandCapacityEmPKS4_
-__ZN3WTF6VectorIPNS0_IN3JSC10IdentifierELm64EEELm32EE15reserveCapacityEm
-__ZN3JSC8NullNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC8NullNodeD0Ev
-__ZN3WTF7HashMapISt4pairINS_6RefPtrIN3JSC7UString3RepEEEjEPNS3_9StructureENS3_28StructureTransitionTableHashENS3_34StructureTra
-__ZN3WTF9HashTableISt4pairINS_6RefPtrIN3JSC7UString3RepEEEjES1_IS7_PNS3_9StructureEENS_18PairFirstExtractorISA_EENS3_28Structur
-__ZN3JSC9Structure22materializePropertyMapEv
-__ZN3JSC15TypeOfValueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC15TypeOfValueNodeD0Ev
-__ZN3JSC12NotEqualNodeD0Ev
-__ZN3JSC3JIT11emit_op_neqEPNS_11InstructionE
-__ZN3JSC3JIT15emitSlow_op_neqEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs13cti_op_typeofEPPv
-__ZN3JSC20jsTypeStringForValueEPNS_9ExecStateENS_7JSValueE
-__ZN3JSC8JITStubs10cti_op_neqEPPv
-__ZN3JSC14ExecutablePool13systemReleaseERKNS0_10AllocationE
-__ZN3WTF6VectorItLm0EE14expandCapacityEmPKt
-__ZNK3JSC10NumberNode8isNumberEv
-__ZNK3JSC14ExpressionNode10isLocationEv
-__ZN3WTF6VectorIPN3JSC10RegisterIDELm32EE14expandCapacityEm
-__ZNK3JSC11BooleanNode6isPureERNS_17BytecodeGeneratorE
-__ZN3JSC4Yarr13newlineCreateEv
-__ZN3JSC12X86Assembler23X86InstructionFormatter15emitRexIfNeededEiii
-__ZN3JSC12X86Assembler23X86InstructionFormatter11memoryModRMEiNS_3X8610RegisterIDES3_ii
-__ZN3JSC17TypeOfResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator15emitResolveBaseEPNS_10RegisterIDERKNS_10IdentifierE
-__ZN3JSC17BytecodeGenerator20emitLoadGlobalObjectEPNS_10RegisterIDEPNS_8JSObjectE
-__ZN3WTF6VectorIN3JSC7JSValueELm0EE14expandCapacityEm
-__ZNK3JSC7AddNode5isAddEv
-__ZN3JSC12BinaryOpNode10emitStrcatERNS_17BytecodeGeneratorEPNS_10RegisterIDES4_PNS_21ReadModifyResolveNodeE
-__ZNK3JSC10StringNode8isStringEv
-__ZNK3JSC14ExpressionNode8isStringEv
-__ZN3JSC17BytecodeGenerator10emitStrcatEPNS_10RegisterIDES2_i
-__ZN3JSC4Yarr12spacesCreateEv
-__ZN3JSC4Yarr15nonspacesCreateEv
-__ZN3JSC8WithNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator13emitPushScopeEPNS_10RegisterIDE
-__ZN3JSC23MacroAssemblerX86Common4moveENS_22AbstractMacroAssemblerINS_12X86AssemblerEE5Imm32ENS_3X8610RegisterIDE
-__ZN3JSC14MacroAssembler4peekENS_3X8610RegisterIDEi
-__ZN3JSC4Yarr14RegexGenerator12atEndOfInputEv
-__ZN3JSC22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpList6linkToENS2_5LabelEPS2_
-__ZN3JSC14MacroAssembler4pokeENS_3X8610RegisterIDEi
-__ZN3JSC21FunctionCallValueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC9ArrayNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator12emitNewArrayEPNS_10RegisterIDEPNS_11ElementNodeE
-__ZN3JSC23CallFunctionCallDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator25emitJumpIfNotFunctionCallEPNS_10RegisterIDEPNS_5LabelE
-__ZN3JSC4Yarr14RegexGenerator29generateAssertionWordBoundaryERNS1_19TermGenerationStateE
-__ZN3JSC4Yarr14RegexGenerator22matchAssertionWordcharERNS1_19TermGenerationStateERNS_22AbstractMacroAssemblerINS_12X86Assembler
-__ZN3WTF6VectorIPN3JSC4Yarr18PatternDisjunctionELm4EE14expandCapacityEm
-__ZL14compileBracketiPiPPhPPKtS3_P9ErrorCodeiS_S_R11CompileData
-__ZN3JSC9ThrowNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC9CommaNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3WTF9HashTableIdSt4pairIdN3JSC7JSValueEENS_18PairFirstExtractorIS4_EENS_9FloatHashIdEENS_14PairHashTraitsINS_10HashTraitsId
-__ZN3JSC17TypeOfResolveNodeD0Ev
-__ZN3JSC18NotStrictEqualNodeD0Ev
-__ZN3JSC8WithNodeD0Ev
-__ZN3JSC21FunctionCallValueNodeD0Ev
-__ZN3JSC9ArrayNodeD0Ev
-__ZN3JSC11ElementNodeD0Ev
-__ZN3JSC23CallFunctionCallDotNodeD0Ev
-__ZN3JSC9ThrowNodeD0Ev
-__ZN3JSC9CommaNodeD0Ev
-__ZN3JSC3JIT23emit_op_unexpected_loadEPNS_11InstructionE
-__ZN3JSC3JIT20emit_op_to_primitiveEPNS_11InstructionE
-__ZN3JSC3JIT14emit_op_strcatEPNS_11InstructionE
-__ZN3JSC3JIT17emit_op_nstricteqEPNS_11InstructionE
-__ZN3JSC3JIT18emit_op_push_scopeEPNS_11InstructionE
-__ZN3JSC3JIT17emit_op_new_arrayEPNS_11InstructionE
-__ZN3JSC3JIT16emit_op_jneq_ptrEPNS_11InstructionE
-__ZN3JSC3JIT13emit_op_throwEPNS_11InstructionE
-__ZN3JSC3JIT14emit_op_jnlessEPNS_11InstructionE
-__ZN3JSC3JIT24emitSlow_op_to_primitiveEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT21emitSlow_op_nstricteqEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT18emitSlow_op_jnlessEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZL15makePostfixNodePvPN3JSC14ExpressionNodeENS0_8OperatorEiii
-__ZN3JSC18PostfixResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC18PostfixResolveNodeD0Ev
-__ZN3JSC8JITStubs22cti_op_call_arityCheckEPPv
-__ZN3JSC19FunctionConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL32constructWithFunctionConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
-__ZN3JSCplERKNS_7UStringES2_
-__ZN3JSC7UString6appendERKS0_
-__ZN3JSC7UString17expandPreCapacityEi
-__ZN3WTF11fastReallocILb0EEEPvS1_m
-__ZN3JSC14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZL11makeDivNodePvPN3JSC14ExpressionNodeES2_b
-__ZL12makeMultNodePvPN3JSC14ExpressionNodeES2_b
-__ZN3JSC9WhileNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC7ModNodeD0Ev
-__ZN3JSC7DivNodeD0Ev
-__ZN3JSC8MultNodeD0Ev
-__ZN3JSC9WhileNodeD0Ev
-__ZN3JSC3JIT11emit_op_modEPNS_11InstructionE
-__ZN3JSC3JIT11emit_op_mulEPNS_11InstructionE
-__ZN3JSC3JIT20emit_op_loop_if_trueEPNS_11InstructionE
-__ZN3JSC3JIT15emitSlow_op_modEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT15emitSlow_op_mulEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT24emitSlow_op_loop_if_trueEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSCL26stringProtoFuncLastIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC7JSValue20toIntegerPreserveNaNEPNS_9ExecStateE
-__ZN3JSC8JITStubs10cti_op_divEPPv
-__ZN3JSC3JIT22emit_op_loop_if_lesseqEPNS_11InstructionE
-__ZN3JSC3JIT26emitSlow_op_loop_if_lesseqEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs13cti_op_lesseqEPPv
-__ZN3JSCL20stringProtoFuncSplitEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC19constructEmptyArrayEPNS_9ExecStateE
-__ZN3JSC7JSArray3putEPNS_9ExecStateEjNS_7JSValueE
-__ZN3JSC7JSArray11putSlowCaseEPNS_9ExecStateEjNS_7JSValueE
-__ZN3JSC14ArrayPrototype18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSCL18arrayProtoFuncJoinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF7HashSetIPN3JSC8JSObjectENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
-__ZN3WTF9HashTableIPN3JSC8JSObjectES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
-__ZN3WTF6VectorItLm256EE6appendItEEvPKT_m
-__ZN3WTF6VectorItLm256EE14expandCapacityEm
-__ZN3WTF6VectorIPN3JSC12CallLinkInfoELm0EE15reserveCapacityEm
-__ZN3JSC4Heap7collectEv
-__ZN3JSC4Heap30markStackObjectsConservativelyEv
-__ZN3JSC4Heap31markCurrentThreadConservativelyEv
-__ZN3JSC4Heap39markCurrentThreadConservativelyInternalEv
-__ZN3JSC4Heap18markConservativelyEPvS1_
-__ZN3JSC7JSArray4markEv
-__ZN3JSC8JSObject4markEv
-__ZN3JSC10JSFunction4markEv
-__ZN3JSC6JSCell4markEv
-__ZN3JSC14JSGlobalObject4markEv
-__ZN3JSC15JSWrapperObject4markEv
-__ZN3JSC18GlobalEvalFunction4markEv
-__ZN3JSC16FunctionBodyNode4markEv
-__ZN3JSC9CodeBlock4markEv
-__ZN3JSC4Heap20markProtectedObjectsEv
-__ZN3JSC12SmallStrings4markEv
-__ZN3JSC4Heap5sweepILNS_8HeapTypeE0EEEmv
-__ZN3JSC14JSGlobalObjectD2Ev
-__ZN3JSC17FunctionPrototypeD1Ev
-__ZN3JSC15ObjectPrototypeD1Ev
-__ZN3JSC14ArrayPrototypeD1Ev
-__ZN3JSC15StringPrototypeD1Ev
-__ZN3JSC16BooleanPrototypeD1Ev
-__ZN3JSC15NumberPrototypeD1Ev
-__ZN3JSC13DatePrototypeD1Ev
-__ZN3JSC12DateInstanceD2Ev
-__ZN3JSC15RegExpPrototypeD1Ev
-__ZN3JSC14ErrorPrototypeD1Ev
-__ZN3JSC20NativeErrorPrototypeD1Ev
-__ZN3JSC17ObjectConstructorD1Ev
-__ZN3JSC19FunctionConstructorD1Ev
-__ZN3JSC16ArrayConstructorD1Ev
-__ZN3JSC17StringConstructorD1Ev
-__ZN3JSC18BooleanConstructorD1Ev
-__ZN3JSC17NumberConstructorD1Ev
-__ZN3JSC15DateConstructorD1Ev
-__ZN3JSC17RegExpConstructorD1Ev
-__ZN3JSC16ErrorConstructorD1Ev
-__ZN3JSC22NativeErrorConstructorD1Ev
-__ZN3JSC10MathObjectD1Ev
-__ZN3JSC18GlobalEvalFunctionD1Ev
-__ZN3JSC8JSObjectD1Ev
-__ZN3JSC9CodeBlock13unlinkCallersEv
-__ZN3WTF6VectorINS_6RefPtrIN3JSC6RegExpEEELm0EE6shrinkEm
-__ZN3JSC12JSActivationD1Ev
-__ZN3JSC12JSActivationD2Ev
-__ZN3JSC12RegExpObjectD1Ev
-__ZN3JSC18RegExpMatchesArrayD1Ev
-__ZN3JSC4Heap5sweepILNS_8HeapTypeE1EEEmv
-__ZN3JSC20globalFuncParseFloatEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF17TCMalloc_PageHeap3NewEm
-__ZN3JSC8JITStubs28cti_op_construct_JSConstructEPPv
-__ZN3JSC8JSObject17createInheritorIDEv
-__ZNK3JSC19BracketAccessorNode10isLocationEv
-__ZNK3JSC19BracketAccessorNode21isBracketAccessorNodeEv
-__ZN3JSC17AssignBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator12emitPutByValEPNS_10RegisterIDES2_S2_
-__ZN3JSC14PostfixDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17ReadModifyDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17AssignBracketNodeD0Ev
-__ZN3JSC14PostfixDotNodeD0Ev
-__ZN3JSC17ReadModifyDotNodeD0Ev
-__ZN3JSC3JIT18emit_op_put_by_valEPNS_11InstructionE
-__ZN3JSC3JIT22emitSlow_op_put_by_valEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC16ArrayConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL29constructWithArrayConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSCL27constructArrayWithSizeQuirkEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSC8JITStubs23cti_op_put_by_val_arrayEPPv
-__ZN3JSC8JITStubs13cti_op_strcatEPPv
-__ZN3JSC7UString3Rep15reserveCapacityEi
-__ZN3JSC7UString13appendNumericEi
-__ZN3JSC11concatenateEPNS_7UString3RepEi
-__ZN3JSC12JSActivation18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSCL18stringFromCharCodeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC16globalFuncEscapeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL26stringProtoFuncToUpperCaseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC12JSActivation14isDynamicScopeEv
-__ZN3WTF6VectorINS_6RefPtrIN3JSC10RegisterIDEEELm16EE14expandCapacityEm
-__ZN3JSC17ObjectConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL30constructWithObjectConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC8JITStubs17cti_op_put_by_valEPPv
-__ZN3JSC15DateConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL28constructWithDateConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC13constructDateEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSC8JITStubs18cti_op_is_functionEPPv
-__ZN3JSC16jsIsFunctionTypeENS_7JSValueE
-__ZN3JSC10Identifier5equalEPKNS_7UString3RepEPKc
-__ZN3JSC11JSImmediate8toStringENS_7JSValueE
-__ZN3JSC7UString4fromEi
-__ZN3JSC7UString3Rep11computeHashEPKti
-__ZNK3JSC8NullNode6isNullEv
-__ZN3JSC9BreakNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator11breakTargetERKNS_10IdentifierE
-__ZN3JSC9BreakNodeD0Ev
-__ZN3JSC3JIT15emit_op_eq_nullEPNS_11InstructionE
-__ZN3JSC8JITStubs19cti_op_is_undefinedEPPv
-__ZN3JSC12JSActivation4markEv
-__ZN3JSC12DateInstanceD1Ev
-__ZNK3JSC18EmptyStatementNode16isEmptyStatementEv
-__ZN3JSC18EmptyStatementNodeD0Ev
-__ZN3JSC3JIT15emit_op_pre_decEPNS_11InstructionE
-__ZN3JSC3JIT19emitSlow_op_pre_decEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3WTF13tryFastMallocEm
-__ZN3JSC8JITStubs17cti_timeout_checkEPPv
-__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE
-__ZN3JSC8JITStubs14cti_op_pre_decEPPv
-__ZN3JSC13jsAddSlowCaseEPNS_9ExecStateENS_7JSValueES2_
-__ZNK3JSC8JSString11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
-__ZNK3JSC8JSObject11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
-__ZNK3JSC8JSObject12defaultValueEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
-__ZN3JSCL22objectProtoFuncValueOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL25functionProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC10JSFunction9classInfoEv
-__ZNK3JSC21UStringSourceProvider8getRangeEii
-__ZNK3JSC7UString6substrEii
-__ZN3JSC8JITStubs26cti_op_get_by_id_self_failEPPv
-__ZN3JSC3JIT29privateCompileGetByIdSelfListEPNS_17StructureStubInfoEPNS_30PolymorphicAccessStructureListEiPNS_9StructureEm
-__ZN3JSC8JITStubs16cti_op_nstricteqEPPv
-__ZN3JSC9ForInNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator20emitNextPropertyNameEPNS_10RegisterIDES2_PNS_5LabelE
-__ZN3JSC9ForInNodeD0Ev
-__ZN3JSC3JIT18emit_op_next_pnameEPNS_11InstructionE
-__ZN3JSC8JITStubs17cti_op_get_pnamesEPPv
-__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
-__ZN3JSC9Structure26getEnumerablePropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayEPNS_8JSObjectE
-__ZN3JSC9Structure35getEnumerableNamesFromPropertyTableERNS_17PropertyNameArrayE
-__ZN3JSC8JITStubs17cti_op_next_pnameEPPv
-__ZN3JSC13jsOwnedStringEPNS_12JSGlobalDataERKNS_7UStringE
-__ZN3JSC22JSPropertyNameIterator10invalidateEv
-__ZN3JSC3JIT22emit_op_init_argumentsEPNS_11InstructionE
-__ZN3JSC3JIT24emit_op_create_argumentsEPNS_11InstructionE
-__ZN3JSC8JITStubs33cti_op_create_arguments_no_paramsEPPv
-__ZN3JSC9Arguments18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC3JIT16emit_op_post_decEPNS_11InstructionE
-__ZN3JSC3JIT20emitSlow_op_post_decEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs15cti_op_post_decEPPv
-__ZN3JSC9Arguments18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
-__ZN3JSC17RegExpConstructor18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC17RegExpConstructor3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC6JSCell11getCallDataERNS_8CallDataE
-__ZN3JSC10JSFunction3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC8JITStubs16cti_op_new_arrayEPPv
-__ZN3JSC14constructArrayEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSCL18arrayProtoFuncPushEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL30comparePropertyMapEntryIndicesEPKvS1_
-__ZN3WTF6VectorIN3JSC10IdentifierELm20EE15reserveCapacityEm
-__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC8JITStubs17cti_op_push_scopeEPPv
-__ZN3JSC8JITStubs14cti_op_resolveEPPv
-__ZN3JSC8JITStubs16cti_op_pop_scopeEPPv
-__ZN3JSC3JIT31privateCompilePutByIdTransitionEPNS_17StructureStubInfoEPNS_9StructureES4_mPNS_14StructureChainENS_22AbstractMacr
-__ZN3JSC20MacroAssemblerX86_649branchPtrENS_23MacroAssemblerX86Common9ConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE
-__ZN3JSC3JIT19patchPutByIdReplaceEPNS_17StructureStubInfoEPNS_9StructureEmNS_22AbstractMacroAssemblerINS_12X86AssemblerEE22Proc
-__ZN3JSC17NumberConstructor18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC8JITStubs16cti_op_is_stringEPPv
-__ZN3JSC8JITStubs19cti_op_convert_thisEPPv
-__ZNK3JSC8JSString12toThisObjectEPNS_9ExecStateE
-__ZN3JSCL22stringProtoFuncReplaceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC12StringObject14toThisJSStringEPNS_9ExecStateE
-__ZN3JSCL21arrayProtoFuncForEachEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC11Interpreter20prepareForRepeatCallEPNS_16FunctionBodyNodeEPNS_9ExecStateEPNS_10JSFunctionEiPNS_14ScopeChainNodeEPNS_7J
-__ZN3JSC3JIT16emit_op_post_incEPNS_11InstructionE
-__ZN3JSC3JIT20emitSlow_op_post_incEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC11Interpreter7executeERNS_16CallFrameClosureEPNS_7JSValueE
-__ZN3JSC10MathObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC11Interpreter13endRepeatCallERNS_16CallFrameClosureE
-__ZN3JSCL21resizePropertyStorageEPNS_8JSObjectEii
-__ZN3JSC8JSObject23allocatePropertyStorageEmm
-__ZN3JSC14ExecutablePool12poolAllocateEm
-__ZN3JSC9Arguments4markEv
-__ZN3JSC22JSPropertyNameIterator4markEv
-__ZN3JSC3JIT10unlinkCallEPNS_12CallLinkInfoE
-__ZN3JSC22JSPropertyNameIteratorD1Ev
-__ZN3JSC9ArgumentsD1Ev
-__ZN3JSC9ArgumentsD2Ev
-__ZN3JSC12StringObjectD1Ev
-__ZN3WTF6VectorIPN3JSC9StructureELm8EE14expandCapacityEmPKS3_
-__ZN3WTF6VectorIPN3JSC9StructureELm8EE15reserveCapacityEm
-__ZN3JSCL19arrayProtoFuncShiftEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL11getPropertyEPNS_9ExecStateEPNS_8JSObjectEj
-__ZN3JSC7JSArray14deletePropertyEPNS_9ExecStateEj
-__ZN3JSC7JSArray9setLengthEj
-__ZN3JSC7UString6appendEPKc
-__ZN3JSC8JITStubs23cti_op_create_argumentsEPPv
-__ZN3JSCL19arrayProtoFuncSliceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE
-__ZN3JSC24ApplyFunctionCallDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZNK3JSC14ExpressionNode13isSimpleArrayEv
-__ZN3JSC17BytecodeGenerator26emitJumpIfNotFunctionApplyEPNS_10RegisterIDEPNS_5LabelE
-__ZN3JSC17BytecodeGenerator15emitCallVarargsEPNS_10RegisterIDES2_S2_S2_jjj
-__ZN3JSC24ApplyFunctionCallDotNodeD0Ev
-__ZN3JSC3JIT20emit_op_load_varargsEPNS_11InstructionE
-__ZN3JSC3JIT20emit_op_call_varargsEPNS_11InstructionE
-__ZN3JSC3JIT20compileOpCallVarargsEPNS_11InstructionE
-__ZN3JSC3JIT29compileOpCallVarargsSetupArgsEPNS_11InstructionE
-__ZN3JSC3JIT24emitSlow_op_call_varargsEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC3JIT28compileOpCallVarargsSlowCaseEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs19cti_op_load_varargsEPPv
-__ZNK3JSC7JSArray9classInfoEv
-__ZN3JSC7JSArray15copyToRegistersEPNS_9ExecStateEPNS_8RegisterEj
-__ZNK3JSC7UString30spliceSubstringsWithSeparatorsEPKNS0_5RangeEiPKS0_i
-__ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
-__ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC7UString4fromEd
-__ZN3WTF4dtoaEPcdiPiS1_PS0_
-__ZN3JSC8JITStubs21cti_op_put_by_id_failEPPv
-__ZN3JSC13DeleteDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator14emitDeleteByIdEPNS_10RegisterIDES2_RKNS_10IdentifierE
-__ZN3JSC13DeleteDotNodeD0Ev
-__ZN3JSC3JIT17emit_op_del_by_idEPNS_11InstructionE
-__ZN3JSC8JITStubs16cti_op_del_by_idEPPv
-__ZN3JSC10JSFunction14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZNK3JSC7ArgList8getSliceEiRS0_
-__ZN3JSC3JIT26emit_op_tear_off_argumentsEPNS_11InstructionE
-__ZN3JSC8JITStubs25cti_op_tear_off_argumentsEPPv
-__ZNK3JSC12StringObject12toThisStringEPNS_9ExecStateE
-__ZN3JSC13PrefixDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC13PrefixDotNodeD0Ev
-__ZNK3JSC8JSObject8toStringEPNS_9ExecStateE
-__ZN3JSCL22arrayProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL21arrayProtoFuncIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC16ErrorConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL29constructWithErrorConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC14constructErrorEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSCL21stringProtoFuncCharAtEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs32cti_op_get_by_id_proto_list_fullEPPv
-__ZN3JSC14InstanceOfNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator14emitInstanceOfEPNS_10RegisterIDES2_S2_S2_
-__ZN3JSC14InstanceOfNodeD0Ev
-__ZN3JSC3JIT18emit_op_instanceofEPNS_11InstructionE
-__ZN3JSC3JIT22emitSlow_op_instanceofEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC12X86Assembler6orl_irEiNS_3X8610RegisterIDE
-__ZN3JSC17RegExpConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL30constructWithRegExpConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC15constructRegExpEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSC13DatePrototype18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSCL20dateProtoFuncGetTimeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC12DateInstance9classInfoEv
-__ZN3JSC12RegExpObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSCL19regExpProtoFuncTestEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC12RegExpObject5matchEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSC3JIT18emit_op_jmp_scopesEPNS_11InstructionE
-__ZN3JSC3JIT30privateCompileGetByIdChainListEPNS_17StructureStubInfoEPNS_30PolymorphicAccessStructureListEiPNS_9StructureEPNS_1
-__ZN3JSC18globalFuncUnescapeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC7UString6appendEt
-__ZN3JSC8JSObject3putEPNS_9ExecStateEjNS_7JSValueE
-__ZN3JSC17PropertyNameArray3addEPNS_7UString3RepE
-__ZN3WTF7HashSetIPN3JSC7UString3RepENS_7PtrHashIS4_EENS_10HashTraitsIS4_EEE3addERKS4_
-__ZN3WTF9HashTableIPN3JSC7UString3RepES4_NS_17IdentityExtractorIS4_EENS_7PtrHashIS4_EENS_10HashTraitsIS4_EESA_E6rehashEi
-__ZN3WTF6VectorIN3JSC10IdentifierELm20EE14expandCapacityEm
-__ZN3JSCL20arrayProtoFuncConcatEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC9ArrayNode13isSimpleArrayEv
-__ZN3JSC8JITStubs10cti_op_mulEPPv
-__ZN3JSC8JITStubs16cti_op_is_objectEPPv
-__ZN3JSC14jsIsObjectTypeENS_7JSValueE
-__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
-__ZN3JSC9CodeBlock34reparseForExceptionInfoIfNecessaryEPNS_9ExecStateE
-__ZNK3JSC10ScopeChain10localDepthEv
-__ZNK3JSC12JSActivation9classInfoEv
-__ZN3JSC6Parser7reparseINS_16FunctionBodyNodeEEEN3WTF10PassRefPtrIT_EEPNS_12JSGlobalDataEPS5_
-__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IP
-__ZN3JSC13StatementNode6setLocEii
-__ZN3JSC16FunctionBodyNode14copyParametersEv
-__ZN3JSC16FunctionBodyNode13finishParsingEPNS_10IdentifierEm
-__ZN3JSC16FunctionBodyNode31bytecodeForExceptionInfoReparseEPNS_14ScopeChainNodeEPNS_9CodeBlockE
-__ZN3JSC9CodeBlock36hasGlobalResolveInfoAtBytecodeOffsetEj
-__ZN3JSC9CodeBlock27lineNumberForBytecodeOffsetEPNS_9ExecStateEj
-__ZN3WTF6VectorIPvLm0EE14expandCapacityEmPKS1_
-__ZN3WTF6VectorIPvLm0EE15reserveCapacityEm
-__ZN3JSC3JIT16emit_op_jeq_nullEPNS_11InstructionE
-__ZN3JSC8JITStubs16cti_op_is_numberEPPv
-__ZN3JSCL23stringProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC12StringObject9classInfoEv
-__ZN3JSC8JITStubs28cti_op_get_by_id_string_failEPPv
-__ZN3JSC11JSImmediate9prototypeENS_7JSValueEPNS_9ExecStateE
-__ZN3JSCL23numberProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC3JIT16emit_op_neq_nullEPNS_11InstructionE
-__ZN3JSC4Yarr23RegexPatternConstructor8copyTermERNS0_11PatternTermE
-__ZL17bracketIsAnchoredPKh
-__ZL32branchFindFirstAssertedCharacterPKhb
-__ZL20branchNeedsLineStartPKhjj
-__ZN3JSC18RegExpMatchesArray18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSCL20stringProtoFuncSliceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC3JIT17emit_op_jneq_nullEPNS_11InstructionE
-__ZN3JSC8JITStubs25cti_op_call_NotJSFunctionEPPv
-__ZN3JSC17StringConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL21callStringConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC12StringObject8toStringEPNS_9ExecStateE
-__ZN3JSC23FunctionCallBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC20EvalFunctionCallNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator19emitResolveWithBaseEPNS_10RegisterIDES2_RKNS_10IdentifierE
-__ZN3JSC23FunctionCallBracketNodeD0Ev
-__ZN3JSC20EvalFunctionCallNodeD0Ev
-__ZN3JSC3JIT25emit_op_resolve_with_baseEPNS_11InstructionE
-__ZN3JSC3JIT17emit_op_call_evalEPNS_11InstructionE
-__ZN3JSC3JIT21emitSlow_op_call_evalEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC14MacroAssembler4jumpENS_22AbstractMacroAssemblerINS_12X86AssemblerEE5LabelE
-__ZN3JSCL19regExpProtoFuncExecEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC7UString12replaceRangeEiiRKS0_
-__ZN3JSC8JITStubs17cti_op_is_booleanEPPv
-__ZN3JSC3JIT22emit_op_put_global_varEPNS_11InstructionE
-__ZN3JSCL23regExpProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL18regExpObjectSourceEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL18regExpObjectGlobalEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL22regExpObjectIgnoreCaseEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL21regExpObjectMultilineEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSC4Yarr14RegexGenerator30generatePatternCharacterGreedyERNS1_19TermGenerationStateE
-__ZN3JSC8JITStubs27cti_op_get_by_id_proto_failEPPv
-__ZN3JSC17DeleteResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17DeleteResolveNodeD0Ev
-__ZN3JSC3JIT20emit_op_resolve_baseEPNS_11InstructionE
-__ZN3JSC8JITStubs19cti_op_resolve_baseEPPv
-__ZN3JSC12JSActivation14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZNK3JSC8JSString8toNumberEPNS_9ExecStateE
-__ZN3JSC8JITStubs24cti_op_resolve_with_baseEPPv
-__ZN3JSC8JITStubs16cti_op_call_evalEPPv
-__ZN3JSC11Interpreter8callEvalEPNS_9ExecStateEPNS_12RegisterFileEPNS_8RegisterEiiRNS_7JSValueE
-__ZN3JSC13LiteralParser5Lexer3lexERNS1_18LiteralParserTokenE
-__ZN3JSC13LiteralParser14parseStatementEv
-__ZN3JSC13LiteralParser15parseExpressionEv
-__ZN3JSC13LiteralParser10parseArrayEv
-__ZN3JSC13LiteralParser11parseObjectEv
-__ZN3JSC10Identifier3addEPNS_9ExecStateEPKti
-__ZN3JSC7JSArray4pushEPNS_9ExecStateENS_7JSValueE
-__ZN3JSCL19mathProtoFuncRandomEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF16weakRandomNumberEv
-__ZN3JSCL18mathProtoFuncFloorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC4Heap15recordExtraCostEm
-__ZN3JSC6Parser5parseINS_8EvalNodeEEEN3WTF10PassRefPtrIT_EEPNS_9ExecStateEPNS_8DebuggerERKNS_10SourceCodeEPiPNS_7UStringE
-__ZN3JSC9ExecState9thisValueEv
-__ZN3JSC11Interpreter7executeEPNS_8EvalNodeEPNS_9ExecStateEPNS_8JSObjectEiPNS_14ScopeChainNodeEPNS_7JSValueE
-__ZN3JSC8EvalNode16generateBytecodeEPNS_14ScopeChainNodeE
-__ZN3JSC17BytecodeGeneratorC2EPNS_8EvalNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrINS_7UString3RepEEENS_16
-__ZN3JSC8EvalNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZThn16_N3JSC8EvalNodeD0Ev
-__ZN3JSC8EvalNodeD0Ev
-__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC8JSObject9classNameEv
-__ZN3JSC11JSImmediate12toThisObjectENS_7JSValueEPNS_9ExecStateE
-__ZNK3JSC6JSCell17getTruncatedInt32ERi
-__ZN3JSC15toInt32SlowCaseEdRb
-__ZN3JSCL20dateProtoFuncSetYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC12DateInstance21msToGregorianDateTimeEdbRNS_17GregorianDateTimeE
-__ZN3JSC21msToGregorianDateTimeEdbRNS_17GregorianDateTimeE
-__ZN3JSCL12getDSTOffsetEdd
-__ZN3JSC21gregorianDateTimeToMSERKNS_17GregorianDateTimeEdb
-__ZN3JSCL15dateToDayInYearEiii
-__ZN3JSC8JITStubs19cti_op_to_primitiveEPPv
-__ZN3JSCL21dateProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC10formatTimeERKNS_17GregorianDateTimeEb
-__ZN3JSCL24dateProtoFuncToGMTStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC7UString13appendNumericEd
-__ZN3JSC11concatenateEPNS_7UString3RepEd
-__ZN3JSCL20dateProtoFuncGetYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL20dateProtoFuncGetDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL21dateProtoFuncGetMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL21dateProtoFuncGetHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23dateProtoFuncGetMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23dateProtoFuncGetSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL19dateProtoFuncGetDayEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL30dateProtoFuncGetTimezoneOffsetEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC28createUndefinedVariableErrorEPNS_9ExecStateERKNS_10IdentifierEjPNS_9CodeBlockE
-__ZN3JSC9CodeBlock32expressionRangeForBytecodeOffsetEPNS_9ExecStateEjRiS3_S3_
-__ZN3JSC5Error6createEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringEilS6_
-__ZN3JSC22NativeErrorConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL35constructWithNativeErrorConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC22NativeErrorConstructor9constructEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
-__ZN3JSCL23returnToThrowTrampolineEPNS_12JSGlobalDataEPvRS2_
-_ctiVMThrowTrampoline
-__ZN3JSC8JITStubs12cti_vm_throwEPPv
-__ZN3JSC11Interpreter14throwExceptionERPNS_9ExecStateERNS_7JSValueEjb
-__ZNK3JSC8JSObject22isNotAnObjectErrorStubEv
-__ZNK3JSC8JSObject19isWatchdogExceptionEv
-__ZN3JSC9CodeBlock24handlerForBytecodeOffsetEj
-__ZN3JSC8JITStubs21cti_op_push_new_scopeEPPv
-__ZN3WTF6VectorIN3JSC22AbstractMacroAssemblerINS1_12X86AssemblerEE4JumpELm16EE14expandCapacityEm
-__ZN3JSCL20dateProtoFuncSetTimeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3WTF7HashMapINS_6RefPtrIN3JSC7UString3RepEEENS1_INS2_8EvalNodeEEENS_7StrHashIS5_EENS_10HashTraitsIS5_EENSA_IS7_EEE3getEPS4
-__ZN3WTF7HashMapINS_6RefPtrIN3JSC7UString3RepEEENS1_INS2_8EvalNodeEEENS_7StrHashIS5_EENS_10HashTraitsIS5_EENSA_IS7_EEE3setEPS4_
-__ZN3WTF9HashTableINS_6RefPtrIN3JSC7UString3RepEEESt4pairIS5_NS1_INS2_8EvalNodeEEEENS_18PairFirstExtractorIS9_EENS_7StrHashIS5_
-__ZN3JSC10LessEqNodeD0Ev
-__ZN3JSC8JITStubs14cti_op_jlesseqEPPv
-__ZN3JSC8JSString18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
-__ZL18makeRightShiftNodePvPN3JSC14ExpressionNodeES2_b
-__ZN3JSC14RightShiftNodeD0Ev
-__ZN3JSC3JIT14emit_op_rshiftEPNS_11InstructionE
-__ZN3JSC3JIT18emitSlow_op_rshiftEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC18PostfixBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC18PostfixBracketNodeD0Ev
-__ZN3JSC21ReadModifyBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC21ReadModifyBracketNodeD0Ev
-__ZN3JSC11Interpreter15unwindCallFrameERPNS_9ExecStateENS_7JSValueERjRPNS_9CodeBlockE
-__ZN3JSCL22errorProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF23waitForThreadCompletionEjPPv
-__ZN3WTF15ThreadConditionD1Ev
-__ZN3JSC9Structure24removePropertyTransitionEPS0_RKNS_10IdentifierERm
-__ZN3JSC12JSActivation3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC26createNotAnObjectErrorStubEPNS_9ExecStateEb
-__ZN3JSC13JSNotAnObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZNK3JSC22JSNotAnObjectErrorStub22isNotAnObjectErrorStubEv
-__ZN3JSC22createNotAnObjectErrorEPNS_9ExecStateEPNS_22JSNotAnObjectErrorStubEjPNS_9CodeBlockE
-__ZN3JSC9CodeBlock37getByIdExceptionInfoForBytecodeOffsetEPNS_9ExecStateEjRNS_8OpcodeIDE
-__ZN3JSCL18createErrorMessageEPNS_9ExecStateEPNS_9CodeBlockEiiiNS_7JSValueENS_7UStringE
-__ZN3JSC13ErrorInstanceD1Ev
-__ZN3JSC22JSNotAnObjectErrorStubD1Ev
-__ZN3JSC13JSNotAnObjectD1Ev
-__ZN3JSC19JSStaticScopeObjectD1Ev
-__ZN3JSC19JSStaticScopeObjectD2Ev
-__ZN3JSC17DeleteBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17BytecodeGenerator15emitDeleteByValEPNS_10RegisterIDES2_S2_
-__ZN3JSC17DeleteBracketNodeD0Ev
-__ZN3JSC8JITStubs17cti_op_del_by_valEPPv
-__ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateEj
-__ZN3JSC28globalFuncEncodeURIComponentEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL6encodeEPNS_9ExecStateERKNS_7ArgListEPKc
-__ZNK3JSC7UString10UTF8StringEb
-__ZN3WTF7Unicode18convertUTF16ToUTF8EPPKtS2_PPcS4_b
-__ZN3JSC10NegateNodeD0Ev
-__ZN3JSC8JITStubs13cti_op_negateEPPv
-__ZN3JSCL17mathProtoFuncSqrtEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL16mathProtoFuncAbsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL18mathProtoFuncRoundEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL16mathProtoFuncCosEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL16mathProtoFuncSinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs10cti_op_subEPPv
-__ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE
-__ZN3JSC16ArrayConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL20callArrayConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs10cti_op_modEPPv
-__ZN3JSC8JITStubs12cti_op_jlessEPPv
-__ZL17makeLeftShiftNodePvPN3JSC14ExpressionNodeES2_b
-__ZN3JSC13LeftShiftNodeD0Ev
-__ZN3JSC3JIT14emit_op_lshiftEPNS_11InstructionE
-__ZN3JSC3JIT18emitSlow_op_lshiftEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC11JITStubCall11addArgumentENS_3X8610RegisterIDE
-__ZN3JSCL16mathProtoFuncMaxEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC10BitAndNodeD0Ev
-__ZN3JSC3JIT14emit_op_bitandEPNS_11InstructionE
-__ZN3JSC3JIT18emitSlow_op_bitandEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs13cti_op_bitandEPPv
-__ZN3JSC14BitwiseNotNodeD0Ev
-__ZN3JSC3JIT14emit_op_bitnotEPNS_11InstructionE
-__ZN3JSC3JIT18emitSlow_op_bitnotEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC22UnsignedRightShiftNodeD0Ev
-__ZN3JSC10BitXOrNodeD0Ev
-__ZN3JSC3JIT14emit_op_bitxorEPNS_11InstructionE
-__ZN3JSC3JIT18emitSlow_op_bitxorEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSCL25stringProtoFuncCharCodeAtEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs14cti_op_urshiftEPPv
-__ZN3JSC16toUInt32SlowCaseEdRb
-__ZN3JSCL17mathProtoFuncCeilEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC6JSCell18getTruncatedUInt32ERj
-__ZN3JSC3JIT13emit_op_bitorEPNS_11InstructionE
-__ZN3JSC3JIT17emitSlow_op_bitorEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs12cti_op_bitorEPPv
-__ZN3JSC9BitOrNodeD0Ev
-__ZN3JSC8JITStubs13cti_op_rshiftEPPv
-__ZN3JSC8JITStubs13cti_op_bitxorEPPv
-__ZN3JSC9parseDateERKNS_7UStringE
-__ZN3WTF6VectorIN3JSC10CallRecordELm0EE14expandCapacityEmPKS2_
-__ZNK3JSC12JSActivation12toThisObjectEPNS_9ExecStateE
-__ZN3JSC3JIT20emit_op_resolve_skipEPNS_11InstructionE
-__ZN3JSC8JITStubs19cti_op_resolve_skipEPPv
-__ZN3JSCL24dateProtoFuncGetFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC17StringConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL30constructWithStringConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC5equalEPKNS_7UString3RepES3_
-__ZN3JSC8EvalNode4markEv
-__ZN3JSC10SwitchNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC13CaseBlockNode20emitBytecodeForBlockERNS_17BytecodeGeneratorEPNS_10RegisterIDES4_
-__ZN3JSC13CaseBlockNode18tryOptimizedSwitchERN3WTF6VectorIPNS_14ExpressionNodeELm8EEERiS7_
-__ZN3JSCL17processClauseListEPNS_14ClauseListNodeERN3WTF6VectorIPNS_14ExpressionNodeELm8EEERNS_10SwitchKindERbRiSB_
-__ZN3WTF6VectorIPN3JSC14ExpressionNodeELm8EE14expandCapacityEm
-__ZN3WTF6VectorINS_6RefPtrIN3JSC5LabelEEELm8EE14expandCapacityEm
-__ZN3JSC17BytecodeGenerator11beginSwitchEPNS_10RegisterIDENS_10SwitchInfo10SwitchTypeE
-__ZN3WTF6VectorIN3JSC10SwitchInfoELm0EE14expandCapacityEm
-__ZN3JSC17BytecodeGenerator9endSwitchEjPN3WTF6RefPtrINS_5LabelEEEPPNS_14ExpressionNodeEPS3_ii
-__ZN3WTF6VectorIN3JSC15SimpleJumpTableELm0EE14expandCapacityEm
-__ZN3WTF6VectorIiLm0EE15reserveCapacityEm
-__ZN3JSC14CaseClauseNodeD0Ev
-__ZN3JSC14ClauseListNodeD0Ev
-__ZN3JSC13CaseBlockNodeD0Ev
-__ZN3JSC10SwitchNodeD0Ev
-__ZN3JSC3JIT19emit_op_switch_charEPNS_11InstructionE
-__ZN3WTF6VectorIN3JSC12SwitchRecordELm0EE14expandCapacityEm
-__ZN3WTF6VectorIN3JSC22AbstractMacroAssemblerINS1_12X86AssemblerEE17CodeLocationLabelELm0EE4growEm
-__ZN3JSC8JITStubs18cti_op_switch_charEPPv
-__ZN3JSCL16mathProtoFuncPowEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF6VectorIcLm0EE14expandCapacityEm
-__ZN3WTF6VectorIN3JSC7UString5RangeELm16EE14expandCapacityEm
-__ZN3WTF6VectorIN3JSC7UStringELm16EE14expandCapacityEmPKS2_
-__ZN3WTF6VectorIN3JSC7UStringELm16EE15reserveCapacityEm
-__ZN3JSC7JSArray16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
-__ZN3JSC9ExecState10arrayTableEPS0_
-__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
-__ZN3WTF9HashTableIPN3JSC20MarkedArgumentBufferES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehas
-__ZN3JSC8JITStubs24cti_op_get_by_val_stringEPPv
-__ZN3JSCL16mathProtoFuncLogEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC7UString8toDoubleEv
-__ZN3WTF9HashTableIPN3JSC7UString3RepES4_NS_17IdentityExtractorIS4_EENS_7PtrHashIS4_EENS_10HashTraitsIS4_EESA_E4findIS4_NS_22Id
-__ZN3JSCL29objectProtoFuncHasOwnPropertyEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL18arrayProtoFuncSortEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC7JSArray4sortEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataE
-__ZN3WTF7AVLTreeIN3JSC32AVLTreeAbstractorForArrayCompareELj44ENS_18AVLTreeDefaultBSetILj44EEEE6insertEi
-__ZN3JSCltERKNS_7UStringES2_
-__ZN3WTF7AVLTreeIN3JSC32AVLTreeAbstractorForArrayCompareELj44ENS_18AVLTreeDefaultBSetILj44EEEE7balanceEi
-__Z12jsRegExpFreeP8JSRegExp
-__ZN3JSCL21stringProtoFuncConcatEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC19globalFuncEncodeURIEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC19globalFuncDecodeURIEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL6decodeEPNS_9ExecStateERKNS_7ArgListEPKcb
-__ZN3WTF7Unicode18UTF8SequenceLengthEc
-__ZN3WTF7Unicode18decodeUTF8SequenceEPKc
-__ZN3JSCL22numberProtoFuncToFixedEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL16integerPartNoExpEd
-__ZN3WTF14FastMallocZone10statisticsEP14_malloc_zone_tP19malloc_statistics_t
-__ZN3JSC4Heap26protectedGlobalObjectCountEv
-__ZN3JSC10JSFunction15argumentsGetterEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZNK3JSC11Interpreter17retrieveArgumentsEPNS_9ExecStateEPNS_10JSFunctionE
-__ZN3JSCL21dateProtoFuncSetMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23setNewValueFromDateArgsEPNS_9ExecStateENS_7JSValueERKNS_7ArgListEib
-__ZN3JSCL20dateProtoFuncSetDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF6VectorIPNS0_IN3JSC10RegisterIDELm32EEELm32EE14expandCapacityEm
-__ZN3JSC8JITStubs14cti_op_pre_incEPPv
-__ZN3WTF6VectorIPN3JSC14ExpressionNodeELm16EE14expandCapacityEm
-__ZN3JSC13UnaryPlusNodeD0Ev
-__ZN3JSC3JIT19emit_op_to_jsnumberEPNS_11InstructionE
-__ZN3JSC3JIT23emitSlow_op_to_jsnumberEPNS_11InstructionERPNS_13SlowCaseEntryE
-__ZN3JSC8JITStubs18cti_op_to_jsnumberEPPv
-__ZN3JSC6JSLock12DropAllLocksC1Eb
-__ZN3JSCL17createJSLockCountEv
-__ZN3JSC6JSLock12DropAllLocksD1Ev
-__ZN3JSCL24dateProtoFuncSetFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF6VectorIN3JSC15StringJumpTableELm0EE15reserveCapacityEm
-__ZN3WTF7HashMapINS_6RefPtrIN3JSC7UString3RepEEENS2_14OffsetLocationENS_7StrHashIS5_EENS_10HashTraitsIS5_EENS9_IS6_EEE3addEPS4_
-__ZN3WTF9HashTableINS_6RefPtrIN3JSC7UString3RepEEESt4pairIS5_NS2_14OffsetLocationEENS_18PairFirstExtractorIS8_EENS_7StrHashIS5_
-__ZN3JSC3JIT21emit_op_switch_stringEPNS_11InstructionE
-__ZN3JSC8JITStubs20cti_op_switch_stringEPPv
-__ZN3WTF6VectorIN3JSC14ExecutablePool10AllocationELm2EE14expandCapacityEm
-__ZN3JSC12JSGlobalData6createEb
-__ZN3JSCL13allocateBlockILNS_8HeapTypeE1EEEPNS_14CollectorBlockEv
-__ZN3JSC7JSValueC1EPNS_9ExecStateEd
-__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RK
-__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
-__ZN3JSC7CStringD1Ev
-__ZN3WTF7HashMapIPvjNS_7PtrHashIS1_EEN3JSC17JSValueHashTraitsENS_10HashTraitsIjEEE3addERKS1_RKj
-__ZN3WTF6VectorINS_6RefPtrIN3JSC12FuncExprNodeEEELm0EE14shrinkCapacityEm
-__ZN3JSC14ExpressionNodeD2Ev
-__ZThn12_N3JSC11ProgramNodeD0Ev
-__ZThn12_N3JSC12FuncExprNodeD0Ev
-__ZThn12_N3JSC16FunctionBodyNodeD0Ev
-__ZN3JSC8JITStubs16cti_op_new_arrayEPvz
-__ZN3WTF6VectorIN3JSC17StructureStubInfoELm0EE15reserveCapacityEm
-__ZN3JSC17BytecodeGenerator10emitOpcodeENS_8OpcodeIDE
-__ZN3JSC23MacroAssemblerX86Common4moveENS_3X8610RegisterIDES2_
-__ZN3JSC8JITStubs15cti_op_new_funcEPvz
-__ZN3JSC8JITStubs21cti_op_resolve_globalEPvz
-__ZN3JSC8JITStubs16cti_op_get_by_idEPvz
-__ZN3JSC8JITStubs31cti_op_construct_NotJSConstructEPvz
-__ZN3JSC8JITStubs16cti_op_put_by_idEPvz
-__ZN3JSC8JITStubs13cti_op_strcatEPvz
-__ZN3JSC8JITStubs19cti_op_resolve_funcEPvz
-__ZN3JSC8JITStubs23cti_vm_dontLazyLinkCallEPvz
-__ZN3JSC8JITStubs22cti_op_call_JSFunctionEPvz
-__ZN3JSC8JITStubs23cti_register_file_checkEPvz
-__ZN3JSC8JITStubs13cti_op_negateEPvz
-__ZN3JSC8JITStubs28cti_op_construct_JSConstructEPvz
-__ZN3JSC23MacroAssemblerX86Common12branchTest32ENS0_9ConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE7AddressENS4_5Imm
-__ZN3JSC8JITStubs23cti_op_put_by_val_arrayEPvz
-__ZN3JSC8JITStubs23cti_op_put_by_id_secondEPvz
-__ZN3JSC15AssemblerBuffer14executableCopyEPNS_14ExecutablePoolE
-__ZN3JSC12X86Assembler8sarl_i8rEiNS_3X8610RegisterIDE
-__ZN3JSC12X86Assembler23X86InstructionFormatter9twoByteOpENS0_15TwoByteOpcodeIDEiNS_3X8610RegisterIDEi
-__ZN3JSC8JITStubs10cti_op_mulEPvz
-__ZN3JSC12jsNumberCellEPNS_12JSGlobalDataEd
-__ZN3JSC8JITStubs10cti_op_subEPvz
-__ZN3JSC8JITStubs10cti_op_divEPvz
-__ZN3JSC8JITStubs23cti_op_get_by_id_secondEPvz
-__ZN3JSC8JITStubs19cti_vm_lazyLinkCallEPvz
-__ZN3WTF6VectorIPN3JSC12CallLinkInfoELm0EE14expandCapacityEm
-__ZN3JSC8JITStubs19cti_op_convert_thisEPvz
-__ZN3JSC8JITStubs21cti_op_put_by_id_failEPvz
-__ZN3JSC8JITStubs10cti_op_addEPvz
-__ZN3JSC8JITStubs17cti_timeout_checkEPvz
-__ZN3JSC9jsBooleanEb
-__ZN3JSC9CodeBlock19isKnownNotImmediateEi
-__ZN3JSC12X86Assembler8movsd_mrEiNS_3X8610RegisterIDENS1_13XMMRegisterIDE
-__ZN3JSC8JITStubs25cti_op_call_NotJSFunctionEPvz
-__ZNK3JSC12JSNumberCell8toNumberEPNS_9ExecStateE
-__ZN3JSC8JITStubs26cti_op_get_by_id_self_failEPvz
-__ZN3JSC8JITStubs10cti_op_endEPvz
-__ZThn12_N3JSC12FuncDeclNodeD0Ev
-__ZN3JSC8JITStubs24cti_op_resolve_with_baseEPvz
-__ZN3JSC8JITStubs19cti_op_new_func_expEPvz
-__ZN3JSC8JITStubs22cti_op_push_activationEPvz
-__ZN3JSC8JITStubs17cti_op_get_by_valEPvz
-__ZN3JSC8JITStubs22cti_op_call_arityCheckEPvz
-__ZN3JSC8JITStubs11cti_op_lessEPvz
-__ZN3JSC12JSNumberCell18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
-__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDE
-__ZN3JSC8JITStubs27cti_op_get_by_id_proto_listEPvz
-__ZN3JSC8JITStubs12cti_op_jtrueEPvz
-__ZN3JSC8JITStubs10cti_op_modEPvz
-__ZN3JSC8JITStubs10cti_op_neqEPvz
-__ZN3JSC8JITStubs12cti_op_jlessEPvz
-__ZN3JSC8JITStubs24cti_op_get_by_id_genericEPvz
-__ZN3JSC8JITStubs14cti_op_jlesseqEPvz
-__ZN3JSC8JITStubs26cti_op_tear_off_activationEPvz
-__ZN3JSC8JITStubs21cti_op_ret_scopeChainEPvz
-__ZN3JSC8JITStubs19cti_op_to_primitiveEPvz
-__ZNK3JSC12JSNumberCell8toStringEPNS_9ExecStateE
-__ZN3JSC8JITStubs13cti_op_bitandEPvz
-__ZN3JSC8JITStubs13cti_op_lshiftEPvz
-__ZN3JSC8JITStubs13cti_op_bitnotEPvz
-__ZNK3JSC12JSNumberCell9toBooleanEPNS_9ExecStateE
-__ZN3JSC8JITStubs14cti_op_urshiftEPvz
-__ZNK3JSC12JSNumberCell18getTruncatedUInt32ERj
-__ZN3JSC4Yarr14RegexGenerator28generateCharacterClassSingleERNS1_19TermGenerationStateE
-__ZN3WTF15deleteAllValuesIPN3JSC4Yarr18PatternDisjunctionELm4EEEvRKNS_6VectorIT_XT0_EEE
-__ZN3JSC8JITStubs17cti_op_new_regexpEPvz
-__ZN3JSC8JITStubs12cti_op_bitorEPvz
-__ZNK3JSC12JSNumberCell17getTruncatedInt32ERi
-__ZN3JSC8JITStubs13cti_op_rshiftEPvz
-__ZN3JSC8JITStubs13cti_op_bitxorEPvz
-__ZN3WTF7HashSetINS_6RefPtrIN3JSC7UString3RepEEENS2_17IdentifierRepHashENS_10HashTraitsIS5_EEE3addERKS5_
-__ZN3JSC8JITStubs9cti_op_eqEPvz
-__ZN3JSC8JITStubs16cti_op_call_evalEPvz
-__ZN3JSC8JITStubs19cti_op_resolve_skipEPvz
-__ZN3JSC8JITStubs17cti_op_new_objectEPvz
-__ZN3JSC8JITStubs14cti_op_resolveEPvz
-__ZN3JSC8JITStubs17cti_op_put_by_valEPvz
-__ZN3JSC8JITStubs18cti_op_switch_charEPvz
-__ZN3JSC8JITStubs28cti_op_get_by_id_string_failEPvz
-__ZThn12_N3JSC8EvalNodeD0Ev
-__ZN3WTF6VectorIN3JSC7UStringELm16EE14expandCapacityEm
-__ZN3JSC8JITStubs17cti_op_get_pnamesEPvz
-__ZN3JSC8JITStubs17cti_op_next_pnameEPvz
-__ZN3WTF7HashSetIPN3JSC20MarkedArgumentBufferENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
-__ZN3WTF9HashTableIPN3JSC20MarkedArgumentBufferES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E4findI
-__ZN3JSC8JITStubs24cti_op_get_by_val_stringEPvz
-__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE28CharacterClassParserDelegate25atomBuiltInCharacterClassENS0_23BuiltInChar
-__ZN3JSC12jsNumberCellEPNS_9ExecStateEd
-__ZN3JSC8JITStubs18cti_op_is_functionEPvz
-__ZN3JSC8JITStubs16cti_op_is_objectEPvz
-__ZN3JSC8JITStubs16cti_op_nstricteqEPvz
-__ZN3JSC8JITStubs13cti_op_lesseqEPvz
-__ZNK3JSC12JSNumberCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
-__ZN3JSC4Yarr14RegexGenerator27generateCharacterClassFixedERNS1_19TermGenerationStateE
-__ZN3JSC4Heap7destroyEv
-__ZN3JSC12JSGlobalDataD1Ev
-__ZN3JSC12JSGlobalDataD2Ev
-__ZN3JSC12RegisterFileD1Ev
-__ZNK3JSC9HashTable11deleteTableEv
-__ZN3JSC5LexerD1Ev
-__ZN3JSC5LexerD2Ev
-__ZN3WTF20deleteAllPairSecondsIP24OpaqueJSClassContextDataKNS_7HashMapIP13OpaqueJSClassS2_NS_7PtrHashIS5_EENS_10HashTraitsIS5_E
-__ZN3JSC17CommonIdentifiersD2Ev
-__ZN3JSC21deleteIdentifierTableEPNS_15IdentifierTableE
-__ZN3JSC4HeapD1Ev
-__ZN3JSC12SmallStringsD1Ev
-__ZN3JSCL16mathProtoFuncMinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL17arrayProtoFuncPopEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC7JSArray3popEv
-__ZN3JSC11DoWhileNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC11DoWhileNodeD0Ev
-__ZN3JSC3JIT18emit_op_switch_immEPNS_11InstructionE
-__ZN3JSC8JITStubs17cti_op_switch_immEPPv
-__ZN3JSC13UnaryPlusNode14stripUnaryPlusEv
-__ZN3JSC15globalFuncIsNaNEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC17NumberConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL21callNumberConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF6VectorIPNS0_IN3JSC10IdentifierELm64EEELm32EE14expandCapacityEm
-__ZN3JSC8JITStubs19cti_op_is_undefinedEPvz
-__ZN3JSC8JITStubs13cti_op_typeofEPvz
-__ZN3JSC8JITStubs33cti_op_create_arguments_no_paramsEPvz
-__ZN3JSC8JITStubs19cti_op_load_varargsEPvz
-__ZN3JSC8JITStubs10cti_op_notEPvz
-__ZN3JSC8JITStubs16cti_op_is_stringEPvz
-__ZN3JSCL24regExpConstructorDollar1EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3WTF6VectorIN3JSC15StringJumpTableELm0EE14expandCapacityEm
-__ZN3JSC8JITStubs20cti_op_switch_stringEPvz
-__ZN3JSC9Arguments3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC8JITStubs18cti_op_to_jsnumberEPvz
-__ZN3JSC8JITStubs19cti_op_loop_if_lessEPvz
-__ZN3JSC9LabelNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC9LabelNodeD0Ev
-__ZNK3JSC7UString5asciiEv
-__ZN3JSC8JITStubs27cti_op_get_by_id_array_failEPvz
-__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDEiPv
-__ZN3JSC8JITStubs23cti_op_create_argumentsEPvz
-__ZN3JSCL21arrayProtoFuncUnShiftEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs25cti_op_tear_off_argumentsEPvz
-__ZN3JSC7JSArray11sortNumericEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataE
-__ZN3JSC7JSArray17compactForSortingEv
-__ZN3JSCL22compareNumbersForQSortEPKvS1_
-__ZN3JSC8JITStubs15cti_op_post_incEPPv
-__ZN3JSC8JITStubs24cti_op_put_by_id_genericEPvz
-__ZN3JSCL24regExpConstructorDollar2EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL24regExpConstructorDollar3EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL24regExpConstructorDollar4EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL24regExpConstructorDollar5EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL24regExpConstructorDollar6EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL21stringProtoFuncSubstrEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23stringProtoFuncFontsizeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL24dateProtoFuncToUTCStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL19stringProtoFuncLinkEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL9dateParseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs21cti_op_loop_if_lesseqEPPv
-__ZN3JSCL16mathProtoFuncExpEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC4Yarr17nonwordcharCreateEv
-__ZN3WTF6VectorIPN3JSC4Yarr18PatternDisjunctionELm4EE14expandCapacityEmPKS4_
-__Z15jsc_pcre_xclassiPKh
-__ZN3JSC18RegExpMatchesArray3putEPNS_9ExecStateEjNS_7JSValueE
-__ZN3JSC28globalFuncDecodeURIComponentEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs27cti_op_get_by_id_array_failEPPv
-__ZNK3JSC9Arguments9classInfoEv
-__ZN3JSC9Arguments15copyToRegistersEPNS_9ExecStateEPNS_8RegisterEj
-__ZN3JSC19JSStaticScopeObject4markEv
-__ZN3JSC8JITStubs19cti_op_loop_if_lessEPPv
-__ZN3JSC8JITStubs16cti_op_del_by_idEPvz
-__ZN3JSC7JSArray14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC7UString6appendEPKti
-__ZN3JSC8JITStubs17cti_op_push_scopeEPvz
-__ZN3JSC8JITStubs19cti_op_resolve_baseEPvz
-__ZN3JSC8JITStubs16cti_op_pop_scopeEPvz
-__ZN3JSC8JITStubs17cti_op_is_booleanEPvz
-__ZN3JSCL20arrayProtoFuncSpliceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs17cti_op_jmp_scopesEPvz
-__ZN3JSC8JITStubs9cti_op_inEPvz
-__ZN3JSC8JITStubs15cti_op_stricteqEPvz
-__ZN3JSC8JITStubs32cti_op_get_by_id_proto_list_fullEPvz
-__ZN3WTF6VectorIiLm8EE14expandCapacityEm
-__ZN3JSCL21stringProtoFuncSearchEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs12cti_vm_throwEPvz
-__ZN3JSC8JITStubs21cti_op_push_new_scopeEPvz
-__ZN3JSC8JITStubs16cti_op_is_numberEPvz
-__ZN3JSC16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
-__ZNK3JSC8JSString8toObjectEPNS_9ExecStateE
-__ZN3JSC12StringObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
-__ZN3JSC9ExecState11stringTableEPS0_
-__ZN3JSC11JSImmediate8toObjectENS_7JSValueEPNS_9ExecStateE
-__ZN3JSC36constructBooleanFromImmediateBooleanEPNS_9ExecStateENS_7JSValueE
-__ZN3JSC13BooleanObjectD1Ev
-__ZN3JSCL17arrayProtoFuncMapEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC7JSArrayC2EN3WTF10PassRefPtrINS_9StructureEEEj
-__ZN3JSC8JITStubs17cti_op_del_by_valEPvz
-__ZN3JSC8JITStubs27cti_op_get_by_id_proto_failEPvz
-__ZN3JSC10JSFunction12callerGetterEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE
-__ZN3JSC18globalFuncIsFiniteEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZNK3JSC12JSNumberCell8toObjectEPNS_9ExecStateE
-__ZN3JSC15constructNumberEPNS_9ExecStateENS_7JSValueE
-__ZN3JSC12NumberObject11getJSNumberEv
-__ZN3JSCL7dateNowEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC12NumberObjectD1Ev
-__ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
-__ZN3JSCL22numberProtoFuncValueOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC13JSNotAnObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
-__ZN3JSC19JSStaticScopeObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC16InternalFunction4nameEPNS_12JSGlobalDataE
-__ZN3JSCL18arrayProtoFuncSomeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JSString18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
-__ZN3JSC12JSNumberCell11getJSNumberEv
-__ZN3JSC23createNotAFunctionErrorEPNS_9ExecStateENS_7JSValueEjPNS_9CodeBlockE
-__ZN3JSC17PrefixBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC17PrefixBracketNodeD0Ev
-__ZN3JSC17RegExpConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL21callRegExpConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC7JSArray4sortEPNS_9ExecStateE
-__ZN3JSCL27dateProtoFuncSetUTCFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL24dateProtoFuncSetUTCHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23setNewValueFromTimeArgsEPNS_9ExecStateENS_7JSValueERKNS_7ArgListEib
-__ZN3JSC8JITStubs17cti_op_switch_immEPvz
-__ZN3JSC12RegExpObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSCL24setRegExpObjectLastIndexEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueE
-__ZN3JSCL28regExpConstructorLeftContextEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSC18RegExpMatchesArray14deletePropertyEPNS_9ExecStateEj
-__ZN3JSC18RegExpMatchesArray3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC10JSFunction12lengthGetterEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZNK3JSC12NumberObject9classInfoEv
-__ZN3JSC8JITStubs12cti_op_throwEPvz
-__ZN3JSCL19isNonASCIIIdentPartEi
-__ZN3JSCL27dateProtoFuncToLocaleStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL16formatLocaleDateEPNS_9ExecStateEPNS_12DateInstanceEdNS_20LocaleDateTimeFormatERKNS_7ArgListE
-__ZN3JSCL21dateProtoFuncSetHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23dateProtoFuncSetMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23dateProtoFuncSetSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL28dateProtoFuncSetMilliSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC12JSNumberCell12toThisObjectEPNS_9ExecStateE
-__ZN3JSC16ErrorConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL20callErrorConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectES6_RKNS_7ArgListEE
-__ZN3JSC17PrototypeFunctionC2EPNS_9ExecStateEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectES6_RKNS_7ArgListEE
-__ZN3JSC17PrototypeFunction11getCallDataERNS_8CallDataE
-__ZN3JSC17PrototypeFunctionD1Ev
-__ZN3JSCL24booleanProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC17BytecodeGenerator18emitJumpSubroutineEPNS_10RegisterIDEPNS_5LabelE
-__ZN3JSC3JIT11emit_op_jsrEPNS_11InstructionE
-__ZN3WTF6VectorIN3JSC3JIT7JSRInfoELm0EE14expandCapacityEm
-__ZN3JSC3JIT12emit_op_sretEPNS_11InstructionE
-__ZN3JSC6Parser7reparseINS_8EvalNodeEEEN3WTF10PassRefPtrIT_EEPNS_12JSGlobalDataEPS5_
-__ZN3JSC8EvalNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IPNS_12Func
-__ZN3JSC8EvalNode31bytecodeForExceptionInfoReparseEPNS_14ScopeChainNodeEPNS_9CodeBlockE
-__ZN3JSC20FixedVMPoolAllocator17coalesceFreeSpaceEv
-__ZN3WTF6VectorIPN3JSC13FreeListEntryELm0EE15reserveCapacityEm
-__ZN3JSCL35reverseSortFreeListEntriesByPointerEPKvS1_
-__ZN3JSC14globalFuncEvalEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL21functionProtoFuncCallEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL22functionProtoFuncApplyEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC9Arguments11fillArgListEPNS_9ExecStateERNS_20MarkedArgumentBufferE
-__ZNK3JSC7JSValue12toThisObjectEPNS_9ExecStateE
-__ZN3JSC8VoidNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC8VoidNodeD0Ev
-__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF10PassRefPtrINS_9StructureEEERKNS_10IdentifierE
-__ZN3JSC20MarkedArgumentBuffer9markListsERN3WTF7HashSetIPS0_NS1_7PtrHashIS3_EENS1_10HashTraitsIS3_EEEE
-__ZN3JSC7CStringaSERKS0_
-__ZNK3JSC19JSStaticScopeObject14isDynamicScopeEv
-__ZN3JSCL33reverseSortCommonSizedAllocationsEPKvS1_
-__ZN3JSCL20arrayProtoFuncFilterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC17NumberConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL30constructWithNumberConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC17BytecodeGenerator18emitUnexpectedLoadEPNS_10RegisterIDEb
-__ZN3JSC8JITStubs12cti_op_throwEPPv
-__ZN3JSC6JSCell9getObjectEv
-__ZN3JSCL21arrayProtoFuncReverseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC8JSObject16isVariableObjectEv
-__ZN3JSC18EmptyStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSCL27compareByStringPairForQSortEPKvS1_
-__Z22jsc_pcre_ucp_othercasej
-__ZN3JSCL35objectProtoFuncPropertyIsEnumerableEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF7HashMapIjN3JSC7JSValueENS_7IntHashIjEENS_10HashTraitsIjEENS5_IS2_EEE3setERKjRKS2_
-__ZN3WTF9HashTableIjSt4pairIjN3JSC7JSValueEENS_18PairFirstExtractorIS4_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIjEE
-__ZN3JSC12RegisterFile21releaseExcessCapacityEv
-__ZN3JSCL20isNonASCIIIdentStartEi
-__ZN3JSC17BytecodeGenerator14emitPutByIndexEPNS_10RegisterIDEjS2_
-__ZN3JSC3JIT20emit_op_put_by_indexEPNS_11InstructionE
-__ZN3JSC8JITStubs19cti_op_put_by_indexEPPv
-__ZN3JSCL25numberConstructorMaxValueEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL28numberConstructorPosInfinityEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL28numberConstructorNegInfinityEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSC18BooleanConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL22callBooleanConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL17mathProtoFuncATanEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JITStubs17cti_op_jmp_scopesEPPv
-__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj
-__ZN3JSCL17mathProtoFuncASinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC11Interpreter7executeEPNS_8EvalNodeEPNS_9ExecStateEPNS_8JSObjectEPNS_14ScopeChainNodeEPNS_7JSValueE
-_JSContextGetGlobalObject
-__ZN3JSC4Heap14registerThreadEv
-__ZN3JSC6JSLockC1EPNS_9ExecStateE
-_JSStringCreateWithUTF8CString
-__ZN3WTF7Unicode18convertUTF8ToUTF16EPPKcS2_PPtS4_b
-_JSClassCreate
-__ZN13OpaqueJSClass6createEPK17JSClassDefinition
-__ZN13OpaqueJSClassC2EPK17JSClassDefinitionPS_
-__ZN3JSC7UString3Rep14createFromUTF8EPKc
-__ZN3WTF7HashMapINS_6RefPtrIN3JSC7UString3RepEEEP19StaticFunctionEntryNS_7StrHashIS5_EENS_10HashTraitsIS5_EENSA_IS7_EEE3addERKS
-__ZN3WTF9HashTableINS_6RefPtrIN3JSC7UString3RepEEESt4pairIS5_P19StaticFunctionEntryENS_18PairFirstExtractorIS9_EENS_7StrHashIS5
-__ZN3WTF7HashMapINS_6RefPtrIN3JSC7UString3RepEEEP16StaticValueEntryNS_7StrHashIS5_EENS_10HashTraitsIS5_EENSA_IS7_EEE3addERKS5_R
-_JSClassRetain
-_JSObjectMake
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE4initEPNS_9ExecStateE
-__ZN13OpaqueJSClass9prototypeEPN3JSC9ExecStateE
-__ZN13OpaqueJSClass11contextDataEPN3JSC9ExecStateE
-__ZN3WTF9HashTableIP13OpaqueJSClassSt4pairIS2_P24OpaqueJSClassContextDataENS_18PairFirstExtractorIS6_EENS_7PtrHashIS2_EENS_14Pa
-__ZN24OpaqueJSClassContextDataC2EP13OpaqueJSClass
-__ZN3JSC7UString3Rep13createCopyingEPKti
-_JSObjectSetProperty
-__ZNK14OpaqueJSString10identifierEPN3JSC12JSGlobalDataE
-__ZN3JSC14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
-_JSStringRelease
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE20staticFunctionGetterEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSC18JSCallbackFunctionC1EPNS_9ExecStateEPFPK13OpaqueJSValuePK15OpaqueJSContextPS3_S9_mPKS5_PS5_ERKNS_10IdentifierE
-__ZN3JSC18JSCallbackFunction11getCallDataERNS_8CallDataE
-__ZN3JSC18JSCallbackFunction4callEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
-_JSObjectGetPrivate
-__ZNK3JSC16JSCallbackObjectINS_8JSObjectEE9classInfoEv
-_JSValueMakeUndefined
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE17staticValueGetterEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN14OpaqueJSString6createERKN3JSC7UStringE
-_JSStringCreateWithCharacters
-_JSValueMakeString
-__ZNK14OpaqueJSString7ustringEv
-__ZN3JSC7UStringC1EPtib
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEED1Ev
-_JSClassRelease
-__ZL25clearReferenceToPrototypeP13OpaqueJSValue
-_JSObjectGetProperty
-_JSValueToObject
-__ZN3JSCL22dateProtoFuncGetUTCDayEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL24dateProtoFuncGetUTCMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23dateProtoFuncGetUTCDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL27dateProtoFuncGetUTCFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC7UString8toUInt32EPb
-__ZN3JSCL24dateProtoFuncGetUTCHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL26dateProtoFuncGetUTCMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL26dateProtoFuncGetUTCSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL7dateUTCEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC12RegExpObject11getCallDataERNS_8CallDataE
-__ZN3JSC9Arguments14deletePropertyEPNS_9ExecStateEj
-_JSValueMakeBoolean
-_JSValueToNumber
-_JSStringCreateWithCFString
-__ZN3WTF13tryFastCallocEmm
-_JSValueMakeNumber
-__ZN3JSC18JSCallbackFunctionD1Ev
-_JSValueToStringCopy
-_JSStringCopyCFString
-__ZN3JSC18ConstStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC13ConstDeclNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC13ConstDeclNode14emitCodeSingleERNS_17BytecodeGeneratorE
-__ZN3JSC13ConstDeclNodeD0Ev
-__ZN3JSC18ConstStatementNodeD0Ev
-__ZN3JSC18BooleanConstructor16getConstructDataERNS_13ConstructDataE
-__ZN3JSCL31constructWithBooleanConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
-__ZN3JSC16constructBooleanEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSCL31dateProtoFuncGetUTCMillisecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL28dateProtoFuncGetMilliSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL31dateProtoFuncToLocaleTimeStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL21regExpObjectLastIndexEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSC21DebuggerStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC21DebuggerStatementNodeD0Ev
-__ZN3JSC4Yarr12RegexPattern21newlineCharacterClassEv
-__ZN3JSC17ObjectConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL23dateProtoFuncSetUTCDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL26stringFromCharCodeSlowCaseEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSCL21callObjectConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL27objectProtoFuncDefineGetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_
-__ZN3JSC12GetterSetter4markEv
-__ZN3JSC12GetterSetterD1Ev
-__ZN3JSCL22regExpProtoFuncCompileEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC17NumberConstructor9classInfoEv
-__ZNK3JSC17RegExpConstructor9classInfoEv
-__ZN3JSCL31dateProtoFuncToLocaleDateStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC8JSObject14isGlobalObjectEv
-_JSValueToBoolean
-__ZN3JSC8JITStubs13cti_op_lshiftEPPv
-__ZN3JSC8JITStubs13cti_op_bitnotEPPv
-__ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC19FunctionConstructor11getCallDataERNS_8CallDataE
-__ZN3WTF9ByteArray6createEm
-__ZNK3JSC6JSCell9getStringERNS_7UStringE
-__ZN3JSC3JIT12emit_op_loopEPNS_11InstructionE
-__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
-__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
-__ZN3JSC11JSByteArrayC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
-__ZN3JSC11JSByteArray18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
-__ZN3JSC11JSByteArray3putEPNS_9ExecStateEjNS_7JSValueE
-__ZN3JSC11JSByteArray3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC11JSByteArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
-__ZN3JSC8JITStubs28cti_op_get_by_val_byte_arrayEPPv
-__ZN3JSC8JITStubs28cti_op_put_by_val_byte_arrayEPPv
-__ZL30makeGetterOrSetterPropertyNodePvRKN3JSC10IdentifierES3_PNS0_13ParameterNodeEPNS0_16FunctionBodyNodeERKNS0_10SourceCodeE
-__ZN3JSC17BytecodeGenerator13emitPutGetterEPNS_10RegisterIDERKNS_10IdentifierES2_
-__ZN3JSC17BytecodeGenerator13emitPutSetterEPNS_10RegisterIDERKNS_10IdentifierES2_
-__ZN3JSC3JIT18emit_op_put_getterEPNS_11InstructionE
-__ZN3JSC3JIT18emit_op_put_setterEPNS_11InstructionE
-__ZN3JSC8JITStubs17cti_op_put_getterEPPv
-__ZN3JSC8JITStubs17cti_op_put_setterEPPv
-__ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_
-__ZNK3JSC12GetterSetter14isGetterSetterEv
-__ZNK3JSC6JSCell14isGetterSetterEv
-__ZN3JSCL29regExpConstructorRightContextEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSC5Lexer19copyCodeWithoutBOMsEv
-__ZN3JSC13JSNotAnObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC6JSCell16getConstructDataERNS_13ConstructDataE
-__ZN3JSC26createNotAConstructorErrorEPNS_9ExecStateENS_7JSValueEjPNS_9CodeBlockE
-__ZN3JSC15isStrWhiteSpaceEt
-__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
-__ZNK3JSC22NativeErrorConstructor9classInfoEv
-__ZNK3JSC16JSCallbackObjectINS_8JSObjectEE9classNameEv
-__ZN3JSC4Heap11objectCountEv
-__ZNK3JSC12SmallStrings5countEv
-__ZN3JSC14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
-__ZN3JSCL27objectProtoFuncLookupGetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSCL27objectProtoFuncDefineSetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
-__ZN3JSC9Structure22getterSetterTransitionEPS0_
-__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_7JSValueE
-__ZN3JSC12PropertySlot14functionGetterEPNS_9ExecStateERKNS_10IdentifierERKS0_
-__ZN3JSCL28objectProtoFuncIsPrototypeOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEERKNS_7UStringE
-__ZNK3JSC7UString6is8BitEv
-__ZN3JSC8JSObject15unwrappedObjectEv
-__ZN3JSC22NativeErrorConstructor11getCallDataERNS_8CallDataE
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE11getCallDataERNS_8CallDataE
-__ZN3JSC17BytecodeGenerator21emitComplexJumpScopesEPNS_5LabelEPNS_18ControlFlowContextES4_
-__ZN3JSC23ThrowableExpressionData14emitThrowErrorERNS_17BytecodeGeneratorENS_9ErrorTypeEPKc
-__ZN3JSC17BytecodeGenerator12emitNewErrorEPNS_10RegisterIDENS_9ErrorTypeENS_7JSValueE
-__ZN3JSC3JIT17emit_op_new_errorEPNS_11InstructionE
-__ZN3JSC23MacroAssemblerX86Common8branch16ENS0_9ConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE9BaseIndexENS4_5Imm32E
-_JSStringRetain
-__ZN3JSCL19arrayProtoFuncEveryEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL20arrayProtoFuncReduceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL25arrayProtoFuncReduceRightEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL28arrayProtoFuncToLocaleStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL25arrayProtoFuncLastIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC15AssignErrorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC8JITStubs16cti_op_new_errorEPPv
-__ZN3JSC15AssignErrorNodeD0Ev
-__ZN3JSC17BytecodeGenerator18emitUnexpectedLoadEPNS_10RegisterIDEd
-__ZN3JSC19JSStaticScopeObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC9ExecState9dateTableEPS0_
-__ZNK3JSC15RegExpPrototype9classInfoEv
-__ZN3JSC12StringObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSCL25dateProtoFuncToDateStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL25dateProtoFuncToTimeStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL25numberConstructorNaNValueEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL31dateProtoFuncSetUTCMillisecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL26dateProtoFuncSetUTCSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL26dateProtoFuncSetUTCMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL24dateProtoFuncSetUTCMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL23throwStackOverflowErrorEPNS_9ExecStateEPNS_12JSGlobalDataEPvRS4_
-__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
-__ZN3JSC15DeleteValueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC15DeleteValueNodeD0Ev
-__ZN3JSC16PostfixErrorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC15PrefixErrorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
-__ZN3JSC16PostfixErrorNodeD0Ev
-__ZN3JSC15PrefixErrorNodeD0Ev
-__ZN3JSC23createInvalidParamErrorEPNS_9ExecStateEPKcNS_7JSValueEjPNS_9CodeBlockE
-__ZNK3JSC15DotAccessorNode17isDotAccessorNodeEv
-__ZNK3JSC14ExpressionNode17isDotAccessorNodeEv
-__ZN3JSC13JSNotAnObject3putEPNS_9ExecStateEjNS_7JSValueE
-__ZN3JSC4Heap24setGCProtectNeedsLockingEv
-__ZN3JSCL23callFunctionConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZNK3JSC16JSCallbackObjectINS_8JSObjectEE8toStringEPNS_9ExecStateE
-__ZN3JSC8JITStubs17cti_op_instanceofEPPv
-__ZN3JSC17BytecodeGenerator35emitThrowExpressionTooDeepExceptionEv
-__ZN3JSCL25numberConstructorMinValueEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL17mathProtoFuncACosEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL18mathProtoFuncATan2EPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL16mathProtoFuncTanEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL28numberProtoFuncToExponentialEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL26numberProtoFuncToPrecisionEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL12charSequenceEci
-__ZN3JSCL29objectProtoFuncToLocaleStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC6JSCell14toThisJSStringEPNS_9ExecStateE
-__ZNK3JSC6JSCell12toThisStringEPNS_9ExecStateE
-__ZN3JSCL27objectProtoFuncLookupSetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
-__ZN3JSC9ExecState22regExpConstructorTableEPS0_
-__ZN3JSCL24regExpConstructorDollar7EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL24regExpConstructorDollar8EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL24regExpConstructorDollar9EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL22regExpConstructorInputEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL25setRegExpConstructorInputEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueE
-__ZN3JSCL26regExpConstructorLastMatchEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL26regExpConstructorLastParenEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL26regExpConstructorMultilineEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL29setRegExpConstructorMultilineEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueE
-__ZN3JSC4Yarr15nondigitsCreateEv
-__ZNK3JSC19JSStaticScopeObject12toThisObjectEPNS_9ExecStateE
-__ZN3JSC12JSActivation18getArgumentsGetterEv
-__ZN3JSC12JSActivation15argumentsGetterEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-__ZN3JSCL23booleanProtoFuncValueOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSCL28stringProtoFuncLocaleCompareEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3WTF8Collator11userDefaultEv
-__ZNK3WTF8Collator7collateEPKtmS2_m
-__ZNK3WTF8Collator14createCollatorEv
-__ZN3WTF8CollatorD1Ev
-__ZN3WTF8Collator15releaseCollatorEv
-__ZNK3JSC10MathObject9classInfoEv
-__ZN3JSC9ExecState9mathTableEPS0_
-__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_
-__ZN3JSC33getCurrentUTCTimeWithMicrosecondsEv
-__ZN3JSC16ProfileGenerator24addParentForConsoleStartEPNS_9ExecStateE
-__ZN3JSC8Profiler20createCallIdentifierEPNS_12JSGlobalDataENS_7JSValueERKNS_7UStringEi
-__ZN3JSC16InternalFunction21calculatedDisplayNameEPNS_12JSGlobalDataE
-__ZN3JSC11ProfileNode10insertNodeEN3WTF10PassRefPtrIS0_EE
-__ZN3WTF6VectorINS_6RefPtrIN3JSC11ProfileNodeEEELm0EE14expandCapacityEm
-__ZN3WTF6VectorINS_6RefPtrIN3JSC16ProfileGeneratorEEELm0EE14expandCapacityEm
-__ZN3JSC8JITStubs23cti_op_profile_did_callEPPv
-__ZN3JSC8Profiler10didExecuteEPNS_9ExecStateENS_7JSValueE
-__ZN3JSC16ProfileGenerator10didExecuteERKNS_14CallIdentifierE
-__ZN3JSC11ProfileNode10didExecuteEv
-__ZN3JSC8JITStubs24cti_op_profile_will_callEPPv
-__ZN3JSC8Profiler11willExecuteEPNS_9ExecStateENS_7JSValueE
-__ZN3JSC16ProfileGenerator11willExecuteERKNS_14CallIdentifierE
-__ZN3JSC11ProfileNode11willExecuteERKNS_14CallIdentifierE
-__ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
-__ZN3JSC16ProfileGenerator13stopProfilingEv
-__ZN3JSC7Profile7forEachEMNS_11ProfileNodeEFvvE
-__ZNK3JSC11ProfileNode25traverseNextNodePostOrderEv
-__ZN3JSC11ProfileNode13stopProfilingEv
-__ZN3JSCeqERKNS_7UStringEPKc
-__ZN3JSC11ProfileNode11removeChildEPS0_
-__ZN3JSC11ProfileNode8addChildEN3WTF10PassRefPtrIS0_EE
-_JSValueIsObjectOfClass
-_JSObjectCallAsConstructor
-__ZN3JSC9constructEPNS_9ExecStateENS_7JSValueENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE
-_JSObjectCallAsFunction
-__ZN3JSC4Heap14primaryHeapEndEv
-__ZN3JSC4Heap16primaryHeapBeginEv
-__ZNK3JSC18JSCallbackFunction9classInfoEv
-__ZN3JSC8Profiler11willExecuteEPNS_9ExecStateERKNS_7UStringEi
-__ZN3JSC8Profiler10didExecuteEPNS_9ExecStateERKNS_7UStringEi
-__ZNK3JSC16ProfileGenerator5titleEv
-__ZN3JSC7ProfileD0Ev
-__ZN3WTF10RefCountedIN3JSC11ProfileNodeEE5derefEv
-__ZN3JSC4Yarr14RegexGenerator33generatePatternCharacterNonGreedyERNS1_19TermGenerationStateE
-__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
-__ZNK3JSC25InterruptedExecutionError19isWatchdogExceptionEv
-__ZN3JSC25InterruptedExecutionErrorD1Ev
-__ZN3JSC12JSGlobalData10ClientDataD2Ev
-__ZN3JSC18RegExpMatchesArray16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
-__ZN3WTF8CollatorC1EPKc
-__ZN3WTF8Collator18setOrderLowerFirstEb
-__ZN3WTF12randomNumberEv
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
-__ZNK3JSC6JSCell9getStringEv
-__ZNK3JSC12DateInstance7getTimeERdRi
-__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
-_JSGlobalContextCreate
-_JSGlobalContextCreateInGroup
-__ZN3JSC4Heap29makeUsableFromMultipleThreadsEv
-_JSGlobalContextRetain
-__ZN3JSC6JSLock6unlockEb
-_JSEvaluateScript
-__ZNK3JSC14JSGlobalObject17supportsProfilingEv
-_JSGlobalContextRelease
-__ZN3JSC14JSGlobalObjectD1Ev
-__ZN3JSC14JSGlobalObject18JSGlobalObjectDataD0Ev
-__ZN3JSC17FunctionPrototype11getCallDataERNS_8CallDataE
-__ZN3JSC15DateConstructor11getCallDataERNS_8CallDataE
-__ZN3JSCL8callDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
-__ZN3JSC13JSNotAnObject4markEv
-_JSObjectIsFunction
-__ZN3JSC4Heap17globalObjectCountEv
-__ZN3JSC4Heap20protectedObjectCountEv
-__ZN3JSC4Heap25protectedObjectTypeCountsEv
-__ZN3WTF9HashTableIPKcSt4pairIS2_jENS_18PairFirstExtractorIS4_EENS_7PtrHashIS2_EENS_14PairHashTraitsINS_10HashTraitsIS2_EENSA_I
-__ZN3WTF20fastMallocStatisticsEv
-__ZNK3JSC4Heap10statisticsEv
-__ZN3WTF27releaseFastMallocFreeMemoryEv
-__ZN3JSC10JSFunction16getConstructDataERNS_13ConstructDataE
-__ZN3JSC10JSFunction9constructEPNS_9ExecStateERKNS_7ArgListE
-__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE
-__ZN3WTF7HashSetIPN3JSC14JSGlobalObjectENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
-__ZN3WTF9HashTableIPN3JSC14JSGlobalObjectES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
-__ZN3JSC3JIT13emit_op_debugEPNS_11InstructionE
-__ZN3JSC8JITStubs12cti_op_debugEPPv
-__ZN3JSC11Interpreter5debugEPNS_9ExecStateENS_11DebugHookIDEii
-__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
-__ZN3JSC9CodeBlock33functionRegisterForBytecodeOffsetEjRi
-_JSStringIsEqualToUTF8CString
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE14callbackGetterEPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE
-_JSObjectSetPrivate
-__ZN3JSC7UString3Rep11computeHashEPKci
-__ZN3JSC16JSCallbackObjectINS_8JSObjectEE14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
-_JSGarbageCollect
-__ZN3JSC4Heap6isBusyEv
-__ZN3JSCL18styleFromArgStringERKNS_7UStringEl
diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri
deleted file mode 100644
index fe9e8cd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri
+++ /dev/null
@@ -1,111 +0,0 @@
-# JavaScriptCore - Qt4 build info
-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
-
-symbian: {
- # Need to guarantee this comes before system includes of /epoc32/include
- MMP_RULES += "USERINCLUDE ../JavaScriptCore/profiler"
- LIBS += -lhal
- # For hal.h
- INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
-}
-
-INCLUDEPATH = \
- $$PWD \
- $$PWD/.. \
- $$PWD/assembler \
- $$PWD/bytecode \
- $$PWD/bytecompiler \
- $$PWD/debugger \
- $$PWD/interpreter \
- $$PWD/jit \
- $$PWD/parser \
- $$PWD/pcre \
- $$PWD/profiler \
- $$PWD/runtime \
- $$PWD/wtf \
- $$PWD/wtf/symbian \
- $$PWD/wtf/unicode \
- $$PWD/yarr \
- $$PWD/API \
- $$PWD/ForwardingHeaders \
- $$JSC_GENERATED_SOURCES_DIR \
- $$INCLUDEPATH
-
-win32-*: DEFINES += _HAS_TR1=0
-
-DEFINES += BUILDING_QT__ BUILDING_JavaScriptCore BUILDING_WTF
-
-contains(JAVASCRIPTCORE_JIT,yes) {
- DEFINES+=ENABLE_JIT=1
- DEFINES+=ENABLE_YARR_JIT=1
- DEFINES+=ENABLE_YARR=1
-}
-contains(JAVASCRIPTCORE_JIT,no) {
- DEFINES+=ENABLE_JIT=0
- DEFINES+=ENABLE_YARR_JIT=0
- DEFINES+=ENABLE_YARR=0
-}
-
-wince* {
- INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/ce-compat
- DEFINES += WINCEBASIC
-
- INCLUDEPATH += $$PWD/../JavaScriptCore/os-wince
- 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/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
deleted file mode 100644
index a805170..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
+++ /dev/null
@@ -1,232 +0,0 @@
-# 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)
-
-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/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/ExecutableAllocatorPosix.cpp \
- jit/ExecutableAllocatorSymbian.cpp \
- jit/ExecutableAllocatorWin.cpp \
- jit/ExecutableAllocator.cpp \
- jit/JITArithmetic.cpp \
- jit/JITCall.cpp \
- jit/JIT.cpp \
- jit/JITOpcodes.cpp \
- jit/JITPropertyAccess.cpp \
- jit/JITPropertyAccess32_64.cpp \
- jit/JITStubs.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/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/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/ScopeChain.cpp \
- runtime/SmallStrings.cpp \
- runtime/StringConstructor.cpp \
- runtime/StringObject.cpp \
- runtime/StringPrototype.cpp \
- runtime/StructureChain.cpp \
- runtime/Structure.cpp \
- runtime/TimeoutChecker.cpp \
- runtime/UString.cpp \
- runtime/UStringImpl.cpp \
- wtf/Assertions.cpp \
- wtf/ByteArray.cpp \
- wtf/CurrentTime.cpp \
- wtf/DateMath.cpp \
- wtf/dtoa.cpp \
- wtf/FastMalloc.cpp \
- wtf/HashTable.cpp \
- wtf/MainThread.cpp \
- wtf/qt/MainThreadQt.cpp \
- wtf/qt/ThreadingQt.cpp \
- wtf/RandomNumber.cpp \
- wtf/RefCountedLeakCounter.cpp \
- wtf/symbian/RegisterFileAllocatorSymbian.cpp \
- wtf/symbian/BlockAllocatorSymbian.cpp \
- wtf/ThreadingNone.cpp \
- wtf/Threading.cpp \
- wtf/TypeTraits.cpp \
- wtf/unicode/CollatorDefault.cpp \
- wtf/unicode/icu/CollatorICU.cpp \
- wtf/unicode/UTF8.cpp \
- yarr/RegexCompiler.cpp \
- yarr/RegexInterpreter.cpp \
- yarr/RegexJIT.cpp
-
-# Generated files, simply list them for JavaScriptCore
-SOURCES += \
- $${JSC_GENERATED_SOURCES_DIR}/Grammar.cpp
-
-!contains(DEFINES, USE_SYSTEM_MALLOC) {
- SOURCES += wtf/TCSystemAlloc.cpp
-}
-
-# 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/src/3rdparty/webkit/JavaScriptCore/JavaScriptCorePrefix.h b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCorePrefix.h
deleted file mode 100644
index 13b21bb..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCorePrefix.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#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/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp
deleted file mode 100644
index 7393aa1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * 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 {
- ARMWord reg = getImm(offset, ARMRegisters::S0);
- dtr_ur(isLoad, srcDst, base, reg | 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 {
- ARMWord reg = getImm(offset, ARMRegisters::S0);
- dtr_dr(isLoad, srcDst, base, reg | 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<ARMWord*>(data + pos);
- ARMWord* addr = getLdrImmAddress(ldrAddr);
- if (*addr != 0xffffffff) {
- if (!(*iter & 1)) {
- int diff = reinterpret_cast<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/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h
deleted file mode 100644
index f93db68..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
- * 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 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
- } 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,
- FADDD = 0x0e300b00,
- FDIVD = 0x0e800b00,
- FSUBD = 0x0e300b40,
- FMULD = 0x0e200b00,
- FCMPD = 0x0eb40b40,
- DTR = 0x05000000,
- LDRH = 0x00100090,
- STRH = 0x00000090,
- STMDB = 0x09200000,
- LDMIA = 0x08b00000,
- FDTR = 0x0d000b00,
- B = 0x0a000000,
- BL = 0x0b000000,
- FMSR = 0x0e000a10,
- FMRS = 0x0e100a10,
- FSITOD = 0x0eb80bc0,
- FTOSID = 0x0ebd0b40,
- FMSTAT = 0x0ef1fa10,
-#if WTF_ARM_ARCH_AT_LEAST(5)
- CLZ = 0x016f0f10,
- BKPT = 0xe120070,
-#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 = 0xee120070,
- };
-
- static const ARMWord INVALID_IMM = 0xf0000000;
- 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; }
- 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 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 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 faddd_r(int dd, int dn, int dm, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FADDD, dd, dn, dm);
- }
-
- void fdivd_r(int dd, int dn, int dm, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FDIVD, dd, dn, dm);
- }
-
- void fsubd_r(int dd, int dn, int dm, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FSUBD, dd, dn, dm);
- }
-
- void fmuld_r(int dd, int dn, int dm, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FMULD, dd, dn, dm);
- }
-
- void fcmpd_r(int dd, int dm, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FCMPD, 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 fmsr_r(int dd, int rn, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FMSR, rn, dd, 0);
- }
-
- void fmrs_r(int rd, int dn, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FMRS, rd, dn, 0);
- }
-
- void fsitod_r(int dd, int dm, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FSITOD, dd, 0, dm);
- }
-
- void ftosid_r(int fd, int dm, Condition cc = AL)
- {
- emitInst(static_cast<ARMWord>(cc) | FTOSID, fd, 0, dm);
- }
-
- void fmstat(Condition cc = AL)
- {
- m_buffer.putInt(static_cast<ARMWord>(cc) | FMSTAT);
- }
-
-#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
- }
-
- 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 jmp(Condition cc = AL, int useConstantPool = 0)
- {
- ensureSpace(sizeof(ARMWord), sizeof(ARMWord));
- int s = m_buffer.uncheckedSize();
- ldr_un_imm(ARMRegisters::pc, 0xffffffff, cc);
- m_jumps.append(s | (useConstantPool & 0x1));
- return JmpSrc(s);
- }
-
- void* executableCopy(ExecutablePool* allocator);
-
- // Patching helpers
-
- static ARMWord* getLdrImmAddress(ARMWord* insn)
- {
- // 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
-
- void linkJump(JmpSrc from, JmpDst to)
- {
- ARMWord* insn = reinterpret_cast<ARMWord*>(m_buffer.data()) + (from.m_offset / sizeof(ARMWord));
- ARMWord* addr = getLdrImmAddressOnPool(insn, m_buffer.poolAddress());
- *addr = static_cast<ARMWord>(to.m_offset);
- }
-
- static void linkJump(void* code, JmpSrc from, void* to)
- {
- patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
- }
-
- static void relinkJump(void* from, void* to)
- {
- patchPointerInternal(reinterpret_cast<intptr_t>(from) - sizeof(ARMWord), to);
- }
-
- static void linkCall(void* code, JmpSrc from, void* to)
- {
- patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
- }
-
- static void relinkCall(void* from, void* to)
- {
- patchPointerInternal(reinterpret_cast<intptr_t>(from) - sizeof(ARMWord), to);
- }
-
- // Address operations
-
- static void* getRelocatedAddress(void* code, JmpSrc jump)
- {
- return reinterpret_cast<void*>(reinterpret_cast<ARMWord*>(code) + jump.m_offset / sizeof(ARMWord) + 1);
- }
-
- static void* getRelocatedAddress(void* code, JmpDst label)
- {
- return reinterpret_cast<void*>(reinterpret_cast<ARMWord*>(code) + label.m_offset / sizeof(ARMWord));
- }
-
- // Address differences
-
- static int getDifferenceBetweenLabels(JmpDst from, JmpSrc to)
- {
- return (to.m_offset + sizeof(ARMWord)) - 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 + sizeof(ARMWord);
- }
-
- // 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);
-
- // 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/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h
deleted file mode 100644
index 21279f5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h
+++ /dev/null
@@ -1,1887 +0,0 @@
-/*
- * Copyright (C) 2009 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;
-
- // s0 == d0 == q0
- // s4 == d2 == q1
- // etc
- typedef enum {
- s0 = 0,
- s1 = 1,
- s2 = 2,
- s3 = 3,
- s4 = 4,
- s5 = 5,
- s6 = 6,
- s7 = 7,
- s8 = 8,
- s9 = 9,
- s10 = 10,
- s11 = 11,
- s12 = 12,
- s13 = 13,
- s14 = 14,
- s15 = 15,
- s16 = 16,
- s17 = 17,
- s18 = 18,
- s19 = 19,
- s20 = 20,
- s21 = 21,
- s22 = 22,
- s23 = 23,
- s24 = 24,
- s25 = 25,
- s26 = 26,
- s27 = 27,
- s28 = 28,
- s29 = 29,
- s30 = 30,
- s31 = 31,
- d0 = 0 << 1,
- d1 = 1 << 1,
- d2 = 2 << 1,
- d3 = 3 << 1,
- d4 = 4 << 1,
- d5 = 5 << 1,
- d6 = 6 << 1,
- d7 = 7 << 1,
- d8 = 8 << 1,
- d9 = 9 << 1,
- d10 = 10 << 1,
- d11 = 11 << 1,
- d12 = 12 << 1,
- d13 = 13 << 1,
- d14 = 14 << 1,
- d15 = 15 << 1,
- d16 = 16 << 1,
- d17 = 17 << 1,
- d18 = 18 << 1,
- d19 = 19 << 1,
- d20 = 20 << 1,
- d21 = 21 << 1,
- d22 = 22 << 1,
- d23 = 23 << 1,
- d24 = 24 << 1,
- d25 = 25 << 1,
- d26 = 26 << 1,
- d27 = 27 << 1,
- d28 = 28 << 1,
- d29 = 29 << 1,
- d30 = 30 << 1,
- d31 = 31 << 1,
- q0 = 0 << 2,
- q1 = 1 << 2,
- q2 = 2 << 2,
- q3 = 3 << 2,
- q4 = 4 << 2,
- q5 = 5 << 2,
- q6 = 6 << 2,
- q7 = 7 << 2,
- q8 = 8 << 2,
- q9 = 9 << 2,
- q10 = 10 << 2,
- q11 = 11 << 2,
- q12 = 12 << 2,
- q13 = 13 << 2,
- q14 = 14 << 2,
- q15 = 15 << 2,
- q16 = 16 << 2,
- q17 = 17 << 2,
- q18 = 18 << 2,
- q19 = 19 << 2,
- q20 = 20 << 2,
- q21 = 21 << 2,
- q22 = 22 << 2,
- q23 = 23 << 2,
- q24 = 24 << 2,
- q25 = 25 << 2,
- q26 = 26 << 2,
- q27 = 27 << 2,
- q28 = 28 << 2,
- q29 = 29 << 2,
- q30 = 30 << 2,
- q31 = 31 << 2,
- } FPRegisterID;
-}
-
-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.byte0;
- 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;
-};
-
-
-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 : 5;
- };
- } m_u;
-};
-
-
-/*
-Some features of the Thumb instruction set are deprecated in ARMv7. Deprecated features affecting
-instructions supported by ARMv7-M are as follows:
-• use of the PC as <Rd> or <Rm> in a 16-bit ADD (SP plus register) instruction
-• use of the SP as <Rm> in a 16-bit ADD (SP plus register) instruction
-• use of the SP as <Rm> in a 16-bit CMP (register) instruction
-• use of MOV (register) instructions in which <Rd> is the SP or PC and <Rm> is also the SP or PC.
-• use of <Rn> as the lowest-numbered register in the register list of a 16-bit STM instruction with base
-register writeback
-*/
-
-class ARMv7Assembler {
-public:
- ~ARMv7Assembler()
- {
- ASSERT(m_jumpsToLink.isEmpty());
- }
-
- typedef ARMRegisters::RegisterID RegisterID;
- typedef ARMRegisters::FPRegisterID FPRegisterID;
-
- // (HS, LO, HI, LS) -> (AE, B, A, BE)
- // (VS, VC) -> (O, NO)
- typedef enum {
- ConditionEQ,
- ConditionNE,
- ConditionHS,
- ConditionLO,
- ConditionMI,
- ConditionPL,
- ConditionVS,
- ConditionVC,
- ConditionHI,
- ConditionLS,
- ConditionGE,
- ConditionLT,
- ConditionGT,
- ConditionLE,
- ConditionAL,
-
- ConditionCS = ConditionHS,
- ConditionCC = ConditionLO,
- } Condition;
-
- class JmpSrc {
- friend class ARMv7Assembler;
- friend class ARMInstructionFormatter;
- public:
- JmpSrc()
- : m_offset(-1)
- {
- }
-
- private:
- JmpSrc(int offset)
- : m_offset(offset)
- {
- }
-
- int m_offset;
- };
-
- class JmpDst {
- friend class ARMv7Assembler;
- friend class ARMInstructionFormatter;
- public:
- JmpDst()
- : m_offset(-1)
- , m_used(false)
- {
- }
-
- bool isUsed() const { return m_used; }
- 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:
-
- struct LinkRecord {
- LinkRecord(intptr_t from, intptr_t to)
- : from(from)
- , to(to)
- {
- }
-
- intptr_t from;
- intptr_t to;
- };
-
- // ARMv7, Appx-A.6.3
- bool BadReg(RegisterID reg)
- {
- return (reg == ARMRegisters::sp) || (reg == ARMRegisters::pc);
- }
-
- bool isSingleRegister(FPRegisterID reg)
- {
- // Check that the high bit isn't set (q16+), and that the low bit isn't (s1, s3, etc).
- return !(reg & ~31);
- }
-
- bool isDoubleRegister(FPRegisterID reg)
- {
- // Check that the high bit isn't set (q16+), and that the low bit isn't (s1, s3, etc).
- return !(reg & ~(31 << 1));
- }
-
- bool isQuadRegister(FPRegisterID reg)
- {
- return !(reg & ~(31 << 2));
- }
-
- uint32_t singleRegisterNum(FPRegisterID reg)
- {
- ASSERT(isSingleRegister(reg));
- return reg;
- }
-
- uint32_t doubleRegisterNum(FPRegisterID reg)
- {
- ASSERT(isDoubleRegister(reg));
- return reg >> 1;
- }
-
- uint32_t quadRegisterNum(FPRegisterID reg)
- {
- ASSERT(isQuadRegister(reg));
- return reg >> 2;
- }
-
- uint32_t singleRegisterMask(FPRegisterID rd, int highBitsShift, int lowBitShift)
- {
- uint32_t rdNum = singleRegisterNum(rd);
- uint32_t rdMask = (rdNum >> 1) << highBitsShift;
- if (rdNum & 1)
- rdMask |= 1 << lowBitShift;
- return rdMask;
- }
-
- uint32_t doubleRegisterMask(FPRegisterID rd, int highBitShift, int lowBitsShift)
- {
- uint32_t rdNum = doubleRegisterNum(rd);
- uint32_t rdMask = (rdNum & 0xf) << lowBitsShift;
- if (rdNum & 16)
- rdMask |= 1 << highBitShift;
- return rdMask;
- }
-
- typedef enum {
- OP_ADD_reg_T1 = 0x1800,
- OP_ADD_S_reg_T1 = 0x1800,
- OP_SUB_reg_T1 = 0x1A00,
- OP_SUB_S_reg_T1 = 0x1A00,
- OP_ADD_imm_T1 = 0x1C00,
- OP_ADD_S_imm_T1 = 0x1C00,
- OP_SUB_imm_T1 = 0x1E00,
- OP_SUB_S_imm_T1 = 0x1E00,
- OP_MOV_imm_T1 = 0x2000,
- OP_CMP_imm_T1 = 0x2800,
- OP_ADD_imm_T2 = 0x3000,
- OP_ADD_S_imm_T2 = 0x3000,
- OP_SUB_imm_T2 = 0x3800,
- OP_SUB_S_imm_T2 = 0x3800,
- OP_AND_reg_T1 = 0x4000,
- OP_EOR_reg_T1 = 0x4040,
- OP_TST_reg_T1 = 0x4200,
- 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_AND_reg_T2 = 0xEA00,
- OP_TST_reg_T2 = 0xEA10,
- OP_ORR_reg_T2 = 0xEA40,
- 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_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_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_SMULL_T1 = 0xFB80,
- } OpcodeID1;
-
- typedef enum {
- OP_B_T4b = 0x9000,
- OP_NOP_T2b = 0x8000,
- } 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;
- ASSERT((condition != ConditionAL) || (mask & (mask - 1)));
- 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_S_imm_T1, (RegisterID)imm.getUInt3(), rn, rd);
- return;
- } else if ((rd == rn) && imm.isUInt8()) {
- m_formatter.oneWordOp5Reg3Imm8(OP_ADD_S_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_S_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()
- {
- m_formatter.twoWordOp16Op16(OP_B_T4a, OP_B_T4b);
- return JmpSrc(m_formatter.size());
- }
-
- // Only allowed in IT (if then) block if last instruction.
- JmpSrc blx(RegisterID rm)
- {
- ASSERT(rm != ARMRegisters::pc);
- m_formatter.oneWordOp8RegReg143(OP_BLX, rm, (RegisterID)8);
- return JmpSrc(m_formatter.size());
- }
-
- // Only allowed in IT (if then) block if last instruction.
- JmpSrc bx(RegisterID rm)
- {
- m_formatter.oneWordOp8RegReg143(OP_BX, rm, (RegisterID)0);
- return JmpSrc(m_formatter.size());
- }
-
- void bkpt(uint8_t imm=0)
- {
- m_formatter.oneWordOp8Imm8(OP_BKPT, imm);
- }
-
- 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 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 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, 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_S_imm_T1, (RegisterID)imm.getUInt3(), rn, rd);
- return;
- } else if ((rd == rn) && imm.isUInt8()) {
- m_formatter.oneWordOp5Reg3Imm8(OP_SUB_S_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_S_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(FPRegisterID rd, FPRegisterID rn, FPRegisterID rm)
- {
- m_formatter.vfpOp(0x0b00ee30 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rn, 23, 0) | doubleRegisterMask(rm, 21, 16));
- }
-
- void vcmp_F64(FPRegisterID rd, FPRegisterID rm)
- {
- m_formatter.vfpOp(0x0bc0eeb4 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rm, 21, 16));
- }
-
- void vcvt_F64_S32(FPRegisterID fd, FPRegisterID sm)
- {
- m_formatter.vfpOp(0x0bc0eeb8 | doubleRegisterMask(fd, 6, 28) | singleRegisterMask(sm, 16, 21));
- }
-
- void vcvt_S32_F64(FPRegisterID sd, FPRegisterID fm)
- {
- m_formatter.vfpOp(0x0bc0eebd | singleRegisterMask(sd, 28, 6) | doubleRegisterMask(fm, 21, 16));
- }
-
- void vldr(FPRegisterID rd, RegisterID rn, int32_t imm)
- {
- vmem(rd, rn, imm, true);
- }
-
- void vmov(RegisterID rd, FPRegisterID sn)
- {
- m_formatter.vfpOp(0x0a10ee10 | (rd << 28) | singleRegisterMask(sn, 0, 23));
- }
-
- void vmov(FPRegisterID sn, RegisterID rd)
- {
- m_formatter.vfpOp(0x0a10ee00 | (rd << 28) | singleRegisterMask(sn, 0, 23));
- }
-
- // move FPSCR flags to APSR.
- void vmrs_APSR_nzcv_FPSCR()
- {
- m_formatter.vfpOp(0xfa10eef1);
- }
-
- void vmul_F64(FPRegisterID rd, FPRegisterID rn, FPRegisterID rm)
- {
- m_formatter.vfpOp(0x0b00ee20 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rn, 23, 0) | doubleRegisterMask(rm, 21, 16));
- }
-
- void vstr(FPRegisterID rd, RegisterID rn, int32_t imm)
- {
- vmem(rd, rn, imm, false);
- }
-
- void vsub_F64(FPRegisterID rd, FPRegisterID rn, FPRegisterID rm)
- {
- m_formatter.vfpOp(0x0b40ee30 | doubleRegisterMask(rd, 6, 28) | doubleRegisterMask(rn, 23, 0) | doubleRegisterMask(rm, 21, 16));
- }
-
-
- 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;
- }
-
- // Assembler admin methods:
-
- size_t size() const
- {
- return m_formatter.size();
- }
-
- void* executableCopy(ExecutablePool* allocator)
- {
- void* copy = m_formatter.executableCopy(allocator);
-
- unsigned jumpCount = m_jumpsToLink.size();
- for (unsigned i = 0; i < jumpCount; ++i) {
- uint16_t* location = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(copy) + m_jumpsToLink[i].from);
- uint16_t* target = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(copy) + m_jumpsToLink[i].to);
- linkJumpAbsolute(location, target);
- }
- m_jumpsToLink.clear();
-
- ASSERT(copy);
- return copy;
- }
-
- 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));
- }
-
- 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);
-
- ExecutableAllocator::cacheFlush(reinterpret_cast<uint16_t*>(from) - 5, 4 * sizeof(uint16_t));
- }
-
- static void repatchInt32(void* where, int32_t value)
- {
- ASSERT(!(reinterpret_cast<intptr_t>(where) & 1));
-
- setInt32(where, value);
-
- ExecutableAllocator::cacheFlush(reinterpret_cast<uint16_t*>(where) - 4, 4 * sizeof(uint16_t));
- }
-
- static void repatchPointer(void* where, void* value)
- {
- ASSERT(!(reinterpret_cast<intptr_t>(where) & 1));
-
- setPointer(where, value);
-
- ExecutableAllocator::cacheFlush(reinterpret_cast<uint16_t*>(where) - 4, 4 * sizeof(uint16_t));
- }
-
- static void repatchLoadPtrToLEA(void* where)
- {
- ASSERT(!(reinterpret_cast<intptr_t>(where) & 1));
-
- uint16_t* loadOp = reinterpret_cast<uint16_t*>(where) + 4;
- ASSERT((*loadOp & 0xfff0) == OP_LDR_reg_T2);
-
- *loadOp = OP_ADD_reg_T3 | (*loadOp & 0xf);
- ExecutableAllocator::cacheFlush(loadOp, sizeof(uint16_t));
- }
-
-private:
-
- // 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 vmem(FPRegisterID rd, RegisterID rn, int32_t imm, bool isLoad)
- {
- bool up;
- uint32_t offset;
- if (imm < 0) {
- offset = -imm;
- up = false;
- } else {
- offset = imm;
- up = true;
- }
-
- // offset is effectively leftshifted by 2 already (the bottom two bits are zero, and not
- // reperesented in the instruction. Left shift by 14, to mov it into position 0x00AA0000.
- ASSERT((offset & ~(0xff << 2)) == 0);
- offset <<= 14;
-
- m_formatter.vfpOp(0x0b00ed00 | offset | (up << 7) | (isLoad << 4) | doubleRegisterMask(rd, 6, 28) | rn);
- }
-
- 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 void linkJumpAbsolute(uint16_t* instruction, void* target)
- {
- // FIMXE: this should be up in the MacroAssembler layer. :-(
- const uint16_t JUMP_TEMPORARY_REGISTER = ARMRegisters::ip;
-
- 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)) );
-
- intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
- if (((relative << 7) >> 7) == relative) {
- // 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));
- // 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;
- 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);
- } else {
- 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);
- }
-
- void vfpOp(int32_t op)
- {
- m_buffer.putInt(op);
- }
-
-
- // 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;
-};
-
-} // namespace JSC
-
-#endif // ENABLE(ASSEMBLER) && CPU(ARM_THUMB2)
-
-#endif // ARMAssembler_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h
deleted file mode 100644
index aad70e4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- * 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 <MacroAssemblerCodeRef.h>
-#include <CodeLocation.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::FPRegisterID FPRegisterID;
- 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;
- };
-
- // 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(void* value)
- : m_value(value)
- {
- }
-
- intptr_t asIntptr()
- {
- return reinterpret_cast<intptr_t>(m_value);
- }
-
- 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(); }
- 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())
- {
- }
-
- 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();
- }
-
- const JumpVector& jumps() { return m_jumps; }
-
- private:
- JumpVector m_jumps;
- };
-
-
- // Section 3: Misc admin methods
-
- static CodePtr trampolineAt(CodeRef ref, Label label)
- {
- return CodePtr(AssemblerType::getRelocatedAddress(ref.m_code.dataLocation(), label.m_label));
- }
-
- 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);
- }
-
-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/src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBuffer.h b/src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBuffer.h
deleted file mode 100644
index e2fb8a1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBuffer.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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>
-
-namespace JSC {
-
- class AssemblerBuffer {
- static const int inlineCapacity = 256;
- public:
- AssemblerBuffer()
- : m_buffer(m_inlineBuffer)
- , m_capacity(inlineCapacity)
- , m_size(0)
- {
- }
-
- ~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<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<int*>(&m_buffer[m_size]) = value;
- m_size += 4;
- }
-
- void putInt64Unchecked(int64_t value)
- {
- ASSERT(!(m_size > m_capacity - 8));
- *reinterpret_cast<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/src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
deleted file mode 100644
index b1c537e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * 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)
- {
- 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;
- m_maxDistance = maxPoolSize;
- }
-
- 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/src/3rdparty/webkit/JavaScriptCore/assembler/CodeLocation.h b/src/3rdparty/webkit/JavaScriptCore/assembler/CodeLocation.h
deleted file mode 100644
index cab28cd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/CodeLocation.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/assembler/LinkBuffer.h b/src/3rdparty/webkit/JavaScriptCore/assembler/LinkBuffer.h
deleted file mode 100644
index 47cac5a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/LinkBuffer.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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 LinkBuffer_h
-#define LinkBuffer_h
-
-#if ENABLE(ASSEMBLER)
-
-#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 MacroAssembler::Label Label;
- typedef MacroAssembler::Jump Jump;
- typedef MacroAssembler::JumpList JumpList;
- typedef MacroAssembler::Call Call;
- typedef MacroAssembler::DataLabel32 DataLabel32;
- typedef MacroAssembler::DataLabelPtr DataLabelPtr;
-
-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.
- LinkBuffer(MacroAssembler* masm, PassRefPtr<ExecutablePool> executablePool)
- : m_executablePool(executablePool)
- , m_code(masm->m_assembler.executableCopy(m_executablePool.get()))
- , m_size(masm->m_assembler.size())
-#ifndef NDEBUG
- , m_completed(false)
-#endif
- {
- }
-
- ~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));
- MacroAssembler::linkCall(code(), call, function);
- }
-
- void link(Jump jump, CodeLocationLabel label)
- {
- MacroAssembler::linkJump(code(), jump, label);
- }
-
- void link(JumpList list, CodeLocationLabel label)
- {
- for (unsigned i = 0; i < list.m_jumps.size(); ++i)
- MacroAssembler::linkJump(code(), list.m_jumps[i], label);
- }
-
- void patch(DataLabelPtr label, void* value)
- {
- MacroAssembler::linkPointer(code(), label.m_label, value);
- }
-
- void patch(DataLabelPtr label, CodeLocationLabel value)
- {
- MacroAssembler::linkPointer(code(), label.m_label, 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(), call.m_jmp));
- }
-
- CodeLocationNearCall locationOfNearCall(Call call)
- {
- ASSERT(call.isFlagSet(Call::Linkable));
- ASSERT(call.isFlagSet(Call::Near));
- return CodeLocationNearCall(MacroAssembler::getLinkerAddress(code(), call.m_jmp));
- }
-
- CodeLocationLabel locationOf(Label label)
- {
- return CodeLocationLabel(MacroAssembler::getLinkerAddress(code(), label.m_label));
- }
-
- CodeLocationDataLabelPtr locationOf(DataLabelPtr label)
- {
- return CodeLocationDataLabelPtr(MacroAssembler::getLinkerAddress(code(), label.m_label));
- }
-
- CodeLocationDataLabel32 locationOf(DataLabel32 label)
- {
- return CodeLocationDataLabel32(MacroAssembler::getLinkerAddress(code(), 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)
- {
- 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());
- }
-
-private:
- // Keep this private! - the underlying code should only be obtained externally via
- // finalizeCode() or finalizeCodeAddendum().
- void* code()
- {
- return m_code;
- }
-
- void performFinalization()
- {
-#ifndef NDEBUG
- ASSERT(!m_completed);
- m_completed = true;
-#endif
-
- ExecutableAllocator::makeExecutable(code(), m_size);
- ExecutableAllocator::cacheFlush(code(), m_size);
- }
-
- RefPtr<ExecutablePool> m_executablePool;
- void* m_code;
- size_t m_size;
-#ifndef NDEBUG
- bool m_completed;
-#endif
-};
-
-} // namespace JSC
-
-#endif // ENABLE(ASSEMBLER)
-
-#endif // LinkBuffer_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MIPSAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MIPSAssembler.h
deleted file mode 100644
index 0ab929d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MIPSAssembler.h
+++ /dev/null
@@ -1,935 +0,0 @@
-/*
- * 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; }
- 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 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 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 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 mfc1(RegisterID rt, FPRegisterID fs)
- {
- emitInst(0x44000000 | (fs << OP_SH_FS) | (rt << OP_SH_RT));
- copDelayNop();
- }
-
- 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 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 are converted to bne/beq/bc1f.
- */
-
- 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
- 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/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h
deleted file mode 100644
index e6f698f..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * 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)
- {
- set32(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);
- }
-#endif
-
-};
-
-} // namespace JSC
-
-#endif // ENABLE(ASSEMBLER)
-
-#endif // MacroAssembler_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp
deleted file mode 100644
index b5b20fa..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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
-
- return false;
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h
deleted file mode 100644
index 52c4fa2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h
+++ /dev/null
@@ -1,955 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc.
- * 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 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:
- 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 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 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::S0, address.base, m_assembler.lsl(address.index, address.scale));
- if (address.offset>=0)
- m_assembler.ldrh_u(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset));
- else
- m_assembler.ldrh_d(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset));
- }
-
- 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
- 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)
- {
- move(target, ARMRegisters::pc);
- }
-
- 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()
- {
- prepareCall();
- return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::LinkableNear);
- }
-
- Call call(RegisterID target)
- {
- prepareCall();
- move(ARMRegisters::pc, target);
- JmpSrc jmpSrc;
- return Call(jmpSrc, Call::None);
- }
-
- void call(Address address)
- {
- call32(address.base, address.offset);
- }
-
- void ret()
- {
- m_assembler.mov_r(ARMRegisters::pc, linkRegister);
- }
-
- void set32(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 set32(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 set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
- {
- // ARM doesn't have byte registers
- set32(cond, left, right, dest);
- }
-
- void set8(Condition cond, Address left, RegisterID right, RegisterID dest)
- {
- // ARM doesn't have byte registers
- load32(left, ARMRegisters::S1);
- set32(cond, ARMRegisters::S1, right, dest);
- }
-
- void set8(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
- {
- // ARM doesn't have byte registers
- set32(cond, left, right, dest);
- }
-
- void setTest32(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 setTest8(Condition cond, Address address, Imm32 mask, RegisterID dest)
- {
- // ARM doesn't have byte registers
- setTest32(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);
- }
-
- Call call()
- {
- prepareCall();
- return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::Linkable);
- }
-
- 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 false;
- }
-
- void loadDouble(ImplicitAddress address, FPRegisterID dest)
- {
- m_assembler.doubleTransfer(true, dest, address.base, address.offset);
- }
-
- void loadDouble(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.faddd_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.fdivd_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.fsubd_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.fmuld_r(dest, dest, src);
- }
-
- void mulDouble(Address src, FPRegisterID dest)
- {
- loadDouble(src, ARMRegisters::SD0);
- mulDouble(ARMRegisters::SD0, dest);
- }
-
- void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
- {
- m_assembler.fmsr_r(dest, src);
- m_assembler.fsitod_r(dest, dest);
- }
-
- 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.fcmpd_r(left, right);
- m_assembler.fmstat();
- 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).
- Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest)
- {
- UNUSED_PARAM(src);
- UNUSED_PARAM(dest);
- 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 fpTemp)
- {
- m_assembler.ftosid_r(ARMRegisters::SD0, src);
- m_assembler.fmrs_r(dest, ARMRegisters::SD0);
-
- // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump.
- m_assembler.fsitod_r(ARMRegisters::SD0, ARMRegisters::SD0);
- 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));
- }
-
- void zeroDouble(FPRegisterID srcDest)
- {
- m_assembler.mov_r(ARMRegisters::S0, ARMAssembler::getOp2(0));
- convertInt32ToDouble(ARMRegisters::S0, srcDest);
- }
-
-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()
- {
- ensureSpace(2 * sizeof(ARMWord), sizeof(ARMWord));
-
- m_assembler.mov_r(linkRegister, ARMRegisters::pc);
- }
-
- void call32(RegisterID base, int32_t offset)
- {
- if (base == ARMRegisters::sp)
- offset += 4;
-
- if (offset >= 0) {
- if (offset <= 0xfff) {
- prepareCall();
- m_assembler.dtr_u(true, ARMRegisters::pc, base, offset);
- } else if (offset <= 0xfffff) {
- m_assembler.add_r(ARMRegisters::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
- prepareCall();
- m_assembler.dtr_u(true, ARMRegisters::pc, ARMRegisters::S0, offset & 0xfff);
- } else {
- ARMWord reg = m_assembler.getImm(offset, ARMRegisters::S0);
- prepareCall();
- m_assembler.dtr_ur(true, ARMRegisters::pc, base, reg);
- }
- } else {
- offset = -offset;
- if (offset <= 0xfff) {
- prepareCall();
- m_assembler.dtr_d(true, ARMRegisters::pc, base, offset);
- } else if (offset <= 0xfffff) {
- m_assembler.sub_r(ARMRegisters::S0, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
- prepareCall();
- m_assembler.dtr_d(true, ARMRegisters::pc, ARMRegisters::S0, offset & 0xfff);
- } else {
- ARMWord reg = m_assembler.getImm(offset, ARMRegisters::S0);
- prepareCall();
- m_assembler.dtr_dr(true, ARMRegisters::pc, base, reg);
- }
- }
- }
-
-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/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h
deleted file mode 100644
index 3d08f0e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h
+++ /dev/null
@@ -1,1186 +0,0 @@
-/*
- * Copyright (C) 2009 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 ARMRegisters::RegisterID dataTempRegister = ARMRegisters::ip;
- static const RegisterID addressTempRegister = ARMRegisters::r3;
- static const FPRegisterID fpTempRegister = ARMRegisters::d7;
-
- 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:
-
- 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 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 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 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);
- }
-
- 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; }
-
- 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 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 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 convertInt32ToDouble(RegisterID src, FPRegisterID dest)
- {
- m_assembler.vmov(fpTempRegister, src);
- m_assembler.vcvt_F64_S32(dest, fpTempRegister);
- }
-
- Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
- {
- m_assembler.vcmp_F64(left, right);
- m_assembler.vmrs_APSR_nzcv_FPSCR();
-
- 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();
- }
-
-
- // 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);
- 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);
- }
-
- // Address is a memory location containing the address to jump to
- void jump(Address address)
- {
- load32(address, dataTempRegister);
- m_assembler.bx(dataTempRegister);
- }
-
-
- // 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(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(cond == Overflow);
- move(imm, dataTempRegister);
- m_assembler.smull(dest, dataTempRegister, src, dataTempRegister);
- m_assembler.asr(addressTempRegister, dest, 31);
- return branch32(NotEqual, addressTempRegister, dataTempRegister);
- }
-
- 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));
- }
-
-
- // Miscellaneous operations:
-
- void breakpoint()
- {
- m_assembler.bkpt();
- }
-
- Call nearCall()
- {
- moveFixedWidthEncoding(Imm32(0), dataTempRegister);
- return Call(m_assembler.blx(dataTempRegister), Call::LinkableNear);
- }
-
- Call call()
- {
- moveFixedWidthEncoding(Imm32(0), dataTempRegister);
- return Call(m_assembler.blx(dataTempRegister), Call::Linkable);
- }
-
- Call call(RegisterID target)
- {
- return Call(m_assembler.blx(target), Call::None);
- }
-
- Call call(Address address)
- {
- load32(address, dataTempRegister);
- return Call(m_assembler.blx(dataTempRegister), Call::None);
- }
-
- void ret()
- {
- m_assembler.bx(linkRegister);
- }
-
- void set32(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 set32(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));
- }
-
- // 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 setTest32(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 setTest8(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), Call::Linkable);
- }
-
- Call makeTailRecursiveCall(Jump oldJump)
- {
- oldJump.link(this);
- return tailRecursiveCall();
- }
-
-
-protected:
- ARMv7Assembler::JmpSrc makeJump()
- {
- moveFixedWidthEncoding(Imm32(0), dataTempRegister);
- return m_assembler.bx(dataTempRegister);
- }
-
- ARMv7Assembler::JmpSrc makeBranch(ARMv7Assembler::Condition cond)
- {
- m_assembler.it(cond, true, true);
- moveFixedWidthEncoding(Imm32(0), dataTempRegister);
- return m_assembler.bx(dataTempRegister);
- }
- 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());
- }
-};
-
-} // namespace JSC
-
-#endif // ENABLE(ASSEMBLER)
-
-#endif // MacroAssemblerARMv7_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
deleted file mode 100644
index 543b0fa..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerMIPS.h
deleted file mode 100644
index 27e30fc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerMIPS.h
+++ /dev/null
@@ -1,1658 +0,0 @@
-/*
- * 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:
-
- 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 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 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);
- }
-
- // 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)
- {
- 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;
- }
-
- Label loadPtrWithAddressOffsetPatch(Address address, RegisterID dest)
- {
- return loadPtrWithPatchToLEA(address, dest);
- }
-
- /* 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
- }
-
- // 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 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 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);
- }
-
- // 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 set32(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 set32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
- {
- move(right, immTempRegister);
- set32(cond, left, immTempRegister, dest);
- }
-
- void setTest32(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 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 convertInt32ToDouble(RegisterID src, FPRegisterID dest)
- {
- m_assembler.mtc1(src, 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.ceqd(left, right);
- return branchFalse(); // false
- }
- if (cond == DoubleGreaterThan) {
- m_assembler.cngtd(left, right);
- return branchFalse(); // false
- }
- if (cond == DoubleGreaterThanOrEqual) {
- m_assembler.cnged(right, left);
- 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 == 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));
- }
-
-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/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h
deleted file mode 100644
index 0366541..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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(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; }
-
-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/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h
deleted file mode 100644
index 073f563..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h
+++ /dev/null
@@ -1,1038 +0,0 @@
-/*
- * 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:
-
- 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 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);
- }
-
-
- // 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);
- }
-
- 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());
- }
-
- void zeroDouble(FPRegisterID srcDest)
- {
- ASSERT(isSSE2Present());
- m_assembler.xorpd_rr(srcDest, srcDest);
- }
-
-
- // 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 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 set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
- {
- m_assembler.cmpl_rr(right, left);
- m_assembler.setCC_r(x86Condition(cond), dest);
- }
-
- void set8(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 set8(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 set32(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 set32(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 setTest8(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 setTest32(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/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h
deleted file mode 100644
index b36c323..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * 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(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;
- }
-
- 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; }
-
-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/src/3rdparty/webkit/JavaScriptCore/assembler/RepatchBuffer.h b/src/3rdparty/webkit/JavaScriptCore/assembler/RepatchBuffer.h
deleted file mode 100644
index 72cf6b2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/RepatchBuffer.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h
deleted file mode 100644
index 57b811c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h
+++ /dev/null
@@ -1,2064 +0,0 @@
-/*
- * 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_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_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; }
- 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 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 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 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(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);
- }
-
- // 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, 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, 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/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
deleted file mode 100644
index 1f090a4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
+++ /dev/null
@@ -1,1719 +0,0 @@
-/*
- * 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 "CodeBlock.h"
-
-#include "JIT.h"
-#include "JSValue.h"
-#include "Interpreter.h"
-#include "JSFunction.h"
-#include "JSStaticScopeObject.h"
-#include "Debugger.h"
-#include "BytecodeGenerator.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;
- unsigned pos = 0;
- while ((pos = result.find('\"', pos)) != UString::NotFound) {
- result = makeString(result.substr(0, pos), "\"\\\"\"", result.substr(pos + 1));
- pos += 4;
- }
- return result;
-}
-
-static UString valueToSourceString(ExecState* exec, JSValue val)
-{
- if (!val)
- return "0";
-
- if (val.isString())
- return makeString("\"", escapeQuotes(val.toString(exec)), "\"");
-
- return val.toString(exec);
-}
-
-static CString constantName(ExecState* exec, int k, JSValue value)
-{
- return makeString(valueToSourceString(exec, value), "(@k", UString::from(k - FirstConstantRegisterIndex), ")").UTF8String();
-}
-
-static CString idName(int id0, const Identifier& ident)
-{
- return makeString(ident.ustring(), "(@id", UString::from(id0), ")").UTF8String();
-}
-
-CString CodeBlock::registerName(ExecState* exec, int r) const
-{
- if (r == missingThisObjectMarker())
- return "<null>";
-
- if (isConstantRegisterIndex(r))
- return constantName(exec, r, getConstant(r));
-
- return makeString("r", UString::from(r)).UTF8String();
-}
-
-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 makeString("/", regExp->pattern(), postfix);
-}
-
-static CString regexpName(int re, RegExp* regexp)
-{
- return makeString(regexpToSourceString(regexp), "(@re", UString::from(re), ")").UTF8String();
-}
-
-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).c_str(), registerName(exec, r1).c_str());
-}
-
-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).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str());
-}
-
-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).c_str(), 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).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str());
- 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).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str());
- it += 4;
-}
-
-#if ENABLE(JIT)
-static bool isGlobalResolve(OpcodeID opcodeID)
-{
- return opcodeID == op_resolve_global;
-}
-
-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).UTF8String().c_str());
-}
-
-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).UTF8String().c_str());
- return;
- case access_get_by_id_proto:
- printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(stubInfo.u.getByIdProto.baseObjectStructure).UTF8String().c_str(), pointerToSourceString(stubInfo.u.getByIdProto.prototypeStructure).UTF8String().c_str());
- return;
- case access_get_by_id_chain:
- printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(stubInfo.u.getByIdChain.baseObjectStructure).UTF8String().c_str(), pointerToSourceString(stubInfo.u.getByIdChain.chain).UTF8String().c_str());
- 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).UTF8String().c_str(), 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).UTF8String().c_str(), 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).UTF8String().c_str(), pointerToSourceString(stubInfo.u.putByIdTransition.structure).UTF8String().c_str(), pointerToSourceString(stubInfo.u.putByIdTransition.chain).UTF8String().c_str());
- return;
- case access_put_by_id_replace:
- printf(" [%4d] %s: %s\n", instructionOffset, "put_by_id_replace", pointerToSourceString(stubInfo.u.putByIdReplace.baseObjectStructure).UTF8String().c_str());
- 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).UTF8String().c_str());
-}
-
-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).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structure).UTF8String().c_str());
- 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).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structure).UTF8String().c_str(), pointerToSourceString(vPC[6].u.structureChain).UTF8String().c_str());
- 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).UTF8String().c_str(), pointerToSourceString(vPC[5].u.structureChain).UTF8String().c_str());
- 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;
- }
-
- // 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].ascii());
- ++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()).ascii());
- ++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()).ascii());
- ++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).ascii(), *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).ascii(), 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_enter_with_activation: {
- int r0 = (++it)->u.operand;
- printf("[%4d] enter_with_activation %s\n", location, registerName(exec, r0).c_str());
- break;
- }
- case op_create_arguments: {
- printf("[%4d] create_arguments\n", location);
- break;
- }
- case op_init_arguments: {
- printf("[%4d] init_arguments\n", location);
- break;
- }
- case op_convert_this: {
- int r0 = (++it)->u.operand;
- printf("[%4d] convert_this %s\n", location, registerName(exec, r0).c_str());
- break;
- }
- case op_new_object: {
- int r0 = (++it)->u.operand;
- printf("[%4d] new_object\t %s\n", location, registerName(exec, r0).c_str());
- 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).c_str(), registerName(exec, argv).c_str(), 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).c_str(), regexpName(re0, regexp(re0)).c_str());
- 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).c_str(), registerName(exec, r1).c_str());
- 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).c_str());
- break;
- }
- case op_pre_dec: {
- int r0 = (++it)->u.operand;
- printf("[%4d] pre_dec\t\t %s\n", location, registerName(exec, r0).c_str());
- 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_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).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str());
- 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).c_str(), idName(id0, m_identifiers[id0]).c_str());
- 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).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels);
- break;
- }
- case op_resolve_global: {
- int r0 = (++it)->u.operand;
- JSValue scope = JSValue((++it)->u.jsCell);
- int id0 = (++it)->u.operand;
- printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str());
- it += 2;
- 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).c_str(), 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).c_str());
- break;
- }
- case op_get_global_var: {
- int r0 = (++it)->u.operand;
- JSValue scope = JSValue((++it)->u.jsCell);
- int index = (++it)->u.operand;
- printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), index);
- break;
- }
- case op_put_global_var: {
- JSValue scope = JSValue((++it)->u.jsCell);
- int index = (++it)->u.operand;
- int r0 = (++it)->u.operand;
- printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName(exec, r0).c_str());
- break;
- }
- case op_resolve_base: {
- int r0 = (++it)->u.operand;
- int id0 = (++it)->u.operand;
- printf("[%4d] resolve_base\t %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str());
- 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_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).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str());
- 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).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), registerName(exec, r4).c_str(), registerName(exec, r5).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str());
- 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).c_str(), n0, registerName(exec, r1).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), 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).c_str(), registerName(exec, r1).c_str(), 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).c_str(), registerName(exec, r1).c_str(), 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).c_str(), registerName(exec, r1).c_str(), 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).c_str(), registerName(exec, r1).c_str(), 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).c_str(), registerName(exec, r1).c_str(), 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).c_str());
- 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).c_str());
- 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).c_str());
- break;
- }
- case op_new_func: {
- int r0 = (++it)->u.operand;
- int f0 = (++it)->u.operand;
- printf("[%4d] new_func\t\t %s, f%d\n", location, registerName(exec, r0).c_str(), f0);
- 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).c_str(), f0);
- break;
- }
- case op_call: {
- int dst = (++it)->u.operand;
- int func = (++it)->u.operand;
- int argCount = (++it)->u.operand;
- int registerOffset = (++it)->u.operand;
- printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset);
- break;
- }
- case op_call_eval: {
- int dst = (++it)->u.operand;
- int func = (++it)->u.operand;
- int argCount = (++it)->u.operand;
- int registerOffset = (++it)->u.operand;
- printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset);
- break;
- }
- case op_call_varargs: {
- int dst = (++it)->u.operand;
- int func = (++it)->u.operand;
- int argCount = (++it)->u.operand;
- int registerOffset = (++it)->u.operand;
- printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), registerName(exec, argCount).c_str(), registerOffset);
- break;
- }
- case op_load_varargs: {
- printUnaryOp(exec, location, it, "load_varargs");
- break;
- }
- case op_tear_off_activation: {
- int r0 = (++it)->u.operand;
- printf("[%4d] tear_off_activation\t %s\n", location, registerName(exec, r0).c_str());
- break;
- }
- case op_tear_off_arguments: {
- printf("[%4d] tear_off_arguments\n", location);
- break;
- }
- case op_ret: {
- int r0 = (++it)->u.operand;
- printf("[%4d] ret\t\t %s\n", location, registerName(exec, r0).c_str());
- break;
- }
- case op_construct: {
- int dst = (++it)->u.operand;
- int func = (++it)->u.operand;
- int argCount = (++it)->u.operand;
- int registerOffset = (++it)->u.operand;
- int proto = (++it)->u.operand;
- int thisRegister = (++it)->u.operand;
- printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset, registerName(exec, proto).c_str(), registerName(exec, thisRegister).c_str());
- break;
- }
- case op_construct_verify: {
- int r0 = (++it)->u.operand;
- int r1 = (++it)->u.operand;
- printf("[%4d] construct_verify\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), 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).c_str(), registerName(exec, r1).c_str());
- 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).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), offset, location + offset);
- it += OPCODE_LENGTH(op_get_pnames) - 1;
- break;
- }
- case op_next_pname: {
- int dest = it[1].u.operand;
- int iter = it[4].u.operand;
- int offset = it[5].u.operand;
- printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(exec, dest).c_str(), registerName(exec, iter).c_str(), 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).c_str());
- 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).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str());
- 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).c_str());
- break;
- }
- case op_throw: {
- int r0 = (++it)->u.operand;
- printf("[%4d] throw\t\t %s\n", location, registerName(exec, r0).c_str());
- break;
- }
- case op_new_error: {
- int r0 = (++it)->u.operand;
- int errorType = (++it)->u.operand;
- int k0 = (++it)->u.operand;
- printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(exec, r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str());
- 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).c_str(), offset, location + offset);
- break;
- }
- case op_sret: {
- int retAddrSrc = (++it)->u.operand;
- printf("[%4d] sret\t\t %s\n", location, registerName(exec, retAddrSrc).c_str());
- 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).c_str());
- break;
- }
- case op_profile_did_call: {
- int function = (++it)->u.operand;
- printf("[%4d] profile_did_call\t %s\n", location, registerName(exec, function).c_str());
- break;
- }
- case op_end: {
- int r0 = (++it)->u.operand;
- printf("[%4d] end\t\t %s\n", location, registerName(exec, r0).c_str());
- 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(functionRegisterInfos)
-
-#define FOR_EACH_MEMBER_VECTOR_EXCEPTION_INFO(macro) \
- macro(expressionInfo) \
- macro(lineInfo) \
- macro(getByIdExceptionInfo) \
- macro(pcVector)
-
-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)
- FOR_EACH_MEMBER_VECTOR_EXCEPTION_INFO(DEFINE_VARS)
- #undef DEFINE_VARS
-
- // Non-vector data members
- size_t evalCodeCacheIsNotEmpty = 0;
-
- size_t symbolTableIsNotEmpty = 0;
- size_t symbolTableTotalSize = 0;
-
- size_t hasExceptionInfo = 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_exceptionInfo) {
- hasExceptionInfo++;
- #define GET_STATS(name) if (!codeBlock->m_exceptionInfo->m_##name.isEmpty()) { name##IsNotEmpty++; name##TotalSize += sizeInBytes(codeBlock->m_exceptionInfo->m_##name); }
- FOR_EACH_MEMBER_VECTOR_EXCEPTION_INFO(GET_STATS)
- #undef GET_STATS
- }
-
- 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)
- FOR_EACH_MEMBER_VECTOR_EXCEPTION_INFO(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 exception info: %zu (%.3f%%)\n", hasExceptionInfo, static_cast<double>(hasExceptionInfo) * 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)
- FOR_EACH_MEMBER_VECTOR_EXCEPTION_INFO(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, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, SymbolTable* symTab)
- : m_numCalleeRegisters(0)
- , m_numVars(0)
- , m_numParameters(0)
- , m_ownerExecutable(ownerExecutable)
- , m_globalData(0)
-#ifndef NDEBUG
- , m_instructionCount(0)
-#endif
- , m_needsFullScopeChain(ownerExecutable->needsActivation())
- , m_usesEval(ownerExecutable->usesEval())
- , m_isNumericCompareFunction(false)
- , m_codeType(codeType)
- , m_source(sourceProvider)
- , m_sourceOffset(sourceOffset)
- , m_symbolTable(symTab)
- , m_exceptionInfo(new ExceptionInfo)
-{
- ASSERT(m_source);
-
-#if DUMP_CODE_BLOCK_STATISTICS
- liveCodeBlockSet.add(this);
-#endif
-}
-
-CodeBlock::~CodeBlock()
-{
-#if !ENABLE(JIT)
- 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]]);
-#else
- 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::unlinkCall(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[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[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)) {
- if(vPC[4].u.structure)
- vPC[4].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))) {
- 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[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[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);
-}
-
-void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
-{
- if (m_exceptionInfo)
- return;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- if (m_needsFullScopeChain) {
- ScopeChain sc(scopeChain);
- int scopeDelta = sc.localDepth();
- if (m_codeType == EvalCode)
- scopeDelta -= static_cast<EvalCodeBlock*>(this)->baseScopeDepth();
- else if (m_codeType == FunctionCode)
- scopeDelta++; // Compilation of function code assumes activation is not on the scope chain yet.
- ASSERT(scopeDelta >= 0);
- while (scopeDelta--)
- scopeChain = scopeChain->next;
- }
-
- m_exceptionInfo.set(m_ownerExecutable->reparseExceptionInfo(m_globalData, scopeChain, this));
-}
-
-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(CallFrame* callFrame, unsigned bytecodeOffset)
-{
- ASSERT(bytecodeOffset < m_instructionCount);
-
- reparseForExceptionInfoIfNecessary(callFrame);
- ASSERT(m_exceptionInfo);
-
- if (!m_exceptionInfo->m_lineInfo.size())
- return m_ownerExecutable->source().firstLine(); // Empty function
-
- int low = 0;
- int high = m_exceptionInfo->m_lineInfo.size();
- while (low < high) {
- int mid = low + (high - low) / 2;
- if (m_exceptionInfo->m_lineInfo[mid].instructionOffset <= bytecodeOffset)
- low = mid + 1;
- else
- high = mid;
- }
-
- if (!low)
- return m_ownerExecutable->source().firstLine();
- return m_exceptionInfo->m_lineInfo[low - 1].lineNumber;
-}
-
-int CodeBlock::expressionRangeForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset)
-{
- ASSERT(bytecodeOffset < m_instructionCount);
-
- reparseForExceptionInfoIfNecessary(callFrame);
- ASSERT(m_exceptionInfo);
-
- if (!m_exceptionInfo->m_expressionInfo.size()) {
- // We didn't think anything could throw. Apparently we were wrong.
- startOffset = 0;
- endOffset = 0;
- divot = 0;
- return lineNumberForBytecodeOffset(callFrame, bytecodeOffset);
- }
-
- int low = 0;
- int high = m_exceptionInfo->m_expressionInfo.size();
- while (low < high) {
- int mid = low + (high - low) / 2;
- if (m_exceptionInfo->m_expressionInfo[mid].instructionOffset <= bytecodeOffset)
- low = mid + 1;
- else
- high = mid;
- }
-
- ASSERT(low);
- if (!low) {
- startOffset = 0;
- endOffset = 0;
- divot = 0;
- return lineNumberForBytecodeOffset(callFrame, bytecodeOffset);
- }
-
- startOffset = m_exceptionInfo->m_expressionInfo[low - 1].startOffset;
- endOffset = m_exceptionInfo->m_expressionInfo[low - 1].endOffset;
- divot = m_exceptionInfo->m_expressionInfo[low - 1].divotPoint + m_sourceOffset;
- return lineNumberForBytecodeOffset(callFrame, bytecodeOffset);
-}
-
-bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, OpcodeID& opcodeID)
-{
- ASSERT(bytecodeOffset < m_instructionCount);
-
- reparseForExceptionInfoIfNecessary(callFrame);
- ASSERT(m_exceptionInfo);
-
- if (!m_exceptionInfo->m_getByIdExceptionInfo.size())
- return false;
-
- int low = 0;
- int high = m_exceptionInfo->m_getByIdExceptionInfo.size();
- while (low < high) {
- int mid = low + (high - low) / 2;
- if (m_exceptionInfo->m_getByIdExceptionInfo[mid].bytecodeOffset <= bytecodeOffset)
- low = mid + 1;
- else
- high = mid;
- }
-
- if (!low || m_exceptionInfo->m_getByIdExceptionInfo[low - 1].bytecodeOffset != bytecodeOffset)
- return false;
-
- opcodeID = m_exceptionInfo->m_getByIdExceptionInfo[low - 1].isOpConstruct ? op_construct : op_instanceof;
- return true;
-}
-
-#if ENABLE(JIT)
-bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex)
-{
- ASSERT(bytecodeOffset < m_instructionCount);
-
- if (!m_rareData || !m_rareData->m_functionRegisterInfos.size())
- return false;
-
- int low = 0;
- int high = m_rareData->m_functionRegisterInfos.size();
- while (low < high) {
- int mid = low + (high - low) / 2;
- if (m_rareData->m_functionRegisterInfos[mid].bytecodeOffset <= bytecodeOffset)
- low = mid + 1;
- else
- high = mid;
- }
-
- if (!low || m_rareData->m_functionRegisterInfos[low - 1].bytecodeOffset != bytecodeOffset)
- return false;
-
- functionRegisterIndex = m_rareData->m_functionRegisterInfos[low - 1].functionRegisterIndex;
- return true;
-}
-#endif
-
-#if !ENABLE(JIT)
-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;
-}
-#else
-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(JIT)
- m_propertyAccessInstructions.shrinkToFit();
- m_globalResolveInstructions.shrinkToFit();
-#else
- 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_exceptionInfo) {
- m_exceptionInfo->m_expressionInfo.shrinkToFit();
- m_exceptionInfo->m_lineInfo.shrinkToFit();
- m_exceptionInfo->m_getByIdExceptionInfo.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();
-#if ENABLE(JIT)
- m_rareData->m_functionRegisterInfos.shrinkToFit();
-#endif
- }
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
deleted file mode 100644
index d92dc9d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * 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 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/RefPtr.h>
-#include <wtf/Vector.h>
-
-#if ENABLE(JIT)
-#include "StructureStubInfo.h"
-#endif
-
-// Register numbers used in bytecode operations have different meaning accoring to their ranges:
-// 0x80000000-0xFFFFFFFF Negative indicies 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 };
-
- 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;
- };
-
- // Both op_construct and op_instanceof require a use of op_get_by_id to get
- // the prototype property from an object. The exception messages for exceptions
- // thrown by these instances op_get_by_id need to reflect this.
- struct GetByIdExceptionInfo {
- unsigned bytecodeOffset : 31;
- bool isOpConstruct : 1;
- };
-
-#if ENABLE(JIT)
- struct CallLinkInfo {
- CallLinkInfo()
- : callee(0)
- {
- }
-
- unsigned bytecodeIndex;
- 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 FunctionRegisterInfo {
- FunctionRegisterInfo(unsigned bytecodeOffset, int functionRegisterIndex)
- : bytecodeOffset(bytecodeOffset)
- , functionRegisterIndex(functionRegisterIndex)
- {
- }
-
- unsigned bytecodeOffset;
- int functionRegisterIndex;
- };
-
- 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 CallReturnOffsetToBytecodeIndex {
- CallReturnOffsetToBytecodeIndex(unsigned callReturnOffset, unsigned bytecodeIndex)
- : callReturnOffset(callReturnOffset)
- , bytecodeIndex(bytecodeIndex)
- {
- }
-
- unsigned callReturnOffset;
- unsigned bytecodeIndex;
- };
-
- // 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(CallReturnOffsetToBytecodeIndex* 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
-
- struct ExceptionInfo : FastAllocBase {
- Vector<ExpressionRangeInfo> m_expressionInfo;
- Vector<LineInfo> m_lineInfo;
- Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo;
-
-#if ENABLE(JIT)
- Vector<CallReturnOffsetToBytecodeIndex> m_callReturnIndexVector;
-#endif
- };
-
- class CodeBlock : public FastAllocBase {
- friend class JIT;
- protected:
- CodeBlock(ScriptExecutable* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable);
- 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
-
- inline bool isKnownNotImmediate(int index)
- {
- if (index == m_thisRegister)
- 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(CallFrame*, unsigned bytecodeOffset);
- int expressionRangeForBytecodeOffset(CallFrame*, unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset);
- bool getByIdExceptionInfoForBytecodeOffset(CallFrame*, unsigned bytecodeOffset, OpcodeID&);
-
-#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 getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress)
- {
- reparseForExceptionInfoIfNecessary(callFrame);
- return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerExecutable()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
- }
-
- bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex);
-#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 ownerExecutable()->generatedJITCode(); }
- ExecutablePool* executablePool() { return ownerExecutable()->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 setUsesArguments(bool usesArguments) { m_usesArguments = usesArguments; }
- bool usesArguments() const { return m_usesArguments; }
-
- 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(); }
-
-#if !ENABLE(JIT)
- void addPropertyAccessInstruction(unsigned propertyAccessInstruction) { m_propertyAccessInstructions.append(propertyAccessInstruction); }
- void addGlobalResolveInstruction(unsigned globalResolveInstruction) { m_globalResolveInstructions.append(globalResolveInstruction); }
- bool hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset);
-#else
- 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]; }
-
- void addFunctionRegisterInfo(unsigned bytecodeOffset, int functionIndex) { createRareDataIfNecessary(); m_rareData->m_functionRegisterInfos.append(FunctionRegisterInfo(bytecodeOffset, functionIndex)); }
-#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]; }
-
- bool hasExceptionInfo() const { return m_exceptionInfo; }
- void clearExceptionInfo() { m_exceptionInfo.clear(); }
- ExceptionInfo* extractExceptionInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo.release(); }
-
- void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_expressionInfo.append(expressionInfo); }
- void addGetByIdExceptionInfo(const GetByIdExceptionInfo& info) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_getByIdExceptionInfo.append(info); }
-
- size_t numberOfLineInfos() const { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_lineInfo.size(); }
- void addLineInfo(const LineInfo& lineInfo) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_lineInfo.append(lineInfo); }
- LineInfo& lastLineInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_lineInfo.last(); }
-
-#if ENABLE(JIT)
- Vector<CallReturnOffsetToBytecodeIndex>& callReturnIndexVector() { ASSERT(m_exceptionInfo); return m_exceptionInfo->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(); }
-
-
- // 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_numParameters;
-
- 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 reparseForExceptionInfoIfNecessary(CallFrame*);
-
- void createRareDataIfNecessary()
- {
- if (!m_rareData)
- m_rareData.set(new RareData);
- }
-
- ScriptExecutable* m_ownerExecutable;
- JSGlobalData* m_globalData;
-
- Vector<Instruction> m_instructions;
-#ifndef NDEBUG
- unsigned m_instructionCount;
-#endif
-
- int m_thisRegister;
-
- bool m_needsFullScopeChain;
- bool m_usesEval;
- bool m_usesArguments;
- bool m_isNumericCompareFunction;
-
- CodeType m_codeType;
-
- RefPtr<SourceProvider> m_source;
- unsigned m_sourceOffset;
-
-#if !ENABLE(JIT)
- Vector<unsigned> m_propertyAccessInstructions;
- Vector<unsigned> m_globalResolveInstructions;
-#else
- 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;
-
- OwnPtr<ExceptionInfo> m_exceptionInfo;
-
- 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;
-
-#if ENABLE(JIT)
- Vector<FunctionRegisterInfo> m_functionRegisterInfos;
-#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, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject)
- : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, &m_unsharedSymbolTable)
- , m_globalObject(globalObject)
- {
- m_globalObject->codeBlocks().add(this);
- }
-
- ~GlobalCodeBlock()
- {
- if (m_globalObject)
- m_globalObject->codeBlocks().remove(this);
- }
-
- void clearGlobalObject() { m_globalObject = 0; }
-
- private:
- JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
- SymbolTable m_unsharedSymbolTable;
- };
-
- class ProgramCodeBlock : public GlobalCodeBlock {
- public:
- ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
- : GlobalCodeBlock(ownerExecutable, codeType, sourceProvider, 0, globalObject)
- {
- }
- };
-
- class EvalCodeBlock : public GlobalCodeBlock {
- public:
- EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
- : GlobalCodeBlock(ownerExecutable, EvalCode, sourceProvider, 0, globalObject)
- , 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, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
- : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, new SharedSymbolTable)
- {
- }
- ~FunctionCodeBlock()
- {
- sharedSymbolTable()->deref();
- }
- };
-
- inline Register& ExecState::r(int index)
- {
- CodeBlock* codeBlock = this->codeBlock();
- if (codeBlock->isConstantRegisterIndex(index))
- return codeBlock->constantRegister(index);
- return this[index];
- }
-
-} // namespace JSC
-
-#endif // CodeBlock_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h
deleted file mode 100644
index a036dd4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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>
-
-namespace JSC {
-
- class EvalCodeCache {
- public:
- PassRefPtr<EvalExecutable> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
- {
- RefPtr<EvalExecutable> evalExecutable;
-
- if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject())
- evalExecutable = m_cacheMap.get(evalSource.rep());
-
- if (!evalExecutable) {
- evalExecutable = EvalExecutable::create(exec, makeSource(evalSource));
- exceptionValue = evalExecutable->compile(exec, scopeChain);
- if (exceptionValue)
- return 0;
-
- if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries)
- m_cacheMap.set(evalSource.rep(), 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<UString::Rep>, RefPtr<EvalExecutable> > EvalCacheMap;
- EvalCacheMap m_cacheMap;
- };
-
-} // namespace JSC
-
-#endif // EvalCodeCache_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h
deleted file mode 100644
index ab6659f..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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 !HAVE(COMPUTED_GOTO)
- // 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/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.cpp
deleted file mode 100644
index 175c1b3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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"
-
-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/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h
deleted file mode 100644
index b4f8e44..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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<UString::Rep>, OffsetLocation> StringOffsetTable;
- StringOffsetTable offsetTable;
-#if ENABLE(JIT)
- CodeLocationLabel ctiDefault; // FIXME: it should not be necessary to store this.
-#endif
-
- inline int32_t offsetForValue(UString::Rep* 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(UString::Rep* 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/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.cpp
deleted file mode 100644
index bb7696d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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"
-
-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];
-
- int sortedIndices[numOpcodeIDs];
- for (int i = 0; i < numOpcodeIDs; ++i)
- sortedIndices[i] = i;
- qsort(sortedIndices, 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/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h
deleted file mode 100644
index f7f53fd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * 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_enter_with_activation, 2) \
- macro(op_init_arguments, 1) \
- macro(op_create_arguments, 1) \
- macro(op_convert_this, 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_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, 6) \
- macro(op_get_scoped_var, 4) \
- macro(op_put_scoped_var, 4) \
- macro(op_get_global_var, 4) \
- macro(op_put_global_var, 4) \
- macro(op_resolve_base, 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_put_by_id, 8) \
- macro(op_put_by_id_transition, 8) \
- macro(op_put_by_id_replace, 8) \
- macro(op_put_by_id_generic, 8) \
- macro(op_del_by_id, 4) \
- macro(op_get_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_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, 3) \
- macro(op_new_func_exp, 3) \
- macro(op_call, 5) \
- macro(op_call_eval, 5) \
- macro(op_call_varargs, 5) \
- macro(op_load_varargs, 3) \
- macro(op_tear_off_activation, 2) \
- macro(op_tear_off_arguments, 1) \
- macro(op_ret, 2) \
- macro(op_method_check, 1) \
- \
- macro(op_construct, 7) \
- macro(op_construct_verify, 3) \
- 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_new_error, 4) \
- \
- 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 HAVE(COMPUTED_GOTO)
-#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
-
-} // namespace JSC
-
-#endif // Opcode_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp
deleted file mode 100644
index 3f0babc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * 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 = 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().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 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(exec, 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/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h
deleted file mode 100644
index 8e3ed9e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.cpp
deleted file mode 100644
index 018d832..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h
deleted file mode 100644
index 8e2c489..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
deleted file mode 100644
index e46bb15..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ /dev/null
@@ -1,2017 +0,0 @@
-/*
- * 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->setIsNumericCompareFunction(instructions() == m_globalData->numericCompareFunction(m_scopeChain->globalObject()->globalExec()));
-
-#if !ENABLE(OPCODE_SAMPLING)
- if (!m_regeneratingForExceptionInfo && (m_codeType == FunctionCode || m_codeType == EvalCode))
- m_codeBlock->clearExceptionInfo();
-#endif
-
- 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.ustring().rep(), newEntry);
-
- if (!result.second) {
- r0 = &registerFor(result.first->second.getIndex());
- return false;
- }
-
- ++m_codeBlock->m_numVars;
- r0 = newRegister();
- 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.ustring().rep(), 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 Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, ProgramCodeBlock* codeBlock)
- : m_shouldEmitDebugHooks(!!debugger)
- , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
- , 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_globalData(&scopeChain.globalObject()->globalExec()->globalData())
- , m_lastOpcodeID(op_end)
- , m_emitNodeDepth(0)
- , 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();
- }
-}
-
-BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, CodeBlock* codeBlock)
- : m_shouldEmitDebugHooks(!!debugger)
- , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
- , m_scopeChain(&scopeChain)
- , m_symbolTable(symbolTable)
- , m_scopeNode(functionBody)
- , m_codeBlock(codeBlock)
- , m_finallyDepth(0)
- , m_dynamicScopeDepth(0)
- , m_baseScopeDepth(0)
- , m_codeType(FunctionCode)
- , m_nextConstantOffset(0)
- , m_globalConstantIndex(0)
- , m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
- , m_lastOpcodeID(op_end)
- , m_emitNodeDepth(0)
- , m_regeneratingForExceptionInfo(false)
- , m_codeBlockBeingRegeneratedFrom(0)
-{
- if (m_shouldEmitDebugHooks)
- m_codeBlock->setNeedsFullScopeChain(true);
-
- codeBlock->setGlobalData(m_globalData);
-
- bool usesArguments = functionBody->usesArguments();
- codeBlock->setUsesArguments(usesArguments);
- if (usesArguments) {
- m_argumentsRegister.setIndex(RegisterFile::OptionalCalleeArguments);
- addVar(propertyNames().arguments, false);
- }
-
- if (m_codeBlock->needsFullScopeChain()) {
- ++m_codeBlock->m_numVars;
- m_activationRegisterIndex = newRegister()->index();
- emitOpcode(op_enter_with_activation);
- instructions().append(m_activationRegisterIndex);
- } else
- emitOpcode(op_enter);
-
- if (usesArguments) {
- emitOpcode(op_init_arguments);
-
- // 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);
- }
-
- const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack();
- for (size_t i = 0; i < functionStack.size(); ++i) {
- FunctionBodyNode* function = functionStack[i];
- const Identifier& ident = function->ident();
- m_functions.add(ident.ustring().rep());
- emitNewFunction(addVar(ident, false), function);
- }
-
- const DeclarationStacks::VarStack& varStack = functionBody->varStack();
- for (size_t i = 0; i < varStack.size(); ++i)
- addVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant);
-
- FunctionParameters& parameters = *functionBody->parameters();
- size_t parameterCount = parameters.size();
- m_nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1;
- m_parameters.grow(1 + parameterCount); // reserve space for "this"
-
- // Add "this" as a parameter
- m_thisRegister.setIndex(m_nextParameterIndex);
- ++m_nextParameterIndex;
- ++m_codeBlock->m_numParameters;
-
- if (functionBody->usesThis() || m_shouldEmitDebugHooks) {
- emitOpcode(op_convert_this);
- instructions().append(m_thisRegister.index());
- }
-
- for (size_t i = 0; i < parameterCount; ++i)
- addParameter(parameters[i]);
-
- preserveLastVar();
-}
-
-BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, EvalCodeBlock* codeBlock)
- : m_shouldEmitDebugHooks(!!debugger)
- , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
- , 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_globalData(&scopeChain.globalObject()->globalExec()->globalData())
- , m_lastOpcodeID(op_end)
- , m_emitNodeDepth(0)
- , 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);
-
- preserveLastVar();
-}
-
-RegisterID* BytecodeGenerator::addParameter(const Identifier& ident)
-{
- // Parameters overwrite var declarations, but not function declarations.
- RegisterID* result = 0;
- UString::Rep* rep = ident.ustring().rep();
- if (!m_functions.contains(rep)) {
- symbolTable().set(rep, m_nextParameterIndex);
- RegisterID& parameter = registerFor(m_nextParameterIndex);
- parameter.setIndex(m_nextParameterIndex);
- result = &parameter;
- }
-
- // 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_nextParameterIndex;
- ++m_codeBlock->m_numParameters;
- return result;
-}
-
-RegisterID* BytecodeGenerator::registerFor(const Identifier& ident)
-{
- if (ident == propertyNames().thisIdentifier)
- return &m_thisRegister;
-
- if (!shouldOptimizeLocals())
- return 0;
-
- SymbolTableEntry entry = symbolTable().get(ident.ustring().rep());
- if (entry.isNull())
- return 0;
-
- if (ident == propertyNames().arguments)
- createArgumentsIfNecessary();
-
- return &registerFor(entry.getIndex());
-}
-
-bool BytecodeGenerator::willResolveToArguments(const Identifier& ident)
-{
- if (ident != propertyNames().arguments)
- return false;
-
- if (!shouldOptimizeLocals())
- return false;
-
- SymbolTableEntry entry = symbolTable().get(ident.ustring().rep());
- 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.ustring().rep());
- ASSERT(!entry.isNull());
- return &registerFor(entry.getIndex());
-}
-
-RegisterID* BytecodeGenerator::constRegisterFor(const Identifier& ident)
-{
- if (m_codeType == EvalCode)
- return 0;
-
- SymbolTableEntry entry = symbolTable().get(ident.ustring().rep());
- if (entry.isNull())
- return 0;
-
- return &registerFor(entry.getIndex());
-}
-
-bool BytecodeGenerator::isLocal(const Identifier& ident)
-{
- if (ident == propertyNames().thisIdentifier)
- return true;
-
- return shouldOptimizeLocals() && symbolTable().contains(ident.ustring().rep());
-}
-
-bool BytecodeGenerator::isLocalConstant(const Identifier& ident)
-{
- return symbolTable().get(ident.ustring().rep()).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)
-{
- 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);
-}
-
-void ALWAYS_INLINE BytecodeGenerator::rewindUnaryOp()
-{
- ASSERT(instructions().size() >= 3);
- instructions().shrink(instructions().size() - 3);
-}
-
-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 && !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_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)
-{
- UString::Rep* rep = ident.ustring().rep();
- 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(globalData(), number));
- JSValue& valueInMap = m_numberMap.add(number, JSValue()).first->second;
- if (!valueInMap)
- valueInMap = jsNumber(globalData(), number);
- return emitLoad(dst, valueInMap);
-}
-
-RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, const Identifier& identifier)
-{
- JSString*& stringInMap = m_stringMap.add(identifier.ustring().rep(), 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, 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;
-
- 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.ustring().rep());
-
- // Found the property
- if (!entry.isNull()) {
- if (entry.isReadOnly() && forWriting) {
- stackDepth = 0;
- index = missingSymbolMarker();
- if (++iter == end)
- globalObject = currentVariableObject;
- return false;
- }
- stackDepth = depth;
- index = entry.getIndex();
- if (++iter == end)
- globalObject = currentVariableObject;
- return true;
- }
- if (currentVariableObject->isDynamicScope())
- break;
- }
-
- // Can't locate the property but we're able to avoid a few lookups.
- stackDepth = depth;
- index = missingSymbolMarker();
- JSObject* scope = *iter;
- if (++iter == end)
- globalObject = scope;
- return true;
-}
-
-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;
- if (!findScopedProperty(property, index, depth, false, 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) {
- // 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(op_resolve_global);
- instructions().append(dst->index());
- instructions().append(globalObject);
- instructions().append(addConstant(property));
- instructions().append(0);
- instructions().append(0);
- 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(asCell(globalObject));
- 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(asCell(globalObject));
- 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;
- findScopedProperty(property, index, depth, false, globalObject);
- if (!globalObject) {
- // We can't optimise at all :-(
- emitOpcode(op_resolve_base);
- instructions().append(dst->index());
- instructions().append(addConstant(property));
- return dst;
- }
-
- // Global object is the base
- return emitLoad(dst, JSValue(globalObject));
-}
-
-RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property)
-{
- size_t depth = 0;
- int index = 0;
- JSObject* globalObject = 0;
- if (!findScopedProperty(property, index, depth, false, globalObject) || !globalObject) {
- // 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(op_resolve_global);
- instructions().append(propDst->index());
- instructions().append(globalObject);
- instructions().append(addConstant(property));
- instructions().append(0);
- instructions().append(0);
- 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::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);
- 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::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)
-{
- unsigned index = m_codeBlock->addFunctionDecl(makeFunction(m_globalData, function));
-
- emitOpcode(op_new_func);
- instructions().append(dst->index());
- instructions().append(index);
- 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));
-
- emitOpcode(op_new_func_exp);
- instructions().append(r0->index());
- instructions().append(index);
- return r0;
-}
-
-RegisterID* BytecodeGenerator::emitCall(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
-{
- return emitCall(op_call, dst, func, thisRegister, argumentsNode, divot, startOffset, endOffset);
-}
-
-void BytecodeGenerator::createArgumentsIfNecessary()
-{
- if (m_codeBlock->usesArguments() && m_codeType == FunctionCode)
- emitOpcode(op_create_arguments);
-}
-
-RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
-{
- createArgumentsIfNecessary();
- return emitCall(op_call_eval, dst, func, thisRegister, argumentsNode, divot, startOffset, endOffset);
-}
-
-RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
-{
- ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
- ASSERT(func->refCount());
- ASSERT(thisRegister->refCount());
-
- RegisterID* originalFunc = func;
- if (m_shouldEmitProfileHooks) {
- // If codegen decided to recycle func as this call's destination register,
- // we need to undo that optimization here so that func will still be around
- // for the sake of op_profile_did_call.
- if (dst == func) {
- RefPtr<RegisterID> movedThisRegister = emitMove(newTemporary(), thisRegister);
- RefPtr<RegisterID> movedFunc = emitMove(thisRegister, func);
-
- thisRegister = movedThisRegister.release().releaseRef();
- func = movedFunc.release().releaseRef();
- }
- }
-
- // Generate code for arguments.
- Vector<RefPtr<RegisterID>, 16> argv;
- argv.append(thisRegister);
- for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) {
- argv.append(newTemporary());
- // op_call requires the arguments to be a sequential range of registers
- ASSERT(argv[argv.size() - 1]->index() == argv[argv.size() - 2]->index() + 1);
- emitNode(argv.last().get(), 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(func->index());
-
-#if ENABLE(JIT)
- m_codeBlock->addFunctionRegisterInfo(instructions().size(), func->index());
-#endif
- }
-
- emitExpressionInfo(divot, startOffset, endOffset);
-
-#if ENABLE(JIT)
- m_codeBlock->addCallLinkInfo();
-#endif
-
- // Emit call.
- emitOpcode(opcodeID);
- instructions().append(dst->index()); // dst
- instructions().append(func->index()); // func
- instructions().append(argv.size()); // argCount
- instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset
-
- if (m_shouldEmitProfileHooks) {
- emitOpcode(op_profile_did_call);
- instructions().append(func->index());
-
- if (dst == originalFunc) {
- thisRegister->deref();
- func->deref();
- }
- }
-
- return dst;
-}
-
-RegisterID* BytecodeGenerator::emitLoadVarargs(RegisterID* argCountDst, RegisterID* arguments)
-{
- ASSERT(argCountDst->index() < arguments->index());
- emitOpcode(op_load_varargs);
- instructions().append(argCountDst->index());
- instructions().append(arguments->index());
- 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());
-
-#if ENABLE(JIT)
- m_codeBlock->addFunctionRegisterInfo(instructions().size(), func->index());
-#endif
- }
-
- emitExpressionInfo(divot, startOffset, endOffset);
-
- // Emit call.
- emitOpcode(op_call_varargs);
- instructions().append(dst->index()); // dst
- instructions().append(func->index()); // func
- instructions().append(argCountRegister->index()); // arg count
- instructions().append(thisRegister->index() + RegisterFile::CallFrameHeaderSize); // initial registerOffset
- 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_activationRegisterIndex);
- } else if (m_codeBlock->usesArguments() && m_codeBlock->m_numParameters > 1)
- emitOpcode(op_tear_off_arguments);
-
- 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, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
-{
- ASSERT(func->refCount());
-
- RegisterID* originalFunc = func;
- if (m_shouldEmitProfileHooks) {
- // If codegen decided to recycle func as this call's destination register,
- // we need to undo that optimization here so that func will still be around
- // for the sake of op_profile_did_call.
- if (dst == func) {
- RefPtr<RegisterID> movedFunc = emitMove(newTemporary(), func);
- func = movedFunc.release().releaseRef();
- }
- }
-
- RefPtr<RegisterID> funcProto = newTemporary();
-
- // Generate code for arguments.
- Vector<RefPtr<RegisterID>, 16> argv;
- argv.append(newTemporary()); // reserve space for "this"
- for (ArgumentListNode* n = argumentsNode ? argumentsNode->m_listNode : 0; n; n = n->m_next) {
- argv.append(newTemporary());
- // op_construct requires the arguments to be a sequential range of registers
- ASSERT(argv[argv.size() - 1]->index() == argv[argv.size() - 2]->index() + 1);
- emitNode(argv.last().get(), n);
- }
-
- if (m_shouldEmitProfileHooks) {
- emitOpcode(op_profile_will_call);
- instructions().append(func->index());
- }
-
- // Load prototype.
- emitExpressionInfo(divot, startOffset, endOffset);
- emitGetByIdExceptionInfo(op_construct);
- emitGetById(funcProto.get(), func, globalData()->propertyNames->prototype);
-
- // 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(dst->index()); // dst
- instructions().append(func->index()); // func
- instructions().append(argv.size()); // argCount
- instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset
- instructions().append(funcProto->index()); // proto
- instructions().append(argv[0]->index()); // thisRegister
-
- emitOpcode(op_construct_verify);
- instructions().append(dst->index());
- instructions().append(argv[0]->index());
-
- if (m_shouldEmitProfileHooks) {
- emitOpcode(op_profile_did_call);
- instructions().append(func->index());
-
- if (dst == originalFunc)
- func->deref();
- }
-
- 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++;
- createArgumentsIfNecessary();
-
- 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 (!m_shouldEmitDebugHooks)
- return;
- 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)
-{
-#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;
-}
-
-RegisterID* BytecodeGenerator::emitNewError(RegisterID* dst, ErrorType type, JSValue message)
-{
- emitOpcode(op_new_error);
- instructions().append(dst->index());
- instructions().append(static_cast<int>(type));
- instructions().append(addConstantValue(message)->index());
- return dst;
-}
-
-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++;
-
- createArgumentsIfNecessary();
-
- 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());
- UString::Rep* clause = static_cast<StringNode*>(node)->value().ustring().rep();
- 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());
- UString::Rep* clause = static_cast<StringNode*>(nodes[i])->value().ustring().rep();
- 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);
- RegisterID* exception = emitNewError(newTemporary(), SyntaxError, jsString(globalData(), "Expression too deep"));
- emitThrow(exception);
- return exception;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h
deleted file mode 100644
index 8b6a425..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * 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;
-
- 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 Debugger*, const ScopeChain&, SymbolTable*, ProgramCodeBlock*);
- BytecodeGenerator(FunctionBodyNode*, const Debugger*, const ScopeChain&, SymbolTable*, CodeBlock*);
- BytecodeGenerator(EvalNode*, const Debugger*, const ScopeChain&, SymbolTable*, EvalCodeBlock*);
-
- JSGlobalData* globalData() const { return m_globalData; }
- const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; }
-
- 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&);
-
- 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.
- //
- // NB: depth does _not_ include the local scope. eg. a depth of 0 refers
- // to the scope containing this codeblock.
- bool findScopedProperty(const Identifier&, int& index, size_t& depth, bool forWriting, 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();
- }
-
- 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());
- if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
- LineInfo info = { instructions().size(), n->lineNo() };
- m_codeBlock->addLineInfo(info);
- }
- if (m_emitNodeDepth >= s_maxEmitNodeDepth)
- return emitThrowExpressionTooDeepException();
- ++m_emitNodeDepth;
- RegisterID* r = n->emitBytecode(*this, dst);
- --m_emitNodeDepth;
- return r;
- }
-
- RegisterID* emitNode(Node* n)
- {
- return emitNode(0, n);
- }
-
- void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
- {
- if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
- LineInfo info = { instructions().size(), n->lineNo() };
- m_codeBlock->addLineInfo(info);
- }
- if (m_emitNodeDepth >= s_maxEmitNodeDepth)
- emitThrowExpressionTooDeepException();
- ++m_emitNodeDepth;
- n->emitBytecodeInConditionContext(*this, trueTarget, falseTarget, fallThroughMeansTrue);
- --m_emitNodeDepth;
- }
-
- void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset)
- {
- 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);
- }
-
- void emitGetByIdExceptionInfo(OpcodeID opcodeID)
- {
- // Only op_construct and op_instanceof need exception info for
- // a preceding op_get_by_id.
- ASSERT(opcodeID == op_construct || opcodeID == op_instanceof);
- GetByIdExceptionInfo info;
- info.bytecodeOffset = instructions().size();
- info.isOpConstruct = (opcodeID == op_construct);
- m_codeBlock->addGetByIdExceptionInfo(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* 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);
-
- 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* emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property);
-
- void emitMethodCheck();
-
- RegisterID* emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property);
- RegisterID* emitPutById(RegisterID* base, const Identifier& property, RegisterID* value);
- RegisterID* emitDeleteById(RegisterID* dst, RegisterID* base, const Identifier&);
- RegisterID* emitGetByVal(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, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
- RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, 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* args);
-
- RegisterID* emitReturn(RegisterID* src);
- RegisterID* emitEnd(RegisterID* src) { return emitUnaryNoDstOp(op_end, src); }
-
- RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode*, 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) { emitUnaryNoDstOp(op_throw, exc); }
- RegisterID* emitNewError(RegisterID* dst, ErrorType type, JSValue 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;
- }
-
- private:
- void emitOpcode(OpcodeID);
- void retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index);
- void retrieveLastUnaryOp(int& dstIndex, int& srcIndex);
- void rewindBinaryOp();
- 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<UString::Rep>, int, IdentifierRepHash, HashTraits<RefPtr<UString::Rep> >, IdentifierMapIndexHashTraits> IdentifierMap;
- typedef HashMap<double, JSValue> NumberMap;
- typedef HashMap<UString::Rep*, JSString*, IdentifierRepHash> IdentifierStringMap;
-
- RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
-
- RegisterID* newRegister();
-
- // Returns the RegisterID corresponding to ident.
- RegisterID* addVar(const Identifier& ident, bool isConstant)
- {
- RegisterID* local;
- addVar(ident, isConstant, local);
- return local;
- }
- // Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
- bool addVar(const Identifier&, bool isConstant, RegisterID*&);
-
- // 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*&);
-
- RegisterID* addParameter(const Identifier&);
-
- void preserveLastVar();
-
- RegisterID& registerFor(int index)
- {
- if (index >= 0)
- return m_calleeRegisters[index];
-
- if (index == RegisterFile::OptionalCalleeArguments)
- return m_argumentsRegister;
-
- 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->lineNo(), body->lastLine());
- }
-
- PassRefPtr<FunctionExecutable> makeFunction(JSGlobalData* globalData, FunctionBodyNode* body)
- {
- return FunctionExecutable::create(globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine());
- }
-
- 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();
-
- bool m_shouldEmitDebugHooks;
- bool m_shouldEmitProfileHooks;
-
- 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<UString::Rep>, IdentifierRepHash> m_functions;
- RegisterID m_ignoredResultRegister;
- RegisterID m_thisRegister;
- RegisterID m_argumentsRegister;
- int m_activationRegisterIndex;
- 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_nextParameterIndex;
- int m_firstConstantIndex;
- int m_nextConstantOffset;
- unsigned m_globalConstantIndex;
-
- int m_globalVarStorageOffset;
-
- // Constant pool
- IdentifierMap m_identifierMap;
- JSValueMap m_jsValueMap;
- NumberMap m_numberMap;
- IdentifierStringMap m_stringMap;
-
- JSGlobalData* m_globalData;
-
- OpcodeID m_lastOpcodeID;
-
- unsigned m_emitNodeDepth;
-
- bool m_regeneratingForExceptionInfo;
- CodeBlock* m_codeBlockBeingRegeneratedFrom;
-
- static const unsigned s_maxEmitNodeDepth = 5000;
- };
-
-}
-
-#endif // BytecodeGenerator_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/NodesCodegen.cpp
deleted file mode 100644
index e682c73..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/NodesCodegen.cpp
+++ /dev/null
@@ -1,1999 +0,0 @@
-/*
-* 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 {
-
-/*
- 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 --------------------------------
-
-static void substitute(UString& string, const UString& substring)
-{
- unsigned position = string.find("%s");
- ASSERT(position != UString::NotFound);
- string = makeString(string.substr(0, position), substring, string.substr(position + 2));
-}
-
-RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* message)
-{
- generator.emitExpressionInfo(divot(), startOffset(), endOffset());
- RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message));
- generator.emitThrow(exception);
- return exception;
-}
-
-RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const UString& label)
-{
- UString message = messageTemplate;
- substitute(message, label);
- generator.emitExpressionInfo(divot(), startOffset(), endOffset());
- RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message));
- generator.emitThrow(exception);
- return exception;
-}
-
-inline RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const Identifier& label)
-{
- return emitThrowError(generator, type, messageTemplate, label.ustring());
-}
-
-// ------------------------------ 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 = RegExp::create(generator.globalData(), m_pattern.ustring(), m_flags.ustring());
- if (!regExp->isValid())
- return emitThrowError(generator, SyntaxError, "Invalid regular expression: %s", 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.size(), m_ident.size(), 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(generator.globalData(), 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.emitPutById(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)
-{
- 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)
-{
- 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);
- return generator.emitConstruct(generator.finalDestination(dst), func.get(), m_args, divot(), startOffset(), endOffset());
-}
-
-// ------------------------------ EvalFunctionCallNode ----------------------------------
-
-RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
-{
- RefPtr<RegisterID> func = generator.tempDestination(dst);
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- generator.emitExpressionInfo(divot() - startOffset() + 4, 4, 0);
- generator.emitResolveWithBase(thisRegister.get(), func.get(), generator.propertyNames().eval);
- return generator.emitCallEval(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
-}
-
-// ------------------------------ FunctionCallValueNode ----------------------------------
-
-RegisterID* FunctionCallValueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
-{
- RefPtr<RegisterID> func = generator.emitNode(m_expr);
- RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
-}
-
-// ------------------------------ FunctionCallResolveNode ----------------------------------
-
-RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
-{
- if (RefPtr<RegisterID> local = generator.registerFor(m_ident)) {
- RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestination(dst, thisRegister.get()), local.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- }
-
- int index = 0;
- size_t depth = 0;
- JSObject* globalObject = 0;
- if (generator.findScopedProperty(m_ident, index, depth, false, globalObject) && index != missingSymbolMarker()) {
- RefPtr<RegisterID> func = generator.emitGetScopedVar(generator.newTemporary(), depth, index, globalObject);
- RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- }
-
- RefPtr<RegisterID> func = generator.newTemporary();
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- int identifierStart = divot() - startOffset();
- generator.emitExpressionInfo(identifierStart + m_ident.size(), m_ident.size(), 0);
- generator.emitResolveWithBase(thisRegister.get(), func.get(), m_ident);
- return generator.emitCall(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, 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);
- RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- return generator.emitCall(generator.finalDestination(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
-}
-
-// ------------------------------ FunctionCallDotNode ----------------------------------
-
-RegisterID* FunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
-{
- RefPtr<RegisterID> function = generator.tempDestination(dst);
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- generator.emitNode(thisRegister.get(), m_base);
- generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
- generator.emitMethodCheck();
- generator.emitGetById(function.get(), thisRegister.get(), m_ident);
- return generator.emitCall(generator.finalDestination(dst, function.get()), function.get(), thisRegister.get(), m_args, 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> finalDestination = generator.finalDestination(dst, function.get());
- generator.emitJumpIfNotFunctionCall(function.get(), realCall.get());
- {
- RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- ArgumentListNode* oldList = m_args->m_listNode;
- if (m_args->m_listNode && m_args->m_listNode->m_expr) {
- generator.emitNode(thisRegister.get(), m_args->m_listNode->m_expr);
- m_args->m_listNode = m_args->m_listNode->m_next;
- } else
- generator.emitLoad(thisRegister.get(), jsNull());
-
- generator.emitCall(finalDestination.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- generator.emitJump(end.get());
- m_args->m_listNode = oldList;
- }
- generator.emitLabel(realCall.get());
- {
- RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- generator.emitCall(finalDestination.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- }
- generator.emitLabel(end.get());
- return finalDestination.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> finalDestination = generator.finalDestination(dst, function.get());
- generator.emitJumpIfNotFunctionApply(function.get(), realCall.get());
- {
- if (mayBeCall) {
- RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- ArgumentListNode* oldList = m_args->m_listNode;
- if (m_args->m_listNode && m_args->m_listNode->m_expr) {
- generator.emitNode(thisRegister.get(), m_args->m_listNode->m_expr);
- m_args->m_listNode = m_args->m_listNode->m_next;
- if (m_args->m_listNode) {
- ASSERT(m_args->m_listNode->m_expr->isSimpleArray());
- ASSERT(!m_args->m_listNode->m_next);
- m_args->m_listNode = static_cast<ArrayNode*>(m_args->m_listNode->m_expr)->toArgumentList(generator.globalData());
- }
- } else
- generator.emitLoad(thisRegister.get(), jsNull());
- generator.emitCall(finalDestination.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- m_args->m_listNode = oldList;
- } 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(), argsRegister.get());
- generator.emitCallVarargs(finalDestination.get(), realFunction.get(), thisRegister.get(), argsCountRegister.get(), divot(), startOffset(), endOffset());
- }
- generator.emitJump(end.get());
- }
- generator.emitLabel(realCall.get());
- {
- RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- generator.emitCall(finalDestination.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- }
- generator.emitLabel(end.get());
- return finalDestination.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;
- if (generator.findScopedProperty(m_ident, index, depth, true, globalObject) && index != missingSymbolMarker()) {
- 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 emitThrowError(generator, ReferenceError, 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;
- if (generator.findScopedProperty(m_ident, index, depth, false, globalObject) && index != missingSymbolMarker()) {
- 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 emitThrowError(generator, ReferenceError, 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.emitGetByIdExceptionInfo(op_instanceof);
- 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;
- if (generator.findScopedProperty(m_ident, index, depth, true, globalObject) && index != missingSymbolMarker()) {
- 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.size(), m_ident.size(), 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;
- if (generator.findScopedProperty(m_ident, index, depth, true, globalObject) && index != missingSymbolMarker()) {
- 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.emitResolveBase(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 emitThrowError(generator, ReferenceError, "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;
-}
-
-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 emitThrowError(generator, ReferenceError, "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.emitResolveBase(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)
- return m_ident.isEmpty()
- ? emitThrowError(generator, SyntaxError, "Invalid continue statement.")
- : emitThrowError(generator, SyntaxError, "Undefined label: '%s'.", m_ident);
-
- 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)
- return m_ident.isEmpty()
- ? emitThrowError(generator, SyntaxError, "Invalid break statement.")
- : emitThrowError(generator, SyntaxError, "Undefined label: '%s'.", m_ident);
-
- 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 emitThrowError(generator, SyntaxError, "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.size() == 1) {
- int32_t intVal = value.rep()->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 emitThrowError(generator, SyntaxError, "Duplicate label: %s.", m_name);
-
- 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();
- if (singleStatement && singleStatement->isBlock()) {
- StatementNode* lastStatementInBlock = static_cast<BlockNode*>(singleStatement)->lastStatement();
- if (lastStatementInBlock && lastStatementInBlock->isReturnNode())
- return 0;
- }
-
- RegisterID* r0 = generator.emitLoad(0, jsUndefined());
- generator.emitDebugHook(WillLeaveCallFrame, firstLine(), lastLine());
- generator.emitReturn(r0);
- 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/src/3rdparty/webkit/JavaScriptCore/bytecompiler/RegisterID.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/RegisterID.h
deleted file mode 100644
index 3532ad8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/RegisterID.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/config.h b/src/3rdparty/webkit/JavaScriptCore/config.h
deleted file mode 100644
index acc162a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/config.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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
-#include "autotoolsconfig.h"
-#endif
-
-#include <wtf/Platform.h>
-
-#if 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 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/src/3rdparty/webkit/JavaScriptCore/create_hash_table b/src/3rdparty/webkit/JavaScriptCore/create_hash_table
deleted file mode 100755
index 77463fb..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/create_hash_table
+++ /dev/null
@@ -1,277 +0,0 @@
-#! /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 "\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";
- }
- print " { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue },\n";
- $i++;
- }
- print " { 0, 0, 0, 0 }\n";
- print "};\n\n";
- print "extern JSC_CONST_HASHTABLE HashTable $name =\n";
- print " \{ $compactSize, $compactHashSizeMask, $nameEntries, 0 \};\n";
- print "} // namespace\n";
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/create_jit_stubs b/src/3rdparty/webkit/JavaScriptCore/create_jit_stubs
deleted file mode 100644
index 4d510ea..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/create_jit_stubs
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /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("#offset#");
-my $op_template = quotemeta("#op#");
-
-my $prefix;
-my $offset = 32;
-my $file;
-
-my $getOptionsResult = GetOptions(
- 'prefix=s' => \$prefix,
- 'offset=i' => \$offset
-);
-
-$file = $ARGV[0];
-
-die "$usage\n" unless ($prefix and $file);
-
-my $stub_template = "";
-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\((.*)\)/ ) {
- $stub_template .= $1 . "\n";
- }
- if ( /^DEFINE_STUB_FUNCTION\((.*), (.*)\)/ ) {
- $stub = $stub_template;
- $rtype = quotemeta($1);
- $op = quotemeta($2);
- $stub =~ s/$offset_template/$offset/g;
- $stub =~ s/$rtype_template/$rtype/g;
- $stub =~ s/$op_template/$op/g;
- $stub =~ s/\\\*/\*/g;
- print $stub;
- }
-}
-
-close(IN);
diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp
deleted file mode 100644
index cbcbd21..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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->recompile(exec);
- 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));
- JSObject* error = eval->compile(globalCallFrame, globalCallFrame->scopeChain());
- if (error)
- return error;
-
- return globalObject->globalData()->interpreter->execute(eval.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h
deleted file mode 100644
index 3b9bec4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp
deleted file mode 100644
index 0444d23..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h
deleted file mode 100644
index 3927017..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp
deleted file mode 100644
index 05a385d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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;
-
- JSFunction* function = asFunction(m_callFrame->callee());
- if (!function)
- return 0;
- return &function->name(m_callFrame);
-}
-
-UString DebuggerCallFrame::calculatedFunctionName() const
-{
- if (!m_callFrame->codeBlock())
- return UString();
-
- JSFunction* function = asFunction(m_callFrame->callee());
- if (!function)
- return UString();
- return function->calculatedDisplayName(m_callFrame);
-}
-
-DebuggerCallFrame::Type DebuggerCallFrame::type() const
-{
- if (m_callFrame->callee())
- return FunctionType;
-
- return ProgramType;
-}
-
-JSObject* DebuggerCallFrame::thisObject() const
-{
- if (!m_callFrame->codeBlock())
- return 0;
-
- return asObject(m_callFrame->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));
- JSObject* error = eval->compile(m_callFrame, m_callFrame->scopeChain());
- if (error)
- return error;
-
- return m_callFrame->scopeChain()->globalData->interpreter->execute(eval.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h
deleted file mode 100644
index 9d377ef..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/docs/make-bytecode-docs.pl b/src/3rdparty/webkit/JavaScriptCore/docs/make-bytecode-docs.pl
deleted file mode 100755
index 9494d1b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/docs/make-bytecode-docs.pl
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-open MACHINE, "<" . $ARGV[0];
-open OUTPUT, ">" . $ARGV[1];
-
-my @undocumented = ();
-
-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/src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h
deleted file mode 100644
index 88d3717..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/ArrayPrototype.lut.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Automatically generated from runtime/ArrayPrototype.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue arrayTableValues[22] = {
- { "toString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncToString), (intptr_t)0 },
- { "toLocaleString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncToLocaleString), (intptr_t)0 },
- { "concat", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncConcat), (intptr_t)1 },
- { "join", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncJoin), (intptr_t)1 },
- { "pop", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncPop), (intptr_t)0 },
- { "push", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncPush), (intptr_t)1 },
- { "reverse", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncReverse), (intptr_t)0 },
- { "shift", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncShift), (intptr_t)0 },
- { "slice", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSlice), (intptr_t)2 },
- { "sort", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSort), (intptr_t)1 },
- { "splice", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSplice), (intptr_t)2 },
- { "unshift", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncUnShift), (intptr_t)1 },
- { "every", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncEvery), (intptr_t)1 },
- { "forEach", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncForEach), (intptr_t)1 },
- { "some", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSome), (intptr_t)1 },
- { "indexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncIndexOf), (intptr_t)1 },
- { "lastIndexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncLastIndexOf), (intptr_t)1 },
- { "filter", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncFilter), (intptr_t)1 },
- { "reduce", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncReduce), (intptr_t)1 },
- { "reduceRight", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncReduceRight), (intptr_t)1 },
- { "map", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncMap), (intptr_t)1 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable arrayTable =
- { 65, 63, arrayTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h
deleted file mode 100644
index 0174298..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/DatePrototype.lut.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Automatically generated from runtime/DatePrototype.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue dateTableValues[47] = {
- { "toString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToString), (intptr_t)0 },
- { "toISOString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToISOString), (intptr_t)0 },
- { "toUTCString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToUTCString), (intptr_t)0 },
- { "toDateString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToDateString), (intptr_t)0 },
- { "toTimeString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToTimeString), (intptr_t)0 },
- { "toLocaleString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToLocaleString), (intptr_t)0 },
- { "toLocaleDateString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToLocaleDateString), (intptr_t)0 },
- { "toLocaleTimeString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToLocaleTimeString), (intptr_t)0 },
- { "valueOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetTime), (intptr_t)0 },
- { "getTime", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetTime), (intptr_t)0 },
- { "getFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetFullYear), (intptr_t)0 },
- { "getUTCFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCFullYear), (intptr_t)0 },
- { "toGMTString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToGMTString), (intptr_t)0 },
- { "getMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetMonth), (intptr_t)0 },
- { "getUTCMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCMonth), (intptr_t)0 },
- { "getDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetDate), (intptr_t)0 },
- { "getUTCDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCDate), (intptr_t)0 },
- { "getDay", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetDay), (intptr_t)0 },
- { "getUTCDay", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCDay), (intptr_t)0 },
- { "getHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetHours), (intptr_t)0 },
- { "getUTCHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCHours), (intptr_t)0 },
- { "getMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetMinutes), (intptr_t)0 },
- { "getUTCMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCMinutes), (intptr_t)0 },
- { "getSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetSeconds), (intptr_t)0 },
- { "getUTCSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCSeconds), (intptr_t)0 },
- { "getMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetMilliSeconds), (intptr_t)0 },
- { "getUTCMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCMilliseconds), (intptr_t)0 },
- { "getTimezoneOffset", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetTimezoneOffset), (intptr_t)0 },
- { "setTime", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetTime), (intptr_t)1 },
- { "setMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetMilliSeconds), (intptr_t)1 },
- { "setUTCMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCMilliseconds), (intptr_t)1 },
- { "setSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetSeconds), (intptr_t)2 },
- { "setUTCSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCSeconds), (intptr_t)2 },
- { "setMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetMinutes), (intptr_t)3 },
- { "setUTCMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCMinutes), (intptr_t)3 },
- { "setHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetHours), (intptr_t)4 },
- { "setUTCHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCHours), (intptr_t)4 },
- { "setDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetDate), (intptr_t)1 },
- { "setUTCDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCDate), (intptr_t)1 },
- { "setMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetMonth), (intptr_t)2 },
- { "setUTCMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCMonth), (intptr_t)2 },
- { "setFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetFullYear), (intptr_t)3 },
- { "setUTCFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCFullYear), (intptr_t)3 },
- { "setYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetYear), (intptr_t)1 },
- { "getYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetYear), (intptr_t)0 },
- { "toJSON", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToJSON), (intptr_t)0 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable dateTable =
- { 134, 127, dateTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h b/src/3rdparty/webkit/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h
deleted file mode 100644
index 94ab756..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h
+++ /dev/null
@@ -1,1199 +0,0 @@
-extern "C" EncodedJSValue JITStubThunked_op_convert_this(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_convert_this(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_convert_this
- str lr, [sp, #32]
- bl JITStubThunked_op_convert_this
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_end(STUB_ARGS_DECLARATION);
-__asm void cti_op_end(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_end
- str lr, [sp, #32]
- bl JITStubThunked_op_end
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_add(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_add(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_add
- str lr, [sp, #32]
- bl JITStubThunked_op_add
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_pre_inc(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_pre_inc(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_pre_inc
- str lr, [sp, #32]
- bl JITStubThunked_op_pre_inc
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_timeout_check(STUB_ARGS_DECLARATION);
-__asm int cti_timeout_check(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_timeout_check
- str lr, [sp, #32]
- bl JITStubThunked_timeout_check
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_register_file_check(STUB_ARGS_DECLARATION);
-__asm void cti_register_file_check(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_register_file_check
- str lr, [sp, #32]
- bl JITStubThunked_register_file_check
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_op_loop_if_lesseq(STUB_ARGS_DECLARATION);
-__asm int cti_op_loop_if_lesseq(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_loop_if_lesseq
- str lr, [sp, #32]
- bl JITStubThunked_op_loop_if_lesseq
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_new_object(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_new_object(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_new_object
- str lr, [sp, #32]
- bl JITStubThunked_op_new_object
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_by_id_generic(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_by_id_generic(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_by_id_generic
- str lr, [sp, #32]
- bl JITStubThunked_op_put_by_id_generic
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_generic(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_generic(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_generic
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_generic
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_by_id(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_by_id(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_by_id
- str lr, [sp, #32]
- bl JITStubThunked_op_put_by_id
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_by_id_fail(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_by_id_fail(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_by_id_fail
- str lr, [sp, #32]
- bl JITStubThunked_op_put_by_id_fail
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_by_id_transition_realloc
- str lr, [sp, #32]
- bl JITStubThunked_op_put_by_id_transition_realloc
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_method_check(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_method_check(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_method_check
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_method_check
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_self_fail(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_self_fail(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_self_fail
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_self_fail
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_getter_stub(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_getter_stub(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_getter_stub
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_getter_stub
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_custom_stub(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_custom_stub(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_custom_stub
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_custom_stub
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_proto_list(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_proto_list(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_proto_list
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_proto_list
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_proto_list_full(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_proto_list_full(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_proto_list_full
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_proto_list_full
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_proto_fail(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_proto_fail(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_proto_fail
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_proto_fail
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_array_fail(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_array_fail(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_array_fail
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_array_fail
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_id_string_fail(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_id_string_fail(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_id_string_fail
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_id_string_fail
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_instanceof(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_instanceof(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_instanceof
- str lr, [sp, #32]
- bl JITStubThunked_op_instanceof
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_del_by_id(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_del_by_id(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_del_by_id
- str lr, [sp, #32]
- bl JITStubThunked_op_del_by_id
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_mul(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_mul(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_mul
- str lr, [sp, #32]
- bl JITStubThunked_op_mul
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_new_func(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_new_func(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_new_func
- str lr, [sp, #32]
- bl JITStubThunked_op_new_func
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void* JITStubThunked_op_call_JSFunction(STUB_ARGS_DECLARATION);
-__asm void* cti_op_call_JSFunction(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_call_JSFunction
- str lr, [sp, #32]
- bl JITStubThunked_op_call_JSFunction
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" VoidPtrPair JITStubThunked_op_call_arityCheck(STUB_ARGS_DECLARATION);
-__asm VoidPtrPair cti_op_call_arityCheck(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_call_arityCheck
- str lr, [sp, #32]
- bl JITStubThunked_op_call_arityCheck
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void* JITStubThunked_vm_lazyLinkCall(STUB_ARGS_DECLARATION);
-__asm void* cti_vm_lazyLinkCall(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_vm_lazyLinkCall
- str lr, [sp, #32]
- bl JITStubThunked_vm_lazyLinkCall
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_push_activation(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_push_activation(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_push_activation
- str lr, [sp, #32]
- bl JITStubThunked_op_push_activation
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_call_NotJSFunction(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_call_NotJSFunction(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_call_NotJSFunction
- str lr, [sp, #32]
- bl JITStubThunked_op_call_NotJSFunction
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_create_arguments(STUB_ARGS_DECLARATION);
-__asm void cti_op_create_arguments(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_create_arguments
- str lr, [sp, #32]
- bl JITStubThunked_op_create_arguments
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_create_arguments_no_params(STUB_ARGS_DECLARATION);
-__asm void cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_create_arguments_no_params
- str lr, [sp, #32]
- bl JITStubThunked_op_create_arguments_no_params
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_tear_off_activation(STUB_ARGS_DECLARATION);
-__asm void cti_op_tear_off_activation(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_tear_off_activation
- str lr, [sp, #32]
- bl JITStubThunked_op_tear_off_activation
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_tear_off_arguments(STUB_ARGS_DECLARATION);
-__asm void cti_op_tear_off_arguments(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_tear_off_arguments
- str lr, [sp, #32]
- bl JITStubThunked_op_tear_off_arguments
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_profile_will_call(STUB_ARGS_DECLARATION);
-__asm void cti_op_profile_will_call(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_profile_will_call
- str lr, [sp, #32]
- bl JITStubThunked_op_profile_will_call
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_profile_did_call(STUB_ARGS_DECLARATION);
-__asm void cti_op_profile_did_call(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_profile_did_call
- str lr, [sp, #32]
- bl JITStubThunked_op_profile_did_call
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_ret_scopeChain(STUB_ARGS_DECLARATION);
-__asm void cti_op_ret_scopeChain(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_ret_scopeChain
- str lr, [sp, #32]
- bl JITStubThunked_op_ret_scopeChain
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_new_array(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_new_array(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_new_array
- str lr, [sp, #32]
- bl JITStubThunked_op_new_array
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_resolve(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_resolve(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_resolve
- str lr, [sp, #32]
- bl JITStubThunked_op_resolve
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_construct_JSConstruct(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_construct_JSConstruct(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_construct_JSConstruct
- str lr, [sp, #32]
- bl JITStubThunked_op_construct_JSConstruct
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_construct_NotJSConstruct(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_construct_NotJSConstruct(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_construct_NotJSConstruct
- str lr, [sp, #32]
- bl JITStubThunked_op_construct_NotJSConstruct
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_val(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_val(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_val
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_val
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_val_string(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_val_string(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_val_string
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_val_string
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_get_by_val_byte_array(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_get_by_val_byte_array(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_by_val_byte_array
- str lr, [sp, #32]
- bl JITStubThunked_op_get_by_val_byte_array
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_sub(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_sub(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_sub
- str lr, [sp, #32]
- bl JITStubThunked_op_sub
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_by_val(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_by_val(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_by_val
- str lr, [sp, #32]
- bl JITStubThunked_op_put_by_val
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_by_val_byte_array(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_by_val_byte_array(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_by_val_byte_array
- str lr, [sp, #32]
- bl JITStubThunked_op_put_by_val_byte_array
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_lesseq(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_lesseq(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_lesseq
- str lr, [sp, #32]
- bl JITStubThunked_op_lesseq
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_op_load_varargs(STUB_ARGS_DECLARATION);
-__asm int cti_op_load_varargs(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_load_varargs
- str lr, [sp, #32]
- bl JITStubThunked_op_load_varargs
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_negate(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_negate(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_negate
- str lr, [sp, #32]
- bl JITStubThunked_op_negate
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_resolve_base(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_resolve_base(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_resolve_base
- str lr, [sp, #32]
- bl JITStubThunked_op_resolve_base
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_resolve_skip(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_resolve_skip(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_resolve_skip
- str lr, [sp, #32]
- bl JITStubThunked_op_resolve_skip
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_resolve_global(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_resolve_global(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_resolve_global
- str lr, [sp, #32]
- bl JITStubThunked_op_resolve_global
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_div(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_div(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_div
- str lr, [sp, #32]
- bl JITStubThunked_op_div
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_pre_dec(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_pre_dec(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_pre_dec
- str lr, [sp, #32]
- bl JITStubThunked_op_pre_dec
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_op_jless(STUB_ARGS_DECLARATION);
-__asm int cti_op_jless(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_jless
- str lr, [sp, #32]
- bl JITStubThunked_op_jless
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_op_jlesseq(STUB_ARGS_DECLARATION);
-__asm int cti_op_jlesseq(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_jlesseq
- str lr, [sp, #32]
- bl JITStubThunked_op_jlesseq
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_not(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_not(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_not
- str lr, [sp, #32]
- bl JITStubThunked_op_not
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_op_jtrue(STUB_ARGS_DECLARATION);
-__asm int cti_op_jtrue(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_jtrue
- str lr, [sp, #32]
- bl JITStubThunked_op_jtrue
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_post_inc(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_post_inc(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_post_inc
- str lr, [sp, #32]
- bl JITStubThunked_op_post_inc
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_op_eq(STUB_ARGS_DECLARATION);
-__asm int cti_op_eq(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_eq
- str lr, [sp, #32]
- bl JITStubThunked_op_eq
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_op_eq_strings(STUB_ARGS_DECLARATION);
-__asm int cti_op_eq_strings(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_eq_strings
- str lr, [sp, #32]
- bl JITStubThunked_op_eq_strings
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_lshift(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_lshift(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_lshift
- str lr, [sp, #32]
- bl JITStubThunked_op_lshift
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_bitand(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_bitand(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_bitand
- str lr, [sp, #32]
- bl JITStubThunked_op_bitand
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_rshift(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_rshift(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_rshift
- str lr, [sp, #32]
- bl JITStubThunked_op_rshift
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_bitnot(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_bitnot(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_bitnot
- str lr, [sp, #32]
- bl JITStubThunked_op_bitnot
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_resolve_with_base(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_resolve_with_base(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_resolve_with_base
- str lr, [sp, #32]
- bl JITStubThunked_op_resolve_with_base
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_new_func_exp(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_new_func_exp(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_new_func_exp
- str lr, [sp, #32]
- bl JITStubThunked_op_new_func_exp
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_mod(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_mod(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_mod
- str lr, [sp, #32]
- bl JITStubThunked_op_mod
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_less(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_less(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_less
- str lr, [sp, #32]
- bl JITStubThunked_op_less
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_post_dec(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_post_dec(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_post_dec
- str lr, [sp, #32]
- bl JITStubThunked_op_post_dec
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_urshift(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_urshift(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_urshift
- str lr, [sp, #32]
- bl JITStubThunked_op_urshift
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_bitxor(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_bitxor(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_bitxor
- str lr, [sp, #32]
- bl JITStubThunked_op_bitxor
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_new_regexp(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_new_regexp(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_new_regexp
- str lr, [sp, #32]
- bl JITStubThunked_op_new_regexp
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_bitor(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_bitor(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_bitor
- str lr, [sp, #32]
- bl JITStubThunked_op_bitor
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_call_eval(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_call_eval(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_call_eval
- str lr, [sp, #32]
- bl JITStubThunked_op_call_eval
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_throw(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_throw(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_throw
- str lr, [sp, #32]
- bl JITStubThunked_op_throw
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSPropertyNameIterator* JITStubThunked_op_get_pnames(STUB_ARGS_DECLARATION);
-__asm JSPropertyNameIterator* cti_op_get_pnames(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_get_pnames
- str lr, [sp, #32]
- bl JITStubThunked_op_get_pnames
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" int JITStubThunked_has_property(STUB_ARGS_DECLARATION);
-__asm int cti_has_property(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_has_property
- str lr, [sp, #32]
- bl JITStubThunked_has_property
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_push_scope(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_push_scope(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_push_scope
- str lr, [sp, #32]
- bl JITStubThunked_op_push_scope
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_pop_scope(STUB_ARGS_DECLARATION);
-__asm void cti_op_pop_scope(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_pop_scope
- str lr, [sp, #32]
- bl JITStubThunked_op_pop_scope
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_typeof(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_typeof(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_typeof
- str lr, [sp, #32]
- bl JITStubThunked_op_typeof
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_is_undefined(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_is_undefined(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_is_undefined
- str lr, [sp, #32]
- bl JITStubThunked_op_is_undefined
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_is_boolean(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_is_boolean(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_is_boolean
- str lr, [sp, #32]
- bl JITStubThunked_op_is_boolean
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_is_number(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_is_number(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_is_number
- str lr, [sp, #32]
- bl JITStubThunked_op_is_number
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_is_string(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_is_string(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_is_string
- str lr, [sp, #32]
- bl JITStubThunked_op_is_string
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_is_object(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_is_object(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_is_object
- str lr, [sp, #32]
- bl JITStubThunked_op_is_object
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_is_function(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_is_function(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_is_function
- str lr, [sp, #32]
- bl JITStubThunked_op_is_function
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_stricteq(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_stricteq(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_stricteq
- str lr, [sp, #32]
- bl JITStubThunked_op_stricteq
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_to_primitive(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_to_primitive(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_to_primitive
- str lr, [sp, #32]
- bl JITStubThunked_op_to_primitive
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_strcat(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_strcat(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_strcat
- str lr, [sp, #32]
- bl JITStubThunked_op_strcat
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_nstricteq(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_nstricteq(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_nstricteq
- str lr, [sp, #32]
- bl JITStubThunked_op_nstricteq
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_to_jsnumber(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_to_jsnumber(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_to_jsnumber
- str lr, [sp, #32]
- bl JITStubThunked_op_to_jsnumber
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_in(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_in(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_in
- str lr, [sp, #32]
- bl JITStubThunked_op_in
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_push_new_scope(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_push_new_scope(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_push_new_scope
- str lr, [sp, #32]
- bl JITStubThunked_op_push_new_scope
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_jmp_scopes(STUB_ARGS_DECLARATION);
-__asm void cti_op_jmp_scopes(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_jmp_scopes
- str lr, [sp, #32]
- bl JITStubThunked_op_jmp_scopes
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_by_index(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_by_index(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_by_index
- str lr, [sp, #32]
- bl JITStubThunked_op_put_by_index
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void* JITStubThunked_op_switch_imm(STUB_ARGS_DECLARATION);
-__asm void* cti_op_switch_imm(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_switch_imm
- str lr, [sp, #32]
- bl JITStubThunked_op_switch_imm
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void* JITStubThunked_op_switch_char(STUB_ARGS_DECLARATION);
-__asm void* cti_op_switch_char(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_switch_char
- str lr, [sp, #32]
- bl JITStubThunked_op_switch_char
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void* JITStubThunked_op_switch_string(STUB_ARGS_DECLARATION);
-__asm void* cti_op_switch_string(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_switch_string
- str lr, [sp, #32]
- bl JITStubThunked_op_switch_string
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_op_del_by_val(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_op_del_by_val(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_del_by_val
- str lr, [sp, #32]
- bl JITStubThunked_op_del_by_val
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_getter(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_getter(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_getter
- str lr, [sp, #32]
- bl JITStubThunked_op_put_getter
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_put_setter(STUB_ARGS_DECLARATION);
-__asm void cti_op_put_setter(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_put_setter
- str lr, [sp, #32]
- bl JITStubThunked_op_put_setter
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" JSObject* JITStubThunked_op_new_error(STUB_ARGS_DECLARATION);
-__asm JSObject* cti_op_new_error(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_new_error
- str lr, [sp, #32]
- bl JITStubThunked_op_new_error
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" void JITStubThunked_op_debug(STUB_ARGS_DECLARATION);
-__asm void cti_op_debug(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_op_debug
- str lr, [sp, #32]
- bl JITStubThunked_op_debug
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_vm_throw(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_vm_throw(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_vm_throw
- str lr, [sp, #32]
- bl JITStubThunked_vm_throw
- ldr lr, [sp, #32]
- bx lr
-}
-
-extern "C" EncodedJSValue JITStubThunked_to_object(STUB_ARGS_DECLARATION);
-__asm EncodedJSValue cti_to_object(STUB_ARGS_DECLARATION)
-{
- ARM
- IMPORT JITStubThunked_to_object
- str lr, [sp, #32]
- bl JITStubThunked_to_object
- ldr lr, [sp, #32]
- bx lr
-}
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp
deleted file mode 100644
index e62a1c4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp
+++ /dev/null
@@ -1,5604 +0,0 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
-
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
- 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 3 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "2.4.1"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-/* Using locations. */
-#define YYLSP_NEEDED 1
-
-/* Substitute the variable and function names. */
-#define yyparse jscyyparse
-#define yylex jscyylex
-#define yyerror jscyyerror
-#define yylval jscyylval
-#define yychar jscyychar
-#define yydebug jscyydebug
-#define yynerrs jscyynerrs
-#define yylloc jscyylloc
-
-/* Copy the first part of user declarations. */
-
-/* Line 189 of yacc.c */
-#line 3 "parser/Grammar.y"
-
-
-/*
- * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
- * Copyright (C) 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 "JSObject.h"
-#include "JSString.h"
-#include "Lexer.h"
-#include "NodeConstructors.h"
-#include "NodeInfo.h"
-#include <stdlib.h>
-#include <string.h>
-#include <wtf/MathExtras.h>
-
-#define YYMALLOC fastMalloc
-#define YYFREE fastFree
-
-#define YYMAXDEPTH 10000
-#define YYENABLE_NLS 0
-
-// Default values for bison.
-#define YYDEBUG 0 // Set to 1 to debug a parse error.
-#define jscyydebug 0 // Set to 1 to debug a parse error.
-#if !OS(DARWIN)
-// Avoid triggering warnings in older bison by not setting this on the Darwin platform.
-// FIXME: Is this still needed?
-#define YYERROR_VERBOSE
-#endif
-
-int jscyyerror(const char*);
-
-static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
-
-#define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
-#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0)
-
-using namespace JSC;
-using namespace std;
-
-static ExpressionNode* makeAssignNode(JSGlobalData*, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end);
-static ExpressionNode* makePrefixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
-static ExpressionNode* makePostfixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
-static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData*, const Identifier& getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
-static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData*, ExpressionNodeInfo function, ArgumentsNodeInfo, int start, int divot, int end);
-static ExpressionNode* makeTypeOfNode(JSGlobalData*, ExpressionNode*);
-static ExpressionNode* makeDeleteNode(JSGlobalData*, ExpressionNode*, int start, int divot, int end);
-static ExpressionNode* makeNegateNode(JSGlobalData*, ExpressionNode*);
-static NumberNode* makeNumberNode(JSGlobalData*, double);
-static ExpressionNode* makeBitwiseNotNode(JSGlobalData*, ExpressionNode*);
-static ExpressionNode* makeMultNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeDivNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeAddNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeSubNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeLeftShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeRightShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static StatementNode* makeVarStatementNode(JSGlobalData*, ExpressionNode*);
-static ExpressionNode* combineCommaNodes(JSGlobalData*, ExpressionNode* list, ExpressionNode* init);
-
-#if COMPILER(MSVC)
-
-#pragma warning(disable: 4065)
-#pragma warning(disable: 4244)
-#pragma warning(disable: 4702)
-
-#endif
-
-#define YYPARSE_PARAM globalPtr
-#define YYLEX_PARAM globalPtr
-
-template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node,
- ParserArenaData<DeclarationStacks::VarStack>* varDecls,
- ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
- CodeFeatures info, int numConstants)
-{
- ASSERT((info & ~AllFeatures) == 0);
- NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants };
- return result;
-}
-
-template <typename T> inline NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
-{
- ASSERT((info & ~AllFeatures) == 0);
- NodeInfo<T> result = { node, info, numConstants };
- return result;
-}
-
-template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
-{
- // decls1 or both are null
- if (!decls1)
- return decls2;
- // only decls1 is non-null
- if (!decls2)
- return decls1;
-
- // Both are non-null
- decls1->data.append(decls2->data);
-
- // Manually release as much as possible from the now-defunct declaration lists
- // to avoid accumulating so many unused heap allocated vectors.
- decls2->data.clear();
-
- return decls1;
-}
-
-static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
-{
- if (!varDecls)
- varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>;
-
- varDecls->data.append(make_pair(&ident, attrs));
-}
-
-static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
-{
- unsigned attrs = DeclarationStacks::IsConstant;
- if (decl->hasInitializer())
- attrs |= DeclarationStacks::HasInitializer;
- appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs);
-}
-
-
-
-/* Line 189 of yacc.c */
-#line 225 "/JavaScriptCore/generated/Grammar.tab.c"
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NULLTOKEN = 258,
- TRUETOKEN = 259,
- FALSETOKEN = 260,
- BREAK = 261,
- CASE = 262,
- DEFAULT = 263,
- FOR = 264,
- NEW = 265,
- VAR = 266,
- CONSTTOKEN = 267,
- CONTINUE = 268,
- FUNCTION = 269,
- RETURN = 270,
- VOIDTOKEN = 271,
- DELETETOKEN = 272,
- IF = 273,
- THISTOKEN = 274,
- DO = 275,
- WHILE = 276,
- INTOKEN = 277,
- INSTANCEOF = 278,
- TYPEOF = 279,
- SWITCH = 280,
- WITH = 281,
- RESERVED = 282,
- THROW = 283,
- TRY = 284,
- CATCH = 285,
- FINALLY = 286,
- DEBUGGER = 287,
- IF_WITHOUT_ELSE = 288,
- ELSE = 289,
- EQEQ = 290,
- NE = 291,
- STREQ = 292,
- STRNEQ = 293,
- LE = 294,
- GE = 295,
- OR = 296,
- AND = 297,
- PLUSPLUS = 298,
- MINUSMINUS = 299,
- LSHIFT = 300,
- RSHIFT = 301,
- URSHIFT = 302,
- PLUSEQUAL = 303,
- MINUSEQUAL = 304,
- MULTEQUAL = 305,
- DIVEQUAL = 306,
- LSHIFTEQUAL = 307,
- RSHIFTEQUAL = 308,
- URSHIFTEQUAL = 309,
- ANDEQUAL = 310,
- MODEQUAL = 311,
- XOREQUAL = 312,
- OREQUAL = 313,
- OPENBRACE = 314,
- CLOSEBRACE = 315,
- NUMBER = 316,
- IDENT = 317,
- STRING = 318,
- AUTOPLUSPLUS = 319,
- AUTOMINUSMINUS = 320
- };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-
-/* Line 214 of yacc.c */
-#line 146 "parser/Grammar.y"
-
- int intValue;
- double doubleValue;
- const Identifier* ident;
-
- // expression subtrees
- ExpressionNodeInfo expressionNode;
- FuncDeclNodeInfo funcDeclNode;
- PropertyNodeInfo propertyNode;
- ArgumentsNodeInfo argumentsNode;
- ConstDeclNodeInfo constDeclNode;
- CaseBlockNodeInfo caseBlockNode;
- CaseClauseNodeInfo caseClauseNode;
- FuncExprNodeInfo funcExprNode;
-
- // statement nodes
- StatementNodeInfo statementNode;
- FunctionBodyNode* functionBodyNode;
- ProgramNode* programNode;
-
- SourceElementsInfo sourceElements;
- PropertyListInfo propertyList;
- ArgumentListInfo argumentList;
- VarDeclListInfo varDeclList;
- ConstDeclListInfo constDeclList;
- ClauseListInfo clauseList;
- ElementListInfo elementList;
- ParameterListInfo parameterList;
-
- Operator op;
-
-
-
-/* Line 214 of yacc.c */
-#line 360 "/JavaScriptCore/generated/Grammar.tab.c"
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE
-{
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-} YYLTYPE;
-# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-/* Copy the second part of user declarations. */
-
-/* Line 264 of yacc.c */
-#line 178 "parser/Grammar.y"
-
-
-template <typename T> inline void setStatementLocation(StatementNode* statement, const T& start, const T& end)
-{
- statement->setLoc(start.first_line, end.last_line);
-}
-
-static inline void setExceptionLocation(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end)
-{
- node->setExceptionSourceCode(divot, divot - start, end - divot);
-}
-
-
-
-/* Line 264 of yacc.c */
-#line 400 "/JavaScriptCore/generated/Grammar.tab.c"
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
-#else
-typedef short int yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(msgid) msgid
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
-#else
-# define YYUSE(e) /* empty */
-#endif
-
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
- int yyi;
-#endif
-{
- return yyi;
-}
-#endif
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
- && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
- YYLTYPE yyls_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
- + 2 * YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
-
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 206
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 2349
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 88
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 194
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 597
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 1082
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 320
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const yytype_uint8 yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 77, 2, 2, 2, 79, 82, 2,
- 68, 69, 78, 74, 70, 75, 73, 66, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 67, 87,
- 80, 86, 81, 85, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 71, 2, 72, 83, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 84, 2, 76, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] =
-{
- 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
- 21, 25, 29, 37, 46, 48, 52, 54, 57, 61,
- 66, 68, 70, 72, 74, 78, 82, 86, 92, 95,
- 100, 101, 103, 105, 108, 110, 112, 117, 121, 125,
- 127, 132, 136, 140, 142, 145, 147, 150, 153, 156,
- 161, 165, 168, 171, 176, 180, 183, 187, 189, 193,
- 195, 197, 199, 201, 203, 206, 209, 211, 214, 217,
- 220, 223, 226, 229, 232, 235, 238, 241, 244, 247,
- 250, 252, 254, 256, 258, 260, 264, 268, 272, 274,
- 278, 282, 286, 288, 292, 296, 298, 302, 306, 308,
- 312, 316, 320, 322, 326, 330, 334, 336, 340, 344,
- 348, 352, 356, 360, 362, 366, 370, 374, 378, 382,
- 384, 388, 392, 396, 400, 404, 408, 410, 414, 418,
- 422, 426, 428, 432, 436, 440, 444, 446, 450, 454,
- 458, 462, 464, 468, 470, 474, 476, 480, 482, 486,
- 488, 492, 494, 498, 500, 504, 506, 510, 512, 516,
- 518, 522, 524, 528, 530, 534, 536, 540, 542, 546,
- 548, 552, 554, 560, 562, 568, 570, 576, 578, 582,
- 584, 588, 590, 594, 596, 598, 600, 602, 604, 606,
- 608, 610, 612, 614, 616, 618, 620, 624, 626, 630,
- 632, 636, 638, 640, 642, 644, 646, 648, 650, 652,
- 654, 656, 658, 660, 662, 664, 666, 668, 670, 673,
- 677, 681, 685, 687, 690, 694, 699, 701, 704, 708,
- 713, 717, 721, 723, 727, 729, 732, 735, 738, 740,
- 743, 746, 752, 760, 768, 776, 782, 792, 803, 811,
- 820, 830, 831, 833, 834, 836, 839, 842, 846, 850,
- 853, 856, 860, 864, 867, 870, 874, 878, 884, 890,
- 894, 900, 901, 903, 905, 908, 912, 917, 920, 924,
- 928, 932, 936, 941, 949, 959, 962, 965, 973, 982,
- 989, 997, 1005, 1014, 1016, 1020, 1021, 1023, 1024, 1026,
- 1028, 1031, 1033, 1035, 1037, 1039, 1041, 1043, 1045, 1049,
- 1053, 1057, 1065, 1074, 1076, 1080, 1082, 1085, 1089, 1094,
- 1096, 1098, 1100, 1102, 1106, 1110, 1114, 1120, 1123, 1128,
- 1129, 1131, 1133, 1136, 1138, 1140, 1145, 1149, 1153, 1155,
- 1160, 1164, 1168, 1170, 1173, 1175, 1178, 1181, 1184, 1189,
- 1193, 1196, 1199, 1204, 1208, 1211, 1215, 1217, 1221, 1223,
- 1225, 1227, 1229, 1231, 1234, 1237, 1239, 1242, 1245, 1248,
- 1251, 1254, 1257, 1260, 1263, 1266, 1269, 1272, 1275, 1278,
- 1280, 1282, 1284, 1286, 1288, 1292, 1296, 1300, 1302, 1306,
- 1310, 1314, 1316, 1320, 1324, 1326, 1330, 1334, 1336, 1340,
- 1344, 1348, 1350, 1354, 1358, 1362, 1364, 1368, 1372, 1376,
- 1380, 1384, 1388, 1390, 1394, 1398, 1402, 1406, 1410, 1412,
- 1416, 1420, 1424, 1428, 1432, 1436, 1438, 1442, 1446, 1450,
- 1454, 1456, 1460, 1464, 1468, 1472, 1474, 1478, 1482, 1486,
- 1490, 1492, 1496, 1498, 1502, 1504, 1508, 1510, 1514, 1516,
- 1520, 1522, 1526, 1528, 1532, 1534, 1538, 1540, 1544, 1546,
- 1550, 1552, 1556, 1558, 1562, 1564, 1568, 1570, 1574, 1576,
- 1580, 1582, 1588, 1590, 1596, 1598, 1604, 1606, 1610, 1612,
- 1616, 1618, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636,
- 1638, 1640, 1642, 1644, 1646, 1648, 1652, 1654, 1658, 1660,
- 1664, 1666, 1668, 1670, 1672, 1674, 1676, 1678, 1680, 1682,
- 1684, 1686, 1688, 1690, 1692, 1694, 1696, 1698, 1701, 1705,
- 1709, 1713, 1715, 1718, 1722, 1727, 1729, 1732, 1736, 1741,
- 1745, 1749, 1751, 1755, 1757, 1760, 1763, 1766, 1768, 1771,
- 1774, 1780, 1788, 1796, 1804, 1810, 1820, 1831, 1839, 1848,
- 1858, 1859, 1861, 1862, 1864, 1867, 1870, 1874, 1878, 1881,
- 1884, 1888, 1892, 1895, 1898, 1902, 1906, 1912, 1918, 1922,
- 1928, 1929, 1931, 1933, 1936, 1940, 1945, 1948, 1952, 1956,
- 1960, 1964, 1969, 1977, 1987, 1990, 1993, 2001, 2010, 2017,
- 2025, 2033, 2042, 2044, 2048, 2049, 2051, 2053
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int16 yyrhs[] =
-{
- 184, 0, -1, 3, -1, 4, -1, 5, -1, 61,
- -1, 63, -1, 66, -1, 51, -1, 62, 67, 143,
- -1, 63, 67, 143, -1, 61, 67, 143, -1, 62,
- 62, 68, 69, 59, 183, 60, -1, 62, 62, 68,
- 182, 69, 59, 183, 60, -1, 90, -1, 91, 70,
- 90, -1, 93, -1, 59, 60, -1, 59, 91, 60,
- -1, 59, 91, 70, 60, -1, 19, -1, 89, -1,
- 94, -1, 62, -1, 68, 147, 69, -1, 71, 96,
- 72, -1, 71, 95, 72, -1, 71, 95, 70, 96,
- 72, -1, 96, 143, -1, 95, 70, 96, 143, -1,
- -1, 97, -1, 70, -1, 97, 70, -1, 92, -1,
- 181, -1, 98, 71, 147, 72, -1, 98, 73, 62,
- -1, 10, 98, 104, -1, 93, -1, 99, 71, 147,
- 72, -1, 99, 73, 62, -1, 10, 98, 104, -1,
- 98, -1, 10, 100, -1, 99, -1, 10, 100, -1,
- 98, 104, -1, 102, 104, -1, 102, 71, 147, 72,
- -1, 102, 73, 62, -1, 99, 104, -1, 103, 104,
- -1, 103, 71, 147, 72, -1, 103, 73, 62, -1,
- 68, 69, -1, 68, 105, 69, -1, 143, -1, 105,
- 70, 143, -1, 100, -1, 102, -1, 101, -1, 103,
- -1, 106, -1, 106, 43, -1, 106, 44, -1, 107,
- -1, 107, 43, -1, 107, 44, -1, 17, 111, -1,
- 16, 111, -1, 24, 111, -1, 43, 111, -1, 64,
- 111, -1, 44, 111, -1, 65, 111, -1, 74, 111,
- -1, 75, 111, -1, 76, 111, -1, 77, 111, -1,
- 108, -1, 110, -1, 109, -1, 110, -1, 111, -1,
- 113, 78, 111, -1, 113, 66, 111, -1, 113, 79,
- 111, -1, 112, -1, 114, 78, 111, -1, 114, 66,
- 111, -1, 114, 79, 111, -1, 113, -1, 115, 74,
- 113, -1, 115, 75, 113, -1, 114, -1, 116, 74,
- 113, -1, 116, 75, 113, -1, 115, -1, 117, 45,
- 115, -1, 117, 46, 115, -1, 117, 47, 115, -1,
- 116, -1, 118, 45, 115, -1, 118, 46, 115, -1,
- 118, 47, 115, -1, 117, -1, 119, 80, 117, -1,
- 119, 81, 117, -1, 119, 39, 117, -1, 119, 40,
- 117, -1, 119, 23, 117, -1, 119, 22, 117, -1,
- 117, -1, 120, 80, 117, -1, 120, 81, 117, -1,
- 120, 39, 117, -1, 120, 40, 117, -1, 120, 23,
- 117, -1, 118, -1, 121, 80, 117, -1, 121, 81,
- 117, -1, 121, 39, 117, -1, 121, 40, 117, -1,
- 121, 23, 117, -1, 121, 22, 117, -1, 119, -1,
- 122, 35, 119, -1, 122, 36, 119, -1, 122, 37,
- 119, -1, 122, 38, 119, -1, 120, -1, 123, 35,
- 120, -1, 123, 36, 120, -1, 123, 37, 120, -1,
- 123, 38, 120, -1, 121, -1, 124, 35, 119, -1,
- 124, 36, 119, -1, 124, 37, 119, -1, 124, 38,
- 119, -1, 122, -1, 125, 82, 122, -1, 123, -1,
- 126, 82, 123, -1, 124, -1, 127, 82, 122, -1,
- 125, -1, 128, 83, 125, -1, 126, -1, 129, 83,
- 126, -1, 127, -1, 130, 83, 125, -1, 128, -1,
- 131, 84, 128, -1, 129, -1, 132, 84, 129, -1,
- 130, -1, 133, 84, 128, -1, 131, -1, 134, 42,
- 131, -1, 132, -1, 135, 42, 132, -1, 133, -1,
- 136, 42, 131, -1, 134, -1, 137, 41, 134, -1,
- 135, -1, 138, 41, 135, -1, 136, -1, 139, 41,
- 134, -1, 137, -1, 137, 85, 143, 67, 143, -1,
- 138, -1, 138, 85, 144, 67, 144, -1, 139, -1,
- 139, 85, 143, 67, 143, -1, 140, -1, 106, 146,
- 143, -1, 141, -1, 106, 146, 144, -1, 142, -1,
- 107, 146, 143, -1, 86, -1, 48, -1, 49, -1,
- 50, -1, 51, -1, 52, -1, 53, -1, 54, -1,
- 55, -1, 57, -1, 58, -1, 56, -1, 143, -1,
- 147, 70, 143, -1, 144, -1, 148, 70, 144, -1,
- 145, -1, 149, 70, 143, -1, 151, -1, 152, -1,
- 155, -1, 180, -1, 160, -1, 161, -1, 162, -1,
- 163, -1, 166, -1, 167, -1, 168, -1, 169, -1,
- 170, -1, 176, -1, 177, -1, 178, -1, 179, -1,
- 59, 60, -1, 59, 185, 60, -1, 11, 153, 87,
- -1, 11, 153, 1, -1, 62, -1, 62, 158, -1,
- 153, 70, 62, -1, 153, 70, 62, 158, -1, 62,
- -1, 62, 159, -1, 154, 70, 62, -1, 154, 70,
- 62, 159, -1, 12, 156, 87, -1, 12, 156, 1,
- -1, 157, -1, 156, 70, 157, -1, 62, -1, 62,
- 158, -1, 86, 143, -1, 86, 144, -1, 87, -1,
- 149, 87, -1, 149, 1, -1, 18, 68, 147, 69,
- 150, -1, 18, 68, 147, 69, 150, 34, 150, -1,
- 20, 150, 21, 68, 147, 69, 87, -1, 20, 150,
- 21, 68, 147, 69, 1, -1, 21, 68, 147, 69,
- 150, -1, 9, 68, 165, 87, 164, 87, 164, 69,
- 150, -1, 9, 68, 11, 154, 87, 164, 87, 164,
- 69, 150, -1, 9, 68, 106, 22, 147, 69, 150,
- -1, 9, 68, 11, 62, 22, 147, 69, 150, -1,
- 9, 68, 11, 62, 159, 22, 147, 69, 150, -1,
- -1, 147, -1, -1, 148, -1, 13, 87, -1, 13,
- 1, -1, 13, 62, 87, -1, 13, 62, 1, -1,
- 6, 87, -1, 6, 1, -1, 6, 62, 87, -1,
- 6, 62, 1, -1, 15, 87, -1, 15, 1, -1,
- 15, 147, 87, -1, 15, 147, 1, -1, 26, 68,
- 147, 69, 150, -1, 25, 68, 147, 69, 171, -1,
- 59, 172, 60, -1, 59, 172, 175, 172, 60, -1,
- -1, 173, -1, 174, -1, 173, 174, -1, 7, 147,
- 67, -1, 7, 147, 67, 185, -1, 8, 67, -1,
- 8, 67, 185, -1, 62, 67, 150, -1, 28, 147,
- 87, -1, 28, 147, 1, -1, 29, 151, 31, 151,
- -1, 29, 151, 30, 68, 62, 69, 151, -1, 29,
- 151, 30, 68, 62, 69, 151, 31, 151, -1, 32,
- 87, -1, 32, 1, -1, 14, 62, 68, 69, 59,
- 183, 60, -1, 14, 62, 68, 182, 69, 59, 183,
- 60, -1, 14, 68, 69, 59, 183, 60, -1, 14,
- 68, 182, 69, 59, 183, 60, -1, 14, 62, 68,
- 69, 59, 183, 60, -1, 14, 62, 68, 182, 69,
- 59, 183, 60, -1, 62, -1, 182, 70, 62, -1,
- -1, 281, -1, -1, 185, -1, 150, -1, 185, 150,
- -1, 3, -1, 4, -1, 5, -1, 61, -1, 63,
- -1, 66, -1, 51, -1, 62, 67, 240, -1, 63,
- 67, 240, -1, 61, 67, 240, -1, 62, 62, 68,
- 69, 59, 280, 60, -1, 62, 62, 68, 279, 69,
- 59, 280, 60, -1, 187, -1, 188, 70, 187, -1,
- 190, -1, 59, 60, -1, 59, 188, 60, -1, 59,
- 188, 70, 60, -1, 19, -1, 186, -1, 191, -1,
- 62, -1, 68, 244, 69, -1, 71, 193, 72, -1,
- 71, 192, 72, -1, 71, 192, 70, 193, 72, -1,
- 193, 240, -1, 192, 70, 193, 240, -1, -1, 194,
- -1, 70, -1, 194, 70, -1, 189, -1, 278, -1,
- 195, 71, 244, 72, -1, 195, 73, 62, -1, 10,
- 195, 201, -1, 190, -1, 196, 71, 244, 72, -1,
- 196, 73, 62, -1, 10, 195, 201, -1, 195, -1,
- 10, 197, -1, 196, -1, 10, 197, -1, 195, 201,
- -1, 199, 201, -1, 199, 71, 244, 72, -1, 199,
- 73, 62, -1, 196, 201, -1, 200, 201, -1, 200,
- 71, 244, 72, -1, 200, 73, 62, -1, 68, 69,
- -1, 68, 202, 69, -1, 240, -1, 202, 70, 240,
- -1, 197, -1, 199, -1, 198, -1, 200, -1, 203,
- -1, 203, 43, -1, 203, 44, -1, 204, -1, 204,
- 43, -1, 204, 44, -1, 17, 208, -1, 16, 208,
- -1, 24, 208, -1, 43, 208, -1, 64, 208, -1,
- 44, 208, -1, 65, 208, -1, 74, 208, -1, 75,
- 208, -1, 76, 208, -1, 77, 208, -1, 205, -1,
- 207, -1, 206, -1, 207, -1, 208, -1, 210, 78,
- 208, -1, 210, 66, 208, -1, 210, 79, 208, -1,
- 209, -1, 211, 78, 208, -1, 211, 66, 208, -1,
- 211, 79, 208, -1, 210, -1, 212, 74, 210, -1,
- 212, 75, 210, -1, 211, -1, 213, 74, 210, -1,
- 213, 75, 210, -1, 212, -1, 214, 45, 212, -1,
- 214, 46, 212, -1, 214, 47, 212, -1, 213, -1,
- 215, 45, 212, -1, 215, 46, 212, -1, 215, 47,
- 212, -1, 214, -1, 216, 80, 214, -1, 216, 81,
- 214, -1, 216, 39, 214, -1, 216, 40, 214, -1,
- 216, 23, 214, -1, 216, 22, 214, -1, 214, -1,
- 217, 80, 214, -1, 217, 81, 214, -1, 217, 39,
- 214, -1, 217, 40, 214, -1, 217, 23, 214, -1,
- 215, -1, 218, 80, 214, -1, 218, 81, 214, -1,
- 218, 39, 214, -1, 218, 40, 214, -1, 218, 23,
- 214, -1, 218, 22, 214, -1, 216, -1, 219, 35,
- 216, -1, 219, 36, 216, -1, 219, 37, 216, -1,
- 219, 38, 216, -1, 217, -1, 220, 35, 217, -1,
- 220, 36, 217, -1, 220, 37, 217, -1, 220, 38,
- 217, -1, 218, -1, 221, 35, 216, -1, 221, 36,
- 216, -1, 221, 37, 216, -1, 221, 38, 216, -1,
- 219, -1, 222, 82, 219, -1, 220, -1, 223, 82,
- 220, -1, 221, -1, 224, 82, 219, -1, 222, -1,
- 225, 83, 222, -1, 223, -1, 226, 83, 223, -1,
- 224, -1, 227, 83, 222, -1, 225, -1, 228, 84,
- 225, -1, 226, -1, 229, 84, 226, -1, 227, -1,
- 230, 84, 225, -1, 228, -1, 231, 42, 228, -1,
- 229, -1, 232, 42, 229, -1, 230, -1, 233, 42,
- 228, -1, 231, -1, 234, 41, 231, -1, 232, -1,
- 235, 41, 232, -1, 233, -1, 236, 41, 231, -1,
- 234, -1, 234, 85, 240, 67, 240, -1, 235, -1,
- 235, 85, 241, 67, 241, -1, 236, -1, 236, 85,
- 240, 67, 240, -1, 237, -1, 203, 243, 240, -1,
- 238, -1, 203, 243, 241, -1, 239, -1, 204, 243,
- 240, -1, 86, -1, 48, -1, 49, -1, 50, -1,
- 51, -1, 52, -1, 53, -1, 54, -1, 55, -1,
- 57, -1, 58, -1, 56, -1, 240, -1, 244, 70,
- 240, -1, 241, -1, 245, 70, 241, -1, 242, -1,
- 246, 70, 240, -1, 248, -1, 249, -1, 252, -1,
- 277, -1, 257, -1, 258, -1, 259, -1, 260, -1,
- 263, -1, 264, -1, 265, -1, 266, -1, 267, -1,
- 273, -1, 274, -1, 275, -1, 276, -1, 59, 60,
- -1, 59, 281, 60, -1, 11, 250, 87, -1, 11,
- 250, 1, -1, 62, -1, 62, 255, -1, 250, 70,
- 62, -1, 250, 70, 62, 255, -1, 62, -1, 62,
- 256, -1, 251, 70, 62, -1, 251, 70, 62, 256,
- -1, 12, 253, 87, -1, 12, 253, 1, -1, 254,
- -1, 253, 70, 254, -1, 62, -1, 62, 255, -1,
- 86, 240, -1, 86, 241, -1, 87, -1, 246, 87,
- -1, 246, 1, -1, 18, 68, 244, 69, 247, -1,
- 18, 68, 244, 69, 247, 34, 247, -1, 20, 247,
- 21, 68, 244, 69, 87, -1, 20, 247, 21, 68,
- 244, 69, 1, -1, 21, 68, 244, 69, 247, -1,
- 9, 68, 262, 87, 261, 87, 261, 69, 247, -1,
- 9, 68, 11, 251, 87, 261, 87, 261, 69, 247,
- -1, 9, 68, 203, 22, 244, 69, 247, -1, 9,
- 68, 11, 62, 22, 244, 69, 247, -1, 9, 68,
- 11, 62, 256, 22, 244, 69, 247, -1, -1, 244,
- -1, -1, 245, -1, 13, 87, -1, 13, 1, -1,
- 13, 62, 87, -1, 13, 62, 1, -1, 6, 87,
- -1, 6, 1, -1, 6, 62, 87, -1, 6, 62,
- 1, -1, 15, 87, -1, 15, 1, -1, 15, 244,
- 87, -1, 15, 244, 1, -1, 26, 68, 244, 69,
- 247, -1, 25, 68, 244, 69, 268, -1, 59, 269,
- 60, -1, 59, 269, 272, 269, 60, -1, -1, 270,
- -1, 271, -1, 270, 271, -1, 7, 244, 67, -1,
- 7, 244, 67, 281, -1, 8, 67, -1, 8, 67,
- 281, -1, 62, 67, 247, -1, 28, 244, 87, -1,
- 28, 244, 1, -1, 29, 248, 31, 248, -1, 29,
- 248, 30, 68, 62, 69, 248, -1, 29, 248, 30,
- 68, 62, 69, 248, 31, 248, -1, 32, 87, -1,
- 32, 1, -1, 14, 62, 68, 69, 59, 280, 60,
- -1, 14, 62, 68, 279, 69, 59, 280, 60, -1,
- 14, 68, 69, 59, 280, 60, -1, 14, 68, 279,
- 69, 59, 280, 60, -1, 14, 62, 68, 69, 59,
- 280, 60, -1, 14, 62, 68, 279, 69, 59, 280,
- 60, -1, 62, -1, 279, 70, 62, -1, -1, 281,
- -1, 247, -1, 281, 247, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
-{
- 0, 293, 293, 294, 295, 296, 297, 298, 309, 323,
- 324, 325, 326, 327, 339, 343, 350, 351, 352, 354,
- 358, 359, 360, 361, 362, 366, 367, 368, 372, 376,
- 384, 385, 389, 390, 394, 395, 396, 400, 404, 411,
- 412, 416, 420, 427, 428, 435, 436, 443, 444, 445,
- 449, 455, 456, 457, 461, 468, 469, 473, 477, 484,
- 485, 489, 490, 494, 495, 496, 500, 501, 502, 506,
- 507, 508, 509, 510, 511, 512, 513, 514, 515, 516,
- 519, 520, 524, 525, 529, 530, 531, 532, 536, 537,
- 539, 541, 546, 547, 548, 552, 553, 555, 560, 561,
- 562, 563, 567, 568, 569, 570, 574, 575, 576, 577,
- 578, 579, 582, 588, 589, 590, 591, 592, 593, 600,
- 601, 602, 603, 604, 605, 609, 616, 617, 618, 619,
- 620, 624, 625, 627, 629, 631, 636, 637, 639, 640,
- 642, 647, 648, 652, 653, 658, 659, 663, 664, 668,
- 669, 674, 675, 680, 681, 685, 686, 691, 692, 697,
- 698, 702, 703, 708, 709, 714, 715, 719, 720, 725,
- 726, 730, 731, 736, 737, 742, 743, 748, 749, 756,
- 757, 764, 765, 772, 773, 774, 775, 776, 777, 778,
- 779, 780, 781, 782, 783, 787, 788, 792, 793, 797,
- 798, 802, 803, 804, 805, 806, 807, 808, 809, 810,
- 811, 812, 813, 814, 815, 816, 817, 818, 822, 824,
- 829, 831, 837, 844, 853, 861, 874, 881, 890, 898,
- 911, 913, 919, 927, 939, 940, 944, 948, 952, 956,
- 958, 963, 966, 976, 978, 980, 982, 988, 995, 1004,
- 1010, 1021, 1022, 1026, 1027, 1031, 1035, 1039, 1043, 1050,
- 1053, 1056, 1059, 1065, 1068, 1071, 1074, 1080, 1086, 1092,
- 1093, 1102, 1103, 1107, 1113, 1123, 1124, 1128, 1129, 1133,
- 1139, 1143, 1150, 1156, 1162, 1172, 1174, 1179, 1180, 1191,
- 1192, 1199, 1200, 1210, 1213, 1219, 1220, 1224, 1225, 1230,
- 1237, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1258, 1259,
- 1260, 1261, 1262, 1266, 1267, 1271, 1272, 1273, 1275, 1279,
- 1280, 1281, 1282, 1283, 1287, 1288, 1289, 1293, 1294, 1297,
- 1299, 1303, 1304, 1308, 1309, 1310, 1311, 1312, 1316, 1317,
- 1318, 1319, 1323, 1324, 1328, 1329, 1333, 1334, 1335, 1336,
- 1340, 1341, 1342, 1343, 1347, 1348, 1352, 1353, 1357, 1358,
- 1362, 1363, 1367, 1368, 1369, 1373, 1374, 1375, 1379, 1380,
- 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1392,
- 1393, 1397, 1398, 1402, 1403, 1404, 1405, 1409, 1410, 1411,
- 1412, 1416, 1417, 1418, 1422, 1423, 1424, 1428, 1429, 1430,
- 1431, 1435, 1436, 1437, 1438, 1442, 1443, 1444, 1445, 1446,
- 1447, 1448, 1452, 1453, 1454, 1455, 1456, 1457, 1461, 1462,
- 1463, 1464, 1465, 1466, 1467, 1471, 1472, 1473, 1474, 1475,
- 1479, 1480, 1481, 1482, 1483, 1487, 1488, 1489, 1490, 1491,
- 1495, 1496, 1500, 1501, 1505, 1506, 1510, 1511, 1515, 1516,
- 1520, 1521, 1525, 1526, 1530, 1531, 1535, 1536, 1540, 1541,
- 1545, 1546, 1550, 1551, 1555, 1556, 1560, 1561, 1565, 1566,
- 1570, 1571, 1575, 1576, 1580, 1581, 1585, 1586, 1590, 1591,
- 1595, 1596, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607,
- 1608, 1609, 1610, 1611, 1615, 1616, 1620, 1621, 1625, 1626,
- 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639,
- 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1650, 1651, 1655,
- 1656, 1660, 1661, 1662, 1663, 1667, 1668, 1669, 1670, 1674,
- 1675, 1679, 1680, 1684, 1685, 1689, 1693, 1697, 1701, 1702,
- 1706, 1707, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718,
- 1721, 1723, 1726, 1728, 1732, 1733, 1734, 1735, 1739, 1740,
- 1741, 1742, 1746, 1747, 1748, 1749, 1753, 1757, 1761, 1762,
- 1765, 1767, 1771, 1772, 1776, 1777, 1781, 1782, 1786, 1790,
- 1791, 1795, 1796, 1797, 1801, 1802, 1806, 1807, 1811, 1812,
- 1813, 1814, 1818, 1819, 1822, 1824, 1828, 1829
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "NULLTOKEN", "TRUETOKEN", "FALSETOKEN",
- "BREAK", "CASE", "DEFAULT", "FOR", "NEW", "VAR", "CONSTTOKEN",
- "CONTINUE", "FUNCTION", "RETURN", "VOIDTOKEN", "DELETETOKEN", "IF",
- "THISTOKEN", "DO", "WHILE", "INTOKEN", "INSTANCEOF", "TYPEOF", "SWITCH",
- "WITH", "RESERVED", "THROW", "TRY", "CATCH", "FINALLY", "DEBUGGER",
- "IF_WITHOUT_ELSE", "ELSE", "EQEQ", "NE", "STREQ", "STRNEQ", "LE", "GE",
- "OR", "AND", "PLUSPLUS", "MINUSMINUS", "LSHIFT", "RSHIFT", "URSHIFT",
- "PLUSEQUAL", "MINUSEQUAL", "MULTEQUAL", "DIVEQUAL", "LSHIFTEQUAL",
- "RSHIFTEQUAL", "URSHIFTEQUAL", "ANDEQUAL", "MODEQUAL", "XOREQUAL",
- "OREQUAL", "OPENBRACE", "CLOSEBRACE", "NUMBER", "IDENT", "STRING",
- "AUTOPLUSPLUS", "AUTOMINUSMINUS", "'/'", "':'", "'('", "')'", "','",
- "'['", "']'", "'.'", "'+'", "'-'", "'~'", "'!'", "'*'", "'%'", "'<'",
- "'>'", "'&'", "'^'", "'|'", "'?'", "'='", "';'", "$accept", "Literal",
- "Property", "PropertyList", "PrimaryExpr", "PrimaryExprNoBrace",
- "ArrayLiteral", "ElementList", "ElisionOpt", "Elision", "MemberExpr",
- "MemberExprNoBF", "NewExpr", "NewExprNoBF", "CallExpr", "CallExprNoBF",
- "Arguments", "ArgumentList", "LeftHandSideExpr", "LeftHandSideExprNoBF",
- "PostfixExpr", "PostfixExprNoBF", "UnaryExprCommon", "UnaryExpr",
- "UnaryExprNoBF", "MultiplicativeExpr", "MultiplicativeExprNoBF",
- "AdditiveExpr", "AdditiveExprNoBF", "ShiftExpr", "ShiftExprNoBF",
- "RelationalExpr", "RelationalExprNoIn", "RelationalExprNoBF",
- "EqualityExpr", "EqualityExprNoIn", "EqualityExprNoBF", "BitwiseANDExpr",
- "BitwiseANDExprNoIn", "BitwiseANDExprNoBF", "BitwiseXORExpr",
- "BitwiseXORExprNoIn", "BitwiseXORExprNoBF", "BitwiseORExpr",
- "BitwiseORExprNoIn", "BitwiseORExprNoBF", "LogicalANDExpr",
- "LogicalANDExprNoIn", "LogicalANDExprNoBF", "LogicalORExpr",
- "LogicalORExprNoIn", "LogicalORExprNoBF", "ConditionalExpr",
- "ConditionalExprNoIn", "ConditionalExprNoBF", "AssignmentExpr",
- "AssignmentExprNoIn", "AssignmentExprNoBF", "AssignmentOperator", "Expr",
- "ExprNoIn", "ExprNoBF", "Statement", "Block", "VariableStatement",
- "VariableDeclarationList", "VariableDeclarationListNoIn",
- "ConstStatement", "ConstDeclarationList", "ConstDeclaration",
- "Initializer", "InitializerNoIn", "EmptyStatement", "ExprStatement",
- "IfStatement", "IterationStatement", "ExprOpt", "ExprNoInOpt",
- "ContinueStatement", "BreakStatement", "ReturnStatement",
- "WithStatement", "SwitchStatement", "CaseBlock", "CaseClausesOpt",
- "CaseClauses", "CaseClause", "DefaultClause", "LabelledStatement",
- "ThrowStatement", "TryStatement", "DebuggerStatement",
- "FunctionDeclaration", "FunctionExpr", "FormalParameterList",
- "FunctionBody", "Program", "SourceElements", "Literal_NoNode",
- "Property_NoNode", "PropertyList_NoNode", "PrimaryExpr_NoNode",
- "PrimaryExprNoBrace_NoNode", "ArrayLiteral_NoNode", "ElementList_NoNode",
- "ElisionOpt_NoNode", "Elision_NoNode", "MemberExpr_NoNode",
- "MemberExprNoBF_NoNode", "NewExpr_NoNode", "NewExprNoBF_NoNode",
- "CallExpr_NoNode", "CallExprNoBF_NoNode", "Arguments_NoNode",
- "ArgumentList_NoNode", "LeftHandSideExpr_NoNode",
- "LeftHandSideExprNoBF_NoNode", "PostfixExpr_NoNode",
- "PostfixExprNoBF_NoNode", "UnaryExprCommon_NoNode", "UnaryExpr_NoNode",
- "UnaryExprNoBF_NoNode", "MultiplicativeExpr_NoNode",
- "MultiplicativeExprNoBF_NoNode", "AdditiveExpr_NoNode",
- "AdditiveExprNoBF_NoNode", "ShiftExpr_NoNode", "ShiftExprNoBF_NoNode",
- "RelationalExpr_NoNode", "RelationalExprNoIn_NoNode",
- "RelationalExprNoBF_NoNode", "EqualityExpr_NoNode",
- "EqualityExprNoIn_NoNode", "EqualityExprNoBF_NoNode",
- "BitwiseANDExpr_NoNode", "BitwiseANDExprNoIn_NoNode",
- "BitwiseANDExprNoBF_NoNode", "BitwiseXORExpr_NoNode",
- "BitwiseXORExprNoIn_NoNode", "BitwiseXORExprNoBF_NoNode",
- "BitwiseORExpr_NoNode", "BitwiseORExprNoIn_NoNode",
- "BitwiseORExprNoBF_NoNode", "LogicalANDExpr_NoNode",
- "LogicalANDExprNoIn_NoNode", "LogicalANDExprNoBF_NoNode",
- "LogicalORExpr_NoNode", "LogicalORExprNoIn_NoNode",
- "LogicalORExprNoBF_NoNode", "ConditionalExpr_NoNode",
- "ConditionalExprNoIn_NoNode", "ConditionalExprNoBF_NoNode",
- "AssignmentExpr_NoNode", "AssignmentExprNoIn_NoNode",
- "AssignmentExprNoBF_NoNode", "AssignmentOperator_NoNode", "Expr_NoNode",
- "ExprNoIn_NoNode", "ExprNoBF_NoNode", "Statement_NoNode", "Block_NoNode",
- "VariableStatement_NoNode", "VariableDeclarationList_NoNode",
- "VariableDeclarationListNoIn_NoNode", "ConstStatement_NoNode",
- "ConstDeclarationList_NoNode", "ConstDeclaration_NoNode",
- "Initializer_NoNode", "InitializerNoIn_NoNode", "EmptyStatement_NoNode",
- "ExprStatement_NoNode", "IfStatement_NoNode",
- "IterationStatement_NoNode", "ExprOpt_NoNode", "ExprNoInOpt_NoNode",
- "ContinueStatement_NoNode", "BreakStatement_NoNode",
- "ReturnStatement_NoNode", "WithStatement_NoNode",
- "SwitchStatement_NoNode", "CaseBlock_NoNode", "CaseClausesOpt_NoNode",
- "CaseClauses_NoNode", "CaseClause_NoNode", "DefaultClause_NoNode",
- "LabelledStatement_NoNode", "ThrowStatement_NoNode",
- "TryStatement_NoNode", "DebuggerStatement_NoNode",
- "FunctionDeclaration_NoNode", "FunctionExpr_NoNode",
- "FormalParameterList_NoNode", "FunctionBody_NoNode",
- "SourceElements_NoNode", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const yytype_uint16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 318, 319, 320, 47, 58, 40, 41,
- 44, 91, 93, 46, 43, 45, 126, 33, 42, 37,
- 60, 62, 38, 94, 124, 63, 61, 59
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint16 yyr1[] =
-{
- 0, 88, 89, 89, 89, 89, 89, 89, 89, 90,
- 90, 90, 90, 90, 91, 91, 92, 92, 92, 92,
- 93, 93, 93, 93, 93, 94, 94, 94, 95, 95,
- 96, 96, 97, 97, 98, 98, 98, 98, 98, 99,
- 99, 99, 99, 100, 100, 101, 101, 102, 102, 102,
- 102, 103, 103, 103, 103, 104, 104, 105, 105, 106,
- 106, 107, 107, 108, 108, 108, 109, 109, 109, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 111, 111, 112, 112, 113, 113, 113, 113, 114, 114,
- 114, 114, 115, 115, 115, 116, 116, 116, 117, 117,
- 117, 117, 118, 118, 118, 118, 119, 119, 119, 119,
- 119, 119, 119, 120, 120, 120, 120, 120, 120, 121,
- 121, 121, 121, 121, 121, 121, 122, 122, 122, 122,
- 122, 123, 123, 123, 123, 123, 124, 124, 124, 124,
- 124, 125, 125, 126, 126, 127, 127, 128, 128, 129,
- 129, 130, 130, 131, 131, 132, 132, 133, 133, 134,
- 134, 135, 135, 136, 136, 137, 137, 138, 138, 139,
- 139, 140, 140, 141, 141, 142, 142, 143, 143, 144,
- 144, 145, 145, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 146, 146, 146, 147, 147, 148, 148, 149,
- 149, 150, 150, 150, 150, 150, 150, 150, 150, 150,
- 150, 150, 150, 150, 150, 150, 150, 150, 151, 151,
- 152, 152, 153, 153, 153, 153, 154, 154, 154, 154,
- 155, 155, 156, 156, 157, 157, 158, 159, 160, 161,
- 161, 162, 162, 163, 163, 163, 163, 163, 163, 163,
- 163, 164, 164, 165, 165, 166, 166, 166, 166, 167,
- 167, 167, 167, 168, 168, 168, 168, 169, 170, 171,
- 171, 172, 172, 173, 173, 174, 174, 175, 175, 176,
- 177, 177, 178, 178, 178, 179, 179, 180, 180, 181,
- 181, 181, 181, 182, 182, 183, 183, 184, 184, 185,
- 185, 186, 186, 186, 186, 186, 186, 186, 187, 187,
- 187, 187, 187, 188, 188, 189, 189, 189, 189, 190,
- 190, 190, 190, 190, 191, 191, 191, 192, 192, 193,
- 193, 194, 194, 195, 195, 195, 195, 195, 196, 196,
- 196, 196, 197, 197, 198, 198, 199, 199, 199, 199,
- 200, 200, 200, 200, 201, 201, 202, 202, 203, 203,
- 204, 204, 205, 205, 205, 206, 206, 206, 207, 207,
- 207, 207, 207, 207, 207, 207, 207, 207, 207, 208,
- 208, 209, 209, 210, 210, 210, 210, 211, 211, 211,
- 211, 212, 212, 212, 213, 213, 213, 214, 214, 214,
- 214, 215, 215, 215, 215, 216, 216, 216, 216, 216,
- 216, 216, 217, 217, 217, 217, 217, 217, 218, 218,
- 218, 218, 218, 218, 218, 219, 219, 219, 219, 219,
- 220, 220, 220, 220, 220, 221, 221, 221, 221, 221,
- 222, 222, 223, 223, 224, 224, 225, 225, 226, 226,
- 227, 227, 228, 228, 229, 229, 230, 230, 231, 231,
- 232, 232, 233, 233, 234, 234, 235, 235, 236, 236,
- 237, 237, 238, 238, 239, 239, 240, 240, 241, 241,
- 242, 242, 243, 243, 243, 243, 243, 243, 243, 243,
- 243, 243, 243, 243, 244, 244, 245, 245, 246, 246,
- 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
- 247, 247, 247, 247, 247, 247, 247, 248, 248, 249,
- 249, 250, 250, 250, 250, 251, 251, 251, 251, 252,
- 252, 253, 253, 254, 254, 255, 256, 257, 258, 258,
- 259, 259, 260, 260, 260, 260, 260, 260, 260, 260,
- 261, 261, 262, 262, 263, 263, 263, 263, 264, 264,
- 264, 264, 265, 265, 265, 265, 266, 267, 268, 268,
- 269, 269, 270, 270, 271, 271, 272, 272, 273, 274,
- 274, 275, 275, 275, 276, 276, 277, 277, 278, 278,
- 278, 278, 279, 279, 280, 280, 281, 281
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 1, 1, 1, 1, 1, 1, 1, 3,
- 3, 3, 7, 8, 1, 3, 1, 2, 3, 4,
- 1, 1, 1, 1, 3, 3, 3, 5, 2, 4,
- 0, 1, 1, 2, 1, 1, 4, 3, 3, 1,
- 4, 3, 3, 1, 2, 1, 2, 2, 2, 4,
- 3, 2, 2, 4, 3, 2, 3, 1, 3, 1,
- 1, 1, 1, 1, 2, 2, 1, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 3, 3, 3, 1, 3,
- 3, 3, 1, 3, 3, 1, 3, 3, 1, 3,
- 3, 3, 1, 3, 3, 3, 1, 3, 3, 3,
- 3, 3, 3, 1, 3, 3, 3, 3, 3, 1,
- 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
- 3, 1, 3, 3, 3, 3, 1, 3, 3, 3,
- 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
- 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
- 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
- 3, 1, 5, 1, 5, 1, 5, 1, 3, 1,
- 3, 1, 3, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 3, 1, 3, 1,
- 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 3, 3, 1, 2, 3, 4, 1, 2, 3, 4,
- 3, 3, 1, 3, 1, 2, 2, 2, 1, 2,
- 2, 5, 7, 7, 7, 5, 9, 10, 7, 8,
- 9, 0, 1, 0, 1, 2, 2, 3, 3, 2,
- 2, 3, 3, 2, 2, 3, 3, 5, 5, 3,
- 5, 0, 1, 1, 2, 3, 4, 2, 3, 3,
- 3, 3, 4, 7, 9, 2, 2, 7, 8, 6,
- 7, 7, 8, 1, 3, 0, 1, 0, 1, 1,
- 2, 1, 1, 1, 1, 1, 1, 1, 3, 3,
- 3, 7, 8, 1, 3, 1, 2, 3, 4, 1,
- 1, 1, 1, 3, 3, 3, 5, 2, 4, 0,
- 1, 1, 2, 1, 1, 4, 3, 3, 1, 4,
- 3, 3, 1, 2, 1, 2, 2, 2, 4, 3,
- 2, 2, 4, 3, 2, 3, 1, 3, 1, 1,
- 1, 1, 1, 2, 2, 1, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
- 1, 1, 1, 1, 3, 3, 3, 1, 3, 3,
- 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
- 3, 1, 3, 3, 3, 1, 3, 3, 3, 3,
- 3, 3, 1, 3, 3, 3, 3, 3, 1, 3,
- 3, 3, 3, 3, 3, 1, 3, 3, 3, 3,
- 1, 3, 3, 3, 3, 1, 3, 3, 3, 3,
- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 5, 1, 5, 1, 5, 1, 3, 1, 3,
- 1, 3, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 3, 1, 3, 1, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 2, 3, 3,
- 3, 1, 2, 3, 4, 1, 2, 3, 4, 3,
- 3, 1, 3, 1, 2, 2, 2, 1, 2, 2,
- 5, 7, 7, 7, 5, 9, 10, 7, 8, 9,
- 0, 1, 0, 1, 2, 2, 3, 3, 2, 2,
- 3, 3, 2, 2, 3, 3, 5, 5, 3, 5,
- 0, 1, 1, 2, 3, 4, 2, 3, 3, 3,
- 3, 4, 7, 9, 2, 2, 7, 8, 6, 7,
- 7, 8, 1, 3, 0, 1, 1, 2
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint16 yydefact[] =
-{
- 297, 2, 3, 4, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 20, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 8, 0, 5, 23,
- 6, 0, 0, 7, 0, 30, 0, 0, 0, 0,
- 238, 21, 39, 22, 45, 61, 62, 66, 82, 83,
- 88, 95, 102, 119, 136, 145, 151, 157, 163, 169,
- 175, 181, 199, 0, 299, 201, 202, 203, 205, 206,
- 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
- 217, 204, 0, 298, 260, 0, 259, 253, 0, 0,
- 0, 23, 34, 16, 43, 46, 35, 222, 0, 234,
- 0, 232, 256, 0, 255, 0, 264, 263, 43, 59,
- 60, 63, 80, 81, 84, 92, 98, 106, 126, 141,
- 147, 153, 159, 165, 171, 177, 195, 0, 63, 70,
- 69, 0, 0, 0, 71, 0, 0, 0, 0, 286,
- 285, 72, 74, 218, 0, 0, 73, 75, 0, 32,
- 0, 0, 31, 76, 77, 78, 79, 0, 0, 0,
- 51, 0, 0, 52, 67, 68, 184, 185, 186, 187,
- 188, 189, 190, 191, 194, 192, 193, 183, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 240, 0, 239, 1, 300, 262, 261,
- 0, 63, 113, 131, 143, 149, 155, 161, 167, 173,
- 179, 197, 254, 0, 43, 44, 0, 0, 17, 0,
- 0, 0, 14, 0, 0, 0, 42, 0, 223, 221,
- 0, 220, 235, 231, 0, 230, 258, 257, 0, 47,
- 0, 0, 48, 64, 65, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 266, 0, 265, 0, 0, 0, 0, 0, 281, 280,
- 0, 0, 219, 279, 24, 30, 26, 25, 28, 33,
- 55, 0, 57, 0, 41, 0, 54, 182, 90, 89,
- 91, 96, 97, 103, 104, 105, 125, 124, 122, 123,
- 120, 121, 137, 138, 139, 140, 146, 152, 158, 164,
- 170, 0, 200, 226, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 251, 38, 0, 293, 0, 0, 0,
- 0, 0, 0, 18, 0, 0, 37, 236, 224, 233,
- 0, 0, 0, 50, 178, 86, 85, 87, 93, 94,
- 99, 100, 101, 112, 111, 109, 110, 107, 108, 127,
- 128, 129, 130, 142, 148, 154, 160, 166, 0, 196,
- 0, 0, 0, 0, 0, 0, 282, 0, 56, 0,
- 40, 53, 0, 0, 0, 227, 0, 251, 0, 63,
- 180, 118, 116, 117, 114, 115, 132, 133, 134, 135,
- 144, 150, 156, 162, 168, 0, 198, 252, 0, 0,
- 0, 295, 0, 0, 11, 0, 9, 10, 19, 15,
- 36, 225, 295, 0, 49, 0, 241, 0, 245, 271,
- 268, 267, 0, 27, 29, 58, 176, 0, 237, 0,
- 228, 0, 0, 0, 251, 295, 0, 301, 302, 303,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 319, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 307, 0, 304, 322, 305, 0, 0, 306,
- 0, 329, 0, 0, 0, 0, 537, 0, 320, 338,
- 321, 344, 360, 361, 365, 381, 382, 387, 394, 401,
- 418, 435, 444, 450, 456, 462, 468, 474, 480, 498,
- 0, 596, 500, 501, 502, 504, 505, 506, 507, 508,
- 509, 510, 511, 512, 513, 514, 515, 516, 503, 296,
- 295, 294, 0, 0, 0, 295, 172, 0, 0, 0,
- 0, 272, 273, 0, 0, 0, 229, 251, 248, 174,
- 0, 0, 295, 559, 0, 558, 552, 0, 0, 0,
- 322, 333, 315, 342, 345, 334, 521, 0, 533, 0,
- 531, 555, 0, 554, 0, 563, 562, 342, 358, 359,
- 362, 379, 380, 383, 391, 397, 405, 425, 440, 446,
- 452, 458, 464, 470, 476, 494, 0, 362, 369, 368,
- 0, 0, 0, 370, 0, 0, 0, 0, 585, 584,
- 371, 373, 517, 0, 0, 372, 374, 0, 331, 0,
- 0, 330, 375, 376, 377, 378, 289, 0, 0, 0,
- 350, 0, 0, 351, 366, 367, 483, 484, 485, 486,
- 487, 488, 489, 490, 493, 491, 492, 482, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 539, 0, 538, 597, 0, 295, 0,
- 287, 0, 242, 244, 243, 0, 0, 269, 271, 274,
- 283, 249, 0, 0, 0, 291, 0, 561, 560, 0,
- 362, 412, 430, 442, 448, 454, 460, 466, 472, 478,
- 496, 553, 0, 342, 343, 0, 0, 316, 0, 0,
- 0, 313, 0, 0, 0, 341, 0, 522, 520, 0,
- 519, 534, 530, 0, 529, 557, 556, 0, 346, 0,
- 0, 347, 363, 364, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 565,
- 0, 564, 0, 0, 0, 0, 0, 580, 579, 0,
- 0, 518, 578, 323, 329, 325, 324, 327, 332, 354,
- 0, 356, 0, 340, 0, 353, 481, 389, 388, 390,
- 395, 396, 402, 403, 404, 424, 423, 421, 422, 419,
- 420, 436, 437, 438, 439, 445, 451, 457, 463, 469,
- 0, 499, 290, 0, 295, 288, 275, 277, 0, 0,
- 250, 0, 246, 292, 525, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 550, 337, 0, 592, 0, 0,
- 0, 0, 0, 0, 317, 0, 0, 336, 535, 523,
- 532, 0, 0, 0, 349, 477, 385, 384, 386, 392,
- 393, 398, 399, 400, 411, 410, 408, 409, 406, 407,
- 426, 427, 428, 429, 441, 447, 453, 459, 465, 0,
- 495, 0, 0, 0, 0, 0, 0, 581, 0, 355,
- 0, 339, 352, 0, 12, 0, 276, 278, 270, 284,
- 247, 0, 0, 526, 0, 550, 0, 362, 479, 417,
- 415, 416, 413, 414, 431, 432, 433, 434, 443, 449,
- 455, 461, 467, 0, 497, 551, 0, 0, 0, 594,
- 0, 0, 310, 0, 308, 309, 318, 314, 335, 524,
- 594, 0, 348, 0, 540, 0, 544, 570, 567, 566,
- 0, 326, 328, 357, 475, 13, 0, 536, 0, 527,
- 0, 0, 0, 550, 594, 0, 0, 595, 594, 593,
- 0, 0, 0, 594, 471, 0, 0, 0, 0, 571,
- 572, 0, 0, 0, 528, 550, 547, 473, 0, 0,
- 594, 588, 0, 594, 0, 586, 0, 541, 543, 542,
- 0, 0, 568, 570, 573, 582, 548, 0, 0, 0,
- 590, 0, 589, 0, 594, 587, 574, 576, 0, 0,
- 549, 0, 545, 591, 311, 0, 575, 577, 569, 583,
- 546, 312
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 41, 232, 233, 92, 93, 43, 150, 151, 152,
- 108, 44, 109, 45, 110, 46, 160, 301, 128, 47,
- 112, 48, 113, 114, 50, 115, 51, 116, 52, 117,
- 53, 118, 213, 54, 119, 214, 55, 120, 215, 56,
- 121, 216, 57, 122, 217, 58, 123, 218, 59, 124,
- 219, 60, 125, 220, 61, 126, 221, 62, 336, 437,
- 222, 63, 64, 65, 66, 98, 334, 67, 100, 101,
- 238, 415, 68, 69, 70, 71, 438, 223, 72, 73,
- 74, 75, 76, 460, 570, 571, 572, 718, 77, 78,
- 79, 80, 81, 96, 358, 517, 82, 83, 518, 751,
- 752, 591, 592, 520, 649, 650, 651, 607, 521, 608,
- 522, 609, 523, 660, 820, 627, 524, 611, 525, 612,
- 613, 527, 614, 528, 615, 529, 616, 530, 617, 732,
- 531, 618, 733, 532, 619, 734, 533, 620, 735, 534,
- 621, 736, 535, 622, 737, 536, 623, 738, 537, 624,
- 739, 538, 625, 740, 539, 867, 975, 741, 540, 541,
- 542, 543, 597, 865, 544, 599, 600, 757, 953, 545,
- 546, 547, 548, 976, 742, 549, 550, 551, 552, 553,
- 998, 1028, 1029, 1030, 1053, 554, 555, 556, 557, 558,
- 595, 889, 1016, 559
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -941
-static const yytype_int16 yypact[] =
-{
- 1516, -941, -941, -941, 44, -2, 839, 26, 178, 73,
- 192, 954, 2114, 2114, 189, -941, 1516, 207, 2114, 245,
- 275, 2114, 226, 47, 2114, 2114, -941, 1200, -941, 280,
- -941, 2114, 2114, -941, 2114, 20, 2114, 2114, 2114, 2114,
- -941, -941, -941, -941, 350, -941, 361, 2201, -941, -941,
- -941, 6, -21, 437, 446, 264, 269, 315, 306, 364,
- 9, -941, -941, 69, -941, -941, -941, -941, -941, -941,
- -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,
- -941, -941, 417, 1516, -941, 88, -941, 1670, 839, 25,
- 435, -941, -941, -941, 390, -941, -941, 338, 96, 338,
- 151, -941, -941, 90, -941, 365, -941, -941, 390, -941,
- 394, 2224, -941, -941, -941, 215, 255, 483, 509, 504,
- 374, 377, 380, 424, 14, -941, -941, 163, 445, -941,
- -941, 2114, 452, 2114, -941, 2114, 2114, 164, 486, -941,
- -941, -941, -941, -941, 1279, 1516, -941, -941, 495, -941,
- 311, 1706, 400, -941, -941, -941, -941, 1781, 2114, 418,
- -941, 2114, 432, -941, -941, -941, -941, -941, -941, -941,
- -941, -941, -941, -941, -941, -941, -941, -941, 2114, 2114,
- 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114,
- 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114,
- 2114, 2114, 2114, -941, 2114, -941, -941, -941, -941, -941,
- 442, 737, 483, 355, 583, 428, 440, 453, 491, 17,
- -941, -941, 481, 469, 390, -941, 505, 187, -941, 513,
- -5, 521, -941, 177, 2114, 539, -941, 2114, -941, -941,
- 545, -941, -941, -941, 178, -941, -941, -941, 236, -941,
- 2114, 547, -941, -941, -941, 2114, 2114, 2114, 2114, 2114,
- 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114,
- 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114,
- -941, 2114, -941, 499, 548, 559, 582, 617, -941, -941,
- 556, 226, -941, -941, -941, 20, -941, -941, -941, -941,
- -941, 628, -941, 314, -941, 329, -941, -941, -941, -941,
- -941, 215, 215, 255, 255, 255, 483, 483, 483, 483,
- 483, 483, 509, 509, 509, 509, 504, 374, 377, 380,
- 424, 546, -941, 29, -11, 2114, 2114, 2114, 2114, 2114,
- 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114,
- 2114, 2114, 2114, 2114, -941, 256, -941, 567, 632, 2114,
- 563, 2114, 2114, -941, 586, 358, -941, -941, 338, -941,
- 574, 635, 436, -941, -941, -941, -941, -941, 215, 215,
- 255, 255, 255, 483, 483, 483, 483, 483, 483, 509,
- 509, 509, 509, 504, 374, 377, 380, 424, 571, -941,
- 1516, 2114, 1516, 584, 1516, 591, -941, 1817, -941, 2114,
- -941, -941, 2114, 2114, 2114, 656, 598, 2114, 648, 2224,
- -941, 483, 483, 483, 483, 483, 355, 355, 355, 355,
- 583, 428, 440, 453, 491, 639, -941, 614, 608, 649,
- 662, 1595, 651, 650, -941, 283, -941, -941, -941, -941,
- -941, -941, 1595, 660, -941, 2114, 681, 670, -941, 716,
- -941, -941, 657, -941, -941, -941, -941, 680, -941, 2114,
- 647, 654, 1516, 2114, 2114, 1595, 677, -941, -941, -941,
- 141, 688, 1122, 707, 712, 179, 717, 1087, 2150, 2150,
- 728, -941, 1595, 730, 2150, 732, 743, 2150, 754, 91,
- 2150, 2150, -941, 1358, -941, 755, -941, 2150, 2150, -941,
- 2150, 714, 2150, 2150, 2150, 2150, -941, 756, -941, -941,
- -941, 403, -941, 434, 2240, -941, -941, -941, 257, 581,
- 498, 619, 630, 747, 769, 753, 828, 23, -941, -941,
- 185, -941, -941, -941, -941, -941, -941, -941, -941, -941,
- -941, -941, -941, -941, -941, -941, -941, -941, -941, 1595,
- 1595, -941, 819, 685, 821, 1595, -941, 1516, 171, 2114,
- 219, 716, -941, 226, 1516, 692, -941, 2114, -941, -941,
- 810, 822, 1595, -941, 183, -941, 1892, 1122, 305, 609,
- -941, -941, -941, 441, -941, -941, 797, 195, 797, 203,
- -941, -941, 197, -941, 816, -941, -941, 441, -941, 447,
- 2263, -941, -941, -941, 262, 698, 515, 640, 638, 812,
- 802, 811, 845, 28, -941, -941, 208, 739, -941, -941,
- 2150, 868, 2150, -941, 2150, 2150, 216, 777, -941, -941,
- -941, -941, -941, 1437, 1595, -941, -941, 740, -941, 449,
- 1928, 827, -941, -941, -941, -941, -941, 2003, 2150, 837,
- -941, 2150, 841, -941, -941, -941, -941, -941, -941, -941,
- -941, -941, -941, -941, -941, -941, -941, -941, 2150, 2150,
- 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150,
- 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150,
- 2150, 2150, 2150, -941, 2150, -941, -941, 844, 1595, 847,
- -941, 848, -941, -941, -941, 8, 842, -941, 716, -941,
- 880, -941, 1516, 849, 1516, -941, 859, -941, -941, 860,
- 2185, 515, 357, 655, 843, 838, 840, 884, 150, -941,
- -941, 857, 846, 441, -941, 861, 299, -941, 863, 181,
- 870, -941, 284, 2150, 866, -941, 2150, -941, -941, 873,
- -941, -941, -941, 712, -941, -941, -941, 301, -941, 2150,
- 876, -941, -941, -941, 2150, 2150, 2150, 2150, 2150, 2150,
- 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150,
- 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, -941,
- 2150, -941, 749, 871, 751, 757, 766, -941, -941, 872,
- 754, -941, -941, -941, 714, -941, -941, -941, -941, -941,
- 778, -941, 464, -941, 511, -941, -941, -941, -941, -941,
- 262, 262, 698, 698, 698, 515, 515, 515, 515, 515,
- 515, 640, 640, 640, 640, 638, 812, 802, 811, 845,
- 878, -941, -941, 891, 1595, -941, 1516, 1516, 894, 226,
- -941, 1516, -941, -941, 39, -7, 2150, 2150, 2150, 2150,
- 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150,
- 2150, 2150, 2150, 2150, 2150, -941, 307, -941, 897, 781,
- 2150, 892, 2150, 2150, -941, 683, 522, -941, -941, 797,
- -941, 902, 785, 525, -941, -941, -941, -941, -941, 262,
- 262, 698, 698, 698, 515, 515, 515, 515, 515, 515,
- 640, 640, 640, 640, 638, 812, 802, 811, 845, 895,
- -941, 1595, 2150, 1595, 904, 1595, 907, -941, 2039, -941,
- 2150, -941, -941, 2150, -941, 906, 1516, 1516, -941, -941,
- -941, 2150, 2150, 950, 912, 2150, 793, 2263, -941, 515,
- 515, 515, 515, 515, 357, 357, 357, 357, 655, 843,
- 838, 840, 884, 908, -941, 909, 889, 918, 796, 1595,
- 921, 919, -941, 313, -941, -941, -941, -941, -941, -941,
- 1595, 923, -941, 2150, 949, 798, -941, 977, -941, -941,
- 916, -941, -941, -941, -941, -941, 803, -941, 2150, 900,
- 901, 1595, 2150, 2150, 1595, 928, 935, 1595, 1595, -941,
- 937, 805, 939, 1595, -941, 1595, 217, 2150, 237, 977,
- -941, 754, 1595, 807, -941, 2150, -941, -941, 931, 941,
- 1595, -941, 942, 1595, 944, -941, 946, -941, -941, -941,
- 37, 940, -941, 977, -941, 973, -941, 1595, 943, 1595,
- -941, 948, -941, 951, 1595, -941, 1595, 1595, 961, 754,
- -941, 1595, -941, -941, -941, 963, 1595, 1595, -941, -941,
- -941, -941
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
-{
- -941, -941, 645, -941, -941, 0, -941, -941, 715, -941,
- 22, -941, 186, -941, -941, -941, -29, -941, 479, -941,
- -941, -941, 3, 169, -941, 105, -941, 230, -941, 725,
- -941, 138, 423, -941, -174, 668, -941, 31, 679, -941,
- 40, 676, -941, 42, 678, -941, 68, 682, -941, -941,
- -941, -941, -941, -941, -941, -35, -305, -941, 172, 18,
- -941, -941, -15, -20, -941, -941, -941, -941, -941, 791,
- -91, 566, -941, -941, -941, -941, -407, -941, -941, -941,
- -941, -941, -941, -941, 319, -941, 471, -941, -941, -941,
- -941, -941, -941, -941, -235, -441, -941, -23, -941, 148,
- -941, -941, -432, -941, -941, 231, -941, -450, -941, -449,
- -941, -941, -941, -511, -941, 167, -941, -941, -941, -329,
- 263, -941, -661, -941, -460, -941, -428, -941, -480, -70,
- -941, -679, 170, -941, -673, 166, -941, -663, 173, -941,
- -660, 174, -941, -657, 165, -941, -941, -941, -941, -941,
- -941, -941, -601, -841, -941, -302, -473, -941, -941, -454,
- -493, -941, -941, -941, -941, -941, 290, -592, 46, -941,
- -941, -941, -941, -940, -941, -941, -941, -941, -941, -941,
- -941, 5, -941, 49, -941, -941, -941, -941, -941, -941,
- -941, -760, -652, -468
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
-static const yytype_uint16 yytable[] =
-{
- 42, 132, 138, 49, 144, 637, 761, 902, 242, 519,
- 471, 564, 663, 371, 626, 1010, 42, 163, 845, 49,
- 519, 830, 831, 326, 636, 846, 958, 42, 94, 127,
- 49, 420, 593, 594, 581, 643, 847, 647, 631, 137,
- 848, 973, 974, 519, 849, 84, 435, 436, 139, 817,
- 201, 413, 148, 182, 183, 278, 821, 360, 350, 416,
- 519, 951, 361, 954, 701, 236, 87, 580, 207, 797,
- 203, 519, 179, 1038, 102, 856, 417, 826, 281, 249,
- 955, 252, 755, 42, 180, 181, 49, 226, 97, 208,
- 149, 246, 638, 227, 202, 1058, 768, 239, 771, 279,
- 393, 850, 351, 851, 1066, 706, 85, 800, 702, 468,
- 224, 1007, 526, 798, 924, 414, 298, 909, 910, 707,
- 440, 925, 302, 526, 711, 952, 978, 519, 519, 207,
- 293, 86, 926, 519, 140, 103, 927, 743, 744, 204,
- 928, 726, 583, 307, 42, 42, 526, 49, 49, 283,
- 519, 285, 243, 286, 287, 898, 205, 802, 731, 804,
- 104, 805, 806, 526, 280, 288, 240, 331, 579, 332,
- 723, 1037, 713, 905, 526, 209, 303, 247, 639, 305,
- 601, 129, 130, 241, 727, 822, 703, 134, 824, 706,
- 812, 881, 95, 141, 142, 354, 758, 929, 765, 930,
- 146, 147, 367, 584, 762, 153, 154, 155, 156, 799,
- 563, 519, 519, 841, 842, 843, 844, 807, 1048, 178,
- 374, 244, 678, 1021, 832, 833, 834, 716, 585, 327,
- 526, 526, 885, 281, 281, 882, 526, 363, 245, 328,
- 99, 602, 329, 891, 398, 1051, 399, 364, 892, 356,
- 282, 289, 365, 526, 105, 704, 357, 131, 714, 835,
- 836, 837, 838, 839, 840, 759, 603, 853, 372, 330,
- 728, 406, 705, 763, 225, 133, 519, 451, 800, 717,
- 896, 256, 760, 255, 766, 27, 800, 311, 312, 982,
- 764, 984, 985, 257, 258, 801, 903, 1052, 356, 193,
- 194, 195, 196, 808, 1049, 370, 394, 989, 774, 920,
- 921, 922, 923, 135, 526, 526, 395, 937, 356, 396,
- 911, 912, 913, 679, 444, 439, 446, 447, 775, 259,
- 260, 322, 323, 324, 325, 680, 681, 1002, 1022, 1003,
- 776, 777, 1004, 136, 894, 356, 397, 145, 308, 309,
- 310, 197, 562, 418, 895, 914, 915, 916, 917, 918,
- 919, 887, 1039, 887, 378, 379, 1042, 745, 888, 887,
- 901, 1046, 464, 746, 465, 887, 977, 466, 337, 526,
- 868, 295, 1020, 296, 281, 456, 410, 458, 1061, 461,
- 199, 1063, 1024, 956, 338, 339, 869, 870, 198, 281,
- 42, 411, 42, 49, 42, 49, 200, 49, 389, 390,
- 391, 392, 1075, 945, 313, 314, 315, 206, 157, 457,
- 566, 158, 519, 159, 237, 375, 376, 377, 281, 157,
- 450, 467, 161, 248, 162, 340, 341, 871, 872, 731,
- 959, 960, 961, 962, 963, 731, 731, 731, 731, 731,
- 731, 731, 731, 731, 731, 731, 274, 578, 157, 995,
- 275, 234, 157, 235, 276, 250, 277, 251, 187, 188,
- 299, 657, 42, 284, 658, 49, 659, 994, 1006, 996,
- 304, 999, 184, 185, 186, 189, 190, 575, 253, 254,
- 111, 380, 381, 382, 306, 228, 229, 230, 231, 519,
- 111, 519, 657, 519, 333, 661, 281, 662, 454, 657,
- 346, 1017, 753, 111, 754, 657, 290, 291, 769, 814,
- 770, 815, 1017, 347, 731, 526, 191, 192, 261, 262,
- 263, 264, 265, 349, 800, 1033, 941, 348, 1055, 270,
- 271, 272, 273, 684, 685, 686, 1017, 519, 266, 267,
- 1017, 352, 712, 720, 1050, 1017, 353, 1036, 519, 721,
- 780, 781, 782, 706, 294, 281, 211, 42, 400, 281,
- 49, 1047, 1017, 355, 42, 1017, 1079, 49, 1056, 519,
- 359, 800, 519, 942, 731, 519, 519, 715, 362, 268,
- 269, 519, 800, 519, 988, 800, 1017, 992, 1076, 1077,
- 519, 366, 526, 1070, 526, 1072, 526, 368, 519, 373,
- 111, 519, 111, 412, 111, 111, 401, 1080, 342, 343,
- 344, 345, 706, 706, 405, 519, 441, 519, 402, 281,
- 111, 445, 519, 452, 519, 519, 111, 111, 455, 519,
- 111, 687, 688, 459, 519, 519, 448, 229, 230, 231,
- 526, 403, 281, 462, 610, 682, 683, 111, 689, 690,
- 470, 526, 783, 784, 610, 693, 694, 695, 696, 747,
- 748, 749, 750, 789, 790, 791, 792, 610, 469, 785,
- 786, 111, 526, 111, 281, 526, 404, 281, 526, 526,
- 873, 874, 875, 876, 526, 474, 526, 408, 409, 691,
- 692, 442, 443, 526, 453, 443, 473, 860, 475, 862,
- 560, 526, 561, 111, 526, 567, 111, 472, 281, 565,
- 787, 788, 42, 569, 42, 49, 573, 49, 526, 111,
- 526, 476, 443, 414, 111, 526, 582, 526, 526, 568,
- 281, 577, 526, 986, 748, 749, 750, 526, 526, 574,
- 281, 628, 629, 730, 709, 443, 586, 633, 111, 335,
- 111, 722, 281, 640, 641, 426, 427, 428, 429, 596,
- 645, 646, 778, 779, 598, 652, 653, 654, 655, 604,
- 253, 254, 772, 773, 648, 166, 167, 168, 169, 170,
- 171, 172, 173, 174, 175, 176, 630, 610, 632, 610,
- 634, 610, 610, 964, 965, 966, 967, 809, 810, 813,
- 800, 635, 212, 503, 111, 419, 656, 610, 931, 800,
- 933, 800, 644, 177, 610, 610, 934, 800, 610, 697,
- 419, 419, 111, 946, 947, 935, 800, 699, 111, 949,
- 111, 111, 1, 2, 3, 610, 950, 939, 940, 88,
- 980, 981, 698, 89, 991, 981, 42, 42, 15, 49,
- 49, 42, 1011, 800, 49, 1015, 981, 1026, 800, 610,
- 700, 610, 1032, 800, 1044, 981, 1057, 800, 708, 724,
- 111, 710, 725, 756, 767, 794, 111, 796, 111, 803,
- 26, 111, 111, 419, 793, 795, 111, 818, 90, 823,
- 28, 91, 30, 825, 852, 33, 854, 34, 855, 857,
- 35, 859, 316, 317, 318, 319, 320, 321, 861, 863,
- 610, 878, 864, 610, 879, 877, 880, 883, 897, 886,
- 890, 207, 207, 884, 111, 899, 610, 893, 904, 932,
- 936, 610, 827, 828, 829, 943, 42, 42, 111, 49,
- 49, 944, 419, 111, 948, 106, 979, 1, 2, 3,
- 983, 990, 993, 997, 88, 610, 1005, 610, 89, 1000,
- 12, 13, 1008, 15, 1009, 1012, 1013, 1014, 18, 800,
- 1018, 1019, 1023, 1025, 1027, 1031, 952, 1040, 1035, 383,
- 384, 385, 386, 387, 388, 1041, 1043, 24, 25, 1045,
- 1059, 1060, 1062, 1064, 1069, 26, 1065, 1067, 1073, 449,
- 407, 1074, 1071, 90, 430, 28, 91, 30, 31, 32,
- 33, 1078, 34, 1081, 432, 35, 431, 433, 36, 37,
- 38, 39, 434, 610, 957, 369, 576, 858, 906, 907,
- 908, 107, 719, 987, 969, 938, 972, 968, 111, 957,
- 957, 610, 970, 900, 971, 1034, 111, 610, 1068, 610,
- 610, 212, 421, 422, 423, 424, 425, 212, 212, 212,
- 212, 212, 212, 212, 212, 212, 212, 212, 1054, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 605, 0,
- 477, 478, 479, 0, 0, 0, 0, 587, 0, 610,
- 0, 588, 0, 488, 489, 610, 491, 610, 0, 0,
- 610, 494, 0, 0, 0, 0, 0, 0, 610, 957,
- 0, 0, 610, 0, 0, 477, 478, 479, 0, 0,
- 500, 501, 587, 0, 0, 0, 588, 0, 502, 212,
- 0, 491, 0, 0, 0, 0, 589, 0, 504, 590,
- 506, 507, 508, 509, 0, 510, 0, 0, 511, 0,
- 610, 512, 513, 514, 515, 0, 0, 0, 0, 0,
- 0, 0, 0, 502, 606, 610, 0, 0, 0, 957,
- 610, 589, 0, 504, 590, 506, 0, 0, 509, 0,
- 510, 0, 0, 511, 610, 0, 0, 0, 212, 0,
- 0, 0, 610, 1, 2, 3, 4, 0, 0, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 0, 0, 18, 19, 20, 0, 21, 22,
- 0, 0, 23, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 24, 25, 0, 0, 0, 0, 0,
- 0, 26, 0, 0, 0, 0, 0, 0, 0, 27,
- 143, 28, 29, 30, 31, 32, 33, 0, 34, 0,
- 0, 35, 0, 0, 36, 37, 38, 39, 0, 0,
- 0, 0, 1, 2, 3, 4, 0, 40, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 0, 0, 18, 19, 20, 0, 21, 22, 0,
- 0, 23, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 24, 25, 0, 0, 0, 0, 0, 0,
- 26, 0, 0, 0, 0, 0, 0, 0, 27, 292,
- 28, 29, 30, 31, 32, 33, 0, 34, 0, 0,
- 35, 0, 0, 36, 37, 38, 39, 0, 0, 0,
- 0, 477, 478, 479, 480, 0, 40, 481, 482, 483,
- 484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
- 0, 0, 494, 495, 496, 0, 497, 498, 0, 0,
- 499, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 500, 501, 0, 0, 0, 0, 0, 0, 502,
- 0, 0, 0, 0, 0, 0, 0, 503, 642, 504,
- 505, 506, 507, 508, 509, 0, 510, 0, 0, 511,
- 0, 0, 512, 513, 514, 515, 0, 0, 0, 0,
- 477, 478, 479, 480, 0, 516, 481, 482, 483, 484,
- 485, 486, 487, 488, 489, 490, 491, 492, 493, 0,
- 0, 494, 495, 496, 0, 497, 498, 0, 0, 499,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 500, 501, 0, 0, 0, 0, 0, 0, 502, 0,
- 0, 0, 0, 0, 0, 0, 503, 811, 504, 505,
- 506, 507, 508, 509, 0, 510, 0, 0, 511, 0,
- 0, 512, 513, 514, 515, 0, 0, 0, 0, 1,
- 2, 3, 4, 0, 516, 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 0, 0,
- 18, 19, 20, 0, 21, 22, 0, 0, 23, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 24,
- 25, 0, 0, 0, 0, 0, 0, 26, 0, 0,
- 0, 0, 0, 0, 0, 27, 0, 28, 29, 30,
- 31, 32, 33, 0, 34, 0, 0, 35, 0, 0,
- 36, 37, 38, 39, 0, 0, 0, 0, 477, 478,
- 479, 480, 0, 40, 481, 482, 483, 484, 485, 486,
- 487, 488, 489, 490, 491, 492, 493, 0, 0, 494,
- 495, 496, 0, 497, 498, 0, 0, 499, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 500, 501,
- 0, 0, 0, 0, 0, 0, 502, 0, 0, 0,
- 0, 0, 0, 0, 503, 0, 504, 505, 506, 507,
- 508, 509, 0, 510, 0, 0, 511, 0, 0, 512,
- 513, 514, 515, 1, 2, 3, 0, 0, 0, 0,
- 88, 210, 516, 0, 89, 0, 12, 13, 0, 15,
- 0, 0, 0, 0, 18, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 2, 3, 0, 24, 25, 0, 88, 0, 0, 0,
- 89, 26, 12, 13, 0, 15, 0, 0, 0, 90,
- 18, 28, 91, 30, 31, 32, 33, 0, 34, 0,
- 0, 35, 0, 0, 36, 37, 38, 39, 0, 24,
- 25, 0, 0, 0, 0, 0, 0, 26, 0, 0,
- 0, 0, 0, 0, 0, 90, 0, 28, 91, 30,
- 31, 32, 33, 0, 34, 0, 0, 35, 297, 0,
- 36, 37, 38, 39, 1, 2, 3, 0, 0, 0,
- 0, 88, 0, 0, 0, 89, 0, 12, 13, 0,
- 15, 0, 0, 0, 0, 18, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 2, 3, 0, 24, 25, 0, 88, 0, 0,
- 0, 89, 26, 12, 13, 0, 15, 0, 0, 0,
- 90, 18, 28, 91, 30, 31, 32, 33, 0, 34,
- 300, 0, 35, 0, 0, 36, 37, 38, 39, 0,
- 24, 25, 0, 0, 0, 0, 0, 0, 26, 0,
- 0, 0, 0, 0, 0, 0, 90, 0, 28, 91,
- 30, 31, 32, 33, 0, 34, 0, 0, 35, 463,
- 0, 36, 37, 38, 39, 477, 478, 479, 0, 0,
- 0, 0, 587, 729, 0, 0, 588, 0, 488, 489,
- 0, 491, 0, 0, 0, 0, 494, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 477, 478, 479, 0, 500, 501, 0, 587, 0,
- 0, 0, 588, 502, 488, 489, 0, 491, 0, 0,
- 0, 589, 494, 504, 590, 506, 507, 508, 509, 0,
- 510, 0, 0, 511, 0, 0, 512, 513, 514, 515,
- 0, 500, 501, 0, 0, 0, 0, 0, 0, 502,
- 0, 0, 0, 0, 0, 0, 0, 589, 0, 504,
- 590, 506, 507, 508, 509, 0, 510, 0, 0, 511,
- 816, 0, 512, 513, 514, 515, 477, 478, 479, 0,
- 0, 0, 0, 587, 0, 0, 0, 588, 0, 488,
- 489, 0, 491, 0, 0, 0, 0, 494, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 477, 478, 479, 0, 500, 501, 0, 587,
- 0, 0, 0, 588, 502, 488, 489, 0, 491, 0,
- 0, 0, 589, 494, 504, 590, 506, 507, 508, 509,
- 0, 510, 819, 0, 511, 0, 0, 512, 513, 514,
- 515, 0, 500, 501, 0, 0, 0, 0, 0, 0,
- 502, 0, 0, 0, 0, 0, 0, 0, 589, 0,
- 504, 590, 506, 507, 508, 509, 0, 510, 0, 0,
- 511, 1001, 0, 512, 513, 514, 515, 1, 2, 3,
- 0, 0, 0, 0, 88, 0, 0, 0, 89, 0,
- 12, 13, 0, 15, 0, 0, 0, 0, 18, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 477, 478, 479, 0, 24, 25, 0,
- 587, 0, 0, 0, 588, 26, 488, 489, 0, 491,
- 0, 0, 0, 90, 494, 28, 91, 30, 31, 32,
- 33, 0, 34, 0, 0, 35, 0, 0, 36, 37,
- 38, 39, 0, 500, 501, 0, 0, 0, 0, 0,
- 0, 502, 0, 0, 0, 0, 0, 866, 0, 589,
- 0, 504, 590, 506, 507, 508, 509, 0, 510, 0,
- 0, 511, 0, 0, 512, 513, 514, 515, 772, 773,
- 0, 0, 0, 666, 667, 668, 669, 670, 671, 672,
- 673, 674, 675, 676, 164, 165, 0, 0, 0, 166,
- 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
- 0, 0, 0, 0, 0, 0, 0, 253, 254, 0,
- 0, 677, 166, 167, 168, 169, 170, 171, 172, 173,
- 174, 175, 176, 664, 665, 0, 0, 177, 666, 667,
- 668, 669, 670, 671, 672, 673, 674, 675, 676, 0,
- 0, 0, 0, 0, 0, 0, 772, 773, 0, 0,
- 177, 666, 667, 668, 669, 670, 671, 672, 673, 674,
- 675, 676, 0, 0, 0, 0, 677, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 677
-};
-
-static const yytype_int16 yycheck[] =
-{
- 0, 16, 22, 0, 27, 498, 598, 767, 99, 441,
- 417, 452, 523, 248, 487, 955, 16, 46, 697, 16,
- 452, 682, 683, 197, 497, 698, 867, 27, 6, 11,
- 27, 336, 482, 482, 475, 503, 699, 510, 492, 21,
- 700, 882, 883, 475, 701, 1, 351, 352, 1, 650,
- 41, 22, 34, 74, 75, 41, 657, 62, 41, 70,
- 492, 22, 67, 70, 41, 94, 68, 474, 83, 41,
- 1, 503, 66, 1013, 1, 67, 87, 678, 70, 108,
- 87, 110, 593, 83, 78, 79, 83, 62, 62, 1,
- 70, 1, 1, 68, 85, 1035, 607, 1, 609, 85,
- 274, 702, 85, 704, 67, 559, 62, 70, 85, 414,
- 88, 952, 441, 85, 793, 86, 151, 778, 779, 560,
- 355, 794, 157, 452, 565, 86, 886, 559, 560, 144,
- 145, 87, 795, 565, 87, 62, 796, 587, 587, 70,
- 797, 582, 1, 178, 144, 145, 475, 144, 145, 131,
- 582, 133, 1, 135, 136, 756, 87, 630, 586, 632,
- 87, 634, 635, 492, 1, 1, 70, 202, 473, 204,
- 577, 1012, 1, 774, 503, 87, 158, 87, 87, 161,
- 1, 12, 13, 87, 1, 658, 1, 18, 661, 643,
- 644, 41, 6, 24, 25, 224, 1, 798, 1, 800,
- 31, 32, 237, 62, 1, 36, 37, 38, 39, 1,
- 445, 643, 644, 693, 694, 695, 696, 1, 1, 47,
- 255, 70, 524, 983, 684, 685, 686, 8, 87, 198,
- 559, 560, 743, 70, 70, 85, 565, 60, 87, 199,
- 62, 62, 200, 62, 279, 8, 281, 70, 67, 62,
- 87, 87, 234, 582, 62, 70, 69, 68, 87, 687,
- 688, 689, 690, 691, 692, 70, 87, 708, 250, 201,
- 87, 291, 87, 70, 88, 68, 708, 368, 70, 60,
- 753, 66, 87, 111, 87, 59, 70, 182, 183, 890,
- 87, 892, 893, 78, 79, 87, 769, 60, 62, 35,
- 36, 37, 38, 87, 87, 69, 275, 899, 610, 789,
- 790, 791, 792, 68, 643, 644, 276, 810, 62, 277,
- 780, 781, 782, 66, 359, 69, 361, 362, 66, 74,
- 75, 193, 194, 195, 196, 78, 79, 938, 990, 940,
- 78, 79, 943, 68, 60, 62, 278, 67, 179, 180,
- 181, 82, 69, 335, 70, 783, 784, 785, 786, 787,
- 788, 62, 1014, 62, 259, 260, 1018, 62, 69, 62,
- 69, 1023, 407, 68, 409, 62, 69, 412, 23, 708,
- 23, 70, 69, 72, 70, 400, 72, 402, 1040, 404,
- 84, 1043, 993, 866, 39, 40, 39, 40, 83, 70,
- 400, 72, 402, 400, 404, 402, 42, 404, 270, 271,
- 272, 273, 1064, 854, 184, 185, 186, 0, 68, 401,
- 455, 71, 854, 73, 86, 256, 257, 258, 70, 68,
- 72, 413, 71, 68, 73, 80, 81, 80, 81, 867,
- 868, 869, 870, 871, 872, 873, 874, 875, 876, 877,
- 878, 879, 880, 881, 882, 883, 82, 472, 68, 932,
- 83, 71, 68, 73, 84, 71, 42, 73, 22, 23,
- 70, 68, 472, 21, 71, 472, 73, 931, 951, 933,
- 62, 935, 45, 46, 47, 39, 40, 469, 43, 44,
- 11, 261, 262, 263, 62, 60, 61, 62, 63, 931,
- 21, 933, 68, 935, 62, 71, 70, 73, 72, 68,
- 82, 979, 71, 34, 73, 68, 30, 31, 71, 70,
- 73, 72, 990, 83, 952, 854, 80, 81, 45, 46,
- 47, 22, 23, 42, 70, 1008, 72, 84, 1031, 35,
- 36, 37, 38, 45, 46, 47, 1014, 979, 39, 40,
- 1018, 70, 567, 573, 1027, 1023, 87, 1011, 990, 574,
- 45, 46, 47, 1017, 69, 70, 87, 567, 69, 70,
- 567, 1025, 1040, 68, 574, 1043, 1069, 574, 1032, 1011,
- 67, 70, 1014, 72, 1012, 1017, 1018, 569, 67, 80,
- 81, 1023, 70, 1025, 72, 70, 1064, 72, 1066, 1067,
- 1032, 62, 931, 1057, 933, 1059, 935, 62, 1040, 62,
- 131, 1043, 133, 67, 135, 136, 68, 1071, 35, 36,
- 37, 38, 1076, 1077, 68, 1057, 59, 1059, 69, 70,
- 151, 68, 1064, 59, 1066, 1067, 157, 158, 67, 1071,
- 161, 22, 23, 59, 1076, 1077, 60, 61, 62, 63,
- 979, 69, 70, 62, 487, 74, 75, 178, 39, 40,
- 62, 990, 22, 23, 497, 35, 36, 37, 38, 60,
- 61, 62, 63, 35, 36, 37, 38, 510, 22, 39,
- 40, 202, 1011, 204, 70, 1014, 69, 70, 1017, 1018,
- 35, 36, 37, 38, 1023, 87, 1025, 69, 70, 80,
- 81, 69, 70, 1032, 69, 70, 67, 722, 59, 724,
- 59, 1040, 62, 234, 1043, 34, 237, 69, 70, 59,
- 80, 81, 722, 7, 724, 722, 69, 724, 1057, 250,
- 1059, 69, 70, 86, 255, 1064, 59, 1066, 1067, 69,
- 70, 87, 1071, 60, 61, 62, 63, 1076, 1077, 69,
- 70, 488, 489, 586, 69, 70, 68, 494, 279, 22,
- 281, 69, 70, 500, 501, 342, 343, 344, 345, 62,
- 507, 508, 74, 75, 62, 512, 513, 514, 515, 62,
- 43, 44, 43, 44, 70, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 68, 630, 68, 632,
- 68, 634, 635, 873, 874, 875, 876, 30, 31, 69,
- 70, 68, 87, 59, 335, 336, 60, 650, 69, 70,
- 69, 70, 67, 86, 657, 658, 69, 70, 661, 82,
- 351, 352, 353, 856, 857, 69, 70, 84, 359, 859,
- 361, 362, 3, 4, 5, 678, 861, 69, 70, 10,
- 69, 70, 83, 14, 69, 70, 856, 857, 19, 856,
- 857, 861, 69, 70, 861, 69, 70, 69, 70, 702,
- 42, 704, 69, 70, 69, 70, 69, 70, 59, 69,
- 401, 60, 60, 86, 68, 83, 407, 42, 409, 21,
- 51, 412, 413, 414, 82, 84, 417, 70, 59, 62,
- 61, 62, 63, 62, 60, 66, 59, 68, 60, 67,
- 71, 31, 187, 188, 189, 190, 191, 192, 69, 60,
- 753, 83, 62, 756, 84, 82, 42, 70, 62, 68,
- 67, 946, 947, 87, 455, 62, 769, 67, 62, 68,
- 68, 774, 679, 680, 681, 67, 946, 947, 469, 946,
- 947, 60, 473, 474, 60, 1, 59, 3, 4, 5,
- 68, 59, 67, 59, 10, 798, 60, 800, 14, 62,
- 16, 17, 22, 19, 62, 67, 87, 59, 24, 70,
- 59, 62, 59, 34, 7, 69, 86, 59, 87, 264,
- 265, 266, 267, 268, 269, 60, 59, 43, 44, 60,
- 69, 60, 60, 59, 31, 51, 60, 67, 60, 364,
- 295, 60, 69, 59, 346, 61, 62, 63, 64, 65,
- 66, 60, 68, 60, 348, 71, 347, 349, 74, 75,
- 76, 77, 350, 866, 867, 244, 470, 718, 775, 776,
- 777, 87, 571, 895, 878, 814, 881, 877, 569, 882,
- 883, 884, 879, 763, 880, 1009, 577, 890, 1053, 892,
- 893, 336, 337, 338, 339, 340, 341, 342, 343, 344,
- 345, 346, 347, 348, 349, 350, 351, 352, 1029, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 1, -1,
- 3, 4, 5, -1, -1, -1, -1, 10, -1, 932,
- -1, 14, -1, 16, 17, 938, 19, 940, -1, -1,
- 943, 24, -1, -1, -1, -1, -1, -1, 951, 952,
- -1, -1, 955, -1, -1, 3, 4, 5, -1, -1,
- 43, 44, 10, -1, -1, -1, 14, -1, 51, 414,
- -1, 19, -1, -1, -1, -1, 59, -1, 61, 62,
- 63, 64, 65, 66, -1, 68, -1, -1, 71, -1,
- 993, 74, 75, 76, 77, -1, -1, -1, -1, -1,
- -1, -1, -1, 51, 87, 1008, -1, -1, -1, 1012,
- 1013, 59, -1, 61, 62, 63, -1, -1, 66, -1,
- 68, -1, -1, 71, 1027, -1, -1, -1, 473, -1,
- -1, -1, 1035, 3, 4, 5, 6, -1, -1, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, -1, -1, 24, 25, 26, -1, 28, 29,
- -1, -1, 32, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 43, 44, -1, -1, -1, -1, -1,
- -1, 51, -1, -1, -1, -1, -1, -1, -1, 59,
- 60, 61, 62, 63, 64, 65, 66, -1, 68, -1,
- -1, 71, -1, -1, 74, 75, 76, 77, -1, -1,
- -1, -1, 3, 4, 5, 6, -1, 87, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, -1, -1, 24, 25, 26, -1, 28, 29, -1,
- -1, 32, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 43, 44, -1, -1, -1, -1, -1, -1,
- 51, -1, -1, -1, -1, -1, -1, -1, 59, 60,
- 61, 62, 63, 64, 65, 66, -1, 68, -1, -1,
- 71, -1, -1, 74, 75, 76, 77, -1, -1, -1,
- -1, 3, 4, 5, 6, -1, 87, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- -1, -1, 24, 25, 26, -1, 28, 29, -1, -1,
- 32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 43, 44, -1, -1, -1, -1, -1, -1, 51,
- -1, -1, -1, -1, -1, -1, -1, 59, 60, 61,
- 62, 63, 64, 65, 66, -1, 68, -1, -1, 71,
- -1, -1, 74, 75, 76, 77, -1, -1, -1, -1,
- 3, 4, 5, 6, -1, 87, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, -1,
- -1, 24, 25, 26, -1, 28, 29, -1, -1, 32,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 43, 44, -1, -1, -1, -1, -1, -1, 51, -1,
- -1, -1, -1, -1, -1, -1, 59, 60, 61, 62,
- 63, 64, 65, 66, -1, 68, -1, -1, 71, -1,
- -1, 74, 75, 76, 77, -1, -1, -1, -1, 3,
- 4, 5, 6, -1, 87, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, -1, -1,
- 24, 25, 26, -1, 28, 29, -1, -1, 32, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 43,
- 44, -1, -1, -1, -1, -1, -1, 51, -1, -1,
- -1, -1, -1, -1, -1, 59, -1, 61, 62, 63,
- 64, 65, 66, -1, 68, -1, -1, 71, -1, -1,
- 74, 75, 76, 77, -1, -1, -1, -1, 3, 4,
- 5, 6, -1, 87, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, -1, -1, 24,
- 25, 26, -1, 28, 29, -1, -1, 32, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 43, 44,
- -1, -1, -1, -1, -1, -1, 51, -1, -1, -1,
- -1, -1, -1, -1, 59, -1, 61, 62, 63, 64,
- 65, 66, -1, 68, -1, -1, 71, -1, -1, 74,
- 75, 76, 77, 3, 4, 5, -1, -1, -1, -1,
- 10, 11, 87, -1, 14, -1, 16, 17, -1, 19,
- -1, -1, -1, -1, 24, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 3,
- 4, 5, -1, 43, 44, -1, 10, -1, -1, -1,
- 14, 51, 16, 17, -1, 19, -1, -1, -1, 59,
- 24, 61, 62, 63, 64, 65, 66, -1, 68, -1,
- -1, 71, -1, -1, 74, 75, 76, 77, -1, 43,
- 44, -1, -1, -1, -1, -1, -1, 51, -1, -1,
- -1, -1, -1, -1, -1, 59, -1, 61, 62, 63,
- 64, 65, 66, -1, 68, -1, -1, 71, 72, -1,
- 74, 75, 76, 77, 3, 4, 5, -1, -1, -1,
- -1, 10, -1, -1, -1, 14, -1, 16, 17, -1,
- 19, -1, -1, -1, -1, 24, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 3, 4, 5, -1, 43, 44, -1, 10, -1, -1,
- -1, 14, 51, 16, 17, -1, 19, -1, -1, -1,
- 59, 24, 61, 62, 63, 64, 65, 66, -1, 68,
- 69, -1, 71, -1, -1, 74, 75, 76, 77, -1,
- 43, 44, -1, -1, -1, -1, -1, -1, 51, -1,
- -1, -1, -1, -1, -1, -1, 59, -1, 61, 62,
- 63, 64, 65, 66, -1, 68, -1, -1, 71, 72,
- -1, 74, 75, 76, 77, 3, 4, 5, -1, -1,
- -1, -1, 10, 11, -1, -1, 14, -1, 16, 17,
- -1, 19, -1, -1, -1, -1, 24, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 3, 4, 5, -1, 43, 44, -1, 10, -1,
- -1, -1, 14, 51, 16, 17, -1, 19, -1, -1,
- -1, 59, 24, 61, 62, 63, 64, 65, 66, -1,
- 68, -1, -1, 71, -1, -1, 74, 75, 76, 77,
- -1, 43, 44, -1, -1, -1, -1, -1, -1, 51,
- -1, -1, -1, -1, -1, -1, -1, 59, -1, 61,
- 62, 63, 64, 65, 66, -1, 68, -1, -1, 71,
- 72, -1, 74, 75, 76, 77, 3, 4, 5, -1,
- -1, -1, -1, 10, -1, -1, -1, 14, -1, 16,
- 17, -1, 19, -1, -1, -1, -1, 24, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 3, 4, 5, -1, 43, 44, -1, 10,
- -1, -1, -1, 14, 51, 16, 17, -1, 19, -1,
- -1, -1, 59, 24, 61, 62, 63, 64, 65, 66,
- -1, 68, 69, -1, 71, -1, -1, 74, 75, 76,
- 77, -1, 43, 44, -1, -1, -1, -1, -1, -1,
- 51, -1, -1, -1, -1, -1, -1, -1, 59, -1,
- 61, 62, 63, 64, 65, 66, -1, 68, -1, -1,
- 71, 72, -1, 74, 75, 76, 77, 3, 4, 5,
- -1, -1, -1, -1, 10, -1, -1, -1, 14, -1,
- 16, 17, -1, 19, -1, -1, -1, -1, 24, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 3, 4, 5, -1, 43, 44, -1,
- 10, -1, -1, -1, 14, 51, 16, 17, -1, 19,
- -1, -1, -1, 59, 24, 61, 62, 63, 64, 65,
- 66, -1, 68, -1, -1, 71, -1, -1, 74, 75,
- 76, 77, -1, 43, 44, -1, -1, -1, -1, -1,
- -1, 51, -1, -1, -1, -1, -1, 22, -1, 59,
- -1, 61, 62, 63, 64, 65, 66, -1, 68, -1,
- -1, 71, -1, -1, 74, 75, 76, 77, 43, 44,
- -1, -1, -1, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 43, 44, -1, -1, -1, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- -1, -1, -1, -1, -1, -1, -1, 43, 44, -1,
- -1, 86, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 43, 44, -1, -1, 86, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, -1,
- -1, -1, -1, -1, -1, -1, 43, 44, -1, -1,
- 86, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, -1, -1, -1, -1, 86, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 86
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint16 yystos[] =
-{
- 0, 3, 4, 5, 6, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 24, 25,
- 26, 28, 29, 32, 43, 44, 51, 59, 61, 62,
- 63, 64, 65, 66, 68, 71, 74, 75, 76, 77,
- 87, 89, 93, 94, 99, 101, 103, 107, 109, 110,
- 112, 114, 116, 118, 121, 124, 127, 130, 133, 136,
- 139, 142, 145, 149, 150, 151, 152, 155, 160, 161,
- 162, 163, 166, 167, 168, 169, 170, 176, 177, 178,
- 179, 180, 184, 185, 1, 62, 87, 68, 10, 14,
- 59, 62, 92, 93, 98, 100, 181, 62, 153, 62,
- 156, 157, 1, 62, 87, 62, 1, 87, 98, 100,
- 102, 106, 108, 110, 111, 113, 115, 117, 119, 122,
- 125, 128, 131, 134, 137, 140, 143, 147, 106, 111,
- 111, 68, 150, 68, 111, 68, 68, 147, 151, 1,
- 87, 111, 111, 60, 185, 67, 111, 111, 147, 70,
- 95, 96, 97, 111, 111, 111, 111, 68, 71, 73,
- 104, 71, 73, 104, 43, 44, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 86, 146, 66,
- 78, 79, 74, 75, 45, 46, 47, 22, 23, 39,
- 40, 80, 81, 35, 36, 37, 38, 82, 83, 84,
- 42, 41, 85, 1, 70, 87, 0, 150, 1, 87,
- 11, 106, 117, 120, 123, 126, 129, 132, 135, 138,
- 141, 144, 148, 165, 98, 100, 62, 68, 60, 61,
- 62, 63, 90, 91, 71, 73, 104, 86, 158, 1,
- 70, 87, 158, 1, 70, 87, 1, 87, 68, 104,
- 71, 73, 104, 43, 44, 146, 66, 78, 79, 74,
- 75, 45, 46, 47, 22, 23, 39, 40, 80, 81,
- 35, 36, 37, 38, 82, 83, 84, 42, 41, 85,
- 1, 70, 87, 147, 21, 147, 147, 147, 1, 87,
- 30, 31, 60, 150, 69, 70, 72, 72, 143, 70,
- 69, 105, 143, 147, 62, 147, 62, 143, 111, 111,
- 111, 113, 113, 115, 115, 115, 117, 117, 117, 117,
- 117, 117, 119, 119, 119, 119, 122, 125, 128, 131,
- 134, 143, 143, 62, 154, 22, 146, 23, 39, 40,
- 80, 81, 35, 36, 37, 38, 82, 83, 84, 42,
- 41, 85, 70, 87, 104, 68, 62, 69, 182, 67,
- 62, 67, 67, 60, 70, 147, 62, 143, 62, 157,
- 69, 182, 147, 62, 143, 111, 111, 111, 113, 113,
- 115, 115, 115, 117, 117, 117, 117, 117, 117, 119,
- 119, 119, 119, 122, 125, 128, 131, 134, 143, 143,
- 69, 68, 69, 69, 69, 68, 151, 96, 69, 70,
- 72, 72, 67, 22, 86, 159, 70, 87, 147, 106,
- 144, 117, 117, 117, 117, 117, 120, 120, 120, 120,
- 123, 126, 129, 132, 135, 144, 144, 147, 164, 69,
- 182, 59, 69, 70, 143, 68, 143, 143, 60, 90,
- 72, 158, 59, 69, 72, 67, 150, 147, 150, 59,
- 171, 150, 62, 72, 143, 143, 143, 147, 144, 22,
- 62, 164, 69, 67, 87, 59, 69, 3, 4, 5,
- 6, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 24, 25, 26, 28, 29, 32,
- 43, 44, 51, 59, 61, 62, 63, 64, 65, 66,
- 68, 71, 74, 75, 76, 77, 87, 183, 186, 190,
- 191, 196, 198, 200, 204, 206, 207, 209, 211, 213,
- 215, 218, 221, 224, 227, 230, 233, 236, 239, 242,
- 246, 247, 248, 249, 252, 257, 258, 259, 260, 263,
- 264, 265, 266, 267, 273, 274, 275, 276, 277, 281,
- 59, 62, 69, 182, 183, 59, 143, 34, 69, 7,
- 172, 173, 174, 69, 69, 147, 159, 87, 150, 144,
- 164, 183, 59, 1, 62, 87, 68, 10, 14, 59,
- 62, 189, 190, 195, 197, 278, 62, 250, 62, 253,
- 254, 1, 62, 87, 62, 1, 87, 195, 197, 199,
- 203, 205, 207, 208, 210, 212, 214, 216, 219, 222,
- 225, 228, 231, 234, 237, 240, 244, 203, 208, 208,
- 68, 247, 68, 208, 68, 68, 244, 248, 1, 87,
- 208, 208, 60, 281, 67, 208, 208, 244, 70, 192,
- 193, 194, 208, 208, 208, 208, 60, 68, 71, 73,
- 201, 71, 73, 201, 43, 44, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 86, 243, 66,
- 78, 79, 74, 75, 45, 46, 47, 22, 23, 39,
- 40, 80, 81, 35, 36, 37, 38, 82, 83, 84,
- 42, 41, 85, 1, 70, 87, 247, 183, 59, 69,
- 60, 183, 150, 1, 87, 147, 8, 60, 175, 174,
- 151, 150, 69, 164, 69, 60, 183, 1, 87, 11,
- 203, 214, 217, 220, 223, 226, 229, 232, 235, 238,
- 241, 245, 262, 195, 197, 62, 68, 60, 61, 62,
- 63, 187, 188, 71, 73, 201, 86, 255, 1, 70,
- 87, 255, 1, 70, 87, 1, 87, 68, 201, 71,
- 73, 201, 43, 44, 243, 66, 78, 79, 74, 75,
- 45, 46, 47, 22, 23, 39, 40, 80, 81, 35,
- 36, 37, 38, 82, 83, 84, 42, 41, 85, 1,
- 70, 87, 244, 21, 244, 244, 244, 1, 87, 30,
- 31, 60, 247, 69, 70, 72, 72, 240, 70, 69,
- 202, 240, 244, 62, 244, 62, 240, 208, 208, 208,
- 210, 210, 212, 212, 212, 214, 214, 214, 214, 214,
- 214, 216, 216, 216, 216, 219, 222, 225, 228, 231,
- 240, 240, 60, 183, 59, 60, 67, 67, 172, 31,
- 150, 69, 150, 60, 62, 251, 22, 243, 23, 39,
- 40, 80, 81, 35, 36, 37, 38, 82, 83, 84,
- 42, 41, 85, 70, 87, 201, 68, 62, 69, 279,
- 67, 62, 67, 67, 60, 70, 244, 62, 240, 62,
- 254, 69, 279, 244, 62, 240, 208, 208, 208, 210,
- 210, 212, 212, 212, 214, 214, 214, 214, 214, 214,
- 216, 216, 216, 216, 219, 222, 225, 228, 231, 240,
- 240, 69, 68, 69, 69, 69, 68, 248, 193, 69,
- 70, 72, 72, 67, 60, 183, 185, 185, 60, 151,
- 150, 22, 86, 256, 70, 87, 244, 203, 241, 214,
- 214, 214, 214, 214, 217, 217, 217, 217, 220, 223,
- 226, 229, 232, 241, 241, 244, 261, 69, 279, 59,
- 69, 70, 240, 68, 240, 240, 60, 187, 72, 255,
- 59, 69, 72, 67, 247, 244, 247, 59, 268, 247,
- 62, 72, 240, 240, 240, 60, 244, 241, 22, 62,
- 261, 69, 67, 87, 59, 69, 280, 281, 59, 62,
- 69, 279, 280, 59, 240, 34, 69, 7, 269, 270,
- 271, 69, 69, 244, 256, 87, 247, 241, 261, 280,
- 59, 60, 280, 59, 69, 60, 280, 247, 1, 87,
- 244, 8, 60, 272, 271, 248, 247, 69, 261, 69,
- 60, 280, 60, 280, 59, 60, 67, 67, 269, 31,
- 247, 69, 247, 60, 60, 280, 281, 281, 60, 248,
- 247, 60
-};
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-
-#define YYFAIL goto yyerrlab
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
-
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
-
-#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, &yylloc)
-#endif
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, Location); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- YYLTYPE const * const yylocationp;
-#endif
-{
- if (!yyvaluep)
- return;
- YYUSE (yylocationp);
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
-# endif
- switch (yytype)
- {
- default:
- break;
- }
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- YYLTYPE const * const yylocationp;
-#endif
-{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
- YY_LOCATION_PRINT (yyoutput, *yylocationp);
- YYFPRINTF (yyoutput, ": ");
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
-#else
-static void
-yy_reduce_print (yyvsp, yylsp, yyrule)
- YYSTYPE *yyvsp;
- YYLTYPE *yylsp;
- int yyrule;
-#endif
-{
- int yynrhs = yyr2[yyrule];
- int yyi;
- unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , &(yylsp[(yyi + 1) - (yynrhs)]) );
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, yylsp, Rule); \
-} while (YYID (0))
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T
-yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
- int yyn = yypact[yystate];
-
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
- {
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
-
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
-
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
-
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
-
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
- }
-}
-#endif /* YYERROR_VERBOSE */
-
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, yylocationp)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- YYLTYPE *yylocationp;
-#endif
-{
- YYUSE (yyvaluep);
- YYUSE (yylocationp);
-
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- switch (yytype)
- {
-
- default:
- break;
- }
-}
-
-/* Prevent warnings from -Wmissing-prototypes. */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
-/* The lookahead symbol. */
-int yychar;
-
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
-
-/* Location data for the lookahead symbol. */
-YYLTYPE yylloc;
-
- /* Number of syntax errors so far. */
- int yynerrs;
-
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
-
- /* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- /* The location stack. */
- YYLTYPE yylsa[YYINITDEPTH];
- YYLTYPE *yyls;
- YYLTYPE *yylsp;
-
- /* The locations where the error started and ended. */
- YYLTYPE yyerror_range[2];
-
- YYSIZE_T yystacksize;
-
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
- YYLTYPE yyloc;
-
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- yytoken = 0;
- yyss = yyssa;
- yyvs = yyvsa;
- yyls = yylsa;
- yystacksize = YYINITDEPTH;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
- yyssp = yyss;
- yyvsp = yyvs;
- yylsp = yyls;
-
-#if YYLTYPE_IS_TRIVIAL
- /* Initialize the default location before parsing starts. */
- yylloc.first_line = yylloc.last_line = 1;
- yylloc.first_column = yylloc.last_column = 1;
-#endif
-
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
- YYLTYPE *yyls1 = yyls;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yyls1, yysize * sizeof (*yylsp),
- &yystacksize);
-
- yyls = yyls1;
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
- YYSTACK_RELOCATE (yyls_alloc, yyls);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
- yylsp = yyls + yysize - 1;
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- if (yystate == YYFINAL)
- YYACCEPT;
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
- yystate = yyn;
- *++yyvsp = yylval;
- *++yylsp = yylloc;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
- /* Default location. */
- YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 2:
-
-/* Line 1455 of yacc.c */
-#line 293 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); ;}
- break;
-
- case 3:
-
-/* Line 1455 of yacc.c */
-#line 294 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); ;}
- break;
-
- case 4:
-
-/* Line 1455 of yacc.c */
-#line 295 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); ;}
- break;
-
- case 5:
-
-/* Line 1455 of yacc.c */
-#line 296 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;}
- break;
-
- case 6:
-
-/* Line 1455 of yacc.c */
-#line 297 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;}
- break;
-
- case 7:
-
-/* Line 1455 of yacc.c */
-#line 298 "parser/Grammar.y"
- {
- Lexer& l = *GLOBAL_DATA->lexer;
- const Identifier* pattern;
- const Identifier* flags;
- if (!l.scanRegExp(pattern, flags))
- YYABORT;
- RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
- int size = pattern->size() + 2; // + 2 for the two /'s
- setExceptionLocation(node, (yylsp[(1) - (1)]).first_column, (yylsp[(1) - (1)]).first_column + size, (yylsp[(1) - (1)]).first_column + size);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, 0, 0);
- ;}
- break;
-
- case 8:
-
-/* Line 1455 of yacc.c */
-#line 309 "parser/Grammar.y"
- {
- Lexer& l = *GLOBAL_DATA->lexer;
- const Identifier* pattern;
- const Identifier* flags;
- if (!l.scanRegExp(pattern, flags, '='))
- YYABORT;
- RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
- int size = pattern->size() + 2; // + 2 for the two /'s
- setExceptionLocation(node, (yylsp[(1) - (1)]).first_column, (yylsp[(1) - (1)]).first_column + size, (yylsp[(1) - (1)]).first_column + size);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, 0, 0);
- ;}
- break;
-
- case 9:
-
-/* Line 1455 of yacc.c */
-#line 323 "parser/Grammar.y"
- { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 10:
-
-/* Line 1455 of yacc.c */
-#line 324 "parser/Grammar.y"
- { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 11:
-
-/* Line 1455 of yacc.c */
-#line 325 "parser/Grammar.y"
- { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, (yyvsp[(1) - (3)].doubleValue), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 12:
-
-/* Line 1455 of yacc.c */
-#line 326 "parser/Grammar.y"
- { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); setStatementLocation((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;}
- break;
-
- case 13:
-
-/* Line 1455 of yacc.c */
-#line 328 "parser/Grammar.y"
- {
- (yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
- if ((yyvsp[(4) - (8)].parameterList).m_features & ArgumentsFeature)
- (yyvsp[(7) - (8)].functionBodyNode)->setUsesArguments();
- setStatementLocation((yyvsp[(7) - (8)].functionBodyNode), (yylsp[(6) - (8)]), (yylsp[(8) - (8)]));
- if (!(yyval.propertyNode).m_node)
- YYABORT;
- ;}
- break;
-
- case 14:
-
-/* Line 1455 of yacc.c */
-#line 339 "parser/Grammar.y"
- { (yyval.propertyList).m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node);
- (yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head;
- (yyval.propertyList).m_features = (yyvsp[(1) - (1)].propertyNode).m_features;
- (yyval.propertyList).m_numConstants = (yyvsp[(1) - (1)].propertyNode).m_numConstants; ;}
- break;
-
- case 15:
-
-/* Line 1455 of yacc.c */
-#line 343 "parser/Grammar.y"
- { (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head;
- (yyval.propertyList).m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail);
- (yyval.propertyList).m_features = (yyvsp[(1) - (3)].propertyList).m_features | (yyvsp[(3) - (3)].propertyNode).m_features;
- (yyval.propertyList).m_numConstants = (yyvsp[(1) - (3)].propertyList).m_numConstants + (yyvsp[(3) - (3)].propertyNode).m_numConstants; ;}
- break;
-
- case 17:
-
-/* Line 1455 of yacc.c */
-#line 351 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;}
- break;
-
- case 18:
-
-/* Line 1455 of yacc.c */
-#line 352 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;}
- break;
-
- case 19:
-
-/* Line 1455 of yacc.c */
-#line 354 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;}
- break;
-
- case 20:
-
-/* Line 1455 of yacc.c */
-#line 358 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); ;}
- break;
-
- case 23:
-
-/* Line 1455 of yacc.c */
-#line 361 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;}
- break;
-
- case 24:
-
-/* Line 1455 of yacc.c */
-#line 362 "parser/Grammar.y"
- { (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;}
- break;
-
- case 25:
-
-/* Line 1455 of yacc.c */
-#line 366 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;}
- break;
-
- case 26:
-
-/* Line 1455 of yacc.c */
-#line 367 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;}
- break;
-
- case 27:
-
-/* Line 1455 of yacc.c */
-#line 368 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;}
- break;
-
- case 28:
-
-/* Line 1455 of yacc.c */
-#line 372 "parser/Grammar.y"
- { (yyval.elementList).m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node);
- (yyval.elementList).m_node.tail = (yyval.elementList).m_node.head;
- (yyval.elementList).m_features = (yyvsp[(2) - (2)].expressionNode).m_features;
- (yyval.elementList).m_numConstants = (yyvsp[(2) - (2)].expressionNode).m_numConstants; ;}
- break;
-
- case 29:
-
-/* Line 1455 of yacc.c */
-#line 377 "parser/Grammar.y"
- { (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head;
- (yyval.elementList).m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node);
- (yyval.elementList).m_features = (yyvsp[(1) - (4)].elementList).m_features | (yyvsp[(4) - (4)].expressionNode).m_features;
- (yyval.elementList).m_numConstants = (yyvsp[(1) - (4)].elementList).m_numConstants + (yyvsp[(4) - (4)].expressionNode).m_numConstants; ;}
- break;
-
- case 30:
-
-/* Line 1455 of yacc.c */
-#line 384 "parser/Grammar.y"
- { (yyval.intValue) = 0; ;}
- break;
-
- case 32:
-
-/* Line 1455 of yacc.c */
-#line 389 "parser/Grammar.y"
- { (yyval.intValue) = 1; ;}
- break;
-
- case 33:
-
-/* Line 1455 of yacc.c */
-#line 390 "parser/Grammar.y"
- { (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;}
- break;
-
- case 35:
-
-/* Line 1455 of yacc.c */
-#line 395 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;}
- break;
-
- case 36:
-
-/* Line 1455 of yacc.c */
-#line 396 "parser/Grammar.y"
- { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 37:
-
-/* Line 1455 of yacc.c */
-#line 400 "parser/Grammar.y"
- { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 38:
-
-/* Line 1455 of yacc.c */
-#line 404 "parser/Grammar.y"
- { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].argumentsNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].argumentsNode).m_numConstants);
- ;}
- break;
-
- case 40:
-
-/* Line 1455 of yacc.c */
-#line 412 "parser/Grammar.y"
- { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 41:
-
-/* Line 1455 of yacc.c */
-#line 416 "parser/Grammar.y"
- { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 42:
-
-/* Line 1455 of yacc.c */
-#line 420 "parser/Grammar.y"
- { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].argumentsNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].argumentsNode).m_numConstants);
- ;}
- break;
-
- case 44:
-
-/* Line 1455 of yacc.c */
-#line 428 "parser/Grammar.y"
- { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 46:
-
-/* Line 1455 of yacc.c */
-#line 436 "parser/Grammar.y"
- { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 47:
-
-/* Line 1455 of yacc.c */
-#line 443 "parser/Grammar.y"
- { (yyval.expressionNode) = makeFunctionCallNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
- break;
-
- case 48:
-
-/* Line 1455 of yacc.c */
-#line 444 "parser/Grammar.y"
- { (yyval.expressionNode) = makeFunctionCallNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
- break;
-
- case 49:
-
-/* Line 1455 of yacc.c */
-#line 445 "parser/Grammar.y"
- { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 50:
-
-/* Line 1455 of yacc.c */
-#line 449 "parser/Grammar.y"
- { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 51:
-
-/* Line 1455 of yacc.c */
-#line 455 "parser/Grammar.y"
- { (yyval.expressionNode) = makeFunctionCallNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
- break;
-
- case 52:
-
-/* Line 1455 of yacc.c */
-#line 456 "parser/Grammar.y"
- { (yyval.expressionNode) = makeFunctionCallNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;}
- break;
-
- case 53:
-
-/* Line 1455 of yacc.c */
-#line 457 "parser/Grammar.y"
- { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 54:
-
-/* Line 1455 of yacc.c */
-#line 461 "parser/Grammar.y"
- { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 55:
-
-/* Line 1455 of yacc.c */
-#line 468 "parser/Grammar.y"
- { (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); ;}
- break;
-
- case 56:
-
-/* Line 1455 of yacc.c */
-#line 469 "parser/Grammar.y"
- { (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;}
- break;
-
- case 57:
-
-/* Line 1455 of yacc.c */
-#line 473 "parser/Grammar.y"
- { (yyval.argumentList).m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node);
- (yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head;
- (yyval.argumentList).m_features = (yyvsp[(1) - (1)].expressionNode).m_features;
- (yyval.argumentList).m_numConstants = (yyvsp[(1) - (1)].expressionNode).m_numConstants; ;}
- break;
-
- case 58:
-
-/* Line 1455 of yacc.c */
-#line 477 "parser/Grammar.y"
- { (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head;
- (yyval.argumentList).m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node);
- (yyval.argumentList).m_features = (yyvsp[(1) - (3)].argumentList).m_features | (yyvsp[(3) - (3)].expressionNode).m_features;
- (yyval.argumentList).m_numConstants = (yyvsp[(1) - (3)].argumentList).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants; ;}
- break;
-
- case 64:
-
-/* Line 1455 of yacc.c */
-#line 495 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 65:
-
-/* Line 1455 of yacc.c */
-#line 496 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 67:
-
-/* Line 1455 of yacc.c */
-#line 501 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 68:
-
-/* Line 1455 of yacc.c */
-#line 502 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 69:
-
-/* Line 1455 of yacc.c */
-#line 506 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 70:
-
-/* Line 1455 of yacc.c */
-#line 507 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;}
- break;
-
- case 71:
-
-/* Line 1455 of yacc.c */
-#line 508 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 72:
-
-/* Line 1455 of yacc.c */
-#line 509 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 73:
-
-/* Line 1455 of yacc.c */
-#line 510 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 74:
-
-/* Line 1455 of yacc.c */
-#line 511 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 75:
-
-/* Line 1455 of yacc.c */
-#line 512 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 76:
-
-/* Line 1455 of yacc.c */
-#line 513 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 77:
-
-/* Line 1455 of yacc.c */
-#line 514 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 78:
-
-/* Line 1455 of yacc.c */
-#line 515 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 79:
-
-/* Line 1455 of yacc.c */
-#line 516 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 85:
-
-/* Line 1455 of yacc.c */
-#line 530 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 86:
-
-/* Line 1455 of yacc.c */
-#line 531 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 87:
-
-/* Line 1455 of yacc.c */
-#line 532 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 89:
-
-/* Line 1455 of yacc.c */
-#line 538 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 90:
-
-/* Line 1455 of yacc.c */
-#line 540 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 91:
-
-/* Line 1455 of yacc.c */
-#line 542 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 93:
-
-/* Line 1455 of yacc.c */
-#line 547 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 94:
-
-/* Line 1455 of yacc.c */
-#line 548 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 96:
-
-/* Line 1455 of yacc.c */
-#line 554 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 97:
-
-/* Line 1455 of yacc.c */
-#line 556 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 99:
-
-/* Line 1455 of yacc.c */
-#line 561 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 100:
-
-/* Line 1455 of yacc.c */
-#line 562 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 101:
-
-/* Line 1455 of yacc.c */
-#line 563 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 103:
-
-/* Line 1455 of yacc.c */
-#line 568 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 104:
-
-/* Line 1455 of yacc.c */
-#line 569 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 105:
-
-/* Line 1455 of yacc.c */
-#line 570 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 107:
-
-/* Line 1455 of yacc.c */
-#line 575 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 108:
-
-/* Line 1455 of yacc.c */
-#line 576 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 109:
-
-/* Line 1455 of yacc.c */
-#line 577 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 110:
-
-/* Line 1455 of yacc.c */
-#line 578 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 111:
-
-/* Line 1455 of yacc.c */
-#line 579 "parser/Grammar.y"
- { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 112:
-
-/* Line 1455 of yacc.c */
-#line 582 "parser/Grammar.y"
- { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 114:
-
-/* Line 1455 of yacc.c */
-#line 589 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 115:
-
-/* Line 1455 of yacc.c */
-#line 590 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 116:
-
-/* Line 1455 of yacc.c */
-#line 591 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 117:
-
-/* Line 1455 of yacc.c */
-#line 592 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 118:
-
-/* Line 1455 of yacc.c */
-#line 594 "parser/Grammar.y"
- { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 120:
-
-/* Line 1455 of yacc.c */
-#line 601 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 121:
-
-/* Line 1455 of yacc.c */
-#line 602 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 122:
-
-/* Line 1455 of yacc.c */
-#line 603 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 123:
-
-/* Line 1455 of yacc.c */
-#line 604 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 124:
-
-/* Line 1455 of yacc.c */
-#line 606 "parser/Grammar.y"
- { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 125:
-
-/* Line 1455 of yacc.c */
-#line 610 "parser/Grammar.y"
- { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column);
- (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 127:
-
-/* Line 1455 of yacc.c */
-#line 617 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 128:
-
-/* Line 1455 of yacc.c */
-#line 618 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 129:
-
-/* Line 1455 of yacc.c */
-#line 619 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 130:
-
-/* Line 1455 of yacc.c */
-#line 620 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 132:
-
-/* Line 1455 of yacc.c */
-#line 626 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 133:
-
-/* Line 1455 of yacc.c */
-#line 628 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 134:
-
-/* Line 1455 of yacc.c */
-#line 630 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 135:
-
-/* Line 1455 of yacc.c */
-#line 632 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 137:
-
-/* Line 1455 of yacc.c */
-#line 638 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 138:
-
-/* Line 1455 of yacc.c */
-#line 639 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 139:
-
-/* Line 1455 of yacc.c */
-#line 641 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 140:
-
-/* Line 1455 of yacc.c */
-#line 643 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 142:
-
-/* Line 1455 of yacc.c */
-#line 648 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 144:
-
-/* Line 1455 of yacc.c */
-#line 654 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 146:
-
-/* Line 1455 of yacc.c */
-#line 659 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 148:
-
-/* Line 1455 of yacc.c */
-#line 664 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 150:
-
-/* Line 1455 of yacc.c */
-#line 670 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 152:
-
-/* Line 1455 of yacc.c */
-#line 676 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 154:
-
-/* Line 1455 of yacc.c */
-#line 681 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 156:
-
-/* Line 1455 of yacc.c */
-#line 687 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 158:
-
-/* Line 1455 of yacc.c */
-#line 693 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 160:
-
-/* Line 1455 of yacc.c */
-#line 698 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 162:
-
-/* Line 1455 of yacc.c */
-#line 704 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 164:
-
-/* Line 1455 of yacc.c */
-#line 710 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 166:
-
-/* Line 1455 of yacc.c */
-#line 715 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 168:
-
-/* Line 1455 of yacc.c */
-#line 721 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 170:
-
-/* Line 1455 of yacc.c */
-#line 726 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 172:
-
-/* Line 1455 of yacc.c */
-#line 732 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
- break;
-
- case 174:
-
-/* Line 1455 of yacc.c */
-#line 738 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
- break;
-
- case 176:
-
-/* Line 1455 of yacc.c */
-#line 744 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;}
- break;
-
- case 178:
-
-/* Line 1455 of yacc.c */
-#line 750 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
- (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 180:
-
-/* Line 1455 of yacc.c */
-#line 758 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
- (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 182:
-
-/* Line 1455 of yacc.c */
-#line 766 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature,
- (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants);
- ;}
- break;
-
- case 183:
-
-/* Line 1455 of yacc.c */
-#line 772 "parser/Grammar.y"
- { (yyval.op) = OpEqual; ;}
- break;
-
- case 184:
-
-/* Line 1455 of yacc.c */
-#line 773 "parser/Grammar.y"
- { (yyval.op) = OpPlusEq; ;}
- break;
-
- case 185:
-
-/* Line 1455 of yacc.c */
-#line 774 "parser/Grammar.y"
- { (yyval.op) = OpMinusEq; ;}
- break;
-
- case 186:
-
-/* Line 1455 of yacc.c */
-#line 775 "parser/Grammar.y"
- { (yyval.op) = OpMultEq; ;}
- break;
-
- case 187:
-
-/* Line 1455 of yacc.c */
-#line 776 "parser/Grammar.y"
- { (yyval.op) = OpDivEq; ;}
- break;
-
- case 188:
-
-/* Line 1455 of yacc.c */
-#line 777 "parser/Grammar.y"
- { (yyval.op) = OpLShift; ;}
- break;
-
- case 189:
-
-/* Line 1455 of yacc.c */
-#line 778 "parser/Grammar.y"
- { (yyval.op) = OpRShift; ;}
- break;
-
- case 190:
-
-/* Line 1455 of yacc.c */
-#line 779 "parser/Grammar.y"
- { (yyval.op) = OpURShift; ;}
- break;
-
- case 191:
-
-/* Line 1455 of yacc.c */
-#line 780 "parser/Grammar.y"
- { (yyval.op) = OpAndEq; ;}
- break;
-
- case 192:
-
-/* Line 1455 of yacc.c */
-#line 781 "parser/Grammar.y"
- { (yyval.op) = OpXOrEq; ;}
- break;
-
- case 193:
-
-/* Line 1455 of yacc.c */
-#line 782 "parser/Grammar.y"
- { (yyval.op) = OpOrEq; ;}
- break;
-
- case 194:
-
-/* Line 1455 of yacc.c */
-#line 783 "parser/Grammar.y"
- { (yyval.op) = OpModEq; ;}
- break;
-
- case 196:
-
-/* Line 1455 of yacc.c */
-#line 788 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 198:
-
-/* Line 1455 of yacc.c */
-#line 793 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 200:
-
-/* Line 1455 of yacc.c */
-#line 798 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 218:
-
-/* Line 1455 of yacc.c */
-#line 822 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
- break;
-
- case 219:
-
-/* Line 1455 of yacc.c */
-#line 824 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
- break;
-
- case 220:
-
-/* Line 1455 of yacc.c */
-#line 829 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
- break;
-
- case 221:
-
-/* Line 1455 of yacc.c */
-#line 831 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)]));
- AUTO_SEMICOLON; ;}
- break;
-
- case 222:
-
-/* Line 1455 of yacc.c */
-#line 837 "parser/Grammar.y"
- { (yyval.varDeclList).m_node = 0;
- (yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (1)].ident), 0);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
- (yyval.varDeclList).m_numConstants = 0;
- ;}
- break;
-
- case 223:
-
-/* Line 1455 of yacc.c */
-#line 844 "parser/Grammar.y"
- { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column);
- (yyval.varDeclList).m_node = node;
- (yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (2)].ident), DeclarationStacks::HasInitializer);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features;
- (yyval.varDeclList).m_numConstants = (yyvsp[(2) - (2)].expressionNode).m_numConstants;
- ;}
- break;
-
- case 224:
-
-/* Line 1455 of yacc.c */
-#line 854 "parser/Grammar.y"
- { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node;
- (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (3)].ident), 0);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = (yyvsp[(1) - (3)].varDeclList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
- (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (3)].varDeclList).m_numConstants;
- ;}
- break;
-
- case 225:
-
-/* Line 1455 of yacc.c */
-#line 862 "parser/Grammar.y"
- { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column);
- (yyval.varDeclList).m_node = combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (4)].varDeclList).m_node, node);
- (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (4)].varDeclList).m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (4)].ident), DeclarationStacks::HasInitializer);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = (yyvsp[(1) - (4)].varDeclList).m_features | ((*(yyvsp[(3) - (4)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (4)].expressionNode).m_features;
- (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (4)].varDeclList).m_numConstants + (yyvsp[(4) - (4)].expressionNode).m_numConstants;
- ;}
- break;
-
- case 226:
-
-/* Line 1455 of yacc.c */
-#line 874 "parser/Grammar.y"
- { (yyval.varDeclList).m_node = 0;
- (yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (1)].ident), 0);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
- (yyval.varDeclList).m_numConstants = 0;
- ;}
- break;
-
- case 227:
-
-/* Line 1455 of yacc.c */
-#line 881 "parser/Grammar.y"
- { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column);
- (yyval.varDeclList).m_node = node;
- (yyval.varDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (2)].ident), DeclarationStacks::HasInitializer);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features;
- (yyval.varDeclList).m_numConstants = (yyvsp[(2) - (2)].expressionNode).m_numConstants;
- ;}
- break;
-
- case 228:
-
-/* Line 1455 of yacc.c */
-#line 891 "parser/Grammar.y"
- { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node;
- (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (3)].ident), 0);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = (yyvsp[(1) - (3)].varDeclList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
- (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (3)].varDeclList).m_numConstants;
- ;}
- break;
-
- case 229:
-
-/* Line 1455 of yacc.c */
-#line 899 "parser/Grammar.y"
- { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature);
- setExceptionLocation(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column);
- (yyval.varDeclList).m_node = combineCommaNodes(GLOBAL_DATA, (yyvsp[(1) - (4)].varDeclList).m_node, node);
- (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (4)].varDeclList).m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (4)].ident), DeclarationStacks::HasInitializer);
- (yyval.varDeclList).m_funcDeclarations = 0;
- (yyval.varDeclList).m_features = (yyvsp[(1) - (4)].varDeclList).m_features | ((*(yyvsp[(3) - (4)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (4)].expressionNode).m_features;
- (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (4)].varDeclList).m_numConstants + (yyvsp[(4) - (4)].expressionNode).m_numConstants;
- ;}
- break;
-
- case 230:
-
-/* Line 1455 of yacc.c */
-#line 911 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
- break;
-
- case 231:
-
-/* Line 1455 of yacc.c */
-#line 914 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;}
- break;
-
- case 232:
-
-/* Line 1455 of yacc.c */
-#line 919 "parser/Grammar.y"
- { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node;
- (yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head;
- (yyval.constDeclList).m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.constDeclList).m_varDeclarations, (yyvsp[(1) - (1)].constDeclNode).m_node);
- (yyval.constDeclList).m_funcDeclarations = 0;
- (yyval.constDeclList).m_features = (yyvsp[(1) - (1)].constDeclNode).m_features;
- (yyval.constDeclList).m_numConstants = (yyvsp[(1) - (1)].constDeclNode).m_numConstants;
- ;}
- break;
-
- case 233:
-
-/* Line 1455 of yacc.c */
-#line 928 "parser/Grammar.y"
- { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head;
- (yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node;
- (yyval.constDeclList).m_node.tail = (yyvsp[(3) - (3)].constDeclNode).m_node;
- (yyval.constDeclList).m_varDeclarations = (yyvsp[(1) - (3)].constDeclList).m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, (yyval.constDeclList).m_varDeclarations, (yyvsp[(3) - (3)].constDeclNode).m_node);
- (yyval.constDeclList).m_funcDeclarations = 0;
- (yyval.constDeclList).m_features = (yyvsp[(1) - (3)].constDeclList).m_features | (yyvsp[(3) - (3)].constDeclNode).m_features;
- (yyval.constDeclList).m_numConstants = (yyvsp[(1) - (3)].constDeclList).m_numConstants + (yyvsp[(3) - (3)].constDeclNode).m_numConstants; ;}
- break;
-
- case 234:
-
-/* Line 1455 of yacc.c */
-#line 939 "parser/Grammar.y"
- { (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;}
- break;
-
- case 235:
-
-/* Line 1455 of yacc.c */
-#line 940 "parser/Grammar.y"
- { (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;}
- break;
-
- case 236:
-
-/* Line 1455 of yacc.c */
-#line 944 "parser/Grammar.y"
- { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;}
- break;
-
- case 237:
-
-/* Line 1455 of yacc.c */
-#line 948 "parser/Grammar.y"
- { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;}
- break;
-
- case 238:
-
-/* Line 1455 of yacc.c */
-#line 952 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;}
- break;
-
- case 239:
-
-/* Line 1455 of yacc.c */
-#line 956 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
- break;
-
- case 240:
-
-/* Line 1455 of yacc.c */
-#line 958 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
- break;
-
- case 241:
-
-/* Line 1455 of yacc.c */
-#line 964 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
- break;
-
- case 242:
-
-/* Line 1455 of yacc.c */
-#line 967 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node),
- mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations),
- mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations),
- (yyvsp[(3) - (7)].expressionNode).m_features | (yyvsp[(5) - (7)].statementNode).m_features | (yyvsp[(7) - (7)].statementNode).m_features,
- (yyvsp[(3) - (7)].expressionNode).m_numConstants + (yyvsp[(5) - (7)].statementNode).m_numConstants + (yyvsp[(7) - (7)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(4) - (7)])); ;}
- break;
-
- case 243:
-
-/* Line 1455 of yacc.c */
-#line 976 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;}
- break;
-
- case 244:
-
-/* Line 1455 of yacc.c */
-#line 978 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;}
- break;
-
- case 245:
-
-/* Line 1455 of yacc.c */
-#line 980 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
- break;
-
- case 246:
-
-/* Line 1455 of yacc.c */
-#line 983 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations,
- (yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features,
- (yyvsp[(3) - (9)].expressionNode).m_numConstants + (yyvsp[(5) - (9)].expressionNode).m_numConstants + (yyvsp[(7) - (9)].expressionNode).m_numConstants + (yyvsp[(9) - (9)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (9)]), (yylsp[(8) - (9)]));
- ;}
- break;
-
- case 247:
-
-/* Line 1455 of yacc.c */
-#line 989 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true),
- mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations),
- mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_funcDeclarations, (yyvsp[(10) - (10)].statementNode).m_funcDeclarations),
- (yyvsp[(4) - (10)].varDeclList).m_features | (yyvsp[(6) - (10)].expressionNode).m_features | (yyvsp[(8) - (10)].expressionNode).m_features | (yyvsp[(10) - (10)].statementNode).m_features,
- (yyvsp[(4) - (10)].varDeclList).m_numConstants + (yyvsp[(6) - (10)].expressionNode).m_numConstants + (yyvsp[(8) - (10)].expressionNode).m_numConstants + (yyvsp[(10) - (10)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (10)]), (yylsp[(9) - (10)])); ;}
- break;
-
- case 248:
-
-/* Line 1455 of yacc.c */
-#line 996 "parser/Grammar.y"
- {
- ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node);
- setExceptionLocation(node, (yylsp[(3) - (7)]).first_column, (yylsp[(3) - (7)]).last_column, (yylsp[(5) - (7)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, (yyvsp[(7) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations,
- (yyvsp[(3) - (7)].expressionNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features | (yyvsp[(7) - (7)].statementNode).m_features,
- (yyvsp[(3) - (7)].expressionNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants + (yyvsp[(7) - (7)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(6) - (7)]));
- ;}
- break;
-
- case 249:
-
-/* Line 1455 of yacc.c */
-#line 1005 "parser/Grammar.y"
- { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column);
- setExceptionLocation(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column);
- appendToVarDeclarationList(GLOBAL_DATA, (yyvsp[(8) - (8)].statementNode).m_varDeclarations, *(yyvsp[(4) - (8)].ident), DeclarationStacks::HasInitializer);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(forIn, (yyvsp[(8) - (8)].statementNode).m_varDeclarations, (yyvsp[(8) - (8)].statementNode).m_funcDeclarations, ((*(yyvsp[(4) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(6) - (8)].expressionNode).m_features | (yyvsp[(8) - (8)].statementNode).m_features, (yyvsp[(6) - (8)].expressionNode).m_numConstants + (yyvsp[(8) - (8)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (8)]), (yylsp[(7) - (8)])); ;}
- break;
-
- case 250:
-
-/* Line 1455 of yacc.c */
-#line 1011 "parser/Grammar.y"
- { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column);
- setExceptionLocation(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column);
- appendToVarDeclarationList(GLOBAL_DATA, (yyvsp[(9) - (9)].statementNode).m_varDeclarations, *(yyvsp[(4) - (9)].ident), DeclarationStacks::HasInitializer);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(forIn, (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations,
- ((*(yyvsp[(4) - (9)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features,
- (yyvsp[(5) - (9)].expressionNode).m_numConstants + (yyvsp[(7) - (9)].expressionNode).m_numConstants + (yyvsp[(9) - (9)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (9)]), (yylsp[(8) - (9)])); ;}
- break;
-
- case 251:
-
-/* Line 1455 of yacc.c */
-#line 1021 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;}
- break;
-
- case 253:
-
-/* Line 1455 of yacc.c */
-#line 1026 "parser/Grammar.y"
- { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;}
- break;
-
- case 255:
-
-/* Line 1455 of yacc.c */
-#line 1031 "parser/Grammar.y"
- { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
- break;
-
- case 256:
-
-/* Line 1455 of yacc.c */
-#line 1035 "parser/Grammar.y"
- { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
- break;
-
- case 257:
-
-/* Line 1455 of yacc.c */
-#line 1039 "parser/Grammar.y"
- { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
- break;
-
- case 258:
-
-/* Line 1455 of yacc.c */
-#line 1043 "parser/Grammar.y"
- { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;}
- break;
-
- case 259:
-
-/* Line 1455 of yacc.c */
-#line 1050 "parser/Grammar.y"
- { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
- break;
-
- case 260:
-
-/* Line 1455 of yacc.c */
-#line 1053 "parser/Grammar.y"
- { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
- break;
-
- case 261:
-
-/* Line 1455 of yacc.c */
-#line 1056 "parser/Grammar.y"
- { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
- break;
-
- case 262:
-
-/* Line 1455 of yacc.c */
-#line 1059 "parser/Grammar.y"
- { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident));
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)), 0, 0, 0, 0); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;}
- break;
-
- case 263:
-
-/* Line 1455 of yacc.c */
-#line 1065 "parser/Grammar.y"
- { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
- break;
-
- case 264:
-
-/* Line 1455 of yacc.c */
-#line 1068 "parser/Grammar.y"
- { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- setExceptionLocation(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
- break;
-
- case 265:
-
-/* Line 1455 of yacc.c */
-#line 1071 "parser/Grammar.y"
- { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;}
- break;
-
- case 266:
-
-/* Line 1455 of yacc.c */
-#line 1074 "parser/Grammar.y"
- { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;}
- break;
-
- case 267:
-
-/* Line 1455 of yacc.c */
-#line 1080 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column),
- (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
- break;
-
- case 268:
-
-/* Line 1455 of yacc.c */
-#line 1086 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations,
- (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;}
- break;
-
- case 269:
-
-/* Line 1455 of yacc.c */
-#line 1092 "parser/Grammar.y"
- { (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;}
- break;
-
- case 270:
-
-/* Line 1455 of yacc.c */
-#line 1094 "parser/Grammar.y"
- { (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head),
- mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations),
- mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_funcDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_funcDeclarations), (yyvsp[(4) - (5)].clauseList).m_funcDeclarations),
- (yyvsp[(2) - (5)].clauseList).m_features | (yyvsp[(3) - (5)].caseClauseNode).m_features | (yyvsp[(4) - (5)].clauseList).m_features,
- (yyvsp[(2) - (5)].clauseList).m_numConstants + (yyvsp[(3) - (5)].caseClauseNode).m_numConstants + (yyvsp[(4) - (5)].clauseList).m_numConstants); ;}
- break;
-
- case 271:
-
-/* Line 1455 of yacc.c */
-#line 1102 "parser/Grammar.y"
- { (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;}
- break;
-
- case 273:
-
-/* Line 1455 of yacc.c */
-#line 1107 "parser/Grammar.y"
- { (yyval.clauseList).m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node);
- (yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head;
- (yyval.clauseList).m_varDeclarations = (yyvsp[(1) - (1)].caseClauseNode).m_varDeclarations;
- (yyval.clauseList).m_funcDeclarations = (yyvsp[(1) - (1)].caseClauseNode).m_funcDeclarations;
- (yyval.clauseList).m_features = (yyvsp[(1) - (1)].caseClauseNode).m_features;
- (yyval.clauseList).m_numConstants = (yyvsp[(1) - (1)].caseClauseNode).m_numConstants; ;}
- break;
-
- case 274:
-
-/* Line 1455 of yacc.c */
-#line 1113 "parser/Grammar.y"
- { (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head;
- (yyval.clauseList).m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node);
- (yyval.clauseList).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].clauseList).m_varDeclarations, (yyvsp[(2) - (2)].caseClauseNode).m_varDeclarations);
- (yyval.clauseList).m_funcDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].clauseList).m_funcDeclarations, (yyvsp[(2) - (2)].caseClauseNode).m_funcDeclarations);
- (yyval.clauseList).m_features = (yyvsp[(1) - (2)].clauseList).m_features | (yyvsp[(2) - (2)].caseClauseNode).m_features;
- (yyval.clauseList).m_numConstants = (yyvsp[(1) - (2)].clauseList).m_numConstants + (yyvsp[(2) - (2)].caseClauseNode).m_numConstants;
- ;}
- break;
-
- case 275:
-
-/* Line 1455 of yacc.c */
-#line 1123 "parser/Grammar.y"
- { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;}
- break;
-
- case 276:
-
-/* Line 1455 of yacc.c */
-#line 1124 "parser/Grammar.y"
- { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;}
- break;
-
- case 277:
-
-/* Line 1455 of yacc.c */
-#line 1128 "parser/Grammar.y"
- { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;}
- break;
-
- case 278:
-
-/* Line 1455 of yacc.c */
-#line 1129 "parser/Grammar.y"
- { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;}
- break;
-
- case 279:
-
-/* Line 1455 of yacc.c */
-#line 1133 "parser/Grammar.y"
- { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, (yyvsp[(3) - (3)].statementNode).m_varDeclarations, (yyvsp[(3) - (3)].statementNode).m_funcDeclarations, (yyvsp[(3) - (3)].statementNode).m_features, (yyvsp[(3) - (3)].statementNode).m_numConstants); ;}
- break;
-
- case 280:
-
-/* Line 1455 of yacc.c */
-#line 1139 "parser/Grammar.y"
- { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)]));
- ;}
- break;
-
- case 281:
-
-/* Line 1455 of yacc.c */
-#line 1143 "parser/Grammar.y"
- { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node);
- setExceptionLocation(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column);
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON;
- ;}
- break;
-
- case 282:
-
-/* Line 1455 of yacc.c */
-#line 1150 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node),
- mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations),
- mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_funcDeclarations, (yyvsp[(4) - (4)].statementNode).m_funcDeclarations),
- (yyvsp[(2) - (4)].statementNode).m_features | (yyvsp[(4) - (4)].statementNode).m_features,
- (yyvsp[(2) - (4)].statementNode).m_numConstants + (yyvsp[(4) - (4)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (4)]), (yylsp[(2) - (4)])); ;}
- break;
-
- case 283:
-
-/* Line 1455 of yacc.c */
-#line 1156 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0),
- mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations),
- mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations),
- (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(7) - (7)].statementNode).m_features | CatchFeature,
- (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(7) - (7)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(2) - (7)])); ;}
- break;
-
- case 284:
-
-/* Line 1455 of yacc.c */
-#line 1163 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node),
- mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations),
- mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_funcDeclarations, (yyvsp[(7) - (9)].statementNode).m_funcDeclarations), (yyvsp[(9) - (9)].statementNode).m_funcDeclarations),
- (yyvsp[(2) - (9)].statementNode).m_features | (yyvsp[(7) - (9)].statementNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features | CatchFeature,
- (yyvsp[(2) - (9)].statementNode).m_numConstants + (yyvsp[(7) - (9)].statementNode).m_numConstants + (yyvsp[(9) - (9)].statementNode).m_numConstants);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (9)]), (yylsp[(2) - (9)])); ;}
- break;
-
- case 285:
-
-/* Line 1455 of yacc.c */
-#line 1172 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;}
- break;
-
- case 286:
-
-/* Line 1455 of yacc.c */
-#line 1174 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- setStatementLocation((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;}
- break;
-
- case 287:
-
-/* Line 1455 of yacc.c */
-#line 1179 "parser/Grammar.y"
- { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); setStatementLocation((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast<FuncDeclNode*>((yyval.statementNode).m_node)->body()); ;}
- break;
-
- case 288:
-
-/* Line 1455 of yacc.c */
-#line 1181 "parser/Grammar.y"
- {
- (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
- if ((yyvsp[(4) - (8)].parameterList).m_features & ArgumentsFeature)
- (yyvsp[(7) - (8)].functionBodyNode)->setUsesArguments();
- setStatementLocation((yyvsp[(7) - (8)].functionBodyNode), (yylsp[(6) - (8)]), (yylsp[(8) - (8)]));
- (yyval.statementNode).m_funcDeclarations->data.append(static_cast<FuncDeclNode*>((yyval.statementNode).m_node)->body());
- ;}
- break;
-
- case 289:
-
-/* Line 1455 of yacc.c */
-#line 1191 "parser/Grammar.y"
- { (yyval.funcExprNode) = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); setStatementLocation((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;}
- break;
-
- case 290:
-
-/* Line 1455 of yacc.c */
-#line 1193 "parser/Grammar.y"
- {
- (yyval.funcExprNode) = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0);
- if ((yyvsp[(3) - (7)].parameterList).m_features & ArgumentsFeature)
- (yyvsp[(6) - (7)].functionBodyNode)->setUsesArguments();
- setStatementLocation((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)]));
- ;}
- break;
-
- case 291:
-
-/* Line 1455 of yacc.c */
-#line 1199 "parser/Grammar.y"
- { (yyval.funcExprNode) = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); setStatementLocation((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;}
- break;
-
- case 292:
-
-/* Line 1455 of yacc.c */
-#line 1201 "parser/Grammar.y"
- {
- (yyval.funcExprNode) = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), GLOBAL_DATA->lexer->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0);
- if ((yyvsp[(4) - (8)].parameterList).m_features & ArgumentsFeature)
- (yyvsp[(7) - (8)].functionBodyNode)->setUsesArguments();
- setStatementLocation((yyvsp[(7) - (8)].functionBodyNode), (yylsp[(6) - (8)]), (yylsp[(8) - (8)]));
- ;}
- break;
-
- case 293:
-
-/* Line 1455 of yacc.c */
-#line 1210 "parser/Grammar.y"
- { (yyval.parameterList).m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident));
- (yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
- (yyval.parameterList).m_node.tail = (yyval.parameterList).m_node.head; ;}
- break;
-
- case 294:
-
-/* Line 1455 of yacc.c */
-#line 1213 "parser/Grammar.y"
- { (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head;
- (yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
- (yyval.parameterList).m_node.tail = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].parameterList).m_node.tail, *(yyvsp[(3) - (3)].ident)); ;}
- break;
-
- case 295:
-
-/* Line 1455 of yacc.c */
-#line 1219 "parser/Grammar.y"
- { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;}
- break;
-
- case 296:
-
-/* Line 1455 of yacc.c */
-#line 1220 "parser/Grammar.y"
- { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;}
- break;
-
- case 297:
-
-/* Line 1455 of yacc.c */
-#line 1224 "parser/Grammar.y"
- { GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;}
- break;
-
- case 298:
-
-/* Line 1455 of yacc.c */
-#line 1225 "parser/Grammar.y"
- { GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features,
- (yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;}
- break;
-
- case 299:
-
-/* Line 1455 of yacc.c */
-#line 1230 "parser/Grammar.y"
- { (yyval.sourceElements).m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA);
- (yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node);
- (yyval.sourceElements).m_varDeclarations = (yyvsp[(1) - (1)].statementNode).m_varDeclarations;
- (yyval.sourceElements).m_funcDeclarations = (yyvsp[(1) - (1)].statementNode).m_funcDeclarations;
- (yyval.sourceElements).m_features = (yyvsp[(1) - (1)].statementNode).m_features;
- (yyval.sourceElements).m_numConstants = (yyvsp[(1) - (1)].statementNode).m_numConstants;
- ;}
- break;
-
- case 300:
-
-/* Line 1455 of yacc.c */
-#line 1237 "parser/Grammar.y"
- { (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node);
- (yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations);
- (yyval.sourceElements).m_funcDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (2)].statementNode).m_funcDeclarations);
- (yyval.sourceElements).m_features = (yyvsp[(1) - (2)].sourceElements).m_features | (yyvsp[(2) - (2)].statementNode).m_features;
- (yyval.sourceElements).m_numConstants = (yyvsp[(1) - (2)].sourceElements).m_numConstants + (yyvsp[(2) - (2)].statementNode).m_numConstants;
- ;}
- break;
-
- case 304:
-
-/* Line 1455 of yacc.c */
-#line 1251 "parser/Grammar.y"
- { ;}
- break;
-
- case 305:
-
-/* Line 1455 of yacc.c */
-#line 1252 "parser/Grammar.y"
- { ;}
- break;
-
- case 306:
-
-/* Line 1455 of yacc.c */
-#line 1253 "parser/Grammar.y"
- { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; ;}
- break;
-
- case 307:
-
-/* Line 1455 of yacc.c */
-#line 1254 "parser/Grammar.y"
- { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; ;}
- break;
-
- case 308:
-
-/* Line 1455 of yacc.c */
-#line 1258 "parser/Grammar.y"
- { ;}
- break;
-
- case 309:
-
-/* Line 1455 of yacc.c */
-#line 1259 "parser/Grammar.y"
- { ;}
- break;
-
- case 310:
-
-/* Line 1455 of yacc.c */
-#line 1260 "parser/Grammar.y"
- { ;}
- break;
-
- case 311:
-
-/* Line 1455 of yacc.c */
-#line 1261 "parser/Grammar.y"
- { if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;}
- break;
-
- case 312:
-
-/* Line 1455 of yacc.c */
-#line 1262 "parser/Grammar.y"
- { if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;}
- break;
-
- case 316:
-
-/* Line 1455 of yacc.c */
-#line 1272 "parser/Grammar.y"
- { ;}
- break;
-
- case 317:
-
-/* Line 1455 of yacc.c */
-#line 1273 "parser/Grammar.y"
- { ;}
- break;
-
- case 318:
-
-/* Line 1455 of yacc.c */
-#line 1275 "parser/Grammar.y"
- { ;}
- break;
-
- case 322:
-
-/* Line 1455 of yacc.c */
-#line 1282 "parser/Grammar.y"
- { ;}
- break;
-
- case 517:
-
-/* Line 1455 of yacc.c */
-#line 1650 "parser/Grammar.y"
- { ;}
- break;
-
- case 518:
-
-/* Line 1455 of yacc.c */
-#line 1651 "parser/Grammar.y"
- { ;}
- break;
-
- case 520:
-
-/* Line 1455 of yacc.c */
-#line 1656 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 521:
-
-/* Line 1455 of yacc.c */
-#line 1660 "parser/Grammar.y"
- { ;}
- break;
-
- case 522:
-
-/* Line 1455 of yacc.c */
-#line 1661 "parser/Grammar.y"
- { ;}
- break;
-
- case 525:
-
-/* Line 1455 of yacc.c */
-#line 1667 "parser/Grammar.y"
- { ;}
- break;
-
- case 526:
-
-/* Line 1455 of yacc.c */
-#line 1668 "parser/Grammar.y"
- { ;}
- break;
-
- case 530:
-
-/* Line 1455 of yacc.c */
-#line 1675 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 533:
-
-/* Line 1455 of yacc.c */
-#line 1684 "parser/Grammar.y"
- { ;}
- break;
-
- case 534:
-
-/* Line 1455 of yacc.c */
-#line 1685 "parser/Grammar.y"
- { ;}
- break;
-
- case 539:
-
-/* Line 1455 of yacc.c */
-#line 1702 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 555:
-
-/* Line 1455 of yacc.c */
-#line 1733 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 557:
-
-/* Line 1455 of yacc.c */
-#line 1735 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 559:
-
-/* Line 1455 of yacc.c */
-#line 1740 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 561:
-
-/* Line 1455 of yacc.c */
-#line 1742 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 563:
-
-/* Line 1455 of yacc.c */
-#line 1747 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 565:
-
-/* Line 1455 of yacc.c */
-#line 1749 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 568:
-
-/* Line 1455 of yacc.c */
-#line 1761 "parser/Grammar.y"
- { ;}
- break;
-
- case 569:
-
-/* Line 1455 of yacc.c */
-#line 1762 "parser/Grammar.y"
- { ;}
- break;
-
- case 578:
-
-/* Line 1455 of yacc.c */
-#line 1786 "parser/Grammar.y"
- { ;}
- break;
-
- case 580:
-
-/* Line 1455 of yacc.c */
-#line 1791 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 585:
-
-/* Line 1455 of yacc.c */
-#line 1802 "parser/Grammar.y"
- { AUTO_SEMICOLON; ;}
- break;
-
- case 592:
-
-/* Line 1455 of yacc.c */
-#line 1818 "parser/Grammar.y"
- { ;}
- break;
-
-
-
-/* Line 1455 of yacc.c */
-#line 5119 "/JavaScriptCore/generated/Grammar.tab.c"
- default: break;
- }
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
- *++yylsp = yyloc;
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (YY_("syntax error"));
-#else
- {
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (yymsg);
- }
- else
- {
- yyerror (YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
- }
-#endif
- }
-
- yyerror_range[0] = yylloc;
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, &yylloc);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- yyerror_range[0] = yylsp[1-yylen];
- /* Do not reclaim the symbols of the rule which action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
- yyerror_range[0] = *yylsp;
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, yylsp);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- *++yyvsp = yylval;
-
- yyerror_range[1] = yylloc;
- /* Using YYLLOC is tempting, but would change the location of
- the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
- *++yylsp = yyloc;
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#if !defined(yyoverflow) || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
- if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, &yylloc);
- /* Do not reclaim the symbols of the rule which action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, yylsp);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
-}
-
-
-
-/* Line 1675 of yacc.c */
-#line 1834 "parser/Grammar.y"
-
-
-#undef GLOBAL_DATA
-
-static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
-{
- if (!loc->isLocation())
- return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot);
-
- if (loc->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(loc);
- if (op == OpEqual) {
- AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments);
- setExceptionLocation(node, start, divot, end);
- return node;
- } else
- return new (globalData) ReadModifyResolveNode(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 (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
- else {
- ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(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 (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
-
- ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->endOffset());
- return node;
-}
-
-static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
-{
- if (!expr->isLocation())
- return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
-
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
- }
- if (expr->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PrefixBracketNode* node = new (globalData) PrefixBracketNode(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 (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->startOffset());
- return node;
-}
-
-static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
-{
- if (!expr->isLocation())
- return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
-
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
- }
- if (expr->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PostfixBracketNode* node = new (globalData) PostfixBracketNode(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 (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->endOffset());
- return node;
-}
-
-static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
-{
- CodeFeatures features = func.m_features | args.m_features;
- int numConstants = func.m_numConstants + args.m_numConstants;
- if (!func.m_node->isLocation())
- return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
- if (func.m_node->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
- const Identifier& identifier = resolve->identifier();
- if (identifier == globalData->propertyNames->eval)
- return createNodeInfo<ExpressionNode*>(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
- return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
- }
- if (func.m_node->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
- FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
- node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
- return createNodeInfo<ExpressionNode*>(node, features, numConstants);
- }
- ASSERT(func.m_node->isDotAccessorNode());
- DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
- FunctionCallDotNode* node;
- if (dot->identifier() == globalData->propertyNames->call)
- node = new (globalData) CallFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
- else if (dot->identifier() == globalData->propertyNames->apply)
- node = new (globalData) ApplyFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
- else
- node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->endOffset());
- return createNodeInfo<ExpressionNode*>(node, features, numConstants);
-}
-
-static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr)
-{
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) TypeOfResolveNode(globalData, resolve->identifier());
- }
- return new (globalData) TypeOfValueNode(globalData, expr);
-}
-
-static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end)
-{
- if (!expr->isLocation())
- return new (globalData) DeleteValueNode(globalData, expr);
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot);
- }
- if (expr->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
- }
- ASSERT(expr->isDotAccessorNode());
- DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
- return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
-}
-
-static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
-{
- PropertyNode::Type type;
- if (getOrSet == "get")
- type = PropertyNode::Getter;
- else if (getOrSet == "set")
- type = PropertyNode::Setter;
- else
- return 0;
- return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
-}
-
-static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
-{
- if (n->isNumber()) {
- NumberNode* numberNode = static_cast<NumberNode*>(n);
- numberNode->setValue(-numberNode->value());
- return numberNode;
- }
-
- return new (globalData) NegateNode(globalData, n);
-}
-
-static NumberNode* makeNumberNode(JSGlobalData* globalData, double d)
-{
- return new (globalData) NumberNode(globalData, d);
-}
-
-static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
-{
- if (expr->isNumber())
- return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value()));
- return new (globalData) BitwiseNotNode(globalData, expr);
-}
-
-static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- expr1 = expr1->stripUnaryPlus();
- expr2 = expr2->stripUnaryPlus();
-
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
-
- if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
- return new (globalData) UnaryPlusNode(globalData, expr2);
-
- if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
- return new (globalData) UnaryPlusNode(globalData, expr1);
-
- return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- expr1 = expr1->stripUnaryPlus();
- expr2 = expr2->stripUnaryPlus();
-
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
- return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
- return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- expr1 = expr1->stripUnaryPlus();
- expr2 = expr2->stripUnaryPlus();
-
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
- return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-// Called by yyparse on error.
-int yyerror(const char*)
-{
- return 1;
-}
-
-// May we automatically insert a semicolon?
-static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
-{
- return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
-}
-
-static ExpressionNode* combineCommaNodes(JSGlobalData* globalData, ExpressionNode* list, ExpressionNode* init)
-{
- if (!list)
- return init;
- if (list->isCommaNode()) {
- static_cast<CommaNode*>(list)->append(init);
- return list;
- }
- return new (globalData) CommaNode(globalData, list, init);
-}
-
-// We turn variable declarations into either assignments or empty
-// statements (which later get stripped out), because the actual
-// declaration work is hoisted up to the start of the function body
-static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
-{
- if (!expr)
- return new (globalData) EmptyStatementNode(globalData);
- return new (globalData) VarStatementNode(globalData, expr);
-}
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h
deleted file mode 100644
index 04dfeb1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h
+++ /dev/null
@@ -1,173 +0,0 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
-
-/* Skeleton interface for Bison's Yacc-like parsers in C
-
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
- 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 3 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NULLTOKEN = 258,
- TRUETOKEN = 259,
- FALSETOKEN = 260,
- BREAK = 261,
- CASE = 262,
- DEFAULT = 263,
- FOR = 264,
- NEW = 265,
- VAR = 266,
- CONSTTOKEN = 267,
- CONTINUE = 268,
- FUNCTION = 269,
- RETURN = 270,
- VOIDTOKEN = 271,
- DELETETOKEN = 272,
- IF = 273,
- THISTOKEN = 274,
- DO = 275,
- WHILE = 276,
- INTOKEN = 277,
- INSTANCEOF = 278,
- TYPEOF = 279,
- SWITCH = 280,
- WITH = 281,
- RESERVED = 282,
- THROW = 283,
- TRY = 284,
- CATCH = 285,
- FINALLY = 286,
- DEBUGGER = 287,
- IF_WITHOUT_ELSE = 288,
- ELSE = 289,
- EQEQ = 290,
- NE = 291,
- STREQ = 292,
- STRNEQ = 293,
- LE = 294,
- GE = 295,
- OR = 296,
- AND = 297,
- PLUSPLUS = 298,
- MINUSMINUS = 299,
- LSHIFT = 300,
- RSHIFT = 301,
- URSHIFT = 302,
- PLUSEQUAL = 303,
- MINUSEQUAL = 304,
- MULTEQUAL = 305,
- DIVEQUAL = 306,
- LSHIFTEQUAL = 307,
- RSHIFTEQUAL = 308,
- URSHIFTEQUAL = 309,
- ANDEQUAL = 310,
- MODEQUAL = 311,
- XOREQUAL = 312,
- OREQUAL = 313,
- OPENBRACE = 314,
- CLOSEBRACE = 315,
- NUMBER = 316,
- IDENT = 317,
- STRING = 318,
- AUTOPLUSPLUS = 319,
- AUTOMINUSMINUS = 320
- };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-
-/* Line 1676 of yacc.c */
-#line 146 "parser/Grammar.y"
-
- int intValue;
- double doubleValue;
- const Identifier* ident;
-
- // expression subtrees
- ExpressionNodeInfo expressionNode;
- FuncDeclNodeInfo funcDeclNode;
- PropertyNodeInfo propertyNode;
- ArgumentsNodeInfo argumentsNode;
- ConstDeclNodeInfo constDeclNode;
- CaseBlockNodeInfo caseBlockNode;
- CaseClauseNodeInfo caseClauseNode;
- FuncExprNodeInfo funcExprNode;
-
- // statement nodes
- StatementNodeInfo statementNode;
- FunctionBodyNode* functionBodyNode;
- ProgramNode* programNode;
-
- SourceElementsInfo sourceElements;
- PropertyListInfo propertyList;
- ArgumentListInfo argumentList;
- VarDeclListInfo varDeclList;
- ConstDeclListInfo constDeclList;
- ClauseListInfo clauseList;
- ElementListInfo elementList;
- ParameterListInfo parameterList;
-
- Operator op;
-
-
-
-/* Line 1676 of yacc.c */
-#line 151 "/JavaScriptCore/generated/Grammar.tab.h"
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE
-{
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-} YYLTYPE;
-# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h
deleted file mode 100644
index 4ec868e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/JSONObject.lut.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Automatically generated from runtime/JSONObject.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue jsonTableValues[3] = {
- { "parse", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(JSONProtoFuncParse), (intptr_t)1 },
- { "stringify", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(JSONProtoFuncStringify), (intptr_t)1 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable jsonTable =
- { 4, 3, jsonTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h
deleted file mode 100644
index c17f34d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/Lexer.lut.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Automatically generated from parser/Keywords.table using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue mainTableValues[37] = {
- { "null", 0, (intptr_t)(NULLTOKEN), (intptr_t)0 },
- { "true", 0, (intptr_t)(TRUETOKEN), (intptr_t)0 },
- { "false", 0, (intptr_t)(FALSETOKEN), (intptr_t)0 },
- { "break", 0, (intptr_t)(BREAK), (intptr_t)0 },
- { "case", 0, (intptr_t)(CASE), (intptr_t)0 },
- { "catch", 0, (intptr_t)(CATCH), (intptr_t)0 },
- { "const", 0, (intptr_t)(CONSTTOKEN), (intptr_t)0 },
- { "default", 0, (intptr_t)(DEFAULT), (intptr_t)0 },
- { "finally", 0, (intptr_t)(FINALLY), (intptr_t)0 },
- { "for", 0, (intptr_t)(FOR), (intptr_t)0 },
- { "instanceof", 0, (intptr_t)(INSTANCEOF), (intptr_t)0 },
- { "new", 0, (intptr_t)(NEW), (intptr_t)0 },
- { "var", 0, (intptr_t)(VAR), (intptr_t)0 },
- { "continue", 0, (intptr_t)(CONTINUE), (intptr_t)0 },
- { "function", 0, (intptr_t)(FUNCTION), (intptr_t)0 },
- { "return", 0, (intptr_t)(RETURN), (intptr_t)0 },
- { "void", 0, (intptr_t)(VOIDTOKEN), (intptr_t)0 },
- { "delete", 0, (intptr_t)(DELETETOKEN), (intptr_t)0 },
- { "if", 0, (intptr_t)(IF), (intptr_t)0 },
- { "this", 0, (intptr_t)(THISTOKEN), (intptr_t)0 },
- { "do", 0, (intptr_t)(DO), (intptr_t)0 },
- { "while", 0, (intptr_t)(WHILE), (intptr_t)0 },
- { "else", 0, (intptr_t)(ELSE), (intptr_t)0 },
- { "in", 0, (intptr_t)(INTOKEN), (intptr_t)0 },
- { "switch", 0, (intptr_t)(SWITCH), (intptr_t)0 },
- { "throw", 0, (intptr_t)(THROW), (intptr_t)0 },
- { "try", 0, (intptr_t)(TRY), (intptr_t)0 },
- { "typeof", 0, (intptr_t)(TYPEOF), (intptr_t)0 },
- { "with", 0, (intptr_t)(WITH), (intptr_t)0 },
- { "debugger", 0, (intptr_t)(DEBUGGER), (intptr_t)0 },
- { "class", 0, (intptr_t)(RESERVED), (intptr_t)0 },
- { "enum", 0, (intptr_t)(RESERVED), (intptr_t)0 },
- { "export", 0, (intptr_t)(RESERVED), (intptr_t)0 },
- { "extends", 0, (intptr_t)(RESERVED), (intptr_t)0 },
- { "import", 0, (intptr_t)(RESERVED), (intptr_t)0 },
- { "super", 0, (intptr_t)(RESERVED), (intptr_t)0 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable mainTable =
- { 133, 127, mainTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h
deleted file mode 100644
index 6222ef9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/MathObject.lut.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Automatically generated from runtime/MathObject.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue mathTableValues[19] = {
- { "abs", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncAbs), (intptr_t)1 },
- { "acos", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncACos), (intptr_t)1 },
- { "asin", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncASin), (intptr_t)1 },
- { "atan", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncATan), (intptr_t)1 },
- { "atan2", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncATan2), (intptr_t)2 },
- { "ceil", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncCeil), (intptr_t)1 },
- { "cos", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncCos), (intptr_t)1 },
- { "exp", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncExp), (intptr_t)1 },
- { "floor", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncFloor), (intptr_t)1 },
- { "log", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncLog), (intptr_t)1 },
- { "max", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncMax), (intptr_t)2 },
- { "min", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncMin), (intptr_t)2 },
- { "pow", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncPow), (intptr_t)2 },
- { "random", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncRandom), (intptr_t)0 },
- { "round", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncRound), (intptr_t)1 },
- { "sin", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncSin), (intptr_t)1 },
- { "sqrt", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncSqrt), (intptr_t)1 },
- { "tan", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncTan), (intptr_t)1 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable mathTable =
- { 67, 63, mathTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h
deleted file mode 100644
index bfa6341..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/NumberConstructor.lut.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Automatically generated from runtime/NumberConstructor.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue numberTableValues[6] = {
- { "NaN", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorNaNValue), (intptr_t)0 },
- { "NEGATIVE_INFINITY", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorNegInfinity), (intptr_t)0 },
- { "POSITIVE_INFINITY", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorPosInfinity), (intptr_t)0 },
- { "MAX_VALUE", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorMaxValue), (intptr_t)0 },
- { "MIN_VALUE", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorMinValue), (intptr_t)0 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable numberTable =
- { 16, 15, numberTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h
deleted file mode 100644
index d45db01..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpConstructor.lut.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Automatically generated from runtime/RegExpConstructor.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue regExpConstructorTableValues[22] = {
- { "input", None, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorInput), (intptr_t)setRegExpConstructorInput },
- { "$_", DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorInput), (intptr_t)setRegExpConstructorInput },
- { "multiline", None, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorMultiline), (intptr_t)setRegExpConstructorMultiline },
- { "$*", DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorMultiline), (intptr_t)setRegExpConstructorMultiline },
- { "lastMatch", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastMatch), (intptr_t)0 },
- { "$&", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastMatch), (intptr_t)0 },
- { "lastParen", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastParen), (intptr_t)0 },
- { "$+", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastParen), (intptr_t)0 },
- { "leftContext", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLeftContext), (intptr_t)0 },
- { "$`", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLeftContext), (intptr_t)0 },
- { "rightContext", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorRightContext), (intptr_t)0 },
- { "$'", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorRightContext), (intptr_t)0 },
- { "$1", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar1), (intptr_t)0 },
- { "$2", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar2), (intptr_t)0 },
- { "$3", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar3), (intptr_t)0 },
- { "$4", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar4), (intptr_t)0 },
- { "$5", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar5), (intptr_t)0 },
- { "$6", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar6), (intptr_t)0 },
- { "$7", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar7), (intptr_t)0 },
- { "$8", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar8), (intptr_t)0 },
- { "$9", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar9), (intptr_t)0 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable regExpConstructorTable =
- { 65, 63, regExpConstructorTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h
deleted file mode 100644
index 8dcb7c9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/RegExpObject.lut.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Automatically generated from runtime/RegExpObject.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue regExpTableValues[6] = {
- { "global", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectGlobal), (intptr_t)0 },
- { "ignoreCase", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectIgnoreCase), (intptr_t)0 },
- { "multiline", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectMultiline), (intptr_t)0 },
- { "source", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectSource), (intptr_t)0 },
- { "lastIndex", DontDelete|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectLastIndex), (intptr_t)setRegExpObjectLastIndex },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable regExpTable =
- { 17, 15, regExpTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h b/src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h
deleted file mode 100644
index 6ea0803..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/StringPrototype.lut.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Automatically generated from runtime/StringPrototype.cpp using /JavaScriptCore/create_hash_table. DO NOT EDIT!
-
-#include "Lookup.h"
-
-namespace JSC {
-
-static const struct HashTableValue stringTableValues[36] = {
- { "toString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToString), (intptr_t)0 },
- { "valueOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToString), (intptr_t)0 },
- { "charAt", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncCharAt), (intptr_t)1 },
- { "charCodeAt", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncCharCodeAt), (intptr_t)1 },
- { "concat", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncConcat), (intptr_t)1 },
- { "indexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncIndexOf), (intptr_t)1 },
- { "lastIndexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncLastIndexOf), (intptr_t)1 },
- { "match", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncMatch), (intptr_t)1 },
- { "replace", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncReplace), (intptr_t)2 },
- { "search", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSearch), (intptr_t)1 },
- { "slice", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSlice), (intptr_t)2 },
- { "split", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSplit), (intptr_t)2 },
- { "substr", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSubstr), (intptr_t)2 },
- { "substring", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSubstring), (intptr_t)2 },
- { "toLowerCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToLowerCase), (intptr_t)0 },
- { "toUpperCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToUpperCase), (intptr_t)0 },
- { "localeCompare", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncLocaleCompare), (intptr_t)1 },
- { "toLocaleLowerCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToLowerCase), (intptr_t)0 },
- { "toLocaleUpperCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToUpperCase), (intptr_t)0 },
- { "big", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncBig), (intptr_t)0 },
- { "small", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSmall), (intptr_t)0 },
- { "blink", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncBlink), (intptr_t)0 },
- { "bold", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncBold), (intptr_t)0 },
- { "fixed", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncFixed), (intptr_t)0 },
- { "italics", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncItalics), (intptr_t)0 },
- { "strike", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncStrike), (intptr_t)0 },
- { "sub", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSub), (intptr_t)0 },
- { "sup", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSup), (intptr_t)0 },
- { "fontcolor", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncFontcolor), (intptr_t)1 },
- { "fontsize", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncFontsize), (intptr_t)1 },
- { "anchor", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncAnchor), (intptr_t)1 },
- { "link", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncLink), (intptr_t)1 },
- { "trim", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncTrim), (intptr_t)0 },
- { "trimLeft", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncTrimLeft), (intptr_t)0 },
- { "trimRight", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncTrimRight), (intptr_t)0 },
- { 0, 0, 0, 0 }
-};
-
-extern JSC_CONST_HASHTABLE HashTable stringTable =
- { 133, 127, stringTableValues, 0 };
-} // namespace
diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/chartables.c b/src/3rdparty/webkit/JavaScriptCore/generated/chartables.c
deleted file mode 100644
index 5c99db0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/generated/chartables.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* This file is automatically written by the dftables auxiliary
-program. If you edit it by hand, you might like to edit the Makefile to
-prevent its ever being regenerated.
-
-This file contains the default tables for characters with codes less than
-128 (ASCII characters). These tables are used when no external tables are
-passed to PCRE. */
-
-const unsigned char jsc_pcre_default_tables[480] = {
-
-/* This table is a lower casing table. */
-
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
- 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
-
-/* This table is a case flipping table. */
-
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
- 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
- 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
-
-/* This table contains bit maps for various character classes.
-Each map is 32 bytes long and the bits run from the least
-significant end of each byte. The classes are: space, digit, word. */
-
- 0x00, 0x3E, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03,
- 0xFE, 0xFF, 0xFF, 0x87, 0xFE, 0xFF, 0xFF, 0x07,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-/* This table identifies various classes of character by individual bits:
- 0x01 white space character
- 0x08 hexadecimal digit
- 0x10 alphanumeric or '_'
-*/
-
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0- 7 */
- 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 8- 15 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 16- 23 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 24- 31 */
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* - ' */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ( - / */
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, /* 0 - 7 */
- 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8 - ? */
- 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x10, /* @ - G */
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, /* H - O */
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, /* P - W */
- 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, /* X - _ */
- 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x10, /* ` - g */
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, /* h - o */
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, /* p - w */
- 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}; /* x -127 */
-
-
-/* End of chartables.c */
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/CachedCall.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/CachedCall.h
deleted file mode 100644
index eb48a03..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/CachedCall.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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, JSValue* exception)
- : m_valid(false)
- , m_interpreter(callFrame->interpreter())
- , m_exception(exception)
- , m_globalObjectScope(callFrame, function->scope().globalObject())
- {
- ASSERT(!function->isHostFunction());
- m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argCount, function->scope().node(), exception);
- m_valid = !*exception;
- }
-
- JSValue call()
- {
- ASSERT(m_valid);
- return m_interpreter->execute(m_closure, m_exception);
- }
- 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;
- JSValue* m_exception;
- DynamicGlobalObjectScope m_globalObjectScope;
- CallFrameClosure m_closure;
- };
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.cpp
deleted file mode 100644
index 9724875..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 {
-
-JSValue CallFrame::thisValue()
-{
- return this[codeBlock()->thisRegister()].jsValue();
-}
-
-#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.ascii(), signedLineNumber);
-}
-#endif
-
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
deleted file mode 100644
index e3ea689..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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 "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:
- JSFunction* 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();
- }
- int argumentCount() const { return this[RegisterFile::ArgumentCount].i(); }
-
- JSValue thisValue();
-
- // 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;
- }
-
- // FIXME: Elsewhere, we use JSGlobalData* rather than JSGlobalData&.
- // We should make this more uniform and either use a reference everywhere
- // or a pointer everywhere.
- 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 setException(JSValue exception) { globalData().exception = exception; }
- void clearException() { globalData().exception = JSValue(); }
- JSValue exception() const { return globalData().exception; }
- JSValue* exceptionSlot() { 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(); }
- Arguments* optionalCalleeArguments() const { return this[RegisterFile::OptionalCalleeArguments].arguments(); }
- Instruction* returnPC() const { return this[RegisterFile::ReturnPC].vPC(); }
-
- void setCalleeArguments(JSValue arguments) { static_cast<Register*>(this)[RegisterFile::OptionalCalleeArguments] = arguments; }
- 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 returnValueRegister, int argc, JSFunction* function)
- {
- ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
-
- setCodeBlock(codeBlock);
- setScopeChain(scopeChain);
- setCallerFrame(callerFrame);
- static_cast<Register*>(this)[RegisterFile::ReturnPC] = vPC; // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
- static_cast<Register*>(this)[RegisterFile::ReturnValueRegister] = Register::withInt(returnValueRegister);
- setArgumentCount(argc); // original argument count (for the sake of the "arguments" object)
- setCallee(function);
- setCalleeArguments(JSValue());
- }
-
- // Read a register from the codeframe (or constant from the CodeBlock).
- inline Register& r(int);
-
- static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }
- int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); }
-
- 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); }
-
- private:
- void setArgumentCount(int count) { static_cast<Register*>(this)[RegisterFile::ArgumentCount] = Register::withInt(count); }
- void setCallee(JSFunction* callee) { static_cast<Register*>(this)[RegisterFile::Callee] = callee; }
- void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[RegisterFile::CodeBlock] = codeBlock; }
-
- static const intptr_t HostCallFrameFlag = 1;
-
- ExecState();
- ~ExecState();
- };
-
-} // namespace JSC
-
-#endif // CallFrame_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrameClosure.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrameClosure.h
deleted file mode 100644
index a301060..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrameClosure.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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);
- newCallFrame->setCalleeArguments(JSValue());
- for (int i = providedParams; i < expectedParams; ++i)
- newCallFrame[i - RegisterFile::CallFrameHeaderSize - expectedParams] = jsUndefined();
- }
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
deleted file mode 100644
index a56040c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
+++ /dev/null
@@ -1,4357 +0,0 @@
-/*
- * 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 "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 <limits.h>
-#include <stdio.h>
-#include <wtf/Threading.h>
-
-#if ENABLE(JIT)
-#include "JIT.h"
-#endif
-
-using namespace std;
-
-namespace JSC {
-
-static ALWAYS_INLINE unsigned bytecodeOffsetForPC(CallFrame* callFrame, CodeBlock* codeBlock, void* pc)
-{
-#if ENABLE(JIT)
- return codeBlock->getBytecodeIndex(callFrame, ReturnAddressPtr(pc));
-#else
- UNUSED_PARAM(callFrame);
- return static_cast<Instruction*>(pc) - codeBlock->instructions().begin();
-#endif
-}
-
-// 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 USE(INTERPRETER)
-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->r(dst) = JSValue(result);
- return true;
- }
- } while (++iter != end);
- exceptionValue = createUndefinedVariableError(callFrame, ident, vPC - codeBlock->instructions().begin(), codeBlock);
- 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 + codeBlock->needsFullScopeChain();
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
- 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;
- callFrame->r(dst) = JSValue(result);
- return true;
- }
- } while (++iter != end);
- exceptionValue = createUndefinedVariableError(callFrame, ident, vPC - codeBlock->instructions().begin(), codeBlock);
- return false;
-}
-
-NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
-{
- int dst = vPC[1].u.operand;
- JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
- ASSERT(globalObject->isGlobalObject());
- int property = vPC[3].u.operand;
- Structure* structure = vPC[4].u.structure;
- int offset = vPC[5].u.operand;
-
- if (structure == globalObject->structure()) {
- callFrame->r(dst) = JSValue(globalObject->getDirectOffset(offset));
- return true;
- }
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- 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[4].u.structure)
- vPC[4].u.structure->deref();
- globalObject->structure()->ref();
- vPC[4] = globalObject->structure();
- vPC[5] = slot.cachedOffset();
- callFrame->r(dst) = JSValue(result);
- return true;
- }
-
- exceptionValue = callFrame->globalData().exception;
- if (exceptionValue)
- return false;
- callFrame->r(dst) = JSValue(result);
- return true;
- }
-
- exceptionValue = createUndefinedVariableError(callFrame, ident, vPC - codeBlock->instructions().begin(), codeBlock);
- return false;
-}
-
-NEVER_INLINE void Interpreter::resolveBase(CallFrame* callFrame, Instruction* vPC)
-{
- int dst = vPC[1].u.operand;
- int property = vPC[2].u.operand;
- callFrame->r(dst) = JSValue(JSC::resolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain()));
-}
-
-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->r(propDst) = JSValue(result);
- callFrame->r(baseDst) = JSValue(base);
- return true;
- }
- ++iter;
- } while (iter != end);
-
- exceptionValue = createUndefinedVariableError(callFrame, ident, vPC - codeBlock->instructions().begin(), codeBlock);
- return false;
-}
-
-#endif // USE(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 USE(INTERPRETER)
-static NEVER_INLINE bool isInvalidParamForIn(CallFrame* callFrame, CodeBlock* codeBlock, const Instruction* vPC, JSValue value, JSValue& exceptionData)
-{
- if (value.isObject())
- return false;
- exceptionData = createInvalidParamError(callFrame, "in" , value, vPC - codeBlock->instructions().begin(), codeBlock);
- return true;
-}
-
-static NEVER_INLINE bool isInvalidParamForInstanceOf(CallFrame* callFrame, CodeBlock* codeBlock, const Instruction* vPC, JSValue value, JSValue& exceptionData)
-{
- if (value.isObject() && asObject(value)->structure()->typeInfo().implementsHasInstance())
- return false;
- exceptionData = createInvalidParamError(callFrame, "instanceof" , value, vPC - codeBlock->instructions().begin(), codeBlock);
- return true;
-}
-#endif
-
-NEVER_INLINE JSValue Interpreter::callEval(CallFrame* callFrame, RegisterFile* registerFile, Register* argv, int argc, int registerOffset, JSValue& exceptionValue)
-{
- if (argc < 2)
- return jsUndefined();
-
- JSValue program = argv[1].jsValue();
-
- if (!program.isString())
- return program;
-
- UString programSource = asString(program)->value(callFrame);
-
- LiteralParser preparser(callFrame, programSource, LiteralParser::NonStrictJSON);
- if (JSValue parsedObject = preparser.tryLiteralParse())
- return parsedObject;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- CodeBlock* codeBlock = callFrame->codeBlock();
- RefPtr<EvalExecutable> eval = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
-
- JSValue result = jsUndefined();
- if (eval)
- result = callFrame->globalData().interpreter->execute(eval.get(), callFrame, callFrame->thisValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue);
-
- return result;
-}
-
-Interpreter::Interpreter()
- : m_sampleEntryDepth(0)
- , m_reentryDepth(0)
-{
-#if HAVE(COMPUTED_GOTO)
- privateExecute(InitializeAndReturn, 0, 0, 0);
-
- for (int i = 0; i < numOpcodeIDs; ++i)
- m_opcodeIDTable.add(m_opcodeTable[i], static_cast<OpcodeID>(i));
-#endif // HAVE(COMPUTED_GOTO)
-
-#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("[ReturnValueRegister] | %10p | %d \n", it, (*it).i()); ++it;
- printf("[ArgumentCount] | %10p | %d \n", it, (*it).i()); ++it;
- printf("[Callee] | %10p | %p \n", it, (*it).function()); ++it;
- printf("[OptionalCalleeArguments] | %10p | %p \n", it, (*it).arguments()); ++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 HAVE(COMPUTED_GOTO)
- 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 (Profiler* profiler = *Profiler::enabledProfilerReference()) {
- if (callFrame->callee())
- profiler->didExecute(callFrame, callFrame->callee());
- else
- profiler->didExecute(callFrame, codeBlock->ownerExecutable()->sourceURL(), codeBlock->ownerExecutable()->lineNo());
- }
-
- // If this call frame created an activation or an 'arguments' object, tear it off.
- if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
- while (!scopeChain->object->inherits(&JSActivation::info))
- scopeChain = scopeChain->pop();
- static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments());
- } else if (Arguments* arguments = callFrame->optionalCalleeArguments()) {
- if (!arguments->isTornOff())
- arguments->copyRegisters();
- }
-
- if (oldCodeBlock->needsFullScopeChain())
- scopeChain->deref();
-
- void* returnPC = callFrame->returnPC();
- callFrame = callFrame->callerFrame();
- if (callFrame->hasHostCallFrameFlag())
- return false;
-
- codeBlock = callFrame->codeBlock();
- bytecodeOffset = bytecodeOffsetForPC(callFrame, codeBlock, returnPC);
- return true;
-}
-
-NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset, bool explicitThrow)
-{
- // Set up the exception object
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- if (exceptionValue.isObject()) {
- JSObject* exception = asObject(exceptionValue);
- if (exception->isNotAnObjectErrorStub()) {
- exception = createNotAnObjectError(callFrame, static_cast<JSNotAnObjectErrorStub*>(exception), bytecodeOffset, codeBlock);
- exceptionValue = exception;
- } else {
- if (!exception->hasProperty(callFrame, Identifier(callFrame, "line")) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, "sourceId")) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, "sourceURL")) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName)) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, expressionCaretOffsetPropertyName)) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName))) {
- if (explicitThrow) {
- int startOffset = 0;
- int endOffset = 0;
- int divotPoint = 0;
- int line = codeBlock->expressionRangeForBytecodeOffset(callFrame, bytecodeOffset, divotPoint, startOffset, endOffset);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, line), ReadOnly | DontDelete);
-
- // We only hit this path for error messages and throw statements, which don't have a specific failure position
- // So we just give the full range of the error/throw statement.
- exception->putWithAttributes(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName), jsNumber(callFrame, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName), jsNumber(callFrame, divotPoint + endOffset), ReadOnly | DontDelete);
- } else
- exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerExecutable()->sourceID()), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerExecutable()->sourceURL()), ReadOnly | DontDelete);
- }
-
- if (exception->isWatchdogException()) {
- while (unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock)) {
- // Don't need handler checks or anything, we just want to unroll all the JS callframes possible.
- }
- return 0;
- }
- }
- }
-
- if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
- DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
- bool hasHandler = codeBlock->handlerForBytecodeOffset(bytecodeOffset);
- debugger->exception(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset), hasHandler);
- }
-
- // If we throw in the middle of a call instruction, we need to notify
- // the profiler manually that the call instruction has returned, since
- // we'll never reach the relevant op_profile_did_call.
- if (Profiler* profiler = *Profiler::enabledProfilerReference()) {
-#if !ENABLE(JIT)
- if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode))
- profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 2].u.operand).jsValue());
- else if (codeBlock->instructions().size() > (bytecodeOffset + 8) && codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct))
- profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 10].u.operand).jsValue());
-#else
- int functionRegisterIndex;
- if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex))
- profiler->didExecute(callFrame, callFrame->r(functionRegisterIndex).jsValue());
-#endif
- }
-
- // Calculate an exception handler vPC, unwinding call frames as necessary.
-
- HandlerInfo* handler = 0;
- while (!(handler = codeBlock->handlerForBytecodeOffset(bytecodeOffset))) {
- if (!unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock))
- return 0;
- }
-
- // Now unwind the scope chain within the exception handler's call frame.
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChain sc(scopeChain);
- int scopeDelta = depth(codeBlock, sc) - handler->scopeDepth;
- ASSERT(scopeDelta >= 0);
- while (scopeDelta--)
- scopeChain = scopeChain->pop();
- callFrame->setScopeChain(scopeChain);
-
- return handler;
-}
-
-JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue* exception)
-{
- ASSERT(!scopeChain->globalData->exception);
-
- if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
- if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
- *exception = createStackOverflowError(callFrame);
- return jsNull();
- }
- }
-
- CodeBlock* codeBlock = &program->bytecode(callFrame, scopeChain);
-
- Register* oldEnd = m_registerFile.end();
- Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
- if (!m_registerFile.grow(newEnd)) {
- *exception = createStackOverflowError(callFrame);
- return jsNull();
- }
-
- DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
-
- JSGlobalObject* lastGlobalObject = m_registerFile.globalObject();
- JSGlobalObject* globalObject = callFrame->dynamicGlobalObject();
- globalObject->copyGlobalsTo(m_registerFile);
-
- CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize);
- newCallFrame->r(codeBlock->thisRegister()) = JSValue(thisObj);
- newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), 0, 0, 0);
-
- if (codeBlock->needsFullScopeChain())
- scopeChain->ref();
-
- Profiler** profiler = Profiler::enabledProfilerReference();
- if (*profiler)
- (*profiler)->willExecute(newCallFrame, program->sourceURL(), program->lineNo());
-
- JSValue result;
- {
- SamplingTool::CallRecord callRecord(m_sampler.get());
-
- m_reentryDepth++;
-#if ENABLE(JIT)
- result = program->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
-#else
- result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
-#endif
- 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 result;
-}
-
-JSValue Interpreter::execute(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception)
-{
- ASSERT(!scopeChain->globalData->exception);
-
- if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
- if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
- *exception = createStackOverflowError(callFrame);
- return jsNull();
- }
- }
-
- Register* oldEnd = m_registerFile.end();
- int argc = 1 + args.size(); // implicit "this" parameter
-
- if (!m_registerFile.grow(oldEnd + argc)) {
- *exception = createStackOverflowError(callFrame);
- return jsNull();
- }
-
- DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
-
- CallFrame* newCallFrame = CallFrame::create(oldEnd);
- size_t dst = 0;
- newCallFrame->r(0) = JSValue(thisObj);
- ArgList::const_iterator end = args.end();
- for (ArgList::const_iterator it = args.begin(); it != end; ++it)
- newCallFrame->r(++dst) = *it;
-
- CodeBlock* codeBlock = &functionExecutable->bytecode(callFrame, scopeChain);
- newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
- if (UNLIKELY(!newCallFrame)) {
- *exception = createStackOverflowError(callFrame);
- m_registerFile.shrink(oldEnd);
- return jsNull();
- }
- // a 0 codeBlock indicates a built-in caller
- newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, argc, function);
-
- Profiler** profiler = Profiler::enabledProfilerReference();
- if (*profiler)
- (*profiler)->willExecute(callFrame, function);
-
- JSValue result;
- {
- SamplingTool::CallRecord callRecord(m_sampler.get());
-
- m_reentryDepth++;
-#if ENABLE(JIT)
- result = functionExecutable->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
-#else
- result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
-#endif
- m_reentryDepth--;
- }
-
- if (*profiler)
- (*profiler)->didExecute(callFrame, function);
-
- m_registerFile.shrink(oldEnd);
- return result;
-}
-
-CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionExecutable, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception)
-{
- ASSERT(!scopeChain->globalData->exception);
-
- if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
- if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
- *exception = createStackOverflowError(callFrame);
- return CallFrameClosure();
- }
- }
-
- Register* oldEnd = m_registerFile.end();
- int argc = 1 + argCount; // implicit "this" parameter
-
- if (!m_registerFile.grow(oldEnd + argc)) {
- *exception = createStackOverflowError(callFrame);
- return CallFrameClosure();
- }
-
- CallFrame* newCallFrame = CallFrame::create(oldEnd);
- size_t dst = 0;
- for (int i = 0; i < argc; ++i)
- newCallFrame->r(++dst) = jsUndefined();
-
- CodeBlock* codeBlock = &FunctionExecutable->bytecode(callFrame, scopeChain);
- newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
- if (UNLIKELY(!newCallFrame)) {
- *exception = createStackOverflowError(callFrame);
- m_registerFile.shrink(oldEnd);
- return CallFrameClosure();
- }
- // a 0 codeBlock indicates a built-in caller
- newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, argc, function);
-#if ENABLE(JIT)
- FunctionExecutable->jitCode(newCallFrame, scopeChain);
-#endif
-
- CallFrameClosure result = { callFrame, newCallFrame, function, FunctionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc };
- return result;
-}
-
-JSValue Interpreter::execute(CallFrameClosure& closure, JSValue* exception)
-{
- 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)
- result = closure.functionExecutable->generatedJITCode().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception);
-#else
- result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception);
-#endif
- m_reentryDepth--;
- }
-
- if (*profiler)
- (*profiler)->didExecute(closure.oldCallFrame, closure.function);
- return result;
-}
-
-void Interpreter::endRepeatCall(CallFrameClosure& closure)
-{
- m_registerFile.shrink(closure.oldEnd);
-}
-
-JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception)
-{
- return execute(eval, callFrame, thisObj, m_registerFile.size() + eval->bytecode(callFrame, scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
-}
-
-JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue* exception)
-{
- ASSERT(!scopeChain->globalData->exception);
-
- if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
- if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
- *exception = createStackOverflowError(callFrame);
- return jsNull();
- }
- }
-
- DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
-
- EvalCodeBlock* codeBlock = &eval->bytecode(callFrame, scopeChain);
-
- JSVariableObject* variableObject;
- for (ScopeChainNode* node = scopeChain; ; node = node->next) {
- ASSERT(node);
- if (node->object->isVariableObject()) {
- variableObject = static_cast<JSVariableObject*>(node->object);
- break;
- }
- }
-
- { // Scope for BatchedTransitionOptimizer
-
- BatchedTransitionOptimizer optimizer(variableObject);
-
- unsigned numVariables = codeBlock->numVariables();
- 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);
- }
- }
-
- int numFunctions = codeBlock->numberOfFunctionDecls();
- 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)) {
- *exception = createStackOverflowError(callFrame);
- return jsNull();
- }
-
- CallFrame* newCallFrame = CallFrame::create(m_registerFile.start() + globalRegisterOffset);
-
- // a 0 codeBlock indicates a built-in caller
- newCallFrame->r(codeBlock->thisRegister()) = JSValue(thisObj);
- newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, 0, 0);
-
- if (codeBlock->needsFullScopeChain())
- scopeChain->ref();
-
- Profiler** profiler = Profiler::enabledProfilerReference();
- if (*profiler)
- (*profiler)->willExecute(newCallFrame, eval->sourceURL(), eval->lineNo());
-
- JSValue result;
- {
- SamplingTool::CallRecord callRecord(m_sampler.get());
-
- m_reentryDepth++;
-#if ENABLE(JIT)
- result = eval->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
-#else
- result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
-#endif
- m_reentryDepth--;
- }
-
- if (*profiler)
- (*profiler)->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
-
- m_registerFile.shrink(oldEnd);
- return 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 USE(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->r(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 = asCell(baseValue);
- 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 = asCell(baseValue)->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 // USE(INTERPRETER)
-
-JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, CallFrame* callFrame, JSValue* exception)
-{
- // 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 HAVE(COMPUTED_GOTO)
- #define LIST_OPCODE_LABEL(id, length) &&id,
- static Opcode labels[] = { FOR_EACH_OPCODE_ID(LIST_OPCODE_LABEL) };
- for (size_t i = 0; i < sizeof(labels) / sizeof(Opcode); ++i)
- m_opcodeTable[i] = labels[i];
- #undef LIST_OPCODE_LABEL
- #endif // HAVE(COMPUTED_GOTO)
- return JSValue();
- }
-
-#if ENABLE(JIT)
- // Mixing Interpreter + JIT is not supported.
- ASSERT_NOT_REACHED();
-#endif
-#if !USE(INTERPRETER)
- UNUSED_PARAM(registerFile);
- UNUSED_PARAM(callFrame);
- UNUSED_PARAM(exception);
- return JSValue();
-#else
-
- JSGlobalData* globalData = &callFrame->globalData();
- JSValue exceptionValue;
- HandlerInfo* handler = 0;
-
- Instruction* vPC = callFrame->codeBlock()->instructions().begin();
- Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
- unsigned tickCount = globalData->timeoutChecker.ticksUntilNextCheck();
-
-#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->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 HAVE(COMPUTED_GOTO)
- #define NEXT_INSTRUCTION() SAMPLE(callFrame->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(callFrame->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->r(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->r(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->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject->regExpStructure(), callFrame->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->r(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->r(dst) = jsBoolean(src1.asInt32() == src2.asInt32());
- else {
- JSValue result = jsBoolean(JSValue::equalSlowCase(callFrame, src1, src2));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsBoolean(true);
- vPC += OPCODE_LENGTH(op_eq_null);
- NEXT_INSTRUCTION();
- }
-
- callFrame->r(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->r(dst) = jsBoolean(src1.asInt32() != src2.asInt32());
- else {
- JSValue result = jsBoolean(!JSValue::equalSlowCase(callFrame, src1, src2));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsBoolean(false);
- vPC += OPCODE_LENGTH(op_neq_null);
- NEXT_INSTRUCTION();
- }
-
- callFrame->r(dst) = jsBoolean(!src.isCell() || !asCell(src)->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();
- callFrame->r(dst) = jsBoolean(JSValue::strictEqual(callFrame, src1, src2));
-
- 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();
- callFrame->r(dst) = jsBoolean(!JSValue::strictEqual(callFrame, src1, src2));
-
- 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->r(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->r(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->r(srcDst) = jsNumber(callFrame, v.asInt32() + 1);
- else {
- JSValue result = jsNumber(callFrame, v.toNumber(callFrame) + 1);
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(srcDst) = jsNumber(callFrame, v.asInt32() - 1);
- else {
- JSValue result = jsNumber(callFrame, v.toNumber(callFrame) - 1);
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(srcDst) = jsNumber(callFrame, v.asInt32() + 1);
- callFrame->r(dst) = v;
- } else {
- JSValue number = callFrame->r(srcDst).jsValue().toJSNumber(callFrame);
- CHECK_FOR_EXCEPTION();
- callFrame->r(srcDst) = jsNumber(callFrame, number.uncheckedGetNumber() + 1);
- callFrame->r(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->r(srcDst) = jsNumber(callFrame, v.asInt32() - 1);
- callFrame->r(dst) = v;
- } else {
- JSValue number = callFrame->r(srcDst).jsValue().toJSNumber(callFrame);
- CHECK_FOR_EXCEPTION();
- callFrame->r(srcDst) = jsNumber(callFrame, number.uncheckedGetNumber() - 1);
- callFrame->r(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->r(dst) = callFrame->r(src);
- else {
- JSValue result = srcVal.toJSNumber(callFrame);
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, -src.asInt32());
- else {
- JSValue result = jsNumber(callFrame, -src.toNumber(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, src1.asInt32() + src2.asInt32());
- else {
- JSValue result = jsAdd(callFrame, src1, src2);
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, src1.asInt32() * src2.asInt32());
- else {
- JSValue result = jsNumber(callFrame, src1.toNumber(callFrame) * src2.toNumber(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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(callFrame, dividend.toNumber(callFrame) / divisor.toNumber(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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(callFrame, dividend.asInt32() % divisor.asInt32());
- ASSERT(result);
- callFrame->r(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(callFrame, fmod(d1, d2));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, src1.asInt32() - src2.asInt32());
- else {
- JSValue result = jsNumber(callFrame, src1.toNumber(callFrame) - src2.toNumber(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, val.asInt32() << (shift.asInt32() & 0x1f));
- else {
- JSValue result = jsNumber(callFrame, (val.toInt32(callFrame)) << (shift.toUInt32(callFrame) & 0x1f));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, val.asInt32() >> (shift.asInt32() & 0x1f));
- else {
- JSValue result = jsNumber(callFrame, (val.toInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, val.asInt32() >> (shift.asInt32() & 0x1f));
- else {
- JSValue result = jsNumber(callFrame, (val.toUInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, src1.asInt32() & src2.asInt32());
- else {
- JSValue result = jsNumber(callFrame, src1.toInt32(callFrame) & src2.toInt32(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, src1.asInt32() ^ src2.asInt32());
- else {
- JSValue result = jsNumber(callFrame, src1.toInt32(callFrame) ^ src2.toInt32(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, src1.asInt32() | src2.asInt32());
- else {
- JSValue result = jsNumber(callFrame, src1.toInt32(callFrame) | src2.toInt32(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = jsNumber(callFrame, ~src.asInt32());
- else {
- JSValue result = jsNumber(callFrame, ~src.toInt32(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(dst) = result;
-
- vPC += OPCODE_LENGTH(op_not);
- 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();
-
- if (isInvalidParamForInstanceOf(callFrame, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
- goto vm_throw;
-
- bool result = asObject(baseVal)->hasInstance(callFrame, callFrame->r(value).jsValue(), callFrame->r(baseProto).jsValue());
- CHECK_FOR_EXCEPTION();
- callFrame->r(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->r(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->r(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->r(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->r(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->r(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->r(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->r(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, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
- goto vm_throw;
-
- JSObject* baseObj = asObject(baseVal);
-
- JSValue propName = callFrame->r(property).jsValue();
-
- uint32_t i;
- if (propName.getUInt32(i))
- callFrame->r(dst) = jsBoolean(baseObj->hasProperty(callFrame, i));
- else {
- Identifier property(callFrame, propName.toString(callFrame));
- CHECK_FOR_EXCEPTION();
- callFrame->r(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_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 = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
- ASSERT(scope->isGlobalObject());
- int index = vPC[3].u.operand;
-
- callFrame->r(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 = static_cast<JSGlobalObject*>(vPC[1].u.jsCell);
- ASSERT(scope->isGlobalObject());
- int index = vPC[2].u.operand;
- int value = vPC[3].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 + callFrame->codeBlock()->needsFullScopeChain();
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
- while (skip--) {
- ++iter;
- ASSERT(iter != end);
- }
-
- ASSERT((*iter)->isVariableObject());
- JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
- callFrame->r(dst) = scope->registerAt(index);
- 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 + callFrame->codeBlock()->needsFullScopeChain();
- int value = vPC[3].u.operand;
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- ScopeChainIterator iter = scopeChain->begin();
- ScopeChainIterator end = scopeChain->end();
- ASSERT(iter != end);
- while (skip--) {
- ++iter;
- ASSERT(iter != end);
- }
-
- ASSERT((*iter)->isVariableObject());
- JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
- 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_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;
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- 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->r(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 = asCell(baseValue);
- 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, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- callFrame->r(dst) = JSValue(baseObject->getDirectOffset(offset));
-
- vPC += OPCODE_LENGTH(op_get_by_id_self);
- NEXT_INSTRUCTION();
- }
- }
-
- uncacheGetByID(callFrame->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 = asCell(baseValue);
- 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, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
- ASSERT(baseValue.get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
- callFrame->r(dst) = JSValue(protoObject->getDirectOffset(offset));
-
- vPC += OPCODE_LENGTH(op_get_by_id_proto);
- NEXT_INSTRUCTION();
- }
- }
- }
-
- uncacheGetByID(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- 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 = asCell(baseValue);
- 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->r(dst) = result;
- } else
- callFrame->r(dst) = jsUndefined();
- vPC += OPCODE_LENGTH(op_get_by_id_getter_proto);
- NEXT_INSTRUCTION();
- }
- }
- }
- uncacheGetByID(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- skip_id_getter_proto:
-#endif
-#if HAVE(COMPUTED_GOTO)
- 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 = asCell(baseValue);
- 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 = callFrame->codeBlock()->identifier(property);
-
- PropertySlot::GetValueFunc getter = vPC[6].u.getterFunc;
- JSValue result = getter(callFrame, protoObject, ident);
- CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = result;
- vPC += OPCODE_LENGTH(op_get_by_id_custom_proto);
- NEXT_INSTRUCTION();
- }
- }
- }
- uncacheGetByID(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- 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 = asCell(baseValue);
- 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, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- ASSERT(baseValue.get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- callFrame->r(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(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- 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 = asCell(baseValue);
- 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->r(dst) = result;
- } else
- callFrame->r(dst) = jsUndefined();
-
- vPC += OPCODE_LENGTH(op_get_by_id_getter_self);
- NEXT_INSTRUCTION();
- }
- }
- uncacheGetByID(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- skip_id_getter_self:
-#endif
-#if HAVE(COMPUTED_GOTO)
- 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 = asCell(baseValue);
- 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 = callFrame->codeBlock()->identifier(property);
-
- PropertySlot::GetValueFunc getter = vPC[5].u.getterFunc;
- JSValue result = getter(callFrame, baseValue, ident);
- CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = result;
- vPC += OPCODE_LENGTH(op_get_by_id_custom_self);
- NEXT_INSTRUCTION();
- }
- }
- uncacheGetByID(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
-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 = callFrame->codeBlock()->identifier(property);
- JSValue baseValue = callFrame->r(base).jsValue();
- PropertySlot slot(baseValue);
- JSValue result = baseValue.get(callFrame, ident, slot);
- CHECK_FOR_EXCEPTION();
-
- callFrame->r(dst) = result;
- vPC += OPCODE_LENGTH(op_get_by_id_generic);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- 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 = asCell(baseValue);
- 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->r(dst) = result;
- } else
- callFrame->r(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(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- skip_id_getter_chain:
-#endif
-#if HAVE(COMPUTED_GOTO)
- 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 = asCell(baseValue);
- 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 = callFrame->codeBlock()->identifier(property);
-
- PropertySlot::GetValueFunc getter = vPC[7].u.getterFunc;
- JSValue result = getter(callFrame, baseObject, ident);
- CHECK_FOR_EXCEPTION();
- callFrame->r(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(callFrame->codeBlock(), vPC);
- NEXT_INSTRUCTION();
- }
-#if HAVE(COMPUTED_GOTO)
- 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->r(dst) = jsNumber(callFrame, asArray(baseValue)->length());
- vPC += OPCODE_LENGTH(op_get_array_length);
- NEXT_INSTRUCTION();
- }
-
- uncacheGetByID(callFrame->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->r(dst) = jsNumber(callFrame, asString(baseValue)->length());
- vPC += OPCODE_LENGTH(op_get_string_length);
- NEXT_INSTRUCTION();
- }
-
- uncacheGetByID(callFrame->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)
-
- 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;
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- JSValue baseValue = callFrame->r(base).jsValue();
- Identifier& ident = codeBlock->identifier(property);
- PutPropertySlot slot;
- 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)
-
- 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 = asCell(baseValue);
- Structure* oldStructure = vPC[4].u.structure;
- Structure* newStructure = vPC[5].u.structure;
-
- if (LIKELY(baseCell->structure() == oldStructure)) {
- ASSERT(baseCell->isObject());
- JSObject* baseObject = asObject(baseCell);
-
- 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(callFrame->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(callFrame->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(callFrame->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)
-
- 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 = asCell(baseValue);
- 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(callFrame->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(callFrame->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)
-
- 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;
-
- JSValue baseValue = callFrame->r(base).jsValue();
- Identifier& ident = callFrame->codeBlock()->identifier(property);
- PutPropertySlot slot;
- 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 = callFrame->codeBlock()->identifier(property);
- JSValue result = jsBoolean(baseObj->deleteProperty(callFrame, ident));
- CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = 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->r(dst) = 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->r(dst) = result;
- vPC += OPCODE_LENGTH(op_get_by_pname);
- NEXT_INSTRUCTION();
- }
- 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->r(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;
- 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();
- JSValue result;
- uint32_t i;
- if (subscript.getUInt32(i))
- result = jsBoolean(baseObj->deleteProperty(callFrame, i));
- else {
- CHECK_FOR_EXCEPTION();
- Identifier property(callFrame, subscript.toString(callFrame));
- CHECK_FOR_EXCEPTION();
- result = jsBoolean(baseObj->deleteProperty(callFrame, property));
- }
-
- CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = 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_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 += callFrame->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 += callFrame->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 {
- UString::Rep* value = asString(scrutinee)->value(callFrame).rep();
- if (value->length() != 1)
- vPC += defaultOffset;
- else
- vPC += callFrame->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 += callFrame->codeBlock()->stringSwitchJumpTable(tableIndex).offsetForValue(asString(scrutinee)->value(callFrame).rep(), 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;
-
- callFrame->r(dst) = JSValue(callFrame->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;
-
- FunctionExecutable* function = callFrame->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->r(dst) = JSValue(func);
-
- vPC += OPCODE_LENGTH(op_new_func_exp);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_call_eval) {
- /* call_eval dst(r) 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 dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCount = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
-
- 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, exceptionValue);
- if (exceptionValue)
- goto vm_throw;
- callFrame->r(dst) = 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 dst(r) 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 dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCount = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
-
- JSValue v = callFrame->r(func).jsValue();
-
- CallData callData;
- CallType callType = v.getCallData(callData);
-
- if (callType == CallTypeJS) {
- ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
- CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callFrame, callDataScopeChain);
-
- CallFrame* previousCallFrame = callFrame;
-
- callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
- if (UNLIKELY(!callFrame)) {
- callFrame = previousCallFrame;
- exceptionValue = createStackOverflowError(callFrame);
- goto vm_throw;
- }
-
- callFrame->init(newCodeBlock, vPC + 5, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
- 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);
- newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, 0);
-
- Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
- ArgList args(thisRegister + 1, argCount - 1);
-
- // FIXME: All host methods should be calling toThisObject, but this is not presently the case.
- JSValue thisValue = thisRegister->jsValue();
- if (thisValue == jsNull())
- thisValue = callFrame->globalThisValue();
-
- JSValue returnValue;
- {
- SamplingTool::HostCallRecord callRecord(m_sampler.get());
- returnValue = callData.native.function(newCallFrame, asObject(v), thisValue, args);
- }
- CHECK_FOR_EXCEPTION();
-
- callFrame->r(dst) = returnValue;
-
- vPC += OPCODE_LENGTH(op_call);
- NEXT_INSTRUCTION();
- }
-
- ASSERT(callType == CallTypeNone);
-
- exceptionValue = createNotAFunctionError(callFrame, v, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
- 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()) - 1;
- 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(!callFrame->callee()->isHostFunction());
- int32_t expectedParams = 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, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
- 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 {
- if (!arguments.isObject()) {
- exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
- goto vm_throw;
- }
- }
- }
- CHECK_FOR_EXCEPTION();
- callFrame->r(argCountDst) = Register::withInt(argCount + 1);
- vPC += OPCODE_LENGTH(op_load_varargs);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_call_varargs) {
- /* call_varargs dst(r) 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 dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCountReg = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
-
- JSValue v = callFrame->r(func).jsValue();
- int argCount = callFrame->r(argCountReg).i();
- registerOffset += argCount;
- CallData callData;
- CallType callType = v.getCallData(callData);
-
- if (callType == CallTypeJS) {
- ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
- CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callFrame, callDataScopeChain);
-
- CallFrame* previousCallFrame = callFrame;
-
- callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
- if (UNLIKELY(!callFrame)) {
- callFrame = previousCallFrame;
- exceptionValue = createStackOverflowError(callFrame);
- goto vm_throw;
- }
-
- callFrame->init(newCodeBlock, vPC + 5, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
- 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);
- newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, 0);
-
- Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
- ArgList args(thisRegister + 1, argCount - 1);
-
- // FIXME: All host methods should be calling toThisObject, but this is not presently the case.
- JSValue thisValue = thisRegister->jsValue();
- if (thisValue == jsNull())
- thisValue = callFrame->globalThisValue();
-
- JSValue returnValue;
- {
- SamplingTool::HostCallRecord callRecord(m_sampler.get());
- returnValue = callData.native.function(newCallFrame, asObject(v), thisValue, args);
- }
- CHECK_FOR_EXCEPTION();
-
- callFrame->r(dst) = returnValue;
-
- vPC += OPCODE_LENGTH(op_call_varargs);
- NEXT_INSTRUCTION();
- }
-
- ASSERT(callType == CallTypeNone);
-
- exceptionValue = createNotAFunctionError(callFrame, v, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
- goto vm_throw;
- }
- DEFINE_OPCODE(op_tear_off_activation) {
- /* tear_off_activation activation(r)
-
- Copy all locals and parameters to new memory allocated on
- the heap, and make the passed activation use this memory
- in the future when looking up entries in the symbol table.
- If there is an 'arguments' object, then it will also use
- this memory for storing the named parameters, but not any
- extra arguments.
-
- This opcode should only be used immediately before op_ret.
- */
-
- int src = vPC[1].u.operand;
- ASSERT(callFrame->codeBlock()->needsFullScopeChain());
-
- asActivation(callFrame->r(src).jsValue())->copyRegisters(callFrame->optionalCalleeArguments());
-
- vPC += OPCODE_LENGTH(op_tear_off_activation);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_tear_off_arguments) {
- /* tear_off_arguments
-
- Copy all arguments to new memory allocated on the heap,
- and make the 'arguments' object use this memory in the
- future when looking up named parameters, but not any
- extra arguments. If an activation object exists for the
- current function context, then the tear_off_activation
- opcode should be used instead.
-
- This opcode should only be used immediately before op_ret.
- */
-
- ASSERT(callFrame->codeBlock()->usesArguments() && !callFrame->codeBlock()->needsFullScopeChain());
-
- if (callFrame->optionalCalleeArguments())
- callFrame->optionalCalleeArguments()->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 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 (callFrame->codeBlock()->needsFullScopeChain())
- callFrame->scopeChain()->deref();
-
- JSValue returnValue = callFrame->r(result).jsValue();
-
- vPC = callFrame->returnPC();
- int dst = callFrame->returnValueRegister();
- callFrame = callFrame->callerFrame();
-
- if (callFrame->hasHostCallFrameFlag())
- return returnValue;
-
- callFrame->r(dst) = returnValue;
-
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_enter) {
- /* enter
-
- Initializes local variables to undefined and fills constant
- registers with their values. If the code block requires an
- activation, enter_with_activation should be used instead.
-
- This opcode should only be used at the beginning of a code
- block.
- */
-
- size_t i = 0;
- CodeBlock* codeBlock = callFrame->codeBlock();
-
- for (size_t count = codeBlock->m_numVars; i < count; ++i)
- callFrame->r(i) = jsUndefined();
-
- vPC += OPCODE_LENGTH(op_enter);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_enter_with_activation) {
- /* enter_with_activation dst(r)
-
- Initializes local variables to undefined, fills constant
- registers with their values, creates an activation object,
- and places the new activation both in dst and at the top
- of the scope chain. If the code block does not require an
- activation, enter should be used instead.
-
- This opcode should only be used at the beginning of a code
- block.
- */
-
- size_t i = 0;
- CodeBlock* codeBlock = callFrame->codeBlock();
-
- for (size_t count = codeBlock->m_numVars; i < count; ++i)
- callFrame->r(i) = jsUndefined();
-
- int dst = vPC[1].u.operand;
- JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable()));
- callFrame->r(dst) = JSValue(activation);
- callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
-
- vPC += OPCODE_LENGTH(op_enter_with_activation);
- 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->r(thisRegister) = JSValue(thisVal.toThisObject(callFrame));
-
- vPC += OPCODE_LENGTH(op_convert_this);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_init_arguments) {
- /* create_arguments
-
- Initialises the arguments object reference to null to ensure
- we can correctly detect that we need to create it later (or
- avoid creating it altogether).
-
- This opcode should only be used at the beginning of a code
- block.
- */
- callFrame->r(RegisterFile::ArgumentsRegister) = JSValue();
- vPC += OPCODE_LENGTH(op_init_arguments);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_create_arguments) {
- /* create_arguments
-
- 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.
- */
-
- if (!callFrame->r(RegisterFile::ArgumentsRegister).jsValue()) {
- Arguments* arguments = new (globalData) Arguments(callFrame);
- callFrame->setCalleeArguments(arguments);
- callFrame->r(RegisterFile::ArgumentsRegister) = JSValue(arguments);
- }
- vPC += OPCODE_LENGTH(op_create_arguments);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_construct) {
- /* construct dst(r) 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 dst = vPC[1].u.operand;
- int func = vPC[2].u.operand;
- int argCount = vPC[3].u.operand;
- int registerOffset = vPC[4].u.operand;
- int proto = vPC[5].u.operand;
- int thisRegister = vPC[6].u.operand;
-
- JSValue v = callFrame->r(func).jsValue();
-
- ConstructData constructData;
- ConstructType constructType = v.getConstructData(constructData);
-
- if (constructType == ConstructTypeJS) {
- ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
- CodeBlock* newCodeBlock = &constructData.js.functionExecutable->bytecode(callFrame, callDataScopeChain);
-
- Structure* structure;
- JSValue prototype = callFrame->r(proto).jsValue();
- if (prototype.isObject())
- structure = asObject(prototype)->inheritorID();
- else
- structure = callDataScopeChain->globalObject->emptyObjectStructure();
- JSObject* newObject = new (globalData) JSObject(structure);
-
- callFrame->r(thisRegister) = JSValue(newObject); // "this" value
-
- CallFrame* previousCallFrame = callFrame;
-
- callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
- if (UNLIKELY(!callFrame)) {
- callFrame = previousCallFrame;
- exceptionValue = createStackOverflowError(callFrame);
- goto vm_throw;
- }
-
- callFrame->init(newCodeBlock, vPC + 7, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
- vPC = newCodeBlock->instructions().begin();
-
-#if ENABLE(OPCODE_STATS)
- OpcodeStats::resetLastInstruction();
-#endif
-
- NEXT_INSTRUCTION();
- }
-
- if (constructType == ConstructTypeHost) {
- ArgList args(callFrame->registers() + thisRegister + 1, argCount - 1);
-
- ScopeChainNode* scopeChain = callFrame->scopeChain();
- CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, 0);
-
- JSValue returnValue;
- {
- SamplingTool::HostCallRecord callRecord(m_sampler.get());
- returnValue = constructData.native.function(newCallFrame, asObject(v), args);
- }
- CHECK_FOR_EXCEPTION();
- callFrame->r(dst) = JSValue(returnValue);
-
- vPC += OPCODE_LENGTH(op_construct);
- NEXT_INSTRUCTION();
- }
-
- ASSERT(constructType == ConstructTypeNone);
-
- exceptionValue = createNotAConstructorError(callFrame, v, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock());
- goto vm_throw;
- }
- DEFINE_OPCODE(op_construct_verify) {
- /* construct_verify dst(r) override(r)
-
- Verifies that register dst holds an object. If not, moves
- the object in register override to register dst.
- */
-
- int dst = vPC[1].u.operand;
- if (LIKELY(callFrame->r(dst).jsValue().isObject())) {
- vPC += OPCODE_LENGTH(op_construct_verify);
- NEXT_INSTRUCTION();
- }
-
- int override = vPC[2].u.operand;
- callFrame->r(dst) = callFrame->r(override);
-
- vPC += OPCODE_LENGTH(op_construct_verify);
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_strcat) {
- int dst = vPC[1].u.operand;
- int src = vPC[2].u.operand;
- int count = vPC[3].u.operand;
-
- callFrame->r(dst) = jsString(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->r(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->r(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->r(dst) = jsPropertyNameIterator;
- callFrame->r(base) = JSValue(o);
- callFrame->r(i) = Register::withInt(0);
- callFrame->r(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());
- callFrame->r(i) = Register::withInt(callFrame->r(i).i() + 1);
- if (key) {
- CHECK_FOR_TIMEOUT();
- callFrame->r(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 HAVE(COMPUTED_GOTO)
- // 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 HAVE(COMPUTED_GOTO)
- 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->r(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 - callFrame->codeBlock()->instructions().begin(), true);
- if (!handler) {
- *exception = exceptionValue;
- return jsNull();
- }
-
- vPC = callFrame->codeBlock()->instructions().begin() + handler->target;
- NEXT_INSTRUCTION();
- }
- DEFINE_OPCODE(op_new_error) {
- /* new_error dst(r) type(n) message(k)
-
- Constructs a new Error instance using the original
- constructor, using immediate number n as the type and
- constant message as the message string. The result is
- written to register dst.
- */
- int dst = vPC[1].u.operand;
- int type = vPC[2].u.operand;
- int message = vPC[3].u.operand;
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()));
-
- vPC += OPCODE_LENGTH(op_new_error);
- NEXT_INSTRUCTION();
- }
- 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 (callFrame->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 = callFrame->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 = callFrame->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 - callFrame->codeBlock()->instructions().begin(), false);
- if (!handler) {
- *exception = exceptionValue;
- return jsNull();
- }
-
- vPC = callFrame->codeBlock()->instructions().begin() + handler->target;
- NEXT_INSTRUCTION();
- }
- }
-#if !HAVE(COMPUTED_GOTO)
- } // iterator loop ends
-#endif
-#endif // USE(INTERPRETER)
- #undef NEXT_INSTRUCTION
- #undef DEFINE_OPCODE
- #undef CHECK_FOR_EXCEPTION
- #undef CHECK_FOR_TIMEOUT
-}
-
-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);
- SymbolTable& symbolTable = *codeBlock->symbolTable();
- int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex();
- if (!functionCallFrame->r(argumentsIndex).jsValue()) {
- Arguments* arguments = new (callFrame) Arguments(functionCallFrame);
- functionCallFrame->setCalleeArguments(arguments);
- functionCallFrame->r(RegisterFile::ArgumentsRegister) = JSValue(arguments);
- }
- return functionCallFrame->r(argumentsIndex).jsValue();
- }
-
- Arguments* arguments = functionCallFrame->optionalCalleeArguments();
- if (!arguments) {
- arguments = new (functionCallFrame) Arguments(functionCallFrame);
- arguments->copyRegisters();
- callFrame->setCalleeArguments(arguments);
- }
-
- return arguments;
-}
-
-JSValue Interpreter::retrieveCaller(CallFrame* callFrame, InternalFunction* 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 = bytecodeOffsetForPC(callerFrame, callerCodeBlock, callFrame->returnPC());
- lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1);
- sourceID = callerCodeBlock->ownerExecutable()->sourceID();
- sourceURL = callerCodeBlock->ownerExecutable()->sourceURL();
- function = callerFrame->callee();
-}
-
-CallFrame* Interpreter::findFunctionCallFrame(CallFrame* callFrame, InternalFunction* 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/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
deleted file mode 100644
index e17b055..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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 InternalFunction;
- 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 { MaxMainThreadReentryDepth = 256, MaxSecondaryThreadReentryDepth = 32 };
-
- class Interpreter : public FastAllocBase {
- friend class JIT;
- friend class CachedCall;
- public:
- Interpreter();
-
- RegisterFile& registerFile() { return m_registerFile; }
-
- Opcode getOpcode(OpcodeID id)
- {
- #if HAVE(COMPUTED_GOTO)
- return m_opcodeTable[id];
- #else
- return id;
- #endif
- }
-
- OpcodeID getOpcodeID(Opcode opcode)
- {
- #if HAVE(COMPUTED_GOTO)
- ASSERT(isOpcode(opcode));
- return m_opcodeIDTable.get(opcode);
- #else
- return opcode;
- #endif
- }
-
- bool isOpcode(Opcode);
-
- JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception);
- JSValue execute(FunctionExecutable*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue* exception);
- JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception);
-
- JSValue retrieveArguments(CallFrame*, JSFunction*) const;
- JSValue retrieveCaller(CallFrame*, InternalFunction*) 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, JSValue& exceptionValue);
- NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset, bool);
- 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*, JSValue* exception);
- void endRepeatCall(CallFrameClosure&);
- JSValue execute(CallFrameClosure&, JSValue* exception);
-
- JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
-
-#if USE(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 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
-
- 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*, InternalFunction*);
-
- JSValue privateExecute(ExecutionFlag, RegisterFile*, CallFrame*, JSValue* exception);
-
- 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 HAVE(COMPUTED_GOTO)
- 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/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
deleted file mode 100644
index ecd7403..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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 Arguments;
- class CodeBlock;
- class ExecState;
- class JSActivation;
- class JSFunction;
- 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=(JSFunction*);
- Register& operator=(JSPropertyNameIterator*);
- Register& operator=(ScopeChainNode*);
- Register& operator=(Instruction*);
-
- int32_t i() const;
- JSActivation* activation() const;
- Arguments* arguments() const;
- CallFrame* callFrame() const;
- CodeBlock* codeBlock() const;
- JSFunction* 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;
- }
-
- private:
- union {
- int32_t i;
- EncodedJSValue value;
-
- JSActivation* activation;
- CallFrame* callFrame;
- CodeBlock* codeBlock;
- JSFunction* 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=(JSFunction* function)
- {
- u.function = function;
- 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 JSFunction* 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/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp
deleted file mode 100644
index 4a33c62..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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"
-
-namespace JSC {
-
-RegisterFile::~RegisterFile()
-{
-#if HAVE(MMAP)
- munmap(m_buffer, ((m_max - m_start) + m_maxGlobals) * sizeof(Register));
-#elif HAVE(VIRTUALALLOC)
-#if OS(WINCE)
- VirtualFree(m_buffer, DWORD(m_commitEnd) - DWORD(m_buffer), MEM_DECOMMIT);
-#endif
- VirtualFree(m_buffer, 0, MEM_RELEASE);
-#elif OS(SYMBIAN)
- delete m_registerFileAllocator;
-#else
- fastFree(m_buffer);
-#endif
-}
-
-void RegisterFile::releaseExcessCapacity()
-{
-#if HAVE(MMAP) && HAVE(MADV_FREE) && !HAVE(VIRTUALALLOC)
- while (madvise(m_start, (m_max - m_start) * sizeof(Register), MADV_FREE) == -1 && errno == EAGAIN) { }
-#elif HAVE(VIRTUALALLOC)
- VirtualFree(m_start, (m_max - m_start) * sizeof(Register), MEM_DECOMMIT);
- m_commitEnd = m_start;
-#endif
- m_maxUsed = m_start;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h
deleted file mode 100644
index 80cf991..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * 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 <stdio.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/VMTags.h>
-
-#if HAVE(MMAP)
-#include <errno.h>
-#include <sys/mman.h>
-#endif
-
-#if OS(SYMBIAN)
-#include <wtf/symbian/RegisterFileAllocatorSymbian.h>
-#endif
-
-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 = 8,
-
- CodeBlock = -8,
- ScopeChain = -7,
- CallerFrame = -6,
- ReturnPC = -5, // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
- ReturnValueRegister = -4,
- ArgumentCount = -3,
- Callee = -2,
- OptionalCalleeArguments = -1,
- };
-
- enum { ProgramCodeThisRegister = -CallFrameHeaderSize - 1 };
- enum { ArgumentsRegister = 0 };
-
- static const size_t defaultCapacity = 524288;
- static const size_t defaultMaxGlobals = 8192;
- static const size_t commitSize = 1 << 14;
- // 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* globalObject) { m_globalObject = globalObject; }
- JSGlobalObject* globalObject() { return m_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); }
-
- private:
- void releaseExcessCapacity();
- size_t m_numGlobals;
- const size_t m_maxGlobals;
- Register* m_start;
- Register* m_end;
- Register* m_max;
- Register* m_buffer;
- Register* m_maxUsed;
-
-#if HAVE(VIRTUALALLOC)
- Register* m_commitEnd;
-#endif
-#if OS(SYMBIAN)
- // Commits and frees a continguous chunk of memory as required
- WTF::RegisterFileAllocator* m_registerFileAllocator;
-#endif
-
- JSGlobalObject* m_globalObject; // The global object whose vars are currently stored in the register file.
- };
-
- // FIXME: Add a generic getpagesize() to WTF, then move this function to WTF as well.
- // This is still a hack that should be fixed later. We know that a Symbian page size is 4K.
- #if OS(SYMBIAN)
- inline bool isPageAligned(size_t size) { return size && !(size % (4 * 1024)); }
- #else
- inline bool isPageAligned(size_t size) { return size && !(size % (8 * 1024)); }
- #endif
-
- inline RegisterFile::RegisterFile(size_t capacity, size_t maxGlobals)
- : m_numGlobals(0)
- , m_maxGlobals(maxGlobals)
- , m_start(0)
- , m_end(0)
- , m_max(0)
- , m_buffer(0)
- , m_globalObject(0)
- {
- // Verify that our values will play nice with mmap and VirtualAlloc.
- ASSERT(isPageAligned(maxGlobals));
- ASSERT(isPageAligned(capacity));
-
- size_t bufferLength = (capacity + maxGlobals) * sizeof(Register);
- #if HAVE(MMAP)
- m_buffer = static_cast<Register*>(mmap(0, bufferLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, VM_TAG_FOR_REGISTERFILE_MEMORY, 0));
- if (m_buffer == MAP_FAILED) {
-#if OS(WINCE)
- fprintf(stderr, "Could not allocate register file: %d\n", GetLastError());
-#else
- fprintf(stderr, "Could not allocate register file: %d\n", errno);
-#endif
- CRASH();
- }
- #elif HAVE(VIRTUALALLOC)
- m_buffer = static_cast<Register*>(VirtualAlloc(0, roundUpAllocationSize(bufferLength, commitSize), MEM_RESERVE, PAGE_READWRITE));
- if (!m_buffer) {
-#if OS(WINCE)
- fprintf(stderr, "Could not allocate register file: %d\n", GetLastError());
-#else
- fprintf(stderr, "Could not allocate register file: %d\n", errno);
-#endif
- CRASH();
- }
- size_t committedSize = roundUpAllocationSize(maxGlobals * sizeof(Register), commitSize);
- void* commitCheck = VirtualAlloc(m_buffer, committedSize, MEM_COMMIT, PAGE_READWRITE);
- if (commitCheck != m_buffer) {
-#if OS(WINCE)
- fprintf(stderr, "Could not allocate register file: %d\n", GetLastError());
-#else
- fprintf(stderr, "Could not allocate register file: %d\n", errno);
-#endif
- CRASH();
- }
- m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_buffer) + committedSize);
- #elif OS(SYMBIAN)
- m_registerFileAllocator = new WTF::RegisterFileAllocator(bufferLength);
- m_buffer = (Register*)(m_registerFileAllocator->buffer());
- // start by committing enough space to hold maxGlobals
- void* newEnd = (void*)((int)m_buffer + (maxGlobals * sizeof(Register)));
- m_registerFileAllocator->grow(newEnd);
- #else
- /*
- * If neither MMAP nor VIRTUALALLOC are available - use fastMalloc instead.
- *
- * Please note that this is the fallback case, which is non-optimal.
- * If any possible, the platform should provide for a better memory
- * allocation mechanism that allows for "lazy commit" or dynamic
- * pre-allocation, similar to mmap or VirtualAlloc, to avoid waste of memory.
- */
- m_buffer = static_cast<Register*>(fastMalloc(bufferLength));
- #endif
- m_start = m_buffer + 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) {
-#if OS(SYMBIAN)
- m_registerFileAllocator->shrink(newEnd);
-#endif
-
- releaseExcessCapacity();
- }
- }
-
- inline bool RegisterFile::grow(Register* newEnd)
- {
- if (newEnd < m_end)
- return true;
-
- if (newEnd > m_max)
- return false;
-
-#if !HAVE(MMAP) && HAVE(VIRTUALALLOC)
- if (newEnd > m_commitEnd) {
- size_t size = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize);
- if (!VirtualAlloc(m_commitEnd, size, MEM_COMMIT, PAGE_READWRITE)) {
-#if OS(WINCE)
- fprintf(stderr, "Could not allocate register file: %d\n", GetLastError());
-#else
- fprintf(stderr, "Could not allocate register file: %d\n", errno);
-#endif
- CRASH();
- }
- m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_commitEnd) + size);
- }
-#endif
-#if OS(SYMBIAN)
- m_registerFileAllocator->grow((void*)newEnd);
-#endif
-
- if (newEnd > m_maxUsed)
- m_maxUsed = newEnd;
-
- m_end = newEnd;
- return true;
- }
-
-} // namespace JSC
-
-#endif // RegisterFile_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.cpp
deleted file mode 100644
index f6b27ec..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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;
-
-}
-
-#endif // HAVE(ASSEMBLER)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h
deleted file mode 100644
index 8f46dee..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * 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/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/UnusedParam.h>
-#include <wtf/Vector.h>
-
-#if OS(IPHONE_OS)
-#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
-
-#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 INITIAL_PROTECTION_FLAGS PROTECTION_FLAGS_RX
-#else
-#define INITIAL_PROTECTION_FLAGS (PROT_READ | PROT_WRITE | PROT_EXEC)
-#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(ASSEMBLER)
-
-namespace JSC {
-
-class ExecutablePool : public RefCounted<ExecutablePool> {
-private:
- struct Allocation {
- char* pages;
- size_t size;
-#if OS(SYMBIAN)
- RChunk* chunk;
-#endif
- };
- typedef Vector<Allocation, 2> AllocationList;
-
-public:
- 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);
- }
-
- ~ExecutablePool()
- {
- AllocationList::const_iterator end = m_pools.end();
- for (AllocationList::const_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(const 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();
- m_smallAllocationPool = ExecutablePool::create(JIT_ALLOCATOR_LARGE_ALLOC_SIZE);
- }
-
- PassRefPtr<ExecutablePool> poolForSize(size_t n)
- {
- // Try to fit in the existing small allocator
- 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 >= 40300)
-#if WTF_MIPS_ISA_REV(2) && (GCC_VERSION < 40403)
- 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(IPHONE_OS)
- static void cacheFlush(void* code, size_t size)
- {
- sys_dcache_flush(code, size);
- sys_icache_invalidate(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)
- 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);
- }
-#else
- #error "The cacheFlush support is missing on this platform."
-#endif
-
-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 = mem.pages;
- 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.pages)
- 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 = result.pages + n;
- m_end = result.pages + allocSize;
- }
-
- m_pools.append(result);
- return result.pages;
-}
-
-}
-
-#endif // ENABLE(ASSEMBLER)
-
-#endif // !defined(ExecutableAllocator)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
deleted file mode 100644
index 4d3c847..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * 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(ASSEMBLER) && OS(DARWIN) && CPU(X86_64)
-
-#include <errno.h>
-
-#include "TCSpinLock.h"
-#include <mach/mach_init.h>
-#include <mach/vm_map.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <wtf/AVLTree.h>
-#include <wtf/VMTags.h>
-
-using namespace WTF;
-
-namespace JSC {
-
-#define TWO_GB (2u * 1024u * 1024u * 1024u)
-#define SIXTEEN_MB (16u * 1024u * 1024u)
-
-// 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;
-
- // Use madvise as apropriate to prevent freed pages from being spilled,
- // and to attempt to ensure that used memory is reported correctly.
-#if HAVE(MADV_FREE_REUSE)
- void release(void* position, size_t size)
- {
- while (madvise(position, size, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
- }
-
- void reuse(void* position, size_t size)
- {
- while (madvise(position, size, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
- }
-#elif HAVE(MADV_DONTNEED)
- void release(void* position, size_t size)
- {
- while (madvise(position, size, MADV_DONTNEED) == -1 && errno == EAGAIN) { }
- }
-
- void reuse(void*, size_t) {}
-#else
- void release(void*, size_t) {}
- void reuse(void*, size_t) {}
-#endif
-
- // All addition to the free list should go through this method, rather than
- // calling insert directly, to avoid multiple entries beging 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 neigboring
- // 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 couse 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_totalHeapSize(totalHeapSize)
- {
- // 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 usespace (in the address range
- // 0x200000000000 .. 0x5fffffffffff).
- intptr_t randomLocation = arc4random() & ((1 << 25) - 1);
- randomLocation += (1 << 24);
- randomLocation <<= 21;
- m_base = mmap(reinterpret_cast<void*>(randomLocation), m_totalHeapSize, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
- if (!m_base)
- CRASH();
-
- // For simplicity, we keep all memory in m_freeList in a 'released' state.
- // This means that we can simply reuse all memory when allocating, without
- // worrying about it's previous state, and also makes coalescing m_freeList
- // simpler since we need not worry about the possibility of coalescing released
- // chunks with non-released ones.
- release(m_base, m_totalHeapSize);
- m_freeList.insert(new FreeListEntry(m_base, m_totalHeapSize));
- }
-
- void* alloc(size_t size)
- {
- 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 {
- // Serach 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 desparation 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;
- }
-
- void free(void* pointer, size_t size)
- {
- // 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 >= SIXTEEN_MB) {
- m_countFreedSinceLastCoalesce = 0;
- coalesceFreeSpace();
- }
- }
-
-private:
-
-#ifndef NDEBUG
- bool isWithinVMPool(void* pointer, size_t size)
- {
- return pointer >= m_base && (reinterpret_cast<char*>(pointer) + size <= reinterpret_cast<char*>(m_base) + m_totalHeapSize);
- }
-#endif
-
- // 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;
-
- void* m_base;
- size_t m_totalHeapSize;
-};
-
-void ExecutableAllocator::intializePageSize()
-{
- ExecutableAllocator::pageSize = getpagesize();
-}
-
-static FixedVMPoolAllocator* allocator = 0;
-static SpinLock spinlock = SPINLOCK_INITIALIZER;
-
-ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t size)
-{
- SpinLockHolder lock_holder(&spinlock);
-
- if (!allocator)
- allocator = new FixedVMPoolAllocator(JIT_ALLOCATOR_LARGE_ALLOC_SIZE, TWO_GB);
- ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(allocator->alloc(size)), size};
- return alloc;
-}
-
-void ExecutablePool::systemRelease(const ExecutablePool::Allocation& allocation)
-{
- SpinLockHolder lock_holder(&spinlock);
-
- ASSERT(allocator);
- allocator->free(allocation.pages, allocation.size);
-}
-
-}
-
-#endif // HAVE(ASSEMBLER)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
deleted file mode 100644
index 06375ad..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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) && OS(UNIX) && !OS(SYMBIAN)
-
-#include <sys/mman.h>
-#include <unistd.h>
-#include <wtf/VMTags.h>
-
-namespace JSC {
-
-#if !(OS(DARWIN) && CPU(X86_64))
-
-void ExecutableAllocator::intializePageSize()
-{
- ExecutableAllocator::pageSize = getpagesize();
-}
-
-ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
-{
- void* allocation = mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
- if (allocation == MAP_FAILED)
- CRASH();
- ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(allocation), n };
- return alloc;
-}
-
-void ExecutablePool::systemRelease(const ExecutablePool::Allocation& alloc)
-{
- int result = munmap(alloc.pages, alloc.size);
- ASSERT_UNUSED(result, !result);
-}
-
-#endif // !(OS(DARWIN) && CPU(X86_64))
-
-#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
-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
-
-}
-
-#endif // HAVE(ASSEMBLER)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorSymbian.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorSymbian.cpp
deleted file mode 100644
index e82975c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorSymbian.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 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 "ExecutableAllocator.h"
-
-#if ENABLE(ASSEMBLER) && OS(SYMBIAN)
-
-#include <e32hal.h>
-#include <e32std.h>
-
-// Set the page size to 256 Kb to compensate for moving memory model limitation
-const size_t MOVING_MEM_PAGE_SIZE = 256 * 1024;
-
-namespace JSC {
-
-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 less of larger chunks.
- ExecutableAllocator::pageSize = MOVING_MEM_PAGE_SIZE;
-#else
- TInt page_size;
- UserHal::PageSizeInBytes(page_size);
- ExecutableAllocator::pageSize = page_size;
-#endif
-}
-
-ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
-{
- RChunk* codeChunk = new RChunk();
-
- TInt errorCode = codeChunk->CreateLocalCode(n, n);
-
- char* allocation = reinterpret_cast<char*>(codeChunk->Base());
- if (!allocation)
- CRASH();
- ExecutablePool::Allocation alloc = { allocation, n, codeChunk };
- return alloc;
-}
-
-void ExecutablePool::systemRelease(const ExecutablePool::Allocation& alloc)
-{
- alloc.chunk->Close();
- delete alloc.chunk;
-}
-
-#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
-#error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform."
-#endif
-
-}
-
-#endif // HAVE(ASSEMBLER)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorWin.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorWin.cpp
deleted file mode 100644
index e38323c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorWin.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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) && OS(WINDOWS)
-
-#include "windows.h"
-
-namespace JSC {
-
-void ExecutableAllocator::intializePageSize()
-{
- SYSTEM_INFO system_info;
- GetSystemInfo(&system_info);
- ExecutableAllocator::pageSize = system_info.dwPageSize;
-}
-
-ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
-{
- void* allocation = VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
- if (!allocation)
- CRASH();
- ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(allocation), n};
- return alloc;
-}
-
-void ExecutablePool::systemRelease(const ExecutablePool::Allocation& alloc)
-{
- VirtualFree(alloc.pages, 0, MEM_RELEASE);
-}
-
-#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
-#error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform."
-#endif
-
-}
-
-#endif // HAVE(ASSEMBLER)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp
deleted file mode 100644
index b414101..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
- * 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 "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
-
-#if ENABLE(JIT)
-
-#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)
- : 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_bytecodeIndex((unsigned)-1)
-#if USE(JSVALUE32_64)
- , m_jumpTargetIndex(0)
- , m_mappedBytecodeIndex((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
-{
-}
-
-#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_bytecodeIndex += 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_bytecodeIndex = 0; m_bytecodeIndex < instructionCount; ) {
- Instruction* currentInstruction = instructionsBegin + m_bytecodeIndex;
- ASSERT_WITH_MESSAGE(m_interpreter->isOpcode(currentInstruction->u.opcode), "privateCompileMainPass gone bad @ %d", m_bytecodeIndex);
-
-#if ENABLE(OPCODE_SAMPLING)
- if (m_bytecodeIndex > 0) // Avoid the overhead of sampling op_enter twice.
- sampleInstruction(currentInstruction);
-#endif
-
-#if !USE(JSVALUE32_64)
- if (m_labels[m_bytecodeIndex].isUsed())
- killLastResultRegister();
-#endif
-
- m_labels[m_bytecodeIndex] = label();
-
- switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) {
- DEFINE_BINARY_OP(op_del_by_val)
-#if USE(JSVALUE32)
- DEFINE_BINARY_OP(op_div)
-#endif
- DEFINE_BINARY_OP(op_in)
- DEFINE_BINARY_OP(op_less)
- DEFINE_BINARY_OP(op_lesseq)
- DEFINE_BINARY_OP(op_urshift)
- 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(JSVALUE32_64)
- 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_construct_verify)
- DEFINE_OP(op_convert_this)
- DEFINE_OP(op_init_arguments)
- DEFINE_OP(op_create_arguments)
- DEFINE_OP(op_debug)
- DEFINE_OP(op_del_by_id)
-#if !USE(JSVALUE32)
- DEFINE_OP(op_div)
-#endif
- DEFINE_OP(op_end)
- DEFINE_OP(op_enter)
- DEFINE_OP(op_enter_with_activation)
- DEFINE_OP(op_eq)
- DEFINE_OP(op_eq_null)
- DEFINE_OP(op_get_by_id)
- DEFINE_OP(op_get_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_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_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_error)
- 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_resolve_global)
- DEFINE_OP(op_resolve_skip)
- DEFINE_OP(op_resolve_with_base)
- DEFINE_OP(op_ret)
- DEFINE_OP(op_rshift)
- 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_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_bytecodeIndex = (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].toBytecodeIndex], this);
- m_jmpTable.clear();
-}
-
-void JIT::privateCompileSlowCases()
-{
- Instruction* instructionsBegin = m_codeBlock->instructions().begin();
-
- m_propertyAccessInstructionIndex = 0;
-#if USE(JSVALUE32_64)
- m_globalResolveInfoIndex = 0;
-#endif
- m_callLinkInfoIndex = 0;
-
- for (Vector<SlowCaseEntry>::iterator iter = m_slowCases.begin(); iter != m_slowCases.end();) {
-#if !USE(JSVALUE32_64)
- killLastResultRegister();
-#endif
-
- m_bytecodeIndex = iter->to;
-#ifndef NDEBUG
- unsigned firstTo = m_bytecodeIndex;
-#endif
- Instruction* currentInstruction = instructionsBegin + m_bytecodeIndex;
-
- 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_construct_verify)
- DEFINE_SLOWCASE_OP(op_convert_this)
-#if !USE(JSVALUE32)
- DEFINE_SLOWCASE_OP(op_div)
-#endif
- DEFINE_SLOWCASE_OP(op_eq)
- DEFINE_SLOWCASE_OP(op_get_by_id)
- DEFINE_SLOWCASE_OP(op_get_by_val)
- DEFINE_SLOWCASE_OP(op_get_by_pname)
- DEFINE_SLOWCASE_OP(op_instanceof)
- DEFINE_SLOWCASE_OP(op_jfalse)
- DEFINE_SLOWCASE_OP(op_jnless)
- DEFINE_SLOWCASE_OP(op_jless)
- DEFINE_SLOWCASE_OP(op_jnlesseq)
- DEFINE_SLOWCASE_OP(op_jtrue)
- 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)
-#if USE(JSVALUE32_64)
- DEFINE_SLOWCASE_OP(op_resolve_global)
-#endif
- DEFINE_SLOWCASE_OP(op_rshift)
- 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_bytecodeIndex = (unsigned)-1;
-#endif
-}
-
-JITCode JIT::privateCompile()
-{
- sampleCodeBlock(m_codeBlock);
-#if ENABLE(OPCODE_SAMPLING)
- sampleInstruction(m_codeBlock->instructions().begin());
-#endif
-
- // Could use a pop_m, but would need to offset the following instruction if so.
- preserveReturnAddressAfterCall(regT2);
- emitPutToCallFrameHeader(regT2, RegisterFile::ReturnPC);
-
- Jump slowRegisterFileCheck;
- Label afterRegisterFileCheck;
- 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);
-
- peek(regT0, OBJECT_OFFSETOF(JITStackFrame, registerFile) / sizeof (void*));
- addPtr(Imm32(m_codeBlock->m_numCalleeRegisters * sizeof(Register)), callFrameRegister, regT1);
-
- slowRegisterFileCheck = branchPtr(Above, regT1, Address(regT0, OBJECT_OFFSETOF(RegisterFile, m_end)));
- afterRegisterFileCheck = label();
- }
-
- privateCompileMainPass();
- privateCompileLinkPass();
- privateCompileSlowCases();
-
- if (m_codeBlock->codeType() == FunctionCode) {
- slowRegisterFileCheck.link(this);
- m_bytecodeIndex = 0;
- JITStubCall(this, cti_register_file_check).call();
-#ifndef NDEBUG
- m_bytecodeIndex = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs.
-#endif
- jump(afterRegisterFileCheck);
- }
-
- ASSERT(m_jmpTable.isEmpty());
-
- LinkBuffer patchBuffer(this, m_globalData->executableAllocator.poolForSize(m_assembler.size()));
-
- // 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 bytecodeIndex = record.bytecodeIndex;
-
- 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[bytecodeIndex + 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[bytecodeIndex + offset]) : record.jumpTable.simpleJumpTable->ctiDefault;
- }
- } else {
- ASSERT(record.type == SwitchRecord::String);
-
- record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeIndex + 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[bytecodeIndex + 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->hasExceptionInfo()) {
- m_codeBlock->callReturnIndexVector().reserveCapacity(m_calls.size());
- for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter)
- m_codeBlock->callReturnIndexVector().append(CallReturnOffsetToBytecodeIndex(patchBuffer.returnAddressOffset(iter->from), iter->bytecodeIndex));
- }
-
- // 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;
- }
-
- return patchBuffer.finalizeCode();
-}
-
-#if !USE(JSVALUE32_64)
-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::unlinkCall(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, JITCode& 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.addressForCall());
- }
-
- // patch the call so we do not continue to try to link.
- repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs.ctiVirtualCall());
-}
-#endif // ENABLE(JIT_OPTIMIZE_CALL)
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h
deleted file mode 100644
index a8f725d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h
+++ /dev/null
@@ -1,1002 +0,0 @@
-/*
- * 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 "JITCode.h"
-#include "JITStubs.h"
-#include "Opcode.h"
-#include "RegisterFile.h"
-#include "MacroAssembler.h"
-#include "Profiler.h"
-#include <bytecode/SamplingTool.h>
-#include <wtf/AlwaysInline.h>
-#include <wtf/Vector.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 bytecodeIndex;
- void* to;
-
- CallRecord()
- {
- }
-
- CallRecord(MacroAssembler::Call from, unsigned bytecodeIndex, void* to = 0)
- : from(from)
- , bytecodeIndex(bytecodeIndex)
- , to(to)
- {
- }
- };
-
- struct JumpTable {
- MacroAssembler::Jump from;
- unsigned toBytecodeIndex;
-
- JumpTable(MacroAssembler::Jump f, unsigned t)
- : from(f)
- , toBytecodeIndex(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 bytecodeIndex;
- unsigned defaultOffset;
-
- SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeIndex, unsigned defaultOffset, Type type)
- : type(type)
- , bytecodeIndex(bytecodeIndex)
- , defaultOffset(defaultOffset)
- {
- this->jumpTable.simpleJumpTable = jumpTable;
- }
-
- SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeIndex, unsigned defaultOffset)
- : type(String)
- , bytecodeIndex(bytecodeIndex)
- , 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 MacroAssembler {
- friend class JITStubCall;
-
- using MacroAssembler::Jump;
- using MacroAssembler::JumpList;
- using MacroAssembler::Label;
-
- // 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;
-#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;
-#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;
-#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;
-#else
- #error "JIT not supported on this platform."
-#endif
-
- 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)
- {
- return JIT(globalData, codeBlock).privateCompile();
- }
-
- 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)
- {
- JIT jit(globalData, codeBlock);
- jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress);
- }
-
- static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, TrampolineStructure *trampolines)
- {
- JIT jit(globalData);
- jit.privateCompileCTIMachineTrampolines(executablePool, globalData, trampolines);
- }
-
- static void patchGetByIdSelf(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
- static void patchPutByIdReplace(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
- 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, JITCode&, CallLinkInfo*, int callerArgCount, JSGlobalData*);
- static void unlinkCall(CallLinkInfo*);
-
- private:
- struct JSRInfo {
- DataLabelPtr storeLocation;
- Label target;
-
- JSRInfo(DataLabelPtr storeLocation, Label targetLocation)
- : storeLocation(storeLocation)
- , target(targetLocation)
- {
- }
- };
-
- JIT(JSGlobalData*, CodeBlock* = 0);
-
- void privateCompileMainPass();
- void privateCompileLinkPass();
- void privateCompileSlowCases();
- JITCode privateCompile();
- 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);
-
- void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, TrampolineStructure *trampolines);
- 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 compileOpCallSetupArgs(Instruction*);
- void compileOpCallVarargsSetupArgs(Instruction*);
- void compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID);
- void compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter);
- void compileOpConstructSetupArgs(Instruction*);
-
- 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);
-
- Address addressFor(unsigned index, RegisterID base = callFrameRegister);
-
- void testPrototype(Structure*, JumpList& failureCases);
-
-#if USE(JSVALUE32_64)
- Address tagFor(unsigned index, RegisterID base = callFrameRegister);
- Address payloadFor(unsigned index, RegisterID base = callFrameRegister);
-
- 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 bytecodeIndex);
- void map(unsigned bytecodeIndex, 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) && USE(JIT_STUB_ARGUMENT_VA_LIST)
- static const int patchOffsetGetByIdSlowCaseCall = 35;
-#elif ENABLE(OPCODE_SAMPLING)
- static const int patchOffsetGetByIdSlowCaseCall = 37;
-#elif USE(JIT_STUB_ARGUMENT_VA_LIST)
- static const int patchOffsetGetByIdSlowCaseCall = 25;
-#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 = 40;
- static const int sequenceGetByIdSlowCaseConstantSpace = 2;
- // sequencePutById
- static const int sequencePutByIdInstructionSpace = 36;
- static const int sequencePutByIdConstantSpace = 4;
-#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(JSVALUE64)
- JIT::Jump emitJumpIfImmediateNumber(RegisterID);
- JIT::Jump emitJumpIfNotImmediateNumber(RegisterID);
-#else
- 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(JSVALUE64)
- void emitFastArithDeTagImmediate(RegisterID);
- Jump emitFastArithDeTagImmediateJumpIfZero(RegisterID);
-#endif
- void emitFastArithReTagImmediate(RegisterID src, RegisterID dest);
- void emitFastArithImmToInt(RegisterID);
- 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) && USE(JIT_STUB_ARGUMENT_VA_LIST)
- static const int patchOffsetGetByIdSlowCaseCall = 31;
-#elif ENABLE(OPCODE_SAMPLING)
- static const int patchOffsetGetByIdSlowCaseCall = 33;
-#elif USE(JIT_STUB_ARGUMENT_VA_LIST)
- static const int patchOffsetGetByIdSlowCaseCall = 21;
-#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;
-#endif
-#endif // USE(JSVALUE32_64)
-
-#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
-#define BEGIN_UNINTERRUPTED_SEQUENCE(name) beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
-#define END_UNINTERRUPTED_SEQUENCE(name) endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
-
- void beginUninterruptedSequence(int, int);
- void endUninterruptedSequence(int, int);
-
-#else
-#define BEGIN_UNINTERRUPTED_SEQUENCE(name)
-#define END_UNINTERRUPTED_SEQUENCE(name)
-#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_catch(Instruction*);
- void emit_op_construct(Instruction*);
- void emit_op_construct_verify(Instruction*);
- void emit_op_convert_this(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_enter_with_activation(Instruction*);
- void emit_op_eq(Instruction*);
- void emit_op_eq_null(Instruction*);
- void emit_op_get_by_id(Instruction*);
- void emit_op_get_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_arguments(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_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_error(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_resolve_global(Instruction*);
- void emit_op_resolve_skip(Instruction*);
- void emit_op_resolve_with_base(Instruction*);
- void emit_op_ret(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_to_jsnumber(Instruction*);
- void emit_op_to_primitive(Instruction*);
- void emit_op_unexpected_load(Instruction*);
-#if ENABLE(JIT_OPTIMIZE_MOD)
- 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_construct_verify(Instruction*, Vector<SlowCaseEntry>::iterator&);
- void emitSlow_op_convert_this(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_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
- void emitSlow_op_get_by_pname(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_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
- void emitSlow_op_jtrue(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_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&);
-
- /* These functions are deprecated: Please use JITStubCall instead. */
- void emitPutJITStubArg(RegisterID src, unsigned argumentNumber);
-#if USE(JSVALUE32_64)
- void emitPutJITStubArg(RegisterID tag, RegisterID payload, unsigned argumentNumber);
- void emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch1, RegisterID scratch2);
-#else
- void emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch);
-#endif
- void emitPutJITStubArgConstant(unsigned value, unsigned argumentNumber);
- void emitPutJITStubArgConstant(void* value, unsigned argumentNumber);
- 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);
-
- 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);
-
- 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_bytecodeIndex;
- 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_mappedBytecodeIndex;
- 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
- } 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/src/3rdparty/webkit/JavaScriptCore/jit/JITArithmetic.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITArithmetic.cpp
deleted file mode 100644
index 2e1ff40..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITArithmetic.cpp
+++ /dev/null
@@ -1,2808 +0,0 @@
-/*
- * 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 "JIT.h"
-
-#if ENABLE(JIT)
-
-#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 {
-
-#if USE(JSVALUE32_64)
-
-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;
-
- // Int32 less.
- if (isOperandConstantImmediateInt(op1)) {
- 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 (!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;
-
- // Int32 less.
- 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 (!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_jnlesseq(Instruction* currentInstruction)
-{
- unsigned op1 = currentInstruction[1].u.operand;
- unsigned op2 = currentInstruction[2].u.operand;
- unsigned target = currentInstruction[3].u.operand;
-
- JumpList notInt32Op1;
- JumpList notInt32Op2;
-
- // Int32 less.
- if (isOperandConstantImmediateInt(op1)) {
- emitLoad(op2, regT3, regT2);
- notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
- addJump(branch32(LessThan, regT2, Imm32(getConstantOperand(op1).asInt32())), target);
- } else if (isOperandConstantImmediateInt(op2)) {
- emitLoad(op1, regT1, regT0);
- notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
- addJump(branch32(GreaterThan, 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(GreaterThan, regT0, regT2), target);
- }
-
- if (!supportsFloatingPoint()) {
- addSlowCase(notInt32Op1);
- addSlowCase(notInt32Op2);
- return;
- }
- Jump end = jump();
-
- // Double less.
- emitBinaryDoubleOp(op_jnlesseq, target, op1, op2, OperandTypes(), notInt32Op1, notInt32Op2, !isOperandConstantImmediateInt(op1), isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2));
- end.link(this);
-}
-
-void JIT::emitSlow_op_jnlesseq(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 (!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(Zero, regT0), target);
-}
-
-// 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 (>>)
-
-void JIT::emit_op_rshift(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)));
- rshift32(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)));
- rshift32(regT2, regT0);
- emitStoreInt32(dst, regT0, dst == op1 || dst == op2);
-}
-
-void JIT::emitSlow_op_rshift(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_rshift);
- stubCall.addArgument(op1);
- stubCall.addArgument(op2);
- stubCall.call(dst);
-}
-
-// 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_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;
- 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)
-
-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 (isOperandConstantImmediateInt(op2) && getConstantOperand(op2).asInt32() != 0) {
- emitLoad(op1, X86Registers::edx, X86Registers::eax);
- move(Imm32(getConstantOperand(op2).asInt32()), X86Registers::ecx);
- addSlowCase(branch32(NotEqual, X86Registers::edx, Imm32(JSValue::Int32Tag)));
- if (getConstantOperand(op2).asInt32() == -1)
- addSlowCase(branch32(Equal, X86Registers::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
- } else {
- emitLoad2(op1, X86Registers::edx, X86Registers::eax, op2, X86Registers::ebx, X86Registers::ecx);
- addSlowCase(branch32(NotEqual, X86Registers::edx, Imm32(JSValue::Int32Tag)));
- addSlowCase(branch32(NotEqual, X86Registers::ebx, Imm32(JSValue::Int32Tag)));
-
- addSlowCase(branch32(Equal, X86Registers::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
- addSlowCase(branch32(Equal, X86Registers::ecx, Imm32(0))); // divide by 0
- }
-
- move(X86Registers::eax, X86Registers::ebx); // Save dividend payload, in case of 0.
- m_assembler.cdq();
- m_assembler.idivl_r(X86Registers::ecx);
-
- // If the remainder is zero and the dividend is negative, the result is -0.
- Jump storeResult1 = branchTest32(NonZero, X86Registers::edx);
- Jump storeResult2 = branchTest32(Zero, X86Registers::ebx, Imm32(0x80000000)); // not negative
- emitStore(dst, jsNumber(m_globalData, -0.0));
- Jump end = jump();
-
- storeResult1.link(this);
- storeResult2.link(this);
- emitStoreInt32(dst, X86Registers::edx, (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)
-
-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_OPTIMIZE_MOD)
- 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)
-{
-#if ENABLE(JIT_OPTIMIZE_MOD)
- 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 ------------------------------ */
-
-#else // USE(JSVALUE32_64)
-
-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);
-#if USE(JSVALUE32)
- addSlowCase(branchAdd32(Overflow, regT0, regT0));
- signExtend32ToPtr(regT0, regT0);
-#endif
- 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;
-
-#if USE(JSVALUE64)
- UNUSED_PARAM(op1);
- UNUSED_PARAM(op2);
- linkSlowCase(iter);
- linkSlowCase(iter);
-#else
- // If we are limited to 32-bit immediates there is a third slow case, which required the operands to have been reloaded.
- Jump notImm1 = getSlowCase(iter);
- Jump notImm2 = getSlowCase(iter);
- linkSlowCase(iter);
- emitGetVirtualRegisters(op1, regT0, op2, regT2);
- notImm1.link(this);
- notImm2.link(this);
-#endif
- 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);
-#if USE(JSVALUE64)
- // supportsFloatingPoint() && USE(JSVALUE64) => 3 SlowCases
- addSlowCase(emitJumpIfNotImmediateNumber(regT0));
- addPtr(tagTypeNumberRegister, regT0);
- movePtrToDouble(regT0, fpRegT0);
- addSlowCase(branchTruncateDoubleToInt32(fpRegT0, regT0));
-#else
- // supportsFloatingPoint() && !USE(JSVALUE64) => 5 SlowCases (of which 1 IfNotJSCell)
- emitJumpSlowCaseIfNotJSCell(regT0, op1);
- addSlowCase(checkStructure(regT0, m_globalData->numberStructure.get()));
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- addSlowCase(branchTruncateDoubleToInt32(fpRegT0, regT0));
- addSlowCase(branchAdd32(Overflow, regT0, regT0));
-#endif
- lhsIsInt.link(this);
- emitJumpSlowCaseIfNotImmediateInteger(regT2);
- } else {
- // !supportsFloatingPoint() => 2 SlowCases
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT2);
- }
- emitFastArithImmToInt(regT2);
- rshift32(regT2, regT0);
-#if USE(JSVALUE32)
- signExtend32ToPtr(regT0, regT0);
-#endif
- }
-#if USE(JSVALUE64)
- emitFastArithIntToImmNoCheck(regT0, regT0);
-#else
- orPtr(Imm32(JSImmediate::TagTypeNumber), regT0);
-#endif
- 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()) {
-#if USE(JSVALUE64)
- linkSlowCase(iter);
- linkSlowCase(iter);
- linkSlowCase(iter);
-#else
- linkSlowCaseIfNotJSCell(iter, op1);
- linkSlowCase(iter);
- linkSlowCase(iter);
- linkSlowCase(iter);
- linkSlowCase(iter);
-#endif
- // 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_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 (isOperandConstantImmediateInt(op2)) {
- emitGetVirtualRegister(op1, regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
-#if USE(JSVALUE64)
- int32_t op2imm = getConstantOperandImmediateInt(op2);
-#else
- int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));
-#endif
- addJump(branch32(GreaterThanOrEqual, regT0, Imm32(op2imm)), target);
- } else if (isOperandConstantImmediateInt(op1)) {
- emitGetVirtualRegister(op2, regT1);
- emitJumpSlowCaseIfNotImmediateInteger(regT1);
-#if USE(JSVALUE64)
- int32_t op1imm = getConstantOperandImmediateInt(op1);
-#else
- int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)));
-#endif
- 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 (isOperandConstantImmediateInt(op2)) {
- linkSlowCase(iter);
-
- if (supportsFloatingPoint()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
- addPtr(tagTypeNumberRegister, regT0);
- movePtrToDouble(regT0, fpRegT0);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1 = emitJumpIfNotJSCell(regT0);
-
- Jump fail2 = checkStructure(regT0, m_globalData->numberStructure.get());
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
-#endif
-
- 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));
-
-#if USE(JSVALUE64)
- fail1.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1.link(this);
- fail2.link(this);
-#endif
- }
-
- 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()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT1);
- addPtr(tagTypeNumberRegister, regT1);
- movePtrToDouble(regT1, fpRegT1);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail1 = emitJumpIfNotJSCell(regT1);
-
- Jump fail2 = checkStructure(regT1, m_globalData->numberStructure.get());
- loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);
-#endif
-
- 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));
-
-#if USE(JSVALUE64)
- fail1.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail1.link(this);
- fail2.link(this);
-#endif
- }
-
- 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()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
- Jump fail2 = emitJumpIfNotImmediateNumber(regT1);
- Jump fail3 = emitJumpIfImmediateInteger(regT1);
- addPtr(tagTypeNumberRegister, regT0);
- addPtr(tagTypeNumberRegister, regT1);
- movePtrToDouble(regT0, fpRegT0);
- movePtrToDouble(regT1, fpRegT1);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1 = emitJumpIfNotJSCell(regT0);
-
- Jump fail2;
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail2 = emitJumpIfNotJSCell(regT1);
-
- Jump fail3 = checkStructure(regT0, m_globalData->numberStructure.get());
- Jump fail4 = checkStructure(regT1, m_globalData->numberStructure.get());
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);
-#endif
-
- emitJumpSlowToHot(branchDouble(DoubleLessThanOrEqualOrUnordered, fpRegT1, fpRegT0), target);
-
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
-
-#if USE(JSVALUE64)
- fail1.link(this);
- fail2.link(this);
- fail3.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1.link(this);
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail2.link(this);
- fail3.link(this);
- fail4.link(this);
-#endif
- }
-
- 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 (isOperandConstantImmediateInt(op2)) {
- emitGetVirtualRegister(op1, regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
-#if USE(JSVALUE64)
- int32_t op2imm = getConstantOperandImmediateInt(op2);
-#else
- int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));
-#endif
- addJump(branch32(LessThan, regT0, Imm32(op2imm)), target);
- } else if (isOperandConstantImmediateInt(op1)) {
- emitGetVirtualRegister(op2, regT1);
- emitJumpSlowCaseIfNotImmediateInteger(regT1);
-#if USE(JSVALUE64)
- int32_t op1imm = getConstantOperandImmediateInt(op1);
-#else
- int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)));
-#endif
- 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 (isOperandConstantImmediateInt(op2)) {
- linkSlowCase(iter);
-
- if (supportsFloatingPoint()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
- addPtr(tagTypeNumberRegister, regT0);
- movePtrToDouble(regT0, fpRegT0);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1 = emitJumpIfNotJSCell(regT0);
-
- Jump fail2 = checkStructure(regT0, m_globalData->numberStructure.get());
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
-#endif
-
- 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));
-
-#if USE(JSVALUE64)
- fail1.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1.link(this);
- fail2.link(this);
-#endif
- }
-
- 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()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT1);
- addPtr(tagTypeNumberRegister, regT1);
- movePtrToDouble(regT1, fpRegT1);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail1 = emitJumpIfNotJSCell(regT1);
-
- Jump fail2 = checkStructure(regT1, m_globalData->numberStructure.get());
- loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);
-#endif
-
- 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));
-
-#if USE(JSVALUE64)
- fail1.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail1.link(this);
- fail2.link(this);
-#endif
- }
-
- 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()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
- Jump fail2 = emitJumpIfNotImmediateNumber(regT1);
- Jump fail3 = emitJumpIfImmediateInteger(regT1);
- addPtr(tagTypeNumberRegister, regT0);
- addPtr(tagTypeNumberRegister, regT1);
- movePtrToDouble(regT0, fpRegT0);
- movePtrToDouble(regT1, fpRegT1);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1 = emitJumpIfNotJSCell(regT0);
-
- Jump fail2;
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail2 = emitJumpIfNotJSCell(regT1);
-
- Jump fail3 = checkStructure(regT0, m_globalData->numberStructure.get());
- Jump fail4 = checkStructure(regT1, m_globalData->numberStructure.get());
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);
-#endif
-
- emitJumpSlowToHot(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), target);
-
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
-
-#if USE(JSVALUE64)
- fail1.link(this);
- fail2.link(this);
- fail3.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1.link(this);
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail2.link(this);
- fail3.link(this);
- fail4.link(this);
-#endif
- }
-
- 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_jnlesseq(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 (isOperandConstantImmediateInt(op2)) {
- emitGetVirtualRegister(op1, regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
-#if USE(JSVALUE64)
- int32_t op2imm = getConstantOperandImmediateInt(op2);
-#else
- int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));
-#endif
- addJump(branch32(GreaterThan, regT0, Imm32(op2imm)), target);
- } else if (isOperandConstantImmediateInt(op1)) {
- emitGetVirtualRegister(op2, regT1);
- emitJumpSlowCaseIfNotImmediateInteger(regT1);
-#if USE(JSVALUE64)
- int32_t op1imm = getConstantOperandImmediateInt(op1);
-#else
- int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)));
-#endif
- addJump(branch32(LessThan, regT1, Imm32(op1imm)), target);
- } else {
- emitGetVirtualRegisters(op1, regT0, op2, regT1);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT1);
-
- addJump(branch32(GreaterThan, regT0, regT1), target);
- }
-}
-
-void JIT::emitSlow_op_jnlesseq(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 (isOperandConstantImmediateInt(op2)) {
- linkSlowCase(iter);
-
- if (supportsFloatingPoint()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
- addPtr(tagTypeNumberRegister, regT0);
- movePtrToDouble(regT0, fpRegT0);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1 = emitJumpIfNotJSCell(regT0);
-
- Jump fail2 = checkStructure(regT0, m_globalData->numberStructure.get());
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
-#endif
-
- int32_t op2imm = getConstantOperand(op2).asInt32();;
-
- move(Imm32(op2imm), regT1);
- convertInt32ToDouble(regT1, fpRegT1);
-
- emitJumpSlowToHot(branchDouble(DoubleLessThanOrUnordered, fpRegT1, fpRegT0), target);
-
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq));
-
-#if USE(JSVALUE64)
- fail1.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1.link(this);
- fail2.link(this);
-#endif
- }
-
- JITStubCall stubCall(this, cti_op_jlesseq);
- stubCall.addArgument(regT0);
- stubCall.addArgument(op2, regT2);
- stubCall.call();
- emitJumpSlowToHot(branchTest32(Zero, regT0), target);
-
- } else if (isOperandConstantImmediateInt(op1)) {
- linkSlowCase(iter);
-
- if (supportsFloatingPoint()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT1);
- addPtr(tagTypeNumberRegister, regT1);
- movePtrToDouble(regT1, fpRegT1);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail1 = emitJumpIfNotJSCell(regT1);
-
- Jump fail2 = checkStructure(regT1, m_globalData->numberStructure.get());
- loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);
-#endif
-
- int32_t op1imm = getConstantOperand(op1).asInt32();;
-
- move(Imm32(op1imm), regT0);
- convertInt32ToDouble(regT0, fpRegT0);
-
- emitJumpSlowToHot(branchDouble(DoubleLessThanOrUnordered, fpRegT1, fpRegT0), target);
-
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq));
-
-#if USE(JSVALUE64)
- fail1.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail1.link(this);
- fail2.link(this);
-#endif
- }
-
- JITStubCall stubCall(this, cti_op_jlesseq);
- stubCall.addArgument(op1, regT2);
- stubCall.addArgument(regT1);
- stubCall.call();
- emitJumpSlowToHot(branchTest32(Zero, regT0), target);
-
- } else {
- linkSlowCase(iter);
-
- if (supportsFloatingPoint()) {
-#if USE(JSVALUE64)
- Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
- Jump fail2 = emitJumpIfNotImmediateNumber(regT1);
- Jump fail3 = emitJumpIfImmediateInteger(regT1);
- addPtr(tagTypeNumberRegister, regT0);
- addPtr(tagTypeNumberRegister, regT1);
- movePtrToDouble(regT0, fpRegT0);
- movePtrToDouble(regT1, fpRegT1);
-#else
- Jump fail1;
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1 = emitJumpIfNotJSCell(regT0);
-
- Jump fail2;
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail2 = emitJumpIfNotJSCell(regT1);
-
- Jump fail3 = checkStructure(regT0, m_globalData->numberStructure.get());
- Jump fail4 = checkStructure(regT1, m_globalData->numberStructure.get());
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);
-#endif
-
- emitJumpSlowToHot(branchDouble(DoubleLessThanOrUnordered, fpRegT1, fpRegT0), target);
-
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq));
-
-#if USE(JSVALUE64)
- fail1.link(this);
- fail2.link(this);
- fail3.link(this);
-#else
- if (!m_codeBlock->isKnownNotImmediate(op1))
- fail1.link(this);
- if (!m_codeBlock->isKnownNotImmediate(op2))
- fail2.link(this);
- fail3.link(this);
- fail4.link(this);
-#endif
- }
-
- linkSlowCase(iter);
- JITStubCall stubCall(this, cti_op_jlesseq);
- stubCall.addArgument(regT0);
- stubCall.addArgument(regT1);
- stubCall.call();
- emitJumpSlowToHot(branchTest32(Zero, regT0), target);
- }
-}
-
-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);
-#if USE(JSVALUE64)
- int32_t imm = getConstantOperandImmediateInt(op1);
- andPtr(Imm32(imm), regT0);
- if (imm >= 0)
- emitFastArithIntToImmNoCheck(regT0, regT0);
-#else
- andPtr(Imm32(static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)))), regT0);
-#endif
- } else if (isOperandConstantImmediateInt(op2)) {
- emitGetVirtualRegister(op1, regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
-#if USE(JSVALUE64)
- int32_t imm = getConstantOperandImmediateInt(op2);
- andPtr(Imm32(imm), regT0);
- if (imm >= 0)
- emitFastArithIntToImmNoCheck(regT0, regT0);
-#else
- andPtr(Imm32(static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)))), regT0);
-#endif
- } 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);
-#if USE(JSVALUE64)
- addSlowCase(branchAdd32(Overflow, Imm32(1), regT1));
- emitFastArithIntToImmNoCheck(regT1, regT1);
-#else
- addSlowCase(branchAdd32(Overflow, Imm32(1 << JSImmediate::IntegerPayloadShift), regT1));
- signExtend32ToPtr(regT1, regT1);
-#endif
- 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);
-#if USE(JSVALUE64)
- addSlowCase(branchSub32(Zero, Imm32(1), regT1));
- emitFastArithIntToImmNoCheck(regT1, regT1);
-#else
- addSlowCase(branchSub32(Zero, Imm32(1 << JSImmediate::IntegerPayloadShift), regT1));
- signExtend32ToPtr(regT1, regT1);
-#endif
- 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);
-#if USE(JSVALUE64)
- addSlowCase(branchAdd32(Overflow, Imm32(1), regT0));
- emitFastArithIntToImmNoCheck(regT0, regT0);
-#else
- addSlowCase(branchAdd32(Overflow, Imm32(1 << JSImmediate::IntegerPayloadShift), regT0));
- signExtend32ToPtr(regT0, regT0);
-#endif
- 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);
-#if USE(JSVALUE64)
- addSlowCase(branchSub32(Zero, Imm32(1), regT0));
- emitFastArithIntToImmNoCheck(regT0, regT0);
-#else
- addSlowCase(branchSub32(Zero, Imm32(1 << JSImmediate::IntegerPayloadShift), regT0));
- signExtend32ToPtr(regT0, regT0);
-#endif
- 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)
-
-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;
-
- emitGetVirtualRegisters(op1, X86Registers::eax, op2, X86Registers::ecx);
- emitJumpSlowCaseIfNotImmediateInteger(X86Registers::eax);
- emitJumpSlowCaseIfNotImmediateInteger(X86Registers::ecx);
-#if USE(JSVALUE64)
- addSlowCase(branchPtr(Equal, X86Registers::ecx, ImmPtr(JSValue::encode(jsNumber(m_globalData, 0)))));
- m_assembler.cdq();
- m_assembler.idivl_r(X86Registers::ecx);
-#else
- emitFastArithDeTagImmediate(X86Registers::eax);
- addSlowCase(emitFastArithDeTagImmediateJumpIfZero(X86Registers::ecx));
- m_assembler.cdq();
- m_assembler.idivl_r(X86Registers::ecx);
- signExtend32ToPtr(X86Registers::edx, X86Registers::edx);
-#endif
- emitFastArithReTagImmediate(X86Registers::edx, X86Registers::eax);
- emitPutVirtualRegister(result);
-}
-
-void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- unsigned result = currentInstruction[1].u.operand;
-
-#if USE(JSVALUE64)
- linkSlowCase(iter);
- linkSlowCase(iter);
- linkSlowCase(iter);
-#else
- Jump notImm1 = getSlowCase(iter);
- Jump notImm2 = getSlowCase(iter);
- linkSlowCase(iter);
- emitFastArithReTagImmediate(X86Registers::eax, X86Registers::eax);
- emitFastArithReTagImmediate(X86Registers::ecx, X86Registers::ecx);
- notImm1.link(this);
- notImm2.link(this);
-#endif
- JITStubCall stubCall(this, cti_op_mod);
- stubCall.addArgument(X86Registers::eax);
- stubCall.addArgument(X86Registers::ecx);
- stubCall.call(result);
-}
-
-#else // CPU(X86) || CPU(X86_64)
-
-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 ENABLE(JIT_OPTIMIZE_MOD)
- emitGetVirtualRegisters(op1, regT0, op2, regT2);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT2);
-
- addSlowCase(branch32(Equal, regT2, Imm32(1)));
-
- emitNakedCall(m_globalData->jitStubs.ctiSoftModulo());
-
- emitPutVirtualRegister(result, regT0);
-#else
- JITStubCall stubCall(this, cti_op_mod);
- stubCall.addArgument(op1, regT2);
- stubCall.addArgument(op2, regT2);
- stubCall.call(result);
-#endif
-}
-
-void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
-#if ENABLE(JIT_OPTIMIZE_MOD)
- 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 ------------------------------ */
-
-#if USE(JSVALUE64)
-
-/* ------------------------------ 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);
-}
-
-#else // USE(JSVALUE64)
-
-/* ------------------------------ BEGIN: !USE(JSVALUE64) (OP_ADD, OP_SUB, OP_MUL) ------------------------------ */
-
-void JIT::compileBinaryArithOp(OpcodeID opcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes types)
-{
- Structure* numberStructure = m_globalData->numberStructure.get();
- Jump wasJSNumberCell1;
- Jump wasJSNumberCell2;
-
- emitGetVirtualRegisters(src1, regT0, src2, regT1);
-
- if (types.second().isReusable() && supportsFloatingPoint()) {
- ASSERT(types.second().mightBeNumber());
-
- // Check op2 is a number
- Jump op2imm = emitJumpIfImmediateInteger(regT1);
- if (!types.second().definitelyIsNumber()) {
- emitJumpSlowCaseIfNotJSCell(regT1, src2);
- addSlowCase(checkStructure(regT1, numberStructure));
- }
-
- // (1) In this case src2 is a reusable number cell.
- // Slow case if src1 is not a number type.
- Jump op1imm = emitJumpIfImmediateInteger(regT0);
- if (!types.first().definitelyIsNumber()) {
- emitJumpSlowCaseIfNotJSCell(regT0, src1);
- addSlowCase(checkStructure(regT0, numberStructure));
- }
-
- // (1a) if we get here, src1 is also a number cell
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- Jump loadedDouble = jump();
- // (1b) if we get here, src1 is an immediate
- op1imm.link(this);
- emitFastArithImmToInt(regT0);
- convertInt32ToDouble(regT0, fpRegT0);
- // (1c)
- loadedDouble.link(this);
- if (opcodeID == op_add)
- addDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- else if (opcodeID == op_sub)
- subDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- else {
- ASSERT(opcodeID == op_mul);
- mulDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- }
-
- // Store the result to the JSNumberCell and jump.
- storeDouble(fpRegT0, Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)));
- move(regT1, regT0);
- emitPutVirtualRegister(dst);
- wasJSNumberCell2 = jump();
-
- // (2) This handles cases where src2 is an immediate number.
- // Two slow cases - either src1 isn't an immediate, or the subtract overflows.
- op2imm.link(this);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
- } else if (types.first().isReusable() && supportsFloatingPoint()) {
- ASSERT(types.first().mightBeNumber());
-
- // Check op1 is a number
- Jump op1imm = emitJumpIfImmediateInteger(regT0);
- if (!types.first().definitelyIsNumber()) {
- emitJumpSlowCaseIfNotJSCell(regT0, src1);
- addSlowCase(checkStructure(regT0, numberStructure));
- }
-
- // (1) In this case src1 is a reusable number cell.
- // Slow case if src2 is not a number type.
- Jump op2imm = emitJumpIfImmediateInteger(regT1);
- if (!types.second().definitelyIsNumber()) {
- emitJumpSlowCaseIfNotJSCell(regT1, src2);
- addSlowCase(checkStructure(regT1, numberStructure));
- }
-
- // (1a) if we get here, src2 is also a number cell
- loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);
- Jump loadedDouble = jump();
- // (1b) if we get here, src2 is an immediate
- op2imm.link(this);
- emitFastArithImmToInt(regT1);
- convertInt32ToDouble(regT1, fpRegT1);
- // (1c)
- loadedDouble.link(this);
- loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);
- if (opcodeID == op_add)
- addDouble(fpRegT1, fpRegT0);
- else if (opcodeID == op_sub)
- subDouble(fpRegT1, fpRegT0);
- else {
- ASSERT(opcodeID == op_mul);
- mulDouble(fpRegT1, fpRegT0);
- }
- storeDouble(fpRegT0, Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)));
- emitPutVirtualRegister(dst);
-
- // Store the result to the JSNumberCell and jump.
- storeDouble(fpRegT0, Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)));
- emitPutVirtualRegister(dst);
- wasJSNumberCell1 = jump();
-
- // (2) This handles cases where src1 is an immediate number.
- // Two slow cases - either src2 isn't an immediate, or the subtract overflows.
- op1imm.link(this);
- emitJumpSlowCaseIfNotImmediateInteger(regT1);
- } else
- emitJumpSlowCaseIfNotImmediateIntegers(regT0, regT1, regT2);
-
- if (opcodeID == op_add) {
- emitFastArithDeTagImmediate(regT0);
- addSlowCase(branchAdd32(Overflow, regT1, regT0));
- } else if (opcodeID == op_sub) {
- addSlowCase(branchSub32(Overflow, regT1, regT0));
- signExtend32ToPtr(regT0, regT0);
- emitFastArithReTagImmediate(regT0, regT0);
- } else {
- ASSERT(opcodeID == op_mul);
- // convert eax & edx from JSImmediates to ints, and check if either are zero
- emitFastArithImmToInt(regT1);
- Jump op1Zero = emitFastArithDeTagImmediateJumpIfZero(regT0);
- Jump op2NonZero = branchTest32(NonZero, regT1);
- op1Zero.link(this);
- // if either input is zero, add the two together, and check if the result is < 0.
- // If it is, we have a problem (N < 0), (N * 0) == -0, not representatble as a JSImmediate.
- move(regT0, regT2);
- addSlowCase(branchAdd32(Signed, regT1, regT2));
- // Skip the above check if neither input is zero
- op2NonZero.link(this);
- addSlowCase(branchMul32(Overflow, regT1, regT0));
- signExtend32ToPtr(regT0, regT0);
- emitFastArithReTagImmediate(regT0, regT0);
- }
- emitPutVirtualRegister(dst);
-
- if (types.second().isReusable() && supportsFloatingPoint())
- wasJSNumberCell2.link(this);
- else if (types.first().isReusable() && supportsFloatingPoint())
- wasJSNumberCell1.link(this);
-}
-
-void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned dst, unsigned src1, unsigned src2, OperandTypes types)
-{
- linkSlowCase(iter);
- if (types.second().isReusable() && supportsFloatingPoint()) {
- if (!types.first().definitelyIsNumber()) {
- linkSlowCaseIfNotJSCell(iter, src1);
- linkSlowCase(iter);
- }
- if (!types.second().definitelyIsNumber()) {
- linkSlowCaseIfNotJSCell(iter, src2);
- linkSlowCase(iter);
- }
- } else if (types.first().isReusable() && supportsFloatingPoint()) {
- if (!types.first().definitelyIsNumber()) {
- linkSlowCaseIfNotJSCell(iter, src1);
- linkSlowCase(iter);
- }
- if (!types.second().definitelyIsNumber()) {
- linkSlowCaseIfNotJSCell(iter, src2);
- linkSlowCase(iter);
- }
- }
- linkSlowCase(iter);
-
- // additional entry point to handle -0 cases.
- if (opcodeID == op_mul)
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, opcodeID == op_add ? cti_op_add : opcodeID == op_sub ? cti_op_sub : cti_op_mul);
- stubCall.addArgument(src1, regT2);
- stubCall.addArgument(src2, regT2);
- stubCall.call(dst);
-}
-
-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) << JSImmediate::IntegerPayloadShift), regT0));
- signExtend32ToPtr(regT0, regT0);
- emitPutVirtualRegister(result);
- } else if (isOperandConstantImmediateInt(op2)) {
- emitGetVirtualRegister(op1, regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
- addSlowCase(branchAdd32(Overflow, Imm32(getConstantOperandImmediateInt(op2) << JSImmediate::IntegerPayloadShift), regT0));
- signExtend32ToPtr(regT0, regT0);
- emitPutVirtualRegister(result);
- } else {
- compileBinaryArithOp(op_add, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand));
- }
-}
-
-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;
-
- if (isOperandConstantImmediateInt(op1)) {
- Jump notImm = getSlowCase(iter);
- linkSlowCase(iter);
- sub32(Imm32(getConstantOperandImmediateInt(op1) << JSImmediate::IntegerPayloadShift), regT0);
- notImm.link(this);
- JITStubCall stubCall(this, cti_op_add);
- stubCall.addArgument(op1, regT2);
- stubCall.addArgument(regT0);
- stubCall.call(result);
- } else if (isOperandConstantImmediateInt(op2)) {
- Jump notImm = getSlowCase(iter);
- linkSlowCase(iter);
- sub32(Imm32(getConstantOperandImmediateInt(op2) << JSImmediate::IntegerPayloadShift), regT0);
- notImm.link(this);
- JITStubCall stubCall(this, cti_op_add);
- stubCall.addArgument(regT0);
- stubCall.addArgument(op2, regT2);
- stubCall.call(result);
- } else {
- OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
- ASSERT(types.first().mightBeNumber() && types.second().mightBeNumber());
- compileBinaryArithOpSlowCase(op_add, iter, result, op1, op2, types);
- }
-}
-
-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;
-
- // 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);
- emitFastArithDeTagImmediate(regT0);
- addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0));
- signExtend32ToPtr(regT0, regT0);
- emitFastArithReTagImmediate(regT0, regT0);
- emitPutVirtualRegister(result);
- } else if (isOperandConstantImmediateInt(op2) && ((value = getConstantOperandImmediateInt(op2)) > 0)) {
- emitGetVirtualRegister(op1, regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
- emitFastArithDeTagImmediate(regT0);
- addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0));
- signExtend32ToPtr(regT0, regT0);
- emitFastArithReTagImmediate(regT0, regT0);
- emitPutVirtualRegister(result);
- } else
- compileBinaryArithOp(op_mul, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand));
-}
-
-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;
-
- if ((isOperandConstantImmediateInt(op1) && (getConstantOperandImmediateInt(op1) > 0))
- || (isOperandConstantImmediateInt(op2) && (getConstantOperandImmediateInt(op2) > 0))) {
- linkSlowCase(iter);
- 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_mul);
- stubCall.addArgument(op1, regT2);
- stubCall.addArgument(op2, regT2);
- stubCall.call(result);
- } else
- compileBinaryArithOpSlowCase(op_mul, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand));
-}
-
-void JIT::emit_op_sub(Instruction* currentInstruction)
-{
- compileBinaryArithOp(op_sub, currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, OperandTypes::fromInt(currentInstruction[4].u.operand));
-}
-
-void JIT::emitSlow_op_sub(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- compileBinaryArithOpSlowCase(op_sub, iter, currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, OperandTypes::fromInt(currentInstruction[4].u.operand));
-}
-
-#endif // USE(JSVALUE64)
-
-/* ------------------------------ END: OP_ADD, OP_SUB, OP_MUL ------------------------------ */
-
-#endif // USE(JSVALUE32_64)
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp
deleted file mode 100644
index da603bd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- * 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 "JIT.h"
-
-#if ENABLE(JIT)
-
-#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 {
-
-#if USE(JSVALUE32_64)
-
-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_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // scopeChain
-
- emitStore(static_cast<unsigned>(RegisterFile::OptionalCalleeArguments), JSValue());
- storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register)))); // callee
- storePtr(regT1, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register)))); // scopeChain
-}
-
-void JIT::compileOpCallSetupArgs(Instruction* instruction)
-{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- emitPutJITStubArg(regT1, regT0, 0);
- emitPutJITStubArgConstant(registerOffset, 1);
- emitPutJITStubArgConstant(argCount, 2);
-}
-
-void JIT::compileOpConstructSetupArgs(Instruction* instruction)
-{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
-
- emitPutJITStubArg(regT1, regT0, 0);
- emitPutJITStubArgConstant(registerOffset, 1);
- emitPutJITStubArgConstant(argCount, 2);
- emitPutJITStubArgFromVirtualRegister(proto, 3, regT2, regT3);
- emitPutJITStubArgConstant(thisRegister, 4);
-}
-
-void JIT::compileOpCallVarargsSetupArgs(Instruction*)
-{
- emitPutJITStubArg(regT1, regT0, 0);
- emitPutJITStubArg(regT3, 1); // registerOffset
- emitPutJITStubArg(regT2, 2); // argCount
-}
-
-void JIT::compileOpCallVarargs(Instruction* instruction)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCountRegister = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- emitLoad(callee, regT1, regT0);
- emitLoadPayload(argCountRegister, regT2); // argCount
- addPtr(Imm32(registerOffset), regT2, regT3); // registerOffset
-
- compileOpCallVarargsSetupArgs(instruction);
-
- 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());
-
- emitStore(dst, regT1, regT0);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
-
- linkSlowCaseIfNotJSCell(iter, callee);
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
-
- map(m_bytecodeIndex + OPCODE_LENGTH(op_call_varargs), dst, regT1, regT0);
- 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())
- JITStubCall(this, cti_op_ret_scopeChain).call();
-
- emitLoad(dst, regT1, regT0);
- emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
-
- restoreReturnAddressBeforeReturn(regT2);
- ret();
-}
-
-void JIT::emit_op_construct_verify(Instruction* currentInstruction)
-{
- unsigned dst = currentInstruction[1].u.operand;
-
- emitLoad(dst, regT1, regT0);
- addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
- addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType)));
-}
-
-void JIT::emitSlow_op_construct_verify(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- unsigned dst = currentInstruction[1].u.operand;
- unsigned src = currentInstruction[2].u.operand;
-
- linkSlowCase(iter);
- linkSlowCase(iter);
- emitLoad(src, regT1, regT0);
- emitStore(dst, regT1, regT0);
-}
-
-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_load_varargs(Instruction* currentInstruction)
-{
- int argCountDst = currentInstruction[1].u.operand;
- int argsOffset = currentInstruction[2].u.operand;
-
- 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_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 dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].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);
-
- if (opcodeID == op_call)
- compileOpCallSetupArgs(instruction);
- else if (opcodeID == op_construct)
- compileOpConstructSetupArgs(instruction);
-
- emitJumpSlowCaseIfNotJSCell(callee, regT1);
- addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
-
- // First, in the case of a construct, allocate the new object.
- if (opcodeID == op_construct) {
- JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitLoad(callee, regT1, regT0);
- }
-
- // 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(m_globalData->jitStubs.ctiVirtualCall());
-
- if (opcodeID == op_call_eval)
- wasEval.link(this);
-
- emitStore(dst, regT1, regT0);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
-
- linkSlowCaseIfNotJSCell(iter, callee);
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
-
- sampleCodeBlock(m_codeBlock);
-}
-
-#else // !ENABLE(JIT_OPTIMIZE_CALL)
-
-/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].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.
-
- // In the case of OpConstruct, call out to a cti_ function to create the new object.
- if (opcodeID == op_construct) {
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
-
- JITStubCall stubCall(this, cti_op_construct_JSConstruct);
- stubCall.addArgument(regT1, regT0);
- stubCall.addArgument(Imm32(0)); // FIXME: Remove this unused JITStub argument.
- stubCall.addArgument(Imm32(0)); // FIXME: Remove this unused JITStub argument.
- stubCall.addArgument(proto);
- stubCall.call(thisRegister);
-
- emitLoad(callee, regT1, regT0);
- }
-
- // 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
- emitStore(registerOffset + RegisterFile::OptionalCalleeArguments, JSValue());
- emitStore(registerOffset + RegisterFile::Callee, regT1, regT0);
-
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + 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(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);
-
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + opcodeLengths[opcodeID], dst, regT1, regT0);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- linkSlowCase(iter);
- linkSlowCase(iter);
-
- // The arguments have been set up on the hot path for op_call_eval
- if (opcodeID == op_call)
- compileOpCallSetupArgs(instruction);
- else if (opcodeID == op_construct)
- compileOpConstructSetupArgs(instruction);
-
- // Fast check for JS function.
- Jump callLinkFailNotObject = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
- Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr));
-
- // First, in the case of a construct, allocate the new object.
- if (opcodeID == op_construct) {
- JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitLoad(callee, regT1, regT0);
- }
-
- // 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(m_globalData->jitStubs.ctiVirtualCallLink());
-
- // Put the return value in dst.
- emitStore(dst, regT1, regT0);;
- sampleCodeBlock(m_codeBlock);
-
- // If not, we need an extra case in the if below!
- ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_eval));
-
- // Done! - return back to the hot path.
- if (opcodeID == op_construct)
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_construct));
- else
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_call));
-
- // This handles host functions
- callLinkFailNotObject.link(this);
- callLinkFailNotJSFunction.link(this);
- JITStubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction).call();
-
- emitStore(dst, regT1, regT0);;
- sampleCodeBlock(m_codeBlock);
-}
-
-/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-#endif // !ENABLE(JIT_OPTIMIZE_CALL)
-
-#else // USE(JSVALUE32_64)
-
-void JIT::compileOpCallInitializeCallFrame()
-{
- store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
-
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
-
- storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register))));
- storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register))));
- storePtr(regT1, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register))));
-}
-
-void JIT::compileOpCallSetupArgs(Instruction* instruction)
-{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- // ecx holds func
- emitPutJITStubArg(regT0, 0);
- emitPutJITStubArgConstant(argCount, 2);
- emitPutJITStubArgConstant(registerOffset, 1);
-}
-
-void JIT::compileOpCallVarargsSetupArgs(Instruction* instruction)
-{
- int registerOffset = instruction[4].u.operand;
-
- // ecx holds func
- emitPutJITStubArg(regT0, 0);
- emitPutJITStubArg(regT1, 2);
- addPtr(Imm32(registerOffset), regT1, regT2);
- emitPutJITStubArg(regT2, 1);
-}
-
-void JIT::compileOpConstructSetupArgs(Instruction* instruction)
-{
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
-
- // ecx holds func
- emitPutJITStubArg(regT0, 0);
- emitPutJITStubArgConstant(registerOffset, 1);
- emitPutJITStubArgConstant(argCount, 2);
- emitPutJITStubArgFromVirtualRegister(proto, 3, regT2);
- emitPutJITStubArgConstant(thisRegister, 4);
-}
-
-void JIT::compileOpCallVarargs(Instruction* instruction)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCountRegister = instruction[3].u.operand;
-
- emitGetVirtualRegister(argCountRegister, regT1);
- emitGetVirtualRegister(callee, regT0);
- compileOpCallVarargsSetupArgs(instruction);
-
- // 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());
-
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitPutVirtualRegister(dst);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- int dst = instruction[1].u.operand;
-
- linkSlowCase(iter);
- linkSlowCase(iter);
- JITStubCall stubCall(this, cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
-
- sampleCodeBlock(m_codeBlock);
-}
-
-#if !ENABLE(JIT_OPTIMIZE_CALL)
-
-/* ------------------------------ BEGIN: !ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].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);
- // The arguments have been set up on the hot path for op_call_eval
- if (opcodeID == op_call)
- compileOpCallSetupArgs(instruction);
- else if (opcodeID == op_construct)
- compileOpConstructSetupArgs(instruction);
-
- // Check for JSFunctions.
- emitJumpSlowCaseIfNotJSCell(regT0);
- addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
-
- // First, in the case of a construct, allocate the new object.
- if (opcodeID == op_construct) {
- JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitGetVirtualRegister(callee, regT0);
- }
-
- // 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(m_globalData->jitStubs.ctiVirtualCall());
-
- if (opcodeID == op_call_eval)
- wasEval.link(this);
-
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitPutVirtualRegister(dst);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
-{
- int dst = instruction[1].u.operand;
-
- linkSlowCase(iter);
- linkSlowCase(iter);
- JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
- stubCall.call(dst); // In the interpreter, the callee puts the return value in dst.
-
- sampleCodeBlock(m_codeBlock);
-}
-
-#else // !ENABLE(JIT_OPTIMIZE_CALL)
-
-/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].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.
-
- // In the case of OpConstruct, call out to a cti_ function to create the new object.
- if (opcodeID == op_construct) {
- int proto = instruction[5].u.operand;
- int thisRegister = instruction[6].u.operand;
-
- emitPutJITStubArg(regT0, 0);
- emitPutJITStubArgFromVirtualRegister(proto, 3, regT2);
- JITStubCall stubCall(this, cti_op_construct_JSConstruct);
- stubCall.call(thisRegister);
- emitGetVirtualRegister(callee, regT0);
- }
-
- // 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
- storePtr(ImmPtr(JSValue::encode(JSValue())), Address(callFrameRegister, (registerOffset + RegisterFile::OptionalCalleeArguments) * static_cast<int>(sizeof(Register))));
- storePtr(regT0, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_data) + 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(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);
-
- // Put the return value in dst. In the interpreter, op_ret does this.
- emitPutVirtualRegister(dst);
-
- sampleCodeBlock(m_codeBlock);
-}
-
-void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
-{
- int dst = instruction[1].u.operand;
- int callee = instruction[2].u.operand;
- int argCount = instruction[3].u.operand;
- int registerOffset = instruction[4].u.operand;
-
- linkSlowCase(iter);
-
- // The arguments have been set up on the hot path for op_call_eval
- if (opcodeID == op_call)
- compileOpCallSetupArgs(instruction);
- else if (opcodeID == op_construct)
- compileOpConstructSetupArgs(instruction);
-
- // Fast check for JS function.
- Jump callLinkFailNotObject = emitJumpIfNotJSCell(regT0);
- Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr));
-
- // First, in the case of a construct, allocate the new object.
- if (opcodeID == op_construct) {
- JITStubCall(this, cti_op_construct_JSConstruct).call(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitGetVirtualRegister(callee, regT0);
- }
-
- // 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);
-
- move(regT0, regT2);
-
- m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(m_globalData->jitStubs.ctiVirtualCallLink());
-
- // Put the return value in dst.
- emitPutVirtualRegister(dst);
- sampleCodeBlock(m_codeBlock);
-
- // If not, we need an extra case in the if below!
- ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_eval));
-
- // Done! - return back to the hot path.
- if (opcodeID == op_construct)
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_construct));
- else
- emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_call));
-
- // This handles host functions
- callLinkFailNotObject.link(this);
- callLinkFailNotJSFunction.link(this);
- JITStubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction).call();
-
- emitPutVirtualRegister(dst);
- sampleCodeBlock(m_codeBlock);
-}
-
-/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
-
-#endif // !ENABLE(JIT_OPTIMIZE_CALL)
-
-#endif // USE(JSVALUE32_64)
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITCode.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITCode.h
deleted file mode 100644
index 5d889b5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITCode.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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* exception)
- {
- return JSValue::decode(ctiTrampoline(m_ref.m_code.executableAddress(), registerFile, callFrame, exception, Profiler::enabledProfilerReference(), globalData));
- }
-
- 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/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h
deleted file mode 100644
index 91d891e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h
+++ /dev/null
@@ -1,866 +0,0 @@
-/*
- * 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. */
-
-// puts an arg onto the stack, as an arg to a context threaded function.
-ALWAYS_INLINE void JIT::emitPutJITStubArg(RegisterID src, unsigned argumentNumber)
-{
- unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;
- poke(src, argumentStackOffset);
-}
-
-/* Deprecated: Please use JITStubCall instead. */
-
-ALWAYS_INLINE void JIT::emitPutJITStubArgConstant(unsigned value, unsigned argumentNumber)
-{
- unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;
- poke(Imm32(value), argumentStackOffset);
-}
-
-/* Deprecated: Please use JITStubCall instead. */
-
-ALWAYS_INLINE void JIT::emitPutJITStubArgConstant(void* value, unsigned argumentNumber)
-{
- unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;
- poke(ImmPtr(value), argumentStackOffset);
-}
-
-/* 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(JSVALUE32_64)
- killLastResultRegister();
-#endif
-}
-
-ALWAYS_INLINE void JIT::emitGetFromCallFrameHeader32(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from)
-{
- load32(Address(from, entry * sizeof(Register)), to);
-#if !USE(JSVALUE32_64)
- killLastResultRegister();
-#endif
-}
-
-ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function)
-{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
-
- Call nakedCall = nearCall();
- m_calls.append(CallRecord(nakedCall, m_bytecodeIndex, function.executableAddress()));
- return nakedCall;
-}
-
-#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
-
-ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace)
-{
-#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
- ASSERT(differenceBetween(m_uninterruptedInstructionSequenceBegin, label()) == insnSpace);
- ASSERT(sizeOfConstantPool() - m_uninterruptedConstantSequenceBegin == constSpace);
-#endif
-}
-
-#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);
-}
-
-#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
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-ALWAYS_INLINE void JIT::restoreArgumentReference()
-{
- poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
-}
-ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline() {}
-#else
-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.
-}
-#endif
-
-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_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
-
- m_slowCases.append(SlowCaseEntry(jump, m_bytecodeIndex));
-}
-
-ALWAYS_INLINE void JIT::addSlowCase(JumpList jumpList)
-{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex 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_bytecodeIndex));
-}
-
-ALWAYS_INLINE void JIT::addJump(Jump jump, int relativeOffset)
-{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
-
- m_jmpTable.append(JumpTable(jump, m_bytecodeIndex + relativeOffset));
-}
-
-ALWAYS_INLINE void JIT::emitJumpSlowToHot(Jump jump, int relativeOffset)
-{
- ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
-
- jump.linkTo(m_labels[m_bytecodeIndex + 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
-
-inline JIT::Address JIT::addressFor(unsigned index, RegisterID base)
-{
- return Address(base, (index * sizeof(Register)));
-}
-
-#if USE(JSVALUE32_64)
-
-inline JIT::Address JIT::tagFor(unsigned index, RegisterID base)
-{
- return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
-}
-
-inline JIT::Address JIT::payloadFor(unsigned index, RegisterID base)
-{
- return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
-}
-
-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 bytecodeIndex)
-{
- for (size_t numberOfJumpTargets = m_codeBlock->numberOfJumpTargets(); m_jumpTargetIndex != numberOfJumpTargets; ++m_jumpTargetIndex) {
- unsigned jumpTarget = m_codeBlock->jumpTarget(m_jumpTargetIndex);
- if (jumpTarget == bytecodeIndex)
- return true;
- if (jumpTarget > bytecodeIndex)
- return false;
- }
- return false;
-}
-
-inline void JIT::map(unsigned bytecodeIndex, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload)
-{
- if (isLabeled(bytecodeIndex))
- return;
-
- m_mappedBytecodeIndex = bytecodeIndex;
- 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_mappedBytecodeIndex = (unsigned)-1;
- m_mappedVirtualRegisterIndex = (unsigned)-1;
- m_mappedTag = (RegisterID)-1;
- m_mappedPayload = (RegisterID)-1;
-}
-
-inline bool JIT::isMapped(unsigned virtualRegisterIndex)
-{
- if (m_mappedBytecodeIndex != m_bytecodeIndex)
- return false;
- if (m_mappedVirtualRegisterIndex != virtualRegisterIndex)
- return false;
- return true;
-}
-
-inline bool JIT::getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload)
-{
- if (m_mappedBytecodeIndex != m_bytecodeIndex)
- 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_mappedBytecodeIndex != m_bytecodeIndex)
- 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))
- addSlowCase(branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::CellTag)));
-}
-
-inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag)
-{
- if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex))
- 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;
-}
-
-/* Deprecated: Please use JITStubCall instead. */
-
-ALWAYS_INLINE void JIT::emitPutJITStubArg(RegisterID tag, RegisterID payload, unsigned argumentNumber)
-{
- unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;
- poke(payload, argumentStackOffset);
- poke(tag, argumentStackOffset + 1);
-}
-
-/* Deprecated: Please use JITStubCall instead. */
-
-ALWAYS_INLINE void JIT::emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch1, RegisterID scratch2)
-{
- unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;
- if (m_codeBlock->isConstantRegisterIndex(src)) {
- JSValue constant = m_codeBlock->getConstant(src);
- poke(Imm32(constant.payload()), argumentStackOffset);
- poke(Imm32(constant.tag()), argumentStackOffset + 1);
- } else {
- emitLoad(src, scratch1, scratch2);
- poke(scratch2, argumentStackOffset);
- poke(scratch1, argumentStackOffset + 1);
- }
-}
-
-#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_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex 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_bytecodeIndex) {
- if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == m_bytecodeIndex)
- 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) ? 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)
-ALWAYS_INLINE JIT::Jump JIT::emitJumpIfImmediateNumber(RegisterID reg)
-{
- return branchTestPtr(NonZero, reg, tagTypeNumberRegister);
-}
-ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotImmediateNumber(RegisterID reg)
-{
- return branchTestPtr(Zero, reg, tagTypeNumberRegister);
-}
-
-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(JSVALUE64)
-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
-}
-
-ALWAYS_INLINE void JIT::emitFastArithImmToInt(RegisterID reg)
-{
-#if USE(JSVALUE64)
- UNUSED_PARAM(reg);
-#else
- rshift32(Imm32(JSImmediate::IntegerPayloadShift), reg);
-#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);
-}
-
-/* Deprecated: Please use JITStubCall instead. */
-
-// get arg puts an arg from the SF register array onto the stack, as an arg to a context threaded function.
-ALWAYS_INLINE void JIT::emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch)
-{
- unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;
- if (m_codeBlock->isConstantRegisterIndex(src)) {
- JSValue value = m_codeBlock->getConstant(src);
- poke(ImmPtr(JSValue::encode(value)), argumentStackOffset);
- } else {
- loadPtr(Address(callFrameRegister, src * sizeof(Register)), scratch);
- poke(scratch, argumentStackOffset);
- }
-
- killLastResultRegister();
-}
-
-#endif // USE(JSVALUE32_64)
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
deleted file mode 100644
index d04857c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
+++ /dev/null
@@ -1,3126 +0,0 @@
-/*
- * 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"
-#include "JIT.h"
-
-#if ENABLE(JIT)
-
-#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(JSVALUE32_64)
-
-void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
-{
-#if ENABLE(JIT_OPTIMIZE_MOD)
- 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
-
- // (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();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
-
- Jump isNativeFunc2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
-
- Jump hasCodeBlock2 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
- preserveReturnAddressAfterCall(regT3);
- restoreArgumentReference();
- Call callJSFunction2 = call();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- hasCodeBlock2.link(this);
-
- // Check argCount matches callee arity.
- Jump arityCheckOkay2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
- preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 1); // return address
- restoreArgumentReference();
- Call callArityCheck2 = call();
- move(regT1, callFrameRegister);
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- arityCheckOkay2.link(this);
-
- isNativeFunc2.link(this);
-
- compileOpCallInitializeCallFrame();
-
- preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 1); // return address
- restoreArgumentReference();
- Call callLazyLinkCall = call();
- restoreReturnAddressBeforeReturn(regT3);
- jump(regT0);
-#endif // ENABLE(JIT_OPTIMIZE_CALL)
-
- // VirtualCall Trampoline
- // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
- Label virtualCallBegin = align();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
-
- Jump isNativeFunc3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
-
- Jump hasCodeBlock3 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
- preserveReturnAddressAfterCall(regT3);
- restoreArgumentReference();
- Call callJSFunction1 = call();
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- hasCodeBlock3.link(this);
-
- // Check argCount matches callee arity.
- Jump arityCheckOkay3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
- preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 1); // return address
- restoreArgumentReference();
- Call callArityCheck1 = call();
- move(regT1, callFrameRegister);
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- arityCheckOkay3.link(this);
-
- isNativeFunc3.link(this);
-
- compileOpCallInitializeCallFrame();
- loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0);
- jump(regT0);
-
-#if CPU(X86) || CPU(ARM_TRADITIONAL)
- Label nativeCallThunk = align();
- preserveReturnAddressAfterCall(regT0);
- emitPutToCallFrameHeader(regT0, RegisterFile::ReturnPC); // Push return address
-
- // Load caller frame's scope chain into this callframe so that whatever we call can
- // get to its global data.
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT1);
- emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT1);
- emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
-
-#if CPU(X86)
- emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
-
- /* We have two structs that we use to describe the stackframe we set up for our
- * call to native code. NativeCallFrameStructure describes the how we set up the stack
- * in advance of the call. NativeFunctionCalleeSignature describes the callframe
- * as the native code expects it. We do this as we are using the fastcall calling
- * convention which results in the callee popping its arguments off the stack, but
- * not the rest of the callframe so we need a nice way to ensure we increment the
- * stack pointer by the right amount after the call.
- */
-
-#if COMPILER(MSVC) || OS(LINUX)
-#if COMPILER(MSVC)
-#pragma pack(push)
-#pragma pack(4)
-#endif // COMPILER(MSVC)
- struct NativeCallFrameStructure {
- // CallFrame* callFrame; // passed in EDX
- JSObject* callee;
- JSValue thisValue;
- ArgList* argPointer;
- ArgList args;
- JSValue result;
- };
- struct NativeFunctionCalleeSignature {
- JSObject* callee;
- JSValue thisValue;
- ArgList* argPointer;
- };
-#if COMPILER(MSVC)
-#pragma pack(pop)
-#endif // COMPILER(MSVC)
-#else
- struct NativeCallFrameStructure {
- // CallFrame* callFrame; // passed in ECX
- // JSObject* callee; // passed in EDX
- JSValue thisValue;
- ArgList* argPointer;
- ArgList args;
- };
- struct NativeFunctionCalleeSignature {
- JSValue thisValue;
- ArgList* argPointer;
- };
-#endif
-
- const int NativeCallFrameSize = (sizeof(NativeCallFrameStructure) + 15) & ~15;
- // Allocate system stack frame
- subPtr(Imm32(NativeCallFrameSize), stackPointerRegister);
-
- // Set up arguments
- subPtr(Imm32(1), regT0); // Don't include 'this' in argcount
-
- // push argcount
- storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, args) + OBJECT_OFFSETOF(ArgList, m_argCount)));
-
- // Calculate the start of the callframe header, and store in regT1
- addPtr(Imm32(-RegisterFile::CallFrameHeaderSize * (int)sizeof(Register)), callFrameRegister, regT1);
-
- // Calculate start of arguments as callframe header - sizeof(Register) * argcount (regT0)
- mul32(Imm32(sizeof(Register)), regT0, regT0);
- subPtr(regT0, regT1);
- storePtr(regT1, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, args) + OBJECT_OFFSETOF(ArgList, m_args)));
-
- // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
- addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, args)), stackPointerRegister, regT0);
- storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, argPointer)));
-
- // regT1 currently points to the first argument, regT1 - sizeof(Register) points to 'this'
- loadPtr(Address(regT1, -(int)sizeof(Register) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT2);
- loadPtr(Address(regT1, -(int)sizeof(Register) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT3);
- storePtr(regT2, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, thisValue) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)));
- storePtr(regT3, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, thisValue) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)));
-
-#if COMPILER(MSVC) || OS(LINUX)
- // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
- addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, result)), stackPointerRegister, X86Registers::ecx);
-
- // Plant callee
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::eax);
- storePtr(X86Registers::eax, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, callee)));
-
- // Plant callframe
- move(callFrameRegister, X86Registers::edx);
-
- call(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
-
- // JSValue is a non-POD type, so eax points to it
- emitLoad(0, regT1, regT0, X86Registers::eax);
-#else
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::edx); // callee
- move(callFrameRegister, X86Registers::ecx); // callFrame
- call(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
-#endif
-
- // We've put a few temporaries on the stack in addition to the actual arguments
- // so pull them off now
- addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister);
-
-#elif CPU(ARM_TRADITIONAL)
- emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
-
- // Allocate stack space for our arglist
- COMPILE_ASSERT((sizeof(ArgList) & 0x7) == 0 && sizeof(JSValue) == 8 && sizeof(Register) == 8, ArgList_should_by_8byte_aligned);
- subPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
-
- // Set up arguments
- subPtr(Imm32(1), regT0); // Don't include 'this' in argcount
-
- // Push argcount
- storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_argCount)));
-
- // Calculate the start of the callframe header, and store in regT1
- move(callFrameRegister, regT1);
- sub32(Imm32(RegisterFile::CallFrameHeaderSize * (int32_t)sizeof(Register)), regT1);
-
- // Calculate start of arguments as callframe header - sizeof(Register) * argcount (regT1)
- mul32(Imm32(sizeof(Register)), regT0, regT0);
- subPtr(regT0, regT1);
-
- // push pointer to arguments
- storePtr(regT1, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_args)));
-
- // Argument passing method:
- // r0 - points to return value
- // r1 - callFrame
- // r2 - callee
- // stack: this(JSValue) and a pointer to ArgList
-
-#if OS(WINCE)
- // Setup arg4:
- push(stackPointerRegister);
-
- // Setup arg3:
- // regT1 currently points to the first argument, regT1-sizeof(Register) points to 'this'
- load32(Address(regT1, -(int32_t)sizeof(void*) * 2), ARMRegisters::r3);
- push(ARMRegisters::r3);
- load32(Address(regT1, -(int32_t)sizeof(void*)), regT3);
- storePtr(regT3, Address(stackPointerRegister));
-
- // Setup arg2:
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT2);
-
- // Setup arg1:
- move(callFrameRegister, regT1);
-
- // Setup arg0:
- move(stackPointerRegister, regT0);
-
- call(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data)));
-
- load32(Address(stackPointerRegister, 0), regT0);
- load32(Address(stackPointerRegister, 4), regT1);
-
- addPtr(Imm32(sizeof(ArgList) + 8), stackPointerRegister);
-#else // OS(WINCE)
- move(stackPointerRegister, regT3);
- subPtr(Imm32(8), stackPointerRegister);
- move(stackPointerRegister, regT0);
- subPtr(Imm32(8 + 4 + 4 /* padding */), stackPointerRegister);
-
- // Setup arg4:
- storePtr(regT3, Address(stackPointerRegister, 8));
-
- // Setup arg3:
- // regT1 currently points to the first argument, regT1-sizeof(Register) points to 'this'
- load32(Address(regT1, -(int32_t)sizeof(void*) * 2), regT3);
- storePtr(regT3, Address(stackPointerRegister, 0));
- load32(Address(regT1, -(int32_t)sizeof(void*)), regT3);
- storePtr(regT3, Address(stackPointerRegister, 4));
-
- // Setup arg2:
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT2);
-
- // Setup arg1:
- move(callFrameRegister, regT1);
-
- call(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data)));
-
- // Load return value
- load32(Address(stackPointerRegister, 16), regT0);
- load32(Address(stackPointerRegister, 20), regT1);
-
- addPtr(Imm32(sizeof(ArgList) + 16 + 8), stackPointerRegister);
-#endif // OS(WINCE)
-
-#endif
-
- // Check for an exception
- move(ImmPtr(&globalData->exception), regT2);
- Jump sawException = branch32(NotEqual, tagFor(0, regT2), Imm32(JSValue::EmptyValueTag));
-
- // Grab the return address.
- emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT3);
-
- // Restore our caller's "r".
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
-
- // Return.
- restoreReturnAddressBeforeReturn(regT3);
- ret();
-
- // Handle an exception
- sawException.link(this);
- // Grab the return address.
- emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
- move(ImmPtr(&globalData->exceptionLocation), regT2);
- storePtr(regT1, regT2);
- move(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()), regT2);
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
- poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
- restoreReturnAddressBeforeReturn(regT2);
- ret();
-
-#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
-#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
-#else
- breakpoint();
-#endif
-
-#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()));
-
-#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
- patchBuffer.link(callArityCheck1, FunctionPtr(cti_op_call_arityCheck));
- patchBuffer.link(callJSFunction1, FunctionPtr(cti_op_call_JSFunction));
-#if ENABLE(JIT_OPTIMIZE_CALL)
- patchBuffer.link(callArityCheck2, FunctionPtr(cti_op_call_arityCheck));
- patchBuffer.link(callJSFunction2, FunctionPtr(cti_op_call_JSFunction));
- patchBuffer.link(callLazyLinkCall, FunctionPtr(cti_vm_lazyLinkCall));
-#endif
-
- CodeRef finalCode = patchBuffer.finalizeCode();
- *executablePool = finalCode.m_executablePool;
-
- trampolines->ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
- trampolines->ctiNativeCallThunk = trampolineAt(finalCode, nativeCallThunk);
-#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
- trampolines->ctiStringLengthTrampoline = trampolineAt(finalCode, stringLengthBegin);
-#else
- UNUSED_PARAM(ctiStringLengthTrampoline);
-#endif
-#if ENABLE(JIT_OPTIMIZE_CALL)
- trampolines->ctiVirtualCallLink = trampolineAt(finalCode, virtualCallLinkBegin);
-#else
- UNUSED_PARAM(ctiVirtualCallLink);
-#endif
-#if ENABLE(JIT_OPTIMIZE_MOD)
- trampolines->ctiSoftModulo = trampolineAt(finalCode, softModBegin);
-#endif
-}
-
-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_bytecodeIndex + 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_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 value, baseVal, and proto are cells.
- emitJumpSlowCaseIfNotJSCell(value);
- emitJumpSlowCaseIfNotJSCell(baseVal);
- emitJumpSlowCaseIfNotJSCell(proto);
-
- // 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_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, baseVal);
- linkSlowCaseIfNotJSCell(iter, proto);
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, cti_op_instanceof);
- stubCall.addArgument(value);
- stubCall.addArgument(baseVal);
- stubCall.addArgument(proto);
- stubCall.call(dst);
-}
-
-void JIT::emit_op_new_func(Instruction* currentInstruction)
-{
- JITStubCall stubCall(this, cti_op_new_func);
- stubCall.addArgument(ImmPtr(m_codeBlock->functionDecl(currentInstruction[2].u.operand)));
- stubCall.call(currentInstruction[1].u.operand);
-}
-
-void JIT::emit_op_get_global_var(Instruction* currentInstruction)
-{
- int dst = currentInstruction[1].u.operand;
- JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(currentInstruction[2].u.jsCell);
- ASSERT(globalObject->isGlobalObject());
- int index = currentInstruction[3].u.operand;
-
- loadPtr(&globalObject->d()->registers, regT2);
-
- emitLoad(index, regT1, regT0, regT2);
- emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + OPCODE_LENGTH(op_get_global_var), dst, regT1, regT0);
-}
-
-void JIT::emit_op_put_global_var(Instruction* currentInstruction)
-{
- JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(currentInstruction[1].u.jsCell);
- ASSERT(globalObject->isGlobalObject());
- int index = currentInstruction[2].u.operand;
- int value = currentInstruction[3].u.operand;
-
- emitLoad(value, regT1, regT0);
-
- loadPtr(&globalObject->d()->registers, regT2);
- emitStore(index, regT1, regT0, regT2);
- map(m_bytecodeIndex + 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 + m_codeBlock->needsFullScopeChain();
-
- emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT2);
- 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_bytecodeIndex + 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 + m_codeBlock->needsFullScopeChain();
- int value = currentInstruction[3].u.operand;
-
- emitLoad(value, regT1, regT0);
-
- emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT2);
- 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_bytecodeIndex + OPCODE_LENGTH(op_put_scoped_var), value, regT1, regT0);
-}
-
-void JIT::emit_op_tear_off_activation(Instruction* currentInstruction)
-{
- JITStubCall stubCall(this, cti_op_tear_off_activation);
- stubCall.addArgument(currentInstruction[1].u.operand);
- stubCall.call();
-}
-
-void JIT::emit_op_tear_off_arguments(Instruction*)
-{
- JITStubCall(this, cti_op_tear_off_arguments).call();
-}
-
-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_bytecodeIndex + 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, cti_op_resolve_base);
- 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 + m_codeBlock->needsFullScopeChain()));
- stubCall.call(currentInstruction[1].u.operand);
-}
-
-void JIT::emit_op_resolve_global(Instruction* currentInstruction)
-{
- // FIXME: Optimize to use patching instead of so many memory accesses.
-
- unsigned dst = currentInstruction[1].u.operand;
- void* globalObject = currentInstruction[2].u.jsCell;
-
- 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), regT0); // payload
- load32(BaseIndex(regT2, regT3, TimesEight, 4), regT1); // tag
- emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + 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;
- void* globalObject = currentInstruction[2].u.jsCell;
- Identifier* ident = &m_codeBlock->identifier(currentInstruction[3].u.operand);
-
- unsigned currentIndex = m_globalResolveInfoIndex++;
-
- linkSlowCase(iter);
- JITStubCall stubCall(this, cti_op_resolve_global);
- stubCall.addArgument(ImmPtr(globalObject));
- 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)));
-
- zeroDouble(fpRegT0);
- emitLoadDouble(cond, fpRegT1);
- addJump(branchDouble(DoubleEqualOrUnordered, 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)));
-
- zeroDouble(fpRegT0);
- emitLoadDouble(cond, fpRegT1);
- addJump(branchDouble(DoubleNotEqual, 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);
-
- set32(Equal, regT1, Imm32(JSValue::NullTag), regT2);
- set32(Equal, regT1, Imm32(JSValue::UndefinedTag), regT1);
- or32(regT2, regT1);
-
- addJump(branchTest32(NonZero, regT1), 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);
-
- set32(Equal, regT1, Imm32(JSValue::NullTag), regT2);
- set32(Equal, regT1, Imm32(JSValue::UndefinedTag), regT1);
- or32(regT2, regT1);
-
- addJump(branchTest32(Zero, regT1), 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)));
-
- set8(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)));
-
- set8(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)
- set8(Equal, regT0, regT1, regT0);
- else
- set8(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);
- setTest8(NonZero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT1);
-
- Jump wasNotImmediate = jump();
-
- isImmediate.link(this);
-
- set8(Equal, regT1, Imm32(JSValue::NullTag), regT2);
- set8(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);
- setTest8(Zero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT1);
-
- Jump wasNotImmediate = jump();
-
- isImmediate.link(this);
-
- set8(NotEqual, regT1, Imm32(JSValue::NullTag), regT2);
- set8(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_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_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()) {
- 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_bytecodeIndex + 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)
-{
- unsigned exception = currentInstruction[1].u.operand;
-
- // This opcode only executes after a return from cti_op_throw.
-
- // cti_op_throw may have taken us to a call frame further up the stack; reload
- // the call frame pointer to adjust.
- peek(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
-
- // Now store the exception returned by cti_op_throw.
- emitStore(exception, regT1, regT0);
- map(m_bytecodeIndex + 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_bytecodeIndex, 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_bytecodeIndex, 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_bytecodeIndex, defaultOffset));
-
- JITStubCall stubCall(this, cti_op_switch_string);
- stubCall.addArgument(scrutinee);
- stubCall.addArgument(Imm32(tableIndex));
- stubCall.call();
- jump(regT0);
-}
-
-void JIT::emit_op_new_error(Instruction* currentInstruction)
-{
- unsigned dst = currentInstruction[1].u.operand;
- unsigned type = currentInstruction[2].u.operand;
- unsigned message = currentInstruction[3].u.operand;
-
- JITStubCall stubCall(this, cti_op_new_error);
- stubCall.addArgument(Imm32(type));
- stubCall.addArgument(m_codeBlock->getConstant(message));
- stubCall.addArgument(Imm32(m_bytecodeIndex));
- stubCall.call(dst);
-}
-
-void JIT::emit_op_debug(Instruction* currentInstruction)
-{
- 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();
-}
-
-
-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_enter_with_activation(Instruction* currentInstruction)
-{
- emit_op_enter(currentInstruction);
-
- JITStubCall(this, cti_op_push_activation).call(currentInstruction[1].u.operand);
-}
-
-void JIT::emit_op_create_arguments(Instruction*)
-{
- Jump argsCreated = branch32(NotEqual, tagFor(RegisterFile::ArgumentsRegister, callFrameRegister), Imm32(JSValue::EmptyValueTag));
-
- // If we get here the arguments pointer is a null cell - i.e. arguments need lazy creation.
- if (m_codeBlock->m_numParameters == 1)
- JITStubCall(this, cti_op_create_arguments_no_params).call();
- else
- JITStubCall(this, cti_op_create_arguments).call();
-
- argsCreated.link(this);
-}
-
-void JIT::emit_op_init_arguments(Instruction*)
-{
- emitStore(RegisterFile::ArgumentsRegister, JSValue(), callFrameRegister);
-}
-
-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_bytecodeIndex + OPCODE_LENGTH(op_convert_this), 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::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);
-}
-
-#else // USE(JSVALUE32_64)
-
-#define RECORD_JUMP_TARGET(targetOffset) \
- do { m_labels[m_bytecodeIndex + (targetOffset)].used(); } while (false)
-
-void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
-{
-#if ENABLE(JIT_OPTIMIZE_MOD)
- Label softModBegin = align();
- softModulo();
-#endif
-#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.
- Label virtualCallLinkBegin = align();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
-
- Jump isNativeFunc2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
-
- Jump hasCodeBlock2 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
- preserveReturnAddressAfterCall(regT3);
- restoreArgumentReference();
- Call callJSFunction2 = call();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- hasCodeBlock2.link(this);
-
- // Check argCount matches callee arity.
- Jump arityCheckOkay2 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
- preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 1); // return address
- restoreArgumentReference();
- Call callArityCheck2 = call();
- move(regT1, callFrameRegister);
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- arityCheckOkay2.link(this);
-
- isNativeFunc2.link(this);
-
- compileOpCallInitializeCallFrame();
- preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 1); // return address
- restoreArgumentReference();
- Call callLazyLinkCall = call();
- restoreReturnAddressBeforeReturn(regT3);
- jump(regT0);
-
- // VirtualCall Trampoline
- // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
- Label virtualCallBegin = align();
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
-
- Jump isNativeFunc3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
-
- Jump hasCodeBlock3 = branch32(GreaterThan, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), Imm32(0));
- preserveReturnAddressAfterCall(regT3);
- restoreArgumentReference();
- Call callJSFunction1 = call();
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- hasCodeBlock3.link(this);
-
- // Check argCount matches callee arity.
- Jump arityCheckOkay3 = branch32(Equal, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParameters)), regT1);
- preserveReturnAddressAfterCall(regT3);
- emitPutJITStubArg(regT3, 1); // return address
- restoreArgumentReference();
- Call callArityCheck1 = call();
- move(regT1, callFrameRegister);
- emitGetJITStubArg(2, regT1); // argCount
- restoreReturnAddressBeforeReturn(regT3);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
- arityCheckOkay3.link(this);
-
- isNativeFunc3.link(this);
-
- compileOpCallInitializeCallFrame();
- loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0);
- jump(regT0);
-
- Label nativeCallThunk = align();
- preserveReturnAddressAfterCall(regT0);
- emitPutToCallFrameHeader(regT0, RegisterFile::ReturnPC); // Push return address
-
- // Load caller frame's scope chain into this callframe so that whatever we call can
- // get to its global data.
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT1);
- emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT1);
- emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
-
-
-#if CPU(X86_64)
- emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, X86Registers::ecx);
-
- // Allocate stack space for our arglist
- subPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
- COMPILE_ASSERT((sizeof(ArgList) & 0xf) == 0, ArgList_should_by_16byte_aligned);
-
- // Set up arguments
- subPtr(Imm32(1), X86Registers::ecx); // Don't include 'this' in argcount
-
- // Push argcount
- storePtr(X86Registers::ecx, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_argCount)));
-
- // Calculate the start of the callframe header, and store in edx
- addPtr(Imm32(-RegisterFile::CallFrameHeaderSize * (int32_t)sizeof(Register)), callFrameRegister, X86Registers::edx);
-
- // Calculate start of arguments as callframe header - sizeof(Register) * argcount (ecx)
- mul32(Imm32(sizeof(Register)), X86Registers::ecx, X86Registers::ecx);
- subPtr(X86Registers::ecx, X86Registers::edx);
-
- // push pointer to arguments
- storePtr(X86Registers::edx, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_args)));
-
- // ArgList is passed by reference so is stackPointerRegister
- move(stackPointerRegister, X86Registers::ecx);
-
- // edx currently points to the first argument, edx-sizeof(Register) points to 'this'
- loadPtr(Address(X86Registers::edx, -(int32_t)sizeof(Register)), X86Registers::edx);
-
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::esi);
-
- move(callFrameRegister, X86Registers::edi);
-
- call(Address(X86Registers::esi, OBJECT_OFFSETOF(JSFunction, m_data)));
-
- addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
-#elif CPU(X86)
- emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
-
- /* We have two structs that we use to describe the stackframe we set up for our
- * call to native code. NativeCallFrameStructure describes the how we set up the stack
- * in advance of the call. NativeFunctionCalleeSignature describes the callframe
- * as the native code expects it. We do this as we are using the fastcall calling
- * convention which results in the callee popping its arguments off the stack, but
- * not the rest of the callframe so we need a nice way to ensure we increment the
- * stack pointer by the right amount after the call.
- */
-#if COMPILER(MSVC) || OS(LINUX)
- struct NativeCallFrameStructure {
- // CallFrame* callFrame; // passed in EDX
- JSObject* callee;
- JSValue thisValue;
- ArgList* argPointer;
- ArgList args;
- JSValue result;
- };
- struct NativeFunctionCalleeSignature {
- JSObject* callee;
- JSValue thisValue;
- ArgList* argPointer;
- };
-#else
- struct NativeCallFrameStructure {
- // CallFrame* callFrame; // passed in ECX
- // JSObject* callee; // passed in EDX
- JSValue thisValue;
- ArgList* argPointer;
- ArgList args;
- };
- struct NativeFunctionCalleeSignature {
- JSValue thisValue;
- ArgList* argPointer;
- };
-#endif
- const int NativeCallFrameSize = (sizeof(NativeCallFrameStructure) + 15) & ~15;
- // Allocate system stack frame
- subPtr(Imm32(NativeCallFrameSize), stackPointerRegister);
-
- // Set up arguments
- subPtr(Imm32(1), regT0); // Don't include 'this' in argcount
-
- // push argcount
- storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, args) + OBJECT_OFFSETOF(ArgList, m_argCount)));
-
- // Calculate the start of the callframe header, and store in regT1
- addPtr(Imm32(-RegisterFile::CallFrameHeaderSize * (int)sizeof(Register)), callFrameRegister, regT1);
-
- // Calculate start of arguments as callframe header - sizeof(Register) * argcount (regT0)
- mul32(Imm32(sizeof(Register)), regT0, regT0);
- subPtr(regT0, regT1);
- storePtr(regT1, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, args) + OBJECT_OFFSETOF(ArgList, m_args)));
-
- // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
- addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, args)), stackPointerRegister, regT0);
- storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, argPointer)));
-
- // regT1 currently points to the first argument, regT1 - sizeof(Register) points to 'this'
- loadPtr(Address(regT1, -(int)sizeof(Register)), regT1);
- storePtr(regT1, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, thisValue)));
-
-#if COMPILER(MSVC) || OS(LINUX)
- // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
- addPtr(Imm32(OBJECT_OFFSETOF(NativeCallFrameStructure, result)), stackPointerRegister, X86Registers::ecx);
-
- // Plant callee
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::eax);
- storePtr(X86Registers::eax, Address(stackPointerRegister, OBJECT_OFFSETOF(NativeCallFrameStructure, callee)));
-
- // Plant callframe
- move(callFrameRegister, X86Registers::edx);
-
- call(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
-
- // JSValue is a non-POD type
- loadPtr(Address(X86Registers::eax), X86Registers::eax);
-#else
- // Plant callee
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::edx);
-
- // Plant callframe
- move(callFrameRegister, X86Registers::ecx);
- call(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
-#endif
-
- // We've put a few temporaries on the stack in addition to the actual arguments
- // so pull them off now
- addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister);
-
-#elif CPU(ARM)
- emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
-
- // Allocate stack space for our arglist
- COMPILE_ASSERT((sizeof(ArgList) & 0x7) == 0, ArgList_should_by_8byte_aligned);
- subPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
-
- // Set up arguments
- subPtr(Imm32(1), regT0); // Don't include 'this' in argcount
-
- // Push argcount
- storePtr(regT0, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_argCount)));
-
- // Calculate the start of the callframe header, and store in regT1
- move(callFrameRegister, regT1);
- sub32(Imm32(RegisterFile::CallFrameHeaderSize * (int32_t)sizeof(Register)), regT1);
-
- // Calculate start of arguments as callframe header - sizeof(Register) * argcount (regT1)
- mul32(Imm32(sizeof(Register)), regT0, regT0);
- subPtr(regT0, regT1);
-
- // push pointer to arguments
- storePtr(regT1, Address(stackPointerRegister, OBJECT_OFFSETOF(ArgList, m_args)));
-
- // regT1 currently points to the first argument, regT1-sizeof(Register) points to 'this'
-
-#if OS(WINCE)
- // Setup arg3:
- loadPtr(Address(regT1, -(int32_t)sizeof(Register)), ARMRegisters::r3);
-
- // Setup arg2:
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT2);
-
- // Setup arg1:
- move(callFrameRegister, regT1);
-
- // Setup arg0:
- move(stackPointerRegister, regT0);
- subPtr(Imm32(sizeof(Register)), stackPointerRegister);
- storePtr(regT0, Address(stackPointerRegister));
-
- call(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data)));
-
- loadPtr(Address(regT0), regT0);
-
- addPtr(Imm32(sizeof(Register) + sizeof(ArgList)), stackPointerRegister);
-#else // OS(WINCE)
- // Setup arg3:
- loadPtr(Address(regT1, -(int32_t)sizeof(Register)), regT2);
-
- // Setup arg2:
- emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT1);
-
- // Setup arg1:
- move(callFrameRegister, regT0);
-
- // Setup arg4: This is a plain hack
- move(stackPointerRegister, ARMRegisters::r3);
-
- call(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_data)));
-
- addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
-#endif // OS(WINCE)
-
-#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
-#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
-#else
- breakpoint();
-#endif
-
- // Check for an exception
- loadPtr(&(globalData->exception), regT2);
- Jump exceptionHandler = branchTestPtr(NonZero, regT2);
-
- // Grab the return address.
- emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
-
- // Restore our caller's "r".
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
-
- // Return.
- restoreReturnAddressBeforeReturn(regT1);
- ret();
-
- // Handle an exception
- exceptionHandler.link(this);
- // Grab the return address.
- emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
- move(ImmPtr(&globalData->exceptionLocation), regT2);
- storePtr(regT1, regT2);
- move(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()), regT2);
- emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
- poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
- restoreReturnAddressBeforeReturn(regT2);
- ret();
-
-
-#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()));
-
-#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
- patchBuffer.link(callArityCheck1, FunctionPtr(cti_op_call_arityCheck));
- patchBuffer.link(callJSFunction1, FunctionPtr(cti_op_call_JSFunction));
-#if ENABLE(JIT_OPTIMIZE_CALL)
- patchBuffer.link(callArityCheck2, FunctionPtr(cti_op_call_arityCheck));
- patchBuffer.link(callJSFunction2, FunctionPtr(cti_op_call_JSFunction));
- patchBuffer.link(callLazyLinkCall, FunctionPtr(cti_vm_lazyLinkCall));
-#endif
-
- CodeRef finalCode = patchBuffer.finalizeCode();
- *executablePool = finalCode.m_executablePool;
-
- trampolines->ctiVirtualCallLink = trampolineAt(finalCode, virtualCallLinkBegin);
- trampolines->ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
- trampolines->ctiNativeCallThunk = trampolineAt(finalCode, nativeCallThunk);
-#if ENABLE(JIT_OPTIMIZE_MOD)
- trampolines->ctiSoftModulo = trampolineAt(finalCode, softModBegin);
-#endif
-#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
- trampolines->ctiStringLengthTrampoline = trampolineAt(finalCode, stringLengthBegin);
-#else
- UNUSED_PARAM(ctiStringLengthTrampoline);
-#endif
-}
-
-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);
-#if USE(JSVALUE64)
- int32_t op2imm = getConstantOperandImmediateInt(op2);
-#else
- int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));
-#endif
- 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_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 baseVal & proto are cells.
- emitJumpSlowCaseIfNotJSCell(regT2, value);
- emitJumpSlowCaseIfNotJSCell(regT0, baseVal);
- emitJumpSlowCaseIfNotJSCell(regT1, proto);
-
- // 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_new_func(Instruction* currentInstruction)
-{
- JITStubCall stubCall(this, cti_op_new_func);
- stubCall.addArgument(ImmPtr(m_codeBlock->functionDecl(currentInstruction[2].u.operand)));
- stubCall.call(currentInstruction[1].u.operand);
-}
-
-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_load_varargs(Instruction* currentInstruction)
-{
- int argCountDst = currentInstruction[1].u.operand;
- int argsOffset = currentInstruction[2].u.operand;
-
- 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_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 = static_cast<JSVariableObject*>(currentInstruction[2].u.jsCell);
- move(ImmPtr(globalObject), regT0);
- emitGetVariableObjectRegister(regT0, currentInstruction[3].u.operand, regT0);
- emitPutVirtualRegister(currentInstruction[1].u.operand);
-}
-
-void JIT::emit_op_put_global_var(Instruction* currentInstruction)
-{
- emitGetVirtualRegister(currentInstruction[3].u.operand, regT1);
- JSVariableObject* globalObject = static_cast<JSVariableObject*>(currentInstruction[1].u.jsCell);
- move(ImmPtr(globalObject), regT0);
- emitPutVariableObjectRegister(regT1, regT0, currentInstruction[2].u.operand);
-}
-
-void JIT::emit_op_get_scoped_var(Instruction* currentInstruction)
-{
- int skip = currentInstruction[3].u.operand + m_codeBlock->needsFullScopeChain();
-
- emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT0);
- 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 + m_codeBlock->needsFullScopeChain();
-
- emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1);
- emitGetVirtualRegister(currentInstruction[3].u.operand, regT0);
- 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)
-{
- JITStubCall stubCall(this, cti_op_tear_off_activation);
- stubCall.addArgument(currentInstruction[1].u.operand, regT2);
- stubCall.call();
-}
-
-void JIT::emit_op_tear_off_arguments(Instruction*)
-{
- JITStubCall(this, cti_op_tear_off_arguments).call();
-}
-
-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())
- JITStubCall(this, cti_op_ret_scopeChain).call();
-
- 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_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_construct_verify(Instruction* currentInstruction)
-{
- emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
-
- emitJumpSlowCaseIfNotJSCell(regT0);
- loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
- addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
-
-}
-
-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, cti_op_resolve_base);
- 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 + m_codeBlock->needsFullScopeChain()));
- stubCall.call(currentInstruction[1].u.operand);
-}
-
-void JIT::emit_op_resolve_global(Instruction* currentInstruction)
-{
- // Fast case
- void* globalObject = currentInstruction[2].u.jsCell;
- Identifier* ident = &m_codeBlock->identifier(currentInstruction[3].u.operand);
-
- 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);
- Jump noMatch = 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);
- Jump end = jump();
-
- // Slow case
- noMatch.link(this);
- JITStubCall stubCall(this, cti_op_resolve_global);
- stubCall.addArgument(ImmPtr(globalObject));
- stubCall.addArgument(ImmPtr(ident));
- stubCall.addArgument(Imm32(currentIndex));
- stubCall.call(currentInstruction[1].u.operand);
- end.link(this);
-}
-
-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(m_globalData, 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);
- set32(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);
-#if USE(JSVALUE64)
- not32(regT0);
- emitFastArithIntToImmNoCheck(regT0, regT0);
-#else
- xorPtr(Imm32(~JSImmediate::TagTypeNumber), regT0);
-#endif
- 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(m_globalData, 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);
- set32(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_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_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()) {
- 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);
-
-#if USE(JSVALUE64)
- loadPtr(BaseIndex(regT2, regT0, TimesEight), regT2);
-#else
- loadPtr(BaseIndex(regT2, regT0, TimesFour), regT2);
-#endif
-
- 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)
- set32(Equal, regT1, regT0, regT0);
- else
- set32(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.
- peek(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
- 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_bytecodeIndex, 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_bytecodeIndex, 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_bytecodeIndex, defaultOffset));
-
- JITStubCall stubCall(this, cti_op_switch_string);
- stubCall.addArgument(scrutinee, regT2);
- stubCall.addArgument(Imm32(tableIndex));
- stubCall.call();
- jump(regT0);
-}
-
-void JIT::emit_op_new_error(Instruction* currentInstruction)
-{
- JITStubCall stubCall(this, cti_op_new_error);
- stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
- stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->getConstant(currentInstruction[3].u.operand))));
- stubCall.addArgument(Imm32(m_bytecodeIndex));
- stubCall.call(currentInstruction[1].u.operand);
-}
-
-void JIT::emit_op_debug(Instruction* currentInstruction)
-{
- 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();
-}
-
-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);
- setTest8(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);
- setTest8(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_enter_with_activation(Instruction* currentInstruction)
-{
- // 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);
-
- JITStubCall(this, cti_op_push_activation).call(currentInstruction[1].u.operand);
-}
-
-void JIT::emit_op_create_arguments(Instruction*)
-{
- Jump argsCreated = branchTestPtr(NonZero, Address(callFrameRegister, sizeof(Register) * RegisterFile::ArgumentsRegister));
- if (m_codeBlock->m_numParameters == 1)
- JITStubCall(this, cti_op_create_arguments_no_params).call();
- else
- JITStubCall(this, cti_op_create_arguments).call();
- argsCreated.link(this);
-}
-
-void JIT::emit_op_init_arguments(Instruction*)
-{
- storePtr(ImmPtr(0), Address(callFrameRegister, sizeof(Register) * RegisterFile::ArgumentsRegister));
-}
-
-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_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_construct_verify(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- linkSlowCase(iter);
- linkSlowCase(iter);
- emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
- emitPutVirtualRegister(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_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
- linkSlowCase(iter); // base array check
- 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::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_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, baseVal);
- linkSlowCaseIfNotJSCell(iter, proto);
- 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);
-}
-
-#endif // USE(JSVALUE32_64)
-
-// For both JSValue32_64 and JSValue32
-#if ENABLE(JIT_OPTIMIZE_MOD)
-#if CPU(ARM_TRADITIONAL)
-void JIT::softModulo()
-{
- push(regS0);
- push(regS1);
- push(regT1);
- push(regT3);
-#if USE(JSVALUE32_64)
- m_assembler.mov_r(regT3, regT2);
- m_assembler.mov_r(regT2, regT0);
-#else
- m_assembler.mov_r(regT3, m_assembler.asr(regT2, 1));
- m_assembler.mov_r(regT2, m_assembler.asr(regT0, 1));
-#endif
- m_assembler.mov_r(regT1, ARMAssembler::getOp2(0));
-
- m_assembler.teq_r(regT3, ARMAssembler::getOp2(0));
- m_assembler.rsb_r(regT3, regT3, ARMAssembler::getOp2(0), ARMAssembler::MI);
- m_assembler.eor_r(regT1, regT1, ARMAssembler::getOp2(1), ARMAssembler::MI);
-
- m_assembler.teq_r(regT2, ARMAssembler::getOp2(0));
- m_assembler.rsb_r(regT2, regT2, ARMAssembler::getOp2(0), ARMAssembler::MI);
- m_assembler.eor_r(regT1, regT1, ARMAssembler::getOp2(2), ARMAssembler::MI);
-
- Jump exitBranch = branch32(LessThan, regT2, regT3);
-
- m_assembler.sub_r(regS1, regT3, ARMAssembler::getOp2(1));
- m_assembler.tst_r(regS1, regT3);
- m_assembler.and_r(regT2, regT2, regS1, ARMAssembler::EQ);
- m_assembler.and_r(regT0, regS1, regT3);
- Jump exitBranch2 = branchTest32(Zero, regT0);
-
- m_assembler.clz_r(regS1, regT2);
- m_assembler.clz_r(regS0, regT3);
- m_assembler.sub_r(regS0, regS0, regS1);
-
- m_assembler.rsbs_r(regS0, regS0, ARMAssembler::getOp2(31));
-
- m_assembler.mov_r(regS0, m_assembler.lsl(regS0, 1), ARMAssembler::NE);
-
- m_assembler.add_r(ARMRegisters::pc, ARMRegisters::pc, m_assembler.lsl(regS0, 2), ARMAssembler::NE);
- m_assembler.mov_r(regT0, regT0);
-
- for (int i = 31; i > 0; --i) {
- m_assembler.cmp_r(regT2, m_assembler.lsl(regT3, i));
- m_assembler.sub_r(regT2, regT2, m_assembler.lsl(regT3, i), ARMAssembler::CS);
- }
-
- m_assembler.cmp_r(regT2, regT3);
- m_assembler.sub_r(regT2, regT2, regT3, ARMAssembler::CS);
-
- exitBranch.link(this);
- exitBranch2.link(this);
-
- m_assembler.teq_r(regT1, ARMAssembler::getOp2(0));
- m_assembler.rsb_r(regT2, regT2, ARMAssembler::getOp2(0), ARMAssembler::GT);
-
-#if USE(JSVALUE32_64)
- m_assembler.mov_r(regT0, regT2);
-#else
- m_assembler.mov_r(regT0, m_assembler.lsl(regT2, 1));
- m_assembler.eor_r(regT0, regT0, ARMAssembler::getOp2(1));
-#endif
- pop(regT3);
- pop(regT1);
- pop(regS1);
- pop(regS0);
- ret();
-}
-#else
-#error "JIT_OPTIMIZE_MOD not yet supported on this platform."
-#endif // CPU(ARM_TRADITIONAL)
-#endif
-} // namespace JSC
-
-#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp
deleted file mode 100644
index 3399f03..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp
+++ /dev/null
@@ -1,1058 +0,0 @@
-/*
- * 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 !USE(JSVALUE32_64)
-
-#include "JIT.h"
-
-#if ENABLE(JIT)
-
-#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 {
-
-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);
-#if USE(JSVALUE64)
- // 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);
-#else
- emitFastArithImmToInt(regT1);
-#endif
- 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::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);
-#if USE(JSVALUE64)
- // See comment in op_get_by_val.
- zeroExtend32ToPtr(regT1, regT1);
-#else
- emitFastArithImmToInt(regT1);
-#endif
- 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;
-
- emitGetVirtualRegisters(baseVReg, regT0, valueVReg, regT1);
-
- JITStubCall stubCall(this, 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_bytecodeIndex += 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_bytecodeIndex += 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 propertyAccessInstructionIndex = m_propertyAccessInstructionIndex++;
-
- linkSlowCaseIfNotJSCell(iter, baseVReg);
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, 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(Structure* structure, JumpList& failureCases)
-{
- if (structure->m_prototype.isNull())
- return;
-
- move(ImmPtr(&asCell(structure->m_prototype)->m_structure), regT2);
- move(ImmPtr(asCell(structure->m_prototype)->m_structure), regT3);
- failureCases.append(branchPtr(NotEqual, Address(regT2), regT3));
-}
-
-void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress)
-{
- 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, failureCases);
-
- // ecx = baseObject->m_structure
- for (RefPtr<Structure>* it = chain->head(); *it; ++it)
- testPrototype(it->get(), 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());
-
- patchBuffer.link(failureCall, FunctionPtr(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)
-{
- 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(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)), regT2);
- load32(Address(regT2, 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());
-
- // 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());
-
- // 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());
-
- 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());
-
- 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>* chainEntries = chain->head();
- JSObject* protoObject = 0;
- for (unsigned i = 0; i < count; ++i) {
- protoObject = asObject(currStructure->prototypeForLookup(callFrame));
- currStructure = chainEntries[i].get();
-
- // Check the prototype object's Structure had not changed.
- Structure** prototypeStructureAddress = &(protoObject->m_structure);
-#if CPU(X86_64)
- move(ImmPtr(currStructure), regT3);
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3));
-#else
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(currStructure)));
-#endif
- }
- 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());
-
- 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>* chainEntries = chain->head();
- JSObject* protoObject = 0;
- for (unsigned i = 0; i < count; ++i) {
- protoObject = asObject(currStructure->prototypeForLookup(callFrame));
- currStructure = chainEntries[i].get();
-
- // Check the prototype object's Structure had not changed.
- Structure** prototypeStructureAddress = &(protoObject->m_structure);
-#if CPU(X86_64)
- move(ImmPtr(currStructure), regT3);
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3));
-#else
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(currStructure)));
-#endif
- }
- 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());
-
- 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 // ENABLE(JIT)
-
-#endif // !USE(JSVALUE32_64)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
deleted file mode 100644
index ec33026..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
+++ /dev/null
@@ -1,1145 +0,0 @@
-/*
- * 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 USE(JSVALUE32_64)
-
-#include "JIT.h"
-
-#if ENABLE(JIT)
-
-#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_bytecodeIndex + 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_bytecodeIndex += 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_bytecodeIndex += 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_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]) + 4), regT1); // tag
- load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0); // payload
- addSlowCase(branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag)));
-
- emitStore(dst, regT1, regT0);
- map(m_bytecodeIndex + 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
- linkSlowCase(iter); // base array check
- 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]) + 4), Imm32(JSValue::EmptyValueTag));
-
- Label storeResult(this);
- emitLoad(value, regT1, regT0);
- store32(regT0, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]))); // payload
- store32(regT1, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + 4)); // 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_bytecodeIndex + 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;
-
- linkSlowCaseIfNotJSCell(iter, base);
- linkSlowCase(iter);
-
- JITStubCall stubCall(this, 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]), resultPayload);
- load32(reinterpret_cast<char*>(&base->m_inlineStorage[cachedOffset]) + 4, resultTag);
- return;
- }
-
- size_t offset = cachedOffset * sizeof(JSValue);
-
- PropertyStorage* protoPropertyStorage = &base->m_externalStorage;
- loadPtr(static_cast<void*>(protoPropertyStorage), temp);
- load32(Address(temp, offset), resultPayload);
- load32(Address(temp, offset + 4), resultTag);
-}
-
-void JIT::testPrototype(Structure* structure, JumpList& failureCases)
-{
- if (structure->m_prototype.isNull())
- return;
-
- failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&asCell(structure->m_prototype)->m_structure), ImmPtr(asCell(structure->m_prototype)->m_structure)));
-}
-
-void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress)
-{
- // 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, failureCases);
-
- // Verify that nothing in the prototype chain has a setter for this property.
- for (RefPtr<Structure>* it = chain->head(); *it; ++it)
- testPrototype(it->get(), 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)));
-
- load32(Address(stackPointerRegister, offsetof(struct JITStackFrame, args[2]) + sizeof(void*)), regT3);
- load32(Address(stackPointerRegister, offsetof(struct JITStackFrame, args[2]) + sizeof(void*) + 4), regT2);
-
- // 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());
-
- patchBuffer.link(failureCall, FunctionPtr(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); // payload
- repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset2), offset + 4); // 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)
-{
- 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(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); // payload
- repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset2), offset + 4); // 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());
-
- // 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());
-
- // 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());
- 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());
- 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>* chainEntries = chain->head();
- JSObject* protoObject = 0;
- for (unsigned i = 0; i < count; ++i) {
- protoObject = asObject(currStructure->prototypeForLookup(callFrame));
- currStructure = chainEntries[i].get();
-
- // Check the prototype object's Structure had not changed.
- Structure** prototypeStructureAddress = &(protoObject->m_structure);
-#if CPU(X86_64)
- move(ImmPtr(currStructure), regT3);
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3));
-#else
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(currStructure)));
-#endif
- }
- 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());
- 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>* chainEntries = chain->head();
- JSObject* protoObject = 0;
- for (unsigned i = 0; i < count; ++i) {
- protoObject = asObject(currStructure->prototypeForLookup(callFrame));
- currStructure = chainEntries[i].get();
-
- // Check the prototype object's Structure had not changed.
- Structure** prototypeStructureAddress = &(protoObject->m_structure);
-#if CPU(X86_64)
- move(ImmPtr(currStructure), regT3);
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3));
-#else
- bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(currStructure)));
-#endif
- }
- 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());
- 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_bytecodeIndex + 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 // ENABLE(JIT)
-
-#endif // ENABLE(JSVALUE32_64)
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubCall.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubCall.h
deleted file mode 100644
index cfbd7dc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubCall.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * 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;
- }
-
- 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;
- }
-
- 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_bytecodeIndex != (unsigned)-1)
- m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeIndex, true);
-#endif
-
- m_jit->restoreArgumentReference();
- JIT::Call call = m_jit->call();
- m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeIndex, m_stub.value()));
-
-#if ENABLE(OPCODE_SAMPLING)
- if (m_jit->m_bytecodeIndex != (unsigned)-1)
- m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeIndex, 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/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
deleted file mode 100644
index 23fcb96..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
+++ /dev/null
@@ -1,3152 +0,0 @@
-/*
- * 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 "JITStubs.h"
-
-#if ENABLE(JIT)
-
-#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 "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(IPHONE_OS)
-#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"
-#else
-#define SYMBOL_STRING_RELOCATION(name) SYMBOL_STRING(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);
-
-static void __attribute__((used)) asm_wrapper()
-{
- asm volatile (
- ".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 volatile (
- ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
- HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
- SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
-#if !USE(JIT_STUB_ARGUMENT_VA_LIST)
- "movl %esp, %ecx" "\n"
-#endif
- "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
- "addl $0x3c, %esp" "\n"
- "popl %ebx" "\n"
- "popl %edi" "\n"
- "popl %esi" "\n"
- "popl %ebp" "\n"
- "ret" "\n"
- );
-
- asm volatile (
- ".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)
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-#error "JIT_STUB_ARGUMENT_VA_LIST not supported on x86-64."
-#endif
-
-// 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 volatile (
-".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 volatile (
-".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"
- "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 volatile (
-".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)
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-#error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7."
-#endif
-
-#define THUNK_RETURN_ADDRESS_OFFSET 0x3C
-#define PRESERVED_RETURN_ADDRESS_OFFSET 0x40
-#define PRESERVED_R4_OFFSET 0x44
-#define PRESERVED_R5_OFFSET 0x48
-#define PRESERVED_R6_OFFSET 0x4C
-#define REGISTER_FILE_OFFSET 0x50
-#define CALLFRAME_OFFSET 0x54
-#define EXCEPTION_OFFSET 0x58
-#define ENABLE_PROFILER_REFERENCE_OFFSET 0x64
-
-#elif COMPILER(GCC) && CPU(ARM_TRADITIONAL)
-
-#define THUNK_RETURN_ADDRESS_OFFSET 64
-#define PRESERVEDR4_OFFSET 68
-
-#elif COMPILER(MSVC) && CPU(X86)
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-#error "JIT_STUB_ARGUMENT_VA_LIST configuration not supported on MSVC."
-#endif
-
-// 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*, JSValue* exception, 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;
- }
- }
-}
-
-#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 volatile (
-".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 volatile (
-".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
-HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
-SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
-#if !USE(JIT_STUB_ARGUMENT_VA_LIST)
- "movl %esp, %ecx" "\n"
-#endif
- "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
- "addl $0x1c, %esp" "\n"
- "popl %ebx" "\n"
- "popl %edi" "\n"
- "popl %esi" "\n"
- "popl %ebp" "\n"
- "ret" "\n"
-);
-
-asm volatile (
-".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)
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-#error "JIT_STUB_ARGUMENT_VA_LIST not supported on x86-64."
-#endif
-
-// 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 volatile (
-".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 volatile (
-".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"
- "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 volatile (
-".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)
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-#error "JIT_STUB_ARGUMENT_VA_LIST not supported on ARMv7."
-#endif
-
-#define THUNK_RETURN_ADDRESS_OFFSET 0x1C
-#define PRESERVED_RETURN_ADDRESS_OFFSET 0x20
-#define PRESERVED_R4_OFFSET 0x24
-#define PRESERVED_R5_OFFSET 0x28
-#define PRESERVED_R6_OFFSET 0x2C
-#define REGISTER_FILE_OFFSET 0x30
-#define CALLFRAME_OFFSET 0x34
-#define EXCEPTION_OFFSET 0x38
-#define ENABLE_PROFILER_REFERENCE_OFFSET 0x40
-
-#elif COMPILER(GCC) && CPU(ARM_TRADITIONAL)
-
-#define THUNK_RETURN_ADDRESS_OFFSET 32
-#define PRESERVEDR4_OFFSET 36
-
-#elif COMPILER(RVCT) && CPU(ARM_TRADITIONAL)
-
-__asm EncodedJSValue ctiTrampoline(void*, RegisterFile*, CallFrame*, JSValue*, Profiler**, JSGlobalData*)
-{
- ARM
- stmdb sp!, {r1-r3}
- stmdb sp!, {r4-r8, lr}
- sub sp, sp, #36
- mov r4, r2
- mov r5, #512
- mov lr, pc
- bx r0
- add sp, sp, #36
- 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, #36
- ldmia sp!, {r4-r8, lr}
- add sp, sp, #12
- bx lr
-}
-
-__asm void ctiOpThrowNotCaught()
-{
- ARM
- add sp, sp, #36
- ldmia sp!, {r4-r8, lr}
- add sp, sp, #12
- bx lr
-}
-
-#elif COMPILER(MSVC) && CPU(X86)
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-#error "JIT_STUB_ARGUMENT_VA_LIST configuration not supported on MSVC."
-#endif
-
-// 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*, JSValue* exception, 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;
- }
- }
-}
-
-#else
- #error "JIT not supported on this platform."
-#endif
-
-#endif // USE(JSVALUE32_64)
-
-#if COMPILER(GCC) && CPU(ARM_THUMB2)
-
-asm volatile(
-".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 volatile(
-".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 volatile(
-".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 volatile(
-".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 volatile(
-".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"
-);
-
-#endif
-
-#if ENABLE(OPCODE_SAMPLING)
- #define CTI_SAMPLER stackFrame.globalData->interpreter->sampler()
-#else
- #define CTI_SAMPLER 0
-#endif
-
-JITThunks::JITThunks(JSGlobalData* globalData)
-{
- JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_trampolineStructure);
-
-#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);
- ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, exception) == EXCEPTION_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);
-
-#endif
-}
-
-#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
-
-NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, ReturnAddressPtr returnAddress, JSValue baseValue, const PutPropertySlot& slot, StructureStubInfo* stubInfo)
-{
- // 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(cti_op_put_by_id_generic));
- return;
- }
-
- JSCell* baseCell = asCell(baseValue);
- Structure* structure = baseCell->structure();
-
- if (structure->isUncacheableDictionary()) {
- ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(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(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(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);
- return;
- }
-
- stubInfo->initPutByIdReplace(structure);
-
- JIT::patchPutByIdReplace(codeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress);
-}
-
-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 = asCell(baseValue);
- 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)
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
-#define SETUP_VA_LISTL_ARGS va_list vl_args; va_start(vl_args, args)
-#else
-#define SETUP_VA_LISTL_ARGS
-#endif
-
-#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) SETUP_VA_LISTL_ARGS; JITStackFrame& stackFrame = *reinterpret_cast<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) SETUP_VA_LISTL_ARGS; JITStackFrame& stackFrame = *reinterpret_cast<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() \
- returnToThrowTrampoline(stackFrame.globalData, STUB_RETURN_ADDRESS, STUB_RETURN_ADDRESS)
-
-#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)
-
-#if CPU(ARM_THUMB2)
-
-#define DEFINE_STUB_FUNCTION(rtype, op) \
- extern "C" { \
- rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
- }; \
- asm volatile ( \
- ".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(ARM_TRADITIONAL) && COMPILER(GCC)
-
-#define DEFINE_STUB_FUNCTION(rtype, op) \
- extern "C" { \
- rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
- }; \
- asm volatile ( \
- ".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, ##offset#])
-RVCT( bl JITStubThunked_#op#)
-RVCT( ldr lr, [sp, ##offset#])
-RVCT( bx lr)
-RVCT(})
-RVCT()
-*/
-
-/* Include the generated file */
-#include "GeneratedJITStubs_RVCT.h"
-
-#else
-#define DEFINE_STUB_FUNCTION(rtype, op) rtype JIT_STUB cti_##op(STUB_ARGS_DECLARATION)
-#endif
-
-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(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(stackFrame.globalData, 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(stackFrame.globalData, 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 (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);
-
- if (LIKELY(stackFrame.registerFile->grow(&stackFrame.callFrame->registers()[stackFrame.callFrame->codeBlock()->m_numCalleeRegisters])))
- return;
-
- // Rewind to the previous call frame because op_call already optimistically
- // moved the call frame forward.
- CallFrame* oldCallFrame = stackFrame.callFrame->callerFrame();
- stackFrame.callFrame = oldCallFrame;
- throwStackOverflowError(oldCallFrame, stackFrame.globalData, ReturnAddressPtr(oldCallFrame->returnPC()), STUB_RETURN_ADDRESS);
-}
-
-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.args[0].jsValue().put(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;
- 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);
-
- 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;
- stackFrame.args[0].jsValue().put(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 = asCell(baseValue)->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()
- && !asCell(baseValue)->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, asCell(baseValue)->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() || asCell(baseValue)->structure()->isDictionary()) {
- ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
- return JSValue::encode(result);
- }
-
- Structure* structure = asCell(baseValue)->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() == asCell(baseValue)->structure()->prototypeForLookup(callFrame)) {
- ASSERT(!asCell(baseValue)->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(!asCell(baseValue)->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(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()) {
- CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, vPCIndex, codeBlock);
- VM_THROW_EXCEPTION();
- }
- ASSERT(typeInfo.type() != UnspecifiedType);
-
- if (!typeInfo.overridesHasInstance()) {
- if (!value.isObject())
- return JSValue::encode(jsBoolean(false));
-
- if (!proto.isObject()) {
- throwError(callFrame, TypeError, "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);
-
- JSValue result = jsBoolean(baseObj->deleteProperty(callFrame, stackFrame.args[1].identifier()));
- 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(stackFrame.globalData, left * right));
-
- CallFrame* callFrame = stackFrame.callFrame;
- JSValue result = jsNumber(stackFrame.globalData, 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);
-
- return stackFrame.args[0].function()->make(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
-}
-
-DEFINE_STUB_FUNCTION(void*, op_call_JSFunction)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
-#if !ASSERT_DISABLED
- CallData callData;
- ASSERT(stackFrame.args[0].jsValue().getCallData(callData) == CallTypeJS);
-#endif
-
- JSFunction* function = asFunction(stackFrame.args[0].jsValue());
- ASSERT(!function->isHostFunction());
- FunctionExecutable* executable = function->jsExecutable();
- ScopeChainNode* callDataScopeChain = function->scope().node();
- executable->jitCode(stackFrame.callFrame, callDataScopeChain);
-
- return function;
-}
-
-DEFINE_STUB_FUNCTION(VoidPtrPair, op_call_arityCheck)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
- JSFunction* callee = asFunction(stackFrame.args[0].jsValue());
- ASSERT(!callee->isHostFunction());
- CodeBlock* newCodeBlock = &callee->jsExecutable()->generatedBytecode();
- int argCount = stackFrame.args[2].int32();
-
- ASSERT(argCount != newCodeBlock->m_numParameters);
-
- CallFrame* oldCallFrame = callFrame->callerFrame();
-
- if (argCount > newCodeBlock->m_numParameters) {
- size_t numParameters = newCodeBlock->m_numParameters;
- Register* r = callFrame->registers() + numParameters;
-
- Register* argv = r - RegisterFile::CallFrameHeaderSize - numParameters - argCount;
- for (size_t i = 0; i < numParameters; ++i)
- argv[i + argCount] = argv[i];
-
- callFrame = CallFrame::create(r);
- callFrame->setCallerFrame(oldCallFrame);
- } else {
- size_t omittedArgCount = newCodeBlock->m_numParameters - argCount;
- Register* 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.
- stackFrame.callFrame = oldCallFrame;
- throwStackOverflowError(oldCallFrame, stackFrame.globalData, stackFrame.args[1].returnAddress(), STUB_RETURN_ADDRESS);
- RETURN_POINTER_PAIR(0, 0);
- }
-
- Register* argv = r - RegisterFile::CallFrameHeaderSize - omittedArgCount;
- for (size_t i = 0; i < omittedArgCount; ++i)
- argv[i] = jsUndefined();
-
- callFrame = CallFrame::create(r);
- callFrame->setCallerFrame(oldCallFrame);
- }
-
- RETURN_POINTER_PAIR(callee, callFrame);
-}
-
-#if ENABLE(JIT_OPTIMIZE_CALL)
-DEFINE_STUB_FUNCTION(void*, vm_lazyLinkCall)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
- JSFunction* callee = asFunction(stackFrame.args[0].jsValue());
- ExecutableBase* executable = callee->executable();
- JITCode& jitCode = executable->generatedJITCode();
-
- CodeBlock* codeBlock = 0;
- if (!executable->isHostFunction())
- codeBlock = &static_cast<FunctionExecutable*>(executable)->bytecode(stackFrame.callFrame, callee->scope().node());
- CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(stackFrame.args[1].returnAddress());
-
- if (!callLinkInfo->seenOnce())
- callLinkInfo->setSeen();
- else
- JIT::linkCall(callee, stackFrame.callFrame->callerFrame()->codeBlock(), codeBlock, jitCode, callLinkInfo, stackFrame.args[2].int32(), stackFrame.globalData);
-
- return jitCode.addressForCall().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 = funcVal.getCallData(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);
-
- callFrame->init(0, static_cast<Instruction*>((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, 0, argCount, 0);
- stackFrame.callFrame = callFrame;
-
- Register* argv = stackFrame.callFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
- ArgList argList(argv + 1, argCount - 1);
-
- JSValue returnValue;
- {
- SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
-
- // FIXME: All host methods should be calling toThisObject, but this is not presently the case.
- JSValue thisValue = argv[0].jsValue();
- if (thisValue == jsNull())
- thisValue = callFrame->globalThisValue();
-
- returnValue = callData.native.function(callFrame, asObject(funcVal), thisValue, argList);
- }
- stackFrame.callFrame = previousCallFrame;
- CHECK_FOR_EXCEPTION();
-
- return JSValue::encode(returnValue);
- }
-
- ASSERT(callType == CallTypeNone);
-
- CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createNotAFunctionError(stackFrame.callFrame, funcVal, vPCIndex, codeBlock);
- VM_THROW_EXCEPTION();
-}
-
-DEFINE_STUB_FUNCTION(void, op_create_arguments)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame);
- stackFrame.callFrame->setCalleeArguments(arguments);
- stackFrame.callFrame[RegisterFile::ArgumentsRegister] = JSValue(arguments);
-}
-
-DEFINE_STUB_FUNCTION(void, op_create_arguments_no_params)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame, Arguments::NoParameters);
- stackFrame.callFrame->setCalleeArguments(arguments);
- stackFrame.callFrame[RegisterFile::ArgumentsRegister] = JSValue(arguments);
-}
-
-DEFINE_STUB_FUNCTION(void, op_tear_off_activation)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- ASSERT(stackFrame.callFrame->codeBlock()->needsFullScopeChain());
- asActivation(stackFrame.args[0].jsValue())->copyRegisters(stackFrame.callFrame->optionalCalleeArguments());
-}
-
-DEFINE_STUB_FUNCTION(void, op_tear_off_arguments)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- ASSERT(stackFrame.callFrame->codeBlock()->usesArguments() && !stackFrame.callFrame->codeBlock()->needsFullScopeChain());
- if (stackFrame.callFrame->optionalCalleeArguments())
- stackFrame.callFrame->optionalCalleeArguments()->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);
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, codeBlock);
- VM_THROW_EXCEPTION();
-}
-
-DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- JSFunction* constructor = asFunction(stackFrame.args[0].jsValue());
- if (constructor->isHostFunction()) {
- CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createNotAConstructorError(callFrame, constructor, vPCIndex, codeBlock);
- VM_THROW_EXCEPTION();
- }
-
-#if !ASSERT_DISABLED
- ConstructData constructData;
- ASSERT(constructor->getConstructData(constructData) == ConstructTypeJS);
-#endif
-
- Structure* structure;
- if (stackFrame.args[3].jsValue().isObject())
- structure = asObject(stackFrame.args[3].jsValue())->inheritorID();
- else
- structure = constructor->scope().node()->globalObject->emptyObjectStructure();
- return new (stackFrame.globalData) JSObject(structure);
-}
-
-DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
-
- JSValue constrVal = stackFrame.args[0].jsValue();
- int argCount = stackFrame.args[2].int32();
- int thisRegister = stackFrame.args[4].int32();
-
- ConstructData constructData;
- ConstructType constructType = constrVal.getConstructData(constructData);
-
- if (constructType == ConstructTypeHost) {
- ArgList argList(callFrame->registers() + thisRegister + 1, argCount - 1);
-
- JSValue returnValue;
- {
- SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
- returnValue = constructData.native.function(callFrame, asObject(constrVal), argList);
- }
- CHECK_FOR_EXCEPTION();
-
- return JSValue::encode(returnValue);
- }
-
- ASSERT(constructType == ConstructTypeNone);
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createNotAConstructorError(callFrame, constrVal, vPCIndex, codeBlock);
- 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();
-
- 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)) {
- // 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_string));
- result = asString(baseValue)->getIndex(callFrame, i);
- } else 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));
- } else
- result = baseValue.get(callFrame, i);
- } 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_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(stackFrame.globalData, left - right));
-
- CallFrame* callFrame = stackFrame.callFrame;
- JSValue result = jsNumber(stackFrame.globalData, 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;
- 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;
- 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 = 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()) {
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPCIndex, codeBlock);
- 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 {
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPCIndex, codeBlock);
- 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(stackFrame.globalData, -v));
-
- CallFrame* callFrame = stackFrame.callFrame;
- JSValue result = jsNumber(stackFrame.globalData, -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()));
-}
-
-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);
- 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);
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, codeBlock);
- VM_THROW_EXCEPTION();
-}
-
-DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_global)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
- JSGlobalObject* globalObject = stackFrame.args[0].globalObject();
- Identifier& ident = stackFrame.args[1].identifier();
- unsigned globalResolveInfoIndex = stackFrame.args[2].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 = callFrame->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);
- }
-
- unsigned vPCIndex = callFrame->codeBlock()->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, callFrame->codeBlock());
- 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(stackFrame.globalData, left / right));
-
- CallFrame* callFrame = stackFrame.callFrame;
- JSValue result = jsNumber(stackFrame.globalData, 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(stackFrame.globalData, 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(stackFrame.globalData, 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() && asCell(src1)->structure()->typeInfo().masqueradesAsUndefined()) ||
- src1.isUndefined();
- }
-
- if (src2.isNull()) {
- return src1.isUndefined() ||
- (src1.isCell() && asCell(src1)->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() && asCell(src2)->structure()->typeInfo().masqueradesAsUndefined();
-
- if (src1.isNull())
- return src2.isCell() && asCell(src2)->structure()->typeInfo().masqueradesAsUndefined();
-
- JSCell* cell1 = asCell(src1);
-
- if (cell1->isString()) {
- if (src2.isInt32())
- return static_cast<JSString*>(cell1)->value(stackFrame.callFrame).toDouble() == src2.asInt32();
-
- if (src2.isDouble())
- return static_cast<JSString*>(cell1)->value(stackFrame.callFrame).toDouble() == src2.asDouble();
-
- if (src2.isTrue())
- return static_cast<JSString*>(cell1)->value(stackFrame.callFrame).toDouble() == 1.0;
-
- if (src2.isFalse())
- return static_cast<JSString*>(cell1)->value(stackFrame.callFrame).toDouble() == 0.0;
-
- JSCell* cell2 = asCell(src2);
- 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(stackFrame.globalData, (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(stackFrame.globalData, 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(stackFrame.globalData, (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(stackFrame.globalData, ~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);
-
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident, vPCIndex, codeBlock);
- 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());
-
- /*
- 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(stackFrame.globalData, 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(stackFrame.globalData, 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(stackFrame.globalData, (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(stackFrame.globalData, 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()->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(stackFrame.globalData, 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);
-
- 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 thisValue = argv[0].jsValue();
- JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject;
-
- if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
- JSValue exceptionValue;
- JSValue result = interpreter->callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
- if (UNLIKELY(exceptionValue)) {
- stackFrame.globalData->exception = exceptionValue;
- VM_THROW_EXCEPTION_AT_END();
- }
- return JSValue::encode(result);
- }
-
- return JSValue::encode(JSValue());
-}
-
-DEFINE_STUB_FUNCTION(EncodedJSValue, op_throw)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
-
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
-
- JSValue exceptionValue = stackFrame.args[0].jsValue();
- ASSERT(exceptionValue);
-
- HandlerInfo* handler = stackFrame.globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex, true);
-
- if (!handler) {
- *stackFrame.exception = exceptionValue;
- STUB_SET_RETURN_ADDRESS(FunctionPtr(ctiOpThrowNotCaught).value());
- return JSValue::encode(jsNull());
- }
-
- stackFrame.callFrame = callFrame;
- void* catchRoutine = handler->nativeCode.executableAddress();
- ASSERT(catchRoutine);
- STUB_SET_RETURN_ADDRESS(catchRoutine);
- return JSValue::encode(exceptionValue);
-}
-
-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();
- return base->hasProperty(stackFrame.callFrame, Identifier(stackFrame.callFrame, property->value(stackFrame.callFrame)));
-}
-
-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();
-
- return JSValue::encode(jsBoolean(JSValue::strictEqual(stackFrame.callFrame, src1, src2)));
-}
-
-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();
-
- return JSValue::encode(jsBoolean(!JSValue::strictEqual(stackFrame.callFrame, src1, src2)));
-}
-
-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()) {
- CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
- stackFrame.globalData->exception = createInvalidParamError(callFrame, "in", baseVal, vPCIndex, codeBlock);
- 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()) {
- UString::Rep* value = asString(scrutinee)->value(callFrame).rep();
- if (value->length() == 1)
- result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue(value->characters()[0]).executableAddress();
- }
-
- 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()) {
- UString::Rep* value = asString(scrutinee)->value(callFrame).rep();
- result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value).executableAddress();
- }
-
- 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();
- JSValue result;
- uint32_t i;
- if (subscript.getUInt32(i))
- result = jsBoolean(baseObj->deleteProperty(callFrame, i));
- else {
- CHECK_FOR_EXCEPTION();
- Identifier property(callFrame, subscript.toString(callFrame));
- CHECK_FOR_EXCEPTION();
- result = jsBoolean(baseObj->deleteProperty(callFrame, property));
- }
-
- CHECK_FOR_EXCEPTION_AT_END();
- return JSValue::encode(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(JSObject*, op_new_error)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned type = stackFrame.args[0].int32();
- JSValue message = stackFrame.args[1].jsValue();
- unsigned bytecodeOffset = stackFrame.args[2].int32();
-
- unsigned lineNumber = codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset);
- return Error::create(callFrame, static_cast<ErrorType>(type), message.toString(callFrame), lineNumber, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
-}
-
-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(EncodedJSValue, vm_throw)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
- CodeBlock* codeBlock = callFrame->codeBlock();
- JSGlobalData* globalData = stackFrame.globalData;
-
- unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, globalData->exceptionLocation);
-
- JSValue exceptionValue = globalData->exception;
- ASSERT(exceptionValue);
- globalData->exception = JSValue();
-
- HandlerInfo* handler = globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex, false);
-
- if (!handler) {
- *stackFrame.exception = exceptionValue;
- return JSValue::encode(jsNull());
- }
-
- stackFrame.callFrame = callFrame;
- void* catchRoutine = handler->nativeCode.executableAddress();
- ASSERT(catchRoutine);
- STUB_SET_RETURN_ADDRESS(catchRoutine);
- return JSValue::encode(exceptionValue);
-}
-
-DEFINE_STUB_FUNCTION(EncodedJSValue, to_object)
-{
- STUB_INIT_STACK_FRAME(stackFrame);
-
- CallFrame* callFrame = stackFrame.callFrame;
- return JSValue::encode(stackFrame.args[0].jsValue().toObject(callFrame));
-}
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
deleted file mode 100644
index cf3a7f8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * 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 JITStubs_h
-#define JITStubs_h
-
-#include "MacroAssemblerCodeRef.h"
-#include "Register.h"
-
-#if ENABLE(JIT)
-
-namespace JSC {
-
- struct StructureStubInfo;
-
- class CodeBlock;
- class ExecutablePool;
- class FunctionExecutable;
- class Identifier;
- class JSGlobalData;
- class JSGlobalData;
- class JSObject;
- class JSPropertyNameIterator;
- class JSValue;
- class JSValueEncodedAsPointer;
- class Profiler;
- class PropertySlot;
- class PutPropertySlot;
- class RegisterFile;
- class JSGlobalObject;
- 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 ctiVirtualCall;
- MacroAssemblerCodePtr ctiNativeCallThunk;
- 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;
- JSValue* exception;
- 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;
- JSValue* exception;
- 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 {
- void* reserved; // Unused
- JITStubArg args[6];
-#if USE(JSVALUE32_64)
- void* padding[2]; // 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;
- JSValue* exception;
-
- void* padding2;
-
- // These arguments passed on the stack.
- Profiler** enabledProfilerReference;
- JSGlobalData* globalData;
-
- ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; }
- };
-#elif CPU(ARM_TRADITIONAL)
- 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;
- JSValue* exception;
-
- // 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; }
- };
-#else
-#error "JITStackFrame not defined for this platform."
-#endif
-
-#define JITSTACKFRAME_ARGS_INDEX (OBJECT_OFFSETOF(JITStackFrame, args) / sizeof(void*))
-
-#if USE(JIT_STUB_ARGUMENT_VA_LIST)
- #define STUB_ARGS_DECLARATION void* args, ...
- #define STUB_ARGS (reinterpret_cast<void**>(vl_args) - 1)
-
- #if COMPILER(MSVC)
- #define JIT_STUB __cdecl
- #else
- #define JIT_STUB
- #endif
-#else
- #define STUB_ARGS_DECLARATION void** args
- #define STUB_ARGS (args)
-
- #if CPU(X86) && COMPILER(MSVC)
- #define JIT_STUB __fastcall
- #elif CPU(X86) && COMPILER(GCC)
- #define JIT_STUB __attribute__ ((fastcall))
- #else
- #define JIT_STUB
- #endif
-#endif
-
-#if CPU(X86_64)
- struct VoidPtrPair {
- void* first;
- void* second;
- };
- #define RETURN_POINTER_PAIR(a,b) VoidPtrPair pair = { a, b }; return pair
-#else
- // MSVC doesn't support returning a two-value struct in two registers, so
- // we cast the struct to int64_t instead.
- typedef uint64_t VoidPtrPair;
- union VoidPtrPairUnion {
- struct { void* first; void* second; } s;
- VoidPtrPair i;
- };
- #define RETURN_POINTER_PAIR(a,b) VoidPtrPairUnion pair = {{ a, b }}; return pair.i
-#endif
-
- extern "C" void ctiVMThrowTrampoline();
- extern "C" void ctiOpThrowNotCaught();
- extern "C" EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue* exception, Profiler**, JSGlobalData*);
-
- class JITThunks {
- public:
- JITThunks(JSGlobalData*);
-
- 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);
-
- MacroAssemblerCodePtr ctiStringLengthTrampoline() { return m_trampolineStructure.ctiStringLengthTrampoline; }
- MacroAssemblerCodePtr ctiVirtualCallLink() { return m_trampolineStructure.ctiVirtualCallLink; }
- MacroAssemblerCodePtr ctiVirtualCall() { return m_trampolineStructure.ctiVirtualCall; }
- MacroAssemblerCodePtr ctiNativeCallThunk() { return m_trampolineStructure.ctiNativeCallThunk; }
- MacroAssemblerCodePtr ctiSoftModulo() { return m_trampolineStructure.ctiSoftModulo; }
-
- private:
- 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_convert_this(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_generic(STUB_ARGS_DECLARATION);
- EncodedJSValue JIT_STUB cti_op_get_by_id_method_check(STUB_ARGS_DECLARATION);
- EncodedJSValue JIT_STUB cti_op_get_by_id_getter_stub(STUB_ARGS_DECLARATION);
- EncodedJSValue JIT_STUB cti_op_get_by_id_custom_stub(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_global(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_throw(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_vm_throw(STUB_ARGS_DECLARATION);
- EncodedJSValue JIT_STUB cti_to_object(STUB_ARGS_DECLARATION);
- JSObject* JIT_STUB cti_op_construct_JSConstruct(STUB_ARGS_DECLARATION);
- JSObject* JIT_STUB cti_op_new_array(STUB_ARGS_DECLARATION);
- JSObject* JIT_STUB cti_op_new_error(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);
- VoidPtrPair JIT_STUB cti_op_call_arityCheck(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_create_arguments(STUB_ARGS_DECLARATION);
- void JIT_STUB cti_op_create_arguments_no_params(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_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_register_file_check(STUB_ARGS_DECLARATION);
- void* JIT_STUB cti_op_call_JSFunction(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_vm_lazyLinkCall(STUB_ARGS_DECLARATION);
-} // extern "C"
-
-} // namespace JSC
-
-#endif // ENABLE(JIT)
-
-#endif // JITStubs_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/jsc.cpp b/src/3rdparty/webkit/JavaScriptCore/jsc.cpp
deleted file mode 100644
index 252fb96..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/jsc.cpp
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * 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 "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 JSValue JSC_HOST_CALL functionPrint(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionDebug(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionGC(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionVersion(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionRun(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionLoad(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionCheckSyntax(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionReadline(ExecState*, JSObject*, JSValue, const ArgList&);
-static NO_RETURN JSValue JSC_HOST_CALL functionQuit(ExecState*, JSObject*, JSValue, const ArgList&);
-
-#if ENABLE(SAMPLING_FLAGS)
-static JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
-#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(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
-
-#if ENABLE(SAMPLING_FLAGS)
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
- putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), 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);
-}
-
-JSValue JSC_HOST_CALL functionPrint(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- for (unsigned i = 0; i < args.size(); ++i) {
- if (i)
- putchar(' ');
-
- printf("%s", args.at(i).toString(exec).UTF8String().c_str());
- }
-
- putchar('\n');
- fflush(stdout);
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL functionDebug(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- fprintf(stderr, "--> %s\n", args.at(0).toString(exec).UTF8String().c_str());
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL functionGC(ExecState* exec, JSObject*, JSValue, const ArgList&)
-{
- JSLock lock(SilenceAssertionsOnly);
- exec->heap()->collectAllGarbage();
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL functionVersion(ExecState*, JSObject*, JSValue, const ArgList&)
-{
- // We need this function for compatibility with the Mozilla JS tests but for now
- // we don't actually do any version-specific handling
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL functionRun(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- StopWatch stopWatch;
- UString fileName = args.at(0).toString(exec);
- Vector<char> script;
- if (!fillBufferWithContentsOfFile(fileName, script))
- return throwError(exec, GeneralError, "Could not open file.");
-
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
-
- stopWatch.start();
- evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
- stopWatch.stop();
-
- return jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS());
-}
-
-JSValue JSC_HOST_CALL functionLoad(ExecState* exec, JSObject* o, JSValue v, const ArgList& args)
-{
- UNUSED_PARAM(o);
- UNUSED_PARAM(v);
- UString fileName = args.at(0).toString(exec);
- Vector<char> script;
- if (!fillBufferWithContentsOfFile(fileName, script))
- return throwError(exec, GeneralError, "Could not open file.");
-
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- Completion result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
- if (result.complType() == Throw)
- exec->setException(result.value());
- return result.value();
-}
-
-JSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec, JSObject* o, JSValue v, const ArgList& args)
-{
- UNUSED_PARAM(o);
- UNUSED_PARAM(v);
- UString fileName = args.at(0).toString(exec);
- Vector<char> script;
- if (!fillBufferWithContentsOfFile(fileName, script))
- return throwError(exec, GeneralError, "Could not open file.");
-
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- Completion result = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName));
- if (result.complType() == Throw)
- exec->setException(result.value());
- return result.value();
-}
-
-#if ENABLE(SAMPLING_FLAGS)
-JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- for (unsigned i = 0; i < args.size(); ++i) {
- unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
- if ((flag >= 1) && (flag <= 32))
- SamplingFlags::setFlag(flag);
- }
- return jsNull();
-}
-
-JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- for (unsigned i = 0; i < args.size(); ++i) {
- unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
- if ((flag >= 1) && (flag <= 32))
- SamplingFlags::clearFlag(flag);
- }
- return jsNull();
-}
-#endif
-
-JSValue JSC_HOST_CALL functionReadline(ExecState* exec, JSObject*, JSValue, const ArgList&)
-{
- 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 jsString(exec, line.data());
-}
-
-JSValue JSC_HOST_CALL functionQuit(ExecState* exec, JSObject*, JSValue, const ArgList&)
-{
- // 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 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)
-#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().releaseRef();
- 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()).ascii());
- else
- printf("End: %s\n", completion.value().toString(globalObject->globalExec()).ascii());
- }
-
- globalData->stopSampling();
- globalObject->globalExec()->clearException();
- }
-
-#if ENABLE(SAMPLING_FLAGS)
- SamplingFlags::stop();
-#endif
- globalData->dumpSampleData(globalObject->globalExec());
-#if ENABLE(SAMPLING_COUNTERS)
- AbstractSamplingCounter::dump();
-#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()).ascii());
- else
- printf("%s\n", completion.value().toString(globalObject->globalExec()).UTF8String().c_str());
-
- 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.UTF8String().c_str(), "r");
- if (!f) {
- fprintf(stderr, "Could not open file: %s\n", fileName.UTF8String().c_str());
- 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';
-
- return true;
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/make-generated-sources.sh b/src/3rdparty/webkit/JavaScriptCore/make-generated-sources.sh
deleted file mode 100755
index 943a7cc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/make-generated-sources.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-export SRCROOT=$PWD
-export WebCore=$PWD
-export CREATE_HASH_TABLE="$SRCROOT/create_hash_table"
-
-mkdir -p DerivedSources/JavaScriptCore
-cd DerivedSources/JavaScriptCore
-
-make -f ../../DerivedSources.make JavaScriptCore=../.. BUILT_PRODUCTS_DIR=../..
-cd ../..
diff --git a/src/3rdparty/webkit/JavaScriptCore/os-win32/stdint.h b/src/3rdparty/webkit/JavaScriptCore/os-win32/stdint.h
deleted file mode 100644
index 1d8787e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/os-win32/stdint.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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_four_bytes)
-CASSERT(sizeof(uint64_t) == 8, uint64_t_is_four_bytes)
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y b/src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y
deleted file mode 100644
index 4d6e7d1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y
+++ /dev/null
@@ -1,2099 +0,0 @@
-%pure_parser
-
-%{
-
-/*
- * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
- * Copyright (C) 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 "JSObject.h"
-#include "JSString.h"
-#include "Lexer.h"
-#include "NodeConstructors.h"
-#include "NodeInfo.h"
-#include <stdlib.h>
-#include <string.h>
-#include <wtf/MathExtras.h>
-
-#define YYMALLOC fastMalloc
-#define YYFREE fastFree
-
-#define YYMAXDEPTH 10000
-#define YYENABLE_NLS 0
-
-// Default values for bison.
-#define YYDEBUG 0 // Set to 1 to debug a parse error.
-#define jscyydebug 0 // Set to 1 to debug a parse error.
-#if !OS(DARWIN)
-// Avoid triggering warnings in older bison by not setting this on the Darwin platform.
-// FIXME: Is this still needed?
-#define YYERROR_VERBOSE
-#endif
-
-int jscyyerror(const char*);
-
-static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
-
-#define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
-#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0)
-
-using namespace JSC;
-using namespace std;
-
-static ExpressionNode* makeAssignNode(JSGlobalData*, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end);
-static ExpressionNode* makePrefixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
-static ExpressionNode* makePostfixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
-static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData*, const Identifier& getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
-static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData*, ExpressionNodeInfo function, ArgumentsNodeInfo, int start, int divot, int end);
-static ExpressionNode* makeTypeOfNode(JSGlobalData*, ExpressionNode*);
-static ExpressionNode* makeDeleteNode(JSGlobalData*, ExpressionNode*, int start, int divot, int end);
-static ExpressionNode* makeNegateNode(JSGlobalData*, ExpressionNode*);
-static NumberNode* makeNumberNode(JSGlobalData*, double);
-static ExpressionNode* makeBitwiseNotNode(JSGlobalData*, ExpressionNode*);
-static ExpressionNode* makeMultNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeDivNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeAddNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeSubNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeLeftShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static ExpressionNode* makeRightShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
-static StatementNode* makeVarStatementNode(JSGlobalData*, ExpressionNode*);
-static ExpressionNode* combineCommaNodes(JSGlobalData*, ExpressionNode* list, ExpressionNode* init);
-
-#if COMPILER(MSVC)
-
-#pragma warning(disable: 4065)
-#pragma warning(disable: 4244)
-#pragma warning(disable: 4702)
-
-#endif
-
-#define YYPARSE_PARAM globalPtr
-#define YYLEX_PARAM globalPtr
-
-template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node,
- ParserArenaData<DeclarationStacks::VarStack>* varDecls,
- ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
- CodeFeatures info, int numConstants)
-{
- ASSERT((info & ~AllFeatures) == 0);
- NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants };
- return result;
-}
-
-template <typename T> inline NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
-{
- ASSERT((info & ~AllFeatures) == 0);
- NodeInfo<T> result = { node, info, numConstants };
- return result;
-}
-
-template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
-{
- // decls1 or both are null
- if (!decls1)
- return decls2;
- // only decls1 is non-null
- if (!decls2)
- return decls1;
-
- // Both are non-null
- decls1->data.append(decls2->data);
-
- // Manually release as much as possible from the now-defunct declaration lists
- // to avoid accumulating so many unused heap allocated vectors.
- decls2->data.clear();
-
- return decls1;
-}
-
-static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
-{
- if (!varDecls)
- varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>;
-
- varDecls->data.append(make_pair(&ident, attrs));
-}
-
-static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
-{
- unsigned attrs = DeclarationStacks::IsConstant;
- if (decl->hasInitializer())
- attrs |= DeclarationStacks::HasInitializer;
- appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs);
-}
-
-%}
-
-%union {
- int intValue;
- double doubleValue;
- const Identifier* ident;
-
- // expression subtrees
- ExpressionNodeInfo expressionNode;
- FuncDeclNodeInfo funcDeclNode;
- PropertyNodeInfo propertyNode;
- ArgumentsNodeInfo argumentsNode;
- ConstDeclNodeInfo constDeclNode;
- CaseBlockNodeInfo caseBlockNode;
- CaseClauseNodeInfo caseClauseNode;
- FuncExprNodeInfo funcExprNode;
-
- // statement nodes
- StatementNodeInfo statementNode;
- FunctionBodyNode* functionBodyNode;
- ProgramNode* programNode;
-
- SourceElementsInfo sourceElements;
- PropertyListInfo propertyList;
- ArgumentListInfo argumentList;
- VarDeclListInfo varDeclList;
- ConstDeclListInfo constDeclList;
- ClauseListInfo clauseList;
- ElementListInfo elementList;
- ParameterListInfo parameterList;
-
- Operator op;
-}
-
-%{
-
-template <typename T> inline void setStatementLocation(StatementNode* statement, const T& start, const T& end)
-{
- statement->setLoc(start.first_line, end.last_line);
-}
-
-static inline void setExceptionLocation(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end)
-{
- node->setExceptionSourceCode(divot, divot - start, end - divot);
-}
-
-%}
-
-%start Program
-
-/* literals */
-%token NULLTOKEN TRUETOKEN FALSETOKEN
-
-/* keywords */
-%token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE
-%token FUNCTION RETURN VOIDTOKEN DELETETOKEN
-%token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF
-%token SWITCH WITH RESERVED
-%token THROW TRY CATCH FINALLY
-%token DEBUGGER
-
-/* give an if without an else higher precedence than an else to resolve the ambiguity */
-%nonassoc IF_WITHOUT_ELSE
-%nonassoc ELSE
-
-/* punctuators */
-%token EQEQ NE /* == and != */
-%token STREQ STRNEQ /* === and !== */
-%token LE GE /* < and > */
-%token OR AND /* || and && */
-%token PLUSPLUS MINUSMINUS /* ++ and -- */
-%token LSHIFT /* << */
-%token RSHIFT URSHIFT /* >> and >>> */
-%token PLUSEQUAL MINUSEQUAL /* += and -= */
-%token MULTEQUAL DIVEQUAL /* *= and /= */
-%token LSHIFTEQUAL /* <<= */
-%token RSHIFTEQUAL URSHIFTEQUAL /* >>= and >>>= */
-%token ANDEQUAL MODEQUAL /* &= and %= */
-%token XOREQUAL OREQUAL /* ^= and |= */
-%token <intValue> OPENBRACE /* { (with char offset) */
-%token <intValue> CLOSEBRACE /* } (with char offset) */
-
-/* terminal types */
-%token <doubleValue> NUMBER
-%token <ident> IDENT STRING
-
-/* automatically inserted semicolon */
-%token AUTOPLUSPLUS AUTOMINUSMINUS
-
-/* non-terminal types */
-%type <expressionNode> Literal ArrayLiteral
-
-%type <expressionNode> PrimaryExpr PrimaryExprNoBrace
-%type <expressionNode> MemberExpr MemberExprNoBF /* BF => brace or function */
-%type <expressionNode> NewExpr NewExprNoBF
-%type <expressionNode> CallExpr CallExprNoBF
-%type <expressionNode> LeftHandSideExpr LeftHandSideExprNoBF
-%type <expressionNode> PostfixExpr PostfixExprNoBF
-%type <expressionNode> UnaryExpr UnaryExprNoBF UnaryExprCommon
-%type <expressionNode> MultiplicativeExpr MultiplicativeExprNoBF
-%type <expressionNode> AdditiveExpr AdditiveExprNoBF
-%type <expressionNode> ShiftExpr ShiftExprNoBF
-%type <expressionNode> RelationalExpr RelationalExprNoIn RelationalExprNoBF
-%type <expressionNode> EqualityExpr EqualityExprNoIn EqualityExprNoBF
-%type <expressionNode> BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF
-%type <expressionNode> BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF
-%type <expressionNode> BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF
-%type <expressionNode> LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF
-%type <expressionNode> LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF
-%type <expressionNode> ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF
-%type <expressionNode> AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF
-%type <expressionNode> Expr ExprNoIn ExprNoBF
-
-%type <expressionNode> ExprOpt ExprNoInOpt
-
-%type <statementNode> Statement Block
-%type <statementNode> VariableStatement ConstStatement EmptyStatement ExprStatement
-%type <statementNode> IfStatement IterationStatement ContinueStatement
-%type <statementNode> BreakStatement ReturnStatement WithStatement
-%type <statementNode> SwitchStatement LabelledStatement
-%type <statementNode> ThrowStatement TryStatement
-%type <statementNode> DebuggerStatement
-
-%type <expressionNode> Initializer InitializerNoIn
-%type <statementNode> FunctionDeclaration
-%type <funcExprNode> FunctionExpr
-%type <functionBodyNode> FunctionBody
-%type <sourceElements> SourceElements
-%type <parameterList> FormalParameterList
-%type <op> AssignmentOperator
-%type <argumentsNode> Arguments
-%type <argumentList> ArgumentList
-%type <varDeclList> VariableDeclarationList VariableDeclarationListNoIn
-%type <constDeclList> ConstDeclarationList
-%type <constDeclNode> ConstDeclaration
-%type <caseBlockNode> CaseBlock
-%type <caseClauseNode> CaseClause DefaultClause
-%type <clauseList> CaseClauses CaseClausesOpt
-%type <intValue> Elision ElisionOpt
-%type <elementList> ElementList
-%type <propertyNode> Property
-%type <propertyList> PropertyList
-%%
-
-// FIXME: There are currently two versions of the grammar in this file, the normal one, and the NoNodes version used for
-// lazy recompilation of FunctionBodyNodes. We should move to generating the two versions from a script to avoid bugs.
-// In the mean time, make sure to make any changes to the grammar in both versions.
-
-Literal:
- NULLTOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); }
- | TRUETOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); }
- | FALSETOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); }
- | NUMBER { $$ = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0, 1); }
- | STRING { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *$1), 0, 1); }
- | '/' /* regexp */ {
- Lexer& l = *GLOBAL_DATA->lexer;
- const Identifier* pattern;
- const Identifier* flags;
- if (!l.scanRegExp(pattern, flags))
- YYABORT;
- RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
- int size = pattern->size() + 2; // + 2 for the two /'s
- setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
- $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
- }
- | DIVEQUAL /* regexp with /= */ {
- Lexer& l = *GLOBAL_DATA->lexer;
- const Identifier* pattern;
- const Identifier* flags;
- if (!l.scanRegExp(pattern, flags, '='))
- YYABORT;
- RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
- int size = pattern->size() + 2; // + 2 for the two /'s
- setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
- $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
- }
-;
-
-Property:
- IDENT ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
- | STRING ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
- | NUMBER ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, $1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
- | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, 0, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); if (!$$.m_node) YYABORT; }
- | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, $4.m_node.head, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
- if ($4.m_features & ArgumentsFeature)
- $7->setUsesArguments();
- setStatementLocation($7, @6, @8);
- if (!$$.m_node)
- YYABORT;
- }
-;
-
-PropertyList:
- Property { $$.m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $1.m_node);
- $$.m_node.tail = $$.m_node.head;
- $$.m_features = $1.m_features;
- $$.m_numConstants = $1.m_numConstants; }
- | PropertyList ',' Property { $$.m_node.head = $1.m_node.head;
- $$.m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail);
- $$.m_features = $1.m_features | $3.m_features;
- $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
-;
-
-PrimaryExpr:
- PrimaryExprNoBrace
- | OPENBRACE CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); }
- | OPENBRACE PropertyList CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
- /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
- | OPENBRACE PropertyList ',' CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
-;
-
-PrimaryExprNoBrace:
- THISTOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); }
- | Literal
- | ArrayLiteral
- | IDENT { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
- | '(' Expr ')' { $$ = $2; }
-;
-
-ArrayLiteral:
- '[' ElisionOpt ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2), 0, $2 ? 1 : 0); }
- | '[' ElementList ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
- | '[' ElementList ',' ElisionOpt ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $4, $2.m_node.head), $2.m_features, $4 ? $2.m_numConstants + 1 : $2.m_numConstants); }
-;
-
-ElementList:
- ElisionOpt AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1, $2.m_node);
- $$.m_node.tail = $$.m_node.head;
- $$.m_features = $2.m_features;
- $$.m_numConstants = $2.m_numConstants; }
- | ElementList ',' ElisionOpt AssignmentExpr
- { $$.m_node.head = $1.m_node.head;
- $$.m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node);
- $$.m_features = $1.m_features | $4.m_features;
- $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; }
-;
-
-ElisionOpt:
- /* nothing */ { $$ = 0; }
- | Elision
-;
-
-Elision:
- ',' { $$ = 1; }
- | Elision ',' { $$ = $1 + 1; }
-;
-
-MemberExpr:
- PrimaryExpr
- | FunctionExpr { $$ = createNodeInfo<ExpressionNode*>($1.m_node, $1.m_features, $1.m_numConstants); }
- | MemberExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
- }
- | MemberExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
- }
- | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
- }
-;
-
-MemberExprNoBF:
- PrimaryExprNoBrace
- | MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
- }
- | MemberExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
- }
- | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
- }
-;
-
-NewExpr:
- MemberExpr
- | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
- }
-;
-
-NewExprNoBF:
- MemberExprNoBF
- | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
- }
-;
-
-CallExpr:
- MemberExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
- | CallExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
- | CallExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
- }
- | CallExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); }
-;
-
-CallExprNoBF:
- MemberExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
- | CallExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
- | CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
- }
- | CallExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
- setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
- }
-;
-
-Arguments:
- '(' ')' { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); }
- | '(' ArgumentList ')' { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
-;
-
-ArgumentList:
- AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node);
- $$.m_node.tail = $$.m_node.head;
- $$.m_features = $1.m_features;
- $$.m_numConstants = $1.m_numConstants; }
- | ArgumentList ',' AssignmentExpr { $$.m_node.head = $1.m_node.head;
- $$.m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node);
- $$.m_features = $1.m_features | $3.m_features;
- $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
-;
-
-LeftHandSideExpr:
- NewExpr
- | CallExpr
-;
-
-LeftHandSideExprNoBF:
- NewExprNoBF
- | CallExprNoBF
-;
-
-PostfixExpr:
- LeftHandSideExpr
- | LeftHandSideExpr PLUSPLUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
- | LeftHandSideExpr MINUSMINUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
-;
-
-PostfixExprNoBF:
- LeftHandSideExprNoBF
- | LeftHandSideExprNoBF PLUSPLUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
- | LeftHandSideExprNoBF MINUSMINUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
-;
-
-UnaryExprCommon:
- DELETETOKEN UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, $2.m_node, @1.first_column, @2.last_column, @2.last_column), $2.m_features, $2.m_numConstants); }
- | VOIDTOKEN UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants + 1); }
- | TYPEOF UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
- | PLUSPLUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
- | AUTOPLUSPLUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
- | MINUSMINUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
- | AUTOMINUSMINUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
- | '+' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
- | '-' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
- | '~' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
- | '!' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
-
-UnaryExpr:
- PostfixExpr
- | UnaryExprCommon
-;
-
-UnaryExprNoBF:
- PostfixExprNoBF
- | UnaryExprCommon
-;
-
-MultiplicativeExpr:
- UnaryExpr
- | MultiplicativeExpr '*' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | MultiplicativeExpr '/' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | MultiplicativeExpr '%' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-MultiplicativeExprNoBF:
- UnaryExprNoBF
- | MultiplicativeExprNoBF '*' UnaryExpr
- { $$ = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | MultiplicativeExprNoBF '/' UnaryExpr
- { $$ = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | MultiplicativeExprNoBF '%' UnaryExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-AdditiveExpr:
- MultiplicativeExpr
- | AdditiveExpr '+' MultiplicativeExpr { $$ = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | AdditiveExpr '-' MultiplicativeExpr { $$ = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-AdditiveExprNoBF:
- MultiplicativeExprNoBF
- | AdditiveExprNoBF '+' MultiplicativeExpr
- { $$ = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | AdditiveExprNoBF '-' MultiplicativeExpr
- { $$ = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-ShiftExpr:
- AdditiveExpr
- | ShiftExpr LSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | ShiftExpr RSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | ShiftExpr URSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-ShiftExprNoBF:
- AdditiveExprNoBF
- | ShiftExprNoBF LSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | ShiftExprNoBF RSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | ShiftExprNoBF URSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-RelationalExpr:
- ShiftExpr
- | RelationalExpr '<' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExpr '>' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExpr LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExpr GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExpr INTOKEN ShiftExpr { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-RelationalExprNoIn:
- ShiftExpr
- | RelationalExprNoIn '<' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoIn '>' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoIn LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoIn GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoIn INSTANCEOF ShiftExpr
- { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-RelationalExprNoBF:
- ShiftExprNoBF
- | RelationalExprNoBF '<' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoBF '>' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoBF LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoBF GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoBF INSTANCEOF ShiftExpr
- { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | RelationalExprNoBF INTOKEN ShiftExpr
- { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
- $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-EqualityExpr:
- RelationalExpr
- | EqualityExpr EQEQ RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExpr NE RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExpr STREQ RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExpr STRNEQ RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-EqualityExprNoIn:
- RelationalExprNoIn
- | EqualityExprNoIn EQEQ RelationalExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExprNoIn NE RelationalExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExprNoIn STREQ RelationalExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExprNoIn STRNEQ RelationalExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-EqualityExprNoBF:
- RelationalExprNoBF
- | EqualityExprNoBF EQEQ RelationalExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExprNoBF NE RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExprNoBF STREQ RelationalExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
- | EqualityExprNoBF STRNEQ RelationalExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseANDExpr:
- EqualityExpr
- | BitwiseANDExpr '&' EqualityExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseANDExprNoIn:
- EqualityExprNoIn
- | BitwiseANDExprNoIn '&' EqualityExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseANDExprNoBF:
- EqualityExprNoBF
- | BitwiseANDExprNoBF '&' EqualityExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseXORExpr:
- BitwiseANDExpr
- | BitwiseXORExpr '^' BitwiseANDExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseXORExprNoIn:
- BitwiseANDExprNoIn
- | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseXORExprNoBF:
- BitwiseANDExprNoBF
- | BitwiseXORExprNoBF '^' BitwiseANDExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseORExpr:
- BitwiseXORExpr
- | BitwiseORExpr '|' BitwiseXORExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseORExprNoIn:
- BitwiseXORExprNoIn
- | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-BitwiseORExprNoBF:
- BitwiseXORExprNoBF
- | BitwiseORExprNoBF '|' BitwiseXORExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-LogicalANDExpr:
- BitwiseORExpr
- | LogicalANDExpr AND BitwiseORExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-LogicalANDExprNoIn:
- BitwiseORExprNoIn
- | LogicalANDExprNoIn AND BitwiseORExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-LogicalANDExprNoBF:
- BitwiseORExprNoBF
- | LogicalANDExprNoBF AND BitwiseORExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-LogicalORExpr:
- LogicalANDExpr
- | LogicalORExpr OR LogicalANDExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-LogicalORExprNoIn:
- LogicalANDExprNoIn
- | LogicalORExprNoIn OR LogicalANDExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-LogicalORExprNoBF:
- LogicalANDExprNoBF
- | LogicalORExprNoBF OR LogicalANDExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-ConditionalExpr:
- LogicalORExpr
- | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
-;
-
-ConditionalExprNoIn:
- LogicalORExprNoIn
- | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
-;
-
-ConditionalExprNoBF:
- LogicalORExprNoBF
- | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr
- { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
-;
-
-AssignmentExpr:
- ConditionalExpr
- | LeftHandSideExpr AssignmentOperator AssignmentExpr
- { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
- @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
- }
-;
-
-AssignmentExprNoIn:
- ConditionalExprNoIn
- | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn
- { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
- @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
- }
-;
-
-AssignmentExprNoBF:
- ConditionalExprNoBF
- | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr
- { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
- @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
- }
-;
-
-AssignmentOperator:
- '=' { $$ = OpEqual; }
- | PLUSEQUAL { $$ = OpPlusEq; }
- | MINUSEQUAL { $$ = OpMinusEq; }
- | MULTEQUAL { $$ = OpMultEq; }
- | DIVEQUAL { $$ = OpDivEq; }
- | LSHIFTEQUAL { $$ = OpLShift; }
- | RSHIFTEQUAL { $$ = OpRShift; }
- | URSHIFTEQUAL { $$ = OpURShift; }
- | ANDEQUAL { $$ = OpAndEq; }
- | XOREQUAL { $$ = OpXOrEq; }
- | OREQUAL { $$ = OpOrEq; }
- | MODEQUAL { $$ = OpModEq; }
-;
-
-Expr:
- AssignmentExpr
- | Expr ',' AssignmentExpr { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-ExprNoIn:
- AssignmentExprNoIn
- | ExprNoIn ',' AssignmentExprNoIn { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-ExprNoBF:
- AssignmentExprNoBF
- | ExprNoBF ',' AssignmentExpr { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
-;
-
-Statement:
- Block
- | VariableStatement
- | ConstStatement
- | FunctionDeclaration
- | EmptyStatement
- | ExprStatement
- | IfStatement
- | IterationStatement
- | ContinueStatement
- | BreakStatement
- | ReturnStatement
- | WithStatement
- | SwitchStatement
- | LabelledStatement
- | ThrowStatement
- | TryStatement
- | DebuggerStatement
-;
-
-Block:
- OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @2); }
- | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- setStatementLocation($$.m_node, @1, @3); }
-;
-
-VariableStatement:
- VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- setStatementLocation($$.m_node, @1, @3); }
- | VAR VariableDeclarationList error { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- setStatementLocation($$.m_node, @1, @2);
- AUTO_SEMICOLON; }
-;
-
-VariableDeclarationList:
- IDENT { $$.m_node = 0;
- $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
- $$.m_funcDeclarations = 0;
- $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
- $$.m_numConstants = 0;
- }
- | IDENT Initializer { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
- $$.m_node = node;
- $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
- $$.m_funcDeclarations = 0;
- $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
- $$.m_numConstants = $2.m_numConstants;
- }
- | VariableDeclarationList ',' IDENT
- { $$.m_node = $1.m_node;
- $$.m_varDeclarations = $1.m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
- $$.m_funcDeclarations = 0;
- $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
- $$.m_numConstants = $1.m_numConstants;
- }
- | VariableDeclarationList ',' IDENT Initializer
- { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
- setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
- $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
- $$.m_varDeclarations = $1.m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
- $$.m_funcDeclarations = 0;
- $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
- $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
- }
-;
-
-VariableDeclarationListNoIn:
- IDENT { $$.m_node = 0;
- $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
- $$.m_funcDeclarations = 0;
- $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
- $$.m_numConstants = 0;
- }
- | IDENT InitializerNoIn { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
- setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
- $$.m_node = node;
- $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
- $$.m_funcDeclarations = 0;
- $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
- $$.m_numConstants = $2.m_numConstants;
- }
- | VariableDeclarationListNoIn ',' IDENT
- { $$.m_node = $1.m_node;
- $$.m_varDeclarations = $1.m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
- $$.m_funcDeclarations = 0;
- $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
- $$.m_numConstants = $1.m_numConstants;
- }
- | VariableDeclarationListNoIn ',' IDENT InitializerNoIn
- { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
- setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
- $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
- $$.m_varDeclarations = $1.m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
- $$.m_funcDeclarations = 0;
- $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
- $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
- }
-;
-
-ConstStatement:
- CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- setStatementLocation($$.m_node, @1, @3); }
- | CONSTTOKEN ConstDeclarationList error
- { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
- setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
-;
-
-ConstDeclarationList:
- ConstDeclaration { $$.m_node.head = $1.m_node;
- $$.m_node.tail = $$.m_node.head;
- $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node);
- $$.m_funcDeclarations = 0;
- $$.m_features = $1.m_features;
- $$.m_numConstants = $1.m_numConstants;
- }
- | ConstDeclarationList ',' ConstDeclaration
- { $$.m_node.head = $1.m_node.head;
- $1.m_node.tail->m_next = $3.m_node;
- $$.m_node.tail = $3.m_node;
- $$.m_varDeclarations = $1.m_varDeclarations;
- appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $3.m_node);
- $$.m_funcDeclarations = 0;
- $$.m_features = $1.m_features | $3.m_features;
- $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
-;
-
-ConstDeclaration:
- IDENT { $$ = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, 0), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
- | IDENT Initializer { $$ = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, $2.m_node), ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features, $2.m_numConstants); }
-;
-
-Initializer:
- '=' AssignmentExpr { $$ = $2; }
-;
-
-InitializerNoIn:
- '=' AssignmentExprNoIn { $$ = $2; }
-;
-
-EmptyStatement:
- ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); }
-;
-
-ExprStatement:
- ExprNoBF ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
- setStatementLocation($$.m_node, @1, @2); }
- | ExprNoBF error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
- setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
-;
-
-IfStatement:
- IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE
- { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
- setStatementLocation($$.m_node, @1, @4); }
- | IF '(' Expr ')' Statement ELSE Statement
- { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node),
- mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations),
- mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
- $3.m_features | $5.m_features | $7.m_features,
- $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
- setStatementLocation($$.m_node, @1, @4); }
-;
-
-IterationStatement:
- DO Statement WHILE '(' Expr ')' ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
- setStatementLocation($$.m_node, @1, @3); }
- | DO Statement WHILE '(' Expr ')' error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
- setStatementLocation($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
- | WHILE '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
- setStatementLocation($$.m_node, @1, @4); }
- | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement
- { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node, $9.m_node, false), $9.m_varDeclarations, $9.m_funcDeclarations,
- $3.m_features | $5.m_features | $7.m_features | $9.m_features,
- $3.m_numConstants + $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
- setStatementLocation($$.m_node, @1, @8);
- }
- | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
- { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true),
- mergeDeclarationLists($4.m_varDeclarations, $10.m_varDeclarations),
- mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations),
- $4.m_features | $6.m_features | $8.m_features | $10.m_features,
- $4.m_numConstants + $6.m_numConstants + $8.m_numConstants + $10.m_numConstants);
- setStatementLocation($$.m_node, @1, @9); }
- | FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement
- {
- ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node);
- setExceptionLocation(node, @3.first_column, @3.last_column, @5.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations,
- $3.m_features | $5.m_features | $7.m_features,
- $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
- setStatementLocation($$.m_node, @1, @6);
- }
- | FOR '(' VAR IDENT INTOKEN Expr ')' Statement
- { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, 0, $6.m_node, $8.m_node, @5.first_column, @5.first_column - @4.first_column, @6.last_column - @5.first_column);
- setExceptionLocation(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
- appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
- $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $8.m_varDeclarations, $8.m_funcDeclarations, ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $6.m_features | $8.m_features, $6.m_numConstants + $8.m_numConstants);
- setStatementLocation($$.m_node, @1, @7); }
- | FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement
- { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, $5.m_node, $7.m_node, $9.m_node, @5.first_column, @5.first_column - @4.first_column, @5.last_column - @5.first_column);
- setExceptionLocation(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
- appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
- $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations,
- ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $5.m_features | $7.m_features | $9.m_features,
- $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
- setStatementLocation($$.m_node, @1, @8); }
-;
-
-ExprOpt:
- /* nothing */ { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
- | Expr
-;
-
-ExprNoInOpt:
- /* nothing */ { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
- | ExprNoIn
-;
-
-ContinueStatement:
- CONTINUE ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @2); }
- | CONTINUE error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
- | CONTINUE IDENT ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @3); }
- | CONTINUE IDENT error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
-;
-
-BreakStatement:
- BREAK ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
- | BREAK error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
- | BREAK IDENT ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @3); }
- | BREAK IDENT error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
-;
-
-ReturnStatement:
- RETURN ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
- | RETURN error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
- setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
- | RETURN Expr ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @3); }
- | RETURN Expr error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
-;
-
-WithStatement:
- WITH '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, $3.m_node, $5.m_node, @3.last_column, @3.last_column - @3.first_column),
- $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features | WithFeature, $3.m_numConstants + $5.m_numConstants);
- setStatementLocation($$.m_node, @1, @4); }
-;
-
-SwitchStatement:
- SWITCH '(' Expr ')' CaseBlock { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations,
- $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
- setStatementLocation($$.m_node, @1, @4); }
-;
-
-CaseBlock:
- OPENBRACE CaseClausesOpt CLOSEBRACE { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, 0, 0), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); }
- | OPENBRACE CaseClausesOpt DefaultClause CaseClausesOpt CLOSEBRACE
- { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, $3.m_node, $4.m_node.head),
- mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $3.m_varDeclarations), $4.m_varDeclarations),
- mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $3.m_funcDeclarations), $4.m_funcDeclarations),
- $2.m_features | $3.m_features | $4.m_features,
- $2.m_numConstants + $3.m_numConstants + $4.m_numConstants); }
-;
-
-CaseClausesOpt:
- /* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; }
- | CaseClauses
-;
-
-CaseClauses:
- CaseClause { $$.m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node);
- $$.m_node.tail = $$.m_node.head;
- $$.m_varDeclarations = $1.m_varDeclarations;
- $$.m_funcDeclarations = $1.m_funcDeclarations;
- $$.m_features = $1.m_features;
- $$.m_numConstants = $1.m_numConstants; }
- | CaseClauses CaseClause { $$.m_node.head = $1.m_node.head;
- $$.m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node.tail, $2.m_node);
- $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
- $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
- $$.m_features = $1.m_features | $2.m_features;
- $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
- }
-;
-
-CaseClause:
- CASE Expr ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node), 0, 0, $2.m_features, $2.m_numConstants); }
- | CASE Expr ':' SourceElements { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node, $4.m_node), $4.m_varDeclarations, $4.m_funcDeclarations, $2.m_features | $4.m_features, $2.m_numConstants + $4.m_numConstants); }
-;
-
-DefaultClause:
- DEFAULT ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); }
- | DEFAULT ':' SourceElements { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0, $3.m_node), $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
-;
-
-LabelledStatement:
- IDENT ':' Statement { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *$1, $3.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
-;
-
-ThrowStatement:
- THROW Expr ';' { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2);
- }
- | THROW Expr error { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
- setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
- $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON;
- }
-;
-
-TryStatement:
- TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, $4.m_node),
- mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
- mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
- $2.m_features | $4.m_features,
- $2.m_numConstants + $4.m_numConstants);
- setStatementLocation($$.m_node, @1, @2); }
- | TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, 0),
- mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations),
- mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations),
- $2.m_features | $7.m_features | CatchFeature,
- $2.m_numConstants + $7.m_numConstants);
- setStatementLocation($$.m_node, @1, @2); }
- | TRY Block CATCH '(' IDENT ')' Block FINALLY Block
- { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, $9.m_node),
- mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations),
- mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations),
- $2.m_features | $7.m_features | $9.m_features | CatchFeature,
- $2.m_numConstants + $7.m_numConstants + $9.m_numConstants);
- setStatementLocation($$.m_node, @1, @2); }
-;
-
-DebuggerStatement:
- DEBUGGER ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @2); }
- | DEBUGGER error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
- setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
-;
-
-FunctionDeclaration:
- FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); setStatementLocation($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body()); }
- | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0);
- if ($4.m_features & ArgumentsFeature)
- $7->setUsesArguments();
- setStatementLocation($7, @6, @8);
- $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body());
- }
-;
-
-FunctionExpr:
- FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
- | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
- if ($3.m_features & ArgumentsFeature)
- $6->setUsesArguments();
- setStatementLocation($6, @5, @7);
- }
- | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); }
- | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
- {
- $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
- if ($4.m_features & ArgumentsFeature)
- $7->setUsesArguments();
- setStatementLocation($7, @6, @8);
- }
-;
-
-FormalParameterList:
- IDENT { $$.m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *$1);
- $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
- $$.m_node.tail = $$.m_node.head; }
- | FormalParameterList ',' IDENT { $$.m_node.head = $1.m_node.head;
- $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
- $$.m_node.tail = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, $1.m_node.tail, *$3); }
-;
-
-FunctionBody:
- /* not in spec */ { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
- | SourceElements_NoNode { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
-;
-
-Program:
- /* not in spec */ { GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, @0.last_line, 0); }
- | SourceElements { GLOBAL_DATA->parser->didFinishParsing($1.m_node, $1.m_varDeclarations, $1.m_funcDeclarations, $1.m_features,
- @1.last_line, $1.m_numConstants); }
-;
-
-SourceElements:
- Statement { $$.m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA);
- $$.m_node->append($1.m_node);
- $$.m_varDeclarations = $1.m_varDeclarations;
- $$.m_funcDeclarations = $1.m_funcDeclarations;
- $$.m_features = $1.m_features;
- $$.m_numConstants = $1.m_numConstants;
- }
- | SourceElements Statement { $$.m_node->append($2.m_node);
- $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
- $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
- $$.m_features = $1.m_features | $2.m_features;
- $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
- }
-;
-
-// Start NoNodes
-
-Literal_NoNode:
- NULLTOKEN
- | TRUETOKEN
- | FALSETOKEN
- | NUMBER { }
- | STRING { }
- | '/' /* regexp */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
- | DIVEQUAL /* regexp with /= */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
-;
-
-Property_NoNode:
- IDENT ':' AssignmentExpr_NoNode { }
- | STRING ':' AssignmentExpr_NoNode { }
- | NUMBER ':' AssignmentExpr_NoNode { }
- | IDENT IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
- | IDENT IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
-;
-
-PropertyList_NoNode:
- Property_NoNode
- | PropertyList_NoNode ',' Property_NoNode
-;
-
-PrimaryExpr_NoNode:
- PrimaryExprNoBrace_NoNode
- | OPENBRACE CLOSEBRACE { }
- | OPENBRACE PropertyList_NoNode CLOSEBRACE { }
- /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
- | OPENBRACE PropertyList_NoNode ',' CLOSEBRACE { }
-;
-
-PrimaryExprNoBrace_NoNode:
- THISTOKEN
- | Literal_NoNode
- | ArrayLiteral_NoNode
- | IDENT { }
- | '(' Expr_NoNode ')'
-;
-
-ArrayLiteral_NoNode:
- '[' ElisionOpt_NoNode ']'
- | '[' ElementList_NoNode ']'
- | '[' ElementList_NoNode ',' ElisionOpt_NoNode ']'
-;
-
-ElementList_NoNode:
- ElisionOpt_NoNode AssignmentExpr_NoNode
- | ElementList_NoNode ',' ElisionOpt_NoNode AssignmentExpr_NoNode
-;
-
-ElisionOpt_NoNode:
- /* nothing */
- | Elision_NoNode
-;
-
-Elision_NoNode:
- ','
- | Elision_NoNode ','
-;
-
-MemberExpr_NoNode:
- PrimaryExpr_NoNode
- | FunctionExpr_NoNode
- | MemberExpr_NoNode '[' Expr_NoNode ']'
- | MemberExpr_NoNode '.' IDENT
- | NEW MemberExpr_NoNode Arguments_NoNode
-;
-
-MemberExprNoBF_NoNode:
- PrimaryExprNoBrace_NoNode
- | MemberExprNoBF_NoNode '[' Expr_NoNode ']'
- | MemberExprNoBF_NoNode '.' IDENT
- | NEW MemberExpr_NoNode Arguments_NoNode
-;
-
-NewExpr_NoNode:
- MemberExpr_NoNode
- | NEW NewExpr_NoNode
-;
-
-NewExprNoBF_NoNode:
- MemberExprNoBF_NoNode
- | NEW NewExpr_NoNode
-;
-
-CallExpr_NoNode:
- MemberExpr_NoNode Arguments_NoNode
- | CallExpr_NoNode Arguments_NoNode
- | CallExpr_NoNode '[' Expr_NoNode ']'
- | CallExpr_NoNode '.' IDENT
-;
-
-CallExprNoBF_NoNode:
- MemberExprNoBF_NoNode Arguments_NoNode
- | CallExprNoBF_NoNode Arguments_NoNode
- | CallExprNoBF_NoNode '[' Expr_NoNode ']'
- | CallExprNoBF_NoNode '.' IDENT
-;
-
-Arguments_NoNode:
- '(' ')'
- | '(' ArgumentList_NoNode ')'
-;
-
-ArgumentList_NoNode:
- AssignmentExpr_NoNode
- | ArgumentList_NoNode ',' AssignmentExpr_NoNode
-;
-
-LeftHandSideExpr_NoNode:
- NewExpr_NoNode
- | CallExpr_NoNode
-;
-
-LeftHandSideExprNoBF_NoNode:
- NewExprNoBF_NoNode
- | CallExprNoBF_NoNode
-;
-
-PostfixExpr_NoNode:
- LeftHandSideExpr_NoNode
- | LeftHandSideExpr_NoNode PLUSPLUS
- | LeftHandSideExpr_NoNode MINUSMINUS
-;
-
-PostfixExprNoBF_NoNode:
- LeftHandSideExprNoBF_NoNode
- | LeftHandSideExprNoBF_NoNode PLUSPLUS
- | LeftHandSideExprNoBF_NoNode MINUSMINUS
-;
-
-UnaryExprCommon_NoNode:
- DELETETOKEN UnaryExpr_NoNode
- | VOIDTOKEN UnaryExpr_NoNode
- | TYPEOF UnaryExpr_NoNode
- | PLUSPLUS UnaryExpr_NoNode
- | AUTOPLUSPLUS UnaryExpr_NoNode
- | MINUSMINUS UnaryExpr_NoNode
- | AUTOMINUSMINUS UnaryExpr_NoNode
- | '+' UnaryExpr_NoNode
- | '-' UnaryExpr_NoNode
- | '~' UnaryExpr_NoNode
- | '!' UnaryExpr_NoNode
-
-UnaryExpr_NoNode:
- PostfixExpr_NoNode
- | UnaryExprCommon_NoNode
-;
-
-UnaryExprNoBF_NoNode:
- PostfixExprNoBF_NoNode
- | UnaryExprCommon_NoNode
-;
-
-MultiplicativeExpr_NoNode:
- UnaryExpr_NoNode
- | MultiplicativeExpr_NoNode '*' UnaryExpr_NoNode
- | MultiplicativeExpr_NoNode '/' UnaryExpr_NoNode
- | MultiplicativeExpr_NoNode '%' UnaryExpr_NoNode
-;
-
-MultiplicativeExprNoBF_NoNode:
- UnaryExprNoBF_NoNode
- | MultiplicativeExprNoBF_NoNode '*' UnaryExpr_NoNode
- | MultiplicativeExprNoBF_NoNode '/' UnaryExpr_NoNode
- | MultiplicativeExprNoBF_NoNode '%' UnaryExpr_NoNode
-;
-
-AdditiveExpr_NoNode:
- MultiplicativeExpr_NoNode
- | AdditiveExpr_NoNode '+' MultiplicativeExpr_NoNode
- | AdditiveExpr_NoNode '-' MultiplicativeExpr_NoNode
-;
-
-AdditiveExprNoBF_NoNode:
- MultiplicativeExprNoBF_NoNode
- | AdditiveExprNoBF_NoNode '+' MultiplicativeExpr_NoNode
- | AdditiveExprNoBF_NoNode '-' MultiplicativeExpr_NoNode
-;
-
-ShiftExpr_NoNode:
- AdditiveExpr_NoNode
- | ShiftExpr_NoNode LSHIFT AdditiveExpr_NoNode
- | ShiftExpr_NoNode RSHIFT AdditiveExpr_NoNode
- | ShiftExpr_NoNode URSHIFT AdditiveExpr_NoNode
-;
-
-ShiftExprNoBF_NoNode:
- AdditiveExprNoBF_NoNode
- | ShiftExprNoBF_NoNode LSHIFT AdditiveExpr_NoNode
- | ShiftExprNoBF_NoNode RSHIFT AdditiveExpr_NoNode
- | ShiftExprNoBF_NoNode URSHIFT AdditiveExpr_NoNode
-;
-
-RelationalExpr_NoNode:
- ShiftExpr_NoNode
- | RelationalExpr_NoNode '<' ShiftExpr_NoNode
- | RelationalExpr_NoNode '>' ShiftExpr_NoNode
- | RelationalExpr_NoNode LE ShiftExpr_NoNode
- | RelationalExpr_NoNode GE ShiftExpr_NoNode
- | RelationalExpr_NoNode INSTANCEOF ShiftExpr_NoNode
- | RelationalExpr_NoNode INTOKEN ShiftExpr_NoNode
-;
-
-RelationalExprNoIn_NoNode:
- ShiftExpr_NoNode
- | RelationalExprNoIn_NoNode '<' ShiftExpr_NoNode
- | RelationalExprNoIn_NoNode '>' ShiftExpr_NoNode
- | RelationalExprNoIn_NoNode LE ShiftExpr_NoNode
- | RelationalExprNoIn_NoNode GE ShiftExpr_NoNode
- | RelationalExprNoIn_NoNode INSTANCEOF ShiftExpr_NoNode
-;
-
-RelationalExprNoBF_NoNode:
- ShiftExprNoBF_NoNode
- | RelationalExprNoBF_NoNode '<' ShiftExpr_NoNode
- | RelationalExprNoBF_NoNode '>' ShiftExpr_NoNode
- | RelationalExprNoBF_NoNode LE ShiftExpr_NoNode
- | RelationalExprNoBF_NoNode GE ShiftExpr_NoNode
- | RelationalExprNoBF_NoNode INSTANCEOF ShiftExpr_NoNode
- | RelationalExprNoBF_NoNode INTOKEN ShiftExpr_NoNode
-;
-
-EqualityExpr_NoNode:
- RelationalExpr_NoNode
- | EqualityExpr_NoNode EQEQ RelationalExpr_NoNode
- | EqualityExpr_NoNode NE RelationalExpr_NoNode
- | EqualityExpr_NoNode STREQ RelationalExpr_NoNode
- | EqualityExpr_NoNode STRNEQ RelationalExpr_NoNode
-;
-
-EqualityExprNoIn_NoNode:
- RelationalExprNoIn_NoNode
- | EqualityExprNoIn_NoNode EQEQ RelationalExprNoIn_NoNode
- | EqualityExprNoIn_NoNode NE RelationalExprNoIn_NoNode
- | EqualityExprNoIn_NoNode STREQ RelationalExprNoIn_NoNode
- | EqualityExprNoIn_NoNode STRNEQ RelationalExprNoIn_NoNode
-;
-
-EqualityExprNoBF_NoNode:
- RelationalExprNoBF_NoNode
- | EqualityExprNoBF_NoNode EQEQ RelationalExpr_NoNode
- | EqualityExprNoBF_NoNode NE RelationalExpr_NoNode
- | EqualityExprNoBF_NoNode STREQ RelationalExpr_NoNode
- | EqualityExprNoBF_NoNode STRNEQ RelationalExpr_NoNode
-;
-
-BitwiseANDExpr_NoNode:
- EqualityExpr_NoNode
- | BitwiseANDExpr_NoNode '&' EqualityExpr_NoNode
-;
-
-BitwiseANDExprNoIn_NoNode:
- EqualityExprNoIn_NoNode
- | BitwiseANDExprNoIn_NoNode '&' EqualityExprNoIn_NoNode
-;
-
-BitwiseANDExprNoBF_NoNode:
- EqualityExprNoBF_NoNode
- | BitwiseANDExprNoBF_NoNode '&' EqualityExpr_NoNode
-;
-
-BitwiseXORExpr_NoNode:
- BitwiseANDExpr_NoNode
- | BitwiseXORExpr_NoNode '^' BitwiseANDExpr_NoNode
-;
-
-BitwiseXORExprNoIn_NoNode:
- BitwiseANDExprNoIn_NoNode
- | BitwiseXORExprNoIn_NoNode '^' BitwiseANDExprNoIn_NoNode
-;
-
-BitwiseXORExprNoBF_NoNode:
- BitwiseANDExprNoBF_NoNode
- | BitwiseXORExprNoBF_NoNode '^' BitwiseANDExpr_NoNode
-;
-
-BitwiseORExpr_NoNode:
- BitwiseXORExpr_NoNode
- | BitwiseORExpr_NoNode '|' BitwiseXORExpr_NoNode
-;
-
-BitwiseORExprNoIn_NoNode:
- BitwiseXORExprNoIn_NoNode
- | BitwiseORExprNoIn_NoNode '|' BitwiseXORExprNoIn_NoNode
-;
-
-BitwiseORExprNoBF_NoNode:
- BitwiseXORExprNoBF_NoNode
- | BitwiseORExprNoBF_NoNode '|' BitwiseXORExpr_NoNode
-;
-
-LogicalANDExpr_NoNode:
- BitwiseORExpr_NoNode
- | LogicalANDExpr_NoNode AND BitwiseORExpr_NoNode
-;
-
-LogicalANDExprNoIn_NoNode:
- BitwiseORExprNoIn_NoNode
- | LogicalANDExprNoIn_NoNode AND BitwiseORExprNoIn_NoNode
-;
-
-LogicalANDExprNoBF_NoNode:
- BitwiseORExprNoBF_NoNode
- | LogicalANDExprNoBF_NoNode AND BitwiseORExpr_NoNode
-;
-
-LogicalORExpr_NoNode:
- LogicalANDExpr_NoNode
- | LogicalORExpr_NoNode OR LogicalANDExpr_NoNode
-;
-
-LogicalORExprNoIn_NoNode:
- LogicalANDExprNoIn_NoNode
- | LogicalORExprNoIn_NoNode OR LogicalANDExprNoIn_NoNode
-;
-
-LogicalORExprNoBF_NoNode:
- LogicalANDExprNoBF_NoNode
- | LogicalORExprNoBF_NoNode OR LogicalANDExpr_NoNode
-;
-
-ConditionalExpr_NoNode:
- LogicalORExpr_NoNode
- | LogicalORExpr_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
-;
-
-ConditionalExprNoIn_NoNode:
- LogicalORExprNoIn_NoNode
- | LogicalORExprNoIn_NoNode '?' AssignmentExprNoIn_NoNode ':' AssignmentExprNoIn_NoNode
-;
-
-ConditionalExprNoBF_NoNode:
- LogicalORExprNoBF_NoNode
- | LogicalORExprNoBF_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
-;
-
-AssignmentExpr_NoNode:
- ConditionalExpr_NoNode
- | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
-;
-
-AssignmentExprNoIn_NoNode:
- ConditionalExprNoIn_NoNode
- | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExprNoIn_NoNode
-;
-
-AssignmentExprNoBF_NoNode:
- ConditionalExprNoBF_NoNode
- | LeftHandSideExprNoBF_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
-;
-
-AssignmentOperator_NoNode:
- '='
- | PLUSEQUAL
- | MINUSEQUAL
- | MULTEQUAL
- | DIVEQUAL
- | LSHIFTEQUAL
- | RSHIFTEQUAL
- | URSHIFTEQUAL
- | ANDEQUAL
- | XOREQUAL
- | OREQUAL
- | MODEQUAL
-;
-
-Expr_NoNode:
- AssignmentExpr_NoNode
- | Expr_NoNode ',' AssignmentExpr_NoNode
-;
-
-ExprNoIn_NoNode:
- AssignmentExprNoIn_NoNode
- | ExprNoIn_NoNode ',' AssignmentExprNoIn_NoNode
-;
-
-ExprNoBF_NoNode:
- AssignmentExprNoBF_NoNode
- | ExprNoBF_NoNode ',' AssignmentExpr_NoNode
-;
-
-Statement_NoNode:
- Block_NoNode
- | VariableStatement_NoNode
- | ConstStatement_NoNode
- | FunctionDeclaration_NoNode
- | EmptyStatement_NoNode
- | ExprStatement_NoNode
- | IfStatement_NoNode
- | IterationStatement_NoNode
- | ContinueStatement_NoNode
- | BreakStatement_NoNode
- | ReturnStatement_NoNode
- | WithStatement_NoNode
- | SwitchStatement_NoNode
- | LabelledStatement_NoNode
- | ThrowStatement_NoNode
- | TryStatement_NoNode
- | DebuggerStatement_NoNode
-;
-
-Block_NoNode:
- OPENBRACE CLOSEBRACE { }
- | OPENBRACE SourceElements_NoNode CLOSEBRACE { }
-;
-
-VariableStatement_NoNode:
- VAR VariableDeclarationList_NoNode ';'
- | VAR VariableDeclarationList_NoNode error { AUTO_SEMICOLON; }
-;
-
-VariableDeclarationList_NoNode:
- IDENT { }
- | IDENT Initializer_NoNode { }
- | VariableDeclarationList_NoNode ',' IDENT
- | VariableDeclarationList_NoNode ',' IDENT Initializer_NoNode
-;
-
-VariableDeclarationListNoIn_NoNode:
- IDENT { }
- | IDENT InitializerNoIn_NoNode { }
- | VariableDeclarationListNoIn_NoNode ',' IDENT
- | VariableDeclarationListNoIn_NoNode ',' IDENT InitializerNoIn_NoNode
-;
-
-ConstStatement_NoNode:
- CONSTTOKEN ConstDeclarationList_NoNode ';'
- | CONSTTOKEN ConstDeclarationList_NoNode error { AUTO_SEMICOLON; }
-;
-
-ConstDeclarationList_NoNode:
- ConstDeclaration_NoNode
- | ConstDeclarationList_NoNode ',' ConstDeclaration_NoNode
-;
-
-ConstDeclaration_NoNode:
- IDENT { }
- | IDENT Initializer_NoNode { }
-;
-
-Initializer_NoNode:
- '=' AssignmentExpr_NoNode
-;
-
-InitializerNoIn_NoNode:
- '=' AssignmentExprNoIn_NoNode
-;
-
-EmptyStatement_NoNode:
- ';'
-;
-
-ExprStatement_NoNode:
- ExprNoBF_NoNode ';'
- | ExprNoBF_NoNode error { AUTO_SEMICOLON; }
-;
-
-IfStatement_NoNode:
- IF '(' Expr_NoNode ')' Statement_NoNode %prec IF_WITHOUT_ELSE
- | IF '(' Expr_NoNode ')' Statement_NoNode ELSE Statement_NoNode
-;
-
-IterationStatement_NoNode:
- DO Statement_NoNode WHILE '(' Expr_NoNode ')' ';'
- | DO Statement_NoNode WHILE '(' Expr_NoNode ')' error // Always performs automatic semicolon insertion
- | WHILE '(' Expr_NoNode ')' Statement_NoNode
- | FOR '(' ExprNoInOpt_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
- | FOR '(' VAR VariableDeclarationListNoIn_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
- | FOR '(' LeftHandSideExpr_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
- | FOR '(' VAR IDENT INTOKEN Expr_NoNode ')' Statement_NoNode
- | FOR '(' VAR IDENT InitializerNoIn_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
-;
-
-ExprOpt_NoNode:
- /* nothing */
- | Expr_NoNode
-;
-
-ExprNoInOpt_NoNode:
- /* nothing */
- | ExprNoIn_NoNode
-;
-
-ContinueStatement_NoNode:
- CONTINUE ';'
- | CONTINUE error { AUTO_SEMICOLON; }
- | CONTINUE IDENT ';'
- | CONTINUE IDENT error { AUTO_SEMICOLON; }
-;
-
-BreakStatement_NoNode:
- BREAK ';'
- | BREAK error { AUTO_SEMICOLON; }
- | BREAK IDENT ';'
- | BREAK IDENT error { AUTO_SEMICOLON; }
-;
-
-ReturnStatement_NoNode:
- RETURN ';'
- | RETURN error { AUTO_SEMICOLON; }
- | RETURN Expr_NoNode ';'
- | RETURN Expr_NoNode error { AUTO_SEMICOLON; }
-;
-
-WithStatement_NoNode:
- WITH '(' Expr_NoNode ')' Statement_NoNode
-;
-
-SwitchStatement_NoNode:
- SWITCH '(' Expr_NoNode ')' CaseBlock_NoNode
-;
-
-CaseBlock_NoNode:
- OPENBRACE CaseClausesOpt_NoNode CLOSEBRACE { }
- | OPENBRACE CaseClausesOpt_NoNode DefaultClause_NoNode CaseClausesOpt_NoNode CLOSEBRACE { }
-;
-
-CaseClausesOpt_NoNode:
- /* nothing */
- | CaseClauses_NoNode
-;
-
-CaseClauses_NoNode:
- CaseClause_NoNode
- | CaseClauses_NoNode CaseClause_NoNode
-;
-
-CaseClause_NoNode:
- CASE Expr_NoNode ':'
- | CASE Expr_NoNode ':' SourceElements_NoNode
-;
-
-DefaultClause_NoNode:
- DEFAULT ':'
- | DEFAULT ':' SourceElements_NoNode
-;
-
-LabelledStatement_NoNode:
- IDENT ':' Statement_NoNode { }
-;
-
-ThrowStatement_NoNode:
- THROW Expr_NoNode ';'
- | THROW Expr_NoNode error { AUTO_SEMICOLON; }
-;
-
-TryStatement_NoNode:
- TRY Block_NoNode FINALLY Block_NoNode
- | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode
- | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode FINALLY Block_NoNode
-;
-
-DebuggerStatement_NoNode:
- DEBUGGER ';'
- | DEBUGGER error { AUTO_SEMICOLON; }
-;
-
-FunctionDeclaration_NoNode:
- FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
- | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
-;
-
-FunctionExpr_NoNode:
- FUNCTION '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
- | FUNCTION '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
- | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
- | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
-;
-
-FormalParameterList_NoNode:
- IDENT { }
- | FormalParameterList_NoNode ',' IDENT
-;
-
-FunctionBody_NoNode:
- /* not in spec */
- | SourceElements_NoNode
-;
-
-SourceElements_NoNode:
- Statement_NoNode
- | SourceElements_NoNode Statement_NoNode
-;
-
-// End NoNodes
-
-%%
-
-#undef GLOBAL_DATA
-
-static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
-{
- if (!loc->isLocation())
- return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot);
-
- if (loc->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(loc);
- if (op == OpEqual) {
- AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments);
- setExceptionLocation(node, start, divot, end);
- return node;
- } else
- return new (globalData) ReadModifyResolveNode(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 (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
- else {
- ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(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 (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
-
- ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->endOffset());
- return node;
-}
-
-static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
-{
- if (!expr->isLocation())
- return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
-
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
- }
- if (expr->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PrefixBracketNode* node = new (globalData) PrefixBracketNode(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 (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->startOffset());
- return node;
-}
-
-static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
-{
- if (!expr->isLocation())
- return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
-
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
- }
- if (expr->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- PostfixBracketNode* node = new (globalData) PostfixBracketNode(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 (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->endOffset());
- return node;
-}
-
-static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
-{
- CodeFeatures features = func.m_features | args.m_features;
- int numConstants = func.m_numConstants + args.m_numConstants;
- if (!func.m_node->isLocation())
- return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
- if (func.m_node->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
- const Identifier& identifier = resolve->identifier();
- if (identifier == globalData->propertyNames->eval)
- return createNodeInfo<ExpressionNode*>(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
- return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
- }
- if (func.m_node->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
- FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
- node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
- return createNodeInfo<ExpressionNode*>(node, features, numConstants);
- }
- ASSERT(func.m_node->isDotAccessorNode());
- DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
- FunctionCallDotNode* node;
- if (dot->identifier() == globalData->propertyNames->call)
- node = new (globalData) CallFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
- else if (dot->identifier() == globalData->propertyNames->apply)
- node = new (globalData) ApplyFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
- else
- node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
- node->setSubexpressionInfo(dot->divot(), dot->endOffset());
- return createNodeInfo<ExpressionNode*>(node, features, numConstants);
-}
-
-static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr)
-{
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) TypeOfResolveNode(globalData, resolve->identifier());
- }
- return new (globalData) TypeOfValueNode(globalData, expr);
-}
-
-static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end)
-{
- if (!expr->isLocation())
- return new (globalData) DeleteValueNode(globalData, expr);
- if (expr->isResolveNode()) {
- ResolveNode* resolve = static_cast<ResolveNode*>(expr);
- return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot);
- }
- if (expr->isBracketAccessorNode()) {
- BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
- return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
- }
- ASSERT(expr->isDotAccessorNode());
- DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
- return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
-}
-
-static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
-{
- PropertyNode::Type type;
- if (getOrSet == "get")
- type = PropertyNode::Getter;
- else if (getOrSet == "set")
- type = PropertyNode::Setter;
- else
- return 0;
- return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
-}
-
-static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
-{
- if (n->isNumber()) {
- NumberNode* numberNode = static_cast<NumberNode*>(n);
- numberNode->setValue(-numberNode->value());
- return numberNode;
- }
-
- return new (globalData) NegateNode(globalData, n);
-}
-
-static NumberNode* makeNumberNode(JSGlobalData* globalData, double d)
-{
- return new (globalData) NumberNode(globalData, d);
-}
-
-static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
-{
- if (expr->isNumber())
- return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value()));
- return new (globalData) BitwiseNotNode(globalData, expr);
-}
-
-static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- expr1 = expr1->stripUnaryPlus();
- expr2 = expr2->stripUnaryPlus();
-
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
-
- if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
- return new (globalData) UnaryPlusNode(globalData, expr2);
-
- if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
- return new (globalData) UnaryPlusNode(globalData, expr1);
-
- return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- expr1 = expr1->stripUnaryPlus();
- expr2 = expr2->stripUnaryPlus();
-
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
- return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
- return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- expr1 = expr1->stripUnaryPlus();
- expr2 = expr2->stripUnaryPlus();
-
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
- return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-{
- if (expr1->isNumber() && expr2->isNumber())
- return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
- return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments);
-}
-
-// Called by yyparse on error.
-int yyerror(const char*)
-{
- return 1;
-}
-
-// May we automatically insert a semicolon?
-static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
-{
- return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
-}
-
-static ExpressionNode* combineCommaNodes(JSGlobalData* globalData, ExpressionNode* list, ExpressionNode* init)
-{
- if (!list)
- return init;
- if (list->isCommaNode()) {
- static_cast<CommaNode*>(list)->append(init);
- return list;
- }
- return new (globalData) CommaNode(globalData, list, init);
-}
-
-// We turn variable declarations into either assignments or empty
-// statements (which later get stripped out), because the actual
-// declaration work is hoisted up to the start of the function body
-static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
-{
- if (!expr)
- return new (globalData) EmptyStatementNode(globalData);
- return new (globalData) VarStatementNode(globalData, expr);
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp
deleted file mode 100644
index 83f56bd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp
+++ /dev/null
@@ -1,1044 +0,0 @@
-/*
- * 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)
- *
- * 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 "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;
-
-// We can't specify the namespace in yacc's C output, so do it here instead.
-using namespace JSC;
-
-#include "Grammar.h"
-#include "Lookup.h"
-#include "Lexer.lut.h"
-
-namespace JSC {
-
-static const UChar byteOrderMark = 0xFEFF;
-
-Lexer::Lexer(JSGlobalData* globalData)
- : m_isReparsing(false)
- , m_globalData(globalData)
- , m_keywordTable(JSC::mainTable)
-{
- m_buffer8.reserveInitialCapacity(initialReadBufferCapacity);
- m_buffer16.reserveInitialCapacity(initialReadBufferCapacity);
-}
-
-Lexer::~Lexer()
-{
- m_keywordTable.deleteTable();
-}
-
-inline const UChar* Lexer::currentCharacter() const
-{
- return m_code - 4;
-}
-
-inline int Lexer::currentOffset() const
-{
- return currentCharacter() - m_codeStart;
-}
-
-ALWAYS_INLINE void Lexer::shift1()
-{
- m_current = m_next1;
- m_next1 = m_next2;
- m_next2 = m_next3;
- if (LIKELY(m_code < m_codeEnd))
- m_next3 = m_code[0];
- else
- m_next3 = -1;
-
- ++m_code;
-}
-
-ALWAYS_INLINE void Lexer::shift2()
-{
- m_current = m_next2;
- m_next1 = m_next3;
- if (LIKELY(m_code + 1 < m_codeEnd)) {
- m_next2 = m_code[0];
- m_next3 = m_code[1];
- } else {
- m_next2 = m_code < m_codeEnd ? m_code[0] : -1;
- m_next3 = -1;
- }
-
- m_code += 2;
-}
-
-ALWAYS_INLINE void Lexer::shift3()
-{
- m_current = m_next3;
- if (LIKELY(m_code + 2 < m_codeEnd)) {
- m_next1 = m_code[0];
- m_next2 = m_code[1];
- m_next3 = m_code[2];
- } else {
- m_next1 = m_code < m_codeEnd ? m_code[0] : -1;
- m_next2 = m_code + 1 < m_codeEnd ? m_code[1] : -1;
- m_next3 = -1;
- }
-
- m_code += 3;
-}
-
-ALWAYS_INLINE void Lexer::shift4()
-{
- if (LIKELY(m_code + 3 < m_codeEnd)) {
- m_current = m_code[0];
- m_next1 = m_code[1];
- m_next2 = m_code[2];
- m_next3 = m_code[3];
- } else {
- m_current = m_code < m_codeEnd ? m_code[0] : -1;
- m_next1 = m_code + 1 < m_codeEnd ? m_code[1] : -1;
- m_next2 = m_code + 2 < m_codeEnd ? m_code[2] : -1;
- m_next3 = -1;
- }
-
- m_code += 4;
-}
-
-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;
-
- // ECMA-262 calls for stripping all Cf characters, but we only strip BOM characters.
- // See <https://bugs.webkit.org/show_bug.cgi?id=4931> for details.
- if (source.provider()->hasBOMs()) {
- for (const UChar* p = m_codeStart; p < m_codeEnd; ++p) {
- if (UNLIKELY(*p == byteOrderMark)) {
- copyCodeWithoutBOMs();
- break;
- }
- }
- }
-
- // Read the first characters into the 4-character buffer.
- shift4();
- ASSERT(currentOffset() == source.startOffset());
-}
-
-void Lexer::copyCodeWithoutBOMs()
-{
- // Note: In this case, the character offset data for debugging will be incorrect.
- // If it's important to correctly debug code with extraneous BOMs, then the caller
- // should strip the BOMs when creating the SourceProvider object and do its own
- // mapping of offsets within the stripped text to original text offset.
-
- m_codeWithoutBOMs.reserveCapacity(m_codeEnd - m_code);
- for (const UChar* p = m_code; p < m_codeEnd; ++p) {
- UChar c = *p;
- if (c != byteOrderMark)
- m_codeWithoutBOMs.append(c);
- }
- ptrdiff_t startDelta = m_codeStart - m_code;
- m_code = m_codeWithoutBOMs.data();
- m_codeStart = m_code + startDelta;
- m_codeEnd = m_codeWithoutBOMs.data() + m_codeWithoutBOMs.size();
-}
-
-void Lexer::shiftLineTerminator()
-{
- ASSERT(isLineTerminator(m_current));
-
- // Allow both CRLF and LFCR.
- if (m_current + m_next1 == '\n' + '\r')
- shift2();
- else
- shift1();
-
- ++m_lineNumber;
-}
-
-ALWAYS_INLINE const Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
-{
- return &m_arena->makeIdentifier(m_globalData, characters, length);
-}
-
-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) ? isASCIIAlpha(c) || c == '$' || c == '_' : 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)
-{
- return isASCII(c) ? isASCIIAlphanumeric(c) || c == '$' || c == '_' : 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;
- default:
- return c;
- }
-}
-
-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)));
-}
-
-int Lexer::lex(void* p1, void* p2)
-{
- ASSERT(!m_error);
- ASSERT(m_buffer8.isEmpty());
- ASSERT(m_buffer16.isEmpty());
-
- YYSTYPE* lvalp = static_cast<YYSTYPE*>(p1);
- YYLTYPE* llocp = static_cast<YYLTYPE*>(p2);
- int token = 0;
- m_terminator = false;
-
-start:
- while (isWhiteSpace(m_current))
- shift1();
-
- int startOffset = currentOffset();
-
- if (m_current == -1) {
- if (!m_terminator && !m_delimited && !m_isReparsing) {
- // automatic semicolon insertion if program incomplete
- token = ';';
- goto doneSemicolon;
- }
- return 0;
- }
-
- m_delimited = false;
- switch (m_current) {
- case '>':
- if (m_next1 == '>' && m_next2 == '>') {
- if (m_next3 == '=') {
- shift4();
- token = URSHIFTEQUAL;
- break;
- }
- shift3();
- token = URSHIFT;
- break;
- }
- if (m_next1 == '>') {
- if (m_next2 == '=') {
- shift3();
- token = RSHIFTEQUAL;
- break;
- }
- shift2();
- token = RSHIFT;
- break;
- }
- if (m_next1 == '=') {
- shift2();
- token = GE;
- break;
- }
- shift1();
- token = '>';
- break;
- case '=':
- if (m_next1 == '=') {
- if (m_next2 == '=') {
- shift3();
- token = STREQ;
- break;
- }
- shift2();
- token = EQEQ;
- break;
- }
- shift1();
- token = '=';
- break;
- case '!':
- if (m_next1 == '=') {
- if (m_next2 == '=') {
- shift3();
- token = STRNEQ;
- break;
- }
- shift2();
- token = NE;
- break;
- }
- shift1();
- token = '!';
- break;
- case '<':
- if (m_next1 == '!' && m_next2 == '-' && m_next3 == '-') {
- // <!-- marks the beginning of a line comment (for www usage)
- shift4();
- goto inSingleLineComment;
- }
- if (m_next1 == '<') {
- if (m_next2 == '=') {
- shift3();
- token = LSHIFTEQUAL;
- break;
- }
- shift2();
- token = LSHIFT;
- break;
- }
- if (m_next1 == '=') {
- shift2();
- token = LE;
- break;
- }
- shift1();
- token = '<';
- break;
- case '+':
- if (m_next1 == '+') {
- shift2();
- if (m_terminator) {
- token = AUTOPLUSPLUS;
- break;
- }
- token = PLUSPLUS;
- break;
- }
- if (m_next1 == '=') {
- shift2();
- token = PLUSEQUAL;
- break;
- }
- shift1();
- token = '+';
- break;
- case '-':
- if (m_next1 == '-') {
- if (m_atLineStart && m_next2 == '>') {
- shift3();
- goto inSingleLineComment;
- }
- shift2();
- if (m_terminator) {
- token = AUTOMINUSMINUS;
- break;
- }
- token = MINUSMINUS;
- break;
- }
- if (m_next1 == '=') {
- shift2();
- token = MINUSEQUAL;
- break;
- }
- shift1();
- token = '-';
- break;
- case '*':
- if (m_next1 == '=') {
- shift2();
- token = MULTEQUAL;
- break;
- }
- shift1();
- token = '*';
- break;
- case '/':
- if (m_next1 == '/') {
- shift2();
- goto inSingleLineComment;
- }
- if (m_next1 == '*')
- goto inMultiLineComment;
- if (m_next1 == '=') {
- shift2();
- token = DIVEQUAL;
- break;
- }
- shift1();
- token = '/';
- break;
- case '&':
- if (m_next1 == '&') {
- shift2();
- token = AND;
- break;
- }
- if (m_next1 == '=') {
- shift2();
- token = ANDEQUAL;
- break;
- }
- shift1();
- token = '&';
- break;
- case '^':
- if (m_next1 == '=') {
- shift2();
- token = XOREQUAL;
- break;
- }
- shift1();
- token = '^';
- break;
- case '%':
- if (m_next1 == '=') {
- shift2();
- token = MODEQUAL;
- break;
- }
- shift1();
- token = '%';
- break;
- case '|':
- if (m_next1 == '=') {
- shift2();
- token = OREQUAL;
- break;
- }
- if (m_next1 == '|') {
- shift2();
- token = OR;
- break;
- }
- shift1();
- token = '|';
- break;
- case '.':
- if (isASCIIDigit(m_next1)) {
- record8('.');
- shift1();
- goto inNumberAfterDecimalPoint;
- }
- token = '.';
- shift1();
- break;
- case ',':
- case '~':
- case '?':
- case ':':
- case '(':
- case ')':
- case '[':
- case ']':
- token = m_current;
- shift1();
- break;
- case ';':
- shift1();
- m_delimited = true;
- token = ';';
- break;
- case '{':
- lvalp->intValue = currentOffset();
- shift1();
- token = OPENBRACE;
- break;
- case '}':
- lvalp->intValue = currentOffset();
- shift1();
- m_delimited = true;
- token = CLOSEBRACE;
- break;
- case '\\':
- goto startIdentifierWithBackslash;
- case '0':
- goto startNumberWithZeroDigit;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- goto startNumber;
- case '"':
- case '\'':
- goto startString;
- default:
- if (isIdentStart(m_current))
- goto startIdentifierOrKeyword;
- if (isLineTerminator(m_current)) {
- shiftLineTerminator();
- m_atLineStart = true;
- m_terminator = true;
- if (lastTokenWasRestrKeyword()) {
- token = ';';
- goto doneSemicolon;
- }
- goto start;
- }
- goto returnError;
- }
-
- m_atLineStart = false;
- goto returnToken;
-
-startString: {
- int stringQuoteCharacter = m_current;
- shift1();
-
- const UChar* stringStart = currentCharacter();
- while (m_current != stringQuoteCharacter) {
- // 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(m_current == '\\') || UNLIKELY(((static_cast<unsigned>(m_current) - 0xE) & 0x2000))) {
- m_buffer16.append(stringStart, currentCharacter() - stringStart);
- goto inString;
- }
- shift1();
- }
- lvalp->ident = makeIdentifier(stringStart, currentCharacter() - stringStart);
- shift1();
- m_atLineStart = false;
- m_delimited = false;
- token = STRING;
- goto returnToken;
-
-inString:
- while (m_current != stringQuoteCharacter) {
- if (m_current == '\\')
- goto inStringEscapeSequence;
- if (UNLIKELY(isLineTerminator(m_current)))
- goto returnError;
- if (UNLIKELY(m_current == -1))
- goto returnError;
- record16(m_current);
- shift1();
- }
- goto doneString;
-
-inStringEscapeSequence:
- shift1();
- if (m_current == 'x') {
- shift1();
- if (isASCIIHexDigit(m_current) && isASCIIHexDigit(m_next1)) {
- record16(convertHex(m_current, m_next1));
- shift2();
- goto inString;
- }
- record16('x');
- if (m_current == stringQuoteCharacter)
- goto doneString;
- goto inString;
- }
- if (m_current == 'u') {
- shift1();
- if (isASCIIHexDigit(m_current) && isASCIIHexDigit(m_next1) && isASCIIHexDigit(m_next2) && isASCIIHexDigit(m_next3)) {
- record16(convertUnicode(m_current, m_next1, m_next2, m_next3));
- shift4();
- goto inString;
- }
- if (m_current == stringQuoteCharacter) {
- record16('u');
- goto doneString;
- }
- goto returnError;
- }
- if (isASCIIOctalDigit(m_current)) {
- if (m_current >= '0' && m_current <= '3' && isASCIIOctalDigit(m_next1) && isASCIIOctalDigit(m_next2)) {
- record16((m_current - '0') * 64 + (m_next1 - '0') * 8 + m_next2 - '0');
- shift3();
- goto inString;
- }
- if (isASCIIOctalDigit(m_next1)) {
- record16((m_current - '0') * 8 + m_next1 - '0');
- shift2();
- goto inString;
- }
- record16(m_current - '0');
- shift1();
- goto inString;
- }
- if (isLineTerminator(m_current)) {
- shiftLineTerminator();
- goto inString;
- }
- if (m_current == -1)
- goto returnError;
- record16(singleEscape(m_current));
- shift1();
- goto inString;
-}
-
-startIdentifierWithBackslash:
- shift1();
- if (UNLIKELY(m_current != 'u'))
- goto returnError;
- shift1();
- if (UNLIKELY(!isASCIIHexDigit(m_current) || !isASCIIHexDigit(m_next1) || !isASCIIHexDigit(m_next2) || !isASCIIHexDigit(m_next3)))
- goto returnError;
- token = convertUnicode(m_current, m_next1, m_next2, m_next3);
- if (UNLIKELY(!isIdentStart(token)))
- goto returnError;
- goto inIdentifierAfterCharacterCheck;
-
-startIdentifierOrKeyword: {
- const UChar* identifierStart = currentCharacter();
- shift1();
- while (isIdentPart(m_current))
- shift1();
- if (LIKELY(m_current != '\\')) {
- lvalp->ident = makeIdentifier(identifierStart, currentCharacter() - identifierStart);
- goto doneIdentifierOrKeyword;
- }
- m_buffer16.append(identifierStart, currentCharacter() - identifierStart);
-}
-
- do {
- shift1();
- if (UNLIKELY(m_current != 'u'))
- goto returnError;
- shift1();
- if (UNLIKELY(!isASCIIHexDigit(m_current) || !isASCIIHexDigit(m_next1) || !isASCIIHexDigit(m_next2) || !isASCIIHexDigit(m_next3)))
- goto returnError;
- token = convertUnicode(m_current, m_next1, m_next2, m_next3);
- if (UNLIKELY(!isIdentPart(token)))
- goto returnError;
-inIdentifierAfterCharacterCheck:
- record16(token);
- shift4();
-
- while (isIdentPart(m_current)) {
- record16(m_current);
- shift1();
- }
- } while (UNLIKELY(m_current == '\\'));
- goto doneIdentifier;
-
-inSingleLineComment:
- while (!isLineTerminator(m_current)) {
- if (UNLIKELY(m_current == -1))
- return 0;
- shift1();
- }
- shiftLineTerminator();
- m_atLineStart = true;
- m_terminator = true;
- if (lastTokenWasRestrKeyword())
- goto doneSemicolon;
- goto start;
-
-inMultiLineComment:
- shift2();
- while (m_current != '*' || m_next1 != '/') {
- if (isLineTerminator(m_current))
- shiftLineTerminator();
- else {
- shift1();
- if (UNLIKELY(m_current == -1))
- goto returnError;
- }
- }
- shift2();
- m_atLineStart = false;
- goto start;
-
-startNumberWithZeroDigit:
- shift1();
- if ((m_current | 0x20) == 'x' && isASCIIHexDigit(m_next1)) {
- shift1();
- goto inHex;
- }
- if (m_current == '.') {
- record8('0');
- record8('.');
- shift1();
- goto inNumberAfterDecimalPoint;
- }
- if ((m_current | 0x20) == 'e') {
- record8('0');
- record8('e');
- shift1();
- goto inExponentIndicator;
- }
- if (isASCIIOctalDigit(m_current))
- goto inOctal;
- if (isASCIIDigit(m_current))
- goto startNumber;
- lvalp->doubleValue = 0;
- goto doneNumeric;
-
-inNumberAfterDecimalPoint:
- while (isASCIIDigit(m_current)) {
- record8(m_current);
- shift1();
- }
- if ((m_current | 0x20) == 'e') {
- record8('e');
- shift1();
- goto inExponentIndicator;
- }
- goto doneNumber;
-
-inExponentIndicator:
- if (m_current == '+' || m_current == '-') {
- record8(m_current);
- shift1();
- }
- if (!isASCIIDigit(m_current))
- goto returnError;
- do {
- record8(m_current);
- shift1();
- } while (isASCIIDigit(m_current));
- goto doneNumber;
-
-inOctal: {
- do {
- record8(m_current);
- shift1();
- } while (isASCIIOctalDigit(m_current));
- if (isASCIIDigit(m_current))
- goto startNumber;
-
- double dval = 0;
-
- const char* end = m_buffer8.end();
- for (const char* p = m_buffer8.data(); p < end; ++p) {
- dval *= 8;
- dval += *p - '0';
- }
- if (dval >= mantissaOverflowLowerBound)
- dval = parseIntOverflow(m_buffer8.data(), end - m_buffer8.data(), 8);
-
- m_buffer8.resize(0);
-
- lvalp->doubleValue = dval;
- goto doneNumeric;
-}
-
-inHex: {
- do {
- record8(m_current);
- shift1();
- } while (isASCIIHexDigit(m_current));
-
- double dval = 0;
-
- const char* end = m_buffer8.end();
- for (const char* p = m_buffer8.data(); p < end; ++p) {
- dval *= 16;
- dval += toASCIIHexValue(*p);
- }
- if (dval >= mantissaOverflowLowerBound)
- dval = parseIntOverflow(m_buffer8.data(), end - m_buffer8.data(), 16);
-
- m_buffer8.resize(0);
-
- lvalp->doubleValue = dval;
- goto doneNumeric;
-}
-
-startNumber:
- record8(m_current);
- shift1();
- while (isASCIIDigit(m_current)) {
- record8(m_current);
- shift1();
- }
- if (m_current == '.') {
- record8('.');
- shift1();
- goto inNumberAfterDecimalPoint;
- }
- if ((m_current | 0x20) == 'e') {
- record8('e');
- shift1();
- goto inExponentIndicator;
- }
-
- // Fall through into doneNumber.
-
-doneNumber:
- // Null-terminate string for strtod.
- m_buffer8.append('\0');
- lvalp->doubleValue = WTF::strtod(m_buffer8.data(), 0);
- m_buffer8.resize(0);
-
- // Fall through into doneNumeric.
-
-doneNumeric:
- // No identifiers allowed directly after numeric literal, e.g. "3in" is bad.
- if (UNLIKELY(isIdentStart(m_current)))
- goto returnError;
-
- m_atLineStart = false;
- m_delimited = false;
- token = NUMBER;
- goto returnToken;
-
-doneSemicolon:
- token = ';';
- m_delimited = true;
- goto returnToken;
-
-doneIdentifier:
- m_atLineStart = false;
- m_delimited = false;
- lvalp->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
- m_buffer16.resize(0);
- token = IDENT;
- goto returnToken;
-
-doneIdentifierOrKeyword: {
- m_atLineStart = false;
- m_delimited = false;
- m_buffer16.resize(0);
- const HashEntry* entry = m_keywordTable.entry(m_globalData, *lvalp->ident);
- token = entry ? entry->lexerValue() : IDENT;
- goto returnToken;
-}
-
-doneString:
- // Atomize constant strings in case they're later used in property lookup.
- shift1();
- m_atLineStart = false;
- m_delimited = false;
- lvalp->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
- m_buffer16.resize(0);
- token = STRING;
-
- // Fall through into returnToken.
-
-returnToken: {
- int lineNumber = m_lineNumber;
- llocp->first_line = lineNumber;
- llocp->last_line = lineNumber;
- llocp->first_column = startOffset;
- llocp->last_column = currentOffset();
-
- m_lastToken = token;
- return token;
-}
-
-returnError:
- m_error = true;
- return -1;
-}
-
-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;
- }
-
- shift1();
-
- 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);
- shift1();
- }
-
- 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;
-
- shift1();
-
- 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))
- shift1();
-
- return true;
-}
-
-void Lexer::clear()
-{
- m_arena = 0;
- m_codeWithoutBOMs.clear();
-
- Vector<char> newBuffer8;
- newBuffer8.reserveInitialCapacity(initialReadBufferCapacity);
- m_buffer8.swap(newBuffer8);
-
- Vector<UChar> newBuffer16;
- newBuffer16.reserveInitialCapacity(initialReadBufferCapacity);
- m_buffer16.swap(newBuffer16);
-
- m_isReparsing = false;
-}
-
-SourceCode Lexer::sourceCode(int openBrace, int closeBrace, int firstLine)
-{
- if (m_codeWithoutBOMs.isEmpty())
- return SourceCode(m_source->provider(), openBrace, closeBrace + 1, firstLine);
-
- const UChar* data = m_source->provider()->data();
-
- ASSERT(openBrace < closeBrace);
-
- int numBOMsBeforeOpenBrace = 0;
- int numBOMsBetweenBraces = 0;
-
- int i;
- for (i = m_source->startOffset(); i < openBrace; ++i)
- numBOMsBeforeOpenBrace += data[i] == byteOrderMark;
- for (; i < closeBrace; ++i)
- numBOMsBetweenBraces += data[i] == byteOrderMark;
-
- return SourceCode(m_source->provider(), openBrace + numBOMsBeforeOpenBrace,
- closeBrace + numBOMsBeforeOpenBrace + numBOMsBetweenBraces + 1, firstLine);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h b/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h
deleted file mode 100644
index c76696c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
- * Copyright (C) 2002, 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 Lexer_h
-#define Lexer_h
-
-#include "Lookup.h"
-#include "ParserArena.h"
-#include "SourceCode.h"
-#include <wtf/ASCIICType.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; }
-
- // Functions for the parser itself.
- int lex(void* lvalp, void* llocp);
- int lineNumber() const { return m_lineNumber; }
- 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();
-
- private:
- friend class JSGlobalData;
-
- Lexer(JSGlobalData*);
- ~Lexer();
-
- void shift1();
- void shift2();
- void shift3();
- void shift4();
- void shiftLineTerminator();
-
- void record8(int);
- void record16(int);
- void record16(UChar);
-
- void copyCodeWithoutBOMs();
-
- int currentOffset() const;
- const UChar* currentCharacter() const;
-
- const Identifier* makeIdentifier(const UChar* characters, size_t length);
-
- bool lastTokenWasRestrKeyword() const;
-
- static const size_t initialReadBufferCapacity = 32;
-
- int m_lineNumber;
-
- 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;
- int m_next1;
- int m_next2;
- int m_next3;
-
- IdentifierArena* m_arena;
-
- JSGlobalData* m_globalData;
-
- const HashTable m_keywordTable;
-
- Vector<UChar> m_codeWithoutBOMs;
- };
-
- inline bool Lexer::isWhiteSpace(int ch)
- {
- return isASCII(ch) ? (ch == ' ' || ch == '\t' || ch == 0xB || ch == 0xC) : WTF::Unicode::isSeparatorSpace(ch);
- }
-
- 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);
- }
-
- // A bridge for yacc from the C world to the C++ world.
- inline int jscyylex(void* lvalp, void* llocp, void* globalData)
- {
- return static_cast<JSGlobalData*>(globalData)->lexer->lex(lvalp, llocp);
- }
-
-} // namespace JSC
-
-#endif // Lexer_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h b/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h
deleted file mode 100644
index dd3b981..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/NodeConstructors.h
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- * 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->lineNumber())
- {
- }
-
- 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/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
deleted file mode 100644
index 4b97e9a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-* 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);
-}
-
-inline 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, int numConstants)
- : m_numConstants(numConstants)
- , m_statements(statements)
-{
- m_arena.swap(arena);
- if (varStack)
- m_varStack.swap(*varStack);
- if (funcStack)
- m_functionStack.swap(*funcStack);
-}
-
-// ------------------------------ ScopeNode -----------------------------
-
-ScopeNode::ScopeNode(JSGlobalData* globalData)
- : StatementNode(globalData)
- , ParserArenaRefCounted(globalData)
- , m_features(NoFeatures)
-{
-}
-
-ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, CodeFeatures features, int numConstants)
- : StatementNode(globalData)
- , ParserArenaRefCounted(globalData)
- , m_data(new ScopeNodeData(globalData->parser->arena(), children, varStack, funcStack, 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, const SourceCode& source, CodeFeatures features, int numConstants)
- : ScopeNode(globalData, source, children, varStack, funcStack, features, numConstants)
-{
-}
-
-PassRefPtr<ProgramNode> ProgramNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& source, CodeFeatures features, int numConstants)
-{
- RefPtr<ProgramNode> node = new ProgramNode(globalData, children, varStack, funcStack, 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, const SourceCode& source, CodeFeatures features, int numConstants)
- : ScopeNode(globalData, source, children, varStack, funcStack, features, numConstants)
-{
-}
-
-PassRefPtr<EvalNode> EvalNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& source, CodeFeatures features, int numConstants)
-{
- RefPtr<EvalNode> node = new EvalNode(globalData, children, varStack, funcStack, 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)
- : ScopeNode(globalData)
-{
-}
-
-inline FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
- : ScopeNode(globalData, sourceCode, children, varStack, funcStack, 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)
-{
- return new FunctionBodyNode(globalData);
-}
-
-PassRefPtr<FunctionBodyNode> FunctionBodyNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
-{
- RefPtr<FunctionBodyNode> node = new FunctionBodyNode(globalData, children, varStack, funcStack, 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/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
deleted file mode 100644
index 7852165..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
+++ /dev/null
@@ -1,1593 +0,0 @@
-/*
- * 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 AllFeatures = EvalFeature | ClosureFeature | AssignFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature;
-
- enum Operator {
- OpEqual,
- OpPlusEq,
- OpMinusEq,
- OpMultEq,
- OpDivEq,
- OpPlusPlus,
- OpMinusMinus,
- OpAndEq,
- OpXOrEq,
- OpOrEq,
- OpModEq,
- OpLShift,
- OpRShift,
- OpURShift
- };
-
- enum LogicalOperator {
- OpLogicalAnd,
- OpLogicalOr
- };
-
- 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 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* emitThrowError(BytecodeGenerator&, ErrorType, const char* message);
- RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const UString&);
- RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const Identifier&);
-
- 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, Getter, Setter };
-
- PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* value, Type);
- PropertyNode(JSGlobalData*, double name, ExpressionNode* value, Type);
-
- const Identifier& name() const { return m_name; }
-
- 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);
-
- 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);
- };
-
- 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* 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);
-
- 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*, int numConstants);
-
- ParserArena m_arena;
- VarStack m_varStack;
- FunctionStack m_functionStack;
- int m_numConstants;
- SourceElements* m_statements;
- };
-
- class ScopeNode : public StatementNode, public ParserArenaRefCounted {
- public:
- typedef DeclarationStacks::VarStack VarStack;
- typedef DeclarationStacks::FunctionStack FunctionStack;
-
- ScopeNode(JSGlobalData*);
- ScopeNode(JSGlobalData*, const SourceCode&, SourceElements*, VarStack*, FunctionStack*, 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; }
- void setUsesArguments() { m_features |= ArgumentsFeature; }
- bool usesThis() const { return m_features & ThisFeature; }
- bool needsActivation() const { return m_features & (EvalFeature | ClosureFeature | WithFeature | CatchFeature); }
-
- 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 PassRefPtr<ProgramNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
-
- static const bool scopeIsFunction = false;
-
- private:
- ProgramNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
-
- virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
- };
-
- class EvalNode : public ScopeNode {
- public:
- static PassRefPtr<EvalNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants);
-
- static const bool scopeIsFunction = false;
-
- private:
- EvalNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, 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 FunctionBodyNode* create(JSGlobalData*);
- static PassRefPtr<FunctionBodyNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, 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*);
- FunctionBodyNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, 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/src/3rdparty/webkit/JavaScriptCore/parser/Parser.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Parser.cpp
deleted file mode 100644
index 039fc46..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Parser.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 "Lexer.h"
-#include <wtf/HashSet.h>
-#include <wtf/Vector.h>
-
-#ifndef yyparse
-extern int jscyyparse(void*);
-#endif
-
-namespace JSC {
-
-void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
-{
- 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 = jscyyparse(globalData);
- bool lexError = lexer.sawError();
- int lineNumber = lexer.lineNumber();
- lexer.clear();
-
- if (parseError || lexError) {
- *errLine = lineNumber;
- *errMsg = "Parse error";
- m_sourceElements = 0;
- }
-}
-
-void Parser::didFinishParsing(SourceElements* sourceElements, ParserArenaData<DeclarationStacks::VarStack>* varStack,
- ParserArenaData<DeclarationStacks::FunctionStack>* funcStack, CodeFeatures features, int lastLine, int numConstants)
-{
- m_sourceElements = sourceElements;
- m_varDeclarations = varStack;
- m_funcDeclarations = funcStack;
- m_features = features;
- m_lastLine = lastLine;
- m_numConstants = numConstants;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Parser.h b/src/3rdparty/webkit/JavaScriptCore/parser/Parser.h
deleted file mode 100644
index 894f709..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Parser.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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 "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(JSGlobalData* globalData, Debugger*, ExecState*, const SourceCode& source, int* errLine = 0, UString* errMsg = 0);
-
- void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*,
- ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features, int lastLine, int numConstants);
-
- ParserArena& arena() { return m_arena; }
-
- private:
- void parse(JSGlobalData*, int* errLine, UString* errMsg);
-
- ParserArena m_arena;
- const SourceCode* m_source;
- SourceElements* m_sourceElements;
- ParserArenaData<DeclarationStacks::VarStack>* m_varDeclarations;
- ParserArenaData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
- CodeFeatures m_features;
- int m_lastLine;
- int m_numConstants;
- };
-
- template <class ParsedNode>
- PassRefPtr<ParsedNode> Parser::parse(JSGlobalData* globalData, Debugger* debugger, ExecState* debuggerExecState, const SourceCode& source, int* errLine, UString* errMsg)
- {
- m_source = &source;
- if (ParsedNode::scopeIsFunction)
- globalData->lexer->setIsReparsing();
- parse(globalData, errLine, errMsg);
-
- RefPtr<ParsedNode> result;
- if (m_sourceElements) {
- result = ParsedNode::create(globalData,
- m_sourceElements,
- m_varDeclarations ? &m_varDeclarations->data : 0,
- m_funcDeclarations ? &m_funcDeclarations->data : 0,
- source,
- m_features,
- m_numConstants);
- result->setLoc(m_source->firstLine(), m_lastLine);
- }
-
- 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/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp
deleted file mode 100644
index a8e8159..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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 "ParserArena.h"
-
-#include "Nodes.h"
-
-namespace JSC {
-
-ParserArena::ParserArena()
- : m_freeableMemory(0)
- , m_freeablePoolEnd(0)
- , m_identifierArena(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/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.h b/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.h
deleted file mode 100644
index eef8e93..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/ParserArena.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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::from(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/src/3rdparty/webkit/JavaScriptCore/parser/SourceProvider.h b/src/3rdparty/webkit/JavaScriptCore/parser/SourceProvider.h
deleted file mode 100644
index 1c59eed..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/parser/SourceProvider.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 {
-
- enum SourceBOMPresence { SourceHasNoBOMs, SourceCouldHaveBOMs };
-
- class SourceProvider : public RefCounted<SourceProvider> {
- public:
- SourceProvider(const UString& url, SourceBOMPresence hasBOMs = SourceCouldHaveBOMs)
- : m_url(url)
- , m_hasBOMs(hasBOMs)
- {
- }
- 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); }
-
- SourceBOMPresence hasBOMs() const { return m_hasBOMs; }
-
- private:
- UString m_url;
- SourceBOMPresence m_hasBOMs;
- };
-
- 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.substr(start, end - start); }
- const UChar* data() const { return m_source.data(); }
- int length() const { return m_source.size(); }
-
- private:
- UStringSourceProvider(const UString& source, const UString& url)
- : SourceProvider(url)
- , m_source(source)
- {
- }
-
- UString m_source;
- };
-
-} // namespace JSC
-
-#endif // SourceProvider_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/pcre/AUTHORS b/src/3rdparty/webkit/JavaScriptCore/pcre/AUTHORS
deleted file mode 100644
index dbac2a5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/AUTHORS
+++ /dev/null
@@ -1,12 +0,0 @@
-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/src/3rdparty/webkit/JavaScriptCore/pcre/COPYING b/src/3rdparty/webkit/JavaScriptCore/pcre/COPYING
deleted file mode 100644
index 6ffdc24..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/COPYING
+++ /dev/null
@@ -1,35 +0,0 @@
-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/src/3rdparty/webkit/JavaScriptCore/pcre/dftables b/src/3rdparty/webkit/JavaScriptCore/pcre/dftables
deleted file mode 100755
index 669b948..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/dftables
+++ /dev/null
@@ -1,273 +0,0 @@
-#!/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/src/3rdparty/webkit/JavaScriptCore/pcre/pcre.h b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre.h
deleted file mode 100644
index 55044fd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* 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/src/3rdparty/webkit/JavaScriptCore/pcre/pcre.pri b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre.pri
deleted file mode 100644
index 4f59e17..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre.pri
+++ /dev/null
@@ -1,12 +0,0 @@
-# Perl Compatible Regular Expressions - Qt4 build info
-VPATH += $$PWD
-INCLUDEPATH += $$PWD $$OUTPUT_DIR/JavaScriptCore/tmp
-DEPENDPATH += $$PWD
-
-SOURCES += \
- pcre_compile.cpp \
- pcre_exec.cpp \
- pcre_tables.cpp \
- pcre_ucp_searchfuncs.cpp \
- pcre_xclass.cpp
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_compile.cpp b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_compile.cpp
deleted file mode 100644
index 2bedca6..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_compile.cpp
+++ /dev/null
@@ -1,2706 +0,0 @@
-/* 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>
-
-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;
- int brastack[BRASTACK_SIZE];
- unsigned char bralenstack[BRASTACK_SIZE];
- 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<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/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_exec.cpp b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_exec.cpp
deleted file mode 100644
index 8ca2eb4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_exec.cpp
+++ /dev/null
@@ -1,2177 +0,0 @@
-/* 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 COMPILER(GCC)
-#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<UString::Rep>, 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 (isprint(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(short 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.UTF8String().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.rep(), 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/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_internal.h b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_internal.h
deleted file mode 100644
index 0016bb5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_internal.h
+++ /dev/null
@@ -1,455 +0,0 @@
-/* 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/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_tables.cpp b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_tables.cpp
deleted file mode 100644
index 8696879..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_tables.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* 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/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp
deleted file mode 100644
index 5592865..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/* 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 : c + offset;
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_xclass.cpp b/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_xclass.cpp
deleted file mode 100644
index a32edd4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/pcre_xclass.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/* 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/src/3rdparty/webkit/JavaScriptCore/pcre/ucpinternal.h b/src/3rdparty/webkit/JavaScriptCore/pcre/ucpinternal.h
deleted file mode 100644
index c8bc4aa..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/ucpinternal.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* 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/src/3rdparty/webkit/JavaScriptCore/pcre/ucptable.cpp b/src/3rdparty/webkit/JavaScriptCore/pcre/ucptable.cpp
deleted file mode 100644
index 011f7f5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/pcre/ucptable.cpp
+++ /dev/null
@@ -1,2968 +0,0 @@
-/* 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/src/3rdparty/webkit/JavaScriptCore/profiler/CallIdentifier.h b/src/3rdparty/webkit/JavaScriptCore/profiler/CallIdentifier.h
deleted file mode 100644
index ba48c55..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/CallIdentifier.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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"
-
-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)
- , 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.rep()->hash(),
- key.m_url.rep()->hash(),
- key.m_lineNumber
- };
- return UString::Rep::computeHash(reinterpret_cast<char*>(hashCodes), sizeof(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.UTF8String().c_str(); }
-#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/src/3rdparty/webkit/JavaScriptCore/profiler/Profile.cpp b/src/3rdparty/webkit/JavaScriptCore/profiler/Profile.cpp
deleted file mode 100644
index c90f9b0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/Profile.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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(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<UString::Rep*, 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).UTF8String().c_str());
-
- printf("\nSort by top of stack, same collapsed (when >= 5):\n");
-}
-#endif
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.cpp
deleted file mode 100644
index f367033..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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(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(const CallIdentifier& callIdentifier)
-{
- if (JAVASCRIPTCORE_PROFILE_WILL_EXECUTE_ENABLED()) {
- CString name = callIdentifier.m_name.UTF8String();
- CString url = callIdentifier.m_url.UTF8String();
- JAVASCRIPTCORE_PROFILE_WILL_EXECUTE(m_profileGroup, const_cast<char*>(name.c_str()), const_cast<char*>(url.c_str()), callIdentifier.m_lineNumber);
- }
-
- if (!m_originatingGlobalExec)
- return;
-
- ASSERT_ARG(m_currentNode, m_currentNode);
- m_currentNode = m_currentNode->willExecute(callIdentifier);
-}
-
-void ProfileGenerator::didExecute(const CallIdentifier& callIdentifier)
-{
- if (JAVASCRIPTCORE_PROFILE_DID_EXECUTE_ENABLED()) {
- CString name = callIdentifier.m_name.UTF8String();
- CString url = callIdentifier.m_url.UTF8String();
- JAVASCRIPTCORE_PROFILE_DID_EXECUTE(m_profileGroup, const_cast<char*>(name.c_str()), const_cast<char*>(url.c_str()), callIdentifier.m_lineNumber);
- }
-
- if (!m_originatingGlobalExec)
- return;
-
- ASSERT_ARG(m_currentNode, m_currentNode);
- if (m_currentNode->callIdentifier() != callIdentifier) {
- RefPtr<ProfileNode> returningNode = ProfileNode::create(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::stopProfiling()
-{
- m_profile->forEach(&ProfileNode::stopProfiling);
-
- removeProfileStart();
- removeProfileEnd();
-
- ASSERT_ARG(m_currentNode, 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(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/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.h b/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.h
deleted file mode 100644
index 82149b3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileGenerator.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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(const CallIdentifier&);
- void didExecute(const CallIdentifier&);
-
- // Stopping Profiling
- void stopProfiling();
-
- typedef void (ProfileGenerator::*ProfileFunction)(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/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.cpp b/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.cpp
deleted file mode 100644
index fb126b3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * 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>
-
-#if OS(WINDOWS)
-#include <windows.h>
-#endif
-
-using namespace WTF;
-
-namespace JSC {
-
-static double getCount()
-{
-#if OS(WINDOWS)
- static LARGE_INTEGER frequency = {0};
- if (!frequency.QuadPart)
- QueryPerformanceFrequency(&frequency);
- LARGE_INTEGER counter;
- QueryPerformanceCounter(&counter);
- return static_cast<double>(counter.QuadPart) / frequency.QuadPart;
-#else
- return currentTimeMS();
-#endif
-}
-
-ProfileNode::ProfileNode(const CallIdentifier& callIdentifier, ProfileNode* headNode, ProfileNode* parentNode)
- : 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(ProfileNode* headNode, ProfileNode* nodeToCopy)
- : 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(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(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().UTF8String().c_str(),
- m_numberOfCalls, m_actualSelfTime, selfPercent(), m_actualTotalTime, totalPercent(),
- m_visibleSelfTime, m_visibleTotalTime,
- (m_visible ? "True" : "False"),
- m_nextSibling ? m_nextSibling->functionName().UTF8String().c_str() : "");
-
- ++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().UTF8String().c_str();
- double sampleCount = m_actualTotalTime * 1000;
- if (indentLevel) {
- for (int i = 0; i < indentLevel; ++i)
- printf(" ");
-
- countedFunctions.add(functionName().rep());
-
- 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().UTF8String().c_str());
- }
-
- return m_actualTotalTime;
-}
-#endif
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.h b/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.h
deleted file mode 100644
index 2b5a936..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfileNode.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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/Vector.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace JSC {
-
- class ProfileNode;
-
- typedef Vector<RefPtr<ProfileNode> >::const_iterator StackIterator;
- typedef HashCountedSet<UString::Rep*> FunctionCallHashCount;
-
- class ProfileNode : public RefCounted<ProfileNode> {
- public:
- static PassRefPtr<ProfileNode> create(const CallIdentifier& callIdentifier, ProfileNode* headNode, ProfileNode* parentNode)
- {
- return adoptRef(new ProfileNode(callIdentifier, headNode, parentNode));
- }
- static PassRefPtr<ProfileNode> create(ProfileNode* headNode, ProfileNode* node)
- {
- return adoptRef(new ProfileNode(headNode, node));
- }
-
- bool operator==(ProfileNode* node) { return m_callIdentifier == node->callIdentifier(); }
-
- ProfileNode* willExecute(const CallIdentifier&);
- ProfileNode* didExecute();
-
- void stopProfiling();
-
- // CallIdentifier members
- 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(const CallIdentifier&, ProfileNode* headNode, ProfileNode* parentNode);
- ProfileNode(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(); }
-
- 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/src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.cpp b/src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.cpp
deleted file mode 100644
index fe8727a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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 "JSFunction.h"
-#include "JSGlobalObject.h"
-#include "Nodes.h"
-#include "Profile.h"
-#include "ProfileGenerator.h"
-#include "ProfileNode.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(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)(callIdentifier);
- }
-}
-
-void Profiler::willExecute(ExecState* exec, JSValue function)
-{
- ASSERT(!m_currentProfiles.isEmpty());
-
- dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier(exec, function, "", 0), exec->lexicalGlobalObject()->profileGroup());
-}
-
-void Profiler::willExecute(ExecState* exec, const UString& sourceURL, int startingLineNumber)
-{
- ASSERT(!m_currentProfiles.isEmpty());
-
- CallIdentifier callIdentifier = createCallIdentifier(exec, JSValue(), sourceURL, startingLineNumber);
-
- dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, callIdentifier, exec->lexicalGlobalObject()->profileGroup());
-}
-
-void Profiler::didExecute(ExecState* exec, JSValue function)
-{
- ASSERT(!m_currentProfiles.isEmpty());
-
- dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(exec, function, "", 0), exec->lexicalGlobalObject()->profileGroup());
-}
-
-void Profiler::didExecute(ExecState* exec, const UString& sourceURL, int startingLineNumber)
-{
- ASSERT(!m_currentProfiles.isEmpty());
-
- dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(exec, JSValue(), sourceURL, startingLineNumber), exec->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(&InternalFunction::info))
- return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
- return CallIdentifier(makeString("(", 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/src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.h b/src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.h
deleted file mode 100644
index 4b8b4a0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/Profiler.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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*, JSValue function);
- void willExecute(ExecState*, const UString& sourceURL, int startingLineNumber);
- void didExecute(ExecState*, JSValue function);
- void didExecute(ExecState*, const UString& sourceURL, int startingLineNumber);
-
- 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/src/3rdparty/webkit/JavaScriptCore/profiler/ProfilerServer.mm b/src/3rdparty/webkit/JavaScriptCore/profiler/ProfilerServer.mm
deleted file mode 100644
index a3944de..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfilerServer.mm
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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(IPHONE_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(IPHONE) || PLATFORM(IPHONE_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(IPHONE) || PLATFORM(IPHONE_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/src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.cpp
deleted file mode 100644
index ab2b5d7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.h
deleted file mode 100644
index 8e1fdbe..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ArgList.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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 "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(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/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.cpp
deleted file mode 100644
index bb30e3b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.cpp
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * 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::from(i)), slot);
-}
-
-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(exec, d->numArguments));
- return true;
- }
-
- if (propertyName == exec->propertyNames().callee && LIKELY(!d->overrodeCallee)) {
- slot.setValue(d->callee);
- return true;
- }
-
- 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(exec, d->numArguments), DontEnum);
- return true;
- }
-
- if (propertyName == exec->propertyNames().callee && LIKELY(!d->overrodeCallee)) {
- descriptor.setDescriptor(d->callee, DontEnum);
- return true;
- }
-
- 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::from(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::from(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) {
- d->overrodeCallee = true;
- putDirect(propertyName, value, DontEnum);
- return;
- }
-
- 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::from(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) {
- d->overrodeCallee = true;
- return true;
- }
-
- return JSObject::deleteProperty(exec, propertyName);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h
deleted file mode 100644
index cca3cf2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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;
- };
-
-
- 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);
-
- 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 = callFrame->callee();
-
- int numParameters = function->jsExecutable()->parameterCount();
- argc = callFrame->argumentCount();
-
- 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(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;
- }
-
- inline Arguments::Arguments(CallFrame* callFrame, NoParametersType)
- : JSObject(callFrame->lexicalGlobalObject()->argumentsStructure())
- , d(new ArgumentsData)
- {
- ASSERT(!callFrame->callee()->jsExecutable()->parameterCount());
-
- unsigned numArguments = callFrame->argumentCount() - 1;
-
- 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 = callFrame->callee();
- d->overrodeLength = false;
- d->overrodeCallee = false;
- }
-
- 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(Arguments* arguments)
- {
- ASSERT(!d()->registerArray);
-
- size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1;
- size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars;
- 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);
- if (arguments && !arguments->isTornOff())
- static_cast<Arguments*>(arguments)->setActivation(this);
- }
-
- ALWAYS_INLINE Arguments* Register::arguments() const
- {
- if (jsValue() == JSValue())
- return 0;
- return asArguments(jsValue());
- }
-
-
-} // namespace JSC
-
-#endif // Arguments_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.cpp
deleted file mode 100644
index fb44494..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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 "JSArray.h"
-#include "JSFunction.h"
-#include "Lookup.h"
-#include "PrototypeFunction.h"
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
-
-static JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList&);
-
-ArrayConstructor::ArrayConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure)
- : InternalFunction(&exec->globalData(), 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(exec, 1), ReadOnly | DontEnum | DontDelete);
-
- // ES5
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, 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, RangeError, "Array size is not a small enough positive integer.");
- return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), n);
- }
-
- // otherwise the array is constructed with the arguments in it
- return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), args);
-}
-
-static JSObject* constructWithArrayConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- return constructArrayWithSizeQuirk(exec, args);
-}
-
-// ECMA 15.4.2
-ConstructType ArrayConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithArrayConstructor;
- return ConstructTypeHost;
-}
-
-static JSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return constructArrayWithSizeQuirk(exec, args);
-}
-
-// ECMA 15.6.1
-CallType ArrayConstructor::getCallData(CallData& callData)
-{
- // equivalent to 'new Array(....)'
- callData.native.function = callArrayConstructor;
- return CallTypeHost;
-}
-
-JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList& args)
-{
- return jsBoolean(args.at(0).inherits(&JSArray::info));
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.h
deleted file mode 100644
index 6d25400..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayConstructor.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, ArrayPrototype*, Structure*);
-
- virtual ConstructType getConstructData(ConstructData&);
- virtual CallType getCallData(CallData&);
- };
-
-} // namespace JSC
-
-#endif // ArrayConstructor_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.cpp
deleted file mode 100644
index 4e8dc02..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ /dev/null
@@ -1,1054 +0,0 @@
-/*
- * 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 "CodeBlock.h"
-#include "CachedCall.h"
-#include "Interpreter.h"
-#include "JIT.h"
-#include "JSStringBuilder.h"
-#include "ObjectPrototype.h"
-#include "Lookup.h"
-#include "Operations.h"
-#include <algorithm>
-#include <wtf/Assertions.h>
-#include <wtf/HashSet.h>
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(ArrayPrototype);
-
-static JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*, JSObject*, JSValue, const ArgList&);
-
-}
-
-#include "ArrayPrototype.lut.h"
-
-namespace JSC {
-
-static inline bool isNumericCompareFunction(ExecState* exec, CallType callType, const CallData& callData)
-{
- if (callType != CallTypeJS)
- return false;
-
-#if ENABLE(JIT)
- // If the JIT is enabled then we need to preserve the invariant that every
- // function with a CodeBlock also has JIT code.
- callData.js.functionExecutable->jitCode(exec, callData.js.scopeChain);
- CodeBlock& codeBlock = callData.js.functionExecutable->generatedBytecode();
-#else
- CodeBlock& codeBlock = callData.js.functionExecutable->bytecode(exec, callData.js.scopeChain);
-#endif
-
- return codeBlock.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(NonNullPassRefPtr<Structure> structure)
- : JSArray(structure)
-{
-}
-
-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);
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- bool isRealArray = isJSArray(&exec->globalData(), thisValue);
- if (!isRealArray && !thisValue.inherits(&JSArray::info))
- return throwError(exec, TypeError);
- JSArray* thisObj = asArray(thisValue);
-
- HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
- if (arrayVisitedElements.size() >= MaxSecondaryThreadReentryDepth) {
- if (!isMainThread() || arrayVisitedElements.size() >= MaxMainThreadReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
- }
-
- bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
- if (alreadyVisited)
- return 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;
- Vector<RefPtr<UString::Rep>, 256> strBuffer(length);
- 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.rep();
- totalSize += str.size();
-
- if (!strBuffer.data()) {
- throwOutOfMemoryError(exec);
- }
-
- if (exec->hadException())
- break;
- }
- arrayVisitedElements.remove(thisObj);
- if (!totalSize)
- return jsEmptyString(exec);
- Vector<UChar> buffer;
- buffer.reserveCapacity(totalSize);
- if (!buffer.data())
- return throwOutOfMemoryError(exec);
-
- for (unsigned i = 0; i < length; i++) {
- if (i)
- buffer.append(',');
- if (RefPtr<UString::Rep> rep = strBuffer[i])
- buffer.append(rep->characters(), rep->length());
- }
- ASSERT(buffer.size() == totalSize);
- return jsString(exec, UString::adopt(buffer));
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&JSArray::info))
- return throwError(exec, TypeError);
- JSObject* thisObj = asArray(thisValue);
-
- HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
- if (arrayVisitedElements.size() >= MaxSecondaryThreadReentryDepth) {
- if (!isMainThread() || arrayVisitedElements.size() >= MaxMainThreadReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
- }
-
- bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
- if (alreadyVisited)
- return 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 = conversionFunction.getCallData(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 strBuffer.build(exec);
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
- if (arrayVisitedElements.size() >= MaxSecondaryThreadReentryDepth) {
- if (!isMainThread() || arrayVisitedElements.size() >= MaxMainThreadReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
- }
-
- bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
- if (alreadyVisited)
- return jsEmptyString(exec); // return an empty string, avoding infinite recursion.
-
- JSStringBuilder strBuffer;
-
- UString separator;
- if (!args.at(0).isUndefined())
- separator = args.at(0).toString(exec);
-
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- for (unsigned k = 0; 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 strBuffer.build(exec);
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSArray* arr = constructEmptyArray(exec);
- int n = 0;
- JSValue curArg = thisValue.toThisObject(exec);
- ArgList::const_iterator it = args.begin();
- ArgList::const_iterator end = args.end();
- 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 (it == end)
- break;
- curArg = (*it);
- ++it;
- }
- arr->setLength(n);
- return arr;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (isJSArray(&exec->globalData(), thisValue))
- return 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(exec, length));
- result = jsUndefined();
- } else {
- result = thisObj->get(exec, length - 1);
- thisObj->deleteProperty(exec, length - 1);
- putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1));
- }
- return result;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (isJSArray(&exec->globalData(), thisValue) && args.size() == 1) {
- JSArray* array = asArray(thisValue);
- array->push(exec, *args.begin());
- return jsNumber(exec, array->length());
- }
-
- JSObject* thisObj = thisValue.toThisObject(exec);
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- for (unsigned n = 0; n < args.size(); n++)
- thisObj->put(exec, length + n, args.at(n));
- length += args.size();
- putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length));
- return jsNumber(exec, length);
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- JSObject* thisObj = thisValue.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 thisObj;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- 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(exec, length));
- result = jsUndefined();
- } else {
- result = thisObj->get(exec, 0);
- 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(exec, length - 1));
- }
- return result;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- // http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10
-
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- // We return a new array
- JSArray* resObj = constructEmptyArray(exec);
- JSValue result = resObj;
- double begin = args.at(0).toInteger(exec);
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- if (begin >= 0) {
- if (begin > length)
- begin = length;
- } else {
- begin += length;
- if (begin < 0)
- begin = 0;
- }
- double end;
- if (args.at(1).isUndefined())
- end = length;
- else {
- end = args.at(1).toInteger(exec);
- if (end < 0) {
- end += length;
- if (end < 0)
- end = 0;
- } else {
- if (end > length)
- end = length;
- }
- }
-
- int n = 0;
- int b = static_cast<int>(begin);
- int e = static_cast<int>(end);
- for (int k = b; k < e; k++, n++) {
- if (JSValue v = getProperty(exec, thisObj, k))
- resObj->put(exec, n, v);
- }
- resObj->setLength(n);
- return result;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(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 thisObj;
- }
-
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
-
- if (!length)
- return 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 thisObj;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- // 15.4.4.12
- JSArray* resObj = constructEmptyArray(exec);
- JSValue result = resObj;
-
- // FIXME: Firefox returns an empty array.
- if (!args.size())
- return jsUndefined();
-
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- double relativeBegin = args.at(0).toInteger(exec);
- unsigned begin;
- if (relativeBegin < 0) {
- relativeBegin += length;
- begin = (relativeBegin < 0) ? 0 : static_cast<unsigned>(relativeBegin);
- } else
- begin = std::min<unsigned>(static_cast<unsigned>(relativeBegin), length);
-
- unsigned deleteCount;
- if (args.size() > 1)
- deleteCount = std::min<int>(std::max<int>(args.at(1).toUInt32(exec), 0), length - begin);
- else
- deleteCount = length - begin;
-
- for (unsigned k = 0; k < deleteCount; k++) {
- if (JSValue v = getProperty(exec, thisObj, k + begin))
- resObj->put(exec, k, v);
- }
- resObj->setLength(deleteCount);
-
- unsigned additionalArgs = std::max<int>(args.size() - 2, 0);
- if (additionalArgs != deleteCount) {
- if (additionalArgs < deleteCount) {
- 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 {
- 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, args.at(k + 2));
-
- putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - deleteCount + additionalArgs));
- return result;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- // 15.4.4.13
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- unsigned nrArgs = args.size();
- if (nrArgs) {
- 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, args.at(k));
- JSValue result = jsNumber(exec, length + nrArgs);
- putProperty(exec, thisObj, exec->propertyNames().length, result);
- return result;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- JSObject* applyThis = args.at(1).isUndefinedOrNull() ? exec->globalThisValue() : args.at(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, exec->exceptionSlot());
- 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(exec, k));
- cachedCall.setArgument(2, thisObj);
-
- JSValue result = cachedCall.call();
- if (result.toBoolean(exec))
- resultArray->put(exec, filterIndex++, v);
- }
- if (k == length)
- return 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(exec, k));
- eachArguments.append(thisObj);
-
- JSValue result = call(exec, function, callType, callData, applyThis, eachArguments);
-
- if (result.toBoolean(exec))
- resultArray->put(exec, filterIndex++, v);
- }
- return resultArray;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- JSObject* applyThis = args.at(1).isUndefinedOrNull() ? exec->globalThisValue() : args.at(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, exec->exceptionSlot());
- 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(exec, 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(exec, k));
- eachArguments.append(thisObj);
-
- JSValue result = call(exec, function, callType, callData, applyThis, eachArguments);
- resultArray->put(exec, k, result);
- }
-
- return 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
-
-JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- JSObject* applyThis = args.at(1).isUndefinedOrNull() ? exec->globalThisValue() : args.at(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, exec->exceptionSlot());
- 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(exec, k));
- cachedCall.setArgument(2, thisObj);
- JSValue result = cachedCall.call();
- if (!result.toBoolean(cachedCall.newCallFrame(exec)))
- return 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(exec, k));
- eachArguments.append(thisObj);
-
- bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec);
-
- if (!predicateResult) {
- result = jsBoolean(false);
- break;
- }
- }
-
- return result;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- JSObject* applyThis = args.at(1).isUndefinedOrNull() ? exec->globalThisValue() : args.at(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, exec->exceptionSlot());
- 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(exec, 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(exec, k));
- eachArguments.append(thisObj);
-
- call(exec, function, callType, callData, applyThis, eachArguments);
- }
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- JSObject* applyThis = args.at(1).isUndefinedOrNull() ? exec->globalThisValue() : args.at(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, exec->exceptionSlot());
- 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(exec, k));
- cachedCall.setArgument(2, thisObj);
- JSValue result = cachedCall.call();
- if (result.toBoolean(cachedCall.newCallFrame(exec)))
- return 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(exec, k));
- eachArguments.append(thisObj);
-
- bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec);
-
- if (predicateResult) {
- result = jsBoolean(true);
- break;
- }
- }
- return result;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- unsigned i = 0;
- JSValue rv;
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- if (!length && args.size() == 1)
- return throwError(exec, TypeError);
- JSArray* array = 0;
- if (isJSArray(&exec->globalData(), thisObj))
- array = asArray(thisObj);
-
- if (args.size() >= 2)
- rv = args.at(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 throwError(exec, TypeError);
- i++;
- }
-
- if (callType == CallTypeJS && array) {
- CachedCall cachedCall(exec, asFunction(function), 4, exec->exceptionSlot());
- 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(exec, i));
- cachedCall.setArgument(3, array);
- rv = cachedCall.call();
- }
- if (i == length) // only return if we reached the end of the array
- return 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(exec, i));
- eachArguments.append(thisObj);
-
- rv = call(exec, function, callType, callData, jsNull(), eachArguments);
- }
- return rv;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- JSValue function = args.at(0);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- unsigned i = 0;
- JSValue rv;
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- if (!length && args.size() == 1)
- return throwError(exec, TypeError);
- JSArray* array = 0;
- if (isJSArray(&exec->globalData(), thisObj))
- array = asArray(thisObj);
-
- if (args.size() >= 2)
- rv = args.at(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 throwError(exec, TypeError);
- i++;
- }
-
- if (callType == CallTypeJS && array) {
- CachedCall cachedCall(exec, asFunction(function), 4, exec->exceptionSlot());
- 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(exec, idx));
- cachedCall.setArgument(3, array);
- rv = cachedCall.call();
- }
- if (i == length) // only return if we reached the end of the array
- return 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(exec, idx));
- eachArguments.append(thisObj);
-
- rv = call(exec, function, callType, callData, jsNull(), eachArguments);
- }
- return rv;
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- // JavaScript 1.5 Extension by Mozilla
- // Documentation: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf
-
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- unsigned index = 0;
- double d = args.at(1).toInteger(exec);
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- if (d < 0)
- d += length;
- if (d > 0) {
- if (d > length)
- index = length;
- else
- index = static_cast<unsigned>(d);
- }
-
- JSValue searchElement = args.at(0);
- for (; index < length; ++index) {
- JSValue e = getProperty(exec, thisObj, index);
- if (!e)
- continue;
- if (JSValue::strictEqual(exec, searchElement, e))
- return jsNumber(exec, index);
- }
-
- return jsNumber(exec, -1);
-}
-
-JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- // JavaScript 1.6 Extension by Mozilla
- // Documentation: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf
-
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
- int index = length - 1;
- double d = args.at(1).toIntegerPreserveNaN(exec);
-
- if (d < 0) {
- d += length;
- if (d < 0)
- return jsNumber(exec, -1);
- }
- if (d < length)
- index = static_cast<int>(d);
-
- JSValue searchElement = args.at(0);
- for (; index >= 0; --index) {
- JSValue e = getProperty(exec, thisObj, index);
- if (!e)
- continue;
- if (JSValue::strictEqual(exec, searchElement, e))
- return jsNumber(exec, index);
- }
-
- return jsNumber(exec, -1);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.h
deleted file mode 100644
index e52914c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ArrayPrototype.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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(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;
- };
-
-} // namespace JSC
-
-#endif // ArrayPrototype_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h b/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
deleted file mode 100644
index 74089a5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- 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/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.cpp
deleted file mode 100644
index b0d8df3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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, NonNullPassRefPtr<Structure> structure, BooleanPrototype* booleanPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, booleanPrototype->classInfo()->className))
-{
- putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
-
- // no. of arguments for constructor
- putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 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 JSObject* constructWithBooleanConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- return constructBoolean(exec, args);
-}
-
-ConstructType BooleanConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithBooleanConstructor;
- return ConstructTypeHost;
-}
-
-// ECMA 15.6.1
-static JSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsBoolean(args.at(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/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.h
deleted file mode 100644
index 1d8a26a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanConstructor.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.cpp
deleted file mode 100644
index c9b3846..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.h
deleted file mode 100644
index 4b02acb..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanObject.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.cpp
deleted file mode 100644
index 8d338f9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 "JSFunction.h"
-#include "JSString.h"
-#include "ObjectPrototype.h"
-#include "PrototypeFunction.h"
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
-
-// Functions
-static JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*, JSObject*, JSValue, const ArgList&);
-
-// ECMA 15.6.4
-
-BooleanPrototype::BooleanPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
- : BooleanObject(structure)
-{
- setInternalValue(jsBoolean(false));
-
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
-}
-
-
-// ------------------------------ Functions --------------------------
-
-// ECMA 15.6.4.2 + 15.6.4.3
-
-JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (thisValue == jsBoolean(false))
- return jsNontrivialString(exec, "false");
-
- if (thisValue == jsBoolean(true))
- return jsNontrivialString(exec, "true");
-
- if (!thisValue.inherits(&BooleanObject::info))
- return throwError(exec, TypeError);
-
- if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false))
- return jsNontrivialString(exec, "false");
-
- ASSERT(asBooleanObject(thisValue)->internalValue() == jsBoolean(true));
- return jsNontrivialString(exec, "true");
-}
-
-JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (thisValue.isBoolean())
- return thisValue;
-
- if (!thisValue.inherits(&BooleanObject::info))
- return throwError(exec, TypeError);
-
- return asBooleanObject(thisValue)->internalValue();
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.h
deleted file mode 100644
index cc69b3f..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/BooleanPrototype.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
- };
-
-} // namespace JSC
-
-#endif // BooleanPrototype_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/CallData.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/CallData.cpp
deleted file mode 100644
index 62e42fe..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/CallData.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 "JSFunction.h"
-
-namespace JSC {
-
-JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args)
-{
- if (callType == CallTypeHost)
- return callData.native.function(exec, asObject(functionObject), thisValue, args);
- ASSERT(callType == CallTypeJS);
- // FIXME: Can this be done more efficiently using the callData?
- return asFunction(functionObject)->call(exec, thisValue, args);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/CallData.h b/src/3rdparty/webkit/JavaScriptCore/runtime/CallData.h
deleted file mode 100644
index 24c19f9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/CallData.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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 "NativeFunctionWrapper.h"
-
-namespace JSC {
-
- class ArgList;
- class ExecState;
- class FunctionExecutable;
- class JSObject;
- class JSValue;
- class ScopeChainNode;
-
- enum CallType {
- CallTypeNone,
- CallTypeHost,
- CallTypeJS
- };
-
- typedef JSValue (JSC_HOST_CALL *NativeFunction)(ExecState*, JSObject*, JSValue thisValue, const ArgList&);
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
deleted file mode 100644
index 0eca610..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
+++ /dev/null
@@ -1,1269 +0,0 @@
-/*
- * 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 "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/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)
-#if OS(SYMBIAN)
- , m_blockallocator(JSCCOLLECTOR_VIRTUALMEM_RESERVATION, BLOCK_SIZE)
-#endif
-{
- ASSERT(globalData);
- memset(&m_heap, 0, sizeof(CollectorHeap));
- allocateBlock();
-}
-
-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
-#if OS(SYMBIAN)
- m_blockallocator.destroy();
-#endif
- m_globalData = 0;
-}
-
-NEVER_INLINE CollectorBlock* Heap::allocateBlock()
-{
-#if OS(DARWIN)
- vm_address_t address = 0;
- vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT);
-#elif OS(SYMBIAN)
- void* address = m_blockallocator.alloc();
- if (!address)
- CRASH();
-#elif OS(WINCE)
- void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
-#elif OS(WINDOWS)
-#if COMPILER(MINGW) && !COMPILER(MINGW64)
- void* address = __mingw_aligned_malloc(BLOCK_SIZE, BLOCK_SIZE);
-#else
- void* address = _aligned_malloc(BLOCK_SIZE, BLOCK_SIZE);
-#endif
- memset(address, 0, BLOCK_SIZE);
-#elif HAVE(POSIX_MEMALIGN)
- void* address;
- posix_memalign(&address, BLOCK_SIZE, BLOCK_SIZE);
-#else
-
-#if ENABLE(JSC_MULTIPLE_THREADS)
-#error Need to initialize pagesize safely.
-#endif
- static size_t pagesize = getpagesize();
-
- size_t extra = 0;
- if (BLOCK_SIZE > pagesize)
- extra = BLOCK_SIZE - pagesize;
-
- void* mmapResult = mmap(NULL, BLOCK_SIZE + extra, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
- uintptr_t address = reinterpret_cast<uintptr_t>(mmapResult);
-
- size_t adjust = 0;
- if ((address & BLOCK_OFFSET_MASK) != 0)
- adjust = BLOCK_SIZE - (address & BLOCK_OFFSET_MASK);
-
- if (adjust > 0)
- munmap(reinterpret_cast<char*>(address), adjust);
-
- if (adjust < extra)
- munmap(reinterpret_cast<char*>(address + adjust + BLOCK_SIZE), extra - adjust);
-
- address += adjust;
-#endif
-
- // Initialize block.
-
- CollectorBlock* block = reinterpret_cast<CollectorBlock*>(address);
- 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(CollectorBlock*) / GROWTH_FACTOR;
- if (numBlocks > maxNumBlocks)
- CRASH();
- numBlocks = max(MIN_ARRAY_SIZE, numBlocks * GROWTH_FACTOR);
- m_heap.numBlocks = numBlocks;
- m_heap.blocks = static_cast<CollectorBlock**>(fastRealloc(m_heap.blocks, numBlocks * sizeof(CollectorBlock*)));
- }
- m_heap.blocks[m_heap.usedBlocks++] = block;
-
- 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();
- freeBlockPtr(m_heap.blocks[block]);
-
- // 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<CollectorBlock**>(fastRealloc(m_heap.blocks, m_heap.numBlocks * sizeof(CollectorBlock*)));
- }
-}
-
-NEVER_INLINE void Heap::freeBlockPtr(CollectorBlock* block)
-{
-#if OS(DARWIN)
- vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE);
-#elif OS(SYMBIAN)
- m_blockallocator.free(reinterpret_cast<void*>(block));
-#elif OS(WINCE)
- VirtualFree(block, 0, MEM_RELEASE);
-#elif OS(WINDOWS)
-#if COMPILER(MINGW) && !COMPILER(MINGW64)
- __mingw_aligned_free(block);
-#else
- _aligned_free(block);
-#endif
-#elif HAVE(POSIX_MEMALIGN)
- free(block);
-#else
- munmap(reinterpret_cast<char*>(block), BLOCK_SIZE);
-#endif
-}
-
-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)
- freeBlockPtr(m_heap.blocks[block]);
-
- 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)
-{
- 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 = reinterpret_cast<Block*>(m_heap.blocks[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;
- }
- } 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.blocks[i]->marked.clear(HeapConstants::cellsPerBlock - 1);
-
- for (size_t i = 0; i != m_heap.usedBlocks && m_heap.usedBlocks != neededBlocks; ) {
- if (m_heap.blocks[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.blocks[i]->marked.set(HeapConstants::cellsPerBlock - 1);
-}
-
-#if OS(WINCE)
-void* g_stackBase = 0;
-
-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 void* getStackBase(void* previousFrame)
-{
- // find the address of this stack frame by taking the address of a local variable
- bool isGrowingDownward;
- void* thisFrame = (void*)(&isGrowingDownward);
-
- isGrowingDownward = previousFrame < &thisFrame;
- static DWORD pageSize = 0;
- if (!pageSize) {
- SYSTEM_INFO systemInfo;
- GetSystemInfo(&systemInfo);
- pageSize = systemInfo.dwPageSize;
- }
-
- // scan all of memory starting from this frame, and return the last writeable page found
- register char* currentPage = (char*)((DWORD)thisFrame & ~(pageSize - 1));
- if (isGrowingDownward) {
- while (currentPage > 0) {
- // check for underflow
- if (currentPage >= (char*)pageSize)
- currentPage -= pageSize;
- else
- currentPage = 0;
- if (!isPageWritable(currentPage))
- return currentPage + pageSize;
- }
- return 0;
- } else {
- while (true) {
- // guaranteed to complete because isPageWritable returns false at end of memory
- currentPage += pageSize;
- if (!isPageWritable(currentPage))
- return currentPage;
- }
- }
-}
-#endif
-
-#if OS(QNX)
-static inline void *currentThreadStackBaseQNX()
-{
- static void* stackBase = 0;
- static size_t stackSize = 0;
- static pthread_t stackThread;
- pthread_t thread = pthread_self();
- if (stackBase == 0 || thread != stackThread) {
- 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);
- return 0;
- }
- devctl(fd, DCMD_PROC_TIDSTATUS, &threadInfo, sizeof(threadInfo), 0);
- close(fd);
- stackBase = reinterpret_cast<void*>(threadInfo.stkbase);
- stackSize = threadInfo.stksize;
- ASSERT(stackBase);
- stackThread = thread;
- }
- return static_cast<char*>(stackBase) + stackSize;
-}
-#endif
-
-static inline void* currentThreadStackBase()
-{
-#if OS(DARWIN)
- pthread_t thread = pthread_self();
- return pthread_get_stackaddr_np(thread);
-#elif OS(WINDOWS) && CPU(X86) && COMPILER(MSVC)
- // offset 0x18 from the FS segment register gives a pointer to
- // the thread information block for the current thread
- NT_TIB* pTib;
- __asm {
- MOV EAX, FS:[18h]
- MOV pTib, EAX
- }
- return static_cast<void*>(pTib->StackBase);
-#elif OS(WINDOWS) && CPU(X86) && COMPILER(GCC)
- // offset 0x18 from the FS segment register gives a pointer to
- // the thread information block for the current thread
- NT_TIB* pTib;
- asm ( "movl %%fs:0x18, %0\n"
- : "=r" (pTib)
- );
- return static_cast<void*>(pTib->StackBase);
-#elif OS(WINDOWS) && CPU(X86_64)
- PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
- return reinterpret_cast<void*>(pTib->StackBase);
-#elif OS(QNX)
- AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
- MutexLocker locker(mutex);
- return currentThreadStackBaseQNX();
-#elif OS(SOLARIS)
- stack_t s;
- thr_stksegment(&s);
- return s.ss_sp;
-#elif OS(OPENBSD)
- pthread_t thread = pthread_self();
- stack_t stack;
- pthread_stackseg_np(thread, &stack);
- return stack.ss_sp;
-#elif OS(SYMBIAN)
- TThreadStackInfo info;
- RThread thread;
- thread.StackInfo(info);
- return (void*)info.iBase;
-#elif OS(HAIKU)
- thread_info threadInfo;
- get_thread_info(find_thread(NULL), &threadInfo);
- return threadInfo.stack_end;
-#elif OS(UNIX)
- AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
- MutexLocker locker(mutex);
- static void* stackBase = 0;
- static size_t stackSize = 0;
- static pthread_t stackThread;
- pthread_t thread = pthread_self();
- if (stackBase == 0 || thread != stackThread) {
- 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);
- stackThread = thread;
- }
- return static_cast<char*>(stackBase) + stackSize;
-#elif OS(WINCE)
- AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
- MutexLocker locker(mutex);
- if (g_stackBase)
- return g_stackBase;
- else {
- int dummy;
- return getStackBase(&dummy);
- }
-#else
-#error Need a way to get the stack base on this platform
-#endif
-}
-
-#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->mainThreadOnly || isMainThread());
-
- if (!m_currentThreadRegistrar || pthread_getspecific(m_currentThreadRegistrar))
- return;
-
- pthread_setspecific(m_currentThreadRegistrar, this);
- Heap::Thread* thread = new Heap::Thread(pthread_self(), getCurrentPlatformThread(), currentThreadStackBase());
-
- 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);
-
-#if USE(JSVALUE32)
-static bool isHalfCellAligned(void *p)
-{
- return (((intptr_t)(p) & (CELL_MASK >> 1)) == 0);
-}
-
-static inline bool isPossibleCell(void* p)
-{
- return isHalfCellAligned(p) && p;
-}
-
-#else
-
-static inline bool isCellAligned(void *p)
-{
- return (((intptr_t)(p) & CELL_MASK) == 0);
-}
-
-static inline bool isPossibleCell(void* p)
-{
- return isCellAligned(p) && p;
-}
-#endif // USE(JSVALUE32)
-
-void Heap::markConservatively(MarkStack& markStack, void* start, void* end)
-{
- if (start > end) {
- void* tmp = start;
- start = end;
- end = tmp;
- }
-
- 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);
-
- CollectorBlock** blocks = m_heap.blocks;
- 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 (blocks[block] != blockAddr)
- continue;
- markStack.append(reinterpret_cast<JSCell*>(xAsBits));
- markStack.drain();
- }
- }
- }
-}
-
-void NEVER_INLINE Heap::markCurrentThreadConservativelyInternal(MarkStack& markStack)
-{
- void* dummy;
- void* stackPointer = &dummy;
- void* stackBase = currentThreadStackBase();
- markConservatively(markStack, stackPointer, stackBase);
-}
-
-#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));
-
- void* stackPointer = otherThreadStackPointer(regs);
- markConservatively(markStack, stackPointer, thread->stackBase);
-
- 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::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::clearMarkBits()
-{
- for (size_t i = 0; i < m_heap.usedBlocks; ++i)
- clearMarkBits(m_heap.blocks[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.blocks[startBlock]->marked.count(startCell);
- for (size_t i = startBlock + 1; i < m_heap.usedBlocks; ++i)
- result += m_heap.blocks[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 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->functionCodeBlockBeingReparsed)
- m_globalData->functionCodeBlockBeingReparsed->markAggregate(markStack);
- 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();
-
- 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::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 USE(JSVALUE32)
- if (cell->isNumber())
- return "number";
-#endif
- 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()
-{
- 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();
-}
-
-void Heap::collectAllGarbage()
-{
- 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);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
deleted file mode 100644
index 3db3d7e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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 <stddef.h>
-#include <string.h>
-#include <wtf/HashCountedSet.h>
-#include <wtf/HashSet.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/Threading.h>
-
-#if ENABLE(JSC_MULTIPLE_THREADS)
-#include <pthread.h>
-#endif
-
-#if OS(SYMBIAN)
-#include <wtf/symbian/BlockAllocatorSymbian.h>
-#endif
-
-#define ASSERT_CLASS_FITS_IN_CELL(class) COMPILE_ASSERT(sizeof(class) <= CELL_SIZE, class_fits_in_cell)
-
-namespace JSC {
-
- class CollectorBlock;
- class JSCell;
- class JSGlobalData;
- class JSValue;
- class MarkedArgumentBuffer;
- class MarkStack;
-
- enum OperationInProgress { NoOperation, Allocation, Collection };
-
- class LiveObjectIterator;
-
- struct CollectorHeap {
- size_t nextBlock;
- size_t nextCell;
- CollectorBlock** blocks;
-
- void* nextNumber;
-
- size_t numBlocks;
- size_t usedBlocks;
-
- size_t extraCost;
- bool didShrink;
-
- OperationInProgress operationInProgress;
- };
-
- 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();
-
- 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;
-
- 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 void markCell(JSCell*);
-
- void markConservatively(MarkStack&, void* start, void* end);
-
- 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);
- NEVER_INLINE void freeBlockPtr(CollectorBlock*);
- 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 markCurrentThreadConservatively(MarkStack&);
- void markCurrentThreadConservativelyInternal(MarkStack&);
- void markOtherThreadConservatively(MarkStack&, Thread*);
- void markStackObjectsConservatively(MarkStack&);
-
- typedef HashCountedSet<JSCell*> ProtectCountSet;
-
- CollectorHeap m_heap;
-
- ProtectCountSet m_protectedValues;
-
- HashSet<MarkedArgumentBuffer*>* m_markListSet;
-
-#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
-
-#if OS(SYMBIAN)
- // Allocates collector blocks with correct alignment
- WTF::AlignedBlockAllocator m_blockallocator;
-#endif
-
- JSGlobalData* m_globalData;
- };
-
- // tunable parameters
- template<size_t bytesPerWord> struct CellSize;
-
- // cell size needs to be a power of two for certain optimizations in collector.cpp
-#if USE(JSVALUE32)
- template<> struct CellSize<sizeof(uint32_t)> { static const size_t m_value = 32; };
-#else
- template<> struct CellSize<sizeof(uint32_t)> { static const size_t m_value = 64; };
-#endif
- template<> struct CellSize<sizeof(uint64_t)> { static const size_t m_value = 64; };
-
-#if OS(WINCE) || OS(SYMBIAN)
- const size_t BLOCK_SIZE = 64 * 1024; // 64k
-#else
- const size_t BLOCK_SIZE = 64 * 4096; // 256k
-#endif
-
- // 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 = CellSize<sizeof(void*)>::m_value;
- 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 {
- uint32_t bits[BITMAP_WORDS];
- bool get(size_t n) const { return !!(bits[n >> 5] & (1 << (n & 0x1F))); }
- void set(size_t n) { bits[n >> 5] |= (1 << (n & 0x1F)); }
- void clear(size_t n) { bits[n >> 5] &= ~(1 << (n & 0x1F)); }
- void clearAll() { memset(bits, 0, sizeof(bits)); }
- 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 {
- double memory[CELL_ARRAY_LENGTH];
- };
-
- class CollectorBlock {
- public:
- CollectorCell cells[CELLS_PER_BLOCK];
- 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 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;
- }
-
-} // namespace JSC
-
-#endif /* Collector_h */
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/CollectorHeapIterator.h b/src/3rdparty/webkit/JavaScriptCore/runtime/CollectorHeapIterator.h
deleted file mode 100644
index be6f3c9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/CollectorHeapIterator.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.blocks[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.blocks[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.blocks[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/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.cpp
deleted file mode 100644
index 3837817..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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")
- JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PROPERTY_NAME)
-{
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h b/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h
deleted file mode 100644
index de24f4a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/CommonIdentifiers.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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;
-
-#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/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp
deleted file mode 100644
index 2f88df9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 <stdio.h>
-
-namespace JSC {
-
-Completion checkSyntax(ExecState* exec, const SourceCode& source)
-{
- JSLock lock(exec);
- ASSERT(exec->globalData().identifierTable == 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 == 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 exception;
- JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj, &exception);
-
- if (exception) {
- if (exception.isObject() && asObject(exception)->isWatchdogException())
- return Completion(Interrupted, exception);
- return Completion(Throw, exception);
- }
- return Completion(Normal, result);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.h
deleted file mode 100644
index 41c9a64..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Completion.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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 };
-
- /*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp
deleted file mode 100644
index 7ee59d7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 "JSFunction.h"
-
-namespace JSC {
-
-JSObject* construct(ExecState* exec, JSValue object, ConstructType constructType, const ConstructData& constructData, const ArgList& args)
-{
- if (constructType == ConstructTypeHost)
- return constructData.native.function(exec, asObject(object), args);
- ASSERT(constructType == ConstructTypeJS);
- // FIXME: Can this be done more efficiently using the constructData?
- return asFunction(object)->construct(exec, args);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.h
deleted file mode 100644
index 6b954a6..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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
-
-namespace JSC {
-
- class ArgList;
- class ExecState;
- class FunctionExecutable;
- class JSObject;
- class JSValue;
- class ScopeChainNode;
-
- enum ConstructType {
- ConstructTypeNone,
- ConstructTypeHost,
- ConstructTypeJS
- };
-
- typedef JSObject* (*NativeConstructor)(ExecState*, JSObject*, const ArgList&);
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp
deleted file mode 100644
index ab95d06..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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 JSValue JSC_HOST_CALL dateParse(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateNow(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateUTC(ExecState*, JSObject*, JSValue, const ArgList&);
-
-DateConstructor::DateConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, datePrototype->classInfo()->className))
-{
- putDirectWithoutTransition(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);
-
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
-
- putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 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 {
- if (isnan(args.at(0).toNumber(exec))
- || isnan(args.at(1).toNumber(exec))
- || (numArgs >= 3 && isnan(args.at(2).toNumber(exec)))
- || (numArgs >= 4 && isnan(args.at(3).toNumber(exec)))
- || (numArgs >= 5 && isnan(args.at(4).toNumber(exec)))
- || (numArgs >= 6 && isnan(args.at(5).toNumber(exec)))
- || (numArgs >= 7 && isnan(args.at(6).toNumber(exec))))
- value = NaN;
- else {
- GregorianDateTime t;
- int year = args.at(0).toInt32(exec);
- t.year = (year >= 0 && year <= 99) ? year : year - 1900;
- t.month = args.at(1).toInt32(exec);
- t.monthDay = (numArgs >= 3) ? args.at(2).toInt32(exec) : 1;
- t.hour = args.at(3).toInt32(exec);
- t.minute = args.at(4).toInt32(exec);
- t.second = args.at(5).toInt32(exec);
- t.isDST = -1;
- double ms = (numArgs >= 7) ? args.at(6).toNumber(exec) : 0;
- value = gregorianDateTimeToMS(exec, t, ms, false);
- }
- }
-
- return new (exec) DateInstance(exec, value);
-}
-
-static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- return constructDate(exec, args);
-}
-
-ConstructType DateConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithDateConstructor;
- return ConstructTypeHost;
-}
-
-// ECMA 15.9.2
-static JSValue JSC_HOST_CALL callDate(ExecState* exec, JSObject*, JSValue, const ArgList&)
-{
- 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 jsMakeNontrivialString(exec, date, " ", time);
-}
-
-CallType DateConstructor::getCallData(CallData& callData)
-{
- callData.native.function = callDate;
- return CallTypeHost;
-}
-
-static JSValue JSC_HOST_CALL dateParse(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsNumber(exec, parseDate(exec, args.at(0).toString(exec)));
-}
-
-static JSValue JSC_HOST_CALL dateNow(ExecState* exec, JSObject*, JSValue, const ArgList&)
-{
- return jsNumber(exec, jsCurrentTime());
-}
-
-static JSValue JSC_HOST_CALL dateUTC(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- int n = args.size();
- if (isnan(args.at(0).toNumber(exec))
- || isnan(args.at(1).toNumber(exec))
- || (n >= 3 && isnan(args.at(2).toNumber(exec)))
- || (n >= 4 && isnan(args.at(3).toNumber(exec)))
- || (n >= 5 && isnan(args.at(4).toNumber(exec)))
- || (n >= 6 && isnan(args.at(5).toNumber(exec)))
- || (n >= 7 && isnan(args.at(6).toNumber(exec))))
- return jsNaN(exec);
-
- GregorianDateTime t;
- int year = args.at(0).toInt32(exec);
- t.year = (year >= 0 && year <= 99) ? year : year - 1900;
- t.month = args.at(1).toInt32(exec);
- t.monthDay = (n >= 3) ? args.at(2).toInt32(exec) : 1;
- t.hour = args.at(3).toInt32(exec);
- t.minute = args.at(4).toInt32(exec);
- t.second = args.at(5).toInt32(exec);
- double ms = (n >= 7) ? args.at(6).toNumber(exec) : 0;
- return jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true)));
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.h
deleted file mode 100644
index 10e450e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/DateConversion.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DateConversion.cpp
deleted file mode 100644
index f129407..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConversion.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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>
-
-using namespace WTF;
-
-namespace JSC {
-
-double parseDate(ExecState* exec, const UString &date)
-{
- if (date == exec->globalData().cachedDateString)
- return exec->globalData().cachedDateStringValue;
- double value = parseDateFromNullTerminatedCharacters(exec, date.UTF8String().c_str());
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp
deleted file mode 100644
index b43b183..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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* exec, NonNullPassRefPtr<Structure> structure)
- : JSWrapperObject(structure)
-{
- setInternalValue(jsNaN(exec));
-}
-
-DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure, double time)
- : JSWrapperObject(structure)
-{
- setInternalValue(jsNumber(exec, timeClip(time)));
-}
-
-DateInstance::DateInstance(ExecState* exec, double time)
- : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure())
-{
- setInternalValue(jsNumber(exec, 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/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h
deleted file mode 100644
index 77d46de..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h
deleted file mode 100644
index d208580..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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)]; }
-
- CacheEntry m_cache[cacheSize];
- };
-
-} // namespace JSC
-
-#endif // DateInstanceCache_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp
deleted file mode 100644
index 25b0ac4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp
+++ /dev/null
@@ -1,1027 +0,0 @@
-/*
- * 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.
- *
- * 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 "Error.h"
-#include "JSString.h"
-#include "JSStringBuilder.h"
-#include "ObjectPrototype.h"
-#include "DateInstance.h"
-
-#if !PLATFORM(MAC) && HAVE(LANGINFO_H)
-#include <langinfo.h>
-#endif
-
-#include <limits.h>
-#include <locale.h>
-#include <math.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 JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*, JSObject*, JSValue, const ArgList&);
-
-static JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*, JSObject*, JSValue, const ArgList&);
-
-}
-
-#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, const ArgList& args)
-{
- CFDateFormatterStyle dateStyle = (format != LocaleTime ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
- CFDateFormatterStyle timeStyle = (format != LocaleDate ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
-
- bool useCustomFormat = false;
- UString customFormatString;
-
- UString arg0String = args.at(0).toString(exec);
- if (arg0String == "custom" && !args.at(1).isUndefined()) {
- useCustomFormat = true;
- customFormatString = args.at(1).toString(exec);
- } else if (format == LocaleDateAndTime && !args.at(1).isUndefined()) {
- dateStyle = styleFromArgString(arg0String, dateStyle);
- timeStyle = styleFromArgString(args.at(1).toString(exec), timeStyle);
- } else if (format != LocaleTime && !args.at(0).isUndefined())
- dateStyle = styleFromArgString(arg0String, dateStyle);
- else if (format != LocaleDate && !args.at(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.data(), customFormatString.size());
- 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 = sizeof(buffer) / sizeof(buffer[0]);
- 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);
- }
-
- return jsNontrivialString(exec, timebuffer);
-}
-
-static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double, LocaleDateTimeFormat format, const ArgList&)
-{
- 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, const ArgList& args, int maxArgs, double* ms, GregorianDateTime* t)
-{
- double milliseconds = 0;
- bool ok = true;
- int idx = 0;
- int numArgs = args.size();
-
- // JS allows extra trailing arguments -- ignore them
- if (numArgs > maxArgs)
- numArgs = maxArgs;
-
- // hours
- if (maxArgs >= 4 && idx < numArgs) {
- t->hour = 0;
- milliseconds += args.at(idx++).toInt32(exec, ok) * msPerHour;
- }
-
- // minutes
- if (maxArgs >= 3 && idx < numArgs && ok) {
- t->minute = 0;
- milliseconds += args.at(idx++).toInt32(exec, ok) * msPerMinute;
- }
-
- // seconds
- if (maxArgs >= 2 && idx < numArgs && ok) {
- t->second = 0;
- milliseconds += args.at(idx++).toInt32(exec, ok) * msPerSecond;
- }
-
- if (!ok)
- return false;
-
- // milliseconds
- if (idx < numArgs) {
- double millis = args.at(idx).toNumber(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, const ArgList& args, int maxArgs, double *ms, GregorianDateTime *t)
-{
- int idx = 0;
- bool ok = true;
- int numArgs = args.size();
-
- // JS allows extra trailing arguments -- ignore them
- if (numArgs > maxArgs)
- numArgs = maxArgs;
-
- // years
- if (maxArgs >= 3 && idx < numArgs)
- t->year = args.at(idx++).toInt32(exec, ok) - 1900;
-
- // months
- if (maxArgs >= 2 && idx < numArgs && ok)
- t->month = args.at(idx++).toInt32(exec, ok);
-
- // days
- if (idx < numArgs && ok) {
- t->monthDay = 0;
- *ms += args.at(idx).toInt32(exec, ok) * 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 0
-@end
-*/
-
-// ECMA 15.9.4
-
-DatePrototype::DatePrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
- : DateInstance(exec, structure)
-{
- // The constructor will be added later, after DateConstructor has been built.
-}
-
-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
-
-JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
- DateConversionBuffer date;
- DateConversionBuffer time;
- formatDate(*gregorianDateTime, date);
- formatTime(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
- DateConversionBuffer date;
- DateConversionBuffer time;
- formatDateUTCVariant(*gregorianDateTime, date);
- formatTimeUTC(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return 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 jsNontrivialString(exec, buffer);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
- DateConversionBuffer date;
- formatDate(*gregorianDateTime, date);
- return jsNontrivialString(exec, date);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
- DateConversionBuffer time;
- formatTime(*gregorianDateTime, time);
- return jsNontrivialString(exec, time);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime, args);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate, args);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime, args);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- return asDateInstance(thisValue)->internalValue();
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, 1900 + gregorianDateTime->year);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, 1900 + gregorianDateTime->year);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
- DateConversionBuffer date;
- DateConversionBuffer time;
- formatDateUTCVariant(*gregorianDateTime, date);
- formatTimeUTC(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->month);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->month);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->monthDay);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->monthDay);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->weekDay);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->weekDay);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->hour);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->hour);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->minute);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->minute);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->second);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->second);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- double milli = thisDateObj->internalNumber();
- if (isnan(milli))
- return jsNaN(exec);
-
- double secs = floor(milli / msPerSecond);
- double ms = milli - secs * msPerSecond;
- return jsNumber(exec, ms);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- double milli = thisDateObj->internalNumber();
- if (isnan(milli))
- return jsNaN(exec);
-
- double secs = floor(milli / msPerSecond);
- double ms = milli - secs * msPerSecond;
- return jsNumber(exec, ms);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- double milli = timeClip(args.at(0).toNumber(exec));
- JSValue result = jsNumber(exec, milli);
- thisDateObj->setInternalValue(result);
- return result;
-}
-
-static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- double milli = thisDateObj->internalNumber();
-
- if (args.isEmpty() || isnan(milli)) {
- JSValue result = jsNaN(exec);
- thisDateObj->setInternalValue(result);
- return result;
- }
-
- double secs = floor(milli / msPerSecond);
- double ms = milli - secs * msPerSecond;
-
- const GregorianDateTime* other = inputIsUTC
- ? thisDateObj->gregorianDateTimeUTC(exec)
- : thisDateObj->gregorianDateTime(exec);
- if (!other)
- return jsNaN(exec);
-
- GregorianDateTime gregorianDateTime;
- gregorianDateTime.copyFrom(*other);
- if (!fillStructuresUsingTimeArgs(exec, args, numArgsToUse, &ms, &gregorianDateTime)) {
- JSValue result = jsNaN(exec);
- thisDateObj->setInternalValue(result);
- return result;
- }
-
- JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
- thisDateObj->setInternalValue(result);
- return result;
-}
-
-static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- if (args.isEmpty()) {
- JSValue result = jsNaN(exec);
- thisDateObj->setInternalValue(result);
- return 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 jsNaN(exec);
- gregorianDateTime.copyFrom(*other);
- }
-
- if (!fillStructuresUsingDateArgs(exec, args, numArgsToUse, &ms, &gregorianDateTime)) {
- JSValue result = jsNaN(exec);
- thisDateObj->setInternalValue(result);
- return result;
- }
-
- JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
- thisDateObj->setInternalValue(result);
- return result;
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, thisValue, args, 1, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, thisValue, args, 1, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, thisValue, args, 2, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, thisValue, args, 2, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, thisValue, args, 3, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, thisValue, args, 3, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, thisValue, args, 4, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, thisValue, args, 4, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = false;
- return setNewValueFromDateArgs(exec, thisValue, args, 1, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = true;
- return setNewValueFromDateArgs(exec, thisValue, args, 1, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = false;
- return setNewValueFromDateArgs(exec, thisValue, args, 2, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = true;
- return setNewValueFromDateArgs(exec, thisValue, args, 2, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = false;
- return setNewValueFromDateArgs(exec, thisValue, args, 3, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- const bool inputIsUTC = true;
- return setNewValueFromDateArgs(exec, thisValue, args, 3, inputIsUTC);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
- if (args.isEmpty()) {
- JSValue result = jsNaN(exec);
- thisDateObj->setInternalValue(result);
- return 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);
- }
-
- bool ok = true;
- int32_t year = args.at(0).toInt32(exec, ok);
- if (!ok) {
- JSValue result = jsNaN(exec);
- thisDateObj->setInternalValue(result);
- return result;
- }
-
- gregorianDateTime.year = (year > 99 || year < 0) ? year - 1900 : year;
- JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, false));
- thisDateObj->setInternalValue(result);
- return result;
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
-
- DateInstance* thisDateObj = asDateInstance(thisValue);
-
- const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
- if (!gregorianDateTime)
- return jsNaN(exec);
-
- // NOTE: IE returns the full year even in getYear.
- return jsNumber(exec, gregorianDateTime->year);
-}
-
-JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- JSObject* object = thisValue.toThisObject(exec);
- if (exec->hadException())
- return jsNull();
-
- JSValue toISOValue = object->get(exec, exec->globalData().propertyNames->toISOString);
- if (exec->hadException())
- return jsNull();
-
- CallData callData;
- CallType callType = toISOValue.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError, "toISOString is not a function");
-
- JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList());
- if (exec->hadException())
- return jsNull();
- if (result.isObject())
- return throwError(exec, TypeError, "toISOString did not return a primitive value");
- return result;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h
deleted file mode 100644
index 612ca06..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/Error.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Error.cpp
deleted file mode 100644
index 69464b7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Error.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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"
-
-namespace JSC {
-
-const char* expressionBeginOffsetPropertyName = "expressionBeginOffset";
-const char* expressionCaretOffsetPropertyName = "expressionCaretOffset";
-const char* expressionEndOffsetPropertyName = "expressionEndOffset";
-
-JSObject* Error::create(ExecState* exec, ErrorType type, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL)
-{
- JSObject* constructor;
- const char* name;
- switch (type) {
- case EvalError:
- constructor = exec->lexicalGlobalObject()->evalErrorConstructor();
- name = "Evaluation error";
- break;
- case RangeError:
- constructor = exec->lexicalGlobalObject()->rangeErrorConstructor();
- name = "Range error";
- break;
- case ReferenceError:
- constructor = exec->lexicalGlobalObject()->referenceErrorConstructor();
- name = "Reference error";
- break;
- case SyntaxError:
- constructor = exec->lexicalGlobalObject()->syntaxErrorConstructor();
- name = "Syntax error";
- break;
- case TypeError:
- constructor = exec->lexicalGlobalObject()->typeErrorConstructor();
- name = "Type error";
- break;
- case URIError:
- constructor = exec->lexicalGlobalObject()->URIErrorConstructor();
- name = "URI error";
- break;
- default:
- constructor = exec->lexicalGlobalObject()->errorConstructor();
- name = "Error";
- break;
- }
-
- MarkedArgumentBuffer args;
- if (message.isEmpty())
- args.append(jsString(exec, name));
- else
- args.append(jsString(exec, message));
- ConstructData constructData;
- ConstructType constructType = constructor->getConstructData(constructData);
- JSObject* error = construct(exec, constructor, constructType, constructData, args);
-
- if (lineNumber != -1)
- error->putWithAttributes(exec, Identifier(exec, "line"), jsNumber(exec, lineNumber), ReadOnly | DontDelete);
- if (sourceID != -1)
- error->putWithAttributes(exec, Identifier(exec, "sourceId"), jsNumber(exec, sourceID), ReadOnly | DontDelete);
- if (!sourceURL.isNull())
- error->putWithAttributes(exec, Identifier(exec, "sourceURL"), jsString(exec, sourceURL), ReadOnly | DontDelete);
-
- return error;
-}
-
-JSObject* Error::create(ExecState* exec, ErrorType type, const char* message)
-{
- return create(exec, type, message, -1, -1, UString());
-}
-
-JSObject* throwError(ExecState* exec, JSObject* error)
-{
- exec->setException(error);
- return error;
-}
-
-JSObject* throwError(ExecState* exec, ErrorType type)
-{
- JSObject* error = Error::create(exec, type, UString(), -1, -1, UString());
- exec->setException(error);
- return error;
-}
-
-JSObject* throwError(ExecState* exec, ErrorType type, const UString& message)
-{
- JSObject* error = Error::create(exec, type, message, -1, -1, UString());
- exec->setException(error);
- return error;
-}
-
-JSObject* throwError(ExecState* exec, ErrorType type, const char* message)
-{
- JSObject* error = Error::create(exec, type, message, -1, -1, UString());
- exec->setException(error);
- return error;
-}
-
-JSObject* throwError(ExecState* exec, ErrorType type, const UString& message, int line, intptr_t sourceID, const UString& sourceURL)
-{
- JSObject* error = Error::create(exec, type, message, line, sourceID, sourceURL);
- exec->setException(error);
- return error;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Error.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Error.h
deleted file mode 100644
index e959cff..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Error.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 <stdint.h>
-
-namespace JSC {
-
- class ExecState;
- class JSObject;
- class UString;
-
- /**
- * Types of Native Errors available. For custom errors, GeneralError
- * should be used.
- */
- enum ErrorType {
- GeneralError = 0,
- EvalError = 1,
- RangeError = 2,
- ReferenceError = 3,
- SyntaxError = 4,
- TypeError = 5,
- URIError = 6
- };
-
- extern const char* expressionBeginOffsetPropertyName;
- extern const char* expressionCaretOffsetPropertyName;
- extern const char* expressionEndOffsetPropertyName;
-
- class Error {
- public:
- static JSObject* create(ExecState*, ErrorType, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL);
- static JSObject* create(ExecState*, ErrorType, const char* message);
- };
-
- JSObject* throwError(ExecState*, ErrorType, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL);
- JSObject* throwError(ExecState*, ErrorType, const UString& message);
- JSObject* throwError(ExecState*, ErrorType, const char* message);
- JSObject* throwError(ExecState*, ErrorType);
- JSObject* throwError(ExecState*, JSObject*);
-
-} // namespace JSC
-
-#endif // Error_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.cpp
deleted file mode 100644
index b9c3f58..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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, NonNullPassRefPtr<Structure> structure, ErrorPrototype* errorPrototype)
- : InternalFunction(&exec->globalData(), 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(exec, 1), DontDelete | ReadOnly | DontEnum);
-}
-
-// ECMA 15.9.3
-ErrorInstance* constructError(ExecState* exec, const ArgList& args)
-{
- ErrorInstance* obj = new (exec) ErrorInstance(exec->lexicalGlobalObject()->errorStructure());
- if (!args.at(0).isUndefined())
- obj->putDirect(exec->propertyNames().message, jsString(exec, args.at(0).toString(exec)));
- return obj;
-}
-
-static JSObject* constructWithErrorConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- return constructError(exec, args);
-}
-
-ConstructType ErrorConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithErrorConstructor;
- return ConstructTypeHost;
-}
-
-// ECMA 15.9.2
-static JSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- // "Error()" gives the sames result as "new Error()"
- return constructError(exec, args);
-}
-
-CallType ErrorConstructor::getCallData(CallData& callData)
-{
- callData.native.function = callErrorConstructor;
- return CallTypeHost;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.h
deleted file mode 100644
index e3d789b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorConstructor.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, ErrorPrototype*);
-
- private:
- virtual ConstructType getConstructData(ConstructData&);
- virtual CallType getCallData(CallData&);
- };
-
- ErrorInstance* constructError(ExecState*, const ArgList&);
-
-} // namespace JSC
-
-#endif // ErrorConstructor_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.cpp
deleted file mode 100644
index 1cdb87a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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(NonNullPassRefPtr<Structure> structure)
- : JSObject(structure)
-{
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.h
deleted file mode 100644
index 9f53b51..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorInstance.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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:
- explicit ErrorInstance(NonNullPassRefPtr<Structure>);
-
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- };
-
-} // namespace JSC
-
-#endif // ErrorInstance_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.cpp
deleted file mode 100644
index eb35733..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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 JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-
-// ECMA 15.9.4
-ErrorPrototype::ErrorPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
- : ErrorInstance(structure)
-{
- // The constructor will be added later in ErrorConstructor's constructor
-
- putDirectWithoutTransition(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
- putDirectWithoutTransition(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum);
-
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
-}
-
-JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- JSObject* thisObj = thisValue.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 jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec));
- return jsNontrivialString(exec, name.toString(exec));
- }
- if (!message.isUndefined())
- return jsMakeNontrivialString(exec, "Error: ", message.toString(exec));
- return jsNontrivialString(exec, "Error");
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.h
deleted file mode 100644
index a561590..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ErrorPrototype.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
- };
-
-} // namespace JSC
-
-#endif // ErrorPrototype_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp
deleted file mode 100644
index b9c6319..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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 "JSGlobalObjectFunctions.h"
-#include "JSObject.h"
-#include "JSNotAnObject.h"
-#include "Interpreter.h"
-#include "Nodes.h"
-
-namespace JSC {
-
-class InterruptedExecutionError : public JSObject {
-public:
- InterruptedExecutionError(JSGlobalData* globalData)
- : JSObject(globalData->interruptedExecutionErrorStructure)
- {
- }
-
- virtual bool isWatchdogException() const { return true; }
-
- virtual UString toString(ExecState*) const { return "JavaScript execution exceeded timeout."; }
-};
-
-JSValue createInterruptedExecutionException(JSGlobalData* globalData)
-{
- return new (globalData) InterruptedExecutionError(globalData);
-}
-
-static JSValue createError(ExecState* exec, ErrorType e, const char* msg)
-{
- return Error::create(exec, e, msg, -1, -1, UString());
-}
-
-JSValue createStackOverflowError(ExecState* exec)
-{
- return createError(exec, RangeError, "Maximum call stack size exceeded.");
-}
-
-JSValue createTypeError(ExecState* exec, const char* message)
-{
- return createError(exec, TypeError, message);
-}
-
-JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock)
-{
- int startOffset = 0;
- int endOffset = 0;
- int divotPoint = 0;
- int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
- JSObject* exception = Error::create(exec, ReferenceError, makeString("Can't find variable: ", ident.ustring()), line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
- return exception;
-}
-
-static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, int expressionStart, int expressionStop, JSValue value, UString error)
-{
- if (!expressionStop || expressionStart > codeBlock->source()->length())
- return makeString(value.toString(exec), " is ", error);
- if (expressionStart < expressionStop)
- return makeString("Result of expression '", codeBlock->source()->getRange(expressionStart, expressionStop), "' [", value.toString(exec), "] is ", error, ".");
-
- // 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--;
- return makeString("Result of expression near '...", codeBlock->source()->getRange(start, stop), "...' [", value.toString(exec), "] is ", error, ".");
-}
-
-JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value, unsigned bytecodeOffset, CodeBlock* codeBlock)
-{
- int startOffset = 0;
- int endOffset = 0;
- int divotPoint = 0;
- int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
- UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, makeString("not a valid argument for '", op, "'"));
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
- return exception;
-}
-
-JSObject* createNotAConstructorError(ExecState* exec, JSValue value, unsigned bytecodeOffset, CodeBlock* codeBlock)
-{
- int startOffset = 0;
- int endOffset = 0;
- int divotPoint = 0;
- int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
-
- // We're in a "new" expression, so we need to skip over the "new.." part
- int startPoint = divotPoint - (startOffset ? startOffset - 4 : 0); // -4 for "new "
- const UChar* data = codeBlock->source()->data();
- while (startPoint < divotPoint && isStrWhiteSpace(data[startPoint]))
- startPoint++;
-
- UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
- return exception;
-}
-
-JSValue createNotAFunctionError(ExecState* exec, JSValue value, unsigned bytecodeOffset, CodeBlock* codeBlock)
-{
- int startOffset = 0;
- int endOffset = 0;
- int divotPoint = 0;
- int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
- UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
- return exception;
-}
-
-JSNotAnObjectErrorStub* createNotAnObjectErrorStub(ExecState* exec, bool isNull)
-{
- return new (exec) JSNotAnObjectErrorStub(exec, isNull);
-}
-
-JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error, unsigned bytecodeOffset, CodeBlock* codeBlock)
-{
- // Both op_construct and op_instanceof require a use of op_get_by_id to get
- // the prototype property from an object. The exception messages for exceptions
- // thrown by these instances op_get_by_id need to reflect this.
- OpcodeID followingOpcodeID;
- if (codeBlock->getByIdExceptionInfoForBytecodeOffset(exec, bytecodeOffset, followingOpcodeID)) {
- ASSERT(followingOpcodeID == op_construct || followingOpcodeID == op_instanceof);
- if (followingOpcodeID == op_construct)
- return createNotAConstructorError(exec, error->isNull() ? jsNull() : jsUndefined(), bytecodeOffset, codeBlock);
- return createInvalidParamError(exec, "instanceof", error->isNull() ? jsNull() : jsUndefined(), bytecodeOffset, codeBlock);
- }
-
- int startOffset = 0;
- int endOffset = 0;
- int divotPoint = 0;
- int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
- UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
- return exception;
-}
-
-JSValue throwOutOfMemoryError(ExecState* exec)
-{
- return throwError(exec, GeneralError, "Out of memory");
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.h
deleted file mode 100644
index b6e7373..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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
-
-
-namespace JSC {
-
- class CodeBlock;
- class ExecState;
- class Identifier;
- class JSGlobalData;
- class JSNotAnObjectErrorStub;
- class JSObject;
- class JSValue;
- class Node;
- struct Instruction;
-
- JSValue createInterruptedExecutionException(JSGlobalData*);
- JSValue createStackOverflowError(ExecState*);
- JSValue createTypeError(ExecState*, const char* message);
- JSValue createUndefinedVariableError(ExecState*, const Identifier&, unsigned bytecodeOffset, CodeBlock*);
- JSNotAnObjectErrorStub* createNotAnObjectErrorStub(ExecState*, bool isNull);
- JSObject* createInvalidParamError(ExecState*, const char* op, JSValue, unsigned bytecodeOffset, CodeBlock*);
- JSObject* createNotAConstructorError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*);
- JSValue createNotAFunctionError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*);
- JSObject* createNotAnObjectError(ExecState*, JSNotAnObjectErrorStub*, unsigned bytecodeOffset, CodeBlock*);
- JSValue throwOutOfMemoryError(ExecState*);
-
-} // namespace JSC
-
-#endif // ExceptionHelpers_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp
deleted file mode 100644
index 79900dc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * 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 "Executable.h"
-
-#include "BytecodeGenerator.h"
-#include "CodeBlock.h"
-#include "JIT.h"
-#include "Parser.h"
-#include "StringBuilder.h"
-#include "Vector.h"
-
-namespace JSC {
-
-#if ENABLE(JIT)
-NativeExecutable::~NativeExecutable()
-{
-}
-#endif
-
-VPtrHackExecutable::~VPtrHackExecutable()
-{
-}
-
-EvalExecutable::~EvalExecutable()
-{
- delete m_evalCodeBlock;
-}
-
-ProgramExecutable::~ProgramExecutable()
-{
- delete m_programCodeBlock;
-}
-
-FunctionExecutable::~FunctionExecutable()
-{
- delete m_codeBlock;
-}
-
-JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNode)
-{
- int errLine;
- UString errMsg;
- RefPtr<EvalNode> evalNode = exec->globalData().parser->parse<EvalNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
- if (!evalNode)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
- recordParse(evalNode->features(), evalNode->lineNo(), evalNode->lastLine());
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- ASSERT(!m_evalCodeBlock);
- m_evalCodeBlock = new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth());
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock));
- generator->generate();
-
- evalNode->destroyData();
- return 0;
-}
-
-JSObject* ProgramExecutable::checkSyntax(ExecState* exec)
-{
- int errLine;
- UString errMsg;
- RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
- if (!programNode)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
- return 0;
-}
-
-JSObject* ProgramExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNode)
-{
- int errLine;
- UString errMsg;
- RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
- if (!programNode)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
- recordParse(programNode->features(), programNode->lineNo(), programNode->lastLine());
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- ASSERT(!m_programCodeBlock);
- m_programCodeBlock = new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider());
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock));
- generator->generate();
-
- programNode->destroyData();
- return 0;
-}
-
-void FunctionExecutable::compile(ExecState*, ScopeChainNode* scopeChainNode)
-{
- JSGlobalData* globalData = scopeChainNode->globalData;
- RefPtr<FunctionBodyNode> body = globalData->parser->parse<FunctionBodyNode>(globalData, 0, 0, m_source);
- if (m_forceUsesArguments)
- body->setUsesArguments();
- body->finishParsing(m_parameters, m_name);
- recordParse(body->features(), body->lineNo(), body->lastLine());
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- ASSERT(!m_codeBlock);
- m_codeBlock = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset());
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlock->symbolTable(), m_codeBlock));
- generator->generate();
- m_numParameters = m_codeBlock->m_numParameters;
- ASSERT(m_numParameters);
- m_numVariables = m_codeBlock->m_numVars;
-
- body->destroyData();
-}
-
-#if ENABLE(JIT)
-
-void EvalExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
-{
- CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
- m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
-
-#if !ENABLE(OPCODE_SAMPLING)
- if (!BytecodeGenerator::dumpsGeneratedCode())
- codeBlock->discardBytecode();
-#endif
-}
-
-void ProgramExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
-{
- CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
- m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
-
-#if !ENABLE(OPCODE_SAMPLING)
- if (!BytecodeGenerator::dumpsGeneratedCode())
- codeBlock->discardBytecode();
-#endif
-}
-
-void FunctionExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
-{
- CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
- m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock);
-
-#if !ENABLE(OPCODE_SAMPLING)
- if (!BytecodeGenerator::dumpsGeneratedCode())
- codeBlock->discardBytecode();
-#endif
-}
-
-#endif
-
-void FunctionExecutable::markAggregate(MarkStack& markStack)
-{
- if (m_codeBlock)
- m_codeBlock->markAggregate(markStack);
-}
-
-ExceptionInfo* FunctionExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock)
-{
- RefPtr<FunctionBodyNode> newFunctionBody = globalData->parser->parse<FunctionBodyNode>(globalData, 0, 0, m_source);
- if (m_forceUsesArguments)
- newFunctionBody->setUsesArguments();
- newFunctionBody->finishParsing(m_parameters, m_name);
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- OwnPtr<CodeBlock> newCodeBlock(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset()));
- globalData->functionCodeBlockBeingReparsed = newCodeBlock.get();
-
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newFunctionBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), newCodeBlock.get()));
- generator->setRegeneratingForExceptionInfo(static_cast<FunctionCodeBlock*>(codeBlock));
- generator->generate();
-
- ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount());
-
-#if ENABLE(JIT)
- JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
- ASSERT(newJITCode.size() == generatedJITCode().size());
-#endif
-
- globalData->functionCodeBlockBeingReparsed = 0;
-
- return newCodeBlock->extractExceptionInfo();
-}
-
-ExceptionInfo* EvalExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock)
-{
- RefPtr<EvalNode> newEvalBody = globalData->parser->parse<EvalNode>(globalData, 0, 0, m_source);
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- OwnPtr<EvalCodeBlock> newCodeBlock(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
-
- OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newEvalBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), newCodeBlock.get()));
- generator->setRegeneratingForExceptionInfo(static_cast<EvalCodeBlock*>(codeBlock));
- generator->generate();
-
- ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount());
-
-#if ENABLE(JIT)
- JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
- ASSERT(newJITCode.size() == generatedJITCode().size());
-#endif
-
- return newCodeBlock->extractExceptionInfo();
-}
-
-void FunctionExecutable::recompile(ExecState*)
-{
- delete m_codeBlock;
- m_codeBlock = 0;
- m_numParameters = NUM_PARAMETERS_NOT_COMPILED;
-#if ENABLE(JIT)
- m_jitCode = JITCode();
-#endif
-}
-
-PassRefPtr<FunctionExecutable> FunctionExecutable::fromGlobalCode(const Identifier& functionName, ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg)
-{
- RefPtr<ProgramNode> program = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), debugger, exec, source, errLine, errMsg);
- if (!program)
- return 0;
-
- StatementNode* exprStatement = program->singleStatement();
- ASSERT(exprStatement);
- ASSERT(exprStatement->isExprStatement());
- if (!exprStatement || !exprStatement->isExprStatement())
- return 0;
-
- ExpressionNode* funcExpr = static_cast<ExprStatementNode*>(exprStatement)->expr();
- ASSERT(funcExpr);
- ASSERT(funcExpr->isFuncExprNode());
- if (!funcExpr || !funcExpr->isFuncExprNode())
- return 0;
-
- FunctionBodyNode* body = static_cast<FuncExprNode*>(funcExpr)->body();
- ASSERT(body);
- return FunctionExecutable::create(&exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine());
-}
-
-UString FunctionExecutable::paramString() const
-{
- FunctionParameters& parameters = *m_parameters;
- StringBuilder builder;
- for (size_t pos = 0; pos < parameters.size(); ++pos) {
- if (!builder.isEmpty())
- builder.append(", ");
- builder.append(parameters[pos].ustring());
- }
- return builder.build();
-}
-
-};
-
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h
deleted file mode 100644
index f74abe9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Executable.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * 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 Executable_h
-#define Executable_h
-
-#include "JSFunction.h"
-#include "Interpreter.h"
-#include "Nodes.h"
-#include "SamplingTool.h"
-
-namespace JSC {
-
- class CodeBlock;
- class Debugger;
- class EvalCodeBlock;
- 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_numParameters(numParameters)
- {
- }
-
- virtual ~ExecutableBase() {}
-
- bool isHostFunction() const { return m_numParameters == NUM_PARAMETERS_IS_HOST; }
-
- protected:
- int m_numParameters;
-
-#if ENABLE(JIT)
- public:
- JITCode& generatedJITCode()
- {
- ASSERT(m_jitCode);
- return m_jitCode;
- }
-
- ExecutablePool* getExecutablePool()
- {
- return m_jitCode.getExecutablePool();
- }
-
- protected:
- JITCode m_jitCode;
-#endif
- };
-
-#if ENABLE(JIT)
- class NativeExecutable : public ExecutableBase {
- public:
- NativeExecutable(ExecState* exec)
- : ExecutableBase(NUM_PARAMETERS_IS_HOST)
- {
- m_jitCode = JITCode(JITCode::HostFunction(exec->globalData().jitStubs.ctiNativeCallThunk()));
- }
-
- ~NativeExecutable();
- };
-#endif
-
- class VPtrHackExecutable : public ExecutableBase {
- public:
- VPtrHackExecutable()
- : ExecutableBase(NUM_PARAMETERS_IS_HOST)
- {
- }
-
- ~VPtrHackExecutable();
- };
-
- class ScriptExecutable : public ExecutableBase {
- public:
- ScriptExecutable(JSGlobalData* globalData, const SourceCode& source)
- : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED)
- , m_source(source)
- , m_features(0)
- {
-#if ENABLE(CODEBLOCK_SAMPLING)
- if (SamplingTool* sampler = globalData->interpreter->sampler())
- sampler->notifyOfScope(this);
-#else
- UNUSED_PARAM(globalData);
-#endif
- }
-
- ScriptExecutable(ExecState* exec, const SourceCode& source)
- : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED)
- , m_source(source)
- , m_features(0)
- {
-#if ENABLE(CODEBLOCK_SAMPLING)
- 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_features & (EvalFeature | ClosureFeature | WithFeature | CatchFeature); }
-
- virtual ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) = 0;
-
- protected:
- void recordParse(CodeFeatures features, int firstLine, int lastLine)
- {
- m_features = features;
- m_firstLine = firstLine;
- m_lastLine = lastLine;
- }
-
- SourceCode m_source;
- CodeFeatures m_features;
- int m_firstLine;
- int m_lastLine;
- };
-
- class EvalExecutable : public ScriptExecutable {
- public:
-
- ~EvalExecutable();
-
- EvalCodeBlock& bytecode(ExecState* exec, ScopeChainNode* scopeChainNode)
- {
- if (!m_evalCodeBlock) {
- JSObject* error = compile(exec, scopeChainNode);
- ASSERT_UNUSED(!error, error);
- }
- return *m_evalCodeBlock;
- }
-
- JSObject* compile(ExecState*, ScopeChainNode*);
-
- ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
- static PassRefPtr<EvalExecutable> create(ExecState* exec, const SourceCode& source) { return adoptRef(new EvalExecutable(exec, source)); }
-
- private:
- EvalExecutable(ExecState* exec, const SourceCode& source)
- : ScriptExecutable(exec, source)
- , m_evalCodeBlock(0)
- {
- }
- EvalCodeBlock* m_evalCodeBlock;
-
-#if ENABLE(JIT)
- public:
- JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode)
- {
- if (!m_jitCode)
- generateJITCode(exec, scopeChainNode);
- return m_jitCode;
- }
-
- private:
- void generateJITCode(ExecState*, ScopeChainNode*);
-#endif
- };
-
- class ProgramExecutable : public ScriptExecutable {
- public:
- static PassRefPtr<ProgramExecutable> create(ExecState* exec, const SourceCode& source)
- {
- return adoptRef(new ProgramExecutable(exec, source));
- }
-
- ~ProgramExecutable();
-
- ProgramCodeBlock& bytecode(ExecState* exec, ScopeChainNode* scopeChainNode)
- {
- if (!m_programCodeBlock) {
- JSObject* error = compile(exec, scopeChainNode);
- ASSERT_UNUSED(!error, error);
- }
- return *m_programCodeBlock;
- }
-
- JSObject* checkSyntax(ExecState*);
- JSObject* compile(ExecState*, ScopeChainNode*);
-
- // CodeBlocks for program code are transient and therefore do not gain from from throwing out there exception information.
- ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) { ASSERT_NOT_REACHED(); return 0; }
-
- private:
- ProgramExecutable(ExecState* exec, const SourceCode& source)
- : ScriptExecutable(exec, source)
- , m_programCodeBlock(0)
- {
- }
- ProgramCodeBlock* m_programCodeBlock;
-
-#if ENABLE(JIT)
- public:
- JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode)
- {
- if (!m_jitCode)
- generateJITCode(exec, scopeChainNode);
- return m_jitCode;
- }
-
- private:
- void generateJITCode(ExecState*, ScopeChainNode*);
-#endif
- };
-
- class FunctionExecutable : public ScriptExecutable {
- friend class JIT;
- public:
- static PassRefPtr<FunctionExecutable> create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
- {
- return adoptRef(new FunctionExecutable(exec, name, source, forceUsesArguments, parameters, firstLine, lastLine));
- }
-
- static PassRefPtr<FunctionExecutable> create(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
- {
- return adoptRef(new FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, firstLine, lastLine));
- }
-
- ~FunctionExecutable();
-
- JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain)
- {
- return new (exec) JSFunction(exec, this, scopeChain);
- }
-
- CodeBlock& bytecode(ExecState* exec, ScopeChainNode* scopeChainNode)
- {
- ASSERT(scopeChainNode);
- if (!m_codeBlock)
- compile(exec, scopeChainNode);
- return *m_codeBlock;
- }
-
- bool isGenerated() const
- {
- return m_codeBlock;
- }
-
- CodeBlock& generatedBytecode()
- {
- ASSERT(m_codeBlock);
- return *m_codeBlock;
- }
-
- const Identifier& name() { return m_name; }
- size_t parameterCount() const { return m_parameters->size(); }
- size_t variableCount() const { return m_numVariables; }
- UString paramString() const;
-
- void recompile(ExecState*);
- ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
- void markAggregate(MarkStack& markStack);
- static PassRefPtr<FunctionExecutable> fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0);
-
- private:
- FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
- : ScriptExecutable(globalData, source)
- , m_forceUsesArguments(forceUsesArguments)
- , m_parameters(parameters)
- , m_codeBlock(0)
- , m_name(name)
- , m_numVariables(0)
- {
- m_firstLine = firstLine;
- m_lastLine = lastLine;
- }
-
- FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
- : ScriptExecutable(exec, source)
- , m_forceUsesArguments(forceUsesArguments)
- , m_parameters(parameters)
- , m_codeBlock(0)
- , m_name(name)
- , m_numVariables(0)
- {
- m_firstLine = firstLine;
- m_lastLine = lastLine;
- }
-
- void compile(ExecState*, ScopeChainNode*);
-
- bool m_forceUsesArguments;
- RefPtr<FunctionParameters> m_parameters;
- CodeBlock* m_codeBlock;
- Identifier m_name;
- size_t m_numVariables;
-
-#if ENABLE(JIT)
- public:
- JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode)
- {
- if (!m_jitCode)
- generateJITCode(exec, scopeChainNode);
- return m_jitCode;
- }
-
- private:
- void generateJITCode(ExecState*, ScopeChainNode*);
-#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();
- }
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.cpp
deleted file mode 100644
index 9b0b1bb..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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 "FunctionPrototype.h"
-#include "JSFunction.h"
-#include "JSGlobalObject.h"
-#include "JSString.h"
-#include "Lexer.h"
-#include "Nodes.h"
-#include "Parser.h"
-#include "StringBuilder.h"
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
-
-FunctionConstructor::FunctionConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, FunctionPrototype* functionPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, functionPrototype->classInfo()->className))
-{
- putDirectWithoutTransition(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
-
- // Number of arguments for constructor
- putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
-}
-
-static JSObject* constructWithFunctionConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- return constructFunction(exec, args);
-}
-
-ConstructType FunctionConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithFunctionConstructor;
- return ConstructTypeHost;
-}
-
-static JSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return 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 = makeString("(function() { ", args.at(0).toString(exec), "\n})");
- else {
- StringBuilder 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.build();
- }
-
- int errLine;
- UString errMsg;
- SourceCode source = makeSource(program, sourceURL, lineNumber);
- RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
- if (!function)
- return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
-
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- ScopeChain scopeChain(globalObject, 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/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.h
deleted file mode 100644
index 197f320..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionConstructor.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp
deleted file mode 100644
index a77b5b2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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 JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*, JSObject*, JSValue, const ArgList&);
-
-FunctionPrototype::FunctionPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
- : InternalFunction(&exec->globalData(), structure, exec->propertyNames().nullIdentifier)
-{
- putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
-}
-
-void FunctionPrototype::addFunctionProperties(ExecState* exec, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction)
-{
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
- *applyFunction = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);
- putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum);
- *callFunction = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall);
- putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum);
-}
-
-static JSValue JSC_HOST_CALL callFunctionPrototype(ExecState*, JSObject*, JSValue, const ArgList&)
-{
- return 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.size() - 1] == '}');
-
- for (size_t i = functionBody.size() - 2; i > 0; --i) {
- UChar ch = functionBody[i];
- if (!Lexer::isWhiteSpace(ch) && !Lexer::isLineTerminator(ch)) {
- if (ch != ';' && ch != '}')
- functionBody = makeString(functionBody.substr(0, i + 1), ";", functionBody.substr(i + 1, functionBody.size() - (i + 1)));
- return;
- }
- }
-}
-
-JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (thisValue.inherits(&JSFunction::info)) {
- JSFunction* function = asFunction(thisValue);
- if (!function->isHostFunction()) {
- FunctionExecutable* executable = function->jsExecutable();
- UString sourceString = executable->source().toString();
- insertSemicolonIfNeeded(sourceString);
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString);
- }
- }
-
- if (thisValue.inherits(&InternalFunction::info)) {
- InternalFunction* function = asInternalFunction(thisValue);
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
- }
-
- return throwError(exec, TypeError);
-}
-
-JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- CallData callData;
- CallType callType = thisValue.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- JSValue array = args.at(1);
-
- MarkedArgumentBuffer applyArgs;
- if (!array.isUndefinedOrNull()) {
- if (!array.isObject())
- return throwError(exec, TypeError);
- 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 throwError(exec, TypeError);
- }
-
- return call(exec, thisValue, callType, callData, args.at(0), applyArgs);
-}
-
-JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- CallData callData;
- CallType callType = thisValue.getCallData(callData);
- if (callType == CallTypeNone)
- return throwError(exec, TypeError);
-
- ArgList callArgs;
- args.getSlice(1, callArgs);
- return call(exec, thisValue, callType, callData, args.at(0), callArgs);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.h
deleted file mode 100644
index af783f7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>);
- void addFunctionProperties(ExecState*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.cpp
deleted file mode 100644
index 7e54053..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.h b/src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.h
deleted file mode 100644
index 27ffbe7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/GetterSetter.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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(asCell(value)->isGetterSetter());
- return static_cast<GetterSetter*>(asCell(value));
- }
-
-
-} // namespace JSC
-
-#endif // GetterSetter_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.cpp
deleted file mode 100644
index c26002b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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, NonNullPassRefPtr<Structure> structure, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
- : PrototypeFunction(exec, 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/src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.h b/src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.h
deleted file mode 100644
index a14ce4d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/GlobalEvalFunction.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.cpp
deleted file mode 100644
index 9acccf0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * 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>
-
-using WTF::ThreadSpecific;
-
-namespace JSC {
-
-typedef HashMap<const char*, RefPtr<UString::Rep>, PtrHash<const char*> > LiteralIdentifierTable;
-
-class IdentifierTable : public FastAllocBase {
-public:
- ~IdentifierTable()
- {
- HashSet<UString::Rep*>::iterator end = m_table.end();
- for (HashSet<UString::Rep*>::iterator iter = m_table.begin(); iter != end; ++iter)
- (*iter)->setIsIdentifier(false);
- }
-
- std::pair<HashSet<UString::Rep*>::iterator, bool> add(UString::Rep* value)
- {
- std::pair<HashSet<UString::Rep*>::iterator, bool> result = m_table.add(value);
- (*result.first)->setIsIdentifier(true);
- return result;
- }
-
- template<typename U, typename V>
- std::pair<HashSet<UString::Rep*>::iterator, bool> add(U value)
- {
- std::pair<HashSet<UString::Rep*>::iterator, bool> result = m_table.add<U, V>(value);
- (*result.first)->setIsIdentifier(true);
- return result;
- }
-
- void remove(UString::Rep* r) { m_table.remove(r); }
-
- LiteralIdentifierTable& literalTable() { return m_literalTable; }
-
-private:
- HashSet<UString::Rep*> m_table;
- LiteralIdentifierTable m_literalTable;
-};
-
-IdentifierTable* createIdentifierTable()
-{
- return new IdentifierTable;
-}
-
-void deleteIdentifierTable(IdentifierTable* table)
-{
- delete table;
-}
-
-bool Identifier::equal(const UString::Rep* 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 UString::Rep* 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 CStringTranslator {
- static unsigned hash(const char* c)
- {
- return UString::Rep::computeHash(c);
- }
-
- static bool equal(UString::Rep* r, const char* s)
- {
- return Identifier::equal(r, s);
- }
-
- static void translate(UString::Rep*& location, const char* c, unsigned hash)
- {
- size_t length = strlen(c);
- UChar* d;
- UString::Rep* r = UString::Rep::createUninitialized(length, d).releaseRef();
- 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<UString::Rep> Identifier::add(JSGlobalData* globalData, const char* c)
-{
- if (!c)
- return UString::null().rep();
- if (!c[0])
- return UString::Rep::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<UString::Rep*>::iterator, bool> addResult = identifierTable.add<const char*, CStringTranslator>(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<UString::Rep> addedString = addResult.second ? adoptRef(*addResult.first) : *addResult.first;
-
- literalIdentifierTable.add(c, addedString.get());
-
- return addedString.release();
-}
-
-PassRefPtr<UString::Rep> Identifier::add(ExecState* exec, const char* c)
-{
- return add(&exec->globalData(), c);
-}
-
-struct UCharBuffer {
- const UChar* s;
- unsigned int length;
-};
-
-struct UCharBufferTranslator {
- static unsigned hash(const UCharBuffer& buf)
- {
- return UString::Rep::computeHash(buf.s, buf.length);
- }
-
- static bool equal(UString::Rep* str, const UCharBuffer& buf)
- {
- return Identifier::equal(str, buf.s, buf.length);
- }
-
- static void translate(UString::Rep*& location, const UCharBuffer& buf, unsigned hash)
- {
- UChar* d;
- UString::Rep* r = UString::Rep::createUninitialized(buf.length, d).releaseRef();
- for (unsigned i = 0; i != buf.length; i++)
- d[i] = buf.s[i];
- r->setHash(hash);
- location = r;
- }
-};
-
-PassRefPtr<UString::Rep> 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 UString::Rep::empty();
- UCharBuffer buf = {s, length};
- pair<HashSet<UString::Rep*>::iterator, bool> addResult = globalData->identifierTable->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<UString::Rep> Identifier::add(ExecState* exec, const UChar* s, int length)
-{
- return add(&exec->globalData(), s, length);
-}
-
-PassRefPtr<UString::Rep> Identifier::addSlowCase(JSGlobalData* globalData, UString::Rep* 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<UString::Rep> Identifier::addSlowCase(ExecState* exec, UString::Rep* r)
-{
- return addSlowCase(&exec->globalData(), r);
-}
-
-void Identifier::remove(UString::Rep* r)
-{
- currentIdentifierTable()->remove(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));
-}
-
-#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 == 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
-
-ThreadSpecific<ThreadIdentifierTableData>* g_identifierTableSpecific = 0;
-
-#if ENABLE(JSC_MULTIPLE_THREADS)
-
-pthread_once_t createIdentifierTableSpecificOnce = PTHREAD_ONCE_INIT;
-static void createIdentifierTableSpecificCallback()
-{
- ASSERT(!g_identifierTableSpecific);
- g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
-}
-void createIdentifierTableSpecific()
-{
- pthread_once(&createIdentifierTableSpecificOnce, createIdentifierTableSpecificCallback);
- ASSERT(g_identifierTableSpecific);
-}
-
-#else
-
-void createIdentifierTableSpecific()
-{
- ASSERT(!g_identifierTableSpecific);
- g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
-}
-
-#endif
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.h
deleted file mode 100644
index 48b1da1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Identifier.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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"
-
-namespace JSC {
-
- class ExecState;
-
- class Identifier {
- friend class Structure;
- public:
- Identifier() { }
-
- Identifier(ExecState* exec, const char* s) : _ustring(add(exec, s)) { } // Only to be used with string literals.
- Identifier(ExecState* exec, const UChar* s, int length) : _ustring(add(exec, s, length)) { }
- Identifier(ExecState* exec, UString::Rep* rep) : _ustring(add(exec, rep)) { }
- Identifier(ExecState* exec, const UString& s) : _ustring(add(exec, s.rep())) { }
-
- Identifier(JSGlobalData* globalData, const char* s) : _ustring(add(globalData, s)) { } // Only to be used with string literals.
- Identifier(JSGlobalData* globalData, const UChar* s, int length) : _ustring(add(globalData, s, length)) { }
- Identifier(JSGlobalData* globalData, UString::Rep* rep) : _ustring(add(globalData, rep)) { }
- Identifier(JSGlobalData* globalData, const UString& s) : _ustring(add(globalData, s.rep())) { }
-
- // Special constructor for cases where we overwrite an object in place.
- Identifier(PlacementNewAdoptType) : _ustring(PlacementNewAdopt) { }
-
- const UString& ustring() const { return _ustring; }
-
- const UChar* data() const { return _ustring.data(); }
- int size() const { return _ustring.size(); }
-
- const char* ascii() const { return _ustring.ascii(); }
-
- static Identifier from(ExecState* exec, unsigned y);
- static Identifier from(ExecState* exec, int y);
- static Identifier from(ExecState* exec, double y);
-
- bool isNull() const { return _ustring.isNull(); }
- bool isEmpty() const { return _ustring.isEmpty(); }
-
- uint32_t toUInt32(bool* ok) const { return _ustring.toUInt32(ok); }
- uint32_t toUInt32(bool* ok, bool tolerateEmptyString) const { return _ustring.toUInt32(ok, tolerateEmptyString); };
- uint32_t toStrictUInt32(bool* ok) const { return _ustring.toStrictUInt32(ok); }
- unsigned toArrayIndex(bool* ok) const { return _ustring.toArrayIndex(ok); }
- double toDouble() const { return _ustring.toDouble(); }
-
- 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 void remove(UString::Rep*);
-
- static bool equal(const UString::Rep*, const char*);
- static bool equal(const UString::Rep*, const UChar*, unsigned length);
- static bool equal(const UString::Rep* a, const UString::Rep* b) { return JSC::equal(a, b); }
-
- static PassRefPtr<UString::Rep> add(ExecState*, const char*); // Only to be used with string literals.
- static PassRefPtr<UString::Rep> add(JSGlobalData*, const char*); // Only to be used with string literals.
-
- private:
- UString _ustring;
-
- static bool equal(const Identifier& a, const Identifier& b) { return a._ustring.rep() == b._ustring.rep(); }
- static bool equal(const Identifier& a, const char* b) { return equal(a._ustring.rep(), b); }
-
- static PassRefPtr<UString::Rep> add(ExecState*, const UChar*, int length);
- static PassRefPtr<UString::Rep> add(JSGlobalData*, const UChar*, int length);
-
- static PassRefPtr<UString::Rep> add(ExecState* exec, UString::Rep* r)
- {
-#ifndef NDEBUG
- checkCurrentIdentifierTable(exec);
-#endif
- if (r->isIdentifier())
- return r;
- return addSlowCase(exec, r);
- }
- static PassRefPtr<UString::Rep> add(JSGlobalData* globalData, UString::Rep* r)
- {
-#ifndef NDEBUG
- checkCurrentIdentifierTable(globalData);
-#endif
- if (r->isIdentifier())
- return r;
- return addSlowCase(globalData, r);
- }
-
- static PassRefPtr<UString::Rep> addSlowCase(ExecState*, UString::Rep* r);
- static PassRefPtr<UString::Rep> addSlowCase(JSGlobalData*, UString::Rep* 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 ThreadIdentifierTableData {
- ThreadIdentifierTableData()
- : defaultIdentifierTable(0)
- , currentIdentifierTable(0)
- {
- }
-
- IdentifierTable* defaultIdentifierTable;
- IdentifierTable* currentIdentifierTable;
- };
-
- extern WTF::ThreadSpecific<ThreadIdentifierTableData>* g_identifierTableSpecific;
- void createIdentifierTableSpecific();
-
- inline IdentifierTable* defaultIdentifierTable()
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- return data.defaultIdentifierTable;
- }
-
- inline void setDefaultIdentifierTable(IdentifierTable* identifierTable)
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- data.defaultIdentifierTable = identifierTable;
- }
-
- inline IdentifierTable* currentIdentifierTable()
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- return data.currentIdentifierTable;
- }
-
- inline IdentifierTable* setCurrentIdentifierTable(IdentifierTable* identifierTable)
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- IdentifierTable* oldIdentifierTable = data.currentIdentifierTable;
- data.currentIdentifierTable = identifierTable;
- return oldIdentifierTable;
- }
-
- inline void resetCurrentIdentifierTable()
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- data.currentIdentifierTable = data.defaultIdentifierTable;
- }
-
-} // namespace JSC
-
-#endif // Identifier_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/InitializeThreading.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/InitializeThreading.cpp
deleted file mode 100644
index 2605a9a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/InitializeThreading.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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>
-
-using namespace WTF;
-
-namespace JSC {
-
-#if OS(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS)
-static pthread_once_t initializeThreadingKeyOnce = PTHREAD_ONCE_INIT;
-#endif
-
-static void initializeThreadingOnce()
-{
- WTF::initializeThreading();
- initializeUString();
- JSGlobalData::storeVPtrs();
-#if ENABLE(JSC_MULTIPLE_THREADS)
- s_dtoaP5Mutex = new Mutex;
- initializeDates();
-#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/src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.cpp
deleted file mode 100644
index c48d628..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 "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(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const Identifier& name)
- : JSObject(structure)
-{
- putDirect(globalData->propertyNames->name, jsString(globalData, name.ustring()), DontDelete | ReadOnly | DontEnum);
-}
-
-const UString& InternalFunction::name(ExecState* exec)
-{
- return asString(getDirect(exec->globalData().propertyNames->name))->value(exec);
-}
-
-const UString InternalFunction::displayName(ExecState* exec)
-{
- JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
-
- if (displayName && isJSString(&exec->globalData(), displayName))
- return asString(displayName)->value(exec);
-
- return UString::null();
-}
-
-const UString InternalFunction::calculatedDisplayName(ExecState* exec)
-{
- const UString explicitName = displayName(exec);
-
- if (!explicitName.isEmpty())
- return explicitName;
-
- return name(exec);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.h b/src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.h
deleted file mode 100644
index d19b82b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/InternalFunction.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 "JSObject.h"
-#include "Identifier.h"
-
-namespace JSC {
-
- class FunctionPrototype;
-
- class InternalFunction : public JSObject {
- 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;
-
- InternalFunction(NonNullPassRefPtr<Structure> structure) : JSObject(structure) { }
- InternalFunction(JSGlobalData*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
deleted file mode 100644
index e83724a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.h
deleted file mode 100644
index 10ded4c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSAPIValueWrapper.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp
deleted file mode 100644
index 85e8bba..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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->variableCount();
-
- // Skip the call frame, which sits between the parameters and vars.
- markStack.appendValues(registerArray + count + RegisterFile::CallFrameHeaderSize, numVars, MayContainNullValues);
-}
-
-bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
- if (symbolTableGet(propertyName, slot))
- return true;
-
- if (JSValue* location = getDirectLocation(propertyName)) {
- slot.setValueSlot(location);
- return true;
- }
-
- // Only return the built-in arguments object if it wasn't overridden above.
- if (propertyName == exec->propertyNames().arguments) {
- slot.setCustom(this, getArgumentsGetter());
- 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();
-}
-
-bool JSActivation::isDynamicScope() const
-{
- return d()->functionExecutable->usesEval();
-}
-
-JSValue JSActivation::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&)
-{
- JSActivation* activation = asActivation(slotBase);
-
- if (activation->d()->functionExecutable->usesArguments()) {
- PropertySlot slot;
- activation->symbolTableGet(exec->propertyNames().arguments, slot);
- return slot.getValue(exec, exec->propertyNames().arguments);
- }
-
- CallFrame* callFrame = CallFrame::create(activation->d()->registers);
- Arguments* arguments = callFrame->optionalCalleeArguments();
- if (!arguments) {
- arguments = new (callFrame) Arguments(callFrame);
- arguments->copyRegisters();
- callFrame->setCalleeArguments(arguments);
- }
- ASSERT(arguments->inherits(&Arguments::info));
-
- return arguments;
-}
-
-// 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.h
deleted file mode 100644
index 91c960c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSActivation.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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 "RegisterFile.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() const;
-
- virtual bool isActivationObject() const { return true; }
-
- virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
-
- 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;
-
- void copyRegisters(Arguments* arguments);
-
- 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->generatedBytecode().symbolTable(), registers)
- , functionExecutable(_functionExecutable)
- {
- // We have to manually ref and deref the symbol table as JSVariableObjectData
- // doesn't know about SharedSymbolTable
- functionExecutable->generatedBytecode().sharedSymbolTable()->ref();
- }
- ~JSActivationData()
- {
- static_cast<SharedSymbolTable*>(symbolTable)->deref();
- }
-
- RefPtr<FunctionExecutable> functionExecutable;
- };
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp
deleted file mode 100644
index ae9e038..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp
+++ /dev/null
@@ -1,1074 +0,0 @@
-/*
- * 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>
-
-#define CHECK_ARRAY_CONSISTENCY 0
-
-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
-
-// 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};
-
-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 unsigned increasedVectorLength(unsigned newLength)
-{
- ASSERT(newLength <= MAX_STORAGE_VECTOR_LENGTH);
-
- // Mathematically equivalent to:
- // increasedLength = (newLength * 3 + 1) / 2;
- // or:
- // increasedLength = (unsigned)ceil(newLength * 1.5));
- // This form is not prone to internal overflow.
- unsigned increasedLength = newLength + (newLength >> 1) + (newLength & 1);
- ASSERT(increasedLength >= newLength);
-
- return min(increasedLength, MAX_STORAGE_VECTOR_LENGTH);
-}
-
-static inline bool isDenseEnoughForVector(unsigned length, unsigned numValues)
-{
- return length / minDensityMultiplier <= numValues;
-}
-
-#if !CHECK_ARRAY_CONSISTENCY
-
-inline void JSArray::checkConsistency(ConsistencyCheckType)
-{
-}
-
-#endif
-
-JSArray::JSArray(NonNullPassRefPtr<Structure> structure)
- : JSObject(structure)
-{
- unsigned initialCapacity = 0;
-
- m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity)));
- m_vectorLength = initialCapacity;
-
- checkConsistency();
-}
-
-JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength)
- : JSObject(structure)
-{
- unsigned initialCapacity = min(initialLength, MIN_SPARSE_ARRAY_INDEX);
-
- m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity)));
- m_storage->m_length = initialLength;
- m_vectorLength = initialCapacity;
- m_storage->m_numValuesInVector = 0;
- m_storage->m_sparseValueMap = 0;
- m_storage->subclassData = 0;
- m_storage->reportedMapCapacity = 0;
-
- JSValue* vector = m_storage->m_vector;
- for (size_t i = 0; i < initialCapacity; ++i)
- vector[i] = JSValue();
-
- checkConsistency();
-
- Heap::heap(this)->reportExtraMemoryCost(initialCapacity * sizeof(JSValue));
-}
-
-JSArray::JSArray(NonNullPassRefPtr<Structure> structure, const ArgList& list)
- : JSObject(structure)
-{
- unsigned initialCapacity = list.size();
-
- m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity)));
- m_storage->m_length = initialCapacity;
- m_vectorLength = initialCapacity;
- m_storage->m_numValuesInVector = initialCapacity;
- m_storage->m_sparseValueMap = 0;
- m_storage->subclassData = 0;
- m_storage->reportedMapCapacity = 0;
-
- size_t i = 0;
- ArgList::const_iterator end = list.end();
- for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i)
- m_storage->m_vector[i] = *it;
-
- checkConsistency();
-
- Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity));
-}
-
-JSArray::~JSArray()
-{
- ASSERT(vptr() == JSGlobalData::jsArrayVPtr);
- checkConsistency(DestructorConsistencyCheck);
-
- delete m_storage->m_sparseValueMap;
- fastFree(m_storage);
-}
-
-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(exec, 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(exec, length()), DontDelete | DontEnum);
- return true;
- }
-
- bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
- if (isArrayIndex) {
- if (i >= m_storage->m_length)
- return false;
- if (i < m_vectorLength) {
- JSValue& value = m_storage->m_vector[i];
- if (value) {
- descriptor.setDescriptor(value, 0);
- return true;
- }
- } else if (SparseArrayValueMap* map = m_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, RangeError, "Invalid array length.");
- return;
- }
- setLength(newLength);
- return;
- }
-
- JSObject::put(exec, propertyName, value, slot);
-}
-
-void JSArray::put(ExecState* exec, unsigned i, JSValue value)
-{
- checkConsistency();
-
- unsigned length = m_storage->m_length;
- if (i >= length && i <= MAX_ARRAY_INDEX) {
- length = i + 1;
- m_storage->m_length = length;
- }
-
- if (i < m_vectorLength) {
- JSValue& valueSlot = m_storage->m_vector[i];
- if (valueSlot) {
- valueSlot = value;
- checkConsistency();
- return;
- }
- valueSlot = value;
- ++m_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 = increasedVectorLength(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 proposedNewNumValuesInVector = newNumValuesInVector;
- // If newVectorLength is already the maximum - MAX_STORAGE_VECTOR_LENGTH - then do not attempt to grow any further.
- while (newVectorLength < MAX_STORAGE_VECTOR_LENGTH) {
- unsigned proposedNewVectorLength = increasedVectorLength(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;
- }
- }
-
- if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage)) {
- throwOutOfMemoryError(exec);
- return;
- }
-
- unsigned vectorLength = m_vectorLength;
-
- if (newNumValuesInVector == storage->m_numValuesInVector + 1) {
- for (unsigned j = vectorLength; j < newVectorLength; ++j)
- storage->m_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)
- storage->m_vector[j] = JSValue();
- for (unsigned j = max(vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j)
- storage->m_vector[j] = map->take(j);
- }
-
- storage->m_vector[i] = value;
-
- m_vectorLength = newVectorLength;
- storage->m_numValuesInVector = newNumValuesInVector;
-
- m_storage = storage;
-
- 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);
-}
-
-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 = increasedVectorLength(newLength);
-
- if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage))
- return false;
-
- m_vectorLength = newVectorLength;
-
- for (unsigned i = vectorLength; i < newVectorLength; ++i)
- storage->m_vector[i] = JSValue();
-
- m_storage = storage;
-
- Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
-
- return true;
-}
-
-void JSArray::setLength(unsigned newLength)
-{
- checkConsistency();
-
- ArrayStorage* storage = m_storage;
-
- unsigned length = m_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;
- }
- }
- }
-
- m_storage->m_length = newLength;
-
- checkConsistency();
-}
-
-JSValue JSArray::pop()
-{
- checkConsistency();
-
- unsigned length = m_storage->m_length;
- if (!length)
- return jsUndefined();
-
- --length;
-
- JSValue result;
-
- if (length < m_vectorLength) {
- JSValue& valueSlot = m_storage->m_vector[length];
- if (valueSlot) {
- --m_storage->m_numValuesInVector;
- result = valueSlot;
- valueSlot = JSValue();
- } else
- result = jsUndefined();
- } else {
- result = jsUndefined();
- if (SparseArrayValueMap* map = m_storage->m_sparseValueMap) {
- SparseArrayValueMap::iterator it = map->find(length);
- if (it != map->end()) {
- result = it->second;
- map->remove(it);
- if (map->isEmpty()) {
- delete map;
- m_storage->m_sparseValueMap = 0;
- }
- }
- }
- }
-
- m_storage->m_length = length;
-
- checkConsistency();
-
- return result;
-}
-
-void JSArray::push(ExecState* exec, JSValue value)
-{
- checkConsistency();
-
- if (m_storage->m_length < m_vectorLength) {
- m_storage->m_vector[m_storage->m_length] = value;
- ++m_storage->m_numValuesInVector;
- ++m_storage->m_length;
- checkConsistency();
- return;
- }
-
- if (m_storage->m_length < MIN_SPARSE_ARRAY_INDEX) {
- SparseArrayValueMap* map = m_storage->m_sparseValueMap;
- if (!map || map->isEmpty()) {
- if (increaseVectorLength(m_storage->m_length + 1)) {
- m_storage->m_vector[m_storage->m_length] = value;
- ++m_storage->m_numValuesInVector;
- ++m_storage->m_length;
- checkConsistency();
- return;
- }
- checkConsistency();
- throwOutOfMemoryError(exec);
- return;
- }
- }
-
- putSlowCase(exec, m_storage->m_length++, value);
-}
-
-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);
-}
-
-typedef std::pair<JSValue, UString> ValueStringPair;
-
-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 compare(va->second, vb->second);
-}
-
-void JSArray::sortNumeric(ExecState* exec, JSValue compareFunction, CallType callType, const CallData& callData)
-{
- unsigned lengthNotIncludingUndefined = compactForSorting();
- if (m_storage->m_sparseValueMap) {
- throwOutOfMemoryError(exec);
- return;
- }
-
- if (!lengthNotIncludingUndefined)
- return;
-
- bool allValuesAreNumbers = true;
- size_t size = m_storage->m_numValuesInVector;
- for (size_t i = 0; i < size; ++i) {
- if (!m_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(m_storage->m_vector, size, sizeof(JSValue), compareNumbersForQSort);
-
- checkConsistency(SortConsistencyCheck);
-}
-
-void JSArray::sort(ExecState* exec)
-{
- unsigned lengthNotIncludingUndefined = compactForSorting();
- if (m_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;
- }
-
- for (size_t i = 0; i < lengthNotIncludingUndefined; i++) {
- JSValue value = m_storage->m_vector[i];
- ASSERT(!value.isUndefined());
- values[i].first = value;
- }
-
- // FIXME: While calling these toString functions, the array could be mutated.
- // In that case, objects pointed to by values in this vector might get garbage-collected!
-
- // 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
-
- // FIXME: If the toString function changed the length of the array, this might be
- // modifying the vector incorrectly.
-
- for (size_t i = 0; i < lengthNotIncludingUndefined; i++)
- m_storage->m_vector[i] = values[i].first;
-
- 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();
-
- // 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(m_storage->m_length <= static_cast<unsigned>(std::numeric_limits<int>::max()));
- if (m_storage->m_length > static_cast<unsigned>(std::numeric_limits<int>::max()))
- return;
-
- if (!m_storage->m_length)
- return;
-
- unsigned usedVectorLength = min(m_storage->m_length, m_vectorLength);
-
- 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.resize(usedVectorLength + (m_storage->m_sparseValueMap ? m_storage->m_sparseValueMap->size() : 0));
-
- if (callType == CallTypeJS)
- tree.abstractor().m_cachedCall.set(new CachedCall(exec, asFunction(compareFunction), 2, exec->exceptionSlot()));
-
- 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 = m_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 = m_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 = m_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;
- }
- }
-
- 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;
- m_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) {
- m_storage->m_vector[i] = tree.abstractor().m_nodes[*iter].value;
- ++iter;
- }
-
- // Put undefined values back in.
- for (unsigned i = numDefined; i < newUsedVectorLength; ++i)
- m_storage->m_vector[i] = jsUndefined();
-
- // Ensure that unused values in the vector are zeroed out.
- for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
- m_storage->m_vector[i] = JSValue();
-
- m_storage->m_numValuesInVector = newUsedVectorLength;
-
- checkConsistency(SortConsistencyCheck);
-}
-
-void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args)
-{
- JSValue* vector = m_storage->m_vector;
- unsigned vectorEnd = min(m_storage->m_length, m_vectorLength);
- unsigned i = 0;
- for (; i < vectorEnd; ++i) {
- JSValue& v = vector[i];
- if (!v)
- break;
- args.append(v);
- }
-
- for (; i < m_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(m_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)
-{
- ASSERT(m_storage);
- if (type == SortConsistencyCheck)
- ASSERT(!m_storage->m_sparseValueMap);
-
- unsigned numValuesInVector = 0;
- for (unsigned i = 0; i < m_vectorLength; ++i) {
- if (JSValue value = m_storage->m_vector[i]) {
- ASSERT(i < m_storage->m_length);
- if (type != DestructorConsistencyCheck)
- value->type(); // Likely to crash if the object was deallocated.
- ++numValuesInVector;
- } else {
- if (type == SortConsistencyCheck)
- ASSERT(i >= m_storage->m_numValuesInVector);
- }
- }
- ASSERT(numValuesInVector == m_storage->m_numValuesInVector);
- ASSERT(numValuesInVector <= m_storage->m_length);
-
- if (m_storage->m_sparseValueMap) {
- SparseArrayValueMap::iterator end = m_storage->m_sparseValueMap->end();
- for (SparseArrayValueMap::iterator it = m_storage->m_sparseValueMap->begin(); it != end; ++it) {
- unsigned index = it->first;
- ASSERT(index < m_storage->m_length);
- ASSERT(index >= m_vectorLength);
- ASSERT(index <= MAX_ARRAY_INDEX);
- ASSERT(it->second);
- if (type != DestructorConsistencyCheck)
- it->second->type(); // Likely to crash if the object was deallocated.
- }
- }
-}
-
-#endif
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h
deleted file mode 100644
index f65f2bc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * 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"
-
-namespace JSC {
-
- typedef HashMap<unsigned, JSValue> SparseArrayValueMap;
-
- struct ArrayStorage {
- unsigned m_length;
- unsigned m_numValuesInVector;
- SparseArrayValueMap* m_sparseValueMap;
- void* subclassData; // A JSArray subclass can use this to fill the vector lazily.
- size_t reportedMapCapacity;
- JSValue m_vector[1];
- };
-
- class JSArray : public JSObject {
- friend class JIT;
- friend class Walker;
-
- public:
- explicit JSArray(NonNullPassRefPtr<Structure>);
- JSArray(NonNullPassRefPtr<Structure>, unsigned initialLength);
- 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();
-
- 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) {
- ++m_storage->m_numValuesInVector;
- if (i >= m_storage->m_length)
- m_storage->m_length = i + 1;
- }
- x = 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);
-
- bool increaseVectorLength(unsigned newLength);
-
- unsigned compactForSorting();
-
- enum ConsistencyCheckType { NormalConsistencyCheck, DestructorConsistencyCheck, SortConsistencyCheck };
- void checkConsistency(ConsistencyCheckType = NormalConsistencyCheck);
-
- unsigned m_vectorLength;
- 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()
- {
- 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::isCellMarked(cell = value.asCell())) {
- if (current.m_values == end) {
- m_markSets.removeLast();
- continue;
- }
- goto findNextUnmarkedNullValue;
- }
-
- Heap::markCell(cell);
- 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());
- }
- }
-
-} // namespace JSC
-
-#endif // JSArray_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp
deleted file mode 100644
index 803a08c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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(exec, 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, false);
- 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, false);
- 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, false);
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h
deleted file mode 100644
index 5b7adcf..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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* exec, unsigned i)
- {
- ASSERT(canAccessIndex(i));
- return jsNumber(exec, m_storage->data()[i]);
- }
-
- void setIndex(unsigned i, int value)
- {
- ASSERT(canAccessIndex(i));
- if (value & ~0xFF) {
- if (value < 0)
- value = 0;
- else
- value = 255;
- }
- m_storage->data()[i] = static_cast<unsigned char>(value);
- }
-
- void setIndex(unsigned i, double value)
- {
- ASSERT(canAccessIndex(i));
- if (!(value > 0)) // Clamp NaN to 0
- value = 0;
- else if (value > 255)
- value = 255;
- m_storage->data()[i] = static_cast<unsigned char>(value + 0.5);
- }
-
- 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*>(asCell(value));
- }
-
- inline bool isJSByteArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsByteArrayVPtr; }
-
-} // namespace JSC
-
-#endif // JSByteArray_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.cpp
deleted file mode 100644
index 869fbfc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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);
-}
-
-UString JSCell::toThisString(ExecState* exec) const
-{
- return toThisObject(exec)->toString(exec);
-}
-
-JSString* JSCell::toThisJSString(ExecState* exec)
-{
- return jsString(exec, toThisString(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/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h
deleted file mode 100644
index 3c8c829..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * 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 "Collector.h"
-#include "JSImmediate.h"
-#include "JSValue.h"
-#include "MarkStack.h"
-#include "Structure.h"
-#include <wtf/Noncopyable.h>
-
-namespace JSC {
-
- class JSCell : public NoncopyableCustomAllocated {
- 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.
-#if USE(JSVALUE32)
- bool isNumber() const;
-#endif
- 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 UString toThisString(ExecState*) const;
- virtual JSString* toThisJSString(ExecState*);
- virtual JSValue getJSNumber();
- void* vptr() { return *reinterpret_cast<void**>(this); }
- void setVPtr(void* vptr) { *reinterpret_cast<void**>(this) = vptr; }
-
- protected:
- static const unsigned AnonymousSlotCount = 0;
-
- private:
- // Base implementation; for non-object classes implements getPropertySlot.
- bool fastGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
- 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()
- {
- }
-
-#if USE(JSVALUE32)
- inline bool JSCell::isNumber() const
- {
- return m_structure->typeInfo().type() == NumberType;
- }
-#endif
-
- 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 JSValue::getCallData(CallData& callData)
- {
- return isCell() ? asCell()->getCallData(callData) : CallTypeNone;
- }
-
- inline ConstructType JSValue::getConstructData(ConstructData& constructData)
- {
- return isCell() ? asCell()->getConstructData(constructData) : ConstructTypeNone;
- }
-
- 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(JSVALUE32_64)
- ALWAYS_INLINE JSCell* JSValue::asCell() const
- {
- ASSERT(isCell());
- return m_ptr;
- }
-#endif // !USE(JSVALUE32_64)
-
- 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 UString JSValue::toThisString(ExecState* exec) const
- {
- return isCell() ? asCell()->toThisString(exec) : toString(exec);
- }
-
- 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::isCellMarked(cell))
- return;
- Heap::markCell(cell);
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.cpp
deleted file mode 100644
index cba6795..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * 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 "FunctionPrototype.h"
-#include "JSGlobalObject.h"
-#include "Interpreter.h"
-#include "ObjectPrototype.h"
-#include "Parser.h"
-#include "PropertyNameArray.h"
-#include "ScopeChainMark.h"
-
-using namespace WTF;
-using namespace Unicode;
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(JSFunction);
-
-const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 };
-
-bool JSFunction::isHostFunctionNonInline() const
-{
- return isHostFunction();
-}
-
-JSFunction::JSFunction(NonNullPassRefPtr<Structure> structure)
- : Base(structure)
- , m_executable(adoptRef(new VPtrHackExecutable()))
-{
-}
-
-JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
- : Base(&exec->globalData(), structure, name)
-#if ENABLE(JIT)
- , m_executable(adoptRef(new NativeExecutable(exec)))
-#endif
-{
-#if ENABLE(JIT)
- setNativeFunction(func);
- putDirect(exec->propertyNames().length, jsNumber(exec, 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(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name())
- , m_executable(executable)
-{
- setScopeChain(scopeChainNode);
-}
-
-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()->isGenerated())
- jsExecutable()->generatedBytecode().unlinkCallers();
-#endif
- scopeChain().~ScopeChain(); // FIXME: Don't we need to do this in the interpreter too?
- }
-}
-
-void JSFunction::markChildren(MarkStack& markStack)
-{
- Base::markChildren(markStack);
- if (!isHostFunction()) {
- jsExecutable()->markAggregate(markStack);
- scopeChain().markAggregate(markStack);
- }
-}
-
-CallType JSFunction::getCallData(CallData& callData)
-{
- if (isHostFunction()) {
- callData.native.function = nativeFunction();
- return CallTypeHost;
- }
- callData.js.functionExecutable = jsExecutable();
- callData.js.scopeChain = scopeChain().node();
- return CallTypeJS;
-}
-
-JSValue JSFunction::call(ExecState* exec, JSValue thisValue, const ArgList& args)
-{
- ASSERT(!isHostFunction());
- return exec->interpreter()->execute(jsExecutable(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot());
-}
-
-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* exec, JSValue slotBase, const Identifier&)
-{
- JSFunction* thisObj = asFunction(slotBase);
- ASSERT(!thisObj->isHostFunction());
- return jsNumber(exec, 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(scopeChain().globalObject()->emptyObjectStructure());
- prototype->putDirect(exec->propertyNames().constructor, this, DontEnum);
- putDirect(exec->propertyNames().prototype, prototype, DontDelete);
- location = getDirectLocation(propertyName);
- }
-
- slot.setValueSlot(this, location, offsetForLocation(location));
- }
-
- if (propertyName == exec->propertyNames().arguments) {
- slot.setCacheableCustom(this, argumentsGetter);
- return true;
- }
-
- if (propertyName == exec->propertyNames().length) {
- slot.setCacheableCustom(this, lengthGetter);
- return true;
- }
-
- if (propertyName == exec->propertyNames().caller) {
- 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) {
- descriptor.setDescriptor(exec->interpreter()->retrieveArguments(exec, this), ReadOnly | DontEnum | DontDelete);
- return true;
- }
-
- if (propertyName == exec->propertyNames().length) {
- descriptor.setDescriptor(jsNumber(exec, jsExecutable()->parameterCount()), ReadOnly | DontEnum | DontDelete);
- return true;
- }
-
- if (propertyName == exec->propertyNames().caller) {
- 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)) {
- 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().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 = scopeChain().node();
- return ConstructTypeJS;
-}
-
-JSObject* JSFunction::construct(ExecState* exec, const ArgList& args)
-{
- ASSERT(!isHostFunction());
- Structure* structure;
- JSValue prototype = get(exec, exec->propertyNames().prototype);
- if (prototype.isObject())
- structure = asObject(prototype)->inheritorID();
- else
- structure = exec->lexicalGlobalObject()->emptyObjectStructure();
- JSObject* thisObj = new (exec) JSObject(structure);
-
- JSValue result = exec->interpreter()->execute(jsExecutable(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot());
- if (exec->hadException() || !result.isObject())
- return thisObj;
- return asObject(result);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h
deleted file mode 100644
index afa24a8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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 "InternalFunction.h"
-
-namespace JSC {
-
- class ExecutableBase;
- class FunctionExecutable;
- class FunctionPrototype;
- class JSActivation;
- class JSGlobalObject;
-
- class JSFunction : public InternalFunction {
- friend class JIT;
- friend class JSGlobalData;
-
- typedef InternalFunction Base;
-
- public:
- JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
- JSFunction(ExecState*, NonNullPassRefPtr<FunctionExecutable>, ScopeChainNode*);
- virtual ~JSFunction();
-
- JSObject* construct(ExecState*, const ArgList&);
- JSValue call(ExecState*, JSValue thisValue, const ArgList&);
-
- void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); }
- ScopeChain& scope() { return 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()
- {
- return *WTF::bitwise_cast<NativeFunction*>(m_data);
- }
-
- virtual ConstructType getConstructData(ConstructData&);
- virtual CallType getCallData(CallData&);
-
- protected:
- const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | InternalFunction::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& scopeChain()
- {
- ASSERT(!isHostFunctionNonInline());
- return *WTF::bitwise_cast<ScopeChain*>(m_data);
- }
- void clearScopeChain()
- {
- ASSERT(!isHostFunctionNonInline());
- new (m_data) ScopeChain(NoScopeChain());
- }
- void setScopeChain(ScopeChainNode* sc)
- {
- ASSERT(!isHostFunctionNonInline());
- new (m_data) ScopeChain(sc);
- }
- void setScopeChain(const ScopeChain& sc)
- {
- ASSERT(!isHostFunctionNonInline());
- *WTF::bitwise_cast<ScopeChain*>(m_data) = sc;
- }
- void setNativeFunction(NativeFunction func)
- {
- *WTF::bitwise_cast<NativeFunction*>(m_data) = func;
- }
- unsigned char m_data[sizeof(void*)];
- };
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp
deleted file mode 100644
index 45abc86..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * 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 "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"
-
-#if ENABLE(JSC_MULTIPLE_THREADS)
-#include <wtf/Threading.h>
-#endif
-
-#if PLATFORM(MAC)
-#include "ProfilerServer.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::createStructure(jsNull()));
- 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(bool isShared)
- : isSharedInstance(isShared)
- , 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()))
- , staticScopeStructure(JSStaticScopeObject::createStructure(jsNull()))
- , stringStructure(JSString::createStructure(jsNull()))
- , notAnObjectErrorStubStructure(JSNotAnObjectErrorStub::createStructure(jsNull()))
- , notAnObjectStructure(JSNotAnObject::createStructure(jsNull()))
- , propertyNameIteratorStructure(JSPropertyNameIterator::createStructure(jsNull()))
- , getterSetterStructure(GetterSetter::createStructure(jsNull()))
- , apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull()))
- , dummyMarkableCellStructure(JSCell::createDummyStructure())
-#if USE(JSVALUE32)
- , numberStructure(JSNumberCell::createStructure(jsNull()))
-#endif
- , identifierTable(createIdentifierTable())
- , propertyNames(new CommonIdentifiers(this))
- , emptyList(new MarkedArgumentBuffer)
- , lexer(new Lexer(this))
- , parser(new Parser)
- , interpreter(new Interpreter)
-#if ENABLE(JIT)
- , jitStubs(this)
-#endif
- , heap(this)
- , initializingLazyNumericCompareFunction(false)
- , head(0)
- , dynamicGlobalObject(0)
- , functionCodeBlockBeingReparsed(0)
- , firstStringifierToMark(0)
- , markStack(jsArrayVPtr)
- , cachedUTCOffset(NaN)
- , weakRandom(static_cast<int>(currentTime()))
-#ifndef NDEBUG
- , mainThreadOnly(false)
-#endif
-{
-#if PLATFORM(MAC)
- startProfilerServerIfNeeded();
-#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;
- deleteIdentifierTable(identifierTable);
-
- delete clientData;
-}
-
-PassRefPtr<JSGlobalData> JSGlobalData::createNonDefault()
-{
- return adoptRef(new JSGlobalData(false));
-}
-
-PassRefPtr<JSGlobalData> JSGlobalData::create()
-{
- JSGlobalData* globalData = new JSGlobalData(false);
- setDefaultIdentifierTable(globalData->identifierTable);
- setCurrentIdentifierTable(globalData->identifierTable);
- return adoptRef(globalData);
-}
-
-PassRefPtr<JSGlobalData> JSGlobalData::createLeaked()
-{
- Structure::startIgnoringLeaks();
- RefPtr<JSGlobalData> data = create();
- Structure::stopIgnoringLeaks();
- return data.release();
-}
-
-bool JSGlobalData::sharedInstanceExists()
-{
- return sharedInstanceInternal();
-}
-
-JSGlobalData& JSGlobalData::sharedInstance()
-{
- JSGlobalData*& instance = sharedInstanceInternal();
- if (!instance) {
- instance = new JSGlobalData(true);
-#if ENABLE(JSC_MULTIPLE_THREADS)
- instance->makeUsableFromMultipleThreads();
-#endif
- }
- return *instance;
-}
-
-JSGlobalData*& JSGlobalData::sharedInstanceInternal()
-{
- ASSERT(JSLock::currentThreadIsHoldingLock());
- static JSGlobalData* sharedInstance;
- return sharedInstance;
-}
-
-// FIXME: We can also detect forms like v1 < v2 ? -1 : 0, reverse comparison, etc.
-const Vector<Instruction>& JSGlobalData::numericCompareFunction(ExecState* exec)
-{
- if (!lazyNumericCompareFunction.size() && !initializingLazyNumericCompareFunction) {
- initializingLazyNumericCompareFunction = true;
- RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(Identifier(exec, "numericCompare"), exec, 0, makeSource(UString("(function (v1, v2) { return v1 - v2; })")), 0, 0);
- lazyNumericCompareFunction = function->bytecode(exec, exec->scopeChain()).instructions();
- initializingLazyNumericCompareFunction = false;
- }
-
- return lazyNumericCompareFunction;
-}
-
-JSGlobalData::ClientData::~ClientData()
-{
-}
-
-void JSGlobalData::resetDateCache()
-{
- cachedUTCOffset = NaN;
- dstOffsetCache.reset();
- cachedDateString = UString();
- dateInstanceCache.reset();
-}
-
-void JSGlobalData::startSampling()
-{
- interpreter->startSampling();
-}
-
-void JSGlobalData::stopSampling()
-{
- interpreter->stopSampling();
-}
-
-void JSGlobalData::dumpSampleData(ExecState* exec)
-{
- interpreter->dumpSampleData(exec);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h
deleted file mode 100644
index 0f1f3c6..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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 "Collector.h"
-#include "DateInstanceCache.h"
-#include "ExecutableAllocator.h"
-#include "JITStubs.h"
-#include "JSValue.h"
-#include "MarkStack.h"
-#include "NumericStrings.h"
-#include "SmallStrings.h"
-#include "TimeoutChecker.h"
-#include "WeakRandom.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-
-struct OpaqueJSClass;
-struct OpaqueJSClassContextData;
-
-namespace JSC {
-
- class CodeBlock;
- class CommonIdentifiers;
- class IdentifierTable;
- class Interpreter;
- class JSGlobalObject;
- class JSObject;
- class Lexer;
- class Parser;
- class Stringifier;
- class Structure;
- class UString;
-
- 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;
- };
-
- class JSGlobalData : public RefCounted<JSGlobalData> {
- public:
- struct ClientData {
- virtual ~ClientData() = 0;
- };
-
- static bool sharedInstanceExists();
- static JSGlobalData& sharedInstance();
-
- static PassRefPtr<JSGlobalData> create();
- static PassRefPtr<JSGlobalData> createLeaked();
- static PassRefPtr<JSGlobalData> createNonDefault();
- ~JSGlobalData();
-
-#if ENABLE(JSC_MULTIPLE_THREADS)
- // Will start tracking threads that use the heap, which is resource-heavy.
- void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); }
-#endif
-
- bool isSharedInstance;
- 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> staticScopeStructure;
- RefPtr<Structure> stringStructure;
- RefPtr<Structure> notAnObjectErrorStubStructure;
- RefPtr<Structure> notAnObjectStructure;
- RefPtr<Structure> propertyNameIteratorStructure;
- RefPtr<Structure> getterSetterStructure;
- RefPtr<Structure> apiWrapperStructure;
- RefPtr<Structure> dummyMarkableCellStructure;
-
-#if USE(JSVALUE32)
- RefPtr<Structure> numberStructure;
-#endif
-
- 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;
-#endif
-
- Lexer* lexer;
- Parser* parser;
- Interpreter* interpreter;
-#if ENABLE(JIT)
- JITThunks jitStubs;
-#endif
- TimeoutChecker timeoutChecker;
- Heap heap;
-
- JSValue exception;
-#if ENABLE(JIT)
- ReturnAddressPtr exceptionLocation;
-#endif
-
- const Vector<Instruction>& numericCompareFunction(ExecState*);
- Vector<Instruction> lazyNumericCompareFunction;
- bool initializingLazyNumericCompareFunction;
-
- HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
-
- JSGlobalObject* head;
- JSGlobalObject* dynamicGlobalObject;
-
- HashSet<JSObject*> arrayVisitedElements;
-
- CodeBlock* functionCodeBlockBeingReparsed;
- Stringifier* firstStringifierToMark;
-
- MarkStack markStack;
-
- double cachedUTCOffset;
- DSTOffsetCache dstOffsetCache;
-
- UString cachedDateString;
- double cachedDateStringValue;
-
- WeakRandom weakRandom;
-
-#ifndef NDEBUG
- bool mainThreadOnly;
-#endif
-
- void resetDateCache();
-
- void startSampling();
- void stopSampling();
- void dumpSampleData(ExecState* exec);
- private:
- JSGlobalData(bool isShared);
- static JSGlobalData*& sharedInstanceInternal();
- void createNativeThunk();
- };
-
-} // namespace JSC
-
-#endif // JSGlobalData_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp
deleted file mode 100644
index 86690bd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * 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.globalObject() == this) {
- registerFile.setGlobalObject(0);
- 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, 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()->recursion = 0;
- 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, FunctionPrototype::createStructure(jsNull())); // The real prototype will be set once ObjectPrototype is created.
- d()->prototypeFunctionStructure = PrototypeFunction::createStructure(d()->functionPrototype);
- NativeFunctionWrapper* callFunction = 0;
- NativeFunctionWrapper* applyFunction = 0;
- d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get(), &callFunction, &applyFunction);
- d()->callFunction = callFunction;
- d()->applyFunction = applyFunction;
- d()->objectPrototype = new (exec) ObjectPrototype(exec, 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<JSObject>::createStructure(d()->objectPrototype);
-
- d()->arrayPrototype = new (exec) ArrayPrototype(ArrayPrototype::createStructure(d()->objectPrototype));
- d()->arrayStructure = JSArray::createStructure(d()->arrayPrototype);
- d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructure(d()->arrayPrototype);
-
- d()->stringPrototype = new (exec) StringPrototype(exec, StringPrototype::createStructure(d()->objectPrototype));
- d()->stringObjectStructure = StringObject::createStructure(d()->stringPrototype);
-
- d()->booleanPrototype = new (exec) BooleanPrototype(exec, BooleanPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
- d()->booleanObjectStructure = BooleanObject::createStructure(d()->booleanPrototype);
-
- d()->numberPrototype = new (exec) NumberPrototype(exec, NumberPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
- d()->numberObjectStructure = NumberObject::createStructure(d()->numberPrototype);
-
- d()->datePrototype = new (exec) DatePrototype(exec, DatePrototype::createStructure(d()->objectPrototype));
- d()->dateStructure = DateInstance::createStructure(d()->datePrototype);
-
- d()->regExpPrototype = new (exec) RegExpPrototype(exec, RegExpPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
- d()->regExpStructure = RegExpObject::createStructure(d()->regExpPrototype);
-
- d()->methodCallDummy = constructEmptyObject(exec);
-
- ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, ErrorPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
- d()->errorStructure = ErrorInstance::createStructure(errorPrototype);
-
- RefPtr<Structure> nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(errorPrototype);
-
- NativeErrorPrototype* evalErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "EvalError", "EvalError");
- NativeErrorPrototype* rangeErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "RangeError", "RangeError");
- NativeErrorPrototype* referenceErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "ReferenceError", "ReferenceError");
- NativeErrorPrototype* syntaxErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "SyntaxError", "SyntaxError");
- NativeErrorPrototype* typeErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "TypeError", "TypeError");
- NativeErrorPrototype* URIErrorPrototype = new (exec) NativeErrorPrototype(exec, nativeErrorPrototypeStructure, "URIError", "URIError");
-
- // Constructors
-
- JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
- JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype);
- JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get());
- JSCell* stringConstructor = new (exec) StringConstructor(exec, StringConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype);
- JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, BooleanConstructor::createStructure(d()->functionPrototype), d()->booleanPrototype);
- JSCell* numberConstructor = new (exec) NumberConstructor(exec, NumberConstructor::createStructure(d()->functionPrototype), d()->numberPrototype);
- JSCell* dateConstructor = new (exec) DateConstructor(exec, DateConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->datePrototype);
-
- d()->regExpConstructor = new (exec) RegExpConstructor(exec, RegExpConstructor::createStructure(d()->functionPrototype), d()->regExpPrototype);
-
- d()->errorConstructor = new (exec) ErrorConstructor(exec, ErrorConstructor::createStructure(d()->functionPrototype), errorPrototype);
-
- RefPtr<Structure> nativeErrorStructure = NativeErrorConstructor::createStructure(d()->functionPrototype);
-
- d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, evalErrorPrototype);
- d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, rangeErrorPrototype);
- d()->referenceErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, referenceErrorPrototype);
- d()->syntaxErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, syntaxErrorPrototype);
- d()->typeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, typeErrorPrototype);
- d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, URIErrorPrototype);
-
- 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);
-
- evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum);
- rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum);
- referenceErrorPrototype->putDirect(exec->propertyNames().constructor, d()->referenceErrorConstructor, DontEnum);
- syntaxErrorPrototype->putDirect(exec->propertyNames().constructor, d()->syntaxErrorConstructor, DontEnum);
- typeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->typeErrorConstructor, DontEnum);
- URIErrorPrototype->putDirect(exec->propertyNames().constructor, d()->URIErrorConstructor, 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);
- putDirectFunctionWithoutTransition(Identifier(exec, "RangeError"), d()->rangeErrorConstructor);
- putDirectFunctionWithoutTransition(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor);
- putDirectFunctionWithoutTransition(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor);
- putDirectFunctionWithoutTransition(Identifier(exec, "TypeError"), d()->typeErrorConstructor);
- putDirectFunctionWithoutTransition(Identifier(exec, "URIError"), d()->URIErrorConstructor);
-
- // Set global values.
- GlobalPropertyInfo staticGlobals[] = {
- GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, MathObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete),
- GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(exec), DontEnum | DontDelete | ReadOnly),
- GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(exec, Inf), DontEnum | DontDelete | ReadOnly),
- GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly),
- GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(JSONObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete)
- };
-
- addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
-
- // Set global functions.
-
- d()->evalFunction = new (exec) GlobalEvalFunction(exec, GlobalEvalFunction::createStructure(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this);
- putDirectFunctionWithoutTransition(exec, d()->evalFunction, DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
-#ifndef NDEBUG
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, 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() 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);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h
deleted file mode 100644
index bbb6d5e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObject.h
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * 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 "NativeFunctionWrapper.h"
-#include "NumberPrototype.h"
-#include "StringPrototype.h"
-#include <wtf/HashSet.h>
-#include <wtf/OwnPtr.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;
-
- 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)
- {
- }
-
- Destructor destructor;
-
- size_t registerArraySize;
-
- JSGlobalObject* next;
- JSGlobalObject* prev;
-
- Debugger* debugger;
-
- ScopeChain globalScopeChain;
- Register globalCallFrame[RegisterFile::CallFrameHeaderSize];
-
- int recursion;
-
- 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;
-
- SymbolTable symbolTable;
- unsigned profileGroup;
-
- RefPtr<JSGlobalData> globalData;
-
- HashSet<GlobalCodeBlock*> codeBlocks;
- };
-
- public:
- void* operator new(size_t, JSGlobalData*);
-
- explicit JSGlobalObject()
- : JSVariableObject(JSGlobalObject::createStructure(jsNull()), new JSGlobalObjectData(destroyJSGlobalObjectData))
- {
- init(this);
- }
-
- protected:
- JSGlobalObject(NonNullPassRefPtr<Structure> structure, JSGlobalObjectData* data, JSObject* thisValue)
- : JSVariableObject(structure, data)
- {
- 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* 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; }
-
- int recursion() { return d()->recursion; }
- void incRecursion() { ++d()->recursion; }
- void decRecursion() { --d()->recursion; }
-
- 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() const;
-
- HashSet<GlobalCodeBlock*>& codeBlocks() { return d()->codeBlocks; }
-
- void copyGlobalsFrom(RegisterFile&);
- void copyGlobalsTo(RegisterFile&);
-
- void resetPrototype(JSValue prototype);
-
- JSGlobalData* globalData() { 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);
- }
-
- protected:
-
- 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.ustring().rep(), 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;
-
-#if USE(JSVALUE32)
- if (typeInfo().type() == StringType)
- return exec->lexicalGlobalObject()->stringPrototype();
-
- ASSERT(typeInfo().type() == NumberType);
- return exec->lexicalGlobalObject()->numberPrototype();
-#else
- ASSERT(typeInfo().type() == StringType);
- return exec->lexicalGlobalObject()->stringPrototype();
-#endif
- }
-
- 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);
- }
-
- 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)
- : m_dynamicGlobalObjectSlot(callFrame->globalData().dynamicGlobalObject)
- , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)
- {
- if (!m_dynamicGlobalObjectSlot) {
- m_dynamicGlobalObjectSlot = dynamicGlobalObject;
-
- // Reset the date cache between JS invocations to force the VM
- // to observe time zone changes.
- callFrame->globalData().resetDateCache();
- }
- }
-
- ~DynamicGlobalObjectScope()
- {
- m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;
- }
-
- private:
- JSGlobalObject*& m_dynamicGlobalObjectSlot;
- JSGlobalObject* m_savedDynamicGlobalObject;
- };
-
-} // namespace JSC
-
-#endif // JSGlobalObject_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
deleted file mode 100644
index be114d7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * 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 "StringBuilder.h"
-#include "StringExtras.h"
-#include "dtoa.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wtf/ASCIICType.h>
-#include <wtf/Assertions.h>
-#include <wtf/MathExtras.h>
-#include <wtf/unicode/UTF8.h>
-
-using namespace WTF;
-using namespace Unicode;
-
-namespace JSC {
-
-static JSValue encode(ExecState* exec, const ArgList& args, const char* doNotEscape)
-{
- UString str = args.at(0).toString(exec);
- CString cstr = str.UTF8String(true);
- if (!cstr.c_str())
- return throwError(exec, URIError, "String contained an illegal UTF-16 sequence.");
-
- JSStringBuilder builder;
- const char* p = cstr.c_str();
- for (size_t k = 0; k < cstr.size(); k++, p++) {
- char c = *p;
- if (c && strchr(doNotEscape, c))
- builder.append(c);
- else {
- char tmp[4];
- snprintf(tmp, 4, "%%%02X", static_cast<unsigned char>(c));
- builder.append(tmp);
- }
- }
- return builder.build(exec);
-}
-
-static JSValue decode(ExecState* exec, const ArgList& args, const char* doNotUnescape, bool strict)
-{
- JSStringBuilder builder;
- UString str = args.at(0).toString(exec);
- int k = 0;
- int len = str.size();
- const UChar* d = str.data();
- 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, URIError);
- // 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) {
- case 0x0009:
- case 0x000A:
- case 0x000B:
- case 0x000C:
- case 0x000D:
- case 0x0020:
- case 0x00A0:
- case 0x2028:
- case 0x2029:
- 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;
-}
-
-static double parseInt(const UString& s, int radix)
-{
- int length = s.size();
- const UChar* data = s.data();
- 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.substr(firstDigitPosition, p - firstDigitPosition).ascii(), 0);
- else if (radix == 2 || radix == 4 || radix == 8 || radix == 16 || radix == 32)
- number = parseIntOverflow(s.substr(firstDigitPosition, p - firstDigitPosition).ascii(), p - firstDigitPosition, radix);
- }
-
- if (!sawDigit)
- return NaN;
-
- return sign * number;
-}
-
-static double parseFloat(const UString& s)
-{
- // Check for 0x prefix here, because toDouble allows it, but we must treat it as 0.
- // Need to skip any whitespace and then one + or - sign.
- int length = s.size();
- const UChar* data = s.data();
- int p = 0;
- while (p < length && isStrWhiteSpace(data[p]))
- ++p;
-
- if (p < length && (data[p] == '+' || data[p] == '-'))
- ++p;
-
- if (length - p >= 2 && data[p] == '0' && (data[p + 1] == 'x' || data[p + 1] == 'X'))
- return 0;
-
- return s.toDouble(true /*tolerant*/, false /* NaN for empty string */);
-}
-
-JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec, JSObject* function, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObject = thisValue.toThisObject(exec);
- JSObject* unwrappedObject = thisObject->unwrappedObject();
- if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != function)
- return throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated");
-
- JSValue x = args.at(0);
- if (!x.isString())
- return x;
-
- UString s = x.toString(exec);
-
- LiteralParser preparser(exec, s, LiteralParser::NonStrictJSON);
- if (JSValue parsedObject = preparser.tryLiteralParse())
- return parsedObject;
-
- RefPtr<EvalExecutable> eval = EvalExecutable::create(exec, makeSource(s));
- JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node());
- if (error)
- return throwError(exec, error);
-
- return exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot());
-}
-
-JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- JSValue value = args.at(0);
- int32_t radix = args.at(1).toInt32(exec);
-
- if (radix != 0 && radix != 10)
- return jsNumber(exec, parseInt(value.toString(exec), radix));
-
- if (value.isInt32())
- return value;
-
- if (value.isDouble()) {
- double d = value.asDouble();
- if (isfinite(d))
- return jsNumber(exec, (d > 0) ? floor(d) : ceil(d));
- if (isnan(d) || isinf(d))
- return jsNaN(exec);
- return jsNumber(exec, 0);
- }
-
- return jsNumber(exec, parseInt(value.toString(exec), radix));
-}
-
-JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsNumber(exec, parseFloat(args.at(0).toString(exec)));
-}
-
-JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsBoolean(isnan(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- double n = args.at(0).toNumber(exec);
- return jsBoolean(!isnan(n) && !isinf(n));
-}
-
-JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- static const char do_not_unescape_when_decoding_URI[] =
- "#$&+,/:;=?@";
-
- return decode(exec, args, do_not_unescape_when_decoding_URI, true);
-}
-
-JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return decode(exec, args, "", true);
-}
-
-JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- static const char do_not_escape_when_encoding_URI[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "!#$&'()*+,-./:;=?@_~";
-
- return encode(exec, args, do_not_escape_when_encoding_URI);
-}
-
-JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- static const char do_not_escape_when_encoding_URI_component[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "!'()*-._~";
-
- return encode(exec, args, do_not_escape_when_encoding_URI_component);
-}
-
-JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- static const char do_not_escape[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "*+-./@_";
-
- JSStringBuilder builder;
- UString str = args.at(0).toString(exec);
- const UChar* c = str.data();
- for (unsigned k = 0; k < str.size(); k++, c++) {
- int u = c[0];
- if (u > 255) {
- char tmp[7];
- sprintf(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];
- sprintf(tmp, "%%%02X", u);
- builder.append(tmp);
- }
- }
-
- return builder.build(exec);
-}
-
-JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- StringBuilder builder;
- UString str = args.at(0).toString(exec);
- int k = 0;
- int len = str.size();
- while (k < len) {
- const UChar* c = str.data() + 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 jsString(exec, builder.build());
-}
-
-#ifndef NDEBUG
-JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- CStringBuffer string;
- args.at(0).toString(exec).getCString(string);
- puts(string.data());
- return jsUndefined();
-}
-#endif
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
deleted file mode 100644
index b1046f2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 JSGlobalObjectFunctions_h
-#define JSGlobalObjectFunctions_h
-
-#include <wtf/unicode/Unicode.h>
-
-namespace JSC {
-
- class ArgList;
- class ExecState;
- class JSObject;
- class JSValue;
-
- // FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
- // is a 0.5% reduction.
-
- JSValue JSC_HOST_CALL globalFuncEval(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncParseInt(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncEscape(ExecState*, JSObject*, JSValue, const ArgList&);
- JSValue JSC_HOST_CALL globalFuncUnescape(ExecState*, JSObject*, JSValue, const ArgList&);
-#ifndef NDEBUG
- JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*, JSObject*, JSValue, const ArgList&);
-#endif
-
- static const double mantissaOverflowLowerBound = 9007199254740992.0;
- double parseIntOverflow(const char*, int length, int radix);
- bool isStrWhiteSpace(UChar);
-
-} // namespace JSC
-
-#endif // JSGlobalObjectFunctions_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.cpp
deleted file mode 100644
index 846238d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.h
deleted file mode 100644
index 0f54f60..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSImmediate.h
+++ /dev/null
@@ -1,721 +0,0 @@
-/*
- * 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(JSVALUE32_64)
-
-#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 JSFastMath;
- class JSGlobalData;
- class JSObject;
- class UString;
-
-#if USE(JSVALUE64)
- 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);
- }
-#endif
-
- /*
- * 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 JSFastMath;
- 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 USE(JSVALUE64)
- // 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;
-#else
- static const intptr_t TagTypeNumber = 0x1; // bottom bit set indicates integer, this dominates the following bit
-#endif
- 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;
-
-#if USE(JSVALUE64)
- static const int32_t IntegerPayloadShift = 0;
-#else
- static const int32_t IntegerPayloadShift = 1;
-#endif
- 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)
- {
-#if USE(JSVALUE64)
- return (rawValue(v) & TagTypeNumber) == TagTypeNumber;
-#else
- return isNumber(v);
-#endif
- }
-
-#if USE(JSVALUE64)
- static ALWAYS_INLINE bool isDouble(JSValue v)
- {
- return isNumber(v) && !isIntegerNumber(v);
- }
-#endif
-
- 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)
- {
-#if USE(JSVALUE64)
- return (rawValue(v1) & rawValue(v2) & TagTypeNumber) == TagTypeNumber;
-#else
- return rawValue(v1) & rawValue(v2) & TagTypeNumber;
-#endif
- }
-
- 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:
-#if USE(JSVALUE64)
- static const int minImmediateInt = ((-INT_MAX) - 1);
- static const int maxImmediateInt = INT_MAX;
-#else
- static const int minImmediateInt = ((-INT_MAX) - 1) >> IntegerPayloadShift;
- static const int maxImmediateInt = INT_MAX >> IntegerPayloadShift;
-#endif
- 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.
-#if USE(JSVALUE64)
- static ALWAYS_INLINE JSValue makeInt(uint32_t value)
-#else
- static ALWAYS_INLINE JSValue makeInt(int32_t value)
-#endif
- {
- return makeValue((static_cast<intptr_t>(value) << IntegerPayloadShift) | TagTypeNumber);
- }
-
-#if USE(JSVALUE64)
- static ALWAYS_INLINE JSValue makeDouble(double value)
- {
- return makeValue(reinterpretDoubleToIntptr(value) + DoubleEncodeOffset);
- }
-#endif
-
- 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);
-
-#if USE(JSVALUE64)
- static ALWAYS_INLINE double doubleValue(JSValue v)
- {
- return reinterpretIntptrToDouble(rawValue(v) - DoubleEncodeOffset);
- }
-#endif
-
- 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); }
-
-#if USE(JSVALUE64)
- 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();
- }
-#else
- ALWAYS_INLINE bool JSImmediate::toBoolean(JSValue v)
- {
- ASSERT(isImmediate(v));
- return isIntegerNumber(v) ? v != zeroImmediate() : v == trueImmediate();
- }
-#endif
-
- ALWAYS_INLINE uint32_t JSImmediate::getTruncatedUInt32(JSValue v)
- {
- // FIXME: should probably be asserting isPositiveIntegerNumber here.
- ASSERT(isIntegerNumber(v));
- return intValue(v);
- }
-
-#if USE(JSVALUE64)
- template<typename T>
- inline JSValue JSImmediate::fromNumberOutsideIntegerRange(T value)
- {
- return makeDouble(static_cast<double>(value));
- }
-#else
- template<typename T>
- inline JSValue JSImmediate::fromNumberOutsideIntegerRange(T)
- {
- return JSValue();
- }
-#endif
-
- 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)
- {
-#if !USE(JSVALUE64)
- if ((i < minImmediateInt) | (i > maxImmediateInt))
- return fromNumberOutsideIntegerRange(i);
-#endif
- 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 USE(JSVALUE64)
- if (isNumber(v)) {
- ASSERT(isDouble(v));
- return doubleValue(v);
- }
-#else
- ASSERT(!isNumber(v));
-#endif
-
- 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());
- }
-
- class JSFastMath {
- public:
- static ALWAYS_INLINE bool canDoFastBitwiseOperations(JSValue v1, JSValue v2)
- {
- return JSImmediate::areBothImmediateIntegerNumbers(v1, v2);
- }
-
- static ALWAYS_INLINE JSValue equal(JSValue v1, JSValue v2)
- {
- ASSERT(canDoFastBitwiseOperations(v1, v2));
- return jsBoolean(v1 == v2);
- }
-
- static ALWAYS_INLINE JSValue notEqual(JSValue v1, JSValue v2)
- {
- ASSERT(canDoFastBitwiseOperations(v1, v2));
- return jsBoolean(v1 != v2);
- }
-
- static ALWAYS_INLINE JSValue andImmediateNumbers(JSValue v1, JSValue v2)
- {
- ASSERT(canDoFastBitwiseOperations(v1, v2));
- return JSImmediate::makeValue(JSImmediate::rawValue(v1) & JSImmediate::rawValue(v2));
- }
-
- static ALWAYS_INLINE JSValue xorImmediateNumbers(JSValue v1, JSValue v2)
- {
- ASSERT(canDoFastBitwiseOperations(v1, v2));
- return JSImmediate::makeValue((JSImmediate::rawValue(v1) ^ JSImmediate::rawValue(v2)) | JSImmediate::TagTypeNumber);
- }
-
- static ALWAYS_INLINE JSValue orImmediateNumbers(JSValue v1, JSValue v2)
- {
- ASSERT(canDoFastBitwiseOperations(v1, v2));
- return JSImmediate::makeValue(JSImmediate::rawValue(v1) | JSImmediate::rawValue(v2));
- }
-
- static ALWAYS_INLINE bool canDoFastRshift(JSValue v1, JSValue v2)
- {
- return JSImmediate::areBothImmediateIntegerNumbers(v1, v2);
- }
-
- static ALWAYS_INLINE bool canDoFastUrshift(JSValue v1, JSValue v2)
- {
- return JSImmediate::areBothImmediateIntegerNumbers(v1, v2) && !(JSImmediate::rawValue(v1) & JSImmediate::signBit);
- }
-
- static ALWAYS_INLINE JSValue rightShiftImmediateNumbers(JSValue val, JSValue shift)
- {
- ASSERT(canDoFastRshift(val, shift) || canDoFastUrshift(val, shift));
-#if USE(JSVALUE64)
- return JSImmediate::makeValue(static_cast<intptr_t>(static_cast<uint32_t>(static_cast<int32_t>(JSImmediate::rawValue(val)) >> ((JSImmediate::rawValue(shift) >> JSImmediate::IntegerPayloadShift) & 0x1f))) | JSImmediate::TagTypeNumber);
-#else
- return JSImmediate::makeValue((JSImmediate::rawValue(val) >> ((JSImmediate::rawValue(shift) >> JSImmediate::IntegerPayloadShift) & 0x1f)) | JSImmediate::TagTypeNumber);
-#endif
- }
-
- static ALWAYS_INLINE bool canDoFastAdditiveOperations(JSValue v)
- {
- // Number is non-negative and an operation involving two of these can't overflow.
- // Checking for allowed negative numbers takes more time than it's worth on SunSpider.
- return (JSImmediate::rawValue(v) & (JSImmediate::TagTypeNumber + (JSImmediate::signBit | (JSImmediate::signBit >> 1)))) == JSImmediate::TagTypeNumber;
- }
-
- static ALWAYS_INLINE bool canDoFastAdditiveOperations(JSValue v1, JSValue v2)
- {
- // Number is non-negative and an operation involving two of these can't overflow.
- // Checking for allowed negative numbers takes more time than it's worth on SunSpider.
- return canDoFastAdditiveOperations(v1) && canDoFastAdditiveOperations(v2);
- }
-
- static ALWAYS_INLINE JSValue addImmediateNumbers(JSValue v1, JSValue v2)
- {
- ASSERT(canDoFastAdditiveOperations(v1, v2));
- return JSImmediate::makeValue(JSImmediate::rawValue(v1) + JSImmediate::rawValue(v2) - JSImmediate::TagTypeNumber);
- }
-
- static ALWAYS_INLINE JSValue subImmediateNumbers(JSValue v1, JSValue v2)
- {
- ASSERT(canDoFastAdditiveOperations(v1, v2));
- return JSImmediate::makeValue(JSImmediate::rawValue(v1) - JSImmediate::rawValue(v2) + JSImmediate::TagTypeNumber);
- }
-
- static ALWAYS_INLINE JSValue incImmediateNumber(JSValue v)
- {
- ASSERT(canDoFastAdditiveOperations(v));
- return JSImmediate::makeValue(JSImmediate::rawValue(v) + (1 << JSImmediate::IntegerPayloadShift));
- }
-
- static ALWAYS_INLINE JSValue decImmediateNumber(JSValue v)
- {
- ASSERT(canDoFastAdditiveOperations(v));
- return JSImmediate::makeValue(JSImmediate::rawValue(v) - (1 << JSImmediate::IntegerPayloadShift));
- }
- };
-
-} // namespace JSC
-
-#endif // !USE(JSVALUE32_64)
-
-#endif // JSImmediate_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.cpp
deleted file mode 100644
index 8f056c8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * 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);
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.h
deleted file mode 100644
index 8b015c4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSLock.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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;
-
- enum JSLockBehavior { SilenceAssertionsOnly, LockForReal };
-
- class JSLock : public Noncopyable {
- public:
- JSLock(ExecState*);
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp
deleted file mode 100644
index f4764e2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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() && exec->exception() == m_exception);
- return m_exception;
-}
-
-bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue&)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return false;
-}
-
-bool JSNotAnObject::toBoolean(ExecState* exec) const
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return false;
-}
-
-double JSNotAnObject::toNumber(ExecState* exec) const
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return NaN;
-}
-
-UString JSNotAnObject::toString(ExecState* exec) const
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return "";
-}
-
-JSObject* JSNotAnObject::toObject(ExecState* exec) const
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return m_exception;
-}
-
-// Marking
-void JSNotAnObject::markChildren(MarkStack& markStack)
-{
- JSObject::markChildren(markStack);
- markStack.append(m_exception);
-}
-
-// JSObject methods
-bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return false;
-}
-
-bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return false;
-}
-
-bool JSNotAnObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier&, PropertyDescriptor&)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return false;
-}
-
-void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue, PutPropertySlot&)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
-}
-
-void JSNotAnObject::put(ExecState* exec, unsigned, JSValue)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
-}
-
-bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier&)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return false;
-}
-
-bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
- return false;
-}
-
-void JSNotAnObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray&, EnumerationMode)
-{
- ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h
deleted file mode 100644
index 339d41f..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 {
-
- class JSNotAnObjectErrorStub : public JSObject {
- public:
- JSNotAnObjectErrorStub(ExecState* exec, bool isNull)
- : JSObject(exec->globalData().notAnObjectErrorStubStructure)
- , m_isNull(isNull)
- {
- }
-
- bool isNull() const { return m_isNull; }
-
- private:
- virtual bool isNotAnObjectErrorStub() const { return true; }
-
- bool m_isNull;
- };
-
- // 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, JSNotAnObjectErrorStub* exception)
- : JSObject(exec->globalData().notAnObjectStructure)
- , m_exception(exception)
- {
- }
-
- static PassRefPtr<Structure> createStructure(JSValue prototype)
- {
- return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
- }
-
- private:
-
- static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | 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;
-
- // Marking
- virtual void markChildren(MarkStack&);
-
- // 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);
-
- JSNotAnObjectErrorStub* m_exception;
- };
-
-} // namespace JSC
-
-#endif // JSNotAnObject_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.cpp
deleted file mode 100644
index f1009b9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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"
-
-#if USE(JSVALUE32)
-
-#include "NumberObject.h"
-#include "UString.h"
-
-namespace JSC {
-
-JSValue JSNumberCell::toPrimitive(ExecState*, PreferredPrimitiveType) const
-{
- return const_cast<JSNumberCell*>(this);
-}
-
-bool JSNumberCell::getPrimitiveNumber(ExecState*, double& number, JSValue& value)
-{
- number = m_value;
- value = this;
- return true;
-}
-
-bool JSNumberCell::toBoolean(ExecState*) const
-{
- return m_value < 0.0 || m_value > 0.0; // false for NaN
-}
-
-double JSNumberCell::toNumber(ExecState*) const
-{
- return m_value;
-}
-
-UString JSNumberCell::toString(ExecState*) const
-{
- return UString::from(m_value);
-}
-
-UString JSNumberCell::toThisString(ExecState*) const
-{
- return UString::from(m_value);
-}
-
-JSObject* JSNumberCell::toObject(ExecState* exec) const
-{
- return constructNumber(exec, const_cast<JSNumberCell*>(this));
-}
-
-JSObject* JSNumberCell::toThisObject(ExecState* exec) const
-{
- return constructNumber(exec, const_cast<JSNumberCell*>(this));
-}
-
-bool JSNumberCell::getUInt32(uint32_t& uint32) const
-{
- uint32 = static_cast<uint32_t>(m_value);
- return uint32 == m_value;
-}
-
-JSValue JSNumberCell::getJSNumber()
-{
- return this;
-}
-
-JSValue jsNumberCell(ExecState* exec, double d)
-{
- return new (exec) JSNumberCell(exec, d);
-}
-
-JSValue jsNumberCell(JSGlobalData* globalData, double d)
-{
- return new (globalData) JSNumberCell(globalData, d);
-}
-
-} // namespace JSC
-
-#else // USE(JSVALUE32)
-
-// Keep our exported symbols lists happy.
-namespace JSC {
-
-JSValue jsNumberCell(ExecState*, double);
-
-JSValue jsNumberCell(ExecState*, double)
-{
- ASSERT_NOT_REACHED();
- return JSValue();
-}
-
-} // namespace JSC
-
-#endif // USE(JSVALUE32)
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.h
deleted file mode 100644
index bcb506b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNumberCell.h
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * 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(JSVALUE32)
- JSValue jsNumberCell(ExecState*, double);
-
- class Identifier;
- class JSCell;
- class JSObject;
- class JSString;
- class PropertySlot;
-
- struct ClassInfo;
- struct Instruction;
-
- class JSNumberCell : public JSCell {
- friend class JIT;
- friend JSValue jsNumberCell(JSGlobalData*, double);
- friend JSValue jsNumberCell(ExecState*, double);
-
- public:
- double value() const { return m_value; }
-
- 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 UString toString(ExecState*) const;
- virtual JSObject* toObject(ExecState*) const;
-
- virtual UString toThisString(ExecState*) const;
- virtual JSObject* toThisObject(ExecState*) const;
- virtual JSValue getJSNumber();
-
- void* operator new(size_t size, ExecState* exec)
- {
- return exec->heap()->allocateNumber(size);
- }
-
- void* operator new(size_t size, JSGlobalData* globalData)
- {
- return globalData->heap.allocateNumber(size);
- }
-
- static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount); }
-
- private:
- JSNumberCell(JSGlobalData* globalData, double value)
- : JSCell(globalData->numberStructure.get())
- , m_value(value)
- {
- }
-
- JSNumberCell(ExecState* exec, double value)
- : JSCell(exec->globalData().numberStructure.get())
- , m_value(value)
- {
- }
-
- virtual bool getUInt32(uint32_t&) const;
-
- double m_value;
- };
-
- JSValue jsNumberCell(JSGlobalData*, double);
-
- inline bool isNumberCell(JSValue v)
- {
- return v.isCell() && v.asCell()->isNumber();
- }
-
- inline JSNumberCell* asNumberCell(JSValue v)
- {
- ASSERT(isNumberCell(v));
- return static_cast<JSNumberCell*>(v.asCell());
- }
-
- ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState* exec, double d)
- {
- *this = jsNumberCell(exec, d);
- }
-
- inline JSValue::JSValue(ExecState* exec, double d)
- {
- JSValue v = JSImmediate::from(d);
- *this = v ? v : jsNumberCell(exec, d);
- }
-
- inline JSValue::JSValue(ExecState* exec, int i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(exec, i);
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(exec, i);
- }
-
- inline JSValue::JSValue(ExecState* exec, long i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(exec, i);
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned long i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(exec, i);
- }
-
- inline JSValue::JSValue(ExecState* exec, long long i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(exec, static_cast<double>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned long long i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(exec, static_cast<double>(i));
- }
-
- inline JSValue::JSValue(JSGlobalData* globalData, double d)
- {
- JSValue v = JSImmediate::from(d);
- *this = v ? v : jsNumberCell(globalData, d);
- }
-
- inline JSValue::JSValue(JSGlobalData* globalData, int i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(globalData, i);
- }
-
- inline JSValue::JSValue(JSGlobalData* globalData, unsigned i)
- {
- JSValue v = JSImmediate::from(i);
- *this = v ? v : jsNumberCell(globalData, i);
- }
-
- inline bool JSValue::isDouble() const
- {
- return isNumberCell(asValue());
- }
-
- inline double JSValue::asDouble() const
- {
- return asNumberCell(asValue())->value();
- }
-
- inline bool JSValue::isNumber() const
- {
- return JSImmediate::isNumber(asValue()) || isDouble();
- }
-
- inline double JSValue::uncheckedGetNumber() const
- {
- ASSERT(isNumber());
- return JSImmediate::isImmediate(asValue()) ? JSImmediate::toDouble(asValue()) : asDouble();
- }
-
-#endif // USE(JSVALUE32)
-
-#if USE(JSVALUE64)
- ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState*, double d)
- {
- *this = JSImmediate::fromNumberOutsideIntegerRange(d);
- }
-
- inline JSValue::JSValue(ExecState*, double d)
- {
- JSValue v = JSImmediate::from(d);
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(ExecState*, int i)
- {
- JSValue v = JSImmediate::from(i);
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(ExecState*, unsigned i)
- {
- JSValue v = JSImmediate::from(i);
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(ExecState*, long i)
- {
- JSValue v = JSImmediate::from(i);
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(ExecState*, unsigned long i)
- {
- JSValue v = JSImmediate::from(i);
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(ExecState*, long long i)
- {
- JSValue v = JSImmediate::from(static_cast<double>(i));
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(ExecState*, unsigned long long i)
- {
- JSValue v = JSImmediate::from(static_cast<double>(i));
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(JSGlobalData*, double d)
- {
- JSValue v = JSImmediate::from(d);
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(JSGlobalData*, int i)
- {
- JSValue v = JSImmediate::from(i);
- ASSERT(v);
- *this = v;
- }
-
- inline JSValue::JSValue(JSGlobalData*, unsigned i)
- {
- JSValue v = JSImmediate::from(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(JSVALUE32) || USE(JSVALUE64)
-
- inline JSValue::JSValue(ExecState*, char i)
- {
- ASSERT(JSImmediate::from(i));
- *this = JSImmediate::from(i);
- }
-
- inline JSValue::JSValue(ExecState*, unsigned char i)
- {
- ASSERT(JSImmediate::from(i));
- *this = JSImmediate::from(i);
- }
-
- inline JSValue::JSValue(ExecState*, short i)
- {
- ASSERT(JSImmediate::from(i));
- *this = JSImmediate::from(i);
- }
-
- inline JSValue::JSValue(ExecState*, unsigned short i)
- {
- ASSERT(JSImmediate::from(i));
- *this = JSImmediate::from(i);
- }
-
- inline JSValue jsNaN(ExecState* exec)
- {
- return jsNumber(exec, NaN);
- }
-
- inline JSValue jsNaN(JSGlobalData* globalData)
- {
- return jsNumber(globalData, NaN);
- }
-
- // --- JSValue inlines ----------------------------
-
- ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const
- {
- return isNumber() ? asValue() : jsNumber(exec, 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(JSVALUE32) || USE(JSVALUE64)
-
-} // namespace JSC
-
-#endif // JSNumberCell_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.cpp
deleted file mode 100644
index d5f3303..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.cpp
+++ /dev/null
@@ -1,879 +0,0 @@
-/*
- * 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 "LiteralParser.h"
-#include "PropertyNameArray.h"
-#include "StringBuilder.h"
-#include <wtf/MathExtras.h>
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(JSONObject);
-
-static JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*, JSObject*, JSValue, const ArgList&);
-
-}
-
-#include "JSONObject.lut.h"
-
-namespace JSC {
-
-// 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&, StringBuilder&);
-
- 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(StringBuilder&, const UString&);
-
- JSValue toJSON(JSValue, const PropertyNameForFunctionCall&);
-
- enum StringifyResult { StringifyFailed, StringifySucceeded, StringifyFailedDueToUndefinedValue };
- StringifyResult appendStringifiedValue(StringBuilder&, JSValue, JSObject* holder, const PropertyNameForFunctionCall&);
-
- bool willIndent() const;
- void indent();
- void unindent();
- void startNewLine(StringBuilder&) 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(exec, 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.size() > maxGapLength) {
- spaces = spaces.substr(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(exec, 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);
-
- StringBuilder result;
- if (appendStringifiedValue(result, value, object, emptyPropertyName) != StringifySucceeded)
- return jsUndefined();
- if (m_exec->hadException())
- return jsNull();
-
- return jsString(m_exec, result.build());
-}
-
-void Stringifier::appendQuotedString(StringBuilder& builder, const UString& value)
-{
- int length = value.size();
-
- // String length plus 2 for quote marks plus 8 so we can accomodate a few escaped characters.
- builder.reserveCapacity(builder.size() + length + 2 + 8);
-
- builder.append('"');
-
- const UChar* data = value.data();
- 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, sizeof(hex) / sizeof(UChar));
- 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, sizeof(list) / sizeof(JSValue));
- return call(m_exec, object, callType, callData, value, args);
-}
-
-Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& 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, sizeof(list) / sizeof(JSValue));
- 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::from(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, TypeError, "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)) {
- m_exec->setException(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.size() + m_gap.size();
- if (newSize > m_repeatedGap.size())
- m_repeatedGap = makeString(m_repeatedGap, m_gap);
- ASSERT(newSize <= m_repeatedGap.size());
- m_indent = m_repeatedGap.substr(0, newSize);
-}
-
-inline void Stringifier::unindent()
-{
- ASSERT(m_indent.size() >= m_gap.size());
- m_indent = m_repeatedGap.substr(0, m_indent.size() - m_gap.size());
-}
-
-inline void Stringifier::startNewLine(StringBuilder& 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, StringBuilder& 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.size() - 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.size();
-
- // 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 1
- stringify JSONProtoFuncStringify DontEnum|Function 1
-@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) {
- m_exec->setException(createStackOverflowError(m_exec));
- return jsUndefined();
- }
-
- JSArray* array = asArray(inValue);
- arrayStack.append(array);
- indexStack.append(0);
- // fallthrough
- }
- arrayStartVisitMember:
- case ArrayStartVisitMember: {
- if (!--tickCount) {
- if (localTimeoutChecker.didTimeOut(m_exec)) {
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
- return jsUndefined();
- }
- 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::from(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) {
- m_exec->setException(createStackOverflowError(m_exec));
- return jsUndefined();
- }
-
- 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)) {
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
- return jsUndefined();
- }
- 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)) {
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
- return jsUndefined();
- }
- 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
-JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (args.isEmpty())
- return throwError(exec, GeneralError, "JSON.parse requires at least one parameter");
- JSValue value = args.at(0);
- UString source = value.toString(exec);
- if (exec->hadException())
- return jsNull();
-
- LiteralParser jsonParser(exec, source, LiteralParser::StrictJSON);
- JSValue unfiltered = jsonParser.tryLiteralParse();
- if (!unfiltered)
- return throwError(exec, SyntaxError, "Unable to parse JSON string");
-
- if (args.size() < 2)
- return unfiltered;
-
- JSValue function = args.at(1);
- CallData callData;
- CallType callType = function.getCallData(callData);
- if (callType == CallTypeNone)
- return unfiltered;
- return Walker(exec, asObject(function), callType, callData).walk(unfiltered);
-}
-
-// ECMA-262 v5 15.12.3
-JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (args.isEmpty())
- return throwError(exec, GeneralError, "No input to stringify");
- JSValue value = args.at(0);
- JSValue replacer = args.at(1);
- JSValue space = args.at(2);
- return Stringifier(exec, replacer, space).stringify(value);
-}
-
-UString JSONStringify(ExecState* exec, JSValue value, unsigned indent)
-{
- JSValue result = Stringifier(exec, jsNull(), jsNumber(exec, indent)).stringify(value);
- if (result.isUndefinedOrNull())
- return UString();
- return result.getString(exec);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.h
deleted file mode 100644
index 7a9e0a4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSONObject.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 "JSObject.h"
-
-namespace JSC {
-
- class Stringifier;
-
- class JSONObject : public JSObject {
- public:
- JSONObject(NonNullPassRefPtr<Structure> structure)
- : JSObject(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/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
deleted file mode 100644
index 61d3bb1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
+++ /dev/null
@@ -1,689 +0,0 @@
-/*
- * 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 "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);
-
-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, TypeError, "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;
-
- JSValue nextPrototypeValue = value;
- while (nextPrototypeValue && nextPrototypeValue.isObject()) {
- JSObject* nextPrototype = asObject(nextPrototypeValue)->unwrappedObject();
- if (nextPrototype == this) {
- throwError(exec, GeneralError, "cyclic __proto__ value");
- return;
- }
- nextPrototypeValue = nextPrototype->prototype();
- }
-
- setPrototype(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()) {
- putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot);
- return;
- }
- }
-
- unsigned attributes;
- JSCell* specificValue;
- if ((m_structure->get(propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly)
- 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;
- }
-
- putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot);
- return;
-}
-
-void JSObject::put(ExecState* exec, unsigned propertyName, JSValue value)
-{
- PutPropertySlot slot;
- put(exec, Identifier::from(exec, propertyName), value, slot);
-}
-
-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 = function.getCallData(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, TypeError, "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, TypeError, "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);
-}
-
-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::putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* 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, TypeError, "Attempting to configurable attribute of unconfigurable property.");
- return false;
- }
- if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) {
- if (throwException)
- throwError(exec, TypeError, "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, TypeError, "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, TypeError, "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, TypeError, "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, TypeError, "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, TypeError, "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;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h
deleted file mode 100644
index cd8f7f7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- * 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 "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 <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;
-
- // 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;
-
- 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);
-
- 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(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 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(); }
-
- void putDirect(const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
- void putDirect(const Identifier& propertyName, JSValue value, unsigned attr = 0);
-
- 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 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);
-
- // 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 isWatchdogException() const { return false; }
- virtual bool isNotAnObjectErrorStub() const { return false; }
-
- 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);
- }
-
- protected:
- static const unsigned StructureFlags = 0;
-
- 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);
- }
-
- 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();
-#if USE(JSVALUE32)
- void isNumber();
-#endif
-
- 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]);
- }
-
- void putDirectInternal(const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot, JSCell*);
- void 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()));
-#if USE(JSVALUE64) || USE(JSVALUE32_64)
- ASSERT(OBJECT_OFFSETOF(JSObject, m_inlineStorage) % sizeof(double) == 0);
-#endif
-}
-
-inline JSObject::~JSObject()
-{
- ASSERT(m_structure);
- if (!isUsingInlineStorage())
- delete [] m_externalStorage;
- m_structure->deref();
-}
-
-inline JSValue JSObject::prototype() const
-{
- return m_structure->storedPrototype();
-}
-
-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.releaseRef(); // ~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 void 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;
- 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;
- }
-
- 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;
- }
-
- 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;
- }
-
- unsigned currentAttributes;
- JSCell* currentSpecificFunction;
- offset = m_structure->get(propertyName, currentAttributes, currentSpecificFunction);
- if (offset != WTF::notFound) {
- if (checkReadOnly && currentAttributes & ReadOnly)
- return;
-
- // 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;
- }
- // 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;
- }
-
- // 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);
-}
-
-inline void 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));
-
- 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 void 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));
-
- 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 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::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);
-}
-
-} // namespace JSC
-
-#endif // JSObject_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
deleted file mode 100644
index a5d4da0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h
deleted file mode 100644
index 01700ac..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.cpp
deleted file mode 100644
index a877ec6..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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();
-}
-
-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() 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.h
deleted file mode 100644
index 4d156d4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSStaticScopeObject.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.ustring().rep(), SymbolTableEntry(-1, attributes));
- }
- virtual ~JSStaticScopeObject();
- virtual void markChildren(MarkStack&);
- bool isDynamicScope() const;
- virtual JSObject* toThisObject(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/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp
deleted file mode 100644
index 815198b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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 "JSObject.h"
-#include "Operations.h"
-#include "StringObject.h"
-#include "StringPrototype.h"
-
-namespace JSC {
-
-// 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 UStringImpls 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<UStringImpl> newImpl = UStringImpl::tryCreateUninitialized(m_length, buffer))
- m_value = newImpl;
- else {
- for (unsigned i = 0; i < m_fiberCount; ++i) {
- m_other.m_fibers[i]->deref();
- m_other.m_fibers[i] = 0;
- }
- m_fiberCount = 0;
- ASSERT(!isRope());
- ASSERT(m_value == UString());
- throwOutOfMemoryError(exec);
- return;
- }
- UChar* position = buffer + m_length;
-
- // Start with the current Rope.
- Vector<Rope::Fiber, 32> workQueue;
- Rope::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 (currentFiber->isRope()) {
- Rope* rope = static_cast<URopeImpl*>(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 {
- UStringImpl* string = static_cast<UStringImpl*>(currentFiber);
- unsigned length = string->length();
- position -= length;
- UStringImpl::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) {
- m_other.m_fibers[i]->deref();
- 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();
- }
- }
-}
-
-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.size());
- 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 = value(exec).toDouble();
- return false;
-}
-
-bool JSString::toBoolean(ExecState*) const
-{
- return m_length;
-}
-
-double JSString::toNumber(ExecState* exec) const
-{
- return value(exec).toDouble();
-}
-
-UString JSString::toString(ExecState* exec) const
-{
- return value(exec);
-}
-
-UString JSString::toThisString(ExecState* exec) const
-{
- return value(exec);
-}
-
-JSString* JSString::toThisJSString(ExecState*)
-{
- return this;
-}
-
-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(exec, m_length), DontEnum | DontDelete | ReadOnly);
- return true;
- }
-
- bool isStrictUInt32;
- unsigned i = propertyName.toStrictUInt32(&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/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.h
deleted file mode 100644
index 58df013..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSString.h
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * 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"
-
-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;
-
- typedef URopeImpl Rope;
-
- class RopeBuilder {
- public:
- RopeBuilder(unsigned fiberCount)
- : m_index(0)
- , m_rope(Rope::tryCreateUninitialized(fiberCount))
- {
- }
-
- bool isOutOfMemory() { return !m_rope; }
-
- void append(Rope::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.rep());
- }
- 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<Rope> release()
- {
- ASSERT(m_index == m_rope->fiberCount());
- return m_rope.release();
- }
-
- unsigned length() { return m_rope->length(); }
-
- private:
- unsigned m_index;
- RefPtr<Rope> m_rope;
- };
-
- ALWAYS_INLINE JSString(JSGlobalData* globalData, const UString& value)
- : JSCell(globalData->stringStructure.get())
- , m_length(value.size())
- , m_value(value)
- , m_fiberCount(0)
- {
- Heap::heap(this)->reportExtraMemoryCost(value.cost());
- }
-
- enum HasOtherOwnerType { HasOtherOwner };
- JSString(JSGlobalData* globalData, const UString& value, HasOtherOwnerType)
- : JSCell(globalData->stringStructure.get())
- , m_length(value.size())
- , m_value(value)
- , m_fiberCount(0)
- {
- }
- JSString(JSGlobalData* globalData, PassRefPtr<UString::Rep> value, HasOtherOwnerType)
- : JSCell(globalData->stringStructure.get())
- , m_length(value->length())
- , m_value(value)
- , m_fiberCount(0)
- {
- }
- JSString(JSGlobalData* globalData, PassRefPtr<Rope> rope)
- : JSCell(globalData->stringStructure.get())
- , m_length(rope->length())
- , m_fiberCount(1)
- {
- m_other.m_fibers[0] = rope.releaseRef();
- }
- // 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.size())
- , 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.size() + 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);
- }
-
- JSString(JSGlobalData* globalData, const UString& value, JSStringFinalizerCallback finalizer, void* context)
- : JSCell(globalData->stringStructure.get())
- , m_length(value.size())
- , m_value(value)
- , m_fiberCount(0)
- {
- // 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.cost());
- }
-
- ~JSString()
- {
- ASSERT(vptr() == JSGlobalData::jsStringVPtr);
- for (unsigned i = 0; i < m_fiberCount; ++i)
- m_other.m_fibers[i]->deref();
-
- 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 this is a rope, m_value should be null -
- // if this is not a rope, m_value should be non-null.
- ASSERT(isRope() == m_value.isNull());
- 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);
-
- 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;
-
- void appendStringInConstruct(unsigned& index, const UString& string)
- {
- UStringImpl* impl = string.rep();
- 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) {
- Rope::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(asCell(v)->isString());
- JSString* s = static_cast<JSString*>(asCell(v));
- ASSERT(s->fiberCount() == 1);
- appendStringInConstruct(index, s);
- m_length += s->length();
- } else {
- UString u(v.toString(exec));
- UStringImpl* impl = u.rep();
- impl->ref();
- m_other.m_fibers[index++] = impl;
- m_length += u.size();
- }
- }
-
- 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;
- virtual UString toThisString(ExecState*) const;
- virtual JSString* toThisJSString(ExecState*);
-
- // 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 Rope.
- 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 Rope::Fiber m_fibers[s_maxInternalRopeLength];
- 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, const ArgList& args);
- friend JSString* jsStringWithFinalizer(ExecState*, const UString&, JSStringFinalizerCallback callback, void* context);
- };
-
- 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(asCell(value)->isString());
- return static_cast<JSString*>(asCell(value));
- }
-
- 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.size()));
- UChar c = s.data()[offset];
- if (c <= 0xFF)
- return globalData->smallStrings.singleCharacterString(globalData, c);
- return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(UString::Rep::create(s.rep(), 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.size() > 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.size());
- return jsSingleCharacterSubstring(exec, value(exec), i);
- }
-
- inline JSString* jsString(JSGlobalData* globalData, const UString& s)
- {
- int size = s.size();
- if (!size)
- return globalData->smallStrings.emptyString(globalData);
- if (size == 1) {
- UChar c = s.data()[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.size() && (s.size() > 1 || s.data()[0] > 0xFF));
- JSGlobalData* globalData = &exec->globalData();
- return fixupVPtr(globalData, new (globalData) JSString(globalData, s, callback, context));
- }
-
- inline JSString* jsSubstring(JSGlobalData* globalData, const UString& s, unsigned offset, unsigned length)
- {
- ASSERT(offset <= static_cast<unsigned>(s.size()));
- ASSERT(length <= static_cast<unsigned>(s.size()));
- ASSERT(offset + length <= static_cast<unsigned>(s.size()));
- if (!length)
- return globalData->smallStrings.emptyString(globalData);
- if (length == 1) {
- UChar c = s.data()[offset];
- if (c <= 0xFF)
- return globalData->smallStrings.singleCharacterString(globalData, c);
- }
- return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(UString::Rep::create(s.rep(), offset, length)), JSString::HasOtherOwner));
- }
-
- inline JSString* jsOwnedString(JSGlobalData* globalData, const UString& s)
- {
- int size = s.size();
- if (!size)
- return globalData->smallStrings.emptyString(globalData);
- if (size == 1) {
- UChar c = s.data()[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(exec, m_length));
- return true;
- }
-
- bool isStrictUInt32;
- unsigned i = propertyName.toStrictUInt32(&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 JSString* JSValue::toThisJSString(ExecState* exec)
- {
- return isCell() ? asCell()->toThisJSString(exec) : jsString(exec, toString(exec));
- }
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSStringBuilder.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSStringBuilder.h
deleted file mode 100644
index 8f208a1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSStringBuilder.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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 "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.data(), str.size());
- }
-
- 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<UStringImpl> result = 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<UStringImpl> result = 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<UStringImpl> result = 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<UStringImpl> result = 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<UStringImpl> result = tryMakeString(string1, string2, string3, string4, string5, string6);
- if (!result)
- return throwOutOfMemoryError(exec);
- return jsNontrivialString(exec, result);
-}
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSType.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSType.h
deleted file mode 100644
index 882b218..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSType.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSTypeInfo.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSTypeInfo.h
deleted file mode 100644
index e225bc7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSTypeInfo.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// -*- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp
deleted file mode 100644
index 502312c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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 "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());
- JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull());
- exec->setException(exception);
- return new (exec) JSNotAnObject(exec, exception);
-}
-
-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());
-
- JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull());
- exec->setException(exception);
- return new (exec) JSNotAnObject(exec, exception);
-}
-
-JSObject* JSValue::synthesizePrototype(ExecState* exec) const
-{
- ASSERT(!isCell());
- if (isNumber())
- return exec->lexicalGlobalObject()->numberPrototype();
- if (isBoolean())
- return exec->lexicalGlobalObject()->booleanPrototype();
-
- JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull());
- exec->setException(exception);
- return new (exec) JSNotAnObject(exec, exception);
-}
-
-#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 {
- ASSERT(isUndefined());
- snprintf(description, size, "Undefined");
- }
-
- return description;
-}
-#endif
-
-int32_t toInt32SlowCase(double d, bool& ok)
-{
- ok = true;
-
- if (d >= -D32 / 2 && d < D32 / 2)
- return static_cast<int32_t>(d);
-
- if (isnan(d) || isinf(d)) {
- ok = false;
- return 0;
- }
-
- double d32 = fmod(trunc(d), D32);
- if (d32 >= D32 / 2)
- d32 -= D32;
- else if (d32 < -D32 / 2)
- d32 += D32;
- return static_cast<int32_t>(d32);
-}
-
-uint32_t toUInt32SlowCase(double d, bool& ok)
-{
- ok = true;
-
- if (d >= 0.0 && d < D32)
- return static_cast<uint32_t>(d);
-
- if (isnan(d) || isinf(d)) {
- ok = false;
- return 0;
- }
-
- double d32 = fmod(trunc(d), D32);
- if (d32 < 0)
- d32 += D32;
- return static_cast<uint32_t>(d32);
-}
-
-NEVER_INLINE double nonInlineNaN()
-{
-#if OS(SYMBIAN)
- return nanval();
-#else
- return std::numeric_limits<double>::quiet_NaN();
-#endif
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.h
deleted file mode 100644
index 6da921f..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.h
+++ /dev/null
@@ -1,851 +0,0 @@
-/*
- * 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 "CallData.h"
-#include "ConstructData.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 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();
- int32_t toInt32SlowCase(double, bool& ok);
- uint32_t toUInt32SlowCase(double, bool& ok);
-
- class JSValue {
- friend class JSImmediate;
- friend struct EncodedJSValueHashTraits;
- friend class JIT;
- friend class JITStubs;
- friend class JITStubCall;
-
- public:
- static EncodedJSValue encode(JSValue value);
- static JSValue decode(EncodedJSValue ptr);
-#if !USE(JSVALUE32_64)
- 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, ExecState*, double);
- JSValue(ExecState*, double);
- JSValue(ExecState*, char);
- JSValue(ExecState*, unsigned char);
- JSValue(ExecState*, short);
- JSValue(ExecState*, unsigned short);
- JSValue(ExecState*, int);
- JSValue(ExecState*, unsigned);
- JSValue(ExecState*, long);
- JSValue(ExecState*, unsigned long);
- JSValue(ExecState*, long long);
- JSValue(ExecState*, unsigned long long);
- JSValue(JSGlobalData*, double);
- JSValue(JSGlobalData*, int);
- JSValue(JSGlobalData*, unsigned);
-
- 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
-
- CallType getCallData(CallData&);
- ConstructType getConstructData(ConstructData&);
-
- // 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;
- int32_t toInt32(ExecState*, bool& ok) const;
- uint32_t toUInt32(ExecState*) const;
- uint32_t toUInt32(ExecState*, bool& ok) 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 put(ExecState*, unsigned propertyName, JSValue);
-
- bool needsThisConversion() const;
- JSObject* toThisObject(ExecState*) const;
- UString toThisString(ExecState*) const;
- JSString* toThisJSString(ExecState*);
-
- 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;
-
-#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;
-
- enum { Int32Tag = 0xffffffff };
- enum { CellTag = 0xfffffffe };
- enum { TrueTag = 0xfffffffd };
- enum { FalseTag = 0xfffffffc };
- enum { NullTag = 0xfffffffb };
- enum { UndefinedTag = 0xfffffffa };
- enum { EmptyValueTag = 0xfffffff9 };
- enum { DeletedValueTag = 0xfffffff8 };
-
- enum { LowestTag = DeletedValueTag };
-
- uint32_t tag() const;
- int32_t payload() const;
-
- JSObject* synthesizePrototype(ExecState*) const;
- JSObject* synthesizeObject(ExecState*) const;
-
-#if USE(JSVALUE32_64)
- 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(ExecState* exec, double d)
- {
- return JSValue(JSValue::EncodeAsDouble, exec, d);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, double d)
- {
- return JSValue(exec, d);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, char i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned char i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, short i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned short i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, int i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, long i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned long i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, long long i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned long long i)
- {
- return JSValue(exec, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(JSGlobalData* globalData, double d)
- {
- return JSValue(globalData, d);
- }
-
- ALWAYS_INLINE JSValue jsNumber(JSGlobalData* globalData, int i)
- {
- return JSValue(globalData, i);
- }
-
- ALWAYS_INLINE JSValue jsNumber(JSGlobalData* globalData, unsigned i)
- {
- return JSValue(globalData, 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; }
-
- inline int32_t toInt32(double val)
- {
- if (!(val >= -2147483648.0 && val < 2147483648.0)) {
- bool ignored;
- return toInt32SlowCase(val, ignored);
- }
- return static_cast<int32_t>(val);
- }
-
- inline uint32_t toUInt32(double val)
- {
- if (!(val >= 0.0 && val < 4294967296.0)) {
- bool ignored;
- return toUInt32SlowCase(val, ignored);
- }
- return static_cast<uint32_t>(val);
- }
-
- // FIXME: We should deprecate this and just use JSValue::asCell() instead.
- JSCell* asCell(JSValue);
-
- inline JSCell* asCell(JSValue value)
- {
- return value.asCell();
- }
-
- ALWAYS_INLINE int32_t JSValue::toInt32(ExecState* exec) const
- {
- if (isInt32())
- return asInt32();
- bool ignored;
- return toInt32SlowCase(toNumber(exec), ignored);
- }
-
- inline uint32_t JSValue::toUInt32(ExecState* exec) const
- {
- if (isUInt32())
- return asInt32();
- bool ignored;
- return toUInt32SlowCase(toNumber(exec), ignored);
- }
-
- inline int32_t JSValue::toInt32(ExecState* exec, bool& ok) const
- {
- if (isInt32()) {
- ok = true;
- return asInt32();
- }
- return toInt32SlowCase(toNumber(exec), ok);
- }
-
- inline uint32_t JSValue::toUInt32(ExecState* exec, bool& ok) const
- {
- if (isUInt32()) {
- ok = true;
- return asInt32();
- }
- return toUInt32SlowCase(toNumber(exec), ok);
- }
-
-#if USE(JSVALUE32_64)
- inline JSValue jsNaN(ExecState* exec)
- {
- return JSValue(exec, 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, ExecState*, double d)
- {
- u.asDouble = d;
- }
-
- inline JSValue::JSValue(ExecState* exec, 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(exec, static_cast<int32_t>(d));
- }
-
- inline JSValue::JSValue(ExecState* exec, char i)
- {
- *this = JSValue(exec, static_cast<int32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned char i)
- {
- *this = JSValue(exec, static_cast<int32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, short i)
- {
- *this = JSValue(exec, static_cast<int32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned short i)
- {
- *this = JSValue(exec, static_cast<int32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState*, int i)
- {
- u.asBits.tag = Int32Tag;
- u.asBits.payload = i;
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned i)
- {
- if (static_cast<int32_t>(i) < 0) {
- *this = JSValue(exec, static_cast<double>(i));
- return;
- }
- *this = JSValue(exec, static_cast<int32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, long i)
- {
- if (static_cast<int32_t>(i) != i) {
- *this = JSValue(exec, static_cast<double>(i));
- return;
- }
- *this = JSValue(exec, static_cast<int32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned long i)
- {
- if (static_cast<uint32_t>(i) != i) {
- *this = JSValue(exec, static_cast<double>(i));
- return;
- }
- *this = JSValue(exec, static_cast<uint32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, long long i)
- {
- if (static_cast<int32_t>(i) != i) {
- *this = JSValue(exec, static_cast<double>(i));
- return;
- }
- *this = JSValue(exec, static_cast<int32_t>(i));
- }
-
- inline JSValue::JSValue(ExecState* exec, unsigned long long i)
- {
- if (static_cast<uint32_t>(i) != i) {
- *this = JSValue(exec, static_cast<double>(i));
- return;
- }
- *this = JSValue(exec, static_cast<uint32_t>(i));
- }
-
- inline JSValue::JSValue(JSGlobalData* globalData, 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(globalData, static_cast<int32_t>(d));
- }
-
- inline JSValue::JSValue(JSGlobalData*, int i)
- {
- u.asBits.tag = Int32Tag;
- u.asBits.payload = i;
- }
-
- inline JSValue::JSValue(JSGlobalData* globalData, unsigned i)
- {
- if (static_cast<int32_t>(i) < 0) {
- *this = JSValue(globalData, static_cast<double>(i));
- return;
- }
- *this = JSValue(globalData, static_cast<int32_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(exec, 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)
-
-} // namespace JSC
-
-#endif // JSValue_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp
deleted file mode 100644
index 7365001..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.ustring().rep()))
- 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.ustring().rep());
- if (!entry.isNull()) {
- descriptor.setDescriptor(registerAt(entry.getIndex()).jsValue(), entry.getAttributes() | DontDelete);
- return true;
- }
- return false;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h
deleted file mode 100644
index 6c679ce..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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() 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.ustring().rep());
- 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.ustring().rep());
- 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.ustring().rep());
- 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.ustring().rep());
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.cpp
deleted file mode 100644
index 2c39f5c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.h
deleted file mode 100644
index f19cd30..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSWrapperObject.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.cpp
deleted file mode 100644
index 072d29b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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)).releaseRef();
- Structure::stopIgnoringLeaks();
- }
- return structure;
-}
-
-}
-
-#endif // ENABLE(JSC_ZOMBIES)
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.h
deleted file mode 100644
index 8b33ea6..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 UString toThisString(ExecState*) const { ASSERT_NOT_REACHED(); return ""; }
- virtual JSString* toThisJSString(ExecState*) { ASSERT_NOT_REACHED(); return 0; }
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp
deleted file mode 100644
index cc33bae..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * 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 "StringBuilder.h"
-#include <wtf/ASCIICType.h>
-#include <wtf/dtoa.h>
-
-namespace JSC {
-
-LiteralParser::TokenType LiteralParser::Lexer::lex(LiteralParserToken& token)
-{
- while (m_ptr < m_end && isASCIISpace(*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;
- StringBuilder 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.build();
- 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(m_exec, 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/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.h b/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.h
deleted file mode 100644
index 0f8072b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/LiteralParser.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.data())
- , m_end(s.data() + s.size())
- {
- }
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.cpp
deleted file mode 100644
index 4e9e086..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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 "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) {
- UString::Rep* identifier = Identifier::add(globalData, values[i].key).releaseRef();
- 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);
- }
- table = entries;
-}
-
-void HashTable::deleteTable() const
-{
- if (table) {
- int max = compactSize;
- for (int i = 0; i != max; ++i) {
- if (UString::Rep* 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(entry->attributes() & Function);
- JSValue* location = thisObj->getDirectLocation(propertyName);
-
- if (!location) {
- InternalFunction* function = new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->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/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h
deleted file mode 100644
index 995aeee..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Lookup.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * 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;
- };
-
- // 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(UString::Rep* key, unsigned char attributes, intptr_t v1, intptr_t v2)
- {
- m_key = key;
- m_attributes = attributes;
- m_u.store.value1 = v1;
- m_u.store.value2 = v2;
- m_next = 0;
- }
-
- void setKey(UString::Rep* key) { m_key = key; }
- UString::Rep* key() const { return m_key; }
-
- unsigned char attributes() const { return m_attributes; }
-
- 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:
- UString::Rep* 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
- } 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.ustring().rep()->existingHash() & compactHashSizeMask];
-
- if (!entry->key())
- return 0;
-
- do {
- if (entry->key() == identifier.ustring().rep())
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.cpp
deleted file mode 100644
index a350c35..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h
deleted file mode 100644
index c551bac..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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>
-
-namespace JSC {
-
- class JSGlobalData;
- class Register;
-
- enum MarkSetProperties { MayContainNullValues, NoNullValues };
-
- class MarkStack : Noncopyable {
- public:
- MarkStack(void* jsArrayVPtr)
- : m_jsArrayVPtr(jsArrayVPtr)
-#ifndef NDEBUG
- , m_isCheckingForDefaultMarkViolation(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);
- static void releaseStack(void* addr, size_t 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;
-
-#ifndef NDEBUG
- public:
- bool m_isCheckingForDefaultMarkViolation;
-#endif
- };
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackNone.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackNone.cpp
deleted file mode 100644
index b1ff48b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackNone.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 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"
-
-#include "FastMalloc.h"
-
-namespace JSC {
-
-void MarkStack::initializePagesize()
-{
- MarkStack::s_pageSize = 4096;
-}
-
-void* MarkStack::allocateStack(size_t size)
-{
- return fastMalloc(size);
-}
-
-void MarkStack::releaseStack(void* addr, size_t)
-{
- return fastFree(addr);
-}
-
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp
deleted file mode 100644
index c28bc0d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackPosix.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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();
-}
-
-void* MarkStack::allocateStack(size_t size)
-{
- return mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-}
-void MarkStack::releaseStack(void* addr, size_t size)
-{
- munmap(addr, size);
-}
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackSymbian.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackSymbian.cpp
deleted file mode 100644
index bda14ac..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackSymbian.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- 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;
-}
-
-void* MarkStack::allocateStack(size_t size)
-{
- return fastMalloc(size);
-}
-
-void MarkStack::releaseStack(void* addr, size_t size)
-{
- return fastFree(addr);
-}
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackWin.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackWin.cpp
deleted file mode 100644
index a171c78..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackWin.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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;
-}
-
-void* MarkStack::allocateStack(size_t size)
-{
- return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
-}
-void MarkStack::releaseStack(void* addr, size_t)
-{
- // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
- // dwSize must be 0 if dwFreeType is MEM_RELEASE.
- VirtualFree(addr, 0, MEM_RELEASE);
-}
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.cpp
deleted file mode 100644
index 8ef97e5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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 "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 JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*, JSObject*, JSValue, const ArgList&);
-
-}
-
-#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, NonNullPassRefPtr<Structure> structure)
- : JSObject(structure)
-{
- putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);
- putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly);
- putDirectWithoutTransition(Identifier(exec, "LN10"), jsNumber(exec, log(10.0)), DontDelete | DontEnum | ReadOnly);
- putDirectWithoutTransition(Identifier(exec, "LOG2E"), jsNumber(exec, 1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
- putDirectWithoutTransition(Identifier(exec, "LOG10E"), jsNumber(exec, 1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly);
- putDirectWithoutTransition(Identifier(exec, "PI"), jsNumber(exec, piDouble), DontDelete | DontEnum | ReadOnly);
- putDirectWithoutTransition(Identifier(exec, "SQRT1_2"), jsNumber(exec, sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
- putDirectWithoutTransition(Identifier(exec, "SQRT2"), jsNumber(exec, 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 --------------------------------
-
-JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsNumber(exec, fabs(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, acos(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, asin(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, atan(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, atan2(args.at(0).toNumber(exec), args.at(1).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsNumber(exec, ceil(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, cos(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, exp(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsNumber(exec, floor(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, log(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- unsigned argsCount = args.size();
- double result = -Inf;
- for (unsigned k = 0; k < argsCount; ++k) {
- double val = args.at(k).toNumber(exec);
- if (isnan(val)) {
- result = NaN;
- break;
- }
- if (val > result || (val == 0 && result == 0 && !signbit(val)))
- result = val;
- }
- return jsNumber(exec, result);
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- unsigned argsCount = args.size();
- double result = +Inf;
- for (unsigned k = 0; k < argsCount; ++k) {
- double val = args.at(k).toNumber(exec);
- if (isnan(val)) {
- result = NaN;
- break;
- }
- if (val < result || (val == 0 && result == 0 && signbit(val)))
- result = val;
- }
- return jsNumber(exec, result);
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- // ECMA 15.8.2.1.13
-
- double arg = args.at(0).toNumber(exec);
- double arg2 = args.at(1).toNumber(exec);
-
- if (isnan(arg2))
- return jsNaN(exec);
- if (isinf(arg2) && fabs(arg) == 1)
- return jsNaN(exec);
- return jsNumber(exec, pow(arg, arg2));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec, JSObject*, JSValue, const ArgList&)
-{
- return jsDoubleNumber(exec, exec->globalData().weakRandom.get());
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- double arg = args.at(0).toNumber(exec);
- double integer = ceil(arg);
- return jsNumber(exec, integer - (integer - arg > 0.5));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, sin(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, sqrt(args.at(0).toNumber(exec)));
-}
-
-JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsDoubleNumber(exec, tan(args.at(0).toNumber(exec)));
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.h
deleted file mode 100644
index a9f7031..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MathObject.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 "JSObject.h"
-
-namespace JSC {
-
- class MathObject : public JSObject {
- public:
- MathObject(ExecState*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.cpp
deleted file mode 100644
index 403fc7e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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, NonNullPassRefPtr<Structure> structure, NativeErrorPrototype* nativeErrorPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, nativeErrorPrototype->getDirect(exec->propertyNames().name).getString(exec)))
- , m_errorStructure(ErrorInstance::createStructure(nativeErrorPrototype))
-{
- putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
- putDirect(exec->propertyNames().prototype, nativeErrorPrototype, DontDelete | ReadOnly | DontEnum);
-}
-
-ErrorInstance* NativeErrorConstructor::construct(ExecState* exec, const ArgList& args)
-{
- ErrorInstance* object = new (exec) ErrorInstance(m_errorStructure);
- if (!args.at(0).isUndefined())
- object->putDirect(exec->propertyNames().message, jsString(exec, args.at(0).toString(exec)));
- return object;
-}
-
-static JSObject* constructWithNativeErrorConstructor(ExecState* exec, JSObject* constructor, const ArgList& args)
-{
- return static_cast<NativeErrorConstructor*>(constructor)->construct(exec, args);
-}
-
-ConstructType NativeErrorConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithNativeErrorConstructor;
- return ConstructTypeHost;
-}
-
-static JSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec, JSObject* constructor, JSValue, const ArgList& args)
-{
- return static_cast<NativeErrorConstructor*>(constructor)->construct(exec, args);
-}
-
-CallType NativeErrorConstructor::getCallData(CallData& callData)
-{
- callData.native.function = callNativeErrorConstructor;
- return CallTypeHost;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.h
deleted file mode 100644
index 152dbac..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorConstructor.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, NativeErrorPrototype*);
-
- static const ClassInfo info;
-
- ErrorInstance* construct(ExecState*, const ArgList&);
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp
deleted file mode 100644
index aa46a6a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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 "JSString.h"
-#include "UString.h"
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
-
-NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& name, const UString& message)
- : JSObject(structure)
-{
- putDirect(exec->propertyNames().name, jsString(exec, name), 0);
- putDirect(exec->propertyNames().message, jsString(exec, message), 0);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h
deleted file mode 100644
index 0c65a9c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 "JSObject.h"
-
-namespace JSC {
-
- class NativeErrorPrototype : public JSObject {
- public:
- NativeErrorPrototype(ExecState*, NonNullPassRefPtr<Structure>, const UString& name, const UString& message);
- };
-
-} // namespace JSC
-
-#endif // NativeErrorPrototype_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeFunctionWrapper.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeFunctionWrapper.h
deleted file mode 100644
index d4eeb3b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeFunctionWrapper.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.cpp
deleted file mode 100644
index cf549ae..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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 "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, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype)
- : InternalFunction(&exec->globalData(), 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(exec, 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* exec, JSValue, const Identifier&)
-{
- return jsNaN(exec);
-}
-
-static JSValue numberConstructorNegInfinity(ExecState* exec, JSValue, const Identifier&)
-{
- return jsNumber(exec, -Inf);
-}
-
-static JSValue numberConstructorPosInfinity(ExecState* exec, JSValue, const Identifier&)
-{
- return jsNumber(exec, Inf);
-}
-
-static JSValue numberConstructorMaxValue(ExecState* exec, JSValue, const Identifier&)
-{
- return jsNumber(exec, 1.7976931348623157E+308);
-}
-
-static JSValue numberConstructorMinValue(ExecState* exec, JSValue, const Identifier&)
-{
- return jsNumber(exec, 5E-324);
-}
-
-// ECMA 15.7.1
-static JSObject* constructWithNumberConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
- double n = args.isEmpty() ? 0 : args.at(0).toNumber(exec);
- object->setInternalValue(jsNumber(exec, n));
- return object;
-}
-
-ConstructType NumberConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithNumberConstructor;
- return ConstructTypeHost;
-}
-
-// ECMA 15.7.2
-static JSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return jsNumber(exec, args.isEmpty() ? 0 : args.at(0).toNumber(exec));
-}
-
-CallType NumberConstructor::getCallData(CallData& callData)
-{
- callData.native.function = callNumberConstructor;
- return CallTypeHost;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.h
deleted file mode 100644
index 723c4b2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberConstructor.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.cpp
deleted file mode 100644
index 1a7e44c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.h
deleted file mode 100644
index 6c18cdd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberObject.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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:
-#if USE(JSVALUE32)
- static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
-#else
- static const unsigned StructureFlags = JSWrapperObject::StructureFlags;
-#endif
-
- private:
- virtual const ClassInfo* classInfo() const { return &info; }
-
- virtual JSValue getJSNumber();
- };
-
- NumberObject* constructNumber(ExecState*, JSValue);
-
-} // namespace JSC
-
-#endif // NumberObject_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.cpp
deleted file mode 100644
index 5680eb1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.cpp
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * 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 "JSStringBuilder.h"
-#include "Operations.h"
-#include "PrototypeFunction.h"
-#include "StringBuilder.h"
-#include "dtoa.h"
-#include <wtf/Assertions.h>
-#include <wtf/MathExtras.h>
-#include <wtf/Vector.h>
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(NumberPrototype);
-
-static JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*, JSObject*, JSValue, const ArgList&);
-
-// ECMA 15.7.4
-
-NumberPrototype::NumberPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
- : NumberObject(structure)
-{
- setInternalValue(jsNumber(exec, 0));
-
- // The constructor will be added later, after NumberConstructor has been constructed
-
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
-}
-
-// ------------------------------ Functions ---------------------------
-
-// ECMA 15.7.4.2 - 15.7.4.7
-
-static UString integerPartNoExp(double d)
-{
- int decimalPoint;
- int sign;
- char result[80];
- WTF::dtoa(result, d, 0, &decimalPoint, &sign, NULL);
- bool resultIsInfOrNan = (decimalPoint == 9999);
- size_t length = strlen(result);
-
- StringBuilder builder;
- builder.append(sign ? "-" : "");
- if (resultIsInfOrNan)
- builder.append((const char*)result);
- else if (decimalPoint <= 0)
- builder.append("0");
- else {
- Vector<char, 1024> buf(decimalPoint + 1);
-
- if (static_cast<int>(length) <= decimalPoint) {
- ASSERT(decimalPoint < 1024);
- memcpy(buf.data(), result, length);
- memset(buf.data() + length, '0', decimalPoint - length);
- } else
- strncpy(buf.data(), result, decimalPoint);
- buf[decimalPoint] = '\0';
-
- builder.append((const char*)(buf.data()));
- }
-
- return builder.build();
-}
-
-static UString charSequence(char c, int count)
-{
- Vector<char, 2048> buf(count + 1, c);
- buf[count] = '\0';
-
- return UString(buf.data());
-}
-
-static double intPow10(int e)
-{
- // This function uses the "exponentiation by squaring" algorithm and
- // long double to quickly and precisely calculate integer powers of 10.0.
-
- // This is a handy workaround for <rdar://problem/4494756>
-
- if (e == 0)
- return 1.0;
-
- bool negative = e < 0;
- unsigned exp = negative ? -e : e;
-
- long double result = 10.0;
- bool foundOne = false;
- for (int bit = 31; bit >= 0; bit--) {
- if (!foundOne) {
- if ((exp >> bit) & 1)
- foundOne = true;
- } else {
- result = result * result;
- if ((exp >> bit) & 1)
- result = result * 10.0;
- }
- }
-
- if (negative)
- return static_cast<double>(1.0 / result);
- return static_cast<double>(result);
-}
-
-JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSValue v = thisValue.getJSNumber();
- if (!v)
- return throwError(exec, TypeError);
-
- double radixAsDouble = args.at(0).toInteger(exec); // nan -> 0
- if (radixAsDouble == 10 || args.at(0).isUndefined())
- return jsString(exec, v.toString(exec));
-
- if (radixAsDouble < 2 || radixAsDouble > 36)
- return throwError(exec, RangeError, "toString() radix argument must be between 2 and 36");
-
- int radix = static_cast<int>(radixAsDouble);
- const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
- // 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 jsString(exec, UString::from(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 jsString(exec, startOfResultString);
-}
-
-JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- // FIXME: Not implemented yet.
-
- JSValue v = thisValue.getJSNumber();
- if (!v)
- return throwError(exec, TypeError);
-
- return jsString(exec, v.toString(exec));
-}
-
-JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- JSValue v = thisValue.getJSNumber();
- if (!v)
- return throwError(exec, TypeError);
-
- return v;
-}
-
-JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSValue v = thisValue.getJSNumber();
- if (!v)
- return throwError(exec, TypeError);
-
- JSValue fractionDigits = args.at(0);
- double df = fractionDigits.toInteger(exec);
- if (!(df >= 0 && df <= 20))
- return throwError(exec, RangeError, "toFixed() digits argument must be between 0 and 20");
- int f = static_cast<int>(df);
-
- double x = v.uncheckedGetNumber();
- if (isnan(x))
- return jsNontrivialString(exec, "NaN");
-
- UString s;
- if (x < 0) {
- s = "-";
- x = -x;
- } else {
- s = "";
- if (x == -0.0)
- x = 0;
- }
-
- if (x >= pow(10.0, 21.0))
- return jsString(exec, makeString(s, UString::from(x)));
-
- const double tenToTheF = pow(10.0, f);
- double n = floor(x * tenToTheF);
- if (fabs(n / tenToTheF - x) >= fabs((n + 1) / tenToTheF - x))
- n++;
-
- UString m = integerPartNoExp(n);
-
- int k = m.size();
- if (k <= f) {
- StringBuilder z;
- for (int i = 0; i < f + 1 - k; i++)
- z.append('0');
- z.append(m);
- m = z.build();
- k = f + 1;
- ASSERT(k == static_cast<int>(m.size()));
- }
- int kMinusf = k - f;
-
- if (kMinusf < static_cast<int>(m.size()))
- return jsString(exec, makeString(s, m.substr(0, kMinusf), ".", m.substr(kMinusf)));
- return jsString(exec, makeString(s, m.substr(0, kMinusf)));
-}
-
-static void fractionalPartToString(char* buf, int& i, const char* result, int resultLength, int fractionalDigits)
-{
- if (fractionalDigits <= 0)
- return;
-
- int fDigitsInResult = static_cast<int>(resultLength) - 1;
- buf[i++] = '.';
- if (fDigitsInResult > 0) {
- if (fractionalDigits < fDigitsInResult) {
- strncpy(buf + i, result + 1, fractionalDigits);
- i += fractionalDigits;
- } else {
- ASSERT(i + resultLength - 1 < 80);
- memcpy(buf + i, result + 1, resultLength - 1);
- i += static_cast<int>(resultLength) - 1;
- }
- }
-
- for (int j = 0; j < fractionalDigits - fDigitsInResult; j++)
- buf[i++] = '0';
-}
-
-static void exponentialPartToString(char* buf, int& i, int decimalPoint)
-{
- buf[i++] = 'e';
- // decimalPoint can't be more than 3 digits decimal given the
- // nature of float representation
- int exponential = decimalPoint - 1;
- buf[i++] = (exponential >= 0) ? '+' : '-';
- if (exponential < 0)
- exponential *= -1;
- if (exponential >= 100)
- buf[i++] = static_cast<char>('0' + exponential / 100);
- if (exponential >= 10)
- buf[i++] = static_cast<char>('0' + (exponential % 100) / 10);
- buf[i++] = static_cast<char>('0' + exponential % 10);
-}
-
-JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSValue v = thisValue.getJSNumber();
- if (!v)
- return throwError(exec, TypeError);
-
- double x = v.uncheckedGetNumber();
-
- if (isnan(x) || isinf(x))
- return jsString(exec, UString::from(x));
-
- JSValue fractionalDigitsValue = args.at(0);
- double df = fractionalDigitsValue.toInteger(exec);
- if (!(df >= 0 && df <= 20))
- return throwError(exec, RangeError, "toExponential() argument must between 0 and 20");
- int fractionalDigits = static_cast<int>(df);
- bool includeAllDigits = fractionalDigitsValue.isUndefined();
-
- int decimalAdjust = 0;
- if (x && !includeAllDigits) {
- double logx = floor(log10(fabs(x)));
- x /= pow(10.0, logx);
- const double tenToTheF = pow(10.0, fractionalDigits);
- double fx = floor(x * tenToTheF) / tenToTheF;
- double cx = ceil(x * tenToTheF) / tenToTheF;
-
- if (fabs(fx - x) < fabs(cx - x))
- x = fx;
- else
- x = cx;
-
- decimalAdjust = static_cast<int>(logx);
- }
-
- if (isnan(x))
- return jsNontrivialString(exec, "NaN");
-
- if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0
- x = 0;
-
- int decimalPoint;
- int sign;
- char result[80];
- WTF::dtoa(result, x, 0, &decimalPoint, &sign, NULL);
- size_t resultLength = strlen(result);
- decimalPoint += decimalAdjust;
-
- int i = 0;
- char buf[80]; // digit + '.' + fractionDigits (max 20) + 'e' + sign + exponent (max?)
- if (sign)
- buf[i++] = '-';
-
- // ? 9999 is the magical "result is Inf or NaN" value. what's 999??
- if (decimalPoint == 999) {
- ASSERT(i + resultLength < 80);
- memcpy(buf + i, result, resultLength);
- buf[i + resultLength] = '\0';
- } else {
- buf[i++] = result[0];
-
- if (includeAllDigits)
- fractionalDigits = static_cast<int>(resultLength) - 1;
-
- fractionalPartToString(buf, i, result, resultLength, fractionalDigits);
- exponentialPartToString(buf, i, decimalPoint);
- buf[i++] = '\0';
- }
- ASSERT(i <= 80);
-
- return jsString(exec, buf);
-}
-
-JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSValue v = thisValue.getJSNumber();
- if (!v)
- return throwError(exec, TypeError);
-
- double doublePrecision = args.at(0).toIntegerPreserveNaN(exec);
- double x = v.uncheckedGetNumber();
- if (args.at(0).isUndefined() || isnan(x) || isinf(x))
- return jsString(exec, v.toString(exec));
-
- UString s;
- if (x < 0) {
- s = "-";
- x = -x;
- } else
- s = "";
-
- if (!(doublePrecision >= 1 && doublePrecision <= 21)) // true for NaN
- return throwError(exec, RangeError, "toPrecision() argument must be between 1 and 21");
- int precision = static_cast<int>(doublePrecision);
-
- int e = 0;
- UString m;
- if (x) {
- e = static_cast<int>(log10(x));
- double tens = intPow10(e - precision + 1);
- double n = floor(x / tens);
- if (n < intPow10(precision - 1)) {
- e = e - 1;
- tens = intPow10(e - precision + 1);
- n = floor(x / tens);
- }
-
- if (fabs((n + 1.0) * tens - x) <= fabs(n * tens - x))
- ++n;
- // maintain n < 10^(precision)
- if (n >= intPow10(precision)) {
- n /= 10.0;
- e += 1;
- }
- ASSERT(intPow10(precision - 1) <= n);
- ASSERT(n < intPow10(precision));
-
- m = integerPartNoExp(n);
- if (e < -6 || e >= precision) {
- if (m.size() > 1)
- m = makeString(m.substr(0, 1), ".", m.substr(1));
- if (e >= 0)
- return jsMakeNontrivialString(exec, s, m, "e+", UString::from(e));
- return jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e));
- }
- } else {
- m = charSequence('0', precision);
- e = 0;
- }
-
- if (e == precision - 1)
- return jsString(exec, makeString(s, m));
- if (e >= 0) {
- if (e + 1 < static_cast<int>(m.size()))
- return jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1)));
- return jsString(exec, makeString(s, m));
- }
- return jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.h
deleted file mode 100644
index 1fb2077..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NumberPrototype.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
- };
-
-} // namespace JSC
-
-#endif // NumberPrototype_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NumericStrings.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NumericStrings.h
deleted file mode 100644
index 89235af..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/NumericStrings.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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/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::from(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::from(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::from(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::from(i);
- return smallIntCache[i];
- }
-
- CacheEntry<double> doubleCache[cacheSize];
- CacheEntry<int> intCache[cacheSize];
- CacheEntry<unsigned> unsignedCache[cacheSize];
- UString smallIntCache[cacheSize];
- };
-
-} // namespace JSC
-
-#endif // NumericStrings_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp
deleted file mode 100644
index 0838eb4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * 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 "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 JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*, JSObject*, JSValue, const ArgList&);
-
-ObjectConstructor::ObjectConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
-: InternalFunction(&exec->globalData(), 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(exec, 1), ReadOnly | DontEnum | DontDelete);
-
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().getOwnPropertyNames, objectConstructorGetOwnPropertyNames), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, 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 JSObject* constructWithObjectConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- return constructObject(exec, args);
-}
-
-ConstructType ObjectConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithObjectConstructor;
- return ConstructTypeHost;
-}
-
-static JSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return constructObject(exec, args);
-}
-
-CallType ObjectConstructor::getCallData(CallData& callData)
-{
- callData.native.function = callObjectConstructor;
- return CallTypeHost;
-}
-
-JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (!args.at(0).isObject())
- return throwError(exec, TypeError, "Requested prototype of a value that is not an object.");
- return asObject(args.at(0))->prototype();
-}
-
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (!args.at(0).isObject())
- return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object.");
- UString propertyName = args.at(1).toString(exec);
- if (exec->hadException())
- return jsNull();
- JSObject* object = asObject(args.at(0));
- PropertyDescriptor descriptor;
- if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
- return jsUndefined();
- if (exec->hadException())
- return 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 description;
-}
-
-// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (!args.at(0).isObject())
- return throwError(exec, TypeError, "Requested property names of a value that is not an object.");
- PropertyNameArray properties(exec);
- asObject(args.at(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 names;
-}
-
-// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (!args.at(0).isObject())
- return throwError(exec, TypeError, "Requested keys of a value that is not an object.");
- PropertyNameArray properties(exec);
- asObject(args.at(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 keys;
-}
-
-// ES5 8.10.5 ToPropertyDescriptor
-static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc)
-{
- if (!in.isObject()) {
- throwError(exec, TypeError, "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 (get.getCallData(callData) == CallTypeNone) {
- throwError(exec, TypeError, "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 (set.getCallData(callData) == CallTypeNone) {
- throwError(exec, TypeError, "Setter must be a function.");
- return false;
- }
- } else
- set = JSValue();
-
- desc.setSetter(set);
- }
-
- if (!desc.isAccessorDescriptor())
- return true;
-
- if (desc.value()) {
- throwError(exec, TypeError, "Invalid property. 'value' present on property with getter or setter.");
- return false;
- }
-
- if (desc.writablePresent()) {
- throwError(exec, TypeError, "Invalid property. 'writable' present on property with getter or setter.");
- return false;
- }
- return true;
-}
-
-JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (!args.at(0).isObject())
- return throwError(exec, TypeError, "Properties can only be defined on Objects.");
- JSObject* O = asObject(args.at(0));
- UString propertyName = args.at(1).toString(exec);
- if (exec->hadException())
- return jsNull();
- PropertyDescriptor descriptor;
- if (!toPropertyDescriptor(exec, args.at(2), descriptor))
- return jsNull();
- ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor()));
- ASSERT(!exec->hadException());
- O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true);
- return 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;
-}
-
-JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (!args.at(0).isObject())
- return throwError(exec, TypeError, "Properties can only be defined on Objects.");
- if (!args.at(1).isObject())
- return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, asObject(args.at(0)), asObject(args.at(1)));
-}
-
-JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (!args.at(0).isObject() && !args.at(0).isNull())
- return throwError(exec, TypeError, "Object prototype may only be an Object or null.");
- JSObject* newObject = constructEmptyObject(exec);
- newObject->setPrototype(args.at(0));
- if (args.at(1).isUndefined())
- return newObject;
- if (!args.at(1).isObject())
- return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, newObject, asObject(args.at(1)));
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.h
deleted file mode 100644
index 1d2cdde..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectConstructor.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, ObjectPrototype*, Structure* prototypeFunctionStructure);
-
- private:
- virtual ConstructType getConstructData(ConstructData&);
- virtual CallType getCallData(CallData&);
- };
-
-} // namespace JSC
-
-#endif // ObjectConstructor_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.cpp
deleted file mode 100644
index c32a007..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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 JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&);
-
-ObjectPrototype::ObjectPrototype(ExecState* exec, NonNullPassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
- : JSObject(stucture)
- , m_hasNoPropertiesWithUInt32Names(true)
-{
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
-
- // Mozilla extensions
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, 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.toStrictUInt32(&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
-
-JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- return thisValue.toThisObject(exec);
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- return jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, args.at(0).toString(exec))));
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSObject* thisObj = thisValue.toThisObject(exec);
-
- if (!args.at(0).isObject())
- return jsBoolean(false);
-
- JSValue v = asObject(args.at(0))->prototype();
-
- while (true) {
- if (!v.isObject())
- return jsBoolean(false);
- if (v == thisObj)
- return jsBoolean(true);
- v = asObject(v)->prototype();
- }
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- CallData callData;
- if (args.at(1).getCallData(callData) == CallTypeNone)
- return throwError(exec, SyntaxError, "invalid getter usage");
- thisValue.toThisObject(exec)->defineGetter(exec, Identifier(exec, args.at(0).toString(exec)), asObject(args.at(1)));
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- CallData callData;
- if (args.at(1).getCallData(callData) == CallTypeNone)
- return throwError(exec, SyntaxError, "invalid setter usage");
- thisValue.toThisObject(exec)->defineSetter(exec, Identifier(exec, args.at(0).toString(exec)), asObject(args.at(1)));
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- return thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, args.at(0).toString(exec)));
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- return thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, args.at(0).toString(exec)));
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- return jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, args.at(0).toString(exec))));
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- return thisValue.toThisJSString(exec);
-}
-
-JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- return jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]");
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.h
deleted file mode 100644
index 489d962..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ObjectPrototype.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
-
- private:
- virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
- virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
-
- bool m_hasNoPropertiesWithUInt32Names;
- };
-
- JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-
-} // namespace JSC
-
-#endif // ObjectPrototype_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Operations.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Operations.cpp
deleted file mode 100644
index cf236bf..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Operations.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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(callFrame, 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 = asCell(v)->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/src/3rdparty/webkit/JavaScriptCore/runtime/Operations.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Operations.h
deleted file mode 100644
index cc0d603..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Operations.h
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * 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.size();
- 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.size();
- 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, 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, const ArgList& args)
- {
- unsigned fiberCount = 0;
- if (LIKELY(thisValue.isString()))
- fiberCount += asString(thisValue)->fiberCount();
- else
- ++fiberCount;
- for (unsigned i = 0; i < args.size(); ++i) {
- JSValue v = args.at(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 < args.size(); ++i) {
- JSValue v = args.at(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(callFrame, 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 = asCell(base);
- 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 = asCell(v);
-
- // 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 = asCell(v);
-
- // 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)
- {
- 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 || base->getPropertySlot(callFrame, property, slot))
- return base;
-
- iter = next;
- ++next;
- }
-
- ASSERT_NOT_REACHED();
- return JSValue();
- }
-} // namespace JSC
-
-#endif // Operations_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyMapHashTable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyMapHashTable.h
deleted file mode 100644
index 44dc2b8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyMapHashTable.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 {
- UString::Rep* key;
- unsigned offset;
- unsigned attributes;
- JSCell* specificValue;
- unsigned index;
-
- PropertyMapEntry(UString::Rep* key, unsigned attributes, JSCell* specificValue)
- : key(key)
- , offset(0)
- , attributes(attributes)
- , specificValue(specificValue)
- , index(0)
- {
- }
-
- PropertyMapEntry(UString::Rep* 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/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.cpp
deleted file mode 100644
index 6b24669..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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(UString::Rep* identifier)
-{
- ASSERT(identifier == UString::null().rep() || identifier == UString::Rep::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].ustring().rep())
- return;
- }
- } else {
- if (m_set.isEmpty()) {
- for (size_t i = 0; i < size; ++i)
- m_set.add(m_data->propertyNameVector()[i].ustring().rep());
- }
- if (!m_set.add(identifier).second)
- return;
- }
-
- addKnownUnique(identifier);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h
deleted file mode 100644
index 3dbcc9d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyNameArray.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.ustring().rep()); }
- void add(UString::Rep*);
- void addKnownUnique(UString::Rep* 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<UString::Rep*, PtrHash<UString::Rep*> > IdentifierSet;
-
- RefPtr<PropertyNameArrayData> m_data;
- IdentifierSet m_set;
- JSGlobalData* m_globalData;
- bool m_shouldCache;
- };
-
-} // namespace JSC
-
-#endif // PropertyNameArray_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.cpp
deleted file mode 100644
index 2306a11..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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);
- if (callType == CallTypeHost)
- return callData.native.function(exec, m_data.getterFunc, thisValue(), exec->emptyList());
- ASSERT(callType == CallTypeJS);
- // FIXME: Can this be done more efficiently using the callData?
- return asFunction(m_data.getterFunc)->call(exec, thisValue(), exec->emptyList());
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.h
deleted file mode 100644
index de9ddc9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertySlot.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h
deleted file mode 100644
index a0d5443..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Protect.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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(asCell(value));
- }
-
- inline void gcUnprotect(JSValue value)
- {
- if (value && value.isCell())
- gcUnprotect(asCell(value));
- }
-
- // 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/src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.cpp
deleted file mode 100644
index 38f8adb..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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, int length, const Identifier& name, NativeFunction function)
- : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), name)
- , m_function(function)
-{
- ASSERT_ARG(function, function);
- putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
-}
-
-PrototypeFunction::PrototypeFunction(ExecState* exec, NonNullPassRefPtr<Structure> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function)
- : InternalFunction(&exec->globalData(), prototypeFunctionStructure, name)
- , m_function(function)
-{
- ASSERT_ARG(function, function);
- putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
-}
-
-CallType PrototypeFunction::getCallData(CallData& callData)
-{
- callData.native.function = m_function;
- return CallTypeHost;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.h
deleted file mode 100644
index 70ee034..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PrototypeFunction.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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*, int length, const Identifier&, NativeFunction);
- PrototypeFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
-
- private:
- virtual CallType getCallData(CallData&);
-
- const NativeFunction m_function;
- };
-
-} // namespace JSC
-
-#endif // PrototypeFunction_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PutPropertySlot.h b/src/3rdparty/webkit/JavaScriptCore/runtime/PutPropertySlot.h
deleted file mode 100644
index eb8ea8a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PutPropertySlot.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// -*- 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()
- : m_type(Uncachable)
- , m_base(0)
- {
- }
-
- 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 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;
- };
-
-} // namespace JSC
-
-#endif // PutPropertySlot_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp
deleted file mode 100644
index f097943..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * 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.
- *
- * 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>
-
-
-#if ENABLE(YARR)
-
-#include "yarr/RegexCompiler.h"
-#if ENABLE(YARR_JIT)
-#include "yarr/RegexJIT.h"
-#else
-#include "yarr/RegexInterpreter.h"
-#endif
-
-#else
-
-#include <pcre/pcre.h>
-
-#endif
-
-namespace JSC {
-
-inline RegExp::RegExp(JSGlobalData* globalData, const UString& pattern)
- : m_pattern(pattern)
- , m_flagBits(0)
- , m_constructionError(0)
- , m_numSubpatterns(0)
-{
- compile(globalData);
-}
-
-inline RegExp::RegExp(JSGlobalData* globalData, const UString& pattern, const UString& flags)
- : m_pattern(pattern)
- , m_flagBits(0)
- , m_constructionError(0)
- , m_numSubpatterns(0)
-{
- // NOTE: The global flag is handled on a case-by-case basis by functions like
- // String::match and RegExpObject::match.
- if (flags.find('g') != UString::NotFound)
- m_flagBits |= Global;
- if (flags.find('i') != UString::NotFound)
- m_flagBits |= IgnoreCase;
- if (flags.find('m') != UString::NotFound)
- m_flagBits |= Multiline;
-
- compile(globalData);
-}
-
-#if !ENABLE(YARR)
-RegExp::~RegExp()
-{
- jsRegExpFree(m_regExp);
-}
-#endif
-
-PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern)
-{
- return adoptRef(new RegExp(globalData, pattern));
-}
-
-PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern, const UString& flags)
-{
- return adoptRef(new RegExp(globalData, pattern, flags));
-}
-
-#if ENABLE(YARR)
-
-void RegExp::compile(JSGlobalData* globalData)
-{
-#if ENABLE(YARR_JIT)
- Yarr::jitCompileRegex(globalData, m_regExpJITCode, m_pattern, m_numSubpatterns, m_constructionError, ignoreCase(), multiline());
-#else
- UNUSED_PARAM(globalData);
- m_regExpBytecode.set(Yarr::byteCompileRegex(m_pattern, m_numSubpatterns, m_constructionError, ignoreCase(), multiline()));
-#endif
-}
-
-int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
-{
- if (startOffset < 0)
- startOffset = 0;
- if (ovector)
- ovector->clear();
-
- if (static_cast<unsigned>(startOffset) > s.size() || s.isNull())
- return -1;
-
-#if ENABLE(YARR_JIT)
- if (!!m_regExpJITCode) {
-#else
- if (m_regExpBytecode) {
-#endif
- int offsetVectorSize = (m_numSubpatterns + 1) * 3; // FIXME: should be 2 - but adding temporary fallback to pcre.
- int* offsetVector;
- Vector<int, 32> nonReturnedOvector;
- if (ovector) {
- ovector->resize(offsetVectorSize);
- offsetVector = ovector->data();
- } else {
- nonReturnedOvector.resize(offsetVectorSize);
- offsetVector = nonReturnedOvector.data();
- }
-
- ASSERT(offsetVector);
- for (int j = 0; j < offsetVectorSize; ++j)
- offsetVector[j] = -1;
-
-
-#if ENABLE(YARR_JIT)
- int result = Yarr::executeRegex(m_regExpJITCode, s.data(), startOffset, s.size(), offsetVector, offsetVectorSize);
-#else
- int result = Yarr::interpretRegex(m_regExpBytecode.get(), s.data(), startOffset, s.size(), offsetVector);
-#endif
-
- if (result < 0) {
-#ifndef NDEBUG
- // TODO: define up a symbol, rather than magic -1
- if (result != -1)
- fprintf(stderr, "jsRegExpExecute failed with result %d\n", result);
-#endif
- if (ovector)
- ovector->clear();
- }
- return result;
- }
-
- return -1;
-}
-
-#else
-
-void RegExp::compile(JSGlobalData*)
-{
- m_regExp = 0;
- JSRegExpIgnoreCaseOption ignoreCaseOption = ignoreCase() ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase;
- JSRegExpMultilineOption multilineOption = multiline() ? JSRegExpMultiline : JSRegExpSingleLine;
- m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(m_pattern.data()), m_pattern.size(), ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError);
-}
-
-int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
-{
- if (startOffset < 0)
- startOffset = 0;
- if (ovector)
- ovector->clear();
-
- if (static_cast<unsigned>(startOffset) > s.size() || s.isNull())
- return -1;
-
- if (m_regExp) {
- // Set up the offset vector for the result.
- // First 2/3 used for result, the last third used by PCRE.
- int* offsetVector;
- int offsetVectorSize;
- int fixedSizeOffsetVector[3];
- if (!ovector) {
- offsetVectorSize = 3;
- offsetVector = fixedSizeOffsetVector;
- } else {
- offsetVectorSize = (m_numSubpatterns + 1) * 3;
- ovector->resize(offsetVectorSize);
- offsetVector = ovector->data();
- }
-
- int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const UChar*>(s.data()), s.size(), startOffset, offsetVector, offsetVectorSize);
-
- if (numMatches < 0) {
-#ifndef NDEBUG
- if (numMatches != JSRegExpErrorNoMatch)
- fprintf(stderr, "jsRegExpExecute failed with result %d\n", numMatches);
-#endif
- if (ovector)
- ovector->clear();
- return -1;
- }
-
- return offsetVector[0];
- }
-
- return -1;
-}
-
-#endif
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h
deleted file mode 100644
index 695b688..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExp.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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>
-#include "yarr/RegexJIT.h"
-#include "yarr/RegexInterpreter.h"
-
-struct JSRegExp;
-
-namespace JSC {
-
- class JSGlobalData;
-
- class RegExp : public RefCounted<RegExp> {
- public:
- static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern);
- static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern, const UString& flags);
-#if !ENABLE(YARR)
- ~RegExp();
-#endif
-
- 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_pattern; }
-
- 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; }
-
- private:
- RegExp(JSGlobalData* globalData, const UString& pattern);
- RegExp(JSGlobalData* globalData, const UString& pattern, const UString& flags);
-
- void compile(JSGlobalData*);
-
- enum FlagBits { Global = 1, IgnoreCase = 2, Multiline = 4 };
-
- UString m_pattern; // FIXME: Just decompile m_regExp instead of storing this.
- int m_flagBits;
- const char* m_constructionError;
- unsigned m_numSubpatterns;
-
-#if ENABLE(YARR_JIT)
- Yarr::RegexCodeBlock m_regExpJITCode;
-#elif ENABLE(YARR)
- OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
-#else
- JSRegExp* m_regExp;
-#endif
- };
-
-} // namespace JSC
-
-#endif // RegExp_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp
deleted file mode 100644
index c0cfc37..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * 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 "JSArray.h"
-#include "JSFunction.h"
-#include "JSString.h"
-#include "ObjectPrototype.h"
-#include "RegExpMatchesArray.h"
-#include "RegExpObject.h"
-#include "RegExpPrototype.h"
-#include "RegExp.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, NonNullPassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype)
- : InternalFunction(&exec->globalData(), structure, Identifier(exec, "RegExp"))
- , d(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(exec, 2), ReadOnly | DontDelete | DontEnum);
-}
-
-RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate* data)
- : JSArray(exec->lexicalGlobalObject()->regExpMatchesArrayStructure(), data->lastNumSubPatterns + 1)
-{
- 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(exec, 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.size() - 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, TypeError, "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 = RegExp::create(&exec->globalData(), pattern, flags);
- if (!regExp->isValid())
- return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage()));
- return new (exec) RegExpObject(exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
-}
-
-static JSObject* constructWithRegExpConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- return constructRegExp(exec, args);
-}
-
-ConstructType RegExpConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithRegExpConstructor;
- return ConstructTypeHost;
-}
-
-// ECMA 15.10.3
-static JSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- return 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/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.h
deleted file mode 100644
index 8f4be71..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpConstructor.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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*, 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.
- */
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.cpp
deleted file mode 100644
index 3758e53..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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 "JSArray.h"
-#include "JSGlobalObject.h"
-#include "JSString.h"
-#include "RegExpConstructor.h"
-#include "RegExpPrototype.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(NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<RegExp> regExp)
- : JSObject(structure)
- , d(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* exec, JSValue slotBase, const Identifier&)
-{
- return jsNumber(exec, 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, const ArgList& args)
-{
- return jsBoolean(match(exec, args));
-}
-
-JSValue RegExpObject::exec(ExecState* exec, const ArgList& args)
-{
- if (match(exec, args))
- return exec->lexicalGlobalObject()->regExpConstructor()->arrayOfMatches(exec);
- return jsNull();
-}
-
-static JSValue JSC_HOST_CALL callRegExpObject(ExecState* exec, JSObject* function, JSValue, const ArgList& args)
-{
- return asRegExpObject(function)->exec(exec, args);
-}
-
-CallType RegExpObject::getCallData(CallData& callData)
-{
- callData.native.function = callRegExpObject;
- return CallTypeHost;
-}
-
-// Shared implementation used by test and exec.
-bool RegExpObject::match(ExecState* exec, const ArgList& args)
-{
- RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
-
- UString input = args.isEmpty() ? regExpConstructor->input() : args.at(0).toString(exec);
- if (input.isNull()) {
- throwError(exec, GeneralError, makeString("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.size()) {
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.h
deleted file mode 100644
index 4ad11ef..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpObject.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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 "JSObject.h"
-#include "RegExp.h"
-
-namespace JSC {
-
- class RegExpObject : public JSObject {
- public:
- RegExpObject(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*, const ArgList&);
- JSValue exec(ExecState*, const ArgList&);
-
- 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 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;
-
- private:
- bool match(ExecState*, const ArgList&);
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp
deleted file mode 100644
index dd5fe02..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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"
-
-namespace JSC {
-
-ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
-
-static JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-
-// ECMA 15.10.5
-
-const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0, 0 };
-
-RegExpPrototype::RegExpPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
- : JSObject(structure)
-{
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
-}
-
-// ------------------------------ Functions ---------------------------
-
-JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
- return asRegExpObject(thisValue)->test(exec, args);
-}
-
-JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
- return asRegExpObject(thisValue)->exec(exec, args);
-}
-
-JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
-
- RefPtr<RegExp> regExp;
- JSValue arg0 = args.at(0);
- JSValue arg1 = args.at(1);
-
- if (arg0.inherits(&RegExpObject::info)) {
- if (!arg1.isUndefined())
- return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
- regExp = asRegExpObject(arg0)->regExp();
- } else {
- UString pattern = args.isEmpty() ? UString("") : arg0.toString(exec);
- UString flags = arg1.isUndefined() ? UString("") : arg1.toString(exec);
- regExp = RegExp::create(&exec->globalData(), pattern, flags);
- }
-
- if (!regExp->isValid())
- return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage()));
-
- asRegExpObject(thisValue)->setRegExp(regExp.release());
- asRegExpObject(thisValue)->setLastIndex(0);
- return jsUndefined();
-}
-
-JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- if (!thisValue.inherits(&RegExpObject::info)) {
- if (thisValue.inherits(&RegExpPrototype::info))
- return jsNontrivialString(exec, "//");
- return throwError(exec, TypeError);
- }
-
- 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 jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.h
deleted file mode 100644
index d3979bd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 "JSObject.h"
-
-namespace JSC {
-
- class RegExpPrototype : public JSObject {
- public:
- RegExpPrototype(ExecState*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
-
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- };
-
-} // namespace JSC
-
-#endif // RegExpPrototype_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.cpp
deleted file mode 100644
index 981794b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.ascii());
- }
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.h
deleted file mode 100644
index 0b15b67..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChain.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChainMark.h b/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChainMark.h
deleted file mode 100644
index 984d101..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ScopeChainMark.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.cpp
deleted file mode 100644
index 78bd4e4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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 "SmallStrings.h"
-
-#include "JSGlobalObject.h"
-#include "JSString.h"
-
-#include <wtf/Noncopyable.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();
-
- UString::Rep* rep(unsigned char character) { return &m_reps[character]; }
-
-private:
- UString::Rep m_reps[numCharactersToStore];
-};
-
-SmallStringsStorage::SmallStringsStorage()
-{
- UChar* characterBuffer = 0;
- RefPtr<UStringImpl> baseString = UStringImpl::createUninitialized(numCharactersToStore, characterBuffer);
- for (unsigned i = 0; i < numCharactersToStore; ++i) {
- characterBuffer[i] = i;
- new (&m_reps[i]) UString::Rep(&characterBuffer[i], 1, PassRefPtr<UStringImpl>(baseString));
- }
-}
-
-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.set(new SmallStringsStorage);
- ASSERT(!m_singleCharacterStrings[character]);
- m_singleCharacterStrings[character] = new (globalData) JSString(globalData, m_storage->rep(character), JSString::HasOtherOwner);
-}
-
-UString::Rep* SmallStrings::singleCharacterStringRep(unsigned char character)
-{
- if (!m_storage)
- m_storage.set(new SmallStringsStorage);
- return m_storage->rep(character);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.h b/src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.h
deleted file mode 100644
index cc11d0a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/SmallStrings.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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/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];
- }
-
- UString::Rep* singleCharacterStringRep(unsigned char character);
-
- void markChildren(MarkStack&);
- void clear();
-
- unsigned count() const;
-
- private:
- void createEmptyString(JSGlobalData*);
- void createSingleCharacterString(JSGlobalData*, unsigned char);
-
- JSString* m_emptyString;
- JSString* m_singleCharacterStrings[0x100];
- OwnPtr<SmallStringsStorage> m_storage;
- };
-
-} // namespace JSC
-
-#endif // SmallStrings_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringBuilder.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StringBuilder.h
deleted file mode 100644
index 59b01e0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringBuilder.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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 StringBuilder_h
-#define StringBuilder_h
-
-#include <wtf/Vector.h>
-
-namespace JSC {
-
-class StringBuilder {
-public:
- void append(const UChar u)
- {
- buffer.append(u);
- }
-
- void append(const char* str)
- {
- append(str, strlen(str));
- }
-
- void append(const char* str, size_t len)
- {
- buffer.reserveCapacity(buffer.size() + len);
- for (size_t i = 0; i < len; i++)
- buffer.append(static_cast<unsigned char>(str[i]));
- }
-
- void append(const UChar* str, size_t len)
- {
- buffer.append(str, len);
- }
-
- void append(const UString& str)
- {
- buffer.append(str.data(), str.size());
- }
-
- bool isEmpty() { return buffer.isEmpty(); }
- void reserveCapacity(size_t newCapacity) { buffer.reserveCapacity(newCapacity); }
- void resize(size_t size) { buffer.resize(size); }
- size_t size() const { return buffer.size(); }
-
- UChar operator[](size_t i) const { return buffer.at(i); }
-
- UString build()
- {
- buffer.shrinkToFit();
- ASSERT(buffer.data() || !buffer.size());
- return UString::adopt(buffer);
- }
-
-protected:
- Vector<UChar, 64> buffer;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.cpp
deleted file mode 100644
index c7b62bf..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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 "JSFunction.h"
-#include "JSGlobalObject.h"
-#include "PrototypeFunction.h"
-#include "StringPrototype.h"
-
-namespace JSC {
-
-static NEVER_INLINE JSValue stringFromCharCodeSlowCase(ExecState* exec, const ArgList& args)
-{
- unsigned length = args.size();
- UChar* buf;
- PassRefPtr<UStringImpl> impl = UStringImpl::createUninitialized(length, buf);
- for (unsigned i = 0; i < length; ++i)
- buf[i] = static_cast<UChar>(args.at(i).toUInt32(exec));
- return jsString(exec, impl);
-}
-
-static JSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (LIKELY(args.size() == 1))
- return jsSingleCharacterString(exec, args.at(0).toUInt32(exec));
- return stringFromCharCodeSlowCase(exec, args);
-}
-
-ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
-
-StringConstructor::StringConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, StringPrototype* stringPrototype)
- : InternalFunction(&exec->globalData(), 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()
- putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
-
- // no. of arguments for constructor
- putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);
-}
-
-// ECMA 15.5.2
-static JSObject* constructWithStringConstructor(ExecState* exec, JSObject*, const ArgList& args)
-{
- if (args.isEmpty())
- return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure());
- return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure(), args.at(0).toString(exec));
-}
-
-ConstructType StringConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructWithStringConstructor;
- return ConstructTypeHost;
-}
-
-// ECMA 15.5.1
-static JSValue JSC_HOST_CALL callStringConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
-{
- if (args.isEmpty())
- return jsEmptyString(exec);
- return jsString(exec, args.at(0).toString(exec));
-}
-
-CallType StringConstructor::getCallData(CallData& callData)
-{
- callData.native.function = callStringConstructor;
- return CallTypeHost;
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.h
deleted file mode 100644
index e511f7b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringConstructor.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, StringPrototype*);
-
- virtual ConstructType getConstructData(ConstructData&);
- virtual CallType getCallData(CallData&);
- };
-
-} // namespace JSC
-
-#endif // StringConstructor_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp
deleted file mode 100644
index f8e0e87..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.toStrictUInt32(&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::from(i)));
- if (mode == IncludeDontEnumProperties)
- propertyNames.add(exec->propertyNames().length);
- return JSObject::getOwnPropertyNames(exec, propertyNames, mode);
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h
deleted file mode 100644
index e3add77..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
deleted file mode 100644
index 43c3e38..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
deleted file mode 100644
index bef4083..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
+++ /dev/null
@@ -1,1067 +0,0 @@
-/*
- * 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 "ObjectPrototype.h"
-#include "Operations.h"
-#include "PropertyNameArray.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 JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*, JSObject*, JSValue, const ArgList&);
-
-static JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*, JSObject*, JSValue, const ArgList&);
-
-static JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*, JSObject*, JSValue, const ArgList&);
-
-}
-
-#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, NonNullPassRefPtr<Structure> structure)
- : StringObject(exec, structure)
-{
- // The constructor will be added later, after StringConstructor has been built
- putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 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, unsigned i)
-{
- Vector<UChar> substitutedReplacement;
- int offset = 0;
- do {
- if (i + 1 == replacement.size())
- break;
-
- UChar ref = replacement[i + 1];
- if (ref == '$') {
- // "$$" -> "$"
- ++i;
- substitutedReplacement.append(replacement.data() + 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.size() - 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.size() > 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.data() + offset, i - offset);
- i += 1 + advance;
- offset = i + 1;
- substitutedReplacement.append(source.data() + backrefStart, backrefLength);
- } while ((i = replacement.find('$', i + 1)) != UString::NotFound);
-
- if (replacement.size() - offset)
- substitutedReplacement.append(replacement.data() + offset, replacement.size() - offset);
-
- substitutedReplacement.shrinkToFit();
- return UString::adopt(substitutedReplacement);
-}
-
-static inline UString substituteBackreferences(const UString& replacement, const UString& source, const int* ovector, RegExp* reg)
-{
- unsigned i = replacement.find('$', 0);
- if (UNLIKELY(i != UString::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.data()), a.size(), reinterpret_cast<const ::UChar*>(b.data()), b.size());
-}
-
-struct StringRange {
-public:
- StringRange(int pos, int len)
- : position(pos)
- , length(len)
- {
- }
-
- StringRange()
- {
- }
-
- int position;
- int length;
-};
-
-JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, JSString* sourceVal, const UString& source, const StringRange* substringRanges, int rangeCount, const UString* separators, int separatorCount);
-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.size();
- 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, UStringImpl::create(source.rep(), 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].size();
-
- if (totalLength == 0)
- return jsString(exec, "");
-
- UChar* buffer;
- PassRefPtr<UStringImpl> impl = UStringImpl::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) {
- UStringImpl::copyChars(buffer + bufferPos, source.data() + substringRanges[i].position, substringRanges[i].length);
- bufferPos += substringRanges[i].length;
- }
- if (i < separatorCount) {
- UStringImpl::copyChars(buffer + bufferPos, separators[i].data(), separators[i].size());
- bufferPos += separators[i].size();
- }
- }
-
- return jsString(exec, impl);
-}
-
-JSValue jsReplaceRange(ExecState* exec, const UString& source, int rangeStart, int rangeLength, const UString& replacement);
-JSValue jsReplaceRange(ExecState* exec, const UString& source, int rangeStart, int rangeLength, const UString& replacement)
-{
- int replacementLength = replacement.size();
- int totalLength = source.size() - rangeLength + replacementLength;
- if (totalLength == 0)
- return jsString(exec, "");
-
- UChar* buffer;
- PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(totalLength, buffer);
- if (!impl)
- return throwOutOfMemoryError(exec);
-
- UStringImpl::copyChars(buffer, source.data(), rangeStart);
- UStringImpl::copyChars(buffer + rangeStart, replacement.data(), replacementLength);
- int rangeEnd = rangeStart + rangeLength;
- UStringImpl::copyChars(buffer + rangeStart + replacementLength, source.data() + rangeEnd, source.size() - rangeEnd);
-
- return jsString(exec, impl);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- JSString* sourceVal = thisValue.toThisJSString(exec);
- const UString& source = sourceVal->value(exec);
-
- JSValue pattern = args.at(0);
-
- JSValue replacement = args.at(1);
- UString replacementString;
- CallData callData;
- CallType callType = replacement.getCallData(callData);
- if (callType == CallTypeNone)
- replacementString = replacement.toString(exec);
-
- if (pattern.inherits(&RegExpObject::info)) {
- 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, exec->exceptionSlot());
- if (exec->hadException())
- return 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(exec, completeMatchStart));
- cachedCall.setArgument(i++, sourceVal);
-
- cachedCall.setThis(exec->globalThisValue());
- JSValue result = cachedCall.call();
- 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 > source.size())
- break;
- }
- }
- } else {
- do {
- 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));
-
- if (callType != CallTypeNone) {
- 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(exec, completeMatchStart));
- args.append(sourceVal);
-
- replacements.append(call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec));
- if (exec->hadException())
- break;
- } else
- replacements.append(substituteBackreferences(replacementString, source, ovector, reg));
-
- lastIndex = matchIndex + matchLen;
- startPosition = lastIndex;
-
- // special case of empty match
- if (matchLen == 0) {
- startPosition++;
- if (startPosition > source.size())
- break;
- }
- } while (global);
- }
-
- if (!lastIndex && replacements.isEmpty())
- return sourceVal;
-
- if (static_cast<unsigned>(lastIndex) < source.size())
- sourceRanges.append(StringRange(lastIndex, source.size() - lastIndex));
-
- return 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);
- unsigned matchPos = source.find(patternString);
-
- if (matchPos == UString::NotFound)
- return sourceVal;
-
- int matchLen = patternString.size();
- if (callType != CallTypeNone) {
- MarkedArgumentBuffer args;
- args.append(jsSubstring(exec, source, matchPos, matchLen));
- args.append(jsNumber(exec, matchPos));
- args.append(sourceVal);
-
- replacementString = call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec);
- }
-
- int ovector[2] = { matchPos, matchPos + matchLen };
- return jsReplaceRange(exec, source, matchPos, matchLen, substituteBackreferences(replacementString, source, ovector, 0));
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- // Also used for valueOf.
-
- if (thisValue.isString())
- return thisValue;
-
- if (thisValue.inherits(&StringObject::info))
- return asStringObject(thisValue)->internalValue();
-
- return throwError(exec, TypeError);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- unsigned len = s.size();
- JSValue a0 = args.at(0);
- if (a0.isUInt32()) {
- uint32_t i = a0.asUInt32();
- if (i < len)
- return jsSingleCharacterSubstring(exec, s, i);
- return jsEmptyString(exec);
- }
- double dpos = a0.toInteger(exec);
- if (dpos >= 0 && dpos < len)
- return jsSingleCharacterSubstring(exec, s, static_cast<unsigned>(dpos));
- return jsEmptyString(exec);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- unsigned len = s.size();
- JSValue a0 = args.at(0);
- if (a0.isUInt32()) {
- uint32_t i = a0.asUInt32();
- if (i < len)
- return jsNumber(exec, s.data()[i]);
- return jsNaN(exec);
- }
- double dpos = a0.toInteger(exec);
- if (dpos >= 0 && dpos < len)
- return jsNumber(exec, s[static_cast<int>(dpos)]);
- return jsNaN(exec);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (thisValue.isString() && (args.size() == 1)) {
- JSValue v = args.at(0);
- return v.isString()
- ? jsString(exec, asString(thisValue), asString(v))
- : jsString(exec, asString(thisValue), v.toString(exec));
- }
-
- return jsString(exec, thisValue, args);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- int len = s.size();
-
- JSValue a0 = args.at(0);
- JSValue a1 = args.at(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);
- }
-
- unsigned result = s.find(u2, pos);
- if (result == UString::NotFound)
- return jsNumber(exec, -1);
- return jsNumber(exec, result);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- int len = s.size();
-
- JSValue a0 = args.at(0);
- JSValue a1 = args.at(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
-
- unsigned result = s.rfind(u2, static_cast<unsigned>(dpos));
- if (result == UString::NotFound)
- return jsNumber(exec, -1);
- return jsNumber(exec, result);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
-
- JSValue a0 = args.at(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 = RegExp::create(&exec->globalData(), a0.toString(exec));
- }
- 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 jsNull();
- return 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 jsNull();
- }
-
- return constructArray(exec, list);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
-
- JSValue a0 = args.at(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 = RegExp::create(&exec->globalData(), a0.toString(exec));
- }
- RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
- int pos;
- int matchLength = 0;
- regExpConstructor->performMatch(reg.get(), u, 0, pos, matchLength);
- return jsNumber(exec, pos);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- int len = s.size();
-
- JSValue a0 = args.at(0);
- JSValue a1 = args.at(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 jsSubstring(exec, s, static_cast<unsigned>(from), static_cast<unsigned>(to) - static_cast<unsigned>(from));
- }
-
- return jsEmptyString(exec);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
-
- JSValue a0 = args.at(0);
- JSValue a1 = args.at(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 result;
- }
- unsigned pos = 0;
- while (i != limit && pos < s.size()) {
- 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 result;
- }
- while (i != limit && p0 < s.size() - 1)
- result->put(exec, i++, jsSingleCharacterSubstring(exec, s, p0++));
- } else {
- unsigned pos;
-
- while (i != limit && (pos = s.find(u2, p0)) != UString::NotFound) {
- result->put(exec, i++, jsSubstring(exec, s, p0, pos - p0));
- p0 = pos + u2.size();
- }
- }
- }
-
- // add remaining string
- if (i != limit)
- result->put(exec, i++, jsSubstring(exec, s, p0, s.size() - p0));
-
- return result;
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- int len = s.size();
-
- JSValue a0 = args.at(0);
- JSValue a1 = args.at(1);
-
- double start = a0.toInteger(exec);
- double length = a1.isUndefined() ? len : a1.toInteger(exec);
- if (start >= len || length <= 0)
- return jsEmptyString(exec);
- if (start < 0) {
- start += len;
- if (start < 0)
- start = 0;
- }
- if (start + length > len)
- length = len - start;
- return jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(length));
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- int len = s.size();
-
- JSValue a0 = args.at(0);
- JSValue a1 = args.at(1);
-
- double start = a0.toNumber(exec);
- double end = a1.toNumber(exec);
- if (isnan(start))
- start = 0;
- if (isnan(end))
- end = 0;
- if (start < 0)
- start = 0;
- if (end < 0)
- end = 0;
- if (start > len)
- start = len;
- if (end > len)
- end = len;
- if (a1.isUndefined())
- end = len;
- if (start > end) {
- double temp = end;
- end = start;
- start = temp;
- }
- return jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(end) - static_cast<unsigned>(start));
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- JSString* sVal = thisValue.toThisJSString(exec);
- const UString& s = sVal->value(exec);
-
- int sSize = s.size();
- if (!sSize)
- return sVal;
-
- const UChar* sData = s.data();
- 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 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 sVal;
- }
- if (length == sSize) {
- if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
- return sVal;
- } else
- buffer.resize(length);
- return jsString(exec, UString::adopt(buffer));
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- JSString* sVal = thisValue.toThisJSString(exec);
- const UString& s = sVal->value(exec);
-
- int sSize = s.size();
- if (!sSize)
- return sVal;
-
- const UChar* sData = s.data();
- 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 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 sVal;
- }
- if (length == sSize) {
- if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
- return sVal;
- } else
- buffer.resize(length);
- return jsString(exec, UString::adopt(buffer));
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- if (args.size() < 1)
- return jsNumber(exec, 0);
-
- UString s = thisValue.toThisString(exec);
- JSValue a0 = args.at(0);
- return jsNumber(exec, localeCompare(s, a0.toString(exec)));
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<big>", s, "</big>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<small>", s, "</small>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<blink>", s, "</blink>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<b>", s, "</b>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<tt>", s, "</tt>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<i>", s, "</i>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<strike>", s, "</strike>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<sub>", s, "</sub>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<sup>", s, "</sup>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- JSValue a0 = args.at(0);
- return jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- JSValue a0 = args.at(0);
-
- uint32_t smallInteger;
- if (a0.getUInt32(smallInteger) && smallInteger <= 9) {
- unsigned stringSize = s.size();
- unsigned bufferSize = 22 + stringSize;
- UChar* buffer;
- PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer);
- if (!impl)
- return 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.data(), 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 jsNontrivialString(exec, impl);
- }
-
- return jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- JSValue a0 = args.at(0);
- return jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>");
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UString s = thisValue.toThisString(exec);
- JSValue a0 = args.at(0);
- UString linkText = a0.toString(exec);
-
- unsigned linkTextSize = linkText.size();
- unsigned stringSize = s.size();
- unsigned bufferSize = 15 + linkTextSize + stringSize;
- UChar* buffer;
- PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer);
- if (!impl)
- return 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.data(), linkTextSize * sizeof(UChar));
- buffer[9 + linkTextSize] = '"';
- buffer[10 + linkTextSize] = '>';
- memcpy(&buffer[11 + linkTextSize], s.data(), stringSize * sizeof(UChar));
- buffer[11 + linkTextSize + stringSize] = '<';
- buffer[12 + linkTextSize + stringSize] = '/';
- buffer[13 + linkTextSize + stringSize] = 'a';
- buffer[14 + linkTextSize + stringSize] = '>';
- return 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)
-{
- UString str = thisValue.toThisString(exec);
- unsigned left = 0;
- if (trimKind & TrimLeft) {
- while (left < str.size() && isTrimWhitespace(str[left]))
- left++;
- }
- unsigned right = str.size();
- 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.size() && thisValue.isString())
- return thisValue;
-
- return jsString(exec, str.substr(left, right - left));
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- return trimString(exec, thisValue, TrimLeft | TrimRight);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- return trimString(exec, thisValue, TrimLeft);
-}
-
-JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
-{
- return trimString(exec, thisValue, TrimRight);
-}
-
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.h
deleted file mode 100644
index 3a6a2a3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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*, 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/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
deleted file mode 100644
index 6d13f4b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
+++ /dev/null
@@ -1,1269 +0,0 @@
-/*
- * 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_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 (UString::Rep* 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 UString::Rep* rep = propertyName._ustring.rep();
-
- 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.ustring().rep(), 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.ustring().rep();
- 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.ustring().rep(), 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 (UString::Rep* 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 UString::Rep* 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;
-
- UString::Rep* rep = propertyName._ustring.rep();
-
- 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;
-
- UString::Rep* rep = propertyName._ustring.rep();
-
- 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(UString::Rep* rep, unsigned attributes)
-{
- return transitionTableHasTransition(make_pair(rep, attributes));
-}
-
-size_t Structure::remove(const Identifier& propertyName)
-{
- ASSERT(!propertyName.isNull());
-
- checkConsistency();
-
- UString::Rep* rep = propertyName._ustring.rep();
-
- 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;
- UString::Rep* 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));
- UString::Rep* 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/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h
deleted file mode 100644
index 968443a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * 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 UString::Rep* rep, unsigned& attributes, JSCell*& specificValue);
- size_t get(const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue)
- {
- ASSERT(!propertyName.isNull());
- return get(propertyName.ustring().rep(), attributes, specificValue);
- }
- bool transitionedFor(const JSCell* specificValue)
- {
- return m_specificValueInPrevious == specificValue;
- }
- bool hasTransition(UString::Rep*, unsigned attributes);
- bool hasTransition(const Identifier& propertyName, unsigned attributes)
- {
- return hasTransition(propertyName._ustring.rep(), 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<UString::Rep> 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;
-
- UString::Rep* rep = propertyName._ustring.rep();
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp
deleted file mode 100644
index 085876c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h
deleted file mode 100644
index 816b66d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureChain.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h
deleted file mode 100644
index d1dc2d9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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<UString::Rep>, 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<UString::Rep> > 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/src/3rdparty/webkit/JavaScriptCore/runtime/SymbolTable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/SymbolTable.h
deleted file mode 100644
index f5e2669..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/SymbolTable.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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<UString::Rep>, SymbolTableEntry, IdentifierRepHash, HashTraits<RefPtr<UString::Rep> >, SymbolTableIndexHashTraits> SymbolTable;
-
- class SharedSymbolTable : public SymbolTable, public RefCounted<SharedSymbolTable>
- {
- };
-
-} // namespace JSC
-
-#endif // SymbolTable_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp
deleted file mode 100644
index 2dc1028..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.
- return currentTime() * 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/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp
deleted file mode 100644
index 9da669d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp
+++ /dev/null
@@ -1,738 +0,0 @@
-/*
- * 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 "dtoa.h"
-#include "Identifier.h"
-#include "Operations.h"
-#include <ctype.h>
-#include <limits.h>
-#include <limits>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wtf/ASCIICType.h>
-#include <wtf/Assertions.h>
-#include <wtf/MathExtras.h>
-#include <wtf/StringExtras.h>
-#include <wtf/Vector.h>
-#include <wtf/unicode/UTF8.h>
-#include <wtf/StringExtras.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;
-
-CString::CString(const char* c)
- : m_length(strlen(c))
- , m_data(new char[m_length + 1])
-{
- memcpy(m_data, c, m_length + 1);
-}
-
-CString::CString(const char* c, size_t length)
- : m_length(length)
- , m_data(new char[length + 1])
-{
- memcpy(m_data, c, m_length);
- m_data[m_length] = 0;
-}
-
-CString::CString(const CString& b)
-{
- m_length = b.m_length;
- if (b.m_data) {
- m_data = new char[m_length + 1];
- memcpy(m_data, b.m_data, m_length + 1);
- } else
- m_data = 0;
-}
-
-CString::~CString()
-{
- delete [] m_data;
-}
-
-CString CString::adopt(char* c, size_t length)
-{
- CString s;
- s.m_data = c;
- s.m_length = length;
- return s;
-}
-
-CString& CString::append(const CString& t)
-{
- char* n;
- n = new char[m_length + t.m_length + 1];
- if (m_length)
- memcpy(n, m_data, m_length);
- if (t.m_length)
- memcpy(n + m_length, t.m_data, t.m_length);
- m_length += t.m_length;
- n[m_length] = 0;
-
- delete [] m_data;
- m_data = n;
-
- return *this;
-}
-
-CString& CString::operator=(const char* c)
-{
- if (m_data)
- delete [] m_data;
- m_length = strlen(c);
- m_data = new char[m_length + 1];
- memcpy(m_data, c, m_length + 1);
-
- return *this;
-}
-
-CString& CString::operator=(const CString& str)
-{
- if (this == &str)
- return *this;
-
- if (m_data)
- delete [] m_data;
- m_length = str.m_length;
- if (str.m_data) {
- m_data = new char[m_length + 1];
- memcpy(m_data, str.m_data, m_length + 1);
- } else
- m_data = 0;
-
- return *this;
-}
-
-bool operator==(const CString& c1, const CString& c2)
-{
- size_t len = c1.size();
- return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0);
-}
-
-// The null string is immutable, except for refCount.
-UString::Rep* UString::s_nullRep;
-UString* UString::s_nullUString;
-
-void initializeUString()
-{
- // UStringImpl::empty() does not construct its static string in a threadsafe fashion,
- // so ensure it has been initialized from here.
- UStringImpl::empty();
-
- UString::s_nullRep = new UStringImpl(0, 0, UStringImpl::ConstructStaticString);
- UString::s_nullUString = new UString;
-}
-
-UString::UString(const char* c)
- : m_rep(Rep::create(c))
-{
-}
-
-UString::UString(const char* c, unsigned length)
- : m_rep(Rep::create(c, length))
-{
-}
-
-UString::UString(const UChar* c, unsigned length)
- : m_rep(Rep::create(c, length))
-{
-}
-
-UString UString::from(int i)
-{
- UChar buf[1 + sizeof(i) * 3];
- UChar* end = buf + sizeof(buf) / sizeof(UChar);
- UChar* p = end;
-
- if (i == 0)
- *--p = '0';
- else if (i == INT_MIN) {
- char minBuf[1 + sizeof(i) * 3];
- sprintf(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::from(long long i)
-{
- UChar buf[1 + sizeof(i) * 3];
- UChar* end = buf + sizeof(buf) / sizeof(UChar);
- 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) - 1, "%I64d", std::numeric_limits<long long>::min());
-#else
- snprintf(minBuf, sizeof(minBuf) - 1, "%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::from(unsigned u)
-{
- UChar buf[sizeof(u) * 3];
- UChar* end = buf + sizeof(buf) / sizeof(UChar);
- 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::from(long l)
-{
- UChar buf[1 + sizeof(l) * 3];
- UChar* end = buf + sizeof(buf) / sizeof(UChar);
- UChar* p = end;
-
- if (l == 0)
- *--p = '0';
- else if (l == LONG_MIN) {
- char minBuf[1 + sizeof(l) * 3];
- sprintf(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::from(double d)
-{
- DtoaBuffer buffer;
- unsigned length;
- doubleToStringInJavaScriptFormat(d, buffer, &length);
- return UString(buffer, length);
-}
-
-bool UString::getCString(CStringBuffer& buffer) const
-{
- unsigned length = size();
- unsigned neededSize = length + 1;
- buffer.resize(neededSize);
- char* buf = buffer.data();
-
- UChar ored = 0;
- const UChar* p = data();
- char* q = buf;
- const UChar* limit = p + length;
- while (p != limit) {
- UChar c = p[0];
- ored |= c;
- *q = static_cast<char>(c);
- ++p;
- ++q;
- }
- *q = '\0';
-
- return !(ored & 0xFF00);
-}
-
-char* UString::ascii() const
-{
- static char* asciiBuffer = 0;
-
- unsigned length = size();
- unsigned neededSize = length + 1;
- delete[] asciiBuffer;
- asciiBuffer = new char[neededSize];
-
- const UChar* p = data();
- char* q = asciiBuffer;
- const UChar* limit = p + length;
- while (p != limit) {
- *q = static_cast<char>(p[0]);
- ++p;
- ++q;
- }
- *q = '\0';
-
- return asciiBuffer;
-}
-
-bool UString::is8Bit() const
-{
- const UChar* u = data();
- const UChar* limit = u + size();
- while (u < limit) {
- if (u[0] > 0xFF)
- return false;
- ++u;
- }
-
- return true;
-}
-
-UChar UString::operator[](unsigned pos) const
-{
- if (pos >= size())
- return '\0';
- return data()[pos];
-}
-
-double UString::toDouble(bool tolerateTrailingJunk, bool tolerateEmptyString) const
-{
- if (size() == 1) {
- UChar c = data()[0];
- if (isASCIIDigit(c))
- return c - '0';
- if (isASCIISpace(c) && tolerateEmptyString)
- return 0;
- return NaN;
- }
-
- // FIXME: If tolerateTrailingJunk is true, then we want to tolerate non-8-bit junk
- // after the number, so this is too strict a check.
- CStringBuffer s;
- if (!getCString(s))
- return NaN;
- const char* c = s.data();
-
- // skip leading white space
- while (isASCIISpace(*c))
- c++;
-
- // empty string ?
- if (*c == '\0')
- return tolerateEmptyString ? 0.0 : NaN;
-
- double d;
-
- // hex number ?
- if (*c == '0' && (*(c + 1) == 'x' || *(c + 1) == 'X')) {
- const char* firstDigitPosition = c + 2;
- c++;
- d = 0.0;
- while (*(++c)) {
- if (*c >= '0' && *c <= '9')
- d = d * 16.0 + *c - '0';
- else if ((*c >= 'A' && *c <= 'F') || (*c >= 'a' && *c <= 'f'))
- d = d * 16.0 + (*c & 0xdf) - 'A' + 10.0;
- else
- break;
- }
-
- if (d >= mantissaOverflowLowerBound)
- d = parseIntOverflow(firstDigitPosition, c - firstDigitPosition, 16);
- } else {
- // regular number ?
- char* end;
- d = WTF::strtod(c, &end);
- if ((d != 0.0 || end != c) && d != Inf && d != -Inf) {
- c = end;
- } else {
- double sign = 1.0;
-
- if (*c == '+')
- c++;
- else if (*c == '-') {
- sign = -1.0;
- c++;
- }
-
- // We used strtod() to do the conversion. However, strtod() handles
- // infinite values slightly differently than JavaScript in that it
- // converts the string "inf" with any capitalization to infinity,
- // whereas the ECMA spec requires that it be converted to NaN.
-
- if (c[0] == 'I' && c[1] == 'n' && c[2] == 'f' && c[3] == 'i' && c[4] == 'n' && c[5] == 'i' && c[6] == 't' && c[7] == 'y') {
- d = sign * Inf;
- c += 8;
- } else if ((d == Inf || d == -Inf) && *c != 'I' && *c != 'i')
- c = end;
- else
- return NaN;
- }
- }
-
- // allow trailing white space
- while (isASCIISpace(*c))
- c++;
- // don't allow anything after - unless tolerant=true
- if (!tolerateTrailingJunk && *c != '\0')
- d = NaN;
-
- return d;
-}
-
-double UString::toDouble(bool tolerateTrailingJunk) const
-{
- return toDouble(tolerateTrailingJunk, true);
-}
-
-double UString::toDouble() const
-{
- return toDouble(false, true);
-}
-
-uint32_t UString::toUInt32(bool* ok) const
-{
- double d = toDouble();
- bool b = true;
-
- if (d != static_cast<uint32_t>(d)) {
- b = false;
- d = 0;
- }
-
- if (ok)
- *ok = b;
-
- return static_cast<uint32_t>(d);
-}
-
-uint32_t UString::toUInt32(bool* ok, bool tolerateEmptyString) const
-{
- double d = toDouble(false, tolerateEmptyString);
- bool b = true;
-
- if (d != static_cast<uint32_t>(d)) {
- b = false;
- d = 0;
- }
-
- if (ok)
- *ok = b;
-
- return static_cast<uint32_t>(d);
-}
-
-uint32_t UString::toStrictUInt32(bool* ok) const
-{
- if (ok)
- *ok = false;
-
- // Empty string is not OK.
- unsigned len = m_rep->length();
- if (len == 0)
- return 0;
- const UChar* p = m_rep->characters();
- unsigned short c = p[0];
-
- // If the first digit is 0, only 0 itself is OK.
- if (c == '0') {
- if (len == 1 && ok)
- *ok = true;
- return 0;
- }
-
- // Convert to UInt32, checking for overflow.
- uint32_t i = 0;
- while (1) {
- // Process character, turning it into a digit.
- if (c < '0' || c > '9')
- return 0;
- const unsigned d = c - '0';
-
- // Multiply by 10, checking for overflow out of 32 bits.
- if (i > 0xFFFFFFFFU / 10)
- return 0;
- i *= 10;
-
- // Add in the digit, checking for overflow out of 32 bits.
- const unsigned max = 0xFFFFFFFFU - d;
- if (i > max)
- return 0;
- i += d;
-
- // Handle end of string.
- if (--len == 0) {
- if (ok)
- *ok = true;
- return i;
- }
-
- // Get next character.
- c = *(++p);
- }
-}
-
-unsigned UString::find(const UString& f, unsigned pos) const
-{
- unsigned fsz = f.size();
-
- if (fsz == 1) {
- UChar ch = f[0];
- const UChar* end = data() + size();
- for (const UChar* c = data() + pos; c < end; c++) {
- if (*c == ch)
- return static_cast<unsigned>(c - data());
- }
- return NotFound;
- }
-
- unsigned sz = size();
- if (sz < fsz)
- return NotFound;
- if (fsz == 0)
- return pos;
- const UChar* end = data() + sz - fsz;
- unsigned fsizeminusone = (fsz - 1) * sizeof(UChar);
- const UChar* fdata = f.data();
- unsigned short fchar = fdata[0];
- ++fdata;
- for (const UChar* c = data() + pos; c <= end; c++) {
- if (c[0] == fchar && !memcmp(c + 1, fdata, fsizeminusone))
- return static_cast<unsigned>(c - data());
- }
-
- return NotFound;
-}
-
-unsigned UString::find(UChar ch, unsigned pos) const
-{
- const UChar* end = data() + size();
- for (const UChar* c = data() + pos; c < end; c++) {
- if (*c == ch)
- return static_cast<unsigned>(c - data());
- }
-
- return NotFound;
-}
-
-unsigned UString::rfind(const UString& f, unsigned pos) const
-{
- unsigned sz = size();
- unsigned fsz = f.size();
- if (sz < fsz)
- return NotFound;
- if (pos > sz - fsz)
- pos = sz - fsz;
- if (fsz == 0)
- return pos;
- unsigned fsizeminusone = (fsz - 1) * sizeof(UChar);
- const UChar* fdata = f.data();
- for (const UChar* c = data() + pos; c >= data(); c--) {
- if (*c == *fdata && !memcmp(c + 1, fdata + 1, fsizeminusone))
- return static_cast<unsigned>(c - data());
- }
-
- return NotFound;
-}
-
-unsigned UString::rfind(UChar ch, unsigned pos) const
-{
- if (isEmpty())
- return NotFound;
- if (pos + 1 >= size())
- pos = size() - 1;
- for (const UChar* c = data() + pos; c >= data(); c--) {
- if (*c == ch)
- return static_cast<unsigned>(c - data());
- }
-
- return NotFound;
-}
-
-UString UString::substr(unsigned pos, unsigned len) const
-{
- unsigned s = size();
-
- if (pos >= s)
- pos = s;
- unsigned limit = s - pos;
- if (len > limit)
- len = limit;
-
- if (pos == 0 && len == s)
- return *this;
-
- return UString(Rep::create(m_rep, pos, len));
-}
-
-bool operator==(const UString& s1, const char *s2)
-{
- if (s2 == 0)
- return s1.isEmpty();
-
- const UChar* u = s1.data();
- const UChar* uend = u + s1.size();
- 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.size();
- const unsigned l2 = s2.size();
- const unsigned lmin = l1 < l2 ? l1 : l2;
- const UChar* c1 = s1.data();
- const UChar* c2 = s2.data();
- 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.size();
- const unsigned l2 = s2.size();
- const unsigned lmin = l1 < l2 ? l1 : l2;
- const UChar* c1 = s1.data();
- const UChar* c2 = s2.data();
- unsigned l = 0;
- while (l < lmin && *c1 == *c2) {
- c1++;
- c2++;
- l++;
- }
- if (l < lmin)
- return (c1[0] > c2[0]);
-
- return (l1 > l2);
-}
-
-int compare(const UString& s1, const UString& s2)
-{
- const unsigned l1 = s1.size();
- const unsigned l2 = s2.size();
- const unsigned lmin = l1 < l2 ? l1 : l2;
- const UChar* c1 = s1.data();
- const UChar* c2 = s2.data();
- unsigned l = 0;
- while (l < lmin && *c1 == *c2) {
- c1++;
- c2++;
- l++;
- }
-
- if (l < lmin)
- return (c1[0] > c2[0]) ? 1 : -1;
-
- if (l1 == l2)
- return 0;
-
- return (l1 > l2) ? 1 : -1;
-}
-
-bool equal(const UString::Rep* r, const UString::Rep* b)
-{
- unsigned length = r->length();
- if (length != b->length())
- return false;
- const UChar* d = r->characters();
- const UChar* s = b->characters();
- for (unsigned i = 0; i != length; ++i) {
- if (d[i] != s[i])
- return false;
- }
- return true;
-}
-
-CString UString::UTF8String(bool strict) const
-{
- // Allocate a buffer big enough to hold all the characters.
- const unsigned length = size();
- Vector<char, 1024> buffer(length * 3);
-
- // Convert to runs of 8-bit characters.
- char* p = buffer.data();
- const UChar* d = reinterpret_cast<const UChar*>(&data()[0]);
- ConversionResult result = convertUTF16ToUTF8(&d, d + length, &p, p + buffer.size(), strict);
- if (result != conversionOK)
- return CString();
-
- return CString(buffer.data(), p - buffer.data());
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h
deleted file mode 100644
index e616201..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * 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 "Collector.h"
-#include "UStringImpl.h"
-#include <stdint.h>
-#include <string.h>
-#include <wtf/Assertions.h>
-#include <wtf/CrossThreadRefCounted.h>
-#include <wtf/OwnFastMallocPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/unicode/Unicode.h>
-
-namespace JSC {
-
- using WTF::PlacementNewAdoptType;
- using WTF::PlacementNewAdopt;
-
- class CString {
- public:
- CString()
- : m_length(0)
- , m_data(0)
- {
- }
-
- CString(const char*);
- CString(const char*, size_t);
- CString(const CString&);
-
- ~CString();
-
- static CString adopt(char*, size_t); // buffer should be allocated with new[].
-
- CString& append(const CString&);
- CString& operator=(const char* c);
- CString& operator=(const CString&);
- CString& operator+=(const CString& c) { return append(c); }
-
- size_t size() const { return m_length; }
- const char* c_str() const { return m_data; }
-
- private:
- size_t m_length;
- char* m_data;
- };
-
- bool operator==(const CString&, const CString&);
-
- typedef Vector<char, 32> CStringBuffer;
-
- class UString {
- friend class JIT;
-
- public:
- typedef UStringImpl Rep;
-
- public:
- UString();
- UString(const char*); // Constructor for null-terminated string.
- UString(const char*, unsigned length);
- UString(const UChar*, unsigned length);
- UString(const Vector<UChar>& buffer);
-
- UString(const UString& s)
- : m_rep(s.m_rep)
- {
- }
-
- // Special constructor for cases where we overwrite an object in place.
- UString(PlacementNewAdoptType)
- : m_rep(PlacementNewAdopt)
- {
- }
-
- ~UString()
- {
- }
-
- template<size_t inlineCapacity>
- static PassRefPtr<UStringImpl> adopt(Vector<UChar, inlineCapacity>& vector)
- {
- return Rep::adopt(vector);
- }
-
- static UString from(int);
- static UString from(long long);
- static UString from(unsigned);
- static UString from(long);
- static UString from(double);
-
- bool getCString(CStringBuffer&) const;
-
- // NOTE: This method should only be used for *debugging* purposes as it
- // is neither Unicode safe nor free from side effects nor thread-safe.
- char* ascii() const;
-
- /**
- * Convert the string to UTF-8, assuming it is UTF-16 encoded.
- * In non-strict mode, this function is tolerant of badly formed UTF-16, it
- * can create UTF-8 strings that are invalid because they have characters in
- * the range U+D800-U+DDFF, U+FFFE, or U+FFFF, but the UTF-8 string is
- * guaranteed to be otherwise valid.
- * In strict mode, error is returned as null CString.
- */
- CString UTF8String(bool strict = false) const;
-
- const UChar* data() const { return m_rep->characters(); }
-
- bool isNull() const { return m_rep == s_nullRep; }
- bool isEmpty() const { return !m_rep->length(); }
-
- bool is8Bit() const;
-
- unsigned size() const { return m_rep->length(); }
-
- UChar operator[](unsigned pos) const;
-
- double toDouble(bool tolerateTrailingJunk, bool tolerateEmptyString) const;
- double toDouble(bool tolerateTrailingJunk) const;
- double toDouble() const;
-
- uint32_t toUInt32(bool* ok = 0) const;
- uint32_t toUInt32(bool* ok, bool tolerateEmptyString) const;
- uint32_t toStrictUInt32(bool* ok = 0) const;
-
- unsigned toArrayIndex(bool* ok = 0) const;
-
- static const unsigned NotFound = 0xFFFFFFFFu;
- unsigned find(const UString& f, unsigned pos = 0) const;
- unsigned find(UChar, unsigned pos = 0) const;
- unsigned rfind(const UString& f, unsigned pos) const;
- unsigned rfind(UChar, unsigned pos) const;
-
- UString substr(unsigned pos = 0, unsigned len = 0xFFFFFFFF) const;
-
- static const UString& null() { return *s_nullUString; }
-
- Rep* rep() const { return m_rep.get(); }
-
- UString(PassRefPtr<Rep> r)
- : m_rep(r)
- {
- ASSERT(m_rep);
- }
-
- size_t cost() const { return m_rep->cost(); }
-
- private:
- RefPtr<Rep> m_rep;
-
- JS_EXPORTDATA static Rep* s_nullRep;
- static UString* s_nullUString;
-
- friend void initializeUString();
- friend bool operator==(const UString&, const UString&);
- };
-
- ALWAYS_INLINE bool operator==(const UString& s1, const UString& s2)
- {
- unsigned size = s1.size();
- switch (size) {
- case 0:
- return !s2.size();
- case 1:
- return s2.size() == 1 && s1.data()[0] == s2.data()[0];
- case 2: {
- if (s2.size() != 2)
- return false;
- const UChar* d1 = s1.data();
- const UChar* d2 = s2.data();
- return (d1[0] == d2[0]) & (d1[1] == d2[1]);
- }
- default:
- return s2.size() == size && memcmp(s1.data(), s2.data(), size * 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);
- }
-
- int compare(const UString&, const UString&);
-
- inline UString::UString()
- : m_rep(s_nullRep)
- {
- }
-
- // 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 UString::toArrayIndex(bool* ok) const
- {
- unsigned i = toStrictUInt32(ok);
- if (ok && i >= 0xFFFFFFFFU)
- *ok = false;
- return i;
- }
-
- // We'd rather not do shared substring append for small strings, since
- // this runs too much risk of a tiny initial string holding down a
- // huge buffer.
- static const unsigned minShareSize = Heap::minExtraCost / sizeof(UChar);
-
- struct IdentifierRepHash : PtrHash<RefPtr<JSC::UString::Rep> > {
- static unsigned hash(const RefPtr<JSC::UString::Rep>& key) { return key->existingHash(); }
- static unsigned hash(JSC::UString::Rep* key) { return key->existingHash(); }
- };
-
- void initializeUString();
-
- template<typename StringType>
- class StringTypeAdapter {
- };
-
- template<>
- class StringTypeAdapter<char*> {
- public:
- StringTypeAdapter<char*>(char* buffer)
- : m_buffer((unsigned char*)buffer)
- , m_length(strlen(buffer))
- {
- }
-
- unsigned length() { return m_length; }
-
- void writeTo(UChar* destination)
- {
- for (unsigned i = 0; i < m_length; ++i)
- destination[i] = m_buffer[i];
- }
-
- private:
- const unsigned char* m_buffer;
- unsigned m_length;
- };
-
- template<>
- class StringTypeAdapter<const char*> {
- public:
- StringTypeAdapter<const char*>(const char* buffer)
- : m_buffer((unsigned char*)buffer)
- , m_length(strlen(buffer))
- {
- }
-
- unsigned length() { return m_length; }
-
- void writeTo(UChar* destination)
- {
- for (unsigned i = 0; i < m_length; ++i)
- destination[i] = m_buffer[i];
- }
-
- private:
- const unsigned char* m_buffer;
- unsigned m_length;
- };
-
- template<>
- class StringTypeAdapter<UString> {
- public:
- StringTypeAdapter<UString>(UString& string)
- : m_data(string.data())
- , m_length(string.size())
- {
- }
-
- 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;
- };
-
- 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<UStringImpl> 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<UStringImpl> resultImpl = UStringImpl::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<UStringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3)
- {
- StringTypeAdapter<StringType1> adapter1(string1);
- StringTypeAdapter<StringType2> adapter2(string2);
- StringTypeAdapter<StringType3> adapter3(string3);
-
- UChar* buffer;
- bool overflow = false;
- unsigned length = adapter1.length();
- sumWithOverflow(length, adapter2.length(), overflow);
- sumWithOverflow(length, adapter3.length(), overflow);
- if (overflow)
- return 0;
- PassRefPtr<UStringImpl> resultImpl = UStringImpl::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<UStringImpl> 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<UStringImpl> resultImpl = UStringImpl::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<UStringImpl> 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<UStringImpl> resultImpl = UStringImpl::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<UStringImpl> 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<UStringImpl> resultImpl = UStringImpl::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<UStringImpl> 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<UStringImpl> resultImpl = UStringImpl::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<UStringImpl> 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<UStringImpl> resultImpl = UStringImpl::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;
- }
-
- template<typename StringType1, typename StringType2>
- UString makeString(StringType1 string1, StringType2 string2)
- {
- PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2);
- if (!resultImpl)
- CRASH();
- return resultImpl;
- }
-
- template<typename StringType1, typename StringType2, typename StringType3>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3)
- {
- PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3);
- if (!resultImpl)
- CRASH();
- return resultImpl;
- }
-
- template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
- {
- PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3, string4);
- if (!resultImpl)
- CRASH();
- return resultImpl;
- }
-
- template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
- {
- PassRefPtr<UStringImpl> 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>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
- {
- PassRefPtr<UStringImpl> 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>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
- {
- PassRefPtr<UStringImpl> 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>
- UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
- {
- PassRefPtr<UStringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8);
- if (!resultImpl)
- CRASH();
- return resultImpl;
- }
-
-} // namespace JSC
-
-namespace WTF {
-
- template<typename T> struct DefaultHash;
- template<typename T> struct StrHash;
-
- template<> struct StrHash<JSC::UString::Rep*> {
- static unsigned hash(const JSC::UString::Rep* key) { return key->hash(); }
- static bool equal(const JSC::UString::Rep* a, const JSC::UString::Rep* b) { return JSC::equal(a, b); }
- static const bool safeToCompareToEmptyOrDeleted = false;
- };
-
- template<> struct StrHash<RefPtr<JSC::UString::Rep> > : public StrHash<JSC::UString::Rep*> {
- using StrHash<JSC::UString::Rep*>::hash;
- static unsigned hash(const RefPtr<JSC::UString::Rep>& key) { return key->hash(); }
- using StrHash<JSC::UString::Rep*>::equal;
- static bool equal(const RefPtr<JSC::UString::Rep>& a, const RefPtr<JSC::UString::Rep>& b) { return JSC::equal(a.get(), b.get()); }
- static bool equal(const JSC::UString::Rep* a, const RefPtr<JSC::UString::Rep>& b) { return JSC::equal(a, b.get()); }
- static bool equal(const RefPtr<JSC::UString::Rep>& a, const JSC::UString::Rep* b) { return JSC::equal(a.get(), b); }
-
- static const bool safeToCompareToEmptyOrDeleted = false;
- };
-
- template<> struct DefaultHash<JSC::UString::Rep*> {
- typedef StrHash<JSC::UString::Rep*> Hash;
- };
-
- template<> struct DefaultHash<RefPtr<JSC::UString::Rep> > {
- typedef StrHash<RefPtr<JSC::UString::Rep> > Hash;
-
- };
-
-} // namespace WTF
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp
deleted file mode 100644
index aba63ad..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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 "UStringImpl.h"
-
-#include "Identifier.h"
-#include "StdLibExtras.h"
-#include "UString.h"
-#include <wtf/unicode/UTF8.h>
-
-using namespace WTF::Unicode;
-using namespace std;
-
-namespace JSC {
-
-static const unsigned minLengthToShare = 20;
-
-UStringImpl::~UStringImpl()
-{
- ASSERT(!isStatic());
-
- if (isIdentifier())
- Identifier::remove(this);
-
- 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();
- }
- }
-}
-
-UStringImpl* UStringImpl::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(UStringImpl, emptyString, (&emptyUCharData, 0, ConstructStaticString));
- return &emptyString;
-}
-
-PassRefPtr<UStringImpl> UStringImpl::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<size_t>::max() - sizeof(UStringImpl)) / sizeof(UChar)))
- CRASH();
- size_t size = sizeof(UStringImpl) + length * sizeof(UChar);
- UStringImpl* string = static_cast<UStringImpl*>(fastMalloc(size));
-
- data = reinterpret_cast<UChar*>(string + 1);
- return adoptRef(new (string) UStringImpl(length));
-}
-
-PassRefPtr<UStringImpl> UStringImpl::create(const UChar* characters, unsigned length)
-{
- if (!characters || !length)
- return empty();
-
- UChar* data;
- PassRefPtr<UStringImpl> string = createUninitialized(length, data);
- memcpy(data, characters, length * sizeof(UChar));
- return string;
-}
-
-PassRefPtr<UStringImpl> UStringImpl::create(const char* characters, unsigned length)
-{
- if (!characters || !length)
- return empty();
-
- UChar* data;
- PassRefPtr<UStringImpl> string = createUninitialized(length, data);
- for (unsigned i = 0; i != length; ++i) {
- unsigned char c = characters[i];
- data[i] = c;
- }
- return string;
-}
-
-PassRefPtr<UStringImpl> UStringImpl::create(const char* string)
-{
- if (!string)
- return empty();
- return create(string, strlen(string));
-}
-
-PassRefPtr<UStringImpl> UStringImpl::create(PassRefPtr<SharedUChar> sharedBuffer, const UChar* buffer, unsigned length)
-{
- if (!length)
- return empty();
- return adoptRef(new UStringImpl(buffer, length, sharedBuffer));
-}
-
-SharedUChar* UStringImpl::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)).releaseRef();
- m_refCountAndFlags = (m_refCountAndFlags & ~s_refCountMaskBufferOwnership) | BufferShared;
- }
-
- ASSERT(bufferOwnership() == BufferShared);
- ASSERT(m_sharedBuffer);
- return m_sharedBuffer;
-}
-
-void URopeImpl::derefFibersNonRecursive(Vector<URopeImpl*, 32>& workQueue)
-{
- unsigned length = fiberCount();
- for (unsigned i = 0; i < length; ++i) {
- Fiber& fiber = fibers(i);
- if (fiber->isRope()) {
- URopeImpl* nextRope = static_cast<URopeImpl*>(fiber);
- if (nextRope->hasOneRef())
- workQueue.append(nextRope);
- else
- nextRope->deref();
- } else
- static_cast<UStringImpl*>(fiber)->deref();
- }
-}
-
-void URopeImpl::destructNonRecursive()
-{
- Vector<URopeImpl*, 32> workQueue;
-
- derefFibersNonRecursive(workQueue);
- delete this;
-
- while (!workQueue.isEmpty()) {
- URopeImpl* rope = workQueue.last();
- workQueue.removeLast();
- rope->derefFibersNonRecursive(workQueue);
- delete rope;
- }
-}
-
-} // namespace JSC
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h
deleted file mode 100644
index 065443a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * 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 UStringImpl_h
-#define UStringImpl_h
-
-#include <limits>
-#include <wtf/CrossThreadRefCounted.h>
-#include <wtf/OwnFastMallocPtr.h>
-#include <wtf/PossiblyNull.h>
-#include <wtf/StringHashFunctions.h>
-#include <wtf/Vector.h>
-#include <wtf/unicode/Unicode.h>
-
-namespace JSC {
-
-class IdentifierTable;
-
-typedef OwnFastMallocPtr<const UChar> SharableUChar;
-typedef CrossThreadRefCounted<SharableUChar> SharedUChar;
-
-class UStringOrRopeImpl : public Noncopyable {
-public:
- bool isRope() { return (m_refCountAndFlags & s_refCountIsRope) == s_refCountIsRope; }
- unsigned length() const { return m_length; }
-
- void ref() { m_refCountAndFlags += s_refCountIncrement; }
- inline void deref();
-
-protected:
- enum BufferOwnership {
- BufferInternal,
- BufferOwned,
- BufferSubstring,
- BufferShared,
- };
-
- using Noncopyable::operator new;
-
- // For SmallStringStorage, which allocates an array and uses an in-place new.
- UStringOrRopeImpl() { }
-
- UStringOrRopeImpl(unsigned length, BufferOwnership ownership)
- : m_refCountAndFlags(s_refCountIncrement | s_refCountFlagShouldReportedCost | ownership)
- , m_length(length)
- {
- ASSERT(!isRope());
- }
-
- enum StaticStringConstructType { ConstructStaticString };
- UStringOrRopeImpl(unsigned length, StaticStringConstructType)
- : m_refCountAndFlags(s_refCountFlagStatic | s_refCountFlagIsIdentifier | BufferOwned)
- , m_length(length)
- {
- ASSERT(!isRope());
- }
-
- enum RopeConstructType { ConstructRope };
- UStringOrRopeImpl(RopeConstructType)
- : m_refCountAndFlags(s_refCountIncrement | s_refCountIsRope)
- , m_length(0)
- {
- ASSERT(isRope());
- }
-
- // The bottom 5 bits hold flags, the top 27 bits hold the ref count.
- // When dereferencing UStringImpls we check for the ref count AND the
- // static bit both being zero - static strings are never deleted.
- static const unsigned s_refCountMask = 0xFFFFFFE0;
- static const unsigned s_refCountIncrement = 0x20;
- static const unsigned s_refCountFlagStatic = 0x10;
- static const unsigned s_refCountFlagShouldReportedCost = 0x8;
- static const unsigned s_refCountFlagIsIdentifier = 0x4;
- static const unsigned s_refCountMaskBufferOwnership = 0x3;
- // Use an otherwise invalid permutation of flags (static & shouldReportedCost -
- // static strings do not set shouldReportedCost in the constructor, and this bit
- // is only ever cleared, not set) to identify objects that are ropes.
- static const unsigned s_refCountIsRope = s_refCountFlagStatic | s_refCountFlagShouldReportedCost;
-
- unsigned m_refCountAndFlags;
- unsigned m_length;
-};
-
-class UStringImpl : public UStringOrRopeImpl {
- friend class CStringTranslator;
- friend class UCharBufferTranslator;
- friend class JIT;
- friend class SmallStringsStorage;
- friend class UStringOrRopeImpl;
- friend void initializeUString();
-private:
- // For SmallStringStorage, which allocates an array and uses an in-place new.
- UStringImpl() { }
-
- // 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.
- UStringImpl(const UChar* characters, unsigned length, StaticStringConstructType)
- : UStringOrRopeImpl(length, ConstructStaticString)
- , m_data(characters)
- , m_buffer(0)
- , m_hash(0)
- {
- hash();
- }
-
- // Create a normal string with internal storage (BufferInternal)
- UStringImpl(unsigned length)
- : UStringOrRopeImpl(length, BufferInternal)
- , m_data(reinterpret_cast<UChar*>(this + 1))
- , m_buffer(0)
- , m_hash(0)
- {
- ASSERT(m_data);
- ASSERT(m_length);
- }
-
- // Create a UStringImpl adopting ownership of the provided buffer (BufferOwned)
- UStringImpl(const UChar* characters, unsigned length)
- : UStringOrRopeImpl(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 UStringImpl (BufferSubstring)
- UStringImpl(const UChar* characters, unsigned length, PassRefPtr<UStringImpl> base)
- : UStringOrRopeImpl(length, BufferSubstring)
- , m_data(characters)
- , m_substringBuffer(base.releaseRef())
- , m_hash(0)
- {
- ASSERT(m_data);
- ASSERT(m_length);
- ASSERT(m_substringBuffer->bufferOwnership() != BufferSubstring);
- }
-
- // Used to construct new strings sharing an existing SharedUChar (BufferShared)
- UStringImpl(const UChar* characters, unsigned length, PassRefPtr<SharedUChar> sharedBuffer)
- : UStringOrRopeImpl(length, BufferShared)
- , m_data(characters)
- , m_sharedBuffer(sharedBuffer.releaseRef())
- , m_hash(0)
- {
- ASSERT(m_data);
- ASSERT(m_length);
- }
-
- // For use only by Identifier's XXXTranslator helpers.
- void setHash(unsigned hash)
- {
- ASSERT(!isStatic());
- ASSERT(!m_hash);
- ASSERT(hash == computeHash(m_data, m_length));
- m_hash = hash;
- }
-
-public:
- ~UStringImpl();
-
- static PassRefPtr<UStringImpl> create(const UChar*, unsigned length);
- static PassRefPtr<UStringImpl> create(const char*, unsigned length);
- static PassRefPtr<UStringImpl> create(const char*);
- static PassRefPtr<UStringImpl> create(PassRefPtr<SharedUChar>, const UChar*, unsigned length);
- static PassRefPtr<UStringImpl> create(PassRefPtr<UStringImpl> rep, unsigned offset, unsigned length)
- {
- ASSERT(rep);
- ASSERT(length <= rep->length());
-
- if (!length)
- return empty();
-
- UStringImpl* ownerRep = (rep->bufferOwnership() == BufferSubstring) ? rep->m_substringBuffer : rep.get();
- return adoptRef(new UStringImpl(rep->m_data + offset, length, ownerRep));
- }
-
- static PassRefPtr<UStringImpl> createUninitialized(unsigned length, UChar*& output);
- static PassRefPtr<UStringImpl> tryCreateUninitialized(unsigned length, UChar*& output)
- {
- if (!length) {
- output = 0;
- return empty();
- }
-
- if (length > ((std::numeric_limits<size_t>::max() - sizeof(UStringImpl)) / sizeof(UChar)))
- return 0;
- UStringImpl* resultImpl;
- if (!tryFastMalloc(sizeof(UChar) * length + sizeof(UStringImpl)).getValue(resultImpl))
- return 0;
- output = reinterpret_cast<UChar*>(resultImpl + 1);
- return adoptRef(new(resultImpl) UStringImpl(length));
- }
-
- template<size_t inlineCapacity>
- static PassRefPtr<UStringImpl> adopt(Vector<UChar, inlineCapacity>& vector)
- {
- if (size_t size = vector.size()) {
- ASSERT(vector.data());
- return adoptRef(new UStringImpl(vector.releaseBuffer(), size));
- }
- return empty();
- }
-
- 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;
- }
-
- 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::stringHash(data, length); }
- static unsigned computeHash(const char* data, unsigned length) { return WTF::stringHash(data, length); }
- static unsigned computeHash(const char* data) { return WTF::stringHash(data); }
-
- ALWAYS_INLINE void deref() { m_refCountAndFlags -= s_refCountIncrement; if (!(m_refCountAndFlags & (s_refCountMask | s_refCountFlagStatic))) delete this; }
-
- static UStringImpl* 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));
- }
-
-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;
-
- 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;
- UStringImpl* m_substringBuffer;
- SharedUChar* m_sharedBuffer;
- };
- mutable unsigned m_hash;
-};
-
-class URopeImpl : public UStringOrRopeImpl {
- friend class UStringOrRopeImpl;
-public:
- // A URopeImpl is composed from a set of smaller strings called Fibers.
- // Each Fiber in a rope is either UStringImpl or another URopeImpl.
- typedef UStringOrRopeImpl* Fiber;
-
- // Creates a URopeImpl comprising of 'fiberCount' Fibers.
- // The URopeImpl is constructed in an uninitialized state - initialize must be called for each Fiber in the URopeImpl.
- static PassRefPtr<URopeImpl> tryCreateUninitialized(unsigned fiberCount)
- {
- void* allocation;
- if (tryFastMalloc(sizeof(URopeImpl) + (fiberCount - 1) * sizeof(Fiber)).getValue(allocation))
- return adoptRef(new (allocation) URopeImpl(fiberCount));
- return 0;
- }
-
- void initializeFiber(unsigned &index, Fiber fiber)
- {
- m_fibers[index++] = fiber;
- fiber->ref();
- m_length += fiber->length();
- }
-
- unsigned fiberCount() { return m_fiberCount; }
- Fiber& fibers(unsigned index) { return m_fibers[index]; }
-
- ALWAYS_INLINE void deref() { m_refCountAndFlags -= s_refCountIncrement; if (!(m_refCountAndFlags & s_refCountMask)) destructNonRecursive(); }
-
-private:
- URopeImpl(unsigned fiberCount) : UStringOrRopeImpl(ConstructRope), m_fiberCount(fiberCount) {}
-
- void destructNonRecursive();
- void derefFibersNonRecursive(Vector<URopeImpl*, 32>& workQueue);
-
- bool hasOneRef() { return (m_refCountAndFlags & s_refCountMask) == s_refCountIncrement; }
-
- unsigned m_fiberCount;
- Fiber m_fibers[1];
-};
-
-inline void UStringOrRopeImpl::deref()
-{
- if (isRope())
- static_cast<URopeImpl*>(this)->deref();
- else
- static_cast<UStringImpl*>(this)->deref();
-}
-
-bool equal(const UStringImpl*, const UStringImpl*);
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h
deleted file mode 100644
index 39a91c5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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(); }
-
- 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/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h
deleted file mode 100644
index 5f58374..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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 <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); }
-
- T* get() const
- {
- if (!m_ptr || !Heap::isCellMarked(m_ptr))
- return 0;
- return m_ptr;
- }
-
- void clear(JSCell* ptr)
- {
- if (ptr == m_ptr)
- m_ptr = 0;
- }
-
- 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 T* 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(T* ptr)
- {
- if (ptr)
- Heap::markCell(ptr);
- m_ptr = ptr;
- }
-
- T* 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* getPtr(const WeakGCPtr<T>& p)
-{
- return p.get();
-}
-
-} // namespace JSC
-
-#endif // WeakGCPtr_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wscript b/src/3rdparty/webkit/JavaScriptCore/wscript
deleted file mode 100644
index 61ad1fb..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wscript
+++ /dev/null
@@ -1,106 +0,0 @@
-#! /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 = ['jsc.cpp', 'ucptable.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 building_on_win32:
- jscore_excludes += ['ExecutableAllocatorPosix.cpp', 'MarkStackPosix.cpp', 'ThreadingPthreads.cpp']
- sources += ['jit/ExecutableAllocatorWin.cpp', 'runtime/MarkStackWin.cpp']
-else:
- jscore_excludes.append('JSStringRefBSTR.cpp')
- jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp']))
-
-def generate_jscore_derived_sources():
- # build the derived sources
- js_dir = jscore_dir
- if building_on_win32:
- js_dir = get_output('cygpath --unix "%s"' % js_dir)
- derived_sources_dir = os.path.join(jscore_dir, 'DerivedSources')
- if not os.path.exists(derived_sources_dir):
- os.mkdir(derived_sources_dir)
-
- olddir = os.getcwd()
- os.chdir(derived_sources_dir)
-
- command = 'make -f %s/DerivedSources.make JavaScriptCore=%s BUILT_PRODUCTS_DIR=%s all FEATURE_DEFINES="%s"' % (js_dir, js_dir, js_dir, ' '.join(feature_defines))
- os.system(command)
- os.chdir(olddir)
-
-def set_options(opt):
- common_set_options(opt)
-
-def configure(conf):
- common_configure(conf)
- generate_jscore_derived_sources()
-
-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,
- )
-
- # we'll get an error if exceptions are on because of an unwind error when using __try
- if building_on_win32:
- flags = obj.env.CXXFLAGS
- flags.remove('/EHsc')
- obj.env.CXXFLAGS = flags
-
- bld.install_files(os.path.join(output_dir, 'JavaScriptCore'), 'API/*.h')
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ASCIICType.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ASCIICType.h
deleted file mode 100644
index b43bb37..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ASCIICType.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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 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 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 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 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 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 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 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'; }
-
- /*
- 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 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 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 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 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 <= '~'; }
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/wtf/AVLTree.h b/src/3rdparty/webkit/JavaScriptCore/wtf/AVLTree.h
deleted file mode 100644
index d7470e7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/AVLTree.h
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- * 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"
-
-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:
- bool m_data[maxDepth];
-};
-
-// 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/src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h b/src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h
deleted file mode 100644
index ce27df6..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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 COMPILER(GCC)
-#define UNLIKELY(x) __builtin_expect((x), 0)
-#else
-#define UNLIKELY(x) (x)
-#endif
-#endif
-
-#ifndef LIKELY
-#if COMPILER(GCC)
-#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(RVCT)
-#define NO_RETURN __declspec(noreturn)
-#else
-#define NO_RETURN
-#endif
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp
deleted file mode 100644
index cadbc91..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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)
-#ifndef WINVER
-#define WINVER 0x0500
-#endif
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-#endif
-#include <windows.h>
-#include <crtdbg.h>
-#endif
-
-#if OS(WINCE)
-#include <winbase.h>
-#endif
-
-extern "C" {
-
-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 COMPILER(MSVC) && !defined(WINCEBASIC)
- 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/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
deleted file mode 100644
index 8b6d09a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * 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"
-
-#if COMPILER(MSVC)
-#include <stddef.h>
-#else
-#include <inttypes.h>
-#endif
-
-#if OS(SYMBIAN)
-#include <e32def.h>
-#include <e32debug.h>
-#endif
-
-#ifdef NDEBUG
-#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 -- gets us into the debugger or the crash reporter -- signals are ignored by the crash reporter so we must do better */
-
-#ifndef CRASH
-#if OS(SYMBIAN)
-#define CRASH() do { \
- __DEBUGGER(); \
- User::Panic(_L("Webkit CRASH"),0); \
- } 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 */
-
-#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)
-#define ASSERT_UNUSED(variable, assertion) ((void)variable)
-
-#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/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.cpp
deleted file mode 100644
index 526f147..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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"
-
-namespace WTF {
-
-PassRefPtr<ByteArray> ByteArray::create(size_t size)
-{
- unsigned char* buffer = new unsigned char[size + sizeof(ByteArray) - sizeof(size_t)];
- ASSERT((reinterpret_cast<size_t>(buffer) & 3) == 0);
- return adoptRef(new (buffer) ByteArray(size));
-}
-
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h
deleted file mode 100644
index f5f5ded..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 <wtf/PassRefPtr.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;
- unsigned char m_data[sizeof(size_t)];
- };
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h
deleted file mode 100644
index cfd1d20..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 Complex_h
-#define Complex_h
-
-#include <complex>
-#include <wtf/MathExtras.h>
-
-namespace WebCore {
-
-typedef std::complex<double> Complex;
-
-inline Complex complexFromMagnitudePhase(double magnitude, double phase)
-{
- return Complex(magnitude * cos(phase), magnitude * sin(phase));
-}
-
-} // namespace WebCore
-
-#endif // Complex_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h b/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h
deleted file mode 100644
index f682f0d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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 CrossThreadRefCounted_h
-#define CrossThreadRefCounted_h
-
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/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
- {
- }
-
- ~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/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp
deleted file mode 100644
index 30ca7c3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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(CF)
-#include <CoreFoundation/CFDate.h>
-#elif PLATFORM(GTK)
-#include <glib.h>
-#elif PLATFORM(WX)
-#include <wx/datetime.h>
-#elif PLATFORM(BREWMP)
-#include <AEEStdLib.h>
-#else // Posix systems relying on the gettimeofday()
-#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 bool started;
- 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(CF)
-
-double currentTime()
-{
- return CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970;
-}
-
-#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 // Other Posix systems rely on the gettimeofday().
-
-double currentTime()
-{
- struct timeval now;
- struct timezone zone;
-
- gettimeofday(&now, &zone);
- return static_cast<double>(now.tv_sec) + (double)(now.tv_usec / 1000000.0);
-}
-
-#endif
-
-} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h
deleted file mode 100644
index dcb1f6c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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::getLocalTime;
-
-#endif // CurrentTime_h
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp
deleted file mode 100644
index b9a0207..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp
+++ /dev/null
@@ -1,996 +0,0 @@
-/*
- * 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.
- *
- * The Original 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 "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;
-}
-
-static 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
-static 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, int 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;
-}
-
-// 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 (int i = 0; i < int(sizeof(known_zones) / sizeof(KnownZone)); 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 = NULL;
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h
deleted file mode 100644
index 033d25e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * 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 DateMath_h
-#define DateMath_h
-
-#include <math.h>
-#include <string.h>
-#include <time.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/Noncopyable.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 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);
-
-} // namespace WTF
-
-using WTF::dateToDaysFrom1970;
-using WTF::dayInMonthFromDayInYear;
-using WTF::dayInYear;
-using WTF::minutesPerHour;
-using WTF::monthFromDayInYear;
-using WTF::msPerDay;
-using WTF::msPerSecond;
-using WTF::msToYear;
-using WTF::secondsPerMinute;
-
-#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()
- {
- delete [] timeZone;
- }
-
- 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 = new char[inZoneSize];
- strncpy(timeZone, inTm.tm_zone, inZoneSize);
-#else
- timeZone = 0;
-#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;
-#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) + 1;
- timeZone = new char[inZoneSize];
- strncpy(timeZone, rhs.timeZone, inZoneSize);
- } else
- timeZone = 0;
- }
-
- int second;
- int minute;
- int hour;
- int weekDay;
- int monthDay;
- int yearDay;
- int month;
- int year;
- int isDST;
- int utcOffset;
- char* timeZone;
-};
-
-static inline int gmtoffset(const GregorianDateTime& t)
-{
- return t.utcOffset;
-}
-} // namespace JSC
-#endif // USE(JSC)
-
-#endif // DateMath_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Deque.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Deque.h
deleted file mode 100644
index 3c3d378..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Deque.h
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * 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]; }
-
- 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> 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/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h
deleted file mode 100644
index 81b1de0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * 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 {
-
- class FastAllocBase {
- public:
- // Placement operator new.
- 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 = fastMalloc(size);
- fastMallocMatchValidateMalloc(p, Internal::AllocTypeClassNew);
- return p;
- }
-
- void operator delete(void* p)
- {
- fastMallocMatchValidateFree(p, Internal::AllocTypeClassNew);
- fastFree(p);
- }
-
- void* operator new[](size_t size)
- {
- void* p = fastMalloc(size);
- fastMallocMatchValidateMalloc(p, Internal::AllocTypeClassNewArray);
- return p;
- }
-
- void operator delete[](void* p)
- {
- fastMallocMatchValidateFree(p, Internal::AllocTypeClassNewArray);
- fastFree(p);
- }
- };
-
- // 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/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
deleted file mode 100644
index e7d9efa..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
+++ /dev/null
@@ -1,4494 +0,0 @@
-// 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
-
-#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 COMPILER(MSVC)
-#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 COMPILER(MSVC)
- 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 <errno.h>
-#include <limits>
-#include <pthread.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#if OS(UNIX)
-#include <unistd.h>
-#endif
-#if COMPILER(MSVC)
-#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();
-
- *(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 free committed pages that we want to keep around.
-static const size_t kMinimumFreeCommittedPageCount = 512;
-
-#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 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()
-{
- pthread_mutex_init(&m_scavengeMutex, 0);
- 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()
-{
- 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()
-{
- 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);
-
- for (int i = kMaxPages; i >= 0 && free_committed_pages_ > targetPageCount; i--) {
- SpanList* slist = (static_cast<size_t>(i) == kMaxPages) ? &large_ : &free_[i];
- while (!DLL_IsEmpty(&slist->normal) && free_committed_pages_ > targetPageCount) {
- 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 (result->decommitted) {
- TCMalloc_SystemCommit(reinterpret_cast<void*>(result->start << kPageShift), static_cast<size_t>(n << kPageShift));
- result->decommitted = false;
- }
-#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
- else {
- // 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 (best->decommitted) {
- TCMalloc_SystemCommit(reinterpret_cast<void*>(best->start << kPageShift), static_cast<size_t>(n << kPageShift));
- best->decommitted = false;
- }
-#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
- else {
- // 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;
-}
-
-static ALWAYS_INLINE void propagateDecommittedState(Span* destination, Span* source)
-{
- destination->decommitted = source->decommitted;
-}
-
-inline void TCMalloc_PageHeap::Carve(Span* span, Length n, bool released) {
- ASSERT(n > 0);
- DLL_Remove(span);
- span->free = 0;
- Event(span, 'A', n);
-
- 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;
- propagateDecommittedState(leftover, span);
- 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 = released ? &listpair->returned : &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 COMPILER(MSVC)
- 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_; }
-
- void* Allocate(size_t size);
- void Deallocate(void* ptr, size_t size_class);
-
- 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_.
- void ReleaseToSpans(void* object);
-
- // REQUIRES: lock_ is held
- // Populate cache by fetching from the page heap.
- // May temporarily release lock_.
- 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 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 void* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(void*) - 1) / sizeof(void*)];
-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 COMPILER(MSVC)
-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 COMPILER(MSVC)
- 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) {
- MESSAGE("allocation failed: %d\n", errno);
- 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<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 COMPILER(MSVC)
- 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 COMPILER(MSVC)
- tlsIndex = TlsAlloc();
-#endif
- tsd_inited = true;
-
-#if !COMPILER(MSVC)
- // 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 COMPILER(MSVC)
- 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 COMPILER(MSVC)
- 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 COMPILER(MSVC)
- 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;
- pthread_setspecific(heap_key, 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>
-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>
-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>
-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) && !OS(IPHONE_OS)
- , 0 // zone_locked will not be called on the zone unless it advertises itself as version five 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/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h
deleted file mode 100644
index 9f82275..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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::fastMalloc;
-using WTF::fastZeroedMalloc;
-using WTF::fastCalloc;
-using WTF::fastRealloc;
-using WTF::tryFastMalloc;
-using WTF::tryFastZeroedMalloc;
-using WTF::tryFastCalloc;
-using WTF::tryFastRealloc;
-using WTF::fastFree;
-using WTF::fastStrDup;
-
-#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)
-
-// 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/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h
deleted file mode 100644
index 448de7d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Forward.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2006, 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_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 PassOwnPtr;
- template<typename T> class PassRefPtr;
- template<typename T> class RefPtr;
- template<typename T, size_t inlineCapacity> class Vector;
-}
-
-using WTF::ListRefPtr;
-using WTF::OwnArrayPtr;
-using WTF::OwnPtr;
-using WTF::PassOwnPtr;
-using WTF::PassRefPtr;
-using WTF::RefPtr;
-using WTF::Vector;
-
-#endif // WTF_Forward_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h
deleted file mode 100644
index 4ed75c5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashCountedSet.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/HashIterators.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashIterators.h
deleted file mode 100644
index 682c83b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashIterators.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h
deleted file mode 100644
index 4631055..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * 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 TYPE, typename HashTranslator> iterator find(const TYPE&);
- template<typename TYPE, typename HashTranslator> const_iterator find(const TYPE&) const;
- template<typename TYPE, typename HashTranslator> bool contains(const TYPE&) 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 TYPE, typename HashTranslator> pair<iterator, bool> add(const TYPE&, 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/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h
deleted file mode 100644
index 4429490..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * 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 HashTableIteratorAdapter<HashTableType, ValueType> iterator;
- typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
-
- void swap(HashSet&);
-
- 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;
-
- // 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;
-
- // 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()
- {
- return m_impl.begin();
- }
-
- template<typename T, typename U, typename V>
- inline typename HashSet<T, U, V>::iterator HashSet<T, U, V>::end()
- {
- return m_impl.end();
- }
-
- template<typename T, typename U, typename V>
- inline typename HashSet<T, U, V>::const_iterator HashSet<T, U, V>::begin() const
- {
- return m_impl.begin();
- }
-
- template<typename T, typename U, typename V>
- inline typename HashSet<T, U, V>::const_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)
- {
- return m_impl.find(value);
- }
-
- template<typename T, typename U, typename V>
- inline typename HashSet<T, U, V>::const_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)
- {
- 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>
- typename HashSet<Value, HashFunctions, Traits>::const_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/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h
deleted file mode 100644
index ceb8963..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h
+++ /dev/null
@@ -1,1169 +0,0 @@
-/*
- * 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 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>::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/src/3rdparty/webkit/JavaScriptCore/wtf/HashTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashTraits.h
deleted file mode 100644
index c8d40f7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashTraits.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
deleted file mode 100644
index 09355ad..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- * 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"
-
-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<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/src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h
deleted file mode 100644
index 41813d3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp
deleted file mode 100644
index 40a4ae5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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 "StdLibExtras.h"
-#include "CurrentTime.h"
-#include "Deque.h"
-#include "Threading.h"
-
-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)
- {
- }
-};
-
-typedef Deque<FunctionWithContext> FunctionQueue;
-
-static bool callbacksPaused; // This global variable is only accessed from main thread.
-
-Mutex& mainThreadFunctionQueueMutex()
-{
- DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
- return staticMutex;
-}
-
-static FunctionQueue& functionQueue()
-{
- DEFINE_STATIC_LOCAL(FunctionQueue, staticFunctionQueue, ());
- return staticFunctionQueue;
-}
-
-void initializeMainThread()
-{
- mainThreadFunctionQueueMutex();
- initializeMainThreadPlatform();
-}
-
-// 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().first();
- functionQueue().removeFirst();
- }
-
- 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 setMainThreadCallbacksPaused(bool paused)
-{
- ASSERT(isMainThread());
-
- if (callbacksPaused == paused)
- return;
-
- callbacksPaused = paused;
-
- if (!callbacksPaused)
- scheduleDispatchFunctionsOnMainThread();
-}
-
-} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h
deleted file mode 100644
index 8c0275b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 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
-
-namespace WTF {
-
-class Mutex;
-
-typedef void MainThreadFunction(void*);
-
-void callOnMainThread(MainThreadFunction*, void* context);
-
-// Blocks the thread until the call finishes on the main thread. Misusing this can easily cause deadlocks.
-void callOnMainThreadAndWait(MainThreadFunction*, void* context);
-
-void setMainThreadCallbacksPaused(bool paused);
-
-// Must be called from the main thread (Darwin is an exception to this rule).
-void initializeMainThread();
-
-// These functions are internal to the callOnMainThread implementation.
-void initializeMainThreadPlatform();
-void scheduleDispatchFunctionsOnMainThread();
-Mutex& mainThreadFunctionQueueMutex();
-void dispatchFunctionsFromMainThread();
-
-} // namespace WTF
-
-using WTF::callOnMainThread;
-using WTF::callOnMainThreadAndWait;
-using WTF::setMainThreadCallbacksPaused;
-
-#endif // MainThread_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MallocZoneSupport.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MallocZoneSupport.h
deleted file mode 100644
index 62df145..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/MallocZoneSupport.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h
deleted file mode 100644
index 9349b48..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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_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); }
-
-// 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) && !OS(ANDROID) && !OS(SYMBIAN)
-using std::isfinite;
-using std::isinf;
-using std::isnan;
-using std::signbit;
-#endif
-
-#endif // #ifndef WTF_MathExtras_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h
deleted file mode 100644
index 48bd10a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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.release());
- 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.release());
- m_condition.signal();
- return wasEmpty;
- }
-
- template<typename DataType>
- inline void MessageQueue<DataType>::prepend(PassOwnPtr<DataType> message)
- {
- MutexLocker lock(m_mutex);
- m_queue.prepend(message.release());
- 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;
-
- DataType* message = m_queue.first();
- m_queue.removeFirst();
- return message;
- }
-
- 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/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h
deleted file mode 100644
index 60a46e2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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_Noncopyable_h
-#define WTF_Noncopyable_h
-
-// 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() { }
- };
-
- class NoncopyableCustomAllocated {
- NoncopyableCustomAllocated(const NoncopyableCustomAllocated&);
- NoncopyableCustomAllocated& operator=(const NoncopyableCustomAllocated&);
- protected:
- NoncopyableCustomAllocated() { }
- ~NoncopyableCustomAllocated() { }
- };
-
-} // namespace WTFNoncopyable
-
-using WTFNoncopyable::Noncopyable;
-using WTFNoncopyable::NoncopyableCustomAllocated;
-
-#endif // WTF_Noncopyable_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h
deleted file mode 100644
index 61375c7..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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_OwnArrayPtr_h
-#define WTF_OwnArrayPtr_h
-
-#include <algorithm>
-#include <wtf/Assertions.h>
-#include <wtf/Noncopyable.h>
-
-namespace WTF {
-
- template <typename T> class OwnArrayPtr : public Noncopyable {
- public:
- explicit OwnArrayPtr(T* ptr = 0) : m_ptr(ptr) { }
- ~OwnArrayPtr() { safeDelete(); }
-
- T* get() const { return m_ptr; }
- T* release() { T* ptr = m_ptr; m_ptr = 0; return ptr; }
-
- void set(T* ptr) { ASSERT(m_ptr != ptr); safeDelete(); m_ptr = ptr; }
- void clear() { safeDelete(); m_ptr = 0; }
-
- T& operator*() const { ASSERT(m_ptr); return *m_ptr; }
- T* 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
-
- void swap(OwnArrayPtr& o) { std::swap(m_ptr, o.m_ptr); }
-
- private:
- void safeDelete() { typedef char known[sizeof(T) ? 1 : -1]; if (sizeof(known)) delete [] m_ptr; }
-
- T* m_ptr;
- };
-
- template <typename T> inline void swap(OwnArrayPtr<T>& a, OwnArrayPtr<T>& b) { a.swap(b); }
-
- 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/src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h
deleted file mode 100644
index 8b6cbf4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h
deleted file mode 100644
index af1684b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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_OwnPtr_h
-#define WTF_OwnPtr_h
-
-#include "Assertions.h"
-#include "Noncopyable.h"
-#include "OwnPtrCommon.h"
-#include "TypeTraits.h"
-#include <algorithm>
-#include <memory>
-
-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> class OwnPtr : public Noncopyable {
- public:
- typedef typename RemovePointer<T>::Type ValueType;
- typedef ValueType* PtrType;
-
- explicit OwnPtr(PtrType ptr = 0) : m_ptr(ptr) { }
- // 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>& o);
-
- ~OwnPtr() { deleteOwnedPtr(m_ptr); }
-
- PtrType get() const { return m_ptr; }
- PtrType release() { PtrType ptr = m_ptr; m_ptr = 0; return ptr; }
-
- // FIXME: This should be renamed to adopt.
- void set(PtrType ptr) { ASSERT(!ptr || m_ptr != ptr); deleteOwnedPtr(m_ptr); m_ptr = ptr; }
-
- void clear() { deleteOwnedPtr(m_ptr); m_ptr = 0; }
-
- 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>&);
- template <typename U> OwnPtr& operator=(const PassOwnPtr<U>&);
-
- void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
-
- private:
- PtrType m_ptr;
- };
-
- template <typename T> template <typename U> inline OwnPtr<T>::OwnPtr(const PassOwnPtr<U>& o)
- : m_ptr(o.release())
- {
- }
-
- template <typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<T>& o)
- {
- T* ptr = m_ptr;
- m_ptr = o.release();
- ASSERT(!ptr || m_ptr != ptr);
- if (ptr)
- deleteOwnedPtr(ptr);
- return *this;
- }
-
- template <typename T> template <typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<U>& o)
- {
- T* ptr = m_ptr;
- m_ptr = o.release();
- ASSERT(!ptr || m_ptr != ptr);
- if (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/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrBrew.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrBrew.cpp
deleted file mode 100644
index c8384e1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrBrew.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 <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);
-}
-
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h
deleted file mode 100644
index c59fdc5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrCommon.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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 _IFileMgr IFileMgr;
-typedef struct _IFile IFile;
-typedef struct IBitmap IBitmap;
-#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*);
-#endif
-
-} // namespace WTF
-
-#endif // WTF_OwnPtrCommon_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp
deleted file mode 100644
index 67a32ff..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtrWin.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/PassOwnPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PassOwnPtr.h
deleted file mode 100644
index ae70457..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/PassOwnPtr.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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 WTF_PassOwnPtr_h
-#define WTF_PassOwnPtr_h
-
-#include "Assertions.h"
-#include "OwnPtrCommon.h"
-#include "TypeTraits.h"
-
-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 {
- public:
- typedef typename RemovePointer<T>::Type ValueType;
- typedef ValueType* PtrType;
-
- PassOwnPtr(PtrType ptr = 0) : m_ptr(ptr) { }
- // 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 really have a need to use real const PassOwnPtrs
- // anyway.
- PassOwnPtr(const PassOwnPtr& o) : m_ptr(o.release()) { }
- template <typename U> PassOwnPtr(const PassOwnPtr<U>& o) : m_ptr(o.release()) { }
-
- ~PassOwnPtr() { deleteOwnedPtr(m_ptr); }
-
- PtrType get() const { return m_ptr; }
-
- void clear() { m_ptr = 0; }
- PtrType release() const { PtrType ptr = m_ptr; m_ptr = 0; return ptr; }
-
- 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=(T*);
- PassOwnPtr& operator=(const PassOwnPtr<T>&);
- template <typename U> PassOwnPtr& operator=(const PassOwnPtr<U>&);
-
- private:
- mutable PtrType m_ptr;
- };
-
- template <typename T> inline PassOwnPtr<T>& PassOwnPtr<T>::operator=(T* optr)
- {
- T* ptr = m_ptr;
- m_ptr = optr;
- ASSERT(!ptr || m_ptr != ptr);
- if (ptr)
- deleteOwnedPtr(ptr);
- return *this;
- }
-
- template <typename T> inline PassOwnPtr<T>& PassOwnPtr<T>::operator=(const PassOwnPtr<T>& optr)
- {
- T* ptr = m_ptr;
- m_ptr = optr.release();
- 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)
- {
- T* ptr = m_ptr;
- m_ptr = optr.release();
- 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, typename U> inline PassOwnPtr<T> static_pointer_cast(const PassOwnPtr<U>& p)
- {
- return PassOwnPtr<T>(static_cast<T*>(p.release()));
- }
-
- template <typename T, typename U> inline PassOwnPtr<T> const_pointer_cast(const PassOwnPtr<U>& p)
- {
- return PassOwnPtr<T>(const_cast<T*>(p.release()));
- }
-
- template <typename T> inline T* getPtr(const PassOwnPtr<T>& p)
- {
- return p.get();
- }
-
-} // namespace WTF
-
-using WTF::PassOwnPtr;
-using WTF::const_pointer_cast;
-using WTF::static_pointer_cast;
-
-#endif // WTF_PassOwnPtr_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h
deleted file mode 100644
index 9c6e44fe..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 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 WTF_PassRefPtr_h
-#define WTF_PassRefPtr_h
-
-#include "AlwaysInline.h"
-
-namespace WTF {
-
- template<typename T> class RefPtr;
- template<typename T> class PassRefPtr;
- template <typename T> PassRefPtr<T> adoptRef(T*);
-
-
- // Remove inline 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.
- template<typename T>
-#if !COMPILER(WINSCW)
- inline
-#endif
- void refIfNotNull(T* ptr)
- {
- if (UNLIKELY(ptr != 0))
- ptr->ref();
- }
-
- template<typename T>
-#if !COMPILER(WINSCW)
- inline
-#endif
- void derefIfNotNull(T* ptr)
- {
- if (UNLIKELY(ptr != 0))
- ptr->deref();
- }
-
- 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 really have a need to use real const PassRefPtrs
- // anyway.
- PassRefPtr(const PassRefPtr& o) : m_ptr(o.releaseRef()) {}
- template <typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.releaseRef()) { }
-
- ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); }
-
- template <class U>
- PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { T* ptr = m_ptr; refIfNotNull(ptr); }
-
- T* get() const { return m_ptr; }
-
- void clear() { T* ptr = m_ptr; derefIfNotNull(ptr); m_ptr = 0; }
- T* releaseRef() const { T* tmp = m_ptr; m_ptr = 0; return tmp; }
-
- 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&);
- template <typename U> PassRefPtr& operator=(const PassRefPtr<U>&);
- template <typename U> PassRefPtr& operator=(const RefPtr<U>&);
-
- friend PassRefPtr adoptRef<T>(T*);
- 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 releaseRef()
- // 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 <class U> NonNullPassRefPtr(const RefPtr<U>& o)
- : m_ptr(o.get())
- {
- ASSERT(m_ptr);
- m_ptr->ref();
- }
-
- NonNullPassRefPtr(const NonNullPassRefPtr& o)
- : m_ptr(o.releaseRef())
- {
- ASSERT(m_ptr);
- }
-
- template <class U> NonNullPassRefPtr(const NonNullPassRefPtr<U>& o)
- : m_ptr(o.releaseRef())
- {
- ASSERT(m_ptr);
- }
-
- template <class U> NonNullPassRefPtr(const PassRefPtr<U>& o)
- : m_ptr(o.releaseRef())
- {
- ASSERT(m_ptr);
- }
-
- ALWAYS_INLINE ~NonNullPassRefPtr() { derefIfNotNull(m_ptr); }
-
- T* get() const { return m_ptr; }
-
- void clear() { derefIfNotNull(m_ptr); m_ptr = 0; }
- T* releaseRef() const { T* tmp = m_ptr; m_ptr = 0; return tmp; }
-
- T& operator*() const { return *m_ptr; }
- T* operator->() const { return m_ptr; }
-
- private:
- mutable T* m_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.releaseRef();
- 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.releaseRef();
- 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)
- {
- 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.releaseRef()));
- }
-
- template <typename T, typename U> inline PassRefPtr<T> const_pointer_cast(const PassRefPtr<U>& p)
- {
- return adoptRef(const_cast<T*>(p.releaseRef()));
- }
-
- template <typename T> inline T* getPtr(const PassRefPtr<T>& p)
- {
- return p.get();
- }
-
-} // 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/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
deleted file mode 100644
index 15f0ffc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
+++ /dev/null
@@ -1,1086 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 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.
- */
-
-#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 */
-#if defined(__CC_ARM) || defined(__ARMCC__)
-#define WTF_COMPILER_RVCT 1
-#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__)
-#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(_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)
-#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(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__)
-#define WTF_CPU_ARM 1
-
-#if defined(__ARMEB__)
-#define WTF_CPU_BIG_ENDIAN 1
-
-#elif !defined(__ARM_EABI__) \
- && !defined(__EABI__) \
- && !defined(__VFP_FP__) \
- && !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(__ARM_ARCH_5E__) \
- || defined(__ARM_ARCH_5TE__) \
- || defined(__ARM_ARCH_5TEJ__) \
- || defined(__MARM_ARMV5__)
-#define WTF_ARM_ARCH_VERSION 5
-
-#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
-
-#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(IPHONE_OS) - iPhone OS */
-/* OS(MAC_OS_X) - Mac OS X (not including iPhone OS) */
-#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_IPHONE_OS 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_PLATFORM_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(IPHONE) */
-/* 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_IPHONE 1
-#endif
-
-/* PLATFORM(IPHONE_SIMULATOR) */
-#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
-#define WTF_PLATFORM_IPHONE 1
-#define WTF_PLATFORM_IPHONE_SIMULATOR 1
-#else
-#define WTF_PLATFORM_IPHONE_SIMULATOR 0
-#endif
-
-#if !defined(WTF_PLATFORM_IPHONE)
-#define WTF_PLATFORM_IPHONE 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(IPHONE)
-#define WTF_PLATFORM_CG 1
-#endif
-#if PLATFORM(MAC) && !PLATFORM(IPHONE)
-#define WTF_PLATFORM_CI 1
-#endif
-
-/* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */
-#if PLATFORM(CHROMIUM)
-#define ENABLE_HISTORY_ALWAYS_ASYNC 1
-#if OS(DARWIN)
-#define WTF_PLATFORM_CG 1
-#define WTF_PLATFORM_CI 1
-#define WTF_USE_ATSUI 1
-#define WTF_USE_CORE_TEXT 1
-#else
-#define WTF_PLATFORM_SKIA 1
-#endif
-#endif
-
-#if PLATFORM(GTK)
-#define WTF_PLATFORM_CAIRO 1
-#endif
-
-
-/* OS(WINCE) && PLATFORM(QT)
- We can not determine the endianess at compile time. For
- Qt for Windows CE the endianess is specified in the
- device specific makespec
-*/
-#if OS(WINCE) && PLATFORM(QT)
-# include <QtGlobal>
-# undef WTF_CPU_BIG_ENDIAN
-# undef WTF_CPU_MIDDLE_ENDIAN
-# if Q_BYTE_ORDER == Q_BIG_ENDIAN
-# define WTF_CPU_BIG_ENDIAN 1
-# endif
-
-# include <ce_time.h>
-#endif
-
-#if (PLATFORM(IPHONE) || 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)
-#undef ENABLE_JSC_MULTIPLE_THREADS
-#define ENABLE_JSC_MULTIPLE_THREADS 0
-#define USE_SYSTEM_MALLOC 0
-#define ENABLE_ICONDATABASE 0
-#define ENABLE_JAVASCRIPT_DEBUGGER 0
-#define ENABLE_FTPDIR 0
-#define ENABLE_PAN_SCROLLING 0
-#define ENABLE_WML 1
-#define HAVE_ACCESSIBILITY 0
-
-#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)
-
-/* _countof is only included in CE6; for CE5 we need to define it ourself */
-#ifndef _countof
-#define _countof(x) (sizeof(x) / sizeof((x)[0]))
-#endif
-
-#endif /* OS(WINCE) && !PLATFORM(QT) */
-
-#if PLATFORM(QT)
-#define WTF_USE_QT4_UNICODE 1
-#if !defined(ENABLE_WIDGETS_10_SUPPORT)
-#define ENABLE_WIDGETS_10_SUPPORT 1
-#endif
-#elif OS(WINCE)
-#define WTF_USE_WINCE_UNICODE 1
-#elif PLATFORM(GTK)
-/* The GTK+ Unicode backend is configurable */
-#else
-#define WTF_USE_ICU_UNICODE 1
-#endif
-
-#if PLATFORM(MAC) && !PLATFORM(IPHONE)
-#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_MAC_JAVA_BRIDGE)
-#define ENABLE_MAC_JAVA_BRIDGE 1
-#endif
-#if !defined(ENABLE_DASHBOARD_SUPPORT)
-#define ENABLE_DASHBOARD_SUPPORT 1
-#endif
-#define HAVE_READLINE 1
-#define HAVE_RUNLOOP_TIMER 1
-#endif /* PLATFORM(MAC) && !PLATFORM(IPHONE) */
-
-#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(QT) && OS(DARWIN)
-#define WTF_PLATFORM_CF 1
-#endif
-
-#if PLATFORM(IPHONE)
-#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_MAC_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_SGL 1
-#define USE_SYSTEM_MALLOC 1
-#define ENABLE_MAC_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
-#endif
-
-#if PLATFORM(WIN)
-#define WTF_USE_WININET 1
-#endif
-
-#if PLATFORM(WX)
-#define ENABLE_ASSEMBLER 1
-#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
-#if OS(DARWIN)
-#define WTF_PLATFORM_CF 1
-#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 !defined(HAVE_ACCESSIBILITY)
-#if PLATFORM(IPHONE) || 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
-
-#if !PLATFORM(IPHONE)
-#define HAVE_MADV_FREE_REUSE 1
-#define HAVE_MADV_FREE 1
-#define HAVE_PTHREAD_SETNAME_NP 1
-#endif
-
-#endif
-
-#if PLATFORM(IPHONE)
-#define HAVE_MADV_FREE 1
-#endif
-
-#elif OS(WINDOWS)
-
-#if OS(WINCE)
-#define HAVE_ERRNO_H 0
-#else
-#define HAVE_SYS_TIMEB_H 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 musn't 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_WIDGETS_10_SUPPORT)
-#define ENABLE_WIDGETS_10_SUPPORT 0
-#endif
-
-#if !defined(ENABLE_INSPECTOR)
-#define ENABLE_INSPECTOR 1
-#endif
-
-#if !defined(ENABLE_MAC_JAVA_BRIDGE)
-#define ENABLE_MAC_JAVA_BRIDGE 0
-#endif
-
-#if !defined(ENABLE_NETSCAPE_PLUGIN_API)
-#define ENABLE_NETSCAPE_PLUGIN_API 1
-#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_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 !defined(ENABLE_TEXT_CARET)
-#define ENABLE_TEXT_CARET 1
-#endif
-
-#if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
-#define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
-#endif
-
-#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
-#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
- || (CPU(IA64) && !CPU(IA64_32)) \
- || CPU(ALPHA) \
- || CPU(SPARC64)
-#define WTF_USE_JSVALUE64 1
-#elif CPU(ARM) || CPU(PPC64) || CPU(MIPS)
-#define WTF_USE_JSVALUE32 1
-#elif OS(WINDOWS) && COMPILER(MINGW)
-/* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg
-on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
-#define WTF_USE_JSVALUE32 1
-#else
-#define WTF_USE_JSVALUE32_64 1
-#endif
-#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */
-
-#if !defined(ENABLE_REPAINT_THROTTLING)
-#define ENABLE_REPAINT_THROTTLING 0
-#endif
-
-#if !defined(ENABLE_JIT)
-
-/* The JIT is tested & working on x86_64 Mac */
-#if CPU(X86_64) && PLATFORM(MAC)
- #define ENABLE_JIT 1
-/* The JIT is tested & working on x86 Mac */
-#elif CPU(X86) && PLATFORM(MAC)
- #define ENABLE_JIT 1
- #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif CPU(ARM_THUMB2) && PLATFORM(IPHONE)
- #define ENABLE_JIT 1
-/* The JIT is tested & working on Android */
-#elif CPU(ARM_THUMB2) && PLATFORM(ANDROID) && ENABLE(ANDROID_JSC_JIT)
- #define ENABLE_JIT 1
-/* The JIT is tested & working on x86 Windows */
-#elif CPU(X86) && PLATFORM(WIN)
- #define ENABLE_JIT 1
-#endif
-
-#if PLATFORM(QT) || PLATFORM(WX)
-#if CPU(X86_64) && OS(DARWIN)
- #define ENABLE_JIT 1
-#elif CPU(X86) && OS(DARWIN)
- #define ENABLE_JIT 1
- #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100
- #define ENABLE_JIT 1
- #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)
- #define ENABLE_JIT 1
- #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
-#elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100
- #define ENABLE_JIT 1
- #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100
- #define ENABLE_JIT 1
-#elif CPU(ARM_TRADITIONAL) && OS(LINUX)
- #define ENABLE_JIT 1
-#endif
-#endif /* PLATFORM(QT) */
-
-#endif /* !defined(ENABLE_JIT) */
-
-/* CPU architecture specific optimizations */
-#if CPU(ARM_TRADITIONAL)
-#if ENABLE(JIT) && !defined(ENABLE_JIT_OPTIMIZE_MOD) && WTF_ARM_ARCH_AT_LEAST(5)
-#define ENABLE_JIT_OPTIMIZE_MOD 1
-#endif
-#endif
-
-#if ENABLE(JIT)
-#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
-#ifndef ENABLE_JIT_OPTIMIZE_MOD
-#define ENABLE_JIT_OPTIMIZE_MOD 0
-#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
-
-#if COMPILER(GCC) && !ENABLE(JIT)
-#define HAVE_COMPUTED_GOTO 1
-#endif
-
-#if ENABLE(JIT) && defined(COVERAGE)
- #define WTF_USE_INTERPRETER 0
-#else
- #define WTF_USE_INTERPRETER 1
-#endif
-
-/* Yet Another Regex Runtime. */
-#if !defined(ENABLE_YARR_JIT)
-
-/* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */
-#if (CPU(X86) && PLATFORM(MAC)) \
- || (CPU(X86_64) && PLATFORM(MAC)) \
- || (CPU(ARM_THUMB2) && PLATFORM(IPHONE)) \
- || (CPU(ARM_THUMB2) && PLATFORM(ANDROID) && ENABLE(ANDROID_JSC_JIT)) \
- || (CPU(X86) && PLATFORM(WIN)) \
- || (CPU(X86) && PLATFORM(WX))
-#define ENABLE_YARR 1
-#define ENABLE_YARR_JIT 1
-#endif
-
-#if PLATFORM(QT)
-#if (CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \
- || (CPU(X86_64) && OS(WINDOWS) && COMPILER(MINGW64) && GCC_VERSION >= 40100) \
- || (CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)) \
- || (CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100) \
- || (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) \
- || (CPU(ARM_TRADITIONAL) && OS(LINUX)) \
- || (CPU(MIPS) && OS(LINUX)) \
- || (CPU(X86) && OS(DARWIN)) \
- || (CPU(X86_64) && OS(DARWIN))
-#define ENABLE_YARR 1
-#define ENABLE_YARR_JIT 1
-#endif
-#endif
-
-#endif /* !defined(ENABLE_YARR_JIT) */
-
-/* Sanity Check */
-#if ENABLE(YARR_JIT) && !ENABLE(YARR)
-#error "YARR_JIT requires YARR"
-#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(IPHONE)
-#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
-#else
-#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0
-#endif
-
-#if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
-#define ENABLE_PAN_SCROLLING 1
-#endif
-
-/* Use the QXmlStreamReader implementation for XMLTokenizer */
-/* Use the QXmlQuery implementation for XSLTProcessor */
-#if PLATFORM(QT)
-#define WTF_USE_QXMLSTREAM 1
-#define WTF_USE_QXMLQUERY 1
-#endif
-
-/* Accelerated compositing */
-#if PLATFORM(MAC)
-#if !defined(BUILDING_ON_TIGER)
-#define WTF_USE_ACCELERATED_COMPOSITING 1
-#endif
-#endif
-
-#if PLATFORM(IPHONE)
-#define WTF_USE_ACCELERATED_COMPOSITING 1
-#endif
-
-/* FIXME: Defining ENABLE_3D_RENDERING here isn't really right, but it's always used with
- with WTF_USE_ACCELERATED_COMPOSITING, and it allows the feature to be turned on and
- off in one place. */
-#if PLATFORM(WIN)
-#include "QuartzCorePresent.h"
-#if QUARTZCORE_PRESENT
-#define WTF_USE_ACCELERATED_COMPOSITING 1
-#define ENABLE_3D_RENDERING 1
-#endif
-#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
-
-#endif /* WTF_Platform_h */
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp
deleted file mode 100644
index fc48263..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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>
-#endif
-
-namespace WTF {
-
-double weakRandomNumber()
-{
-#if COMPILER(MSVC) && defined(_CRT_RAND_S)
- // rand_s is incredibly slow on windows so we fall back on rand for Math.random
- return (rand() + (rand() / (RAND_MAX + 1.0))) / (RAND_MAX + 1.0);
-#elif PLATFORM(BREWMP)
- uint32_t bits;
- GETRAND(reinterpret_cast<byte*>(&bits), sizeof(uint32_t));
- return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
-#else
- return randomNumber();
-#endif
-}
-
-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;
- ISource* randomSource;
-
- IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell;
- ISHELL_CreateInstance(shell, AEECLSID_RANDOM, reinterpret_cast<void**>(&randomSource));
- ISOURCE_Read(randomSource, reinterpret_cast<char*>(&bits), 4);
- ISOURCE_Release(randomSource);
-
- 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/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.h
deleted file mode 100644
index fe1687c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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();
-
- // Returns a pseudo-random number in the range [0, 1), attempts to
- // produce a reasonable "random" number fast.
- // We only need this because rand_s is so slow on windows.
- double weakRandomNumber();
-
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h
deleted file mode 100644
index ae414c0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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(static_cast<unsigned>(time(0)));
-
- // 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 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
-}
-
-inline void initializeWeakRandomNumberGenerator()
-{
-#if COMPILER(MSVC) && defined(_CRT_RAND_S)
- // We need to initialise windows rand() explicitly for Math.random
- unsigned seed = 0;
- rand_s(&seed);
- srand(seed);
-#endif
-}
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
deleted file mode 100644
index 761a856..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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 RefCounted_h
-#define RefCounted_h
-
-#include <wtf/Assertions.h>
-#include <wtf/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);
- ++m_refCount;
- }
-
- bool hasOneRef() const
- {
- ASSERT(!m_deletionHasBegun);
- return m_refCount == 1;
- }
-
- int refCount() const
- {
- return m_refCount;
- }
-
-protected:
- RefCountedBase()
- : m_refCount(1)
-#ifndef NDEBUG
- , m_deletionHasBegun(false)
-#endif
- {
- }
-
- ~RefCountedBase()
- {
- }
-
- // Returns whether the pointer should be freed or not.
- bool derefBase()
- {
- ASSERT(!m_deletionHasBegun);
- 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<class T>
- friend class CrossThreadRefCounted;
-
- int m_refCount;
-#ifndef NDEBUG
- bool m_deletionHasBegun;
-#endif
-};
-
-
-template<class T> class RefCounted : public RefCountedBase, public Noncopyable {
-public:
- void deref()
- {
- if (derefBase())
- delete static_cast<T*>(this);
- }
-
-protected:
- ~RefCounted()
- {
- }
-};
-
-template<class T> class RefCountedCustomAllocated : public RefCountedBase, public NoncopyableCustomAllocated {
-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/src/3rdparty/webkit/JavaScriptCore/wtf/RefCountedLeakCounter.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/RefCountedLeakCounter.cpp
deleted file mode 100644
index 80922d3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCountedLeakCounter.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h
deleted file mode 100644
index 84e841c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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_RefPtr_h
-#define WTF_RefPtr_h
-
-#include <algorithm>
-#include "AlwaysInline.h"
-#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:
- RefPtr() : m_ptr(0) { }
- RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
- RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { T* ptr = m_ptr; refIfNotNull(ptr); }
- // see comment in PassRefPtr.h for why this takes const reference
- 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.
- 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(); }
-
- ~RefPtr() { derefIfNotNull(m_ptr); }
-
- template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { T* ptr = m_ptr; refIfNotNull(ptr); }
-
- T* get() const { return m_ptr; }
-
- void clear() { derefIfNotNull(m_ptr); m_ptr = 0; }
- 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>&);
- 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&);
-
- private:
- static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
-
- T* m_ptr;
- };
-
- template <typename T> template <typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
- : m_ptr(o.releaseRef())
- {
- }
-
- template <typename T> template <typename U> inline RefPtr<T>::RefPtr(const NonNullPassRefPtr<U>& o)
- : m_ptr(o.releaseRef())
- {
- }
-
- 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.releaseRef();
- derefIfNotNull(ptr);
- return *this;
- }
-
- template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(const NonNullPassRefPtr<T>& o)
- {
- T* ptr = m_ptr;
- m_ptr = o.releaseRef();
- 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.releaseRef();
- 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.releaseRef();
- 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/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h
deleted file mode 100644
index 7f6ebfe..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/RetainPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RetainPtr.h
deleted file mode 100644
index 77f25e0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RetainPtr.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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 RetainPtr_h
-#define RetainPtr_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); }
-
- ~RetainPtr() { if (PtrType ptr = m_ptr) CFRelease(ptr); }
-
- template <typename U> RetainPtr(const RetainPtr<U>& o) : m_ptr(o.get()) { if (PtrType ptr = m_ptr) CFRetain(ptr); }
-
- PtrType get() const { return m_ptr; }
-
- PtrType releaseRef() { PtrType tmp = m_ptr; m_ptr = 0; return tmp; }
-
- 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*);
-
- void adoptCF(PtrType);
- void adoptNS(PtrType);
-
- void swap(RetainPtr&);
-
- private:
- PtrType m_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 <class T> inline void RetainPtr<T>::swap(RetainPtr<T>& o)
- {
- std::swap(m_ptr, o.m_ptr);
- }
-
- template <class 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();
- }
-
-} // namespace WTF
-
-using WTF::AdoptCF;
-using WTF::AdoptNS;
-using WTF::RetainPtr;
-
-#endif // WTF_RetainPtr_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h
deleted file mode 100644
index 96a929c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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)
-
-namespace WTF {
-
- /*
- * C++'s idea of a reinterpret_cast lacks sufficient cojones.
- */
- template<typename TO, typename FROM>
- 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;
- }
-
-} // namespace WTF
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h
deleted file mode 100644
index 28e80b8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2006 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>
-
-#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);
- return result;
-}
-
-#if COMPILER(MSVC7_OR_LOWER) || OS(WINCE)
-
-inline int vsnprintf(char* buffer, size_t count, const char* format, va_list args)
-{
- return _vsnprintf(buffer, count, format, args);
-}
-
-#endif
-
-#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 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/src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h
deleted file mode 100644
index 07f117f..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 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 WTF_StringHashFunctions_h
-#define WTF_StringHashFunctions_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;
-
-// stringHash methods based on Paul Hsieh's SuperFastHash.
-// http://www.azillionmonkeys.com/qed/hash.html
-// char* data is interpreted as latin-encoded (zero extended to 16 bits).
-
-inline unsigned stringHash(const UChar* data, unsigned length)
-{
- unsigned hash = WTF::stringHashingStartValue;
- unsigned rem = length & 1;
- length >>= 1;
-
- // Main loop
- for (; length > 0; length--) {
- hash += data[0];
- unsigned tmp = (data[1] << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- data += 2;
- hash += hash >> 11;
- }
-
- // Handle end case
- if (rem) {
- hash += data[0];
- hash ^= hash << 11;
- hash += hash >> 17;
- }
-
- // Force "avalanching" of final 127 bits
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 2;
- hash += hash >> 15;
- hash ^= hash << 10;
-
- hash &= 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 (hash == 0)
- hash = 0x40000000;
-
- return hash;
-}
-
-inline unsigned stringHash(const char* data, unsigned length)
-{
- unsigned hash = WTF::stringHashingStartValue;
- unsigned rem = length & 1;
- length >>= 1;
-
- // Main loop
- for (; length > 0; length--) {
- hash += static_cast<unsigned char>(data[0]);
- unsigned tmp = (static_cast<unsigned char>(data[1]) << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- data += 2;
- hash += hash >> 11;
- }
-
- // Handle end case
- if (rem) {
- hash += static_cast<unsigned char>(data[0]);
- hash ^= hash << 11;
- hash += hash >> 17;
- }
-
- // Force "avalanching" of final 127 bits
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 2;
- hash += hash >> 15;
- hash ^= hash << 10;
-
- hash &= 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 (hash == 0)
- hash = 0x40000000;
-
- return hash;
-}
-
-inline unsigned stringHash(const char* data)
-{
- unsigned hash = WTF::stringHashingStartValue;
-
- // Main loop
- for (;;) {
- unsigned char b0 = data[0];
- if (!b0)
- break;
- unsigned char b1 = data[1];
- if (!b1) {
- hash += b0;
- hash ^= hash << 11;
- hash += hash >> 17;
- break;
- }
- hash += b0;
- unsigned tmp = (b1 << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- data += 2;
- hash += hash >> 11;
- }
-
- // Force "avalanching" of final 127 bits.
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 2;
- hash += hash >> 15;
- hash ^= hash << 10;
-
- hash &= 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 (hash == 0)
- hash = 0x40000000;
-
- return hash;
-}
-
-} // namespace WTF
-
-#endif // WTF_StringHashFunctions_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TCPageMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TCPageMap.h
deleted file mode 100644
index 3f56c24..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCPageMap.h
+++ /dev/null
@@ -1,316 +0,0 @@
-// 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 x, size_t n) {
- // 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/src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h
deleted file mode 100644
index 8a73e13..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright (c) 2005, 2006, 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>
-
-#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() */
-
-#include <sched.h> /* For sched_yield() */
-
-#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>
-#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) {
- sched_yield(); // Yield immediately since fast path failed
- 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
- }
-}
-
-#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/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp
deleted file mode 100644
index c46ff31..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp
+++ /dev/null
@@ -1,522 +0,0 @@
-// 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 <fcntl.h>
-#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/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h
deleted file mode 100644
index 3af87a8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h
deleted file mode 100644
index 7e5679f..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * 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 OS(WINDOWS)
-#include <windows.h>
-#endif
-
-namespace WTF {
-
-#if !USE(PTHREADS) && !PLATFORM(QT) && 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*();
- ~ThreadSpecific();
-
-private:
-#if !USE(PTHREADS) && !PLATFORM(QT) && OS(WINDOWS)
- friend void ThreadSpecificThreadExit();
-#endif
-
- T* get();
- void set(T*);
- void static destroy(void* ptr);
-
-#if USE(PTHREADS) || PLATFORM(QT) || 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)
- 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 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 ThreadSpecific<T>::~ThreadSpecific()
-{
-}
-
-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 ThreadSpecific<T>::~ThreadSpecific()
-{
- pthread_key_delete(m_key); // Does not invoke destructor functions.
-}
-
-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 ThreadSpecific<T>::~ThreadSpecific()
-{
- // Does not invoke destructor functions. QThreadStorage will do it
-}
-
-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 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);
-#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 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*>(fastMalloc(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/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecificWin.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecificWin.cpp
deleted file mode 100644
index f2c0cad..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecificWin.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp
deleted file mode 100644
index 49de59e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
deleted file mode 100644
index 50e08bd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * 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 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"
-
-#if OS(WINCE)
-#include <windows.h>
-#endif
-
-#include <wtf/Assertions.h>
-#include <wtf/Locker.h>
-#include <wtf/Noncopyable.h>
-
-#if OS(WINDOWS) && !OS(WINCE)
-#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
-
-#if USE(PTHREADS)
-#include <pthread.h>
-#elif PLATFORM(GTK)
-#include "GOwnPtr.h"
-typedef struct _GMutex GMutex;
-typedef struct _GCond GCond;
-#endif
-
-#if PLATFORM(QT)
-#include <qglobal.h>
-QT_BEGIN_NAMESPACE
-class QMutex;
-class QWaitCondition;
-QT_END_NAMESPACE
-#endif
-
-#include <stdint.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);
-
-// 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();
-bool isMainThread();
-int waitForThreadCompletion(ThreadIdentifier, void**);
-void detachThread(ThreadIdentifier);
-
-#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;
-};
-
-#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
-
-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:
- ThreadSafeShared(int initialRefCount = 1)
- : ThreadSafeSharedBase(initialRefCount)
- {
- }
-
- void deref()
- {
- if (derefBase())
- delete static_cast<T*>(this);
- }
-};
-
-// 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();
-
-void lockAtomicallyInitializedStaticMutex();
-void unlockAtomicallyInitializedStaticMutex();
-
-} // namespace WTF
-
-using WTF::Mutex;
-using WTF::MutexLocker;
-using WTF::ThreadCondition;
-using WTF::ThreadIdentifier;
-using WTF::ThreadSafeShared;
-
-#if USE(LOCKFREE_THREADSAFESHARED)
-using WTF::atomicDecrement;
-using WTF::atomicIncrement;
-#endif
-
-using WTF::createThread;
-using WTF::currentThread;
-using WTF::isMainThread;
-using WTF::detachThread;
-using WTF::waitForThreadCompletion;
-
-#endif // Threading_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp
deleted file mode 100644
index 2feb808..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * 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 <sys/time.h>
-#endif
-
-#if OS(ANDROID)
-#include "jni_utility.h"
-#endif
-
-namespace WTF {
-
-typedef HashMap<ThreadIdentifier, pthread_t> ThreadMap;
-
-static Mutex* atomicallyInitializedStaticMutex;
-
-#if !OS(DARWIN) || PLATFORM(CHROMIUM) || USE(WEB_THREAD)
-static pthread_t mainThread; // The thread that was the first to call initializeThreading(), which must be the main thread.
-#endif
-
-void clearPthreadHandleForIdentifier(ThreadIdentifier);
-
-static Mutex& threadMapMutex()
-{
- DEFINE_STATIC_LOCAL(Mutex, mutex, ());
- return mutex;
-}
-
-void initializeThreading()
-{
- if (!atomicallyInitializedStaticMutex) {
- atomicallyInitializedStaticMutex = new Mutex;
- threadMapMutex();
- initializeRandomNumberGenerator();
-#if !OS(DARWIN) || PLATFORM(CHROMIUM) || USE(WEB_THREAD)
- mainThread = pthread_self();
-#endif
- initializeMainThread();
- }
-}
-
-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)
-// On the Android platform, threads must be registered with the VM before they run.
-struct ThreadData {
- ThreadFunction entryPoint;
- void* arg;
-};
-
-static void* runThreadWithRegistration(void* arg)
-{
- ThreadData* data = static_cast<ThreadData*>(arg);
- JavaVM* vm = JSC::Bindings::getJavaVM();
- JNIEnv* env;
- void* ret = 0;
- if (vm->AttachCurrentThread(&env, 0) == JNI_OK) {
- ret = data->entryPoint(data->arg);
- vm->DetachCurrentThread();
- }
- delete data;
- return ret;
-}
-
-ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*)
-{
- pthread_t threadHandle;
- ThreadData* threadData = new ThreadData();
- threadData->entryPoint = entryPoint;
- threadData->arg = data;
-
- if (pthread_create(&threadHandle, 0, runThreadWithRegistration, static_cast<void*>(threadData))) {
- LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data);
- delete threadData;
- return 0;
- }
- 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);
-}
-
-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;
-}
-
-bool isMainThread()
-{
-#if OS(DARWIN) && !PLATFORM(CHROMIUM) && !USE(WEB_THREAD)
- return pthread_main_np();
-#else
- return pthread_equal(pthread_self(), mainThread);
-#endif
-}
-
-Mutex::Mutex()
-{
- pthread_mutex_init(&m_mutex, NULL);
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp
deleted file mode 100644
index 73c3f0c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * 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"
-#if !USE(PTHREADS) && OS(WINDOWS)
-#include "ThreadSpecific.h"
-#endif
-#if !OS(WINCE)
-#include <process.h>
-#endif
-#if HAVE(ERRNO_H)
-#include <errno.h>
-#else
-#define NO_ERRNO
-#endif
-#include <windows.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/HashMap.h>
-#include <wtf/MathExtras.h>
-#include <wtf/RandomNumberSeed.h>
-
-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 ThreadIdentifier mainThreadIdentifier;
-
-static Mutex& threadMapMutex()
-{
- static Mutex mutex;
- return mutex;
-}
-
-void initializeThreading()
-{
- if (!atomicallyInitializedStaticMutex) {
- atomicallyInitializedStaticMutex = new Mutex;
- threadMapMutex();
- initializeRandomNumberGenerator();
- initializeMainThread();
- mainThreadIdentifier = currentThread();
- initializeCurrentThreadInternal("Main Thread");
- }
-}
-
-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);
-}
-
-struct ThreadFunctionInvocation {
- ThreadFunctionInvocation(ThreadFunction function, void* data) : function(function), data(data) {}
-
- ThreadFunction function;
- void* data;
-};
-
-static unsigned __stdcall wtfThreadEntryPoint(void* param)
-{
- ThreadFunctionInvocation invocation = *static_cast<ThreadFunctionInvocation*>(param);
- delete 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;
- ThreadFunctionInvocation* invocation = 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, 0, (LPDWORD)&threadIdentifier);
-#else
- HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex(0, 0, wtfThreadEntryPoint, invocation, 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 defined(NO_ERRNO)
- 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;
- }
-
- 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);
-}
-
-ThreadIdentifier currentThread()
-{
- return static_cast<ThreadIdentifier>(GetCurrentThreadId());
-}
-
-bool isMainThread()
-{
- return currentThread() == mainThreadIdentifier;
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp
deleted file mode 100644
index 9e51ad0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
- /*
- * 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(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);
-
-} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h
deleted file mode 100644
index 62dbc49..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h
+++ /dev/null
@@ -1,373 +0,0 @@
- /*
- * 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
- // 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
-
- // 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 = IsInteger<T>::value; };
- template <> struct IsPod<float> { static const bool value = true; };
- template <> struct IsPod<double> { static const bool value = true; };
- template <> struct IsPod<long double> { static const bool value = true; };
- 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;
- };
-
-#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/src/3rdparty/webkit/JavaScriptCore/wtf/UnusedParam.h b/src/3rdparty/webkit/JavaScriptCore/wtf/UnusedParam.h
deleted file mode 100644
index 996f5c8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/UnusedParam.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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. */
-
-#define UNUSED_PARAM(x) (void)x
-
-#endif /* WTF_UnusedParam_h */
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h b/src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h
deleted file mode 100644
index 6600050..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
deleted file mode 100644
index c267050..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
+++ /dev/null
@@ -1,1139 +0,0 @@
-/*
- * 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 "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<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;
-
- 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;
- }
-
- template<typename T, size_t inlineCapacity>
- template<size_t otherCapacity>
- Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(const Vector<T, otherCapacity>& 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;
- }
-
- 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>
- 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/src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h
deleted file mode 100644
index 3c40b61..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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 Vector3_h
-#define Vector3_h
-
-#include <math.h>
-
-namespace WebCore {
-
-class Vector3 {
-public:
- Vector3()
- : m_x(0.0)
- , m_y(0.0)
- , m_z(0.0)
- {
- }
-
- Vector3(double x, double y, double z)
- : m_x(x)
- , m_y(y)
- , m_z(z)
- {
- }
-
- Vector3(const float p[3])
- : m_x(p[0])
- , m_y(p[1])
- , m_z(p[2])
- {
- }
-
- Vector3(const double p[3])
- : m_x(p[0])
- , m_y(p[1])
- , m_z(p[2])
- {
- }
-
- double abs() const
- {
- return sqrt(m_x * m_x + m_y * m_y + m_z * m_z);
- }
-
- bool isZero() const
- {
- return !m_x && !m_y && !m_z;
- }
-
- void normalize()
- {
- double absValue = abs();
- if (!absValue)
- return;
-
- double k = 1.0 / absValue;
- m_x *= k;
- m_y *= k;
- m_z *= k;
- }
-
- double x() const { return m_x; }
- double y() const { return m_y; }
- double z() const { return m_z; }
-
-private:
- double m_x;
- double m_y;
- double m_z;
-};
-
-inline Vector3 operator+(const Vector3& v1, const Vector3& v2)
-{
- return Vector3(v1.x() + v2.x(), v1.y() + v2.y(), v1.z() + v2.z());
-}
-
-inline Vector3 operator-(const Vector3& v1, const Vector3& v2)
-{
- return Vector3(v1.x() - v2.x(), v1.y() - v2.y(), v1.z() - v2.z());
-}
-
-inline Vector3 operator*(double k, const Vector3& v)
-{
- return Vector3(k * v.x(), k * v.y(), k * v.z());
-}
-
-inline Vector3 operator*(const Vector3& v, double k)
-{
- return Vector3(k * v.x(), k * v.y(), k * v.z());
-}
-
-inline double dot(const Vector3& v1, const Vector3& v2)
-{
- return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z();
-}
-
-inline Vector3 cross(const Vector3& v1, const Vector3& v2)
-{
- double x3 = v1.y() * v2.z() - v1.z() * v2.y();
- double y3 = v1.z() * v2.x() - v1.x() * v2.z();
- double z3 = v1.x() * v2.y() - v1.y() * v2.x();
- return Vector3(x3, y3, z3);
-}
-
-inline double distance(const Vector3& v1, const Vector3& v2)
-{
- return (v1 - v2).abs();
-}
-
-} // WebCore
-
-#endif // Vector3_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h
deleted file mode 100644
index 3f33b29..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp
deleted file mode 100644
index 6289d04..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp
+++ /dev/null
@@ -1,2466 +0,0 @@
-/****************************************************************
- *
- * The author of this software is David M. Gay.
- *
- * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
- * Copyright (C) 2002, 2005, 2006, 2007, 2008 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
- Bell Laboratories, Room 2C-463
- 600 Mountain Avenue
- Murray Hill, NJ 07974-0636
- U.S.A.
- dmg@bell-labs.com
- */
-
-/* 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.
- * 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).
- */
-
-/*
- * #define IEEE_8087 for IEEE-arithmetic machines where the least
- * significant byte has the lowest address.
- * #define IEEE_MC68k for IEEE-arithmetic machines where the most
- * significant byte has the lowest address.
- * #define No_leftright to omit left-right logic in fast floating-point
- * computation of dtoa.
- * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
- * and Honor_FLT_ROUNDS is not #defined.
- * #define Inaccurate_Divide for IEEE-format with correctly rounded
- * products but inaccurate quotients, e.g., for Intel i860.
- * #define USE_LONG_LONG on machines that have a "long long"
- * integer type (of >= 64 bits), and performance testing shows that
- * it is faster than 32-bit fallback (which is often not the case
- * on 32-bit machines). On such machines, you can #define Just_16
- * to store 16 bits per 32-bit int32_t when doing high-precision integer
- * arithmetic. Whether this speeds things up or slows things down
- * depends on the machine and the number being converted.
- * #define Bad_float_h if your system lacks a float.h or if it does not
- * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP,
- * FLT_RADIX, FLT_ROUNDS, and DBL_MAX.
- * #define INFNAN_CHECK on IEEE systems to cause strtod to check for
- * Infinity and NaN (case insensitively). On some systems (e.g.,
- * some HP systems), it may be necessary to #define NAN_WORD0
- * appropriately -- to the most significant word of a quiet NaN.
- * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.)
- * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
- * strtod also accepts (case insensitively) strings of the form
- * NaN(x), where x is a string of hexadecimal digits and spaces;
- * if there is only one string of hexadecimal digits, it is taken
- * for the 52 fraction bits of the resulting NaN; if there are two
- * or more strings of hex digits, the first is for the high 20 bits,
- * the second and subsequent for the low 32 bits, with intervening
- * white space ignored; but if this results in none of the 52
- * fraction bits being on (an IEEE Infinity symbol), then NAN_WORD0
- * and NAN_WORD1 are used instead.
- * #define NO_IEEE_Scale to disable new (Feb. 1997) logic in strtod that
- * avoids underflows on inputs whose result does not underflow.
- * If you #define NO_IEEE_Scale on a machine that uses IEEE-format
- * floating-point numbers and flushes underflows to zero rather
- * than implementing gradual underflow, then you must also #define
- * Sudden_Underflow.
- * #define YES_ALIAS to permit aliasing certain double values with
- * arrays of ULongs. This leads to slightly better code with
- * some compilers and was always used prior to 19990916, but it
- * is not strictly legal and can cause trouble with aggressively
- * optimizing compilers (e.g., gcc 2.95.1 under -O2).
- * #define SET_INEXACT if IEEE arithmetic is being used and extra
- * computation should be done to set the inexact flag when the
- * result is inexact and avoid setting inexact when the result
- * is exact. In this case, dtoa.c must be compiled in
- * an environment, perhaps provided by #include "dtoa.c" in a
- * suitable wrapper, that defines two functions,
- * int get_inexact(void);
- * void clear_inexact(void);
- * such that get_inexact() returns a nonzero value if the
- * inexact bit is already set, and clear_inexact() sets the
- * inexact bit to 0. When SET_INEXACT is #defined, strtod
- * also does extra computations to set the underflow and overflow
- * flags when appropriate (i.e., when the result is tiny and
- * inexact or when it is a numeric value rounded to +-infinity).
- * #define NO_ERRNO if strtod should not assign errno = ERANGE when
- * the result overflows to +-Infinity or underflows to 0.
- */
-
-#include "config.h"
-#include "dtoa.h"
-
-#if HAVE(ERRNO_H)
-#include <errno.h>
-#else
-#define NO_ERRNO
-#endif
-#include <math.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wtf/AlwaysInline.h>
-#include <wtf/Assertions.h>
-#include <wtf/FastMalloc.h>
-#include <wtf/MathExtras.h>
-#include <wtf/Vector.h>
-#include <wtf/Threading.h>
-
-#include <stdio.h>
-
-#if COMPILER(MSVC)
-#pragma warning(disable: 4244)
-#pragma warning(disable: 4245)
-#pragma warning(disable: 4554)
-#endif
-
-#if CPU(BIG_ENDIAN)
-#define IEEE_MC68k
-#elif CPU(MIDDLE_ENDIAN)
-#define IEEE_ARM
-#else
-#define IEEE_8087
-#endif
-
-#define INFNAN_CHECK
-
-#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(IEEE_ARM) != 1
-Exactly one of IEEE_8087, IEEE_ARM or IEEE_MC68k should be defined.
-#endif
-
-namespace WTF {
-
-#if ENABLE(JSC_MULTIPLE_THREADS)
-Mutex* s_dtoaP5Mutex;
-#endif
-
-typedef union { double d; uint32_t L[2]; } U;
-
-#ifdef YES_ALIAS
-#define dval(x) x
-#ifdef IEEE_8087
-#define word0(x) ((uint32_t*)&x)[1]
-#define word1(x) ((uint32_t*)&x)[0]
-#else
-#define word0(x) ((uint32_t*)&x)[0]
-#define word1(x) ((uint32_t*)&x)[1]
-#endif
-#else
-#ifdef IEEE_8087
-#define word0(x) (x)->L[1]
-#define word1(x) (x)->L[0]
-#else
-#define word0(x) (x)->L[0]
-#define word1(x) (x)->L[1]
-#endif
-#define dval(x) (x)->d
-#endif
-
-/* The following definition of Storeinc is appropriate for MIPS processors.
- * An alternative that might be better on some machines is
- * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
- */
-#if defined(IEEE_8087) || defined(IEEE_ARM)
-#define Storeinc(a,b,c) (((unsigned short*)a)[1] = (unsigned short)b, ((unsigned short*)a)[0] = (unsigned short)c, a++)
-#else
-#define Storeinc(a,b,c) (((unsigned short*)a)[0] = (unsigned short)b, ((unsigned short*)a)[1] = (unsigned short)c, a++)
-#endif
-
-#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
-
-#if !defined(NO_IEEE_Scale)
-#undef Avoid_Underflow
-#define Avoid_Underflow
-#endif
-
-#if !defined(Flt_Rounds)
-#if defined(FLT_ROUNDS)
-#define Flt_Rounds FLT_ROUNDS
-#else
-#define Flt_Rounds 1
-#endif
-#endif /*Flt_Rounds*/
-
-
-#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
-
-
-// FIXME: we should remove non-Pack_32 mode since it is unused and unmaintained
-#ifndef Pack_32
-#define Pack_32
-#endif
-
-#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
-
-#ifndef USE_LONG_LONG
-#ifdef Just_16
-#undef Pack_32
-/* When Pack_32 is not defined, we store 16 bits per 32-bit int32_t.
- * This makes some inner loops simpler and sometimes saves work
- * during multiplications, but it often seems to make things slightly
- * slower. Hence the default is now to store 32 bits per int32_t.
- */
-#endif
-#endif
-
-#define Kmax 15
-
-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
-#ifdef Pack_32
- 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);
-#else
- uint32_t y = *x * m + carry;
- carry = y >> 16;
- *x++ = y & 0xffff;
-#endif
-#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)
-{
- int k;
- int32_t y;
- int32_t x = (nd + 8) / 9;
-
- for (k = 0, y = 1; x > y; y <<= 1, k++) { }
-#ifdef Pack_32
- b.sign = 0;
- b.resize(1);
- b.words()[0] = y9;
-#else
- b.sign = 0;
- b.resize((b->x[1] = y9 >> 16) ? 2 : 1);
- b.words()[0] = y9 & 0xffff;
-#endif
-
- 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 & 1)
- 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, *xa, *xb, *xae, *xbe;
- uint32_t *xc, *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
-#ifdef Pack_32
- 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;
- 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;
- Storeinc(xc, z, z2);
- z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
- carry = z2 >> 16;
- } while (x < xae);
- *xc = z2;
- }
- }
-#else
- for(; xb < xbe; xc0++) {
- if ((y = *xb++)) {
- x = xa;
- xc = xc0;
- carry = 0;
- do {
- z = *x++ * y + *xc + carry;
- carry = z >> 16;
- *xc++ = z & 0xffff;
- } while (x < xae);
- *xc = carry;
- }
- }
-#endif
-#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 p5s_count;
-
-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;
- p5s_count = 1;
- }
-
- int p5s_count_local = p5s_count;
-#if ENABLE(JSC_MULTIPLE_THREADS)
- s_dtoaP5Mutex->unlock();
-#endif
- int p5s_used = 0;
-
- for (;;) {
- if (k & 1)
- mult(b, p5->val);
-
- if (!(k >>= 1))
- break;
-
- if (++p5s_used == p5s_count_local) {
-#if ENABLE(JSC_MULTIPLE_THREADS)
- s_dtoaP5Mutex->lock();
-#endif
- if (p5s_used == p5s_count) {
- ASSERT(!p5->next);
- p5->next = new P5Node;
- p5->next->next = 0;
- p5->next->val = p5->val;
- mult(p5->next->val, p5->next->val);
- ++p5s_count;
- }
-
- p5s_count_local = p5s_count;
-#if ENABLE(JSC_MULTIPLE_THREADS)
- s_dtoaP5Mutex->unlock();
-#endif
- }
- p5 = p5->next;
- }
-}
-
-static ALWAYS_INLINE void lshift(BigInt& b, int k)
-{
-#ifdef Pack_32
- int n = k >> 5;
-#else
- int n = k >> 4;
-#endif
-
- 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;
-#ifdef Pack_32
- 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] != 0));
- }
-#else
- if (k &= 0xf) {
- uint32_t hiSubword = 0;
- int s = 16 - k;
- for (; src >= srcStart; --src) {
- *dst-- = hiSubword | *src >> s;
- hiSubword = (*src << k) & 0xffff;
- }
- *dst = hiSubword;
- ASSERT(dst == dstStart + n);
- result->wds = b->wds + n + (result->x[n1 - 1] != 0);
- }
- #endif
- 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;
-#ifdef Pack_32
- 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;
- 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;
- Storeinc(xc, z, y);
- }
-#else
- do {
- uint32_t y = *xa++ - *xb++ - borrow;
- borrow = (y & 0x10000) >> 16;
- *xc++ = y & 0xffff;
- } while (xb < xbe);
- while (xa < xae) {
- uint32_t y = *xa++ - borrow;
- borrow = (y & 0x10000) >> 16;
- *xc++ = y & 0xffff;
- }
-#endif
-#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;
-#ifndef Avoid_Underflow
-#ifndef Sudden_Underflow
- if (L > 0) {
-#endif
-#endif
- word0(&u) = L;
- word1(&u) = 0;
-#ifndef Avoid_Underflow
-#ifndef Sudden_Underflow
- } else {
- L = -L >> Exp_shift;
- if (L < Exp_shift) {
- word0(&u) = 0x80000 >> L;
- word1(&u) = 0;
- } else {
- word0(&u) = 0;
- L -= Exp_shift;
- word1(&u) = L >= 31 ? 1 : 1 << 31 - L;
- }
- }
-#endif
-#endif
- 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;
-#ifdef Pack_32
- if (k < Ebits) {
- d0 = Exp_1 | (y >> (Ebits - k));
- w = xa > xa0 ? *--xa : 0;
- d1 = (y << (32 - Ebits + k)) | (w >> (Ebits - k));
- goto ret_d;
- }
- 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;
- }
-#else
- if (k < Ebits + 16) {
- z = xa > xa0 ? *--xa : 0;
- d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k;
- w = xa > xa0 ? *--xa : 0;
- y = xa > xa0 ? *--xa : 0;
- d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k;
- goto ret_d;
- }
- z = xa > xa0 ? *--xa : 0;
- w = xa > xa0 ? *--xa : 0;
- k -= Ebits + 16;
- d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k;
- y = xa > xa0 ? *--xa : 0;
- d1 = w << k + 16 | y << k;
-#endif
-ret_d:
-#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, y, z;
-#ifndef Sudden_Underflow
- int i;
-#endif
-#define d0 word0(d)
-#define d1 word1(d)
-
- b.sign = 0;
-#ifdef Pack_32
- b.resize(1);
-#else
- b.resize(2);
-#endif
- x = b.words();
-
- z = d0 & Frac_mask;
- d0 &= 0x7fffffff; /* clear sign bit, which we ignore */
-#ifdef Sudden_Underflow
- de = (int)(d0 >> Exp_shift);
-#else
- if ((de = (int)(d0 >> Exp_shift)))
- z |= Exp_msk1;
-#endif
-#ifdef Pack_32
- 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;
- }
-
-#ifndef Sudden_Underflow
- i = b.size();
-#endif
- } else {
- k = lo0bits(&z);
- x[0] = z;
-#ifndef Sudden_Underflow
- i = 1;
-#endif
- b.resize(1);
- k += 32;
- }
-#else
- if ((y = d1)) {
- if ((k = lo0bits(&y))) {
- if (k >= 16) {
- x[0] = y | z << 32 - k & 0xffff;
- x[1] = z >> k - 16 & 0xffff;
- x[2] = z >> k;
- i = 2;
- } else {
- x[0] = y & 0xffff;
- x[1] = y >> 16 | z << 16 - k & 0xffff;
- x[2] = z >> k & 0xffff;
- x[3] = z >> k + 16;
- i = 3;
- }
- } else {
- x[0] = y & 0xffff;
- x[1] = y >> 16;
- x[2] = z & 0xffff;
- x[3] = z >> 16;
- i = 3;
- }
- } else {
- k = lo0bits(&z);
- if (k >= 16) {
- x[0] = z;
- i = 0;
- } else {
- x[0] = z & 0xffff;
- x[1] = z >> 16;
- i = 1;
- }
- k += 32;
- } while (!x[i])
- --i;
- b->resize(i + 1);
-#endif
-#ifndef Sudden_Underflow
- if (de) {
-#endif
- *e = de - Bias - (P - 1) + k;
- *bits = P - k;
-#ifndef Sudden_Underflow
- } else {
- *e = de - Bias - (P - 1) + 1 + k;
-#ifdef Pack_32
- *bits = (32 * i) - hi0bits(x[i - 1]);
-#else
- *bits = (i + 2) * 16 - hi0bits(x[i]);
-#endif
- }
-#endif
-}
-#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);
-#ifdef Pack_32
- k = ka - kb + 32 * (a.size() - b.size());
-#else
- k = ka - kb + 16 * (a.size() - b.size());
-#endif
- 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,
-#ifdef Avoid_Underflow
- 9007199254740992. * 9007199254740992.e-256
- /* = 2^106 * 1e-53 */
-#else
- 1e-256
-#endif
-};
-
-/* 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
-
-#if defined(INFNAN_CHECK)
-
-#ifndef NAN_WORD0
-#define NAN_WORD0 0x7ff80000
-#endif
-
-#ifndef NAN_WORD1
-#define NAN_WORD1 0
-#endif
-
-static int match(const char** sp, const char* t)
-{
- int c, d;
- const char* s = *sp;
-
- while ((d = *t++)) {
- if ((c = *++s) >= 'A' && c <= 'Z')
- c += 'a' - 'A';
- if (c != d)
- return 0;
- }
- *sp = s + 1;
- return 1;
-}
-
-#ifndef No_Hex_NaN
-static void hexnan(U* rvp, const char** sp)
-{
- uint32_t c, x[2];
- const char* s;
- int havedig, udx0, xshift;
-
- x[0] = x[1] = 0;
- havedig = xshift = 0;
- udx0 = 1;
- s = *sp;
- while ((c = *(const unsigned char*)++s)) {
- if (c >= '0' && c <= '9')
- c -= '0';
- else if (c >= 'a' && c <= 'f')
- c += 10 - 'a';
- else if (c >= 'A' && c <= 'F')
- c += 10 - 'A';
- else if (c <= ' ') {
- if (udx0 && havedig) {
- udx0 = 0;
- xshift = 1;
- }
- continue;
- } else if (/*(*/ c == ')' && havedig) {
- *sp = s + 1;
- break;
- } else
- return; /* invalid form: don't change *sp */
- havedig = 1;
- if (xshift) {
- xshift = 0;
- x[0] = x[1];
- x[1] = 0;
- }
- if (udx0)
- x[0] = (x[0] << 4) | (x[1] >> 28);
- x[1] = (x[1] << 4) | c;
- }
- if ((x[0] &= 0xfffff) || x[1]) {
- word0(rvp) = Exp_mask | x[0];
- word1(rvp) = x[1];
- }
-}
-#endif /*No_Hex_NaN*/
-#endif /* INFNAN_CHECK */
-
-double strtod(const char* s00, char** se)
-{
-#ifdef Avoid_Underflow
- int scale;
-#endif
- 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;
-#ifdef SET_INEXACT
- int inexact, oldinexact;
-#endif
-
- 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 have_dig;
- }
- goto dig_done;
- }
- for (; c >= '0' && c <= '9'; c = *++s) {
-have_dig:
- 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;
- }
- }
- }
-dig_done:
- 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) {
-#ifdef INFNAN_CHECK
- /* Check for Nan and Infinity */
- switch(c) {
- case 'i':
- case 'I':
- if (match(&s,"nf")) {
- --s;
- if (!match(&s,"inity"))
- ++s;
- word0(&rv) = 0x7ff00000;
- word1(&rv) = 0;
- goto ret;
- }
- break;
- case 'n':
- case 'N':
- if (match(&s, "an")) {
- word0(&rv) = NAN_WORD0;
- word1(&rv) = NAN_WORD1;
-#ifndef No_Hex_NaN
- if (*s == '(') /*)*/
- hexnan(&rv, &s);
-#endif
- goto ret;
- }
- }
-#endif /* INFNAN_CHECK */
-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) {
-#ifdef SET_INEXACT
- if (k > DBL_DIG)
- oldinexact = get_inexact();
-#endif
- dval(&rv) = tens[k - 9] * dval(&rv) + z;
- }
- if (nd <= DBL_DIG && Flt_Rounds == 1) {
- 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;
- }
- }
-#ifndef Inaccurate_Divide
- else if (e >= -Ten_pmax) {
- /* rv = */ rounded_quotient(dval(&rv), tens[-e]);
- goto ret;
- }
-#endif
- }
- e1 += nd - k;
-
-#ifdef SET_INEXACT
- inexact = 1;
- if (k <= DBL_DIG)
- oldinexact = get_inexact();
-#endif
-#ifdef Avoid_Underflow
- scale = 0;
-#endif
-
- /* 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:
-#ifndef NO_ERRNO
- errno = ERANGE;
-#endif
- /* Can't trust HUGE_VAL */
- word0(&rv) = Exp_mask;
- word1(&rv) = 0;
-#ifdef SET_INEXACT
- /* set overflow bit */
- dval(&rv0) = 1e300;
- dval(&rv0) *= dval(&rv0);
-#endif
- 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;
-#ifdef Avoid_Underflow
- 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; zap 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;
- }
-#else
- for (j = 0; e1 > 1; j++, e1 >>= 1)
- if (e1 & 1)
- dval(&rv) *= tinytens[j];
- /* The last multiplication could underflow. */
- dval(&rv0) = dval(&rv);
- dval(&rv) *= tinytens[j];
- if (!dval(&rv)) {
- dval(&rv) = 2. * dval(&rv0);
- dval(&rv) *= tinytens[j];
-#endif
- if (!dval(&rv)) {
-undfl:
- dval(&rv) = 0.;
-#ifndef NO_ERRNO
- errno = ERANGE;
-#endif
- goto ret;
- }
-#ifndef Avoid_Underflow
- word0(&rv) = Tiny0;
- word1(&rv) = Tiny1;
- /* The refinement below will clean
- * this approximation up.
- */
- }
-#endif
- }
- }
-
- /* 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;
-#ifdef Avoid_Underflow
- j = bbe - scale;
- i = j + bbbits - 1; /* logb(rv) */
- if (i < Emin) /* denormal */
- j += P - Emin;
- else
- j = P + 1 - bbbits;
-#else /*Avoid_Underflow*/
-#ifdef Sudden_Underflow
- j = P + 1 - bbbits;
-#else /*Sudden_Underflow*/
- j = bbe;
- i = j + bbbits - 1; /* logb(rv) */
- if (i < Emin) /* denormal */
- j += P - Emin;
- else
- j = P + 1 - bbbits;
-#endif /*Sudden_Underflow*/
-#endif /*Avoid_Underflow*/
- bb2 += j;
- bd2 += j;
-#ifdef Avoid_Underflow
- bd2 += scale;
-#endif
- 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
-#ifdef Avoid_Underflow
- || (word0(&rv) & Exp_mask) <= (2 * P + 1) * Exp_msk1
-#else
- || (word0(&rv) & Exp_mask) <= Exp_msk1
-#endif
- ) {
-#ifdef SET_INEXACT
- if (!delta->words()[0] && delta->size() <= 1)
- inexact = 0;
-#endif
- break;
- }
- if (!delta.words()[0] && delta.size() <= 1) {
- /* exact result */
-#ifdef SET_INEXACT
- inexact = 0;
-#endif
- break;
- }
- lshift(delta, Log2P);
- if (cmp(delta, bs) > 0)
- goto drop_down;
- break;
- }
- if (i == 0) {
- /* exactly half-way between */
- if (dsign) {
- if ((word0(&rv) & Bndry_mask1) == Bndry_mask1
- && word1(&rv) == (
-#ifdef Avoid_Underflow
- (scale && (y = word0(&rv) & Exp_mask) <= 2 * P * Exp_msk1)
- ? (0xffffffff & (0xffffffff << (2 * P + 1 - (y >> Exp_shift)))) :
-#endif
- 0xffffffff)) {
- /*boundary case -- increment exponent*/
- word0(&rv) = (word0(&rv) & Exp_mask) + Exp_msk1;
- word1(&rv) = 0;
-#ifdef Avoid_Underflow
- dsign = 0;
-#endif
- break;
- }
- } else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) {
-drop_down:
- /* boundary case -- decrement exponent */
-#ifdef Sudden_Underflow /*{{*/
- L = word0(&rv) & Exp_mask;
-#ifdef Avoid_Underflow
- if (L <= (scale ? (2 * P + 1) * Exp_msk1 : Exp_msk1))
-#else
- if (L <= Exp_msk1)
-#endif /*Avoid_Underflow*/
- goto undfl;
- L -= Exp_msk1;
-#else /*Sudden_Underflow}{*/
-#ifdef Avoid_Underflow
- 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;
- }
- }
-#endif /*Avoid_Underflow*/
- L = (word0(&rv) & Exp_mask) - Exp_msk1;
-#endif /*Sudden_Underflow}}*/
- 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);
-#ifndef Sudden_Underflow
- if (!dval(&rv))
- goto undfl;
-#endif
- }
-#ifdef Avoid_Underflow
- dsign = 1 - dsign;
-#endif
- break;
- }
- if ((aadj = ratio(delta, bs)) <= 2.) {
- if (dsign)
- aadj = aadj1 = 1.;
- else if (word1(&rv) || word0(&rv) & Bndry_mask) {
-#ifndef Sudden_Underflow
- if (word1(&rv) == Tiny1 && !word0(&rv))
- goto undfl;
-#endif
- 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;
-#ifdef Check_FLT_ROUNDS
- switch (Rounding) {
- case 2: /* towards +infinity */
- aadj1 -= 0.5;
- break;
- case 0: /* towards 0 */
- case 3: /* towards -infinity */
- aadj1 += 0.5;
- }
-#else
- if (Flt_Rounds == 0)
- aadj1 += 0.5;
-#endif /*Check_FLT_ROUNDS*/
- }
- 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;
- } else
- word0(&rv) += P * Exp_msk1;
- } else {
-#ifdef Avoid_Underflow
- 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;
-#else
-#ifdef Sudden_Underflow
- if ((word0(&rv) & Exp_mask) <= P * Exp_msk1) {
- dval(&rv0) = dval(&rv);
- word0(&rv) += P * Exp_msk1;
- adj.d = aadj1 * ulp(&rv);
- dval(&rv) += adj.d;
- if ((word0(&rv) & Exp_mask) <= P * Exp_msk1)
- {
- if (word0(&rv0) == Tiny0 && word1(&rv0) == Tiny1)
- goto undfl;
- word0(&rv) = Tiny0;
- word1(&rv) = Tiny1;
- goto cont;
- }
- else
- word0(&rv) -= P * Exp_msk1;
- } else {
- adj.d = aadj1 * ulp(&rv);
- dval(&rv) += adj.d;
- }
-#else /*Sudden_Underflow*/
- /* Compute adj so that the IEEE rounding rules will
- * correctly round rv + adj in some half-way cases.
- * If rv * ulp(rv) is denormalized (i.e.,
- * y <= (P - 1) * Exp_msk1), we must adjust aadj to avoid
- * trouble from bits lost to denormalization;
- * example: 1.2e-307 .
- */
- if (y <= (P - 1) * Exp_msk1 && aadj > 1.) {
- aadj1 = (double)(int)(aadj + 0.5);
- if (!dsign)
- aadj1 = -aadj1;
- }
- adj.d = aadj1 * ulp(&rv);
- dval(&rv) += adj.d;
-#endif /*Sudden_Underflow*/
-#endif /*Avoid_Underflow*/
- }
- z = word0(&rv) & Exp_mask;
-#ifndef SET_INEXACT
-#ifdef Avoid_Underflow
- if (!scale)
-#endif
- if (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;
- }
-#endif
-cont:
- ;
- }
-#ifdef SET_INEXACT
- if (inexact) {
- if (!oldinexact) {
- word0(&rv0) = Exp_1 + (70 << Exp_shift);
- word1(&rv0) = 0;
- dval(&rv0) += 1.;
- }
- } else if (!oldinexact)
- clear_inexact();
-#endif
-#ifdef Avoid_Underflow
- if (scale) {
- word0(&rv0) = Exp_1 - 2 * P * Exp_msk1;
- word1(&rv0) = 0;
- dval(&rv) *= dval(&rv0);
-#ifndef NO_ERRNO
- /* try to avoid the bug of testing an 8087 register value */
- if (word0(&rv) == 0 && word1(&rv) == 0)
- errno = ERANGE;
-#endif
- }
-#endif /* Avoid_Underflow */
-#ifdef SET_INEXACT
- if (inexact && !(word0(&rv) & Exp_mask)) {
- /* set underflow bit */
- dval(&rv0) = 1e-300;
- dval(&rv0) *= dval(&rv0);
- }
-#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, *bxe, q, *sx, *sxe;
-#ifdef USE_LONG_LONG
- unsigned long long borrow, carry, y, ys;
-#else
- uint32_t borrow, carry, y, ys;
-#ifdef Pack_32
- uint32_t si, z, zs;
-#endif
-#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
-#ifdef Pack_32
- 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;
- Storeinc(bx, z, y);
-#else
- ys = *sx++ * q + carry;
- carry = ys >> 16;
- y = *bx - (ys & 0xffff) - borrow;
- borrow = (y & 0x10000) >> 16;
- *bx++ = y & 0xffff;
-#endif
-#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
-#ifdef Pack_32
- 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;
- Storeinc(bx, z, y);
-#else
- ys = *sx++ + carry;
- carry = ys >> 16;
- y = *bx - (ys & 0xffff) - borrow;
- borrow = (y & 0x10000) >> 16;
- *bx++ = y & 0xffff;
-#endif
-#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. 92-101].
- *
- * 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.
- */
-
-void dtoa(DtoaBuffer result, double dd, int ndigits, int* decpt, int* sign, char** rve)
-{
- /*
- Arguments ndigits, decpt, sign are similar to those
- of ecvt and fcvt; trailing zeros are suppressed from
- the returned string. If not null, *rve is set to point
- to the end of the return value. If d is +-Infinity or NaN,
- then *decpt is set to 9999.
-
- */
-
- int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0,
- j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
- spec_case, try_quick;
- int32_t L;
-#ifndef Sudden_Underflow
- int denorm;
- uint32_t x;
-#endif
- BigInt b, b1, delta, mlo, mhi, S;
- U d2, eps, u;
- double ds;
- char *s, *s0;
-#ifdef SET_INEXACT
- int inexact, oldinexact;
-#endif
-
- u.d = dd;
- if (word0(&u) & Sign_bit) {
- /* set sign for everything, including 0's and NaNs */
- *sign = 1;
- word0(&u) &= ~Sign_bit; /* clear sign bit */
- } else
- *sign = 0;
-
- if ((word0(&u) & Exp_mask) == Exp_mask)
- {
- /* Infinity or NaN */
- *decpt = 9999;
- if (!word1(&u) && !(word0(&u) & 0xfffff)) {
- strcpy(result, "Infinity");
- if (rve)
- *rve = result + 8;
- } else {
- strcpy(result, "NaN");
- if (rve)
- *rve = result + 3;
- }
- return;
- }
- if (!dval(&u)) {
- *decpt = 1;
- result[0] = '0';
- result[1] = '\0';
- if (rve)
- *rve = result + 1;
- return;
- }
-
-#ifdef SET_INEXACT
- try_quick = oldinexact = get_inexact();
- inexact = 1;
-#endif
-
- d2b(b, &u, &be, &bbits);
-#ifdef Sudden_Underflow
- i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask >> Exp_shift1));
-#else
- if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask >> Exp_shift1)))) {
-#endif
- 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;
-#ifndef Sudden_Underflow
- 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;
- }
-#endif
- 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;
- }
-
-#ifndef SET_INEXACT
-#ifdef Check_FLT_ROUNDS
- try_quick = Rounding == 1;
-#else
- try_quick = 1;
-#endif
-#endif /*SET_INEXACT*/
-
- leftright = 1;
- ilim = ilim1 = -1;
- i = 18;
- ndigits = 0;
- s = s0 = result;
-
- if (ilim >= 0 && ilim <= Quick_max && try_quick) {
-
- /* 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 fast_failed;
- ilim = ilim1;
- k--;
- dval(&u) *= 10.;
- ieps++;
- }
- dval(&eps) = (ieps * dval(&u)) + 7.;
- word0(&eps) -= (P - 1) * Exp_msk1;
- if (ilim == 0) {
- S.clear();
- mhi.clear();
- dval(&u) -= 5.;
- if (dval(&u) > dval(&eps))
- goto one_digit;
- if (dval(&u) < -dval(&eps))
- goto no_digits;
- goto fast_failed;
- }
-#ifndef No_leftright
- 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 bump_up;
- if (++i >= ilim)
- break;
- dval(&eps) *= 10.;
- dval(&u) *= 10.;
- }
- } else {
-#endif
- /* 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 bump_up;
- else if (dval(&u) < 0.5 - dval(&eps)) {
- while (*--s == '0') { }
- s++;
- goto ret;
- }
- break;
- }
- }
-#ifndef No_leftright
- }
-#endif
-fast_failed:
- 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 no_digits;
- goto one_digit;
- }
- for (i = 1;; i++, dval(&u) *= 10.) {
- L = (int32_t)(dval(&u) / ds);
- dval(&u) -= L * ds;
-#ifdef Check_FLT_ROUNDS
- /* If FLT_ROUNDS == 2, L will usually be high by 1 */
- if (dval(&u) < 0) {
- L--;
- dval(&u) += ds;
- }
-#endif
- *s++ = '0' + (int)L;
- if (!dval(&u)) {
-#ifdef SET_INEXACT
- inexact = 0;
-#endif
- break;
- }
- if (i == ilim) {
- dval(&u) += dval(&u);
- if (dval(&u) > ds || (dval(&u) == ds && (L & 1))) {
-bump_up:
- 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 =
-#ifndef Sudden_Underflow
- denorm ? be + (Bias + (P - 1) - 1 + 1) :
-#endif
- 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 (!word1(&u) && !(word0(&u) & Bndry_mask)
-#ifndef Sudden_Underflow
- && word0(&u) & (Exp_mask & ~Exp_msk1)
-#endif
- ) {
- /* 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.
- */
-#ifdef Pack_32
- if ((i = ((s5 ? 32 - hi0bits(S.words()[S.size() - 1]) : 1) + s2) & 0x1f))
- i = 32 - i;
-#else
- if ((i = ((s5 ? 32 - hi0bits(S.words()[S.size() - 1]) : 1) + s2) & 0xf))
- i = 16 - i;
-#endif
- 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 (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) {
- mhi = mlo;
- 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);
- if (j1 == 0 && !(word1(&u) & 1)) {
- if (dig == '9')
- goto round_9_up;
- if (j > 0)
- dig++;
-#ifdef SET_INEXACT
- else if (!b->x[0] && b->wds <= 1)
- inexact = 0;
-#endif
- *s++ = dig;
- goto ret;
- }
- if (j < 0 || (j == 0 && !(word1(&u) & 1))) {
- if (!b.words()[0] && b.size() <= 1) {
-#ifdef SET_INEXACT
- inexact = 0;
-#endif
- goto accept_dig;
- }
- if (j1 > 0) {
- lshift(b, 1);
- j1 = cmp(b, S);
- if ((j1 > 0 || (j1 == 0 && (dig & 1))) && dig++ == '9')
- goto round_9_up;
- }
-accept_dig:
- *s++ = dig;
- goto ret;
- }
- if (j1 > 0) {
- if (dig == '9') { /* possible if i == 1 */
-round_9_up:
- *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) {
-#ifdef SET_INEXACT
- inexact = 0;
-#endif
- goto ret;
- }
- if (i >= ilim)
- break;
- multadd(b, 10, 0);
- }
-
- /* Round off last digit */
-
- lshift(b, 1);
- j = cmp(b, S);
- if (j > 0 || (j == 0 && (dig & 1))) {
-roundoff:
- while (*--s == '9')
- if (s == s0) {
- k++;
- *s++ = '1';
- goto ret;
- }
- ++*s++;
- } else {
- while (*--s == '0') { }
- s++;
- }
- goto ret;
-no_digits:
- k = -1 - ndigits;
- goto ret;
-one_digit:
- *s++ = '1';
- k++;
- goto ret;
-ret:
-#ifdef SET_INEXACT
- if (inexact) {
- if (!oldinexact) {
- word0(&u) = Exp_1 + (70 << Exp_shift);
- word1(&u) = 0;
- dval(&u) += 1.;
- }
- } else if (!oldinexact)
- clear_inexact();
-#endif
- *s = 0;
- *decpt = k + 1;
- if (rve)
- *rve = s;
-}
-
-static ALWAYS_INLINE void append(char*& next, const char* src, unsigned size)
-{
- for (unsigned i = 0; i < size; ++i)
- *next++ = *src++;
-}
-
-void doubleToStringInJavaScriptFormat(double d, DtoaBuffer buffer, unsigned* resultLength)
-{
- ASSERT(buffer);
-
- // avoid ever printing -NaN, in JS conceptually there is only one NaN value
- if (isnan(d)) {
- append(buffer, "NaN", 3);
- if (resultLength)
- *resultLength = 3;
- return;
- }
- // -0 -> "0"
- if (!d) {
- buffer[0] = '0';
- if (resultLength)
- *resultLength = 1;
- return;
- }
-
- int decimalPoint;
- int sign;
-
- DtoaBuffer result;
- char* resultEnd = 0;
- WTF::dtoa(result, d, 0, &decimalPoint, &sign, &resultEnd);
- int length = resultEnd - result;
-
- char* next = buffer;
- if (sign)
- *next++ = '-';
-
- if (decimalPoint <= 0 && decimalPoint > -6) {
- *next++ = '0';
- *next++ = '.';
- for (int j = decimalPoint; j < 0; j++)
- *next++ = '0';
- append(next, result, length);
- } else if (decimalPoint <= 21 && decimalPoint > 0) {
- if (length <= decimalPoint) {
- append(next, result, length);
- for (int j = 0; j < decimalPoint - length; j++)
- *next++ = '0';
- } else {
- append(next, result, decimalPoint);
- *next++ = '.';
- append(next, result + decimalPoint, length - decimalPoint);
- }
- } else if (result[0] < '0' || result[0] > '9')
- append(next, result, length);
- else {
- *next++ = result[0];
- if (length > 1) {
- *next++ = '.';
- append(next, result + 1, length - 1);
- }
-
- *next++ = 'e';
- *next++ = (decimalPoint >= 0) ? '+' : '-';
- // decimalPoint can't be more than 3 digits decimal given the
- // nature of float representation
- int exponential = decimalPoint - 1;
- if (exponential < 0)
- exponential = -exponential;
- if (exponential >= 100)
- *next++ = static_cast<char>('0' + exponential / 100);
- if (exponential >= 10)
- *next++ = static_cast<char>('0' + (exponential % 100) / 10);
- *next++ = static_cast<char>('0' + exponential % 10);
- }
- if (resultLength)
- *resultLength = next - buffer;
-}
-
-} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h
deleted file mode 100644
index 6127f53..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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
-
-namespace WTF {
- class Mutex;
-}
-
-namespace WTF {
-
- extern WTF::Mutex* s_dtoaP5Mutex;
-
- double strtod(const char* s00, char** se);
-
- typedef char DtoaBuffer[80];
- void dtoa(DtoaBuffer result, double d, int ndigits, int* decpt, int* sign, char** rve);
-
- // dtoa() for ECMA-262 'ToString Applied to the Number Type.'
- // The *resultLength will have the length of the resultant string in bufer.
- // The resultant string isn't terminated by 0.
- void doubleToStringInJavaScriptFormat(double, DtoaBuffer, unsigned* resultLength);
-
-} // namespace WTF
-
-using WTF::DtoaBuffer;
-using WTF::doubleToStringInJavaScriptFormat;
-
-#endif // WTF_dtoa_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.cpp
deleted file mode 100644
index da0d839..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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"
-
-#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
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.h
deleted file mode 100644
index 1fc594c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GOwnPtr.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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
-
-#include <algorithm>
-#include <wtf/Assertions.h>
-#include <wtf/Noncopyable.h>
-
-// Forward delcarations at this point avoid the need to include GLib includes
-// in WTF headers.
-typedef struct _GError GError;
-typedef struct _GList GList;
-typedef struct _GCond GCond;
-typedef struct _GMutex GMutex;
-typedef struct _GPatternSpec GPatternSpec;
-typedef struct _GDir GDir;
-typedef struct _GHashTable GHashTable;
-typedef struct _GFile GFile;
-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<GHashTable>(GHashTable*);
-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()
- {
- freeOwnedGPtr(m_ptr);
- m_ptr = 0;
- }
-
- 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 // GOwnPtr_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.cpp
deleted file mode 100644
index e7cf34b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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"
-
-#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);
-}
-
-} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.h
deleted file mode 100644
index 66739ef..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/gobject/GRefPtr.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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
-
-#include "AlwaysInline.h"
-#include <algorithm>
-
-typedef struct _GHashTable GHashTable;
-
-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 <> GHashTable* refGPtr(GHashTable* ptr);
-template <> void derefGPtr(GHashTable* ptr);
-
-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()
- {
- if (T* ptr = m_ptr)
- derefGPtr(ptr);
- m_ptr = 0;
- }
-
- 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 <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::refGPtr;
-using WTF::derefGPtr;
-using WTF::adoptGRef;
-using WTF::static_pointer_cast;
-using WTF::const_pointer_cast;
-
-#endif // WTF_GRefPtr_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp
deleted file mode 100644
index 7b2d0f2..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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>
-
-
-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);
-}
-
-} // namespace WTF
-
-#include "MainThreadQt.moc"
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp
deleted file mode 100644
index dc04a68..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * 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 ThreadIdentifier mainThreadIdentifier;
-
-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();
- QThread* mainThread = QCoreApplication::instance()->thread();
- mainThreadIdentifier = identifierByQthreadHandle(mainThread);
- if (!mainThreadIdentifier)
- mainThreadIdentifier = establishIdentifierForThread(mainThread);
- initializeMainThread();
- }
-}
-
-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);
-}
-
-bool isMainThread()
-{
- return QThread::currentThread() == QCoreApplication::instance()->thread();
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp
deleted file mode 100644
index 0b9a043..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must 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 OS(SYMBIAN)
-
-#include "BlockAllocatorSymbian.h"
-
-
-namespace WTF {
-
-/** Efficiently allocates blocks of size blockSize with blockSize alignment.
- * Primarly designed for JSC Collector's needs.
- * Not thread-safe.
- */
-AlignedBlockAllocator::AlignedBlockAllocator(TUint32 reservationSize, TUint32 blockSize )
- : m_reservation(reservationSize),
- m_blockSize(blockSize)
-{
-
- // Get system's page size value.
- SYMBIAN_PAGESIZE(m_pageSize);
-
- // We only accept multiples of system page size for both initial reservation and the alignment/block size
- m_reservation = SYMBIAN_ROUNDUPTOMULTIPLE(m_reservation, m_pageSize);
- __ASSERT_ALWAYS(SYMBIAN_ROUNDUPTOMULTIPLE(m_blockSize, m_pageSize), User::Panic(_L("AlignedBlockAllocator1"), KErrArgument));
-
- // Calculate max. bit flags we need to carve a reservationSize range into blockSize-sized blocks
- m_map.numBits = m_reservation / m_blockSize;
- const TUint32 bitsPerWord = 8*sizeof(TUint32);
- const TUint32 numWords = (m_map.numBits + bitsPerWord -1) / bitsPerWord;
-
- m_map.bits = new TUint32[numWords];
- __ASSERT_ALWAYS(m_map.bits, User::Panic(_L("AlignedBlockAllocator2"), KErrNoMemory));
- m_map.clearAll();
-
- // Open a Symbian RChunk, and reserve requested virtual address range
- // Any thread in this process can operate this rchunk due to EOwnerProcess access rights.
- TInt ret = m_chunk.CreateDisconnectedLocal(0 , 0, (TInt)m_reservation , EOwnerProcess);
- if (ret != KErrNone)
- User::Panic(_L("AlignedBlockAllocator3"), ret);
-
- // This is the offset to m_chunk.Base() required to make it m_blockSize-aligned
- m_offset = SYMBIAN_ROUNDUPTOMULTIPLE(TUint32(m_chunk.Base()), m_blockSize) - TUint(m_chunk.Base());
-
-}
-
-void* AlignedBlockAllocator::alloc()
-{
-
- TInt freeRam = 0;
- void* address = 0;
-
- // Look up first free slot in bit map
- const TInt freeIdx = m_map.findFree();
-
- // Pseudo OOM: We ate up the address space we reserved..
- // ..even though the device may have free RAM left
- if (freeIdx < 0)
- return 0;
-
- TInt ret = m_chunk.Commit(m_offset + (m_blockSize * freeIdx), m_blockSize);
- if (ret != KErrNone)
- return 0; // True OOM: Device didn't have physical RAM to spare
-
- // Updated bit to mark region as in use.
- m_map.set(freeIdx);
-
- // Calculate address of committed region (block)
- address = (void*)( (m_chunk.Base() + m_offset) + (TUint)(m_blockSize * freeIdx) );
-
- return address;
-}
-
-void AlignedBlockAllocator::free(void* block)
-{
- // Calculate index of block to be freed
- TInt idx = TUint(static_cast<TUint8*>(block) - m_chunk.Base() - m_offset) / m_blockSize;
-
- __ASSERT_DEBUG(idx >= 0 && idx < m_map.numBits, User::Panic(_L("AlignedBlockAllocator4"), KErrCorrupt)); // valid index check
- __ASSERT_DEBUG(m_map.get(idx), User::Panic(_L("AlignedBlockAllocator5"), KErrCorrupt)); // in-use flag check
-
- // Return committed region to system RAM pool (the physical RAM becomes usable by others)
- TInt ret = m_chunk.Decommit(m_offset + m_blockSize * idx, m_blockSize);
-
- // mark this available again
- m_map.clear(idx);
-}
-
-void AlignedBlockAllocator::destroy()
-{
- // release everything!
- m_chunk.Decommit(0, m_chunk.MaxSize());
- m_map.clearAll();
-}
-
-AlignedBlockAllocator::~AlignedBlockAllocator()
-{
- destroy();
- m_chunk.Close();
- delete [] m_map.bits;
-}
-
-} // end of namespace
-
-#endif // SYMBIAN
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h
deleted file mode 100644
index 5dfdb3d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must 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 BlockAllocatorSymbian_h
-#define BlockAllocatorSymbian_h
-
-#include <e32cmn.h>
-#include <e32std.h>
-#include <hal.h>
-
-
-#define SYMBIAN_PAGESIZE(x) (HAL::Get(HALData::EMemoryPageSize, x));
-#define SYMBIAN_FREERAM(x) (HAL::Get(HALData::EMemoryRAMFree, x));
-#define SYMBIAN_ROUNDUPTOMULTIPLE(x, multipleof) ( (x + multipleof - 1) & ~(multipleof - 1) )
-
-// Set sane defaults if -D<flagname=value> wasn't provided via compiler args
-#ifndef JSCCOLLECTOR_VIRTUALMEM_RESERVATION
-#if defined(__WINS__)
- // Emulator has limited virtual address space
- #define JSCCOLLECTOR_VIRTUALMEM_RESERVATION (4*1024*1024)
-#else
- // HW has plenty of virtual addresses
- #define JSCCOLLECTOR_VIRTUALMEM_RESERVATION (128*1024*1024)
-#endif
-#endif
-
-namespace WTF {
-
-/**
- * Allocates contiguous region of size blockSize with blockSize-aligned address.
- * blockSize must be a multiple of system page size (typically 4K on Symbian/ARM)
- *
- * @param reservationSize Virtual address range to be reserved upon creation of chunk (bytes).
- * @param blockSize Size of a single allocation. Returned address will also be blockSize-aligned.
- */
-class AlignedBlockAllocator {
- public:
- AlignedBlockAllocator(TUint32 reservationSize, TUint32 blockSize);
- ~AlignedBlockAllocator();
- void destroy();
- void* alloc();
- void free(void* data);
-
- private:
- RChunk m_chunk; // Symbian chunk that lets us reserve/commit/decommit
- TUint m_offset; // offset of first committed region from base
- TInt m_pageSize; // cached value of system page size, typically 4K on Symbian
- TUint32 m_reservation;
- TUint32 m_blockSize;
-
- // Tracks comitted/decommitted state of a blockSize region
- struct {
-
- TUint32 *bits; // array of bit flags
- TUint32 numBits; // number of regions to keep track of
-
- bool get(TUint32 n) const
- {
- return !!(bits[n >> 5] & (1 << (n & 0x1F)));
- }
-
- void set(TUint32 n)
- {
- bits[n >> 5] |= (1 << (n & 0x1F));
- }
-
- void clear(TUint32 n)
- {
- bits[n >> 5] &= ~(1 << (n & 0x1F));
- }
-
- void clearAll()
- {
- for (TUint32 i = 0; i < numBits; i++)
- clear(i);
- }
-
- TInt findFree() const
- {
- for (TUint32 i = 0; i < numBits; i++) {
- if (!get(i))
- return i;
- }
- return -1;
- }
-
- } m_map;
-
-};
-
-}
-
-#endif // end of BlockAllocatorSymbian_h
-
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp
deleted file mode 100644
index da5cc99..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must 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 OS(SYMBIAN)
-
-#include "RegisterFileAllocatorSymbian.h"
-
-namespace WTF {
-
-/** Efficiently allocates memory pools of size poolSize.
- * Primarily designed for JSC RegisterFile's needs.
- * Not thread-safe.
- */
-RegisterFileAllocator::RegisterFileAllocator(TUint32 reservationSize, TUint32 poolSize) :
- m_reserved(reservationSize), m_poolSize(poolSize)
-{
- // Get system's page size value.
- SYMBIAN_PAGESIZE(m_pageSize);
-
- // We only accept multiples of system page size for both initial reservation
- // and the alignment/pool size
- m_reserved = SYMBIAN_ROUNDUPTOMULTIPLE(m_reserved, m_pageSize);
- __ASSERT_ALWAYS(SYMBIAN_ROUNDUPTOMULTIPLE(m_poolSize, m_pageSize),
- User::Panic(_L("RegisterFileAllocator1"), KErrArgument));
-
- // Open a Symbian RChunk, and reserve requested virtual address range
- // Any thread in this process can operate this RChunk due to EOwnerProcess access rights.
- TInt ret = m_chunk.CreateDisconnectedLocal(0 , 0, (TInt)m_reserved , EOwnerProcess);
- if (ret != KErrNone)
- User::Panic(_L("RegisterFileAllocator2"), ret);
-
- m_buffer = (void*)m_chunk.Base();
- m_resEnd = (void*)(m_chunk.Base() + m_chunk.MaxSize());
- m_comEnd = m_buffer;
-}
-
-RegisterFileAllocator::~RegisterFileAllocator()
-{
- // release everything!
- m_chunk.Decommit(0, m_chunk.MaxSize());
- m_chunk.Close();
-}
-
-void* RegisterFileAllocator::buffer() const
-{
- return m_buffer;
-}
-
-void RegisterFileAllocator::grow(void* newEnd)
-{
- // trying to commit more memory than reserved!
- if (newEnd > m_resEnd)
- return;
-
- if (newEnd > m_comEnd) {
- TInt nBytes = (TInt)(newEnd) - (TInt)(m_comEnd);
- nBytes = SYMBIAN_ROUNDUPTOMULTIPLE(nBytes, m_poolSize);
- TInt offset = (TInt)m_comEnd - (TInt)m_buffer;
-
- TInt ret = m_chunk.Commit(offset, nBytes);
- if (ret == KErrNone)
- m_comEnd = (void*)(m_chunk.Base() + m_chunk.Size());
- }
-}
-
-void RegisterFileAllocator::shrink(void* newEnd)
-{
- if (newEnd < m_comEnd) {
- TInt nBytes = (TInt)newEnd - (TInt)m_comEnd;
- if (nBytes >= m_poolSize) {
- TInt offset = SYMBIAN_ROUNDUPTOMULTIPLE((TUint)newEnd, m_poolSize) - (TInt)m_buffer;
- nBytes = (TInt)m_comEnd - offset - (TInt)m_buffer;
- if (nBytes > 0) {
- TInt ret = m_chunk.Decommit(offset, nBytes);
- if (ret == KErrNone)
- m_comEnd = (void*)(m_chunk.Base() + m_chunk.Size());
- }
- }
- }
-}
-
-} // end of namespace
-
-#endif // SYMBIAN
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h
deleted file mode 100644
index 5e1951b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must 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 RegisterFileAllocatorSymbian_h
-#define RegisterFileAllocatorSymbian_h
-
-#include "SymbianDefines.h"
-
-namespace WTF {
-
-/**
- * Allocates contiguous regions of size poolSize.
- * poolSize must be a multiple of system page size (typically 4K on Symbian/ARM)
- *
- * @param reservationSize Virtual address range to be reserved upon creation of chunk (bytes).
- * @param poolSize Size of a single allocation.
- */
-class RegisterFileAllocator {
-
-public:
- RegisterFileAllocator(
- TUint32 reservationSize, TUint32 poolSize = SYMBIAN_REGFILEALLOC_DEFAULTPOOLSIZE);
- ~RegisterFileAllocator();
- void* buffer() const;
- void grow(void* newEnd);
- void shrink(void* newEnd);
-
-private:
- RChunk m_chunk; // Symbian chunk that lets us reserve/commit/decommit
-
- // all following values are in numbers of bytes
- TInt m_pageSize; // cached value of system page size, typically 4K on Symbian
- TUint32 m_reserved; // total number of reserved bytes in virtual memory
- TUint32 m_poolSize; // size of one memory pool, set by default to 64K in wtf/symbian/SymbianDefines.h
-
- void* m_buffer; // pointer to base of the chunk
- void* m_comEnd; // pointer to end of currently committed memory
- void* m_resEnd; // pointer to end of reserved memory
-
-};
-
-} // end of namespace
-
-#endif // RegisterFileAllocatorSymbian_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h
deleted file mode 100644
index 225c4f4..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must 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 SymbianDefines_h
-#define SymbianDefines_h
-
-#include <e32cmn.h>
-#include <e32std.h>
-#include <hal.h>
-
-#define SYMBIAN_PAGESIZE(x) (HAL::Get(HALData::EMemoryPageSize, x));
-#define SYMBIAN_FREERAM(x) (HAL::Get(HALData::EMemoryRAMFree, x));
-#define SYMBIAN_ROUNDUPTOMULTIPLE(x, multipleof) ( (x + multipleof - 1) & ~(multipleof - 1) )
-
-#define SYMBIAN_REGFILEALLOC_DEFAULTPOOLSIZE 65536 // 64K
-
-#endif // SymbianDefines_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h
deleted file mode 100644
index fe6a809..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp
deleted file mode 100644
index 21d5856..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "UTF8.h"
-
-namespace WTF {
-namespace Unicode {
-
-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 (b0 & 0x80) == 0 ? 1 : inlineUTF8SequenceLengthNonASCII(b0);
-}
-
-int UTF8SequenceLength(char b0)
-{
- return (b0 & 0x80) == 0 ? 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 = 0xFFFD;
- }
-
- 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 };
-
-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) {
- UChar32 ch = 0;
- int extraBytesToRead = UTF8SequenceLength(*source) - 1;
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted;
- break;
- }
- // Do this check whether lenient or strict
- if (!isLegalUTF8(reinterpret_cast<const unsigned char*>(source), extraBytesToRead + 1)) {
- result = sourceIllegal;
- break;
- }
- // The cases all fall through.
- switch (extraBytesToRead) {
- case 5: ch += static_cast<unsigned char>(*source++); ch <<= 6; // remember, illegal UTF-8
- case 4: ch += static_cast<unsigned char>(*source++); ch <<= 6; // remember, illegal UTF-8
- case 3: ch += static_cast<unsigned char>(*source++); ch <<= 6;
- case 2: ch += static_cast<unsigned char>(*source++); ch <<= 6;
- case 1: ch += static_cast<unsigned char>(*source++); ch <<= 6;
- case 0: ch += static_cast<unsigned char>(*source++);
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead + 1); // Back up source pointer!
- result = targetExhausted; break;
- }
- if (ch <= 0xFFFF) {
- // UTF-16 surrogate values are illegal in UTF-32
- if (ch >= 0xD800 && ch <= 0xDFFF) {
- if (strict) {
- source -= (extraBytesToRead + 1); // return to the illegal value itself
- result = sourceIllegal;
- break;
- } else
- *target++ = 0xFFFD;
- } else
- *target++ = (UChar)ch; // normal case
- } else if (ch > 0x10FFFF) {
- if (strict) {
- result = sourceIllegal;
- source -= (extraBytesToRead + 1); // return to the start
- break; // Bail out; shouldn't continue
- } else
- *target++ = 0xFFFD;
- } else {
- // target is a character in range 0xFFFF - 0x10FFFF
- if (target + 1 >= targetEnd) {
- source -= (extraBytesToRead + 1); // Back up source pointer!
- result = targetExhausted;
- break;
- }
- ch -= 0x0010000UL;
- *target++ = (UChar)((ch >> 10) + 0xD800);
- *target++ = (UChar)((ch & 0x03FF) + 0xDC00);
- }
- }
- *sourceStart = source;
- *targetStart = target;
- return result;
-}
-
-}
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.h
deleted file mode 100644
index a5ed93e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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);
- }
-}
-
-#endif // WTF_UTF8_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
deleted file mode 100644
index d59439d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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>
-#else
-#error "Unknown Unicode implementation"
-#endif
-
-COMPILE_ASSERT(sizeof(UChar) == 2, UCharIsTwoBytes);
-
-#endif // WTF_UNICODE_H
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp
deleted file mode 100644
index e20c376..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "config.h"
-#include "UnicodeGLib.h"
-
-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;
-}
-
-int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
-{
- *error = false;
- GOwnPtr<GError> gerror;
-
- GOwnPtr<char> utf8src;
- utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr()));
- if (gerror) {
- *error = true;
- return -1;
- }
-
- GOwnPtr<char> utf8result;
- utf8result.set(g_utf8_casefold(utf8src.get(), -1));
-
- long utf16resultLength = -1;
- GOwnPtr<UChar> utf16result;
- utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr()));
- if (gerror) {
- *error = true;
- return -1;
- }
-
- if (utf16resultLength > resultLength) {
- *error = true;
- return utf16resultLength;
- }
- memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar));
-
- return utf16resultLength;
-}
-
-int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
-{
- *error = false;
- GOwnPtr<GError> gerror;
-
- GOwnPtr<char> utf8src;
- utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr()));
- if (gerror) {
- *error = true;
- return -1;
- }
-
- GOwnPtr<char> utf8result;
- utf8result.set(g_utf8_strdown(utf8src.get(), -1));
-
- long utf16resultLength = -1;
- GOwnPtr<UChar> utf16result;
- utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr()));
- if (gerror) {
- *error = true;
- return -1;
- }
-
- if (utf16resultLength > resultLength) {
- *error = true;
- return utf16resultLength;
- }
- memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar));
-
- return utf16resultLength;
-}
-
-int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
-{
- *error = false;
- GOwnPtr<GError> gerror;
-
- GOwnPtr<char> utf8src;
- utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr()));
- if (gerror) {
- *error = true;
- return -1;
- }
-
- GOwnPtr<char> utf8result;
- utf8result.set(g_utf8_strup(utf8src.get(), -1));
-
- long utf16resultLength = -1;
- GOwnPtr<UChar> utf16result;
- utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr()));
- if (gerror) {
- *error = true;
- return -1;
- }
-
- if (utf16resultLength > resultLength) {
- *error = true;
- return utf16resultLength;
- }
- memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar));
-
- return utf16resultLength;
-}
-
-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/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h
deleted file mode 100644
index 5d3eca6..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 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 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_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_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 U_MASK(x) ((uint32_t)1<<(x))
-
-#endif
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
deleted file mode 100644
index ecab5bd..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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(IPHONE_OS)
- 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) {
- CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII);
- return new Collator(buf);
- } else
- return new Collator("");
-#else
- return 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/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
deleted file mode 100644
index 9b1754a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * 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 <QChar>
-#include <QString>
-
-#include <config.h>
-
-#include <stdint.h>
-
-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)
-typedef wchar_t UChar;
-#else
-typedef uint16_t UChar;
-#endif
-typedef uint32_t UChar32;
-
-// some defines from ICU
-
-#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 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_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_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 U_MASK(x) ((uint32_t)1<<(x))
-
-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(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 ch)
-{
- return QChar::toUpper(ch);
-}
-
-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(c);
-}
-
-inline UChar32 foldCase(UChar32 c)
-{
- return QChar::toCaseFolded(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(c)) & test);
-}
-
-inline bool isSeparatorSpace(UChar32 c)
-{
- return QChar::category(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(c)) & test;
-}
-
-inline bool isLower(UChar32 c)
-{
- return QChar::category(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(c);
-}
-
-inline uint8_t combiningClass(UChar32 c)
-{
- return QChar::combiningClass(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(c);
-}
-
-inline CharCategory category(UChar32 c)
-{
- return (CharCategory) U_MASK(QChar::category(c));
-}
-
-} }
-
-#endif // WTF_UNICODE_QT4_H
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp
deleted file mode 100644
index 2df44f8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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 {
-
-wchar_t toLower(wchar_t c)
-{
- return towlower(c);
-}
-
-wchar_t toUpper(wchar_t c)
-{
- return towupper(c);
-}
-
-wchar_t foldCase(wchar_t c)
-{
- return towlower(c);
-}
-
-bool isPrintableChar(wchar_t c)
-{
- return !!iswprint(c);
-}
-
-bool isSpace(wchar_t c)
-{
- return !!iswspace(c);
-}
-
-bool isLetter(wchar_t c)
-{
- return !!iswalpha(c);
-}
-
-bool isUpper(wchar_t c)
-{
- return !!iswupper(c);
-}
-
-bool isLower(wchar_t c)
-{
- return !!iswlower(c);
-}
-
-bool isDigit(wchar_t c)
-{
- return !!iswdigit(c);
-}
-
-bool isPunct(wchar_t c)
-{
- return !!iswpunct(c);
-}
-
-int toLower(wchar_t* result, int resultLength, const wchar_t* 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 != 0);
- if (resultIterator < resultEnd)
- *resultIterator = 0;
-
- return (resultIterator - result) + remainingCharacters;
-}
-
-int toUpper(wchar_t* result, int resultLength, const wchar_t* 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 != 0);
- if (resultIterator < resultEnd)
- *resultIterator = 0;
-
- return (resultIterator - result) + remainingCharacters;
-}
-
-int foldCase(wchar_t* result, int resultLength, const wchar_t* 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;
-}
-
-wchar_t toTitleCase(wchar_t 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);
-}
-
-wchar_t mirroredChar(UChar32 c)
-{
- return UnicodeCE::mirroredChar(c);
-}
-
-int digitValue(wchar_t c)
-{
- return UnicodeCE::digitValue(c);
-}
-
-} // namespace Unicode
-} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h
deleted file mode 100644
index db656ec..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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 UNICODE_WINCE_H
-#define UNICODE_WINCE_H
-
-#include "ce_unicode.h"
-
-#define TO_MASK(x) (1 << (x))
-
-// some defines from ICU needed one or two places
-
-#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 U_IS_SURROGATE(c) (((c) & 0xfffff800) == 0xd800)
-#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
-#define U16_IS_SURROGATE_LEAD(c) (((c) & 0x400) == 0)
-
-#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_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_IS_SINGLE(c) !U_IS_SURROGATE(c)
-
-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(wchar_t);
- bool isLetter(wchar_t);
- bool isPrintableChar(wchar_t);
- bool isUpper(wchar_t);
- bool isLower(wchar_t);
- bool isPunct(wchar_t);
- bool isDigit(wchar_t);
- inline bool isSeparatorSpace(wchar_t c) { return category(c) == Separator_Space; }
- inline bool isHighSurrogate(wchar_t c) { return (c & 0xfc00) == 0xd800; }
- inline bool isLowSurrogate(wchar_t c) { return (c & 0xfc00) == 0xdc00; }
-
- wchar_t toLower(wchar_t);
- wchar_t toUpper(wchar_t);
- wchar_t foldCase(wchar_t);
- wchar_t toTitleCase(wchar_t);
- int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);
- int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);
- int foldCase(UChar* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);
-
- int digitValue(wchar_t);
-
- wchar_t mirroredChar(UChar32);
- unsigned char combiningClass(UChar32);
- DecompositionType decompositionType(UChar32);
- Direction direction(UChar32);
- inline bool isArabicChar(UChar32)
- {
- return false; // FIXME: implement!
- }
-
- inline bool hasLineBreakingPropertyComplexContext(UChar32)
- {
- return false; // FIXME: implement!
- }
-
- inline int umemcasecmp(const wchar_t* a, const wchar_t* b, int len)
- {
- for (int i = 0; i < len; ++i) {
- wchar_t c1 = foldCase(a[i]);
- wchar_t c2 = foldCase(b[i]);
- if (c1 != c2)
- return c1 - c2;
- }
- return 0;
- }
-
- inline UChar32 surrogateToUcs4(wchar_t high, wchar_t low)
- {
- return (UChar32(high) << 10) + low - 0x35fdc00;
- }
-
- } // namespace Unicode
-
-} // namespace WTF
-
-#endif
-// vim: ts=2 sw=2 et
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h
deleted file mode 100644
index 37174f0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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 FastMallocWince_h
-#define 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 // FastMallocWince_h
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp
deleted file mode 100644
index 9cd3d12..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp
+++ /dev/null
@@ -1,728 +0,0 @@
-/*
- * 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 "RegexCompiler.h"
-
-#include "RegexInterpreter.h"
-#include "RegexPattern.h"
-#include <wtf/Vector.h>
-
-#if ENABLE(YARR)
-
-using namespace WTF;
-
-namespace JSC { namespace Yarr {
-
-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();
-
- 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;
-};
-
-
-CharacterClass* newlineCreate()
-{
- CharacterClass* characterClass = new CharacterClass();
-
- characterClass->m_matches.append('\n');
- characterClass->m_matches.append('\r');
- characterClass->m_matchesUnicode.append(0x2028);
- characterClass->m_matchesUnicode.append(0x2029);
-
- return characterClass;
-}
-
-CharacterClass* digitsCreate()
-{
- CharacterClass* characterClass = new CharacterClass();
-
- characterClass->m_ranges.append(CharacterRange('0', '9'));
-
- return characterClass;
-}
-
-CharacterClass* spacesCreate()
-{
- CharacterClass* characterClass = new CharacterClass();
-
- characterClass->m_matches.append(' ');
- characterClass->m_ranges.append(CharacterRange('\t', '\r'));
- characterClass->m_matchesUnicode.append(0x00a0);
- characterClass->m_matchesUnicode.append(0x1680);
- characterClass->m_matchesUnicode.append(0x180e);
- characterClass->m_matchesUnicode.append(0x2028);
- characterClass->m_matchesUnicode.append(0x2029);
- characterClass->m_matchesUnicode.append(0x202f);
- characterClass->m_matchesUnicode.append(0x205f);
- characterClass->m_matchesUnicode.append(0x3000);
- characterClass->m_rangesUnicode.append(CharacterRange(0x2000, 0x200a));
-
- return characterClass;
-}
-
-CharacterClass* wordcharCreate()
-{
- CharacterClass* characterClass = new CharacterClass();
-
- characterClass->m_matches.append('_');
- characterClass->m_ranges.append(CharacterRange('0', '9'));
- characterClass->m_ranges.append(CharacterRange('A', 'Z'));
- characterClass->m_ranges.append(CharacterRange('a', 'z'));
-
- return characterClass;
-}
-
-CharacterClass* nondigitsCreate()
-{
- CharacterClass* characterClass = new CharacterClass();
-
- characterClass->m_ranges.append(CharacterRange(0, '0' - 1));
- characterClass->m_ranges.append(CharacterRange('9' + 1, 0x7f));
- characterClass->m_rangesUnicode.append(CharacterRange(0x80, 0xffff));
-
- return characterClass;
-}
-
-CharacterClass* nonspacesCreate()
-{
- CharacterClass* characterClass = new CharacterClass();
-
- characterClass->m_ranges.append(CharacterRange(0, '\t' - 1));
- characterClass->m_ranges.append(CharacterRange('\r' + 1, ' ' - 1));
- characterClass->m_ranges.append(CharacterRange(' ' + 1, 0x7f));
- characterClass->m_rangesUnicode.append(CharacterRange(0x0080, 0x009f));
- characterClass->m_rangesUnicode.append(CharacterRange(0x00a1, 0x167f));
- characterClass->m_rangesUnicode.append(CharacterRange(0x1681, 0x180d));
- characterClass->m_rangesUnicode.append(CharacterRange(0x180f, 0x1fff));
- characterClass->m_rangesUnicode.append(CharacterRange(0x200b, 0x2027));
- characterClass->m_rangesUnicode.append(CharacterRange(0x202a, 0x202e));
- characterClass->m_rangesUnicode.append(CharacterRange(0x2030, 0x205e));
- characterClass->m_rangesUnicode.append(CharacterRange(0x2060, 0x2fff));
- characterClass->m_rangesUnicode.append(CharacterRange(0x3001, 0xffff));
-
- return characterClass;
-}
-
-CharacterClass* nonwordcharCreate()
-{
- CharacterClass* characterClass = new CharacterClass();
-
- characterClass->m_matches.append('`');
- characterClass->m_ranges.append(CharacterRange(0, '0' - 1));
- characterClass->m_ranges.append(CharacterRange('9' + 1, 'A' - 1));
- characterClass->m_ranges.append(CharacterRange('Z' + 1, '_' - 1));
- characterClass->m_ranges.append(CharacterRange('z' + 1, 0x7f));
- characterClass->m_rangesUnicode.append(CharacterRange(0x80, 0xffff));
-
- return characterClass;
-}
-
-
-class RegexPatternConstructor {
-public:
- RegexPatternConstructor(RegexPattern& pattern)
- : m_pattern(pattern)
- , m_characterClassConstructor(pattern.m_ignoreCase)
- {
- }
-
- ~RegexPatternConstructor()
- {
- }
-
- void reset()
- {
- m_pattern.reset();
- m_characterClassConstructor.reset();
- }
-
- void assertionBOL()
- {
- 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));
- 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, invert));
- m_alternative = parenthesesDisjunction->addNewAlternative();
- }
-
- void atomParenthesesEnd()
- {
- ASSERT(m_alternative->m_parent);
- ASSERT(m_alternative->m_parent->m_parent);
- m_alternative = m_alternative->m_parent->m_parent;
-
- m_alternative->lastTerm().parentheses.lastSubpatternId = m_pattern.m_numSubpatterns;
- }
-
- void atomBackReference(unsigned subpatternId)
- {
- ASSERT(subpatternId);
- 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.invertOrCapture && (subpatternId == term.subpatternId)) {
- m_alternative->m_terms.append(PatternTerm::ForwardReference());
- return;
- }
- }
-
- m_alternative->m_terms.append(PatternTerm(subpatternId));
- }
-
- PatternDisjunction* copyDisjunction(PatternDisjunction* disjunction)
- {
- PatternDisjunction* newDisjunction = new PatternDisjunction();
-
- newDisjunction->m_parent = disjunction->m_parent;
- for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
- PatternAlternative* alternative = disjunction->m_alternatives[alt];
- PatternAlternative* newAlternative = newDisjunction->addNewAlternative();
- for (unsigned i = 0; i < alternative->m_terms.size(); ++i)
- newAlternative->m_terms.append(copyTerm(alternative->m_terms[i]));
- }
-
- m_pattern.m_disjunctions.append(newDisjunction);
- return newDisjunction;
- }
-
- PatternTerm copyTerm(PatternTerm& term)
- {
- if ((term.type != PatternTerm::TypeParenthesesSubpattern) && (term.type != PatternTerm::TypeParentheticalAssertion))
- return PatternTerm(term);
-
- PatternTerm termCopy = term;
- termCopy.parentheses.disjunction = copyDisjunction(termCopy.parentheses.disjunction);
- 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 == UINT_MAX) ? 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 = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize, currentInputPosition);
- currentInputPosition += term.parentheses.disjunction->m_minimumSize;
- } else {
- currentCallFrameSize += RegexStackSpaceForBackTrackInfoParenthesesOnce;
- 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);
- }
-
-private:
- RegexPattern& m_pattern;
- PatternAlternative* m_alternative;
- CharacterClassConstructor m_characterClassConstructor;
- bool m_invertCharacterClass;
-};
-
-
-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.setupOffsets();
-
- return false;
-};
-
-
-} }
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.h b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.h
deleted file mode 100644
index 9d2443a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 RegexCompiler_h
-#define RegexCompiler_h
-
-#if ENABLE(YARR)
-
-#include "RegexParser.h"
-#include "RegexPattern.h"
-#include <wtf/unicode/Unicode.h>
-
-namespace JSC { namespace Yarr {
-
-const char* compileRegex(const UString& patternString, RegexPattern& pattern);
-
-} } // namespace JSC::Yarr
-
-#endif
-
-#endif // RegexCompiler_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp
deleted file mode 100644
index 647b20a..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp
+++ /dev/null
@@ -1,1607 +0,0 @@
-/*
- * 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 "RegexInterpreter.h"
-
-#include "RegexCompiler.h"
-#include "RegexPattern.h"
-
-#ifndef NDEBUG
-#include <stdio.h>
-#endif
-
-#if ENABLE(YARR)
-
-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 inParentheses;
- };
- struct BackTrackInfoParentheses {
- uintptr_t matchAmount;
- ParenthesesDisjunctionContext* lastContext;
- uintptr_t prevBegin;
- uintptr_t prevEnd;
- };
-
- 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)
- {
- return new(malloc(sizeof(DisjunctionContext) + (disjunction->m_frameSize - 1) * sizeof(uintptr_t))) DisjunctionContext();
- }
-
- void freeDisjunctionContext(DisjunctionContext* context)
- {
- free(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)
- {
- return new(malloc(sizeof(ParenthesesDisjunctionContext) + (((term.atom.parenthesesDisjunction->m_numSubpatterns << 1) - 1) * sizeof(int)) + sizeof(DisjunctionContext) + (disjunction->m_frameSize - 1) * sizeof(uintptr_t))) ParenthesesDisjunctionContext(output, term);
- }
-
- void freeParenthesesDisjunctionContext(ParenthesesDisjunctionContext* context)
- {
- free(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 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;
- }
-
- 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;
-
- 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];
- ASSERT((matchBegin == -1) == (matchEnd == -1));
- ASSERT(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) == (matchEnd == -1));
- ASSERT(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);
- }
- void resetAssertionMatches(ByteTerm& term)
- {
- unsigned firstSubpatternId = term.atom.subpatternId;
- unsigned count = term.atom.parenthesesDisjunction->m_numSubpatterns;
- for (unsigned i = 0; i < (count << 1); ++i)
- output[(firstSubpatternId << 1) + i] = -1;
- }
- bool parenthesesDoBacktrack(ByteTerm& term, BackTrackInfoParentheses* backTrack)
- {
- while (backTrack->matchAmount) {
- ParenthesesDisjunctionContext* context = backTrack->lastContext;
-
- if (matchDisjunction(term.atom.parenthesesDisjunction, context->getDisjunctionContext(term), true))
- return true;
-
- resetMatches(term, context);
- popParenthesesDisjunctionContext(backTrack);
- freeParenthesesDisjunctionContext(context);
- }
-
- return false;
- }
-
- 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->inParentheses = 1;
- break;
- }
- case QuantifierNonGreedy: {
- backTrack->inParentheses = 0;
- 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*)
- {
- 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;
- }
- return true;
- }
-
- 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->inParentheses);
- backTrack->inParentheses = 0;
- context->term += term.atom.parenthesesWidth;
- return true;
- case QuantifierNonGreedy:
- ASSERT(backTrack->inParentheses);
- 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->inParentheses) {
- context->term -= term.atom.parenthesesWidth;
- return false;
- }
- case QuantifierNonGreedy:
- if (!backTrack->inParentheses) {
- // now try to match the parens; set this speculatively.
- backTrack->inParentheses = 1;
- if (term.capture()) {
- unsigned subpatternId = term.atom.subpatternId;
- output[(subpatternId << 1) + 1] = input.getPos() + term.inputPosition;
- }
- context->term -= term.atom.parenthesesWidth;
- return true;
- }
- case QuantifierFixedCount:
- break;
- }
-
- 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;
- }
-
- bool matchParentheses(ByteTerm& term, DisjunctionContext* context)
- {
- ASSERT(term.type == ByteTerm::TypeParenthesesSubpattern);
-
- BackTrackInfoParentheses* backTrack = reinterpret_cast<BackTrackInfoParentheses*>(context->frame + term.frameLocation);
-
- unsigned subpatternId = term.atom.subpatternId;
- ByteDisjunction* disjunctionBody = term.atom.parenthesesDisjunction;
-
- backTrack->prevBegin = output[(subpatternId << 1)];
- backTrack->prevEnd = output[(subpatternId << 1) + 1];
-
- 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);
- if (matchDisjunction(disjunctionBody, context->getDisjunctionContext(term)))
- appendParenthesesDisjunctionContext(backTrack, context);
- else {
- // The match failed; try to find an alternate point to carry on from.
- resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
- if (!parenthesesDoBacktrack(term, backTrack))
- return false;
- }
- }
-
- ASSERT(backTrack->matchAmount == term.atom.quantityCount);
- ParenthesesDisjunctionContext* context = backTrack->lastContext;
- recordParenthesesMatch(term, context);
- return true;
- }
-
- case QuantifierGreedy: {
- while (backTrack->matchAmount < term.atom.quantityCount) {
- ParenthesesDisjunctionContext* context = allocParenthesesDisjunctionContext(disjunctionBody, output, term);
- if (matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term)))
- appendParenthesesDisjunctionContext(backTrack, context);
- else {
- resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
- break;
- }
- }
-
- if (backTrack->matchAmount) {
- ParenthesesDisjunctionContext* context = backTrack->lastContext;
- recordParenthesesMatch(term, context);
- }
- return true;
- }
-
- case QuantifierNonGreedy:
- return true;
- }
-
- ASSERT_NOT_REACHED();
- return false;
- }
-
- // 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.
- //
- bool backtrackParentheses(ByteTerm& term, DisjunctionContext* context)
- {
- ASSERT(term.type == ByteTerm::TypeParenthesesSubpattern);
-
- BackTrackInfoParentheses* backTrack = reinterpret_cast<BackTrackInfoParentheses*>(context->frame + term.frameLocation);
-
- if (term.capture()) {
- unsigned subpatternId = term.atom.subpatternId;
- output[(subpatternId << 1)] = backTrack->prevBegin;
- output[(subpatternId << 1) + 1] = backTrack->prevEnd;
- }
-
- ByteDisjunction* disjunctionBody = term.atom.parenthesesDisjunction;
-
- switch (term.atom.quantityType) {
- case QuantifierFixedCount: {
- ASSERT(backTrack->matchAmount == term.atom.quantityCount);
-
- ParenthesesDisjunctionContext* context = 0;
-
- if (!parenthesesDoBacktrack(term, backTrack))
- return false;
-
- // 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);
- if (matchDisjunction(disjunctionBody, context->getDisjunctionContext(term)))
- appendParenthesesDisjunctionContext(backTrack, context);
- else {
- // The match failed; try to find an alternate point to carry on from.
- resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
- if (!parenthesesDoBacktrack(term, backTrack))
- return false;
- }
- }
-
- ASSERT(backTrack->matchAmount == term.atom.quantityCount);
- context = backTrack->lastContext;
- recordParenthesesMatch(term, context);
- return true;
- }
-
- case QuantifierGreedy: {
- if (!backTrack->matchAmount)
- return false;
-
- ParenthesesDisjunctionContext* context = backTrack->lastContext;
- if (matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term), true)) {
- while (backTrack->matchAmount < term.atom.quantityCount) {
- ParenthesesDisjunctionContext* context = allocParenthesesDisjunctionContext(disjunctionBody, output, term);
- if (matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term)))
- appendParenthesesDisjunctionContext(backTrack, context);
- else {
- resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
- break;
- }
- }
- } else {
- resetMatches(term, context);
- popParenthesesDisjunctionContext(backTrack);
- freeParenthesesDisjunctionContext(context);
- }
-
- if (backTrack->matchAmount) {
- ParenthesesDisjunctionContext* context = backTrack->lastContext;
- recordParenthesesMatch(term, context);
- }
- return true;
- }
-
- 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);
- if (matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term))) {
- appendParenthesesDisjunctionContext(backTrack, context);
- recordParenthesesMatch(term, context);
- return true;
- } else {
- resetMatches(term, context);
- freeParenthesesDisjunctionContext(context);
- }
- }
-
- // Nope - okay backtrack looking for an alternative.
- while (backTrack->matchAmount) {
- ParenthesesDisjunctionContext* context = backTrack->lastContext;
- if (matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term), true)) {
- // successful backtrack! we're back in the game!
- if (backTrack->matchAmount) {
- context = backTrack->lastContext;
- recordParenthesesMatch(term, context);
- }
- return true;
- }
-
- // pop a match off the stack
- resetMatches(term, context);
- popParenthesesDisjunctionContext(backTrack);
- freeParenthesesDisjunctionContext(context);
- }
-
- return false;
- }
- }
-
- ASSERT_NOT_REACHED();
- return false;
- }
-
-#define MATCH_NEXT() { ++context->term; goto matchAgain; }
-#define BACKTRACK() { --context->term; goto backtrack; }
-#define currentTerm() (disjunction->terms[context->term])
- bool matchDisjunction(ByteDisjunction* disjunction, DisjunctionContext* context, bool btrack = false)
- {
- if (btrack)
- BACKTRACK();
-
- 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 true;
-
- case ByteTerm::TypeBodyAlternativeBegin:
- MATCH_NEXT();
- case ByteTerm::TypeBodyAlternativeDisjunction:
- case ByteTerm::TypeBodyAlternativeEnd:
- context->matchEnd = input.getPos();
- return true;
-
- 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:
- if (matchParentheses(currentTerm(), context))
- MATCH_NEXT();
- BACKTRACK();
- case ByteTerm::TypeParenthesesSubpatternOnceBegin:
- if (matchParenthesesOnceBegin(currentTerm(), context))
- MATCH_NEXT();
- BACKTRACK();
- case ByteTerm::TypeParenthesesSubpatternOnceEnd:
- if (matchParenthesesOnceEnd(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 false;
- 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 false;
-
- input.next();
- context->matchBegin = input.getPos();
- 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:
- if (backtrackParentheses(currentTerm(), context))
- MATCH_NEXT();
- BACKTRACK();
- case ByteTerm::TypeParenthesesSubpatternOnceBegin:
- if (backtrackParenthesesOnceBegin(currentTerm(), context))
- MATCH_NEXT();
- BACKTRACK();
- case ByteTerm::TypeParenthesesSubpatternOnceEnd:
- if (backtrackParenthesesOnceEnd(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 false;
- }
-
- bool matchNonZeroDisjunction(ByteDisjunction* disjunction, DisjunctionContext* context, bool btrack = false)
- {
- if (matchDisjunction(disjunction, context, btrack)) {
- while (context->matchBegin == context->matchEnd) {
- if (!matchDisjunction(disjunction, context, true))
- return false;
- }
- return true;
- }
-
- return false;
- }
-
- int interpret()
- {
- for (unsigned i = 0; i < ((pattern->m_body->m_numSubpatterns + 1) << 1); ++i)
- output[i] = -1;
-
- DisjunctionContext* context = allocDisjunctionContext(pattern->m_body.get());
-
- if (matchDisjunction(pattern->m_body.get(), context)) {
- output[0] = context->matchBegin;
- output[1] = context->matchEnd;
- }
-
- freeDisjunctionContext(context);
-
- return output[0];
- }
-
- Interpreter(BytecodePattern* pattern, int* output, const UChar* inputChar, unsigned start, unsigned length)
- : pattern(pattern)
- , output(output)
- , input(inputChar, start, length)
- {
- }
-
-private:
- BytecodePattern *pattern;
- int* output;
- InputStream input;
-};
-
-
-
-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_bodyDisjunction = 0;
- m_currentAlternativeIndex = 0;
- }
-
- BytecodePattern* compile()
- {
- regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize);
- emitDisjunction(m_pattern.m_body);
- regexEnd();
-
- return new BytecodePattern(m_bodyDisjunction, m_allParenthesesInfo, m_pattern);
- }
-
- 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 atomParenthesesSubpatternBegin(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, 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, 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;
- }
-
- 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 atomParenthesesEnd(bool doInline, 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();
-
- bool isAssertion = m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin;
- bool invertOrCapture = m_bodyDisjunction->terms[beginTerm].invertOrCapture;
- unsigned subpatternId = m_bodyDisjunction->terms[beginTerm].atom.subpatternId;
-
- m_bodyDisjunction->terms.append(ByteTerm(isAssertion ? ByteTerm::TypeParentheticalAssertionEnd : ByteTerm::TypeParenthesesSubpatternOnceEnd, subpatternId, invertOrCapture, inputPosition));
- m_bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm;
- m_bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm;
- m_bodyDisjunction->terms[endTerm].frameLocation = frameLocation;
-
- if (doInline) {
- 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;
- } else {
- ByteTerm& parenthesesBegin = m_bodyDisjunction->terms[beginTerm];
- ASSERT(parenthesesBegin.type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
-
- bool invertOrCapture = parenthesesBegin.invertOrCapture;
- 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, invertOrCapture, inputPosition));
-
- m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
- m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
- m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
- }
- }
-
- void regexBegin(unsigned numSubpatterns, unsigned callFrameSize)
- {
- m_bodyDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize);
- m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin());
- m_bodyDisjunction->terms[0].frameLocation = 0;
- m_currentAlternativeIndex = 0;
- }
-
- void regexEnd()
- {
- closeBodyAlternative();
- }
-
- void alternativeBodyDisjunction()
- {
- int newAlternativeIndex = m_bodyDisjunction->terms.size();
- m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
- m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction());
-
- 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)
- {
- for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
- unsigned currentCountAlreadyChecked = inputCountAlreadyChecked;
-
- if (alt) {
- if (disjunction == m_pattern.m_body)
- alternativeBodyDisjunction();
- else
- alternativeDisjunction();
- }
-
- PatternAlternative* alternative = disjunction->m_alternatives[alt];
- unsigned minimumSize = alternative->m_minimumSize;
-
- ASSERT(minimumSize >= parenthesesInputCountAlreadyChecked);
- unsigned countToCheck = minimumSize - parenthesesInputCountAlreadyChecked;
- 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.invertOrCapture, 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.invertOrCapture, term.inputPosition - currentCountAlreadyChecked, term.frameLocation, term.quantityCount, term.quantityType);
- break;
-
- case PatternTerm::TypeBackReference:
- atomBackReference(term.subpatternId, 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) {
- if (term.quantityType == QuantifierFixedCount) {
- disjunctionAlreadyCheckedCount = term.parentheses.disjunction->m_minimumSize;
- unsigned delegateEndInputOffset = term.inputPosition - currentCountAlreadyChecked;
- atomParenthesesSubpatternBegin(term.parentheses.subpatternId, term.invertOrCapture, delegateEndInputOffset - disjunctionAlreadyCheckedCount, term.frameLocation, term.frameLocation);
- emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, term.parentheses.disjunction->m_minimumSize);
- atomParenthesesEnd(true, term.parentheses.lastSubpatternId, delegateEndInputOffset, term.frameLocation, term.quantityCount, term.quantityType, term.parentheses.disjunction->m_callFrameSize);
- } else {
- unsigned delegateEndInputOffset = term.inputPosition - currentCountAlreadyChecked;
- atomParenthesesSubpatternBegin(term.parentheses.subpatternId, term.invertOrCapture, delegateEndInputOffset - disjunctionAlreadyCheckedCount, term.frameLocation, term.frameLocation + RegexStackSpaceForBackTrackInfoParenthesesOnce);
- emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, 0);
- atomParenthesesEnd(true, term.parentheses.lastSubpatternId, delegateEndInputOffset, term.frameLocation, term.quantityCount, term.quantityType, term.parentheses.disjunction->m_callFrameSize);
- }
- } else {
- unsigned delegateEndInputOffset = term.inputPosition - currentCountAlreadyChecked;
- atomParenthesesSubpatternBegin(term.parentheses.subpatternId, term.invertOrCapture, delegateEndInputOffset - disjunctionAlreadyCheckedCount, term.frameLocation, 0);
- emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, 0);
- atomParenthesesEnd(false, term.parentheses.lastSubpatternId, delegateEndInputOffset, term.frameLocation, term.quantityCount, term.quantityType, term.parentheses.disjunction->m_callFrameSize);
- }
- break;
- }
-
- case PatternTerm::TypeParentheticalAssertion: {
- unsigned alternativeFrameLocation = term.frameLocation + RegexStackSpaceForBackTrackInfoParentheticalAssertion;
-
- atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invertOrCapture, term.frameLocation, alternativeFrameLocation);
- emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, 0);
- atomParenthesesEnd(true, term.parentheses.lastSubpatternId, 0, term.frameLocation, term.quantityCount, term.quantityType);
- break;
- }
- }
- }
- }
- }
-
-private:
- RegexPattern& m_pattern;
- ByteDisjunction* m_bodyDisjunction;
- unsigned m_currentAlternativeIndex;
- Vector<ParenthesesStackEntry> m_parenthesesStack;
- Vector<ByteDisjunction*> m_allParenthesesInfo;
-};
-
-
-BytecodePattern* byteCompileRegex(const UString& patternString, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline)
-{
- RegexPattern pattern(ignoreCase, multiline);
-
- if ((error = compileRegex(patternString, pattern)))
- return 0;
-
- numSubpatterns = pattern.m_numSubpatterns;
-
- return ByteCompiler(pattern).compile();
-}
-
-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);
-
-
-} }
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.h b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.h
deleted file mode 100644
index e3c3122..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.h
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * 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 RegexInterpreter_h
-#define RegexInterpreter_h
-
-#if ENABLE(YARR)
-
-#include "RegexParser.h"
-#include "RegexPattern.h"
-#include <wtf/unicode/Unicode.h>
-
-namespace JSC { namespace Yarr {
-
-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,
- TypeParentheticalAssertionBegin,
- TypeParentheticalAssertionEnd,
- TypeCheckInput,
- } type;
- bool invertOrCapture;
- 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;
- } alternative;
- unsigned checkInputCount;
- };
- unsigned frameLocation;
- int inputPosition;
-
- ByteTerm(UChar ch, int inputPos, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
- : frameLocation(frameLocation)
- {
- 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)
- {
- 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)
- , invertOrCapture(invert)
- {
- atom.characterClass = characterClass;
- atom.quantityType = QuantifierFixedCount;
- atom.quantityCount = 1;
- inputPosition = inputPos;
- }
-
- ByteTerm(Type type, unsigned subpatternId, ByteDisjunction* parenthesesInfo, bool invertOrCapture, int inputPos)
- : type(type)
- , invertOrCapture(invertOrCapture)
- {
- atom.subpatternId = subpatternId;
- atom.parenthesesDisjunction = parenthesesInfo;
- atom.quantityType = QuantifierFixedCount;
- atom.quantityCount = 1;
- inputPosition = inputPos;
- }
-
- ByteTerm(Type type, bool invert = false)
- : type(type)
- , invertOrCapture(invert)
- {
- atom.quantityType = QuantifierFixedCount;
- atom.quantityCount = 1;
- }
-
- ByteTerm(Type type, unsigned subpatternId, bool invertOrCapture, int inputPos)
- : type(type)
- , invertOrCapture(invertOrCapture)
- {
- 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, inputPos);
- }
-
- static ByteTerm BodyAlternativeBegin()
- {
- ByteTerm term(TypeBodyAlternativeBegin);
- term.alternative.next = 0;
- term.alternative.end = 0;
- return term;
- }
-
- static ByteTerm BodyAlternativeDisjunction()
- {
- ByteTerm term(TypeBodyAlternativeDisjunction);
- term.alternative.next = 0;
- term.alternative.end = 0;
- return term;
- }
-
- static ByteTerm BodyAlternativeEnd()
- {
- ByteTerm term(TypeBodyAlternativeEnd);
- term.alternative.next = 0;
- term.alternative.end = 0;
- return term;
- }
-
- static ByteTerm AlternativeBegin()
- {
- ByteTerm term(TypeAlternativeBegin);
- term.alternative.next = 0;
- term.alternative.end = 0;
- return term;
- }
-
- static ByteTerm AlternativeDisjunction()
- {
- ByteTerm term(TypeAlternativeDisjunction);
- term.alternative.next = 0;
- term.alternative.end = 0;
- return term;
- }
-
- static ByteTerm AlternativeEnd()
- {
- ByteTerm term(TypeAlternativeEnd);
- term.alternative.next = 0;
- term.alternative.end = 0;
- return term;
- }
-
- static ByteTerm SubpatternBegin()
- {
- return ByteTerm(TypeSubpatternBegin);
- }
-
- static ByteTerm SubpatternEnd()
- {
- return ByteTerm(TypeSubpatternEnd);
- }
-
- bool invert()
- {
- return invertOrCapture;
- }
-
- bool capture()
- {
- return invertOrCapture;
- }
-};
-
-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(ByteDisjunction* body, Vector<ByteDisjunction*> allParenthesesInfo, RegexPattern& pattern)
- : m_body(body)
- , m_ignoreCase(pattern.m_ignoreCase)
- , m_multiline(pattern.m_multiline)
- {
- 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();
- }
-
- ~BytecodePattern()
- {
- deleteAllValues(m_allParenthesesInfo);
- deleteAllValues(m_userCharacterClasses);
- }
-
- OwnPtr<ByteDisjunction> m_body;
- bool m_ignoreCase;
- bool m_multiline;
-
- CharacterClass* newlineCharacterClass;
- CharacterClass* wordcharCharacterClass;
-private:
- Vector<ByteDisjunction*> m_allParenthesesInfo;
- Vector<CharacterClass*> m_userCharacterClasses;
-};
-
-BytecodePattern* byteCompileRegex(const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase = false, bool multiline = false);
-int interpretRegex(BytecodePattern* v_regex, const UChar* input, unsigned start, unsigned length, int* output);
-
-} } // namespace JSC::Yarr
-
-#endif
-
-#endif // RegexInterpreter_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp
deleted file mode 100644
index 271d453..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp
+++ /dev/null
@@ -1,1421 +0,0 @@
-/*
- * 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 "RegexCompiler.h"
-
-#include "pcre.h" // temporary, remove when fallback is removed.
-
-#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)
- {
- 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 AlternativeBacktrackRecord {
- DataLabelPtr dataLabel;
- Label backtrackLocation;
-
- AlternativeBacktrackRecord(DataLabelPtr dataLabel, Label backtrackLocation)
- : dataLabel(dataLabel)
- , backtrackLocation(backtrackLocation)
- {
- }
- };
-
- struct TermGenerationState {
- TermGenerationState(PatternDisjunction* disjunction, unsigned checkedTotal)
- : disjunction(disjunction)
- , checkedTotal(checkedTotal)
- {
- }
-
- void resetAlternative()
- {
- isBackTrackGenerated = false;
- alt = 0;
- }
- bool alternativeValid()
- {
- return alt < disjunction->m_alternatives.size();
- }
- void nextAlternative()
- {
- ++alt;
- }
- PatternAlternative* alternative()
- {
- return disjunction->m_alternatives[alt];
- }
-
- void resetTerm()
- {
- ASSERT(alternativeValid());
- t = 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];
- }
-
- 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 jumpToBacktrack(Jump jump, MacroAssembler* masm)
- {
- if (isBackTrackGenerated)
- jump.linkTo(backtrackLabel, masm);
- else
- backTrackJumps.append(jump);
- }
- void jumpToBacktrack(JumpList& jumps, MacroAssembler* masm)
- {
- if (isBackTrackGenerated)
- jumps.linkTo(backtrackLabel, masm);
- else
- backTrackJumps.append(jumps);
- }
- bool plantJumpToBacktrackIfExists(MacroAssembler* masm)
- {
- if (isBackTrackGenerated) {
- masm->jump(backtrackLabel);
- return true;
- }
- return false;
- }
- void addBacktrackJump(Jump jump)
- {
- backTrackJumps.append(jump);
- }
- void setBacktrackGenerated(Label label)
- {
- isBackTrackGenerated = true;
- backtrackLabel = label;
- }
- void linkAlternativeBacktracks(MacroAssembler* masm)
- {
- isBackTrackGenerated = false;
- backTrackJumps.link(masm);
- }
- void linkAlternativeBacktracksTo(Label label, MacroAssembler* masm)
- {
- isBackTrackGenerated = false;
- backTrackJumps.linkTo(label, masm);
- }
- void propagateBacktrackingFrom(TermGenerationState& nestedParenthesesState, MacroAssembler* masm)
- {
- jumpToBacktrack(nestedParenthesesState.backTrackJumps, masm);
- if (nestedParenthesesState.isBackTrackGenerated)
- setBacktrackGenerated(nestedParenthesesState.backtrackLabel);
- }
-
- PatternDisjunction* disjunction;
- int checkedTotal;
- private:
- unsigned alt;
- unsigned t;
- JumpList backTrackJumps;
- Label backtrackLabel;
- bool isBackTrackGenerated;
- };
-
- 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(jump(), this);
-
- matchDest.link(this);
- } else {
- // Erk, really should poison out these alternatives early. :-/
- if (term.inputPosition)
- state.jumpToBacktrack(jump(), this);
- else
- state.jumpToBacktrack(branch32(NotEqual, index, Imm32(state.checkedTotal)), this);
- }
- }
-
- 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(jump(), this);
-
- matchDest.link(this);
- } else {
- if (term.inputPosition == state.checkedTotal)
- state.jumpToBacktrack(notAtEndOfInput(), this);
- // Erk, really should poison out these alternatives early. :-/
- else
- state.jumpToBacktrack(jump(), 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.invertOrCapture) {
- matchAssertionWordchar(state, nonWordCharThenNonWordChar, nonWordCharThenWordChar);
- nonWordCharThenWordChar.append(jump());
- } else {
- matchAssertionWordchar(state, nonWordCharThenWordChar, nonWordCharThenNonWordChar);
- nonWordCharThenNonWordChar.append(jump());
- }
- state.jumpToBacktrack(nonWordCharThenNonWordChar, this);
-
- // We jump here if the last character was a wordchar.
- matchDest.link(this);
- JumpList wordCharThenWordChar;
- JumpList wordCharThenNonWordChar;
- if (term.invertOrCapture) {
- matchAssertionWordchar(state, wordCharThenNonWordChar, wordCharThenWordChar);
- wordCharThenWordChar.append(jump());
- } else {
- matchAssertionWordchar(state, wordCharThenWordChar, wordCharThenNonWordChar);
- // This can fall-though!
- }
-
- state.jumpToBacktrack(wordCharThenWordChar, this);
-
- 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(branch32(NotEqual, character, Imm32(Unicode::toLower(ch))), this);
- } else {
- ASSERT(!m_pattern.m_ignoreCase || (Unicode::toLower(ch) == Unicode::toUpper(ch)));
- state.jumpToBacktrack(jumpIfCharNotEquals(ch, state.inputOffset()), this);
- }
- }
-
- 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(branch32(NotEqual, character, Imm32(chPair | mask)), this);
- } else
- state.jumpToBacktrack(branch32WithUnalignedHalfWords(NotEqual, BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), Imm32(chPair)), this);
- }
-
- 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(branch32(NotEqual, character, Imm32(Unicode::toLower(ch))), this);
- } else {
- ASSERT(!m_pattern.m_ignoreCase || (Unicode::toLower(ch) == Unicode::toUpper(ch)));
- state.jumpToBacktrack(branch16(NotEqual, BaseIndex(input, countRegister, TimesTwo, (state.inputOffset() + term.quantityCount) * sizeof(UChar)), Imm32(ch)), this);
- }
- 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);
- branch32(NotEqual, countRegister, Imm32(term.quantityCount)).linkTo(loop, this);
- failures.append(jump());
-
- Label backtrackBegin(this);
- loadFromFrame(term.frameLocation, countRegister);
- state.jumpToBacktrack(branchTest32(Zero, countRegister), this);
- sub32(Imm32(1), countRegister);
- sub32(Imm32(1), index);
-
- failures.link(this);
-
- storeToFrame(countRegister, term.frameLocation);
-
- state.setBacktrackGenerated(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(jump(), this);
-
- Label backtrackBegin(this);
- loadFromFrame(term.frameLocation, countRegister);
-
- atEndOfInput().linkTo(hardFail, this);
- 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.setBacktrackGenerated(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.invertOrCapture)
- state.jumpToBacktrack(matchDest, this);
- else {
- state.jumpToBacktrack(jump(), 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.invertOrCapture)
- state.jumpToBacktrack(matchDest, this);
- else {
- state.jumpToBacktrack(jump(), 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.invertOrCapture) {
- 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);
- branch32(NotEqual, countRegister, Imm32(term.quantityCount)).linkTo(loop, this);
- failures.append(jump());
-
- Label backtrackBegin(this);
- loadFromFrame(term.frameLocation, countRegister);
- state.jumpToBacktrack(branchTest32(Zero, countRegister), this);
- sub32(Imm32(1), countRegister);
- sub32(Imm32(1), index);
-
- failures.link(this);
-
- storeToFrame(countRegister, term.frameLocation);
-
- state.setBacktrackGenerated(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(jump(), 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.invertOrCapture)
- 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.setBacktrackGenerated(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.setBacktrackGenerated(backtrackBegin);
-
- state.jumpToBacktrack(jumpIfNoAvailableInput(countToCheck), this);
- state.checkedTotal += countToCheck;
- }
-
- for (state.resetTerm(); state.termValid(); state.nextTerm())
- generateTerm(state);
-
- state.checkedTotal -= countToCheck;
- } else {
- JumpList successes;
-
- 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);
- successes.append(jump());
-
- // Alternative did not match.
- Label backtrackLocation(this);
-
- // Can we backtrack the alternative? - if so, do so. If not, just fall through to the next one.
- state.plantJumpToBacktrackIfExists(this);
-
- state.linkAlternativeBacktracks(this);
-
- if (countToCheck) {
- sub32(Imm32(countToCheck), index);
- state.checkedTotal -= countToCheck;
- }
-
- m_backtrackRecords.append(AlternativeBacktrackRecord(dataLabel, backtrackLocation));
- }
- // We fall through to here when the last alternative fails.
- // Add a backtrack out of here for the parenthese handling code to link up.
- state.addBacktrackJump(jump());
-
- // Generate a trampoline for the parens code to backtrack to, to retry the
- // next alternative.
- state.setBacktrackGenerated(label());
- loadFromFrameAndJump(alternativeFrameLocation);
-
- // FIXME: both of the above hooks are a little inefficient, in that you
- // may end up trampolining here, just to trampoline back out to the
- // parentheses code, or vice versa. We can probably eliminate a jump
- // by restructuring, but coding this way for now for simplicity during
- // development.
-
- 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.quantityCount == 1) && (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.invertOrCapture && (term.quantityType == QuantifierFixedCount)) {
- 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 backTrackJumps vector, and that if they need backtracking
- // they will have set an entry point on the parenthesesState's backtrackLabel.
- state.propagateBacktrackingFrom(parenthesesState, this);
- } else {
- Jump nonGreedySkipParentheses;
- Label nonGreedyTryParentheses;
- if (term.quantityType == QuantifierGreedy)
- storeToFrame(Imm32(1), parenthesesFrameLocation);
- else if (term.quantityType == QuantifierNonGreedy) {
- storeToFrame(Imm32(0), parenthesesFrameLocation);
- nonGreedySkipParentheses = jump();
- nonGreedyTryParentheses = label();
- storeToFrame(Imm32(1), parenthesesFrameLocation);
- }
-
- // store the match start index
- if (term.invertOrCapture) {
- 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)));
- }
-
- // generate the body of the parentheses
- TermGenerationState parenthesesState(disjunction, state.checkedTotal);
- generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation);
-
- // store the match end index
- if (term.invertOrCapture) {
- 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)));
- }
- Jump success = jump();
-
- // A failure AFTER the parens jumps here
- Label backtrackFromAfterParens(this);
-
- if (term.quantityType == QuantifierGreedy) {
- // If this is zero we have now tested with both with and without the parens.
- loadFromFrame(parenthesesFrameLocation, indexTemporary);
- state.jumpToBacktrack(branchTest32(Zero, indexTemporary), this);
- } else if (term.quantityType == QuantifierNonGreedy) {
- // If this is zero we have now tested with both with and without the parens.
- loadFromFrame(parenthesesFrameLocation, indexTemporary);
- branchTest32(Zero, indexTemporary).linkTo(nonGreedyTryParentheses, this);
- }
-
- parenthesesState.plantJumpToBacktrackIfExists(this);
- // A failure WITHIN the parens jumps here
- parenthesesState.linkAlternativeBacktracks(this);
- if (term.invertOrCapture) {
- store32(Imm32(-1), Address(output, (term.parentheses.subpatternId << 1) * sizeof(int)));
- store32(Imm32(-1), Address(output, ((term.parentheses.subpatternId << 1) + 1) * sizeof(int)));
- }
-
- if (term.quantityType == QuantifierGreedy)
- storeToFrame(Imm32(0), parenthesesFrameLocation);
- else
- state.jumpToBacktrack(jump(), this);
-
- state.setBacktrackGenerated(backtrackFromAfterParens);
- if (term.quantityType == QuantifierNonGreedy)
- nonGreedySkipParentheses.link(this);
- success.link(this);
- }
- }
-
- 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.invertOrCapture) {
- // 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(jump(), 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(jump(), 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_generationFailed = true;
- break;
-
- case PatternTerm::TypeForwardReference:
- break;
-
- case PatternTerm::TypeParenthesesSubpattern:
- if ((term.quantityCount == 1) && !term.parentheses.isCopy)
- generateParenthesesSingle(state);
- else
- m_generationFailed = true;
- break;
-
- case PatternTerm::TypeParentheticalAssertion:
- generateParentheticalAssertion(state);
- break;
- }
- }
-
- void generateDisjunction(PatternDisjunction* disjunction)
- {
- TermGenerationState state(disjunction, 0);
- state.resetAlternative();
-
- // Plant a check to see if there is sufficient input available to run the first alternative.
- // Jumping back to the label 'firstAlternative' will get to this check, jumping to
- // 'firstAlternativeInputChecked' will jump directly to matching the alternative having
- // skipped this check.
-
- Label firstAlternative(this);
-
- // check availability for the next alternative
- int countCheckedForCurrentAlternative = 0;
- int countToCheckForFirstAlternative = 0;
- bool hasShorterAlternatives = false;
- JumpList notEnoughInputForPreviousAlternative;
-
- if (state.alternativeValid()) {
- PatternAlternative* alternative = state.alternative();
- countToCheckForFirstAlternative = alternative->m_minimumSize;
- state.checkedTotal += countToCheckForFirstAlternative;
- if (countToCheckForFirstAlternative)
- notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForFirstAlternative));
- countCheckedForCurrentAlternative = countToCheckForFirstAlternative;
- }
-
- Label firstAlternativeInputChecked(this);
-
- while (state.alternativeValid()) {
- // Track whether any alternatives are shorter than the first one.
- hasShorterAlternatives = hasShorterAlternatives || (countCheckedForCurrentAlternative < countToCheckForFirstAlternative);
-
- PatternAlternative* alternative = state.alternative();
- optimizeAlternative(alternative);
-
- 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);
- } else
- pop(returnRegister);
- store32(index, Address(output, 4));
- store32(returnRegister, output);
-
- generateReturn();
-
- state.nextAlternative();
-
- // if there are any more alternatives, plant the check for input before looping.
- if (state.alternativeValid()) {
- PatternAlternative* nextAlternative = state.alternative();
- int countToCheckForNextAlternative = nextAlternative->m_minimumSize;
-
- if (countCheckedForCurrentAlternative > countToCheckForNextAlternative) { // CASE 1: current alternative was longer than the next one.
- // If we get here, there 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, there 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, there 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;
-
- // 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);
- 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(firstAlternativeInputChecked, this);
- else { // no need to check the input, but we do have some bookkeeping to do first.
- state.linkAlternativeBacktracks(this);
-
- // Where necessary update our preserved start position.
- if (!m_pattern.m_body->m_hasFixedSize) {
- move(index, regT0);
- sub32(Imm32(countCheckedForCurrentAlternative - 1), regT0);
- poke(regT0, m_pattern.m_body->m_callFrameSize);
- }
-
- // 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);
- poke(regT0, m_pattern.m_body->m_callFrameSize);
- } else
- poke(index, m_pattern.m_body->m_callFrameSize);
- }
- // 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!)
-
- unsigned frameSize = m_pattern.m_body->m_callFrameSize;
- if (!m_pattern.m_body->m_hasFixedSize)
- ++frameSize;
- if (frameSize)
- addPtr(Imm32(frameSize * sizeof(void*)), stackPointerRegister);
-
- move(Imm32(-1), returnRegister);
-
- generateReturn();
- }
-
- 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);
- 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)
- pop(ARMRegisters::r6);
- pop(ARMRegisters::r5);
- pop(ARMRegisters::r4);
-#elif CPU(MIPS)
- // Do nothing
-#endif
- ret();
- }
-
-public:
- RegexGenerator(RegexPattern& pattern)
- : m_pattern(pattern)
- , m_generationFailed(false)
- {
- }
-
- void generate()
- {
- generateEnter();
-
- // TODO: do I really want this on the stack?
- if (!m_pattern.m_body->m_hasFixedSize)
- push(index);
-
- 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->executableAllocator.poolForSize(size()));
-
- for (unsigned i = 0; i < m_backtrackRecords.size(); ++i)
- patchBuffer.patch(m_backtrackRecords[i].dataLabel, patchBuffer.locationOf(m_backtrackRecords[i].backtrackLocation));
-
- jitObject.set(patchBuffer.finalizeCode());
- }
-
- bool generationFailed()
- {
- return m_generationFailed;
- }
-
-private:
- RegexPattern& m_pattern;
- Vector<AlternativeBacktrackRecord> m_backtrackRecords;
- bool m_generationFailed;
-};
-
-void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& patternString, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline)
-{
- RegexPattern pattern(ignoreCase, multiline);
-
- if ((error = compileRegex(patternString, pattern)))
- return;
-
- numSubpatterns = pattern.m_numSubpatterns;
-
- RegexGenerator generator(pattern);
- generator.compile(globalData, jitObject);
-
- if (generator.generationFailed()) {
- JSRegExpIgnoreCaseOption ignoreCaseOption = ignoreCase ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase;
- JSRegExpMultilineOption multilineOption = multiline ? JSRegExpMultiline : JSRegExpSingleLine;
- jitObject.setFallback(jsRegExpCompile(reinterpret_cast<const UChar*>(patternString.data()), patternString.size(), ignoreCaseOption, multilineOption, &numSubpatterns, &error));
- }
-}
-
-}}
-
-#endif
-
-
-
-
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h
deleted file mode 100644
index fd765bc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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>
-
-#include <pcre.h>
-struct JSRegExp; // temporary, remove when fallback is removed.
-
-#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_fallback(0)
- {
- }
-
- ~RegexCodeBlock()
- {
- if (m_fallback)
- jsRegExpFree(m_fallback);
- }
-
- JSRegExp* getFallback() { return m_fallback; }
- void setFallback(JSRegExp* fallback) { m_fallback = fallback; }
-
- bool operator!() { return !m_ref.m_code.executableAddress(); }
- 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);
- }
-
-private:
- MacroAssembler::CodeRef m_ref;
- JSRegExp* m_fallback;
-};
-
-void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase = false, bool multiline = false);
-
-inline int executeRegex(RegexCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output, int outputArraySize)
-{
- if (JSRegExp* fallback = jitObject.getFallback())
- return (jsRegExpExecute(fallback, input, length, start, output, outputArraySize) < 0) ? -1 : output[0];
-
- return jitObject.execute(input, start, length, output);
-}
-
-} } // namespace JSC::Yarr
-
-#endif
-
-#endif // RegexJIT_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexParser.h b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexParser.h
deleted file mode 100644
index c946c2e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexParser.h
+++ /dev/null
@@ -1,852 +0,0 @@
-/*
- * 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
-
-#if ENABLE(YARR)
-
-#include <UString.h>
-#include <limits.h>
-#include <wtf/ASCIICType.h>
-#include <wtf/unicode/Unicode.h>
-
-namespace JSC { namespace Yarr {
-
-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);
- }
-
- /*
- * atomPatternCharacterUnescaped():
- *
- * This method is called directly from parseCharacterClass(), to report a new
- * pattern character token. This method differs from atomPatternCharacter(),
- * which will be called from parseEscape(), since a hypen provided via this
- * method may be indicating a character range, but a hyphen parsed by
- * parseEscape() cannot be interpreted as doing so.
- */
- void atomPatternCharacterUnescaped(UChar ch)
- {
- switch (m_state) {
- case empty:
- m_character = ch;
- m_state = cachedCharacter;
- break;
-
- case cachedCharacter:
- if (ch == '-')
- m_state = cachedCharacterHyphen;
- else {
- m_delegate.atomCharacterClassAtom(m_character);
- m_character = ch;
- }
- break;
-
- case cachedCharacterHyphen:
- if (ch >= m_character)
- m_delegate.atomCharacterClassRange(m_character, ch);
- else
- m_err = CharacterClassOutOfOrder;
- m_state = empty;
- }
- }
-
- /*
- * atomPatternCharacter():
- *
- * Adds a pattern character, called by parseEscape(), as such will not
- * interpret a hyphen as indicating a character range.
- */
- void atomPatternCharacter(UChar ch)
- {
- // Flush if a character is already pending to prevent the
- // hyphen from begin interpreted as indicating a range.
- if((ch == '-') && (m_state == cachedCharacter))
- flush();
-
- atomPatternCharacterUnescaped(ch);
- }
-
- /*
- * atomBuiltInCharacterClass():
- *
- * Adds a built-in character class, called by parseEscape().
- */
- void atomBuiltInCharacterClass(BuiltInCharacterClassID classID, bool invert)
- {
- flush();
- m_delegate.atomCharacterClassBuiltIn(classID, invert);
- }
-
- /*
- * end():
- *
- * Called at end of construction.
- */
- void end()
- {
- flush();
- 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:
- void flush()
- {
- if (m_state != empty) // either cachedCharacter or cachedCharacterHyphen
- m_delegate.atomCharacterClassAtom(m_character);
- if (m_state == cachedCharacterHyphen)
- m_delegate.atomCharacterClassAtom('-');
- m_state = empty;
- }
-
- Delegate& m_delegate;
- ErrorCode& m_err;
- enum CharacterClassConstructionState {
- empty,
- cachedCharacter,
- cachedCharacterHyphen,
- } 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.data())
- , m_size(pattern.size())
- , 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.atomPatternCharacterUnescaped(consume());
- }
-
- 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, UINT_MAX);
- lastTokenWasAnAtom = false;
- break;
-
- case '+':
- consume();
- parseQuantifier(lastTokenWasAnAtom, 1, UINT_MAX);
- 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() : UINT_MAX;
-
- 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 = UINT_MAX)
-{
- return Parser<Delegate>(delegate, pattern, backReferenceLimit).parse();
-}
-
-} } // namespace JSC::Yarr
-
-#endif
-
-#endif // RegexParser_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h
deleted file mode 100644
index 2e8f468..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * 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 RegexPattern_h
-#define RegexPattern_h
-
-
-#if ENABLE(YARR)
-
-#include <wtf/Vector.h>
-#include <wtf/unicode/Unicode.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 RegexStackSpaceForBackTrackInfoParentheses 4
-
-struct PatternDisjunction;
-
-struct CharacterRange {
- UChar begin;
- UChar end;
-
- CharacterRange(UChar begin, UChar end)
- : begin(begin)
- , end(end)
- {
- }
-};
-
-struct CharacterClass : FastAllocBase {
- Vector<UChar> m_matches;
- Vector<CharacterRange> m_ranges;
- Vector<UChar> m_matchesUnicode;
- Vector<CharacterRange> m_rangesUnicode;
-};
-
-enum QuantifierType {
- QuantifierFixedCount,
- QuantifierGreedy,
- QuantifierNonGreedy,
-};
-
-struct PatternTerm {
- enum Type {
- TypeAssertionBOL,
- TypeAssertionEOL,
- TypeAssertionWordBoundary,
- TypePatternCharacter,
- TypeCharacterClass,
- TypeBackReference,
- TypeForwardReference,
- TypeParenthesesSubpattern,
- TypeParentheticalAssertion,
- } type;
- bool invertOrCapture;
- union {
- UChar patternCharacter;
- CharacterClass* characterClass;
- unsigned subpatternId;
- struct {
- PatternDisjunction* disjunction;
- unsigned subpatternId;
- unsigned lastSubpatternId;
- bool isCopy;
- } parentheses;
- };
- QuantifierType quantityType;
- unsigned quantityCount;
- int inputPosition;
- unsigned frameLocation;
-
- PatternTerm(UChar ch)
- : type(PatternTerm::TypePatternCharacter)
- {
- patternCharacter = ch;
- quantityType = QuantifierFixedCount;
- quantityCount = 1;
- }
-
- PatternTerm(CharacterClass* charClass, bool invert)
- : type(PatternTerm::TypeCharacterClass)
- , invertOrCapture(invert)
- {
- characterClass = charClass;
- quantityType = QuantifierFixedCount;
- quantityCount = 1;
- }
-
- PatternTerm(Type type, unsigned subpatternId, PatternDisjunction* disjunction, bool invertOrCapture)
- : type(type)
- , invertOrCapture(invertOrCapture)
- {
- parentheses.disjunction = disjunction;
- parentheses.subpatternId = subpatternId;
- parentheses.isCopy = false;
- quantityType = QuantifierFixedCount;
- quantityCount = 1;
- }
-
- PatternTerm(Type type, bool invert = false)
- : type(type)
- , invertOrCapture(invert)
- {
- quantityType = QuantifierFixedCount;
- quantityCount = 1;
- }
-
- PatternTerm(unsigned spatternId)
- : type(TypeBackReference)
- , invertOrCapture(false)
- {
- subpatternId = 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 invertOrCapture;
- }
-
- bool capture()
- {
- return invertOrCapture;
- }
-
- void quantify(unsigned count, QuantifierType type)
- {
- quantityCount = count;
- quantityType = type;
- }
-};
-
-struct PatternAlternative : FastAllocBase {
- PatternAlternative(PatternDisjunction* disjunction)
- : m_parent(disjunction)
- {
- }
-
- 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);
- }
-
- Vector<PatternTerm> m_terms;
- PatternDisjunction* m_parent;
- unsigned m_minimumSize;
- bool m_hasFixedSize;
-};
-
-struct PatternDisjunction : FastAllocBase {
- PatternDisjunction(PatternAlternative* parent = 0)
- : m_parent(parent)
- {
- }
-
- ~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 RegexPattern {
- RegexPattern(bool ignoreCase, bool multiline)
- : m_ignoreCase(ignoreCase)
- , m_multiline(multiline)
- , m_numSubpatterns(0)
- , m_maxBackReference(0)
- , newlineCached(0)
- , digitsCached(0)
- , spacesCached(0)
- , wordcharCached(0)
- , nondigitsCached(0)
- , nonspacesCached(0)
- , nonwordcharCached(0)
- {
- }
-
- ~RegexPattern()
- {
- deleteAllValues(m_disjunctions);
- deleteAllValues(m_userCharacterClasses);
- }
-
- void reset()
- {
- m_numSubpatterns = 0;
- m_maxBackReference = 0;
-
- 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();
- }
-
- 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;
- bool m_multiline;
- unsigned m_numSubpatterns;
- unsigned m_maxBackReference;
- PatternDisjunction* m_body;
- Vector<PatternDisjunction*, 4> m_disjunctions;
- Vector<CharacterClass*> m_userCharacterClasses;
-
-private:
- CharacterClass* newlineCached;
- CharacterClass* digitsCached;
- CharacterClass* spacesCached;
- CharacterClass* wordcharCached;
- CharacterClass* nondigitsCached;
- CharacterClass* nonspacesCached;
- CharacterClass* nonwordcharCached;
-};
-
-} } // namespace JSC::Yarr
-
-#endif
-
-#endif // RegexPattern_h
diff --git a/src/3rdparty/webkit/Source/CMakeLists.txt b/src/3rdparty/webkit/Source/CMakeLists.txt
new file mode 100644
index 0000000..cdaa555
--- /dev/null
+++ b/src/3rdparty/webkit/Source/CMakeLists.txt
@@ -0,0 +1,138 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+PROJECT(WebKit)
+
+# Set a default build type if and only if user did not define one as command
+# line options and he did not give custom CFLAGS or CXXFLAGS. Otherwise, flags
+# from default build type would overwrite user-defined ones.
+IF (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS AND NOT CMAKE_CXX_FLAGS)
+ SET(CMAKE_BUILD_TYPE Release)
+ENDIF ()
+SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
+
+SET(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/JavaScriptCore")
+SET(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/WebCore")
+SET(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/WebKit")
+SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/../Tools")
+SET(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
+SET(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
+
+INCLUDE(WebKitMacros)
+INCLUDE(WebKitFS)
+INCLUDE(WebKitHelpers)
+INCLUDE(WebKitFeatures)
+
+# -----------------------------------------------------------------------------
+# Determine which port will be built
+# -----------------------------------------------------------------------------
+SET(ALL_PORTS Efl WinCE)
+SET(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
+
+LIST(FIND ALL_PORTS ${PORT} RET)
+IF (${RET} EQUAL -1)
+ MESSAGE(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
+ENDIF ()
+
+# -----------------------------------------------------------------------------
+# Find common packages (used by all ports)
+# -----------------------------------------------------------------------------
+FIND_PACKAGE(BISON REQUIRED)
+FIND_PACKAGE(FLEX REQUIRED)
+FIND_PACKAGE(Gperf REQUIRED)
+FIND_PACKAGE(Perl REQUIRED)
+FIND_PACKAGE(PythonInterp REQUIRED)
+
+# -----------------------------------------------------------------------------
+# Determine the target processor
+# -----------------------------------------------------------------------------
+STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
+IF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ SET(WTF_CPU_ARM 1)
+ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)")
+ SET(WTF_CPU_X86_64 1)
+ELSEIF (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
+ SET(WTF_CPU_X86 1)
+ELSE ()
+ MESSAGE(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
+ENDIF ()
+
+# -----------------------------------------------------------------------------
+# Determine the operating system
+# -----------------------------------------------------------------------------
+IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
+ SET(WTF_OS_UNIX 1)
+
+ IF (APPLE)
+ SET(WTF_OS_MAC_OS_X 1)
+ ENDIF ()
+ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ SET(WTF_OS_WINDOWS 1)
+ELSE ()
+ MESSAGE(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
+ENDIF ()
+
+# -----------------------------------------------------------------------------
+# Default target names (can be overrriden in Options${PORT}.cmake file)
+# -----------------------------------------------------------------------------
+SET(JSC_EXECUTABLE_NAME JSC)
+SET(WTF_LIBRARY_NAME WTF)
+SET(JavaScriptCore_LIBRARY_NAME JavaScriptCore)
+SET(WebCore_LIBRARY_NAME WebCore)
+SET(WebKit_LIBRARY_NAME WebKit)
+
+# -----------------------------------------------------------------------------
+# Default library types
+# -----------------------------------------------------------------------------
+OPTION(SHARED_CORE "build WTF, JavaScriptCore and WebCore as shared libraries")
+
+IF (SHARED_CORE)
+ SET(WTF_LIBRARY_TYPE SHARED)
+ SET(JavaScriptCore_LIBRARY_TYPE SHARED)
+ SET(WebCore_LIBRARY_TYPE SHARED)
+ELSE ()
+ SET(WTF_LIBRARY_TYPE STATIC)
+ SET(JavaScriptCore_LIBRARY_TYPE STATIC)
+ SET(WebCore_LIBRARY_TYPE STATIC)
+ENDIF ()
+
+SET(WebKit_LIBRARY_TYPE SHARED)
+
+# -----------------------------------------------------------------------------
+# Port-specific options
+# -----------------------------------------------------------------------------
+INCLUDE(OptionsCommon)
+INCLUDE(Options${PORT})
+
+# -----------------------------------------------------------------------------
+# Define packaging
+# -----------------------------------------------------------------------------
+INCLUDE(WebKitPackaging)
+
+# -----------------------------------------------------------------------------
+# Add module directories
+# -----------------------------------------------------------------------------
+ADD_SUBDIRECTORY(JavaScriptCore)
+ADD_SUBDIRECTORY(WebCore)
+ADD_SUBDIRECTORY(WebKit)
+
+# -----------------------------------------------------------------------------
+# Add test browser if exists
+# -----------------------------------------------------------------------------
+INCLUDE_IF_EXISTS(${TOOLS_DIR}/CMakeLists${PORT}.txt)
+
+# -----------------------------------------------------------------------------
+# Set compiler flags for all targets
+# -----------------------------------------------------------------------------
+WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WTF_LIBRARY_NAME})
+WEBKIT_SET_EXTRA_COMPILER_FLAGS(${JavaScriptCore_LIBRARY_NAME})
+WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WebCore_LIBRARY_NAME})
+WEBKIT_SET_EXTRA_COMPILER_FLAGS(${WebKit_LIBRARY_NAME})
+
+# -----------------------------------------------------------------------------
+# Create the configuration file
+# -----------------------------------------------------------------------------
+CONFIGURE_FILE(cmakeconfig.h.cmake ${CMAKE_BINARY_DIR}/cmakeconfig.h @ONLY)
+
+# -----------------------------------------------------------------------------
+# Prints a summary of all enabled/disabled features
+# -----------------------------------------------------------------------------
+WEBKIT_PRINT_FEATURES()
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/APICast.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/APICast.h
new file mode 100644
index 0000000..4294d3d
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/API/APIShims.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/APIShims.h
new file mode 100644
index 0000000..2e13851
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/APIShims.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 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))
+ {
+ UNUSED_PARAM(registerThread);
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ if (registerThread)
+ globalData->heap.machineThreads().addCurrentThread();
+#endif
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSBase.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSBase.cpp
new file mode 100644
index 0000000..c5f1b15
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSBase.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSBase.h
new file mode 100644
index 0000000..fed54fe
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSBase.h
@@ -0,0 +1,138 @@
+/*
+ * 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 */
+/* These rules should stay the same as in WebKit2/Shared/API/c/WKBase.h */
+
+#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) || defined(__CC_ARM) || defined(__ARMCC__)
+#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
+#define JS_EXPORT __declspec(dllexport)
+#else
+#define JS_EXPORT __declspec(dllimport)
+#endif
+#else /* !defined(JS_NO_EXPORT) */
+#define JS_EXPORT
+#endif /* defined(JS_NO_EXPORT) */
+
+/* JS tests uses WTF but has no config.h, so we need to set the export defines here. */
+#ifndef WTF_EXPORT_PRIVATE
+#define WTF_EXPORT_PRIVATE 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/src/3rdparty/webkit/JavaScriptCore/API/JSBasePrivate.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSBasePrivate.h
index befa316..befa316 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSBasePrivate.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSBasePrivate.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.cpp
new file mode 100644
index 0000000..fa9d216
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.cpp
@@ -0,0 +1,90 @@
+/*
+ * 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::s_info = { "CallbackConstructor", &JSObjectWithGlobalObject::s_info, 0, 0 };
+
+JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
+ : JSObjectWithGlobalObject(globalObject, structure)
+ , m_class(jsClass)
+ , m_callback(callback)
+{
+ ASSERT(inherits(&s_info));
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.h
new file mode 100644
index 0000000..64b237d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackConstructor.h
@@ -0,0 +1,59 @@
+/*
+ * 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*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback);
+ virtual ~JSCallbackConstructor();
+ JSClassRef classRef() const { return m_class; }
+ JSObjectCallAsConstructorCallback callback() const { return m_callback; }
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+protected:
+ static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
+
+private:
+ virtual ConstructType getConstructData(ConstructData&);
+
+ JSClassRef m_class;
+ JSObjectCallAsConstructorCallback m_callback;
+};
+
+} // namespace JSC
+
+#endif // JSCallbackConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.cpp
new file mode 100644
index 0000000..28b3419
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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::s_info = { "CallbackFunction", &InternalFunction::s_info, 0, 0 };
+
+JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name)
+ : InternalFunction(&exec->globalData(), globalObject, globalObject->callbackFunctionStructure(), name)
+ , m_callback(callback)
+{
+ ASSERT(inherits(&s_info));
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.h
new file mode 100644
index 0000000..55c9ed4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackFunction.h
@@ -0,0 +1,57 @@
+/*
+ * 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 s_info;
+
+ // InternalFunction mish-mashes constructor and function behavior -- we should
+ // refactor the code so this override isn't necessary
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+private:
+ virtual CallType getCallData(CallData&);
+
+ static EncodedJSValue JSC_HOST_CALL call(ExecState*);
+
+ JSObjectCallAsFunctionCallback m_callback;
+};
+
+} // namespace JSC
+
+#endif // JSCallbackFunction_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.cpp
new file mode 100644
index 0000000..6a7462a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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 "Heap.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>::s_info = { "CallbackObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
+template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject", &JSGlobalObject::s_info, 0, 0 };
+
+void JSCallbackObjectData::finalize(Handle<Unknown> handle, void* context)
+{
+ JSClassRef jsClass = static_cast<JSClassRef>(context);
+ JSObjectRef thisRef = toRef(asObject(handle.get()));
+
+ for (; jsClass; jsClass = jsClass->parentClass)
+ if (JSObjectFinalizeCallback finalize = jsClass->finalize)
+ finalize(thisRef);
+ HandleSlot slot = handle.slot();
+ HandleHeap::heapFor(slot)->deallocate(slot);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.h
new file mode 100644
index 0000000..338d057
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObject.h
@@ -0,0 +1,200 @@
+/*
+ * 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 : WeakHandleOwner {
+ 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(JSGlobalData& globalData, JSCell* owner, const Identifier& propertyName, JSValue value)
+ {
+ if (!m_privateProperties)
+ m_privateProperties = adoptPtr(new JSPrivatePropertyMap);
+ m_privateProperties->setPrivateProperty(globalData, owner, propertyName, value);
+ }
+
+ void deletePrivateProperty(const Identifier& propertyName)
+ {
+ if (!m_privateProperties)
+ return;
+ m_privateProperties->deletePrivateProperty(propertyName);
+ }
+
+ void visitChildren(SlotVisitor& visitor)
+ {
+ if (!m_privateProperties)
+ return;
+ m_privateProperties->visitChildren(visitor);
+ }
+
+ 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.get();
+ }
+
+ void setPrivateProperty(JSGlobalData& globalData, JSCell* owner, const Identifier& propertyName, JSValue value)
+ {
+ WriteBarrier<Unknown> empty;
+ m_propertyMap.add(propertyName.impl(), empty).first->second.set(globalData, owner, value);
+ }
+
+ void deletePrivateProperty(const Identifier& propertyName)
+ {
+ m_propertyMap.remove(propertyName.impl());
+ }
+
+ void visitChildren(SlotVisitor& visitor)
+ {
+ for (PrivatePropertyMap::iterator ptr = m_propertyMap.begin(); ptr != m_propertyMap.end(); ++ptr) {
+ if (ptr->second)
+ visitor.append(&ptr->second);
+ }
+ }
+
+ private:
+ typedef HashMap<RefPtr<StringImpl>, WriteBarrier<Unknown>, IdentifierRepHash> PrivatePropertyMap;
+ PrivatePropertyMap m_propertyMap;
+ };
+ OwnPtr<JSPrivatePropertyMap> m_privateProperties;
+ virtual void finalize(Handle<Unknown>, void*);
+};
+
+
+template <class Base>
+class JSCallbackObject : public Base {
+public:
+ JSCallbackObject(ExecState*, JSGlobalObject*, Structure*, JSClassRef, void* data);
+ JSCallbackObject(JSGlobalData&, JSClassRef, Structure*);
+
+ void setPrivate(void* data);
+ void* getPrivate();
+
+ static const ClassInfo s_info;
+
+ JSClassRef classRef() const { return m_callbackObjectData->jsClass; }
+ bool inherits(JSClassRef) const;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount, &s_info);
+ }
+
+ JSValue getPrivateProperty(const Identifier& propertyName) const
+ {
+ return m_callbackObjectData->getPrivateProperty(propertyName);
+ }
+
+ void setPrivateProperty(JSGlobalData& globalData, const Identifier& propertyName, JSValue value)
+ {
+ m_callbackObjectData->setPrivateProperty(globalData, this, propertyName, value);
+ }
+
+ void deletePrivateProperty(const Identifier& propertyName)
+ {
+ m_callbackObjectData->deletePrivateProperty(propertyName);
+ }
+
+protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
+
+private:
+ virtual UString className() const;
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, 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 void visitChildren(SlotVisitor& visitor)
+ {
+ Base::visitChildren(visitor);
+ m_callbackObjectData->visitChildren(visitor);
+ }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
new file mode 100644
index 0000000..8639e1a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
@@ -0,0 +1,603 @@
+/*
+ * 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(&s_info));
+ return static_cast<JSCallbackObject*>(asObject(value));
+}
+
+template <class Base>
+JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, void* data)
+ : Base(globalObject, structure)
+ , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass)))
+{
+ ASSERT(Base::inherits(&s_info));
+ init(exec);
+}
+
+// Global object constructor.
+// FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one.
+template <class Base>
+JSCallbackObject<Base>::JSCallbackObject(JSGlobalData& globalData, JSClassRef jsClass, Structure* structure)
+ : Base(globalData, structure)
+ , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass)))
+{
+ ASSERT(Base::inherits(&s_info));
+ 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));
+ }
+
+ bool needsFinalizer = false;
+ for (JSClassRef jsClassPtr = classRef(); jsClassPtr && !needsFinalizer; jsClassPtr = jsClassPtr->parentClass)
+ needsFinalizer = jsClassPtr->finalize;
+ if (needsFinalizer) {
+ HandleSlot slot = exec->globalData().allocateGlobalHandle();
+ HandleHeap::heapFor(slot)->makeWeak(slot, m_callbackObjectData.get(), classRef());
+ HandleHeap::heapFor(slot)->writeBarrier(slot, this);
+ *slot = this;
+ }
+}
+
+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>::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(exec->globalData(), 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(exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.cpp
new file mode 100644
index 0000000..08dc721
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.cpp
@@ -0,0 +1,261 @@
+/*
+ * 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();
+ StaticValueEntry* existingEntry = m_staticValues->get(impl);
+ m_staticValues->set(impl, entry);
+ delete existingEntry;
+ }
+ ++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();
+ StaticFunctionEntry* existingEntry = m_staticFunctions->get(impl);
+ m_staticFunctions->set(impl, entry);
+ delete existingEntry;
+ }
+ ++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));
+}
+
+PassRefPtr<OpaqueJSClass> OpaqueJSClass::create(const JSClassDefinition* clientDefinition)
+{
+ JSClassDefinition definition = *clientDefinition; // Avoid modifying client copy.
+
+ JSClassDefinition protoDefinition = kJSClassDefinitionEmpty;
+ protoDefinition.finalize = 0;
+ 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(JSC::JSGlobalData&, 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(exec->globalData(), 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.set(exec->globalData(), new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // 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(exec->globalData(), prototype);
+ }
+ }
+ return jsClassData.cachedPrototype.get();
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.h
new file mode 100644
index 0000000..d346cc5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSClassRef.h
@@ -0,0 +1,128 @@
+/*
+ * 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 "Weak.h"
+#include "JSObject.h"
+#include "Protect.h"
+#include "UString.h"
+#include <wtf/HashMap.h>
+
+struct StaticValueEntry {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ StaticValueEntry(JSObjectGetPropertyCallback _getProperty, JSObjectSetPropertyCallback _setProperty, JSPropertyAttributes _attributes)
+ : getProperty(_getProperty), setProperty(_setProperty), attributes(_attributes)
+ {
+ }
+
+ JSObjectGetPropertyCallback getProperty;
+ JSObjectSetPropertyCallback setProperty;
+ JSPropertyAttributes attributes;
+};
+
+struct StaticFunctionEntry {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ 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 {
+ WTF_MAKE_NONCOPYABLE(OpaqueJSClassContextData); WTF_MAKE_FAST_ALLOCATED;
+public:
+ OpaqueJSClassContextData(JSC::JSGlobalData&, 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::Weak<JSC::JSObject> cachedPrototype;
+};
+
+struct OpaqueJSClass : public ThreadSafeRefCounted<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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRef.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRef.cpp
new file mode 100644
index 0000000..e2db577
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRef.cpp
@@ -0,0 +1,176 @@
+/*
+ * 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.
+#ifndef 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(*globalData, JSGlobalObject::createStructure(*globalData, jsNull()));
+ return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec()));
+ }
+
+ JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(*globalData, globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull()));
+ ExecState* exec = globalObject->globalExec();
+ JSValue prototype = globalObjectClass->prototype(exec);
+ if (!prototype)
+ prototype = jsNull();
+ globalObject->resetPrototype(*globalData, 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.clearBuiltinStructures();
+ 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/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRef.h
index c5c8a71..c5c8a71 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRef.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRefPrivate.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRefPrivate.h
index ff014ec..ff014ec 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRefPrivate.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSContextRefPrivate.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRef.cpp
new file mode 100644
index 0000000..2df010a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRef.cpp
@@ -0,0 +1,547 @@
+/*
+ * 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(constructEmptyObject(exec));
+
+ JSCallbackObject<JSObjectWithGlobalObject>* object = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
+ if (JSObject* prototype = jsClass->prototype(exec))
+ object->setPrototype(exec->globalData(), 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->globalData(), 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, exec->lexicalGlobalObject(), 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, exec->lexicalGlobalObject(), 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, exec->lexicalGlobalObject(), 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(exec->globalData(), 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>::s_info))
+ return static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_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>::s_info)) {
+ static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivate(data);
+ return true;
+ }
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_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>::s_info))
+ result = static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
+ else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_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>::s_info)) {
+ static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
+ return true;
+ }
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info)) {
+ static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), 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>::s_info)) {
+ static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->deletePrivateProperty(name);
+ return true;
+ }
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_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 {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ 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/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRef.h
index 3e8b0eb..3e8b0eb 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRef.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRefPrivate.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRefPrivate.h
index 32e80ab..32e80ab 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRefPrivate.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSObjectRefPrivate.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSProfilerPrivate.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSProfilerPrivate.cpp
index ea277f0..ea277f0 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSProfilerPrivate.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSProfilerPrivate.cpp
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSProfilerPrivate.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSProfilerPrivate.h
index b3fe533..b3fe533 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSProfilerPrivate.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSProfilerPrivate.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSRetainPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSRetainPtr.h
new file mode 100644
index 0000000..a884f38
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRef.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRef.cpp
new file mode 100644
index 0000000..ea31da6
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRef.h
new file mode 100644
index 0000000..c5c15440
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefBSTR.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefBSTR.cpp
new file mode 100644
index 0000000..70f4254
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefBSTR.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefBSTR.h
index 59f19b7..59f19b7 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefBSTR.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefBSTR.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefCF.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefCF.cpp
new file mode 100644
index 0000000..0877a13
--- /dev/null
+++ b/src/3rdparty/webkit/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 = adoptArrayPtr(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/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefCF.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefCF.h
index a424765..a424765 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRefCF.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSStringRefCF.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSValueRef.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSValueRef.cpp
new file mode 100644
index 0000000..e2626be
--- /dev/null
+++ b/src/3rdparty/webkit/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>::s_info))
+ return static_cast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
+ if (o->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_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/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSValueRef.h
index 4186db8..4186db8 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSValueRef.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h
new file mode 100644
index 0000000..f7b91da
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
new file mode 100644
index 0000000..13900cf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.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 "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>::s_info) || obj->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::s_info));
+ map->map().set(exec->globalData(), 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)));
+}
+
+void JSWeakObjectMapRemove(JSContextRef ctx, JSWeakObjectMapRef map, void* key)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ map->map().take(key);
+}
+
+// We need to keep this function in the build to keep the nightlies running.
+JS_EXPORT bool JSWeakObjectMapClear(JSContextRef, JSWeakObjectMapRef, void*, JSObjectRef);
+bool JSWeakObjectMapClear(JSContextRef, JSWeakObjectMapRef, void*, JSObjectRef)
+{
+ return true;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h
new file mode 100644
index 0000000..5a07cf7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+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 Removes the entry for the given key if the key is present, otherwise it has no effect.
+ @param ctx The execution context to use.
+ @param map The map to use.
+ @param key The key to remove.
+ */
+JS_EXPORT void JSWeakObjectMapRemove(JSContextRef ctx, JSWeakObjectMapRef map, void* key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // JSWeakObjectMapPrivate_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JavaScript.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JavaScript.h
index f8d92d8..f8d92d8 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JavaScript.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JavaScript.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JavaScriptCore.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/JavaScriptCore.h
index 87d6018..87d6018 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/JavaScriptCore.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/JavaScriptCore.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/API/OpaqueJSString.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/API/OpaqueJSString.cpp
new file mode 100644
index 0000000..9a116e6
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/API/OpaqueJSString.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/OpaqueJSString.h
new file mode 100644
index 0000000..69c0962
--- /dev/null
+++ b/src/3rdparty/webkit/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 ThreadSafeRefCounted<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::ThreadSafeRefCounted<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/src/3rdparty/webkit/JavaScriptCore/API/WebKitAvailability.h b/src/3rdparty/webkit/Source/JavaScriptCore/API/WebKitAvailability.h
index 0e4f091..0e4f091 100644
--- a/src/3rdparty/webkit/JavaScriptCore/API/WebKitAvailability.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/API/WebKitAvailability.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/AUTHORS b/src/3rdparty/webkit/Source/JavaScriptCore/AUTHORS
index e50da8c..e50da8c 100644
--- a/src/3rdparty/webkit/JavaScriptCore/AUTHORS
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/AUTHORS
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/CMakeLists.txt b/src/3rdparty/webkit/Source/JavaScriptCore/CMakeLists.txt
new file mode 100644
index 0000000..c994611
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/CMakeLists.txt
@@ -0,0 +1,250 @@
+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}/heap"
+ "${JAVASCRIPTCORE_DIR}/debugger"
+ "${JAVASCRIPTCORE_DIR}/interpreter"
+ "${JAVASCRIPTCORE_DIR}/jit"
+ "${JAVASCRIPTCORE_DIR}/parser"
+ "${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
+
+ heap/Heap.cpp
+ heap/HandleHeap.cpp
+ heap/HandleStack.cpp
+ heap/MachineStackMarker.cpp
+ heap/MarkedBlock.cpp
+ heap/MarkedSpace.cpp
+ heap/ConservativeRoots.cpp
+ heap/MarkStack.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
+ parser/SourceProviderCache.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/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/GetterSetter.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/JSLock.cpp
+ runtime/JSNotAnObject.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/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/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/StringRecursionChecker.cpp
+ runtime/Structure.cpp
+ runtime/StructureChain.cpp
+ runtime/TimeoutChecker.cpp
+ runtime/UString.cpp
+
+ yarr/YarrPattern.cpp
+ yarr/YarrInterpreter.cpp
+ yarr/YarrJIT.cpp
+ yarr/YarrSyntaxChecker.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/ObjectConstructor.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_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
+ LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_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_JAVASCRIPTCORE_DIR}/Lexer.lut.h MAIN_DEPENDENCY)
+LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h)
+
+#GENERATOR: "RegExpJitTables.h": tables used by Yarr
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
+ MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables
+ COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
+ VERBATIM)
+ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
+
+
+
+IF (WTF_CPU_ARM)
+ LIST(APPEND JavaScriptCore_SOURCES
+ assembler/ARMAssembler.cpp
+ assembler/ARMv7Assembler.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/src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsEfl.txt b/src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsEfl.txt
new file mode 100644
index 0000000..cdc3fe2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsEfl.txt
@@ -0,0 +1,20 @@
+LIST(APPEND JavaScriptCore_SOURCES
+ jit/ExecutableAllocatorFixedVMPool.cpp
+ jit/ExecutableAllocator.cpp
+ heap/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/src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsWinCE.txt b/src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsWinCE.txt
new file mode 100644
index 0000000..d878863
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/CMakeListsWinCE.txt
@@ -0,0 +1,22 @@
+LIST(APPEND JavaScriptCore_SOURCES
+ jit/ExecutableAllocator.cpp
+
+ heap/MarkStackWin.cpp
+)
+
+IF (ENABLE_JIT AND WTF_CPU_ARM)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
+ MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_jit_stubs
+ DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp
+ COMMAND ${PERL_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_jit_stubs --prefix=MSVC ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp > ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
+ VERBATIM)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
+ MAIN_DEPENDENCY ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
+ COMMAND armasm -nologo ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
+ VERBATIM)
+
+ LIST (APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj)
+ENDIF ()
diff --git a/src/3rdparty/webkit/JavaScriptCore/COPYING.LIB b/src/3rdparty/webkit/Source/JavaScriptCore/COPYING.LIB
index 87c4a33..87c4a33 100644
--- a/src/3rdparty/webkit/JavaScriptCore/COPYING.LIB
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/COPYING.LIB
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog
new file mode 100644
index 0000000..ae7ef60
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog
@@ -0,0 +1,11889 @@
+2011-05-23 Matthew Delaney <mdelaney@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Remove safeFloatToInt() in FloatRect.cpp and replace with working version of clampToInteger()
+ https://bugs.webkit.org/show_bug.cgi?id=58216
+
+ * wtf/MathExtras.h:
+ (clampToInteger):
+ (clampToPositiveInteger):
+
+2011-06-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION (r79060): Searching for a flight at united.com fails
+ https://bugs.webkit.org/show_bug.cgi?id=63003
+
+ This original change also broke Twitter, and we attempted to refine the fix to
+ address that problem (http://trac.webkit.org/changeset/80542), but since it still breaks United,
+ we need to revert the change until we understand the problem better.
+
+ * wtf/DateMath.cpp:
+ (WTF::parseDateFromNullTerminatedCharacters):
+
+2011-06-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 62405 - Fix integer overflow in Array.prototype.push
+
+ Fix geoff's review comments re static_cast.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncPush):
+
+2011-06-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 62405 - Fix integer overflow in Array.prototype.push
+
+ There are three integer overflows here, leading to safe (not a security risk)
+ but incorrect (non-spec-compliant) behaviour.
+
+ Two overflows occur when calculating the new length after pushing (one in the
+ fast version of push in JSArray, one in the generic version in ArrayPrototype).
+ The other occurs calculating indices to write to when multiple items are pushed.
+
+ These errors result in three test-262 failures.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncPush):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::put):
+ (JSC::JSArray::push):
+
+2011-06-08 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org>
+
+ Reviewed by Andreas Kling.
+
+ Webkit on SPARC Solaris has wrong endian
+ https://bugs.webkit.org/show_bug.cgi?id=29407
+
+ Bug 57256 fixed one crash on misaligned reads on sparc/solaris, but
+ there are more ocurrences of the same code pattern in webkit.
+
+ This patch includes the check on these other parts of the code.
+
+ This is a speculative fix, I don't have a sparc machine to test and
+ don't know which kind of test would trigger a crash (but it's quite
+ obvious that it's the same code duplicated in different files).
+
+ * runtime/UString.h:
+ (JSC::UStringHash::equal):
+ * wtf/text/StringHash.h:
+ (WTF::StringHash::equal):
+
+2011-06-08 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Build fix for building QtWebKit inside of Qt.
+ https://bugs.webkit.org/show_bug.cgi?id=62280
+
+ Remove CONFIG=staticlib, because it causes the configure script to add -ljavascriptcore
+ into QtWebKit.prl.
+
+ No new tests, as this is just a build fix.
+
+ * JavaScriptCore.pri:
+
+2011-06-03 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Benjamin Poulain.
+
+ [Qt] Build fix of QtWebKit 2.2 when inside Qt tree with GCC 4.6.
+ https://bugs.webkit.org/show_bug.cgi?id=61957
+
+ When building inside the Qt source tree, qmake always append the mkspecs
+ defines after ours. We have to workaround and make sure that we append
+ our flags after the qmake variable used inside Qt. This workaround was provided
+ by our qmake folks. We need to append in both case because qmake behave differently
+ when called with -spec or via SUBDIR+=. This patch unbreak r87950 on Mac for Qt port.
+
+ * JavaScriptCore.pro:
+
+2011-06-02 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Build fix of QtWebKit 2.2 when inside Qt tree with GCC 4.6.
+ https://bugs.webkit.org/show_bug.cgi?id=61957
+
+ When building inside the Qt source tree, qmake always append the mkspecs
+ defines after ours. We have to workaround and make sure that we append
+ our flags after the qmake variable used inside Qt. This workaround was provided
+ by our qmake folks.
+
+ * JavaScriptCore.pro:
+
+2011-05-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Freezing a function and its prototype causes browser to crash.
+ https://bugs.webkit.org/show_bug.cgi?id=61758
+
+ Make JSObject::preventExtensions virtual so that we can override it
+ and instantiate all lazy
+
+ * JavaScriptCore.exp:
+ * runtime/JSFunction.cpp:
+ (JSC::createPrototypeProperty):
+ (JSC::JSFunction::preventExtensions):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSFunction.h:
+ * runtime/JSObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::seal):
+ (JSC::JSObject::seal):
+
+2011-05-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ XMLDocumentParserLibxml2 should play nice with strict OwnPtrs
+ https://bugs.webkit.org/show_bug.cgi?id=59394
+
+ This portion of the change introduces a PassTraits template, which
+ is used to enable takeFirst() to work for a Deque holding OwnPtrs,
+ and optimize it for a Deque holding RefPtrs. In the future it can
+ be deployed elsewhere to make our data structures work better with
+ our smart pointers.
+
+ * GNUmakefile.list.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/Deque.h:
+ (WTF::::takeFirst):
+ * wtf/PassTraits.h: Added.
+ (WTF::PassTraits::transfer):
+
+2011-05-26 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ ASSERT(isMainThread()) when using single threaded jsc executable
+ https://bugs.webkit.org/show_bug.cgi?id=60846
+
+ Remove the ASSERT since we do not have the concept of MainThread in JSC.
+
+ * wtf/CryptographicallyRandomNumber.cpp:
+ (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomNumber):
+ (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomValues):
+
+2011-05-20 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/9472883> and https://bugs.webkit.org/show_bug.cgi?id=61203
+ Horrendous bug in callOnMainThreadAndWait
+
+ * wtf/MainThread.cpp:
+ (WTF::dispatchFunctionsFromMainThread): Before signaling the background thread with the
+ syncFlag condition, reacquire the mutex first.
+
+2011-05-20 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Oliver Hunt.
+
+ JIT requires VM overcommit (particularly on x86-64), Linux does not by default support this without swap?
+ https://bugs.webkit.org/show_bug.cgi?id=42756
+
+ Use the MAP_NORESERVE flag for mmap on Linux to skip the kernel
+ check of the available memory. This should give us an
+ overcommit-like behavior in most systems, which is what we want.
+
+ * wtf/OSAllocatorPosix.cpp:
+ (WTF::OSAllocator::reserveAndCommit): pass MAP_NORSERVE to mmap.
+
+2011-05-11 Igor Oliveira <igor.oliveira@openbossa.org>
+
+ Reviewed by Eric Seidel.
+
+ WebKit does not build with GCCE
+ https://bugs.webkit.org/show_bug.cgi?id=60667
+
+ Allow compile WebKit with GCCE
+
+ * wtf/Alignment.h:
+ * wtf/Platform.h:
+
+2011-05-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ JSGlobalObject and some others do GC allocation during initialization, which can cause heap corruption
+ https://bugs.webkit.org/show_bug.cgi?id=61090
+
+ Remove the Structure-free JSGlobalObject constructor and instead always
+ pass the structure into the JSGlobalObject constructor.
+ Stop DebuggerActivation creating a new structure every time, and simply
+ use a single shared structure held by the GlobalData.
+
+ * API/JSContextRef.cpp:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ (functionRun):
+ (jscmain):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::clearBuiltinStructures):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.h:
+
+2011-05-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Partial fix for <rdar://problem/9417875> REGRESSION: SunSpider ~17% slower
+ in browser than on command line
+
+ This patch fixes a few issues in generated code that could unreasonably
+ prolong object lifetimes.
+
+ * heap/Heap.cpp:
+ (JSC::Heap::collectAllGarbage): Throw away all function code before doing
+ a major collection. We want to clear polymorphic caches, since they can
+ keep alive large object graphs that have gone "stale". For the same reason,
+ but to a lesser extent, we also want to clear linked functions and other
+ one-off caches.
+
+ This has the side-benefit of reducing memory footprint from run-once
+ functions, and of allowing predictions and caches that have failed to
+ re-specialize.
+
+ Eventually, if compilation costs rise far enough, we may want a more
+ limited strategy for de-specializing code without throwing it away
+ completely, but this works for now, and it's the simplest solution.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITStubs.h:
+ * runtime/JSFunction.cpp: Made the host function stub cache weak --
+ otherwise it's effectively a memory leak that can seriously fragment the
+ GC and JIT heaps.
+
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::visitChildren): Cleared up some comments that confused
+ me when working with this code.
+
+2011-05-07 Dawit Alemayehu <adawit@kde.org>
+
+ Reviewed by Daniel Bates.
+
+ Fix compile with GCC 4.6.0
+ https://bugs.webkit.org/show_bug.cgi?id=60380
+
+ Remove unused local variable from code.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+
+2011-05-12 Keith Kyzivat <keith.kyzivat@nokia.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Arm debug build failing on ARMAssembler::debugOffset()
+ https://bugs.webkit.org/show_bug.cgi?id=60688
+
+ Related to svn rev 85523
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::debugOffset):
+
+2011-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/9331651> REGRESSION: RPRVT grows by 1MB / sec @ dvd2blu.com
+
+ SunSpider reports no change.
+
+ This bug was caused by changing Structure and Executable to being GC
+ objects, and by a long-standing bug that would thrash the global object
+ between dictionary and non-dictionary states.
+
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer): Don't
+ eagerly transition to dictionary -- this can cause pathological dictionary
+ churn, and it's not necessary, since objects know how to automatically
+ transition to dictionary when necessary.
+
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal): Be sure to report
+ extra cost from compilation, because it can be quite high. This is especially
+ important for program code, since DOM timers can repeatedly allocate
+ program code without allocating any other objects.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::removeDirect): Don't transition to the uncacheable state
+ if the thing we're trying to remove doesn't exist. This can happen during
+ compilation, since the compiler needs to ensure that no pre-existing
+ conflicting definitions exist for certain declarations.
+
+2011-05-11 Holger Hans Peter Freyther <holger@moiji-mobile.com>
+
+ Unreviewed build fix.
+
+ [MIPS] Fix compilation of the MIPS JIT
+
+ Include the MIPSAssembler.h first to indirectly include
+ AssemblerBuffer.h before the AbstractMacroAssembler.h. This
+ order is used for the ARM and X86 MacroAssembler*.h
+
+ * assembler/MacroAssemblerMIPS.h:
+
+2011-05-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ http://bugs.webkit.org/show_bug.cgi?id=60509
+ Wrong type used for return value from strlen
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastStrDup): Use size_t. Also don't bother checking for failure since
+ fastMalloc won't return if it fails.
+
+2011-05-05 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Benjamin Poulain.
+
+ [Qt] Make QtWebKit build when using gcc 4.6.0
+ https://bugs.webkit.org/show_bug.cgi?id=60265
+
+ If QtWebKit is compiled with gcc 4.6.0 or later we don't want to deactivate
+ the c++0x support because it works.
+
+ * JavaScriptCore.pro:
+
+2011-05-04 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Geoffrey Garen.
+
+ Port MachineStackMarker.cpp to Windows x64
+ https://bugs.webkit.org/show_bug.cgi?id=60216
+
+ * heap/MachineStackMarker.cpp:
+ (JSC::getPlatformThreadRegisters): the CONTEXT struct is usable also
+ on 64-bit Windows.
+ (JSC::otherThreadStackPointer): return the Rsp register on Windows x64.
+
+2011-05-04 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Martin Robinson.
+
+ Link libjavascriptcoregtk on Windows with winmm.dll
+ https://bugs.webkit.org/show_bug.cgi?id=60215
+
+ * GNUmakefile.am:
+
+2011-05-04 Tao Bai <michaelbai@chromium.org>
+
+ Reviewed by David Kilzer.
+
+ Populate touch-icon url to FrameLoaderClient
+ https://bugs.webkit.org/show_bug.cgi?id=59143
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-05-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/9366557> Various crashes due to bad DFG codegen at canalplus.fr
+
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::checkArgumentTypes): Removed a stray line of
+ code that accidentally survived the conversion to a switch statement,
+ causing a lot of important code not to run most of the time.
+
+ Since this is not a trivial finger-picking mistake, I will not call it a
+ typo.
+
+2011-05-04 Adam Roben <aroben@apple.com>
+
+ Another attempted build fix
+
+ * wtf/OwnPtr.h:
+ (WTF::OwnPtr::operator==):
+ (WTF::OwnPtr::operator!=):
+ * wtf/PassOwnPtr.h:
+ (WTF::PassOwnPtr::operator==):
+ (WTF::PassOwnPtr::operator!=):
+ Added a return statement. And made a tweak based on a suggestion from Anders Carlsson.
+
+2011-05-04 Adam Roben <aroben@apple.com>
+
+ Try to fix Leopard, Qt, and probably others
+
+ * wtf/OwnPtr.h:
+ (WTF::OwnPtr::operator==):
+ (WTF::OwnPtr::operator!=):
+ * wtf/PassOwnPtr.h:
+ (WTF::PassOwnPtr::operator==):
+ (WTF::PassOwnPtr::operator!=):
+ Try to get the compiler not to instantiate these function templates unnecessarily.
+
+2011-05-03 Adam Roben <aroben@apple.com>
+
+ Disallow equality comparisons between [Pass]OwnPtrs
+
+ If you have two OwnPtrs that are equal, you've already lost. (Unless you're doing something
+ really sneaky, in which case you should stop!)
+
+ Fixes <http://webkit.org/b/60053> Testing OwnPtrs for equality should cause a compiler error
+
+ Reviewed by Anders Carlsson and Antti Koivisto.
+
+ * wtf/OwnPtr.h:
+ (WTF::OwnPtr::operator==):
+ (WTF::OwnPtr::operator!=):
+ * wtf/PassOwnPtr.h:
+ (WTF::PassOwnPtr::operator==):
+ (WTF::PassOwnPtr::operator!=):
+ Added private equality operators that fail to compile when used. (When not used, the
+ compiler will skip over them because they are function templates.)
+
+2011-05-04 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Gavin Barraclough.
+
+ JITArithmetic.cpp produces a warning on a unused variable.
+ https://bugs.webkit.org/show_bug.cgi?id=60060
+
+ Just properly use what we already have converted.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlow_op_mul):
+
+2011-05-04 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Geoffrey Garen.
+
+ JITPropertyAccess produces a unused but set variable warning in gcc 4.6.0.
+ https://bugs.webkit.org/show_bug.cgi?id=60050
+
+ This patch fix a compilation warning. The new warning scenario -Wunused-but-set-variable
+ in gcc 4.6.0 is included in -Wall and therefore stops the compilation when warnings are treated
+ as errors. The patch introduces a new macro ASSERT_JIT_OFFSET_UNUSED and ASSERT_WITH_MESSAGE_UNUSED
+ which copy the idea of ASSERT_UNUSED.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::emit_op_put_by_id):
+ * wtf/Assertions.h:
+ (assertWithMessageUnused):
+
+2011-04-29 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Implement FULLSCREEN_API on Windows, Part 4: Enable it
+ https://bugs.webkit.org/show_bug.cgi?id=59798
+
+ * wtf/Platform.h: Set ENABLE_FULLSCREEN_API on win.
+
+2011-05-03 Alexis Menard <alexis.menard@openbossa.org>
+
+ Reviewed by Eric Seidel.
+
+ Unused but set variable warning in MacroAssemberX86_64
+ https://bugs.webkit.org/show_bug.cgi?id=59482
+
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::call):
+ (JSC::MacroAssemblerX86_64::tailRecursiveCall):
+ (JSC::MacroAssemblerX86_64::makeTailRecursiveCall):
+
+2011-05-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make malloc validation useful
+ https://bugs.webkit.org/show_bug.cgi?id=57502
+
+ Reland this patch (rolled out in 82905) without
+ turning it on by default.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/FastMalloc.cpp:
+ (WTF::tryFastMalloc):
+ (WTF::fastMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::fastCalloc):
+ (WTF::fastFree):
+ (WTF::tryFastRealloc):
+ (WTF::fastRealloc):
+ (WTF::fastMallocSize):
+ (WTF::TCMalloc_PageHeap::isScavengerSuspended):
+ (WTF::TCMalloc_PageHeap::scheduleScavenger):
+ (WTF::TCMalloc_PageHeap::suspendScavenger):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+ (WTF::TCMallocStats::malloc):
+ (WTF::TCMallocStats::free):
+ (WTF::TCMallocStats::fastCalloc):
+ (WTF::TCMallocStats::tryFastCalloc):
+ (WTF::TCMallocStats::calloc):
+ (WTF::TCMallocStats::fastRealloc):
+ (WTF::TCMallocStats::tryFastRealloc):
+ (WTF::TCMallocStats::realloc):
+ (WTF::TCMallocStats::fastMallocSize):
+ * wtf/FastMalloc.h:
+ (WTF::Internal::fastMallocValidationHeader):
+ (WTF::Internal::fastMallocValidationSuffix):
+ (WTF::Internal::fastMallocMatchValidationType):
+ (WTF::Internal::setFastMallocMatchValidationType):
+ (WTF::fastMallocMatchValidateFree):
+ (WTF::fastMallocValidate):
+
+2011-05-03 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Anders Carlsson.
+
+ Compile error with GCC 4.6.0, tries to assign unsigned& to bitfield
+ https://bugs.webkit.org/show_bug.cgi?id=59261
+
+ Use unary '+' to force proper type detection in template arguments
+ with GCC 4.6.0. See bug report for more details.
+
+ * runtime/Structure.cpp:
+ (JSC::StructureTransitionTable::remove): Use '+' to force precise type detection.
+ (JSC::StructureTransitionTable::add): ditto.
+ * runtime/Structure.h:
+ (JSC::StructureTransitionTable::keyForWeakGCMapFinalizer): ditto.
+
+2011-05-03 Jessie Berlin <jberlin@apple.com>
+
+ Rubber-stamped by Adam Roben.
+
+ Revert r85550 and r85575.
+
+ Variables cannot be exported via the .def file. Instead, they should be annotated with
+ JS_EXPORTDATA.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/Structure.cpp:
+ (JSC::Structure::materializePropertyMap):
+ * runtime/Structure.h:
+ (JSC::Structure::typeInfo):
+ (JSC::Structure::previousID):
+ (JSC::Structure::propertyStorageCapacity):
+ (JSC::Structure::propertyStorageSize):
+ (JSC::Structure::get):
+ (JSC::Structure::materializePropertyMapIfNecessary):
+
+2011-05-02 Adam Roben <aroben@apple.com>
+
+ Allow implicit conversion from nullptr_t to PassOwnPtr
+
+ This makes it a lot easier to write code that just wants a null PassOwnPtr, especially in
+ strict PassOwnPtr mode.
+
+ Fixes <http://webkit.org/b/59964> Implicit conversion from std::nullptr_t to PassOwnPtr
+ doesn't work, but should
+
+ Reviewed by Adam Barth.
+
+ * wtf/PassOwnPtr.h:
+ (WTF::PassOwnPtr::PassOwnPtr): Added a non-explicit constructor that takes a nullptr_t.
+
+ * wtf/MessageQueue.h:
+ (WTF::::waitForMessageFilteredWithTimeout):
+ (WTF::::tryGetMessage):
+ Use the new implicit conversion.
+
+2011-05-02 Jessie Berlin <jberlin@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Remove an assertion that Windows was hitting on launch.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::materializePropertyMap):
+ * runtime/Structure.h:
+ (JSC::Structure::typeInfo):
+ (JSC::Structure::previousID):
+ (JSC::Structure::propertyStorageCapacity):
+ (JSC::Structure::propertyStorageSize):
+ (JSC::Structure::get):
+ (JSC::Structure::materializePropertyMapIfNecessary):
+
+2011-05-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/9371948> JavaScriptCore should build with GCC 4.2
+
+ * Configurations/CompilerVersion.xcconfig:
+
+2011-05-02 Gavin Barraclough <barraclough@apple.com>
+
+ ARMv7 build fix.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Jump::link):
+ (JSC::AbstractMacroAssembler::Jump::linkTo):
+
+2011-05-02 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-05-02 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ crash in JSC::RegExp::match
+ https://bugs.webkit.org/show_bug.cgi?id=58922
+
+ Cleared chained backtrack data label when linking label even if that
+ label doesn't chain itself. This is needed so that subsequent
+ backtrack data labels point to the next outer paren and not within
+ the current paren.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::TermGenerationState::linkDataLabelToBacktrackIfExists):
+
+2011-05-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Tiny bit of heap cleanup.
+
+ * heap/MarkedBlock.h:
+ (JSC::MarkedBlock::contains): Tightened up an assertion and a comment.
+
+ * heap/MarkedSpace.h:
+ (JSC::MarkedSpace::globalData):
+ (JSC::MarkedSpace::highWaterMark):
+ (JSC::MarkedSpace::setHighWaterMark): Moved inlines out of the class
+ definition, for better clarity.
+
+2011-05-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Correct marking of interpreter data in mixed mode builds
+ https://bugs.webkit.org/show_bug.cgi?id=59962
+
+ We had a few places in mixed mode builds where we would not
+ track data used by the interpreter for marking. This patch
+ corrects the problem and adds a number of assertions to catch
+ live Structures being collected.
+
+ * JavaScriptCore.exp:
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::debugOffset):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addPropertyAccessInstruction):
+ (JSC::CodeBlock::addGlobalResolveInstruction):
+ (JSC::CodeBlock::addStructureStubInfo):
+ (JSC::CodeBlock::addGlobalResolveInfo):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ (JSC::BytecodeGenerator::emitDirectPutById):
+ * runtime/Structure.cpp:
+ (JSC::Structure::materializePropertyMap):
+ * runtime/Structure.h:
+ (JSC::Structure::typeInfo):
+ (JSC::Structure::previousID):
+ (JSC::Structure::propertyStorageCapacity):
+ (JSC::Structure::propertyStorageSize):
+ (JSC::Structure::get):
+ (JSC::Structure::materializePropertyMapIfNecessary):
+
+2011-05-02 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Use native NullPtr when using GCC 4.6.0 and C++0x
+ https://bugs.webkit.org/show_bug.cgi?id=59252
+
+ GCC 4.6.0 has nullptr support, use it when possible.
+
+ * wtf/NullPtr.cpp: include config.h to pull in Platform.h before
+ NullPtr.h, since we need the GCC_VERSION_AT_LEAST definition.
+ * wtf/NullPtr.h: check for GCC >= 4.6.0 and C++0x in order to
+ use native nullptr.
+
+2011-05-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=59950
+ Clean up AssemblerBuffer to use a Vector internally.
+
+ AssemblerBuffer handles reallocing a byte array itself - stop that.
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerLabel::AssemblerLabel):
+ (JSC::AssemblerLabel::labelAtOffset):
+ (JSC::AssemblerBuffer::AssemblerBuffer):
+ (JSC::AssemblerBuffer::~AssemblerBuffer):
+ (JSC::AssemblerBuffer::isAvailable):
+ (JSC::AssemblerBuffer::ensureSpace):
+ (JSC::AssemblerBuffer::isAligned):
+ (JSC::AssemblerBuffer::putIntegral):
+ (JSC::AssemblerBuffer::putIntegralUnchecked):
+ (JSC::AssemblerBuffer::putByteUnchecked):
+ (JSC::AssemblerBuffer::putByte):
+ (JSC::AssemblerBuffer::putShortUnchecked):
+ (JSC::AssemblerBuffer::putShort):
+ (JSC::AssemblerBuffer::putIntUnchecked):
+ (JSC::AssemblerBuffer::putInt):
+ (JSC::AssemblerBuffer::putInt64Unchecked):
+ (JSC::AssemblerBuffer::putInt64):
+ (JSC::AssemblerBuffer::codeSize):
+ (JSC::AssemblerBuffer::label):
+ (JSC::AssemblerBuffer::executableCopy):
+ (JSC::AssemblerBuffer::rewindToLabel):
+ (JSC::AssemblerBuffer::debugOffset):
+ (JSC::AssemblerBuffer::append):
+ (JSC::AssemblerBuffer::grow):
+ * assembler/AssemblerBufferWithConstantPool.h:
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::linkCall):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::X86InstructionFormatter::rewindToLabel):
+
+2011-05-02 Jeff Miller <jeffm@apple.com>
+
+ Reviewed by Alexy Proskuryakov.
+
+ Avoid potential buffer overflow in WTFLog() and WTFLogVerbose()
+ https://bugs.webkit.org/show_bug.cgi?id=59949
+
+ * wtf/Assertions.cpp: Check for 0 or empty format string in WTFLog() and WTFLogVerbose().
+
+2011-05-02 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ StringImpl::endsWith has some insane code
+ https://bugs.webkit.org/show_bug.cgi?id=59900
+
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::endsWith):
+ - m_data shadows a member variable of the same name.
+
+2011-05-02 Gabor Loki <loki@webkit.org>
+
+ Buildfix for ARM after r85448
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::loadBranchTarget):
+
+2011-05-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Strict-mode only reserved words not reserved
+ https://bugs.webkit.org/show_bug.cgi?id=55342
+
+ Fix line number tracking when we rollback the lexer.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseSourceElements):
+
+2011-05-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ ES5 Strict mode does not allow getter and setter for same propId
+ https://bugs.webkit.org/show_bug.cgi?id=57295
+
+ Simplify and correct the logic for strict mode object literals.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseStrictObjectLiteral):
+
+2011-05-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Assigning to function identifier under strict should throw
+ https://bugs.webkit.org/show_bug.cgi?id=59289
+
+ Add logic to StaticScopeObject to ensure we don't silently consume
+ writes to constant properties.
+
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::put):
+
+2011-05-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=59903
+ Use AssemblerLabel throughout Assembler classes, AssemblerBuffer
+
+ Creating a lable() into the AssemblerBuffer should return an AssemblerLabel,
+ not an unsigned int.
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::blx):
+ (JSC::ARMAssembler::label):
+ (JSC::ARMAssembler::loadBranchTarget):
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::b):
+ (JSC::ARMv7Assembler::blx):
+ (JSC::ARMv7Assembler::bx):
+ (JSC::ARMv7Assembler::label):
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::label):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::label):
+ * assembler/AssemblerBufferWithConstantPool.h:
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::label):
+ (JSC::MIPSAssembler::relocateJumps):
+ * assembler/SH4Assembler.h:
+ (JSC::SH4Assembler::loadConstant):
+ (JSC::SH4Assembler::loadConstantUnReusable):
+ (JSC::SH4Assembler::call):
+ (JSC::SH4Assembler::jmp):
+ (JSC::SH4Assembler::jne):
+ (JSC::SH4Assembler::je):
+ (JSC::SH4Assembler::label):
+ (JSC::SH4Assembler::oneShortOp):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::call):
+ (JSC::X86Assembler::jmp_r):
+ (JSC::X86Assembler::label):
+ (JSC::X86Assembler::X86InstructionFormatter::immediateRel32):
+ (JSC::X86Assembler::X86InstructionFormatter::label):
+
+2011-05-01 Adam Barth <abarth@webkit.org>
+
+ Reviewed by David Levin.
+
+ Enable strict mode for OwnPtr and PassOwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=59428
+
+ * wtf/OwnPtr.h:
+
+2011-05-01 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Enable strict OwnPtr for PLATFORM(WIN)
+ https://bugs.webkit.org/show_bug.cgi?id=59881
+
+ * wtf/OwnPtr.h:
+
+2011-05-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=59896
+ Remove JmpSrc/JmpDst types.
+
+ The JmpSrc/JmpDst classes predate the MacroAssembler interface. Having these
+ object be per-assembler in unhelpful, causes unnecessary code duplication,
+ and prevents the AssemblerBuffer from providing a richer type for labels.
+ The limited semantic meaning that they did convey is undermined by the manner
+ in which their meanings have been overloaded (use of JmpSrc for Call, JmpDst
+ for data labels).
+
+ Jumps on ARMv7 have had additional information added to the object via the
+ ARMv7 JmpSrc. This data should probably be in the instruction stream. This
+ patch does not fix the problem, and moves the data (ifdefed) to
+ AbstractMacroAssembler::Jump (which is effectively where it was before!).
+ This at least closes the hole such that no further data may be added to JmpSrc,
+ but this is unfortunate, and should be cleaned up.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::blx):
+ (JSC::ARMAssembler::label):
+ (JSC::ARMAssembler::align):
+ (JSC::ARMAssembler::loadBranchTarget):
+ (JSC::ARMAssembler::jmp):
+ (JSC::ARMAssembler::linkPointer):
+ (JSC::ARMAssembler::linkJump):
+ (JSC::ARMAssembler::linkCall):
+ (JSC::ARMAssembler::getRelocatedAddress):
+ (JSC::ARMAssembler::getDifferenceBetweenLabels):
+ (JSC::ARMAssembler::getCallReturnOffset):
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::b):
+ (JSC::ARMv7Assembler::blx):
+ (JSC::ARMv7Assembler::bx):
+ (JSC::ARMv7Assembler::label):
+ (JSC::ARMv7Assembler::align):
+ (JSC::ARMv7Assembler::getRelocatedAddress):
+ (JSC::ARMv7Assembler::getDifferenceBetweenLabels):
+ (JSC::ARMv7Assembler::getCallReturnOffset):
+ (JSC::ARMv7Assembler::linkJump):
+ (JSC::ARMv7Assembler::linkCall):
+ (JSC::ARMv7Assembler::linkPointer):
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Label::isSet):
+ (JSC::AbstractMacroAssembler::Call::Call):
+ (JSC::AbstractMacroAssembler::Jump::Jump):
+ (JSC::AbstractMacroAssembler::Jump::link):
+ (JSC::AbstractMacroAssembler::Jump::linkTo):
+ (JSC::AbstractMacroAssembler::linkPointer):
+ (JSC::AbstractMacroAssembler::getLinkerAddress):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerLabel::AssemblerLabel):
+ (JSC::AssemblerLabel::isSet):
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::patch):
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::label):
+ (JSC::MIPSAssembler::align):
+ (JSC::MIPSAssembler::getRelocatedAddress):
+ (JSC::MIPSAssembler::getDifferenceBetweenLabels):
+ (JSC::MIPSAssembler::getCallReturnOffset):
+ (JSC::MIPSAssembler::linkJump):
+ (JSC::MIPSAssembler::linkCall):
+ (JSC::MIPSAssembler::linkPointer):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::branchDouble):
+ (JSC::MacroAssemblerARMv7::branchDoubleZeroOrNaN):
+ (JSC::MacroAssemblerARMv7::jump):
+ (JSC::MacroAssemblerARMv7::nearCall):
+ (JSC::MacroAssemblerARMv7::call):
+ (JSC::MacroAssemblerARMv7::ret):
+ (JSC::MacroAssemblerARMv7::tailRecursiveCall):
+ (JSC::MacroAssemblerARMv7::makeBranch):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::nearCall):
+ (JSC::MacroAssemblerMIPS::call):
+ (JSC::MacroAssemblerMIPS::tailRecursiveCall):
+ (JSC::MacroAssemblerMIPS::branchTrue):
+ (JSC::MacroAssemblerMIPS::branchFalse):
+ (JSC::MacroAssemblerMIPS::branchEqual):
+ (JSC::MacroAssemblerMIPS::branchNotEqual):
+ * assembler/SH4Assembler.h:
+ (JSC::SH4Assembler::call):
+ (JSC::SH4Assembler::jmp):
+ (JSC::SH4Assembler::jne):
+ (JSC::SH4Assembler::je):
+ (JSC::SH4Assembler::label):
+ (JSC::SH4Assembler::align):
+ (JSC::SH4Assembler::linkJump):
+ (JSC::SH4Assembler::linkCall):
+ (JSC::SH4Assembler::linkPointer):
+ (JSC::SH4Assembler::getCallReturnOffset):
+ (JSC::SH4Assembler::getRelocatedAddress):
+ (JSC::SH4Assembler::getDifferenceBetweenLabels):
+ (JSC::SH4Assembler::patchPointer):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::call):
+ (JSC::X86Assembler::jmp):
+ (JSC::X86Assembler::jmp_r):
+ (JSC::X86Assembler::jne):
+ (JSC::X86Assembler::jnz):
+ (JSC::X86Assembler::je):
+ (JSC::X86Assembler::jz):
+ (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::label):
+ (JSC::X86Assembler::labelFor):
+ (JSC::X86Assembler::align):
+ (JSC::X86Assembler::linkJump):
+ (JSC::X86Assembler::linkCall):
+ (JSC::X86Assembler::linkPointer):
+ (JSC::X86Assembler::getCallReturnOffset):
+ (JSC::X86Assembler::getRelocatedAddress):
+ (JSC::X86Assembler::getDifferenceBetweenLabels):
+ (JSC::X86Assembler::rewindToLabel):
+ (JSC::X86Assembler::X86InstructionFormatter::immediateRel32):
+ (JSC::X86Assembler::X86InstructionFormatter::rewindToLabel):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::atJumpTarget):
+ (JSC::JIT::emitGetVirtualRegister):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jmp):
+ (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_jsr):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emit_op_jmp_scopes):
+
+2011-05-01 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix MIPS build due to the split of "Condition" enum
+ https://bugs.webkit.org/show_bug.cgi?id=59407
+
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::debugOffset):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::branch32):
+ (JSC::MacroAssemblerMIPS::compare32):
+
+2011-04-30 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Enable strict OwnPtr for GTK
+ https://bugs.webkit.org/show_bug.cgi?id=59861
+
+ * wtf/OwnPtr.h:
+
+2011-04-30 Gavin Barraclough <barraclough@apple.com>
+
+ ARMv7 build fix.
+
+ * assembler/AssemblerBufferWithConstantPool.h:
+
+2011-04-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 59869 - AssemblerBuffer cleanup - disambiguate size()
+
+ The method size() is called on the AssemblerBuffer both to acquire
+ the complete size of the code, and to get a position to use as a
+ label into the code. Instead, add an explicit 'label' method.
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::blx):
+ (JSC::ARMAssembler::codeSize):
+ (JSC::ARMAssembler::label):
+ (JSC::ARMAssembler::loadBranchTarget):
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::b):
+ (JSC::ARMv7Assembler::blx):
+ (JSC::ARMv7Assembler::bx):
+ (JSC::ARMv7Assembler::label):
+ (JSC::ARMv7Assembler::codeSize):
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::codeSize):
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::data):
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::codeSize):
+ (JSC::AssemblerBuffer::label):
+ * assembler/AssemblerBufferWithConstantPool.h:
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::LinkBuffer):
+ (JSC::LinkBuffer::linkCode):
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::newJmpSrc):
+ (JSC::MIPSAssembler::appendJump):
+ (JSC::MIPSAssembler::label):
+ (JSC::MIPSAssembler::codeSize):
+ (JSC::MIPSAssembler::relocateJumps):
+ * assembler/SH4Assembler.h:
+ (JSC::SH4Assembler::loadConstant):
+ (JSC::SH4Assembler::loadConstantUnReusable):
+ (JSC::SH4Assembler::call):
+ (JSC::SH4Assembler::jmp):
+ (JSC::SH4Assembler::jne):
+ (JSC::SH4Assembler::je):
+ (JSC::SH4Assembler::label):
+ (JSC::SH4Assembler::executableCopy):
+ (JSC::SH4Assembler::oneShortOp):
+ (JSC::SH4Assembler::codeSize):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::call):
+ (JSC::X86Assembler::jmp_r):
+ (JSC::X86Assembler::codeSize):
+ (JSC::X86Assembler::label):
+ (JSC::X86Assembler::executableCopy):
+ (JSC::X86Assembler::X86InstructionFormatter::immediateRel32):
+ (JSC::X86Assembler::X86InstructionFormatter::codeSize):
+ (JSC::X86Assembler::X86InstructionFormatter::label):
+ (JSC::X86Assembler::X86InstructionFormatter::executableCopy):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::compile):
+
+2011-04-29 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-04-29 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ CSP script-src should block eval
+ https://bugs.webkit.org/show_bug.cgi?id=59850
+
+ ggaren recommend a different approach to this patch, essentially
+ installing a new function for function-eval and changing the AST
+ representation of operator-eval to call function-eval. However, I'm
+ not sure that approach is workable because the ASTBuilder doesn't know
+ about global objects, and there is added complication due to the cache.
+
+ This approach is more dynamic, adding a branch in EvalExecutable to
+ detect whether eval is current disabled in the lexical scope. The spec
+ is slightly unclear about whether we should return undefined or throw
+ an exception. I've asked Brandon to clarify the spec, but throwing an
+ exception seems natural.
+
+ * JavaScriptCore.exp:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::disableEval):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ (JSC::JSGlobalObject::isEvalEnabled):
+
+2011-04-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=59847
+ Remove linkOffset from LinkBuffer
+
+ This is redundant since removal of recompilation for exception info.
+
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::LinkBuffer):
+ (JSC::LinkBuffer::linkCode):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::compile):
+ (JSC::JIT::compileCTIMachineTrampolines):
+ (JSC::JIT::compileCTINativeCall):
+ * 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/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::compile):
+
+2011-04-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt & Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=59221
+ [RegexFuzz] Regression blocking testing
+
+ Okay, so the bug here is that when, in the case of a TypeParentheticalAssertion
+ node, emitDisjunction recursively calls to itself to emit the nested disjunction
+ the value of parenthesesInputCountAlreadyChecked is bogus (doesn't take into
+ account the uncheck that has just taken place).
+
+ Also, the special handling given to countToCheck in the case of parenthetical
+ assertions is nonsense, delete it, along with the isParentheticalAssertion argument.
+
+ * yarr/YarrInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+
+2011-04-29 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Enable strict OwnPtr for Qt
+ https://bugs.webkit.org/show_bug.cgi?id=59667
+
+ * wtf/OwnPtr.h:
+
+2011-04-29 Dean Jackson <dino@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Add ENABLE macro for WebKitAnimation
+ https://bugs.webkit.org/show_bug.cgi?id=59729
+
+ Add new feature to toggle WebKit Animation API.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Install testapi.js along side testapi
+ https://bugs.webkit.org/show_bug.cgi?id=59773
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Add new build phase to copy testapi.js to install path of testapi
+ on install.
+
+2011-04-28 David Levin <levin@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Remove IMAGE_RESIZER related code.
+ https://bugs.webkit.org/show_bug.cgi?id=59735
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=59763
+ DFG JIT - Unify FPRReg & FPRegisterID
+
+ (Following on from GPRReg/RegisterID unification).
+
+ * dfg/DFGFPRInfo.h:
+ (JSC::DFG::FPRInfo::toRegister):
+ (JSC::DFG::FPRInfo::debugName):
+ * dfg/DFGGPRInfo.h:
+ * dfg/DFGJITCodeGenerator.cpp:
+ (JSC::DFG::JITCodeGenerator::fillDouble):
+ (JSC::DFG::JITCodeGenerator::checkConsistency):
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::boxDouble):
+ (JSC::DFG::JITCodeGenerator::unboxDouble):
+ (JSC::DFG::JITCodeGenerator::flushRegisters):
+ (JSC::DFG::JITCodeGenerator::isFlushed):
+ (JSC::DFG::JITCodeGenerator::setupTwoStubArgs):
+ (JSC::DFG::JITCodeGenerator::setupStubArguments):
+ (JSC::DFG::JITCodeGenerator::callOperation):
+ (JSC::DFG::GPRResult::lockedResult):
+ (JSC::DFG::FPRResult::lockedResult):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::fillNumericToDouble):
+ (JSC::DFG::JITCompiler::jumpFromSpeculativeToNonSpeculative):
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGJITCompiler.h:
+ * dfg/DFGNode.h:
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::EntryLocation::EntryLocation):
+ (JSC::DFG::NonSpeculativeJIT::valueToNumber):
+ (JSC::DFG::NonSpeculativeJIT::valueToInt32):
+ (JSC::DFG::NonSpeculativeJIT::numberToInt32):
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGNonSpeculativeJIT.h:
+ (JSC::DFG::NonSpeculativeJIT::silentSpillAllRegisters):
+ (JSC::DFG::NonSpeculativeJIT::silentFillAllRegisters):
+ * dfg/DFGRegisterBank.h:
+ (JSC::DFG::RegisterBank::iterator::regID):
+ (JSC::DFG::RegisterBank::iterator::debugName):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculationCheck::SpeculationCheck):
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+
+2011-04-28 David Kilzer <ddkilzer@apple.com>
+
+ Revert "<http://webkit.org/b/59705> WTF::postTimer() leaks a CFRunLoopTimerRef every time it's called"
+
+ This reverts commit r85195. It was crashing DumpRenderTree on Lion.
+
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::postTimer):
+
+2011-04-28 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove WML
+ https://bugs.webkit.org/show_bug.cgi?id=59678
+
+ Remove the WML configuration option from the Mac build system.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-28 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r85233 and r85235.
+ http://trac.webkit.org/changeset/85233
+ http://trac.webkit.org/changeset/85235
+ https://bugs.webkit.org/show_bug.cgi?id=59754
+
+ Causes issues with jsc. (Requested by dave_levin on #webkit).
+
+ * GNUmakefile.list.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::ExecutablePool):
+ * parser/SourceProvider.h:
+ (JSC::SourceProvider::SourceProvider):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * wtf/CMakeLists.txt:
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::ref):
+ (WTF::RefCountedBase::hasOneRef):
+ (WTF::RefCountedBase::refCount):
+ (WTF::RefCountedBase::derefBase):
+ * wtf/SizeLimits.cpp:
+ * wtf/ThreadRestrictionVerifier.h: Removed.
+ * wtf/text/CString.h:
+ (WTF::CStringBuffer::CStringBuffer):
+
+2011-04-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 59740 - DFG JIT - Unify GPRReg & RegisterID
+
+ Currently we use a mix of enum values throughout the DFG JIT to represent
+ gpr registers - the RegisterID provided by the MacroAssembler, and the
+ GPRReg enum giving the sequential register set over which the RegisterBank
+ allocates. Unify the two.
+
+ Patch to unify FPRReg in a similar fashion will follow.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * dfg/DFGFPRInfo.h: Added.
+ (JSC::DFG::next):
+ (JSC::DFG::FPRBankInfo::toRegister):
+ (JSC::DFG::FPRBankInfo::toIndex):
+ * dfg/DFGGPRInfo.h: Added.
+ (JSC::DFG::GPRInfo::toRegister):
+ (JSC::DFG::GPRInfo::toIndex):
+ (JSC::DFG::GPRInfo::debugName):
+ * dfg/DFGJITCodeGenerator.cpp:
+ (JSC::DFG::JITCodeGenerator::fillInteger):
+ (JSC::DFG::JITCodeGenerator::fillDouble):
+ (JSC::DFG::JITCodeGenerator::fillJSValue):
+ (JSC::DFG::JITCodeGenerator::dump):
+ (JSC::DFG::JITCodeGenerator::checkConsistency):
+ (JSC::DFG::GPRTemporary::GPRTemporary):
+ (JSC::DFG::FPRTemporary::FPRTemporary):
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::boxDouble):
+ (JSC::DFG::JITCodeGenerator::unboxDouble):
+ (JSC::DFG::JITCodeGenerator::spill):
+ (JSC::DFG::JITCodeGenerator::flushRegisters):
+ (JSC::DFG::JITCodeGenerator::isFlushed):
+ (JSC::DFG::JITCodeGenerator::bitOp):
+ (JSC::DFG::JITCodeGenerator::shiftOp):
+ (JSC::DFG::JITCodeGenerator::setupTwoStubArgs):
+ (JSC::DFG::JITCodeGenerator::setupStubArguments):
+ (JSC::DFG::JITCodeGenerator::callOperation):
+ (JSC::DFG::IntegerOperand::gpr):
+ (JSC::DFG::DoubleOperand::gpr):
+ (JSC::DFG::GPRTemporary::gpr):
+ (JSC::DFG::FPRTemporary::gpr):
+ (JSC::DFG::GPRResult::lockedResult):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::fillNumericToDouble):
+ (JSC::DFG::JITCompiler::fillInt32ToInteger):
+ (JSC::DFG::JITCompiler::fillToJS):
+ (JSC::DFG::JITCompiler::jumpFromSpeculativeToNonSpeculative):
+ (JSC::DFG::JITCompiler::compileFunction):
+ (JSC::DFG::JITCompiler::jitAssertIsInt32):
+ (JSC::DFG::JITCompiler::jitAssertIsJSInt32):
+ (JSC::DFG::JITCompiler::jitAssertIsJSNumber):
+ (JSC::DFG::JITCompiler::jitAssertIsJSDouble):
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::preserveReturnAddressAfterCall):
+ (JSC::DFG::JITCompiler::restoreReturnAddressBeforeReturn):
+ (JSC::DFG::JITCompiler::emitGetFromCallFrameHeaderPtr):
+ (JSC::DFG::JITCompiler::emitPutToCallFrameHeader):
+ (JSC::DFG::JITCompiler::emitPutImmediateToCallFrameHeader):
+ (JSC::DFG::JITCompiler::addressForGlobalVar):
+ (JSC::DFG::JITCompiler::addressFor):
+ (JSC::DFG::JITCompiler::tagFor):
+ (JSC::DFG::JITCompiler::payloadFor):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::EntryLocation::EntryLocation):
+ (JSC::DFG::NonSpeculativeJIT::valueToNumber):
+ (JSC::DFG::NonSpeculativeJIT::valueToInt32):
+ (JSC::DFG::NonSpeculativeJIT::numberToInt32):
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGNonSpeculativeJIT.h:
+ (JSC::DFG::NonSpeculativeJIT::silentSpillGPR):
+ (JSC::DFG::NonSpeculativeJIT::silentSpillFPR):
+ (JSC::DFG::NonSpeculativeJIT::silentFillGPR):
+ (JSC::DFG::NonSpeculativeJIT::silentFillFPR):
+ (JSC::DFG::NonSpeculativeJIT::silentSpillAllRegisters):
+ (JSC::DFG::NonSpeculativeJIT::silentFillAllRegisters):
+ * dfg/DFGRegisterBank.h:
+ (JSC::DFG::RegisterBank::allocate):
+ (JSC::DFG::RegisterBank::retain):
+ (JSC::DFG::RegisterBank::release):
+ (JSC::DFG::RegisterBank::lock):
+ (JSC::DFG::RegisterBank::unlock):
+ (JSC::DFG::RegisterBank::isLocked):
+ (JSC::DFG::RegisterBank::name):
+ (JSC::DFG::RegisterBank::iterator::name):
+ (JSC::DFG::RegisterBank::iterator::isLocked):
+ (JSC::DFG::RegisterBank::iterator::release):
+ (JSC::DFG::RegisterBank::iterator::gpr):
+ (JSC::DFG::RegisterBank::iterator::debugName):
+ (JSC::DFG::RegisterBank::iterator::operator++):
+ (JSC::DFG::RegisterBank::iterator::operator!=):
+ (JSC::DFG::RegisterBank::iterator::index):
+ (JSC::DFG::RegisterBank::iterator::iterator):
+ (JSC::DFG::RegisterBank::begin):
+ (JSC::DFG::RegisterBank::end):
+ (JSC::DFG::RegisterBank::isLockedAtIndex):
+ (JSC::DFG::RegisterBank::nameAtIndex):
+ (JSC::DFG::RegisterBank::releaseAtIndex):
+ (JSC::DFG::RegisterBank::allocateInternal):
+ (JSC::DFG::RegisterBank::MapEntry::MapEntry):
+ * dfg/DFGScoreBoard.h:
+ (JSC::DFG::ScoreBoard::~ScoreBoard):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
+ (JSC::DFG::SpeculationCheck::SpeculationCheck):
+ (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
+ (JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
+ (JSC::DFG::SpeculativeJIT::compile):
+ (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
+ (JSC::DFG::SpeculativeJIT::initializeVariableTypes):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculateIntegerOperand::gpr):
+
+2011-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove evil addressOfStructure() function
+ https://bugs.webkit.org/show_bug.cgi?id=59739
+
+ Remove the addressOfStructure function from JSCell, and update
+ callsites to use the same logic as testPrototype()
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ * runtime/JSCell.h:
+
+2011-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Clean up testPrototype()
+ https://bugs.webkit.org/show_bug.cgi?id=59734
+
+ Remove direct pointer to the inside of a GC object and just do
+ the indirect load manually. Doesn't effect sunspider but does
+ clean up the code quite a bit, and simplifies the handling of
+ GC values.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::testPrototype):
+
+2011-04-28 David Levin <levin@chromium.org>
+
+ Build fix.
+
+ * wtf/RefCounted.h: Fix inverted ifdef.
+
+2011-04-07 David Levin <levin@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
+
+ * GNUmakefile.list.am: Added new files to the build.
+ * JavaScriptCore.gypi: Ditto.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::ExecutablePool): Turned off checks for this
+ due to not being able to figure out what was guarding it (bug 58091).
+ * parser/SourceProvider.h:
+ (JSC::SourceProvider::SourceProvider): Ditto.
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp): Ditto.
+ * wtf/CMakeLists.txt: Added new files to the build.
+ * wtf/ThreadRestrictionVerifier.h: Added.
+ Everything is done in the header to avoid the issue with exports
+ that are only useful in debug but still needing to export them.
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::ref): Added checks using the non thread safe verifier.
+ and filed bug 58171 about making it stricter.
+ (WTF::RefCountedBase::hasOneRef): Ditto.
+ (WTF::RefCountedBase::refCount): Ditto.
+ (WTF::RefCountedBase::setMutexForVerifier): Expose a way to change the checks to be based
+ on a mutex. This is in the header to avoid adding more exports from JavaScriptCore.
+ (WTF::RefCountedBase::deprecatedTurnOffVerifier): Temporary way to turn off verification.
+ Filed bug 58174 to remove this method.
+ (WTF::RefCountedBase::derefBase):
+ * wtf/SizeLimits.cpp: Adjusted the debug size check for RefCounted.
+ * wtf/text/CString.h:
+ (WTF::CStringBuffer::CStringBuffer): Turned off checks for this while a fix is being
+ done in Chromium's test_shell (bug 58093).
+
+2011-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed attempt to fix the build.
+
+ * GNUmakefile.am: add -lpthread.
+
+2011-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Only need a single implementation of testPrototype
+ https://bugs.webkit.org/show_bug.cgi?id=59724
+
+ Remove excess copy of identical testPrototype() code
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::testPrototype):
+ * jit/JITPropertyAccess32_64.cpp:
+
+2011-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [Gtk] Split JSC and WebCore builds
+ https://bugs.webkit.org/show_bug.cgi?id=19428
+
+ Build JavaScriptCore as a libtool shared library instead of a
+ private convenience library.
+
+ * GNUmakefile.am: define new jsc library and adapt to new name for
+ javascriptcore target.
+ * GNUmakefile.list.am: ditto.
+
+2011-04-28 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/59705> WTF::postTimer() leaks a CFRunLoopTimerRef every time it's called
+
+ Reviewed by Simon Fraser.
+
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::postTimer): Use RetainPtr to plug the leak.
+
+2011-04-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Add way to install testapi in production builds
+ https://bugs.webkit.org/show_bug.cgi?id=59674
+
+ * Configurations/TestAPI.xcconfig: Copied from Configurations/JavaScriptCore.xcconfig.
+ Add configuration file for TestAPI. In addition to name, we now specify an install path
+ and allow SKIP_INSTALL to be overridden by setting FORCE_TOOL_INSTALL.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Remove in-project build settings and add missing configuration files. Added missing CompilerVersion.xcconfig
+ file.
+
+2011-04-27 Adam Barth <abarth@webkit.org>
+
+ Reviewed by David Levin.
+
+ Enable strict OwnPtrs for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=59666
+
+ * wtf/OwnPtr.h:
+
+2011-04-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Add ability to remove keys from weakmap API
+ https://bugs.webkit.org/show_bug.cgi?id=59645
+
+ Add JSWeakObjectMapRemove API
+
+ * API/JSWeakObjectMapRefPrivate.cpp:
+ * API/JSWeakObjectMapRefPrivate.h:
+ * JavaScriptCore.exp:
+
+2011-04-27 Adam Barth <abarth@webkit.org>
+
+ Reviewed by David Levin.
+
+ Enable strict mode for OwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=59428
+
+ This patch enables strict mode for OwnPtr on PLATFORM(MAC) only.
+
+ * wtf/OwnPtr.h:
+
+2011-04-27 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Remove Android build system
+ https://bugs.webkit.org/show_bug.cgi?id=48111
+
+ This is to avoid the maintenance burden until the Android port is
+ fully upstreamed.
+
+ * Android.mk: Removed.
+ * Android.v8.wtf.mk: Removed.
+
+2011-04-27 Mark Rowe <mrowe@apple.com>
+
+ Fix 32-bit build after r85036.
+
+ * wtf/Platform.h: USE(PLUGIN_HOST_PROCESS) is only true for 64-bit.
+
+2011-04-27 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed buildfix after r85036.
+
+ Readd non-dead code.
+
+ * wtf/OSAllocatorPosix.cpp:
+ (WTF::OSAllocator::reserveAndCommit):
+
+2011-04-27 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Kenneth Russell.
+
+ OwnPtr assignment operator should be private
+ https://bugs.webkit.org/show_bug.cgi?id=59487
+
+ Unfortunately we can't remove the copy constructor because of some
+ detail about gcc. (The issue is documented in a comment already.)
+
+ * wtf/OwnPtr.h:
+
+2011-04-26 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r84977.
+ http://trac.webkit.org/changeset/84977
+ https://bugs.webkit.org/show_bug.cgi?id=59568
+
+ caused crashes on the SL WK2 bots (Requested by jessieberlin
+ on #webkit).
+
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::call):
+ (JSC::MacroAssemblerX86_64::tailRecursiveCall):
+ (JSC::MacroAssemblerX86_64::makeTailRecursiveCall):
+
+2011-04-26 Kevin Ollivier <kevino@theolliviers.com>
+
+ Rubberstamped by Eric Seidel.
+
+ Enable waf to be used to build other ports
+ https://bugs.webkit.org/show_bug.cgi?id=58213
+
+ * wscript:
+
+2011-04-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by David Hyatt.
+
+ Remove Datagrid from the tree
+ https://bugs.webkit.org/show_bug.cgi?id=59543
+
+ * Configurations/FeatureDefines.xcconfig:
+ Remove feature.
+
+2011-04-26 Adrienne Walker <enne@google.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix incorrect use of OwnPtr<T*> in GCActivityCallback
+ https://bugs.webkit.org/show_bug.cgi?id=59559
+
+ * runtime/GCActivityCallback.h:
+
+2011-04-26 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Daniel Bates.
+
+ Unused but set variable warning in MacroAssembelX86_64
+ https://bugs.webkit.org/show_bug.cgi?id=59482
+
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::call): do not declare the label
+ variable if we are not going to use it.
+ (JSC::MacroAssemblerX86_64::tailRecursiveCall): ditto.
+ (JSC::MacroAssemblerX86_64::makeTailRecursiveCall): ditto.
+
+2011-04-26 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Choose the compiler based on the Xcode version for Snow Leopard debug builds.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/CompilerVersion.xcconfig: Added.
+
+2011-04-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Nixed special finalizer handling for WebCore strings
+ https://bugs.webkit.org/show_bug.cgi?id=59425
+
+ SunSpider reports no change.
+
+ Not needed anymore, since weak handles have finalizers.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::resolveRopeSlowCase):
+ (JSC::JSString::outOfMemory):
+ (JSC::JSString::substringFromRope):
+ (JSC::JSString::replaceCharacter): Updated for removal of union.
+
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::~JSString):
+ (JSC::RopeBuilder::appendStringInConstruct):
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength): No need for
+ union or special constructor anymore.
+
+2011-04-26 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Speeding up SVG filters with multicore (SMP) support
+ https://bugs.webkit.org/show_bug.cgi?id=43903
+
+ Some SVG filters execute a huge number of pixel manipulations, which
+ cannot be sped up by graphics accelerators, since their algorithm is
+ too complex. Using the power of Symmetric Multi Processing (SMP) we
+ can split up a task to smaller (data independent) tasks, which can be
+ executed independently.
+
+ The ParallelJobs framework provides a simple way for distributed
+ programming. The framework is based on WebKit's threading infrastructure,
+ Open Multi-Processing's (OpenMP) API, and libdispatch API.
+
+ * GNUmakefile.list.am:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/ParallelJobs.h: Added.
+ (WTF::ParallelJobs::ParallelJobs):
+ (WTF::ParallelJobs::numberOfJobs):
+ (WTF::ParallelJobs::parameterForJob):
+ (WTF::ParallelJobs::executeJobs):
+ * wtf/ParallelJobsGeneric.cpp: Added.
+ (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
+ (WTF::ParallelEnvironment::ThreadPrivate::executeJob):
+ (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
+ (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
+ * wtf/ParallelJobsGeneric.h: Added.
+ (WTF::ParallelEnvironment::ParallelEnvironment):
+ (WTF::ParallelEnvironment::numberOfJobs):
+ (WTF::ParallelEnvironment::parameterForJob):
+ (WTF::ParallelEnvironment::executeJobs):
+ (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate):
+ (WTF::ParallelEnvironment::ThreadPrivate::create):
+ * wtf/ParallelJobsLibdispatch.h: Added.
+ (WTF::ParallelEnvironment::ParallelEnvironment):
+ (WTF::ParallelEnvironment::numberOfJobs):
+ (WTF::ParallelEnvironment::parameterForJob):
+ (WTF::ParallelEnvironment::executeJobs):
+ * wtf/ParallelJobsOpenMP.h: Added.
+ (WTF::ParallelEnvironment::ParallelEnvironment):
+ (WTF::ParallelEnvironment::numberOfJobs):
+ (WTF::ParallelEnvironment::parameterForJob):
+ (WTF::ParallelEnvironment::executeJobs):
+ * wtf/Platform.h:
+ * wtf/wtf.pri:
+
+2011-04-26 Mihai Parparita <mihaip@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Turn off make built-in implicit rules for derived sources makefile
+ https://bugs.webkit.org/show_bug.cgi?id=59418
+
+ We don't use any of make's built-in implicit rules, turning them off
+ speeds up parsing of the makefile.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * gyp/generate-derived-sources.sh:
+
+2011-04-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Custom prototypes on DOM objects don't persist after garbage collection
+ https://bugs.webkit.org/show_bug.cgi?id=59412
+
+ SunSpider reports no change.
+
+ The hasCustomProperties() check didn't check for a custom prototype.
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::hasCustomProperties): Changed to delegate to Structure
+ because it is the "truth" about an object's pedigree.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ * runtime/Structure.h:
+ (JSC::Structure::didTransition): Track whether a Structure has ever
+ transitioned for any reason. If so, we have to assume that the object
+ holding it is custom in some way.
+
+2011-04-25 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=59405
+ DFG JIT - add type speculation for integer & array types, for vars & args.
+
+ If a var or argument is used as the base for a GetByVal or PutByVal access
+ we are speculating that it is of type Array (we only generate code on the
+ speculative path to perform array accesses). By typing the var or args slot
+ as Array, and checking on entry to the function (in the case of args), and
+ each time the local is written to, we can avoid a type check at each point
+ the array is accessed. This will typically hoist type checks out of loops.
+
+ Similarly, any local that is incremented or decremented, or is the input or
+ output or a bitwise operator, is likely to be an integer. By typing the
+ local as int32 we can avoid speculation checks on access, and tagging when
+ writing to the slot. All accesses can become 32bit instead of 64.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::set):
+ (JSC::DFG::ByteCodeParser::predictArray):
+ (JSC::DFG::ByteCodeParser::predictInt32):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::PredictionSlot::PredictionSlot):
+ (JSC::DFG::Graph::Graph):
+ (JSC::DFG::Graph::predict):
+ (JSC::DFG::Graph::getPrediction):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::tagFor):
+ (JSC::DFG::JITCompiler::payloadFor):
+ * dfg/DFGNode.h:
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
+ (JSC::DFG::SpeculativeJIT::initializeVariableTypes):
+ * dfg/DFGSpeculativeJIT.h:
+ * runtime/Executable.cpp:
+ (JSC::tryDFGCompile):
+
+2011-04-25 David Levin <levin@chromium.org>
+
+ Reviewed by James Robinson.
+
+ Fix OwnPtr strict mode violation in MessageQueue.h
+ https://bugs.webkit.org/show_bug.cgi?id=59400
+
+ * wtf/MessageQueue.h:
+ (WTF::::waitForMessage):
+ (WTF::::waitForMessageFilteredWithTimeout):
+ (WTF::::tryGetMessage):
+
+2011-04-25 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ JavaScriptCore should play nice strict OwnPtrs
+ https://bugs.webkit.org/show_bug.cgi?id=59401
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parse):
+ * heap/Heap.cpp:
+ (JSC::TypeCounter::TypeCounter):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::Scope):
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::GenerationState::addParenthesesTail):
+
+2011-04-25 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * wtf/ListHashSet.h:
+
+2011-04-25 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 59370 - DFG JIT - fix leak of BlocksBlocks
+ (put the blocks immediately into an OwnPtr).
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parse):
+
+2011-04-25 James Robinson <jamesr@chromium.org>
+
+ Reviewed by David Levin.
+
+ Fix strict OwnPtr violations in ListHashSet and RenderLayerCompositor
+ https://bugs.webkit.org/show_bug.cgi?id=59353
+
+ * wtf/ListHashSet.h:
+ (WTF::::ListHashSet):
+
+2011-04-25 David Levin <levin@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Fix PassOwnPtr issues in Structure and JSGlobalData.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=59347
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/Structure.cpp:
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::createPropertyMap):
+ * runtime/Structure.h:
+
+2011-04-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make ClassInfo required when creating a Structure
+ https://bugs.webkit.org/show_bug.cgi?id=59340
+
+ Add ClassInfo to all those types which currently don't
+ have it, and add an assertion to Structure::create to
+ ensure that the provided classInfo is not null.
+
+ * runtime/Executable.h:
+ (JSC::EvalExecutable::createStructure):
+ (JSC::ProgramExecutable::createStructure):
+ (JSC::FunctionExecutable::createStructure):
+ * runtime/GetterSetter.cpp:
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::createStructure):
+ * runtime/JSAPIValueWrapper.cpp:
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::createStructure):
+ * runtime/JSCell.cpp:
+ * runtime/JSCell.h:
+ * runtime/JSString.cpp:
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::createStructure):
+ * runtime/Structure.h:
+ (JSC::Structure::create):
+ (JSC::JSCell::createDummyStructure):
+
+2011-04-25 David Levin <levin@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ PropertyMapHashTable.h should use adoptPtr instead of implicit conversions to PassRefPtr.
+ https://bugs.webkit.org/show_bug.cgi?id=59342
+
+ This patch is to prepare for the strict OwnPtr hack-a-thon.
+
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyTable::copy):
+
+2011-04-25 Thouraya ANDOLSI <thouraya.andolsi@st.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Rationalize MacroAssembler branch methods
+ https://bugs.webkit.org/show_bug.cgi?id=58950
+
+ split out the 'Condition' enum into 'RelationalCondition' and 'ResultCondition'
+ and apply related changes (only for SH4 platforms).
+
+ * assembler/MacroAssemblerSH4.cpp:
+ * assembler/MacroAssemblerSH4.h:
+ (JSC::MacroAssemblerSH4::compare32):
+ (JSC::MacroAssemblerSH4::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerSH4::branchDouble):
+ (JSC::MacroAssemblerSH4::branch32):
+ (JSC::MacroAssemblerSH4::branchTest8):
+ (JSC::MacroAssemblerSH4::branch8):
+ (JSC::MacroAssemblerSH4::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerSH4::test8):
+ (JSC::MacroAssemblerSH4::branch16):
+ (JSC::MacroAssemblerSH4::branchTest32):
+ (JSC::MacroAssemblerSH4::branchAdd32):
+ (JSC::MacroAssemblerSH4::branchMul32):
+ (JSC::MacroAssemblerSH4::branchSub32):
+ (JSC::MacroAssemblerSH4::branchOr32):
+ (JSC::MacroAssemblerSH4::branchConvertDoubleToInt32):
+ (JSC::MacroAssemblerSH4::branchPtrWithPatch):
+ (JSC::MacroAssemblerSH4::SH4Condition):
+ * assembler/SH4Assembler.h:
+ (JSC::SH4Assembler::cmpEqImmR0):
+
+2011-04-25 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ PropertyMapHashTable should work with strict OwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=59337
+
+ This patch is in preparation for the strict OwnPtr hack-a-thon.
+
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyTable::PropertyTable):
+ (JSC::PropertyTable::addDeletedOffset):
+
+2011-04-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Nixed MarkStack::deprecatedAppend, since it has no clients left.
+
+ * heap/MarkStack.h:
+
+2011-04-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 59287 - DFG JIT - Handle temporaries as vars, allowing support for ?:
+
+ SetLocals to temporaries will only be generated if they are used within other
+ blocks, due to the SSA based DCE.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::ByteCodeParser):
+ (JSC::DFG::ByteCodeParser::get):
+ (JSC::DFG::ByteCodeParser::set):
+ (JSC::DFG::ByteCodeParser::getLocal):
+ (JSC::DFG::ByteCodeParser::setLocal):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ (JSC::DFG::ByteCodeParser::processPhiStack):
+ (JSC::DFG::ByteCodeParser::allocateVirtualRegisters):
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::BasicBlock::BasicBlock):
+
+2011-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig & Geoff Garen.
+
+ Bug 59266 - DFG JIT - Add SSA style DCE
+
+ This works by making GetLocal nodes reference SetLocal nodes from prior blocks,
+ via intermediate Phi nodes. Whenever we add a GetLocal to the graph, also add a
+ matching child Phi, and add the Phi to a work queue to add references to prior
+ definitions once we have the full CFG & can determine predecessors. This process
+ is iterative, inserting new phis into predecessors as necessary.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::getVariable):
+ (JSC::DFG::ByteCodeParser::setVariable):
+ (JSC::DFG::ByteCodeParser::getArgument):
+ (JSC::DFG::ByteCodeParser::setArgument):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ (JSC::DFG::ByteCodeParser::processWorkQueue):
+ (JSC::DFG::ByteCodeParser::allocateVirtualRegisters):
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ (JSC::DFG::Graph::refChildren):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::ref):
+ * dfg/DFGNode.h:
+ (JSC::DFG::Node::ref):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGScoreBoard.h:
+ (JSC::DFG::ScoreBoard::~ScoreBoard):
+ (JSC::DFG::ScoreBoard::dump):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+
+2011-04-22 Vitaly Repeshko <vitalyr@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add missing default constructors for HashMap iterator specializations.
+ https://bugs.webkit.org/show_bug.cgi?id=59250
+
+ * wtf/HashIterators.h:
+ * wtf/HashTable.h:
+ (WTF::HashTableConstIterator::HashTableConstIterator): Added cast
+ to help compiler find the function template.
+
+2011-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 59262 - DFG JIT - reduce size of VariableRecord
+
+ We never need both the get & set node, only the most recent
+ (which is always a set, if both exist).
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::getVariable):
+ (JSC::DFG::ByteCodeParser::setVariable):
+ (JSC::DFG::ByteCodeParser::getArgument):
+ (JSC::DFG::ByteCodeParser::setArgument):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::VariableRecord::VariableRecord):
+
+2011-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Bug 59254 - DFG JIT - retain VariableRecords for args/var in all basic blocks,
+ such that this information is available for DCE. Also, since this enlarges the
+ size of BasicBlock, make Graph hold a vector of pointers to basic blocks, not a
+ vector of blocks.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::ByteCodeParser):
+ (JSC::DFG::ByteCodeParser::get):
+ (JSC::DFG::ByteCodeParser::set):
+ (JSC::DFG::ByteCodeParser::getVariable):
+ (JSC::DFG::ByteCodeParser::setVariable):
+ (JSC::DFG::ByteCodeParser::getArgument):
+ (JSC::DFG::ByteCodeParser::setArgument):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ (JSC::DFG::ByteCodeParser::setupPredecessors):
+ (JSC::DFG::ByteCodeParser::allocateVirtualRegisters):
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::VariableRecord::VariableRecord):
+ (JSC::DFG::BasicBlock::BasicBlock):
+ (JSC::DFG::BasicBlock::getBytecodeBegin):
+ (JSC::DFG::Graph::blockIndexForBytecodeOffset):
+ (JSC::DFG::Graph::blockForBytecodeOffset):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::detectPeepHoleBranch):
+
+2011-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Errk, build fix.
+
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+
+2011-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Quick cleanup to SpeculativeJIT/NonSpeculativeJIT compile loop,
+ move out the call to checkConsistency().
+
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
+ (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
+
+2011-04-21 Vitaly Repeshko <vitalyr@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Provide default constructors for HashMap iterators.
+ https://bugs.webkit.org/show_bug.cgi?id=59151
+
+ These will be used to implement an iterator over EventTarget's
+ listeners.
+
+ * wtf/HashTable.h:
+ (WTF::HashTableConstIteratorAdapter::HashTableConstIteratorAdapter):
+ (WTF::HashTableIteratorAdapter::HashTableIteratorAdapter):
+
+2011-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 59232 - DFG JIT - Add predecessor links to BasicBlocks
+
+ These will be necessary for DCE support.
+ Also factor allocateVirtualRegisters out into its own method.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::setupPredecessors):
+ (JSC::DFG::ByteCodeParser::allocateVirtualRegisters):
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::blockForBytecodeOffset):
+ * dfg/DFGNode.h:
+ (JSC::DFG::Node::isTerminal):
+
+2011-04-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Object.create creates uncachable objects
+ https://bugs.webkit.org/show_bug.cgi?id=59164
+
+ Use the prototype object's inheritorID, as we
+ should always have done
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::visitChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::nullPrototypeObjectStructure):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorCreate):
+
+2011-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 59222 - DFG JIT - don't allocate virtual registers to nodes with no result
+
+ We currently allocate virtual registers to nodes which have no result - these are
+ clearly unused, and may result in us allocating a larger than necessary stack frame.
+
+ Encapsulate Node::virtualRegister such that we can ASSERT this is only called on
+ nodes that have results, and improve the quality of output from the consistency check.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::ref):
+ (JSC::DFG::Graph::deref):
+ * dfg/DFGJITCodeGenerator.cpp:
+ (JSC::DFG::JITCodeGenerator::fillInteger):
+ (JSC::DFG::JITCodeGenerator::fillDouble):
+ (JSC::DFG::JITCodeGenerator::fillJSValue):
+ (JSC::DFG::JITCodeGenerator::dump):
+ (JSC::DFG::JITCodeGenerator::checkConsistency):
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::canReuse):
+ (JSC::DFG::JITCodeGenerator::isFilled):
+ (JSC::DFG::JITCodeGenerator::isFilledDouble):
+ (JSC::DFG::JITCodeGenerator::use):
+ (JSC::DFG::JITCodeGenerator::integerResult):
+ (JSC::DFG::JITCodeGenerator::noResult):
+ (JSC::DFG::JITCodeGenerator::cellResult):
+ (JSC::DFG::JITCodeGenerator::jsValueResult):
+ (JSC::DFG::JITCodeGenerator::doubleResult):
+ (JSC::DFG::JITCodeGenerator::initConstantInfo):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::fillNumericToDouble):
+ (JSC::DFG::JITCompiler::fillInt32ToInteger):
+ (JSC::DFG::JITCompiler::fillToJS):
+ (JSC::DFG::JITCompiler::jumpFromSpeculativeToNonSpeculative):
+ * dfg/DFGNode.h:
+ (JSC::DFG::Node::Node):
+ (JSC::DFG::Node::hasResult):
+ (JSC::DFG::Node::virtualRegister):
+ (JSC::DFG::Node::setVirtualRegister):
+ (JSC::DFG::Node::refCount):
+ (JSC::DFG::Node::ref):
+ (JSC::DFG::Node::deref):
+ (JSC::DFG::Node::adjustedRefCount):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::isKnownInteger):
+ (JSC::DFG::NonSpeculativeJIT::isKnownNumeric):
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGScoreBoard.h:
+ (JSC::DFG::ScoreBoard::use):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
+ (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
+ (JSC::DFG::SpeculativeJIT::compile):
+
+2011-04-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Oliver Hunt.
+
+ Arrays should participate in global object forwarding fun
+ https://bugs.webkit.org/show_bug.cgi?id=59215
+
+ * runtime/JSGlobalObject.h:
+ (JSC::constructEmptyArray):
+ (JSC::constructArray):
+ Add variants of constructArray that take a global object.
+
+2011-04-22 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r84650 and r84654.
+ http://trac.webkit.org/changeset/84650
+ http://trac.webkit.org/changeset/84654
+ https://bugs.webkit.org/show_bug.cgi?id=59218
+
+ Broke Windows build (Requested by bweinstein on #webkit).
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::init):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * heap/Handle.h:
+ (JSC::HandleBase::operator!):
+ (JSC::HandleBase::operator UnspecifiedBoolType*):
+ (JSC::HandleTypes::getFromSlot):
+ * heap/HandleHeap.cpp:
+ (JSC::HandleHeap::markStrongHandles):
+ (JSC::HandleHeap::markWeakHandles):
+ (JSC::HandleHeap::finalizeWeakHandles):
+ (JSC::HandleHeap::writeBarrier):
+ (JSC::HandleHeap::protectedGlobalObjectCount):
+ (JSC::HandleHeap::isValidWeakNode):
+ * heap/HandleHeap.h:
+ (JSC::HandleHeap::copyWeak):
+ (JSC::HandleHeap::makeWeak):
+ (JSC::HandleHeap::Node::slot):
+ * heap/HandleStack.cpp:
+ (JSC::HandleStack::mark):
+ (JSC::HandleStack::grow):
+ * heap/HandleStack.h:
+ (JSC::HandleStack::zapTo):
+ (JSC::HandleStack::push):
+ * heap/Heap.cpp:
+ (JSC::HandleHeap::protectedObjectTypeCounts):
+ * heap/Local.h:
+ (JSC::::set):
+ * heap/Strong.h:
+ (JSC::Strong::set):
+ * heap/Weak.h:
+ (JSC::Weak::set):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::singleTransition):
+ (JSC::StructureTransitionTable::setSingleTransition):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::add):
+ (JSC::WeakGCMap::set):
+ * runtime/WriteBarrier.h:
+
+2011-04-22 Brian Weinstein <bweinstein@apple.com>
+
+ Part of Windows build fix from r84650.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-04-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make it harder to use HandleSlot incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=59205
+
+ Just add a little type fudging to make it harder to
+ incorrectly assign through a HandleSlot.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::init):
+ * JavaScriptCore.exp:
+ * heap/Handle.h:
+ (JSC::HandleBase::operator!):
+ (JSC::HandleBase::operator UnspecifiedBoolType*):
+ (JSC::HandleTypes::getFromSlot):
+ * heap/HandleHeap.cpp:
+ (JSC::HandleHeap::markStrongHandles):
+ (JSC::HandleHeap::markWeakHandles):
+ (JSC::HandleHeap::finalizeWeakHandles):
+ (JSC::HandleHeap::writeBarrier):
+ (JSC::HandleHeap::protectedGlobalObjectCount):
+ (JSC::HandleHeap::isValidWeakNode):
+ * heap/HandleHeap.h:
+ (JSC::HandleHeap::copyWeak):
+ (JSC::HandleHeap::makeWeak):
+ (JSC::HandleHeap::Node::slot):
+ * heap/HandleStack.cpp:
+ (JSC::HandleStack::mark):
+ (JSC::HandleStack::grow):
+ * heap/HandleStack.h:
+ (JSC::HandleStack::zapTo):
+ (JSC::HandleStack::push):
+ * heap/Heap.cpp:
+ (JSC::HandleHeap::protectedObjectTypeCounts):
+ * heap/Local.h:
+ (JSC::::set):
+ * heap/Strong.h:
+ (JSC::Strong::set):
+ * heap/Weak.h:
+ (JSC::Weak::set):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::singleTransition):
+ (JSC::StructureTransitionTable::setSingleTransition):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::add):
+ (JSC::WeakGCMap::set):
+ * runtime/WriteBarrier.h:
+ (JSC::OpaqueJSValue::toJSValue):
+ (JSC::OpaqueJSValue::toJSValueRef):
+ (JSC::OpaqueJSValue::fromJSValue):
+
+2011-04-22 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed. Build fix for ENABLE(INTERPRETER) after r84556.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::visitAggregate):
+
+2011-04-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r84583.
+ http://trac.webkit.org/changeset/84583
+ https://bugs.webkit.org/show_bug.cgi?id=59173
+
+ "broke
+ http://trac.webkit.org/export/84593/trunk/LayoutTests/fast/js
+ /Object-create.html" (Requested by ggaren on #webkit).
+
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorCreate):
+
+2011-04-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add a feature define to allow <details> and <summary> to be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=59118
+ <rdar://problem/9257045>
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Object.create creates uncachable objects
+ https://bugs.webkit.org/show_bug.cgi?id=59164
+
+ Use the prototype object's inheritorID, as we
+ should always have done
+
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorCreate):
+
+2011-04-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Start moving to a general visitor pattern for GC traversal
+ https://bugs.webkit.org/show_bug.cgi?id=59141
+
+ This is just a rename:
+ markChildren -> visitChildren
+ markAggregate -> visitAggregate
+ markStack -> visitor
+ MarkStack -> typedef'd to SlotVisitor
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::visitChildren):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::visitChildren):
+ (JSC::JSCallbackObject::visitChildren):
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::visitStructures):
+ (JSC::EvalCodeCache::visitAggregate):
+ (JSC::CodeBlock::visitAggregate):
+ * bytecode/CodeBlock.h:
+ * bytecode/EvalCodeCache.h:
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::visitAggregate):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::visitAggregate):
+ * bytecode/StructureStubInfo.h:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::visitChildren):
+ * debugger/DebuggerActivation.h:
+ * heap/HandleHeap.cpp:
+ (JSC::WeakHandleOwner::isReachableFromOpaqueRoots):
+ (JSC::HandleHeap::markStrongHandles):
+ (JSC::HandleHeap::markWeakHandles):
+ * heap/HandleHeap.h:
+ * heap/HandleStack.cpp:
+ (JSC::HandleStack::mark):
+ * heap/HandleStack.h:
+ * heap/Heap.cpp:
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * heap/Heap.h:
+ * heap/MarkStack.cpp:
+ (JSC::MarkStack::visitChildren):
+ (JSC::MarkStack::drain):
+ * heap/MarkStack.h:
+ (JSC::HeapRootVisitor::HeapRootVisitor):
+ (JSC::HeapRootVisitor::mark):
+ (JSC::HeapRootVisitor::visitor):
+ * heap/MarkedSpace.h:
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::markLists):
+ * runtime/ArgList.h:
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::visitChildren):
+ * runtime/Arguments.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::visitChildren):
+ (JSC::ProgramExecutable::visitChildren):
+ (JSC::FunctionExecutable::visitChildren):
+ * runtime/Executable.h:
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::visitChildren):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::createStructure):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::visitChildren):
+ * runtime/JSActivation.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::visitChildren):
+ * runtime/JSArray.h:
+ (JSC::JSArray::visitDirect):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell::visitChildren):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::visitChildren):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::visitIfNeeded):
+ (JSC::JSGlobalObject::visitChildren):
+ * runtime/JSGlobalObject.h:
+ * runtime/JSONObject.cpp:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::visitChildren):
+ * runtime/JSObject.h:
+ (JSC::JSObject::visitDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::visitChildren):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::createStructure):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::visitChildren):
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::TypeInfo):
+ (JSC::TypeInfo::overridesVisitChildren):
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::visitChildren):
+ * runtime/JSWrapperObject.h:
+ * runtime/JSZombie.h:
+ (JSC::JSZombie::visitChildren):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::visitChildren):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::visitChildren):
+ * runtime/RegExpObject.h:
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::visitChildren):
+ * runtime/ScopeChain.h:
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::visitChildren):
+ * runtime/SmallStrings.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::visitChildren):
+ * runtime/Structure.h:
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::visitChildren):
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::createStructure):
+
+2011-04-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r84548.
+ http://trac.webkit.org/changeset/84548
+ https://bugs.webkit.org/show_bug.cgi?id=59144
+
+ Broke chromium-win build (Requested by aklein on #webkit).
+
+ * wtf/Platform.h:
+
+2011-04-21 Adam Klein <adamk@chromium.org>
+
+ Reviewed by David Levin.
+
+ [fileapi] Worker File API calls that create Blobs fail in debug builds due to random number generator thread assertion
+ https://bugs.webkit.org/show_bug.cgi?id=55728
+
+ Enable WTF_MULTIPLE_THREADS for Chromium.
+
+ * wtf/Platform.h:
+
+2011-04-20 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ JSString::resolveRope inefficient for common 2 fiber case
+ https://bugs.webkit.org/show_bug.cgi?id=58994
+
+ Split JSString::resolveRope into three routines.
+ resolveRope allocates the new buffer and handles the 1 or 2
+ fiber case with single level fibers.
+ resolveRopeSlowCase handles the general case.
+ outOfMemory handles the rare out of memory exception case.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::resolveRopeSlowCase):
+ (JSC::JSString::outOfMemory):
+ * runtime/JSString.h:
+
+2011-04-20 Adam Klein <adamk@chromium.org>
+
+ Reviewed by David Levin.
+
+ Rename all uses of JSC_MULTIPLE_THREADS under wtf/... to WTF_MULTIPLE_THREADS
+ https://bugs.webkit.org/show_bug.cgi?id=59040
+
+ This will be used to fix https://bugs.webkit.org/show_bug.cgi?id=55728
+ by enabling WTF_MULTIPLE_THREADS for Chromium.
+
+ * wtf/CryptographicallyRandomNumber.cpp:
+ (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomNumber):
+ (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomValues):
+ * wtf/FastMalloc.cpp:
+ * wtf/Platform.h:
+ Enable WTF_MULTIPLE_THREADS whenever JSC_MULTIPLE_THREADS is enabled.
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+ * wtf/RefCountedLeakCounter.cpp:
+ (WTF::RefCountedLeakCounter::increment):
+ (WTF::RefCountedLeakCounter::decrement):
+ * wtf/dtoa.cpp:
+ (WTF::pow5mult):
+
+2011-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Geoff Garen
+
+ Bug 59069 - DFG JIT - register allocate r8, r9, r10
+
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::gprToRegisterID):
+
+2011-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix - revert accidental change.
+
+ * wtf/Platform.h:
+
+2011-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add SAMPLING_FLAGS tool to DFG JIT.
+
+ * bytecode/SamplingTool.h:
+ (JSC::SamplingFlags::addressOfFlags):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::setSamplingFlag):
+ (JSC::DFG::JITCompiler::clearSamplingFlag):
+ * dfg/DFGJITCompiler.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::setSamplingFlag):
+ (JSC::JIT::clearSamplingFlag):
+ * wtf/Platform.h:
+
+2011-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 59022 - DFG JIT - Optimize branch-on-relational-compare
+
+ If a relational compare (< or <=) is immediately followed by a branch,
+ we can combine the two, avoiding generation of a boolean into a register.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branch32):
+ (JSC::MacroAssemblerX86Common::invert):
+ (JSC::MacroAssemblerX86Common::commute):
+ * dfg/DFGNode.h:
+ (JSC::DFG::Node::adjustedRefCount):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::isJSConstantWithInt32Value):
+ (JSC::DFG::SpeculativeJIT::detectPeepHoleBranch):
+
+2011-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ ARMv7 build fix II.
+
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::softModulo):
+
+2011-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ ARMv7 build fix.
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::test8):
+
+2011-04-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Rationalize MacroAssembler branch methods
+ https://bugs.webkit.org/show_bug.cgi?id=58950
+
+ The MacroAssembler currently exposes x86's weird behaviour that the 'setcc'
+ instruction only sets the low 8 bits of a register. Stop that.
+
+ Having done so, to clarify remove the 'set32' prefix from test & compare
+ instructions - these methods all now set a full 32/64 bit register (Ptr size).
+ The size in the function name should indicate the amount of data being compared.
+
+ Also split out the 'Condition' enum into 'RelationalCondition' and
+ 'ResultCondition'. The former is used in binary comparison, the latter is a unary
+ condition check on the result of an operation.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::branchPtr):
+ (JSC::MacroAssembler::branch32):
+ (JSC::MacroAssembler::branch16):
+ (JSC::MacroAssembler::branchTestPtr):
+ (JSC::MacroAssembler::comparePtr):
+ (JSC::MacroAssembler::branchAddPtr):
+ (JSC::MacroAssembler::branchSubPtr):
+ (JSC::MacroAssembler::branchTest8):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::branch8):
+ (JSC::MacroAssemblerARM::branch32):
+ (JSC::MacroAssemblerARM::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARM::branch16):
+ (JSC::MacroAssemblerARM::branchTest8):
+ (JSC::MacroAssemblerARM::branchTest32):
+ (JSC::MacroAssemblerARM::branchAdd32):
+ (JSC::MacroAssemblerARM::branchMul32):
+ (JSC::MacroAssemblerARM::branchSub32):
+ (JSC::MacroAssemblerARM::branchNeg32):
+ (JSC::MacroAssemblerARM::branchOr32):
+ (JSC::MacroAssemblerARM::compare32):
+ (JSC::MacroAssemblerARM::test32):
+ (JSC::MacroAssemblerARM::test8):
+ (JSC::MacroAssemblerARM::branchPtrWithPatch):
+ (JSC::MacroAssemblerARM::ARMCondition):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::branch32):
+ (JSC::MacroAssemblerARMv7::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARMv7::branch16):
+ (JSC::MacroAssemblerARMv7::branch8):
+ (JSC::MacroAssemblerARMv7::branchTest32):
+ (JSC::MacroAssemblerARMv7::branchTest8):
+ (JSC::MacroAssemblerARMv7::branchAdd32):
+ (JSC::MacroAssemblerARMv7::branchMul32):
+ (JSC::MacroAssemblerARMv7::branchOr32):
+ (JSC::MacroAssemblerARMv7::branchSub32):
+ (JSC::MacroAssemblerARMv7::compare32):
+ (JSC::MacroAssemblerARMv7::test32):
+ (JSC::MacroAssemblerARMv7::test8):
+ (JSC::MacroAssemblerARMv7::branchPtrWithPatch):
+ (JSC::MacroAssemblerARMv7::makeBranch):
+ (JSC::MacroAssemblerARMv7::armV7Condition):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::branch8):
+ (JSC::MacroAssemblerMIPS::branch32):
+ (JSC::MacroAssemblerMIPS::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerMIPS::branch16):
+ (JSC::MacroAssemblerMIPS::branchTest32):
+ (JSC::MacroAssemblerMIPS::branchTest8):
+ (JSC::MacroAssemblerMIPS::branchAdd32):
+ (JSC::MacroAssemblerMIPS::branchMul32):
+ (JSC::MacroAssemblerMIPS::branchSub32):
+ (JSC::MacroAssemblerMIPS::branchOr32):
+ (JSC::MacroAssemblerMIPS::compare32):
+ (JSC::MacroAssemblerMIPS::test8):
+ (JSC::MacroAssemblerMIPS::test32):
+ (JSC::MacroAssemblerMIPS::branchPtrWithPatch):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::branch32):
+ (JSC::MacroAssemblerX86::branchPtrWithPatch):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branch8):
+ (JSC::MacroAssemblerX86Common::branch32):
+ (JSC::MacroAssemblerX86Common::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerX86Common::branch16):
+ (JSC::MacroAssemblerX86Common::branchTest32):
+ (JSC::MacroAssemblerX86Common::branchTest8):
+ (JSC::MacroAssemblerX86Common::branchAdd32):
+ (JSC::MacroAssemblerX86Common::branchMul32):
+ (JSC::MacroAssemblerX86Common::branchSub32):
+ (JSC::MacroAssemblerX86Common::branchNeg32):
+ (JSC::MacroAssemblerX86Common::branchOr32):
+ (JSC::MacroAssemblerX86Common::compare32):
+ (JSC::MacroAssemblerX86Common::test8):
+ (JSC::MacroAssemblerX86Common::test32):
+ (JSC::MacroAssemblerX86Common::x86Condition):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::comparePtr):
+ (JSC::MacroAssemblerX86_64::branchPtr):
+ (JSC::MacroAssemblerX86_64::branchTestPtr):
+ (JSC::MacroAssemblerX86_64::branchAddPtr):
+ (JSC::MacroAssemblerX86_64::branchSubPtr):
+ (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86_64::branchTest8):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * 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):
+
+2011-04-20 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Cleanup includepath adjustment for generated files
+ https://bugs.webkit.org/show_bug.cgi?id=58869
+
+ * JavaScriptCore.pri: Add the directory of generated files to the include
+ path with absolute path to make it valid in the final build step.
+
+2011-04-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove unneeded deprecated methods from MarkStack
+ https://bugs.webkit.org/show_bug.cgi?id=58853
+
+ Remove deprecated methods
+
+ * heap/MarkStack.h:
+
+2011-04-19 Mark Rowe <mrowe@apple.com>
+
+ Things work best when the Xcode project refers to the file at a path that exists.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-04-19 Renata Hodovan <reni@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move the alignment related macros in Vector.h to new Alignment.h.
+ https://bugs.webkit.org/show_bug.cgi?id=56000
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Alignment.h: Added.
+ * wtf/CMakeLists.txt:
+ * wtf/Vector.h:
+
+2011-04-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove DeprecatedPtr
+ https://bugs.webkit.org/show_bug.cgi?id=58718
+
+ Remove the class an all functions that still exist to support it.
+
+ * heap/MarkStack.h:
+ (JSC::MarkStack::append):
+ * runtime/JSValue.h:
+ * runtime/WriteBarrier.h:
+
+2011-04-19 Jungshik Shin <jshin@chromium.org>
+
+ Reviewed by David Levin
+
+ Add U+FEFF (Zero width no-break space) to CharacterNames.h.
+ It's added to the list of characters to treat as zero-width
+ in WebCore.
+
+ https://bugs.webkit.org/show_bug.cgi?id=48860
+
+ * wtf/unicode/CharacterNames.h:
+
+2011-04-19 Csaba Osztrogonác <ossy@webkit.org>
+
+ [Qt] REGRESSION(84176): http/tests/xmlhttprequest/event-listener-gc.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=58871
+
+ Unreviewed, rolling out r84176, r84178, r84186, r84212 and r84231.
+ http://trac.webkit.org/changeset/84176 (original patch)
+ http://trac.webkit.org/changeset/84178 (original patch - part 2)
+ http://trac.webkit.org/changeset/84186 (build fix)
+ http://trac.webkit.org/changeset/84212
+ http://trac.webkit.org/changeset/84231 (skip failing test)
+
+ original bugs:
+ - https://bugs.webkit.org/show_bug.cgi?id=58718
+ - https://bugs.webkit.org/show_bug.cgi?id=58853
+
+ * heap/MarkStack.h:
+ (JSC::MarkStack::deprecatedAppendValues):
+ (JSC::MarkStack::append):
+ (JSC::MarkStack::deprecatedAppend):
+ * runtime/JSValue.h:
+ * runtime/WriteBarrier.h:
+ (JSC::DeprecatedPtr::DeprecatedPtr):
+ (JSC::DeprecatedPtr::get):
+ (JSC::DeprecatedPtr::operator*):
+ (JSC::DeprecatedPtr::operator->):
+ (JSC::DeprecatedPtr::slot):
+ (JSC::DeprecatedPtr::operator UnspecifiedBoolType*):
+ (JSC::DeprecatedPtr::operator!):
+ (JSC::operator==):
+
+2011-04-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove unneeded deprecated methods from MarkStack
+ https://bugs.webkit.org/show_bug.cgi?id=58853
+
+ Remove deprecated methods
+
+ * heap/MarkStack.h:
+
+2011-04-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Off by one initialising repeat callframe
+ https://bugs.webkit.org/show_bug.cgi?id=58838
+ <rdar://problem/8756810>
+
+ If the end of a callframe made for a repeat call landed on
+ a page boundary the following page may not have been committed
+ which means that the off by one could lead to a crash. However
+ it could only happen in this case and only on windows which is
+ why it was so hard to repro. Alas given the steps needed to
+ reproduce are such that it's not really possible to make a
+ testcase.
+
+ This fix makes the code a little less squirrely by not trying
+ to avoid the unnecessary initialisation of |this|.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::prepareForRepeatCall):
+
+2011-04-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 58829 - DFG JIT - Optimize add/sub immediate, multiply.
+
+ Add code generation for add/subtract instruction with immediate operands
+ (where a child is a constant), and don't bail to non-speculative if an
+ integer multiple results in a +0 result (only if it should be generating -0).
+
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::isDoubleConstantWithInt32Value):
+
+2011-04-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 58817 - DFG JIT - if speculative compilation fails, throw away code.
+
+ If we detect a logical conflict, throw away generated code,
+ and only compile through the NonSpeculativeJIT.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::rewindToLabel):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::rewindToOffset):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branchAdd32):
+ (JSC::MacroAssemblerX86Common::branchSub32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::rewindToLabel):
+ (JSC::X86Assembler::X86InstructionFormatter::rewindToLabel):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::linkSpeculationChecks):
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGNode.h:
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculationCheckIndexIterator::SpeculationCheckIndexIterator):
+
+2011-04-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove DeprecatedPtr
+ https://bugs.webkit.org/show_bug.cgi?id=58718
+
+ As simple as it sounds.
+
+ * runtime/JSValue.h:
+ * runtime/WriteBarrier.h:
+
+2011-04-17 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ JSC no longer builds with Clang due to -Woverloaded-virtual warning
+ https://bugs.webkit.org/show_bug.cgi?id=58760
+
+ Rename Structure's specificValue overload of put to putSpecificValue to avoid
+ Clang's warning for overloading a virtual function.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::putSpecificValue):
+ * runtime/Structure.h:
+
+2011-04-17 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Remove WTF_PLATFORM_SGL
+ https://bugs.webkit.org/show_bug.cgi?id=58743
+
+ WTF_PLATFORM_SGL and PLATFORM(SGL) are not used in the code anywhere.
+
+ * wtf/Platform.h:
+
+2011-04-17 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Rename PLATFORM(CA) to USE(CA)
+ https://bugs.webkit.org/show_bug.cgi?id=58742
+
+ * wtf/Platform.h:
+
+2011-04-17 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Rename PLATFORM(CG) to USE(CG)
+ https://bugs.webkit.org/show_bug.cgi?id=58729
+
+ * wtf/Platform.h:
+
+2011-04-16 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Rename PLATFORM(CAIRO) to USE(CAIRO)
+ https://bugs.webkit.org/show_bug.cgi?id=55192
+
+ * wtf/Platform.h:
+ * wtf/gobject/GTypedefs.h:
+
+2011-04-15 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r84067.
+ http://trac.webkit.org/changeset/84067
+ https://bugs.webkit.org/show_bug.cgi?id=58724
+
+ qt build are failing. (Requested by loislo2 on #webkit).
+
+ * heap/MarkStack.h:
+ (JSC::MarkStack::append):
+ * runtime/JSValue.h:
+ * runtime/WriteBarrier.h:
+ (JSC::DeprecatedPtr::DeprecatedPtr):
+ (JSC::DeprecatedPtr::get):
+ (JSC::DeprecatedPtr::operator*):
+ (JSC::DeprecatedPtr::operator->):
+ (JSC::DeprecatedPtr::slot):
+ (JSC::DeprecatedPtr::operator UnspecifiedBoolType*):
+ (JSC::DeprecatedPtr::operator!):
+ (JSC::operator==):
+
+2011-04-15 Shishir Agrawal <shishir@chromium.org>
+
+ Reviewed by James Robinson.
+
+ Add a flag to guard Page Visibility API changes.
+ https://bugs.webkit.org/show_bug.cgi?id=58464
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-15 Gavin Barraclough <barraclough@apple.com>
+
+ Errrk! - build fix from !x86-64.
+
+ * dfg/DFGNode.h:
+
+2011-04-15 David Levin <levin@chromium.org>
+
+ Revert of r83974.
+
+ JavaScriptCore shouldn't depend on ../ThirdParty/gtest/xcode/gtest.xcodeproj
+ https://bugs.webkit.org/show_bug.cgi?id=58716
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/tests/RunAllWtfTests.cpp: Removed.
+ * wtf/tests/StringTests.cpp: Removed.
+
+2011-04-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove DeprecatedPtr
+ https://bugs.webkit.org/show_bug.cgi?id=58718
+
+ As simple as it sounds.
+
+ * heap/MarkStack.h:
+ (JSC::MarkStack::append):
+ * runtime/JSValue.h:
+ * runtime/WriteBarrier.h:
+
+2011-04-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add a simple tool to gather statistics on whether functions
+ are completed through the new or old JIT.
+
+ * dfg/DFGNode.h:
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+
+2011-04-15 Oliver Hunt <oliver@apple.com>
+
+ GC allocate Structure
+ https://bugs.webkit.org/show_bug.cgi?id=58483
+
+ Rolling r83894 r83827 r83810 r83809 r83808 back in with
+ a workaround for the gcc bug seen by the gtk bots
+
+ * 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/JSContextRef.cpp:
+ * JavaScriptCore.JSVALUE32_64only.exp:
+ * JavaScriptCore.JSVALUE64only.exp:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::markStructures):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::MethodCallLinkInfo::setSeen):
+ (JSC::GlobalResolveInfo::GlobalResolveInfo):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ (JSC::PolymorphicAccessStructureList::markAggregate):
+ (JSC::Instruction::Instruction):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ (JSC::StructureStubInfo::markAggregate):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdSelf):
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ (JSC::StructureStubInfo::initPutByIdReplace):
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * heap/Handle.h:
+ * heap/MarkStack.cpp:
+ (JSC::MarkStack::markChildren):
+ (JSC::MarkStack::drain):
+ * heap/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::sweep):
+ * heap/Strong.h:
+ (JSC::Strong::Strong):
+ (JSC::Strong::set):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::uncachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::uncacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchMethodCallProto):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchMethodCallProto):
+ (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/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::storePtrWithWriteBarrier):
+ * jsc.cpp:
+ (cleanupGlobalData):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ (JSC::Arguments::Arguments):
+ (JSC::JSActivation::copyRegisters):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayConstructor.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ (JSC::arrayProtoFuncSplice):
+ * runtime/ArrayPrototype.h:
+ (JSC::ArrayPrototype::createStructure):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanObject.cpp:
+ (JSC::BooleanObject::BooleanObject):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * 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:
+ (JSC::DateInstance::createStructure):
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/Error.cpp:
+ (JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ (JSC::ErrorInstance::create):
+ * runtime/ErrorInstance.h:
+ (JSC::ErrorInstance::createStructure):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ErrorPrototype.h:
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::InterruptedExecutionError::InterruptedExecutionError):
+ (JSC::TerminatedExecutionError::TerminatedExecutionError):
+ * runtime/Executable.cpp:
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::createStructure):
+ (JSC::NativeExecutable::createStructure):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::EvalExecutable::createStructure):
+ (JSC::ProgramExecutable::createStructure):
+ (JSC::FunctionExecutable::createStructure):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionConstructor.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ (JSC::GetterSetter::createStructure):
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::createStructure):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * 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/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSCell.cpp:
+ (JSC::isZombie):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell::JSCell):
+ (JSC::JSCell::JSCell::addressOfStructure):
+ (JSC::JSCell::JSCell::structure):
+ (JSC::JSCell::JSCell::markChildren):
+ (JSC::JSCell::JSValue::isZombie):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs):
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::clearBuiltinStructures):
+ (JSC::JSGlobalData::createLeaked):
+ * runtime/JSGlobalData.h:
+ (JSC::allocateGlobalHandle):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::markChildren):
+ (JSC::JSGlobalObject::copyGlobalsFrom):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ (JSC::JSGlobalObject::createStructure):
+ (JSC::Structure::prototypeChain):
+ (JSC::Structure::isValid):
+ (JSC::constructEmptyArray):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::JSNotAnObject):
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSONObject.cpp:
+ (JSC::JSONObject::JSONObject):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::seal):
+ (JSC::JSObject::freeze):
+ (JSC::JSObject::preventExtensions):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::createInheritorID):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ (JSC::JSObject::JSObject):
+ (JSC::JSNonFinalObject::createStructure):
+ (JSC::JSNonFinalObject::JSNonFinalObject):
+ (JSC::JSFinalObject::create):
+ (JSC::JSFinalObject::createStructure):
+ (JSC::JSFinalObject::JSFinalObject):
+ (JSC::constructEmptyObject):
+ (JSC::createEmptyObjectStructure):
+ (JSC::JSObject::~JSObject):
+ (JSC::JSObject::setPrototype):
+ (JSC::JSObject::setStructure):
+ (JSC::JSObject::inheritorID):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::transitionTo):
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSObjectWithGlobalObject.cpp:
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSObjectWithGlobalObject.h:
+ (JSC::JSObjectWithGlobalObject::createStructure):
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::create):
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::createStructure):
+ (JSC::JSPropertyNameIterator::setCachedStructure):
+ (JSC::Structure::setEnumerationCache):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::createStructure):
+ * runtime/JSType.h:
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::TypeInfo):
+ * runtime/JSValue.h:
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ (JSC::JSVariableObject::JSVariableObject):
+ (JSC::JSVariableObject::copyRegisterArray):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/JSZombie.cpp:
+ * runtime/JSZombie.h:
+ (JSC::JSZombie::JSZombie):
+ (JSC::JSZombie::createStructure):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ (JSC::NativeErrorConstructor::markChildren):
+ (JSC::constructWithNativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ (JSC::NativeErrorConstructor::createStructure):
+ * 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:
+ (JSC::NumberObject::createStructure):
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/NumberPrototype.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/ObjectConstructor.h:
+ (JSC::ObjectConstructor::createStructure):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyTable::PropertyTable):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ (JSC::RegExpMatchesArray::RegExpMatchesArray):
+ * 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/ScopeChain.h:
+ (JSC::ScopeChainNode::ScopeChainNode):
+ (JSC::ScopeChainNode::createStructure):
+ * runtime/StrictEvalActivation.cpp:
+ (JSC::StrictEvalActivation::StrictEvalActivation):
+ * 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::StringObjectThatMasqueradesAsUndefined):
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/StringPrototype.h:
+ (JSC::StringPrototype::createStructure):
+ * runtime/Structure.cpp:
+ (JSC::StructureTransitionTable::remove):
+ (JSC::StructureTransitionTable::add):
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::despecifyFunctionTransition):
+ (JSC::Structure::getterSetterTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::toCacheableDictionaryTransition):
+ (JSC::Structure::toUncacheableDictionaryTransition):
+ (JSC::Structure::sealTransition):
+ (JSC::Structure::freezeTransition):
+ (JSC::Structure::preventExtensionsTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::put):
+ (JSC::Structure::markChildren):
+ * runtime/Structure.h:
+ (JSC::Structure::create):
+ (JSC::Structure::setPrototypeWithoutTransition):
+ (JSC::Structure::createStructure):
+ (JSC::JSCell::createDummyStructure):
+ (JSC::StructureTransitionTable::keyForWeakGCMapFinalizer):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain):
+ (JSC::StructureChain::markChildren):
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::create):
+ (JSC::StructureChain::head):
+ (JSC::StructureChain::createStructure):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::WeakGCMapFinalizerCallback::finalizerContextFor):
+ (JSC::StructureTransitionTable::WeakGCMapFinalizerCallback::keyForFinalizer):
+ (JSC::StructureTransitionTable::~StructureTransitionTable):
+ (JSC::StructureTransitionTable::slot):
+ (JSC::StructureTransitionTable::setMap):
+ (JSC::StructureTransitionTable::singleTransition):
+ (JSC::StructureTransitionTable::clearSingleTransition):
+ (JSC::StructureTransitionTable::setSingleTransition):
+ * runtime/WeakGCMap.h:
+ (JSC::DefaultWeakGCMapFinalizerCallback::finalizerContextFor):
+ (JSC::DefaultWeakGCMapFinalizerCallback::keyForFinalizer):
+ (JSC::WeakGCMap::contains):
+ (JSC::WeakGCMap::find):
+ (JSC::WeakGCMap::remove):
+ (JSC::WeakGCMap::add):
+ (JSC::WeakGCMap::set):
+ (JSC::WeakGCMap::finalize):
+ * runtime/WriteBarrier.h:
+ (JSC::writeBarrier):
+ (JSC::WriteBarrierBase::set):
+ (JSC::WriteBarrierBase::operator*):
+ (JSC::WriteBarrierBase::operator->):
+ (JSC::WriteBarrierBase::setWithoutWriteBarrier):
+
+2011-04-15 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Gavin Barraclough.
+
+ Correctly prefix symbols. Since gcc 4.5.0, Windows x64 symbols
+ are not prefixed by underscore anymore. This is consistent with
+ what MSVC does.
+ https://bugs.webkit.org/show_bug.cgi?id=58573
+
+ * jit/JITStubs.cpp:
+
+2011-04-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 58705 - DFG JIT Add support for flow control (branch, jump).
+
+ Add support for control flow by breaking the CodeBlock up into multiple
+ basic blocks, generating code for each basic block in turn through the
+ speculative JIT & then the non-speculative JIT.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::setTemporary):
+ (JSC::DFG::ByteCodeParser::addToGraph):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::BasicBlock::BasicBlock):
+ (JSC::DFG::BasicBlock::getBytecodeOffset):
+ (JSC::DFG::Graph::blockIndexForBytecodeOffset):
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::JITCodeGenerator):
+ (JSC::DFG::JITCodeGenerator::addBranch):
+ (JSC::DFG::JITCodeGenerator::linkBranches):
+ (JSC::DFG::JITCodeGenerator::BranchRecord::BranchRecord):
+ * dfg/DFGNode.h:
+ (JSC::DFG::Node::Node):
+ (JSC::DFG::Node::isJump):
+ (JSC::DFG::Node::isBranch):
+ (JSC::DFG::Node::takenBytecodeOffset):
+ (JSC::DFG::Node::notTakenBytecodeOffset):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGNonSpeculativeJIT.h:
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+
+2011-04-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 58701 - DFG JIT - add GetLocal/SetLocal nodes
+
+ Use these for both access to arguments & local variables, adds ability
+ to set locals, such that values will persist between basic blocks.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::ByteCodeParser):
+ (JSC::DFG::ByteCodeParser::get):
+ (JSC::DFG::ByteCodeParser::set):
+ (JSC::DFG::ByteCodeParser::getVariable):
+ (JSC::DFG::ByteCodeParser::setVariable):
+ (JSC::DFG::ByteCodeParser::getArgument):
+ (JSC::DFG::ByteCodeParser::setArgument):
+ (JSC::DFG::ByteCodeParser::getThis):
+ (JSC::DFG::ByteCodeParser::setThis):
+ (JSC::DFG::ByteCodeParser::VariableRecord::VariableRecord):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ (JSC::DFG::Graph::derefChildren):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::ref):
+ (JSC::DFG::Graph::deref):
+ * dfg/DFGNode.h:
+ (JSC::DFG::Node::hasLocal):
+ (JSC::DFG::Node::local):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+
+2011-04-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 58696 - DFG JIT split handling of vars/temporaries
+
+ Presently all callee registers are treated as having single block scope,
+ since the DFG JIT can only compile single block functions. In order to
+ expand the JIT to support control flow we will need to change to retaining
+ locals (but not temporaries) across basic block boundaries.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::ByteCodeParser):
+ (JSC::DFG::ByteCodeParser::get):
+ (JSC::DFG::ByteCodeParser::set):
+ (JSC::DFG::ByteCodeParser::getVariable):
+ (JSC::DFG::ByteCodeParser::setVariable):
+ (JSC::DFG::ByteCodeParser::getTemporary):
+ (JSC::DFG::ByteCodeParser::setTemporary):
+ (JSC::DFG::ByteCodeParser::getArgument):
+ (JSC::DFG::ByteCodeParser::getInt32Constant):
+ (JSC::DFG::ByteCodeParser::getDoubleConstant):
+ (JSC::DFG::ByteCodeParser::getJSConstant):
+ (JSC::DFG::ByteCodeParser::constantUndefined):
+ (JSC::DFG::ByteCodeParser::constantNull):
+ (JSC::DFG::ByteCodeParser::one):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ (JSC::DFG::ByteCodeParser::parse):
+ (JSC::DFG::parse):
+ * dfg/DFGNode.h:
+ * dfg/DFGScoreBoard.h:
+ (JSC::DFG::ScoreBoard::ScoreBoard):
+ (JSC::DFG::ScoreBoard::~ScoreBoard):
+ (JSC::DFG::ScoreBoard::allocate):
+ (JSC::DFG::ScoreBoard::use):
+
+2011-04-15 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ globalObject moved to JSObjectWithGlobalObject.cpp inhibits inlining
+ https://bugs.webkit.org/show_bug.cgi?id=58677
+
+ Moved JSObjectWithGlobalObject::globalObject() to
+ runtime/JSObjectWithGlobalObject.h to allow the compiler to inline
+ it for a performance benefit. An equivalent instance had been in
+ a header file before r60057.
+
+ * JavaScriptCore.exp:
+ * runtime/JSObjectWithGlobalObject.cpp:
+ * runtime/JSObjectWithGlobalObject.h:
+ (JSC::JSObjectWithGlobalObject::globalObject):
+
+2011-04-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make JSNodeFilterCondition handle its lifetime correctly
+ https://bugs.webkit.org/show_bug.cgi?id=58622
+
+ Add export
+
+ * JavaScriptCore.exp:
+
+2011-04-14 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ WebKit2: Password field input does not switch to ASCII-compatible source
+ https://bugs.webkit.org/show_bug.cgi?id=58583
+ <rdar://problem/9059651>
+
+ * wtf/Platform.h: Removed WTF_USE_CARBON_SECURE_INPUT_MODE. It's now only used by Chromium,
+ and shouldn't be enabled on any other platforms, so there is no reason to make it
+ configurable via Platform.h.
+
+2011-04-15 Dmitry Lomov <dslomov@google.com>
+
+ Reviewed by David Levin.
+
+ Add a sample test case for GTest framework
+ https://bugs.webkit.org/show_bug.cgi?id=58509
+
+ Add an example of GTest testcase, complete with a runner, to JavaScriptCore.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/tests/RunAllWtfTests.cpp: Added.
+ (main):
+ * wtf/tests/StringTests.cpp: Added.
+
+2011-04-15 Anna Cavender <annacc@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Renaming TRACK feature define to VIDEO_TRACK
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-14 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Geoffrey Garen.
+
+ Hide DFG_JIT_RESTRICTIONS behind ARITHMETIC_OP() macro, and rename
+ m_regressionGuard to m_parseFailed, such that it can be reused for
+ other failure cases.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::ByteCodeParser):
+ (JSC::DFG::ByteCodeParser::parse):
+
+2011-04-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Bug 58620 - DFG JIT - loading of arguments should not be lazy
+
+ This optimization is overly simplistic. It only works because we never
+ write out definitions to arguments (since we currently only compile
+ single block functions). Revert this for now, we may want to reintroduce
+ something like this again in the future, but it will need to be aware
+ how to schedule definitions to arguments versus lazy loads that have not
+ yet been performed.
+
+ * dfg/DFGGenerationInfo.h:
+ (JSC::DFG::GenerationInfo::needsSpill):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ * dfg/DFGGraph.h:
+ * dfg/DFGJITCodeGenerator.cpp:
+ (JSC::DFG::JITCodeGenerator::fillInteger):
+ (JSC::DFG::JITCodeGenerator::fillDouble):
+ (JSC::DFG::JITCodeGenerator::fillJSValue):
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::initConstantInfo):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::fillNumericToDouble):
+ (JSC::DFG::JITCompiler::fillInt32ToInteger):
+ (JSC::DFG::JITCompiler::fillToJS):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::isKnownInteger):
+ (JSC::DFG::NonSpeculativeJIT::isKnownNumeric):
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
+ (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
+ (JSC::DFG::SpeculativeJIT::compile):
+
+2011-04-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Bug 58600 - DFG JIT bugs in ValueToInt, PutByVal
+
+ The bug in PutByVal is that an operand is in JSValueOperand - when this
+ locks an integer into a register it will always retag the value without
+ checking if the register is already locked. This is a problem where the
+ value being stored by a PutByVal is the same as the subscript.
+ The subscript is locked into a register first, as a strict integer.
+ Locking the value results in the subscript being modified.
+
+ The bug in ValueToInt related to the function of sillentFillAllRegisters.
+ The problem is that this method will restore all register values from
+ prior to the call, overwriting the result of the call out. Allow a
+ register to be passed to specifically be excluded from being preserved.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::debugOffset):
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::debugOffset):
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::debugOffset):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::debugOffset):
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::debugAddress):
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::debugOffset):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::orPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::debugOffset):
+ (JSC::X86Assembler::X86InstructionFormatter::debugOffset):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGGenerationInfo.h:
+ * dfg/DFGJITCodeGenerator.cpp:
+ (JSC::DFG::JITCodeGenerator::fillJSValue):
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::isConstant):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::isConstant):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::valueToNumber):
+ (JSC::DFG::NonSpeculativeJIT::valueToInt32):
+ (JSC::DFG::NonSpeculativeJIT::numberToInt32):
+ (JSC::DFG::NonSpeculativeJIT::isKnownInteger):
+ (JSC::DFG::NonSpeculativeJIT::isKnownNumeric):
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGNonSpeculativeJIT.h:
+ (JSC::DFG::NonSpeculativeJIT::silentSpillGPR):
+ (JSC::DFG::NonSpeculativeJIT::silentSpillFPR):
+ (JSC::DFG::NonSpeculativeJIT::silentFillGPR):
+ (JSC::DFG::NonSpeculativeJIT::silentFillFPR):
+ (JSC::DFG::NonSpeculativeJIT::silentSpillAllRegisters):
+ (JSC::DFG::NonSpeculativeJIT::silentFillAllRegisters):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+
+2011-04-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Drain the mark stack while marking weak handles, not after.
+ https://bugs.webkit.org/show_bug.cgi?id=58574
+
+ Otherwise, items that would have caused more weak handle marking are
+ processed after all weak handle marking has finished, and referenced
+ weak handles get recycled.
+
+ * heap/HandleHeap.cpp:
+ (JSC::HandleHeap::markWeakHandles): Removed looping from here, since we
+ want Heap::markRoots to be responsible for draining the mark stack.
+
+ * heap/Heap.cpp:
+ (JSC::Heap::markRoots): Moved looping to here, as explained above.
+
+ For efficiency's sake, drain the mark stack before starting to mark weak
+ handles. Otherwise, items drained while marking weak handles may force
+ an extra trip through the weak handle list.
+
+ For correctness's sake, drain the mark stack each time through the weak
+ handle list. Otherwise, opaque roots that would make weak handles reachable
+ are not discovered until after weak handle marking is over.
+
+2011-04-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make protected object list in caches window reflect reality
+ https://bugs.webkit.org/show_bug.cgi?id=58565
+
+ Make sure the heap includes objects protected by Strong handles
+ in its list of protected objects.
+
+ * heap/HandleHeap.h:
+ * heap/Heap.cpp:
+ (JSC::HandleHeap::protectedObjectTypeCounts):
+
+2011-04-14 Satish Sampath <satish@chromium.org>
+
+ Reviewed by Anders Carlsson.
+
+ Don't emit RegExp tables for chromium where they are not used
+ https://bugs.webkit.org/show_bug.cgi?id=58544
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * create_regex_tables: Added the "--notables" command line argument.
+
+2011-04-13 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix ASSERTs seen on Windows bots.
+
+ * wtf/HashTable.h:
+ (WTF::hashTableSwap): Force MSVC to use the right version of swap.
+
+2011-04-13 Ryuan Choi <ryuan.choi@samsung.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [CMAKE] Separate DerivedSources.
+ https://bugs.webkit.org/show_bug.cgi?id=58427
+
+ * CMakeLists.txt: Change DERIVED_SOURCES_DIR to DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
+
+2011-04-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Switched DOM wrappers to use HashMap of Weak<T> instead of WeakGCMap<T>
+ https://bugs.webkit.org/show_bug.cgi?id=58482
+
+ This will allow wrappers to make individual decisions about their lifetimes.
+
+ * heap/HandleHeap.h:
+ (JSC::HandleHeap::copyWeak): New function for copying a weak handle.
+ It's wasn't previously possible to perform this operation using HandleHeap
+ API because the HandleHeap doesn't expose its underlying Node structure.
+
+ * heap/Local.h:
+ (JSC::::set):
+ * heap/Strong.h:
+ (JSC::Strong::set): Added ASSERTs to verify that dead objects are not
+ resurrected by placement into handles.
+
+ (JSC::swap): Added a swap helper, so use of Strong<T> inside a hash table
+ is efficient.
+
+ * heap/Weak.h:
+ (JSC::Weak::Weak): Fixed a bug where copying a weak pointer would not
+ copy its weak callback and context.
+
+ (JSC::Weak::operator=): Added an assignment operator, since the default
+ C++ assignment operator did the wrong thing.
+
+ (JSC::Weak::set): Added ASSERTs to verify that dead objects are not
+ resurrected by placement into handles.
+
+ (JSC::swap): Added a swap helper, so use of Strong<T> inside a hash table
+ is efficient, and can be done without copying, which is illegal during
+ the handle finalization phase.
+
+2011-04-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make PropertyMapEntry use a WriteBarrier for specificValue
+ https://bugs.webkit.org/show_bug.cgi?id=58407
+
+ Make PropertyMapEntry use a WriteBarrier for specificValue, and then
+ propagate the required JSGlobalData through all the methods it ends
+ up being needed.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype):
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectSetPrototype):
+ * JavaScriptCore.exp:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * interpreter/Interpreter.cpp:
+ (JSC::appendSourceToError):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::name):
+ (JSC::InternalFunction::displayName):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::getOwnPropertySlot):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::name):
+ (JSC::JSFunction::displayName):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::putWithAttributes):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ * runtime/JSGlobalObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::put):
+ (JSC::JSObject::deleteProperty):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::lookupGetter):
+ (JSC::JSObject::lookupSetter):
+ (JSC::JSObject::getPropertySpecificValue):
+ (JSC::JSObject::getOwnPropertyNames):
+ (JSC::JSObject::seal):
+ (JSC::JSObject::freeze):
+ (JSC::JSObject::preventExtensions):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::getOwnPropertyDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirect):
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::isSealed):
+ (JSC::JSObject::isFrozen):
+ (JSC::JSObject::setPrototypeWithCycleCheck):
+ (JSC::JSObject::setPrototype):
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorCreate):
+ (JSC::objectConstructorSeal):
+ (JSC::objectConstructorFreeze):
+ (JSC::objectConstructorPreventExtensions):
+ (JSC::objectConstructorIsSealed):
+ (JSC::objectConstructorIsFrozen):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyMapEntry::PropertyMapEntry):
+ (JSC::PropertyTable::PropertyTable):
+ (JSC::PropertyTable::copy):
+ * runtime/Structure.cpp:
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::despecifyFunctionTransition):
+ (JSC::Structure::getterSetterTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::toCacheableDictionaryTransition):
+ (JSC::Structure::toUncacheableDictionaryTransition):
+ (JSC::Structure::sealTransition):
+ (JSC::Structure::freezeTransition):
+ (JSC::Structure::preventExtensionsTransition):
+ (JSC::Structure::isSealed):
+ (JSC::Structure::isFrozen):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::get):
+ (JSC::Structure::despecifyFunction):
+ (JSC::Structure::despecifyAllFunctions):
+ (JSC::Structure::put):
+ (JSC::Structure::getPropertyNames):
+ * runtime/Structure.h:
+ (JSC::Structure::get):
+ (JSC::Structure::materializePropertyMapIfNecessary):
+
+2011-04-13 Paul Knight <pknight@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ BACKTRACE() macro should check for Debug configuration in macro, not WTFReportBacktrace definition
+ https://bugs.webkit.org/show_bug.cgi?id=58405
+
+ The BACKTRACE() macro requires JavaScriptCore be built with a Debug
+ configuration in order for it to be enabled. Move the NDEBUG check to
+ the header so it will be enabled when the calling framework or
+ application is built with a Debug configuration, similar to how
+ ASSERT() and friends work.
+
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+
+2011-04-12 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=58131
+
+ Provide a workaround for an obscure Studio 12 compiler bug, which
+ couldn't call src->~T() on a const T *src.
+
+ * wtf/Vector.h:
+
+2011-04-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=58395
+ Exceptions thrown from property getters called from Array prototype functions can be missed
+
+ This is caught by an ASSERT in the top of Interpreter::executeCall.
+ Check for exceptions after accessing properties that could be getters.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ - Add exception checks.
+
+2011-04-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make API callback objects use weak handles to run their finalizers
+ https://bugs.webkit.org/show_bug.cgi?id=58389
+
+ Make the API object's private data struct act as a finalizer for
+ an api object if the callback object has a API defined finalizer.
+
+ * API/JSCallbackObject.cpp:
+ (JSC::JSCallbackObjectData::finalize):
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::init):
+ * heap/Handle.h:
+
+2011-04-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Cleaned up hash traits, and added hash traits for handles
+ https://bugs.webkit.org/show_bug.cgi?id=58381
+
+ * heap/Handle.h:
+ (JSC::HandleBase::swap):
+ (JSC::Handle::Handle):
+ (JSC::Handle::swap): Implemented swap, so we can rehash efficiently, and
+ without creating new handles (which is not allowed during handle finalization).
+
+ * heap/Strong.h:
+ (JSC::Strong::swap): Use new SimpleClassHashTraits to avoid duplication.
+
+ * heap/Weak.h:
+ (JSC::Weak::isHashTableDeletedValue):
+ (JSC::Weak::Weak):
+ (JSC::Weak::swap):
+ (JSC::Weak::hashTableDeletedValue): Ditto.
+
+ * wtf/HashTraits.h:
+ (WTF::SimpleClassHashTraits::constructDeletedValue):
+ (WTF::SimpleClassHashTraits::isDeletedValue): Added SimpleClassHashTraits,
+ which are analogous to SimpleClassVectorTraits, since they are used in a
+ bunch of places.
+
+ * wtf/RetainPtr.h: Use new SimpleClassHashTraits to avoid duplication.
+
+ * wtf/text/StringHash.h: Use new SimpleClassHashTraits to avoid duplication.
+
+2011-04-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Cleaned up some Vector traits, and added missing Vector traits for handles
+ https://bugs.webkit.org/show_bug.cgi?id=58372
+
+ * heap/Local.h: Inherit from SimpleClassVectorTraits to avoid duplication.
+
+ * heap/Strong.h: Ditto.
+
+ * heap/Weak.h: Ditto.
+
+ * parser/JSParser.cpp: Fixed a traits error. No test case because this
+ particular trait is not currently exercised by the parser.
+
+ * runtime/UString.h: No need to override canInitializeWithMemset, since
+ our base class sets it to true.
+
+ * wtf/VectorTraits.h: Inherit from VectorTraitsBase to avoid duplication.
+
+ * wtf/text/WTFString.h: No need to override canInitializeWithMemset, since
+ our base class sets it to true.
+
+2011-04-12 Thouraya ANDOLSI <thouraya.andolsi@st.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Enable JIT build for SH4 platforms.
+ https://bugs.webkit.org/show_bug.cgi?id=58317
+ enable JIT build for QT backend for SH4 platforms.
+
+ * JavaScriptCore.pro:
+ * wtf/Platform.h:
+
+2011-04-11 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=58289
+
+ Fix compilation on Solaris/Studio 12 C++ in wtf/FastMalloc.cpp,
+ WTF::TCMalloc_PageHeap::runScavengerThread(void*) expected to return a value.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::runScavengerThread):
+
+2011-04-11 Mark Rowe <mrowe@apple.com>
+
+ Fix the build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Headers used outside of JavaScriptCore need to be marked as private.
+
+2011-04-11 Anna Cavender <annacc@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Setup ENABLE(TRACK) feature define
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-11 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix a few builds.
+
+ Updated a few more build configurations for file moves.
+
+ * CMakeListsWinCE.txt:
+
+2011-04-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 58263 - Use EncodedValueDescriptor on both JSVALUE32_64, JSVALUE64
+
+ The JSJITInterface already uses EncodedValueDescriptor to access the tag/payload
+ separately on JSVALUE64, even though EncodedValueDescriptor is not used in
+ JSVALUE64's implementation of JSValue. Remove the separate definition for m_ptr
+ on X86_64. Using the union allows us to remove a layer of makeImmediate()/
+ immedaiteValue() methods.
+
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitTagAsBoolImmediate):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_not):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emitSlow_op_not):
+ * runtime/JSCell.h:
+ * runtime/JSValue.h:
+ * runtime/JSValueInlineMethods.h:
+ (JSC::JSValue::encode):
+ (JSC::JSValue::decode):
+ (JSC::JSValue::operator==):
+ (JSC::JSValue::operator!=):
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::operator bool):
+ (JSC::JSValue::asInt32):
+ (JSC::JSValue::isUndefinedOrNull):
+ (JSC::JSValue::isBoolean):
+ (JSC::JSValue::isCell):
+ (JSC::JSValue::isInt32):
+ (JSC::JSValue::asDouble):
+ (JSC::JSValue::isNumber):
+ (JSC::JSValue::asCell):
+
+2011-04-11 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix a few builds.
+
+ Updated a few more build configurations for file moves.
+
+ * CMakeListsEfl.txt:
+ * wscript:
+
+2011-04-11 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: Updated a file name.
+
+ * CMakeLists.txt:
+
+2011-04-11 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Moved remaining heap implementation files to the heap folder.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * heap/ConservativeRoots.cpp: Copied from runtime/ConservativeSet.cpp.
+ * heap/ConservativeRoots.h: Copied from runtime/ConservativeSet.h.
+ * heap/Handle.h:
+ * heap/Heap.cpp:
+ * heap/MachineStackMarker.cpp: Copied from runtime/MachineStackMarker.cpp.
+ * heap/MachineStackMarker.h: Copied from runtime/MachineStackMarker.h.
+ * heap/MarkStack.cpp: Copied from runtime/MarkStack.cpp.
+ * heap/MarkStack.h: Copied from runtime/MarkStack.h.
+ * heap/MarkStackPosix.cpp: Copied from runtime/MarkStackPosix.cpp.
+ * heap/MarkStackSymbian.cpp: Copied from runtime/MarkStackSymbian.cpp.
+ * heap/MarkStackWin.cpp: Copied from runtime/MarkStackWin.cpp.
+ * heap/MarkedBlock.cpp: Copied from runtime/MarkedBlock.cpp.
+ * heap/MarkedBlock.h: Copied from runtime/MarkedBlock.h.
+ * heap/MarkedSpace.cpp: Copied from runtime/MarkedSpace.cpp.
+ * heap/MarkedSpace.h: Copied from runtime/MarkedSpace.h.
+ * interpreter/RegisterFile.cpp:
+ * runtime/ConservativeSet.cpp: Removed.
+ * runtime/ConservativeSet.h: Removed.
+ * runtime/MachineStackMarker.cpp: Removed.
+ * runtime/MachineStackMarker.h: Removed.
+ * runtime/MarkStack.cpp: Removed.
+ * runtime/MarkStack.h: Removed.
+ * runtime/MarkStackPosix.cpp: Removed.
+ * runtime/MarkStackSymbian.cpp: Removed.
+ * runtime/MarkStackWin.cpp: Removed.
+ * runtime/MarkedBlock.cpp: Removed.
+ * runtime/MarkedBlock.h: Removed.
+ * runtime/MarkedSpace.cpp: Removed.
+ * runtime/MarkedSpace.h: Removed.
+
+2011-04-11 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-04-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 58198 - Clean up JSValue implementation for JSVALUE64
+
+ Remove JSNumberCell, JSImmediate, unify some methods between JSVALUE32_64/JSVALUE64
+
+ JSNumberCell.h largely just contained the constructors for JSValue on JSVALUE64,
+ which should not have been here. JSImmediate mostly contained uncalled methods,
+ along with the internal implementation of the JSValue constructors split unnecessarily
+ across a number of layers of function calls. These could largely be merged back
+ together. Many methods and constructors from JSVALUE32_64 and JSVALUE64 can by unified.
+
+ The .cpp files were empty.
+
+ Moving all these methods into JSValue.h seems to be a repro measurable regression, so
+ I have kept these methods in a separate JSValueInlineMethods.h. Adding the 64-bit tag
+ values as static const members of JSValue also measures as a repro regression, so I
+ have made these #defines.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ - Removed JSImmediate.h, JSNumberCell.h.
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoad):
+ - Removed class JSImmediate.
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ - Removed class JSImmediate.
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ - Removed class JSImmediate.
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ - Removed class JSImmediate.
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpIfJSCell):
+ (JSC::JIT::emitJumpIfNotJSCell):
+ (JSC::JIT::emitJumpIfImmediateInteger):
+ (JSC::JIT::emitJumpIfNotImmediateInteger):
+ (JSC::JIT::emitFastArithDeTagImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitTagAsBoolImmediate):
+ - Removed class JSImmediate.
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_not):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emitSlow_op_not):
+ - Removed class JSImmediate.
+ * jit/JSInterfaceJIT.h:
+ - Removed class JSImmediate.
+ * runtime/JSCell.h:
+ - Removed JSImmediate.h, JSNumberCell.h.
+ * runtime/JSImmediate.cpp: Removed.
+ * runtime/JSImmediate.h: Removed.
+ * runtime/JSNumberCell.cpp: Removed.
+ * runtime/JSNumberCell.h: Removed.
+ - Removed.
+ * runtime/JSObject.h:
+ - Removed JSImmediate.h, JSNumberCell.h.
+ * runtime/JSString.h:
+ - Removed JSImmediate.h, JSNumberCell.h.
+ * runtime/JSValue.h:
+ - Added tags for JSVALUE64, moved out some JSVALUE32_64 methods, unified with JSVALUE64.
+ * runtime/JSValueInlineMethods.h: Added.
+ (JSC::JSValue::toInt32):
+ (JSC::JSValue::toUInt32):
+ (JSC::JSValue::isUInt32):
+ (JSC::JSValue::asUInt32):
+ (JSC::JSValue::uncheckedGetNumber):
+ (JSC::JSValue::toJSNumber):
+ (JSC::jsNaN):
+ (JSC::JSValue::getNumber):
+ (JSC::JSValue::getBoolean):
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::encode):
+ (JSC::JSValue::decode):
+ (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::isDouble):
+ (JSC::JSValue::isTrue):
+ (JSC::JSValue::isFalse):
+ (JSC::JSValue::tag):
+ (JSC::JSValue::payload):
+ (JSC::JSValue::asInt32):
+ (JSC::JSValue::asDouble):
+ (JSC::JSValue::asCell):
+ (JSC::JSValue::isNumber):
+ (JSC::JSValue::isBoolean):
+ (JSC::JSValue::makeImmediate):
+ (JSC::JSValue::immediateValue):
+ (JSC::reinterpretDoubleToIntptr):
+ (JSC::reinterpretIntptrToDouble):
+ - Methods moved here from JSImmediate.h/JSNumberCell.h/JSValue.h.
+ * runtime/Operations.h:
+ - Removed JSImmediate.h, JSNumberCell.h.
+ * wtf/StdLibExtras.h:
+ - Export bitwise_cast.
+
+2011-04-11 Thouraya ANDOLSI <thouraya.andolsi@st.com>
+
+ Reviewed by Oliver Hunt.
+
+ SH4 JIT SUPPORT.
+ https://bugs.webkit.org/show_bug.cgi?id=44329
+
+ Add JIT remaining part for SH4 platforms.
+
+ * assembler/MacroAssemblerSH4.h:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ * jit/JITOpcodes32_64.cpp:
+ * jit/JITPropertyAccess32_64.cpp:
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ * jit/JSInterfaceJIT.h:
+
+2011-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber-stamped by Beth Dakin.
+
+ Moved Heap.h and Heap.cpp to the heap folder, because anything less
+ would be uncivilized.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * heap/Heap.cpp: Copied from JavaScriptCore/runtime/Heap.cpp.
+ * heap/Heap.h: Copied from JavaScriptCore/runtime/Heap.h.
+ * runtime/Heap.cpp: Removed.
+ * runtime/Heap.h: Removed.
+
+2011-04-10 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Remove duplicated code from AtomicString::fromUTF8()
+ https://bugs.webkit.org/show_bug.cgi?id=53711
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/text/AtomicString.cpp:
+ (WTF::AtomicString::fromUTF8Internal):
+ * wtf/text/AtomicString.h:
+ (WTF::AtomicString::fromUTF8):
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::calculateStringHashAndLengthFromUTF8):
+ * wtf/unicode/UTF8.h:
+
+2011-04-10 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed.
+
+ Fix build (at least on Lion) by adding some newish header files to
+ PrivateHeaders.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-04-09 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try recommitting some things svn left out of its last commit.
+
+ * heap/Handle.h:
+ (JSC::HandleBase::operator!):
+ (JSC::HandleBase::HandleBase):
+ (JSC::HandleBase::slot):
+ (JSC::HandleBase::setSlot):
+ (JSC::Handle::Handle):
+ * heap/HandleHeap.cpp:
+ (JSC::HandleHeap::markWeakHandles):
+ (JSC::HandleHeap::finalizeWeakHandles):
+ (JSC::HandleHeap::isValidWeakNode):
+ * heap/HandleHeap.h:
+ (JSC::HandleHeap::globalData):
+
+2011-04-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A few heap-related renames and file moves.
+
+ WeakGCPtr<T> => Weak<T>
+ Global<T> => Strong<T>
+ collector/ => heap/
+ collector/* => heap/*
+ runtime/WeakGCPtr.h => heap/Weak.h
+
+ (Eventually, even more files should move into the heap directory. Like
+ Heap.h and Heap.cpp, for example.)
+
+ * API/JSClassRef.h:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * GNUmakefile.list.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/SamplingTool.h:
+ * bytecompiler/BytecodeGenerator.h:
+ * collector: Removed.
+ * collector/handles: Removed.
+ * collector/handles/Global.h: Removed.
+ * collector/handles/Handle.h: Removed.
+ * collector/handles/HandleHeap.cpp: Removed.
+ * collector/handles/HandleHeap.h: Removed.
+ * collector/handles/HandleStack.cpp: Removed.
+ * collector/handles/HandleStack.h: Removed.
+ * collector/handles/Local.h: Removed.
+ * collector/handles/LocalScope.h: Removed.
+ * heap: Copied from collector.
+ * heap/Handle.h: Copied from collector/handles/Handle.h.
+ * heap/HandleHeap.cpp: Copied from collector/handles/HandleHeap.cpp.
+ * heap/HandleHeap.h: Copied from collector/handles/HandleHeap.h.
+ * heap/HandleStack.cpp: Copied from collector/handles/HandleStack.cpp.
+ * heap/HandleStack.h: Copied from collector/handles/HandleStack.h.
+ * heap/Local.h: Copied from collector/handles/Local.h.
+ * heap/LocalScope.h: Copied from collector/handles/LocalScope.h.
+ * heap/Strong.h: Copied from collector/handles/Global.h.
+ (JSC::Strong::Strong):
+ (JSC::Strong::~Strong):
+ (JSC::Strong::operator=):
+ * heap/Weak.h: Copied from runtime/WeakGCPtr.h.
+ (JSC::Weak::Weak):
+ (JSC::Weak::~Weak):
+ * heap/handles: Removed.
+ * interpreter/RegisterFile.h:
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITStubs.h:
+ * runtime/Structure.h:
+ * runtime/WeakGCPtr.h: Removed.
+
+2011-04-08 Alpha Lam <hclam@chromium.org>
+
+ Unreviewed, rolling out r83335.
+ http://trac.webkit.org/changeset/83335
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+ GTK and QT bots are broken
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-08 Gavin Barraclough <barraclough@apple.com>
+
+ Ooops, typo, build fix.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parse):
+
+2011-04-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 58154 - Add support for comparison operators to the DFG JIT.
+
+ Add support for <, <=, ==, ===, and also !. Add support for all corresponding
+ bytecode ops, including the not- and -null forms. Initially add functionally
+ correct support, we'll revisit the performance.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::ByteCodeParser):
+ (JSC::DFG::ByteCodeParser::constantNull):
+ (JSC::DFG::ByteCodeParser::parse):
+ - Add support for parsing of bytecode opcodes,
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::callOperation):
+ - Add new operation call types, return bool values.
+ * dfg/DFGNode.h:
+ - Add new node types.
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ - Add code generation for new nodes.
+ * dfg/DFGOperations.cpp:
+ (JSC::DFG::operationCompareLess):
+ (JSC::DFG::operationCompareLessEq):
+ (JSC::DFG::operationCompareEq):
+ (JSC::DFG::operationCompareStrictEq):
+ (JSC::DFG::dfgConvertJSValueToBoolean):
+ * dfg/DFGOperations.h:
+ - Add operation callbacks to implement new ops.
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ - Add code generation for new nodes.
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ - Switched to a simpler <0 check, rather than relying on an internal value in JSImmediate.
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ - Switched to a simpler <0 check, rather than relying on an internal value in JSImmediate.
+ * runtime/JSImmediate.h:
+ - Make tag values public, rather than relying on a friend - this matches JSVALUE32_64.
+
+2011-04-07 Anna Cavender <annacc@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Setup ENABLE(TRACK) feature define
+ https://bugs.webkit.org/show_bug.cgi?id=53556
+
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-07 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [WK2][Qt][GTK] Introduce common use flag for the shared UNIX domain socket IPC implementation
+ https://bugs.webkit.org/show_bug.cgi?id=58030
+
+ * wtf/Platform.h: Introduce USE(UNIX_DOMAIN_SOCKETS) for WebKit2.
+
+2011-04-08 Adam Roben <aroben@apple.com>
+
+ Clean build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd: Don't try to delete directories that
+ don't exist. Also switched from del /s to rmdir /s, which has the benefit of deleting the
+ directory itself in addition to the files it contains.
+
+2011-04-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Some Handle<T> cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=58109
+
+ * bytecode/SamplingTool.h: Sorted alphabetically because that's the
+ WebKit style. Added a Global.h #include that was previously missing
+ but harmless.
+
+ * collector/handles/Global.h:
+ (JSC::Global::Global): Added a null constructor. No need for a special
+ tag, and the tag is incompatible with some data structures.
+
+ (JSC::Global::isHashTableDeletedValue):
+ (JSC::Global::~Global):
+ (JSC::Global::set):
+ (JSC::Global::operator=):
+ (JSC::Global::clear):
+ (JSC::Global::hashTableDeletedValue): Reordered constructors to be near
+ each other.
+
+ (JSC::Global::setWithWriteBarrier): Renamed internalSet to
+ setWithWriteBarrier for clarity, and funneled more code into using set
+ and setWithWriteBarrier to reduce duplication.
+
+ * collector/handles/Handle.h:
+ (JSC::HandleBase::operator!):
+ (JSC::HandleBase::HandleBase): Removed isEmpty(), since we already have
+ boolean and ! operators.
+
+ (JSC::HandleBase::slot):
+ (JSC::HandleBase::setSlot):
+ (JSC::Handle::Handle): Added general support for null Handles. This was
+ previously outlawed by ASSERTs, but our code has grown to support and
+ rely on null Handles.
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::markWeakHandles):
+ (JSC::HandleHeap::finalizeWeakHandles):
+ (JSC::HandleHeap::isValidWeakNode): Migrated from isValidWeakHandle,
+ and beefed this up a bit.
+
+ * collector/handles/HandleHeap.h:
+ (JSC::HandleHeap::globalData): Added accessor, used by some new set functions.
+
+ * collector/handles/Local.h: Moved hash traits to the bottom of the file,
+ since this file is about the Local class, not the traits.
+
+ (JSC::::Local): Updated for removal of invalidate().
+
+ (JSC::::operator): Deployed "using" to avoid a lot of this->
+ template funny business.
+
+ (JSC::::setWithSlotCheck): Renamed from internalSet, more specific now.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile): Updated to use null constructor.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::hostFunctionStub):
+
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::Structure::setEnumerationCache):
+ * runtime/Structure.h: Removed clearEnumerationCache
+ because it was an unused holdover from when the enumeration cache was
+ not a handle.
+
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::set): Finish initializing our handle before putting it
+ in the table. This seemed more logical, and at one point was required
+ to avoid triggering an ASSERT.
+
+ * runtime/WeakGCPtr.h: Inherit from Handle instead of rolling our own
+ handle-like behavior, to avoid duplication.
+
+ (JSC::WeakGCPtr::WeakGCPtr):
+ (JSC::WeakGCPtr::~WeakGCPtr):
+ (JSC::WeakGCPtr::get):
+ (JSC::WeakGCPtr::clear):
+ (JSC::WeakGCPtr::set):
+ (JSC::WeakGCPtr::setWithWriteBarrier): Removed duplicate code and
+ standardized on Handle idioms.
+
+2011-04-07 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Martin Robinson.
+
+ Refactor Gtk build system to separate list of files
+ https://bugs.webkit.org/show_bug.cgi?id=58090
+
+ This is the first step towards generating part of the GTK build system
+ using GYP. In the first iteration, our plan is to just generate the
+ list of files. This patch is the first step, which is to separate out
+ the part of JavaScriptCore build system that we intend to generate from
+ the rest of the build system.
+
+ * GNUmakefile.am:
+ * GNUmakefile.list.am: Added.
+
+2011-04-07 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Mapping booleans the same way as integers
+ https://bugs.webkit.org/show_bug.cgi?id=56913
+
+ Instead of having a seperate tag field for booleans,
+ the logical values are stored in the payload field
+ (for JSValue32_64 representation).
+
+ 1.007x speedup on SunSpider.
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitStoreBool):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_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_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/JSInterfaceJIT.h:
+ * runtime/JSValue.h:
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::isTrue):
+ (JSC::JSValue::isFalse):
+ (JSC::JSValue::getBoolean):
+
+2011-04-07 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add stub support for generating Gtk build system from gyp
+ https://bugs.webkit.org/show_bug.cgi?id=58086
+
+ This does not produce a buildable JavaScriptCore, but it
+ does allow running gyp/configure --port=gtk and having
+ it generate a gtk.Makefile which we can use for testing
+ the rest of the plumbing.
+
+ * gyp/gtk.gyp: Added.
+
+2011-04-07 Andrew Scherkus <scherkus@chromium.org>
+
+ Revert ENABLE_TRACK patch due to compile failures.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-04-07 Adam Barth <abarth@webkit.org>
+
+ Fix whitespace in GNUmakefile.am.
+
+ * GNUmakefile.am:
+
+2011-04-07 Gavin Barraclough <barraclough@apple.com>
+
+ Fix a couple of typos in comments that Darin spotted.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_not):
+ * runtime/JSImmediate.h:
+
+2011-04-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+ Bug 58057 - Store boolean payload in low bit of JSImmediate
+
+ And remove some uncalled functions from JSImmediate.h
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitTagAsBoolImmediate):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_not):
+ * runtime/JSImmediate.h:
+ (JSC::JSImmediate::makeInt):
+ (JSC::JSImmediate::makeBool):
+ (JSC::JSImmediate::intValue):
+ (JSC::JSImmediate::boolValue):
+ (JSC::JSImmediate::asInt32):
+ (JSC::JSImmediate::toDouble):
+ (JSC::JSValue::asInt32):
+ (JSC::JSValue::isUInt32):
+ (JSC::JSValue::asUInt32):
+
+2011-04-07 Liang Qi <liang.qi@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt][Symbian] Enable webkit build with GCCE on Symbian.
+ https://bugs.webkit.org/show_bug.cgi?id=57841
+
+ * wtf/MathExtras.h: GCCE compiler doesn't support those std static functions.
+
+2011-04-06 Dai Mikurube <dmikurube@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add QUOTA build flag for unified quota API
+ https://bugs.webkit.org/show_bug.cgi?id=57918
+
+ * Configurations/FeatureDefines.xcconfig: Added QUOTA build flag
+
+2011-04-06 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Darin Adler.
+
+ Make sure JS_EXPORT_PRIVATE is an empty define when we aren't using the export macros.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27551
+
+ * config.h:
+
+2011-04-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Stop JSObject::isUsingInlineStorage() from using the structure
+ https://bugs.webkit.org/show_bug.cgi?id=57986
+
+ Make the isUsingInlineStorage() implementation just look at
+ whether the property storage is inside the object.
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::isUsingInlineStorage):
+ (JSC::JSObject::JSObject):
+
+2011-04-06 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Geoff Garen.
+
+ Update comments documenting JSVALUE64/JSVALUE32_64 JSValue representations.
+
+ * runtime/JSImmediate.h:
+ * runtime/JSValue.h:
+
+2011-04-06 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ cmake: Fix build for ARMv7
+
+ * CMakeLists.txt: add missing file.
+
+2011-04-06 Liang Qi <liang.qi@nokia.com>
+
+ Reviewed by Benjamin Poulain.
+
+ Correct a include file name.
+ https://bugs.webkit.org/show_bug.cgi?id=57839
+
+ * wtf/PageAllocatorSymbian.h: It should be case sensitive. This fix
+ builds on Unix hosts.
+
+2011-04-06 Adam Roben <aroben@apple.com>
+
+ Build fix after r83056
+
+ * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd: Added property svn:executable.
+
+2011-04-06 Adam Roben <aroben@apple.com>
+
+ Move JavaScriptCoreGenerated's file-copying logic out to a new script
+
+ Hopefully this will make it easier to modify this logic in the future. I also made the
+ script much quieter than the old logic, since it didn't seem helpful to see long lists of
+ filenames during the copying phase.
+
+ If we like this new style, we could copy it for our other projects.
+
+ Fixes <http://webkit.org/b/57950> JavaScriptCoreGenerated's file-copying logic is hard to
+ modify and noisy
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Moved logic to copy
+ files from here...
+ * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd: ...to here. (Added.)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added copy-files.cmd
+ for convenience.
+
+2011-04-05 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Who likes export files? I do!
+
+2011-04-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Introduced the concept of opaque roots, in preparation for marking the DOM with them
+ https://bugs.webkit.org/show_bug.cgi?id=57903
+
+ * JavaScriptCore.exp: Who likes export files? I do!
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::isValidWeakHandle): Factored out a helper function for ASSERTs.
+
+ (JSC::WeakHandleOwner::~WeakHandleOwner): Moved from header to avoid
+ weak linkage problems.
+
+ (JSC::WeakHandleOwner::isReachableFromOpaqueRoots): New callback.
+ Currently unused.
+
+ (JSC::WeakHandleOwner::finalize): Switched from pure virtual to a
+ default empty implementation, since not all clients necessarily want
+ or need non-trivial finalizers.
+
+ (JSC::HandleHeap::markWeakHandles): Split updateWeakHandles into two
+ passes. The first pass marks all reachable weak handles. The second pass
+ finalizes all unreachable weak handles. This must be two passes because
+ we don't know the set of finalizable weak handles until we're done
+ marking all weak handles.
+
+ (JSC::HandleHeap::finalizeWeakHandles): Use new helper function.
+
+ * collector/handles/HandleHeap.h: Ditto.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::markRoots):
+ (JSC::Heap::reset): Split out handle marking from handle finalization.
+
+ * runtime/MarkStack.cpp:
+ (JSC::MarkStack::reset):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::addOpaqueRoot):
+ (JSC::MarkStack::containsOpaqueRoot):
+ (JSC::MarkStack::opaqueRootCount):
+ (JSC::HeapRootMarker::markStack): New helper functions for managing the
+ set of opaque roots.
+
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::finalize): Renamed to match parent class declaration.
+
+2011-04-05 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Build fix for YarrParser.h
+ https://bugs.webkit.org/show_bug.cgi?id=57822
+
+ * yarr/YarrParser.h:
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate):
+
+2011-04-05 Steve Falkenburg <sfalken@apple.com>
+
+ Follow-up Windows build fix.
+ Don't skip react-to-vsprops-changes.py for all production builds,
+ only those initiated via JavaScriptCore.make.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2011-04-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION (r82849): 85,000+ JSC-related leaks seen on SnowLeopard Intel Leaks
+ https://bugs.webkit.org/show_bug.cgi?id=57857
+
+ Whoops, accidentally removed a deref().
+
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+
+2011-04-05 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Add per-configuration vsprops files.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops: Removed inheritance from common.vsprops.
+ Set production environment variable before calling make.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebug.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugAll.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedDebugCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedProduction.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedRelease.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleaseCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedReleasePGO.vsprops: Added.
+
+2011-04-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make caches window show more info about non-jsobject GC values
+ https://bugs.webkit.org/show_bug.cgi?id=57874
+
+ Add ClassInfo to the various internal JS types that currently
+ don't have any, and make the text for caches window show the
+ classname for non-JSObject instances.
+
+ * runtime/Executable.cpp:
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::createStructure):
+ (JSC::NativeExecutable::createStructure):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::EvalExecutable::createStructure):
+ (JSC::ProgramExecutable::createStructure):
+ (JSC::FunctionExecutable::createStructure):
+ * runtime/Heap.cpp:
+ (JSC::TypeCounter::typeName):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/ScopeChain.cpp:
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::createStructure):
+ * runtime/StructureChain.cpp:
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::createStructure):
+
+2011-04-05 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Andreas Kling.
+
+ Cleanup StringConcatenate
+ https://bugs.webkit.org/show_bug.cgi?id=57836
+
+ Don't use PassRefPtr in local variables, properly store in RefPtrs and release on return.
+ Add a makeString() variant taking 9 arguments, needed by a follow-up patch.
+
+ * wtf/text/StringConcatenate.h:
+ (WTF::tryMakeString):
+ (WTF::makeString):
+
+2011-04-04 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r82876.
+ http://trac.webkit.org/changeset/82876
+ https://bugs.webkit.org/show_bug.cgi?id=57816
+
+ Caused a lot of test crashes (Requested by tkent on #webkit).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/FastMalloc.cpp:
+ (WTF::tryFastMalloc):
+ (WTF::fastMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::fastCalloc):
+ (WTF::fastFree):
+ (WTF::tryFastRealloc):
+ (WTF::fastRealloc):
+ (WTF::fastMallocSize):
+ (WTF::TCMalloc_PageHeap::isScavengerSuspended):
+ (WTF::TCMalloc_PageHeap::scheduleScavenger):
+ (WTF::TCMalloc_PageHeap::suspendScavenger):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+ (WTF::TCMallocStats::malloc):
+ (WTF::TCMallocStats::free):
+ (WTF::TCMallocStats::fastCalloc):
+ (WTF::TCMallocStats::tryFastCalloc):
+ (WTF::TCMallocStats::calloc):
+ (WTF::TCMallocStats::fastRealloc):
+ (WTF::TCMallocStats::tryFastRealloc):
+ (WTF::TCMallocStats::realloc):
+ (WTF::TCMallocStats::fastMallocSize):
+ * wtf/FastMalloc.h:
+ (WTF::Internal::fastMallocMatchValidationType):
+ (WTF::Internal::fastMallocMatchValidationValue):
+ (WTF::Internal::setFastMallocMatchValidationType):
+ (WTF::fastMallocMatchValidateFree):
+ * wtf/Platform.h:
+
+2011-04-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ Stop JSCell.h from including Structure.h
+ https://bugs.webkit.org/show_bug.cgi?id=57809
+
+ * runtime/GetterSetter.h:
+ * runtime/JSAPIValueWrapper.h:
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSValue::toThisObject):
+ * runtime/JSString.h:
+ * runtime/ScopeChain.h:
+ * runtime/Structure.h:
+ (JSC::JSCell::isObject):
+ (JSC::JSCell::isString):
+ (JSC::JSCell::classInfo):
+ (JSC::JSCell::createDummyStructure):
+ (JSC::JSValue::needsThisConversion):
+ (JSC::MarkStack::internalAppend):
+ * runtime/StructureChain.h:
+
+2011-04-04 Oliver Hunt <oliver@apple.com>
+
+ Fix clang build.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+ (WTF::fastRealloc):
+
+2011-04-04 Oliver Hunt <oliver@apple.com>
+
+ Remove accidental change to Platform.h
+
+ * wtf/Platform.h:
+
+2011-04-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a weak-handle-related leak in RegisterFile
+ https://bugs.webkit.org/show_bug.cgi?id=57793
+
+ * interpreter/RegisterFile.cpp: Nixed leaky GlobalObjectNotifier.
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::GlobalObjectOwner::finalize):
+ (JSC::RegisterFile::RegisterFile): Replaced GlobalObjectNotifier with
+ a per-RegisterFile weak handle owner, which does not leak.
+
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::set): Allow set() to take a context argument, since
+ RegisterFile now needs this. (Seems like it was an accidental omission
+ all along.)
+
+2011-04-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make malloc validation useful
+ https://bugs.webkit.org/show_bug.cgi?id=57502
+
+ This patch changes FAST_MALLOC_MATCH_VALIDATION with a general
+ corruption check that tags the beginning and end of all allocations
+ to check for write overflows and overwrites the contents of
+ memory on free in order to (hopefully) show up use-after-free issues
+ sooner.
+
+ We also turn it on by default for debug builds.
+
+ * JavaScriptCore.exp:
+ * wtf/FastMalloc.cpp:
+ (WTF::tryFastMalloc):
+ (WTF::fastMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::fastCalloc):
+ (WTF::fastFree):
+ (WTF::tryFastRealloc):
+ (WTF::fastRealloc):
+ (WTF::TCMalloc_PageHeap::isScavengerSuspended):
+ (WTF::TCMalloc_PageHeap::scheduleScavenger):
+ (WTF::TCMalloc_PageHeap::suspendScavenger):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+ (WTF::TCMallocStats::malloc):
+ (WTF::TCMallocStats::free):
+ (WTF::TCMallocStats::fastCalloc):
+ (WTF::TCMallocStats::tryFastCalloc):
+ (WTF::TCMallocStats::calloc):
+ (WTF::TCMallocStats::fastRealloc):
+ (WTF::TCMallocStats::tryFastRealloc):
+ (WTF::TCMallocStats::realloc):
+ * wtf/FastMalloc.h:
+ (WTF::Internal::fastMallocValidationHeader):
+ (WTF::Internal::fastMallocValidationSuffix):
+ (WTF::Internal::fastMallocMatchValidationType):
+ (WTF::Internal::setFastMallocMatchValidationType):
+ (WTF::fastMallocMatchValidateFree):
+ (WTF::fastMallocValidate):
+ * wtf/Platform.h:
+
+2011-04-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Renamed clearWeakPointers => updateWeakHandles and removed misleading comment
+ https://bugs.webkit.org/show_bug.cgi?id=57790
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::updateWeakHandles): Updated for rename.
+
+ * collector/handles/HandleHeap.h: Removed comment claiming that this
+ function should only be called during teardown, because it's actually
+ called after every GC pass.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::markRoots): Updated for rename.
+
+2011-04-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Standardized handling of handles for immediate values
+ https://bugs.webkit.org/show_bug.cgi?id=57788
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::clearWeakPointers): Don't check for null or non-cell
+ values here, because our write barrier guarantees that such values are
+ not in the weak list.
+
+ (JSC::HandleHeap::writeBarrier): Standardized on checking for null before
+ checking for cell, and on using early return instead of if/else.
+
+ * collector/handles/HandleHeap.h:
+ (JSC::HandleHeap::deallocate):
+ (JSC::HandleHeap::makeWeak): Ditto.
+
+2011-04-04 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Removed a redundant variable from HandleHeap
+ https://bugs.webkit.org/show_bug.cgi?id=57786
+
+ Forgot to commit the file that actually removes the data member!
+
+ * collector/handles/HandleHeap.h:
+
+2011-04-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed a redundant variable from HandleHeap
+ https://bugs.webkit.org/show_bug.cgi?id=57786
+
+ We don't need a specific variable to indicate that we're in the middle
+ of the finalization phase, since m_nextToFinalize already does this.
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::HandleHeap):
+ (JSC::HandleHeap::clearWeakPointers):
+ (JSC::HandleHeap::writeBarrier):
+
+2011-04-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Renamed Finalizer => WeakHandleOwner (in preparation for adding a reachability callback)
+ https://bugs.webkit.org/show_bug.cgi?id=57775
+
+ Also renamed noFinalizer => emptyWeakOwner, since this is really an
+ optimization for a weak owner with empty callbacks.
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::clearWeakPointers): Updated for renames. Removed
+ redundant initialization of m_nextToFinalize. Moved deletion check inside
+ weak owner check, since the weak owner can't delete the node if there is
+ no weak owner!
+
+ * collector/handles/HandleHeap.h:
+ (JSC::WeakHandleOwner::~WeakHandleOwner):
+ (JSC::HandleHeap::makeWeak): Updated for renames.
+
+ (JSC::HandleHeap::hasWeakOwner): Changed getFinalizer to hasWeakOwner,
+ to clarify this function's role in assertions.
+
+ (JSC::HandleHeap::Node::Node):
+ (JSC::HandleHeap::Node::makeWeak):
+ (JSC::HandleHeap::Node::isWeak):
+ (JSC::HandleHeap::Node::weakOwner):
+ (JSC::HandleHeap::Node::weakOwnerContext):
+ (JSC::HandleHeap::Node::emptyWeakOwner):
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::globalObjectCollectedNotifier):
+ * interpreter/RegisterFile.h:
+ * runtime/WeakGCMap.h:
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::WeakGCPtr):
+ (JSC::WeakGCPtr::set): Updated for renames.
+
+2011-04-04 Oliver Hunt <oliver@apple.com>
+
+ Fix WinCE build.
+
+ * bytecode/Instruction.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+
+2011-04-04 Adam Roben <aroben@apple.com>
+
+ Delete mt.dep files when doing a clean build due to .vsprops file changes
+
+ Apparently this is yet another file that Visual Studio can't figure out it needs to rebuild.
+
+ Fixes <http://webkit.org/b/57777> r82850 failed to build on Windows Debug (Build)
+
+ Reviewed by Brian Weinstein.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+ (main): Added dep to the list of extensions we look for when choosing files to delete.
+
+2011-04-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make StructureChain GC allocated
+ https://bugs.webkit.org/show_bug.cgi?id=56695
+
+ Make StructureChain GC allocated, and make the various owners
+ mark it correctly.
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ (JSC::PolymorphicAccessStructureList::derefStructures):
+ (JSC::PolymorphicAccessStructureList::markAggregate):
+ (JSC::Instruction::Instruction):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ (JSC::StructureStubInfo::markAggregate):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ * collector/handles/Handle.h:
+ (JSC::HandleConverter::operator->):
+ (JSC::HandleConverter::operator*):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jneq_ptr):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_jneq_ptr):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::getPolymorphicAccessStructureListSlot):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSCell.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ * runtime/JSGlobalObject.h:
+ (JSC::Structure::prototypeChain):
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::create):
+ (JSC::JSPropertyNameIterator::get):
+ (JSC::JSPropertyNameIterator::markChildren):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::setCachedPrototypeChain):
+ * runtime/JSZombie.cpp:
+ (JSC::JSZombie::leakedZombieStructure):
+ * runtime/JSZombie.h:
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::append):
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::sweep):
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::markAggregate):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain):
+ (JSC::StructureChain::~StructureChain):
+ (JSC::StructureChain::markChildren):
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::create):
+ (JSC::StructureChain::createStructure):
+ * runtime/WriteBarrier.h:
+ (JSC::WriteBarrierBase::get):
+ (JSC::WriteBarrierBase::operator*):
+ (JSC::WriteBarrierBase::operator->):
+
+2011-04-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed some complexity from HandleHeap
+ https://bugs.webkit.org/show_bug.cgi?id=57650
+
+ Eliminated pointer-tagging flags.
+
+ Tied being weak to having a finalizer (or at least a finalizer sentinel).
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::clearWeakPointers): Removed the special self-destroying
+ flag. It was unused. If we bring it back, we'll probably use a shared
+ autodeallocating finalizer instead.
+
+ * collector/handles/HandleHeap.h:
+ (JSC::HandleHeap::makeWeak): makeWeak and adding a finalizer are now
+ a single, atomic operation -- this makes the relationship between
+ finalizers and weak pointers clearer, and impossible to get wrong.
+
+ (JSC::HandleHeap::Node::Node):
+ (JSC::HandleHeap::Node::handleHeap): No more flags.
+
+ (JSC::HandleHeap::Node::makeWeak):
+ (JSC::HandleHeap::Node::isWeak): Ditto above. We use a special sentienl
+ value in the finalizer slot to indicate that a handle is weak but doesn't
+ require an external function call for finalization.
+
+2011-04-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed WeakGCMap::deprecatedRemove because it was deprecated and unused
+ https://bugs.webkit.org/show_bug.cgi?id=57648
+
+ * runtime/WeakGCMap.h:
+
+2011-04-01 Adam Roben <aroben@apple.com>
+
+ Maintain the invariant that Lexer::m_current is set to -1 when at the end of the code buffer
+
+ Covered by existing tests.
+
+ Fixes <http://webkit.org/b/56699>.
+
+ Reviewed by Oliver Hunt.
+
+ * parser/Lexer.h:
+ (JSC::Lexer::setOffset): Copied code from Lexer::shift to update m_current, because
+ supposedly the idiom that function uses is fast.
+
+2011-03-31 Thouraya ANDOLSI <thouraya.andolsi@st.com>
+
+ Reviewed by Oliver Hunt.
+
+ SH4 JIT SUPPORT.
+ https://bugs.webkit.org/show_bug.cgi?id=44329
+
+ Add YARR support for SH4 platforms (disabled by default).
+
+ * GNUmakefile.am:
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerSH4.cpp: Added.
+ * assembler/MacroAssemblerSH4.h: Added.
+ * assembler/SH4Assembler.h: Added.
+ * yarr/YarrJIT.cpp:
+
+2011-03-30 Adam Roben <aroben@apple.com>
+
+ Clean build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Serialized project dependencies so projects
+ don't try to build in parallel (which doesn't mesh with our buildfailed mechanism).
+
+2011-03-30 Oliver Hunt <oliver@apple.com>
+
+ Rollout r82500
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ (JSC::PolymorphicAccessStructureList::derefStructures):
+ (JSC::Instruction::Instruction):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jneq_ptr):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_jneq_ptr):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+ * jit/JITStubs.cpp:
+ (JSC::getPolymorphicAccessStructureListSlot):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSCell.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ * runtime/JSGlobalObject.h:
+ (JSC::Structure::prototypeChain):
+ * runtime/JSObject.h:
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::create):
+ (JSC::JSPropertyNameIterator::get):
+ (JSC::JSPropertyNameIterator::markChildren):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::setCachedPrototypeChain):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::append):
+ * runtime/Structure.h:
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain):
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::create):
+
+2011-03-29 Matthew Delaney <mdelaney@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Use the Accelerate vImage vectorized (un)premultiplyImageData functions for ImageBufferCG
+
+ https://bugs.webkit.org/show_bug.cgi?id=53134
+
+ * wtf/Platform.h: Added in WTF flag for using the Accelerate framework
+
+2011-03-30 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Share most vsprops between Release and Production builds in releaseproduction.vsprops
+ https://bugs.webkit.org/show_bug.cgi?id=57508
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreRelease.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseCairoCFLite.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFProduction.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFRelease.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscProduction.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscRelease.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscReleaseCairoCFLite.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiProduction.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiRelease.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiReleaseCairoCFLite.vsprops:
+
+2011-03-30 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Explicitly prevent testapi and minidom from being installed rather than relying
+ on Xcode's current behavior of not installing if INSTALL_PATH is not explicitly
+ set at the target level.
+
+ <rdar://problem/9206357>
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-03-30 Timur Iskhodzhanov <timurrrr@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add some dynamic annotations to JavaScriptCore/wtf
+ https://bugs.webkit.org/show_bug.cgi?id=53747
+
+ By using these annotations we can improve the precision of finding
+ WebKit errors using dynamic analysis tools like ThreadSanitizer and Valgrind.
+ These annotations don't affect the compiled binaries unless USE(DYNAMIC_ANNOTATIONS) is "1".
+
+ These files don't add new functionality, so don't need extra tests.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/DynamicAnnotations.cpp: Added.
+ (WTFAnnotateBenignRaceSized):
+ (WTFAnnotateHappensBefore):
+ (WTFAnnotateHappensAfter):
+ * wtf/DynamicAnnotations.h: Added.
+ * wtf/ThreadSafeRefCounted.h:
+ (WTF::ThreadSafeRefCountedBase::derefBase):
+ * wtf/text/StringStatics.cpp:
+ (WTF::StringImpl::empty):
+
+2011-03-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make StructureChain GC allocated
+ https://bugs.webkit.org/show_bug.cgi?id=56695
+
+ Make StructureChain GC allocated, and make the various owners
+ mark it correctly.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ (JSC::PolymorphicAccessStructureList::derefStructures):
+ (JSC::PolymorphicAccessStructureList::markAggregate):
+ (JSC::Instruction::Instruction):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ (JSC::StructureStubInfo::markAggregate):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jneq_ptr):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_jneq_ptr):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+ * jit/JITStubs.cpp:
+ (JSC::getPolymorphicAccessStructureListSlot):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSCell.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ * runtime/JSGlobalObject.h:
+ (JSC::Structure::prototypeChain):
+ * runtime/JSObject.h:
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::create):
+ (JSC::JSPropertyNameIterator::get):
+ (JSC::JSPropertyNameIterator::markChildren):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::setCachedPrototypeChain):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::append):
+ * runtime/Structure.h:
+ (JSC::Structure::cachedPrototypeChainSlot):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain):
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::create):
+ (JSC::StructureChain::createStructure):
+
+2011-03-30 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Update Windows production build logic for new production configurations
+ https://bugs.webkit.org/show_bug.cgi?id=57494
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFProduction.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscProduction.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiProduction.vsprops:
+
+2011-03-30 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Rename Windows configuration Release_LTCG to Production for clarity
+ https://bugs.webkit.org/show_bug.cgi?id=57465
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreProduction.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseLTCG.vsprops.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseLTCG.vsprops: Removed.
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFProduction.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleaseLTCG.vsprops.
+ * JavaScriptCore.vcproj/WTF/WTFReleaseLTCG.vsprops: Removed.
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/jsc/jscProduction.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscReleaseLTCG.vsprops.
+ * JavaScriptCore.vcproj/jsc/jscReleaseLTCG.vsprops: Removed.
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapiProduction.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiReleaseLTCG.vsprops.
+ * JavaScriptCore.vcproj/testapi/testapiReleaseLTCG.vsprops: Removed.
+
+2011-03-30 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add the NEXT_OPCODE() macro to the DFG-JIT parser
+ https://bugs.webkit.org/show_bug.cgi?id=57322
+
+ In JavaScriptCore we use macros to jump to the next opcode
+ (both in interpreter and JIT). This macro is added to the
+ DFG-JIT parser as well.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parse):
+
+2011-03-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ ~25% regression on v8-splay in the SunSpider harness
+ https://bugs.webkit.org/show_bug.cgi?id=56128
+
+ I'm not sure if this is the root cause of the regression Stephanie
+ measured, but it seems to get us back to previous v8-splay times.
+
+ SunSpider reports no change. v8-splay says 41% faster.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reset): Make marking proportional to 1X the size of the heap,
+ not .5X the size of the heap. When the heap is large, this makes a big
+ difference. (Our old heap growth policy matched this. You can see by
+ looking at resizeBlocks in revisions prior to r77699.)
+
+2011-03-29 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Use per-configuration vsprops in JavaScriptCore to avoid WebKitVSPropsRedirectionDir removal by MSVC IDE
+ https://bugs.webkit.org/show_bug.cgi?id=57350
+
+ Visual Studio's IDE was removing instances of $(WebKitVSPropsRedirectionDir) from
+ InheritedPropertySheet rules in our vcproj files when the vcproj was edited from within
+ the IDE. To avoid this, add a separate vsprops file for each project configuration that
+ contains the required inherited property sheets.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreDebug.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreDebugAll.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreDebugCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreRelease.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleaseLTCG.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGO.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreReleasePGOOptimize.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFDebug.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTFDebugAll.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTFDebugCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTFRelease.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTFReleaseLTCG.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTFReleasePGO.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/jsc/jscDebug.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jscDebugAll.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jscDebugCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jscRelease.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jscReleaseCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jscReleaseLTCG.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jscReleasePGO.vsprops: Added.
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapiDebug.vsprops: Added.
+ * JavaScriptCore.vcproj/testapi/testapiDebugAll.vsprops: Added.
+ * JavaScriptCore.vcproj/testapi/testapiDebugCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/testapi/testapiRelease.vsprops: Added.
+ * JavaScriptCore.vcproj/testapi/testapiReleaseCairoCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/testapi/testapiReleaseLTCG.vsprops: Added.
+
+2011-03-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ REGRESSION(r82173): Causes assertion and test failures in run-javascriptcore-tests on Windows (Requested by aroben on #webkit).
+ https://bugs.webkit.org/show_bug.cgi?id=57333
+
+ constructDate now takes the global object explicitly as it may be called
+ by functions other than the constructor itself.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeDate):
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ (JSC::constructWithDateConstructor):
+ * runtime/DateConstructor.h:
+
+2011-03-29 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Benjamin Poulain.
+
+ https://bugs.webkit.org/show_bug.cgi?id=41953
+
+ Fix compile error on Solaris 10/Sun Studio 12 CC emanating from MathExtras.h
+
+ * wtf/MathExtras.h:
+
+2011-03-29 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=57231
+ Add conditional for SUNCC supporting alignment macros
+
+ Compile fix for Solaris 10/Sun Studio 12 CC
+
+ * wtf/Vector.h:
+
+2011-03-29 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=57256
+
+ Fix crash on misaligned reads on Solaris 10/Sparc
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::equal):
+
+2011-03-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ instanceof Array test fails when using iframes
+ https://bugs.webkit.org/show_bug.cgi?id=17250
+
+ This is a problem with all built in constructors, the use of
+ lexicalGlobalObject rather than the constructors own
+ global object reference means that a builtin will always use
+ the prototype from the lexical global object rather than that
+ of the constructors origin.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction):
+ (JSObjectMakeRegExp):
+ * JavaScriptCore.exp:
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanConstructor.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ * runtime/DateInstance.cpp:
+ * runtime/DateInstance.h:
+ * runtime/ErrorConstructor.cpp:
+ (JSC::constructWithErrorConstructor):
+ (JSC::callErrorConstructor):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructWithFunctionConstructor):
+ (JSC::callFunctionConstructor):
+ (JSC::constructFunction):
+ * runtime/FunctionConstructor.h:
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::getOwnPropertySlot):
+ (JSC::JSCell::put):
+ (JSC::JSCell::deleteProperty):
+ (JSC::JSCell::toThisObject):
+ (JSC::JSCell::toObject):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSValue::toObject):
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::toObject):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::toObject):
+ * runtime/JSObject.h:
+ * runtime/JSString.cpp:
+ (JSC::StringObject::create):
+ (JSC::JSString::toObject):
+ (JSC::JSString::toThisObject):
+ * runtime/JSString.h:
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::toObjectSlowCase):
+ (JSC::JSValue::toThisObjectSlowCase):
+ (JSC::JSValue::synthesizeObject):
+ * runtime/JSValue.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::constructWithNumberConstructor):
+ * runtime/NumberObject.cpp:
+ (JSC::constructNumber):
+ * runtime/NumberObject.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructObject):
+ (JSC::constructWithObjectConstructor):
+ (JSC::callObjectConstructor):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ (JSC::constructWithRegExpConstructor):
+ (JSC::callRegExpConstructor):
+ * runtime/RegExpConstructor.h:
+ * runtime/StringConstructor.cpp:
+ (JSC::constructWithStringConstructor):
+ * runtime/StringObject.h:
+
+2011-03-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESSION [r78794-r79249] Allocation of memory is slow when number of active objects is large
+ https://bugs.webkit.org/show_bug.cgi?id=56823
+
+ Partial fix for most of the problem. (TOT still shows a regression, though.)
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reportExtraMemoryCostSlowCase): Use highWaterMark(), instead of
+ capacity(), since capacity() is O(n) relative to the size of the heap.
+
+ In limited circumstances, capacity() is also worse than highWaterMark()
+ for measuring extra cost relative to heap size, since capacity() only
+ measures the *current* capacity of the heap, but the heap will grow if
+ necessary to attain highWaterMark().
+
+2011-03-28 Oliver Hunt <oliver@apple.com>
+
+ REGRESSION(r82130): It made all tests crash (Requested by Ossy on #webkit).
+ https://bugs.webkit.org/show_bug.cgi?id=57251
+
+ Build fix, had remnant of another patch in r82130
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+
+2011-03-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add additional immediate types to allow us to distinguish the source of a JIT immediate
+ https://bugs.webkit.org/show_bug.cgi?id=57190
+
+ Allow us to distinguish whether a JIT immediate is a value that we
+ control (TrustedImm32 and TrustedImmPtr) vs. ones that can be controlled
+ or influenced by code we are compiling. Currently we do nothing with this
+ information -- this change is large and mechanical but would obscure any
+ logic changes that we would have made.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::TrustedImmPtr::TrustedImmPtr):
+ (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr):
+ (JSC::AbstractMacroAssembler::TrustedImm32::TrustedImm32):
+ (JSC::AbstractMacroAssembler::Imm32::Imm32):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::pop):
+ (JSC::MacroAssembler::poke):
+ (JSC::MacroAssembler::branchPtr):
+ (JSC::MacroAssembler::branch32):
+ (JSC::MacroAssembler::addPtr):
+ (JSC::MacroAssembler::andPtr):
+ (JSC::MacroAssembler::orPtr):
+ (JSC::MacroAssembler::subPtr):
+ (JSC::MacroAssembler::xorPtr):
+ (JSC::MacroAssembler::setPtr):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::branchTestPtr):
+ (JSC::MacroAssembler::branchSubPtr):
+ (JSC::MacroAssembler::branchTest8):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::add32):
+ (JSC::MacroAssemblerARM::and32):
+ (JSC::MacroAssemblerARM::lshift32):
+ (JSC::MacroAssemblerARM::mul32):
+ (JSC::MacroAssemblerARM::or32):
+ (JSC::MacroAssemblerARM::rshift32):
+ (JSC::MacroAssemblerARM::urshift32):
+ (JSC::MacroAssemblerARM::sub32):
+ (JSC::MacroAssemblerARM::xor32):
+ (JSC::MacroAssemblerARM::store32):
+ (JSC::MacroAssemblerARM::push):
+ (JSC::MacroAssemblerARM::move):
+ (JSC::MacroAssemblerARM::branch8):
+ (JSC::MacroAssemblerARM::branch32):
+ (JSC::MacroAssemblerARM::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARM::branch16):
+ (JSC::MacroAssemblerARM::branchTest8):
+ (JSC::MacroAssemblerARM::branchTest32):
+ (JSC::MacroAssemblerARM::branchAdd32):
+ (JSC::MacroAssemblerARM::branchMul32):
+ (JSC::MacroAssemblerARM::branchSub32):
+ (JSC::MacroAssemblerARM::set32Compare32):
+ (JSC::MacroAssemblerARM::set8Compare32):
+ (JSC::MacroAssemblerARM::set32Test32):
+ (JSC::MacroAssemblerARM::set32Test8):
+ (JSC::MacroAssemblerARM::moveWithPatch):
+ (JSC::MacroAssemblerARM::branchPtrWithPatch):
+ (JSC::MacroAssemblerARM::storePtrWithPatch):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::add32):
+ (JSC::MacroAssemblerARMv7::and32):
+ (JSC::MacroAssemblerARMv7::lshift32):
+ (JSC::MacroAssemblerARMv7::mul32):
+ (JSC::MacroAssemblerARMv7::or32):
+ (JSC::MacroAssemblerARMv7::rshift32):
+ (JSC::MacroAssemblerARMv7::urshift32):
+ (JSC::MacroAssemblerARMv7::sub32):
+ (JSC::MacroAssemblerARMv7::xor32):
+ (JSC::MacroAssemblerARMv7::load32):
+ (JSC::MacroAssemblerARMv7::load32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerARMv7::load16):
+ (JSC::MacroAssemblerARMv7::store32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerARMv7::store32):
+ (JSC::MacroAssemblerARMv7::loadDouble):
+ (JSC::MacroAssemblerARMv7::storeDouble):
+ (JSC::MacroAssemblerARMv7::push):
+ (JSC::MacroAssemblerARMv7::move):
+ (JSC::MacroAssemblerARMv7::compare32):
+ (JSC::MacroAssemblerARMv7::test32):
+ (JSC::MacroAssemblerARMv7::branch32):
+ (JSC::MacroAssemblerARMv7::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARMv7::branch16):
+ (JSC::MacroAssemblerARMv7::branch8):
+ (JSC::MacroAssemblerARMv7::branchTest32):
+ (JSC::MacroAssemblerARMv7::branchTest8):
+ (JSC::MacroAssemblerARMv7::branchAdd32):
+ (JSC::MacroAssemblerARMv7::branchMul32):
+ (JSC::MacroAssemblerARMv7::branchSub32):
+ (JSC::MacroAssemblerARMv7::nearCall):
+ (JSC::MacroAssemblerARMv7::call):
+ (JSC::MacroAssemblerARMv7::set32Compare32):
+ (JSC::MacroAssemblerARMv7::set8Compare32):
+ (JSC::MacroAssemblerARMv7::set32Test32):
+ (JSC::MacroAssemblerARMv7::set32Test8):
+ (JSC::MacroAssemblerARMv7::moveWithPatch):
+ (JSC::MacroAssemblerARMv7::branchPtrWithPatch):
+ (JSC::MacroAssemblerARMv7::storePtrWithPatch):
+ (JSC::MacroAssemblerARMv7::tailRecursiveCall):
+ (JSC::MacroAssemblerARMv7::makeJump):
+ (JSC::MacroAssemblerARMv7::makeBranch):
+ (JSC::MacroAssemblerARMv7::setupArmAddress):
+ (JSC::MacroAssemblerARMv7::makeBaseIndexBase):
+ (JSC::MacroAssemblerARMv7::moveFixedWidthEncoding):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::add32):
+ (JSC::MacroAssemblerMIPS::and32):
+ (JSC::MacroAssemblerMIPS::lshift32):
+ (JSC::MacroAssemblerMIPS::mul32):
+ (JSC::MacroAssemblerMIPS::or32):
+ (JSC::MacroAssemblerMIPS::rshift32):
+ (JSC::MacroAssemblerMIPS::urshift32):
+ (JSC::MacroAssemblerMIPS::sub32):
+ (JSC::MacroAssemblerMIPS::xor32):
+ (JSC::MacroAssemblerMIPS::load32):
+ (JSC::MacroAssemblerMIPS::load32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerMIPS::store32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerMIPS::store32):
+ (JSC::MacroAssemblerMIPS::push):
+ (JSC::MacroAssemblerMIPS::move):
+ (JSC::MacroAssemblerMIPS::branch8):
+ (JSC::MacroAssemblerMIPS::branch32):
+ (JSC::MacroAssemblerMIPS::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerMIPS::branch16):
+ (JSC::MacroAssemblerMIPS::branchTest32):
+ (JSC::MacroAssemblerMIPS::branchTest8):
+ (JSC::MacroAssemblerMIPS::branchAdd32):
+ (JSC::MacroAssemblerMIPS::branchMul32):
+ (JSC::MacroAssemblerMIPS::branchSub32):
+ (JSC::MacroAssemblerMIPS::set8Compare32):
+ (JSC::MacroAssemblerMIPS::set32Compare32):
+ (JSC::MacroAssemblerMIPS::set32Test8):
+ (JSC::MacroAssemblerMIPS::set32Test32):
+ (JSC::MacroAssemblerMIPS::moveWithPatch):
+ (JSC::MacroAssemblerMIPS::branchPtrWithPatch):
+ (JSC::MacroAssemblerMIPS::storePtrWithPatch):
+ (JSC::MacroAssemblerMIPS::tailRecursiveCall):
+ (JSC::MacroAssemblerMIPS::loadDouble):
+ (JSC::MacroAssemblerMIPS::storeDouble):
+ (JSC::MacroAssemblerMIPS::branchTruncateDoubleToInt32):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::add32):
+ (JSC::MacroAssemblerX86::addWithCarry32):
+ (JSC::MacroAssemblerX86::and32):
+ (JSC::MacroAssemblerX86::or32):
+ (JSC::MacroAssemblerX86::sub32):
+ (JSC::MacroAssemblerX86::store32):
+ (JSC::MacroAssemblerX86::branch32):
+ (JSC::MacroAssemblerX86::moveWithPatch):
+ (JSC::MacroAssemblerX86::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86::storePtrWithPatch):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::add32):
+ (JSC::MacroAssemblerX86Common::and32):
+ (JSC::MacroAssemblerX86Common::lshift32):
+ (JSC::MacroAssemblerX86Common::mul32):
+ (JSC::MacroAssemblerX86Common::or32):
+ (JSC::MacroAssemblerX86Common::rshift32):
+ (JSC::MacroAssemblerX86Common::urshift32):
+ (JSC::MacroAssemblerX86Common::sub32):
+ (JSC::MacroAssemblerX86Common::xor32):
+ (JSC::MacroAssemblerX86Common::store32):
+ (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerX86Common::push):
+ (JSC::MacroAssemblerX86Common::move):
+ (JSC::MacroAssemblerX86Common::branch8):
+ (JSC::MacroAssemblerX86Common::branch32):
+ (JSC::MacroAssemblerX86Common::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerX86Common::branch16):
+ (JSC::MacroAssemblerX86Common::branchTest32):
+ (JSC::MacroAssemblerX86Common::branchTest8):
+ (JSC::MacroAssemblerX86Common::branchAdd32):
+ (JSC::MacroAssemblerX86Common::branchMul32):
+ (JSC::MacroAssemblerX86Common::branchSub32):
+ (JSC::MacroAssemblerX86Common::set8Compare32):
+ (JSC::MacroAssemblerX86Common::set32Compare32):
+ (JSC::MacroAssemblerX86Common::set32Test8):
+ (JSC::MacroAssemblerX86Common::set32Test32):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::add32):
+ (JSC::MacroAssemblerX86_64::and32):
+ (JSC::MacroAssemblerX86_64::or32):
+ (JSC::MacroAssemblerX86_64::sub32):
+ (JSC::MacroAssemblerX86_64::loadDouble):
+ (JSC::MacroAssemblerX86_64::addDouble):
+ (JSC::MacroAssemblerX86_64::convertInt32ToDouble):
+ (JSC::MacroAssemblerX86_64::store32):
+ (JSC::MacroAssemblerX86_64::call):
+ (JSC::MacroAssemblerX86_64::tailRecursiveCall):
+ (JSC::MacroAssemblerX86_64::makeTailRecursiveCall):
+ (JSC::MacroAssemblerX86_64::addPtr):
+ (JSC::MacroAssemblerX86_64::andPtr):
+ (JSC::MacroAssemblerX86_64::orPtr):
+ (JSC::MacroAssemblerX86_64::subPtr):
+ (JSC::MacroAssemblerX86_64::xorPtr):
+ (JSC::MacroAssemblerX86_64::storePtr):
+ (JSC::MacroAssemblerX86_64::setPtr):
+ (JSC::MacroAssemblerX86_64::branchPtr):
+ (JSC::MacroAssemblerX86_64::branchTestPtr):
+ (JSC::MacroAssemblerX86_64::branchSubPtr):
+ (JSC::MacroAssemblerX86_64::moveWithPatch):
+ (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86_64::storePtrWithPatch):
+ (JSC::MacroAssemblerX86_64::branchTest8):
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::callOperation):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::jitAssertIsInt32):
+ (JSC::DFG::JITCompiler::emitCount):
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::emitPutImmediateToCallFrameHeader):
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
+ (JSC::DFG::SpeculativeJIT::compile):
+ * jit/JIT.cpp:
+ (JSC::JIT::emitTimeoutCheck):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_urshift):
+ (JSC::JIT::emitSlow_op_urshift):
+ (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):
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_negate):
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emit_op_jless):
+ (JSC::JIT::emit_op_jlesseq):
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emitRightShift):
+ (JSC::JIT::emitRightShiftSlowCase):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emit_op_bitxor):
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emitSlow_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::emitSub32Constant):
+ (JSC::JIT::emitBinaryDoubleOp):
+ (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::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::emit_op_ret_object_or_this):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutCellToCallFrameHeader):
+ (JSC::JIT::emitPutIntToCallFrameHeader):
+ (JSC::JIT::emitPutImmediateToCallFrameHeader):
+ (JSC::JIT::emitLoadCharacterString):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ (JSC::JIT::checkStructure):
+ (JSC::JIT::setSamplingFlag):
+ (JSC::JIT::clearSamplingFlag):
+ (JSC::JIT::emitCount):
+ (JSC::JIT::sampleInstruction):
+ (JSC::JIT::sampleCodeBlock):
+ (JSC::JIT::emitStoreInt32):
+ (JSC::JIT::emitStoreCell):
+ (JSC::JIT::emitStoreBool):
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ (JSC::JIT::emitInitRegister):
+ (JSC::JIT::emitJumpIfJSCell):
+ (JSC::JIT::emitJumpIfNotJSCell):
+ (JSC::JIT::emitJumpIfImmediateInteger):
+ (JSC::JIT::emitJumpIfNotImmediateInteger):
+ (JSC::JIT::emitFastArithDeTagImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitTagAsBoolImmediate):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_check_has_instance):
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_op_ret_object_or_this):
+ (JSC::JIT::emit_op_resolve):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emit_op_resolve_base):
+ (JSC::JIT::emit_op_ensure_property_exists):
+ (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::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_jsr):
+ (JSC::JIT::emit_op_resolve_with_base):
+ (JSC::JIT::emit_op_new_func_exp):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_push_new_scope):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emit_op_init_lazy_reg):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emit_op_convert_this_strict):
+ (JSC::JIT::emitSlow_op_not):
+ (JSC::JIT::emitSlow_op_neq):
+ (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_resolve_global_dynamic):
+ (JSC::JIT::emit_op_new_regexp):
+ (JSC::JIT::emit_op_load_varargs):
+ (JSC::JIT::emitSlow_op_load_varargs):
+ (JSC::JIT::emit_op_new_func):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_check_has_instance):
+ (JSC::JIT::emit_op_instanceof):
+ (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_resolve):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emit_op_resolve_base):
+ (JSC::JIT::emit_op_ensure_property_exists):
+ (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::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_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):
+ (JSC::JIT::emit_op_resolve_with_base):
+ (JSC::JIT::emit_op_new_func_exp):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_push_new_scope):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_create_activation):
+ (JSC::JIT::emit_op_create_arguments):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emit_op_convert_this_strict):
+ (JSC::JIT::emit_op_get_arguments_length):
+ (JSC::JIT::emitSlow_op_get_arguments_length):
+ (JSC::JIT::emit_op_get_argument_by_val):
+ (JSC::JIT::softModulo):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_get_by_pname):
+ (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::emit_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::testPrototype):
+ (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::emit_op_put_getter):
+ (JSC::JIT::emit_op_put_setter):
+ (JSC::JIT::emit_op_del_by_id):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (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):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::addArgument):
+ * jit/JITStubs.cpp:
+ (JSC::getPolymorphicAccessStructureListSlot):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::emitJumpIfNotJSCell):
+ (JSC::JSInterfaceJIT::emitLoadInt32):
+ (JSC::JSInterfaceJIT::emitLoadDouble):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
+ (JSC::SpecializedThunkJIT::loadJSStringArgument):
+ (JSC::SpecializedThunkJIT::tagReturnAsInt32):
+ (JSC::SpecializedThunkJIT::tagReturnAsJSCell):
+ * jit/ThunkGenerators.cpp:
+ (JSC::charToString):
+ (JSC::powThunkGenerator):
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::matchCharacterClass):
+ (JSC::Yarr::YarrGenerator::storeToFrame):
+ (JSC::Yarr::YarrGenerator::storeToFrameWithPatch):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::generateCode):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterSingle):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterNonGreedy):
+ (JSC::Yarr::YarrGenerator::generateCharacterClassFixed):
+ (JSC::Yarr::YarrGenerator::generateCharacterClassGreedy):
+ (JSC::Yarr::YarrGenerator::generateCharacterClassNonGreedy):
+ (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
+ (JSC::Yarr::YarrGenerator::generateDisjunction):
+
+2011-03-28 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Fix the linking of jsc with MinGW after r81963.
+
+ * jsc.pro: add -l and remove the lib suffix.
+
+2011-03-27 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=57170 Fix last elements
+ in an enum to remove a trailing comma. Sun Studio 12 CC errors out.
+
+ Compile fix only, no actual code change.
+
+ * wtf/MessageQueue.h:
+
+2011-03-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Allow defineOwnProperty to work on DOMObjects
+ https://bugs.webkit.org/show_bug.cgi?id=57129
+
+ Fix a couple of places where we uses getter()/setter() rather
+ than [gs]etterPresent().
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineOwnProperty):
+
+2011-03-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Crash when paused at a breakpoint caused by inaccurate Activation records.
+ https://bugs.webkit.org/show_bug.cgi?id=57120
+
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::symbolTableGet):
+ (JSC::JSActivation::symbolTablePut):
+ (JSC::JSActivation::getOwnPropertyNames):
+ (JSC::JSActivation::symbolTablePutWithAttributes):
+
+2011-03-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Crash in debugger beneath MarkStack::drain @ me.com, ibm.com
+ https://bugs.webkit.org/show_bug.cgi?id=57080
+ <rdar://problem/8525907>
+
+ The crash was caused by changes in the executable after recompilation.
+
+ The fix is for the activation to copy the data it needs instead of
+ relying on the data in the executable.
+
+ SunSpider and v8 report no change.
+
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters): Use our own data members instead of
+ reading data out of the executable.
+
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation): Initialize our data members.
+
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::symbolTableGet):
+ (JSC::JSActivation::symbolTablePut):
+ (JSC::JSActivation::getOwnPropertyNames):
+ (JSC::JSActivation::symbolTablePutWithAttributes):
+ (JSC::JSActivation::isDynamicScope):
+ (JSC::JSActivation::argumentsGetter): Use our own data members instead of
+ reading data out of the executable.
+
+ * runtime/JSActivation.h: Added new data members to track data previously
+ tracked by the executable. Since I've removed the executable pointer,
+ on a 64bit system, I've only made activations bigger by an int.
+
+2011-03-25 David Kilzer <ddkilzer@apple.com>
+
+ Remove duplicate entry from JavaScriptCore.exp
+
+ JSC::createStackOverflowError(JSC::ExecState*) was originally
+ exported in r60057, then duplicated in r60392.
+
+ * JavaScriptCore.exp: Removed duplicate entry.
+
+2011-03-25 Jarred Nicholls <jarred@sencha.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] MSVC Build Error - need to link advapi32.lib for jsc.exe
+ https://bugs.webkit.org/show_bug.cgi?id=56098
+
+ Need to link advapi32.lib for jsc.exe since wtf/OSRandomSource.cpp uses the Win32 Crypto API
+
+ * jsc.pro:
+
+2011-03-24 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Introduce WTF HexNumber.h
+ https://bugs.webkit.org/show_bug.cgi?id=56099
+
+ Introduce a set of functions that ease converting from a bye or a number to a hex string,
+ replacing several of these conversions and String::format("%x") usages all over WebCore.
+
+ * GNUmakefile.am: Add HexNumber.h to build.
+ * JavaScriptCore.exp: Export StringBuilder::reserveCapacity.
+ * JavaScriptCore.gypi: Add HexNumber.h to build.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export StringBuilder::reserveCapacity.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add HexNumber.h to build.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * wtf/CMakeLists.txt: Ditto.
+ * wtf/HexNumber.h: Added.
+ (WTF::Internal::hexDigitsForMode): Internal helper.
+ (WTF::appendByteAsHex): Free function, that appends a byte as hex string into a destination.
+ (WTF::placeByteAsHex): Ditto, but places the result using *foo++ = '..' or foo[index++] = '..'
+ (WTF::appendUnsignedAsHex): Free function, that appends a number as hex string into a destination.
+
+2011-03-24 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 2: Add new symobl.
+
+ (I should have used the EWS bots for this!)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-03-24 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 1: Removed old symobl.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-03-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Ensure that all compilation takes place within a dynamic global object scope
+ https://bugs.webkit.org/show_bug.cgi?id=57054
+ <rdar://problem/9083011>
+
+ Otherwise, entry to the global object scope might throw away the code
+ we just compiled, causing a crash.
+
+ * JavaScriptCore.exp: Updated for signature change.
+
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate): Removed explicit compilation calls
+ here because (a) they took place outside a dynamic global object scope
+ and (b) they were redundant.
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall): Updated for signature change.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct): Declare our dynamic global object
+ scope earlier, to ensure that compilation takes place within it.
+
+ * runtime/Completion.cpp:
+ (JSC::evaluate): Removed explicit compilation calls here because (a)
+ they took place outside a dynamic global object scope and (b) they were
+ redundant.
+
+ * runtime/Executable.h:
+ (JSC::EvalExecutable::compile):
+ (JSC::ProgramExecutable::compile):
+ (JSC::FunctionExecutable::compileForCall):
+ (JSC::FunctionExecutable::compileForConstruct): Added an ASSERT to
+ verify our new invariant that all compilation takes place within a
+ dynamic global object scope.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
+ * runtime/JSGlobalObject.h: Changed the signature of DynamicGlobalObjectScope
+ to require a JSGlobalData instead of an ExecState* since it is often
+ easier to provide the former, and the latter was not necessary.
+
+2011-03-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ REGRESSION (r79987-r80210): Crash in JSWeakObjectMapClear
+ https://bugs.webkit.org/show_bug.cgi?id=55671
+
+ This is no longer necessary, and it seems that with the new weakmap
+ model it's simply unsafe, so this reduces it to a no-op.
+
+ * API/JSWeakObjectMapRefPrivate.cpp:
+
+2011-03-24 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20302
+ Correct implementation of signbit on Solaris
+
+ * wtf/MathExtras.h:
+ (signbit):
+
+2011-03-23 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7959320> Threads that use APIs above the BSD layer must be registered with the Obj-C GC.
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeCurrentThreadInternal):
+
+2011-03-23 Mark Rowe <mrowe@apple.com>
+
+ Stop setting OTHER_OPTIONS in JavaScriptCore's Makefile.
+
+ It's not necessary to pass "-target All" as xcodebuild always builds the
+ first target in the project unless otherwise specified. The presence of
+ that option also breaks "make clean" since that results in both the
+ -target and -alltargets options being passed to xcodebuild.
+
+ * Makefile:
+
+2011-03-23 Pavel Feldman <pfeldman@chromium.org>
+
+ Not reviewed: bring back Vector::contains that was removed as a part of roll back.
+
+ * wtf/Vector.h:
+ (WTF::::contains):
+
+2011-03-23 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r81686.
+ http://trac.webkit.org/changeset/81686
+ https://bugs.webkit.org/show_bug.cgi?id=56914
+
+ Breaks webkit_tests in Chromium again. (Requested by pfeldman
+ on #webkit).
+
+ * wtf/Vector.h:
+
+2011-03-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ JavaScriptCore GYP build should work on a case-sensitive file system
+ https://bugs.webkit.org/show_bug.cgi?id=56911
+
+ The issue is that there are two UString.h headers, one named UString.h
+ and one named ustring.h. This patch excludes ustring.h from the header
+ map to avoid confusion. While I was editing this part of the GYP file,
+ I cleaned up the exclude rules to be more modern.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ REGRESSION (r78382): No scripts appear in the Web Inspector's Scripts
+ panel on Windows, and many inspector regression tests are failing
+ https://bugs.webkit.org/show_bug.cgi?id=54490
+
+ The bug was caused by two different classes using the same name (Recompiler).
+
+ * debugger/Debugger.cpp:
+ * runtime/JSGlobalData.cpp:
+ (WTF::Recompiler::operator()): Put Recompiler in an anonymous namespace,
+ so our two recompilers' inline functions don't stomp each other at
+ link time.
+
+2011-03-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Remove USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER.
+ <rdar://problem/8944718>
+
+ * DerivedSources.make:
+ Remove generation of USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER.
+
+2011-03-22 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Add DFG module to build system (disabled by default).
+ https://bugs.webkit.org/show_bug.cgi?id=56845
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+
+2011-03-22 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add support to build-webkit for building with gyp-generated project files
+ https://bugs.webkit.org/show_bug.cgi?id=56877
+
+ Found a couple missing Private headers while trying to make WebCore build.
+
+ * JavaScriptCore.gypi:
+
+2011-03-22 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Make it possible to build JavaScriptCore and WebCore gyp builds outside of Source
+ https://bugs.webkit.org/show_bug.cgi?id=56867
+
+ This should make it possible to build the gyp-generated JavaScriptCore.xcodeproj
+ from a JavaScriptCore directory outside of Source.
+
+ * gyp/JavaScriptCore.gyp:
+ * gyp/run-if-exists.sh: Added.
+ * gyp/update-info-plist.sh: Added.
+
+2011-03-22 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add Profiling Configuration to JavaScriptCore gyp build
+ https://bugs.webkit.org/show_bug.cgi?id=56862
+
+ It appears this is identical to Release, but I suspect
+ there is someone/thing who uses the Profiling target
+ so we're adding it for completeness.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove os_win32_files variable from the GYP build
+ https://bugs.webkit.org/show_bug.cgi?id=56804
+
+ Now that our understanding of GYP is sufficiently advanced, we don't
+ need os_win32_files any more. (Turns out Eric was right, as he always
+ is.)
+
+ * JavaScriptCore.gypi:
+
+2011-03-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ GYP build of JavaScriptCore should be able to link from an empty WebKitBuild directory
+ https://bugs.webkit.org/show_bug.cgi?id=56803
+
+ Previously, we thought we should generate the derived source files in
+ the shared intermediate build products directory, but there are
+ assumptions built into other parts of the Mac build system that the
+ derived source files will be generated in a particular subdirectory of
+ the build products directory.
+
+ This patch is a partial revert of the change that moved the derived
+ source files to the shared intermediate directory. After this patch,
+ the GYP build can build JavaScriptCore without help from the main
+ normal build system.
+
+ * JavaScriptCore.gypi:
+ * gyp/JavaScriptCore.gyp:
+ * gyp/generate-derived-sources.sh:
+ * gyp/generate-dtrace-header.sh:
+
+2011-03-22 Jay Civelli <jcivelli@chromium.org>
+
+ Reviewed by David Levin.
+
+ Adding a contains method to Vector.
+ https://bugs.webkit.org/show_bug.cgi?id=55859
+
+ * wtf/Vector.h:
+ (WTF::Vector::contains):
+
+2011-03-22 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix a bunch of typos in DFG.
+ https://bugs.webkit.org/show_bug.cgi?id=56813
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::parse):
+ * dfg/DFGGenerationInfo.h:
+ (JSC::DFG::GenerationInfo::setSpilled):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ * dfg/DFGGraph.h:
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::setupStubArguments):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGJITCompiler.h:
+ * dfg/DFGNode.h:
+ * dfg/DFGNonSpeculativeJIT.h:
+ * dfg/DFGOperations.h:
+ * dfg/DFGRegisterBank.h:
+ (JSC::DFG::RegisterBank::allocate):
+ * dfg/DFGScoreBoard.h:
+ (JSC::DFG::ScoreBoard::~ScoreBoard):
+ (JSC::DFG::ScoreBoard::allocate):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+
+2011-03-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Production configuration in GYP isn&apos;t set up correctly
+ https://bugs.webkit.org/show_bug.cgi?id=56786
+
+ Update JavaScriptCore.gyp with information mined from
+ JavaScriptCore.xcodeproj.
+
+ * JavaScriptCore.gypi:
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-22 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ REGRESSION(r80096): Number type input unexpectedly rounds fractional values
+ https://bugs.webkit.org/show_bug.cgi?id=56367
+
+ Introduce clampToInteger(unsigned).
+
+ * wtf/MathExtras.h:
+ (clampToInteger): Added.
+
+2011-03-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ GYP build should not have include paths that point within the source tree
+ https://bugs.webkit.org/show_bug.cgi?id=56788
+
+ Turns out we don't need these include paths anymore now that we have
+ header maps working properly.
+
+ * gyp/JavaScriptCore.gyp:
+ - Also, remove jsc.cpp from the excluded list because it's not part
+ of the jsc_files variable instead of the javascriptcore_files
+ variable.
+
+2011-03-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Solve the Assertions.cpp / -Wno-missing-format-attribute mystery
+ https://bugs.webkit.org/show_bug.cgi?id=56780
+
+ The reason we couldn't resolve this warning in the GYP build was that
+ the normal build disables this warning specifically for this file.
+ This patch takes the same approach as the previous patch to
+ WebCoreObjCExtras.mm in that it uses a pragma to suppress the warning
+ (rather than a build system configuration).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ - Remove the special-case for this file.
+ * gyp/JavaScriptCore.gyp:
+ - Remove the work-around for this issue.
+ * wtf/Assertions.cpp:
+ - Add a pragma disabling this warning for this file.
+
+2011-03-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ WebCore GYP build shouldn't crash on startup
+ https://bugs.webkit.org/show_bug.cgi?id=56776
+
+ Debug builds shouldn't define NDEBUG. This same logic exists in the
+ project.pbxproj file.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-21 Robert Kroeger <rjkroege@chromium.org>
+
+ Reviewed by Antonio Gomes.
+
+ Flag to enable/disable a GestureReocognizer framework
+
+ https://bugs.webkit.org/show_bug.cgi?id=49345
+
+ * wtf/Platform.h:
+
+2011-03-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add new files to JavaScriptCore.gypi
+ https://bugs.webkit.org/show_bug.cgi?id=56766
+
+ * JavaScriptCore.gypi:
+
+2011-03-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r81377.
+ http://trac.webkit.org/changeset/81377
+ https://bugs.webkit.org/show_bug.cgi?id=56765
+
+ WebPageSerializerTest.MultipleFrames is broken (Requested by
+ simonjam on #webkit).
+
+ * wtf/Vector.h:
+
+2011-03-21 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Extend constant pool to be able to store 16 bit instructions with a constant
+ https://bugs.webkit.org/show_bug.cgi?id=46796
+
+ The putShortWithConstantInt function inserts a 16 bit instruction which
+ refers a 32 bits constant or literal. This is a vital function for those
+ target which loads a PC relative value with a 16 bit instruction (like
+ Thumb-2 instruction set and SH4 architecture).
+
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::putIntegral):
+ (JSC::AssemblerBuffer::putIntegralUnchecked):
+ * assembler/AssemblerBufferWithConstantPool.h:
+
+2011-03-21 Philippe Normand <pnormand@igalia.com>
+
+ Unreviewed, GTK distcheck build fix.
+
+ * GNUmakefile.am:
+
+2011-03-20 Bill Budge <bbudge@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Rename ThreadSafeShared to ThreadSafeRefCounted
+ https://bugs.webkit.org/show_bug.cgi?id=56714
+
+ No new tests. Exposes no new functionality.
+
+ * API/JSClassRef.h:
+ * API/OpaqueJSString.h:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Atomics.h:
+ * wtf/CMakeLists.txt:
+ * wtf/CrossThreadRefCounted.h:
+ (WTF::CrossThreadRefCounted::CrossThreadRefCounted):
+ (WTF::::crossThreadCopy):
+ * wtf/ThreadSafeRefCounted.h: Copied from wtf/ThreadSafeShared.h.
+ (WTF::ThreadSafeRefCountedBase::ThreadSafeRefCountedBase):
+ (WTF::ThreadSafeRefCountedBase::ref):
+ (WTF::ThreadSafeRefCountedBase::refCount):
+ (WTF::ThreadSafeRefCountedBase::derefBase):
+ (WTF::ThreadSafeRefCounted::ThreadSafeRefCounted):
+ * wtf/ThreadSafeShared.h: Removed.
+ * wtf/Threading.h:
+
+2011-03-19 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Remove StringImpl::computeHash()
+ https://bugs.webkit.org/show_bug.cgi?id=49894
+
+ Replace remainig StringImpl::computeHash with StringImpl::computeHashStringHasher.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::CStringTranslator::hash):
+ (WTF::UCharBufferTranslator::hash):
+ (WTF::HashAndCharactersTranslator::hash):
+ * wtf/text/StringImpl.h:
+ (WTF::StringImpl::setHash):
+ (WTF::StringImpl::hash):
+
+2011-03-19 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Rename WTF::StringHasher methods
+ https://bugs.webkit.org/show_bug.cgi?id=53532
+
+ Rename createHash to computeHash and createBlobHash to hashMemory.
+ Also add a using WTF::StringHasher in the header file.
+
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::Hash::hash):
+ * runtime/Identifier.cpp:
+ (JSC::IdentifierCStringTranslator::hash):
+ (JSC::IdentifierUCharBufferTranslator::hash):
+ * wtf/StringHasher.h:
+ (WTF::StringHasher::computeHash):
+ (WTF::StringHasher::hashMemory):
+ * wtf/text/StringHash.h:
+ (WTF::CaseFoldingHash::hash):
+ * wtf/text/StringImpl.h:
+ (WTF::StringImpl::computeHash):
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::calculateStringHashAndLengthFromUTF8Internal):
+
+2011-03-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ [GTK] JSC crashes in 32bit Release bots after r80743
+ https://bugs.webkit.org/show_bug.cgi?id=56180
+
+ The crash was caused by referencing GC memory from a GC destructor. This
+ is not safe because destruction time / order is not guaranteed.
+
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::create):
+ (JSC::ProfileGenerator::ProfileGenerator):
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ * profiler/ProfileGenerator.h:
+ (JSC::ProfileGenerator::origin): Made ExecState* the first argument,
+ to match the rest of this class and JSC.
+
+ Use a JSGlobalObject* instead of an ExecState* with an indirect reference
+ to a JSGlobalObject* to track our origin. This is simpler and more
+ efficient, and it removes the destruction order dependency that was causing
+ our crash.
+
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::startProfiling): Updated for change to JSGlobalObject*.
+ (JSC::Profiler::stopProfiling): New function for stopping all profiles
+ for a given global object. This is more straight-forward than multiplexing
+ through the old function.
+
+ (JSC::dispatchFunctionToProfiles): Updated for change to JSGlobalObject*.
+ * profiler/Profiler.h: Ditto.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject): Ditto.
+
+2011-03-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ 1 Structure leaked beneath JSGlobalData::storeVPtrs()
+ https://bugs.webkit.org/show_bug.cgi?id=56595
+
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::VPtrHackExecutable::VPtrHackExecutable):
+ (JSC::ScriptExecutable::ScriptExecutable): Use a raw pointer instead of
+ PassRefPtr, like JSString does, since JSGlobalData owns the singleton
+ exectuable structure.
+
+2011-03-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Fixed some string leaks seen on the buildbot
+ https://bugs.webkit.org/show_bug.cgi?id=56619
+
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyTable::~PropertyTable): DEref!
+
+2011-03-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Crash in JSC::MarkStack::drain Under Stress
+ https://bugs.webkit.org/show_bug.cgi?id=56470
+
+ We perform a number of gc allocations while when
+ we are setting up new globals in a piece of global
+ code. We do this by adding new properties to the
+ symbol table, and then expanding the storage to fit
+ at the end.
+
+ If a GC happens during this time we will report an
+ incorrect size for the global object's symbol table
+ storage.
+
+ This patch corrects this by growing the storage size
+ before we starting adding entries to the symbol table.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::resizeRegisters):
+
+2011-03-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ 1 Structure leaked beneath JSGlobalData::storeVPtrs()
+ https://bugs.webkit.org/show_bug.cgi?id=56595
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs): Take local ownership of the Structure
+ we're using, since the Executable is not designed to own the Structure.
+
+2011-03-17 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Sam Weinig.
+
+ Add missing register-register branchTest8 to MacroAssemblerX86Common/X86Assembler.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branchTest8):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::testb_rr):
+
+2011-03-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 56603 - DFG JIT related cleanup
+ Move node generation out to separate function, move binarySearch algorithm out
+ to StdLibExtras, fix Graph::dump() to print comma between non-node children,
+ even if there are no node children.
+
+ * bytecode/CodeBlock.h:
+ (JSC::getCallReturnOffset):
+ (JSC::CodeBlock::getStubInfo):
+ (JSC::CodeBlock::getCallLinkInfo):
+ (JSC::CodeBlock::getMethodCallLinkInfo):
+ (JSC::CodeBlock::bytecodeOffset):
+ - Move binaryChop to binarySearch in StdLibExtras
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::ByteCodeParser):
+ (JSC::DFG::ByteCodeParser::parse):
+ (JSC::DFG::parse):
+ - Make m_noArithmetic a member, initialize m_currentIndex in the constructor.
+ * dfg/DFGByteCodeParser.h:
+ - Change parse() to not take a start index (always 0).
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::dump):
+ - Fix Graph::dump() to print comma between non-node children, even if there are no node children.
+ * dfg/DFGJITCodeGenerator.h:
+ (JSC::DFG::JITCodeGenerator::JITCodeGenerator):
+ - Initialize m_compileIndex in constructor.
+ * dfg/DFGNonSpeculativeJIT.cpp:
+ (JSC::DFG::NonSpeculativeJIT::compile):
+ * dfg/DFGNonSpeculativeJIT.h:
+ - Spilt out compilation of individual node.
+ * dfg/DFGOperations.cpp:
+ (JSC::DFG::operationConvertThis):
+ * dfg/DFGOperations.h:
+ - Cleanup parameter name.
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT.h:
+ - Spilt out compilation of individual node.
+ * runtime/Executable.cpp:
+ (JSC::tryDFGCompile):
+ - Change parse() to not take a start index (always 0).
+ * wtf/StdLibExtras.h:
+ (WTF::binarySearch):
+ - Move binaryChop to binarySearch in StdLibExtras
+
+2011-03-17 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix clang build.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs):
+
+2011-03-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ 1 Structure leaked beneath JSGlobalData::storeVPtrs()
+ https://bugs.webkit.org/show_bug.cgi?id=56595
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs): Now that we have an executable, we need
+ to explicitly run its destructor.
+
+2011-03-17 Jeff Miller <jeffm@apple.com>
+
+ Use a consistent set of file patterns in the svn:ignore property for all .xcodeproj directories, specifically:
+
+ *.mode*
+ *.pbxuser
+ *.perspective*
+ project.xcworkspace
+ xcuserdata
+
+ * JavaScriptCore.xcodeproj: Modified property svn:ignore.
+
+2011-03-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reverting r81197, breaks JIT + INTERPRETER build.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addPropertyAccessInstruction):
+ (JSC::CodeBlock::addGlobalResolveInstruction):
+ (JSC::CodeBlock::addStructureStubInfo):
+ * bytecode/Opcode.h:
+ * bytecode/StructureStubInfo.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ (JSC::BytecodeGenerator::emitDirectPutById):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitConstruct):
+ (JSC::BytecodeGenerator::emitCatch):
+
+2011-03-17 Ben Taylor <bentaylor.solx86@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add a COMPILER(SUNCC) define for Sun Studio 12.
+ https://bugs.webkit.org/show_bug.cgi?56444
+ derived from patch 1 of 16 originally from https://bugs.webkit.org/show_bug.cgi?id=24932
+
+ * wtf/Platform.h:
+
+2011-03-17 Jay Civelli <jcivelli@chromium.org>
+
+ Reviewed by David Levin.
+
+ Adding a contains method to Vector.
+ https://bugs.webkit.org/show_bug.cgi?id=55859
+
+ * wtf/Vector.h:
+ (WTF::::operator):
+ (WTF::::contains):
+
+2011-03-17 Patrick Gansterer <paroga@webkit.org>
+
+ Fix the interpreter build.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Added globalData to inheritorID().
+
+2011-03-16 Sam Weinig <sam@webkit.org>
+
+ Fix the interpreter build.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::privateExecute):
+ Remove .get()s.
+
+2011-03-16 Adam Barth <abarth@webkit.org>
+
+ Reviewed by James Robinson.
+
+ Remove USE(BUILTIN_UTF8_CODEC)
+ https://bugs.webkit.org/show_bug.cgi?id=56508
+
+ We added this recently when we were unsure about the stability of the
+ built-in UTF-8 codec. However, the codec seems to be stable, so we
+ don't need the macro.
+
+ * wtf/Platform.h:
+
+2011-03-16 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Make JIT build for ARM Thumb-2 with RVCT
+ https://bugs.webkit.org/show_bug.cgi?id=56440
+
+ Derived from a patch by Dave Tapuska.
+
+ Also, modify the RVCT stub template to indicate that it preserves 8 byte stack alignment.
+
+ * jit/JITStubs.cpp:
+
+2011-03-16 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Darin Adler.
+
+ Fix MIPS build with const *void
+ https://bugs.webkit.org/show_bug.cgi?id=56513
+
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::load32):
+ (JSC::MacroAssemblerMIPS::store32):
+
+2011-03-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Remove unnecessary caller tracking shenanigans from CodeBlock
+ https://bugs.webkit.org/show_bug.cgi?id=56483
+
+ This removes some leftover cruft from when we made CodeBlock
+ mark its callees. Removing it gives us a 0.7% progression,
+ reducing the overall regression to ~1.3%.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CallLinkInfo::CallLinkInfo):
+ * jit/JIT.cpp:
+ (JSC::JIT::linkCall):
+ (JSC::JIT::linkConstruct):
+
+2011-03-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make Structure creation require a JSGlobalData
+ https://bugs.webkit.org/show_bug.cgi?id=56438
+
+ Mechanical change to make Structure::create require JSGlobalData&, and
+ require all users to provide the globalData.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * API/JSContextRef.cpp:
+ * JavaScriptCore.exp:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ (functionRun):
+ (jscmain):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ * runtime/ArrayPrototype.h:
+ (JSC::ArrayPrototype::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DateInstance.h:
+ (JSC::DateInstance::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/ErrorInstance.h:
+ (JSC::ErrorInstance::createStructure):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::createStructure):
+ (JSC::EvalExecutable::createStructure):
+ (JSC::ProgramExecutable::createStructure):
+ (JSC::FunctionExecutable::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::createStructure):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::createStructure):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSArray.h:
+ (JSC::JSArray::createStructure):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell::createDummyStructure):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs):
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ (JSC::JSGlobalObject::createStructure):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::createInheritorID):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ (JSC::JSNonFinalObject::createStructure):
+ (JSC::JSFinalObject::createStructure):
+ (JSC::createEmptyObjectStructure):
+ (JSC::JSObject::inheritorID):
+ * runtime/JSObjectWithGlobalObject.h:
+ (JSC::JSObjectWithGlobalObject::createStructure):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::createStructure):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::createStructure):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ * runtime/JSZombie.h:
+ (JSC::JSZombie::createStructure):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ (JSC::NativeErrorConstructor::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/ObjectConstructor.h:
+ (JSC::ObjectConstructor::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::createStructure):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/StringPrototype.h:
+ (JSC::StringPrototype::createStructure):
+ * runtime/Structure.h:
+ (JSC::Structure::create):
+
+2011-03-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Some conservative root gathering cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=56447
+
+ SunSpider says 0.5% - 1.8% faster.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::gatherConservativeRoots):
+ * interpreter/RegisterFile.h: New helper function for doing the
+ conservative gathering of the register file. It's still conservative,
+ since the register file may contain uninitialized values, but it's
+ moving-safe, because it only visits values tagged as pointers, so there's
+ no risk of mistaking an integer for a pointer and accidentally changing it.
+
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeRoots::add):
+ * runtime/ConservativeSet.h: Added a single-value add function, used above.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots): Separated machine stack conservative roots from
+ register file conservative roots because machine stack roots must be
+ pinned, but register file roots need not be pinned.
+
+ Adopted new interface for passing the current stack extent to the machine
+ stack root gathering routine. This allows us to exclude marking-related
+ data structures on the stack, and thus avoid double-marking the set of
+ machine roots.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::MachineThreads::gatherFromCurrentThread):
+ (JSC::MachineThreads::gatherConservativeRoots):
+ * runtime/MachineStackMarker.h: Added new interface, described above.
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::firstAtom):
+ * wtf/StdLibExtras.h:
+ (WTF::roundUpToMultipleOf): Moved roundUpToMultipleOf so it could be used
+ by MachineStacks.
+
+2011-03-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little bit of MarkStack cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=56443
+
+ Moved MarkStack functions into MarkStack.h/.cpp.
+
+ SunSpider reports no change.
+
+ * runtime/JSArray.h:
+ * runtime/JSCell.h: Moved from here...
+ * runtime/MarkStack.cpp:
+ (JSC::MarkStack::markChildren):
+ (JSC::MarkStack::drain): ...to here. Also, no need to inline drain. It's
+ a huge function, and not called many times.
+
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::~MarkStack): Moved near constructor, per style guide.
+ (JSC::MarkStack::append):
+ (JSC::MarkStack::deprecatedAppend):
+ (JSC::MarkStack::internalAppend): Moved to here.
+
+2011-03-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed another deprecatedAppend
+ https://bugs.webkit.org/show_bug.cgi?id=56429
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::markStrongHandles):
+ * collector/handles/HandleHeap.h: Use HeapRootMarker, since handles are
+ marked directly by the Heap.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots): Ditto.
+
+2011-03-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed some more deprecated / unsafe append
+ https://bugs.webkit.org/show_bug.cgi?id=56428
+
+ * collector/handles/HandleStack.cpp:
+ (JSC::HandleStack::mark):
+ * collector/handles/HandleStack.h: Mark the handle stack using a HeapRoot
+ marker, since it's a heap root.
+
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::markLists):
+ (JSC::MarkedArgumentBuffer::slowAppend):
+ * runtime/ArgList.h: Ditto.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots): Added a mark call for marking the handle stack.
+ It seems like Oliver forgot this in his last patch. (!)
+
+ * runtime/MarkStack.h: Removed appendSlots, since it would allow an
+ object to embed JSValues directly instead of using WriteBarrier.
+
+ (JSC::MarkStack::append): Added a private append for a list of values.
+
+ (JSC::HeapRootMarker::mark): Access to the above.
+
+2011-03-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed a few more deprecatedAppends, and removed HeapRoot<T>
+ https://bugs.webkit.org/show_bug.cgi?id=56422
+
+ Added HeapRootMarker, a privileged class for marking direct heap roots
+ that are iterated during each garbage collection. This is easier to use
+ and more reliable than HeapRoot<T>, so I've removed HeapRoot<T>.
+
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::exception):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Completion.cpp:
+ (JSC::evaluate): exception is no longer a HeapRoot<T>, so no need to
+ call .get() on it.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * runtime/Heap.h: Updated to use HeapRootMarker.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkStack::append): Added private functions for
+ HeapRootMarker to use.
+
+ * runtime/JSGlobalData.h: exception is no longer a HeapRoot<T>.
+
+ * runtime/MarkStack.h:
+ (JSC::HeapRootMarker::HeapRootMarker):
+ (JSC::HeapRootMarker::mark): Added private functions for
+ HeapRootMarker to use.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::markChildren): Updated to use HeapRootMarker.
+
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::emptyString):
+ (JSC::SmallStrings::singleCharacterString):
+ (JSC::SmallStrings::singleCharacterStrings): Updated to use HeapRootMarker.
+
+ * runtime/WriteBarrier.h: Removed HeapRoot<T>.
+
+2011-03-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Made the global object moving-GC-safe
+ https://bugs.webkit.org/show_bug.cgi?id=56348
+
+ SunSpider reports no change.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::markChildren): Removed a dubious comment that
+ suggested we do not need to visit all our references during GC, since
+ that is not true in a moving GC.
+
+ Re-sorted data members by type, removed one duplicate, and added back
+ the one missing mark I found.
+
+ * runtime/JSGlobalObject.h: Re-sorted data members by type.
+
+2011-03-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Introduce Local<T> to allow us to start moving to precise marking of locals
+ https://bugs.webkit.org/show_bug.cgi?id=56394
+
+ Introduce a new handle type, Local<T> and a scoping mechanism
+ LocalScope to allow us to start moving towards precise marking
+ of temporaries and local variables.
+
+ We also start to use the new Local<> type in the JSON stringifier
+ so that we can have some coverage of their behaviour in the initial
+ checkin.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * collector/handles/Handle.h:
+ (JSC::::asObject):
+ * collector/handles/HandleStack.cpp: Added.
+ (JSC::HandleStack::HandleStack):
+ (JSC::HandleStack::mark):
+ (JSC::HandleStack::grow):
+ * collector/handles/HandleStack.h: Added.
+ (JSC::HandleStack::enterScope):
+ (JSC::HandleStack::zapTo):
+ (JSC::HandleStack::leaveScope):
+ (JSC::HandleStack::push):
+ * collector/handles/Local.h: Added.
+ (JSC::Local::internalSet):
+ (JSC::::Local):
+ (JSC::::operator):
+ (JSC::LocalStack::LocalStack):
+ (JSC::LocalStack::peek):
+ (JSC::LocalStack::pop):
+ (JSC::LocalStack::push):
+ (JSC::LocalStack::isEmpty):
+ (JSC::LocalStack::size):
+ * collector/handles/LocalScope.h: Added.
+ (JSC::LocalScope::LocalScope):
+ (JSC::LocalScope::~LocalScope):
+ (JSC::LocalScope::release):
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots):
+ * runtime/Heap.h:
+ (JSC::Heap::allocateLocalHandle):
+ (JSC::Heap::handleStack):
+ * runtime/JSCell.h:
+ (JSC::JSCell::::getString):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::allocateLocalHandle):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Stringifier):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::appendStringifiedValue):
+ (JSC::Stringifier::Holder::Holder):
+ (JSC::Walker::Walker):
+ (JSC::Walker::walk):
+ (JSC::JSONProtoFuncParse):
+ (JSC::JSONProtoFuncStringify):
+ (JSC::JSONStringify):
+ * runtime/JSONObject.h:
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::appendValues):
+ (JSC::MarkStack::appendSlots):
+
+2011-03-15 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Sam Weinig.
+
+ Bug 56420 - Remove ENABLE(JIT) code from ByteCompiler
+ Some methods have unnecessary differences in name/arguments for interpreter/JIT.
+
+ * bytecode/CodeBlock.cpp:
+ * bytecode/CodeBlock.h:
+ (JSC::HandlerInfo::HandlerInfo):
+ (JSC::CodeBlock::addPropertyAccessInfo):
+ (JSC::CodeBlock::addGlobalResolveInfo):
+ (JSC::CodeBlock::addCallLinkInfo):
+ (JSC::CodeBlock::globalResolveInfo):
+ * bytecode/Opcode.h:
+ * bytecode/StructureStubInfo.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ (JSC::BytecodeGenerator::emitDirectPutById):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitConstruct):
+ (JSC::BytecodeGenerator::emitCatch):
+
+2011-03-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix broken assert in new code.
+
+ * dfg/DFGAliasTracker.h:
+ (JSC::DFG::AliasTracker::recordPutByVal):
+ - recordPutByVal is called for both PutByVal & PutByValAlias.
+
+2011-03-15 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ Removed redundant code from BytecodeGenerator.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ * bytecompiler/BytecodeGenerator.h:
+ - delete uncalled code missed when reparsing was removed.
+
+2011-03-15 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Darin Adler.
+
+ Introduce WTF_USE_EXPORT_MACROS, which will allow us to put shared library import/export
+ info into the headers rather than in export symbol definition files, but disable it on
+ all platforms initially so we can deal with port build issues one port at a time.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27551
+
+ * API/JSBase.h:
+ * config.h:
+ * wtf/Assertions.h:
+ * wtf/ExportMacros.h: Added.
+ * wtf/Platform.h:
+
+2011-03-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed build fix.
+
+ Buildfix when JIT is not enabled after r81079
+ https://bugs.webkit.org/show_bug.cgi?id=56361
+
+ * runtime/Executable.cpp:
+
+2011-03-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Made the global object moving-GC-safe
+ https://bugs.webkit.org/show_bug.cgi?id=56348
+
+ SunSpider reports no change.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::markChildren): Removed a dubious comment that
+ suggested we do not need to visit all our references during GC, since
+ that is not true in a moving GC.
+
+ Re-sorted data members by type, removed one duplicate, and added back
+ the one missing mark I found.
+
+ * runtime/JSGlobalObject.h: Re-sorted data members by type.
+
+2011-03-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Made JSWrapperObject and subclasses moving-GC-safe
+ https://bugs.webkit.org/show_bug.cgi?id=56346
+
+ SunSpider reports no change.
+
+ * runtime/BooleanObject.cpp:
+ (JSC::BooleanObject::BooleanObject):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance): No more need for JSGlobalData, since
+ we don't initialize the wrapped value in our constructor.
+
+ * runtime/DateInstance.h: Don't set the OverridesMarkChildren flag because
+ we do not in fact override markChildren.
+
+ * runtime/DatePrototype.h: Declare an anonymous slot, since wrapper object
+ no longer does so for us. Also added an ASSERT to catch a latent bug,
+ where DatePrototype stomped on its base class's anonymous slot. Hard-coded
+ anonymous slots are a plague on our code. This doesn't cause any problems
+ in our existing code since the base class never reads the anonymous slot
+ it declares, but it caused crashes when I tried to start using the slot
+ in an initial version of this patch.
+
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue): Resolved a problem where
+ our internal value was stored in two places: an anonymous slot, and a
+ data member which was not always visited during GC. Now, we only use the
+ data member, and we always visit it. (Instead of relying on certain
+ subclasses to set the OverridesMarkChildren bit, we set it ourselves.)
+
+ * runtime/NumberObject.cpp:
+ (JSC::NumberObject::NumberObject): No more need for JSGlobalData, since
+ we don't initialize the wrapped value in our constructor.
+
+ * runtime/NumberObject.h: Removed meaningless declaration.
+
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject): No more need for JSGlobalData, since
+ we don't initialize the wrapped value in our constructor.
+
+ * runtime/StringObject.h: Don't set the OverridesMarkChildren flag because
+ we do not in fact override markChildren.
+
+ * runtime/StringPrototype.h: Declare an anonymous slot, since wrapper object
+ no longer does so for us. Also added an ASSERT to catch a latent bug,
+ where DatePrototype stomped on its base class's anonymous slot. Hard-coded
+ anonymous slots are a plague on our code.
+
+2011-03-14 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Look-ahead assertions with back references don’t work as expected
+ https://bugs.webkit.org/show_bug.cgi?id=56082
+
+ Changed parentheses assertion processing to temporarily back out the
+ number of known characters after the assertion while processing the
+ assertion. This was done so that assertions don't fail due to
+ checking the number of required characters as additional to the
+ rest of the express since assertions don't "consume" input.
+ Added a byte code to uncheck characters to support the change.
+
+ * yarr/YarrInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchDisjunction):
+ (JSC::Yarr::ByteCompiler::uncheckInput):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/YarrInterpreter.h:
+ (JSC::Yarr::ByteTerm::UncheckInput):
+
+2011-03-14 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Warning that round/roundf functions are already defined when compiled with RVCT 4 on symbian.
+ https://bugs.webkit.org/show_bug.cgi?id=56133
+
+ Add condition to not compile webkit internal math round functions on RVCT compiler versions
+ from 3.0.0 because they are already defined in compiler math library.
+
+ * wtf/MathExtras.h:
+
+2011-03-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen & Oliver Hunt.
+
+ Bug 56284 - Add a dataflow intermediate representation for use in JIT generation.
+
+ The JSC JIT presently generates code directly from the bytecode used by the interpreter.
+ This is not an optimal intermediate representation for JIT code generation, since it does
+ not capture liveness information of values, and provides little opportunity to perform
+ any static analysis for even primitive types. The JIT currently generates two code paths,
+ a fast path handling common cases, and a slower path handling less common operand types.
+ However the slow path jumps back into the fast path, meaning that information arising
+ from the earlier type checks cannot be propagated to later operations.
+
+ This patch adds:
+ * a dataflow intermediate representation capable of describing a single basic block
+ of operations,
+ * a mechanism to convert a simple, single-block bytecode functions to the new IR,
+ * and a JIT code generator capable of generating code from this representation.
+
+ The JIT generates two code paths, with the slower path not reentering the fast path
+ mid-block, allowing speculative optimizations to be made on the hot path, with type
+ information arising from these speculative decisions able to be propagated through the
+ dataflow. Code generation of both speculative and non-speculative paths exploits the type
+ and liveness information represented in the dataflow graph to attempt to avoid redundant
+ boxing and type-checking of values, and to remove unnecessary spills of temporary values
+ to the RegisterFile.
+
+ The dataflow JIT currently can only support a subset of bytecode operations, limited to
+ arithmetic, bit-ops, and basic property access. Functions that cannot be compiled by the
+ dataflow JIT will be run using the existing JIT. The coverage of the dataflow JIT will be
+ expanded to include, control-flow, function calls, and then the long-tail of remaining
+ bytecode instructions. The JIT presently only support JSVALUE64, and as a consequence of
+ this only supports x86-64.
+
+ The status of the dataflow JIT is currently work-in-progress. Limitations of the present
+ JIT code generation may cause performance regressions, particularly:
+ * the policy to only generate arithmetic code on the speculative path using integer
+ instructions, never using floating point.
+ * the policy to only generate arithmetic code on the non-speculative path using
+ floating point instructions, never using integer.
+ * always generating JSValue adds on the non-speculative path as a call out to a
+ C-function, never handling this in JIT code.
+ * always assuming by-Value property accesses on the speculative path to be array
+ accesses.
+ * generating all by-Value property accesses from the non-speculative path as a call
+ out to a C-function.
+ * generating all by-Indentifer property accesses as a call out to a C-function.
+ Due to these regressions, the code is landed in a state where it is disabled in most
+ cases by the ENABLE_DFG_JIT_RESTRICTIONS guard in Platform.h. As these regressions are
+ addressed, the JIT will be allowed to trigger in more cases.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ - Added new files to Xcode project.
+ * dfg: Added.
+ - Added directory for new code.
+ * dfg/DFGByteCodeParser.cpp: Added.
+ * dfg/DFGByteCodeParser.h: Added.
+ - Contruct a DFG::Graph representation from a bytecode CodeBlock.
+ * dfg/DFGGenerationInfo.h: Added.
+ - Track type & register information for VirtualRegisters during JIT code generation.
+ * dfg/DFGGraph.cpp: Added.
+ * dfg/DFGGraph.h: Added.
+ - Dataflow graph intermediate representation for code generation.
+ * dfg/DFGJITCodeGenerator.cpp: Added.
+ * dfg/DFGJITCodeGenerator.h: Added.
+ - Base class for SpeculativeJIT & NonSpeculativeJIT to share common functionality.
+ * dfg/DFGJITCompiler.cpp: Added.
+ * dfg/DFGJITCompiler.h: Added.
+ - Class responsible for driving code generation of speculativeJIT & non-speculative
+ code paths from the dataflow graph.
+ * dfg/DFGNonSpeculativeJIT.cpp: Added.
+ * dfg/DFGNonSpeculativeJIT.h: Added.
+ - Used to generate the non-speculative code path, this make no assumptions
+ about operand types.
+ * dfg/DFGOperations.cpp: Added.
+ * dfg/DFGOperations.h: Added.
+ - Helper functions called from the JIT generated code.
+ * dfg/DFGRegisterBank.h: Added.
+ - Used to track contents of physical registers during JIT code generation.
+ * dfg/DFGSpeculativeJIT.cpp: Added.
+ * dfg/DFGSpeculativeJIT.h: Added.
+ - Used to generate the speculative code path, this make assumptions about
+ operand types to enable optimization.
+ * runtime/Executable.cpp:
+ - Add code to attempt to use the DFG JIT to compile a function, with fallback
+ to the existing JIT.
+ * wtf/Platform.h:
+ - Added compile guards to enable the DFG JIT.
+
+2011-03-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed more cases of DeprecatedPtr (exception, SmallStrings)
+ https://bugs.webkit.org/show_bug.cgi?id=56332
+
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add):
+ (JSC::Identifier::addSlowCase): Use a variable instead of a hard-coded
+ constant, to make this code less brittle.
+
+ * runtime/JSGlobalData.h: Use HeapRoot instead of DeprecatedPtr because
+ this reference is owned and managed directly by the heap.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::substringFromRope):
+ * runtime/JSString.h:
+ (JSC::jsSingleCharacterString):
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::jsString):
+ (JSC::jsStringWithFinalizer):
+ (JSC::jsSubstring):
+ (JSC::jsOwnedString): Use a variable instead of a hard-coded
+ constant, to make this code less brittle.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::rep):
+ (JSC::SmallStringsStorage::SmallStringsStorage):
+ (JSC::SmallStrings::SmallStrings):
+ (JSC::SmallStrings::markChildren):
+ (JSC::SmallStrings::clear):
+ (JSC::SmallStrings::count): Use a variable instead of a hard-coded
+ constant, to make this code less brittle.
+
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::singleCharacterString): Use HeapRoot instead of
+ DeprecatedPtr because these references are owned and managed directly by
+ the heap.
+
+ Stop using FixedArray because we only want a very limited set
+ of classes to be able to use HeapRoot. (Replaced with manual ASSERTs.)
+
+ * runtime/WriteBarrier.h:
+ (JSC::operator==):
+ (JSC::WriteBarrier::WriteBarrier):
+ (JSC::HeapRoot::HeapRoot):
+ (JSC::HeapRoot::operator=): Added HeapRoot, which is allowed to set
+ without write barrier because we assume all HeapRoots are scanned during
+ all GC passes.
+
+2011-03-14 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben and Gavin Barraclough.
+
+ FileSystemWin.cpp needs listDirectory() implementation
+ https://bugs.webkit.org/show_bug.cgi?id=56331
+ <rdar://problem/9126635>
+
+ Give StringConcatenate the ability to deal with const UChar*'s as a String type to append.
+
+ * wtf/text/StringConcatenate.h:
+
+2011-03-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <http://webkit.org/b/56304> REGRESSION(r80892): 100,000+ leaks seen on the build bot
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass): Don't leak any existing entry for the given name if
+ the class definition contains duplicates. This also removes what look to be leaks
+ of the StringImpl instances that are used as keys: the HashMap key type is a RefPtr
+ which retains / releases the instances at the appropriate time, so explicitly calling
+ ref is not necessary.
+
+2011-03-14 Oliver Hunt <oliver@apple.com>
+
+ Fix windows build
+
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::emitLoadInt32):
+ (JSC::JSInterfaceJIT::tagFor):
+ (JSC::JSInterfaceJIT::payloadFor):
+ (JSC::JSInterfaceJIT::intPayloadFor):
+ (JSC::JSInterfaceJIT::intTagFor):
+ (JSC::JSInterfaceJIT::addressFor):
+
+2011-03-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Ensure all values are correctly tagged in the registerfile
+ https://bugs.webkit.org/show_bug.cgi?id=56214
+
+ This patch makes sure that all JSCell pointers written to
+ the registerfile are correctly tagged as JSCells, and replaces
+ raw int usage with the immediate representation.
+
+ For performance, register pressure, and general saneness reasons
+ I've added abstractions for reading and writing the tag
+ and payload of integer registers directly for the JSVALUE64
+ encoding.
+
+ * interpreter/Register.h:
+ (JSC::Register::withInt):
+ (JSC::Register::withCallee):
+ (JSC::Register::operator=):
+ (JSC::Register::i):
+ (JSC::Register::activation):
+ (JSC::Register::function):
+ (JSC::Register::propertyNameIterator):
+ (JSC::Register::scopeChain):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutToCallFrameHeader):
+ (JSC::JIT::emitPutCellToCallFrameHeader):
+ (JSC::JIT::emitPutIntToCallFrameHeader):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_load_varargs):
+ (JSC::JIT::emitSlow_op_load_varargs):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::intPayloadFor):
+ (JSC::JSInterfaceJIT::intTagFor):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::returnJSValue):
+ (JSC::SpecializedThunkJIT::returnDouble):
+ (JSC::SpecializedThunkJIT::returnInt32):
+ (JSC::SpecializedThunkJIT::returnJSCell):
+
+2011-03-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A few Heap-related renames (sans file moves, which should come next)
+ https://bugs.webkit.org/show_bug.cgi?id=56283
+
+ ConservativeSet => ConservativeRoots. "Set" was misleading, since items
+ are not uniqued. Also, "Roots" is more specific about what's in the set.
+
+ MachineStackMarker => MachineThreads. "Threads" is more descriptive of
+ the fact that this class maintains a set of all threads using JSC.
+ "Stack" was misleading, since this class traverses stacks and registers.
+ "Mark" was misleading, since this class doesn't mark anything anymore.
+
+ registerThread => addCurrentThread. "Current" is more specific.
+ unregisterThread => removeCurrentThread. "Current" is more specific.
+
+ "currentThreadRegistrar" => threadSpecific. The only point of this data
+ structure is to register a thread-specific destructor with a pointer to
+ this.
+
+ "mark...Conservatively" => "gather". "Mark" is not true, since these
+ functions don't mark anything. "Conservatively" is redundant, since they
+ take "ConservativeRoots" as an argument.
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+ * JavaScriptCore.exp:
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeRoots::grow):
+ (JSC::ConservativeRoots::add):
+ * runtime/ConservativeSet.h:
+ (JSC::ConservativeRoots::ConservativeRoots):
+ (JSC::ConservativeRoots::~ConservativeRoots):
+ (JSC::ConservativeRoots::size):
+ (JSC::ConservativeRoots::roots):
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::markRoots):
+ * runtime/Heap.h:
+ (JSC::Heap::machineThreads):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::makeUsableFromMultipleThreads):
+ * runtime/MachineStackMarker.cpp:
+ (JSC::MachineThreads::MachineThreads):
+ (JSC::MachineThreads::~MachineThreads):
+ (JSC::MachineThreads::makeUsableFromMultipleThreads):
+ (JSC::MachineThreads::addCurrentThread):
+ (JSC::MachineThreads::removeThread):
+ (JSC::MachineThreads::removeCurrentThread):
+ (JSC::MachineThreads::gatherFromCurrentThreadInternal):
+ (JSC::MachineThreads::gatherFromCurrentThread):
+ (JSC::MachineThreads::gatherFromOtherThread):
+ (JSC::MachineThreads::gatherConservativeRoots):
+ * runtime/MachineStackMarker.h:
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::append):
+
+2011-03-13 David Kilzer <ddkilzer@apple.com>
+
+ BUILD FIX for armv7 after r80969
+
+ Bug 56270 - The JIT 'friend's many classes in JSC; start unwinding this.
+ <https://bugs.webkit.org/show_bug.cgi?id=56270>
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load32): Made void* address argument
+ const.
+ (JSC::MacroAssemblerARMv7::store32): Ditto.
+
+2011-03-13 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix the Mac build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Make sure to forward
+ ConervativeSet.h, since it's now visible when compiling other projects.
+
+2011-03-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed another case of DeprecatedPtr (ConservativeSet)
+ https://bugs.webkit.org/show_bug.cgi?id=56281
+
+ The ConservativeSet is an internal data structure used during marking,
+ so direct pointers are fine.
+
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeSet::grow):
+ * runtime/ConservativeSet.h: Added some accessors, for use by MarkStack::append.
+ (JSC::ConservativeSet::~ConservativeSet): Fixed a typo where we calculated
+ the size of the set based on sizeof(DeprecatedPtr<T>*) instead of
+ sizeof(DeprecatedPtr<T>). I'm not sure if this had real-world implications or not.
+ (JSC::ConservativeSet::size):
+ (JSC::ConservativeSet::set): Use direct pointers, as stated above.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::append): Created a special case of append for
+ ConservativeSet. I didn't want to add back a generic "append JSCell*"
+ function, since other class might start using that wrong. (In the end,
+ this function might go away, since the Heap will want to do something
+ slightly more interesting with the conservative set, but this is OK for
+ now.)
+
+2011-03-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed another case of DeprecatedPtr (PutPropertySlot)
+ https://bugs.webkit.org/show_bug.cgi?id=56278
+
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::setExistingProperty):
+ (JSC::PutPropertySlot::setNewProperty):
+ (JSC::PutPropertySlot::base): Direct pointer is fine for PutPropertySlot,
+ since it's a stack-allocated temporary.
+
+2011-03-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed one case of DeprecatedPtr (ScopeChainIterator)
+ https://bugs.webkit.org/show_bug.cgi?id=56277
+
+ * runtime/ScopeChain.h: Direct pointer is fine for ScopeChainIterator,
+ since it's a stack-allocated temporary.
+
+2011-03-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 56273 - Add three operand forms to MacroAssember operations.
+
+ Adding for X86(_64) for now, should be rolled out to other backends as necessary.
+ These may allow more efficient code generation in some cases, avoiding the need
+ for unnecessary register-register move instructions.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Jump::link):
+ (JSC::AbstractMacroAssembler::Jump::linkTo):
+ - marked these methods const.
+ (JSC::AbstractMacroAssembler::Jump::isSet):
+ - add a method to check whether a Jump object has been set to
+ reference an instruction, or is in a null, unset state.
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::FunctionPtr::FunctionPtr):
+ - add non-explicit constructor, for FunctionPtr's to C/C++ functions.
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::and32):
+ (JSC::MacroAssemblerX86Common::lshift32):
+ (JSC::MacroAssemblerX86Common::or32):
+ (JSC::MacroAssemblerX86Common::rshift32):
+ (JSC::MacroAssemblerX86Common::urshift32):
+ (JSC::MacroAssemblerX86Common::xor32):
+ (JSC::MacroAssemblerX86Common::moveDouble):
+ (JSC::MacroAssemblerX86Common::addDouble):
+ (JSC::MacroAssemblerX86Common::divDouble):
+ (JSC::MacroAssemblerX86Common::subDouble):
+ (JSC::MacroAssemblerX86Common::mulDouble):
+ (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerX86Common::branchTest32):
+ (JSC::MacroAssemblerX86Common::branchTest8):
+ (JSC::MacroAssemblerX86Common::branchAdd32):
+ (JSC::MacroAssemblerX86Common::branchMul32):
+ (JSC::MacroAssemblerX86Common::branchSub32):
+ - add three operand forms of these instructions.
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::addDouble):
+ (JSC::MacroAssemblerX86_64::convertInt32ToDouble):
+ (JSC::MacroAssemblerX86_64::loadPtr):
+ (JSC::MacroAssemblerX86_64::branchTestPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::JmpSrc::isSet):
+ - add a method to check whether a JmpSrc object has been set to
+ reference an instruction, or is in a null, unset state.
+ (JSC::X86Assembler::movsd_rr):
+ - added FP register-register move.
+ (JSC::X86Assembler::linkJump):
+ - Add an assert to check jumps aren't linked more than once.
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadInt32ToDouble):
+ - load integers to the FPU via regsiters on x86-64.
+
+2011-03-13 Gavin Barraclough <barraclough@apple.com>
+
+ ARM build fix.
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::load32):
+
+2011-03-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 56270 - The JIT 'friend's many classes in JSC; start unwinding this.
+
+ The JIT need to 'friend' other classes in order to be able to calculate offsets
+ of various properties, or the absolute addresses of members within specific objects,
+ in order to JIT generate code that will access members within the class when run.
+
+ Instead of using friends in these cases, switch to providing specific accessor
+ methods to provide this information. In the case of offsets, these can be static
+ functions, and in the case of pointers to members within a specific object these can
+ be const methods returning pointers to const values, to prevent clients from
+ modifying values otherwise encapsulated within classes.
+
+ * bytecode/SamplingTool.h:
+ * interpreter/Register.h:
+ * interpreter/RegisterFile.h:
+ * runtime/JSArray.h:
+ * runtime/JSCell.h:
+ * runtime/JSTypeInfo.h:
+ * runtime/JSVariableObject.h:
+ * runtime/Structure.h:
+ * wtf/RefCounted.h:
+ - Change these classes to no longer friend the JIT, add accessors for member offsets.
+ * jit/JIT.cpp:
+ * jit/JITCall32_64.cpp:
+ * jit/JITInlineMethods.h:
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp:
+ * jit/JITPropertyAccess.cpp:
+ * jit/JITPropertyAccess32_64.cpp:
+ - Change the JIT to use class accessors, rather than taking object ofsets directly.
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/MacroAssemblerX86_64.h:
+ * assembler/X86Assembler.h:
+ - Since the accessors for objects members return const pointers to retain encapsulation,
+ methods generating code with absolute addresses must be able to handle const pointers
+ (the JIT doesn't write to these values, do dies treat the pointer to value as const
+ from within the C++ code of the JIT, if not at runtime!).
+
+2011-03-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r80919.
+ http://trac.webkit.org/changeset/80919
+ https://bugs.webkit.org/show_bug.cgi?id=56251
+
+ all windows bots failed to compile this change (Requested by
+ loislo on #webkit).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/StructureStubInfo.cpp:
+ * interpreter/Register.h:
+ (JSC::Register::withInt):
+ (JSC::Register::withCallee):
+ (JSC::Register::operator=):
+ (JSC::Register::i):
+ (JSC::Register::activation):
+ (JSC::Register::function):
+ (JSC::Register::propertyNameIterator):
+ (JSC::Register::scopeChain):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutToCallFrameHeader):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_load_varargs):
+ (JSC::JIT::emitSlow_op_load_varargs):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::payloadFor):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::returnJSValue):
+ (JSC::SpecializedThunkJIT::returnDouble):
+ (JSC::SpecializedThunkJIT::returnInt32):
+ (JSC::SpecializedThunkJIT::returnJSCell):
+ * runtime/ArgList.cpp:
+ * runtime/DateConversion.cpp:
+ * runtime/GCActivityCallbackCF.cpp:
+ * runtime/Identifier.cpp:
+ * runtime/JSActivation.h:
+ (JSC::asActivation):
+ * runtime/JSLock.cpp:
+ * runtime/JSNumberCell.cpp:
+ * runtime/JSObject.h:
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSValue.h:
+ * runtime/JSZombie.cpp:
+ * runtime/MarkedBlock.cpp:
+ * runtime/MarkedSpace.cpp:
+ * runtime/PropertyNameArray.cpp:
+ * runtime/ScopeChain.h:
+ (JSC::ExecState::globalThisValue):
+ * wtf/DateMath.cpp:
+
+2011-03-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Ensure all values are correctly tagged in the registerfile
+ https://bugs.webkit.org/show_bug.cgi?id=56214
+
+ This patch makes sure that all JSCell pointers written to
+ the registerfile are correctly tagged as JSCells, and replaces
+ raw int usage with the immediate representation.
+
+ For performance, register pressure, and general saneness reasons
+ I've added abstractions for reading and writing the tag
+ and payload of integer registers directly for the JSVALUE64
+ encoding.
+
+ * interpreter/Register.h:
+ (JSC::Register::withInt):
+ (JSC::Register::withCallee):
+ (JSC::Register::operator=):
+ (JSC::Register::i):
+ (JSC::Register::activation):
+ (JSC::Register::function):
+ (JSC::Register::propertyNameIterator):
+ (JSC::Register::scopeChain):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutToCallFrameHeader):
+ (JSC::JIT::emitPutCellToCallFrameHeader):
+ (JSC::JIT::emitPutIntToCallFrameHeader):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_load_varargs):
+ (JSC::JIT::emitSlow_op_load_varargs):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::intPayloadFor):
+ (JSC::JSInterfaceJIT::intTagFor):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::returnJSValue):
+ (JSC::SpecializedThunkJIT::returnDouble):
+ (JSC::SpecializedThunkJIT::returnInt32):
+ (JSC::SpecializedThunkJIT::returnJSCell):
+
+2011-03-11 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Introduce project_dir variable and make paths a whole lot saner. Ok, a little bit saner.
+ https://bugs.webkit.org/show_bug.cgi?id=56231
+
+ * JavaScriptCore.gypi: Added project_dir variable.
+ * gyp/JavaScriptCore.gyp: Changed to use project_dir, rather than DEPTH/JavaScriptCore.
+ * gyp/generate-dtrace-header.sh: Changed to use project_dir.
+
+2011-03-11 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Start using derived sources correctly and link minidom with JavaScriptCore gyp project.
+ https://bugs.webkit.org/show_bug.cgi?id=56217
+
+ * gyp/JavaScriptCore.gyp: Added derived source files and passing of shared directory
+ to the scripts.
+ * gyp/generate-derived-sources.sh: Changed to use passed directory.
+ * gyp/generate-dtrace-header.sh: Ditto.
+
+2011-03-11 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/8955589> Adopt AVFoundation media back end on Lion.
+
+ No new tests, existing media tests cover this.
+
+ * JavaScriptCore.exp: Export cancelCallOnMainThread
+ * wtf/Platform.h: Define WTF_USE_AVFOUNDATION.
+
+2011-03-11 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Tweak dylib paths and add dtrace header generation action to JavaScriptCore gyp project.
+ https://bugs.webkit.org/show_bug.cgi?id=56207
+
+ * JavaScriptCore.gypi: Added Tracing.d to the sources.
+ * gyp/generate-dtrace-header.sh: Added.
+ * gyp/JavaScriptCore.gyp: Updated dylib paths (now the project can see them),
+ and added DTrace header generating step.
+
+2011-03-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix allocation of native function with a cached thunk
+ https://bugs.webkit.org/show_bug.cgi?id=56127
+
+ Fix this race condition found while fixing zombies.
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::clearWeakPointers):
+ * runtime/Heap.cpp:
+ (JSC::Heap::reset):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::markChildren):
+ * runtime/JSValue.h:
+ (JSC::JSValue::decode):
+ * runtime/JSZombie.cpp:
+ (JSC::JSZombie::leakedZombieStructure):
+ * runtime/JSZombie.h:
+ (JSC::JSZombie::createStructure):
+ * runtime/MarkedBlock.cpp:
+
+2011-03-10 Luiz Agostini <luiz.agostini@openbossa.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] fast/workers/stress-js-execution.html is crashing on Qt bot (intermittently)
+ https://bugs.webkit.org/show_bug.cgi?id=33008
+
+ Defining WTF_USE_PTHREAD_BASED_QT=1 for platforms where QThread uses pthread internally.
+ Symbian is excluded because pthread_kill does not work on it. Mac is excluded because
+ it has its own ways to do JSC threading.
+
+ Defining WTF_USE_PTHREADS inside MachineStackMarker.cpp if USE(PTHREAD_BASED_QT) is true.
+
+ * runtime/MachineStackMarker.cpp:
+ * wtf/Platform.h:
+
+2011-03-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 56077 - ES5 conformance issues with RegExp.prototype
+
+ There are three issues causing test failures in sputnik.
+
+ (1) lastIndex should be converted at the point it is used, not the point it is set (this is visible if valueOf is overridden).
+ (2) The 'length' property of the test/exec functions should be 1.
+ (3) If no input is specified, the input to test()/exec() is "undefined" (i.e. ToString(undefined)) - not RegExp.input.
+
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::markChildren):
+ - Added to mark lastIndex
+ (JSC::regExpObjectLastIndex):
+ (JSC::setRegExpObjectLastIndex):
+ - lastIndex is now stored as a JSValue.
+ (JSC::RegExpObject::match):
+ - Use accessor methods to get/set lastIndex, add fast case for isUInt32 (don't convert to double).
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::setLastIndex):
+ (JSC::RegExpObject::setLastIndex):
+ - Set lastIndex, either from a size_t or a JSValue.
+ (JSC::RegExpObject::getLastIndex):
+ - Get lastIndex.
+ (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
+ - Initialize as a JSValue.
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ - Add test/exec properties with length 1.
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ - Do not read RegExp.input if none is provided.
+ * tests/mozilla/js1_2/regexp/RegExp_input.js:
+ * tests/mozilla/js1_2/regexp/RegExp_input_as_array.js:
+ - Update these tests (they relied on non-ES5 behaviour).
+
+2011-03-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Rolled back in 80277 and 80280 with event handler layout test failures fixed.
+ https://bugs.webkit.org/show_bug.cgi?id=55653
+
+ The failures were caused by a last minute typo: assigning to currentEvent
+ instead of m_currentEvent.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecompiler/BytecodeGenerator.cpp:
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp:
+ * runtime/Arguments.h:
+ * runtime/JSActivation.cpp:
+ * runtime/JSActivation.h:
+ * runtime/JSCell.h:
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h:
+ * runtime/JSObject.cpp:
+ * runtime/JSStaticScopeObject.cpp:
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSVariableObject.h:
+ * runtime/MarkedSpace.cpp:
+ * runtime/MarkedSpace.h:
+
+2011-03-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ jquery/manipulation.html fails after r80598
+ https://bugs.webkit.org/show_bug.cgi?id=56019
+
+ When linking a call, codeblock now takes ownership of the linked function
+ This removes the need for unlinking, and thus the incorrectness that was
+ showing up in these tests.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CallLinkInfo::CallLinkInfo):
+ (JSC::CallLinkInfo::setUnlinked):
+ (JSC::CodeBlock::addCaller):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::linkCall):
+ (JSC::JIT::linkConstruct):
+ * jit/JIT.h:
+ * runtime/Executable.cpp:
+ * runtime/Executable.h:
+
+2011-03-09 Daniel Bates <dbates@rim.com>
+
+ Attempt to fix the WinCE build after changeset 80684 <http://trac.webkit.org/changeset/80684>
+ (Bug #56041<https://bugs.webkit.org/show_bug.cgi?id=56041>).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Substitute variable callFrame for exec in call to createSyntaxError().
+
+2011-03-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 56041 - RexExp constructor should only accept flags "gim"
+ Fix for issues introduced in r80667.
+
+ Invalid flags to a RegExp literal are a late syntax error!
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addRegExp):
+ - Pass a PassRefPtr<RegExp>
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::addRegExp):
+ (JSC::BytecodeGenerator::emitNewRegExp):
+ * bytecompiler/BytecodeGenerator.h:
+ - Pass a PassRefPtr<RegExp>
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ - Should not be ASSERTing that the flags are valid - this is a late(er) error.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ - Need to check for error from RegExp constructor.
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ - Need to check for error from RegExp constructor.
+ * runtime/RegExp.h:
+ (JSC::RegExp::isValid):
+ - Make isValid check that the regexp was created with valid flags.
+ * runtime/RegExpKey.h:
+ - Since we'll not create RegExp objects with invalid flags, separate out the deleted value.
+
+2011-03-09 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix part 2.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-03-09 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix part 1.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-03-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 56041 - RexExp constructor should only accept flags "gim"
+ We also should be passing the flags around as a bitfield rather than a string,
+ and should not have redundant, incompatible code for converting the string to a bitfield!
+
+ * JavaScriptCore.exp:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ - Need to parse flags string to enum.
+ * runtime/RegExp.cpp:
+ (JSC::regExpFlags):
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ - Add method to parse flags string to enum, change constructor/create args to take enum.
+ * runtime/RegExp.h:
+ (JSC::RegExp::global):
+ (JSC::RegExp::ignoreCase):
+ (JSC::RegExp::multiline):
+ - Change to use new enum values.
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ * runtime/RegExpCache.h:
+ - Changed to use regExpFlags enum instead of int/const UString&.
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ - Add use new enum parsing, check for error.
+ * runtime/RegExpKey.h:
+ (JSC::RegExpKey::RegExpKey):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ - Pass NoFlags value instead of empty string.
+ (JSC::regExpProtoFuncCompile):
+ - Add use new enum parsing, check for error.
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ - Pass NoFlags value instead of empty string.
+
+2011-03-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Bug 55994 - Functions on Array.prototype should check length first.
+ These methods are designed to work on generic objects too, and if 'length'
+ is a getter that throws an exception, ensure this is correctly thrown
+ (even if other exceptions would be thrown, too).
+
+ Make the length check the first thing we do.
+ This change shows a progression on SunSpider on my machine, but this is likely bogus.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (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):
+
+2011-03-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make CodeBlock GC write barrier safe
+ https://bugs.webkit.org/show_bug.cgi?id=55910
+
+ In order to make CodeBlock WriteBarrier safe it was necessary
+ to make it have a single GC owner, and for that reason I have
+ made ExecutableBase a GC allocated object. This required
+ updating their creation routines as well as all sites that hold
+ a reference to them. GC objects that held Executable's have been
+ converted to WriteBarriers, and all other sites now use Global<>.
+
+ As an added benefit this gets rid of JSGlobalData's list of
+ GlobalCodeBlocks.
+
+ Perf testing shows a 0.5% progression on v8, vs. a 0.3% regression
+ on SunSpider. Given none of the tests that show regressions
+ demonstrate a regression on their own, and sampling shows up nothing.
+ I suspect we're just getting one or two additional gc passes at
+ the end of the run.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::EvalCodeCache::markAggregate):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::ownerExecutable):
+ (JSC::CodeBlock::addConstant):
+ (JSC::CodeBlock::constantRegister):
+ (JSC::CodeBlock::getConstant):
+ (JSC::CodeBlock::addFunctionDecl):
+ (JSC::CodeBlock::addFunctionExpr):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::ExecState::r):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecode/SamplingTool.h:
+ (JSC::ScriptSampleRecord::ScriptSampleRecord):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::addConstantValue):
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadDouble):
+ (JSC::JIT::emitLoadInt32ToDouble):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ (JSC::JITThunks::hostFunctionStub):
+ (JSC::JITThunks::clearHostFunctionStubs):
+ * jit/JITStubs.h:
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::~FunctionExecutable):
+ (JSC::EvalExecutable::markChildren):
+ (JSC::ProgramExecutable::markChildren):
+ (JSC::FunctionExecutable::markChildren):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::createStructure):
+ (JSC::NativeExecutable::create):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::VPtrHackExecutable::VPtrHackExecutable):
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::EvalExecutable::create):
+ (JSC::EvalExecutable::createStructure):
+ (JSC::ProgramExecutable::create):
+ (JSC::ProgramExecutable::createStructure):
+ (JSC::FunctionExecutable::create):
+ (JSC::FunctionExecutable::createStructure):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/Heap.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::markRoots):
+ * runtime/Heap.h:
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ (JSC::JSActivation::markChildren):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * runtime/JSCell.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::markChildren):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs):
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::getHostFunction):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/JSObject.cpp:
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ * runtime/JSZombie.cpp:
+ (JSC::JSZombie::leakedZombieStructure):
+ * runtime/JSZombie.h:
+ (JSC::JSZombie::createStructure):
+ * runtime/MarkedSpace.h:
+
+2011-03-07 Andy Estes <aestes@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ REGRESSION (r79060): Timestamp is missing from tweets in twitter.
+ https://bugs.webkit.org/show_bug.cgi?id=55228
+
+ A change to the date parser to handle the case where the year is
+ specified before the time zone inadvertently started accepting strings
+ such as '+0000' as valid years. Those strings actually represent time
+ zones in an offset of hours and minutes from UTC, not years.
+
+ * wtf/DateMath.cpp:
+ (WTF::parseDateFromNullTerminatedCharacters): If the current character
+ in dateString is '+' or '-', do not try to parse the next token as a
+ year.
+
+2011-03-06 Yuta Kitamura <yutak@chromium.org>
+
+ Reviewed by Kent Tamura.
+
+ Add SHA-1 for new WebSocket protocol
+ https://bugs.webkit.org/show_bug.cgi?id=55039
+
+ The code is based on Chromium's portable SHA-1 implementation
+ (src/base/sha1_portable.cc). Modifications were made in order
+ to make the code comply with WebKit coding style.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/MD5.cpp:
+ (WTF::MD5::MD5):
+ * wtf/SHA1.cpp: Added.
+ (WTF::testSHA1): This function will be run the first time SHA1
+ constructor is called. This function computes a few hash values
+ and checks the results in debug builds. However, constructor is
+ probably not a good place to run these tests, so we need to find
+ a good place for it (bug 55853).
+ (WTF::expectSHA1):
+ (WTF::f):
+ (WTF::k):
+ (WTF::rotateLeft):
+ (WTF::SHA1::SHA1):
+ (WTF::SHA1::addBytes):
+ (WTF::SHA1::computeHash):
+ (WTF::SHA1::finalize):
+ (WTF::SHA1::processBlock):
+ (WTF::SHA1::reset):
+ * wtf/SHA1.h: Added.
+ (WTF::SHA1::addBytes):
+ * wtf/wtf.pri:
+
+2011-03-05 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add Derived Sources to WebCore GYP build
+ https://bugs.webkit.org/show_bug.cgi?id=55813
+
+ Rename the action to be friendlier.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-04 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Need symbian version of cryptographicallyRandomValuesFromOS
+ https://bugs.webkit.org/show_bug.cgi?id=55782
+
+ Implement Symbian version of cryptographicallyRandomValuesFromOS
+
+ * wtf/OSRandomSource.cpp:
+ (WTF::cryptographicallyRandomValuesFromOS):
+
+2011-03-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 55815 - Should throw an exception from JSObject::defineOwnProperty if !isExtensible().
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineOwnProperty):
+ Add missing check.
+
+2011-03-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by olliej.
+
+ Bug 54945 - The web page hangs towards the end of page load in Interpreter enabled javascript code in the latest webkit trunk.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (1) don't infinite loop.
+ (2) goto 1.
+
+2011-03-04 Gavin Barraclough <barraclough@apple.com>
+
+ cmake build fix.
+
+ * CMakeLists.txt:
+
+2011-03-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add Copy Files step to JavaScriptCore GYP build for apitest and minidom
+ https://bugs.webkit.org/show_bug.cgi?id=55798
+
+ * JavaScriptCore.gypi:
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Remove unneeded round-trips through ../Source in the Chromium GYP build
+ https://bugs.webkit.org/show_bug.cgi?id=55795
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2011-03-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Use target_defaults to reduce boilerplate in GYP build system
+ https://bugs.webkit.org/show_bug.cgi?id=55790
+
+ Instead of setting up the configuration in each target, just defer to
+ target_defaults. Also, removed a define that was redundant with the
+ xcconfig.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 55736 - Implement seal/freeze/preventExtensions for normal object types.
+ Provide basic functionallity from section 15.2.4 of ECMA-262.
+ This support will need expanding to cover arrays, too.
+
+ Shows a 0.5% progression on SunSpidey, this seems to be due to changing
+ ObjectConstructor to use a static table.
+
+ * DerivedSources.make:
+ * JavaScriptCore.exp:
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::objectConstructorTable):
+ Add a static table for ObjectConstructor.
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ Add a static table for ObjectConstructor.
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ Add a static table for ObjectConstructor.
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::seal):
+ (JSC::JSObject::freeze):
+ (JSC::JSObject::preventExtensions):
+ Transition the object's structure.
+ (JSC::JSObject::defineOwnProperty):
+ Check isExtensible.
+ * runtime/JSObject.h:
+ (JSC::JSObject::isSealed):
+ (JSC::JSObject::isFrozen):
+ (JSC::JSObject::isExtensible):
+ These wrap method on structure.
+ (JSC::JSObject::putDirectInternal):
+ Check isExtensible.
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::ObjectConstructor::getOwnPropertySlot):
+ (JSC::ObjectConstructor::getOwnPropertyDescriptor):
+ Change ObjectConstructor to use a static table.
+ (JSC::objectConstructorSeal):
+ (JSC::objectConstructorFreeze):
+ (JSC::objectConstructorPreventExtensions):
+ (JSC::objectConstructorIsSealed):
+ (JSC::objectConstructorIsFrozen):
+ (JSC::objectConstructorIsExtensible):
+ Add new methods on Object.
+ * runtime/ObjectConstructor.h:
+ (JSC::ObjectConstructor::createStructure):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ init/propagate m_preventExtensions
+ (JSC::Structure::sealTransition):
+ (JSC::Structure::freezeTransition):
+ (JSC::Structure::preventExtensionsTransition):
+ transition the structure, materializing the property map, setting m_preventExtensions & changing attributes.
+ (JSC::Structure::isSealed):
+ (JSC::Structure::isFrozen):
+ check attributes to detect if object is sealed/frozen.
+ * runtime/Structure.h:
+ (JSC::Structure::isExtensible):
+ checks the m_preventExtensions flag.
+
+2011-03-04 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Jon Honeycutt.
+
+ Adopt VersionStamper tool for Windows WebKit DLLs
+ https://bugs.webkit.org/show_bug.cgi?id=55784
+ <rdar://problem/9021273>
+
+ We now use a tool to stamp the version number onto the Apple WebKit DLLs
+ during the post-build step.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: Removed.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd:
+
+2011-03-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ JavaScriptCore GYP build should use a header map
+ https://bugs.webkit.org/show_bug.cgi?id=55712
+
+ This patch moves the os-win32 files into their own variable so that we
+ can use a header map in the Apple Mac Xcode build. The problem is that
+ the header map searches the whole project rather than just the files
+ included in a given target. Another solution to this problem is to
+ make GYP smarter about filtering out what files are added to the
+ project file.
+
+ * JavaScriptCore.gypi:
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-03 Ryosuke Niwa <rniwa@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Remove LOOSE_PASS_OWN_ARRAY_PTR from PassOwnArrayPtr.h
+ https://bugs.webkit.org/show_bug.cgi?id=55554
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::copyGlobalsTo): Pass nullptr instead of 0.
+ (JSC::JSGlobalObject::resizeRegisters): Ditto; also use OwnArrayPtr instead of a raw pointer.
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::addStaticGlobals): Ditto.
+ * wtf/PassOwnArrayPtr.h: Removed #define LOOSE_PASS_OWN_ARRAY_PTR
+ (WTF::PassOwnArrayPtr::PassOwnArrayPtr): Added a constructor that takes nullptr_t.
+
+2011-03-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add jsc to JavaScriptCore GYP build
+ https://bugs.webkit.org/show_bug.cgi?id=55711
+
+ * JavaScriptCore.gypi:
+ - Move jsc.cpp into jsc_files because it's really part of the jsc
+ target.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ - Remove extraneous files from the normal jsc build. I probably
+ added these by mistake at some point.
+ * gyp/JavaScriptCore.gyp:
+ - Add the jsc target to the GYP file.
+
+2011-03-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add testapi to JavaScriptCore GYP build
+ https://bugs.webkit.org/show_bug.cgi?id=55707
+
+ The new testapi target is slightly incomplete. There's a resource
+ copying step that we don't quite have yet.
+
+ This patch also cleans up some of the configuration issues in
+ JavaScriptCore.xcodeproj. It seems kind of wordy to repeat these for
+ each target. I suspect there's a more compact way of defining the
+ configurations, but this removes the "Default" configuration, which is
+ progress.
+
+ * JavaScriptCore.gypi:
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Teach JavaScriptCore GYP build about private headers
+ https://bugs.webkit.org/show_bug.cgi?id=55532
+
+ This patch distinguishes between public and private framework headers
+ so that public headers are copied into the Headers directory and
+ private headers are copied into the PrivateHeaders directory.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-03 Geoffrey Garen <ggaren@apple.com>
+
+ Rolled out 80277 and 80280 because they caused event handler layout test
+ failures.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecompiler/BytecodeGenerator.cpp:
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp:
+ * runtime/Arguments.h:
+ * runtime/JSActivation.cpp:
+ * runtime/JSActivation.h:
+ * runtime/JSCell.h:
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h:
+ * runtime/JSObject.cpp:
+ * runtime/JSStaticScopeObject.cpp:
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSVariableObject.h:
+ * runtime/MarkedSpace.cpp:
+ * runtime/MarkedSpace.h:
+
+2011-03-03 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix. Alter order of headers included to make sure windows.h
+ is configured by wx, and skip Posix implementation file we don't use on Win.
+
+ * wscript:
+ * wtf/wx/StringWx.cpp:
+
+2011-03-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ JSVariableObject needs to use WriteBarrier for symboltable property storage
+ https://bugs.webkit.org/show_bug.cgi?id=55698
+
+ Replace the direct usage of Register in JSVariableObject (and descendents)
+ with WriteBarrier. This requires updating the Arguments object to use
+ WriteBarrier as well.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/ArgList.h:
+ (JSC::MarkedArgumentBuffer::initialize):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::markChildren):
+ (JSC::Arguments::copyToRegisters):
+ (JSC::Arguments::fillArgList):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::setActivation):
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::copyRegisters):
+ (JSC::JSActivation::copyRegisters):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::symbolTableGet):
+ (JSC::JSActivation::symbolTablePut):
+ (JSC::JSActivation::symbolTablePutWithAttributes):
+ (JSC::JSActivation::put):
+ (JSC::JSActivation::putWithAttributes):
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::put):
+ (JSC::JSGlobalObject::putWithAttributes):
+ (JSC::JSGlobalObject::markChildren):
+ (JSC::JSGlobalObject::copyGlobalsFrom):
+ (JSC::JSGlobalObject::copyGlobalsTo):
+ (JSC::JSGlobalObject::resizeRegisters):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::setRegisters):
+ (JSC::JSGlobalObject::addStaticGlobals):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::put):
+ (JSC::JSStaticScopeObject::putWithAttributes):
+ * runtime/JSVariableObject.cpp:
+ (JSC::JSVariableObject::symbolTableGet):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::registerAt):
+ (JSC::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
+ (JSC::JSVariableObject::symbolTableGet):
+ (JSC::JSVariableObject::symbolTablePut):
+ (JSC::JSVariableObject::symbolTablePutWithAttributes):
+ (JSC::JSVariableObject::copyRegisterArray):
+ (JSC::JSVariableObject::setRegisters):
+
+2011-03-03 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Removed obsolete symbol.
+
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::getOwnPropertySlot): Don't mark this function
+ inline -- it's virtual.
+
+2011-03-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Moved all variable object storage inline -- upping the object size limit to 1K
+ https://bugs.webkit.org/show_bug.cgi?id=55653
+
+ * JavaScriptCore.exp:
+ * bytecompiler/BytecodeGenerator.cpp:
+ * jit/JITOpcodes.cpp:
+ * runtime/Arguments.h:
+ * runtime/JSActivation.h: Removed out-of-line storage. Changed d-> to m_.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedSpace::sizeClassFor): Added an imprecise size class
+ to accomodate objects up to 1K.
+
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h: Removed out-of-line storage. Changed d-> to m_.
+
+ * runtime/JSObject.cpp: Don't ASSERT that JSFinalObject fills the maximum
+ object size, since it doesn't anymore.
+
+ * runtime/JSStaticScopeObject.cpp:
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSVariableObject.h: Removed out-of-line storage. Changed d-> to m_.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h: Added an imprecise size class to accomodate objects up to 1K.
+
+2011-03-03 Timothy Hatcher <timothy@apple.com>
+
+ Make APIShims usable from WebCore.
+
+ Reviewed by Oliver Hunt.
+
+ * ForwardingHeaders/JavaScriptCore/APIShims.h: Added.
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-03-03 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Begin Characters Optimization Causes YARR Interpreter Errors
+ https://bugs.webkit.org/show_bug.cgi?id=55479
+
+ The addBeginTerm function is removed because it doesn't correctly handle those
+ cases when an "invalid" term has been
+ collected (e.g. CharacterClass). Move the removed function to the
+ setupAlternativeBeginTerms method's switch-case
+ where the non-allowed cases are correctly handled.
+
+ Reenable the Beginning Character Optimization in the YARR Interpreter again.
+
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::YarrPatternConstructor::setupAlternativeBeginTerms):
+ (JSC::Yarr::YarrPattern::compile):
+
+2011-03-02 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit2: Use CFNetwork Sessions API.
+ https://bugs.webkit.org/show_bug.cgi?id=55435
+
+ Add the ability to create a Private Browsing storage session.
+
+ * wtf/Platform.h:
+ Add a new #define for using CF Storage Sessions.
+
+2011-03-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove "register slot" concept from PropertySlot
+ https://bugs.webkit.org/show_bug.cgi?id=55621
+
+ PropertySlot had already stopped storing Register "slots"
+ so this patch is simply removing that api entirely.
+ This exposed a problem in the ProgramNode constructor for
+ BytecodeGenerator where it reads from the registerfile
+ before it has initialised it.
+
+ This bug wasn't a problem before as we were merely testing
+ for property existence rather than the actual value, and
+ used to work because setRegisterSlot didn't check that the
+ provided slot contained an initialised value.
+
+ To get around this issue we now use symbolTableHasProperty
+ to do the symbol table check without trying to read the
+ RegisterFile.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::symbolTableGet):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::symbolTableHasProperty):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::symbolTableGet):
+ * runtime/PropertySlot.h:
+
+2011-03-02 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add feature define for data transfer items
+ https://bugs.webkit.org/show_bug.cgi?id=55510
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2011-03-02 Adam Roben <aroben@apple.com>
+
+ Delete old .res files whenever any .vsprops file changes
+
+ Prospective fix for <http://webkit.org/b/55599> r80079 caused incremental Windows builds to
+ fail
+
+ Reviewed by Tony Chang.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+ (main): Restructured code to loop over a set of file extensions, deleting any old files that
+ have that extension. Now deletes .res files, too. (We previously deleted any file matching
+ *.manifest*, but that turned out to just be the union of *.manifest and *.res.)
+
+2011-03-02 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Teach JavaScriptCore GYP build how to build minidom
+ https://bugs.webkit.org/show_bug.cgi?id=55536
+
+ * JavaScriptCore.gypi:
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-01 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ JavaScriptCore GYP build should copy some headers into the target framework
+ https://bugs.webkit.org/show_bug.cgi?id=55524
+
+ After this patch, all the framework headers are exported as public
+ headers. We need to teach GYP how to handle private headers.
+
+ I struggled to determine how to store the information about whether a
+ header was public, private, or project (i.e., not exported).
+ Generally, the GYPI should just list the files, but it seemed siliy to
+ have an almost duplicated list of files in the GYP file itself. If
+ this design doesn't scale, we might have to revisit it in the future.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * JavaScriptCore.gypi:
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-01 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r80079.
+ http://trac.webkit.org/changeset/80079
+ https://bugs.webkit.org/show_bug.cgi?id=55547
+
+ "Broke the Win debug build?" (Requested by dcheng on #webkit).
+
+ * wtf/Platform.h:
+
+2011-03-01 Daniel Cheng <dcheng@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add feature define for data transfer items
+ https://bugs.webkit.org/show_bug.cgi?id=55510
+
+ * wtf/Platform.h:
+
+2011-03-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Joseph Pecoraro.
+
+ Misaligned memory access in CloneDeserializer on all ARM arch.
+ https://bugs.webkit.org/show_bug.cgi?id=48742
+
+ Add a CPU class for architectures that need aligned addresses
+ for memory access.
+
+ * wtf/Platform.h:
+
+2011-03-01 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add pre- and post-build actions for JavaScriptCore GYP build
+ https://bugs.webkit.org/show_bug.cgi?id=55507
+
+ After this patch, we have all the steps for building the main
+ JavaScriptCore framework except the "copy headers" step, which I'll do
+ next.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-03-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Rolled back in r79627 now that the underlying cause for it crashing is fixed.
+ https://bugs.webkit.org/show_bug.cgi?id=55159
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Heap.cpp:
+ (JSC::Heap::allocateSlowCase):
+ * runtime/Heap.h:
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedSpace::sizeClassFor):
+ (JSC::JSCell::Heap::allocate):
+ (JSC::JSCell::JSCell::operator new):
+ * runtime/MarkedBlock.h:
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::SizeClass::SizeClass):
+
+2011-03-01 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Replace two script phases that do nothing but copy files with copy files build phases.
+
+ This speeds up the build by a few seconds on high-end Mac Pros.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-03-01 David Kilzer <ddkilzer@apple.com>
+
+ Spring cleaning!
+
+ Rubber-stamped by Mark Rowe.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ (Copy Into Framework): Remove "set -x" and its comment.
+
+2011-03-01 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ TinyMCE not working in nightlies
+ https://bugs.webkit.org/show_bug.cgi?id=54978
+
+ Disabling setupBeginChars() to temporarily work arround the test
+ failure. Filed https://bugs.webkit.org/show_bug.cgi?id=55479
+ to track fixing the issue.
+
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::YarrPattern::compile):
+
+2011-02-23 Joseph Pecoraro <joepeck@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Viewport parsing no longer accepts "1.0;" value as valid.
+ https://bugs.webkit.org/show_bug.cgi?id=53705
+
+ Include a didReadNumber parameter to String -> float / double
+ conversion functions. This way, if the "ok" boolean out
+ parameter is false, you can check to see if there in fact
+ was a valid number parsed with garbage at the end. Examples
+ of that would be parsing "123x456" would have ok = false,
+ but didReadNumber = true.
+
+ * JavaScriptCore.exp:
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::toDouble):
+ (WTF::StringImpl::toFloat):
+ * wtf/text/StringImpl.h:
+ * wtf/text/WTFString.cpp:
+ (WTF::String::toDouble):
+ (WTF::String::toFloat):
+ (WTF::charactersToDouble):
+ (WTF::charactersToFloat):
+ * wtf/text/WTFString.h:
+
+2011-02-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Past-the-end writes in VM exceptions (caused crashes in r79627)
+ https://bugs.webkit.org/show_bug.cgi?id=55448
+
+ Some exceptions had the wrong structures, so they misoverestimated their
+ inline storage sizes.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Use the right structure.
+
+ * runtime/JSObject.h:
+ (JSC::JSNonFinalObject::JSNonFinalObject):
+ (JSC::JSFinalObject::JSFinalObject): ASSERT that our structure capacity
+ is correct to verify this doesn't happen again.
+
+2011-03-01 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Clean up the project files and move common options to WebKit.pri.
+
+ * JavaScriptCore.pri: Move options also needed in WebCore into WebKit.pri.
+ * JavaScriptCore.pro: Deduplicate options.
+ * jsc.pro: Ditto.
+
+2011-03-01 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Teach JavaScriptCore GYP build about DEPTH
+ https://bugs.webkit.org/show_bug.cgi?id=55425
+
+ In addition to teaching the JavaScriptCore GYP build about DEPTH, this
+ change overrides the GCC warning configuration to disable a warning
+ that's causing probems in Assertions.cpp. With that warning disabled,
+ JavaScriptCore builds again.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-02-28 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-28 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r79948.
+ http://trac.webkit.org/changeset/79948
+ https://bugs.webkit.org/show_bug.cgi?id=55439
+
+ "caused crashes on the SL release bot" (Requested by ggaren on
+ #webkit).
+
+ * runtime/JSGlobalData.h:
+ * runtime/WriteBarrier.h:
+
+2011-02-28 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig & Darin Adler.
+
+ Bug 55423 - Clean up property tables in Structure
+
+ Encapsulate, reduce duplication of table search code,
+ and reduce the size of the tables (remove the index,
+ just maintain the tables in the correct order).
+
+ Shows a 0.5% - 1% progression on sunspider.
+
+ * JavaScriptCore.exp:
+ * runtime/PropertyMapHashTable.h:
+ (JSC::isPowerOf2):
+ (JSC::nextPowerOf2):
+ bit ops used to calculate table size.
+ (JSC::PropertyMapEntry::PropertyMapEntry):
+ (JSC::PropertyTable::ordered_iterator::operator++):
+ (JSC::PropertyTable::ordered_iterator::operator==):
+ (JSC::PropertyTable::ordered_iterator::operator!=):
+ (JSC::PropertyTable::ordered_iterator::operator*):
+ (JSC::PropertyTable::ordered_iterator::operator->):
+ (JSC::PropertyTable::ordered_iterator::ordered_iterator):
+ implementation of the iterator types
+ (JSC::PropertyTable::PropertyTable):
+ (JSC::PropertyTable::~PropertyTable):
+ constructors take an initial capacity for the table,
+ a table to copy, or both.
+ (JSC::PropertyTable::begin):
+ (JSC::PropertyTable::end):
+ create in-order iterators.
+ (JSC::PropertyTable::find):
+ search the hash table
+ (JSC::PropertyTable::add):
+ add a value to the hash table
+ (JSC::PropertyTable::remove):
+ remove a value from the hash table
+ (JSC::PropertyTable::size):
+ (JSC::PropertyTable::isEmpty):
+ accessors.
+ (JSC::PropertyTable::propertyStorageSize):
+ (JSC::PropertyTable::clearDeletedOffsets):
+ (JSC::PropertyTable::hasDeletedOffset):
+ (JSC::PropertyTable::getDeletedOffset):
+ (JSC::PropertyTable::addDeletedOffset):
+ cache deleted (available) offsets in the property storage array.
+ (JSC::PropertyTable::copy):
+ take a copy of the PropertyTable, potentially expanding the capacity.
+ (JSC::PropertyTable::sizeInMemory):
+ used for DEBUG build statistics
+ (JSC::PropertyTable::reinsert):
+ (JSC::PropertyTable::rehash):
+ (JSC::PropertyTable::tableCapacity):
+ (JSC::PropertyTable::deletedEntryIndex):
+ (JSC::PropertyTable::skipDeletedEntries):
+ (JSC::PropertyTable::table):
+ (JSC::PropertyTable::usedCount):
+ (JSC::PropertyTable::dataSize):
+ (JSC::PropertyTable::sizeForCapacity):
+ (JSC::PropertyTable::canInsert):
+ these methods provide internal implementation.
+ * runtime/Structure.cpp:
+ (JSC::Structure::dumpStatistics):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::get):
+ (JSC::Structure::despecifyFunction):
+ (JSC::Structure::despecifyAllFunctions):
+ (JSC::Structure::put):
+ (JSC::Structure::remove):
+ (JSC::Structure::createPropertyMap):
+ (JSC::Structure::getPropertyNames):
+ (JSC::PropertyTable::checkConsistency):
+ (JSC::Structure::checkConsistency):
+ factored out code to PropertyMapHashTable.h
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageSize):
+ (JSC::Structure::isEmpty):
+ (JSC::Structure::get):
+ factored out code to PropertyMapHashTable.h
+
+2011-02-28 Xan Lopez <xlopez@igalia.com>
+
+ Another fix build :(
+
+ Fix typo.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::freePlatformThreadRegisters):
+
+2011-02-28 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed build fix for Snow Leopard.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::freePlatformThreadRegisters):
+
+2011-02-28 Alejandro G. Castro <alex@igalia.com>
+
+ Unreviewed, fix SnowLeopard compilation after r79952.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::freePlatformThreadRegisters):
+
+2011-02-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <http://webkit.org/b/55430> OwnArrayPtr.h's LOOSE_OWN_ARRAY_PTR results in link errors.
+
+ * wtf/OwnArrayPtr.h:
+ (WTF::::set): Implement OwnArrayPtr::set.
+
+2011-02-28 Martin Zoubek <martin.zoubek@acision.com> and Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Multithread support for JSC on UNIX
+ https://bugs.webkit.org/show_bug.cgi?id=26838
+
+ Implement suspendThread() and resumeThread() for systems with
+ pthread.h using thread signal handler.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::pthreadSignalHandlerSuspendResume):
+ (JSC::MachineStackMarker::Thread::Thread):
+ (JSC::getCurrentPlatformThread):
+ (JSC::suspendThread):
+ (JSC::resumeThread):
+ (JSC::getPlatformThreadRegisters):
+ (JSC::otherThreadStackPointer):
+ (JSC::freePlatformThreadRegisters):
+ (JSC::MachineStackMarker::markOtherThreadConservatively):
+ * wtf/Platform.h: Added Gtk port to use
+ ENABLE_JSC_MULTIPLE_THREADS.
+
+2011-02-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Stop using DeprecatedPtr for the global exception slot
+ https://bugs.webkit.org/show_bug.cgi?id=55424
+
+ Create GCRootPtr to signify that the exception slot is
+ a gcroot, and so is exempt from the usual writebarrier
+ restrictions.
+
+ * runtime/JSGlobalData.h:
+ * runtime/WriteBarrier.h:
+ (JSC::GCRootPtr::GCRootPtr):
+ (JSC::GCRootPtr::operator=):
+
+2011-02-28 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Use more xcconfig files in JavaScriptCore gyp build
+ https://bugs.webkit.org/show_bug.cgi?id=55391
+
+ The GYP experts tell me that we have have a total of two xcconfig
+ files: one for the xcodeproj as a whole and one for each target. This
+ patch uses that technique to re-use the existing xcconfig files and
+ eliminate the duplication.
+
+ Technically, this patch introduces some build errors because the
+ xcconfig files assume that the xcodeproj file is one level higher in
+ the directory hierarchy. Specifically, the xcodeproj file can no
+ longer find the Info.plist or the prefix header. I plan to fix that in
+ a subsequent patch.
+
+ Also, this patch introduces the Release and Production configurations,
+ which should work correctly now.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-02-28 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ Add symbol to export.
+
+2011-02-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make ScopeChainNode GC allocated
+ https://bugs.webkit.org/show_bug.cgi?id=55283
+
+ Simplify lifetime and other issues with the scopechain
+ by making it gc allocated. This allows us to simplify
+ function exit and unwinding, as well as making the
+ current iterative refcounting go away.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::createActivation):
+ * bytecode/StructureStubInfo.cpp:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ * bytecompiler/BytecodeGenerator.h:
+ * debugger/Debugger.cpp:
+ (JSC::Recompiler::operator()):
+ * debugger/DebuggerCallFrame.h:
+ (JSC::DebuggerCallFrame::scopeChain):
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/CallFrame.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::depth):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::emit_op_ret):
+ (JSC::JIT::emit_op_ret_object_or_this):
+ (JSC::JIT::compileOpCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_end):
+ (JSC::JIT::emit_op_ret):
+ (JSC::JIT::emit_op_ret_object_or_this):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_end):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * runtime/ArgList.cpp:
+ * runtime/Completion.cpp:
+ (JSC::evaluate):
+ * runtime/Completion.h:
+ * runtime/DateConversion.cpp:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/GCActivityCallbackCF.cpp:
+ * runtime/Identifier.cpp:
+ * runtime/JSCell.h:
+ * runtime/JSChunk.cpp: Added.
+ * runtime/JSChunk.h: Added.
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::markChildren):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::getOwnPropertySlot):
+ (JSC::JSFunction::getConstructData):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::scope):
+ (JSC::JSFunction::setScope):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::globalScopeChain):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/JSLock.cpp:
+ * runtime/JSNumberCell.cpp:
+ * runtime/JSZombie.cpp:
+ * runtime/MarkedBlock.cpp:
+ * runtime/MarkedSpace.cpp:
+ * runtime/PropertyNameArray.cpp:
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ (JSC::ScopeChainNode::localDepth):
+ (JSC::ScopeChainNode::markChildren):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::ScopeChainNode):
+ (JSC::ScopeChainNode::createStructure):
+ (JSC::ScopeChainNode::push):
+ (JSC::ScopeChainNode::pop):
+ (JSC::ScopeChainIterator::ScopeChainIterator):
+ (JSC::ScopeChainIterator::operator*):
+ (JSC::ScopeChainIterator::operator->):
+ (JSC::ScopeChainIterator::operator++):
+ (JSC::ScopeChainNode::begin):
+ (JSC::ScopeChainNode::end):
+ (JSC::ExecState::globalData):
+ (JSC::ExecState::lexicalGlobalObject):
+ (JSC::ExecState::globalThisValue):
+ * runtime/ScopeChainMark.h:
+ * wtf/DateMath.cpp:
+
+2011-02-27 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Implement WTF::randomNumber in terms of WTF::cryptographicallyRandomNumber when possible
+ https://bugs.webkit.org/show_bug.cgi?id=55326
+
+ Currently, randomNumber does a bunch of platform-specific work that to
+ get a cryptographic randomness when available. Instead, we should use
+ cryptographicallyRandomNumber, which abstracts this work.
+ Unfortunately, we can't remove all of the WTF::randomNumber
+ implementation because not every port has access to cryptographically
+ random numbers.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+
+2011-02-27 Benjamin Poulain <ikipou@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ Eliminate DeprecatedPtrList from RenderBlock
+ https://bugs.webkit.org/show_bug.cgi?id=54972
+
+ Add methods find() and contains() using an adaptor to ListHashSet.
+ Those method are like the one of HashSet, they allow to find objects
+ based on a different key than the one used to define the set.
+
+ Add convenience methods for direct access to the head and tail of the list.
+ Those methods are providing similar API/behavior as Vector.
+
+ * wtf/ListHashSet.h:
+ (WTF::::first):
+ (WTF::::last):
+ (WTF::::removeLast):
+ (WTF::ListHashSetTranslatorAdapter::hash):
+ (WTF::ListHashSetTranslatorAdapter::equal):
+ (WTF::::find):
+ (WTF::::contains):
+
+2011-02-26 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Add support for DragonFly BSD
+ https://bugs.webkit.org/show_bug.cgi?id=54407
+
+ DragonFly BSD is based on FreeBSD, so handle it like FreeBSD.
+
+ * wtf/Platform.h:
+
+2011-02-26 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ JavaScriptCore should use the xcconfig file instead of importing that information into GYP
+ https://bugs.webkit.org/show_bug.cgi?id=55282
+
+ Technically, this breaks the build because I had removed one of the
+ warnings in this config file, but this change seems like an
+ improvement.
+
+ * gyp/JavaScriptCore.gyp:
+
+2011-02-26 Thouraya ANDOLSI <thouraya.andolsi@st.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ SH4 JIT SUPPORT
+ https://bugs.webkit.org/show_bug.cgi?id=44329
+
+ Provide an ExecutableAllocater::cacheFlush() implementation for
+ Linux/SH4.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2011-02-25 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r79627.
+ http://trac.webkit.org/changeset/79627
+ https://bugs.webkit.org/show_bug.cgi?id=55274
+
+ broke worker tests (Requested by olliej on #webkit).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/Heap.cpp:
+ (JSC::Heap::allocate):
+ * runtime/Heap.h:
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell::operator new):
+ (JSC::JSCell::MarkedSpace::sizeClassFor):
+ (JSC::JSCell::MarkedSpace::allocate):
+ * runtime/MarkedBlock.h:
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::SizeClass::SizeClass):
+
+2011-02-25 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Leak in JSParser::Scope of ScopeLabelInfo Vector
+ https://bugs.webkit.org/show_bug.cgi?id=55249
+
+ Changed m_labels to be an OwnPtr<>. Added VectorTraits
+ and Scope copy constructor to support this change.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::~Scope):
+
+2011-02-25 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ WebSocket uses insecure random numbers
+ https://bugs.webkit.org/show_bug.cgi?id=54714
+
+ * JavaScriptCore.exp: Export WTF::cryptographicallyRandomNumber()
+
+2011-02-25 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Move timeBeginPeriod into OS(WINDOWS) section
+ https://bugs.webkit.org/show_bug.cgi?id=55247
+
+ * jsc.cpp:
+ (main): timeBeginPeriod is available on all Windows versions and not compiler specific.
+
+2011-02-25 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed WinCE build fix for r79695.
+
+ * jsc.cpp:
+ (main): SetErrorMode isn't available on WinCE.
+
+2011-02-25 Adam Roben <aroben@apple.com>
+
+ Work around Cygwin's crash-suppression behavior
+
+ Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which any processes it launches will
+ inherit. This is bad for testing/debugging, as it causes the post-mortem debugger not to be
+ invoked. (Cygwin does this because it makes crashes more UNIX-y.) We reset the error mode
+ when our test apps launch to work around Cygwin's behavior.
+
+ Fixes <http://webkit.org/b/55222> Test apps crash silently (without invoking post-mortem
+ debugger) when launched from Cygwin 1.7
+
+ Reviewed by Darin Adler.
+
+ * API/tests/testapi.c: Added a now-needed #include.
+ (main):
+ * jsc.cpp:
+ (main):
+ Call ::SetErrorMode(0) to undo Cygwin's folly.
+
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: Define NOMINMAX like many of our
+ other projects do so that windows.h won't define min/max macros that interfere with
+ std::numeric_limits<T>::min/max.
+
+2011-02-24 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add GYP project for JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=55027
+
+ Again, this GYP files is very rough, but it succeeds in building
+ JavaScriptCore. There's a lot more work to do here, especially in the
+ area of sharing with JavaScriptGlue.gyp. This patch is more of a
+ checkpoint so that other folks can help out if they wish.
+
+ * gyp: Added.
+ * gyp/JavaScriptCore.gyp: Added.
+ * gyp/generate-derived-sources.sh: Added.
+
+2011-02-24 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add missing files to JavaScriptCore.gypi
+ https://bugs.webkit.org/show_bug.cgi?id=55193
+
+ I forgot to add mm files in my previous patch.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * JavaScriptCore.gypi:
+
+2011-02-24 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove unused parameter name in GCActivityCallback.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=55194
+
+ This change is not strictly required for the GYP-based build system,
+ but I noticed this error when working on the new build system.
+
+ * runtime/GCActivityCallback.cpp:
+ (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
+
+2011-02-24 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Add a USE() macro to control use of the built-in UTF8 codec
+ https://bugs.webkit.org/show_bug.cgi?id=55189
+
+ Defaults USE(BUILTIN_UTF8_CODEC) to true for all platforms except chromium, which controls the flag via features.gypi.
+
+ * wtf/Platform.h:
+
+2011-02-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Variable-sized allocation (but still capped at 64 bytes)
+ https://bugs.webkit.org/show_bug.cgi?id=55159
+
+ SunSpider reports no change.
+
+ * JavaScriptCore.exp: Some day, I hope not to have to edit this file.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::allocateSlowCase): Split allocation into a fast and slow
+ case, so the fast case can inline size class selection and turn it into
+ a compile-time constant.
+
+ Changed the collect-on-every allocation debugging switch to collect only
+ on every slow allocation, so you can still flip the switch without
+ recompiling the world. This may also be preferable for debugging purposes,
+ since collecting after every single allocation can be unusably slow,
+ and can mask problems by running destructors early.
+
+ * runtime/Heap.h: Ditto.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedSpace::sizeClassFor):
+ (JSC::JSCell::Heap::allocate):
+ (JSC::JSCell::JSCell::operator new): The inlining mentioned above.
+
+ * runtime/MarkedBlock.h: Dropped the block size from 256KB to 16KB. With
+ multiple size classes, allocating a full 256KB for the first allocation
+ in a given class can be pathologically wasteful. (8KB, or 4KB Mac and
+ 8KB Windows, would be even better, but that seems to be a peformance
+ regression for now.)
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::reset): There's more than one size class now, and its
+ cell size is not constant.
+
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::SizeClass::SizeClass): Ditto.
+
+2011-02-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make WeakGCMap use new handle infrastructure
+ https://bugs.webkit.org/show_bug.cgi?id=55100
+
+ Remove old WeakGCMap implementation and move over to new handle
+ based logic.
+
+ This has a number of benefits, most notably it makes a WeakGCMap
+ always reflect the true state of the world by as all entries are
+ removed at the first gc cycle that makes them dead. This allows
+ us to get rid of code in a wide variety of objects where the only
+ purpose was to remove themselves from maps.
+
+ It also means that we no longer need to have special "unchecked"
+ versions of any functions on WeakGCMap. Alas in order to maintain
+ compatibility with the JSWeakObjectMapClear API it is still
+ necessary to have an api that resembles uncheckedRemove, this is
+ now deprecatedRemove and will be dealt with in a later patch.
+
+ In order to get correct semantics in WeakGCMap we need more
+ contextual information in the finalizer, so we've added an
+ abstract class based finaliser and a context parameter to the
+ calls.
+
+ The new an improved WeakGCMap also results in sigificantly more
+ churn in the weak handle lists so exposed some potential problems
+ during the post mark phase which have been rectified as well.
+
+ * API/JSWeakObjectMapRefPrivate.cpp:
+ * API/JSWeakObjectMapRefPrivate.h:
+ * runtime/Heap.cpp:
+ (JSC::Heap::globalObjectCount):
+ (JSC::Heap::protectedGlobalObjectCount):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::init):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::iterator::iterator):
+ (JSC::WeakGCMap::iterator::get):
+ (JSC::WeakGCMap::iterator::getSlot):
+ (JSC::WeakGCMap::iterator::operator++):
+ (JSC::WeakGCMap::iterator::operator==):
+ (JSC::WeakGCMap::iterator::operator!=):
+ (JSC::WeakGCMap::WeakGCMap):
+ (JSC::WeakGCMap::isEmpty):
+ (JSC::WeakGCMap::clear):
+ (JSC::WeakGCMap::get):
+ (JSC::WeakGCMap::getSlot):
+ (JSC::WeakGCMap::set):
+ (JSC::WeakGCMap::take):
+ (JSC::WeakGCMap::size):
+ (JSC::WeakGCMap::deprecatedRemove):
+ (JSC::WeakGCMap::begin):
+ (JSC::WeakGCMap::end):
+ (JSC::WeakGCMap::~WeakGCMap):
+ (JSC::WeakGCMap::finalize):
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::WeakGCPtr):
+ (JSC::WeakGCPtr::set):
+
+2011-02-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make weaklist processing deal with weak handles being removed during the iteration
+ https://bugs.webkit.org/show_bug.cgi?id=55105
+
+ It is possible for the handle heap to end up in a broken state if
+ a handle's finalizer removes either the current or next handle
+ to be visited during the post-gc cleanup. This patch removes that
+ problem by allowing the deallocate(Node*) routine to update the
+ iterator if it is called during finalization.
+
+ * collector/handles/HandleHeap.cpp:
+ (JSC::HandleHeap::HandleHeap):
+ (JSC::HandleHeap::updateAfterMark):
+ (JSC::HandleHeap::clearWeakPointers):
+ (JSC::HandleHeap::writeBarrier):
+ (JSC::HandleHeap::protectedGlobalObjectCount):
+ * collector/handles/HandleHeap.h:
+ (JSC::Finalizer::~Finalizer):
+ (JSC::HandleHeap::getFinalizer):
+ (JSC::HandleHeap::deallocate):
+ (JSC::HandleHeap::makeWeak):
+ (JSC::HandleHeap::makeSelfDestroying):
+ (JSC::HandleHeap::Node::Node):
+ (JSC::HandleHeap::Node::setFinalizer):
+ (JSC::HandleHeap::Node::finalizer):
+ (JSC::HandleHeap::Node::finalizerContext):
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::setGlobalObject):
+ (JSC::GlobalObjectNotifier::finalize):
+ (JSC::RegisterFile::globalObjectCollectedNotifier):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ * runtime/Heap.cpp:
+ (JSC::Heap::destroy):
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::WeakGCPtr):
+ (JSC::WeakGCPtr::set):
+
+2011-02-24 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ PatternAlternative leaked in YarrPatternConstructor::atomParenthesesEnd()
+ https://bugs.webkit.org/show_bug.cgi?id=55156
+
+ Added code to delete unneeded PatternAlternative after it is removed
+ from m_alternatives Vector.
+
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::YarrPatternConstructor::atomParenthesesEnd):
+
+2011-02-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ VectorBuffer should not call malloc(0)
+ https://bugs.webkit.org/show_bug.cgi?id=55091
+
+ Turns out the malloc() call which was so hot in:
+ https://bugs.webkit.org/show_bug.cgi?id=55005
+ was actually just malloc(0).
+
+ We shouldn't be calling malloc(0) anyway, since there is no need to
+ and it might actually do work on some systems.
+ I believe on Mac it ends up taking the standard spinlocks (expensive)
+ and the code on Brew actually does a malloc(1) instead. Neither is desirable.
+
+ * wtf/Vector.h:
+ (WTF::VectorBufferBase::allocateBuffer):
+ (WTF::VectorBufferBase::tryAllocateBuffer):
+
+2011-02-24 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Remove obsolete PLATFORM(CI)
+ https://bugs.webkit.org/show_bug.cgi?id=55082
+
+ * wtf/Platform.h:
+
+2011-02-24 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Remove the GFile GOwnPtr specialization
+ https://bugs.webkit.org/show_bug.cgi?id=55154
+
+ Remove the GFile specialization of GOwnPtr. It's sufficient to use GRefPtr
+ to track GFiles since they are just regular reference-counted GObjects.
+
+ * wtf/gobject/GOwnPtr.cpp: Remove GFile specialization.
+ * wtf/gobject/GOwnPtr.h: Ditto.
+
+2011-02-24 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Rename PLATFORM(SKIA) to USE(SKIA)
+ https://bugs.webkit.org/show_bug.cgi?id=55090
+
+ * wtf/Platform.h:
+
+2011-02-24 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Remove pthreads dependecy for JSLock
+ https://bugs.webkit.org/show_bug.cgi?id=54832
+
+ JSLock is only needed to support an obsolete execution model where JavaScriptCore
+ automatically protected against concurrent access from multiple threads.
+ So it's safe to disable it on non-mac platforms where we don't have native pthreads.
+
+ * runtime/JSLock.cpp:
+
+2011-02-24 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix MIPS build with new patchOffsetPut/GetByIdPropertyMapOffset1/2 values
+ https://bugs.webkit.org/show_bug.cgi?id=54997
+
+ * jit/JIT.h:
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+
+2011-02-24 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] MinGW build fails to link
+ https://bugs.webkit.org/show_bug.cgi?id=55050
+
+ Prepend the libraries of subcomponents instead of appending them
+ to fix the library order according to the dependency of the libraries
+
+ * JavaScriptCore.pri: rename addJavaScriptCore to prependJavaScriptCore
+ * jsc.pro: ditto
+
+2011-02-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Deque<T> should support inline capacity
+ https://bugs.webkit.org/show_bug.cgi?id=55032
+
+ The title says it all. There are currently no places
+ which use this code yet, however it's been tested in conjunction
+ with code for bug 55005.
+
+ This also adds an ASSERT that capacity is never 1. If you were able
+ to set the capacity equal to 1, the Deque would just get confused
+ and happily append your item but still think it had size 0.
+
+ * wtf/Deque.h:
+ (WTF::DequeIterator::DequeIterator):
+ (WTF::DequeConstIterator::DequeConstIterator):
+ (WTF::DequeReverseIterator::DequeReverseIterator):
+ (WTF::DequeConstReverseIterator::DequeConstReverseIterator):
+ (WTF::::checkValidity):
+ (WTF::::checkIndexValidity):
+ (WTF::::invalidateIterators):
+ (WTF::::Deque):
+ (WTF::deleteAllValues):
+ (WTF::::operator):
+ (WTF::::destroyAll):
+ (WTF::::~Deque):
+ (WTF::::swap):
+ (WTF::::clear):
+ (WTF::::findIf):
+ (WTF::::expandCapacityIfNeeded):
+ (WTF::::expandCapacity):
+ (WTF::::takeFirst):
+ (WTF::::append):
+ (WTF::::prepend):
+ (WTF::::removeFirst):
+ (WTF::::remove):
+ (WTF::::addToIteratorsList):
+ (WTF::::removeFromIteratorsList):
+ (WTF::::DequeIteratorBase):
+ (WTF::::~DequeIteratorBase):
+ (WTF::::isEqual):
+ (WTF::::increment):
+ (WTF::::decrement):
+ (WTF::::after):
+ (WTF::::before):
+ * wtf/Vector.h:
+
+2011-02-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Ojan Vafai.
+
+ Add missing files to JavaScriptCore.gypi
+ https://bugs.webkit.org/show_bug.cgi?id=55020
+
+ gypi files are supposed to list every file under the sun. This patch
+ adds some missing files and sorts the rest.
+
+ * JavaScriptCore.gypi:
+
+2011-02-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Refactored MarkedSpace to operate in terms of size classes
+ https://bugs.webkit.org/show_bug.cgi?id=55106
+
+ SunSpider reports no change.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedSpace::sizeClassFor):
+ (JSC::JSCell::MarkedSpace::allocate): Delegate allocation based on size
+ class. Since these functions are inline, the compiler can constant fold
+ them.
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::cellSize):
+ (JSC::MarkedBlock::size): Factored out a cellSize() helper.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::allocateFromSizeClass):
+ (JSC::MarkedSpace::shrink):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::SizeClass::SizeClass):
+ (JSC::MarkedSpace::SizeClass::reset): Changed to operate in terms of
+ abstract SizeClass objects, which are independent linked lists of blocks
+ of a certain size class, instead of a single m_heap object.
+
+2011-02-23 Adam Barth <abarth@webkit.org>
+
+ Reviewed by James Robinson.
+
+ [Chromium] Use WebKitClient for OSRandomSource instead of trying to talk to the file system in the sandbox
+ https://bugs.webkit.org/show_bug.cgi?id=55093
+
+ Exclude OSRandomSource.cpp from the Chromium build. This function is
+ implemented in WebKit/chromium/src instead.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2011-02-23 Oliver Hunt <oliver@apple.com>
+
+ Roll out r64156 as it introduces incorrect behaviour.
+
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::setIndex):
+
+2011-02-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Moved the "nextAtom" allocation pointer into MarkedBlock for better encapsulation
+ https://bugs.webkit.org/show_bug.cgi?id=55079
+
+ SunSpider reports no change.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reset): Moved Zombie sweeping here, up from MarkedSpace,
+ since we want Heap to logically control MarkedSpace. MarkedSpace should
+ never choose to sweep itself.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate): Updated for nextAtom becoming a
+ member of MarkedBlock. No need to reset nextAtom to firstAtom() when
+ we reach the end of a block, since there's now an explicit reset pass
+ during GC.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::reset): Added the nextAtom data member, and reordered
+ some data members to improve cache locality.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+ (JSC::CollectorHeap::CollectorHeap): Removed nextAtom, and added an
+ explicit reset pass.
+
+2011-02-23 James Robinson <jamesr@chromium.org>
+
+ Unreviewed, rolling out r79428.
+ http://trac.webkit.org/changeset/79428
+ https://bugs.webkit.org/show_bug.cgi?id=54714
+
+ Does not work in the Chromium sandbox
+
+ * JavaScriptCore.exp:
+
+2011-02-23 Adam Roben <aroben@apple.com>
+
+ Fix an off-by-one error in JSC::appendSourceToError
+
+ Looks like this bug has been around since the code was first added in r35245.
+
+ Fixes <http://webkit.org/b/55052> <rdar://problem/9043512> Crash in JSC::appendSourceToError
+ when running fast/dom/objc-big-method-name.html on Windows with full page heap enabled
+
+ Reviewed by Darin Adler.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::appendSourceToError): When trimming whitespace off the end of the string, examine the
+ character at stop-1 rather than at stop. At this point in the code, stop represents the
+ index just past the end of the characters we care about, and can even be just past the end
+ of the entire data buffer.
+
+2011-02-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Rolled back in r79367 with SnowLeopard Release bot crash fixed.
+ https://bugs.webkit.org/show_bug.cgi?id=54999
+
+ The crash was caused by failure to update the "nextBlock" pointer when
+ removing a block from the list while shrinking. The fix is to update the
+ "nextBlock" pointer.
+
+ This crash was very rare because it only happened in cases where the very
+ first block in the heap contained no marked cells.
+
+2011-02-23 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Include frame numbers in backtraces.
+ https://bugs.webkit.org/show_bug.cgi?id=55060
+
+ * wtf/Assertions.cpp:
+
+2011-02-23 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ latest jsc for armv7 crashes in sunspider tests
+ https://bugs.webkit.org/show_bug.cgi?id=54667
+
+ Update JIT offset values in ARMv7 after r78732. Fixes crashes in
+ SunSpider and JavaScript tests.
+
+ * jit/JIT.h: update values.
+
+2011-02-23 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r79418.
+ http://trac.webkit.org/changeset/79418
+ https://bugs.webkit.org/show_bug.cgi?id=55043
+
+ "breaks shlib linux build" (Requested by morrita on #webkit).
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * JavaScriptCore.gypi:
+
+2011-02-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Use DEFINE_STATIC_LOCAL for ignoreSetMutex in Structure.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=54831
+
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/Structure.cpp:
+ (JSC::ignoreSetMutex):
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::initializeThreading):
+ * runtime/Structure.h:
+
+2011-02-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Rename PLATFORM(CF) to USE(CF)
+ https://bugs.webkit.org/show_bug.cgi?id=53540
+
+ * runtime/DatePrototype.cpp:
+ * runtime/GCActivityCallbackCF.cpp:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * wtf/CurrentTime.cpp:
+ * wtf/Platform.h:
+ * wtf/text/AtomicString.h:
+ * wtf/text/StringImpl.h:
+ (WTF::StringImpl::computeHash):
+ * wtf/text/WTFString.h:
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::userDefault):
+
+2011-02-23 Fumitoshi Ukai <ukai@chromium.org>
+
+ Unreviewed build fix for Windows.
+
+ WebSocket uses insecure random numbers
+ https://bugs.webkit.org/show_bug.cgi?id=54714
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export WTF::cryptographicallyRandomNumber()
+
+2011-02-23 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ WebSocket uses insecure random numbers
+ https://bugs.webkit.org/show_bug.cgi?id=54714
+
+ * JavaScriptCore.exp: Export WTF::cryptographicallyRandomNumber()
+
+2011-02-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Ojan Vafai.
+
+ Add missing files to JavaScriptCore.gypi
+ https://bugs.webkit.org/show_bug.cgi?id=55020
+
+ gypi files are supposed to list every file under the sun. This patch
+ adds some missing files and sorts the rest.
+
+ * JavaScriptCore.gypi:
+
+2011-02-22 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r79367.
+ http://trac.webkit.org/changeset/79367
+ https://bugs.webkit.org/show_bug.cgi?id=55012
+
+ all layout tests are crashing on Snow Leopard (Requested by
+ rniwa on #webkit).
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ * runtime/MarkedBlock.h:
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::destroy):
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::freeBlock):
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::shrink):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+ (JSC::CollectorHeap::collectorBlock):
+ * wtf/CMakeLists.txt:
+ * wtf/DoublyLinkedList.h: Removed.
+
+2011-02-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Manage MarkedBlocks in a linked list instead of a vector, so arbitrary removal is O(1)
+ https://bugs.webkit.org/show_bug.cgi?id=54999
+
+ SunSpider reports no change.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj: So many build systems, so little time.
+ * wtf/CMakeLists.txt:
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::setPrev):
+ (JSC::MarkedBlock::setNext):
+ (JSC::MarkedBlock::prev):
+ (JSC::MarkedBlock::next): Added linked list data members and accessors.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::destroy):
+ (JSC::MarkedSpace::allocateBlock): Stop using vector, since it doesn't exist anymore.
+
+ (JSC::MarkedSpace::freeBlocks): New helper function for updating relevant
+ data structures when freeing blocks.
+
+ (JSC::MarkedSpace::allocate): Updated for nextBlock being a pointer and
+ not a vector index.
+
+ (JSC::MarkedSpace::shrink): Construct a temporary list of empties and
+ then free them, to avoid modifying our hash table while iterating it.
+ This wasn't a concern before because we were using indirect array
+ indexing, not direct pointer indexing.
+
+ (JSC::MarkedSpace::reset): Updated for nextBlock being a pointer and
+ not a vector index.
+
+ * runtime/MarkedSpace.h:
+ (JSC::CollectorHeap::CollectorHeap): Changed data type from vector to linked list.
+
+ * wtf/DoublyLinkedList.h: Added. New linked list class.
+ (WTF::::DoublyLinkedList):
+ (WTF::::isEmpty):
+ (WTF::::head):
+ (WTF::::append):
+ (WTF::::remove):
+
+2011-02-22 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 54988 - Re-create StructureTransitionTable class, encapsulate transition table
+
+ The Structure class keeps a table of transitions to derived Structure types. Since
+ this table commonly contains a single entry we employ an optimization where instead
+ of holding a map, we may hold a pointer directly to a single instance of the mapped
+ type. We use an additional bit of data to flag whether the pointer is currently
+ pointing to a table of transitions, or a singleton transition. Previously we had
+ commonly used a pattern of storing data in the low bits of pointers, but had moved
+ away from this since it causes false leaks to be reported by the leaks tool. However
+ in this case, the entries in the map are weak links - this pointer will never be
+ responsible for keeping an object alive. As such we can use this approach provided
+ that the bit is set when a table is not in use (otherwise the table would appear to
+ be leaked).
+
+ Additionally, the transition table currently allows two entries to exist for a given
+ key - one specialized to a particular value, and one not specialized. This is
+ unnecessary, wasteful, and a little inconsistent. (If you create an entry for a
+ specialized value, then a non-specialized entry, both will exist. If you create an
+ entry for a non-specialized value, then try to create a specialized entry, only a
+ non-specialized form will be allowed.)
+
+ This shows a small progression on v8.
+
+ * JavaScriptCore.exp:
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirectInternal):
+ * runtime/Structure.cpp:
+ (JSC::StructureTransitionTable::contains):
+ (JSC::StructureTransitionTable::get):
+ (JSC::StructureTransitionTable::remove):
+ (JSC::StructureTransitionTable::add):
+ (JSC::Structure::dumpStatistics):
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::get):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::Hash::hash):
+ (JSC::StructureTransitionTable::Hash::equal):
+ (JSC::StructureTransitionTable::HashTraits::emptyValue):
+ (JSC::StructureTransitionTable::HashTraits::constructDeletedValue):
+ (JSC::StructureTransitionTable::HashTraits::isDeletedValue):
+ (JSC::StructureTransitionTable::StructureTransitionTable):
+ (JSC::StructureTransitionTable::~StructureTransitionTable):
+ (JSC::StructureTransitionTable::isUsingSingleSlot):
+ (JSC::StructureTransitionTable::map):
+ (JSC::StructureTransitionTable::setMap):
+ (JSC::StructureTransitionTable::singleTransition):
+ (JSC::StructureTransitionTable::setSingleTransition):
+
+2011-02-22 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Redesign the build system
+ https://bugs.webkit.org/show_bug.cgi?id=51339
+
+ Part 2.
+
+ Build WebCore as a static library, compile the WebKit API and WebKit2 API
+ in a final step and link to WebKit2, WebCore and JSC libraries to fix
+ linking issues resulting from stripped away symbols.
+
+ * JavaScriptCore.pri: Remove the workaround.
+
+2011-02-21 Adam Roben <aroben@apple.com>
+
+ Fix linker warning on Windows
+
+ r79135 tried to export JSObject::s_info by adding it to JavaScriptCore.def. This is the
+ obvious way (since it's how we export functions), but unfortunately it doesn't work correct.
+ r79222 made us export it the right way (using the JS_EXPORTDATA macro), but forgot to remove
+ it from JavaScriptCore.def. This caused us to get linker warnings about exporting the symbol
+ multiple times.
+
+ Rubber-stamped by Anders Carlsson.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Removed JSObject::s_info.
+
+2011-02-21 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebResourceCacheManager should be responsible for managing the CFURLCache as well
+ as the WebCore memory cache.
+ https://bugs.webkit.org/show_bug.cgi?id=54886
+ Part of <rdar://problem/8971738>
+
+ Add a new use flag for using the CFURLCache.
+
+ * wtf/Platform.h:
+
+2011-02-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Use ASSERT_JIT_OFFSET in JITPropertyAccess32_64.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=54901
+
+ * jit/JIT.h: swap actual and expected values in message, they were
+ reversed.
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCall): use ASSERT_JIT_OFFSET instead of
+ a simple ASSERT.
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_method_check): ditto.
+ (JSC::JIT::compileGetByIdHotPath): ditto.
+ (JSC::JIT::compileGetByIdSlowCase): ditto.
+ (JSC::JIT::emit_op_put_by_id): ditto.
+
+2011-02-21 Gavin Barraclough <barraclough@apple.com>
+
+ Ruber stamped by Sam Weinig
+
+ Bug 54899 - Math.LOG10E should be 0.4342944819032518
+ This value is quoted in section 15.8.1.5 of the spec.
+
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+
+2011-02-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 54894 - Make inheritance structure described by ClassInfo match C++ class hierarchy.
+
+ The ClassInfo objects describe an inheritance hierarchy, with each ClassInfo instance
+ containing a pointer to its parent class. These links should reflect the inheritance
+ hierarchy of C++ classes below JSObject. For the large part it does, but in some cases
+ entries in the C++ hierarchy are skipped over. This presently likely doesn't matter,
+ since intervening C++ classes may not have ClassInfo - but would be a potential bug
+ were ClassInfo were to be added.
+
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackObjectFunctions.h:
+ * runtime/Arguments.h:
+ * runtime/ArrayPrototype.cpp:
+ * runtime/BooleanObject.cpp:
+ * runtime/DateInstance.cpp:
+ * runtime/DatePrototype.cpp:
+ * runtime/ErrorInstance.cpp:
+ * runtime/InternalFunction.cpp:
+ * runtime/JSActivation.cpp:
+ * runtime/JSArray.cpp:
+ * runtime/JSFunction.cpp:
+ * runtime/JSONObject.cpp:
+ * runtime/JSObject.h:
+ * runtime/JSZombie.h:
+ * runtime/MathObject.cpp:
+ * runtime/NativeErrorConstructor.cpp:
+ * runtime/NumberConstructor.cpp:
+ * runtime/NumberObject.cpp:
+ * runtime/RegExpConstructor.cpp:
+ * runtime/RegExpObject.cpp:
+ * runtime/StringObject.cpp:
+ * runtime/StringPrototype.cpp:
+
+2011-02-21 Adam Roben <aroben@apple.com>
+
+ Export JSObject::s_info from JavaScriptCore.dll
+
+ This matches what we do for all other ClassInfo objects that WebCore needs access to.
+
+ Fixes <http://webkit.org/b/54881> REGRESSION (r79132): Lots of tests crashing in
+ JSCell::inherits on Windows
+
+ Reviewed by Sam Weinig.
+
+ * runtime/JSObject.h: Added JS_EXPORTDATA to s_info.
+
+2011-02-21 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ Switched to compiler based detection, where the error actually is.
+
+ It is not the platform that needs the workaround, it is the compiler.
+
+ QtWebKit fails to compile on Windows XP with msvc-2008
+ https://bugs.webkit.org/show_bug.cgi?id=54746
+
+ * bytecode/CodeBlock.h:
+ * runtime/RegExpObject.h:
+
+2011-02-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=54839
+ Remove PrototypeFunction, NativeFunctionWrapper, and GlobalEvalFunction.
+
+ Historically, Native functions used to be represented by PrototypeFunctions, however
+ since introducing call optimizations to the JIT this has used JSFunctions for host
+ calls too. At the point this change was made, the interpreter continued to use
+ PrototypeFunctions, however since fallback from the JIT to interpreter was introduced
+ the interpreter has had to be able to run using host functions represented using
+ JSFunctions - leading to an unnecessary and redundant divergence in behaviour between
+ interpreter only builds, and situations where the JIT has fallen back to interpreting.
+
+ NativeFunctionWrapper only existed to select between PrototypeFunction and JSFunction
+ for wrappers for host functions, and as such can also be removed.
+
+ GlobalEvalFunction is a redundant wrapper that happens to be derived from
+ PrototypeFunction. It existed to hold a reference to the global object - but since all
+ functions how derive from JSObjectWithGlobalObject, this no longer requires an
+ additional class to provide this functionality.
+
+ * JavaScriptCore.JSVALUE32_64only.exp:
+ * JavaScriptCore.JSVALUE64only.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Removed symbols / references to files.
+
+ * runtime/GlobalEvalFunction.cpp: Removed.
+ * runtime/GlobalEvalFunction.h: Removed.
+ * runtime/NativeFunctionWrapper.h: Removed.
+ * runtime/PrototypeFunction.cpp: Removed.
+ * runtime/PrototypeFunction.h: Removed.
+ Removed.
+
+ * runtime/Executable.cpp:
+ (JSC::NativeExecutable::~NativeExecutable):
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::create):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::JSFunction::nativeFunction):
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getCallData):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::getHostFunction):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::getCTIStub):
+ Added interpreter-friendly constructors for NativeExecutables.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ * interpreter/Interpreter.cpp:
+ * jit/JITStubs.cpp:
+ * jsc.cpp:
+ * runtime/ArrayConstructor.cpp:
+ * runtime/BooleanPrototype.cpp:
+ * runtime/BooleanPrototype.h:
+ * runtime/CallData.h:
+ * runtime/DateConstructor.cpp:
+ * runtime/DateConstructor.h:
+ * runtime/ErrorPrototype.cpp:
+ * runtime/ErrorPrototype.h:
+ * runtime/FunctionPrototype.cpp:
+ * runtime/FunctionPrototype.h:
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ * runtime/Lookup.cpp:
+ * runtime/NumberPrototype.cpp:
+ * runtime/NumberPrototype.h:
+ * runtime/ObjectConstructor.cpp:
+ * runtime/ObjectConstructor.h:
+ * runtime/ObjectPrototype.cpp:
+ * runtime/ObjectPrototype.h:
+ * runtime/RegExpPrototype.cpp:
+ * runtime/RegExpPrototype.h:
+ * runtime/SmallStrings.h:
+ * runtime/StringConstructor.cpp:
+ * runtime/StringConstructor.h:
+ Removed use of redundant classes.
+
+2011-02-19 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed build fix for Symbian.
+
+ [Symbian] Revert the removal of linking
+ against hal after r79126.
+
+ Dependency on the hal library can not be removed
+ as it is still used (e.g. in MarkStackSymbian.cpp).
+
+ * JavaScriptCore.pri:
+
+2011-02-19 Gavin Barraclough <barraclough@apple.com>
+
+ Interpreter build fix.
+
+ * runtime/ArrayConstructor.cpp:
+ * runtime/BooleanPrototype.cpp:
+ * runtime/DateConstructor.cpp:
+ * runtime/ErrorPrototype.cpp:
+ * runtime/FunctionPrototype.cpp:
+ * runtime/Lookup.cpp:
+ * runtime/NumberPrototype.cpp:
+ * runtime/ObjectConstructor.cpp:
+ * runtime/ObjectPrototype.cpp:
+ * runtime/RegExpPrototype.cpp:
+ * runtime/StringConstructor.cpp:
+
+2011-02-19 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix!!
+
+ * JavaScriptCore.exp:
+
+2011-02-19 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix!!
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-19 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix!
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-19 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix!
+
+ * JavaScriptCore.exp:
+
+2011-02-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 54786 - Devirtualize JSCell::classInfo()
+
+ Instead of making a virtual function call, add a pointer to the ClassInfo
+ onto Structure.
+
+ This removes a virtual function call, and paves the way towards removing all
+ the createStructure methods, and StructureFlags/AnonymousSlotCount properties
+ (these should be able to move onto ClassInfo).
+
+ Calls to Structure::create must now pass a pointer to the ClassInfo for the
+ structure. All objects now have a ClassInfo pointer, non-object cell types
+ still do not.
+
+ Changes are most mechanical, involving three steps:
+ * Remove virtual classInfo() methods.
+ * Add &s_info parameter to calls to Structure::create.
+ * Rename ClassInfo static members on classes from 'info' to 's_info',
+ for consistency.
+
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.cpp:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ * API/JSObjectRef.cpp:
+ * API/JSValueRef.cpp:
+ * API/JSWeakObjectMapRefPrivate.cpp:
+ * JavaScriptCore.exp:
+ * debugger/Debugger.cpp:
+ * debugger/DebuggerActivation.h:
+ * debugger/DebuggerCallFrame.cpp:
+ * interpreter/Interpreter.cpp:
+ * jit/JITCall32_64.cpp:
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.cpp:
+ * profiler/Profiler.cpp:
+ * runtime/Arguments.cpp:
+ * runtime/Arguments.h:
+ * runtime/ArrayConstructor.cpp:
+ * runtime/ArrayPrototype.cpp:
+ * runtime/ArrayPrototype.h:
+ * runtime/BooleanObject.cpp:
+ * runtime/BooleanObject.h:
+ * runtime/BooleanPrototype.cpp:
+ * runtime/DateConstructor.cpp:
+ * runtime/DateInstance.cpp:
+ * runtime/DateInstance.h:
+ * runtime/DatePrototype.cpp:
+ * runtime/DatePrototype.h:
+ * runtime/ErrorInstance.cpp:
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ * runtime/FunctionPrototype.cpp:
+ * runtime/FunctionPrototype.h:
+ * runtime/GetterSetter.h:
+ * runtime/GlobalEvalFunction.h:
+ * runtime/InternalFunction.cpp:
+ * runtime/InternalFunction.h:
+ * runtime/JSAPIValueWrapper.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/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h:
+ * runtime/JSNotAnObject.h:
+ * runtime/JSONObject.cpp:
+ * runtime/JSONObject.h:
+ * runtime/JSObject.cpp:
+ * runtime/JSObject.h:
+ * runtime/JSObjectWithGlobalObject.h:
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSString.h:
+ * runtime/JSVariableObject.h:
+ * runtime/JSWrapperObject.h:
+ * runtime/JSZombie.cpp:
+ * runtime/JSZombie.h:
+ * runtime/Lookup.cpp:
+ * runtime/MathObject.cpp:
+ * runtime/MathObject.h:
+ * runtime/NativeErrorConstructor.cpp:
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NumberConstructor.cpp:
+ * runtime/NumberConstructor.h:
+ * runtime/NumberObject.cpp:
+ * runtime/NumberObject.h:
+ * runtime/NumberPrototype.cpp:
+ * runtime/ObjectConstructor.cpp:
+ * runtime/ObjectPrototype.cpp:
+ * runtime/RegExpConstructor.cpp:
+ * runtime/RegExpConstructor.h:
+ * runtime/RegExpObject.cpp:
+ * runtime/RegExpObject.h:
+ * runtime/RegExpPrototype.cpp:
+ * runtime/ScopeChain.cpp:
+ * runtime/StringConstructor.cpp:
+ * runtime/StringObject.cpp:
+ * runtime/StringObject.h:
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ * runtime/StringPrototype.cpp:
+ * runtime/StringPrototype.h:
+ * runtime/Structure.cpp:
+ * runtime/Structure.h:
+
+2011-02-19 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/54808> Change jsc target to build directly into JavaScriptCore.framework/Resources/jsc
+
+ Reviewed by Dan Bernstein.
+
+ * Configurations/Base.xcconfig: Added
+ JAVASCRIPTCORE_FRAMEWORKS_DIR variable.
+ * Configurations/JavaScriptCore.xcconfig: Used
+ JAVASCRIPTCORE_FRAMEWORKS_DIR to define INSTALL_PATH.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Set the INSTALL_PATH
+ for Production configuration of jsc target.
+ (Copy Into Framework): Removed old build phase.
+ (Fix Framework Reference): Renamed build phase to "Copy Into
+ Framework". Added "set -x" call to make the script print the
+ commands it is running. Added code to exit early for Production
+ builds since this was never intended for them. Added code to
+ copy jsc into the JavaScriptCore.framework/Resources directory.
+
+2011-02-19 Siddharth Mathur <siddharth.mathur@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Symbian] OSAllocator implementation for Symbian OS.
+ Manages both data and code region requests. V8 and Sunspider tested
+ OK with interpreter. Not tested with JSC JIT yet as it has unrelated
+ failures. Also no thread safety yet.
+ https://bugs.webkit.org/show_bug.cgi?id=51128
+
+ * JavaScriptCore.pri: removed HAL linkage
+ * wtf/Bitmap.h:
+ (WTF::::findRunOfZeros): find run of zeros in a bitmap. quick n dirty
+ * wtf/OSAllocator.h:
+ (WTF::OSAllocator::decommitAndRelease): decommit explicitly
+ * wtf/OSAllocatorSymbian.cpp: Impl. of OSAllocator interface
+ (WTF::allocateCodeChunk): utility for code chunks
+ (WTF::deallocateCodeChunk): utility for code chunks
+ (WTF::dataAllocatorInstance): getter for data allocator instance
+ (WTF::OSAllocator::reserveUncommitted):
+ (WTF::OSAllocator::releaseDecommitted):
+ (WTF::OSAllocator::commit):
+ (WTF::OSAllocator::decommit):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::PageAllocatorSymbian::PageAllocatorSymbian): maps requests
+ to one underlying Symbian chunk
+ (WTF::PageAllocatorSymbian::~PageAllocatorSymbian):
+ (WTF::PageAllocatorSymbian::reserve):
+ (WTF::PageAllocatorSymbian::release):
+ (WTF::PageAllocatorSymbian::commit):
+ (WTF::PageAllocatorSymbian::decommit):
+ (WTF::PageAllocatorSymbian::contains):
+ * wtf/PageAllocatorSymbian.h: Added.
+ (WTF::SymbianChunk::SymbianChunk): wrapper around RChunk
+ (WTF::SymbianChunk::~SymbianChunk):
+ (WTF::SymbianChunk::contains):
+
+2011-02-19 Yong Li <yoli@rim.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=54687
+ When being built with armcc, "int" bit fields are treated as
+ unsigned integers, which will fail the comparisons like "m_offset == -1".
+ Using "signed" fixes the problem.
+
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+
+2011-02-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Made MarkedSpace block iteration size-class agnostic
+ https://bugs.webkit.org/show_bug.cgi?id=54792
+
+ SunSpider reports no change.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::clearMarks):
+ (JSC::MarkedSpace::sweep):
+ (JSC::MarkedSpace::objectCount):
+ (JSC::MarkedSpace::size):
+ (JSC::MarkedSpace::capacity):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::forEach): Iterate blocks in hashing order instead of
+ size class list order. This is a much simpler convention in a world
+ of many different size classes.
+
+2011-02-18 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ Added friend exception to Qt platform, which also compiles Windows.
+
+ QtWebKit fails to compile on Windows XP with msvc-2008
+ https://bugs.webkit.org/show_bug.cgi?id=54746
+
+ * bytecode/CodeBlock.h:
+ * runtime/RegExpObject.h:
+
+2011-02-18 Geoffrey Garen <ggaren@apple.com>
+
+ (Rolled back in r79022 with crash fixed.)
+
+ Reviewed by Sam Weinig.
+
+ Use hashing instead of linear search in the conservative pointer test
+ https://bugs.webkit.org/show_bug.cgi?id=54767
+
+ SunSpider reports no change.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::destroy): No need to explicitly clear the blocks array,
+ since freeBlock removes items for us.
+
+ (JSC::MarkedSpace::freeBlock): Fixed a typo that always removed the last
+ block from the block set instead of the block being freed. Changed to
+ remove a block from our data structures before deallocating it, since
+ this is slightly cleaner.
+
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::contains): Variable-sized objects will use more,
+ smaller blocks, so it's important for the contains check not to be O(n)
+ in the number of blocks.
+
+2011-02-18 chris reiss <christopher.reiss@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ REGRESSION: Date.parse("Tue Nov 23 20:40:05 2010 GMT") returns NaN
+ https://bugs.webkit.org/show_bug.cgi?id=49989
+
+ updated test fast/js/script-tests/date-parse-test.js
+
+ * wtf/DateMath.cpp:
+ (WTF::parseDateFromNullTerminatedCharacters):
+
+2011-02-18 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r79022.
+ http://trac.webkit.org/changeset/79022
+ https://bugs.webkit.org/show_bug.cgi?id=54775
+
+ It broke the whole world (Requested by Ossy on #webkit).
+
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::contains):
+
+2011-02-18 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Dave Hyatt.
+
+ Add support for dir=auto
+ https://bugs.webkit.org/show_bug.cgi?id=50916
+
+ Change defaultWritingDirection() to return if the writing direction
+ was determined from a letter with strong directionality or not.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.order:
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::defaultWritingDirection):
+ * wtf/text/StringImpl.h:
+ * wtf/text/WTFString.h:
+ (WTF::String::defaultWritingDirection):
+
+2011-02-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use hashing instead of linear search in the conservative pointer test
+ https://bugs.webkit.org/show_bug.cgi?id=54767
+
+ SunSpider reports no change.
+
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::contains): Variable-sized objects will use more,
+ smaller blocks, so it's important for the contains check not to be O(n)
+ in the number of blocks.
+
+2011-02-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Tightened some usage accounting code in MarkedSpace
+ https://bugs.webkit.org/show_bug.cgi?id=54761
+
+ SunSpider reports no change.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap): Initialize the marked space high water mark on
+ construction, instead of relying on some implicit subtleties to make
+ not initializing it work out OK.
+
+ * runtime/Heap.h: Fixed up includes.
+
+ * runtime/MarkedBlock.h: Made firstAtom() static so clients can call it
+ even without having allocated a block.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace): Don't pre-allocate a block, since this
+ would be prohibitively expensive with multiple size classes.
+
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::freeBlock): Track allocated blocks in a hash set,
+ since linear search in the contains check will be prohibitively
+ expensive once we're using lots of smaller blocks.
+
+ (JSC::MarkedSpace::allocate): Don't assume that we always have a block
+ allocated, since we don't anymore. (See above.)
+
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h: Updated for changes mentioned above.
+
+2011-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Made object allocation secretly variable-sized (Shhhh!)
+ https://bugs.webkit.org/show_bug.cgi?id=54721
+
+ SunSpider reports no change.
+
+ Internally, MarkedBlock now makes variable-sized allocations, even
+ though MarkedSpace doesn't take advantage of this yet.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock): No need to ASSERT that allocations are
+ fixed-sized.
+
+ * runtime/MarkedBlock.h: Shrunk the atom size so we can allocate things
+ that are not multiples of 64 bytes.
+
+2011-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed some math errors when when using variable-sized cells
+ https://bugs.webkit.org/show_bug.cgi?id=54717
+
+ SunSpider reports no change.
+
+ Computer Science Barbie says, "Math is not so hard afterall!"
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate): Round up when calculating the
+ minimum number of atoms required for a cell, since rounding down
+ will get you splinched.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::sweep):
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::forEach): Changed a bunch of != tests to < tests
+ because m_endAtom is actually a fuzzy end -- iterating from firstAtom()
+ may not hit m_endAtom exactly.
+
+2011-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more abstraction for MarkedSpace::contains
+ https://bugs.webkit.org/show_bug.cgi?id=54715
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::contains): Added a contains function, so MarkedSpace
+ doesn't have to know how MarkedBlock tracks containment internally.
+
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::contains): Call through to MarkedBlock to figure out
+ if a cell that seems to be in a block is valid.
+
+2011-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed the invariant that the last cell in a block is always marked
+ https://bugs.webkit.org/show_bug.cgi?id=54713
+
+ SunSpider reports no change.
+
+ This adds one branch to allocation, but simplifies the mark invariant,
+ especially in a world of variable-sized cells. Now, it really is true
+ that any cell whose mark bit is set is a valid, live cell whose
+ constructor has run and whose destructor has not run.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate): Changed this do-while into a while
+ since we can no longer rely on a set mark bit to break out of this loop
+ before it reaches the end of the block.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::sweep):
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::isEmpty):
+ (JSC::MarkedBlock::clearMarks):
+ (JSC::MarkedBlock::markCount):
+ (JSC::MarkedBlock::forEach): No need to set a special last mark bit.
+
+2011-02-17 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r78856 and r78907.
+ http://trac.webkit.org/changeset/78856
+ http://trac.webkit.org/changeset/78907
+ https://bugs.webkit.org/show_bug.cgi?id=54705
+
+ These seem to break tests on 32-bit builds. (Requested by
+ aroben on #webkit).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * collector/handles/Global.h:
+ (JSC::Global::internalSet):
+ * collector/handles/Handle.h:
+ (JSC::HandleTypes::getFromSlot):
+ (JSC::HandleTypes::toJSValue):
+ (JSC::HandleTypes::validateUpcast):
+ (JSC::HandleConverter::operator->):
+ (JSC::HandleConverter::operator*):
+ (JSC::Handle::Handle):
+ (JSC::Handle::get):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sortNumeric):
+ * runtime/JSObject.h:
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ * runtime/SlotAccessor.h: Removed.
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::get):
+ (JSC::WeakGCPtr::internalSet):
+ * runtime/WriteBarrier.h:
+ (JSC::DeprecatedPtr::DeprecatedPtr):
+ (JSC::DeprecatedPtr::get):
+ (JSC::DeprecatedPtr::operator*):
+ (JSC::DeprecatedPtr::operator->):
+ (JSC::DeprecatedPtr::slot):
+ (JSC::DeprecatedPtr::operator UnspecifiedBoolType*):
+ (JSC::DeprecatedPtr::operator!):
+ (JSC::WriteBarrierBase::set):
+ (JSC::WriteBarrierBase::get):
+ (JSC::WriteBarrierBase::operator*):
+ (JSC::WriteBarrierBase::operator->):
+ (JSC::WriteBarrierBase::clear):
+ (JSC::WriteBarrierBase::slot):
+ (JSC::WriteBarrierBase::operator UnspecifiedBoolType*):
+ (JSC::WriteBarrierBase::operator!):
+ (JSC::WriteBarrierBase::setWithoutWriteBarrier):
+ (JSC::WriteBarrier::WriteBarrier):
+
+2011-02-17 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed.
+
+ [Qt] Buildfix.
+
+ * wtf/RetainPtr.h: Add missing PLATFORM(CF) guard.
+
+2011-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Made MarkedBlock variable-sized
+ https://bugs.webkit.org/show_bug.cgi?id=54692
+
+ SunSpider reports no change.
+
+ Each MarkedBlock is now composed of a set of fixed-sized atoms, with one
+ mark bit per atom. A given cell may be composed of one or more atoms.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::allocate): Made fixed-sizedness a property of MarkedSpace,
+ bubbling it up from MarkedBlock, since MarkedBlock now supports variable-
+ sizedness.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate): Removed use of CELLS_PER_BLOCK and
+ (implicit) one constants -- these quantities are not constant anymore.
+ Updated for switch from cell to atom.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::create):
+ (JSC::MarkedBlock::destroy):
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::sweep):
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::firstAtom):
+ (JSC::MarkedBlock::atoms):
+ (JSC::MarkedBlock::isAtomAligned):
+ (JSC::MarkedBlock::blockFor):
+ (JSC::MarkedBlock::isEmpty):
+ (JSC::MarkedBlock::clearMarks):
+ (JSC::MarkedBlock::size):
+ (JSC::MarkedBlock::capacity):
+ (JSC::MarkedBlock::atomNumber):
+ (JSC::MarkedBlock::isMarked):
+ (JSC::MarkedBlock::testAndSetMarked):
+ (JSC::MarkedBlock::setMarked):
+ (JSC::MarkedBlock::forEach): Same as above. Also removed use of CELL_SIZE
+ and BLOCK_SIZE, and switched away from calling arbitrary pointers cells.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+ (JSC::CollectorHeap::CollectorHeap):
+ (JSC::MarkedSpace::contains): Updated for renames. Made fixed-sizedness
+ a property of MarkedSpace.
+
+2011-02-17 Oliver Hunt <oliver@apple.com>
+
+ Attempt to fix windows build
+
+ * runtime/WriteBarrier.h:
+
+2011-02-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Refactor WriteBarrier and DeprecatedPtr to have less code duplication.
+ https://bugs.webkit.org/show_bug.cgi?id=54608
+
+ Make use of the tricks used for Handle, et al to avoid duplicating all
+ of the logic for DeprecatedPtr and WriteBarrier simply to support known
+ vs. unknown types.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * collector/handles/Global.h:
+ (JSC::Global::internalSet):
+ * collector/handles/Handle.h:
+ (JSC::Handle::Handle):
+ (JSC::Handle::get):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sortNumeric):
+ * runtime/JSObject.h:
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ * runtime/SlotAccessor.h: Added.
+ (JSC::SlotTypes::getFromBaseType):
+ (JSC::SlotTypes::convertToBaseType):
+ (JSC::SlotTypes::getFromSlot):
+ (JSC::SlotTypes::toJSValue):
+ (JSC::SlotTypes::validateUpcast):
+ (JSC::SlotAccessor::operator->):
+ (JSC::SlotAccessor::operator*):
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::get):
+ (JSC::WeakGCPtr::internalSet):
+ * runtime/WriteBarrier.h:
+ (JSC::DeprecatedPtr::DeprecatedPtr):
+ (JSC::DeprecatedPtr::get):
+ (JSC::DeprecatedPtr::slot):
+ (JSC::DeprecatedPtr::operator=):
+ (JSC::WriteBarrierTranslator::convertToStorage):
+ (JSC::WriteBarrierTranslator::convertFromStorage):
+ (JSC::WriteBarrierBase::set):
+ (JSC::WriteBarrierBase::get):
+ (JSC::WriteBarrierBase::clear):
+ (JSC::WriteBarrierBase::slot):
+ (JSC::WriteBarrierBase::operator UnspecifiedBoolType*):
+ (JSC::WriteBarrierBase::operator!):
+ (JSC::WriteBarrierBase::setWithoutWriteBarrier):
+ (JSC::WriteBarrier::WriteBarrier):
+
+2011-02-17 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Revert incorrect blind fix and restore previous working code.
+
+ * wtf/wx/StringWx.cpp:
+ (WTF::String::String):
+
+2011-02-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Intermittent crashes beneath MarkStack::drain
+ https://bugs.webkit.org/show_bug.cgi?id=54614
+ <rdar://problem/8971070>
+
+ The crashes were caused by a GC happening after the global object's
+ property table had grown (due to compilation), but before the properties
+ had been fully initialized by program execution.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Explicitly resize the global
+ object's register storage immediately, without waiting for program
+ execution to do it for us. This ensures that the global object's count
+ of global variables is consistent with the size of its global variable
+ storage at all times, and it ensures that all global variables are
+ properly initialized from the get-go.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::resizeRegisters):
+ * runtime/JSGlobalObject.h: Added a helper function for growing the
+ global object's register storage, and initializing new registers.
+
+== Rolled over to ChangeLog-2011-02-16 ==
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2002-12-03 b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2002-12-03
index bd63777..bd63777 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2002-12-03
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2002-12-03
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2003-10-25 b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2003-10-25
index 7127d32..7127d32 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2003-10-25
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2003-10-25
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2007-10-14 b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2007-10-14
index 693f966..693f966 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2007-10-14
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2007-10-14
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2008-08-10 b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2008-08-10
index 0912aec..0912aec 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2008-08-10
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2008-08-10
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2009-06-16 b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2009-06-16
index 52d3c36..52d3c36 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog-2009-06-16
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2009-06-16
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2010-05-24 b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2010-05-24
new file mode 100644
index 0000000..e6ec0f1
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2011-02-16 b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2011-02-16
new file mode 100644
index 0000000..9f81b2b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog-2011-02-16
@@ -0,0 +1,24628 @@
+2011-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 54524 - Allow JSObject to fully utilize cell's capacity for inline storage.
+
+ Currently JSObject is both directly instantiated for regular JS objects, and
+ derived to implement subtypes. A consequence of this is that we need to ensure
+ that sufficient space from the cell is left unused and available for any data
+ members that will be introduced by subclasses of JSObject. By restructuring
+ the internal storage array out of JSObject we can increase the size in the
+ internal storage for regular objects.
+
+ Add classes JSFinalObject and JSNonFinalObject. JSNonFinalObject retains as
+ much additional capacity as is currently available to allow for data members
+ in subclasses. JSFinalObject utilizes all available space for internal storage,
+ and only allows construction through JSFinalObject::create().
+
+ The additional storage made available in the JSObject means that we need no
+ longer rely on a union of the internal storage with a pointer to storage that
+ is only valid for external storage. This means we can go back to always having
+ a valid pointer to property storage, regardless of whether this is internal or
+ external. This simplifies some cases of access to the array from C code, and
+ significantly simplifies JIT access, since repatching no longer needs to be
+ able to change between a load of the storage pointer / a LEA of the internal
+ storage.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::repatchPointer):
+ * assembler/MIPSAssembler.h:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerARMv7.h:
+ * assembler/MacroAssemblerMIPS.h:
+ * assembler/MacroAssemblerX86.h:
+ * assembler/MacroAssemblerX86_64.h:
+ * assembler/RepatchBuffer.h:
+ * assembler/X86Assembler.h:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ * debugger/DebuggerActivation.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_resolve_global):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_resolve_global):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::emit_op_get_by_pname):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::emit_op_get_by_pname):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Arguments.h:
+ (JSC::Arguments::Arguments):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorInstance.h:
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::InterruptedExecutionError::InterruptedExecutionError):
+ (JSC::TerminatedExecutionError::TerminatedExecutionError):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalObject.h:
+ (JSC::constructEmptyObject):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::JSNotAnObject):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::createInheritorID):
+ (JSC::JSObject::allocatePropertyStorage):
+ * runtime/JSObject.h:
+ (JSC::JSObject::propertyStorage):
+ (JSC::JSNonFinalObject::JSNonFinalObject):
+ (JSC::JSNonFinalObject::createStructure):
+ (JSC::JSFinalObject::create):
+ (JSC::JSFinalObject::createStructure):
+ (JSC::JSFinalObject::JSFinalObject):
+ (JSC::JSObject::offsetOfInlineStorage):
+ (JSC::constructEmptyObject):
+ (JSC::createEmptyObjectStructure):
+ (JSC::JSObject::JSObject):
+ (JSC::JSObject::~JSObject):
+ (JSC::Structure::isUsingInlineStorage):
+ * runtime/JSObjectWithGlobalObject.cpp:
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSObjectWithGlobalObject.h:
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::TypeInfo):
+ (JSC::TypeInfo::isVanilla):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::JSVariableObject):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructObject):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * runtime/StrictEvalActivation.cpp:
+ (JSC::StrictEvalActivation::StrictEvalActivation):
+ * runtime/StrictEvalActivation.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::growPropertyStorageCapacity):
+
+2011-02-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Incorrect handling of global writes in dynamic contexts
+ https://bugs.webkit.org/show_bug.cgi?id=49383
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ Can't use the existing callframe to return an uncaught exception
+ as by definition that callframe has already been torn down.
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::ASTBuilder):
+ (JSC::ASTBuilder::varDeclarations):
+ (JSC::ASTBuilder::funcDeclarations):
+ (JSC::ASTBuilder::features):
+ (JSC::ASTBuilder::numConstants):
+ (JSC::ASTBuilder::createFuncDeclStatement):
+ (JSC::ASTBuilder::addVar):
+ (JSC::ASTBuilder::incConstants):
+ (JSC::ASTBuilder::usesThis):
+ (JSC::ASTBuilder::usesCatch):
+ (JSC::ASTBuilder::usesClosures):
+ (JSC::ASTBuilder::usesArguments):
+ (JSC::ASTBuilder::usesAssignment):
+ (JSC::ASTBuilder::usesWith):
+ (JSC::ASTBuilder::usesEval):
+ Don't need a vector of scopes in the ASTBuilder
+ * runtime/Operations.h:
+ (JSC::resolveBase):
+ In strict mode the optimisation that we use to skip a lookup
+ on the global object is incorrect and lead to us always
+ disallowing global writes when we needed to do a dynamic slot
+ lookup. Now the strict mode path actually checks for the
+ property.
+
+2011-02-15 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Windows build fix for
+ https://bugs.webkit.org/show_bug.cgi?id=54415
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Remove deleted files.
+
+2011-02-15 Oliver Hunt <oliver@apple.com>
+
+ Fix EFL build for
+ https://bugs.webkit.org/show_bug.cgi?id=54415
+
+ * CMakeLists.txt:
+
+2011-02-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Refactor handles and weak pointers to become nicer and more automatic
+ https://bugs.webkit.org/show_bug.cgi?id=54415
+
+ Move to a true handle based mechanism for GC value protection. This
+ also allows us to switch to a more sensible behaviour for weak pointers
+ in which weak pointers are automatically updated.
+
+ This allows us to remove the old (and convoluted) that required all
+ objects that may be held by a weak reference to be aware of the reference
+ and manually clear them in their destructors.
+
+ This also adds a few new data types to JSC that we use to efficiently
+ allocate and return the underlying handle storage.
+
+ This patch is largely renaming and removing now unnecessary destructors
+ from objects.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::create):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ (OpaqueJSClass::contextData):
+ (OpaqueJSClass::prototype):
+ * API/JSClassRef.h:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * collector/handles/Global.h: Added.
+ New Global handle type used to keep gc objects live, even if they're not
+ marked.
+ (JSC::Global::Global):
+ (JSC::Global::~Global):
+ (JSC::Global::set):
+ We can only assign directly to a global from another global.
+ In all other cases we need the JSGlobalData to be provided
+ explicitly so we use a set function.
+ (JSC::Global::operator=):
+ (JSC::Global::clear):
+ (JSC::Global::isHashTableDeletedValue):
+ (JSC::Global::internalSet):
+ * collector/handles/Handle.h: Added.
+ Root "Handle" type used for immutable handles and to provide the basic
+ APIs needed for pointer-like behaviour.
+ (JSC::HandleBase::operator!):
+ (JSC::HandleBase::operator UnspecifiedBoolType*):
+ (JSC::HandleBase::isEmpty):
+ (JSC::HandleBase::HandleBase):
+ (JSC::HandleBase::slot):
+ (JSC::HandleBase::invalidate):
+ (JSC::HandleBase::setSlot):
+ (JSC::HandleTypes::getFromSlot):
+ (JSC::HandleTypes::toJSValue):
+ (JSC::HandleTypes::validateUpcast):
+ (JSC::HandleConverter::operator->):
+ (JSC::HandleConverter::operator*):
+ (JSC::Handle::Handle):
+ (JSC::Handle::get):
+ (JSC::Handle::wrapSlot):
+ (JSC::operator==):
+ (JSC::operator!=):
+ * collector/handles/HandleHeap.cpp: Added.
+ New heap for global handles.
+ (JSC::HandleHeap::HandleHeap):
+ (JSC::HandleHeap::grow):
+ (JSC::HandleHeap::markStrongHandles):
+ (JSC::HandleHeap::updateAfterMark):
+ (JSC::HandleHeap::clearWeakPointers):
+ (JSC::HandleHeap::writeBarrier):
+ * collector/handles/HandleHeap.h: Added.
+ (JSC::HandleHeap::heapFor):
+ (JSC::HandleHeap::toHandle):
+ (JSC::HandleHeap::toNode):
+ (JSC::HandleHeap::allocate):
+ (JSC::HandleHeap::deallocate):
+ (JSC::HandleHeap::makeWeak):
+ Convert a hard handle into weak handle that does not
+ protect the object it points to.
+ (JSC::HandleHeap::makeSelfDestroying):
+ Converts a handle to a weak handle that will be returned
+ to the free list when the referenced object dies.
+ (JSC::HandleHeap::Node::Node):
+ (JSC::HandleHeap::Node::slot):
+ (JSC::HandleHeap::Node::handleHeap):
+ (JSC::HandleHeap::Node::setFinalizer):
+ (JSC::HandleHeap::Node::makeWeak):
+ (JSC::HandleHeap::Node::isWeak):
+ (JSC::HandleHeap::Node::makeSelfDestroying):
+ (JSC::HandleHeap::Node::isSelfDestroying):
+ (JSC::HandleHeap::Node::finalizer):
+ (JSC::HandleHeap::Node::setPrev):
+ (JSC::HandleHeap::Node::prev):
+ (JSC::HandleHeap::Node::setNext):
+ (JSC::HandleHeap::Node::next):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ * interpreter/Interpreter.h:
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::globalObjectCollected):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ * runtime/GCHandle.cpp: Removed.
+ * runtime/GCHandle.h: Removed.
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::markRoots):
+ * runtime/Heap.h:
+ (JSC::Heap::allocateGlobalHandle):
+ (JSC::Heap::reportExtraMemoryCost):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::allocateGlobalHandle):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::create):
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::createStructure):
+ (JSC::Structure::setEnumerationCache):
+ (JSC::Structure::clearEnumerationCache):
+ * runtime/Protect.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ * runtime/Structure.h:
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtrBase::get):
+ (JSC::WeakGCPtrBase::clear):
+ (JSC::WeakGCPtrBase::operator!):
+ (JSC::WeakGCPtrBase::operator UnspecifiedBoolType*):
+ (JSC::WeakGCPtrBase::~WeakGCPtrBase):
+ (JSC::WeakGCPtrBase::WeakGCPtrBase):
+ (JSC::WeakGCPtrBase::internalSet):
+ (JSC::LazyWeakGCPtr::LazyWeakGCPtr):
+ (JSC::LazyWeakGCPtr::set):
+ (JSC::WeakGCPtr::WeakGCPtr):
+ (JSC::WeakGCPtr::operator=):
+ * runtime/WriteBarrier.h:
+ * wtf/BlockStack.h: Added.
+ (WTF::::BlockStack):
+ (WTF::::~BlockStack):
+ (WTF::::blocks):
+ (WTF::::grow):
+ (WTF::::shrink):
+ * wtf/SentinelLinkedList.h: Added.
+ (WTF::::SentinelLinkedList):
+ (WTF::::begin):
+ (WTF::::end):
+ (WTF::::push):
+ (WTF::::remove):
+ * wtf/SinglyLinkedList.h: Added.
+ (WTF::::SinglyLinkedList):
+ (WTF::::isEmpty):
+ (WTF::::push):
+ (WTF::::pop):
+
+2011-02-15 Pratik Solanki <psolanki@apple.com>
+
+ Move WTF_USE_CFNETWORK to Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=54168
+
+ Reviewed by Darin Adler.
+
+ * wtf/Platform.h: Define WTF_USE_CFNETWORK for Windows builds.
+
+2011-02-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Moved MarkedBlock data members to the head of the block
+ https://bugs.webkit.org/show_bug.cgi?id=54482
+
+ This allows for a variable-sized tail, to accommodate oversized blocks.
+
+ SunSpider reports no change.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate):
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::destroy):
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::sweep):
+ * runtime/MarkedBlock.h: Added missing element to the CELLS_PER_BLOCK
+ calculation. This kind of error is why we want to migrate to the system
+ described below.
+
+ (JSC::roundUpToMultipleOf):
+ (JSC::MarkedBlock::firstCell):
+ (JSC::MarkedBlock::cells):
+ (JSC::MarkedBlock::cellNumber): Use subtraction instead of masking to
+ calculate cell number. The mask is no longer correct because the first
+ cell is not at the head of the block.
+
+ (JSC::MarkedBlock::forEach): Replaced m_cells data member with a cells()
+ accessor. We want to use sizeof(MarkedBlock) to calculate the size of the
+ block header, so we can't have an explicit data member to represent the block tail.
+
+ Also replaced iteration from zero with iteration from startCell(), since
+ the first N cells are now occupied by the header.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::reset): Replaced iteration from zero as above.
+
+2011-02-15 Chris Rogers <crogers@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix Mutex::tryLock() on Windows to work properly with PlatformCondition::timedWait()
+ https://bugs.webkit.org/show_bug.cgi?id=54408
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::PlatformCondition::timedWait):
+
+2011-02-15 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Remove some dead code in ARMv7
+ https://bugs.webkit.org/show_bug.cgi?id=54461
+
+ * assembler/ARMv7Assembler.h: remove dead code.
+
+2011-02-14 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber-stamped by Gavin Barraclough.
+
+ Some MarkedBlock refactoring.
+
+ Made cells private.
+
+ Renamed cells => m_cells
+ marked => m_marks.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate):
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::destroy):
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::sweep):
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::isEmpty):
+ (JSC::MarkedBlock::clearMarks):
+ (JSC::MarkedBlock::markCount):
+ (JSC::MarkedBlock::isMarked):
+ (JSC::MarkedBlock::testAndSetMarked):
+ (JSC::MarkedBlock::setMarked):
+ (JSC::MarkedBlock::forEach):
+
+2011-02-14 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add basic parser for Content Security Policy
+ https://bugs.webkit.org/show_bug.cgi?id=54379
+
+ Add a constructor for copying a Vector into a String. I suspect there
+ are a number of call sites that are doing this manually that would
+ benefit from being moved to this API.
+
+ * wtf/text/WTFString.h:
+ (WTF::String::String):
+
+2011-02-14 Pavel Podivilov <podivilov@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: use call frame column to determine execution line in source frame.
+ https://bugs.webkit.org/show_bug.cgi?id=54001
+
+ * wtf/text/TextPosition.h:
+ (WTF::ZeroBasedNumber::convertAsOneBasedInt):
+
+2011-02-13 Jeremy Moskovich <jeremy@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add a compile-time option to completely disable WebArchive support.
+ https://bugs.webkit.org/show_bug.cgi?id=52712
+
+ Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code.
+ Ports Affected:
+ WebArchive support is currently enabled for all ports that define PLATFORM(CF) apart from Qt.
+ This patch preserves this behavior except that it also disables support in the Chromium port.
+
+ * wtf/Platform.h: Add ENABLE_WEB_ARCHIVE definition and turn it off explicitly for Qt & Chromium ports.
+
+2011-02-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Bug 53760 - JSC fails to build with TOT Clang
+ https://bugs.webkit.org/show_bug.cgi?id=53760
+
+ Fix -Woverloaded-virtual warnings. This is also a 6% speedup on the v8 raytrace
+ benchmark; it is nothing-to-noise on everything else.
+
+ * API/JSCallbackObject.h: Remove pointlessly overloaded method.
+ * API/JSCallbackObjectFunctions.h: Ditto.
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::put): Change signature to match the base class. This implementation
+ was no longer being called by anyone. This wasn't noticed because it is merely an
+ optimization of the base class' implementation.
+ * runtime/Arguments.h: Ditto.
+
+2011-02-12 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Use /dev/urandom as the OSRandomSource on OS(DARWIN)
+ https://bugs.webkit.org/show_bug.cgi?id=54279
+
+ I'm not sure it makes much of a difference whether we use arc4random or
+ /dev/urandom on Mac. However, there's some aesthetic benefit to using
+ the same underlying API on as many platforms as reasonable.
+
+ * config.h:
+ * wtf/OSRandomSource.cpp:
+ (WTF::cryptographicallyRandomValuesFromOS):
+
+2011-02-12 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Kenneth Russell.
+
+ Enable ArrayBuffers by default
+ https://bugs.webkit.org/show_bug.cgi?id=54310
+
+ Export the required functions.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-11 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove explicit disable ENABLE_ASSEMBLER_WX_EXCLUSIVE on non-iOS ports
+ https://bugs.webkit.org/show_bug.cgi?id=54107
+
+ It is unnecessary to explicitly disable ENABLE_ASSEMBLER_WX_EXCLUSIVE
+ by the definition of ENABLE().
+
+ * wtf/Platform.h:
+
+2011-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Randomly touch some build files in the hopes of fixing the Qt build.
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+
+2011-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Garbage collection timer cycles forever, even when nothing is happening
+ https://bugs.webkit.org/show_bug.cgi?id=54320
+
+ (Rolling back in r78386 with the build fixed.)
+
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallbackPlatformData::trigger): Be sure to make
+ our timer inert after forcing a GC, to avoid GC'ing repeatedly.
+
+2011-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Used svn merge -r78386:78385 to roll out r78386 because it broke the build.
+
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallbackPlatformData::trigger):
+
+2011-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Garbage collection timer cycles forever, even when nothing is happening
+ https://bugs.webkit.org/show_bug.cgi?id=54320
+
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallbackPlatformData::trigger): Be sure to make
+ our timer inert after forcing a GC, to avoid GC'ing repeatedly.
+
+2011-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the Windows build: added an exported symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more encapsulation for the heap: Removed CollectorHeapIterator
+ https://bugs.webkit.org/show_bug.cgi?id=54298
+
+ CollectorHeapIterator is a God object that knows the internals of each
+ of the pieces of the heap. This undermines the encapsulation I'm trying
+ to achieve by splitting concepts into different classes.
+
+ As an alternative, I've given each class a forEach iteration function,
+ which takes a functor as an argument. Now, each class just needs to
+ know how to iterate the things it knows about.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed CollectorHeapIterator.
+
+ * debugger/Debugger.cpp:
+ (JSC::Recompiler::Recompiler):
+ (JSC::Recompiler::~Recompiler):
+ (JSC::Recompiler::operator()):
+ (JSC::Debugger::recompileAllJSFunctions): Updated to use forEach interface
+ instead of an iterator.
+
+ * runtime/CollectorHeapIterator.h: Removed.
+
+ * runtime/Heap.cpp:
+ (JSC::TypeCounter::TypeCounter):
+ (JSC::TypeCounter::typeName):
+ (JSC::TypeCounter::operator()):
+ (JSC::TypeCounter::take):
+ (JSC::Heap::protectedObjectTypeCounts):
+ (JSC::Heap::objectTypeCounts): Added forEach and removed iterator.
+
+ * runtime/Heap.h:
+ (JSC::Heap::forEach):
+ * runtime/JSGlobalData.cpp:
+ (JSC::Recompiler::operator()):
+ (JSC::JSGlobalData::recompileAllJSFunctions):
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::forEach): Added forEach. Removed friend declaration
+ for CollectorHeapIterator. Now, we can make all our data private and
+ change it without breaking any other classes.
+
+ * runtime/MarkedSpace.cpp:
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::forEach): Added forEach and removed iterator.
+
+2011-02-11 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ CryptographicRandomNumber has its threading ifdefs backwards
+ https://bugs.webkit.org/show_bug.cgi?id=54280
+
+ Turns out we want the mutex when thread is enabled. :)
+
+ * wtf/CryptographicallyRandomNumber.cpp:
+ (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomNumber):
+ (WTF::ARC4Stream::ARC4RandomNumberGenerator::randomValues):
+
+2011-02-10 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ WebKit should have a cryptographic RNG
+ https://bugs.webkit.org/show_bug.cgi?id=22049
+
+ Teach JavaScriptCore how to export this function.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more encapsulation for MarkedBlock: Made all constants private
+ so clients don't know whether allocations are fixed-sized or not
+ https://bugs.webkit.org/show_bug.cgi?id=54270
+
+ SunSpider reports no change.
+
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::advance): Updated for removal of HeapConstants.
+
+ * runtime/Error.cpp: Switched to using ASSERT_CLASS_FITS_IN_CELL, like
+ all other classes.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::allocate): Updated for removal of HeapConstants.
+ (JSC::Heap::reset): Updated to use size(), instead of calculating size
+ on our own.
+
+ * runtime/Heap.h: Moved the ASSERT here to MarkedBlock, since it enforces
+ on special knowledge of fixed-sizery, which only MarkedBlock is supposed
+ to know about.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate): Updated for removal of HeapConstants.
+ Also changed to reset nextCell to 0 at the end of a block, since that
+ seems more consistent.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs): Changed to use a fixed array of char.
+ This hard-coded size is a little wonky, but the compiler will tell us
+ if it's ever wrong, so I think it's OK.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::destroy):
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::sweep): Updated for removal of HeapConstants.
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::isEmpty):
+ (JSC::MarkedBlock::clearMarks):
+ (JSC::MarkedBlock::size):
+ (JSC::MarkedBlock::capacity): Made constants private to this class.
+ Removed HeapConstants. Added size() and capacity() functions.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::objectCount):
+ (JSC::MarkedSpace::size):
+ (JSC::MarkedSpace::capacity):
+ * runtime/MarkedSpace.h: Use MarkedBlock helper functions instead of
+ direct knowledge of MarkedBlock internals.
+
+2011-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more encapsulation for MarkedBlock: Made mark bits private
+ https://bugs.webkit.org/show_bug.cgi?id=54264
+
+ SunSpider reports no change.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots):
+ (JSC::Heap::reset): Renamed clearMarkBits => clearMarks, since clients
+ don't need to know that marks are represented as bits. Renamed
+ markedCells => markCount, since clients don't need to know that blocks
+ are split into cells.
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::isEmpty):
+ (JSC::MarkedBlock::clearMarks):
+ (JSC::MarkedBlock::markCount): New helper functions for encapsulating
+ the information clients actually need.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::destroy):
+ (JSC::MarkedSpace::shrink):
+ (JSC::MarkedSpace::clearMarks):
+ (JSC::MarkedSpace::markCount):
+ (JSC::MarkedSpace::objectCount):
+ * runtime/MarkedSpace.h: Use new helper functions instead of accessing
+ MarkedBlock data directly.
+
+2011-02-10 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Cached JavaScript Parser Data Being Left in Memory Cache
+ https://bugs.webkit.org/show_bug.cgi?id=54245
+
+ Added clear method which removes SourceProviderCache items.
+ Cleaned up extraneous whitespace.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * parser/SourceProviderCache.cpp:
+ (JSC::SourceProviderCache::~SourceProviderCache):
+ (JSC::SourceProviderCache::clear):
+ (JSC::SourceProviderCache::byteSize):
+ (JSC::SourceProviderCache::add):
+ * parser/SourceProviderCache.h:
+
+2011-02-10 Joseph Pecoraro <joepeck@webkit.org>
+
+ Follow-up fix to r78291. I should pass (int) 0, not '0' to memset.
+
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallback::commonConstructor): fix mistaken post-review change.
+
+2011-02-10 Joseph Pecoraro <joepeck@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Make DefaultGCActivityCallback for PLATFORM(CF) Easier to Subclass
+ https://bugs.webkit.org/show_bug.cgi?id=54257
+
+ A subclass may want to specify the CFRunLoop that the Garbage Collection
+ will happen on. It was difficult to manipulate this in a subclass because
+ the current DefaultGCActivityCallback class does this in its constructor.
+ This patch generalizes things a bit more so that a specific run loop can
+ be passed in to the constructor. This makes it so all run loop management
+ can stay in DefaultGCActivityCallback and a subclass can specify any runloop.
+
+ * runtime/GCActivityCallback.h: expose a PLATFORM(CF) constructor that can
+ specify the runloop GC can be scheduled on.
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback): two constructors,
+ one that specifies the run loop and passes that on to commonConstructor and
+ the old constructor defaults to the current run loop.
+ (JSC::DefaultGCActivityCallback::commonConstructor): do normal construction,
+ adding the timer to the given runloop.
+
+2011-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more encapsulation for MarkedBlock: Moved allocate() and sweep() into MarkedBlock
+ https://bugs.webkit.org/show_bug.cgi?id=54253
+
+ SunSpider reports no change.
+
+ * runtime/CollectorHeapIterator.h: Removed DeadObjectIterator, since it
+ is now unused.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reset): Moved the call to shrink() here, since it seems a
+ little more clear for MarkedSpace's client to tell it explicitly when to
+ shrink.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkedBlock::allocate): Split out from MarkedSpace::allocate.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::sweep): Split out from MarkedSpace::sweep, and
+ converted to more directly iterate a MarkedBlock based on knowing its
+ internal structure.
+
+ * runtime/MarkedBlock.h:
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::sweep):
+ * runtime/MarkedSpace.h: Split out the code mentioned above.
+
+2011-02-10 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Fix compilation error on OpenBSD
+ https://bugs.webkit.org/show_bug.cgi?id=53766
+
+ Add a HAVE_STRNSTR in Platform.h and define it only on Darwin and FreeBSD.
+
+ * wtf/Platform.h:
+ * wtf/StringExtras.h: Use HAVE(STRNSTR) now.
+
+2011-02-10 Adam Roben <aroben@apple.com>
+
+ Print locations of assertions and logs in a way that Visual Studio understands
+
+ With this change, double-clicking one of these locations in Visual Studio's Output Window
+ will focus that line of code in the editor.
+
+ Fixes <http://webkit.org/b/54208> Double-clicking locations of assertions/logs in Visual
+ Studio's Output Window does nothing
+
+ Reviewed by Alexey Proskuryakov.
+
+ * wtf/Assertions.cpp:
+ (printCallSite): Use OS(WINDOWS) instead of the meaningless OS(WIN). When we aren't using
+ the debug CRT (and thus can't call _CrtDbgReport), print the file and line number using the
+ same format that cl.exe uses when it prints compiler errors.
+
+2011-02-10 Dan Bernstein <mitz@apple.com>
+
+ LLVM Compiler build fix.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::create):
+
+2011-02-10 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Remove PCRE source from trunk
+ https://bugs.webkit.org/show_bug.cgi?id=54188
+
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * DerivedSources.pro:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.order:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * pcre/AUTHORS: Removed.
+ * pcre/COPYING: Removed.
+ * pcre/dftables: Removed.
+ * pcre/pcre.h: Removed.
+ * pcre/pcre.pri: Removed.
+ * pcre/pcre_compile.cpp: Removed.
+ * pcre/pcre_exec.cpp: Removed.
+ * pcre/pcre_internal.h: Removed.
+ * pcre/pcre_tables.cpp: Removed.
+ * pcre/pcre_ucp_searchfuncs.cpp: Removed.
+ * pcre/pcre_xclass.cpp: Removed.
+ * pcre/ucpinternal.h: Removed.
+ * pcre/ucptable.cpp: Removed.
+ * wscript:
+
+2011-02-10 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add randomValuesFromOS for OS(WINDOWS)
+ https://bugs.webkit.org/show_bug.cgi?id=54155
+
+ Use CryptGenRandom for generating cryptographically secure random numbers.
+ This will work on WinCE and MinGW too.
+
+ * config.h:
+ * wtf/OSRandomSource.cpp:
+ (WTF::randomValuesFromOS):
+
+2011-02-10 Jarred Nicholls <jarred@sencha.com>
+
+ Reviewed by Adam Barth.
+
+ REGRESSION(r78149): Return value of read() shouldn't be ignored.
+ https://bugs.webkit.org/show_bug.cgi?id=54167
+
+ stdio read should have its return value handled. Build error in gcc 4.4.5.
+
+ * wtf/OSRandomSource.cpp:
+ (WTF::randomValuesFromOS):
+
+2011-02-10 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Rename randomValuesFromOS to cryptographicallyRandomValuesFromOS
+ https://bugs.webkit.org/show_bug.cgi?id=54156
+
+ randomValuesFromOS generates random numbers of cryptographic quality.
+ Make this clear by adding "cryptographically" to the function name.
+
+ * wtf/CryptographicallyRandomNumber.cpp:
+ (WTF::ARC4Stream::ARC4RandomNumberGenerator::stir):
+ * wtf/OSRandomSource.cpp:
+ (WTF::cryptographicallyRandomValuesFromOS):
+ * wtf/OSRandomSource.h:
+
+2011-02-09 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/8805364> Malloc zone enumeration code should be safe in the face of errors from the memory reader.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::PageHeapAllocator::recordAdministrativeRegions): Use the new helper function to walk the linked list safely.
+ (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects): Ditto.
+ (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Ditto.
+ (WTF::TCMallocStats::PageMapFreeObjectFinder::visit): Bail out if the span could not be read.
+ (WTF::TCMallocStats::PageMapMemoryUsageRecorder::visit): Ditto.
+ * wtf/MallocZoneSupport.h:
+ (WTF::RemoteMemoryReader::operator()): Remove an assert that is not valid.
+ (WTF::RemoteMemoryReader::nextEntryInLinkedList): Add a helper function for retrieving the next entry in
+ a linked list. It maps a failed read of the remote memory in to a null pointer, which all callers can
+ handle gracefully.
+
+2011-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 54164 - Optimize global_var accesses on JSVALUE64
+
+ Directly embed the pointer to d->registers, optimize out the load
+ from the variable object, as we do already in JSVALUE32_64.
+
+ This is a ~1.5% win on sunspidey.
+
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * 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):
+
+2011-02-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more encapsulation for MarkedBlock: Made MarkedBlock responsible
+ for its own initialization and destruction
+ https://bugs.webkit.org/show_bug.cgi?id=54137
+
+ * runtime/CollectorHeapIterator.h: Removed ObjectIterator since it is
+ now unused.
+
+ * runtime/JSCell.h: Maded MarkedBlock a friend so it can construct and
+ destruct JSCells.
+
+ * runtime/MarkedBlock.cpp:
+ (JSC::MarkedBlock::create):
+ (JSC::MarkedBlock::destroy):
+ (JSC::MarkedBlock::MarkedBlock): Migrated initialization and destruction
+ code from MarkedSpace, updating it not to use ObjectIterator. We don't
+ want to use an abstract iterator since iteration will be unique to each
+ block in the future.
+
+ * runtime/MarkedBlock.h: Made the consructor private and moved it into
+ the .cpp file because it's big now.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::freeBlock): Migrated code.
+
+ * runtime/MarkedSpace.h:
+ (JSC::CollectorHeap::collectorBlock): Keep a vector of MarkedBlock
+ pointers instead of aligned allocations -- how MarkedBlocks are allocated
+ is now an implementation detail of MarkedBlock.
+
+2011-02-09 Adam Barth <abarth@webkit.org>
+
+ Another attempt to fix the Qt Windows build.
+
+ * config.h:
+ * wtf/OSRandomSource.cpp:
+ (WTF::randomValuesFromOS):
+
+2011-02-09 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix the Qt Windows build.
+
+ * wtf/OSRandomSource.cpp:
+ (WTF::randomValuesFromOS):
+
+2011-02-09 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add WTF::cryptographicallyRandomNumber
+ https://bugs.webkit.org/show_bug.cgi?id=54083
+
+ Introduce a cryptographically strong random number generator to WTF.
+ The random number generator is based on arc4random as found in:
+
+ http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/crypt/arc4random.c?rev=1.22
+
+ I've changed to source to WebKit style and abstracted the operating
+ system interaction to OSRandomSource. We'll use this functionality to
+ expose a cryptographically strong random number generator to
+ JavaScript.
+
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * config.h:
+ * wtf/CMakeLists.txt:
+ * wtf/CryptographicallyRandomNumber.cpp: Added.
+ (WTF::initMutexIfNeeded):
+ (WTF::init):
+ (WTF::addRandomData):
+ (WTF::stir):
+ (WTF::stirIfNeeded):
+ (WTF::getByte):
+ (WTF::getWord):
+ (WTF::cryptographicallyRandomNumber):
+ (WTF::cryptographicallyRandomValues):
+ * wtf/CryptographicallyRandomNumber.h: Added.
+ * wtf/OSRandomSource.cpp: Added.
+ (WTF::randomValuesFromOS):
+ * wtf/OSRandomSource.h: Added.
+ * wtf/wtf.pri:
+
+2011-02-09 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the build.
+
+ * wtf/Bitmap.h: Include string.h for memset. Not sure why this started
+ failing now.
+
+2011-02-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A tiny bit of encapsulation for MarkedBlock: made its heap data member private
+ https://bugs.webkit.org/show_bug.cgi?id=54129
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::isCellAligned):
+ (JSC::MarkedBlock::MarkedBlock):
+ (JSC::MarkedBlock::heap): Made the heap data member private, and provided
+ a constructor and an accessor.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocateBlock):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::heap): Use the constructor and accessor.
+
+2011-02-09 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Replace PCRE with Yarr in WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=53496
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * create_regex_tables:
+ * runtime/RegExp.cpp:
+ * wtf/Platform.h:
+ * yarr/Yarr.h:
+ * yarr/YarrJIT.cpp:
+ * yarr/YarrJIT.h:
+ * yarr/YarrParser.h:
+ * yarr/YarrPattern.h:
+ * yarr/YarrSyntaxChecker.h:
+ * yarr/yarr.pri: Added.
+
+2011-02-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed some dead code from Heap
+ https://bugs.webkit.org/show_bug.cgi?id=54064
+
+ * runtime/MarkedSpace.cpp: Removed some now-unused constants and
+ declarations.
+
+ (JSC::MarkedSpace::allocate): Removed some ASSERTs that are also ASSERTed
+ by our caller. Removed redundant typedefs.
+
+2011-02-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use a vector to track blocks in the Heap, instead of hand-rolled vector-like code
+ https://bugs.webkit.org/show_bug.cgi?id=54062
+
+ SunSpider reports no change.
+
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::isValid):
+ (JSC::CollectorHeapIterator::isLive): Updated for new mark invariant: To
+ know if an object is live, you just need to test its mark bit.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::MarkedSpace): Moved waterMark and highWaterMark from
+ CollectorHeap into MarkedSpace, since they're global state. Removed call
+ to memset since CollectorHeap is a true class with its own constructor now.
+
+ (JSC::MarkedSpace::destroy): Change uses of m_heap.usedBlocks to
+ m_heap.blocks.size(), and m_heap.numBlocks to m_heap.blocks.capacity().
+
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::freeBlock): No need to manage our vector manually anymore.
+
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::shrink):
+ (JSC::MarkedSpace::clearMarkBits):
+ (JSC::MarkedSpace::markedCells):
+ (JSC::MarkedSpace::sweep):
+ (JSC::MarkedSpace::objectCount):
+ (JSC::MarkedSpace::capacity):
+ (JSC::MarkedSpace::reset):
+ (JSC::MarkedSpace::primaryHeapEnd):
+ * runtime/MarkedSpace.h:
+ (JSC::CollectorHeap::CollectorHeap):
+ (JSC::MarkedSpace::highWaterMark):
+ (JSC::MarkedSpace::setHighWaterMark):
+ (JSC::MarkedSpace::contains): Same as above.
+
+2011-02-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Give each MarkedBlock enough mark bits to cover the whole block
+ https://bugs.webkit.org/show_bug.cgi?id=54029
+
+ SunSpider reports no change.
+
+ This simplifies access to mark bits, since any cell-aligned pointer
+ into a block now has a valid mark bit to test.
+
+ * runtime/MarkedBlock.h: Changed CELLS_PER_BLOCK to account for the extra
+ mark bits. This happens not to change its actual value.
+ (JSC::MarkedBlock::cellNumber):
+ (JSC::MarkedBlock::isMarked):
+ (JSC::MarkedBlock::testAndSetMarked):
+ (JSC::MarkedBlock::setMarked): Changed const JSCell* to const void* to
+ remove a cast from our caller, and to more accurately reflect the fact
+ that MarkedBlock is agnostic about the types pointed to by the pointers
+ you pass to it.
+
+ (JSC::MarkedBlock::isPossibleCell): Removed a null check. We now consider
+ the null pointer to be a possible cell with a 0 (impossible) block. This
+ removes a null check from marking.
+
+ * runtime/MarkedSpace.cpp:
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::contains): Simplified the contains check, and inlined
+ the whole thing, now that it's so simple.
+
+2011-02-08 Daniel Bates <dbates@rim.com>
+
+ Rubber-stamped by Martin Robinson.
+
+ Rename enum ProtectionSeting [sic] to ProtectionSetting.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::reprotectRegion):
+ * jit/ExecutableAllocator.h:
+
+2011-02-08 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Should not always define USE_SYSTEM_MALLOC
+ https://bugs.webkit.org/show_bug.cgi?id=54007
+
+ * wtf/Platform.h:
+
+2011-02-08 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ LLVM Compiler build fix.
+
+ * runtime/WriteBarrier.h:
+ (JSC::WriteBarrier::WriteBarrier):
+
+2011-02-07 Ryosuke Niwa <rniwa@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ JSVariableObject::setRegisters should take PassOwnArrayPtr for registersArray.
+ https://bugs.webkit.org/show_bug.cgi?id=53902
+
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters): Uses OwnArrayPtr<Register> instead of Register*.
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::copyGlobalsFrom): Ditto.
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::setRegisters): Takes PassOwnArrayPtr<Register> instead of Register*
+ for registerArray.
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::copyRegisterArray): Returns PassOwnArrayPtr<Register> instead of Register*.
+ (JSC::JSVariableObject::setRegisters): Takes PassOwnArrayPtr<Register> instead of Register*
+ for registerArray.
+
+2011-02-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed some dead code from Heap
+ https://bugs.webkit.org/show_bug.cgi?id=53969
+
+ SunSpider reports no change.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::shrink):
+ (JSC::MarkedSpace::sweep):
+ * runtime/MarkedSpace.h: Removed resizeBlocks and growBlocks, and
+ renamed shrinkBlocks to shrink, making it unconditionally shrink as
+ much as possible.
+
+2011-02-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Simplified the marked space's mark invariant
+ https://bugs.webkit.org/show_bug.cgi?id=53968
+
+ SunSpider reports no change.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate): Mark objects when allocating them. This
+ means that, at all times other than the mark phase, an object is live
+ if and only if it is marked.
+
+ (JSC::MarkedSpace::containsSlowCase): Use the new mark invariant to
+ simplify testing whether an object is live.
+
+2011-02-07 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=53950
+ USE_WK_SCROLLBAR_PAINTER in ScrollbarThemeMac should be in
+ Platform.h instead
+
+ * wtf/Platform.h:
+
+2011-02-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ Add built-in decoder for UTF-8 for improved performance
+ https://bugs.webkit.org/show_bug.cgi?id=53898
+
+ * wtf/unicode/UnicodeMacrosFromICU.h: Added U8_MAX_LENGTH and
+ U8_APPEND_UNSAFE. Also fixed header.
+
+2011-02-07 Adam Roben <aroben@apple.com>
+
+ Delete precompiled headers whenever any .vsprops file changes
+
+ Precompiled headers need to be rebuilt if, e.g., an ENABLE_* macro is changed in one of our
+ .vsprops files. Unfortunately, Visual Studio isn't smart enough to figure this out, so we
+ give it some assistance by deleting the precompiled headers whenever any .vsprops file
+ changes.
+
+ I also made some drive-by fixes while I was in the area.
+
+ Fixes <http://webkit.org/b/53826> react-to-vsprops-changes.py doesn't force precompiled
+ headers to be rebuilt, but should
+
+ Reviewed by David Kilzer.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Stop ignoring the
+ return code from react-to-vsprops-changes.py so we will notice when errors are introduced.
+ But skip the script entirely in production builds, where it is both unnecessary and can't
+ function correctly (due to not having the entire source tree available to it).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+ (main): Removed an extra '*' in the glob for finding manifest files. The extra '*' was
+ leftover from before we rearranged WebKitBuild in r75138. Moved code to delete an old file
+ to the new delete_if_older_than function. Added code to delete any precompiled headers older
+ than the newest .vsprops file.
+ (delete_if_older_than): Added. Code came from main.
+
+2011-02-07 Antti Koivisto <antti@apple.com>
+
+ Not reviewed.
+
+ ASSERTS_DISABLED -> ASSERT_DISABLED
+
+ * wtf/BloomFilter.h:
+
+2011-02-06 Ryosuke Niwa <rniwa@webkit.org>
+
+ Unreviewed; speculative Qt build fix.
+
+ * JavaScriptCore.pro:
+
+2011-02-06 Ryosuke Niwa <rniwa@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
+ https://bugs.webkit.org/show_bug.cgi?id=52867
+
+ Removed LOOSE_OWN_ARRAY_PTR and OwnArrayPtr<T>::set. Replaced all calls to OwnArrayPtr::set
+ and loose instantiation of OwnArrayPtr by calls to operator= and adoptArrayPtr. Also removed
+ OwnArrayPtrCommon.h since PassOwnArrayPtr.h needs to include OwnArrayPtr.h and there is
+ no point in putting deleteOwnedArrayPtr into a separate header.
+
+ Note: if this patch breaks build, the code is either instiantiating OwnArrayPtr
+ without calling adoptArrayPtr or calling set on ArrayOwnPtr instead of operator=.
+
+ No tests are added since this is a refactoring.
+
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString): Calls adoptArrayPtr.
+ * GNUmakefile.am: Removed OwnArrayPtrCommon.h
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::deleteProperty): Calls adoptArrayPtr.
+ * runtime/Arguments.h:
+ (JSC::Arguments::copyRegisters): Ditto.
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator): Ditto.
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::setRegisters): Calls operator= instead of set.
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain): Ditto.
+ * wtf/CMakeLists.txt:
+ * wtf/DateMath.h:
+ (JSC::GregorianDateTime::GregorianDateTime): No longer instnatiates OwnArrayPtr
+ with a null pointer.
+ * wtf/OwnArrayPtr.h:
+ * wtf/OwnArrayPtrCommon.h: Removed.
+ * wtf/PassOwnArrayPtr.h: No longer includes OwnArrayCommon.h
+ (WTF::deleteOwnedArrayPtr): Moved from OwnArrayPtrCommon.h
+
+2011-02-06 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Use bloom filter for descendant selector filtering
+ https://bugs.webkit.org/show_bug.cgi?id=53880
+
+ Implement a bloom filter with k=2 and 8 bit counting.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/BloomFilter.h: Added.
+ (WTF::BloomFilter::maximumCount):
+ (WTF::BloomFilter::BloomFilter):
+ (WTF::BloomFilter::mayContain):
+ (WTF::BloomFilter::add):
+ (WTF::BloomFilter::remove):
+ (WTF::BloomFilter::firstSlot):
+ (WTF::BloomFilter::secondSlot):
+ (WTF::::add):
+ (WTF::::remove):
+ (WTF::::clear):
+ (WTF::::likelyEmpty):
+ (WTF::::isClear):
+
+2011-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Rolled back in r77612 with ASSERT/crash fixed.
+ https://bugs.webkit.org/show_bug.cgi?id=53759
+
+ Don't shrink the heap to 0 unconditionally. Instead, shrink to 1 if
+ necessary. For now, the heap assumes that it always has at least one
+ block live.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::reset):
+ * runtime/Heap.h:
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::shrinkBlocks):
+ (JSC::MarkedSpace::sweep):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::highWaterMark):
+ (JSC::MarkedSpace::setHighWaterMark):
+
+2011-02-04 David Kilzer <ddkilzer@apple.com>
+
+ BUILD FIX: REALLY remove the last vestiges of JSVALUE32!
+
+ <rdar://problem/8957409> Remove last vestiges of JSVALUE32
+ <http://webkit.org/b/53779>
+
+ * DerivedSources.make: Removed dependency on
+ JavaScriptCore.JSVALUE32.exp.
+
+2011-02-04 David Kilzer <ddkilzer@apple.com>
+
+ <rdar://problem/8957409> Remove last vestiges of JSVALUE32
+ <http://webkit.org/b/53779>
+
+ Reviewed by Darin Adler.
+
+ Support for JSVALUE32 was originaly removed in r70111.
+
+ * Configurations/JavaScriptCore.xcconfig: Changed armv6 to use
+ JavaScriptCore.JSVALUE32_64.exp and ppc64 to use
+ JavaScriptCore.JSVALUE64.exp to match Platform.h.
+ * DerivedSources.make: Removed rule for
+ JavaScriptCore.JSVALUE32.exp.
+ * JavaScriptCore.JSVALUE32only.exp: Removed.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Removed references
+ to JavaScriptCore.JSVALUE32only.exp.
+
+2011-02-04 David Kilzer <ddkilzer@apple.com>
+
+ Use static_cast and other style cleanup in YarrInterpreter.cpp
+ <http://webkit.org/b/53772>
+
+ Reviewed by John Sullivan.
+
+ * yarr/YarrInterpreter.cpp:
+ (JSC::Yarr::Interpreter::InputStream::readChecked): Use
+ static_cast.
+ (JSC::Yarr::Interpreter::InputStream::checkInput): Remove
+ unnecessary else block.
+ (JSC::Yarr::Interpreter::matchAssertionEOL): Ditto.
+ (JSC::Yarr::Interpreter::backtrackBackReference): Ditto.
+ (JSC::Yarr::ByteCompiler::emitDisjunction): Use static_cast.
+
+2011-02-04 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r77625 and r77626.
+ http://trac.webkit.org/changeset/77625
+ http://trac.webkit.org/changeset/77626
+ https://bugs.webkit.org/show_bug.cgi?id=53765
+
+ It broke Windows builds (Requested by Ossy_ on #webkit).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * create_regex_tables:
+ * runtime/RegExp.cpp:
+ * wtf/Platform.h:
+ * yarr/Yarr.h:
+ * yarr/YarrJIT.cpp:
+ * yarr/YarrJIT.h:
+ * yarr/YarrParser.h:
+ * yarr/YarrPattern.h:
+ * yarr/YarrSyntaxChecker.h:
+ * yarr/yarr.pri: Removed.
+
+2011-02-04 Jessie Berlin <jberlin@apple.com>
+
+ Windows build fix. Unreviewed.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2011-02-04 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Replace PCRE with Yarr in WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=53496
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * create_regex_tables:
+ * runtime/RegExp.cpp:
+ * wtf/Platform.h:
+ * yarr/Yarr.h:
+ * yarr/YarrJIT.cpp:
+ * yarr/YarrJIT.h:
+ * yarr/YarrParser.h:
+ * yarr/YarrPattern.h:
+ * yarr/YarrSyntaxChecker.h:
+ * yarr/yarr.pri: Added.
+
+2011-02-04 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Unreviewed rollout two patches r77614 and r77612.
+
+ REGRESSION: Snow Leopard Intel Release anumber of failing tests.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::reset):
+ * runtime/Heap.h:
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::sweep):
+ (JSC::MarkedSpace::reset):
+ * runtime/MarkedSpace.h:
+
+2011-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix 32bit build.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reset): Use an explicit cast to avoid shortening warnings,
+ since 1.5 is double (64bit), and the result is size_t (32bit).
+
+2011-02-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Changed MarkedSpace to delegate grow/shrink decisions to Heap
+ https://bugs.webkit.org/show_bug.cgi?id=53759
+
+ SunSpider reports no change.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::reset):
+ * runtime/Heap.h: Reorganized a few data members for better cache locality.
+ Added a grow policy.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::sweep):
+ (JSC::MarkedSpace::reset): Don't shrink automatically. Instead, wait for
+ the heap to make an explicit sweep call.
+
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::highWaterMark):
+ (JSC::MarkedSpace::setHighWaterMark): Use a watermark to determine how
+ many bytes to allocate before failing and giving the heap an opportunity
+ to collect garbage. This also means that we allocate blocks on demand,
+ instead of ahead of time.
+
+2011-02-03 James Kozianski <koz@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add navigator.registerProtocolHandler behind a flag.
+ https://bugs.webkit.org/show_bug.cgi?id=52609
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-02-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Not all blocks are freed when the heap is freed (counting is hard!)
+ https://bugs.webkit.org/show_bug.cgi?id=53732
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::destroy): Freeing a block compacts the list, so just
+ keep freeing block 0 until there are no blocks left.
+
+2011-02-03 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the Mac build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: The new MarkedBlock.h header
+ needs to be private, not project, so other projects can include headers
+ that depend on it.
+
+2011-02-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Start using MarkedBlock instead of CollectorBlock
+ https://bugs.webkit.org/show_bug.cgi?id=53693
+
+ SunSpider reports no change.
+
+ * runtime/MarkedBlock.h:
+ (JSC::MarkedBlock::blockFor):
+ (JSC::MarkedBlock::setMarked):
+ (JSC::MarkedBlock::isCellAligned):
+ (JSC::MarkedBlock::isPossibleCell): Updated for const-ness.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::containsSlowCase):
+ (JSC::MarkedSpace::clearMarkBits): Updated for const-ness.
+
+ * runtime/MarkedSpace.h:
+ (JSC::CollectorHeap::collectorBlock):
+ (JSC::MarkedSpace::heap):
+ (JSC::MarkedSpace::isMarked):
+ (JSC::MarkedSpace::testAndSetMarked):
+ (JSC::MarkedSpace::setMarked):
+ (JSC::MarkedSpace::contains): Switched from CollectorBlock to MarkedBlock,
+ and deleted dead CollectorBlock-related code.
+
+2011-02-03 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Avoid strlen() in AtomicString::fromUTF8
+ https://bugs.webkit.org/show_bug.cgi?id=50516
+
+ Add an overload to calculateStringHashFromUTF8 to get
+ strlen() of the input data with only one call.
+
+ This change shows about 3% performance win on the xml-parser benchmark.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/text/AtomicString.cpp:
+ (WTF::AtomicString::fromUTF8):
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::calculateStringHashAndLengthFromUTF8Internal):
+ (WTF::Unicode::calculateStringHashFromUTF8):
+ (WTF::Unicode::calculateStringHashAndLengthFromUTF8):
+ * wtf/unicode/UTF8.h:
+
+2011-02-02 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-02-02 Gavin Barraclough <barraclough@apple.com>
+
+ oops, build fix!
+
+ * wtf/Assertions.cpp:
+
+2011-02-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 53650 - Add a BACKTRACE macro to Assertions.h
+
+ Add a BACKTRACE macro to Assertions.h, which will print a backtrace on
+ debug Mac builds, make CRASH (and thus ASSERT) automatically call this.
+
+ * JavaScriptCore.exp:
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+
+2011-02-02 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improper backtrack of nested non-capturing greedy paren to prior paren
+ https://bugs.webkit.org/show_bug.cgi?id=53261
+
+ A paren that follows a non-capturing greedy paren nested within a
+ non-capturing fixed paren was back tracking to the last paren
+ processed instead of the immediately prior paren.
+ Refactored default backtracking of parens to prior paren to work for
+ both nested (within) and immediately prior (after) parens.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::GenerationState::addParenthesesTail):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::TermGenerationState):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::setJumpListToPriorParen):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::getJumpListToPriorParen):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::ParenthesesTail):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::generateCode):
+ (JSC::Yarr::YarrGenerator::generateParenthesesDisjunction):
+ (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
+ (JSC::Yarr::YarrGenerator::generateDisjunction):
+
+2011-02-02 Jeff Miller <jeffm@apple.com>
+
+ Reviewed by Darin Adler and Steve Falkenburg.
+
+ Add DerivedSources.make to some Visual Studio projects
+ https://bugs.webkit.org/show_bug.cgi?id=53607
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Add DerivedSources.make.
+
+2011-02-02 Steve Lacey <sjl@chromium.org>
+
+ Reviewed by Eric Carlson.
+
+ Implement basic media statistics on media elements.
+ https://bugs.webkit.org/show_bug.cgi?id=53322
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-02-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fixes for wxWebKit.
+
+ * wtf/wx/StringWx.cpp:
+ (WTF::String::String):
+
+2011-02-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more Heap refactoring
+ https://bugs.webkit.org/show_bug.cgi?id=53577
+
+ SunSpider reports no change.
+
+ Split out MarkedBlock into its own file / class.
+
+ Did the following renames:
+ isCellMarked => isMarked
+ checkMarkCell => testAndSetMarked
+ markCell => setMarked
+ cellOffset => cellNumber
+ collectorBlock => blockFor
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Heap.cpp:
+ (JSC::WeakGCHandlePool::update):
+ * runtime/Heap.h:
+ (JSC::Heap::isMarked):
+ (JSC::Heap::testAndSetMarked):
+ (JSC::Heap::setMarked):
+ * runtime/JSArray.h:
+ (JSC::MarkStack::markChildren):
+ (JSC::MarkStack::drain):
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkStack::internalAppend):
+ * runtime/MarkedBlock.cpp: Added.
+ * runtime/MarkedBlock.h: Added.
+ (JSC::MarkedBlock::blockFor):
+ (JSC::MarkedBlock::cellNumber):
+ (JSC::MarkedBlock::isMarked):
+ (JSC::MarkedBlock::testAndSetMarked):
+ (JSC::MarkedBlock::setMarked):
+ (JSC::MarkedBlock::isCellAligned):
+ (JSC::MarkedBlock::isPossibleCell):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::isMarked):
+ (JSC::MarkedSpace::testAndSetMarked):
+ (JSC::MarkedSpace::setMarked):
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::isValid):
+ (JSC::::get):
+ (JSC::::take):
+ (JSC::::set):
+
+2011-02-02 Sam Weinig <sam@webkit.org>
+
+ Fix windows clean build.
+
+ * DerivedSources.make:
+
+2011-02-02 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Fix dist compilation
+ https://bugs.webkit.org/show_bug.cgi?id=53579
+
+ * GNUmakefile.am: Added WriteBarrier.h to the sources, it was
+ added in r77151
+
+2011-02-01 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r77297.
+ http://trac.webkit.org/changeset/77297
+ https://bugs.webkit.org/show_bug.cgi?id=53538
+
+ caused leopard crashes (Requested by paroga on #webkit).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/text/AtomicString.cpp:
+ (WTF::AtomicString::fromUTF8):
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::calculateStringHashFromUTF8):
+ * wtf/unicode/UTF8.h:
+
+2011-02-01 Sam Weinig <sam@webkit.org>
+
+ Fix Mac production builds.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-02-01 Sam Weinig <sam@webkit.org>
+
+ Try to fix the windows build.
+
+ * DerivedSources.make:
+
+2011-02-01 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Avoid strlen() in AtomicString::fromUTF8
+ https://bugs.webkit.org/show_bug.cgi?id=50516
+
+ Add an overload to calculateStringHashFromUTF8 to get
+ strlen() of the input data with only one call.
+
+ This change shows about 3% performance win on the xml-parser benchmark.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/text/AtomicString.cpp:
+ (WTF::AtomicString::fromUTF8):
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::calculateStringHashAndLengthFromUTF8Internal):
+ (WTF::Unicode::calculateStringHashFromUTF8):
+ (WTF::Unicode::calculateStringHashAndLengthFromUTF8):
+ * wtf/unicode/UTF8.h:
+
+2011-02-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Beth Dakin.
+
+ Part 2 for <rdar://problem/8492788>
+ Adopt WKScrollbarPainterController
+
+ Use header detection to define scrollbar painting controller #define.
+
+ * DerivedSources.make:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-02-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Refactor JSGlobalObject-related tear-down
+ https://bugs.webkit.org/show_bug.cgi?id=53478
+
+ While investigating crashes caused by r77082, I noticed some strange
+ destructor-time behaviors. This patch makes them less strange.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::globalObject):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::GlobalCodeBlock::~GlobalCodeBlock): Store the set of global code
+ blocks on the Heap, instead of on independent global objects. The heap
+ is guaranteed to outlast any GC-owned data structure. The heap is also
+ a natural place to store objects that needs out-of-band marking, since
+ the heap is responsible for marking all roots.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots):
+ (JSC::Heap::globalObjectCount):
+ (JSC::Heap::protectedGlobalObjectCount):
+ * runtime/Heap.h:
+ (JSC::Heap::codeBlocks):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::init):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ * runtime/MarkedSpace.cpp: Store the set of global objects in a weak map
+ owned by JSGlobalData, instead of an instrusive circular linked list.
+ This is simpler, and it avoids destructor-time access between garbage
+ collected objects, which is hard to get right.
+
+ (JSC::MarkedSpace::destroy): Make sure to clear mark bits before tearing
+ everything down. Otherwise, weak data structures will incorrectly report
+ that objects pending destruction are still alive.
+
+2011-02-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESSION(77082): GC-related crashes seen: on WebKit2 bot; on GTK 32bit
+ bot; loading trac pages; typing in search field
+ https://bugs.webkit.org/show_bug.cgi?id=53519
+
+ The crashes were all caused by failure to run an object's destructor.
+
+ * runtime/CollectorHeapIterator.h:
+ (JSC::ObjectIterator::ObjectIterator): Don't skip forward upon
+ construction. The iterator class used to do that when it was designed
+ for prior-to-beginning initialization. I forgot to remove this line
+ of code when I changed the iterator to normal initialization.
+
+ Skipping forward upon construction was causing the heap to skip running
+ the destructor for the very first object in a block when destroying the
+ block. This usually did not crash, since block destruction is rare and
+ most objects have pretty trivial destructors. However, in the rare case
+ when the heap would destroy a block whose first object was a global
+ object or a DOM node, BOOM.
+
+2011-01-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Update JSObject storage for new marking API
+ https://bugs.webkit.org/show_bug.cgi?id=53467
+
+ JSObject no longer uses EncodedJSValue for its property storage.
+ This produces a stream of mechanical changes to PropertySlot and
+ anonymous storage APIs.
+
+ * JavaScriptCore.exp:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanObject.cpp:
+ (JSC::BooleanObject::BooleanObject):
+ * runtime/BooleanObject.h:
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::getOwnPropertySlot):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::fillGetterPropertySlot):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::offsetForLocation):
+ (JSC::JSObject::putAnonymousValue):
+ (JSC::JSObject::clearAnonymousValue):
+ (JSC::JSObject::getAnonymousValue):
+ (JSC::JSObject::putThisToAnonymousValue):
+ (JSC::JSObject::locationForOffset):
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ * runtime/JSObjectWithGlobalObject.cpp:
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/NumberConstructor.cpp:
+ (JSC::constructWithNumberConstructor):
+ * runtime/NumberObject.cpp:
+ (JSC::NumberObject::NumberObject):
+ (JSC::constructNumber):
+ * runtime/NumberObject.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::getValue):
+ (JSC::PropertySlot::setValue):
+ (JSC::PropertySlot::setRegisterSlot):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/WriteBarrier.h:
+ (JSC::WriteBarrierBase::setWithoutWriteBarrier):
+
+2011-02-01 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Antonio Gomes.
+
+ Modify RandomNumberSeed.h to use USE(MERSENNE_TWISTER_19937)
+ https://bugs.webkit.org/show_bug.cgi?id=53506
+
+ Currently, use of the Mersenne Twister pseudorandom number generator
+ is hardcoded to the Windows CE port. With the passing of bug #53253,
+ we can generalize support for this PRNG to all ports that use srand(3)
+ and rand(3), including Windows CE.
+
+ * wtf/RandomNumberSeed.h:
+ (WTF::initializeRandomNumberGenerator):
+
+2011-02-01 Dave Tapuska <dtapuska@rim.com>
+
+ Reviewed by Gavin Barraclough.
+
+ MacroAssemblerARM would generate code that did 32bit loads
+ on addresses that were not aligned. More specifically it would
+ generate a ldr r8,[r1, #7] which isn't valid on ARMv5 and lower.
+ The intended instruction really is ldrb r8,[r1, #7]; ensure we
+ call load8 instead of load32.
+
+ https://bugs.webkit.org/show_bug.cgi?id=46095
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::set32Test32):
+ (JSC::MacroAssemblerARM::set32Test8):
+
+2011-02-01 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Fix some Visual Studio compiler warnings.
+ https://bugs.webkit.org/show_bug.cgi?id=53476
+
+ * wtf/MathExtras.h:
+ (clampToInteger):
+ (clampToPositiveInteger):
+ * wtf/ThreadingWin.cpp:
+ (WTF::absoluteTimeToWaitTimeoutInterval):
+
+2011-01-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bogus callframe during stack unwinding
+ https://bugs.webkit.org/show_bug.cgi?id=53454
+
+ Trying to access a callframe's globalData after destroying its
+ ScopeChain is not a good thing. While we could access the
+ globalData directly through the (known valid) scopechain we're
+ holding on to, it feels fragile. Instead we push the valid
+ ScopeChain onto the callframe again to ensure that the callframe
+ itself remains valid.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+
+2011-01-31 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Potentially Unsafe HashSet of RuntimeObject* in RootObject definition
+ https://bugs.webkit.org/show_bug.cgi?id=53271
+
+ Reapplying this change again.
+ Changed isValid() to use .get() as a result of change r77151.
+
+ Added new isValid() methods to check if a contained object in
+ a WeakGCMap is valid when using an unchecked iterator.
+
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::isValid):
+
+2011-01-31 Oliver Hunt <oliver@apple.com>
+
+ Convert markstack to a slot visitor API
+ https://bugs.webkit.org/show_bug.cgi?id=53219
+
+ rolling r77098, r77099, r77100, r77109, and
+ r77111 back in, along with a few more Qt fix attempts.
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::getPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::markChildren):
+ (JSC::JSCallbackObject::setPrivateProperty):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::put):
+ (JSC::::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ (JSObjectSetPrivateProperty):
+ * API/JSWeakObjectMapRefInternal.h:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::globalObject):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ (JSC::BytecodeGenerator::findScopedProperty):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ (JSC::DebuggerActivation::markChildren):
+ * debugger/DebuggerActivation.h:
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::exception):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::appendSourceToError):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::markLists):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::markChildren):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::setActivation):
+ (JSC::Arguments::Arguments):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSplice):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeSet::grow):
+ * runtime/ConservativeSet.h:
+ (JSC::ConservativeSet::~ConservativeSet):
+ (JSC::ConservativeSet::mark):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ (JSC::GetterSetter::getter):
+ (JSC::GetterSetter::setGetter):
+ (JSC::GetterSetter::setter):
+ (JSC::GetterSetter::setSetter):
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ (JSC::GlobalEvalFunction::markChildren):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::cachedGlobalObject):
+ * runtime/Heap.cpp:
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::value):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::put):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ * runtime/JSArray.h:
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::markChildrenDirect):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkStack::append):
+ (JSC::JSCell::MarkStack::internalAppend):
+ (JSC::JSCell::MarkStack::deprecatedAppend):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::regExpConstructor):
+ (JSC::JSGlobalObject::errorConstructor):
+ (JSC::JSGlobalObject::evalErrorConstructor):
+ (JSC::JSGlobalObject::rangeErrorConstructor):
+ (JSC::JSGlobalObject::referenceErrorConstructor):
+ (JSC::JSGlobalObject::syntaxErrorConstructor):
+ (JSC::JSGlobalObject::typeErrorConstructor):
+ (JSC::JSGlobalObject::URIErrorConstructor):
+ (JSC::JSGlobalObject::evalFunction):
+ (JSC::JSGlobalObject::objectPrototype):
+ (JSC::JSGlobalObject::functionPrototype):
+ (JSC::JSGlobalObject::arrayPrototype):
+ (JSC::JSGlobalObject::booleanPrototype):
+ (JSC::JSGlobalObject::stringPrototype):
+ (JSC::JSGlobalObject::numberPrototype):
+ (JSC::JSGlobalObject::datePrototype):
+ (JSC::JSGlobalObject::regExpPrototype):
+ (JSC::JSGlobalObject::methodCallDummy):
+ (JSC::Structure::prototypeForLookup):
+ (JSC::constructArray):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::object):
+ (JSC::Stringifier::Holder::objectSlot):
+ (JSC::Stringifier::markAggregate):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::Holder::appendNextProperty):
+ (JSC::Walker::callReviver):
+ (JSC::Walker::walk):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirectOffset):
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::putUndefinedAtDirectOffset):
+ (JSC::JSObject::flattenDictionaryObject):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::JSValue::putDirect):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSString.cpp:
+ (JSC::StringObject::create):
+ * runtime/JSValue.h:
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::markChildren):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStack):
+ (JSC::MarkStack::deprecatedAppendValues):
+ (JSC::MarkStack::appendValues):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ (JSC::constructWithNumberConstructor):
+ * runtime/NumberObject.cpp:
+ (JSC::constructNumber):
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ (JSC::resolveBase):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::setExistingProperty):
+ (JSC::PutPropertySlot::setNewProperty):
+ (JSC::PutPropertySlot::base):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChainIterator::operator*):
+ (JSC::ScopeChainIterator::operator->):
+ (JSC::ScopeChain::top):
+ * runtime/ScopeChainMark.h:
+ (JSC::ScopeChain::markAggregate):
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ (JSC::SmallStrings::markChildren):
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::emptyString):
+ (JSC::SmallStrings::singleCharacterString):
+ (JSC::SmallStrings::singleCharacterStrings):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ * runtime/Structure.h:
+ (JSC::Structure::storedPrototype):
+ (JSC::Structure::storedPrototypeSlot):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::uncheckedGet):
+ (JSC::WeakGCMap::uncheckedGetSlot):
+ (JSC::::get):
+ (JSC::::take):
+ (JSC::::set):
+ (JSC::::uncheckedRemove):
+ * runtime/WriteBarrier.h: Added.
+ (JSC::DeprecatedPtr::DeprecatedPtr):
+ (JSC::DeprecatedPtr::get):
+ (JSC::DeprecatedPtr::operator*):
+ (JSC::DeprecatedPtr::operator->):
+ (JSC::DeprecatedPtr::slot):
+ (JSC::DeprecatedPtr::operator UnspecifiedBoolType*):
+ (JSC::DeprecatedPtr::operator!):
+ (JSC::WriteBarrierBase::set):
+ (JSC::WriteBarrierBase::get):
+ (JSC::WriteBarrierBase::operator*):
+ (JSC::WriteBarrierBase::operator->):
+ (JSC::WriteBarrierBase::clear):
+ (JSC::WriteBarrierBase::slot):
+ (JSC::WriteBarrierBase::operator UnspecifiedBoolType*):
+ (JSC::WriteBarrierBase::operator!):
+ (JSC::WriteBarrier::WriteBarrier):
+ (JSC::operator==):
+
+2011-01-31 Dan Winship <danw@gnome.org>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ wss (websockets ssl) support for gtk via new gio TLS support
+ https://bugs.webkit.org/show_bug.cgi?id=50344
+
+ Add a GPollableOutputStream typedef for TLS WebSockets support
+
+ * wtf/gobject/GTypedefs.h:
+
+2011-01-31 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=53352
+ Heavy external fragmentation in FixedVMPoolAllocator can lead to a CRASH().
+
+ The FixedVMPoolAllocator currently uses a best fix policy -
+ switch to first fit, this is less prone to external fragmentation.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::AllocationTableSizeClass::AllocationTableSizeClass):
+ (JSC::AllocationTableSizeClass::blockSize):
+ (JSC::AllocationTableSizeClass::blockCount):
+ (JSC::AllocationTableSizeClass::blockAlignment):
+ (JSC::AllocationTableSizeClass::size):
+ (JSC::AllocationTableLeaf::AllocationTableLeaf):
+ (JSC::AllocationTableLeaf::~AllocationTableLeaf):
+ (JSC::AllocationTableLeaf::allocate):
+ (JSC::AllocationTableLeaf::free):
+ (JSC::AllocationTableLeaf::isEmpty):
+ (JSC::AllocationTableLeaf::isFull):
+ (JSC::AllocationTableLeaf::size):
+ (JSC::AllocationTableLeaf::classForSize):
+ (JSC::AllocationTableLeaf::dump):
+ (JSC::LazyAllocationTable::LazyAllocationTable):
+ (JSC::LazyAllocationTable::~LazyAllocationTable):
+ (JSC::LazyAllocationTable::allocate):
+ (JSC::LazyAllocationTable::free):
+ (JSC::LazyAllocationTable::isEmpty):
+ (JSC::LazyAllocationTable::isFull):
+ (JSC::LazyAllocationTable::size):
+ (JSC::LazyAllocationTable::dump):
+ (JSC::LazyAllocationTable::classForSize):
+ (JSC::AllocationTableDirectory::AllocationTableDirectory):
+ (JSC::AllocationTableDirectory::~AllocationTableDirectory):
+ (JSC::AllocationTableDirectory::allocate):
+ (JSC::AllocationTableDirectory::free):
+ (JSC::AllocationTableDirectory::isEmpty):
+ (JSC::AllocationTableDirectory::isFull):
+ (JSC::AllocationTableDirectory::size):
+ (JSC::AllocationTableDirectory::classForSize):
+ (JSC::AllocationTableDirectory::dump):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::allocated):
+ (JSC::FixedVMPoolAllocator::isValid):
+ (JSC::FixedVMPoolAllocator::classForSize):
+ (JSC::FixedVMPoolAllocator::offsetToPointer):
+ (JSC::FixedVMPoolAllocator::pointerToOffset):
+ (JSC::ExecutableAllocator::committedByteCount):
+ (JSC::ExecutableAllocator::isValid):
+ (JSC::ExecutableAllocator::underMemoryPressure):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::PageReservation):
+ (WTF::PageReservation::commit):
+ (WTF::PageReservation::decommit):
+ (WTF::PageReservation::committed):
+
+2011-01-31 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r76969.
+ http://trac.webkit.org/changeset/76969
+ https://bugs.webkit.org/show_bug.cgi?id=53418
+
+ "It is causing crashes in GTK+ and Leopard bots" (Requested by
+ alexg__ on #webkit).
+
+ * runtime/WeakGCMap.h:
+
+2011-01-30 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed, rolling out r77098, r77099, r77100, r77109, and
+ r77111.
+ http://trac.webkit.org/changeset/77098
+ http://trac.webkit.org/changeset/77099
+ http://trac.webkit.org/changeset/77100
+ http://trac.webkit.org/changeset/77109
+ http://trac.webkit.org/changeset/77111
+ https://bugs.webkit.org/show_bug.cgi?id=53219
+
+ Qt build is broken
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::getPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::markChildren):
+ (JSC::JSCallbackObject::setPrivateProperty):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::put):
+ (JSC::::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ (JSObjectSetPrivateProperty):
+ * API/JSWeakObjectMapRefInternal.h:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::globalObject):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ (JSC::BytecodeGenerator::findScopedProperty):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ (JSC::DebuggerActivation::markChildren):
+ * debugger/DebuggerActivation.h:
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::exception):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::appendSourceToError):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::markLists):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::markChildren):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::setActivation):
+ (JSC::Arguments::Arguments):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSplice):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeSet::grow):
+ * runtime/ConservativeSet.h:
+ (JSC::ConservativeSet::~ConservativeSet):
+ (JSC::ConservativeSet::mark):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ (JSC::GetterSetter::getter):
+ (JSC::GetterSetter::setGetter):
+ (JSC::GetterSetter::setter):
+ (JSC::GetterSetter::setSetter):
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ (JSC::GlobalEvalFunction::markChildren):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::cachedGlobalObject):
+ * runtime/Heap.cpp:
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::value):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::put):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ * runtime/JSArray.h:
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::markChildrenDirect):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSValue::toThisObject):
+ (JSC::JSCell::MarkStack::append):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::regExpConstructor):
+ (JSC::JSGlobalObject::errorConstructor):
+ (JSC::JSGlobalObject::evalErrorConstructor):
+ (JSC::JSGlobalObject::rangeErrorConstructor):
+ (JSC::JSGlobalObject::referenceErrorConstructor):
+ (JSC::JSGlobalObject::syntaxErrorConstructor):
+ (JSC::JSGlobalObject::typeErrorConstructor):
+ (JSC::JSGlobalObject::URIErrorConstructor):
+ (JSC::JSGlobalObject::evalFunction):
+ (JSC::JSGlobalObject::objectPrototype):
+ (JSC::JSGlobalObject::functionPrototype):
+ (JSC::JSGlobalObject::arrayPrototype):
+ (JSC::JSGlobalObject::booleanPrototype):
+ (JSC::JSGlobalObject::stringPrototype):
+ (JSC::JSGlobalObject::numberPrototype):
+ (JSC::JSGlobalObject::datePrototype):
+ (JSC::JSGlobalObject::regExpPrototype):
+ (JSC::JSGlobalObject::methodCallDummy):
+ (JSC::Structure::prototypeForLookup):
+ (JSC::constructArray):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::object):
+ (JSC::Stringifier::markAggregate):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::Holder::appendNextProperty):
+ (JSC::Walker::callReviver):
+ (JSC::Walker::walk):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirectOffset):
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::flattenDictionaryObject):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::JSValue::putDirect):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSString.cpp:
+ (JSC::StringObject::create):
+ * runtime/JSValue.h:
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::markChildren):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::appendValues):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ (JSC::constructWithNumberConstructor):
+ * runtime/NumberObject.cpp:
+ (JSC::constructNumber):
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ (JSC::resolveBase):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::setExistingProperty):
+ (JSC::PutPropertySlot::setNewProperty):
+ (JSC::PutPropertySlot::base):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChainIterator::operator*):
+ (JSC::ScopeChainIterator::operator->):
+ (JSC::ScopeChain::top):
+ * runtime/ScopeChainMark.h:
+ (JSC::ScopeChain::markAggregate):
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ (JSC::SmallStrings::markChildren):
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::emptyString):
+ (JSC::SmallStrings::singleCharacterString):
+ (JSC::SmallStrings::singleCharacterStrings):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ * runtime/Structure.h:
+ (JSC::Structure::storedPrototype):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::uncheckedGet):
+ (JSC::WeakGCMap::isValid):
+ (JSC::::get):
+ (JSC::::take):
+ (JSC::::set):
+ (JSC::::uncheckedRemove):
+ * runtime/WriteBarrier.h: Removed.
+
+2011-01-30 Simon Fraser <simon.fraser@apple.com>
+
+ Build fix the build fix. I assume Oliver meant m_cell, not m_value.
+
+ * runtime/WriteBarrier.h:
+ (JSC::WriteBarrierBase::clear):
+
+2011-01-30 Oliver Hunt <oliver@apple.com>
+
+ More Qt build fixes
+
+ * runtime/WriteBarrier.h:
+ (JSC::WriteBarrierBase::clear):
+
+2011-01-30 Oliver Hunt <oliver@apple.com>
+
+ Convert markstack to a slot visitor API
+ https://bugs.webkit.org/show_bug.cgi?id=53219
+
+ rolling r77006 and r77020 back in.
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::getPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::markChildren):
+ (JSC::JSCallbackObject::setPrivateProperty):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::put):
+ (JSC::::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ (JSObjectSetPrivateProperty):
+ * API/JSWeakObjectMapRefInternal.h:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::globalObject):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ (JSC::BytecodeGenerator::findScopedProperty):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ (JSC::DebuggerActivation::markChildren):
+ * debugger/DebuggerActivation.h:
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::exception):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::appendSourceToError):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::markLists):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::markChildren):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::setActivation):
+ (JSC::Arguments::Arguments):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSplice):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeSet::grow):
+ * runtime/ConservativeSet.h:
+ (JSC::ConservativeSet::~ConservativeSet):
+ (JSC::ConservativeSet::mark):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ (JSC::GetterSetter::getter):
+ (JSC::GetterSetter::setGetter):
+ (JSC::GetterSetter::setter):
+ (JSC::GetterSetter::setSetter):
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ (JSC::GlobalEvalFunction::markChildren):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::cachedGlobalObject):
+ * runtime/Heap.cpp:
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::value):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::put):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ * runtime/JSArray.h:
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::markChildrenDirect):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkStack::append):
+ (JSC::JSCell::MarkStack::internalAppend):
+ (JSC::JSCell::MarkStack::deprecatedAppend):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::regExpConstructor):
+ (JSC::JSGlobalObject::errorConstructor):
+ (JSC::JSGlobalObject::evalErrorConstructor):
+ (JSC::JSGlobalObject::rangeErrorConstructor):
+ (JSC::JSGlobalObject::referenceErrorConstructor):
+ (JSC::JSGlobalObject::syntaxErrorConstructor):
+ (JSC::JSGlobalObject::typeErrorConstructor):
+ (JSC::JSGlobalObject::URIErrorConstructor):
+ (JSC::JSGlobalObject::evalFunction):
+ (JSC::JSGlobalObject::objectPrototype):
+ (JSC::JSGlobalObject::functionPrototype):
+ (JSC::JSGlobalObject::arrayPrototype):
+ (JSC::JSGlobalObject::booleanPrototype):
+ (JSC::JSGlobalObject::stringPrototype):
+ (JSC::JSGlobalObject::numberPrototype):
+ (JSC::JSGlobalObject::datePrototype):
+ (JSC::JSGlobalObject::regExpPrototype):
+ (JSC::JSGlobalObject::methodCallDummy):
+ (JSC::Structure::prototypeForLookup):
+ (JSC::constructArray):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::object):
+ (JSC::Stringifier::Holder::objectSlot):
+ (JSC::Stringifier::markAggregate):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::Holder::appendNextProperty):
+ (JSC::Walker::callReviver):
+ (JSC::Walker::walk):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirectOffset):
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::putUndefinedAtDirectOffset):
+ (JSC::JSObject::flattenDictionaryObject):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::JSValue::putDirect):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSString.cpp:
+ (JSC::StringObject::create):
+ * runtime/JSValue.h:
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::markChildren):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStack):
+ (JSC::MarkStack::deprecatedAppendValues):
+ (JSC::MarkStack::appendValues):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ (JSC::constructWithNumberConstructor):
+ * runtime/NumberObject.cpp:
+ (JSC::constructNumber):
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ (JSC::resolveBase):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::setExistingProperty):
+ (JSC::PutPropertySlot::setNewProperty):
+ (JSC::PutPropertySlot::base):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChainIterator::operator*):
+ (JSC::ScopeChainIterator::operator->):
+ (JSC::ScopeChain::top):
+ * runtime/ScopeChainMark.h:
+ (JSC::ScopeChain::markAggregate):
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ (JSC::SmallStrings::markChildren):
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::emptyString):
+ (JSC::SmallStrings::singleCharacterString):
+ (JSC::SmallStrings::singleCharacterStrings):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ * runtime/Structure.h:
+ (JSC::Structure::storedPrototype):
+ (JSC::Structure::storedPrototypeSlot):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::uncheckedGet):
+ (JSC::WeakGCMap::uncheckedGetSlot):
+ (JSC::WeakGCMap::isValid):
+ (JSC::::get):
+ (JSC::::take):
+ (JSC::::set):
+ (JSC::::uncheckedRemove):
+ * runtime/WriteBarrier.h: Added.
+ (JSC::DeprecatedPtr::DeprecatedPtr):
+ (JSC::DeprecatedPtr::get):
+ (JSC::DeprecatedPtr::operator*):
+ (JSC::DeprecatedPtr::operator->):
+ (JSC::DeprecatedPtr::slot):
+ (JSC::DeprecatedPtr::operator UnspecifiedBoolType*):
+ (JSC::DeprecatedPtr::operator!):
+ (JSC::WriteBarrierBase::set):
+ (JSC::WriteBarrierBase::get):
+ (JSC::WriteBarrierBase::operator*):
+ (JSC::WriteBarrierBase::operator->):
+ (JSC::WriteBarrierBase::slot):
+ (JSC::WriteBarrierBase::operator UnspecifiedBoolType*):
+ (JSC::WriteBarrierBase::operator!):
+ (JSC::WriteBarrier::WriteBarrier):
+ (JSC::operator==):
+
+2011-01-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Filter all Heap collection through a common reset function, in
+ preparation for adding features triggered by collection.
+ https://bugs.webkit.org/show_bug.cgi?id=53396
+
+ SunSpider reports no change.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reportExtraMemoryCostSlowCase): When we're over the extraCost
+ limit, just call collectAllGarbage() instead of rolling our own special
+ way of resetting the heap. In theory, this may be slower in some cases,
+ but it also fixes cases of pathological heap growth that we've seen,
+ where the only objects being allocated are temporary and huge
+ (<rdar://problem/8885843>).
+
+ (JSC::Heap::allocate):
+ (JSC::Heap::collectAllGarbage): Use the shared reset function.
+
+ (JSC::Heap::reset):
+ * runtime/Heap.h: Carved a new shared reset function out of the old
+ collectAllGarbage.
+
+2011-01-30 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r77025.
+ http://trac.webkit.org/changeset/77025
+ https://bugs.webkit.org/show_bug.cgi?id=53401
+
+ It made js1_5/Regress/regress-159334.js fail on 64 bit Linux
+ (Requested by Ossy on #webkit).
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (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::reverseSortFreeListEntriesByPointer):
+ (JSC::reverseSortCommonSizedAllocations):
+ (JSC::FixedVMPoolAllocator::release):
+ (JSC::FixedVMPoolAllocator::reuse):
+ (JSC::FixedVMPoolAllocator::addToFreeList):
+ (JSC::FixedVMPoolAllocator::coalesceFreeSpace):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::isValid):
+ (JSC::FixedVMPoolAllocator::allocInternal):
+ (JSC::FixedVMPoolAllocator::isWithinVMPool):
+ (JSC::FixedVMPoolAllocator::addToCommittedByteCount):
+ (JSC::ExecutableAllocator::committedByteCount):
+ (JSC::maybeModifyVMPoolSize):
+ (JSC::ExecutableAllocator::isValid):
+ (JSC::ExecutableAllocator::underMemoryPressure):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::PageReservation):
+ (WTF::PageReservation::commit):
+ (WTF::PageReservation::decommit):
+
+2011-01-30 Leo Yang <leo.yang@torchmobile.com.cn>
+
+ Reviewed by Daniel Bates.
+
+ Code style issue in JavaScriptCore/wtf/CurrentTime.h
+ https://bugs.webkit.org/show_bug.cgi?id=53394
+
+ According to rule #3 at http://webkit.org/coding/coding-style.html,
+ This patch fix style issue in CurrentTime.h.
+
+ No functionality change, no new tests.
+
+ * wtf/CurrentTime.h:
+ (WTF::currentTimeMS):
+ (WTF::getLocalTime):
+
+2011-01-30 Benjamin Poulain <ikipou@gmail.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] JavaScriptCore does not link on Mac if building WebKit 2
+ https://bugs.webkit.org/show_bug.cgi?id=53377
+
+ The option "-whole-archive" is not availabe with the libtool of Mac OS X,
+ instead, we can use "-all_load" on Mac.
+
+ * JavaScriptCore.pri:
+
+2011-01-29 Geoffrey Garen <ggaren@apple.com>
+
+ Sorry Leopard bot -- I committed a change by accident.
+
+ * JavaScriptCore.exp: You may have your symbols back now.
+
+2011-01-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Simplified Heap iteration
+ https://bugs.webkit.org/show_bug.cgi?id=53393
+
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::isValid):
+ (JSC::CollectorHeapIterator::isLive):
+ (JSC::CollectorHeapIterator::advance): Removed "max" argument to
+ advance because it's a constant.
+ (JSC::LiveObjectIterator::LiveObjectIterator):
+ (JSC::LiveObjectIterator::operator++):
+ (JSC::DeadObjectIterator::DeadObjectIterator):
+ (JSC::DeadObjectIterator::operator++):
+ (JSC::ObjectIterator::ObjectIterator):
+ (JSC::ObjectIterator::operator++): Factored out common checks into
+ two helper functions -- isValid() for "Am I past the end?" and isLive()
+ for "Is the cell I'm pointing to live?".
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::freeBlock):
+ (JSC::MarkedSpace::sweep): Always sweep from the beginning of the heap
+ to the end, to avoid making sweep subtly reliant on internal Heap state.
+ (JSC::MarkedSpace::primaryHeapBegin):
+ (JSC::MarkedSpace::primaryHeapEnd): Always be explicit about where
+ iteration begins.
+
+2011-01-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Simplified heap destruction
+ https://bugs.webkit.org/show_bug.cgi?id=53392
+
+ * JavaScriptCore.exp:
+ * runtime/Heap.cpp:
+ (JSC::Heap::destroy):
+ * runtime/Heap.h:
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::destroy):
+ * runtime/MarkedSpace.h: Don't go out of our way to destroy GC-protected
+ cells last -- the difficult contortions required to do so just don't seem
+ justified. We make no guarantees about GC protection after the client
+ throws away JSGlobalData, and it doesn't seem like any meaningful
+ guarantee is even possible.
+
+2011-01-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Switched heap to use the Bitmap class and removed CollectorBitmap
+ https://bugs.webkit.org/show_bug.cgi?id=53391
+
+ SunSpider says 1.005x as fast. Seems like a fluke.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate): Updated for rename and returning a value
+ rather than taking a value by reference.
+
+ * runtime/MarkedSpace.h: Code reuse is good.
+
+ * wtf/Bitmap.h:
+ (WTF::::testAndSet): Added, since this is the one thing Bitmap was missing
+ which CollectorBitmap had. (Renamed from the less conventional "getset".)
+
+ (WTF::::nextPossiblyUnset): Renamed and changed to return a value for
+ clarity. It's all the same with inlining.
+
+2011-01-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Some more Heap cleanup.
+ https://bugs.webkit.org/show_bug.cgi?id=53357
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Updated exported symbols.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reportExtraMemoryCostSlowCase): Renamed recordExtraCost to
+ reportExtraMemoryCostSlowCase to match our naming conventions.
+
+ (JSC::Heap::capacity): Renamed size to capacity because this function
+ returns the capacity of the heap, including unused portions.
+
+ * runtime/Heap.h:
+ (JSC::Heap::globalData):
+ (JSC::Heap::markedSpace):
+ (JSC::Heap::machineStackMarker):
+ (JSC::Heap::reportExtraMemoryCost): Moved statics to the top of the file.
+ Moved ctor and dtor to the beginning of the class definition. Grouped
+ functions by purpose.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::capacity): Renamed size to capacity because this
+ function returns the capacity of the heap, including unused portions.
+
+ * runtime/MarkedSpace.h: Removed statistics and the Statistics class because
+ the same information can be gotten just by calling size() and capacity().
+
+ * runtime/MemoryStatistics.cpp:
+ * runtime/MemoryStatistics.h: Ditto.
+
+2011-01-29 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Eric Seidel.
+
+ Move wince/mt19937ar.c to ThirdParty and make it a policy choice
+ https://bugs.webkit.org/show_bug.cgi?id=53253
+
+ Make inclusion of MT19937 a policy decision.
+
+ Currently, we hardcoded to use MT19937 when building for
+ Windows CE. Instead, we should make this a policy decision
+ with the Windows CE port using this by default.
+
+ * JavaScriptCore.pri: Append Source/ThirdParty to the end
+ of the list include directories.
+ * wtf/CMakeLists.txt: Ditto.
+ * wtf/Platform.h: Defined WTF_USE_MERSENNE_TWISTER_19937 when
+ building for Windows CE.
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber): Substituted USE(MERSENNE_TWISTER_19937) for OS(WINCE).
+
+2011-01-29 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Bug 53374 - Remove uses of unsafe string functions in debugging code
+ https://bugs.webkit.org/show_bug.cgi?id=53374
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::printTraceData):
+
+2011-01-29 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ JavaScriptCoreUseJIT environment variable broken
+ https://bugs.webkit.org/show_bug.cgi?id=53372
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Check the actual value in the string returned
+ by getenv() rather than just doing a NULL check on the return value.
+
+2011-01-29 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Move CharacterNames.h into WTF directory
+ https://bugs.webkit.org/show_bug.cgi?id=49618
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/unicode/CharacterNames.h: Renamed from WebCore/platform/text/CharacterNames.h.
+ * wtf/unicode/UTF8.cpp:
+
+2011-01-28 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add various clampToInt() methods to MathExtras.h
+ https://bugs.webkit.org/show_bug.cgi?id=52910
+
+ Add functions for clamping doubles and floats to valid int
+ ranges, for signed and positive integers.
+
+ * wtf/MathExtras.h:
+ (clampToInteger):
+ (clampToPositiveInteger):
+
+2011-01-28 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r77006 and r77020.
+ http://trac.webkit.org/changeset/77006
+ http://trac.webkit.org/changeset/77020
+ https://bugs.webkit.org/show_bug.cgi?id=53360
+
+ "Broke Windows tests" (Requested by rniwa on #webkit).
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::getPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::markChildren):
+ (JSC::JSCallbackObject::setPrivateProperty):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::put):
+ (JSC::::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ (JSObjectSetPrivateProperty):
+ * API/JSWeakObjectMapRefInternal.h:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::globalObject):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ (JSC::BytecodeGenerator::findScopedProperty):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ (JSC::DebuggerActivation::markChildren):
+ * debugger/DebuggerActivation.h:
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::exception):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::appendSourceToError):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::markLists):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::markChildren):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::setActivation):
+ (JSC::Arguments::Arguments):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSplice):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeSet::grow):
+ * runtime/ConservativeSet.h:
+ (JSC::ConservativeSet::~ConservativeSet):
+ (JSC::ConservativeSet::mark):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ (JSC::GetterSetter::getter):
+ (JSC::GetterSetter::setGetter):
+ (JSC::GetterSetter::setter):
+ (JSC::GetterSetter::setSetter):
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ (JSC::GlobalEvalFunction::markChildren):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::cachedGlobalObject):
+ * runtime/Heap.cpp:
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::value):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::put):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ * runtime/JSArray.h:
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::markChildrenDirect):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSValue::toThisObject):
+ (JSC::JSCell::MarkStack::append):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::regExpConstructor):
+ (JSC::JSGlobalObject::errorConstructor):
+ (JSC::JSGlobalObject::evalErrorConstructor):
+ (JSC::JSGlobalObject::rangeErrorConstructor):
+ (JSC::JSGlobalObject::referenceErrorConstructor):
+ (JSC::JSGlobalObject::syntaxErrorConstructor):
+ (JSC::JSGlobalObject::typeErrorConstructor):
+ (JSC::JSGlobalObject::URIErrorConstructor):
+ (JSC::JSGlobalObject::evalFunction):
+ (JSC::JSGlobalObject::objectPrototype):
+ (JSC::JSGlobalObject::functionPrototype):
+ (JSC::JSGlobalObject::arrayPrototype):
+ (JSC::JSGlobalObject::booleanPrototype):
+ (JSC::JSGlobalObject::stringPrototype):
+ (JSC::JSGlobalObject::numberPrototype):
+ (JSC::JSGlobalObject::datePrototype):
+ (JSC::JSGlobalObject::regExpPrototype):
+ (JSC::JSGlobalObject::methodCallDummy):
+ (JSC::Structure::prototypeForLookup):
+ (JSC::constructArray):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::object):
+ (JSC::Stringifier::markAggregate):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::Holder::appendNextProperty):
+ (JSC::Walker::callReviver):
+ (JSC::Walker::walk):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirectOffset):
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::flattenDictionaryObject):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::JSValue::putDirect):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSString.cpp:
+ (JSC::StringObject::create):
+ * runtime/JSValue.h:
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::markChildren):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::appendValues):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ (JSC::constructWithNumberConstructor):
+ * runtime/NumberObject.cpp:
+ (JSC::constructNumber):
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ (JSC::resolveBase):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::setExistingProperty):
+ (JSC::PutPropertySlot::setNewProperty):
+ (JSC::PutPropertySlot::base):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChainIterator::operator*):
+ (JSC::ScopeChainIterator::operator->):
+ (JSC::ScopeChain::top):
+ * runtime/ScopeChainMark.h:
+ (JSC::ScopeChain::markAggregate):
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ (JSC::SmallStrings::markChildren):
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::emptyString):
+ (JSC::SmallStrings::singleCharacterString):
+ (JSC::SmallStrings::singleCharacterStrings):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ * runtime/Structure.h:
+ (JSC::Structure::storedPrototype):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::uncheckedGet):
+ (JSC::WeakGCMap::isValid):
+ (JSC::::get):
+ (JSC::::take):
+ (JSC::::set):
+ (JSC::::uncheckedRemove):
+ * runtime/WriteBarrier.h: Removed.
+
+2011-01-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=53352
+ Heavy external fragmentation in FixedVMPoolAllocator can lead to a CRASH().
+
+ The FixedVMPoolAllocator currently uses a best fix policy -
+ switch to first fit, this is less prone to external fragmentation.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::AllocationTableSizeClass::AllocationTableSizeClass):
+ (JSC::AllocationTableSizeClass::blockSize):
+ (JSC::AllocationTableSizeClass::blockCount):
+ (JSC::AllocationTableSizeClass::blockAlignment):
+ (JSC::AllocationTableSizeClass::size):
+ (JSC::AllocationTableLeaf::AllocationTableLeaf):
+ (JSC::AllocationTableLeaf::~AllocationTableLeaf):
+ (JSC::AllocationTableLeaf::allocate):
+ (JSC::AllocationTableLeaf::free):
+ (JSC::AllocationTableLeaf::isEmpty):
+ (JSC::AllocationTableLeaf::isFull):
+ (JSC::AllocationTableLeaf::size):
+ (JSC::AllocationTableLeaf::classForSize):
+ (JSC::AllocationTableLeaf::dump):
+ (JSC::LazyAllocationTable::LazyAllocationTable):
+ (JSC::LazyAllocationTable::~LazyAllocationTable):
+ (JSC::LazyAllocationTable::allocate):
+ (JSC::LazyAllocationTable::free):
+ (JSC::LazyAllocationTable::isEmpty):
+ (JSC::LazyAllocationTable::isFull):
+ (JSC::LazyAllocationTable::size):
+ (JSC::LazyAllocationTable::dump):
+ (JSC::LazyAllocationTable::classForSize):
+ (JSC::AllocationTableDirectory::AllocationTableDirectory):
+ (JSC::AllocationTableDirectory::~AllocationTableDirectory):
+ (JSC::AllocationTableDirectory::allocate):
+ (JSC::AllocationTableDirectory::free):
+ (JSC::AllocationTableDirectory::isEmpty):
+ (JSC::AllocationTableDirectory::isFull):
+ (JSC::AllocationTableDirectory::size):
+ (JSC::AllocationTableDirectory::classForSize):
+ (JSC::AllocationTableDirectory::dump):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::allocated):
+ (JSC::FixedVMPoolAllocator::isValid):
+ (JSC::FixedVMPoolAllocator::classForSize):
+ (JSC::FixedVMPoolAllocator::offsetToPointer):
+ (JSC::FixedVMPoolAllocator::pointerToOffset):
+ (JSC::ExecutableAllocator::committedByteCount):
+ (JSC::ExecutableAllocator::isValid):
+ (JSC::ExecutableAllocator::underMemoryPressure):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::PageReservation):
+ (WTF::PageReservation::commit):
+ (WTF::PageReservation::decommit):
+ (WTF::PageReservation::committed):
+
+2011-01-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Convert markstack to a slot visitor API
+ https://bugs.webkit.org/show_bug.cgi?id=53219
+
+ Move the MarkStack over to a slot based marking API.
+
+ In order to avoiding aliasing concerns there are two new types
+ that need to be used when holding on to JSValues and JSCell that
+ need to be marked: WriteBarrier and DeprecatedPtr. WriteBarrier
+ is expected to be used for any JSValue or Cell that's lifetime and
+ marking is controlled by another GC object. DeprecatedPtr is used
+ for any value that we need to rework ownership for.
+
+ The change over to this model has produced a large amount of
+ code changes, but they are mostly mechanical (forwarding JSGlobalData,
+ etc).
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::getPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::markChildren):
+ (JSC::JSCallbackObject::setPrivateProperty):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::put):
+ (JSC::::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ (JSObjectSetPrivateProperty):
+ * API/JSWeakObjectMapRefInternal.h:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::globalObject):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ (JSC::BytecodeGenerator::findScopedProperty):
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ (JSC::DebuggerActivation::markChildren):
+ * debugger/DebuggerActivation.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::appendSourceToError):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Register.h:
+ (JSC::Register::jsValueSlot):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::markChildren):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::setActivation):
+ (JSC::Arguments::Arguments):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSplice):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/ConservativeSet.h:
+ (JSC::ConservativeSet::mark):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ (JSC::GetterSetter::getter):
+ (JSC::GetterSetter::setGetter):
+ (JSC::GetterSetter::setter):
+ (JSC::GetterSetter::setSetter):
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ (JSC::GlobalEvalFunction::markChildren):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::cachedGlobalObject):
+ * runtime/Heap.cpp:
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::value):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::put):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ * runtime/JSArray.h:
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::markChildrenDirect):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSCell.h:
+ (JSC::JSCell::MarkStack::append):
+ (JSC::JSCell::MarkStack::appendCell):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::regExpConstructor):
+ (JSC::JSGlobalObject::errorConstructor):
+ (JSC::JSGlobalObject::evalErrorConstructor):
+ (JSC::JSGlobalObject::rangeErrorConstructor):
+ (JSC::JSGlobalObject::referenceErrorConstructor):
+ (JSC::JSGlobalObject::syntaxErrorConstructor):
+ (JSC::JSGlobalObject::typeErrorConstructor):
+ (JSC::JSGlobalObject::URIErrorConstructor):
+ (JSC::JSGlobalObject::evalFunction):
+ (JSC::JSGlobalObject::objectPrototype):
+ (JSC::JSGlobalObject::functionPrototype):
+ (JSC::JSGlobalObject::arrayPrototype):
+ (JSC::JSGlobalObject::booleanPrototype):
+ (JSC::JSGlobalObject::stringPrototype):
+ (JSC::JSGlobalObject::numberPrototype):
+ (JSC::JSGlobalObject::datePrototype):
+ (JSC::JSGlobalObject::regExpPrototype):
+ (JSC::JSGlobalObject::methodCallDummy):
+ (JSC::constructArray):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::object):
+ (JSC::Stringifier::Holder::objectSlot):
+ (JSC::Stringifier::markAggregate):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::Holder::appendNextProperty):
+ (JSC::Walker::callReviver):
+ (JSC::Walker::walk):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::putUndefinedAtDirectOffset):
+ (JSC::JSObject::flattenDictionaryObject):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::JSValue::putDirect):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSString.cpp:
+ (JSC::StringObject::create):
+ * runtime/JSValue.h:
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::markChildren):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MarkStack.h:
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ (JSC::constructWithNumberConstructor):
+ * runtime/NumberObject.cpp:
+ (JSC::constructNumber):
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ (JSC::resolveBase):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::setExistingProperty):
+ (JSC::PutPropertySlot::setNewProperty):
+ (JSC::PutPropertySlot::base):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChainIterator::operator*):
+ (JSC::ScopeChainIterator::operator->):
+ (JSC::ScopeChain::top):
+ * runtime/ScopeChainMark.h:
+ (JSC::ScopeChain::markAggregate):
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ (JSC::SmallStrings::markChildren):
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::emptyString):
+ (JSC::SmallStrings::singleCharacterString):
+ (JSC::SmallStrings::singleCharacterStrings):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/Structure.cpp:
+ (JSC::Structure::flattenDictionaryStructure):
+ * runtime/Structure.h:
+ (JSC::Structure::storedPrototypeSlot):
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::uncheckedGet):
+ (JSC::WeakGCMap::uncheckedGetSlot):
+ (JSC::::get):
+ (JSC::::take):
+ (JSC::::set):
+ (JSC::::uncheckedRemove):
+ * runtime/WriteBarrier.h: Added.
+ (JSC::DeprecatedPtr::DeprecatedPtr):
+ (JSC::DeprecatedPtr::get):
+ (JSC::DeprecatedPtr::operator*):
+ (JSC::DeprecatedPtr::operator->):
+ (JSC::DeprecatedPtr::slot):
+ (JSC::DeprecatedPtr::operator UnspecifiedBoolType*):
+ (JSC::DeprecatedPtr::operator!):
+ (JSC::WriteBarrierBase::set):
+ (JSC::WriteBarrierBase::get):
+ (JSC::WriteBarrierBase::operator*):
+ (JSC::WriteBarrierBase::operator->):
+ (JSC::WriteBarrierBase::slot):
+ (JSC::WriteBarrierBase::operator UnspecifiedBoolType*):
+ (JSC::WriteBarrierBase::operator!):
+ (JSC::WriteBarrier::WriteBarrier):
+ (JSC::operator==):
+
+2011-01-28 Adam Roben <aroben@apple.com>
+
+ Chromium build fix after r76967
+
+ * wtf/ThreadingPrimitives.h: Use OS(WINDOWS) instead of PLATFORM(WIN), to match other
+ similar macros in this file.
+
+2011-01-28 Michael Saboff <msaboff@apple.com>
+
+ Potentially Unsafe HashSet of RuntimeObject* in RootObject definition
+ https://bugs.webkit.org/show_bug.cgi?id=53271
+
+ Reapplying this this change. No change from prior patch in
+ JavaScriptCore.
+
+ Added new isValid() methods to check if a contained object in
+ a WeakGCMap is valid when using an unchecked iterator.
+
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::isValid):
+
+2011-01-27 Adam Roben <aroben@apple.com>
+
+ Extract code to convert a WTF absolute time to a Win32 wait interval into a separate
+ function
+
+ Fixes <http://webkit.org/b/53208> <rdar://problem/8922490> BinarySemaphore should wrap a
+ Win32 event
+
+ Reviewed by Dave Hyatt.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export the new function.
+
+ * wtf/ThreadingPrimitives.h: Declare the new function.
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadCondition::timedWait): Moved code to convert the absolute time to a wait
+ interval from here...
+ (WTF::absoluteTimeToWaitTimeoutInterval): ...to here.
+
+2011-01-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add basic rubber banding support
+ <rdar://problem/8219429>
+ https://bugs.webkit.org/show_bug.cgi?id=53277
+
+ * wtf/Platform.h: Add ENABLE for rubber banding.
+
+2011-01-28 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r76893.
+ http://trac.webkit.org/changeset/76893
+ https://bugs.webkit.org/show_bug.cgi?id=53287
+
+ It made some tests crash on GTK and Qt debug bots (Requested
+ by Ossy on #webkit).
+
+ * runtime/WeakGCMap.h:
+
+2011-01-27 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add WTFString method to compare equality with Vector<UChar>
+ https://bugs.webkit.org/show_bug.cgi?id=53266
+
+ I'm planning to use this method in the new XSS filter implementation,
+ but it seems generally useful.
+
+ * wtf/text/StringImpl.h:
+ (WTF::equalIgnoringNullity):
+ * wtf/text/WTFString.h:
+ (WTF::equalIgnoringNullity):
+
+2011-01-27 Michael Saboff <msaboff@apple.com>
+
+ Potentially Unsafe HashSet of RuntimeObject* in RootObject definition
+ https://bugs.webkit.org/show_bug.cgi?id=53271
+
+ Added new isValid() methods to check if a contained object in
+ a WeakGCMap is valid when using an unchecked iterator.
+
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::isValid):
+
+2011-01-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add events to represent the start/end of a gesture scroll
+ https://bugs.webkit.org/show_bug.cgi?id=53215
+
+ * wtf/Platform.h: Add ENABLE for gesture events.
+
+2011-01-26 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt][Symbian] Fix --minimal build
+ https://bugs.webkit.org/show_bug.cgi?id=52839
+
+ Move definition of USE_SYSTEM_MALLOC out of pri file.
+ Put it in platform.h instead.
+
+ * wtf/Platform.h:
+ * wtf/TCSystemAlloc.cpp:
+ * wtf/wtf.pri:
+
+2011-01-26 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [WINCE] Add JIT support to build system
+ https://bugs.webkit.org/show_bug.cgi?id=53079
+
+ * CMakeListsWinCE.txt:
+
+2011-01-25 Adam Roben <aroben@apple.com>
+
+ Windows Production build fix
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Set BUILDSTYLE to Release_PGO at the very start
+ of the file so that ConfigurationBuildDir takes that into account. Also set it the right way
+ (by redefining the macro) rather than the wrong way (by modifying the environment variable).
+
+2011-01-25 Steve Falkenburg <sfalken@apple.com>
+
+ Rubber-stamped by Adam Roben.
+
+ Windows production build fix.
+ Use correct environment variable escaping
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2011-01-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ JSON.stringify processing time exponentially grows with size of object
+ https://bugs.webkit.org/show_bug.cgi?id=51922
+
+ Remove last use of reserveCapacity from JSON stringification, as it results
+ in appalling append behaviour when there are a large number of property names
+ and nothing else.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendQuotedString):
+
+2011-01-25 Antti Koivisto <antti@apple.com>
+
+ Not reviewed.
+
+ Try to fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2011-01-25 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESSION: Leak in JSParser::Scope::copyCapturedVariablesToVector()
+ https://bugs.webkit.org/show_bug.cgi?id=53061
+
+ Cache did not know about the subclass so failed to fully delete the items.
+ Got rid of the subclass and moved the classes to separate files.
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::saveFunctionInfo):
+ (JSC::JSParser::Scope::restoreFunctionInfo):
+ (JSC::JSParser::findCachedFunctionInfo):
+ (JSC::JSParser::parseFunctionInfo):
+ * parser/SourceProvider.h:
+ * parser/SourceProviderCache.cpp: Added.
+ (JSC::SourceProviderCache::~SourceProviderCache):
+ (JSC::SourceProviderCache::byteSize):
+ * parser/SourceProviderCache.h: Added.
+ (JSC::SourceProviderCache::SourceProviderCache):
+ (JSC::SourceProviderCache::add):
+ (JSC::SourceProviderCache::get):
+ * parser/SourceProviderCacheItem.h: Added.
+ (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
+ (JSC::SourceProviderCacheItem::approximateByteSize):
+ (JSC::SourceProviderCacheItem::closeBraceToken):
+
+2011-01-25 Marcilio Mendonca <mamendonca@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 53087: Refactoring: replaced a hanging "else" with a "return"
+ statement
+ https://bugs.webkit.org/show_bug.cgi?id=53087.
+
+ Refactoring work: Replaced a hanging "else" within an #if PLATFORM(M
+ with a "return" so that the code is more readable and less error pro
+ (e.g., "else" doesn't use braces so adding extra lines to the else
+ block won't have any effect; even worse, code still compiles
+ successfully.
+
+ * wtf/Assertions.cpp:
+
+2011-01-24 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Change ENABLE_3D_CANVAS to ENABLE_WEBGL
+ https://bugs.webkit.org/show_bug.cgi?id=53041
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2011-01-25 Adam Roben <aroben@apple.com>
+
+ Windows Production build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Added a missing "set".
+
+2011-01-25 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add missing defines for COMPILER(RVCT) && CPU(ARM_THUMB2)
+ https://bugs.webkit.org/show_bug.cgi?id=52949
+
+ * jit/JITStubs.cpp:
+
+2011-01-24 Adam Roben <aroben@apple.com>
+
+ Windows Production build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Update for move of JavaScriptCore into Source.
+
+2011-01-24 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Optimize regex patterns which contain empty alternatives
+ https://bugs.webkit.org/show_bug.cgi?id=51395
+
+ Eliminate the empty alternatives from the regex pattern and convert it to do
+ the matching in an easier way.
+
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::YarrPatternConstructor::atomParenthesesEnd):
+
+2011-01-24 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt] Move project files into Source
+ https://bugs.webkit.org/show_bug.cgi?id=52891
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+ * jsc.pro:
+
+2011-01-23 Mark Rowe <mrowe@apple.com>
+
+ Follow-up to r76477.
+
+ Fix the scripts that detect problematic code such as static initializers
+ and destructors, weak vtables, inappropriate files in the framework wrappers,
+ and public headers including private headers. These had all been broken
+ since the projects were moved in to the Source directory as the paths to the
+ scripts were not updated at that time.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2011-01-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Use WTF::StringHasher in WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=52934
+
+ Add an additional function to calculate the hash
+ of data with a runtimedependent size.
+
+ * wtf/StringHasher.h:
+ (WTF::StringHasher::createBlobHash):
+
+2011-01-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Fix comment in String::ascii()
+ https://bugs.webkit.org/show_bug.cgi?id=52980
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::ascii):
+
+2011-01-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Add String::containsOnlyLatin1()
+ https://bugs.webkit.org/show_bug.cgi?id=52979
+
+ * wtf/text/WTFString.h:
+ (WTF::String::containsOnlyLatin1):
+ (WTF::charactersAreAllLatin1):
+
+2011-01-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Remove obsolete JSVALUE32 code
+ https://bugs.webkit.org/show_bug.cgi?id=52948
+
+ r70111 removed support for JSVALUE32.
+ ARM, MIPS and X86 support JSVALUE32_64 only.
+
+ * jit/JITStubs.cpp:
+
+2011-01-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ ASSERT running run-webkit-tests --threaded.
+ https://bugs.webkit.org/show_bug.cgi?id=52971
+
+ SunSpider and v8 report no change.
+
+ * runtime/ConservativeSet.cpp:
+ (JSC::ConservativeSet::grow):
+ (JSC::ConservativeSet::add):
+ * runtime/ConservativeSet.h: Tweaked the inline capacity to 128, and
+ the growth policy to 2X, to make SunSpider and v8 happy.
+ (JSC::ConservativeSet::ConservativeSet):
+ (JSC::ConservativeSet::~ConservativeSet):
+ (JSC::ConservativeSet::mark): Use OSAllocator directly, instead of malloc.
+ Malloc is forbidden during a multi-threaded mark phase because it can
+ cause deadlock.
+
+2011-01-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ A few of Maciej's review suggestions for my last patch.
+ https://bugs.webkit.org/show_bug.cgi?id=52946
+
+ SunSpider reports no change.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Updated build systems.
+
+ * runtime/ConservativeSet.cpp: Added.
+ (JSC::isPointerAligned):
+ (JSC::ConservativeSet::add):
+ * runtime/ConservativeSet.h: Added.
+ (JSC::ConservativeSet::ConservativeSet):
+ (JSC::ConservativeSet::mark): Split ConservativeSet out into its own
+ file, and moved the conservative check into ConservativeSet::add, making
+ ConservativeSet's responsibility clearer.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots):
+ * runtime/MachineStackMarker.cpp:
+ (JSC::MachineStackMarker::markCurrentThreadConservativelyInternal):
+ (JSC::MachineStackMarker::markOtherThreadConservatively):
+ * runtime/MachineStackMarker.h:
+ * runtime/MarkStack.h: Updated for changes above.
+
+2011-01-22 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed WinCE build fix for r76430.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::swapIfBackwards):
+
+2011-01-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Reorganized MarkedSpace, making many of its functions private.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::Heap::heap):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::globalData):
+ (JSC::MarkedSpace::heap):
+
+2011-01-21 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix build: moved helper function out of #ifdef.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::swapIfBackwards):
+
+2011-01-21 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ A few of Maciej's review suggestions for my last patch.
+ https://bugs.webkit.org/show_bug.cgi?id=52946
+
+ SunSpider reports no change.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::swapIfBackwards): Added a helper function for handling platforms
+ where the stack can grow in any direction.
+
+ (JSC::MachineStackMarker::markCurrentThreadConservativelyInternal):
+ (JSC::MachineStackMarker::markOtherThreadConservatively): Use the helper
+ function.
+
+ (JSC::isPointerAligned): Use "!" instead of "==0" because a robot told me to.
+
+ (JSC::MachineStackMarker::markConservatively): Changed to use a more
+ standard looping idiom, and to use the helper function above.
+
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::isCellAligned): Use "!" instead of "==0" because a robot told me to.
+
+2011-01-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Cleaned up some conservative marking code.
+ https://bugs.webkit.org/show_bug.cgi?id=52946
+
+ SunSpider reports no change.
+
+ * interpreter/RegisterFile.h: No need for a special marking function,
+ since we already expose a start() and end().
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::registerFile):
+ (JSC::Heap::markRoots):
+ * runtime/Heap.h:
+ (JSC::Heap::contains): Migrated markConservatively() to the machine stack
+ marker class. Now, Heap just provides a contains() function, which the
+ machine stack marker uses for checking whether a pointer points into the heap.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::MachineStackMarker::markCurrentThreadConservativelyInternal):
+ (JSC::MachineStackMarker::markOtherThreadConservatively):
+ (JSC::isPointerAligned):
+ (JSC::MachineStackMarker::markConservatively):
+ * runtime/MachineStackMarker.h: Move the conservative marking code here.
+
+ * runtime/MarkStack.h:
+ (JSC::ConservativeSet::add):
+ (JSC::ConservativeSet::mark): Changed to using a vector instead of hash
+ set. Vector seems to be a bit faster, and it generates smaller code.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::containsSlowCase):
+ * runtime/MarkedSpace.h:
+ (JSC::MarkedSpace::isCellAligned):
+ (JSC::MarkedSpace::isPossibleCell):
+ (JSC::MarkedSpace::contains): Kept the code for determining whether a
+ pointer pointed into marked space, and moved the code for marking
+ a set of conservative pointers into the machine stack marker.
+
+ * wtf/HashSet.h:
+ (WTF::::add): Added two missing inlines that I noticed while testing
+ vector vs hash set.
+
+2011-01-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Work around a Clang bug <rdar://problem/8876150> that leads to it incorrectly emitting an access
+ control warning when a client tries to use operator bool exposed above via "using PageBlock::operator bool".
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::operator bool):
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::operator bool):
+
+2011-01-21 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ [RegexFuzz] Hang with forward assertion
+ https://bugs.webkit.org/show_bug.cgi?id=52825
+ <rdar://problem/8894332>
+
+ The backtrackTo label from the first term in a list of terms is
+ being overwritten by processing of subsequent terms. Changed
+ copyBacktrackToLabel() to check for an existing bcaktrackTo label
+ before copying and renamed it to propagateBacktrackToLabel() since
+ it no longer copies.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::propagateBacktrackToLabel):
+ (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
+
+2011-01-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved the mark stack from global data to the heap, since it pertains
+ to the heap, and not the virtual machine as a whole.
+ https://bugs.webkit.org/show_bug.cgi?id=52930
+
+ SunSpider reports no change.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::markRoots):
+ * runtime/Heap.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+
+2011-01-21 Peter Gal <galpeter@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION(r76177): All JavaScriptCore tests fail on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=52814
+
+ Get the approximateByteSize value before releasing the OwnPtr.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseFunctionInfo):
+
+2011-01-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Remove unnecessary <stdio.h> include
+ https://bugs.webkit.org/show_bug.cgi?id=52884
+
+ * jit/JIT.cpp: remove unnecessary include.
+
+2011-01-20 Ryosuke Niwa <rniwa@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Added OwnPtrCommon.h because OwnArrayPtr::set calls deleteOwnedPtr.
+
+ * wtf/OwnArrayPtr.h:
+
+2011-01-20 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ [WINCE] Remove obsolete JSVALUE32 code
+ https://bugs.webkit.org/show_bug.cgi?id=52450
+
+ Remove the "offset hack" in create_jit_stubs, since we
+ only support JSVALUE32_64 in the meantime.
+
+ * create_jit_stubs: Removed offset argument
+ * jit/JITStubs.cpp:
+
+2011-01-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ When marking conservatively, guard against reviving dead objects.
+ https://bugs.webkit.org/show_bug.cgi?id=52840
+
+ SunSpider and v8 say no change.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::markCallFrames): Updated to use the ConservativeSet API.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::recordExtraCost): No need to guard against conservative
+ marking reviving dead objects anymore, since the conservative marking
+ mechanism guards against this now.
+
+ (JSC::Heap::markConservatively):
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::markTempSortVectors): Don't drain the mark stack inside a
+ marking function. We want to establish a separation of concerns between
+ visiting roots and draining the mark stack.
+
+ (JSC::Heap::markRoots): Gather the set of conservative references before
+ clearning mark bits, because conservative marking now uses the mark bits
+ to determine if a reference is valid, and avoid reviving dead objects.
+
+ (JSC::Heap::collectAllGarbage): No need to guard against conservative
+ marking reviving dead objects anymore, since the conservative marking
+ mechanism guards against this now.
+
+ * runtime/Heap.h: Updated to use the ConservativeSet API.
+
+ * runtime/MachineStackMarker.cpp:
+ (JSC::MachineStackMarker::markCurrentThreadConservativelyInternal):
+ (JSC::MachineStackMarker::markCurrentThreadConservatively):
+ (JSC::MachineStackMarker::markOtherThreadConservatively):
+ (JSC::MachineStackMarker::markMachineStackConservatively):
+ * runtime/MachineStackMarker.h: Ditto.
+
+ * runtime/MarkStack.h:
+ (JSC::ConservativeSet::add):
+ (JSC::ConservativeSet::mark): Added ConservativeSet, for gathering the
+ set of conservative references. This is different from MarkStack, since
+ we don't mark the set until it is completely gathered.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::freeBlock):
+ (JSC::MarkedSpace::resizeBlocks):
+ (JSC::MarkedSpace::markConservatively):
+ * runtime/MarkedSpace.h: When marking conservatively, guard against
+ reviving dead objects.
+
+2011-01-20 Siddharth Mathur <siddharth.mathur@nokia.com>
+
+ Reviewed by Geoffrey Garen.
+
+ [Symbian] Fix StackBounds::initialize()
+ https://bugs.webkit.org/show_bug.cgi?id=52842
+
+ * wtf/StackBounds.cpp:
+ (WTF::StackBounds::initialize): Use TThreadStackInfo.iLimit for stack limit
+
+2011-01-20 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/8890203> [RegexFuzz] Crash in generated code (52773)
+ https://bugs.webkit.org/show_bug.cgi?id=52773
+
+ Fixed case where an existing DataLabelPtr is overwritten. The
+ replacing DataLabelPtr is now resolved immediately in
+ linkDataLabelToBacktrackIfExists(). Cleanup - eliminated bool
+ return value for the routine as it was never used.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::TermGenerationState::linkDataLabelToBacktrackIfExists):
+
+2011-01-20 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt][WK2] WebKit2 enabled build fails to link
+
+ Work around undefined reference linking issues until the buildsystem gets redesigned.
+ These issues first occured in minimal builds (see BUG 50519).
+
+ * JavaScriptCore.pri: link as whole-archive for WebKit2 builds
+
+2011-01-20 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Refactoring of the custom allocation framework
+ https://bugs.webkit.org/show_bug.cgi?id=49897
+
+ Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589).
+ The modification replaces Noncopyable and FastAllocBase classes and these inherits with their
+ equivalent macro implementation at the necessary places.
+
+ * wtf/FastAllocBase.h: Turn FastAllocBase's implementation into a macro.
+
+2011-01-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Follow-up to r75766 / <rdar://problem/5469576>.
+
+ We were failing to initialize the key, causing all sorts of unexpected behavior.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::setThreadHeap):
+ (WTF::TCMalloc_ThreadCache::GetThreadHeap):
+ (WTF::TCMalloc_ThreadCache::InitTSD): Ensure that the key is initialized.
+
+2011-01-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Rolled back in r76078, with crash fixed.
+ https://bugs.webkit.org/show_bug.cgi?id=52668
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::markChildren): Account for the fact that the global
+ object moves its variables into and out of the register file. While out
+ of the register file, the symbol table's size is not an accurate count
+ for the size of the register array, since the BytecodeGenerator might
+ be compiling, adding items to the symbol table.
+
+2011-01-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Stack overflow when converting an Error object to string
+ https://bugs.webkit.org/show_bug.cgi?id=46410
+
+ * Android.mk: Added StringRecursionChecker.cpp and
+ StringRecursionChecker.h.
+ * CMakeLists.txt: Ditto.
+ * GNUmakefile.am: Ditto.
+ * JavaScriptCore.gypi: Ditto.
+ * JavaScriptCore.pro: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString): Use StringRecursionChecker instead
+ of the older hand-written code to do the same thing.
+ (JSC::arrayProtoFuncToLocaleString): Ditto.
+ (JSC::arrayProtoFuncJoin): Ditto.
+
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString): Use StringRecursionChecker.
+
+ * runtime/JSGlobalData.h: Renamed arrayVisitedElements to
+ stringRecursionCheckVisitedObjects.
+
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString): Use StringRecursionChecker.
+
+ * runtime/StringRecursionChecker.cpp: Added.
+ * runtime/StringRecursionChecker.h: Added.
+
+2011-01-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove non-spec support for callable RegExp
+ https://bugs.webkit.org/show_bug.cgi?id=28285
+
+ Remove support for callable regexps. If it breaks sites we can
+ just roll this out.
+
+ * runtime/RegExpObject.cpp:
+ * runtime/RegExpObject.h:
+ * tests/mozilla/expected.html: update results.
+
+2011-01-19 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Cache function offsets to speed up javascript parsing
+ https://bugs.webkit.org/show_bug.cgi?id=52622
+
+ Use cache to save function offsets and some other info.
+ This avoids quite a bit of work when reparsing the source.
+
+ * parser/ASTBuilder.h:
+ * parser/JSParser.cpp:
+ (JSC::JSParser::CachedFunctionInfo::CachedFunctionInfo):
+ (JSC::JSParser::CachedFunctionInfo::approximateByteSize):
+ (JSC::JSParser::CachedFunctionInfo::closeBraceToken):
+ (JSC::JSParser::Scope::copyCapturedVariablesToVector):
+ (JSC::JSParser::Scope::saveFunctionInfo):
+ (JSC::JSParser::Scope::restoreFunctionInfo):
+ (JSC::JSParser::findCachedFunctionInfo):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::parseFunctionInfo):
+ * parser/Lexer.h:
+ (JSC::Lexer::setOffset):
+ (JSC::Lexer::setLineNumber):
+ (JSC::Lexer::sourceProvider):
+ * parser/SourceProvider.h:
+ (JSC::SourceProviderCache::SourceProviderCache):
+ (JSC::SourceProviderCache::~SourceProviderCache):
+ (JSC::SourceProviderCache::byteSize):
+ (JSC::SourceProviderCache::add):
+ (JSC::SourceProviderCache::get):
+ (JSC::SourceProvider::SourceProvider):
+ (JSC::SourceProvider::~SourceProvider):
+ (JSC::SourceProvider::cache):
+ (JSC::SourceProvider::notifyCacheSizeChanged):
+ (JSC::SourceProvider::cacheSizeChanged):
+ * parser/SyntaxChecker.h:
+
+2011-01-19 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Follow-up to r75766 / <rdar://problem/5469576>.
+
+ * DerivedSources.make: Evaluate the SDKROOT variable correctly.
+
+2011-01-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [jsfunfuzz] Defining a function called __proto__ inside an eval triggers an assertion
+ https://bugs.webkit.org/show_bug.cgi?id=52672
+
+ Rather than coming up with a somewhat convoluted mechanism to ensure that
+ developers can override the global objects prototype with a function named
+ __proto__ and expect it to work, we just disallow it at the syntax level.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseFunctionInfo):
+
+2011-01-19 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/8882994> Regression: Simple nested backtrack hangs
+ https://bugs.webkit.org/show_bug.cgi?id=52675
+
+ The changeset (r76076) for https://bugs.webkit.org/show_bug.cgi?id=52540
+ broke simple backtracking in some cases. Reworked that change to
+ link both jumps and labels.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::hasBacktrackToLabel):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::propagateBacktrackingFrom):
+ (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
+
+2011-01-19 Pavel Podivilov <podivilov@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: [JSC] scripts have incorrect starting line (always 1).
+ https://bugs.webkit.org/show_bug.cgi?id=52721
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * debugger/Debugger.h:
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ * parser/SourceCode.h:
+ (JSC::SourceCode::SourceCode):
+ * parser/SourceProvider.h:
+ (JSC::SourceProvider::startPosition):
+
+2011-01-19 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Laszlo Gombos and Tor Arne Vestbø.
+
+ [Qt] Remove unnecessary "../Source" from paths
+ after moving source files into Source is finished.
+
+ * JavaScriptCore.pri:
+
+2011-01-19 Benjamin Kalman <kalman@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Don't return void from void function String::split
+ https://bugs.webkit.org/show_bug.cgi?id=52684
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::split):
+
+2011-01-18 Kenneth Russell <kbr@google.com>
+
+ Unreviewed, rolling out r76078.
+ http://trac.webkit.org/changeset/76078
+ https://bugs.webkit.org/show_bug.cgi?id=52668
+
+ Caused crashes of fast/canvas/webgl/constants.html,
+ fast/canvas/webgl/gl-enum-tests.html, and possibly other layout
+ test crashes in Release mode. WebGL crashes were observed with
+ "run-webkit-tests fast/canvas/webgl". It was necessary to run
+ multiple tests to provoke the crash.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::markGlobals):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::markChildren):
+
+2011-01-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [jsfunfuzz] Assertion asking activation for arguments when arguments is overridden
+ https://bugs.webkit.org/show_bug.cgi?id=52690
+
+ Clean up code to retrieve arguments from activation and function objects.
+ Remove the incorrect assertion from JSActivation's argumentsGetter.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveArguments):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+
+2011-01-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed RegisterFile::markGlobals because it was obtuse, and it
+ unnecessarily relied on conservative marking.
+ https://bugs.webkit.org/show_bug.cgi?id=52668
+
+ * interpreter/RegisterFile.h: Removed markGlobals.
+
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren): Added a comment explaning why some
+ JSActivations don't always mark their registers arrays.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::markChildren): Instead of calling markGlobals, mark
+ the registers array directly.
+
+2011-01-18 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/8875432> Regression: Some text-only e-mails cause hang beneath RegExp::match (52540)
+ https://bugs.webkit.org/show_bug.cgi?id=52540
+ https://bugs.webkit.org/show_bug.cgi?id=52662
+
+ Directly use backtrack label with parentheses nested under a
+ non-capturing parentheses. Also linked current parentheses
+ tail code object for possible parens nested within a non-capturing
+ parentheses.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::linkBacktrackToLabel):
+ (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
+
+2011-01-18 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Only use moving memory model assumption in ExecutableAllocator::intializePageSize() for Symbian OS
+ https://bugs.webkit.org/show_bug.cgi?id=52517
+
+ Patch by David Tapuska
+
+ Currently, we compile code with respect to the Symbian-specific moving memory model
+ assumption for all ARMv5 or lower architectures. Instead, we should only compile
+ such code when building for Symbian OS on those architectures because this model
+ is Symbian-specific.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::intializePageSize):
+
+2011-01-18 Dimitry Andric <dim@freebsd.org>
+
+ Reviewed by Andreas Kling.
+
+ Fix linking JavaScriptCore on FreeBSD/amd64
+ https://bugs.webkit.org/show_bug.cgi?id=52591
+
+ Linking of JavaScriptCore on FreeBSD/amd64 fails, for the same reason as
+ in bug 28422: cti_vm_throw needs a "@plt" suffix, otherwise the linker
+ complains about the relocation type.
+
+ * jit/JITStubs.cpp: use @plt suffix on x86_64 platforms, for both Linux
+ and FreeBSD.
+
+2011-01-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ [jsfunfuzz] Assertion in codegen for array of NaN constants
+ https://bugs.webkit.org/show_bug.cgi?id=52643
+
+ Don't cache NaN literals in the code generator, as NaN doesn't compare
+ as equal to itself it causes problems when rehashing the number cache.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoad):
+
+2011-01-17 Jarred Nicholls <jarred@sencha.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ REGRESSION(r75709): Return value of fscanf() shouldn't be ignored.
+ https://bugs.webkit.org/show_bug.cgi?id=52585
+
+ gcc 4.4.4+ has warn_unused_value attribute on fscanf, so we should check
+ the return value to get around the gcc warning
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::maybeModifyVMPoolSize):
+
+2011-01-17 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ [regexfuzz] Crash running regex with lookahead
+ https://bugs.webkit.org/show_bug.cgi?id=52548
+
+ Eliminated agressive chaining of backtracks. This code was overwriting
+ already valid backtrack information.
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::processBacktracks):
+
+2011-01-17 Tony Gentilcore <tonyg@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix some headers with missing or misspelled #ifndef guards
+ https://bugs.webkit.org/show_bug.cgi?id=52545
+
+ * wtf/RefPtrHashMap.h:
+
+2011-01-17 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Update xcodeproj svn:ignore to include xcuserdata.
+
+ * JavaScriptCore.xcodeproj: Modified property svn:ignore.
+
+2011-01-16 Adam Barth <abarth@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Move WebKit into Source
+ https://bugs.webkit.org/show_bug.cgi?id=52530
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2011-01-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ [jsfunfuzz] Parser doesn't correctly validate for-loop syntax
+ https://bugs.webkit.org/show_bug.cgi?id=52516
+
+ Ensure that we always check for a semicolon after encountering
+ multiple declarations in the initialiser portion of a for-loop.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseForStatement):
+
+2011-01-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Strict mode restrictions on arguments and eval usage aren't complete
+ https://bugs.webkit.org/show_bug.cgi?id=52528
+
+ Fix a few bugs in strict mode where we incorrect allow mutation of
+ arguments and eval in the parser.
+
+ Alas the "optimisation" used by the syntax checker for validating
+ binary and unary expressions was too aggressive: we do actually need
+ a stack for operations and operands although it needn't be as complete
+ as that used for the full AST builder.
+
+ Also disallow assignment to arguments in all cases as allowing arguments
+ to be assignable is always an error in strict mode, regardless of context.
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::BinaryExprContext::BinaryExprContext):
+ (JSC::ASTBuilder::UnaryExprContext::UnaryExprContext):
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseAssignmentExpression):
+ (JSC::JSParser::parseBinaryExpression):
+ (JSC::JSParser::parseUnaryExpression):
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::BinaryExprContext::BinaryExprContext):
+ (JSC::SyntaxChecker::BinaryExprContext::~BinaryExprContext):
+ (JSC::SyntaxChecker::UnaryExprContext::UnaryExprContext):
+ (JSC::SyntaxChecker::UnaryExprContext::~UnaryExprContext):
+ (JSC::SyntaxChecker::appendBinaryExpressionInfo):
+ (JSC::SyntaxChecker::operatorStackPop):
+
+2011-01-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Rolled back in r75886.
+ https://bugs.webkit.org/show_bug.cgi?id=52527
+
+ r75886 broke the GTK Linux bot because Linux was -- quite surprisingly --
+ set up to use the constants for embedded devices.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::maybeModifyVMPoolSize): Separated Linux constants from embedded
+ constants.
+
+2011-01-15 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r75886.
+ http://trac.webkit.org/changeset/75886
+ https://bugs.webkit.org/show_bug.cgi?id=52526
+
+ "Broke GTK+ 64bit" (Requested by xan_ on #webkit).
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+
+2011-01-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/8870429> Shrink the executable pool on embedded devices
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp: Dropped the pool size from 32MB
+ to 16MB.
+
+2011-01-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Incorrect behavior changing attributes of an accessor
+ https://bugs.webkit.org/show_bug.cgi?id=52515
+
+ defineProperty doesn't correctly handle changing attributes of an accessor
+ property. This is because we don't pass the full descriptor to the
+ putDescriptor helper function, which means we have insufficient information
+ to do the right thing. Once that's passed the correct behavior is relatively
+ simple to implement.
+
+ * runtime/JSObject.cpp:
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+
+2011-01-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ [jsfunfuzz] Incorrect handling of consecutive duplicate labels
+ https://bugs.webkit.org/show_bug.cgi?id=52505
+
+ Compare StringImpl*'s instead of Identifier*'s when looking for duplicate
+ labels.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseExpressionOrLabelStatement):
+
+2011-01-14 Simon Fraser <simon.fraser@apple.com>
+
+ No review.
+
+ Initialize m_operationInProgress after r75855.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+
+2011-01-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reverted accidentally committed code from my last checkin.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::markRoots):
+
+2011-01-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Try to fix the GTK bot.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::markRoots): Kids, remember to initialize your data members.
+ Knowing is half the battle.
+
+2011-01-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Stephanie Lewis.
+
+ [jsfunfuzz] We should be clearing the lexers temporary character buffers when switching to strict mode
+ https://bugs.webkit.org/show_bug.cgi?id=52501
+
+ Clear the temporary character buffers used for reading escaped characters and
+ numbers.
+
+ * parser/Lexer.h:
+ (JSC::Lexer::setOffset):
+
+2011-01-14 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix non-Dtrace builds: #include Tracing.h instead of TracingDtrace.h.
+
+ * runtime/Heap.cpp:
+
+2011-01-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Split out a MarkedSpace strategy object from Heap.
+ https://bugs.webkit.org/show_bug.cgi?id=52421
+
+ SunSpider reports no change.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Updated our 7 build systems. Which is cool.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::recordExtraCost):
+ (JSC::Heap::allocate):
+ (JSC::Heap::markConservatively):
+ (JSC::Heap::markRoots):
+ (JSC::Heap::objectCount):
+ (JSC::Heap::statistics):
+ (JSC::Heap::size):
+ (JSC::Heap::isBusy):
+ (JSC::Heap::collectAllGarbage):
+ (JSC::Heap::primaryHeapBegin):
+ (JSC::Heap::primaryHeapEnd):
+ * runtime/Heap.h:
+ (JSC::Heap::globalData):
+ (JSC::Heap::markedSpace):
+ (JSC::Heap::isCellMarked):
+ (JSC::Heap::checkMarkCell):
+ (JSC::Heap::markCell): Moved all code pertaining to managing chunks of
+ collector memory out of this class. Heap now just delegates to MarkedSpace.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::Heap::heap): Updated for MarkedSpace delegation.
+
+ * runtime/JSValue.h: Moved the ValueStringPair typedef to help with #includes.
+
+ * runtime/MarkedSpace.cpp: Copied from runtime/Heap.cpp.
+ (JSC::MarkedSpace::MarkedSpace):
+ (JSC::MarkedSpace::destroy):
+ (JSC::MarkedSpace::allocateBlock):
+ (JSC::MarkedSpace::freeBlock):
+ (JSC::MarkedSpace::allocate):
+ (JSC::MarkedSpace::resizeBlocks):
+ (JSC::MarkedSpace::growBlocks):
+ (JSC::MarkedSpace::shrinkBlocks):
+ (JSC::MarkedSpace::markConservatively):
+ (JSC::MarkedSpace::clearMarkBits):
+ (JSC::MarkedSpace::markedCells):
+ (JSC::MarkedSpace::sweep):
+ (JSC::MarkedSpace::objectCount):
+ (JSC::MarkedSpace::addToStatistics):
+ (JSC::MarkedSpace::statistics):
+ (JSC::MarkedSpace::size):
+ (JSC::MarkedSpace::reset):
+ (JSC::MarkedSpace::primaryHeapBegin):
+ (JSC::MarkedSpace::primaryHeapEnd):
+ * runtime/MarkedSpace.h: Copied from runtime/Heap.h.
+ (JSC::MarkedSpace::globalData):
+ (JSC::MarkedSpace::didShrink):
+ (JSC::MarkedSpace::cellBlock):
+ (JSC::MarkedSpace::cellOffset):
+ (JSC::MarkedSpace::isCellMarked):
+ (JSC::MarkedSpace::checkMarkCell):
+ (JSC::MarkedSpace::markCell): Moved all code pertaining to managing chunks of
+ collector memory into this class.
+
+ * runtime/MemoryStatistics.cpp:
+ (JSC::heapStatistics):
+ * runtime/MemoryStatistics.h: Updated for MarkedSpace delegation.
+
+2011-01-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [jsfunfuzz] parser doesn't enforce continue restrictions correctly.
+ https://bugs.webkit.org/show_bug.cgi?id=52493
+
+ This patch reworks handling of break, continue and label statements
+ to correctly handle all the valid and invalid cases. Previously certain
+ errors would be missed by the parser in strict mode, but the bytecode
+ generator needed to handle those cases for non-strict code so nothing
+ failed, it simply became non-standard behaviour.
+
+ Now that we treat break and continue errors as early faults in non-strict
+ mode as well that safety net has been removed so the parser bugs result in
+ crashes at codegen time.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::ScopeLabelInfo::ScopeLabelInfo):
+ (JSC::JSParser::next):
+ (JSC::JSParser::nextTokenIsColon):
+ (JSC::JSParser::continueIsValid):
+ Continue is only valid in loops so we can't use breakIsValid()
+ (JSC::JSParser::pushLabel):
+ We now track whether the label is for a loop (and is therefore a
+ valid target for continue.
+ (JSC::JSParser::popLabel):
+ (JSC::JSParser::getLabel):
+ Replace hasLabel with getLabel so that we can validate the target
+ when parsing continue statements.
+ (JSC::JSParser::Scope::continueIsValid):
+ (JSC::JSParser::Scope::pushLabel):
+ (JSC::JSParser::Scope::getLabel):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseBreakStatement):
+ (JSC::JSParser::parseContinueStatement):
+ (JSC::LabelInfo::LabelInfo):
+ (JSC::JSParser::parseExpressionOrLabelStatement):
+ Consecutive labels now get handled iteratively so that we can determine
+ whether they're valid targets for continue.
+ * parser/Lexer.cpp:
+ (JSC::Lexer::nextTokenIsColon):
+ * parser/Lexer.h:
+ (JSC::Lexer::setOffset):
+
+2011-01-14 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Use the Windows thread pool instead of an extra thread for FastMalloc scavenging
+ https://bugs.webkit.org/show_bug.cgi?id=45186
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scheduleScavenger): Added missing this pointer to CreateTimerQueueTimer().
+
+2011-01-14 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Use the Windows thread pool instead of an extra thread for FastMalloc scavenging
+ https://bugs.webkit.org/show_bug.cgi?id=45186
+
+ r75819 accidentally changed the initial state of the scavenge timer.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::initializeScavenger): Changed initial state of m_scavengingSuspended to true.
+
+2011-01-14 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed Windows Release build fix.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavengerTimerFired):
+
+2011-01-14 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed Windows Release build fix.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavengerTimerFired):
+
+2011-01-14 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Use the Windows thread pool instead of an extra thread for FastMalloc scavenging
+ https://bugs.webkit.org/show_bug.cgi?id=45186
+
+ Use CreateTimerQueueTimer() to start periodicScavenge() and stop it with DeleteTimerQueueTimer().
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::initializeScavenger):
+ (WTF::TCMalloc_PageHeap::isScavengerSuspended):
+ (WTF::TCMalloc_PageHeap::scheduleScavenger):
+ (WTF::TCMalloc_PageHeap::rescheduleScavenger):
+ (WTF::TCMalloc_PageHeap::suspendScavenger):
+ (WTF::scavengerTimerFired):
+ (WTF::TCMalloc_PageHeap::periodicScavenge):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+
+2011-01-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Align import/export directives
+ https://bugs.webkit.org/show_bug.cgi?id=52208
+
+ * API/JSBase.h: Align import/export directives with
+ WebKit2/Shared/API/c/WKBase.h
+
+2011-01-14 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Incorrect backtracking for nested alternatives
+ https://bugs.webkit.org/show_bug.cgi?id=52387
+
+ In the process of propigating a datalabel it wasn't getting connected
+ to a destination when the destination was an indirect jump. Added
+ code to recognize a direct backtrack destination that was an indirect
+ jump and added mechanism to associate DataLabelPtrs with indirect
+ jump entries.
+ Removed dead method
+ BacktrackDestination::linkDataLabelToHereIfExists()
+
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::YarrGenerator::IndirectJumpEntry::IndirectJumpEntry):
+ (JSC::Yarr::YarrGenerator::IndirectJumpEntry::addDataLabel):
+ (JSC::Yarr::YarrGenerator::GenerationState::addIndirectJumpEntry):
+ (JSC::Yarr::YarrGenerator::GenerationState::emitIndirectJumpTable):
+ Changes to link indirect jumps with DataLabelPtr's.
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::clearSubDataLabelPtr):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::linkDataLabelToBacktrackIfExists):
+ Updated to handle immediate linking of indirect jumps to
+ DataLabelPtr.
+ (JSC::Yarr::YarrGenerator::generateParenthesesDisjunction): Changed to
+ reflect updated linkDataLabelToBacktrackIfExists().
+
+2011-01-14 Pavel Podivilov <podivilov@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: provide script column offset to frontend.
+ https://bugs.webkit.org/show_bug.cgi?id=52377
+
+ * parser/SourceCode.h:
+ (JSC::SourceCode::SourceCode):
+ (JSC::SourceCode::firstColumn):
+
+2011-01-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/5469576> Use __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 if available.
+
+ * DerivedSources.make: Create a header file, HeaderDetection.h, that tells
+ us whether pthread_machdep.h is available.
+ * wtf/FastMalloc.cpp: If __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 is available, then
+ don't do the pthread_getspecific_function_pointer trick.
+ (WTF::setThreadHeap): Ditto, but set thread-specific data.
+ (WTF::TCMalloc_ThreadCache::GetThreadHeap): Ditto, but get rather than set.
+
+2011-01-13 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ JIT requires VM overcommit (particularly on x86-64), Linux does not by default support this without swap?
+ https://bugs.webkit.org/show_bug.cgi?id=42756
+
+ The FixedVMPool Allocator does not work well on systems where
+ allocating very large amounts of memory upfront is not reasonable,
+ like Linux without overcommit enabled. As a workaround, on Linux,
+ default to the values used in embedded environments (in the MB
+ range), and only jump to the GB range if we detect at runtime that
+ overcommit is enabled. Should fix crashes on Linux/x86_64 with
+ less than 3 or 4GB of RAM.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::free): use new variables for VM pool
+ size and coalesce limit.
+ (JSC::ExecutableAllocator::isValid): swap the variables from
+ embedded to generic values at runtime, on linux, if overcommit is
+ enabled.
+ (JSC::ExecutableAllocator::underMemoryPressure): use new variables
+ for VM pool size and coalesce limit.
+
+2011-01-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Add new Yarr.h header to the list file.
+
+ * GNUmakefile.am: ditto.
+
+2011-01-12 Martin Robinson <mrobinson@igalia.com>
+
+ Missing Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h in WebKitGtk tarball
+ https://bugs.webkit.org/show_bug.cgi?id=52299
+
+ * GNUmakefile.am: Fix the GTK+ build on ARMv7 by including missing source
+ files in the source list.
+
+2011-01-12 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Add Yarr.h to YARR
+ https://bugs.webkit.org/show_bug.cgi?id=51021
+
+ Move other common constants and functions from YARR's different files
+ to Yarr.h.
+ Use Yarr.h header instead of including other YARR headers where it
+ is possible.
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ * yarr/Yarr.h: Added.
+ * yarr/YarrInterpreter.cpp:
+ * yarr/YarrInterpreter.h:
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::jitCompile):
+ (JSC::Yarr::execute):
+ * yarr/YarrJIT.h:
+ * yarr/YarrParser.h:
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::YarrPattern::compile):
+ (JSC::Yarr::YarrPattern::YarrPattern):
+ * yarr/YarrPattern.h:
+
+2011-01-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r75595.
+ http://trac.webkit.org/changeset/75595
+ https://bugs.webkit.org/show_bug.cgi?id=52286
+
+ It broke fast/regex/pcre-test-1.html (Requested by Ossy on
+ #webkit).
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ * yarr/Yarr.h: Removed.
+ * yarr/YarrInterpreter.cpp:
+ * yarr/YarrInterpreter.h:
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::jitCompile):
+ * yarr/YarrJIT.h:
+ (JSC::Yarr::execute):
+ * yarr/YarrParser.h:
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::compile):
+ (JSC::Yarr::YarrPattern::YarrPattern):
+ * yarr/YarrPattern.h:
+
+2011-01-12 Peter Varga <pvarga@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Add Yarr.h to YARR
+ https://bugs.webkit.org/show_bug.cgi?id=51021
+
+ Move other common constants and functions from YARR's different files
+ to Yarr.h.
+ Use Yarr.h header instead of including other YARR headers where it
+ is possible.
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ * yarr/Yarr.h: Added.
+ * yarr/YarrInterpreter.cpp:
+ * yarr/YarrInterpreter.h:
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::jitCompile):
+ (JSC::Yarr::execute):
+ * yarr/YarrJIT.h:
+ * yarr/YarrParser.h:
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::YarrPattern::compile):
+ (JSC::Yarr::YarrPattern::YarrPattern):
+ * yarr/YarrPattern.h:
+
+2011-01-11 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Missing call to popTempSortVector() for exception case in JSArray::sort.
+ https://bugs.webkit.org/show_bug.cgi?id=50718
+
+ Fix to patch of 50718 that added pushTempSortVector() and
+ popTempSortVector() to JSArray::sort() to mark elements during sort.
+ Need to add popTempSortVector() for the return case if toString()
+ had an exception.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sort): Added popTempSortVector()
+
+2011-01-11 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Darin Adler.
+
+ Microoptimization in ~JSString
+ https://bugs.webkit.org/show_bug.cgi?id=52222
+
+ The case where m_fibers is 0 seems to be the most common one
+ (almost 1/2 of the time, followed at some distance by m_fibers = 1
+ in 1/4 of the cases in a typical SunSpider execution). We can save
+ one comparison in this common case by doing a bit of refactoring
+ in the JSString destructor; overall a 0.3% progression, but only
+ the string tests show improvement.
+
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::~JSString):
+
+2011-01-10 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ ASSERTION Failure in JSC::binaryChop
+ https://bugs.webkit.org/show_bug.cgi?id=25614
+
+ Changed JITStubs::cti_register_file_check() to use the current stack's
+ return PC to find the bytecode for handling the exception in the prior
+ frame. Also added the appropriate arrity check routine call to the
+ JIT to bytecode vector (m_callReturnIndexVector) in the CodeBlock.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile): Changed the arrity check call location
+ so that it gets added to the m_calls list so that it's included in
+ CodeBlock::m_callReturnIndexVector.
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION): Use the current call frame's return PC.
+
+2011-01-10 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Martin Robinson.
+
+ Remove extraneous COMPILER(GCC) condition when checking GCC_VERSION_AT_LEAST()
+ https://bugs.webkit.org/show_bug.cgi?id=52178
+
+ It is sufficient to test GCC_VERSION_AT_LEAST() instead of both COMPILER(GCC) and
+ GCC_VERSION_AT_LEAST(). Notice GCC_VERSION_AT_LEAST() is defined to be 0 when we
+ are not compiling with GCC.
+
+ Fixes style issues at the callsites (i.e. replace comma with comma-space in
+ macro function argument list). Also, makes a spelling correction in a comment.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * wtf/Platform.h:
+
+2011-01-10 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: removed some uses of nextNumber that I missed last time.
+
+ * runtime/Heap.cpp:
+ (JSC::Heap::reset):
+ (JSC::Heap::collectAllGarbage):
+
+2011-01-10 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
+
+ We should only use __builtin_expect if we are compiling with GCC or RVCT 3 or higher in GNU mode
+ as pointed out by Siddharth Mathur per <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0202h/Cjabddedbde.html>.
+
+ * wtf/AlwaysInline.h:
+ * wtf/Platform.h: Removed define WTF_COMPILER_RVCT4_OR_GREATER. Instead added macro
+ function RVCT_VERSION_AT_LEAST so that we can test for an arbitrary minimum RVCT
+ version.
+
+2011-01-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Moved Collector.* => Heap.*, since the file contains a class named "Heap".
+
+ * API/JSCallbackObject.cpp:
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Interpreter.cpp:
+ * interpreter/RegisterFile.h:
+ * jit/JITStubs.cpp:
+ * runtime/Collector.cpp: Removed.
+ * runtime/Collector.h: Removed.
+ * runtime/CollectorHeapIterator.h:
+ * runtime/GCActivityCallbackCF.cpp:
+ * runtime/Heap.cpp: Copied from JavaScriptCore/runtime/Collector.cpp.
+ * runtime/Heap.h: Copied from JavaScriptCore/runtime/Collector.h.
+ * runtime/InitializeThreading.cpp:
+ * runtime/JSCell.h:
+ * runtime/JSGlobalData.cpp:
+ * runtime/JSGlobalData.h:
+ * runtime/JSLock.cpp:
+ * runtime/JSNumberCell.h:
+ * runtime/MachineStackMarker.cpp:
+ * runtime/MemoryStatistics.h:
+ * runtime/Protect.h:
+ * runtime/UString.cpp:
+ * runtime/WeakGCMap.h:
+ * runtime/WeakGCPtr.h:
+
+2011-01-10 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove unused isString() case in JSString::toPrimitiveString()
+ https://bugs.webkit.org/show_bug.cgi?id=52167
+
+ We never call toPrimitiveString() with strings, so remove the
+ check and add an ASSERT ensuring this never happens. 0.7% overall
+ progression in sunspider, since one of the call sites is very hot.
+
+ * runtime/JSString.h:
+ (JSC::JSValue::toPrimitiveString):
+
+2011-01-10 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Rename the existing YARR files and classes
+ https://bugs.webkit.org/show_bug.cgi?id=51872
+
+ Replace the "Regex" prefix with "Yarr" in the name of YARR files and classes.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ (JSC::RegExp::printTraceData):
+ * yarr/YarrInterpreter.cpp: Renamed from Source/JavaScriptCore/yarr/RegexInterpreter.cpp.
+ (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::readPair):
+ (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::InputStream::isNotAvailableInput):
+ (JSC::Yarr::Interpreter::testCharacterClass):
+ (JSC::Yarr::Interpreter::checkCharacter):
+ (JSC::Yarr::Interpreter::checkCasedCharacter):
+ (JSC::Yarr::Interpreter::checkCharacterClass):
+ (JSC::Yarr::Interpreter::tryConsumeBackReference):
+ (JSC::Yarr::Interpreter::matchAssertionBOL):
+ (JSC::Yarr::Interpreter::matchAssertionEOL):
+ (JSC::Yarr::Interpreter::matchAssertionWordBoundary):
+ (JSC::Yarr::Interpreter::backtrackPatternCharacter):
+ (JSC::Yarr::Interpreter::backtrackPatternCasedCharacter):
+ (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::parenthesesDoBacktrack):
+ (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::matchParentheticalAssertionBegin):
+ (JSC::Yarr::Interpreter::matchParentheticalAssertionEnd):
+ (JSC::Yarr::Interpreter::backtrackParentheticalAssertionBegin):
+ (JSC::Yarr::Interpreter::backtrackParentheticalAssertionEnd):
+ (JSC::Yarr::Interpreter::matchParentheses):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+ (JSC::Yarr::Interpreter::lookupForBeginChars):
+ (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::atomParenthesesOnceBegin):
+ (JSC::Yarr::ByteCompiler::atomParenthesesTerminalBegin):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd):
+ (JSC::Yarr::ByteCompiler::popParenthesesStack):
+ (JSC::Yarr::ByteCompiler::dumpDisjunction):
+ (JSC::Yarr::ByteCompiler::closeAlternative):
+ (JSC::Yarr::ByteCompiler::closeBodyAlternative):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd):
+ (JSC::Yarr::ByteCompiler::regexBegin):
+ (JSC::Yarr::ByteCompiler::regexEnd):
+ (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction):
+ (JSC::Yarr::ByteCompiler::alternativeDisjunction):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ (JSC::Yarr::byteCompile):
+ (JSC::Yarr::interpret):
+ * yarr/YarrInterpreter.h: Renamed from Source/JavaScriptCore/yarr/RegexInterpreter.h.
+ (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::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):
+ (JSC::Yarr::ByteTerm::invert):
+ (JSC::Yarr::ByteTerm::capture):
+ (JSC::Yarr::ByteDisjunction::ByteDisjunction):
+ (JSC::Yarr::BytecodePattern::BytecodePattern):
+ (JSC::Yarr::BytecodePattern::~BytecodePattern):
+ * yarr/YarrJIT.cpp: Renamed from Source/JavaScriptCore/yarr/RegexJIT.cpp.
+ (JSC::Yarr::YarrGenerator::optimizeAlternative):
+ (JSC::Yarr::YarrGenerator::matchCharacterClassRange):
+ (JSC::Yarr::YarrGenerator::matchCharacterClass):
+ (JSC::Yarr::YarrGenerator::jumpIfNoAvailableInput):
+ (JSC::Yarr::YarrGenerator::jumpIfAvailableInput):
+ (JSC::Yarr::YarrGenerator::checkInput):
+ (JSC::Yarr::YarrGenerator::atEndOfInput):
+ (JSC::Yarr::YarrGenerator::notAtEndOfInput):
+ (JSC::Yarr::YarrGenerator::jumpIfCharEquals):
+ (JSC::Yarr::YarrGenerator::jumpIfCharNotEquals):
+ (JSC::Yarr::YarrGenerator::readCharacter):
+ (JSC::Yarr::YarrGenerator::storeToFrame):
+ (JSC::Yarr::YarrGenerator::storeToFrameWithPatch):
+ (JSC::Yarr::YarrGenerator::loadFromFrame):
+ (JSC::Yarr::YarrGenerator::loadFromFrameAndJump):
+ (JSC::Yarr::YarrGenerator::IndirectJumpEntry::IndirectJumpEntry):
+ (JSC::Yarr::YarrGenerator::IndirectJumpEntry::addJump):
+ (JSC::Yarr::YarrGenerator::AlternativeBacktrackRecord::AlternativeBacktrackRecord):
+ (JSC::Yarr::YarrGenerator::GenerationState::GenerationState):
+ (JSC::Yarr::YarrGenerator::GenerationState::addIndirectJumpEntry):
+ (JSC::Yarr::YarrGenerator::GenerationState::emitIndirectJumpTable):
+ (JSC::Yarr::YarrGenerator::GenerationState::incrementParenNestingLevel):
+ (JSC::Yarr::YarrGenerator::GenerationState::decrementParenNestingLevel):
+ (JSC::Yarr::YarrGenerator::GenerationState::addParenthesesTail):
+ (JSC::Yarr::YarrGenerator::GenerationState::emitParenthesesTail):
+ (JSC::Yarr::YarrGenerator::GenerationState::addJumpToNextInteration):
+ (JSC::Yarr::YarrGenerator::GenerationState::addJumpsToNextInteration):
+ (JSC::Yarr::YarrGenerator::GenerationState::addDataLabelToNextIteration):
+ (JSC::Yarr::YarrGenerator::GenerationState::linkToNextIteration):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::BacktrackDestination):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::clear):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::clearDataLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::hasDestination):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::isStackOffset):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::isLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::isJumpList):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::hasDataLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::copyTarget):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::copyTo):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::addBacktrackJump):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setStackOffset):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setNextBacktrackLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::copyBacktrackToLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setBacktrackToLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setBacktrackJumpList):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setBacktrackSourceLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setDataLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::setSubDataLabelPtr):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::linkToNextBacktrack):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::getStackOffset):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::getLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::getBacktrackJumps):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::getDataLabel):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::jumpToBacktrack):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::linkDataLabelToHereIfExists):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::plantJumpToBacktrackIfExists):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::linkAlternativeBacktracks):
+ (JSC::Yarr::YarrGenerator::BacktrackDestination::linkAlternativeBacktracksTo):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::TermGenerationState):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::resetAlternative):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::alternativeValid):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::nextAlternative):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::alternative):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::isLastAlternative):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::resetTerm):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::termValid):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::nextTerm):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::term):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::isLastTerm):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::getSubParenNum):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::isMainDisjunction):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::setParenthesesTail):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::getParenthesesTail):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::lookaheadTerm):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::isSinglePatternCharacterLookaheadTerm):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::inputOffset):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::clearBacktrack):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::jumpToBacktrack):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::plantJumpToBacktrackIfExists):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::linkDataLabelToBacktrackIfExists):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::addBacktrackJump):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::setBacktrackDataLabel):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::setBackTrackStackOffset):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::setBacktrackLabel):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::linkAlternativeBacktracks):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::linkAlternativeBacktracksTo):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::setBacktrackLink):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::chainBacktracks):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::chainBacktrackJumps):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::getBacktrackDestination):
+ (JSC::Yarr::YarrGenerator::TermGenerationState::propagateBacktrackingFrom):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::ParenthesesTail):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::processBacktracks):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::setNextIteration):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::addAfterParenJump):
+ (JSC::Yarr::YarrGenerator::ParenthesesTail::generateCode):
+ (JSC::Yarr::YarrGenerator::generateAssertionBOL):
+ (JSC::Yarr::YarrGenerator::generateAssertionEOL):
+ (JSC::Yarr::YarrGenerator::matchAssertionWordchar):
+ (JSC::Yarr::YarrGenerator::generateAssertionWordBoundary):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterSingle):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterPair):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy):
+ (JSC::Yarr::YarrGenerator::generatePatternCharacterNonGreedy):
+ (JSC::Yarr::YarrGenerator::generateCharacterClassSingle):
+ (JSC::Yarr::YarrGenerator::generateCharacterClassFixed):
+ (JSC::Yarr::YarrGenerator::generateCharacterClassGreedy):
+ (JSC::Yarr::YarrGenerator::generateCharacterClassNonGreedy):
+ (JSC::Yarr::YarrGenerator::generateParenthesesDisjunction):
+ (JSC::Yarr::YarrGenerator::generateParenthesesSingle):
+ (JSC::Yarr::YarrGenerator::generateParenthesesGreedyNoBacktrack):
+ (JSC::Yarr::YarrGenerator::generateParentheticalAssertion):
+ (JSC::Yarr::YarrGenerator::generateTerm):
+ (JSC::Yarr::YarrGenerator::generateDisjunction):
+ (JSC::Yarr::YarrGenerator::generateEnter):
+ (JSC::Yarr::YarrGenerator::generateReturn):
+ (JSC::Yarr::YarrGenerator::YarrGenerator):
+ (JSC::Yarr::YarrGenerator::generate):
+ (JSC::Yarr::YarrGenerator::compile):
+ (JSC::Yarr::jitCompile):
+ * yarr/YarrJIT.h: Renamed from Source/JavaScriptCore/yarr/RegexJIT.h.
+ (JSC::Yarr::YarrCodeBlock::YarrCodeBlock):
+ (JSC::Yarr::YarrCodeBlock::~YarrCodeBlock):
+ (JSC::Yarr::YarrCodeBlock::setFallBack):
+ (JSC::Yarr::YarrCodeBlock::isFallBack):
+ (JSC::Yarr::YarrCodeBlock::set):
+ (JSC::Yarr::YarrCodeBlock::execute):
+ (JSC::Yarr::YarrCodeBlock::getAddr):
+ (JSC::Yarr::execute):
+ * yarr/YarrParser.h: Renamed from Source/JavaScriptCore/yarr/RegexParser.h.
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::begin):
+ (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::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/YarrPattern.cpp: Renamed from Source/JavaScriptCore/yarr/RegexPattern.cpp.
+ (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::BeginCharHelper::BeginCharHelper):
+ (JSC::Yarr::BeginCharHelper::addBeginChar):
+ (JSC::Yarr::BeginCharHelper::merge):
+ (JSC::Yarr::BeginCharHelper::addCharacter):
+ (JSC::Yarr::BeginCharHelper::linkHotTerms):
+ (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor):
+ (JSC::Yarr::YarrPatternConstructor::~YarrPatternConstructor):
+ (JSC::Yarr::YarrPatternConstructor::reset):
+ (JSC::Yarr::YarrPatternConstructor::assertionBOL):
+ (JSC::Yarr::YarrPatternConstructor::assertionEOL):
+ (JSC::Yarr::YarrPatternConstructor::assertionWordBoundary):
+ (JSC::Yarr::YarrPatternConstructor::atomPatternCharacter):
+ (JSC::Yarr::YarrPatternConstructor::atomBuiltInCharacterClass):
+ (JSC::Yarr::YarrPatternConstructor::atomCharacterClassBegin):
+ (JSC::Yarr::YarrPatternConstructor::atomCharacterClassAtom):
+ (JSC::Yarr::YarrPatternConstructor::atomCharacterClassRange):
+ (JSC::Yarr::YarrPatternConstructor::atomCharacterClassBuiltIn):
+ (JSC::Yarr::YarrPatternConstructor::atomCharacterClassEnd):
+ (JSC::Yarr::YarrPatternConstructor::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::YarrPatternConstructor::atomParentheticalAssertionBegin):
+ (JSC::Yarr::YarrPatternConstructor::atomParenthesesEnd):
+ (JSC::Yarr::YarrPatternConstructor::atomBackReference):
+ (JSC::Yarr::YarrPatternConstructor::copyDisjunction):
+ (JSC::Yarr::YarrPatternConstructor::copyTerm):
+ (JSC::Yarr::YarrPatternConstructor::quantifyAtom):
+ (JSC::Yarr::YarrPatternConstructor::disjunction):
+ (JSC::Yarr::YarrPatternConstructor::regexBegin):
+ (JSC::Yarr::YarrPatternConstructor::regexEnd):
+ (JSC::Yarr::YarrPatternConstructor::regexError):
+ (JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets):
+ (JSC::Yarr::YarrPatternConstructor::setupDisjunctionOffsets):
+ (JSC::Yarr::YarrPatternConstructor::setupOffsets):
+ (JSC::Yarr::YarrPatternConstructor::checkForTerminalParentheses):
+ (JSC::Yarr::YarrPatternConstructor::optimizeBOL):
+ (JSC::Yarr::YarrPatternConstructor::addBeginTerm):
+ (JSC::Yarr::YarrPatternConstructor::setupDisjunctionBeginTerms):
+ (JSC::Yarr::YarrPatternConstructor::setupAlternativeBeginTerms):
+ (JSC::Yarr::YarrPatternConstructor::setupBeginChars):
+ (JSC::Yarr::compile):
+ (JSC::Yarr::YarrPattern::YarrPattern):
+ * yarr/YarrPattern.h: Renamed from Source/JavaScriptCore/yarr/RegexPattern.h.
+ (JSC::Yarr::CharacterRange::CharacterRange):
+ (JSC::Yarr::CharacterClassTable::create):
+ (JSC::Yarr::CharacterClassTable::CharacterClassTable):
+ (JSC::Yarr::CharacterClass::CharacterClass):
+ (JSC::Yarr::PatternTerm::PatternTerm):
+ (JSC::Yarr::PatternTerm::ForwardReference):
+ (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::PatternAlternative::setOnceThrough):
+ (JSC::Yarr::PatternAlternative::onceThrough):
+ (JSC::Yarr::PatternDisjunction::PatternDisjunction):
+ (JSC::Yarr::PatternDisjunction::~PatternDisjunction):
+ (JSC::Yarr::PatternDisjunction::addNewAlternative):
+ (JSC::Yarr::TermChain::TermChain):
+ (JSC::Yarr::BeginChar::BeginChar):
+ (JSC::Yarr::YarrPattern::~YarrPattern):
+ (JSC::Yarr::YarrPattern::reset):
+ (JSC::Yarr::YarrPattern::containsIllegalBackReference):
+ (JSC::Yarr::YarrPattern::newlineCharacterClass):
+ (JSC::Yarr::YarrPattern::digitsCharacterClass):
+ (JSC::Yarr::YarrPattern::spacesCharacterClass):
+ (JSC::Yarr::YarrPattern::wordcharCharacterClass):
+ (JSC::Yarr::YarrPattern::nondigitsCharacterClass):
+ (JSC::Yarr::YarrPattern::nonspacesCharacterClass):
+ (JSC::Yarr::YarrPattern::nonwordcharCharacterClass):
+
+2011-01-10 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * parser/SyntaxChecker.h:
+
+2011-01-10 Dave Tapuska <dtapuska@rim.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add CTI ASM versions for RVCT ARM THUMB2 mode.
+
+ https://bugs.webkit.org/show_bug.cgi?id=52154
+
+ * jit/JITStubs.cpp:
+ (JSC::ctiTrampoline):
+ (JSC::ctiVMThrowTrampoline):
+ (JSC::ctiOpThrowNotCaught):
+
+2011-01-10 Gavin Barraclough <barraclough@apple.com>
+
+ Qt build fix.
+
+ * JavaScriptCore.pro:
+
+2011-01-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 52079 - Syntax errors should be early errors.
+
+ From chapter 16 the spec:
+ An implementation must report most errors at the time the relevant ECMAScript language construct is
+ evaluated. An early error is an error that can be detected and reported prior to the evaluation of
+ any construct in the Program containing the error. An implementation must report early errors in a
+ Program prior to the first evaluation of that Program. Early errors in eval code are reported at
+ the time eval is called but prior to evaluation of any construct within the eval code. All errors
+ that are not early errors are runtime errors.
+
+ An implementation must treat any instance of the following kinds of errors as an early error:
+ * Any syntax error."
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Added new files.
+ * bytecode/CodeBlock.cpp:
+ Removed op_throw_syntax_error.
+ * bytecode/Opcode.h:
+ Removed op_throw_syntax_error.
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ If m_expressionTooDeep then throw a runtime error.
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ Initialize m_expressionTooDeep.
+ (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):
+ Sets m_expressionTooDeep.
+ * bytecompiler/BytecodeGenerator.h:
+ Added m_expressionTooDeep, removed emitThrowSyntaxError.
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ (JSC::ContinueNode::emitBytecode):
+ (JSC::BreakNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::LabelNode::emitBytecode):
+ Conditions that threw syntax error are now handled during parsing;
+ during bytecompilation these are now just ASSERTs.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp:
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ Removed op_throw_syntax_error.
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createRegExp):
+ Renamed; added syntax check.
+ * parser/JSParser.cpp:
+ (JSC::JSParser::breakIsValid):
+ (JSC::JSParser::hasLabel):
+ (JSC::JSParser::Scope::Scope):
+ (JSC::JSParser::Scope::setIsFunction):
+ (JSC::JSParser::Scope::isFunctionBoundary):
+ (JSC::JSParser::ScopeRef::hasContainingScope):
+ (JSC::JSParser::ScopeRef::containingScope):
+ (JSC::JSParser::AutoPopScopeRef::AutoPopScopeRef):
+ (JSC::JSParser::AutoPopScopeRef::~AutoPopScopeRef):
+ (JSC::JSParser::AutoPopScopeRef::setPopped):
+ (JSC::JSParser::popScopeInternal):
+ (JSC::JSParser::popScope):
+ (JSC::jsParse):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::parseBreakStatement):
+ (JSC::JSParser::parseContinueStatement):
+ (JSC::JSParser::parseReturnStatement):
+ (JSC::JSParser::parseTryStatement):
+ (JSC::JSParser::parseFunctionInfo):
+ (JSC::JSParser::parseExpressionOrLabelStatement):
+ (JSC::JSParser::parsePrimaryExpression):
+ * parser/JSParser.h:
+ * parser/Nodes.h:
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::createRegExp):
+ Renamed; added syntax check.
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createOutOfMemoryError):
+ (JSC::throwOutOfMemoryError):
+ * runtime/ExceptionHelpers.h:
+ Broke out createOutOfMemoryError.
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ Add check for exception after bytecode generation.
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ RegExp error prefixes not included in error string.
+ * yarr/RegexParser.h:
+ (JSC::Yarr::Parser::parse):
+ Removed regexBegin/regexEnd/regexError.
+ * yarr/RegexPattern.cpp:
+ (JSC::Yarr::RegexPatternConstructor::regexBegin):
+ Removed regexEnd/regexError.
+ (JSC::Yarr::compileRegex):
+ Add call to regexBegin (no longer called from the parser).
+ * yarr/YarrSyntaxChecker.cpp: Added.
+ (JSC::Yarr::SyntaxChecker::assertionBOL):
+ (JSC::Yarr::SyntaxChecker::assertionEOL):
+ (JSC::Yarr::SyntaxChecker::assertionWordBoundary):
+ (JSC::Yarr::SyntaxChecker::atomPatternCharacter):
+ (JSC::Yarr::SyntaxChecker::atomBuiltInCharacterClass):
+ (JSC::Yarr::SyntaxChecker::atomCharacterClassBegin):
+ (JSC::Yarr::SyntaxChecker::atomCharacterClassAtom):
+ (JSC::Yarr::SyntaxChecker::atomCharacterClassRange):
+ (JSC::Yarr::SyntaxChecker::atomCharacterClassBuiltIn):
+ (JSC::Yarr::SyntaxChecker::atomCharacterClassEnd):
+ (JSC::Yarr::SyntaxChecker::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::SyntaxChecker::atomParentheticalAssertionBegin):
+ (JSC::Yarr::SyntaxChecker::atomParenthesesEnd):
+ (JSC::Yarr::SyntaxChecker::atomBackReference):
+ (JSC::Yarr::SyntaxChecker::quantifyAtom):
+ (JSC::Yarr::SyntaxChecker::disjunction):
+ (JSC::Yarr::checkSyntax):
+ * yarr/YarrSyntaxChecker.h: Added.
+ Check RegExp syntax.
+
+2011-01-10 Adam Roben <aroben@apple.com>
+
+ Roll out r75289
+
+ It was causing assertion failures. See <http://webkit.org/b/52156>.
+
+ * wtf/StackBounds.cpp:
+ (WTF::StackBounds::initialize):
+
+2011-01-08 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Unify string table adding in AtomicString
+ https://bugs.webkit.org/show_bug.cgi?id=51927
+
+ Move code for adding a string into a separate function.
+ This removes multiple occurrence of the same logic.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::addToStringTable): Added.
+ (WTF::AtomicString::add): Use addToStringTable().
+ (WTF::AtomicString::fromUTF8): Ditto.
+
+2011-01-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Split machine stack marking functions into their own class (MachineStackMarker)
+ https://bugs.webkit.org/show_bug.cgi?id=52088
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Moved registerThread()
+ call behind an #ifdef because we shouldn't be registering threads at all
+ if we don't support usage on multiple threads.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Updated projects.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::markRoots):
+ * runtime/Collector.h:
+ (JSC::Heap::machineStackMarker): Moved code to machineStackMarker.
+
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::makeUsableFromMultipleThreads): Removed an unnecessary
+ level of indirection, to make Heap less of a God class.
+
+ * runtime/MachineStackMarker.h: Copied from Source/JavaScriptCore/runtime/Collector.h.
+ * runtime/MachineStackMarker.cpp: Copied from Source/JavaScriptCore/runtime/Collector.cpp.
+ (JSC::MachineStackMarker::MachineStackMarker):
+ (JSC::MachineStackMarker::~MachineStackMarker):
+ (JSC::MachineStackMarker::makeUsableFromMultipleThreads):
+ (JSC::MachineStackMarker::registerThread):
+ (JSC::MachineStackMarker::unregisterThread):
+ (JSC::MachineStackMarker::markCurrentThreadConservativelyInternal):
+ (JSC::MachineStackMarker::markCurrentThreadConservatively):
+ (JSC::MachineStackMarker::markOtherThreadConservatively):
+ (JSC::MachineStackMarker::markMachineStackConservatively): Moved code from Heap.
+
+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/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h
index 06b566b..06b566b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APIShims.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APIShims.h
new file mode 100644
index 0000000..92e712a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APIShims.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/APIShims.h>
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h
index 25b2aa4..25b2aa4 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h
index f7e57be..f7e57be 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h
index 7713722..7713722 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h
index e048d34..e048d34 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h
index d32e0c7..d32e0c7 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h
index 11ae723..11ae723 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h
index 7186287..7186287 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h
index ab90c6d..ab90c6d 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h
index 7dc8e08..7dc8e08 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h
index 51e029e..51e029e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h
index 0c58890..0c58890 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/GNUmakefile.list.am b/src/3rdparty/webkit/Source/JavaScriptCore/GNUmakefile.list.am
new file mode 100644
index 0000000..16bbf56
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/GNUmakefile.list.am
@@ -0,0 +1,609 @@
+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/ObjectConstructor.lut.h \
+ Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \
+ Source/JavaScriptCore/runtime/RegExpObject.lut.h \
+ Source/JavaScriptCore/runtime/StringPrototype.lut.h
+
+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/ARMv7Assembler.cpp \
+ Source/JavaScriptCore/assembler/ARMv7Assembler.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/MacroAssemblerARMv7.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/MacroAssemblerSH4.h \
+ Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp \
+ Source/JavaScriptCore/assembler/SH4Assembler.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/heap/ConservativeRoots.cpp \
+ Source/JavaScriptCore/heap/ConservativeRoots.h \
+ Source/JavaScriptCore/heap/Handle.h \
+ Source/JavaScriptCore/heap/HandleHeap.cpp \
+ Source/JavaScriptCore/heap/HandleHeap.h \
+ Source/JavaScriptCore/heap/HandleStack.cpp \
+ Source/JavaScriptCore/heap/HandleStack.h \
+ Source/JavaScriptCore/heap/Heap.cpp \
+ Source/JavaScriptCore/heap/Heap.h \
+ Source/JavaScriptCore/heap/Local.h \
+ Source/JavaScriptCore/heap/LocalScope.h \
+ Source/JavaScriptCore/heap/MachineStackMarker.cpp \
+ Source/JavaScriptCore/heap/MachineStackMarker.h \
+ Source/JavaScriptCore/heap/MarkStack.cpp \
+ Source/JavaScriptCore/heap/MarkStack.h \
+ Source/JavaScriptCore/heap/MarkedBlock.cpp \
+ Source/JavaScriptCore/heap/MarkedBlock.h \
+ Source/JavaScriptCore/heap/MarkedSpace.cpp \
+ Source/JavaScriptCore/heap/MarkedSpace.h \
+ Source/JavaScriptCore/heap/Strong.h \
+ Source/JavaScriptCore/heap/Weak.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/APIShims.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/SourceProviderCache.cpp \
+ Source/JavaScriptCore/parser/SourceProviderCache.h \
+ Source/JavaScriptCore/parser/SourceProviderCacheItem.h \
+ Source/JavaScriptCore/parser/SyntaxChecker.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/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/GetterSetter.cpp \
+ Source/JavaScriptCore/runtime/GetterSetter.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/JSLock.cpp \
+ Source/JavaScriptCore/runtime/JSLock.h \
+ Source/JavaScriptCore/runtime/JSNotAnObject.cpp \
+ Source/JavaScriptCore/runtime/JSNotAnObject.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/JSValueInlineMethods.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/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/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/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/StringRecursionChecker.cpp \
+ Source/JavaScriptCore/runtime/StringRecursionChecker.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/WeakRandom.h \
+ Source/JavaScriptCore/runtime/WriteBarrier.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/BlockStack.h \
+ Source/JavaScriptCore/wtf/BloomFilter.h \
+ Source/JavaScriptCore/wtf/BumpPointerAllocator.h \
+ Source/JavaScriptCore/wtf/ByteArray.cpp \
+ Source/JavaScriptCore/wtf/ByteArray.h \
+ Source/JavaScriptCore/wtf/CrossThreadRefCounted.h \
+ Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp \
+ Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.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/DoublyLinkedList.h \
+ Source/JavaScriptCore/wtf/dtoa.cpp \
+ Source/JavaScriptCore/wtf/dtoa.h \
+ Source/JavaScriptCore/wtf/DynamicAnnotations.cpp \
+ Source/JavaScriptCore/wtf/DynamicAnnotations.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/HexNumber.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/OSRandomSource.cpp \
+ Source/JavaScriptCore/wtf/OSRandomSource.h \
+ Source/JavaScriptCore/wtf/OwnArrayPtr.h \
+ Source/JavaScriptCore/wtf/OwnFastMallocPtr.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/PassTraits.h \
+ Source/JavaScriptCore/wtf/ParallelJobs.h \
+ Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp \
+ Source/JavaScriptCore/wtf/ParallelJobsGeneric.h \
+ Source/JavaScriptCore/wtf/ParallelJobsLibdispatch.h \
+ Source/JavaScriptCore/wtf/ParallelJobsOpenMP.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/SentinelLinkedList.h \
+ Source/JavaScriptCore/wtf/SHA1.cpp \
+ Source/JavaScriptCore/wtf/SHA1.h \
+ Source/JavaScriptCore/wtf/SinglyLinkedList.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/ThreadSafeRefCounted.h \
+ Source/JavaScriptCore/wtf/ThreadSpecific.h \
+ Source/JavaScriptCore/wtf/TypeTraits.cpp \
+ Source/JavaScriptCore/wtf/TypeTraits.h \
+ Source/JavaScriptCore/wtf/unicode/CharacterNames.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/Yarr.h \
+ Source/JavaScriptCore/yarr/YarrInterpreter.cpp \
+ Source/JavaScriptCore/yarr/YarrInterpreter.h \
+ Source/JavaScriptCore/yarr/YarrJIT.cpp \
+ Source/JavaScriptCore/yarr/YarrJIT.h \
+ Source/JavaScriptCore/yarr/YarrParser.h \
+ Source/JavaScriptCore/yarr/YarrPattern.cpp \
+ Source/JavaScriptCore/yarr/YarrPattern.h \
+ Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp \
+ Source/JavaScriptCore/yarr/YarrSyntaxChecker.h
+
+if TARGET_WIN32
+javascriptcore_sources += \
+ Source/JavaScriptCore/heap/MarkStackWin.cpp \
+ Source/JavaScriptCore/wtf/OSAllocatorWin.cpp
+else
+javascriptcore_sources += \
+ Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp \
+ Source/JavaScriptCore/heap/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 # USE_GLIB_UNICODE
+
+# 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_jsc_@WEBKITGTK_API_MAJOR_VERSION@_SOURCES = \
+ Source/JavaScriptCore/jsc.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/Info.plist b/src/3rdparty/webkit/Source/JavaScriptCore/Info.plist
new file mode 100644
index 0000000..a8ae5cc
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp
new file mode 100644
index 0000000..f9eee85
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp
@@ -0,0 +1 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEPNS_9StructureEiRKNS_10IdentifierEPFxS2_E
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp
new file mode 100644
index 0000000..eaa9f51
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp
@@ -0,0 +1 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEPNS_9StructureEiRKNS_10IdentifierEPFPvS2_E
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.gypi
new file mode 100644
index 0000000..cc18967
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.gypi
@@ -0,0 +1,731 @@
+{
+ 'variables': {
+ 'project_dir': ['.'],
+ # These headers are part of JavaScriptCore's public API in the Apple Mac build.
+ 'javascriptcore_publicheader_files': [
+ 'API/JSBase.h',
+ 'API/JSContextRef.h',
+ 'API/JSObjectRef.h',
+ 'API/JSStringRef.h',
+ 'API/JSStringRefCF.h',
+ 'API/JSValueRef.h',
+ 'API/JavaScript.h',
+ 'API/JavaScriptCore.h',
+ 'API/WebKitAvailability.h',
+ ],
+ # These headers are part of JavaScriptCore's private API in the Apple Mac build.
+ 'javascriptcore_privateheader_files': [
+ 'API/APICast.h',
+ 'API/APIShims.h',
+ 'API/JSBasePrivate.h',
+ 'API/JSContextRefPrivate.h',
+ 'API/JSObjectRefPrivate.h',
+ 'API/JSProfilerPrivate.h',
+ 'API/JSRetainPtr.h',
+ 'API/JSWeakObjectMapRefInternal.h',
+ 'API/JSWeakObjectMapRefPrivate.h',
+ 'API/OpaqueJSString.h',
+ 'assembler/MacroAssemblerCodeRef.h',
+ 'bytecode/Opcode.h',
+ 'heap/ConservativeRoots.h',
+ 'heap/Handle.h',
+ 'heap/HandleHeap.h',
+ 'heap/HandleStack.h',
+ 'heap/Heap.h',
+ 'heap/Local.h',
+ 'heap/LocalScope.h',
+ 'heap/Strong.h',
+ 'heap/Weak.h',
+ 'config.h',
+ 'debugger/Debugger.h',
+ 'debugger/DebuggerActivation.h',
+ 'debugger/DebuggerCallFrame.h',
+ 'interpreter/CallFrame.h',
+ 'interpreter/Interpreter.h',
+ 'interpreter/Register.h',
+ 'interpreter/RegisterFile.h',
+ 'jit/ExecutableAllocator.h',
+ 'jit/JITCode.h',
+ 'jit/JITStubs.h',
+ 'jit/ThunkGenerators.h',
+ 'parser/ResultType.h',
+ 'parser/SourceCode.h',
+ 'parser/SourceProvider.h',
+ 'parser/SourceProviderCache.h',
+ 'profiler/CallIdentifier.h',
+ 'profiler/Profile.h',
+ 'profiler/ProfileNode.h',
+ 'profiler/Profiler.h',
+ 'runtime/ArgList.h',
+ 'runtime/ArrayPrototype.h',
+ 'runtime/BooleanObject.h',
+ 'runtime/CachedTranscendentalFunction.h',
+ 'runtime/CallData.h',
+ 'runtime/ClassInfo.h',
+ 'runtime/CommonIdentifiers.h',
+ 'runtime/Completion.h',
+ 'runtime/ConstructData.h',
+ 'runtime/DateInstance.h',
+ 'runtime/DateInstanceCache.h',
+ 'runtime/Error.h',
+ 'runtime/ExceptionHelpers.h',
+ 'runtime/FunctionConstructor.h',
+ 'runtime/FunctionPrototype.h',
+ 'runtime/GCActivityCallback.h',
+ 'runtime/Identifier.h',
+ 'runtime/InitializeThreading.h',
+ 'runtime/InternalFunction.h',
+ 'runtime/JSAPIValueWrapper.h',
+ 'runtime/JSArray.h',
+ 'runtime/JSByteArray.h',
+ 'runtime/JSCell.h',
+ 'runtime/JSFunction.h',
+ 'runtime/JSGlobalData.h',
+ 'runtime/JSGlobalObject.h',
+ 'runtime/JSLock.h',
+ 'runtime/JSNumberCell.h',
+ 'runtime/JSObject.h',
+ 'runtime/JSObjectWithGlobalObject.h',
+ 'runtime/JSString.h',
+ 'runtime/JSType.h',
+ 'runtime/JSTypeInfo.h',
+ 'runtime/JSValue.h',
+ 'runtime/JSValueInlineMethods.h',
+ 'runtime/JSVariableObject.h',
+ 'runtime/JSWrapperObject.h',
+ 'runtime/Lookup.h',
+ 'runtime/MathObject.h',
+ 'runtime/MemoryStatistics.h',
+ 'runtime/NumberObject.h',
+ 'runtime/NumberPrototype.h',
+ 'runtime/NumericStrings.h',
+ 'runtime/ObjectPrototype.h',
+ 'runtime/Operations.h',
+ 'runtime/PropertyDescriptor.h',
+ 'runtime/PropertyMapHashTable.h',
+ 'runtime/PropertyNameArray.h',
+ 'runtime/PropertySlot.h',
+ 'runtime/Protect.h',
+ 'runtime/PutPropertySlot.h',
+ 'runtime/RegExp.h',
+ 'runtime/RegExpKey.h',
+ 'runtime/RegExpCache.h',
+ 'runtime/RegExpObject.h',
+ 'runtime/RopeImpl.h',
+ 'runtime/ScopeChain.h',
+ 'runtime/SmallStrings.h',
+ 'runtime/StringObject.h',
+ 'runtime/StringObjectThatMasqueradesAsUndefined.h',
+ 'runtime/StringPrototype.h',
+ 'runtime/Structure.h',
+ 'runtime/StructureChain.h',
+ 'runtime/StructureTransitionTable.h',
+ 'runtime/SymbolTable.h',
+ 'runtime/Terminator.h',
+ 'runtime/TimeoutChecker.h',
+ 'runtime/UString.h',
+ 'runtime/UStringBuilder.h',
+ 'runtime/WeakGCMap.h',
+ 'runtime/WeakRandom.h',
+ 'runtime/WriteBarrier.h',
+ 'wtf/ASCIICType.h',
+ 'wtf/AVLTree.h',
+ 'wtf/Alignment.h',
+ 'wtf/AlwaysInline.h',
+ 'wtf/Assertions.h',
+ 'wtf/Atomics.h',
+ 'wtf/Bitmap.h',
+ 'wtf/BlockStack.h',
+ 'wtf/BloomFilter.h',
+ 'wtf/BumpPointerAllocator.h',
+ 'wtf/ByteArray.h',
+ 'wtf/Complex.h',
+ 'wtf/CrossThreadRefCounted.h',
+ 'wtf/CryptographicallyRandomNumber.h',
+ 'wtf/CurrentTime.h',
+ 'wtf/DateMath.h',
+ 'wtf/DecimalNumber.h',
+ 'wtf/Decoder.h',
+ 'wtf/Deque.h',
+ 'wtf/DisallowCType.h',
+ 'wtf/DoublyLinkedList.h',
+ 'wtf/Encoder.h',
+ 'wtf/FastAllocBase.h',
+ 'wtf/FastMalloc.h',
+ 'wtf/FixedArray.h',
+ 'wtf/Forward.h',
+ 'wtf/GetPtr.h',
+ 'wtf/HashCountedSet.h',
+ 'wtf/HashFunctions.h',
+ 'wtf/HashIterators.h',
+ 'wtf/HashMap.h',
+ 'wtf/HashSet.h',
+ 'wtf/HashTable.h',
+ 'wtf/HashTraits.h',
+ 'wtf/HexNumber.h',
+ 'wtf/ListHashSet.h',
+ 'wtf/ListRefPtr.h',
+ 'wtf/Locker.h',
+ 'wtf/MD5.h',
+ 'wtf/MainThread.h',
+ 'wtf/MathExtras.h',
+ 'wtf/MessageQueue.h',
+ 'wtf/NonCopyingSort.h',
+ 'wtf/Noncopyable.h',
+ 'wtf/NotFound.h',
+ 'wtf/NullPtr.h',
+ 'wtf/OSAllocator.h',
+ 'wtf/OwnArrayPtr.h',
+ 'wtf/OwnFastMallocPtr.h',
+ 'wtf/OwnPtr.h',
+ 'wtf/OwnPtrCommon.h',
+ 'wtf/PageAllocation.h',
+ 'wtf/PageAllocationAligned.h',
+ 'wtf/PageBlock.h',
+ 'wtf/PageReservation.h',
+ 'wtf/PassOwnArrayPtr.h',
+ 'wtf/PassOwnPtr.h',
+ 'wtf/PassRefPtr.h',
+ 'wtf/PassTraits.h',
+ 'wtf/Platform.h',
+ 'wtf/PossiblyNull.h',
+ 'wtf/RandomNumber.h',
+ 'wtf/RefCounted.h',
+ 'wtf/RefCountedLeakCounter.h',
+ 'wtf/RefPtr.h',
+ 'wtf/RefPtrHashMap.h',
+ 'wtf/RetainPtr.h',
+ 'wtf/SentinelLinkedList.h',
+ 'wtf/SinglyLinkedList.h',
+ 'wtf/StackBounds.h',
+ 'wtf/StaticConstructors.h',
+ 'wtf/StdLibExtras.h',
+ 'wtf/StringExtras.h',
+ 'wtf/StringHasher.h',
+ 'wtf/ThreadSafeRefCounted.h',
+ 'wtf/ThreadSpecific.h',
+ 'wtf/Threading.h',
+ 'wtf/ThreadingPrimitives.h',
+ 'wtf/TypeTraits.h',
+ 'wtf/UnusedParam.h',
+ 'wtf/VMTags.h',
+ 'wtf/ValueCheck.h',
+ 'wtf/Vector.h',
+ 'wtf/VectorTraits.h',
+ 'wtf/WTFThreadData.h',
+ 'wtf/dtoa.h',
+ 'wtf/text/AtomicString.h',
+ 'wtf/text/AtomicStringHash.h',
+ 'wtf/text/AtomicStringImpl.h',
+ 'wtf/text/CString.h',
+ 'wtf/text/StringBuffer.h',
+ 'wtf/text/StringBuilder.h',
+ 'wtf/text/StringConcatenate.h',
+ 'wtf/text/StringHash.h',
+ 'wtf/text/StringImpl.h',
+ 'wtf/text/StringImplBase.h',
+ 'wtf/text/TextPosition.h',
+ 'wtf/text/WTFString.h',
+ 'wtf/unicode/CharacterNames.h',
+ 'wtf/unicode/Collator.h',
+ 'wtf/unicode/UTF8.h',
+ 'wtf/unicode/Unicode.h',
+ 'wtf/unicode/icu/UnicodeIcu.h',
+ 'yarr/Yarr.h',
+ 'yarr/YarrInterpreter.h',
+ 'yarr/YarrPattern.h',
+ ],
+ 'javascriptcore_files': [
+ 'API/APIShims.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/JSClassRef.h',
+ 'API/JSContextRef.cpp',
+ 'API/JSObjectRef.cpp',
+ 'API/JSProfilerPrivate.cpp',
+ 'API/JSStringRef.cpp',
+ 'API/JSStringRefBSTR.cpp',
+ 'API/JSStringRefBSTR.h',
+ 'API/JSStringRefCF.cpp',
+ 'API/JSValueRef.cpp',
+ 'API/JSWeakObjectMapRefPrivate.cpp',
+ 'API/OpaqueJSString.cpp',
+ 'AllInOneFile.cpp',
+ 'ForwardingHeaders/JavaScriptCore/APICast.h',
+ 'ForwardingHeaders/JavaScriptCore/APIShims.h',
+ 'ForwardingHeaders/JavaScriptCore/JSBase.h',
+ 'ForwardingHeaders/JavaScriptCore/JSContextRef.h',
+ 'ForwardingHeaders/JavaScriptCore/JSObjectRef.h',
+ 'ForwardingHeaders/JavaScriptCore/JSRetainPtr.h',
+ 'ForwardingHeaders/JavaScriptCore/JSStringRef.h',
+ 'ForwardingHeaders/JavaScriptCore/JSStringRefCF.h',
+ 'ForwardingHeaders/JavaScriptCore/JSValueRef.h',
+ 'ForwardingHeaders/JavaScriptCore/JavaScript.h',
+ 'ForwardingHeaders/JavaScriptCore/JavaScriptCore.h',
+ 'ForwardingHeaders/JavaScriptCore/OpaqueJSString.h',
+ 'ForwardingHeaders/JavaScriptCore/WebKitAvailability.h',
+ 'JavaScriptCorePrefix.h',
+ 'assembler/ARMAssembler.cpp',
+ 'assembler/ARMAssembler.h',
+ 'assembler/ARMv7Assembler.cpp',
+ '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.cpp',
+ 'assembler/MacroAssemblerARM.h',
+ 'assembler/MacroAssemblerARMv7.h',
+ 'assembler/MacroAssemblerMIPS.h',
+ 'assembler/MacroAssemblerX86.h',
+ 'assembler/MacroAssemblerX86Common.h',
+ 'assembler/MacroAssemblerX86_64.h',
+ 'assembler/RepatchBuffer.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/SamplingTool.cpp',
+ 'bytecode/SamplingTool.h',
+ 'bytecode/StructureStubInfo.cpp',
+ 'bytecode/StructureStubInfo.h',
+ 'bytecompiler/BytecodeGenerator.cpp',
+ 'bytecompiler/BytecodeGenerator.h',
+ 'bytecompiler/Label.h',
+ 'bytecompiler/LabelScope.h',
+ 'bytecompiler/NodesCodegen.cpp',
+ 'bytecompiler/RegisterID.h',
+ 'heap/ConservativeRoots.cpp',
+ 'heap/HandleHeap.cpp',
+ 'heap/HandleStack.cpp',
+ 'heap/Heap.cpp',
+ 'heap/MachineStackMarker.cpp',
+ 'heap/MachineStackMarker.h',
+ 'heap/MarkStack.cpp',
+ 'heap/MarkStack.h',
+ 'heap/MarkStackPosix.cpp',
+ 'heap/MarkStackSymbian.cpp',
+ 'heap/MarkStackWin.cpp',
+ 'heap/MarkedBlock.cpp',
+ 'heap/MarkedBlock.h',
+ 'heap/MarkedSpace.cpp',
+ 'heap/MarkedSpace.h',
+ 'debugger/Debugger.cpp',
+ 'debugger/DebuggerActivation.cpp',
+ 'debugger/DebuggerCallFrame.cpp',
+ 'dfg/DFGAliasTracker.h',
+ 'dfg/DFGByteCodeParser.cpp',
+ 'dfg/DFGByteCodeParser.h',
+ 'dfg/DFGGenerationInfo.h',
+ 'dfg/DFGGraph.cpp',
+ 'dfg/DFGGraph.h',
+ 'dfg/DFGJITCodeGenerator.cpp',
+ 'dfg/DFGJITCodeGenerator.h',
+ 'dfg/DFGJITCompiler.cpp',
+ 'dfg/DFGJITCompiler.h',
+ 'dfg/DFGNode.h',
+ 'dfg/DFGNonSpeculativeJIT.cpp',
+ 'dfg/DFGNonSpeculativeJIT.h',
+ 'dfg/DFGOperations.cpp',
+ 'dfg/DFGOperations.h',
+ 'dfg/DFGRegisterBank.h',
+ 'dfg/DFGScoreBoard.h',
+ 'dfg/DFGSpeculativeJIT.cpp',
+ 'dfg/DFGSpeculativeJIT.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/CallFrameClosure.h',
+ 'interpreter/Interpreter.cpp',
+ 'interpreter/RegisterFile.cpp',
+ 'jit/ExecutableAllocator.cpp',
+ 'jit/ExecutableAllocatorFixedVMPool.cpp',
+ 'jit/JIT.cpp',
+ 'jit/JIT.h',
+ 'jit/JITArithmetic.cpp',
+ 'jit/JITArithmetic32_64.cpp',
+ 'jit/JITCall.cpp',
+ 'jit/JITCall32_64.cpp',
+ 'jit/JITInlineMethods.h',
+ 'jit/JITOpcodes.cpp',
+ 'jit/JITOpcodes32_64.cpp',
+ 'jit/JITPropertyAccess.cpp',
+ 'jit/JITPropertyAccess32_64.cpp',
+ 'jit/JITStubCall.h',
+ 'jit/JITStubs.cpp',
+ 'jit/JSInterfaceJIT.h',
+ 'jit/SpecializedThunkJIT.h',
+ 'jit/ThunkGenerators.cpp',
+ 'os-win32/WinMain.cpp',
+ 'os-win32/inttypes.h',
+ '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/SourceProviderCache.cpp',
+ 'parser/SourceProviderCacheItem.h',
+ 'parser/SyntaxChecker.h',
+ 'profiler/Profile.cpp',
+ 'profiler/ProfileGenerator.cpp',
+ 'profiler/ProfileGenerator.h',
+ 'profiler/ProfileNode.cpp',
+ 'profiler/Profiler.cpp',
+ 'profiler/ProfilerServer.h',
+ 'profiler/ProfilerServer.mm',
+ 'qt/api/qscriptconverter_p.h',
+ 'qt/api/qscriptengine.cpp',
+ 'qt/api/qscriptengine.h',
+ 'qt/api/qscriptengine_p.cpp',
+ 'qt/api/qscriptengine_p.h',
+ 'qt/api/qscriptfunction.cpp',
+ 'qt/api/qscriptfunction_p.h',
+ 'qt/api/qscriptoriginalglobalobject_p.h',
+ 'qt/api/qscriptprogram.cpp',
+ 'qt/api/qscriptprogram.h',
+ 'qt/api/qscriptprogram_p.h',
+ 'qt/api/qscriptstring.cpp',
+ 'qt/api/qscriptstring.h',
+ 'qt/api/qscriptstring_p.h',
+ 'qt/api/qscriptsyntaxcheckresult.cpp',
+ 'qt/api/qscriptsyntaxcheckresult.h',
+ 'qt/api/qscriptsyntaxcheckresult_p.h',
+ 'qt/api/qscriptvalue.cpp',
+ 'qt/api/qscriptvalue.h',
+ 'qt/api/qscriptvalue_p.h',
+ 'qt/api/qscriptvalueiterator.cpp',
+ 'qt/api/qscriptvalueiterator.h',
+ 'qt/api/qscriptvalueiterator_p.h',
+ 'qt/api/qtscriptglobal.h',
+ 'qt/benchmarks/qscriptengine/tst_qscriptengine.cpp',
+ 'qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp',
+ 'qt/tests/qscriptengine/tst_qscriptengine.cpp',
+ 'qt/tests/qscriptstring/tst_qscriptstring.cpp',
+ 'qt/tests/qscriptvalue/tst_qscriptvalue.cpp',
+ 'qt/tests/qscriptvalue/tst_qscriptvalue.h',
+ 'qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp',
+ 'qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp',
+ 'qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp',
+ 'qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp',
+ 'qt/tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp',
+ 'runtime/ArgList.cpp',
+ 'runtime/Arguments.cpp',
+ 'runtime/Arguments.h',
+ 'runtime/ArrayConstructor.cpp',
+ 'runtime/ArrayConstructor.h',
+ 'runtime/ArrayPrototype.cpp',
+ 'runtime/BatchedTransitionOptimizer.h',
+ 'runtime/BooleanConstructor.cpp',
+ 'runtime/BooleanConstructor.h',
+ 'runtime/BooleanObject.cpp',
+ 'runtime/BooleanPrototype.cpp',
+ 'runtime/BooleanPrototype.h',
+ 'runtime/CallData.cpp',
+ 'runtime/CommonIdentifiers.cpp',
+ 'runtime/Completion.cpp',
+ 'runtime/ConstructData.cpp',
+ 'runtime/DateConstructor.cpp',
+ 'runtime/DateConstructor.h',
+ 'runtime/DateConversion.cpp',
+ 'runtime/DateConversion.h',
+ 'runtime/DateInstance.cpp',
+ 'runtime/DatePrototype.cpp',
+ 'runtime/DatePrototype.h',
+ 'runtime/Error.cpp',
+ 'runtime/ErrorConstructor.cpp',
+ 'runtime/ErrorConstructor.h',
+ 'runtime/ErrorInstance.cpp',
+ 'runtime/ErrorInstance.h',
+ 'runtime/ErrorPrototype.cpp',
+ 'runtime/ErrorPrototype.h',
+ 'runtime/ExceptionHelpers.cpp',
+ 'runtime/Executable.cpp',
+ 'runtime/Executable.h',
+ 'runtime/FunctionConstructor.cpp',
+ 'runtime/FunctionPrototype.cpp',
+ 'runtime/GCActivityCallback.cpp',
+ 'runtime/GCActivityCallbackCF.cpp',
+ 'runtime/GetterSetter.cpp',
+ 'runtime/GetterSetter.h',
+ 'runtime/Identifier.cpp',
+ 'runtime/InitializeThreading.cpp',
+ 'runtime/InternalFunction.cpp',
+ 'runtime/JSAPIValueWrapper.cpp',
+ 'runtime/JSActivation.cpp',
+ 'runtime/JSActivation.h',
+ 'runtime/JSArray.cpp',
+ 'runtime/JSByteArray.cpp',
+ 'runtime/JSCell.cpp',
+ 'runtime/JSFunction.cpp',
+ 'runtime/JSGlobalData.cpp',
+ 'runtime/JSGlobalObject.cpp',
+ 'runtime/JSGlobalObjectFunctions.cpp',
+ 'runtime/JSGlobalObjectFunctions.h',
+ 'runtime/JSLock.cpp',
+ 'runtime/JSNotAnObject.cpp',
+ 'runtime/JSNotAnObject.h',
+ 'runtime/JSNumberCell.cpp',
+ 'runtime/JSONObject.cpp',
+ 'runtime/JSONObject.h',
+ 'runtime/JSObject.cpp',
+ 'runtime/JSObjectWithGlobalObject.cpp',
+ 'runtime/JSPropertyNameIterator.cpp',
+ 'runtime/JSPropertyNameIterator.h',
+ 'runtime/JSStaticScopeObject.cpp',
+ 'runtime/JSStaticScopeObject.h',
+ 'runtime/JSString.cpp',
+ 'runtime/JSStringBuilder.h',
+ 'runtime/JSValue.cpp',
+ 'runtime/JSVariableObject.cpp',
+ 'runtime/JSWrapperObject.cpp',
+ 'runtime/JSZombie.cpp',
+ 'runtime/JSZombie.h',
+ 'runtime/LiteralParser.cpp',
+ 'runtime/LiteralParser.h',
+ 'runtime/Lookup.cpp',
+ 'runtime/MathObject.cpp',
+ 'runtime/MemoryStatistics.cpp',
+ 'runtime/NativeErrorConstructor.cpp',
+ 'runtime/NativeErrorConstructor.h',
+ 'runtime/NativeErrorPrototype.cpp',
+ 'runtime/NativeErrorPrototype.h',
+ 'runtime/NumberConstructor.cpp',
+ 'runtime/NumberConstructor.h',
+ 'runtime/NumberObject.cpp',
+ 'runtime/NumberPrototype.cpp',
+ 'runtime/ObjectConstructor.cpp',
+ 'runtime/ObjectConstructor.h',
+ 'runtime/ObjectPrototype.cpp',
+ 'runtime/Operations.cpp',
+ 'runtime/PropertyDescriptor.cpp',
+ 'runtime/PropertyNameArray.cpp',
+ 'runtime/PropertySlot.cpp',
+ 'runtime/RegExp.cpp',
+ 'runtime/RegExpCache.cpp',
+ 'runtime/RegExpConstructor.cpp',
+ 'runtime/RegExpConstructor.h',
+ 'runtime/RegExpMatchesArray.h',
+ 'runtime/RegExpObject.cpp',
+ 'runtime/RegExpPrototype.cpp',
+ 'runtime/RegExpPrototype.h',
+ 'runtime/RopeImpl.cpp',
+ 'runtime/ScopeChain.cpp',
+ 'runtime/ScopeChainMark.h',
+ 'runtime/SmallStrings.cpp',
+ 'runtime/StrictEvalActivation.cpp',
+ 'runtime/StrictEvalActivation.h',
+ 'runtime/StringConstructor.cpp',
+ 'runtime/StringConstructor.h',
+ 'runtime/StringObject.cpp',
+ 'runtime/StringPrototype.cpp',
+ 'runtime/StringRecursionChecker.cpp',
+ 'runtime/StringRecursionChecker.h',
+ 'runtime/Structure.cpp',
+ 'runtime/StructureChain.cpp',
+ 'runtime/TimeoutChecker.cpp',
+ 'runtime/Tracing.d',
+ 'runtime/Tracing.h',
+ 'runtime/UString.cpp',
+ 'runtime/UStringConcatenate.h',
+ 'wtf/Assertions.cpp',
+ 'wtf/ByteArray.cpp',
+ 'wtf/CryptographicallyRandomNumber.cpp',
+ 'wtf/CurrentTime.cpp',
+ 'wtf/DateMath.cpp',
+ 'wtf/DecimalNumber.cpp',
+ 'wtf/DynamicAnnotations.cpp',
+ 'wtf/DynamicAnnotations.h',
+ 'wtf/FastMalloc.cpp',
+ 'wtf/HashTable.cpp',
+ 'wtf/MD5.cpp',
+ 'wtf/MainThread.cpp',
+ 'wtf/MallocZoneSupport.h',
+ 'wtf/NullPtr.cpp',
+ 'wtf/OSAllocatorPosix.cpp',
+ 'wtf/OSAllocatorSymbian.cpp',
+ 'wtf/OSAllocatorWin.cpp',
+ 'wtf/OSRandomSource.cpp',
+ 'wtf/OSRandomSource.h',
+ 'wtf/PageAllocationAligned.cpp',
+ 'wtf/PageAllocatorSymbian.h',
+ 'wtf/PageBlock.cpp',
+ 'wtf/RandomNumber.cpp',
+ 'wtf/RandomNumberSeed.h',
+ 'wtf/RefCountedLeakCounter.cpp',
+ 'wtf/SHA1.cpp',
+ 'wtf/SHA1.h',
+ 'wtf/SegmentedVector.h',
+ 'wtf/SizeLimits.cpp',
+ 'wtf/StackBounds.cpp',
+ 'wtf/StringExtras.cpp',
+ 'wtf/TCPackedCache.h',
+ 'wtf/TCPageMap.h',
+ 'wtf/TCSpinLock.h',
+ 'wtf/TCSystemAlloc.cpp',
+ 'wtf/TCSystemAlloc.h',
+ 'wtf/ThreadFunctionInvocation.h',
+ 'wtf/ThreadIdentifierDataPthreads.cpp',
+ 'wtf/ThreadIdentifierDataPthreads.h',
+ 'wtf/ThreadSpecificWin.cpp',
+ 'wtf/Threading.cpp',
+ 'wtf/ThreadingNone.cpp',
+ 'wtf/ThreadingPthreads.cpp',
+ 'wtf/ThreadingWin.cpp',
+ 'wtf/TypeTraits.cpp',
+ 'wtf/WTFThreadData.cpp',
+ 'wtf/android/AndroidThreading.h',
+ 'wtf/android/MainThreadAndroid.cpp',
+ 'wtf/brew/MainThreadBrew.cpp',
+ 'wtf/brew/OwnPtrBrew.cpp',
+ 'wtf/brew/RefPtrBrew.h',
+ 'wtf/brew/ShellBrew.h',
+ 'wtf/brew/StringBrew.cpp',
+ 'wtf/brew/SystemMallocBrew.h',
+ 'wtf/chromium/ChromiumThreading.h',
+ 'wtf/chromium/MainThreadChromium.cpp',
+ 'wtf/dtoa.cpp',
+ 'wtf/efl/MainThreadEfl.cpp',
+ 'wtf/gobject/GOwnPtr.cpp',
+ 'wtf/gobject/GOwnPtr.h',
+ 'wtf/gobject/GRefPtr.cpp',
+ 'wtf/gobject/GRefPtr.h',
+ 'wtf/gobject/GTypedefs.h',
+ 'wtf/gtk/MainThreadGtk.cpp',
+ 'wtf/gtk/ThreadingGtk.cpp',
+ 'wtf/haiku/MainThreadHaiku.cpp',
+ 'wtf/haiku/StringHaiku.cpp',
+ 'wtf/mac/MainThreadMac.mm',
+ 'wtf/qt/MainThreadQt.cpp',
+ 'wtf/qt/StringQt.cpp',
+ 'wtf/qt/ThreadingQt.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/UnicodeMacrosFromICU.h',
+ 'wtf/unicode/brew/UnicodeBrew.cpp',
+ 'wtf/unicode/brew/UnicodeBrew.h',
+ 'wtf/unicode/glib/UnicodeGLib.cpp',
+ 'wtf/unicode/glib/UnicodeGLib.h',
+ 'wtf/unicode/icu/CollatorICU.cpp',
+ 'wtf/unicode/qt4/UnicodeQt4.h',
+ 'wtf/unicode/wince/UnicodeWinCE.cpp',
+ 'wtf/unicode/wince/UnicodeWinCE.h',
+ 'wtf/url/api/ParsedURL.cpp',
+ 'wtf/url/api/ParsedURL.h',
+ 'wtf/url/api/URLString.h',
+ 'wtf/url/src/RawURLBuffer.h',
+ 'wtf/url/src/URLBuffer.h',
+ 'wtf/url/src/URLCharacterTypes.cpp',
+ 'wtf/url/src/URLCharacterTypes.h',
+ 'wtf/url/src/URLComponent.h',
+ 'wtf/url/src/URLEscape.cpp',
+ 'wtf/url/src/URLEscape.h',
+ 'wtf/url/src/URLParser.h',
+ 'wtf/url/src/URLQueryCanonicalizer.h',
+ 'wtf/url/src/URLSegments.cpp',
+ 'wtf/url/src/URLSegments.h',
+ 'wtf/win/MainThreadWin.cpp',
+ 'wtf/win/OwnPtrWin.cpp',
+ 'wtf/wince/FastMallocWinCE.h',
+ 'wtf/wince/MemoryManager.cpp',
+ 'wtf/wince/MemoryManager.h',
+ 'wtf/wx/MainThreadWx.cpp',
+ 'wtf/wx/StringWx.cpp',
+ 'yarr/YarrInterpreter.cpp',
+ 'yarr/YarrJIT.cpp',
+ 'yarr/YarrJIT.h',
+ 'yarr/YarrParser.h',
+ 'yarr/YarrPattern.cpp',
+ 'yarr/YarrSyntaxChecker.cpp',
+ 'yarr/YarrSyntaxChecker.h',
+ ],
+ 'javascriptcore_derived_source_files': [
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ArrayPrototype.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/DatePrototype.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/HeaderDetection.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/JSONObject.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/Lexer.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/MathObject.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/NumberConstructor.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpConstructor.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpJitTables.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpObject.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/StringPrototype.lut.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/TracingDtrace.h',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ObjectConstructor.lut.h',
+ ],
+ 'minidom_files': [
+ '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',
+ ],
+ 'minidom_support_files': [
+ 'API/tests/minidom.js',
+ ],
+ 'testapi_files': [
+ 'API/tests/testapi.c',
+ ],
+ 'testapi_support_files': [
+ 'API/tests/testapi.js',
+ ],
+ 'jsc_files': [
+ 'jsc.cpp',
+ ],
+ }
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.order b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.order
new file mode 100644
index 0000000..b82958e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.order
@@ -0,0 +1,2130 @@
+__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
+__ZL30calculateCompiledPatternLengthPKti24JSRegExpIgnoreCaseOptionR11CompileDataR9ErrorCode
+__ZL11checkEscapePPKtS0_P9ErrorCodeib
+__ZL13compileBranchiPiPPhPPKtS3_P9ErrorCodeS_S_R11CompileData
+__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
+__ZN3WTF10StringImpl23defaultWritingDirectionEPb
+__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
+__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
+__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
+__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/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pri
new file mode 100644
index 0000000..f6d064f
--- /dev/null
+++ b/src/3rdparty/webkit/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 = $$OUTPUT_DIR/JavaScriptCore/generated
+}
+
+JAVASCRIPTCORE_INCLUDEPATH = \
+ $$PWD \
+ $$PWD/.. \
+ $$PWD/../ThirdParty \
+ $$PWD/assembler \
+ $$PWD/bytecode \
+ $$PWD/bytecompiler \
+ $$PWD/heap \
+ $$PWD/dfg \
+ $$PWD/debugger \
+ $$PWD/interpreter \
+ $$PWD/jit \
+ $$PWD/parser \
+ $$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
+ 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(prependJavaScriptCoreLib) {
+ # Argument is the relative path to JavaScriptCore.pro's qmake output
+ pathToJavaScriptCoreOutput = $$ARGS/$$JAVASCRIPTCORE_DESTDIR
+
+ win32-msvc*|wince* {
+ LIBS = -l$$JAVASCRIPTCORE_TARGET $$LIBS
+ LIBS = -L$$pathToJavaScriptCoreOutput $$LIBS
+ POST_TARGETDEPS += $${pathToJavaScriptCoreOutput}$${QMAKE_DIR_SEP}$${JAVASCRIPTCORE_TARGET}.lib
+ } else:symbian {
+ LIBS = -l$${JAVASCRIPTCORE_TARGET}.lib $$LIBS
+ # 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 $$LIBS
+ 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
+ CONFIG -= staticlib
+
+ export(QMAKE_LIBDIR)
+ export(LIBS)
+ export(POST_TARGETDEPS)
+ export(CONFIG)
+
+ return(true)
+}
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pro
new file mode 100644
index 0000000..a109179
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pro
@@ -0,0 +1,237 @@
+# 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
+
+# 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
+}
+
+*-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(yarr/yarr.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 \
+ assembler/MacroAssemblerSH4.h \
+ assembler/MacroAssemblerSH4.cpp \
+ assembler/SH4Assembler.h \
+ bytecode/CodeBlock.cpp \
+ bytecode/JumpTable.cpp \
+ bytecode/Opcode.cpp \
+ bytecode/SamplingTool.cpp \
+ bytecode/StructureStubInfo.cpp \
+ bytecompiler/BytecodeGenerator.cpp \
+ bytecompiler/NodesCodegen.cpp \
+ heap/ConservativeRoots.cpp \
+ heap/HandleHeap.cpp \
+ heap/HandleStack.cpp \
+ heap/Heap.cpp \
+ heap/MachineStackMarker.cpp \
+ heap/MarkStack.cpp \
+ heap/MarkStackPosix.cpp \
+ heap/MarkStackSymbian.cpp \
+ heap/MarkStackWin.cpp \
+ heap/MarkedBlock.cpp \
+ heap/MarkedSpace.cpp \
+ debugger/DebuggerActivation.cpp \
+ debugger/DebuggerCallFrame.cpp \
+ debugger/Debugger.cpp \
+ dfg/DFGByteCodeParser.cpp \
+ dfg/DFGGraph.cpp \
+ dfg/DFGJITCodeGenerator.cpp \
+ dfg/DFGJITCompiler.cpp \
+ dfg/DFGNonSpeculativeJIT.cpp \
+ dfg/DFGOperations.cpp \
+ dfg/DFGSpeculativeJIT.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 \
+ parser/SourceProviderCache.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/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/GetterSetter.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/JSLock.cpp \
+ runtime/JSNotAnObject.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/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/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/StringRecursionChecker.cpp \
+ runtime/StructureChain.cpp \
+ runtime/Structure.cpp \
+ runtime/TimeoutChecker.cpp \
+ runtime/UString.cpp \
+ yarr/YarrJIT.cpp \
+
+*sh4* {
+ QMAKE_CXXFLAGS += -mieee -w
+ QMAKE_CFLAGS += -mieee -w
+}
+
+# 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
+}
+
+lessThan(QT_GCC_MAJOR_VERSION, 5) {
+ # GCC 4.5 and before
+ lessThan(QT_GCC_MINOR_VERSION, 6) {
+ # 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
+ }
+
+ # GCC 4.6 and after.
+ greaterThan(QT_GCC_MINOR_VERSION, 5) {
+ if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x)) {
+ # We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr).
+ QMAKE_CFLAGS_WARN_ON += -Wno-c++0x-compat
+ QMAKE_CXXFLAGS_WARN_ON += -Wno-c++0x-compat
+ QMAKE_CFLAGS += -Wno-c++0x-compat
+ QMAKE_CXXFLAGS += -Wno-c++0x-compat
+ }
+ }
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCorePrefix.h b/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCorePrefix.h
new file mode 100644
index 0000000..21d6204
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/THANKS b/src/3rdparty/webkit/Source/JavaScriptCore/THANKS
index b9a9649..b9a9649 100644
--- a/src/3rdparty/webkit/JavaScriptCore/THANKS
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/THANKS
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMAssembler.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMAssembler.cpp
new file mode 100644
index 0000000..d7f556b
--- /dev/null
+++ b/src/3rdparty/webkit/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.isAligned(8))
+ 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->m_offset) & (~0x1);
+ ARMWord* ldrAddr = reinterpret_cast_ptr<ARMWord*>(data + pos);
+ ARMWord* addr = getLdrImmAddress(ldrAddr);
+ if (*addr != InvalidBranchTarget) {
+ if (!(iter->m_offset & 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMAssembler.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMAssembler.h
new file mode 100644
index 0000000..be3a9da
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMAssembler.h
@@ -0,0 +1,891 @@
+/*
+ * 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<AssemblerLabel, 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;
+
+ // 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
+ }
+
+ AssemblerLabel 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 m_buffer.label();
+ }
+
+ 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
+
+ size_t codeSize() const
+ {
+ return m_buffer.codeSize();
+ }
+
+ void ensureSpace(int insnSpace, int constSpace)
+ {
+ m_buffer.ensureSpace(insnSpace, constSpace);
+ }
+
+ int sizeOfConstantPool()
+ {
+ return m_buffer.sizeOfConstantPool();
+ }
+
+ AssemblerLabel label()
+ {
+ m_buffer.ensureSpaceForAnyOneInstruction();
+ return m_buffer.label();
+ }
+
+ AssemblerLabel align(int alignment)
+ {
+ while (!m_buffer.isAligned(alignment))
+ mov_r(ARMRegisters::r0, ARMRegisters::r0);
+
+ return label();
+ }
+
+ AssemblerLabel loadBranchTarget(int rd, Condition cc = AL, int useConstantPool = 0)
+ {
+ ensureSpace(sizeof(ARMWord), sizeof(ARMWord));
+ m_jumps.append(m_buffer.codeSize() | (useConstantPool & 0x1));
+ ldr_un_imm(rd, InvalidBranchTarget, cc);
+ return m_buffer.label();
+ }
+
+ AssemblerLabel jmp(Condition cc = AL, int useConstantPool = 0)
+ {
+ return loadBranchTarget(ARMRegisters::pc, cc, useConstantPool);
+ }
+
+ void* executableCopy(ExecutablePool* allocator);
+
+#ifndef NDEBUG
+ unsigned debugOffset() { return m_buffer.debugOffset(); }
+#endif
+
+ // 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, AssemblerLabel 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);
+ }
+
+ // Linkers
+ static intptr_t getAbsoluteJumpAddress(void* base, int offset = 0)
+ {
+ return reinterpret_cast<intptr_t>(base) + offset - sizeof(ARMWord);
+ }
+
+ void linkJump(AssemblerLabel from, AssemblerLabel 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, AssemblerLabel 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, AssemblerLabel 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, AssemblerLabel label)
+ {
+ return reinterpret_cast<void*>(reinterpret_cast<char*>(code) + label.m_offset);
+ }
+
+ // Address differences
+
+ static int getDifferenceBetweenLabels(AssemblerLabel a, AssemblerLabel b)
+ {
+ return b.m_offset - a.m_offset;
+ }
+
+ static unsigned getCallReturnOffset(AssemblerLabel 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMv7Assembler.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMv7Assembler.cpp
new file mode 100644
index 0000000..7aa1f10
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMv7Assembler.h
new file mode 100644
index 0000000..8c9053c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/ARMv7Assembler.h
@@ -0,0 +1,2222 @@
+/*
+ * 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;
+};
+
+typedef enum {
+ SRType_LSL,
+ SRType_LSR,
+ SRType_ASR,
+ SRType_ROR,
+
+ SRType_RRX = SRType_ROR
+} ARMShiftType;
+
+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;
+ };
+
+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.
+ AssemblerLabel b()
+ {
+ m_formatter.twoWordOp16Op16(OP_B_T4a, OP_B_T4b);
+ return m_formatter.label();
+ }
+
+ // Only allowed in IT (if then) block if last instruction.
+ AssemblerLabel blx(RegisterID rm)
+ {
+ ASSERT(rm != ARMRegisters::pc);
+ m_formatter.oneWordOp8RegReg143(OP_BLX, rm, (RegisterID)8);
+ return m_formatter.label();
+ }
+
+ // Only allowed in IT (if then) block if last instruction.
+ AssemblerLabel bx(RegisterID rm)
+ {
+ m_formatter.oneWordOp8RegReg143(OP_BX, rm, (RegisterID)0);
+ return m_formatter.label();
+ }
+
+ 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);
+ }
+
+ AssemblerLabel label()
+ {
+ return m_formatter.label();
+ }
+
+ AssemblerLabel align(int alignment)
+ {
+ while (!m_formatter.isAligned(alignment))
+ bkpt();
+
+ return label();
+ }
+
+ static void* getRelocatedAddress(void* code, AssemblerLabel label)
+ {
+ ASSERT(label.isSet());
+ return reinterpret_cast<void*>(reinterpret_cast<ptrdiff_t>(code) + label.m_offset);
+ }
+
+ static int getDifferenceBetweenLabels(AssemblerLabel a, AssemblerLabel b)
+ {
+ return b.m_offset - a.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:
+
+ 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(); }
+ size_t codeSize() const { return m_formatter.codeSize(); }
+
+ static unsigned getCallReturnOffset(AssemblerLabel call)
+ {
+ ASSERT(call.isSet());
+ 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(AssemblerLabel from, AssemblerLabel to, JumpType type, Condition condition)
+ {
+ ASSERT(to.isSet());
+ ASSERT(from.isSet());
+ m_jumpsToLink.append(LinkRecord(from.m_offset, to.m_offset, type, condition));
+ }
+
+ static void linkJump(void* code, AssemblerLabel from, void* to)
+ {
+ ASSERT(from.isSet());
+
+ uint16_t* location = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(code) + from.m_offset);
+ linkJumpAbsolute(location, to);
+ }
+
+ static void linkCall(void* code, AssemblerLabel from, void* to)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(code) & 1));
+ ASSERT(from.isSet());
+ 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, AssemblerLabel 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);
+ }
+
+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 codeSize() const { return m_buffer.codeSize(); }
+ AssemblerLabel label() const { return m_buffer.label(); }
+ bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); }
+ void* data() const { return m_buffer.data(); }
+
+#ifndef NDEBUG
+ unsigned debugOffset() { return m_buffer.debugOffset(); }
+#endif
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
new file mode 100644
index 0000000..cda1264
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
@@ -0,0 +1,582 @@
+/*
+ * 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;
+
+ // 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(const void* ptr)
+ : m_ptr(ptr)
+ {
+ }
+
+ const void* m_ptr;
+ };
+
+ // TrustedImmPtr:
+ //
+ // 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 TrustedImmPtr {
+ explicit TrustedImmPtr(const void* value)
+ : m_value(value)
+ {
+ }
+
+ intptr_t asIntptr()
+ {
+ return reinterpret_cast<intptr_t>(m_value);
+ }
+
+ const void* m_value;
+ };
+
+ struct ImmPtr : public TrustedImmPtr {
+ explicit ImmPtr(const void* value)
+ : TrustedImmPtr(value)
+ {
+ }
+ };
+
+ // TrustedImm32:
+ //
+ // 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 TrustedImm32 {
+ explicit TrustedImm32(int32_t value)
+ : m_value(value)
+#if CPU(ARM) || CPU(MIPS)
+ , m_isPointer(false)
+#endif
+ {
+ }
+
+#if !CPU(X86_64)
+ explicit TrustedImm32(TrustedImmPtr 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
+ };
+
+
+ struct Imm32 : public TrustedImm32 {
+ explicit Imm32(int32_t value)
+ : TrustedImm32(value)
+ {
+ }
+#if !CPU(X86_64)
+ explicit Imm32(TrustedImmPtr ptr)
+ : TrustedImm32(ptr)
+ {
+ }
+#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 isSet() const { return m_label.isSet(); }
+ private:
+ AssemblerLabel 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:
+ AssemblerLabel 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:
+ AssemblerLabel 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(AssemblerLabel 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);
+ }
+
+ AssemblerLabel 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()
+ {
+ }
+
+#if CPU(ARM_THUMB2)
+ // Fixme: this information should be stored in the instruction stream, not in the Jump object.
+ Jump(AssemblerLabel jmp, ARMv7Assembler::JumpType type, ARMv7Assembler::Condition condition = ARMv7Assembler::ConditionInvalid)
+ : m_jmp(jmp)
+ , m_type(type)
+ , m_condition(condition)
+ {
+ }
+#else
+ Jump(AssemblerLabel jmp)
+ : m_jmp(jmp)
+ {
+ }
+#endif
+
+ void link(AbstractMacroAssembler<AssemblerType>* masm) const
+ {
+#if CPU(ARM_THUMB2)
+ masm->m_assembler.linkJump(m_jmp, masm->m_assembler.label(), m_type, m_condition);
+#else
+ masm->m_assembler.linkJump(m_jmp, masm->m_assembler.label());
+#endif
+ }
+
+ void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm) const
+ {
+#if CPU(ARM_THUMB2)
+ masm->m_assembler.linkJump(m_jmp, label.m_label, m_type, m_condition);
+#else
+ masm->m_assembler.linkJump(m_jmp, label.m_label);
+#endif
+ }
+
+ bool isSet() const { return m_jmp.isSet(); }
+
+ private:
+ AssemblerLabel m_jmp;
+#if CPU(ARM_THUMB2)
+ ARMv7Assembler::JumpType m_type;
+ ARMv7Assembler::Condition m_condition;
+#endif
+ };
+
+ // 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
+ 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);
+ }
+
+ // Temporary interface; likely to be removed, since may be hard to port to all architectures.
+#if CPU(X86) || CPU(X86_64)
+ void rewindToLabel(Label rewindTo) { m_assembler.rewindToLabel(rewindTo.m_label); }
+#endif
+
+ void beginUninterruptedSequence() { }
+ void endUninterruptedSequence() { }
+
+#ifndef NDEBUG
+ unsigned debugOffset() { return m_assembler.debugOffset(); }
+#endif
+
+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, AssemblerLabel label, void* value)
+ {
+ AssemblerType::linkPointer(code, label, value);
+ }
+
+ static void* getLinkerAddress(void* code, AssemblerLabel 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);
+ }
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // AbstractMacroAssembler_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBuffer.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBuffer.h
new file mode 100644
index 0000000..5acc51d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBuffer.h
@@ -0,0 +1,184 @@
+/*
+ * 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 {
+
+ struct AssemblerLabel {
+ AssemblerLabel()
+ : m_offset(std::numeric_limits<uint32_t>::max())
+ {
+ }
+
+ explicit AssemblerLabel(uint32_t offset)
+ : m_offset(offset)
+ {
+ }
+
+ bool isSet() const { return (m_offset != std::numeric_limits<uint32_t>::max()); }
+
+ AssemblerLabel labelAtOffset(int offset) const
+ {
+ return AssemblerLabel(m_offset + offset);
+ }
+
+ uint32_t m_offset;
+ };
+
+ class AssemblerBuffer {
+ static const int inlineCapacity = 128;
+ public:
+ AssemblerBuffer()
+ : m_storage(inlineCapacity)
+ , m_buffer(m_storage.begin())
+ , m_capacity(inlineCapacity)
+ , m_index(0)
+ {
+ }
+
+ ~AssemblerBuffer()
+ {
+ }
+
+ bool isAvailable(int space)
+ {
+ return m_index + space <= m_capacity;
+ }
+
+ void ensureSpace(int space)
+ {
+ if (!isAvailable(space))
+ grow();
+ }
+
+ bool isAligned(int alignment) const
+ {
+ return !(m_index & (alignment - 1));
+ }
+
+ template<typename IntegralType>
+ void putIntegral(IntegralType value)
+ {
+ ensureSpace(sizeof(IntegralType));
+ putIntegralUnchecked(value);
+ }
+
+ template<typename IntegralType>
+ void putIntegralUnchecked(IntegralType value)
+ {
+ ASSERT(isAvailable(sizeof(IntegralType)));
+ *reinterpret_cast_ptr<IntegralType*>(m_buffer + m_index) = value;
+ m_index += sizeof(IntegralType);
+ }
+
+ void putByteUnchecked(int8_t value) { putIntegralUnchecked(value); }
+ void putByte(int8_t value) { putIntegral(value); }
+ void putShortUnchecked(int16_t value) { putIntegralUnchecked(value); }
+ void putShort(int16_t value) { putIntegral(value); }
+ void putIntUnchecked(int32_t value) { putIntegralUnchecked(value); }
+ void putInt(int32_t value) { putIntegral(value); }
+ void putInt64Unchecked(int64_t value) { putIntegralUnchecked(value); }
+ void putInt64(int64_t value) { putIntegral(value); }
+
+ void* data() const
+ {
+ return m_buffer;
+ }
+
+ size_t codeSize() const
+ {
+ return m_index;
+ }
+
+ AssemblerLabel label() const
+ {
+ return AssemblerLabel(m_index);
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ if (!m_index)
+ return 0;
+
+ void* result = allocator->alloc(m_index);
+
+ if (!result)
+ return 0;
+
+ ExecutableAllocator::makeWritable(result, m_index);
+
+ return memcpy(result, m_buffer, m_index);
+ }
+
+ void rewindToLabel(AssemblerLabel label)
+ {
+ m_index = label.m_offset;
+ }
+
+#ifndef NDEBUG
+ unsigned debugOffset() { return m_index; }
+#endif
+
+ protected:
+ void append(const char* data, int size)
+ {
+ if (!isAvailable(size))
+ grow(size);
+
+ memcpy(m_buffer + m_index, data, size);
+ m_index += size;
+ }
+
+ void grow(int extraCapacity = 0)
+ {
+ m_capacity += m_capacity / 2 + extraCapacity;
+
+ m_storage.grow(m_capacity);
+ m_buffer = m_storage.begin();
+ }
+
+ private:
+ Vector<char, inlineCapacity> m_storage;
+ char* m_buffer;
+ int m_capacity;
+ int m_index;
+ };
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // AssemblerBuffer_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
new file mode 100644
index 0000000..2932d69
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
@@ -0,0 +1,342 @@
+/*
+ * 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;
+ using AssemblerBuffer::putIntegral;
+ using AssemblerBuffer::putIntegralUnchecked;
+public:
+ typedef struct {
+ short high;
+ short low;
+ } TwoShorts;
+
+ 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);
+ }
+
+ void ensureSpaceForAnyOneInstruction()
+ {
+ flushIfNoSpaceFor(maxInstructionSize, sizeof(uint64_t));
+ }
+
+ 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);
+ }
+
+ void putIntegral(TwoShorts value)
+ {
+ putIntegral(value.high);
+ putIntegral(value.low);
+ }
+
+ void putIntegralUnchecked(TwoShorts value)
+ {
+ putIntegralUnchecked(value.high);
+ putIntegralUnchecked(value.low);
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ flushConstantPool(false);
+ return AssemblerBuffer::executableCopy(allocator);
+ }
+
+ void putShortWithConstantInt(uint16_t insn, uint32_t constant, bool isReusable = false)
+ {
+ putIntegralWithConstantInt(insn, constant, isReusable);
+ }
+
+ void putIntWithConstantInt(uint32_t insn, uint32_t constant, bool isReusable = false)
+ {
+ putIntegralWithConstantInt(insn, constant, isReusable);
+ }
+
+ // 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;
+ }
+
+ template<typename IntegralType>
+ void putIntegralWithConstantInt(IntegralType insn, uint32_t constant, bool isReusable)
+ {
+ if (!m_numConsts)
+ m_maxDistance = maxPoolSize;
+ flushIfNoSpaceFor(sizeof(IntegralType), 4);
+
+ m_loadOffsets.append(codeSize());
+ if (isReusable) {
+ for (int i = 0; i < m_numConsts; ++i) {
+ if (m_mask[i] == ReusableConst && m_pool[i] == constant) {
+ putIntegral(static_cast<IntegralType>(AssemblerType::patchConstantPoolLoad(insn, i)));
+ correctDeltas(sizeof(IntegralType));
+ return;
+ }
+ }
+ }
+
+ m_pool[m_numConsts] = constant;
+ m_mask[m_numConsts] = static_cast<char>(isReusable ? ReusableConst : UniqueConst);
+
+ putIntegral(static_cast<IntegralType>(AssemblerType::patchConstantPoolLoad(insn, m_numConsts)));
+ ++m_numConsts;
+
+ correctDeltas(sizeof(IntegralType), 4);
+ }
+
+ void flushConstantPool(bool useBarrier = true)
+ {
+ if (m_numConsts == 0)
+ return;
+ int alignPool = (codeSize() + (useBarrier ? barrierSize : 0)) & (sizeof(uint64_t) - 1);
+
+ if (alignPool)
+ alignPool = sizeof(uint64_t) - alignPool;
+
+ // Callback to protect the constant pool from execution
+ if (useBarrier)
+ putIntegral(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 = codeSize();
+ 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<char*>(data()) + *iter;
+ AssemblerType::patchConstantPoolLoad(loadAddr, reinterpret_cast<char*>(data()) + 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/CodeLocation.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/CodeLocation.h
new file mode 100644
index 0000000..e29029b
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/LinkBuffer.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/LinkBuffer.h
new file mode 100644
index 0000000..bc893d6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/LinkBuffer.h
@@ -0,0 +1,360 @@
+/*
+ * 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 {
+ WTF_MAKE_NONCOPYABLE(LinkBuffer);
+ 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;
+#if ENABLE(BRANCH_COMPACTION)
+ typedef MacroAssembler::LinkRecord LinkRecord;
+ typedef MacroAssembler::JumpLinkType JumpLinkType;
+#endif
+
+public:
+ LinkBuffer(MacroAssembler* masm, PassRefPtr<ExecutablePool> executablePool)
+ : m_executablePool(executablePool)
+ , m_size(0)
+ , m_code(0)
+ , m_assembler(masm)
+#ifndef NDEBUG
+ , m_completed(false)
+#endif
+ {
+ linkCode();
+ }
+
+ LinkBuffer(MacroAssembler* masm, ExecutableAllocator& allocator)
+ : m_executablePool(allocator.poolForSize(masm->m_assembler.codeSize()))
+ , m_size(0)
+ , m_code(0)
+ , m_assembler(masm)
+#ifndef NDEBUG
+ , m_completed(false)
+#endif
+ {
+ linkCode();
+ }
+
+ ~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)
+ {
+ AssemblerLabel target = applyOffset(label.m_label);
+ MacroAssembler::linkPointer(code(), target, value);
+ }
+
+ void patch(DataLabelPtr label, CodeLocationLabel value)
+ {
+ AssemblerLabel 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)));
+ }
+
+#ifndef NDEBUG
+ void* debugAddress()
+ {
+ return m_code;
+ }
+#endif
+
+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()
+ {
+ ASSERT(!m_code);
+#if !ENABLE(BRANCH_COMPACTION)
+ m_code = m_assembler->m_assembler.executableCopy(m_executablePool.get());
+ m_size = m_assembler->m_assembler.codeSize();
+ ASSERT(m_code);
+#else
+ size_t initialSize = m_assembler->m_assembler.codeSize();
+ m_code = (uint8_t*)m_executablePool->alloc(initialSize);
+ if (!m_code)
+ return;
+ ExecutableAllocator::makeWritable(m_code, initialSize);
+ uint8_t* inData = (uint8_t*)m_assembler->unlinkedCode();
+ uint8_t* outData = reinterpret_cast<uint8_t*>(m_code);
+ 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 = outData + jumpsToLink[i].to() - offset; // Compensate for what we have collapsed so far
+ else
+ target = outData + jumpsToLink[i].to() - m_assembler->executableOffsetFor(jumpsToLink[i].to());
+
+ JumpLinkType jumpLinkType = m_assembler->computeJumpType(jumpsToLink[i], outData + 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, initialSize - readPtr);
+ m_assembler->recordLinkOffsets(readPtr, initialSize, readPtr - writePtr);
+
+ 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 + initialSize - 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MIPSAssembler.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MIPSAssembler.h
new file mode 100644
index 0000000..166018f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MIPSAssembler.h
@@ -0,0 +1,912 @@
+/*
+ * 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<AssemblerLabel, 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
+ };
+
+ 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);
+ }
+
+ void appendJump()
+ {
+ m_jumps.append(m_buffer.label());
+ }
+
+ 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
+
+ AssemblerLabel label()
+ {
+ return m_buffer.label();
+ }
+
+ AssemblerLabel align(int alignment)
+ {
+ while (!m_buffer.isAligned(alignment))
+ bkpt();
+
+ return label();
+ }
+
+ static void* getRelocatedAddress(void* code, AssemblerLabel label)
+ {
+ return reinterpret_cast<void*>(reinterpret_cast<char*>(code) + label.m_offset);
+ }
+
+ static int getDifferenceBetweenLabels(AssemblerLabel a, AssemblerLabel b)
+ {
+ return b.m_offset - a.m_offset;
+ }
+
+ // Assembler admin methods:
+
+ size_t codeSize() const
+ {
+ return m_buffer.codeSize();
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ void *result = m_buffer.executableCopy(allocator);
+ if (!result)
+ return 0;
+
+ relocateJumps(m_buffer.data(), result);
+ return result;
+ }
+
+#ifndef NDEBUG
+ unsigned debugOffset() { return m_buffer.debugOffset(); }
+#endif
+
+ static unsigned getCallReturnOffset(AssemblerLabel 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(AssemblerLabel from, AssemblerLabel to)
+ {
+ ASSERT(to.isSet());
+ ASSERT(from.isSet());
+ 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, AssemblerLabel from, void* to)
+ {
+ ASSERT(from.isSet());
+ 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, AssemblerLabel from, void* to)
+ {
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(reinterpret_cast<intptr_t>(code) + from.m_offset);
+ linkCallInternal(insn, to);
+ }
+
+ static void linkPointer(void* code, AssemblerLabel 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));
+ }
+
+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->m_offset;
+ 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.codeSize() - 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssembler.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssembler.h
new file mode 100644
index 0000000..b94bd0d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssembler.h
@@ -0,0 +1,353 @@
+/*
+ * 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; };
+
+#elif CPU(SH4)
+#include "MacroAssemblerSH4.h"
+namespace JSC {
+typedef MacroAssemblerSH4 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(TrustedImm32(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(TrustedImm32 value, int index = 0)
+ {
+ store32(value, Address(stackPointerRegister, (index * sizeof(void*))));
+ }
+
+ void poke(TrustedImmPtr 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(RelationalCondition cond, RegisterID op1, TrustedImmPtr imm, Label target)
+ {
+ branchPtr(cond, op1, imm).linkTo(target, this);
+ }
+
+ void branch32(RelationalCondition cond, RegisterID op1, RegisterID op2, Label target)
+ {
+ branch32(cond, op1, op2).linkTo(target, this);
+ }
+
+ void branch32(RelationalCondition cond, RegisterID op1, TrustedImm32 imm, Label target)
+ {
+ branch32(cond, op1, imm).linkTo(target, this);
+ }
+
+ void branch32(RelationalCondition cond, RegisterID left, Address right, Label target)
+ {
+ branch32(cond, left, right).linkTo(target, this);
+ }
+
+ void branch16(RelationalCondition cond, BaseIndex left, RegisterID right, Label target)
+ {
+ branch16(cond, left, right).linkTo(target, this);
+ }
+
+ void branchTestPtr(ResultCondition 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(TrustedImm32 imm, RegisterID srcDest)
+ {
+ add32(imm, srcDest);
+ }
+
+ void addPtr(TrustedImmPtr imm, RegisterID dest)
+ {
+ add32(TrustedImm32(imm), dest);
+ }
+
+ void addPtr(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ add32(imm, src, dest);
+ }
+
+ void andPtr(RegisterID src, RegisterID dest)
+ {
+ and32(src, dest);
+ }
+
+ void andPtr(TrustedImm32 imm, RegisterID srcDest)
+ {
+ and32(imm, srcDest);
+ }
+
+ void orPtr(RegisterID src, RegisterID dest)
+ {
+ or32(src, dest);
+ }
+
+ void orPtr(TrustedImmPtr imm, RegisterID dest)
+ {
+ or32(TrustedImm32(imm), dest);
+ }
+
+ void orPtr(TrustedImm32 imm, RegisterID dest)
+ {
+ or32(imm, dest);
+ }
+
+ void subPtr(RegisterID src, RegisterID dest)
+ {
+ sub32(src, dest);
+ }
+
+ void subPtr(TrustedImm32 imm, RegisterID dest)
+ {
+ sub32(imm, dest);
+ }
+
+ void subPtr(TrustedImmPtr imm, RegisterID dest)
+ {
+ sub32(TrustedImm32(imm), dest);
+ }
+
+ void xorPtr(RegisterID src, RegisterID dest)
+ {
+ xor32(src, dest);
+ }
+
+ void xorPtr(TrustedImm32 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 comparePtr(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest)
+ {
+ compare32(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(TrustedImmPtr imm, ImplicitAddress address)
+ {
+ store32(TrustedImm32(imm), address);
+ }
+
+ void storePtr(TrustedImmPtr imm, void* address)
+ {
+ store32(TrustedImm32(imm), address);
+ }
+
+ DataLabel32 storePtrWithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ return store32WithAddressOffsetPatch(src, address);
+ }
+
+
+ Jump branchPtr(RelationalCondition cond, RegisterID left, RegisterID right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(RelationalCondition cond, RegisterID left, TrustedImmPtr right)
+ {
+ return branch32(cond, left, TrustedImm32(right));
+ }
+
+ Jump branchPtr(RelationalCondition cond, RegisterID left, Address right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(RelationalCondition cond, Address left, RegisterID right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(RelationalCondition cond, AbsoluteAddress left, RegisterID right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(RelationalCondition cond, Address left, TrustedImmPtr right)
+ {
+ return branch32(cond, left, TrustedImm32(right));
+ }
+
+ Jump branchPtr(RelationalCondition cond, AbsoluteAddress left, TrustedImmPtr right)
+ {
+ return branch32(cond, left, TrustedImm32(right));
+ }
+
+ Jump branchTestPtr(ResultCondition cond, RegisterID reg, RegisterID mask)
+ {
+ return branchTest32(cond, reg, mask);
+ }
+
+ Jump branchTestPtr(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ return branchTest32(cond, reg, mask);
+ }
+
+ Jump branchTestPtr(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ return branchTest32(cond, address, mask);
+ }
+
+ Jump branchTestPtr(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ return branchTest32(cond, address, mask);
+ }
+
+
+ Jump branchAddPtr(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ return branchAdd32(cond, src, dest);
+ }
+
+ Jump branchSubPtr(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ return branchSub32(cond, imm, dest);
+ }
+ using MacroAssemblerBase::branchTest8;
+ Jump branchTest8(ResultCondition cond, ExtendedAddress address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ return MacroAssemblerBase::branchTest8(cond, Address(address.base, address.offset), mask);
+ }
+#endif
+
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssembler_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
new file mode 100644
index 0000000..2db5df1
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
new file mode 100644
index 0000000..9e27cd0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
@@ -0,0 +1,1031 @@
+/*
+ * 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 RelationalCondition {
+ 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
+ };
+
+ enum ResultCondition {
+ 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(TrustedImm32 imm, Address address)
+ {
+ load32(address, ARMRegisters::S1);
+ add32(imm, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
+ }
+
+ void add32(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.subs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
+ }
+
+ void sub32(TrustedImm32 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(TrustedImm32 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;
+ }
+
+ 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 imm)
+ {
+ move(imm, ARMRegisters::S0);
+ push(ARMRegisters::S0);
+ }
+
+ void move(TrustedImm32 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(TrustedImmPtr imm, RegisterID dest)
+ {
+ move(TrustedImm32(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(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ load8(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, RegisterID right, int useConstantPool = 0)
+ {
+ m_assembler.cmp_r(left, right);
+ return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 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(RelationalCondition cond, RegisterID left, Address right)
+ {
+ load32(right, ARMRegisters::S1);
+ return branch32(cond, left, ARMRegisters::S1);
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, RegisterID right)
+ {
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32WithUnalignedHalfWords(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ load32WithUnalignedHalfWords(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch16(RelationalCondition cond, BaseIndex left, RegisterID right)
+ {
+ UNUSED_PARAM(cond);
+ UNUSED_PARAM(left);
+ UNUSED_PARAM(right);
+ ASSERT_NOT_REACHED();
+ return jump();
+ }
+
+ Jump branch16(RelationalCondition cond, BaseIndex left, TrustedImm32 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(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ load8(address, ARMRegisters::S1);
+ return branchTest32(cond, ARMRegisters::S1, mask);
+ }
+
+ Jump branchTest32(ResultCondition 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(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-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(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ load32(address, ARMRegisters::S1);
+ return branchTest32(cond, ARMRegisters::S1, mask);
+ }
+
+ Jump branchTest32(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-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(ResultCondition 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(ResultCondition cond, TrustedImm32 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(ResultCondition 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(ResultCondition cond, TrustedImm32 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(ResultCondition 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(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ sub32(imm, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchNeg32(ResultCondition cond, RegisterID srcDest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ neg32(srcDest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchOr32(ResultCondition 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 compare32(RelationalCondition 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 compare32(RelationalCondition cond, RegisterID left, TrustedImm32 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 test32(ResultCondition cond, RegisterID reg, TrustedImm32 mask, RegisterID dest)
+ {
+ if (mask.m_value == -1)
+ m_assembler.cmp_r(0, reg);
+ else
+ m_assembler.tst_r(reg, 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 test32(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest)
+ {
+ load32(address, ARMRegisters::S1);
+ test32(cond, ARMRegisters::S1, mask, dest);
+ }
+
+ void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest)
+ {
+ load8(address, ARMRegisters::S1);
+ test32(cond, ARMRegisters::S1, mask, dest);
+ }
+
+ void add32(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
+ }
+
+ void add32(TrustedImm32 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(TrustedImm32 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(const 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(RelationalCondition cond, AbsoluteAddress left, RegisterID right)
+ {
+ load32(left.m_ptr, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 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(TrustedImmPtr initialValue, RegisterID dest)
+ {
+ DataLabelPtr dataLabel(this);
+ m_assembler.ldr_un_imm(dest, reinterpret_cast<ARMWord>(initialValue.m_value));
+ return dataLabel;
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S1);
+ Jump jump = branch32(cond, left, ARMRegisters::S1, true);
+ return jump;
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ load32(left, ARMRegisters::S1);
+ dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S0);
+ Jump jump = branch32(cond, ARMRegisters::S0, ARMRegisters::S1, true);
+ return jump;
+ }
+
+ DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
+ {
+ DataLabelPtr dataLabel = moveWithPatch(initialValue, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
+ return dataLabel;
+ }
+
+ DataLabelPtr storePtrWithPatch(ImplicitAddress address)
+ {
+ return storePtrWithPatch(TrustedImmPtr(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(RelationalCondition cond)
+ {
+ return static_cast<ARMAssembler::Condition>(cond);
+ }
+
+ ARMAssembler::Condition ARMCondition(ResultCondition 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
new file mode 100644
index 0000000..c4cf38c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
@@ -0,0 +1,1351 @@
+/*
+ * 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 RelationalCondition {
+ 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
+ };
+
+ enum ResultCondition {
+ 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 TrustedImm32, 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(TrustedImm32 imm, RegisterID dest)
+ {
+ add32(imm, dest, dest);
+ }
+
+ void add32(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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 TrustedImm32. 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(const void* address, RegisterID dest)
+ {
+ move(TrustedImmPtr(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(TrustedImm32(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(TrustedImm32(address.offset), dataTempRegister);
+ m_assembler.ldrh(dest, address.base, dataTempRegister);
+ }
+ }
+
+ DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ DataLabel32 label = moveWithPatch(TrustedImm32(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(TrustedImm32 imm, ImplicitAddress address)
+ {
+ move(imm, dataTempRegister);
+ store32(dataTempRegister, setupArmAddress(address));
+ }
+
+ void store32(RegisterID src, const void* address)
+ {
+ move(TrustedImmPtr(address), addressTempRegister);
+ m_assembler.str(src, addressTempRegister, ARMThumbImmediate::makeUInt16(0));
+ }
+
+ void store32(TrustedImm32 imm, const 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(TrustedImm32(offset), base, addressTempRegister);
+ base = addressTempRegister;
+ offset = 0;
+ }
+
+ m_assembler.vldr(dest, base, offset);
+ }
+
+ void loadDouble(const void* address, FPRegisterID dest)
+ {
+ move(TrustedImmPtr(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(TrustedImm32(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 = jump();
+ 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 = jump();
+ 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(TrustedImm32 imm)
+ {
+ move(imm, dataTempRegister);
+ push(dataTempRegister);
+ }
+
+ // Register move operations:
+ //
+ // Move values in registers.
+
+ void move(TrustedImm32 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(TrustedImmPtr imm, RegisterID dest)
+ {
+ move(TrustedImm32(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, TrustedImm32(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, TrustedImm32 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(TrustedImm32(imm), dataTempRegister);
+ m_assembler.cmp(left, dataTempRegister);
+ }
+ }
+ }
+
+ void test32(RegisterID reg, TrustedImm32 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(RelationalCondition cond, RegisterID left, RegisterID right)
+ {
+ m_assembler.cmp(left, right);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 right)
+ {
+ compare32(left, right);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, Address right)
+ {
+ load32(right, dataTempRegister);
+ return branch32(cond, left, dataTempRegister);
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, RegisterID right)
+ {
+ load32(left, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32(left, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch32(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32(left, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch32WithUnalignedHalfWords(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32WithUnalignedHalfWords(left, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch32(RelationalCondition cond, AbsoluteAddress left, RegisterID right)
+ {
+ load32(left.m_ptr, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32(left.m_ptr, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch16(RelationalCondition 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(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load16(left, addressTempRegister);
+ m_assembler.lsl(addressTempRegister, addressTempRegister, 16);
+ return branch32(cond, addressTempRegister, TrustedImm32(right.m_value << 16));
+ }
+
+ Jump branch8(RelationalCondition cond, RegisterID left, TrustedImm32 right)
+ {
+ compare32(left, right);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ // use addressTempRegister incase the branch8 we call uses dataTempRegister. :-/
+ load8(left, addressTempRegister);
+ return branch8(cond, addressTempRegister, right);
+ }
+
+ Jump branchTest32(ResultCondition cond, RegisterID reg, RegisterID mask)
+ {
+ m_assembler.tst(reg, mask);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchTest32(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ test32(reg, mask);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchTest32(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ // use addressTempRegister incase the branchTest32 we call uses dataTempRegister. :-/
+ load32(address, addressTempRegister);
+ return branchTest32(cond, addressTempRegister, mask);
+ }
+
+ Jump branchTest32(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ // use addressTempRegister incase the branchTest32 we call uses dataTempRegister. :-/
+ load32(address, addressTempRegister);
+ return branchTest32(cond, addressTempRegister, mask);
+ }
+
+ Jump branchTest8(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ test32(reg, mask);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ // use addressTempRegister incase the branchTest8 we call uses dataTempRegister. :-/
+ load8(address, addressTempRegister);
+ return branchTest8(cond, addressTempRegister, mask);
+ }
+
+ void jump(RegisterID target)
+ {
+ m_assembler.bx(target);
+ }
+
+ // Address is a memory location containing the address to jump to
+ void jump(Address address)
+ {
+ load32(address, dataTempRegister);
+ m_assembler.bx(dataTempRegister);
+ }
+
+
+ // 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(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ m_assembler.add_S(dest, dest, src);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ 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(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest)
+ {
+ m_assembler.smull(dest, dataTempRegister, src1, src2);
+
+ if (cond == Overflow) {
+ m_assembler.asr(addressTempRegister, dest, 31);
+ return branch32(NotEqual, addressTempRegister, dataTempRegister);
+ }
+
+ return branchTest32(cond, dest);
+ }
+
+ Jump branchMul32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ return branchMul32(cond, src, dest, dest);
+ }
+
+ Jump branchMul32(ResultCondition cond, TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(imm, dataTempRegister);
+ return branchMul32(cond, dataTempRegister, src, dest);
+ }
+
+ Jump branchOr32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ m_assembler.orr_S(dest, dest, src);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchSub32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ m_assembler.sub_S(dest, dest, src);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchSub32(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ 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(TrustedImm32(0), dataTempRegister);
+ return Call(m_assembler.blx(dataTempRegister), Call::LinkableNear);
+ }
+
+ Call call()
+ {
+ moveFixedWidthEncoding(TrustedImm32(0), dataTempRegister);
+ return Call(m_assembler.blx(dataTempRegister), Call::Linkable);
+ }
+
+ Call call(RegisterID target)
+ {
+ return Call(m_assembler.blx(target), Call::None);
+ }
+
+ Call call(Address address)
+ {
+ load32(address, dataTempRegister);
+ return Call(m_assembler.blx(dataTempRegister), Call::None);
+ }
+
+ void ret()
+ {
+ m_assembler.bx(linkRegister);
+ }
+
+ void compare32(RelationalCondition 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 compare32(RelationalCondition cond, Address left, RegisterID right, RegisterID dest)
+ {
+ load32(left, dataTempRegister);
+ compare32(cond, dataTempRegister, right, dest);
+ }
+
+ void compare32(RelationalCondition cond, RegisterID left, TrustedImm32 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));
+ }
+
+ // 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 test32(ResultCondition cond, Address address, TrustedImm32 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 test8(ResultCondition cond, Address address, TrustedImm32 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(TrustedImm32 imm, RegisterID dst)
+ {
+ moveFixedWidthEncoding(imm, dst);
+ return DataLabel32(this);
+ }
+
+ DataLabelPtr moveWithPatch(TrustedImmPtr imm, RegisterID dst)
+ {
+ moveFixedWidthEncoding(TrustedImm32(imm), dst);
+ return DataLabelPtr(this);
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, dataTempRegister);
+ return branch32(cond, left, dataTempRegister);
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ load32(left, addressTempRegister);
+ dataLabel = moveWithPatch(initialRightValue, dataTempRegister);
+ return branch32(cond, addressTempRegister, dataTempRegister);
+ }
+
+ DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
+ {
+ DataLabelPtr label = moveWithPatch(initialValue, dataTempRegister);
+ store32(dataTempRegister, address);
+ return label;
+ }
+ DataLabelPtr storePtrWithPatch(ImplicitAddress address) { return storePtrWithPatch(TrustedImmPtr(0), address); }
+
+
+ Call tailRecursiveCall()
+ {
+ // Like a normal call, but don't link.
+ moveFixedWidthEncoding(TrustedImm32(0), dataTempRegister);
+ return Call(m_assembler.bx(dataTempRegister), 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;
+ }
+
+ Jump jump()
+ {
+ moveFixedWidthEncoding(TrustedImm32(0), dataTempRegister);
+ return Jump(m_assembler.bx(dataTempRegister), inUninterruptedSequence() ? ARMv7Assembler::JumpNoConditionFixedSize : ARMv7Assembler::JumpNoCondition);
+ }
+
+ Jump makeBranch(ARMv7Assembler::Condition cond)
+ {
+ m_assembler.it(cond, true, true);
+ moveFixedWidthEncoding(TrustedImm32(0), dataTempRegister);
+ return Jump(m_assembler.bx(dataTempRegister), inUninterruptedSequence() ? ARMv7Assembler::JumpConditionFixedSize : ARMv7Assembler::JumpCondition, cond);
+ }
+ Jump makeBranch(RelationalCondition cond) { return makeBranch(armV7Condition(cond)); }
+ Jump makeBranch(ResultCondition cond) { return makeBranch(armV7Condition(cond)); }
+ Jump 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(TrustedImm32(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(TrustedImm32(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(TrustedImm32(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(TrustedImm32(address.offset), addressTempRegister);
+ m_assembler.add(addressTempRegister, addressTempRegister, address.base);
+ }
+
+ return addressTempRegister;
+ }
+
+ void moveFixedWidthEncoding(TrustedImm32 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(RelationalCondition cond)
+ {
+ return static_cast<ARMv7Assembler::Condition>(cond);
+ }
+
+ ARMv7Assembler::Condition armV7Condition(ResultCondition 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
new file mode 100644
index 0000000..2183b22
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
@@ -0,0 +1,224 @@
+/*
+ * 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 returnType>
+ FunctionPtr(returnType(*value)())
+ : m_value((void*)value)
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ template<typename returnType, typename argType1>
+ FunctionPtr(returnType(*value)(argType1))
+ : m_value((void*)value)
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ template<typename returnType, typename argType1, typename argType2>
+ FunctionPtr(returnType(*value)(argType1, argType2))
+ : m_value((void*)value)
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ template<typename returnType, typename argType1, typename argType2, typename argType3>
+ FunctionPtr(returnType(*value)(argType1, argType2, argType3))
+ : m_value((void*)value)
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4>
+ FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4))
+ : m_value((void*)value)
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ template<typename FunctionType>
+ explicit FunctionPtr(FunctionType* value)
+ // Using a C-ctyle cast here to avoid compiler error on RVTC:
+ // Error: #694: reinterpret_cast cannot cast away const or other type qualifiers
+ // (I guess on RVTC function pointers have a different constness to GCC/MSVC?)
+ : m_value((void*)value)
+ {
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h
new file mode 100644
index 0000000..af1f5a1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h
@@ -0,0 +1,1795 @@
+/*
+ * 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 "MIPSAssembler.h"
+#include "AbstractMacroAssembler.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 RelationalCondition {
+ Equal,
+ NotEqual,
+ Above,
+ AboveOrEqual,
+ Below,
+ BelowOrEqual,
+ GreaterThan,
+ GreaterThanOrEqual,
+ LessThan,
+ LessThanOrEqual
+ };
+
+ enum ResultCondition {
+ 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 TrustedImm32, 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(TrustedImm32 imm, RegisterID dest)
+ {
+ add32(imm, dest, dest);
+ }
+
+ void add32(TrustedImm32 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(TrustedImm32 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(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ /*
+ li addrTemp, address
+ li immTemp, imm
+ lw dataTemp, 0(addrTemp)
+ addu dataTemp, dataTemp, immTemp
+ sw dataTemp, 0(addrTemp)
+ */
+ move(TrustedImmPtr(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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ /*
+ li addrTemp, address
+ li immTemp, imm
+ lw dataTemp, 0(addrTemp)
+ subu dataTemp, dataTemp, immTemp
+ sw dataTemp, 0(addrTemp)
+ */
+ move(TrustedImmPtr(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(TrustedImm32 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 TrustedImm32. 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(const void* address, RegisterID dest)
+ {
+ /*
+ li addrTemp, address
+ lw dest, 0(addrTemp)
+ */
+ move(TrustedImmPtr(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(TrustedImm32(address.offset), addrTempRegister);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lw(dest, addrTempRegister, 0);
+ m_fixedWidth = false;
+ return dataLabel;
+ }
+
+ /* 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(TrustedImm32(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(TrustedImm32 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, const void* address)
+ {
+ /*
+ li addrTemp, address
+ sw src, 0(addrTemp)
+ */
+ move(TrustedImmPtr(address), addrTempRegister);
+ m_assembler.sw(src, addrTempRegister, 0);
+ }
+
+ void store32(TrustedImm32 imm, const void* address)
+ {
+ /*
+ li immTemp, imm
+ li addrTemp, address
+ sw src, 0(addrTemp)
+ */
+ if (!imm.m_isPointer && !imm.m_value && !m_fixedWidth) {
+ move(TrustedImmPtr(address), addrTempRegister);
+ m_assembler.sw(MIPSRegisters::zero, addrTempRegister, 0);
+ } else {
+ move(imm, immTempRegister);
+ move(TrustedImmPtr(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(TrustedImm32 imm)
+ {
+ move(imm, immTempRegister);
+ push(immTempRegister);
+ }
+
+ // Register move operations:
+ //
+ // Move values in registers.
+
+ void move(TrustedImm32 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(TrustedImmPtr imm, RegisterID dest)
+ {
+ move(TrustedImm32(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, TrustedImm32(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(RelationalCondition cond, Address left, TrustedImm32 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(RelationalCondition cond, RegisterID left, RegisterID right)
+ {
+ if (cond == Equal)
+ return branchEqual(left, right);
+ if (cond == NotEqual)
+ 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);
+ }
+ ASSERT(0);
+
+ return Jump();
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 right)
+ {
+ move(right, immTempRegister);
+ return branch32(cond, left, immTempRegister);
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, Address right)
+ {
+ load32(right, dataTempRegister);
+ return branch32(cond, left, dataTempRegister);
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, RegisterID right)
+ {
+ load32(left, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ load32(left, dataTempRegister);
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branch32(RelationalCondition cond, BaseIndex left, TrustedImm32 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(RelationalCondition cond, BaseIndex left, TrustedImm32 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(RelationalCondition cond, AbsoluteAddress left, RegisterID right)
+ {
+ load32(left.m_ptr, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
+ {
+ load32(left.m_ptr, dataTempRegister);
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branch16(RelationalCondition cond, BaseIndex left, RegisterID right)
+ {
+ load16(left, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch16(RelationalCondition cond, BaseIndex left, TrustedImm32 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(ResultCondition 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(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-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(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ load32(address, dataTempRegister);
+ return branchTest32(cond, dataTempRegister, mask);
+ }
+
+ Jump branchTest32(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ load32(address, dataTempRegister);
+ return branchTest32(cond, dataTempRegister, mask);
+ }
+
+ Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-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(ResultCondition 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(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ move(imm, immTempRegister);
+ return branchAdd32(cond, immTempRegister, dest);
+ }
+
+ Jump branchMul32(ResultCondition 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(ResultCondition cond, TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(imm, immTempRegister);
+ move(src, dest);
+ return branchMul32(cond, immTempRegister, dest);
+ }
+
+ Jump branchSub32(ResultCondition 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(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ move(imm, immTempRegister);
+ return branchSub32(cond, immTempRegister, dest);
+ }
+
+ Jump branchOr32(ResultCondition 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.label(), 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.label(), Call::Linkable);
+ }
+
+ Call call(RegisterID target)
+ {
+ m_assembler.jalr(target);
+ m_assembler.nop();
+ return Call(m_assembler.label(), 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.label(), Call::None);
+ }
+
+ void ret()
+ {
+ m_assembler.jr(MIPSRegisters::ra);
+ m_assembler.nop();
+ }
+
+ void compare32(RelationalCondition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ if (cond == Equal) {
+ m_assembler.xorInsn(dest, left, right);
+ m_assembler.sltiu(dest, dest, 1);
+ } else if (cond == NotEqual) {
+ 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);
+ }
+ }
+
+ void compare32(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest)
+ {
+ move(right, immTempRegister);
+ compare32(cond, left, immTempRegister, dest);
+ }
+
+ void test8(ResultCondition cond, Address address, TrustedImm32 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 test32(ResultCondition cond, Address address, TrustedImm32 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(TrustedImm32 imm, RegisterID dest)
+ {
+ m_fixedWidth = true;
+ DataLabel32 label(this);
+ move(imm, dest);
+ m_fixedWidth = false;
+ return label;
+ }
+
+ DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
+ {
+ m_fixedWidth = true;
+ DataLabelPtr label(this);
+ move(initialValue, dest);
+ m_fixedWidth = false;
+ return label;
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ m_fixedWidth = true;
+ dataLabel = moveWithPatch(initialRightValue, immTempRegister);
+ Jump temp = branch32(cond, left, immTempRegister);
+ m_fixedWidth = false;
+ return temp;
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ m_fixedWidth = true;
+ load32(left, dataTempRegister);
+ dataLabel = moveWithPatch(initialRightValue, immTempRegister);
+ Jump temp = branch32(cond, dataTempRegister, immTempRegister);
+ m_fixedWidth = false;
+ return temp;
+ }
+
+ DataLabelPtr storePtrWithPatch(TrustedImmPtr 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(TrustedImmPtr(0), address);
+ }
+
+ Call tailRecursiveCall()
+ {
+ // Like a normal call, but don't update the returned address register
+ m_fixedWidth = true;
+ move(TrustedImm32(0), MIPSRegisters::t9);
+ m_assembler.jr(MIPSRegisters::t9);
+ m_assembler.nop();
+ m_fixedWidth = false;
+ return Call(m_assembler.label(), 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(TrustedImm32(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(TrustedImmPtr(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(TrustedImmPtr(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(TrustedImm32(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.label());
+ }
+
+ Jump branchFalse()
+ {
+ m_assembler.appendJump();
+ m_assembler.bc1f();
+ m_assembler.nop();
+ insertRelaxationWords();
+ return Jump(m_assembler.label());
+ }
+
+ Jump branchEqual(RegisterID rs, RegisterID rt)
+ {
+ m_assembler.appendJump();
+ m_assembler.beq(rs, rt, 0);
+ m_assembler.nop();
+ insertRelaxationWords();
+ return Jump(m_assembler.label());
+ }
+
+ Jump branchNotEqual(RegisterID rs, RegisterID rt)
+ {
+ m_assembler.appendJump();
+ m_assembler.bne(rs, rt, 0);
+ m_assembler.nop();
+ insertRelaxationWords();
+ return Jump(m_assembler.label());
+ }
+
+ 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, TrustedImm32(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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp
new file mode 100644
index 0000000..ee11f55
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 STMicroelectronics. All rights reserved.
+ * 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(ASSEMBLER) && CPU(SH4)
+
+#include "MacroAssemblerSH4.h"
+
+namespace JSC {
+
+void MacroAssemblerSH4::linkCall(void* code, Call call, FunctionPtr function)
+{
+ SH4Assembler::linkCall(code, call.m_jmp, function.value());
+}
+
+void MacroAssemblerSH4::repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+{
+ SH4Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+}
+
+void MacroAssemblerSH4::repatchCall(CodeLocationCall call, FunctionPtr destination)
+{
+ SH4Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+}
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h
new file mode 100644
index 0000000..5ef7b20
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h
@@ -0,0 +1,1747 @@
+/*
+ * Copyright (C) 2009-2011 STMicroelectronics. All rights reserved.
+ * 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 MacroAssemblerSH4_h
+#define MacroAssemblerSH4_h
+
+#if ENABLE(ASSEMBLER) && CPU(SH4)
+
+#include "AbstractMacroAssembler.h"
+#include "SH4Assembler.h"
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+class MacroAssemblerSH4 : public AbstractMacroAssembler<SH4Assembler> {
+public:
+ typedef SH4Assembler::FPRegisterID FPRegisterID;
+
+ static const Scale ScalePtr = TimesFour;
+ static const FPRegisterID fscratch = SH4Registers::fr10;
+ static const RegisterID stackPointerRegister = SH4Registers::sp;
+ static const RegisterID linkRegister = SH4Registers::pr;
+ static const RegisterID scratchReg3 = SH4Registers::r13;
+
+ enum RelationalCondition {
+ Equal = SH4Assembler::EQ,
+ NotEqual = SH4Assembler::NE,
+ Above = SH4Assembler::HI,
+ AboveOrEqual = SH4Assembler::HS,
+ Below = SH4Assembler::LI,
+ BelowOrEqual = SH4Assembler::LS,
+ GreaterThan = SH4Assembler::GT,
+ GreaterThanOrEqual = SH4Assembler::GE,
+ LessThan = SH4Assembler::LT,
+ LessThanOrEqual = SH4Assembler::LE
+ };
+
+ enum ResultCondition {
+ Overflow = SH4Assembler::OF,
+ Signed = SH4Assembler::SI,
+ Zero = SH4Assembler::EQ,
+ NonZero = SH4Assembler::NE
+ };
+
+ enum DoubleCondition {
+ // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
+ DoubleEqual = SH4Assembler::EQ,
+ DoubleNotEqual = SH4Assembler::NE,
+ DoubleGreaterThan = SH4Assembler::GT,
+ DoubleGreaterThanOrEqual = SH4Assembler::GE,
+ DoubleLessThan = SH4Assembler::LT,
+ DoubleLessThanOrEqual = SH4Assembler::LE,
+ // If either operand is NaN, these conditions always evaluate to true.
+ DoubleEqualOrUnordered = SH4Assembler::EQU,
+ DoubleNotEqualOrUnordered = SH4Assembler::NEU,
+ DoubleGreaterThanOrUnordered = SH4Assembler::GTU,
+ DoubleGreaterThanOrEqualOrUnordered = SH4Assembler::GEU,
+ DoubleLessThanOrUnordered = SH4Assembler::LTU,
+ DoubleLessThanOrEqualOrUnordered = SH4Assembler::LEU,
+ };
+
+ RegisterID claimScratch()
+ {
+ return m_assembler.claimScratch();
+ }
+
+ void releaseScratch(RegisterID reg)
+ {
+ m_assembler.releaseScratch(reg);
+ }
+
+ // Integer arithmetic operations
+
+ void add32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.addlRegReg(src, dest);
+ }
+
+ void add32(TrustedImm32 imm, RegisterID dest)
+ {
+ if (m_assembler.isImmediate(imm.m_value)) {
+ m_assembler.addlImm8r(imm.m_value, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(imm.m_value, scr);
+ m_assembler.addlRegReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void add32(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ if (src != dest)
+ m_assembler.movlRegReg(src, dest);
+ add32(imm, dest);
+ }
+
+ void add32(TrustedImm32 imm, Address address)
+ {
+ RegisterID scr = claimScratch();
+ load32(address, scr);
+ add32(imm, scr);
+ store32(scr, address);
+ releaseScratch(scr);
+ }
+
+ void add32(Address src, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ load32(src, scr);
+ m_assembler.addlRegReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void and32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.andlRegReg(src, dest);
+ }
+
+ void and32(TrustedImm32 imm, RegisterID dest)
+ {
+ if ((imm.m_value <= 255) && (imm.m_value >= 0) && (dest == SH4Registers::r0)) {
+ m_assembler.andlImm8r(imm.m_value, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant((imm.m_value), scr);
+ m_assembler.andlRegReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void lshift32(RegisterID shiftamount, RegisterID dest)
+ {
+ m_assembler.shllRegReg(dest, shiftamount);
+ }
+
+ void rshift32(int imm, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(-imm, scr);
+ m_assembler.shaRegReg(dest, scr);
+ releaseScratch(scr);
+ }
+
+ void lshift32(TrustedImm32 imm, RegisterID dest)
+ {
+ if ((imm.m_value == 1) || (imm.m_value == 2) || (imm.m_value == 8) || (imm.m_value == 16)) {
+ m_assembler.shllImm8r(imm.m_value, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(imm.m_value, scr);
+ m_assembler.shllRegReg(dest, scr);
+ releaseScratch(scr);
+ }
+
+ void mul32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.imullRegReg(src, dest);
+ m_assembler.stsmacl(dest);
+ }
+
+ void mul32(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ move(imm, scr);
+ if (src != dest)
+ move(src, dest);
+ mul32(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void not32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.notlReg(src, dest);
+ }
+
+ void or32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.orlRegReg(src, dest);
+ }
+
+ void or32(TrustedImm32 imm, RegisterID dest)
+ {
+ if ((imm.m_value <= 255) && (imm.m_value >= 0) && (dest == SH4Registers::r0)) {
+ m_assembler.orlImm8r(imm.m_value, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(imm.m_value, scr);
+ m_assembler.orlRegReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void rshift32(RegisterID shiftamount, RegisterID dest)
+ {
+ compare32(32, shiftamount, Equal);
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4);
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.neg(shiftamount, shiftamount);
+ m_assembler.shaRegReg(dest, shiftamount);
+ }
+
+ void rshift32(TrustedImm32 imm, RegisterID dest)
+ {
+ if (imm.m_value & 0x1f)
+ rshift32(imm.m_value & 0x1f, dest);
+ }
+
+ void sub32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.sublRegReg(src, dest);
+ }
+
+ void sub32(TrustedImm32 imm, AbsoluteAddress address, RegisterID scratchReg)
+ {
+ RegisterID result = claimScratch();
+
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg);
+ m_assembler.movlMemReg(scratchReg, result);
+
+ if (m_assembler.isImmediate(-imm.m_value))
+ m_assembler.addlImm8r(-imm.m_value, result);
+ else {
+ m_assembler.loadConstant(imm.m_value, scratchReg3);
+ m_assembler.sublRegReg(scratchReg3, result);
+ }
+
+ store32(result, scratchReg);
+ releaseScratch(result);
+ }
+
+ void sub32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ RegisterID result = claimScratch();
+ RegisterID scratchReg = claimScratch();
+
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg);
+ m_assembler.movlMemReg(scratchReg, result);
+
+ if (m_assembler.isImmediate(-imm.m_value))
+ m_assembler.addlImm8r(-imm.m_value, result);
+ else {
+ m_assembler.loadConstant(imm.m_value, scratchReg3);
+ m_assembler.sublRegReg(scratchReg3, result);
+ }
+
+ store32(result, scratchReg);
+ releaseScratch(result);
+ releaseScratch(scratchReg);
+ }
+
+ void add32(TrustedImm32 imm, AbsoluteAddress address, RegisterID scratchReg)
+ {
+ RegisterID result = claimScratch();
+
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg);
+ m_assembler.movlMemReg(scratchReg, result);
+
+ if (m_assembler.isImmediate(imm.m_value))
+ m_assembler.addlImm8r(imm.m_value, result);
+ else {
+ m_assembler.loadConstant(imm.m_value, scratchReg3);
+ m_assembler.addlRegReg(scratchReg3, result);
+ }
+
+ store32(result, scratchReg);
+ releaseScratch(result);
+ }
+
+ void add32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ RegisterID result = claimScratch();
+ RegisterID scratchReg = claimScratch();
+
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address.m_ptr), scratchReg);
+ m_assembler.movlMemReg(scratchReg, result);
+
+ if (m_assembler.isImmediate(imm.m_value))
+ m_assembler.addlImm8r(imm.m_value, result);
+ else {
+ m_assembler.loadConstant(imm.m_value, scratchReg3);
+ m_assembler.addlRegReg(scratchReg3, result);
+ }
+
+ store32(result, scratchReg);
+ releaseScratch(result);
+ releaseScratch(scratchReg);
+ }
+
+ void sub32(TrustedImm32 imm, RegisterID dest)
+ {
+ if (m_assembler.isImmediate(-imm.m_value)) {
+ m_assembler.addlImm8r(-imm.m_value, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(imm.m_value, scr);
+ m_assembler.sublRegReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void sub32(Address src, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ load32(src, scr);
+ m_assembler.sublRegReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void xor32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.xorlRegReg(src, dest);
+ }
+
+ void xor32(TrustedImm32 imm, RegisterID srcDest)
+ {
+ if ((srcDest != SH4Registers::r0) || (imm.m_value > 255) || (imm.m_value < 0)) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant((imm.m_value), scr);
+ m_assembler.xorlRegReg(scr, srcDest);
+ releaseScratch(scr);
+ return;
+ }
+
+ m_assembler.xorlImm8r(imm.m_value, srcDest);
+ }
+
+ void compare32(int imm, RegisterID dst, RelationalCondition cond)
+ {
+ if (((cond == Equal) || (cond == NotEqual)) && (dst == SH4Registers::r0) && m_assembler.isImmediate(imm)) {
+ m_assembler.cmpEqImmR0(imm, dst);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(imm, scr);
+ m_assembler.cmplRegReg(scr, dst, SH4Condition(cond));
+ releaseScratch(scr);
+ }
+
+ void compare32(int offset, RegisterID base, RegisterID left, RelationalCondition cond)
+ {
+ RegisterID scr = claimScratch();
+ if (!offset) {
+ m_assembler.movlMemReg(base, scr);
+ m_assembler.cmplRegReg(scr, left, SH4Condition(cond));
+ releaseScratch(scr);
+ return;
+ }
+
+ if ((offset < 0) || (offset >= 64)) {
+ m_assembler.loadConstant(offset, scr);
+ m_assembler.addlRegReg(base, scr);
+ m_assembler.movlMemReg(scr, scr);
+ m_assembler.cmplRegReg(scr, left, SH4Condition(cond));
+ releaseScratch(scr);
+ return;
+ }
+
+ m_assembler.movlMemReg(offset >> 2, base, scr);
+ m_assembler.cmplRegReg(scr, left, SH4Condition(cond));
+ releaseScratch(scr);
+ }
+
+ void testImm(int imm, int offset, RegisterID base)
+ {
+ RegisterID scr = claimScratch();
+ RegisterID scr1 = claimScratch();
+
+ if ((offset < 0) || (offset >= 64)) {
+ m_assembler.loadConstant(offset, scr);
+ m_assembler.addlRegReg(base, scr);
+ m_assembler.movlMemReg(scr, scr);
+ } else if (offset)
+ m_assembler.movlMemReg(offset >> 2, base, scr);
+ else
+ m_assembler.movlMemReg(base, scr);
+ if (m_assembler.isImmediate(imm))
+ m_assembler.movImm8(imm, scr1);
+ else
+ m_assembler.loadConstant(imm, scr1);
+
+ m_assembler.testlRegReg(scr, scr1);
+ releaseScratch(scr);
+ releaseScratch(scr1);
+ }
+
+ void testlImm(int imm, RegisterID dst)
+ {
+ if ((dst == SH4Registers::r0) && (imm <= 255) && (imm >= 0)) {
+ m_assembler.testlImm8r(imm, dst);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(imm, scr);
+ m_assembler.testlRegReg(scr, dst);
+ releaseScratch(scr);
+ }
+
+ void compare32(RegisterID right, int offset, RegisterID base, RelationalCondition cond)
+ {
+ if (!offset) {
+ RegisterID scr = claimScratch();
+ m_assembler.movlMemReg(base, scr);
+ m_assembler.cmplRegReg(right, scr, SH4Condition(cond));
+ releaseScratch(scr);
+ return;
+ }
+
+ if ((offset < 0) || (offset >= 64)) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(offset, scr);
+ m_assembler.addlRegReg(base, scr);
+ m_assembler.movlMemReg(scr, scr);
+ m_assembler.cmplRegReg(right, scr, SH4Condition(cond));
+ releaseScratch(scr);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.movlMemReg(offset >> 2, base, scr);
+ m_assembler.cmplRegReg(right, scr, SH4Condition(cond));
+ releaseScratch(scr);
+ }
+
+ void compare32(int imm, int offset, RegisterID base, RelationalCondition cond)
+ {
+ if (!offset) {
+ RegisterID scr = claimScratch();
+ RegisterID scr1 = claimScratch();
+ m_assembler.movlMemReg(base, scr);
+ m_assembler.loadConstant(imm, scr1);
+ m_assembler.cmplRegReg(scr1, scr, SH4Condition(cond));
+ releaseScratch(scr1);
+ releaseScratch(scr);
+ return;
+ }
+
+ if ((offset < 0) || (offset >= 64)) {
+ RegisterID scr = claimScratch();
+ RegisterID scr1 = claimScratch();
+ m_assembler.loadConstant(offset, scr);
+ m_assembler.addlRegReg(base, scr);
+ m_assembler.movlMemReg(scr, scr);
+ m_assembler.loadConstant(imm, scr1);
+ m_assembler.cmplRegReg(scr1, scr, SH4Condition(cond));
+ releaseScratch(scr1);
+ releaseScratch(scr);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ RegisterID scr1 = claimScratch();
+ m_assembler.movlMemReg(offset >> 2, base, scr);
+ m_assembler.loadConstant(imm, scr1);
+ m_assembler.cmplRegReg(scr1, scr, SH4Condition(cond));
+ releaseScratch(scr1);
+ releaseScratch(scr);
+ }
+
+ // Memory access operation
+
+ void load32(ImplicitAddress address, RegisterID dest)
+ {
+ load32(address.base, address.offset, dest);
+ }
+
+ void load8(ImplicitAddress address, RegisterID dest)
+ {
+ load8(address.base, address.offset, dest);
+ }
+
+ void load32(BaseIndex address, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ move(address.index, scr);
+ lshift32(TrustedImm32(address.scale), scr);
+ add32(address.base, scr);
+ load32(scr, address.offset, dest);
+ releaseScratch(scr);
+ }
+
+ void load32(void* address, RegisterID dest)
+ {
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), dest);
+ m_assembler.movlMemReg(dest, dest);
+ }
+
+ void load32(RegisterID base, int offset, RegisterID dest)
+ {
+ if (!offset) {
+ m_assembler.movlMemReg(base, dest);
+ return;
+ }
+
+ if ((offset >= 0) && (offset < 64)) {
+ m_assembler.movlMemReg(offset >> 2, base, dest);
+ return;
+ }
+
+ if ((dest == SH4Registers::r0) && (dest != base)) {
+ m_assembler.loadConstant((offset), dest);
+ m_assembler.movlR0mr(base, dest);
+ return;
+ }
+
+ RegisterID scr;
+ if (dest == base)
+ scr = claimScratch();
+ else
+ scr = dest;
+ m_assembler.loadConstant((offset), scr);
+ m_assembler.addlRegReg(base, scr);
+ m_assembler.movlMemReg(scr, dest);
+
+ if (dest == base)
+ releaseScratch(scr);
+ }
+
+ void load8(RegisterID base, int offset, RegisterID dest)
+ {
+ if (!offset) {
+ m_assembler.movbMemReg(base, dest);
+ return;
+ }
+
+ if ((offset > 0) && (offset < 64) && (dest == SH4Registers::r0)) {
+ m_assembler.movbMemReg(offset, base, dest);
+ return;
+ }
+
+ if (base != dest) {
+ m_assembler.loadConstant((offset), dest);
+ m_assembler.addlRegReg(base, dest);
+ m_assembler.movbMemReg(dest, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant((offset), scr);
+ m_assembler.addlRegReg(base, scr);
+ m_assembler.movbMemReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void load32(RegisterID r0, RegisterID src, RegisterID dst)
+ {
+ ASSERT(r0 == SH4Registers::r0);
+ m_assembler.movlR0mr(src, dst);
+ }
+
+ void load32(RegisterID src, RegisterID dst)
+ {
+ m_assembler.movlMemReg(src, dst);
+ }
+
+ void load16(ImplicitAddress address, RegisterID dest)
+ {
+ if (!address.offset) {
+ m_assembler.movwMemReg(address.base, dest);
+ return;
+ }
+
+ if ((address.offset > 0) && (address.offset < 64) && (dest == SH4Registers::r0)) {
+ m_assembler.movwMemReg(address.offset, address.base, dest);
+ return;
+ }
+
+ if (address.base != dest) {
+ m_assembler.loadConstant((address.offset), dest);
+ m_assembler.addlRegReg(address.base, dest);
+ m_assembler.movwMemReg(dest, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant((address.offset), scr);
+ m_assembler.addlRegReg(address.base, scr);
+ m_assembler.movwMemReg(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void load16(RegisterID src, RegisterID dest)
+ {
+ m_assembler.movwMemReg(src, dest);
+ }
+
+ void load16(RegisterID r0, RegisterID src, RegisterID dest)
+ {
+ ASSERT(r0 == SH4Registers::r0);
+ m_assembler.movwR0mr(src, dest);
+ }
+
+ void load16(BaseIndex address, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+
+ move(address.index, scr);
+ lshift32(TrustedImm32(address.scale), scr);
+
+ if (address.offset)
+ add32(TrustedImm32(address.offset), scr);
+ if (scr == SH4Registers::r0)
+ m_assembler.movwR0mr(address.base, scr);
+ else {
+ add32(address.base, scr);
+ load16(scr, scr);
+ }
+
+ extuw(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void store32(RegisterID src, ImplicitAddress address)
+ {
+ RegisterID scr = claimScratch();
+ store32(src, address.offset, address.base, scr);
+ releaseScratch(scr);
+ }
+
+ void store32(RegisterID src, int offset, RegisterID base, RegisterID scr)
+ {
+ if (!offset) {
+ m_assembler.movlRegMem(src, base);
+ return;
+ }
+
+ if ((offset >=0) && (offset < 64)) {
+ m_assembler.movlRegMem(src, offset >> 2, base);
+ return;
+ }
+
+ m_assembler.loadConstant((offset), scr);
+ if (scr == SH4Registers::r0) {
+ m_assembler.movlRegMemr0(src, base);
+ return;
+ }
+
+ m_assembler.addlRegReg(base, scr);
+ m_assembler.movlRegMem(src, scr);
+ }
+
+ void store32(RegisterID src, RegisterID offset, RegisterID base)
+ {
+ ASSERT(offset == SH4Registers::r0);
+ m_assembler.movlRegMemr0(src, base);
+ }
+
+ void store32(RegisterID src, RegisterID dst)
+ {
+ m_assembler.movlRegMem(src, dst);
+ }
+
+ void store32(TrustedImm32 imm, ImplicitAddress address)
+ {
+ RegisterID scr = claimScratch();
+ RegisterID scr1 = claimScratch();
+ m_assembler.loadConstant((imm.m_value), scr);
+ store32(scr, address.offset, address.base, scr1);
+ releaseScratch(scr);
+ releaseScratch(scr1);
+ }
+
+ void store32(RegisterID src, BaseIndex address)
+ {
+ RegisterID scr = claimScratch();
+
+ move(address.index, scr);
+ lshift32(TrustedImm32(address.scale), scr);
+ add32(address.base, scr);
+ store32(src, Address(scr, address.offset));
+
+ releaseScratch(scr);
+ }
+
+ void store32(TrustedImm32 imm, void* address)
+ {
+ RegisterID scr = claimScratch();
+ RegisterID scr1 = claimScratch();
+ m_assembler.loadConstant((imm.m_value), scr);
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), scr1);
+ m_assembler.movlMemReg(scr, scr1);
+ releaseScratch(scr);
+ releaseScratch(scr1);
+ }
+
+ void store32(RegisterID src, void* address)
+ {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), scr);
+ m_assembler.movlMemReg(src, scr);
+ releaseScratch(scr);
+ }
+
+ DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ DataLabel32 label(this);
+ m_assembler.loadConstantUnReusable(address.offset, scr);
+ m_assembler.addlRegReg(address.base, scr);
+ m_assembler.movlMemReg(scr, dest);
+ releaseScratch(scr);
+ return label;
+ }
+
+ DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ RegisterID scr = claimScratch();
+ DataLabel32 label(this);
+ m_assembler.loadConstantUnReusable(address.offset, scr);
+ m_assembler.addlRegReg(address.base, scr);
+ m_assembler.movlRegMem(src, scr);
+ releaseScratch(scr);
+ return label;
+ }
+
+ // Floating-point operations
+
+ bool supportsFloatingPoint() const { return true; }
+ bool supportsFloatingPointTruncate() const { return true; }
+ bool supportsFloatingPointSqrt() const { return true; }
+
+ void loadDouble(ImplicitAddress address, FPRegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+
+ m_assembler.loadConstant(address.offset, scr);
+ if (address.base == SH4Registers::r0) {
+ m_assembler.fmovsReadr0r(scr, (FPRegisterID)(dest + 1));
+ m_assembler.addlImm8r(4, scr);
+ m_assembler.fmovsReadr0r(scr, dest);
+ releaseScratch(scr);
+ return;
+ }
+
+ m_assembler.addlRegReg(address.base, scr);
+ m_assembler.fmovsReadrminc(scr, (FPRegisterID)(dest + 1));
+ m_assembler.fmovsReadrm(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void loadDouble(const void* address, FPRegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(address), scr);
+ m_assembler.fmovsReadrminc(scr, (FPRegisterID)(dest + 1));
+ m_assembler.fmovsReadrm(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void storeDouble(FPRegisterID src, ImplicitAddress address)
+ {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(address.offset, scr);
+ m_assembler.addlRegReg(address.base, scr);
+ m_assembler.fmovsWriterm((FPRegisterID)(src + 1), scr);
+ m_assembler.addlImm8r(4, scr);
+ m_assembler.fmovsWriterm(src, scr);
+ releaseScratch(scr);
+ }
+
+ void addDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.daddRegReg(src, dest);
+ }
+
+ void addDouble(Address address, FPRegisterID dest)
+ {
+ loadDouble(address, fscratch);
+ addDouble(fscratch, dest);
+ }
+
+ void subDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.dsubRegReg(src, dest);
+ }
+
+ void subDouble(Address address, FPRegisterID dest)
+ {
+ loadDouble(address, fscratch);
+ subDouble(fscratch, dest);
+ }
+
+ void mulDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.dmulRegReg(src, dest);
+ }
+
+ void mulDouble(Address address, FPRegisterID dest)
+ {
+ loadDouble(address, fscratch);
+ mulDouble(fscratch, dest);
+ }
+
+ void divDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.ddivRegReg(src, dest);
+ }
+
+ void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
+ {
+ m_assembler.ldsrmfpul(src);
+ m_assembler.floatfpulDreg(dest);
+ }
+
+ void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(src.m_ptr), scr);
+ convertInt32ToDouble(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void convertInt32ToDouble(Address src, FPRegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ load32(src, scr);
+ convertInt32ToDouble(scr, dest);
+ releaseScratch(scr);
+ }
+
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+
+ move(address.index, scr);
+ lshift32(TrustedImm32(address.scale), scr);
+ add32(address.base, scr);
+
+ if (address.offset)
+ add32(TrustedImm32(address.offset), scr);
+
+ RegisterID scr1 = claimScratch();
+ load16(scr, scr1);
+ add32(TrustedImm32(2), scr);
+ load16(scr, dest);
+ move(TrustedImm32(16), scr);
+ m_assembler.shllRegReg(dest, scr);
+ or32(scr1, dest);
+
+ releaseScratch(scr);
+ releaseScratch(scr1);
+ }
+
+ Jump branch32WithUnalignedHalfWords(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ RegisterID scr = scratchReg3;
+ load32WithUnalignedHalfWords(left, scr);
+ if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
+ m_assembler.testlRegReg(scr, scr);
+ else
+ compare32(right.m_value, scr, cond);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch)
+ {
+ m_assembler.movImm8(0, scratchReg3);
+ convertInt32ToDouble(scratchReg3, scratch);
+ return branchDouble(DoubleNotEqual, reg, scratch);
+ }
+
+ Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch)
+ {
+ m_assembler.movImm8(0, scratchReg3);
+ convertInt32ToDouble(scratchReg3, scratch);
+ return branchDouble(DoubleEqualOrUnordered, reg, scratch);
+ }
+
+ Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
+ {
+ if (cond == DoubleEqual) {
+ m_assembler.dcmppeq(right, left);
+ return branchTrue();
+ }
+
+ if (cond == DoubleNotEqual) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(0x7fbfffff, scratchReg3);
+ m_assembler.dcnvds(right);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 8);
+ m_assembler.dcnvds(left);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.branch(BT_OPCODE, 4);
+ m_assembler.dcmppeq(right, left);
+ releaseScratch(scr);
+ return branchFalse();
+ }
+
+ if (cond == DoubleGreaterThan) {
+ m_assembler.dcmppgt(right, left);
+ return branchTrue();
+ }
+
+ if (cond == DoubleGreaterThanOrEqual) {
+ m_assembler.dcmppgt(left, right);
+ return branchFalse();
+ }
+
+ if (cond == DoubleLessThan) {
+ m_assembler.dcmppgt(left, right);
+ return branchTrue();
+ }
+
+ if (cond == DoubleLessThanOrEqual) {
+ m_assembler.dcmppgt(right, left);
+ return branchFalse();
+ }
+
+ if (cond == DoubleEqualOrUnordered) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(0x7fbfffff, scratchReg3);
+ m_assembler.dcnvds(right);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 5);
+ m_assembler.dcnvds(left);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.dcmppeq(left, right);
+ releaseScratch(scr);
+ return branchTrue();
+ }
+
+ if (cond == DoubleGreaterThanOrUnordered) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(0x7fbfffff, scratchReg3);
+ m_assembler.dcnvds(right);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 5);
+ m_assembler.dcnvds(left);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.dcmppgt(right, left);
+ releaseScratch(scr);
+ return branchTrue();
+ }
+
+ if (cond == DoubleGreaterThanOrEqualOrUnordered) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(0x7fbfffff, scratchReg3);
+ m_assembler.dcnvds(right);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 5);
+ m_assembler.dcnvds(left);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.dcmppgt(left, right);
+ releaseScratch(scr);
+ return branchFalse();
+ }
+
+ if (cond == DoubleLessThanOrUnordered) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(0x7fbfffff, scratchReg3);
+ m_assembler.dcnvds(right);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 5);
+ m_assembler.dcnvds(left);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.dcmppgt(left, right);
+ releaseScratch(scr);
+ return branchTrue();
+ }
+
+ if (cond == DoubleLessThanOrEqualOrUnordered) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(0x7fbfffff, scratchReg3);
+ m_assembler.dcnvds(right);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 5);
+ m_assembler.dcnvds(left);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.dcmppgt(right, left);
+ releaseScratch(scr);
+ return branchFalse();
+ }
+
+ ASSERT(cond == DoubleNotEqualOrUnordered);
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(0x7fbfffff, scratchReg3);
+ m_assembler.dcnvds(right);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 22, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 5);
+ m_assembler.dcnvds(left);
+ m_assembler.stsfpulReg(scr);
+ m_assembler.cmplRegReg(scratchReg3, scr, SH4Condition(Equal));
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.dcmppeq(right, left);
+ releaseScratch(scr);
+ return branchFalse();
+ }
+
+ Jump branchTrue()
+ {
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 6, sizeof(uint32_t));
+ Jump m_jump = Jump(m_assembler.je());
+ m_assembler.loadConstantUnReusable(0x0, scratchReg3);
+ m_assembler.nop();
+ m_assembler.nop();
+ return m_jump;
+ }
+
+ Jump branchFalse()
+ {
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 6, sizeof(uint32_t));
+ Jump m_jump = Jump(m_assembler.jne());
+ m_assembler.loadConstantUnReusable(0x0, scratchReg3);
+ m_assembler.nop();
+ m_assembler.nop();
+ return m_jump;
+ }
+
+ Jump branch32(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ RegisterID scr = claimScratch();
+ move(left.index, scr);
+ lshift32(TrustedImm32(left.scale), scr);
+ add32(left.base, scr);
+ load32(scr, left.offset, scr);
+ compare32(right.m_value, scr, cond);
+ releaseScratch(scr);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ void sqrtDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ if (dest != src)
+ m_assembler.dmovRegReg(src, dest);
+ m_assembler.dsqrt(dest);
+ }
+
+ Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ RegisterID addressTempRegister = claimScratch();
+ load8(address, addressTempRegister);
+ Jump jmp = branchTest32(cond, addressTempRegister, mask);
+ releaseScratch(addressTempRegister);
+ return jmp;
+ }
+
+ void signExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ }
+
+ Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ RegisterID addressTempRegister = claimScratch();
+ load8(left, addressTempRegister);
+ Jump jmp = branch32(cond, addressTempRegister, right);
+ releaseScratch(addressTempRegister);
+ return jmp;
+ }
+
+ Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest)
+ {
+ m_assembler.ftrcdrmfpul(src);
+ m_assembler.stsfpulReg(dest);
+ m_assembler.loadConstant(0x7fffffff, scratchReg3);
+ m_assembler.cmplRegReg(dest, scratchReg3, SH4Condition(Equal));
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 14, sizeof(uint32_t));
+ m_assembler.branch(BT_OPCODE, 2);
+ m_assembler.addlImm8r(1, scratchReg3);
+ m_assembler.cmplRegReg(dest, scratchReg3, SH4Condition(Equal));
+ return branchTrue();
+ }
+
+ // Stack manipulation operations
+
+ void pop(RegisterID dest)
+ {
+ m_assembler.popReg(dest);
+ }
+
+ void push(RegisterID src)
+ {
+ m_assembler.pushReg(src);
+ }
+
+ void push(Address address)
+ {
+ if (!address.offset) {
+ push(address.base);
+ return;
+ }
+
+ if ((address.offset < 0) || (address.offset >= 64)) {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(address.offset, scr);
+ m_assembler.addlRegReg(address.base, scr);
+ m_assembler.movlMemReg(scr, SH4Registers::sp);
+ m_assembler.addlImm8r(-4, SH4Registers::sp);
+ releaseScratch(scr);
+ return;
+ }
+
+ m_assembler.movlMemReg(address.offset >> 2, address.base, SH4Registers::sp);
+ m_assembler.addlImm8r(-4, SH4Registers::sp);
+ }
+
+ void push(TrustedImm32 imm)
+ {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(imm.m_value, scr);
+ push(scr);
+ releaseScratch(scr);
+ }
+
+ // Register move operations
+
+ void move(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.loadConstant(imm.m_value, dest);
+ }
+
+ DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
+ {
+ DataLabelPtr dataLabel(this);
+ m_assembler.loadConstantUnReusable(reinterpret_cast<uint32_t>(initialValue.m_value), dest, true);
+ return dataLabel;
+ }
+
+ void move(RegisterID src, RegisterID dest)
+ {
+ m_assembler.movlRegReg(src, dest);
+ }
+
+ void move(TrustedImmPtr imm, RegisterID dest)
+ {
+ m_assembler.loadConstant(imm.asIntptr(), dest);
+ }
+
+ void extuw(RegisterID src, RegisterID dst)
+ {
+ m_assembler.extuw(src, dst);
+ }
+
+ void compare32(RelationalCondition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ m_assembler.cmplRegReg(right, left, SH4Condition(cond));
+ if (cond != NotEqual) {
+ m_assembler.movt(dest);
+ return;
+ }
+
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4);
+ m_assembler.movImm8(0, dest);
+ m_assembler.branch(BT_OPCODE, 0);
+ m_assembler.movImm8(1, dest);
+ }
+
+ void compare32(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest)
+ {
+ if (left != dest) {
+ move(right, dest);
+ compare32(cond, left, dest, dest);
+ return;
+ }
+
+ RegisterID scr = claimScratch();
+ move(right, scr);
+ compare32(cond, left, scr, dest);
+ releaseScratch(scr);
+ }
+
+ void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+
+ load8(address, dest);
+ if (mask.m_value == -1)
+ compare32(0, dest, static_cast<RelationalCondition>(cond));
+ else
+ testlImm(mask.m_value, dest);
+ if (cond != NonZero) {
+ m_assembler.movt(dest);
+ return;
+ }
+
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4);
+ m_assembler.movImm8(0, dest);
+ m_assembler.branch(BT_OPCODE, 0);
+ m_assembler.movImm8(1, dest);
+ }
+
+ void loadPtrLinkReg(ImplicitAddress address)
+ {
+ RegisterID scr = claimScratch();
+ load32(address, scr);
+ m_assembler.ldspr(scr);
+ releaseScratch(scr);
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, RegisterID right)
+ {
+ m_assembler.cmplRegReg(right, left, SH4Condition(cond));
+ /* BT label => BF off
+ nop LDR reg
+ nop braf @reg
+ nop nop
+ */
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 right)
+ {
+ if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
+ m_assembler.testlRegReg(left, left);
+ else
+ compare32(right.m_value, left, cond);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, Address right)
+ {
+ compare32(right.offset, right.base, left, cond);
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, RegisterID right)
+ {
+ compare32(right, left.offset, left.base, cond);
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ compare32(right.m_value, left.offset, left.base, cond);
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branch32(RelationalCondition cond, AbsoluteAddress left, RegisterID right)
+ {
+ RegisterID scr = claimScratch();
+
+ move(TrustedImm32(reinterpret_cast<uint32_t>(left.m_ptr)), scr);
+ m_assembler.cmplRegReg(right, scr, SH4Condition(cond));
+ releaseScratch(scr);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branch32(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 right)
+ {
+ RegisterID addressTempRegister = claimScratch();
+
+ m_assembler.loadConstant(reinterpret_cast<uint32_t>(left.m_ptr), addressTempRegister);
+ m_assembler.movlMemReg(addressTempRegister, addressTempRegister);
+ compare32(right.m_value, addressTempRegister, cond);
+ releaseScratch(addressTempRegister);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branch16(RelationalCondition cond, BaseIndex left, RegisterID right)
+ {
+ RegisterID scr = claimScratch();
+
+ move(left.index, scr);
+ lshift32(TrustedImm32(left.scale), scr);
+
+ if (left.offset)
+ add32(TrustedImm32(left.offset), scr);
+ add32(left.base, scr);
+ load16(scr, scr);
+ extuw(scr, scr);
+ releaseScratch(scr);
+
+ return branch32(cond, scr, right);
+ }
+
+ Jump branch16(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ RegisterID scr = claimScratch();
+
+ move(left.index, scr);
+ lshift32(TrustedImm32(left.scale), scr);
+
+ if (left.offset)
+ add32(TrustedImm32(left.offset), scr);
+ add32(left.base, scr);
+ load16(scr, scr);
+ extuw(scr, scr);
+ RegisterID scr1 = claimScratch();
+ m_assembler.loadConstant(right.m_value, scr1);
+ releaseScratch(scr);
+ releaseScratch(scr1);
+
+ return branch32(cond, scr, scr1);
+ }
+
+ Jump branchTest32(ResultCondition cond, RegisterID reg, RegisterID mask)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+
+ m_assembler.testlRegReg(reg, mask);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchTest32(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+
+ if (mask.m_value == -1)
+ m_assembler.testlRegReg(reg, reg);
+ else
+ testlImm(mask.m_value, reg);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchTest32(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+
+ if (mask.m_value == -1)
+ compare32(0, address.offset, address.base, static_cast<RelationalCondition>(cond));
+ else
+ testImm(mask.m_value, address.offset, address.base);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchTest32(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ RegisterID scr = claimScratch();
+
+ move(address.index, scr);
+ lshift32(TrustedImm32(address.scale), scr);
+ add32(address.base, scr);
+ load32(scr, address.offset, scr);
+
+ if (mask.m_value == -1)
+ m_assembler.testlRegReg(scr, scr);
+ else
+ testlImm(mask.m_value, scr);
+
+ releaseScratch(scr);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump jump()
+ {
+ return Jump(m_assembler.jmp());
+ }
+
+ void jump(RegisterID target)
+ {
+ m_assembler.jmpReg(target);
+ }
+
+ void jump(Address address)
+ {
+ RegisterID scr = claimScratch();
+
+ if ((address.offset < 0) || (address.offset >= 64)) {
+ m_assembler.loadConstant(address.offset, scr);
+ m_assembler.addlRegReg(address.base, scr);
+ m_assembler.movlMemReg(scr, scr);
+ } else if (address.offset)
+ m_assembler.movlMemReg(address.offset >> 2, address.base, scr);
+ else
+ m_assembler.movlMemReg(address.base, scr);
+ m_assembler.jmpReg(scr);
+
+ releaseScratch(scr);
+ }
+
+ // Arithmetic control flow operations
+
+ Jump branchAdd32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+
+ if (cond == Overflow) {
+ m_assembler.addvlRegReg(src, dest);
+ return branchTrue();
+ }
+
+ if (cond == Signed) {
+ m_assembler.addlRegReg(src, dest);
+ // Check if dest is negative
+ m_assembler.cmppz(dest);
+ return branchFalse();
+ }
+
+ m_assembler.addlRegReg(src, dest);
+ compare32(0, dest, Equal);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+
+ move(imm, scratchReg3);
+ return branchAdd32(cond, scratchReg3, dest);
+ }
+
+ Jump branchMul32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+
+ if (cond == Overflow) {
+ RegisterID scr1 = claimScratch();
+ RegisterID scr = claimScratch();
+ m_assembler.dmullRegReg(src, dest);
+ m_assembler.stsmacl(dest);
+ m_assembler.movImm8(-31, scr);
+ m_assembler.movlRegReg(dest, scr1);
+ m_assembler.shaRegReg(scr1, scr);
+ m_assembler.stsmach(scr);
+ m_assembler.cmplRegReg(scr, scr1, SH4Condition(Equal));
+ releaseScratch(scr1);
+ releaseScratch(scr);
+ return branchFalse();
+ }
+
+ m_assembler.imullRegReg(src, dest);
+ m_assembler.stsmacl(dest);
+ if (cond == Signed) {
+ // Check if dest is negative
+ m_assembler.cmppz(dest);
+ return branchFalse();
+ }
+
+ compare32(0, dest, static_cast<RelationalCondition>(cond));
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchMul32(ResultCondition cond, TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+
+ move(imm, scratchReg3);
+ if (src != dest)
+ move(src, dest);
+
+ return branchMul32(cond, scratchReg3, dest);
+ }
+
+ Jump branchSub32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+
+ if (cond == Overflow) {
+ m_assembler.subvlRegReg(src, dest);
+ return branchTrue();
+ }
+
+ if (cond == Signed) {
+ // Check if dest is negative
+ m_assembler.sublRegReg(src, dest);
+ compare32(0, dest, LessThan);
+ return branchTrue();
+ }
+
+ sub32(src, dest);
+ compare32(0, dest, static_cast<RelationalCondition>(cond));
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchSub32(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+
+ move(imm, scratchReg3);
+ return branchSub32(cond, scratchReg3, dest);
+ }
+
+ Jump branchOr32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero));
+
+ if (cond == Signed) {
+ or32(src, dest);
+ compare32(0, dest, static_cast<RelationalCondition>(LessThan));
+ return branchTrue();
+ }
+
+ or32(src, dest);
+ compare32(0, dest, static_cast<RelationalCondition>(cond));
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp)
+ {
+ m_assembler.ftrcdrmfpul(src);
+ m_assembler.stsfpulReg(dest);
+ convertInt32ToDouble(dest, fscratch);
+ failureCases.append(branchDouble(DoubleNotEqualOrUnordered, fscratch, src));
+
+ if (dest == SH4Registers::r0)
+ m_assembler.cmpEqImmR0(0, dest);
+ else {
+ m_assembler.movImm8(0, scratchReg3);
+ m_assembler.cmplRegReg(scratchReg3, dest, SH4Condition(Equal));
+ }
+ failureCases.append(branchTrue());
+ }
+
+ void neg32(RegisterID dst)
+ {
+ m_assembler.neg(dst, dst);
+ }
+
+ void not32(RegisterID dst)
+ {
+ m_assembler.notlReg(dst, dst);
+ }
+
+ void urshift32(RegisterID shiftamount, RegisterID dest)
+ {
+ compare32(32, shiftamount, Equal);
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 4);
+ m_assembler.branch(BT_OPCODE, 1);
+ m_assembler.neg(shiftamount, shiftamount);
+ m_assembler.shllRegReg(dest, shiftamount);
+ }
+
+ void urshift32(TrustedImm32 imm, RegisterID dest)
+ {
+ RegisterID scr = claimScratch();
+ m_assembler.loadConstant(-(imm.m_value), scr);
+ m_assembler.shaRegReg(dest, scr);
+ releaseScratch(scr);
+ }
+
+ Call call()
+ {
+ return Call(m_assembler.call(), Call::Linkable);
+ }
+
+ 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, RegisterID target)
+ {
+ load32(address.base, address.offset, target);
+ m_assembler.ensureSpace(m_assembler.maxInstructionSize + 2);
+ m_assembler.branch(JSR_OPCODE, target);
+ m_assembler.nop();
+ }
+
+ void breakpoint()
+ {
+ m_assembler.bkpt();
+ m_assembler.nop();
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ RegisterID dataTempRegister = claimScratch();
+
+ dataLabel = moveWithPatch(initialRightValue, dataTempRegister);
+ m_assembler.cmplRegReg(dataTempRegister, left, SH4Condition(cond));
+ releaseScratch(dataTempRegister);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ RegisterID scr = claimScratch();
+
+ m_assembler.loadConstant(left.offset, scr);
+ m_assembler.addlRegReg(left.base, scr);
+ m_assembler.movlMemReg(scr, scr);
+ RegisterID scr1 = claimScratch();
+ dataLabel = moveWithPatch(initialRightValue, scr1);
+ m_assembler.cmplRegReg(scr1, scr, SH4Condition(cond));
+ releaseScratch(scr);
+ releaseScratch(scr1);
+
+ if (cond == NotEqual)
+ return branchFalse();
+ return branchTrue();
+ }
+
+ void ret()
+ {
+ m_assembler.ret();
+ m_assembler.nop();
+ }
+
+ DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
+ {
+ RegisterID scr = claimScratch();
+ DataLabelPtr label = moveWithPatch(initialValue, scr);
+ store32(scr, address);
+ releaseScratch(scr);
+ return label;
+ }
+
+ DataLabelPtr storePtrWithPatch(ImplicitAddress address) { return storePtrWithPatch(TrustedImmPtr(0), address); }
+
+ int sizeOfConstantPool()
+ {
+ return m_assembler.sizeOfConstantPool();
+ }
+
+ Call tailRecursiveCall()
+ {
+ RegisterID scr = claimScratch();
+
+ m_assembler.loadConstantUnReusable(0x0, scr, true);
+ Jump m_jump = Jump(m_assembler.jmp(scr));
+ releaseScratch(scr);
+
+ return Call::fromTailJump(m_jump);
+ }
+
+ Call makeTailRecursiveCall(Jump oldJump)
+ {
+ oldJump.link(this);
+ return tailRecursiveCall();
+ }
+protected:
+ SH4Assembler::Condition SH4Condition(RelationalCondition cond)
+ {
+ return static_cast<SH4Assembler::Condition>(cond);
+ }
+
+ SH4Assembler::Condition SH4Condition(ResultCondition cond)
+ {
+ return static_cast<SH4Assembler::Condition>(cond);
+ }
+private:
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkCall(void*, Call, FunctionPtr);
+ static void repatchCall(CodeLocationCall, CodeLocationLabel);
+ static void repatchCall(CodeLocationCall, FunctionPtr);
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssemblerSH4_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
new file mode 100644
index 0000000..a1657e6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
@@ -0,0 +1,196 @@
+/*
+ * 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(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ m_assembler.leal_mr(imm.m_value, src, dest);
+ }
+
+ void add32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.addl_im(imm.m_value, address.m_ptr);
+ }
+
+ void addWithCarry32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.adcl_im(imm.m_value, address.m_ptr);
+ }
+
+ void and32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.andl_im(imm.m_value, address.m_ptr);
+ }
+
+ void or32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.orl_im(imm.m_value, address.m_ptr);
+ }
+
+ void sub32(TrustedImm32 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(TrustedImm32 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(RelationalCondition cond, AbsoluteAddress left, RegisterID right)
+ {
+ m_assembler.cmpl_rm(right, left.m_ptr);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(RelationalCondition cond, AbsoluteAddress left, TrustedImm32 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(TrustedImmPtr initialValue, RegisterID dest)
+ {
+ m_assembler.movl_i32r(initialValue.asIntptr(), dest);
+ return DataLabelPtr(this);
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ m_assembler.cmpl_ir_force32(initialRightValue.asIntptr(), left);
+ dataLabel = DataLabelPtr(this);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ m_assembler.cmpl_im_force32(initialRightValue.asIntptr(), left.offset, left.base);
+ dataLabel = DataLabelPtr(this);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
+ {
+ m_assembler.movl_i32m(initialValue.asIntptr(), address.offset, address.base);
+ return DataLabelPtr(this);
+ }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
new file mode 100644
index 0000000..8255425
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
@@ -0,0 +1,1282 @@
+/*
+ * 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 RelationalCondition {
+ 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
+ };
+
+ enum ResultCondition {
+ 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 TrustedImm32, 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(TrustedImm32 imm, Address address)
+ {
+ m_assembler.addl_im(imm.m_value, address.offset, address.base);
+ }
+
+ void add32(TrustedImm32 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(TrustedImm32 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(TrustedImm32 imm, Address address)
+ {
+ m_assembler.andl_im(imm.m_value, address.offset, address.base);
+ }
+
+ void and32(RegisterID op1, RegisterID op2, RegisterID dest)
+ {
+ if (op1 == op2)
+ zeroExtend32ToPtr(op1, dest);
+ else if (op1 == dest)
+ and32(op2, dest);
+ else {
+ move(op2, dest);
+ and32(op1, dest);
+ }
+ }
+
+ void and32(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(src, dest);
+ and32(imm, dest);
+ }
+
+ void lshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ ASSERT(shift_amount != dest);
+
+ if (shift_amount == X86Registers::ecx)
+ m_assembler.shll_CLr(dest);
+ else {
+ // 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 we dest is ecx, then shift the swapped register!
+ swap(shift_amount, X86Registers::ecx);
+ m_assembler.shll_CLr(dest == X86Registers::ecx ? shift_amount : dest);
+ swap(shift_amount, X86Registers::ecx);
+ }
+ }
+
+ void lshift32(RegisterID src, RegisterID shift_amount, RegisterID dest)
+ {
+ ASSERT(shift_amount != dest);
+
+ if (src != dest)
+ move(src, dest);
+ lshift32(shift_amount, dest);
+ }
+
+ void lshift32(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.shll_i8r(imm.m_value, dest);
+ }
+
+ void lshift32(RegisterID src, TrustedImm32 imm, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ lshift32(imm, 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(TrustedImm32 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(TrustedImm32 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(TrustedImm32 imm, Address address)
+ {
+ m_assembler.orl_im(imm.m_value, address.offset, address.base);
+ }
+
+ void or32(RegisterID op1, RegisterID op2, RegisterID dest)
+ {
+ if (op1 == op2)
+ zeroExtend32ToPtr(op1, dest);
+ else if (op1 == dest)
+ or32(op2, dest);
+ else {
+ move(op2, dest);
+ or32(op1, dest);
+ }
+ }
+
+ void or32(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(src, dest);
+ or32(imm, dest);
+ }
+
+ void rshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ ASSERT(shift_amount != dest);
+
+ if (shift_amount == X86Registers::ecx)
+ m_assembler.sarl_CLr(dest);
+ else {
+ // 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 we dest is ecx, then shift the swapped register!
+ swap(shift_amount, X86Registers::ecx);
+ m_assembler.sarl_CLr(dest == X86Registers::ecx ? shift_amount : dest);
+ swap(shift_amount, X86Registers::ecx);
+ }
+ }
+
+ void rshift32(RegisterID src, RegisterID shift_amount, RegisterID dest)
+ {
+ ASSERT(shift_amount != dest);
+
+ if (src != dest)
+ move(src, dest);
+ rshift32(shift_amount, dest);
+ }
+
+ void rshift32(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.sarl_i8r(imm.m_value, dest);
+ }
+
+ void rshift32(RegisterID src, TrustedImm32 imm, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ rshift32(imm, dest);
+ }
+
+ void urshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ ASSERT(shift_amount != dest);
+
+ if (shift_amount == X86Registers::ecx)
+ m_assembler.shrl_CLr(dest);
+ else {
+ // 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 we dest is ecx, then shift the swapped register!
+ swap(shift_amount, X86Registers::ecx);
+ m_assembler.shrl_CLr(dest == X86Registers::ecx ? shift_amount : dest);
+ swap(shift_amount, X86Registers::ecx);
+ }
+ }
+
+ void urshift32(RegisterID src, RegisterID shift_amount, RegisterID dest)
+ {
+ ASSERT(shift_amount != dest);
+
+ if (src != dest)
+ move(src, dest);
+ urshift32(shift_amount, dest);
+ }
+
+ void urshift32(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.shrl_i8r(imm.m_value, dest);
+ }
+
+ void urshift32(RegisterID src, TrustedImm32 imm, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ urshift32(imm, dest);
+ }
+
+ void sub32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.subl_rr(src, dest);
+ }
+
+ void sub32(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.subl_ir(imm.m_value, dest);
+ }
+
+ void sub32(TrustedImm32 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(TrustedImm32 imm, Address dest)
+ {
+ m_assembler.xorl_im(imm.m_value, dest.offset, dest.base);
+ }
+
+ void xor32(TrustedImm32 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 xor32(RegisterID op1, RegisterID op2, RegisterID dest)
+ {
+ if (op1 == op2)
+ move(TrustedImm32(0), dest);
+ else if (op1 == dest)
+ xor32(op2, dest);
+ else {
+ move(op2, dest);
+ xor32(op1, dest);
+ }
+ }
+
+ void xor32(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(src, dest);
+ xor32(imm, 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 TrustedImm32. 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(TrustedImm32 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 moveDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ if (src != dest)
+ m_assembler.movsd_rr(src, dest);
+ }
+
+ 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(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ if (op1 == dest)
+ addDouble(op2, dest);
+ else {
+ moveDouble(op2, dest);
+ addDouble(op1, 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(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest)
+ {
+ // B := A / B is invalid.
+ ASSERT(op1 == dest || op2 != dest);
+
+ moveDouble(op1, dest);
+ divDouble(op2, 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(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest)
+ {
+ // B := A - B is invalid.
+ ASSERT(op1 == dest || op2 != dest);
+
+ moveDouble(op1, dest);
+ subDouble(op2, 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(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ if (op1 == dest)
+ mulDouble(op2, dest);
+ else {
+ moveDouble(op2, dest);
+ mulDouble(op1, 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).
+ enum BranchTruncateType { BranchIfTruncateFailed, BranchIfTruncateSuccessful };
+ Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest, BranchTruncateType branchType = BranchIfTruncateFailed)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.cvttsd2si_rr(src, dest);
+ return branch32(branchType ? NotEqual : Equal, dest, TrustedImm32(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(TrustedImm32 imm)
+ {
+ m_assembler.push_i32(imm.m_value);
+ }
+
+
+ // Register move operations:
+ //
+ // Move values in registers.
+
+ void move(TrustedImm32 imm, RegisterID dest)
+ {
+ // Note: on 64-bit the TrustedImm32 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(TrustedImmPtr 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(TrustedImmPtr 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, TrustedImm32(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(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ m_assembler.cmpb_im(right.m_value, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, RegisterID right)
+ {
+ m_assembler.cmpl_rr(right, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 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(RelationalCondition cond, TrustedImm32 left, RegisterID right)
+ {
+ if (((cond == Equal) || (cond == NotEqual)) && !left.m_value)
+ m_assembler.testl_rr(right, right);
+ else
+ m_assembler.cmpl_ir(left.m_value, right);
+ return Jump(m_assembler.jCC(x86Condition(commute(cond))));
+ }
+
+ Jump branch32(RelationalCondition cond, RegisterID left, Address right)
+ {
+ m_assembler.cmpl_mr(right.offset, right.base, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, RegisterID right)
+ {
+ m_assembler.cmpl_rm(right, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(RelationalCondition cond, Address left, TrustedImm32 right)
+ {
+ m_assembler.cmpl_im(right.m_value, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(RelationalCondition cond, BaseIndex left, TrustedImm32 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(RelationalCondition cond, BaseIndex left, TrustedImm32 right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branch16(RelationalCondition 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(RelationalCondition cond, BaseIndex left, TrustedImm32 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(ResultCondition cond, RegisterID reg, RegisterID mask)
+ {
+ m_assembler.testl_rr(reg, mask);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest32(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-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.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(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ 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(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ 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(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values.
+ ASSERT(mask.m_value >= -128 && mask.m_value <= 255);
+ if (mask.m_value == -1)
+ m_assembler.testb_rr(reg, reg);
+ else
+ m_assembler.testb_i8r(mask.m_value, reg);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values.
+ ASSERT(mask.m_value >= -128 && mask.m_value <= 255);
+ 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(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values.
+ ASSERT(mask.m_value >= -128 && mask.m_value <= 255);
+ 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(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ add32(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(ResultCondition cond, TrustedImm32 src, Address dest)
+ {
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(ResultCondition cond, RegisterID src, Address dest)
+ {
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(ResultCondition cond, Address src, RegisterID dest)
+ {
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest)
+ {
+ if (src1 == dest)
+ return branchAdd32(cond, src2, dest);
+ move(src2, dest);
+ return branchAdd32(cond, src1, dest);
+ }
+
+ Jump branchAdd32(ResultCondition cond, RegisterID src, TrustedImm32 imm, RegisterID dest)
+ {
+ move(src, dest);
+ return branchAdd32(cond, imm, dest);
+ }
+
+ Jump branchMul32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ mul32(src, dest);
+ if (cond != Overflow)
+ m_assembler.testl_rr(dest, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchMul32(ResultCondition cond, Address src, RegisterID dest)
+ {
+ mul32(src, dest);
+ if (cond != Overflow)
+ m_assembler.testl_rr(dest, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchMul32(ResultCondition cond, TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ mul32(imm, src, dest);
+ if (cond != Overflow)
+ m_assembler.testl_rr(dest, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchMul32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest)
+ {
+ if (src1 == dest)
+ return branchMul32(cond, src2, dest);
+ move(src2, dest);
+ return branchMul32(cond, src1, dest);
+ }
+
+ Jump branchSub32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ sub32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ sub32(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(ResultCondition cond, TrustedImm32 imm, Address dest)
+ {
+ sub32(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(ResultCondition cond, RegisterID src, Address dest)
+ {
+ sub32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(ResultCondition cond, Address src, RegisterID dest)
+ {
+ sub32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest)
+ {
+ // B := A - B is invalid.
+ ASSERT(src1 == dest || src2 != dest);
+
+ move(src1, dest);
+ return branchSub32(cond, src2, dest);
+ }
+
+ Jump branchSub32(ResultCondition cond, RegisterID src1, TrustedImm32 src2, RegisterID dest)
+ {
+ move(src1, dest);
+ return branchSub32(cond, src2, dest);
+ }
+
+ Jump branchNeg32(ResultCondition cond, RegisterID srcDest)
+ {
+ neg32(srcDest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchOr32(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ 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 compare32(RelationalCondition 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 compare32(RelationalCondition cond, RegisterID left, TrustedImm32 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 test8(ResultCondition cond, Address address, TrustedImm32 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 test32(ResultCondition cond, Address address, TrustedImm32 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);
+ }
+
+ // Invert a relational condition, e.g. == becomes !=, < becomes >=, etc.
+ static RelationalCondition invert(RelationalCondition cond)
+ {
+ return static_cast<RelationalCondition>(cond ^ 1);
+ }
+
+ // Commute a relational condition, returns a new condition that will produce
+ // the same results given the same inputs but with their positions exchanged.
+ static RelationalCondition commute(RelationalCondition cond)
+ {
+ // Equality is commutative!
+ if (cond == Equal || cond == NotEqual)
+ return cond;
+
+ // Based on the values of x86 condition codes, remap > with < and >= with <=
+ if (cond >= LessThan) {
+ ASSERT(cond == LessThan || cond == LessThanOrEqual || cond == GreaterThan || cond == GreaterThanOrEqual);
+ return static_cast<RelationalCondition>(X86Assembler::ConditionL + X86Assembler::ConditionG - cond);
+ }
+
+ // As above, for unsigned conditions.
+ ASSERT(cond == Below || cond == BelowOrEqual || cond == Above || cond == AboveOrEqual);
+ return static_cast<RelationalCondition>(X86Assembler::ConditionB + X86Assembler::ConditionA - cond);
+ }
+
+protected:
+ X86Assembler::Condition x86Condition(RelationalCondition cond)
+ {
+ return static_cast<X86Assembler::Condition>(cond);
+ }
+
+ X86Assembler::Condition x86Condition(ResultCondition 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
new file mode 100644
index 0000000..4cd02c8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
@@ -0,0 +1,482 @@
+/*
+ * 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::addDouble;
+ using MacroAssemblerX86Common::loadDouble;
+ using MacroAssemblerX86Common::convertInt32ToDouble;
+
+ void add32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ move(TrustedImmPtr(address.m_ptr), scratchRegister);
+ add32(imm, Address(scratchRegister));
+ }
+
+ void and32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ move(TrustedImmPtr(address.m_ptr), scratchRegister);
+ and32(imm, Address(scratchRegister));
+ }
+
+ void or32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ move(TrustedImmPtr(address.m_ptr), scratchRegister);
+ or32(imm, Address(scratchRegister));
+ }
+
+ void sub32(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ move(TrustedImmPtr(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(TrustedImmPtr(address), scratchRegister);
+ loadDouble(scratchRegister, dest);
+ }
+
+ void addDouble(AbsoluteAddress address, FPRegisterID dest)
+ {
+ move(TrustedImmPtr(address.m_ptr), scratchRegister);
+ m_assembler.addsd_mr(0, scratchRegister, dest);
+ }
+
+ void convertInt32ToDouble(TrustedImm32 imm, FPRegisterID dest)
+ {
+ move(imm, scratchRegister);
+ m_assembler.cvtsi2sd_rr(scratchRegister, dest);
+ }
+
+ void store32(TrustedImm32 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(TrustedImmPtr(0), scratchRegister);
+ Call result = Call(m_assembler.call(scratchRegister), Call::Linkable);
+ ASSERT_UNUSED(label, differenceBetween(label, result) == REPTACH_OFFSET_CALL_R11);
+ return result;
+ }
+
+ Call tailRecursiveCall()
+ {
+ DataLabelPtr label = moveWithPatch(TrustedImmPtr(0), scratchRegister);
+ Jump newJump = Jump(m_assembler.jmp_r(scratchRegister));
+ ASSERT_UNUSED(label, differenceBetween(label, newJump) == REPTACH_OFFSET_CALL_R11);
+ return Call::fromTailJump(newJump);
+ }
+
+ Call makeTailRecursiveCall(Jump oldJump)
+ {
+ oldJump.link(this);
+ DataLabelPtr label = moveWithPatch(TrustedImmPtr(0), scratchRegister);
+ Jump newJump = Jump(m_assembler.jmp_r(scratchRegister));
+ ASSERT_UNUSED(label, 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(TrustedImm32 imm, RegisterID srcDest)
+ {
+ m_assembler.addq_ir(imm.m_value, srcDest);
+ }
+
+ void addPtr(TrustedImmPtr imm, RegisterID dest)
+ {
+ move(imm, scratchRegister);
+ m_assembler.addq_rr(scratchRegister, dest);
+ }
+
+ void addPtr(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ m_assembler.leaq_mr(imm.m_value, src, dest);
+ }
+
+ void addPtr(TrustedImm32 imm, Address address)
+ {
+ m_assembler.addq_im(imm.m_value, address.offset, address.base);
+ }
+
+ void addPtr(TrustedImm32 imm, AbsoluteAddress address)
+ {
+ move(TrustedImmPtr(address.m_ptr), scratchRegister);
+ addPtr(imm, Address(scratchRegister));
+ }
+
+ void andPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.andq_rr(src, dest);
+ }
+
+ void andPtr(TrustedImm32 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(TrustedImmPtr imm, RegisterID dest)
+ {
+ move(imm, scratchRegister);
+ m_assembler.orq_rr(scratchRegister, dest);
+ }
+
+ void orPtr(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.orq_ir(imm.m_value, dest);
+ }
+
+ void orPtr(RegisterID op1, RegisterID op2, RegisterID dest)
+ {
+ if (op1 == op2)
+ move(op1, dest);
+ else if (op1 == dest)
+ orPtr(op2, dest);
+ else {
+ move(op2, dest);
+ orPtr(op1, dest);
+ }
+ }
+
+ void orPtr(TrustedImm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(src, dest);
+ orPtr(imm, dest);
+ }
+
+ void subPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.subq_rr(src, dest);
+ }
+
+ void subPtr(TrustedImm32 imm, RegisterID dest)
+ {
+ m_assembler.subq_ir(imm.m_value, dest);
+ }
+
+ void subPtr(TrustedImmPtr 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(TrustedImm32 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(const 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(TrustedImmPtr 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 comparePtr(RelationalCondition cond, RegisterID left, TrustedImm32 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(RelationalCondition cond, RegisterID left, RegisterID right)
+ {
+ m_assembler.cmpq_rr(right, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtr(RelationalCondition cond, RegisterID left, TrustedImmPtr right)
+ {
+ move(right, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ Jump branchPtr(RelationalCondition cond, RegisterID left, Address right)
+ {
+ m_assembler.cmpq_mr(right.offset, right.base, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtr(RelationalCondition cond, AbsoluteAddress left, RegisterID right)
+ {
+ move(TrustedImmPtr(left.m_ptr), scratchRegister);
+ return branchPtr(cond, Address(scratchRegister), right);
+ }
+
+ Jump branchPtr(RelationalCondition cond, Address left, RegisterID right)
+ {
+ m_assembler.cmpq_rm(right, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtr(RelationalCondition cond, Address left, TrustedImmPtr right)
+ {
+ move(right, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ Jump branchTestPtr(ResultCondition cond, RegisterID reg, RegisterID mask)
+ {
+ m_assembler.testq_rr(reg, mask);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTestPtr(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-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(ResultCondition cond, AbsoluteAddress address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ loadPtr(address.m_ptr, scratchRegister);
+ return branchTestPtr(cond, scratchRegister, mask);
+ }
+
+ Jump branchTestPtr(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-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(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-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(ResultCondition cond, RegisterID src, RegisterID dest)
+ {
+ addPtr(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSubPtr(ResultCondition cond, TrustedImm32 imm, RegisterID dest)
+ {
+ subPtr(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
+ {
+ m_assembler.movq_i64r(initialValue.asIntptr(), dest);
+ return DataLabelPtr(this);
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ Jump branchPtrWithPatch(RelationalCondition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
+ {
+ DataLabelPtr label = moveWithPatch(initialValue, scratchRegister);
+ storePtr(scratchRegister, address);
+ return label;
+ }
+
+ using MacroAssemblerX86Common::branchTest8;
+ Jump branchTest8(ResultCondition cond, ExtendedAddress address, TrustedImm32 mask = TrustedImm32(-1))
+ {
+ TrustedImmPtr addr(reinterpret_cast<void*>(address.offset));
+ MacroAssemblerX86Common::move(addr, scratchRegister);
+ return MacroAssemblerX86Common::branchTest8(cond, BaseIndex(scratchRegister, address.base, TimesOne), mask);
+ }
+
+ 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, call.m_jmp.labelAtOffset(-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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/RepatchBuffer.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/RepatchBuffer.h
new file mode 100644
index 0000000..e9feb65
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/RepatchBuffer.h
@@ -0,0 +1,129 @@
+/*
+ * 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 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/src/3rdparty/webkit/Source/JavaScriptCore/assembler/SH4Assembler.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/SH4Assembler.h
new file mode 100644
index 0000000..44304c0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/SH4Assembler.h
@@ -0,0 +1,2005 @@
+/*
+ * Copyright (C) 2009-2011 STMicroelectronics. All rights reserved.
+ * 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 SH4Assembler_h
+#define SH4Assembler_h
+
+#if ENABLE(ASSEMBLER) && CPU(SH4)
+
+#include "AssemblerBuffer.h"
+#include "AssemblerBufferWithConstantPool.h"
+#include <stdarg.h>
+#include <stdint.h>
+#include <wtf/Assertions.h>
+#include <wtf/Vector.h>
+
+#ifndef NDEBUG
+#define SH4_ASSEMBLER_TRACING
+#endif
+
+namespace JSC {
+typedef uint16_t SH4Word;
+
+enum {
+ INVALID_OPCODE = 0xffff,
+ ADD_OPCODE = 0x300c,
+ ADDIMM_OPCODE = 0x7000,
+ ADDC_OPCODE = 0x300e,
+ ADDV_OPCODE = 0x300f,
+ AND_OPCODE = 0x2009,
+ ANDIMM_OPCODE = 0xc900,
+ DIV0_OPCODE = 0x2007,
+ DIV1_OPCODE = 0x3004,
+ BF_OPCODE = 0x8b00,
+ BFS_OPCODE = 0x8f00,
+ BRA_OPCODE = 0xa000,
+ BRAF_OPCODE = 0x0023,
+ NOP_OPCODE = 0x0009,
+ BSR_OPCODE = 0xb000,
+ RTS_OPCODE = 0x000b,
+ BT_OPCODE = 0x8900,
+ BTS_OPCODE = 0x8d00,
+ BSRF_OPCODE = 0x0003,
+ BRK_OPCODE = 0x003b,
+ FTRC_OPCODE = 0xf03d,
+ CMPEQ_OPCODE = 0x3000,
+ CMPEQIMM_OPCODE = 0x8800,
+ CMPGE_OPCODE = 0x3003,
+ CMPGT_OPCODE = 0x3007,
+ CMPHI_OPCODE = 0x3006,
+ CMPHS_OPCODE = 0x3002,
+ CMPPL_OPCODE = 0x4015,
+ CMPPZ_OPCODE = 0x4011,
+ CMPSTR_OPCODE = 0x200c,
+ DT_OPCODE = 0x4010,
+ FCMPEQ_OPCODE = 0xf004,
+ FCMPGT_OPCODE = 0xf005,
+ FMOV_OPCODE = 0xf00c,
+ FADD_OPCODE = 0xf000,
+ FMUL_OPCODE = 0xf002,
+ FSUB_OPCODE = 0xf001,
+ FDIV_OPCODE = 0xf003,
+ FNEG_OPCODE = 0xf04d,
+ JMP_OPCODE = 0x402b,
+ JSR_OPCODE = 0x400b,
+ LDSPR_OPCODE = 0x402a,
+ LDSLPR_OPCODE = 0x4026,
+ MOV_OPCODE = 0x6003,
+ MOVIMM_OPCODE = 0xe000,
+ MOVB_WRITE_RN_OPCODE = 0x2000,
+ MOVB_WRITE_RNDEC_OPCODE = 0x2004,
+ MOVB_WRITE_R0RN_OPCODE = 0x0004,
+ MOVB_WRITE_OFFGBR_OPCODE = 0xc000,
+ MOVB_WRITE_OFFRN_OPCODE = 0x8000,
+ MOVB_READ_RM_OPCODE = 0x6000,
+ MOVB_READ_RMINC_OPCODE = 0x6004,
+ MOVB_READ_R0RM_OPCODE = 0x000c,
+ MOVB_READ_OFFGBR_OPCODE = 0xc400,
+ MOVB_READ_OFFRM_OPCODE = 0x8400,
+ MOVL_WRITE_RN_OPCODE = 0x2002,
+ MOVL_WRITE_RNDEC_OPCODE = 0x2006,
+ MOVL_WRITE_R0RN_OPCODE = 0x0006,
+ MOVL_WRITE_OFFGBR_OPCODE = 0xc200,
+ MOVL_WRITE_OFFRN_OPCODE = 0x1000,
+ MOVL_READ_RM_OPCODE = 0x6002,
+ MOVL_READ_RMINC_OPCODE = 0x6006,
+ MOVL_READ_R0RM_OPCODE = 0x000e,
+ MOVL_READ_OFFGBR_OPCODE = 0xc600,
+ MOVL_READ_OFFPC_OPCODE = 0xd000,
+ MOVL_READ_OFFRM_OPCODE = 0x5000,
+ MOVW_WRITE_RN_OPCODE = 0x2001,
+ MOVW_READ_RM_OPCODE = 0x6001,
+ MOVW_READ_R0RM_OPCODE = 0x000d,
+ MOVW_READ_OFFRM_OPCODE = 0x8500,
+ MOVW_READ_OFFPC_OPCODE = 0x9000,
+ MOVA_READ_OFFPC_OPCODE = 0xc700,
+ MOVT_OPCODE = 0x0029,
+ MULL_OPCODE = 0x0007,
+ DMULL_L_OPCODE = 0x3005,
+ STSMACL_OPCODE = 0x001a,
+ STSMACH_OPCODE = 0x000a,
+ DMULSL_OPCODE = 0x300d,
+ NEG_OPCODE = 0x600b,
+ NEGC_OPCODE = 0x600a,
+ NOT_OPCODE = 0x6007,
+ OR_OPCODE = 0x200b,
+ ORIMM_OPCODE = 0xcb00,
+ ORBIMM_OPCODE = 0xcf00,
+ SETS_OPCODE = 0x0058,
+ SETT_OPCODE = 0x0018,
+ SHAD_OPCODE = 0x400c,
+ SHAL_OPCODE = 0x4020,
+ SHAR_OPCODE = 0x4021,
+ SHLD_OPCODE = 0x400d,
+ SHLL_OPCODE = 0x4000,
+ SHLL2_OPCODE = 0x4008,
+ SHLL8_OPCODE = 0x4018,
+ SHLL16_OPCODE = 0x4028,
+ SHLR_OPCODE = 0x4001,
+ SHLR2_OPCODE = 0x4009,
+ SHLR8_OPCODE = 0x4019,
+ SHLR16_OPCODE = 0x4029,
+ STSPR_OPCODE = 0x002a,
+ STSLPR_OPCODE = 0x4022,
+ FLOAT_OPCODE = 0xf02d,
+ SUB_OPCODE = 0x3008,
+ SUBC_OPCODE = 0x300a,
+ SUBV_OPCODE = 0x300b,
+ TST_OPCODE = 0x2008,
+ TSTIMM_OPCODE = 0xc800,
+ TSTB_OPCODE = 0xcc00,
+ EXTUW_OPCODE = 0x600d,
+ XOR_OPCODE = 0x200a,
+ XORIMM_OPCODE = 0xca00,
+ XORB_OPCODE = 0xce00,
+ FMOVS_READ_RM_INC_OPCODE = 0xf009,
+ FMOVS_READ_RM_OPCODE = 0xf008,
+ FMOVS_READ_R0RM_OPCODE = 0xf006,
+ FMOVS_WRITE_RN_OPCODE = 0xf00a,
+ FMOVS_WRITE_RN_DEC_OPCODE = 0xf00b,
+ FMOVS_WRITE_R0RN_OPCODE = 0xf007,
+ FCNVDS_DRM_FPUL_OPCODE = 0xf0bd,
+ LDS_RM_FPUL_OPCODE = 0x405a,
+ FLDS_FRM_FPUL_OPCODE = 0xf01d,
+ STS_FPUL_RN_OPCODE = 0x005a,
+ FSTS_FPUL_FRN_OPCODE = 0xF00d,
+ LDSFPSCR_OPCODE = 0x406a,
+ STSFPSCR_OPCODE = 0x006a,
+ LDSRMFPUL_OPCODE = 0x405a,
+ FSTSFPULFRN_OPCODE = 0xf00d,
+ FSQRT_OPCODE = 0xf06d,
+ FSCHG_OPCODE = 0xf3fd,
+ CLRT_OPCODE = 8,
+};
+
+namespace SH4Registers {
+typedef enum {
+ r0,
+ r1,
+ r2,
+ r3,
+ r4,
+ r5,
+ r6,
+ r7,
+ r8,
+ r9,
+ r10,
+ r11,
+ r12,
+ r13,
+ r14, fp = r14,
+ r15, sp = r15,
+ pc,
+ pr,
+} RegisterID;
+
+typedef enum {
+ fr0, dr0 = fr0,
+ fr1,
+ fr2, dr2 = fr2,
+ fr3,
+ fr4, dr4 = fr4,
+ fr5,
+ fr6, dr6 = fr6,
+ fr7,
+ fr8, dr8 = fr8,
+ fr9,
+ fr10, dr10 = fr10,
+ fr11,
+ fr12, dr12 = fr12,
+ fr13,
+ fr14, dr14 = fr14,
+ fr15,
+} FPRegisterID;
+}
+
+inline uint16_t getOpcodeGroup1(uint16_t opc, int rm, int rn)
+{
+ return (opc | ((rm & 0xf) << 8) | ((rn & 0xf) << 4));
+}
+
+inline uint16_t getOpcodeGroup2(uint16_t opc, int rm)
+{
+ return (opc | ((rm & 0xf) << 8));
+}
+
+inline uint16_t getOpcodeGroup3(uint16_t opc, int rm, int rn)
+{
+ return (opc | ((rm & 0xf) << 8) | (rn & 0xff));
+}
+
+inline uint16_t getOpcodeGroup4(uint16_t opc, int rm, int rn, int offset)
+{
+ return (opc | ((rm & 0xf) << 8) | ((rn & 0xf) << 4) | (offset & 0xf));
+}
+
+inline uint16_t getOpcodeGroup5(uint16_t opc, int rm)
+{
+ return (opc | (rm & 0xff));
+}
+
+inline uint16_t getOpcodeGroup6(uint16_t opc, int rm)
+{
+ return (opc | (rm & 0xfff));
+}
+
+inline uint16_t getOpcodeGroup7(uint16_t opc, int rm)
+{
+ return (opc | ((rm & 0x7) << 9));
+}
+
+inline uint16_t getOpcodeGroup8(uint16_t opc, int rm, int rn)
+{
+ return (opc | ((rm & 0x7) << 9) | ((rn & 0x7) << 5));
+}
+
+inline uint16_t getOpcodeGroup9(uint16_t opc, int rm, int rn)
+{
+ return (opc | ((rm & 0xf) << 8) | ((rn & 0x7) << 5));
+}
+
+inline uint16_t getOpcodeGroup10(uint16_t opc, int rm, int rn)
+{
+ return (opc | ((rm & 0x7) << 9) | ((rn & 0xf) << 4));
+}
+
+inline uint16_t getOpcodeGroup11(uint16_t opc, int rm, int rn)
+{
+ return (opc | ((rm & 0xf) << 4) | (rn & 0xf));
+}
+
+inline uint16_t getRn(uint16_t x)
+{
+ return ((x & 0xf00) >> 8);
+}
+
+inline uint16_t getRm(uint16_t x)
+{
+ return ((x & 0xf0) >> 4);
+}
+
+inline uint16_t getDisp(uint16_t x)
+{
+ return (x & 0xf);
+}
+
+inline uint16_t getImm8(uint16_t x)
+{
+ return (x & 0xff);
+}
+
+inline uint16_t getImm12(uint16_t x)
+{
+ return (x & 0xfff);
+}
+
+inline uint16_t getDRn(uint16_t x)
+{
+ return ((x & 0xe00) >> 9);
+}
+
+inline uint16_t getDRm(uint16_t x)
+{
+ return ((x & 0xe0) >> 5);
+}
+
+class SH4Assembler {
+public:
+ typedef SH4Registers::RegisterID RegisterID;
+ typedef SH4Registers::FPRegisterID FPRegisterID;
+ typedef AssemblerBufferWithConstantPool<512, 4, 2, SH4Assembler> SH4Buffer;
+ static const RegisterID scratchReg1 = SH4Registers::r3;
+ static const RegisterID scratchReg2 = SH4Registers::r11;
+ static const uint32_t maxInstructionSize = 16;
+
+ enum {
+ padForAlign8 = 0x00,
+ padForAlign16 = 0x0009,
+ padForAlign32 = 0x00090009,
+ };
+
+ SH4Assembler()
+ {
+ m_claimscratchReg = 0x0;
+ }
+
+ // SH4 condition codes
+ typedef enum {
+ EQ = 0x0, // Equal
+ NE = 0x1, // Not Equal
+ HS = 0x2, // Unsigend Greater Than equal
+ HI = 0x3, // Unsigend Greater Than
+ LS = 0x4, // Unsigend Lower or Same
+ LI = 0x5, // Unsigend Lower
+ GE = 0x6, // Greater or Equal
+ LT = 0x7, // Less Than
+ GT = 0x8, // Greater Than
+ LE = 0x9, // Less or Equal
+ OF = 0xa, // OverFlow
+ SI = 0xb, // Signed
+ EQU= 0xc, // Equal or unordered(NaN)
+ NEU= 0xd,
+ GTU= 0xe,
+ GEU= 0xf,
+ LTU= 0x10,
+ LEU= 0x11,
+ } Condition;
+
+ // Opaque label types
+public:
+ bool isImmediate(int constant)
+ {
+ return ((constant <= 127) && (constant >= -128));
+ }
+
+ RegisterID claimScratch()
+ {
+ ASSERT((m_claimscratchReg != 0x3));
+
+ if (!(m_claimscratchReg & 0x1)) {
+ m_claimscratchReg = (m_claimscratchReg | 0x1);
+ return scratchReg1;
+ }
+
+ m_claimscratchReg = (m_claimscratchReg | 0x2);
+ return scratchReg2;
+ }
+
+ void releaseScratch(RegisterID scratchR)
+ {
+ if (scratchR == scratchReg1)
+ m_claimscratchReg = (m_claimscratchReg & 0x2);
+ else
+ m_claimscratchReg = (m_claimscratchReg & 0x1);
+ }
+
+ // Stack operations
+
+ void pushReg(RegisterID reg)
+ {
+ if (reg == SH4Registers::pr) {
+ oneShortOp(getOpcodeGroup2(STSLPR_OPCODE, SH4Registers::sp));
+ return;
+ }
+
+ oneShortOp(getOpcodeGroup1(MOVL_WRITE_RNDEC_OPCODE, SH4Registers::sp, reg));
+ }
+
+ void popReg(RegisterID reg)
+ {
+ if (reg == SH4Registers::pr) {
+ oneShortOp(getOpcodeGroup2(LDSLPR_OPCODE, SH4Registers::sp));
+ return;
+ }
+
+ oneShortOp(getOpcodeGroup1(MOVL_READ_RMINC_OPCODE, reg, SH4Registers::sp));
+ }
+
+ void movt(RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup2(MOVT_OPCODE, dst);
+ oneShortOp(opc);
+ }
+
+ // Arithmetic operations
+
+ void addlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(ADD_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void addclRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(ADDC_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void addvlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(ADDV_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void addlImm8r(int imm8, RegisterID dst)
+ {
+ ASSERT((imm8 <= 127) && (imm8 >= -128));
+
+ uint16_t opc = getOpcodeGroup3(ADDIMM_OPCODE, dst, imm8);
+ oneShortOp(opc);
+ }
+
+ void andlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(AND_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void andlImm8r(int imm8, RegisterID dst)
+ {
+ ASSERT((imm8 <= 255) && (imm8 >= 0));
+ ASSERT(dst == SH4Registers::r0);
+
+ uint16_t opc = getOpcodeGroup5(ANDIMM_OPCODE, imm8);
+ oneShortOp(opc);
+ }
+
+ void div1lRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(DIV1_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void div0lRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(DIV0_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void notlReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(NOT_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void orlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(OR_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void orlImm8r(int imm8, RegisterID dst)
+ {
+ ASSERT((imm8 <= 255) && (imm8 >= 0));
+ ASSERT(dst == SH4Registers::r0);
+
+ uint16_t opc = getOpcodeGroup5(ORIMM_OPCODE, imm8);
+ oneShortOp(opc);
+ }
+
+ void sublRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(SUB_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void subvlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(SUBV_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void xorlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(XOR_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void xorlImm8r(int imm8, RegisterID dst)
+ {
+ ASSERT((imm8 <= 255) && (imm8 >= 0));
+ ASSERT(dst == SH4Registers::r0);
+
+ uint16_t opc = getOpcodeGroup5(XORIMM_OPCODE, imm8);
+ oneShortOp(opc);
+ }
+
+ void shllImm8r(int imm, RegisterID dst)
+ {
+ switch (imm) {
+ case 1:
+ oneShortOp(getOpcodeGroup2(SHLL_OPCODE, dst));
+ break;
+ case 2:
+ oneShortOp(getOpcodeGroup2(SHLL2_OPCODE, dst));
+ break;
+ case 8:
+ oneShortOp(getOpcodeGroup2(SHLL8_OPCODE, dst));
+ break;
+ case 16:
+ oneShortOp(getOpcodeGroup2(SHLL16_OPCODE, dst));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ void neg(RegisterID dst, RegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup1(NEG_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void shllRegReg(RegisterID dst, RegisterID rShift)
+ {
+ uint16_t opc = getOpcodeGroup1(SHLD_OPCODE, dst, rShift);
+ oneShortOp(opc);
+ }
+
+ void shlrRegReg(RegisterID dst, RegisterID rShift)
+ {
+ neg(rShift, rShift);
+ shllRegReg(dst, rShift);
+ }
+
+ void sharRegReg(RegisterID dst, RegisterID rShift)
+ {
+ neg(rShift, rShift);
+ shaRegReg(dst, rShift);
+ }
+
+ void shaRegReg(RegisterID dst, RegisterID rShift)
+ {
+ uint16_t opc = getOpcodeGroup1(SHAD_OPCODE, dst, rShift);
+ oneShortOp(opc);
+ }
+
+ void shlrImm8r(int imm, RegisterID dst)
+ {
+ switch (imm) {
+ case 1:
+ oneShortOp(getOpcodeGroup2(SHLR_OPCODE, dst));
+ break;
+ case 2:
+ oneShortOp(getOpcodeGroup2(SHLR2_OPCODE, dst));
+ break;
+ case 8:
+ oneShortOp(getOpcodeGroup2(SHLR8_OPCODE, dst));
+ break;
+ case 16:
+ oneShortOp(getOpcodeGroup2(SHLR16_OPCODE, dst));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ void imullRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MULL_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void dmullRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(DMULL_L_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void dmulslRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(DMULSL_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void stsmacl(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(STSMACL_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ void stsmach(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(STSMACH_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ // Comparisons
+
+ void cmplRegReg(RegisterID left, RegisterID right, Condition cond)
+ {
+ switch (cond) {
+ case NE:
+ oneShortOp(getOpcodeGroup1(CMPEQ_OPCODE, right, left));
+ break;
+ case GT:
+ oneShortOp(getOpcodeGroup1(CMPGT_OPCODE, right, left));
+ break;
+ case EQ:
+ oneShortOp(getOpcodeGroup1(CMPEQ_OPCODE, right, left));
+ break;
+ case GE:
+ oneShortOp(getOpcodeGroup1(CMPGE_OPCODE, right, left));
+ break;
+ case HS:
+ oneShortOp(getOpcodeGroup1(CMPHS_OPCODE, right, left));
+ break;
+ case HI:
+ oneShortOp(getOpcodeGroup1(CMPHI_OPCODE, right, left));
+ break;
+ case LI:
+ oneShortOp(getOpcodeGroup1(CMPHI_OPCODE, left, right));
+ break;
+ case LS:
+ oneShortOp(getOpcodeGroup1(CMPHS_OPCODE, left, right));
+ break;
+ case LE:
+ oneShortOp(getOpcodeGroup1(CMPGE_OPCODE, left, right));
+ break;
+ case LT:
+ oneShortOp(getOpcodeGroup1(CMPGT_OPCODE, left, right));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ void cmppl(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(CMPPL_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ void cmppz(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(CMPPZ_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ void cmpEqImmR0(int imm, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup5(CMPEQIMM_OPCODE, imm);
+ oneShortOp(opc);
+ }
+
+ void testlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(TST_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void testlImm8r(int imm, RegisterID dst)
+ {
+ ASSERT((dst == SH4Registers::r0) && (imm <= 255) && (imm >= 0));
+
+ uint16_t opc = getOpcodeGroup5(TSTIMM_OPCODE, imm);
+ oneShortOp(opc);
+ }
+
+ void nop()
+ {
+ oneShortOp(NOP_OPCODE, false);
+ }
+
+ void sett()
+ {
+ oneShortOp(SETT_OPCODE);
+ }
+
+ void clrt()
+ {
+ oneShortOp(CLRT_OPCODE);
+ }
+
+ void fschg()
+ {
+ oneShortOp(FSCHG_OPCODE);
+ }
+
+ void bkpt()
+ {
+ oneShortOp(BRK_OPCODE, false);
+ }
+
+ void branch(uint16_t opc, int label)
+ {
+ switch (opc) {
+ case BT_OPCODE:
+ ASSERT((label <= 127) && (label >= -128));
+ oneShortOp(getOpcodeGroup5(BT_OPCODE, label));
+ break;
+ case BRA_OPCODE:
+ ASSERT((label <= 2047) && (label >= -2048));
+ oneShortOp(getOpcodeGroup6(BRA_OPCODE, label));
+ break;
+ case BF_OPCODE:
+ ASSERT((label <= 127) && (label >= -128));
+ oneShortOp(getOpcodeGroup5(BF_OPCODE, label));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ void branch(uint16_t opc, RegisterID reg)
+ {
+ switch (opc) {
+ case BRAF_OPCODE:
+ oneShortOp(getOpcodeGroup2(BRAF_OPCODE, reg));
+ break;
+ case JMP_OPCODE:
+ oneShortOp(getOpcodeGroup2(JMP_OPCODE, reg));
+ break;
+ case JSR_OPCODE:
+ oneShortOp(getOpcodeGroup2(JSR_OPCODE, reg));
+ break;
+ case BSRF_OPCODE:
+ oneShortOp(getOpcodeGroup2(BSRF_OPCODE, reg));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ void ldspr(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(LDSPR_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ void stspr(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(STSPR_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ void extuw(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(EXTUW_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ // float operations
+
+ void ldsrmfpul(RegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup2(LDS_RM_FPUL_OPCODE, src);
+ oneShortOp(opc);
+ }
+
+ void fneg(FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup2(FNEG_OPCODE, dst);
+ oneShortOp(opc, true, false);
+ }
+
+ void fsqrt(FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup2(FSQRT_OPCODE, dst);
+ oneShortOp(opc, true, false);
+ }
+
+ void stsfpulReg(RegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup2(STS_FPUL_RN_OPCODE, src);
+ oneShortOp(opc);
+ }
+
+ void floatfpulfrn(RegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup2(FLOAT_OPCODE, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fmull(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(FMUL_OPCODE, dst, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fmovsReadrm(RegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(FMOVS_READ_RM_OPCODE, dst, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fmovsWriterm(FPRegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(FMOVS_WRITE_RN_OPCODE, dst, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fmovsWriter0r(FPRegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(FMOVS_WRITE_R0RN_OPCODE, dst, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fmovsReadr0r(RegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(FMOVS_READ_R0RM_OPCODE, dst, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fmovsReadrminc(RegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(FMOVS_READ_RM_INC_OPCODE, dst, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fmovsWriterndec(FPRegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(FMOVS_WRITE_RN_DEC_OPCODE, dst, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void ftrcRegfpul(FPRegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup2(FTRC_OPCODE, src);
+ oneShortOp(opc, true, false);
+ }
+
+ void fldsfpul(RegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup2(FLDS_FRM_FPUL_OPCODE, src);
+ oneShortOp(opc);
+ }
+
+ void fstsfpul(RegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup2(FSTS_FPUL_FRN_OPCODE, src);
+ oneShortOp(opc);
+ }
+
+ void ldsfpscr(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(LDSFPSCR_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ void stsfpscr(RegisterID reg)
+ {
+ uint16_t opc = getOpcodeGroup2(STSFPSCR_OPCODE, reg);
+ oneShortOp(opc);
+ }
+
+ // double operations
+
+ void dcnvds(FPRegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup7(FCNVDS_DRM_FPUL_OPCODE, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void dcmppeq(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup8(FCMPEQ_OPCODE, dst >> 1, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void dcmppgt(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup8(FCMPGT_OPCODE, dst >> 1, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void dmulRegReg(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup8(FMUL_OPCODE, dst >> 1, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void dsubRegReg(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup8(FSUB_OPCODE, dst >> 1, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void daddRegReg(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup8(FADD_OPCODE, dst >> 1, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void dmovRegReg(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup8(FMOV_OPCODE, dst >> 1, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void ddivRegReg(FPRegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup8(FDIV_OPCODE, dst >> 1, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void dsqrt(FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup7(FSQRT_OPCODE, dst >> 1);
+ oneShortOp(opc);
+ }
+
+ void dneg(FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup7(FNEG_OPCODE, dst >> 1);
+ oneShortOp(opc);
+ }
+
+ void fmovReadrm(RegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup10(FMOVS_READ_RM_OPCODE, dst >> 1, src);
+ oneShortOp(opc);
+ }
+
+ void fmovWriterm(FPRegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup9(FMOVS_WRITE_RN_OPCODE, dst, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void fmovWriter0r(FPRegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup9(FMOVS_WRITE_R0RN_OPCODE, dst, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void fmovReadr0r(RegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup10(FMOVS_READ_R0RM_OPCODE, dst >> 1, src);
+ oneShortOp(opc);
+ }
+
+ void fmovReadrminc(RegisterID src, FPRegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup10(FMOVS_READ_RM_INC_OPCODE, dst >> 1, src);
+ oneShortOp(opc);
+ }
+
+ void fmovWriterndec(FPRegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup9(FMOVS_WRITE_RN_DEC_OPCODE, dst, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void floatfpulDreg(FPRegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup7(FLOAT_OPCODE, src >> 1);
+ oneShortOp(opc);
+ }
+
+ void ftrcdrmfpul(FPRegisterID src)
+ {
+ uint16_t opc = getOpcodeGroup7(FTRC_OPCODE, src >> 1);
+ oneShortOp(opc);
+ }
+
+ // Various move ops
+
+ void movImm8(int imm8, RegisterID dst)
+ {
+ ASSERT((imm8 <= 127) && (imm8 >= -128));
+
+ uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, imm8);
+ oneShortOp(opc);
+ }
+
+ void movlRegReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOV_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movwRegMem(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVW_WRITE_RN_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movwMemReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVW_READ_RM_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movwPCReg(int offset, RegisterID base, RegisterID dst)
+ {
+ ASSERT(base == SH4Registers::pc);
+ ASSERT((offset <= 255) && (offset >= 0));
+
+ uint16_t opc = getOpcodeGroup3(MOVW_READ_OFFPC_OPCODE, dst, offset);
+ oneShortOp(opc);
+ }
+
+ void movwMemReg(int offset, RegisterID base, RegisterID dst)
+ {
+ ASSERT(dst == SH4Registers::r0);
+
+ uint16_t opc = getOpcodeGroup11(MOVW_READ_OFFRM_OPCODE, base, offset);
+ oneShortOp(opc);
+ }
+
+ void movwR0mr(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVW_READ_R0RM_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movlRegMem(RegisterID src, int offset, RegisterID base)
+ {
+ ASSERT((offset <= 15) && (offset >= 0));
+
+ if (!offset) {
+ oneShortOp(getOpcodeGroup1(MOVL_WRITE_RN_OPCODE, base, src));
+ return;
+ }
+
+ oneShortOp(getOpcodeGroup4(MOVL_WRITE_OFFRN_OPCODE, base, src, offset));
+ }
+
+ void movlRegMem(RegisterID src, RegisterID base)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVL_WRITE_RN_OPCODE, base, src);
+ oneShortOp(opc);
+ }
+
+ void movlMemReg(int offset, RegisterID base, RegisterID dst)
+ {
+ if (base == SH4Registers::pc) {
+ ASSERT((offset <= 255) && (offset >= 0));
+ oneShortOp(getOpcodeGroup3(MOVL_READ_OFFPC_OPCODE, dst, offset));
+ return;
+ }
+
+ ASSERT((offset <= 15) && (offset >= 0));
+ if (!offset) {
+ oneShortOp(getOpcodeGroup1(MOVL_READ_RM_OPCODE, dst, base));
+ return;
+ }
+
+ oneShortOp(getOpcodeGroup4(MOVL_READ_OFFRM_OPCODE, dst, base, offset));
+ }
+
+ void movbMemReg(int offset, RegisterID base, RegisterID dst)
+ {
+ ASSERT(dst == SH4Registers::r0);
+
+ uint16_t opc = getOpcodeGroup11(MOVB_READ_OFFRM_OPCODE, base, offset);
+ oneShortOp(opc);
+ }
+
+ void movbR0mr(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVB_READ_R0RM_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movbMemReg(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVB_READ_RM_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movlMemReg(RegisterID base, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVL_READ_RM_OPCODE, dst, base);
+ oneShortOp(opc);
+ }
+
+ void movlMemRegIn(RegisterID base, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVL_READ_RMINC_OPCODE, dst, base);
+ oneShortOp(opc);
+ }
+
+ void movlR0mr(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVL_READ_R0RM_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movlRegMemr0(RegisterID src, RegisterID dst)
+ {
+ uint16_t opc = getOpcodeGroup1(MOVL_WRITE_R0RN_OPCODE, dst, src);
+ oneShortOp(opc);
+ }
+
+ void movlImm8r(int imm8, RegisterID dst)
+ {
+ ASSERT((imm8 <= 127) && (imm8 >= -128));
+
+ uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, imm8);
+ oneShortOp(opc);
+ }
+
+ void loadConstant(uint32_t constant, RegisterID dst)
+ {
+ if (((int)constant <= 0x7f) && ((int)constant >= -0x80)) {
+ movImm8(constant, dst);
+ return;
+ }
+
+ uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, 0);
+
+ m_buffer.ensureSpace(maxInstructionSize, sizeof(uint32_t));
+ printInstr(getOpcodeGroup3(MOVIMM_OPCODE, dst, constant), m_buffer.codeSize());
+ m_buffer.putShortWithConstantInt(opc, constant, true);
+ }
+
+ void loadConstantUnReusable(uint32_t constant, RegisterID dst, bool ensureSpace = false)
+ {
+ uint16_t opc = getOpcodeGroup3(MOVIMM_OPCODE, dst, 0);
+
+ if (ensureSpace)
+ m_buffer.ensureSpace(maxInstructionSize, sizeof(uint32_t));
+
+ printInstr(getOpcodeGroup3(MOVIMM_OPCODE, dst, constant), m_buffer.codeSize());
+ m_buffer.putShortWithConstantInt(opc, constant);
+ }
+
+ // Flow control
+
+ AssemblerLabel call()
+ {
+ RegisterID scr = claimScratch();
+ m_buffer.ensureSpace(maxInstructionSize + 4, sizeof(uint32_t));
+ loadConstantUnReusable(0x0, scr);
+ branch(JSR_OPCODE, scr);
+ nop();
+ releaseScratch(scr);
+ return m_buffer.label();
+ }
+
+ AssemblerLabel call(RegisterID dst)
+ {
+ m_buffer.ensureSpace(maxInstructionSize + 2);
+ branch(JSR_OPCODE, dst);
+ nop();
+ return m_buffer.label();
+ }
+
+ AssemblerLabel jmp()
+ {
+ RegisterID scr = claimScratch();
+ m_buffer.ensureSpace(maxInstructionSize + 4, sizeof(uint32_t));
+ AssemblerLabel label = m_buffer.label();
+ loadConstantUnReusable(0x0, scr);
+ branch(BRAF_OPCODE, scr);
+ nop();
+ releaseScratch(scr);
+ return label;
+ }
+
+ AssemblerLabel jmp(RegisterID dst)
+ {
+ jmpReg(dst);
+ return m_buffer.label();
+ }
+
+ void jmpReg(RegisterID dst)
+ {
+ m_buffer.ensureSpace(maxInstructionSize + 2);
+ branch(JMP_OPCODE, dst);
+ nop();
+ }
+
+ AssemblerLabel jne()
+ {
+ AssemblerLabel label = m_buffer.label();
+ branch(BF_OPCODE, 0);
+ return label;
+ }
+
+ AssemblerLabel je()
+ {
+ AssemblerLabel label = m_buffer.label();
+ branch(BT_OPCODE, 0);
+ return label;
+ }
+
+ void ret()
+ {
+ m_buffer.ensureSpace(maxInstructionSize + 2);
+ oneShortOp(RTS_OPCODE, false);
+ }
+
+ AssemblerLabel label()
+ {
+ m_buffer.ensureSpaceForAnyOneInstruction();
+ return m_buffer.label();
+ }
+
+ int sizeOfConstantPool()
+ {
+ return m_buffer.sizeOfConstantPool();
+ }
+
+ AssemblerLabel align(int alignment)
+ {
+ m_buffer.ensureSpace(maxInstructionSize + 2);
+ while (!m_buffer.isAligned(alignment)) {
+ nop();
+ m_buffer.ensureSpace(maxInstructionSize + 2);
+ }
+ return label();
+ }
+
+ static void changePCrelativeAddress(int offset, uint16_t* instructionPtr, uint32_t newAddress)
+ {
+ uint32_t address = (offset << 2) + ((reinterpret_cast<uint32_t>(instructionPtr) + 4) &(~0x3));
+ *reinterpret_cast<uint32_t*>(address) = newAddress;
+ }
+
+ static uint16_t* getInstructionPtr(void* code, int offset)
+ {
+ return reinterpret_cast<uint16_t*> (reinterpret_cast<uint32_t>(code) + offset);
+ }
+
+ static void linkJump(void* code, AssemblerLabel from, void* to)
+ {
+ ASSERT(from.isSet());
+
+ uint16_t* instructionPtr = getInstructionPtr(code, from.m_offset);
+ uint16_t instruction = *instructionPtr;
+ int offsetBits = (reinterpret_cast<uint32_t>(to) - reinterpret_cast<uint32_t>(code)) - from.m_offset;
+
+ if (((instruction & 0xff00) == BT_OPCODE) || ((instruction & 0xff00) == BF_OPCODE)) {
+ /* BT label ==> BF 2
+ nop LDR reg
+ nop braf @reg
+ nop nop
+ */
+ offsetBits -= 8;
+ instruction ^= 0x0202;
+ *instructionPtr++ = instruction;
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits);
+ instruction = (BRAF_OPCODE | (*instructionPtr++ & 0xf00));
+ *instructionPtr = instruction;
+ printBlockInstr(instructionPtr - 2, from.m_offset, 3);
+ return;
+ }
+
+ /* MOV #imm, reg => LDR reg
+ braf @reg braf @reg
+ nop nop
+ */
+ ASSERT((*(instructionPtr + 1) & BRAF_OPCODE) == BRAF_OPCODE);
+
+ offsetBits -= 4;
+ if (offsetBits >= -4096 && offsetBits <= 4094) {
+ *instructionPtr = getOpcodeGroup6(BRA_OPCODE, offsetBits >> 1);
+ *(++instructionPtr) = NOP_OPCODE;
+ printBlockInstr(instructionPtr - 1, from.m_offset, 2);
+ return;
+ }
+
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits - 2);
+ printInstr(*instructionPtr, from.m_offset + 2);
+ }
+
+ static void linkCall(void* code, AssemblerLabel from, void* to)
+ {
+ uint16_t* instructionPtr = getInstructionPtr(code, from.m_offset);
+ instructionPtr -= 3;
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, reinterpret_cast<uint32_t>(to));
+ }
+
+ static void linkPointer(void* code, AssemblerLabel where, void* value)
+ {
+ uint16_t* instructionPtr = getInstructionPtr(code, where.m_offset);
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, reinterpret_cast<uint32_t>(value));
+ }
+
+ static unsigned getCallReturnOffset(AssemblerLabel call)
+ {
+ ASSERT(call.isSet());
+ return call.m_offset;
+ }
+
+ static uint32_t* getLdrImmAddressOnPool(SH4Word* insn, uint32_t* constPool)
+ {
+ return (constPool + (*insn & 0xff));
+ }
+
+ static SH4Word patchConstantPoolLoad(SH4Word load, int value)
+ {
+ return ((load & ~0xff) | value);
+ }
+
+ static SH4Buffer::TwoShorts placeConstantPoolBarrier(int offset)
+ {
+ ASSERT(((offset >> 1) <=2047) && ((offset >> 1) >= -2048));
+
+ SH4Buffer::TwoShorts m_barrier;
+ m_barrier.high = (BRA_OPCODE | (offset >> 1));
+ m_barrier.low = NOP_OPCODE;
+ printInstr(((BRA_OPCODE | (offset >> 1))), 0);
+ printInstr(NOP_OPCODE, 0);
+ return m_barrier;
+ }
+
+ static void patchConstantPoolLoad(void* loadAddr, void* constPoolAddr)
+ {
+ SH4Word* instructionPtr = reinterpret_cast<SH4Word*>(loadAddr);
+ SH4Word instruction = *instructionPtr;
+ SH4Word index = instruction & 0xff;
+
+ if ((instruction & 0xf000) != MOVIMM_OPCODE)
+ return;
+
+ ASSERT((((reinterpret_cast<uint32_t>(constPoolAddr) - reinterpret_cast<uint32_t>(loadAddr)) + index * 4)) < 1024);
+
+ int offset = reinterpret_cast<uint32_t>(constPoolAddr) + (index * 4) - ((reinterpret_cast<uint32_t>(instructionPtr) & ~0x03) + 4);
+ instruction &=0xf00;
+ instruction |= 0xd000;
+ offset &= 0x03ff;
+ instruction |= (offset >> 2);
+ *instructionPtr = instruction;
+ printInstr(instruction, reinterpret_cast<uint32_t>(loadAddr));
+ }
+
+ static void repatchPointer(void* where, void* value)
+ {
+ patchPointer(where, value);
+ }
+
+ static void repatchInt32(void* where, int32_t value)
+ {
+ uint16_t* instructionPtr = reinterpret_cast<uint16_t*>(where);
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, value);
+ }
+
+ static void relinkCall(void* from, void* to)
+ {
+ uint16_t* instructionPtr = reinterpret_cast<uint16_t*>(from);
+ instructionPtr -= 3;
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, reinterpret_cast<uint32_t>(to));
+ }
+
+ static void relinkJump(void* from, void* to)
+ {
+ uint16_t* instructionPtr = reinterpret_cast<uint16_t*> (from);
+ uint16_t instruction = *instructionPtr;
+ int32_t offsetBits = (reinterpret_cast<uint32_t>(to) - reinterpret_cast<uint32_t>(from));
+
+ if (((*instructionPtr & 0xff00) == BT_OPCODE) || ((*instructionPtr & 0xff00) == BF_OPCODE)) {
+ offsetBits -= 8;
+ instructionPtr++;
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits);
+ instruction = (BRAF_OPCODE | (*instructionPtr++ & 0xf00));
+ *instructionPtr = instruction;
+ printBlockInstr(instructionPtr, reinterpret_cast<uint32_t>(from) + 1, 3);
+ return;
+ }
+
+ ASSERT((*(instructionPtr + 1) & BRAF_OPCODE) == BRAF_OPCODE);
+ offsetBits -= 4;
+ if (offsetBits >= -4096 && offsetBits <= 4094) {
+ *instructionPtr = getOpcodeGroup6(BRA_OPCODE, offsetBits >> 1);
+ *(++instructionPtr) = NOP_OPCODE;
+ printBlockInstr(instructionPtr - 2, reinterpret_cast<uint32_t>(from), 2);
+ return;
+ }
+
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits - 2);
+ printInstr(*instructionPtr, reinterpret_cast<uint32_t>(from));
+ }
+
+ // Linking & patching
+
+ void linkJump(AssemblerLabel from, AssemblerLabel to)
+ {
+ ASSERT(to.isSet());
+ ASSERT(from.isSet());
+
+ uint16_t* instructionPtr = getInstructionPtr(data(), from.m_offset);
+ uint16_t instruction = *instructionPtr;
+ int offsetBits;
+
+ if (((instruction & 0xff00) == BT_OPCODE) || ((instruction & 0xff00) == BF_OPCODE)) {
+ /* BT label => BF 2
+ nop LDR reg
+ nop braf @reg
+ nop nop
+ */
+ offsetBits = (to.m_offset - from.m_offset) - 8;
+ instruction ^= 0x0202;
+ *instructionPtr++ = instruction;
+ if ((*instructionPtr & 0xf000) == 0xe000) {
+ uint32_t* addr = getLdrImmAddressOnPool(instructionPtr, m_buffer.poolAddress());
+ *addr = offsetBits;
+ } else
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits);
+ instruction = (BRAF_OPCODE | (*instructionPtr++ & 0xf00));
+ *instructionPtr = instruction;
+ printBlockInstr(instructionPtr - 2, from.m_offset, 3);
+ return;
+ }
+
+ /* MOV # imm, reg => LDR reg
+ braf @reg braf @reg
+ nop nop
+ */
+ ASSERT((*(instructionPtr + 1) & BRAF_OPCODE) == BRAF_OPCODE);
+ offsetBits = (to.m_offset - from.m_offset) - 4;
+ if (offsetBits >= -4096 && offsetBits <= 4094) {
+ *instructionPtr = getOpcodeGroup6(BRA_OPCODE, offsetBits >> 1);
+ *(++instructionPtr) = NOP_OPCODE;
+ printBlockInstr(instructionPtr - 1, from.m_offset, 2);
+ return;
+ }
+
+ instruction = *instructionPtr;
+ if ((instruction & 0xf000) == 0xe000) {
+ uint32_t* addr = getLdrImmAddressOnPool(instructionPtr, m_buffer.poolAddress());
+ *addr = offsetBits - 2;
+ printInstr(*instructionPtr, from.m_offset + 2);
+ return;
+ }
+
+ changePCrelativeAddress((*instructionPtr & 0xff), instructionPtr, offsetBits - 2);
+ printInstr(*instructionPtr, from.m_offset + 2);
+ }
+
+ static void* getRelocatedAddress(void* code, AssemblerLabel label)
+ {
+ return reinterpret_cast<void*>(reinterpret_cast<char*>(code) + label.m_offset);
+ }
+
+ static int getDifferenceBetweenLabels(AssemblerLabel a, AssemblerLabel b)
+ {
+ return b.m_offset - a.m_offset;
+ }
+
+ static void patchPointer(void* code, AssemblerLabel where, void* value)
+ {
+ patchPointer(reinterpret_cast<uint32_t*>(code) + where.m_offset, value);
+ }
+
+ static void patchPointer(void* code, void* value)
+ {
+ patchInt32(code, reinterpret_cast<uint32_t>(value));
+ }
+
+ static void patchInt32(void* code, uint32_t value)
+ {
+ changePCrelativeAddress((*(reinterpret_cast<uint16_t*>(code)) & 0xff), reinterpret_cast<uint16_t*>(code), value);
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ return m_buffer.executableCopy(allocator);
+ }
+
+ void prefix(uint16_t pre)
+ {
+ m_buffer.putByte(pre);
+ }
+
+ void oneShortOp(uint16_t opcode, bool checksize = true, bool isDouble = true)
+ {
+ printInstr(opcode, m_buffer.codeSize(), isDouble);
+ if (checksize)
+ m_buffer.ensureSpace(maxInstructionSize);
+ m_buffer.putShortUnchecked(opcode);
+ }
+
+ void ensureSpace(int space)
+ {
+ m_buffer.ensureSpace(space);
+ }
+
+ void ensureSpace(int insnSpace, int constSpace)
+ {
+ m_buffer.ensureSpace(insnSpace, constSpace);
+ }
+
+ // Administrative methods
+
+ void* data() const { return m_buffer.data(); }
+ size_t codeSize() const { return m_buffer.codeSize(); }
+
+#ifdef SH4_ASSEMBLER_TRACING
+ static void printInstr(uint16_t opc, unsigned int size, bool isdoubleInst = true)
+ {
+ if (!getenv("JavaScriptCoreDumpJIT"))
+ return;
+
+ const char *format = 0;
+ printfStdoutInstr("offset: 0x%8.8x\t", size);
+ switch (opc) {
+ case BRK_OPCODE:
+ format = " BRK\n";
+ break;
+ case NOP_OPCODE:
+ format = " NOP\n";
+ break;
+ case RTS_OPCODE:
+ format =" *RTS\n";
+ break;
+ case SETS_OPCODE:
+ format = " SETS\n";
+ break;
+ case SETT_OPCODE:
+ format = " SETT\n";
+ break;
+ case CLRT_OPCODE:
+ format = " CLRT\n";
+ break;
+ case FSCHG_OPCODE:
+ format = " FSCHG\n";
+ break;
+ }
+ if (format) {
+ printfStdoutInstr(format);
+ return;
+ }
+ switch (opc & 0xf0ff) {
+ case BRAF_OPCODE:
+ format = " *BRAF R%d\n";
+ break;
+ case DT_OPCODE:
+ format = " DT R%d\n";
+ break;
+ case CMPPL_OPCODE:
+ format = " CMP/PL R%d\n";
+ break;
+ case CMPPZ_OPCODE:
+ format = " CMP/PZ R%d\n";
+ break;
+ case JMP_OPCODE:
+ format = " *JMP @R%d\n";
+ break;
+ case JSR_OPCODE:
+ format = " *JSR @R%d\n";
+ break;
+ case LDSPR_OPCODE:
+ format = " LDS R%d, PR\n";
+ break;
+ case LDSLPR_OPCODE:
+ format = " LDS.L @R%d+, PR\n";
+ break;
+ case MOVT_OPCODE:
+ format = " MOVT R%d\n";
+ break;
+ case SHAL_OPCODE:
+ format = " SHAL R%d\n";
+ break;
+ case SHAR_OPCODE:
+ format = " SHAR R%d\n";
+ break;
+ case SHLL_OPCODE:
+ format = " SHLL R%d\n";
+ break;
+ case SHLL2_OPCODE:
+ format = " SHLL2 R%d\n";
+ break;
+ case SHLL8_OPCODE:
+ format = " SHLL8 R%d\n";
+ break;
+ case SHLL16_OPCODE:
+ format = " SHLL16 R%d\n";
+ break;
+ case SHLR_OPCODE:
+ format = " SHLR R%d\n";
+ break;
+ case SHLR2_OPCODE:
+ format = " SHLR2 R%d\n";
+ break;
+ case SHLR8_OPCODE:
+ format = " SHLR8 R%d\n";
+ break;
+ case SHLR16_OPCODE:
+ format = " SHLR16 R%d\n";
+ break;
+ case STSPR_OPCODE:
+ format = " STS PR, R%d\n";
+ break;
+ case STSLPR_OPCODE:
+ format = " STS.L PR, @-R%d\n";
+ break;
+ case LDS_RM_FPUL_OPCODE:
+ format = " LDS R%d, FPUL\n";
+ break;
+ case STS_FPUL_RN_OPCODE:
+ format = " STS FPUL, R%d \n";
+ break;
+ case FLDS_FRM_FPUL_OPCODE:
+ format = " FLDS FR%d, FPUL\n";
+ break;
+ case FSTS_FPUL_FRN_OPCODE:
+ format = " FSTS FPUL, R%d \n";
+ break;
+ case LDSFPSCR_OPCODE:
+ format = " LDS R%d, FPSCR \n";
+ break;
+ case STSFPSCR_OPCODE:
+ format = " STS FPSCR, R%d \n";
+ break;
+ case STSMACL_OPCODE:
+ format = " STS MACL, R%d \n";
+ break;
+ case STSMACH_OPCODE:
+ format = " STS MACH, R%d \n";
+ break;
+ case BSRF_OPCODE:
+ format = " *BSRF R%d";
+ break;
+ case FTRC_OPCODE:
+ format = " FTRC FR%d, FPUL\n";
+ break;
+ }
+ if (format) {
+ printfStdoutInstr(format, getRn(opc));
+ return;
+ }
+ switch (opc & 0xf0ff) {
+ case FNEG_OPCODE:
+ format = " FNEG DR%d\n";
+ break;
+ case FLOAT_OPCODE:
+ format = " FLOAT DR%d\n";
+ break;
+ case FTRC_OPCODE:
+ format = " FTRC FR%d, FPUL\n";
+ break;
+ case FSQRT_OPCODE:
+ format = " FSQRT FR%d\n";
+ break;
+ case FCNVDS_DRM_FPUL_OPCODE:
+ format = " FCNVDS FR%d, FPUL\n";
+ break;
+ }
+ if (format) {
+ if (isdoubleInst)
+ printfStdoutInstr(format, getDRn(opc) << 1);
+ else
+ printfStdoutInstr(format, getRn(opc));
+ return;
+ }
+ switch (opc & 0xf00f) {
+ case ADD_OPCODE:
+ format = " ADD R%d, R%d\n";
+ break;
+ case ADDC_OPCODE:
+ format = " ADDC R%d, R%d\n";
+ break;
+ case ADDV_OPCODE:
+ format = " ADDV R%d, R%d\n";
+ break;
+ case AND_OPCODE:
+ format = " AND R%d, R%d\n";
+ break;
+ case DIV1_OPCODE:
+ format = " DIV1 R%d, R%d\n";
+ break;
+ case CMPEQ_OPCODE:
+ format = " CMP/EQ R%d, R%d\n";
+ break;
+ case CMPGE_OPCODE:
+ format = " CMP/GE R%d, R%d\n";
+ break;
+ case CMPGT_OPCODE:
+ format = " CMP/GT R%d, R%d\n";
+ break;
+ case CMPHI_OPCODE:
+ format = " CMP/HI R%d, R%d\n";
+ break;
+ case CMPHS_OPCODE:
+ format = " CMP/HS R%d, R%d\n";
+ break;
+ case MOV_OPCODE:
+ format = " MOV R%d, R%d\n";
+ break;
+ case MOVB_WRITE_RN_OPCODE:
+ format = " MOV.B R%d, @R%d\n";
+ break;
+ case MOVB_WRITE_RNDEC_OPCODE:
+ format = " MOV.B R%d, @-R%d\n";
+ break;
+ case MOVB_WRITE_R0RN_OPCODE:
+ format = " MOV.B R%d, @(R0, R%d)\n";
+ break;
+ case MOVB_READ_RM_OPCODE:
+ format = " MOV.B @R%d, R%d\n";
+ break;
+ case MOVB_READ_RMINC_OPCODE:
+ format = " MOV.B @R%d+, R%d\n";
+ break;
+ case MOVB_READ_R0RM_OPCODE:
+ format = " MOV.B @(R0, R%d), R%d\n";
+ break;
+ case MOVL_WRITE_RN_OPCODE:
+ format = " MOV.L R%d, @R%d\n";
+ break;
+ case MOVL_WRITE_RNDEC_OPCODE:
+ format = " MOV.L R%d, @-R%d\n";
+ break;
+ case MOVL_WRITE_R0RN_OPCODE:
+ format = " MOV.L R%d, @(R0, R%d)\n";
+ break;
+ case MOVL_READ_RM_OPCODE:
+ format = " MOV.L @R%d, R%d\n";
+ break;
+ case MOVL_READ_RMINC_OPCODE:
+ format = " MOV.L @R%d+, R%d\n";
+ break;
+ case MOVL_READ_R0RM_OPCODE:
+ format = " MOV.L @(R0, R%d), R%d\n";
+ break;
+ case MULL_OPCODE:
+ format = " MUL.L R%d, R%d\n";
+ break;
+ case DMULL_L_OPCODE:
+ format = " DMULU.L R%d, R%d\n";
+ break;
+ case DMULSL_OPCODE:
+ format = " DMULS.L R%d, R%d\n";
+ break;
+ case NEG_OPCODE:
+ format = " NEG R%d, R%d\n";
+ break;
+ case NEGC_OPCODE:
+ format = " NEGC R%d, R%d\n";
+ break;
+ case NOT_OPCODE:
+ format = " NOT R%d, R%d\n";
+ break;
+ case OR_OPCODE:
+ format = " OR R%d, R%d\n";
+ break;
+ case SHAD_OPCODE:
+ format = " SHAD R%d, R%d\n";
+ break;
+ case SHLD_OPCODE:
+ format = " SHLD R%d, R%d\n";
+ break;
+ case SUB_OPCODE:
+ format = " SUB R%d, R%d\n";
+ break;
+ case SUBC_OPCODE:
+ format = " SUBC R%d, R%d\n";
+ break;
+ case SUBV_OPCODE:
+ format = " SUBV R%d, R%d\n";
+ break;
+ case TST_OPCODE:
+ format = " TST R%d, R%d\n";
+ break;
+ case XOR_OPCODE:
+ format = " XOR R%d, R%d\n";break;
+ case MOVW_WRITE_RN_OPCODE:
+ format = " MOV.W R%d, @R%d\n";
+ break;
+ case MOVW_READ_RM_OPCODE:
+ format = " MOV.W @R%d, R%d\n";
+ break;
+ case MOVW_READ_R0RM_OPCODE:
+ format = " MOV.W @(R0, R%d), R%d\n";
+ break;
+ case EXTUW_OPCODE:
+ format = " EXTU.W R%d, R%d\n";
+ break;
+ }
+ if (format) {
+ printfStdoutInstr(format, getRm(opc), getRn(opc));
+ return;
+ }
+ switch (opc & 0xf00f) {
+ case FSUB_OPCODE:
+ format = " FSUB FR%d, FR%d\n";
+ break;
+ case FADD_OPCODE:
+ format = " FADD FR%d, FR%d\n";
+ break;
+ case FDIV_OPCODE:
+ format = " FDIV FR%d, FR%d\n";
+ break;
+ case FMUL_OPCODE:
+ format = " DMULL FR%d, FR%d\n";
+ break;
+ case FMOV_OPCODE:
+ format = " FMOV FR%d, FR%d\n";
+ break;
+ case FCMPEQ_OPCODE:
+ format = " FCMP/EQ FR%d, FR%d\n";
+ break;
+ case FCMPGT_OPCODE:
+ format = " FCMP/GT FR%d, FR%d\n";
+ break;
+ }
+ if (format) {
+ if (isdoubleInst)
+ printfStdoutInstr(format, getDRm(opc) << 1, getDRn(opc) << 1);
+ else
+ printfStdoutInstr(format, getRm(opc), getRn(opc));
+ return;
+ }
+ switch (opc & 0xf00f) {
+ case FMOVS_WRITE_RN_DEC_OPCODE:
+ format = " %s FR%d, @-R%d\n";
+ break;
+ case FMOVS_WRITE_RN_OPCODE:
+ format = " %s FR%d, @R%d\n";
+ break;
+ case FMOVS_WRITE_R0RN_OPCODE:
+ format = " %s FR%d, @(R0, R%d)\n";
+ break;
+ }
+ if (format) {
+ if (isdoubleInst)
+ printfStdoutInstr(format, "FMOV", getDRm(opc) << 1, getDRn(opc));
+ else
+ printfStdoutInstr(format, "FMOV.S", getRm(opc), getRn(opc));
+ return;
+ }
+ switch (opc & 0xf00f) {
+ case FMOVS_READ_RM_OPCODE:
+ format = " %s @R%d, FR%d\n";
+ break;
+ case FMOVS_READ_RM_INC_OPCODE:
+ format = " %s @R%d+, FR%d\n";
+ break;
+ case FMOVS_READ_R0RM_OPCODE:
+ format = " %s @(R0, R%d), FR%d\n";
+ break;
+ }
+ if (format) {
+ if (isdoubleInst)
+ printfStdoutInstr(format, "FMOV", getDRm(opc), getDRn(opc) << 1);
+ else
+ printfStdoutInstr(format, "FMOV.S", getRm(opc), getRn(opc));
+ return;
+ }
+ switch (opc & 0xff00) {
+ case BF_OPCODE:
+ format = " BF %d\n";
+ break;
+ case BFS_OPCODE:
+ format = " *BF/S %d\n";
+ break;
+ case ANDIMM_OPCODE:
+ format = " AND #%d, R0\n";
+ break;
+ case BT_OPCODE:
+ format = " BT %d\n";
+ break;
+ case BTS_OPCODE:
+ format = " *BT/S %d\n";
+ break;
+ case CMPEQIMM_OPCODE:
+ format = " CMP/EQ #%d, R0\n";
+ break;
+ case MOVB_WRITE_OFFGBR_OPCODE:
+ format = " MOV.B R0, @(%d, GBR)\n";
+ break;
+ case MOVB_READ_OFFGBR_OPCODE:
+ format = " MOV.B @(%d, GBR), R0\n";
+ break;
+ case MOVL_WRITE_OFFGBR_OPCODE:
+ format = " MOV.L R0, @(%d, GBR)\n";
+ break;
+ case MOVL_READ_OFFGBR_OPCODE:
+ format = " MOV.L @(%d, GBR), R0\n";
+ break;
+ case MOVA_READ_OFFPC_OPCODE:
+ format = " MOVA @(%d, PC), R0\n";
+ break;
+ case ORIMM_OPCODE:
+ format = " OR #%d, R0\n";
+ break;
+ case ORBIMM_OPCODE:
+ format = " OR.B #%d, @(R0, GBR)\n";
+ break;
+ case TSTIMM_OPCODE:
+ format = " TST #%d, R0\n";
+ break;
+ case TSTB_OPCODE:
+ format = " TST.B %d, @(R0, GBR)\n";
+ break;
+ case XORIMM_OPCODE:
+ format = " XOR #%d, R0\n";
+ break;
+ case XORB_OPCODE:
+ format = " XOR.B %d, @(R0, GBR)\n";
+ break;
+ }
+ if (format) {
+ printfStdoutInstr(format, getImm8(opc));
+ return;
+ }
+ switch (opc & 0xff00) {
+ case MOVB_WRITE_OFFRN_OPCODE:
+ format = " MOV.B R0, @(%d, R%d)\n";
+ break;
+ case MOVB_READ_OFFRM_OPCODE:
+ format = " MOV.B @(%d, R%d), R0\n";
+ break;
+ }
+ if (format) {
+ printfStdoutInstr(format, getDisp(opc), getRm(opc));
+ return;
+ }
+ switch (opc & 0xf000) {
+ case BRA_OPCODE:
+ format = " *BRA %d\n";
+ break;
+ case BSR_OPCODE:
+ format = " *BSR %d\n";
+ break;
+ }
+ if (format) {
+ printfStdoutInstr(format, getImm12(opc));
+ return;
+ }
+ switch (opc & 0xf000) {
+ case MOVL_READ_OFFPC_OPCODE:
+ format = " MOV.L @(%d, PC), R%d\n";
+ break;
+ case ADDIMM_OPCODE:
+ format = " ADD #%d, R%d\n";
+ break;
+ case MOVIMM_OPCODE:
+ format = " MOV #%d, R%d\n";
+ break;
+ case MOVW_READ_OFFPC_OPCODE:
+ format = " MOV.W @(%d, PC), R%d\n";
+ break;
+ }
+ if (format) {
+ printfStdoutInstr(format, getImm8(opc), getRn(opc));
+ return;
+ }
+ switch (opc & 0xf000) {
+ case MOVL_WRITE_OFFRN_OPCODE:
+ format = " MOV.L R%d, @(%d, R%d)\n";
+ printfStdoutInstr(format, getRm(opc), getDisp(opc), getRn(opc));
+ break;
+ case MOVL_READ_OFFRM_OPCODE:
+ format = " MOV.L @(%d, R%d), R%d\n";
+ printfStdoutInstr(format, getDisp(opc), getRm(opc), getRn(opc));
+ break;
+ }
+ }
+
+ static void printfStdoutInstr(const char* format, ...)
+ {
+ if (getenv("JavaScriptCoreDumpJIT")) {
+ va_list args;
+ va_start(args, format);
+ vprintfStdoutInstr(format, args);
+ va_end(args);
+ }
+ }
+
+ static void vprintfStdoutInstr(const char* format, va_list args)
+ {
+ if (getenv("JavaScriptCoreDumpJIT"))
+ vfprintf(stdout, format, args);
+ }
+
+ static void printBlockInstr(uint16_t* first, unsigned int offset, int nbInstr)
+ {
+ printfStdoutInstr(">> repatch instructions after link\n");
+ for (int i = 0; i <= nbInstr; i++)
+ printInstr(*(first + i), offset + i);
+ printfStdoutInstr(">> end repatch\n");
+ }
+#else
+ static void printInstr(uint16_t opc, unsigned int size, bool isdoubleInst = true) {};
+ static void printBlockInstr(uint16_t* first, unsigned int offset, int nbInstr) {};
+#endif
+
+private:
+ SH4Buffer m_buffer;
+ int m_claimscratchReg;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER) && CPU(SH4)
+
+#endif // SH4Assembler_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/assembler/X86Assembler.h b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/X86Assembler.h
new file mode 100644
index 0000000..3fb6a6b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/assembler/X86Assembler.h
@@ -0,0 +1,2055 @@
+/*
+ * 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_EbGb = 0x84,
+ 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:
+
+ X86Assembler()
+ {
+ }
+
+ // 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, const 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, const 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, const 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, const 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, const 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, const void* addr)
+ {
+ m_formatter.oneByteOp(OP_CMP_EvGv, reg, addr);
+ }
+
+ void cmpl_im(int imm, const 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_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_TEST_EbGb, src, dst);
+ }
+
+ 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(const 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(const 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(const void* addr)
+ {
+ m_formatter.oneByteOp64(OP_MOV_EAXOv);
+ m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
+ }
+
+ void movq_EAXm(const 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, const void* addr)
+ {
+ if (src == X86Registers::eax)
+ movl_EAXm(addr);
+ else
+ m_formatter.oneByteOp(OP_MOV_EvGv, src, addr);
+ }
+
+ void movl_mr(const 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, const 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:
+
+ AssemblerLabel call()
+ {
+ m_formatter.oneByteOp(OP_CALL_rel32);
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel call(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_CALLN, dst);
+ return m_formatter.label();
+ }
+
+ void call_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_CALLN, base, offset);
+ }
+
+ AssemblerLabel jmp()
+ {
+ m_formatter.oneByteOp(OP_JMP_rel32);
+ return m_formatter.immediateRel32();
+ }
+
+ // Return a AssemblerLabel 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. :-/
+ AssemblerLabel jmp_r(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_JMPN, dst);
+ return m_formatter.label();
+ }
+
+ void jmp_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_JMPN, base, offset);
+ }
+
+ AssemblerLabel jne()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionNE));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jnz()
+ {
+ return jne();
+ }
+
+ AssemblerLabel je()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionE));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jz()
+ {
+ return je();
+ }
+
+ AssemblerLabel jl()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionL));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jb()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionB));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jle()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionLE));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jbe()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionBE));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jge()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionGE));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jg()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionG));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel ja()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionA));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jae()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionAE));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jo()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionO));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel jp()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionP));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel js()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionS));
+ return m_formatter.immediateRel32();
+ }
+
+ AssemblerLabel 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(const 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_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ 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:
+
+ size_t codeSize() const
+ {
+ return m_formatter.codeSize();
+ }
+
+ AssemblerLabel label()
+ {
+ return m_formatter.label();
+ }
+
+ AssemblerLabel 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(AssemblerLabel from, AssemblerLabel to)
+ {
+ ASSERT(from.isSet());
+ ASSERT(to.isSet());
+
+ char* code = reinterpret_cast<char*>(m_formatter.data());
+ ASSERT(!reinterpret_cast<int32_t*>(code + from.m_offset)[-1]);
+ setRel32(code + from.m_offset, code + to.m_offset);
+ }
+
+ static void linkJump(void* code, AssemblerLabel from, void* to)
+ {
+ ASSERT(from.isSet());
+
+ setRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
+ }
+
+ static void linkCall(void* code, AssemblerLabel from, void* to)
+ {
+ ASSERT(from.isSet());
+
+ setRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
+ }
+
+ static void linkPointer(void* code, AssemblerLabel where, void* value)
+ {
+ ASSERT(where.isSet());
+
+ 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 unsigned getCallReturnOffset(AssemblerLabel call)
+ {
+ ASSERT(call.isSet());
+ return call.m_offset;
+ }
+
+ static void* getRelocatedAddress(void* code, AssemblerLabel label)
+ {
+ ASSERT(label.isSet());
+ return reinterpret_cast<void*>(reinterpret_cast<ptrdiff_t>(code) + label.m_offset);
+ }
+
+ static int getDifferenceBetweenLabels(AssemblerLabel a, AssemblerLabel b)
+ {
+ return b.m_offset - a.m_offset;
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ return m_formatter.executableCopy(allocator);
+ }
+
+ void rewindToLabel(AssemblerLabel rewindTo) { m_formatter.rewindToLabel(rewindTo); }
+
+#ifndef NDEBUG
+ unsigned debugOffset() { return m_formatter.debugOffset(); }
+#endif
+
+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, const 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);
+ }
+
+ AssemblerLabel immediateRel32()
+ {
+ m_buffer.putIntUnchecked(0);
+ return label();
+ }
+
+ // Administrative methods:
+
+ size_t codeSize() const { return m_buffer.codeSize(); }
+ AssemblerLabel label() const { return m_buffer.label(); }
+ 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);
+ }
+
+ void rewindToLabel(AssemblerLabel rewindTo) { m_buffer.rewindToLabel(rewindTo); }
+
+#ifndef NDEBUG
+ unsigned debugOffset() { return m_buffer.debugOffset(); }
+#endif
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.cpp
new file mode 100644
index 0000000..522e2c3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -0,0 +1,1662 @@
+/*
+ * 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].get()).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());
+ }
+#endif
+#if ENABLE(INTERPRETER)
+ 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.get());
+ ++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_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->globalData(), ownerExecutable, globalObject)
+ , m_heap(&m_globalObject->globalData().heap)
+ , m_numCalleeRegisters(0)
+ , m_numVars(0)
+ , m_numParameters(0)
+ , m_isConstructor(isConstructor)
+ , m_ownerExecutable(globalObject->globalData(), 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(JIT)
+ for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i)
+ m_structureStubInfos[i].deref();
+#endif // ENABLE(JIT)
+
+#if DUMP_CODE_BLOCK_STATISTICS
+ liveCodeBlockSet.remove(this);
+#endif
+}
+
+void CodeBlock::visitStructures(SlotVisitor& visitor, 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)) {
+ visitor.append(&vPC[4].u.structure);
+ 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)) {
+ visitor.append(&vPC[4].u.structure);
+ visitor.append(&vPC[5].u.structure);
+ 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)) {
+ visitor.append(&vPC[4].u.structure);
+ visitor.append(&vPC[5].u.structureChain);
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
+ visitor.append(&vPC[4].u.structure);
+ visitor.append(&vPC[5].u.structure);
+ visitor.append(&vPC[6].u.structureChain);
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
+ visitor.append(&vPC[4].u.structure);
+ 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)
+ visitor.append(&vPC[3].u.structure);
+ 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->visitAggregate(visitor, 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 EvalCodeCache::visitAggregate(SlotVisitor& visitor)
+{
+ EvalCacheMap::iterator end = m_cacheMap.end();
+ for (EvalCacheMap::iterator ptr = m_cacheMap.begin(); ptr != end; ++ptr)
+ visitor.append(&ptr->second);
+}
+
+void CodeBlock::visitAggregate(SlotVisitor& visitor)
+{
+ visitor.append(&m_globalObject);
+ visitor.append(&m_ownerExecutable);
+ if (m_rareData)
+ m_rareData->m_evalCodeCache.visitAggregate(visitor);
+ visitor.appendValues(m_constantRegisters.data(), m_constantRegisters.size());
+ for (size_t i = 0; i < m_functionExprs.size(); ++i)
+ visitor.append(&m_functionExprs[i]);
+ for (size_t i = 0; i < m_functionDecls.size(); ++i)
+ visitor.append(&m_functionDecls[i]);
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ for (unsigned i = 0; i < numberOfCallLinkInfos(); ++i)
+ if (callLinkInfo(i).isLinked())
+ visitor.append(&callLinkInfo(i).callee);
+#endif
+#if ENABLE(INTERPRETER)
+ for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i)
+ visitStructures(visitor, &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)
+ visitor.append(&m_globalResolveInfos[i].structure);
+ }
+
+ for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i)
+ m_structureStubInfos[i].visitAggregate(visitor);
+
+ for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) {
+ if (m_methodCallLinkInfos[i].cachedStructure) {
+ // Both members must be filled at the same time
+ visitor.append(&m_methodCallLinkInfos[i].cachedStructure);
+ ASSERT(!!m_methodCallLinkInfos[i].cachedPrototypeStructure);
+ visitor.append(&m_methodCallLinkInfos[i].cachedPrototypeStructure);
+ }
+ }
+#endif
+}
+
+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();
+#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()->push(activation));
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.h
new file mode 100644
index 0000000..33e39c5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/CodeBlock.h
@@ -0,0 +1,658 @@
+/*
+ * 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()
+ : hasSeenShouldRepatch(false)
+ {
+ }
+
+ CodeLocationNearCall callReturnLocation;
+ CodeLocationDataLabelPtr hotPathBegin;
+ CodeLocationNearCall hotPathOther;
+ WriteBarrier<JSFunction> callee;
+ bool hasSeenShouldRepatch;
+
+ void setUnlinked() { callee.clear(); }
+ bool isLinked() { return callee; }
+
+ bool seenOnce()
+ {
+ return hasSeenShouldRepatch;
+ }
+
+ void setSeen()
+ {
+ hasSeenShouldRepatch = true;
+ }
+ };
+
+ struct MethodCallLinkInfo {
+ MethodCallLinkInfo()
+ {
+ }
+
+ 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.setWithoutWriteBarrier((Structure*)1);
+ }
+
+ CodeLocationCall callReturnLocation;
+ CodeLocationDataLabelPtr structureLabel;
+ WriteBarrier<Structure> cachedStructure;
+ WriteBarrier<Structure> cachedPrototypeStructure;
+ };
+
+ struct GlobalResolveInfo {
+ GlobalResolveInfo(unsigned bytecodeOffset)
+ : offset(0)
+ , bytecodeOffset(bytecodeOffset)
+ {
+ }
+
+ WriteBarrier<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 binarySearch algorithm.
+
+ 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;
+ }
+#endif
+
+ class CodeBlock {
+ WTF_MAKE_FAST_ALLOCATED;
+ friend class JIT;
+ protected:
+ CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor);
+
+ WriteBarrier<JSGlobalObject> m_globalObject;
+ Heap* m_heap;
+
+ public:
+ virtual ~CodeBlock();
+
+ void visitAggregate(SlotVisitor&);
+
+ 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)
+
+ StructureStubInfo& getStubInfo(ReturnAddressPtr returnAddress)
+ {
+ return *(binarySearch<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress.value()));
+ }
+
+ CallLinkInfo& getCallLinkInfo(ReturnAddressPtr returnAddress)
+ {
+ return *(binarySearch<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress.value()));
+ }
+
+ MethodCallLinkInfo& getMethodCallLinkInfo(ReturnAddressPtr returnAddress)
+ {
+ return *(binarySearch<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 binarySearch<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.get(); }
+
+ 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)
+ {
+ if (!m_globalData->canUseJIT())
+ m_propertyAccessInstructions.append(propertyAccessInstruction);
+ }
+ void addGlobalResolveInstruction(unsigned globalResolveInstruction)
+ {
+ if (!m_globalData->canUseJIT())
+ 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)
+ {
+ if (m_globalData->canUseJIT())
+ m_structureStubInfos.append(stubInfo);
+ }
+ StructureStubInfo& structureStubInfo(int index) { return m_structureStubInfos[index]; }
+
+ void addGlobalResolveInfo(unsigned globalResolveInstruction)
+ {
+ if (m_globalData->canUseJIT())
+ 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(); }
+ // We only generate exception handling info if the user is debugging
+ // (and may want line number info), or if the function contains exception handler.
+ 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 addConstant(JSValue v)
+ {
+ m_constantRegisters.append(WriteBarrier<Unknown>());
+ m_constantRegisters.last().set(m_globalObject->globalData(), m_ownerExecutable.get(), v);
+ }
+ WriteBarrier<Unknown>& 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].get(); }
+
+ unsigned addFunctionDecl(FunctionExecutable* n)
+ {
+ unsigned size = m_functionDecls.size();
+ m_functionDecls.append(WriteBarrier<FunctionExecutable>());
+ m_functionDecls.last().set(m_globalObject->globalData(), m_ownerExecutable.get(), n);
+ return size;
+ }
+ FunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); }
+ int numberOfFunctionDecls() { return m_functionDecls.size(); }
+ unsigned addFunctionExpr(FunctionExecutable* n)
+ {
+ unsigned size = m_functionExprs.size();
+ m_functionExprs.append(WriteBarrier<FunctionExecutable>());
+ m_functionExprs.last().set(m_globalObject->globalData(), m_ownerExecutable.get(), n);
+ return size;
+ }
+ FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); }
+
+ unsigned addRegExp(PassRefPtr<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.get(); }
+
+ // 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 visitStructures(SlotVisitor&, Instruction* vPC) const;
+
+ void createRareDataIfNecessary()
+ {
+ if (!m_rareData)
+ m_rareData = adoptPtr(new RareData);
+ }
+
+ WriteBarrier<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;
+#endif
+
+ Vector<unsigned> m_jumpTargets;
+
+ // Constant Pool
+ Vector<Identifier> m_identifiers;
+ COMPILE_ASSERT(sizeof(Register) == sizeof(WriteBarrier<Unknown>), Register_must_be_same_size_as_WriteBarrier_Unknown);
+ Vector<WriteBarrier<Unknown> > m_constantRegisters;
+ Vector<WriteBarrier<FunctionExecutable> > m_functionDecls;
+ Vector<WriteBarrier<FunctionExecutable> > m_functionExprs;
+
+ SymbolTable* m_symbolTable;
+
+ struct RareData {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ 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
+ };
+#if COMPILER(MSVC)
+ friend void WTF::deleteOwnedPtr<RareData>(RareData*);
+#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)
+ {
+ }
+
+ 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 *reinterpret_cast<Register*>(&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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/EvalCodeCache.h
new file mode 100644
index 0000000..df937dd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/EvalCodeCache.h
@@ -0,0 +1,83 @@
+/*
+ * 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 MarkStack;
+ typedef MarkStack SlotVisitor;
+
+ class EvalCodeCache {
+ public:
+ EvalExecutable* get(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
+ {
+ EvalExecutable* evalExecutable = 0;
+
+ if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject())
+ evalExecutable = m_cacheMap.get(evalSource.impl()).get();
+
+ 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(), WriteBarrier<EvalExecutable>(exec->globalData(), owner, evalExecutable));
+ }
+
+ return evalExecutable;
+ }
+
+ bool isEmpty() const { return m_cacheMap.isEmpty(); }
+
+ void visitAggregate(SlotVisitor&);
+
+ private:
+ static const unsigned maxCacheableSourceLength = 256;
+ static const int maxCacheEntries = 64;
+
+ typedef HashMap<RefPtr<StringImpl>, WriteBarrier<EvalExecutable> > EvalCacheMap;
+ EvalCacheMap m_cacheMap;
+ };
+
+} // namespace JSC
+
+#endif // EvalCodeCache_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Instruction.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Instruction.h
new file mode 100644
index 0000000..866846c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Instruction.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.
+ * 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 "StructureChain.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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ struct PolymorphicStubInfo {
+ bool isChain;
+ PolymorphicAccessStructureListStubRoutineType stubRoutine;
+ WriteBarrier<Structure> base;
+ union {
+ WriteBarrierBase<Structure> proto;
+ WriteBarrierBase<StructureChain> chain;
+ } u;
+
+ void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base)
+ {
+ stubRoutine = _stubRoutine;
+ base.set(globalData, owner, _base);
+ u.proto.clear();
+ isChain = false;
+ }
+
+ void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, Structure* _proto)
+ {
+ stubRoutine = _stubRoutine;
+ base.set(globalData, owner, _base);
+ u.proto.set(globalData, owner, _proto);
+ isChain = false;
+ }
+
+ void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain)
+ {
+ stubRoutine = _stubRoutine;
+ base.set(globalData, owner, _base);
+ u.chain.set(globalData, owner, _chain);
+ isChain = true;
+ }
+ } list[POLYMORPHIC_LIST_CACHE_SIZE];
+
+ PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase)
+ {
+ list[0].set(globalData, owner, stubRoutine, firstBase);
+ }
+
+ PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, Structure* firstProto)
+ {
+ list[0].set(globalData, owner, stubRoutine, firstBase, firstProto);
+ }
+
+ PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain)
+ {
+ list[0].set(globalData, owner, stubRoutine, firstBase, firstChain);
+ }
+
+ void visitAggregate(SlotVisitor& visitor, int count)
+ {
+ for (int i = 0; i < count; ++i) {
+ PolymorphicStubInfo& info = list[i];
+ ASSERT(info.base);
+
+ visitor.append(&info.base);
+ if (info.u.proto && !info.isChain)
+ visitor.append(&info.u.proto);
+ if (info.u.chain && info.isChain)
+ visitor.append(&info.u.chain);
+ }
+ }
+ };
+
+ 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.clear();
+#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.clear();
+ u.operand = operand;
+ }
+
+ Instruction(JSGlobalData& globalData, JSCell* owner, Structure* structure)
+ {
+ u.structure.clear();
+ u.structure.set(globalData, owner, structure);
+ }
+ Instruction(JSGlobalData& globalData, JSCell* owner, StructureChain* structureChain)
+ {
+ u.structureChain.clear();
+ u.structureChain.set(globalData, owner, structureChain);
+ }
+ Instruction(JSGlobalData& globalData, JSCell* owner, JSCell* jsCell)
+ {
+ u.jsCell.clear();
+ u.jsCell.set(globalData, owner, jsCell);
+ }
+ Instruction(PolymorphicAccessStructureList* polymorphicStructures) { u.polymorphicStructures = polymorphicStructures; }
+ Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; }
+
+ union {
+ Opcode opcode;
+ int operand;
+ WriteBarrierBase<Structure> structure;
+ WriteBarrierBase<StructureChain> structureChain;
+ WriteBarrierBase<JSCell> jsCell;
+ PolymorphicAccessStructureList* polymorphicStructures;
+ PropertySlot::GetValueFunc getterFunc;
+ } u;
+
+ private:
+ Instruction(StructureChain*);
+ Instruction(Structure*);
+ };
+
+} // namespace JSC
+
+namespace WTF {
+
+ template<> struct VectorTraits<JSC::Instruction> : VectorTraitsBase<true, JSC::Instruction> { };
+
+} // namespace WTF
+
+#endif // Instruction_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/JumpTable.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/JumpTable.cpp
new file mode 100644
index 0000000..ef7098b
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/JumpTable.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/JumpTable.h
new file mode 100644
index 0000000..5bbe047
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Opcode.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Opcode.cpp
new file mode 100644
index 0000000..0bb714b
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Opcode.h
new file mode 100644
index 0000000..8082ae0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/Opcode.h
@@ -0,0 +1,275 @@
+/*
+ * 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_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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/SamplingTool.cpp
new file mode 100644
index 0000000..f47e698
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/SamplingTool.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/SamplingTool.h
new file mode 100644
index 0000000..1d77b31
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/SamplingTool.h
@@ -0,0 +1,421 @@
+/*
+ * 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 "Strong.h"
+#include "Nodes.h"
+#include "Opcode.h"
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/Threading.h>
+
+namespace JSC {
+
+ class ScriptExecutable;
+
+ class SamplingFlags {
+ 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;
+ };
+
+ static const void* addressOfFlags()
+ {
+ return &s_flags;
+ }
+
+#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(JSGlobalData& globalData, ScriptExecutable* executable)
+ : m_executable(globalData, 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*);
+
+ Strong<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 {
+ WTF_MAKE_NONCOPYABLE(CallRecord);
+ 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 {
+ WTF_MAKE_NONCOPYABLE(CallRecord);
+ 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 DeletableSamplingCounter;
+ public:
+ void count(uint32_t count = 1)
+ {
+ m_counter += count;
+ }
+
+ static void dump();
+
+ int64_t* addressOfCounter() { return &m_counter; }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
new file mode 100644
index 0000000..9dd41a6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
@@ -0,0 +1,112 @@
+/*
+ * 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"
+
+#include "JSObject.h"
+#include "ScopeChain.h"
+
+namespace JSC {
+
+#if ENABLE(JIT)
+void StructureStubInfo::deref()
+{
+ switch (accessType) {
+ case access_get_by_id_self_list: {
+ PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
+ delete polymorphicStructures;
+ return;
+ }
+ case access_get_by_id_proto_list: {
+ PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList;
+ delete polymorphicStructures;
+ return;
+ }
+ case access_get_by_id_self:
+ case access_get_by_id_proto:
+ case access_get_by_id_chain:
+ case access_put_by_id_transition:
+ case access_put_by_id_replace:
+ 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 have to release any allocated memory
+ return;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+void StructureStubInfo::visitAggregate(SlotVisitor& visitor)
+{
+ switch (accessType) {
+ case access_get_by_id_self:
+ visitor.append(&u.getByIdSelf.baseObjectStructure);
+ return;
+ case access_get_by_id_proto:
+ visitor.append(&u.getByIdProto.baseObjectStructure);
+ visitor.append(&u.getByIdProto.prototypeStructure);
+ return;
+ case access_get_by_id_chain:
+ visitor.append(&u.getByIdChain.baseObjectStructure);
+ visitor.append(&u.getByIdChain.chain);
+ return;
+ case access_get_by_id_self_list: {
+ PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
+ polymorphicStructures->visitAggregate(visitor, u.getByIdSelfList.listSize);
+ return;
+ }
+ case access_get_by_id_proto_list: {
+ PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList;
+ polymorphicStructures->visitAggregate(visitor, u.getByIdProtoList.listSize);
+ return;
+ }
+ case access_put_by_id_transition:
+ visitor.append(&u.putByIdTransition.previousStructure);
+ visitor.append(&u.putByIdTransition.structure);
+ visitor.append(&u.putByIdTransition.chain);
+ return;
+ case access_put_by_id_replace:
+ visitor.append(&u.putByIdReplace.baseObjectStructure);
+ 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 need to mark anything
+ return;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+#endif
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.h
new file mode 100644
index 0000000..7f11edd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecode/StructureStubInfo.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 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(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure)
+ {
+ accessType = access_get_by_id_self;
+
+ u.getByIdSelf.baseObjectStructure.set(globalData, owner, baseObjectStructure);
+ }
+
+ void initGetByIdProto(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, Structure* prototypeStructure)
+ {
+ accessType = access_get_by_id_proto;
+
+ u.getByIdProto.baseObjectStructure.set(globalData, owner, baseObjectStructure);
+ u.getByIdProto.prototypeStructure.set(globalData, owner, prototypeStructure);
+ }
+
+ void initGetByIdChain(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, StructureChain* chain)
+ {
+ accessType = access_get_by_id_chain;
+
+ u.getByIdChain.baseObjectStructure.set(globalData, owner, baseObjectStructure);
+ u.getByIdChain.chain.set(globalData, owner, chain);
+ }
+
+ 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(JSGlobalData& globalData, JSCell* owner, Structure* previousStructure, Structure* structure, StructureChain* chain)
+ {
+ accessType = access_put_by_id_transition;
+
+ u.putByIdTransition.previousStructure.set(globalData, owner, previousStructure);
+ u.putByIdTransition.structure.set(globalData, owner, structure);
+ u.putByIdTransition.chain.set(globalData, owner, chain);
+ }
+
+ void initPutByIdReplace(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure)
+ {
+ accessType = access_put_by_id_replace;
+
+ u.putByIdReplace.baseObjectStructure.set(globalData, owner, baseObjectStructure);
+ }
+
+ void deref();
+ void visitAggregate(SlotVisitor&);
+
+ bool seenOnce()
+ {
+ return seen;
+ }
+
+ void setSeen()
+ {
+ seen = true;
+ }
+
+ int accessType : 31;
+ int seen : 1;
+
+ union {
+ struct {
+ WriteBarrierBase<Structure> baseObjectStructure;
+ } getByIdSelf;
+ struct {
+ WriteBarrierBase<Structure> baseObjectStructure;
+ WriteBarrierBase<Structure> prototypeStructure;
+ } getByIdProto;
+ struct {
+ WriteBarrierBase<Structure> baseObjectStructure;
+ WriteBarrierBase<StructureChain> chain;
+ } getByIdChain;
+ struct {
+ PolymorphicAccessStructureList* structureList;
+ int listSize;
+ } getByIdSelfList;
+ struct {
+ PolymorphicAccessStructureList* structureList;
+ int listSize;
+ } getByIdProtoList;
+ struct {
+ WriteBarrierBase<Structure> previousStructure;
+ WriteBarrierBase<Structure> structure;
+ WriteBarrierBase<StructureChain> chain;
+ } putByIdTransition;
+ struct {
+ WriteBarrierBase<Structure> baseObjectStructure;
+ } putByIdReplace;
+ } u;
+
+ CodeLocationLabel stubRoutine;
+ CodeLocationCall callReturnLocation;
+ CodeLocationLabel hotPathBegin;
+ };
+
+} // namespace JSC
+
+#endif
+
+#endif // StructureStubInfo_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
new file mode 100644
index 0000000..1c126de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -0,0 +1,2248 @@
+/*
+ * 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 "JSFunction.h"
+#include "Interpreter.h"
+#include "ScopeChain.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
+}
+
+JSObject* 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();
+
+ if (m_expressionTooDeep)
+ return createOutOfMemoryError(m_scopeChain->globalObject.get());
+ return 0;
+}
+
+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, ScopeChainNode* scopeChain, SymbolTable* symbolTable, ProgramCodeBlock* codeBlock)
+ : m_shouldEmitDebugHooks(scopeChain->globalObject->debugger())
+ , m_shouldEmitProfileHooks(scopeChain->globalObject->supportsProfiling())
+ , m_shouldEmitRichSourceInfo(scopeChain->globalObject->supportsRichSourceInfo())
+ , m_scopeChain(*scopeChain->globalData, 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->globalData)
+ , m_lastOpcodeID(op_end)
+#ifndef NDEBUG
+ , m_lastOpcodePosition(0)
+#endif
+ , m_stack(m_globalData->stack())
+ , m_usesExceptions(false)
+ , m_expressionTooDeep(false)
+{
+ 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.get();
+ 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(*m_globalData, 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();
+
+ HashSet<StringImpl*, IdentifierRepHash> newGlobals;
+ Vector<std::pair<int, bool>, 16> functionInfo(functionStack.size());
+ for (size_t i = 0; i < functionStack.size(); ++i) {
+ FunctionBodyNode* function = functionStack[i];
+ globalObject->removeDirect(*m_globalData, function->ident()); // Make sure our new function is not shadowed by an old property.
+ SymbolTableEntry entry = symbolTable->inlineGet(function->ident().impl());
+
+ if (entry.isNull())
+ newGlobals.add(function->ident().impl());
+ functionInfo[i] = make_pair(entry.getIndex(), entry.isReadOnly());
+ }
+
+ Vector<bool, 16> shouldCreateVar(varStack.size());
+ for (size_t i = 0; i < varStack.size(); ++i) {
+ if (newGlobals.contains(varStack[i].first->impl()) || globalObject->hasProperty(exec, *varStack[i].first)) {
+ shouldCreateVar[i] = false;
+ continue;
+ }
+ shouldCreateVar[i] = true;
+ newGlobals.add(varStack[i].first->impl());
+ }
+
+ int expectedSize = symbolTable->size() + newGlobals.size();
+ globalObject->resizeRegisters(symbolTable->size(), expectedSize);
+
+ for (size_t i = 0; i < functionStack.size(); ++i) {
+ FunctionBodyNode* function = functionStack[i];
+ if (functionInfo[i].second)
+ continue;
+ RegisterID* dst = addGlobalVar(function->ident(), false);
+ JSValue value = new (exec) JSFunction(exec, makeFunction(exec, function), scopeChain);
+ globalObject->registerAt(dst->index() - m_globalVarStorageOffset).set(*m_globalData, globalObject, value);
+ }
+
+ for (size_t i = 0; i < varStack.size(); ++i) {
+ if (!shouldCreateVar[i])
+ continue;
+ addGlobalVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant);
+ }
+ if (symbolTable->size() != expectedSize)
+ CRASH();
+
+ preserveLastVar();
+ } 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), DontDelete);
+ }
+ for (size_t i = 0; i < varStack.size(); ++i) {
+ if (globalObject->symbolTableHasProperty(*varStack[i].first) || 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, ScopeChainNode* scopeChain, SymbolTable* symbolTable, CodeBlock* codeBlock)
+ : m_shouldEmitDebugHooks(scopeChain->globalObject->debugger())
+ , m_shouldEmitProfileHooks(scopeChain->globalObject->supportsProfiling())
+ , m_shouldEmitRichSourceInfo(scopeChain->globalObject->supportsRichSourceInfo())
+ , m_scopeChain(*scopeChain->globalData, 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->globalData)
+ , m_lastOpcodeID(op_end)
+#ifndef NDEBUG
+ , m_lastOpcodePosition(0)
+#endif
+ , m_stack(m_globalData->stack())
+ , m_usesExceptions(false)
+ , m_expressionTooDeep(false)
+{
+ 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, ScopeChainNode* scopeChain, SymbolTable* symbolTable, EvalCodeBlock* codeBlock)
+ : m_shouldEmitDebugHooks(scopeChain->globalObject->debugger())
+ , m_shouldEmitProfileHooks(scopeChain->globalObject->supportsProfiling())
+ , m_shouldEmitRichSourceInfo(scopeChain->globalObject->supportsRichSourceInfo())
+ , m_scopeChain(*scopeChain->globalData, 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->globalData)
+ , m_lastOpcodeID(op_end)
+#ifndef NDEBUG
+ , m_lastOpcodePosition(0)
+#endif
+ , m_stack(m_globalData->stack())
+ , m_usesExceptions(false)
+ , m_expressionTooDeep(false)
+{
+ 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(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->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(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->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->addConstant(JSValue(v));
+ } else
+ index = result.first->second;
+
+ return &m_constantPoolRegisters[index];
+}
+
+unsigned BytecodeGenerator::addRegExp(PassRefPtr<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()).get().isString()) {
+ const UString& value = asString(m_codeBlock->constantRegister(src2->index()).get())->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 JSValue each time.
+ // Later we can do the extra work to handle that like the other cases. They also don't
+ // work correctly with NaN as a key.
+ if (isnan(number) || 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->get();
+ 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->get();
+ 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->get();
+ 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 (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());
+#endif
+#if ENABLE(INTERPRETER)
+ 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;
+
+ // 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());
+#endif
+#if ENABLE(INTERPRETER)
+ 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));
+#endif
+
+#if ENABLE(INTERPRETER)
+ 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));
+#endif
+#if ENABLE(INTERPRETER)
+ 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));
+#endif
+#if ENABLE(INTERPRETER)
+ 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, PassRefPtr<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());
+}
+
+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.
+ m_expressionTooDeep = true;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
new file mode 100644
index 0000000..05a955b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -0,0 +1,579 @@
+/*
+ * 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/PassRefPtr.h>
+#include <wtf/SegmentedVector.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ class Identifier;
+ class ScopeChainNode;
+
+ 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ typedef DeclarationStacks::VarStack VarStack;
+ typedef DeclarationStacks::FunctionStack FunctionStack;
+
+ static void setDumpsGeneratedCode(bool dumpsGeneratedCode);
+ static bool dumpsGeneratedCode();
+
+ BytecodeGenerator(ProgramNode*, ScopeChainNode*, SymbolTable*, ProgramCodeBlock*);
+ BytecodeGenerator(FunctionBodyNode*, ScopeChainNode*, SymbolTable*, CodeBlock*);
+ BytecodeGenerator(EvalNode*, ScopeChainNode*, SymbolTable*, EvalCodeBlock*);
+
+ JSGlobalData* globalData() const { return m_globalData; }
+ const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; }
+
+ bool isConstructor() { return m_codeBlock->m_isConstructor; }
+
+ JSObject* 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, PassRefPtr<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 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; }
+
+ 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(PassRefPtr<RegExp>);
+
+ FunctionExecutable* makeFunction(ExecState* exec, FunctionBodyNode* body)
+ {
+ return FunctionExecutable::create(exec, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());
+ }
+
+ 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;
+
+ Strong<ScopeChainNode> 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_expressionTooDeep;
+ };
+
+}
+
+#endif // BytecodeGenerator_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/Label.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/Label.h
index 8cab1db..8cab1db 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/Label.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/Label.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/LabelScope.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/LabelScope.h
index cc21fff..cc21fff 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/LabelScope.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/LabelScope.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
new file mode 100644
index 0000000..03578cf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
@@ -0,0 +1,2055 @@
+/*
+* 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();
+}
+
+// ------------------------------ 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)
+{
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitNewRegExp(generator.finalDestination(dst),
+ generator.globalData()->regExpCache()->lookupOrCreate(m_pattern.ustring(), regExpFlags(m_flags.ustring())));
+}
+
+// ------------------------------ 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);
+ ASSERT(scope);
+
+ 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);
+ ASSERT(scope);
+
+ generator.emitJumpScopes(scope->breakTarget(), scope->scopeDepth());
+ return dst;
+}
+
+// ------------------------------ ReturnNode -----------------------------------
+
+RegisterID* ReturnNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ ASSERT(generator.codeType() == FunctionCode);
+
+ 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());
+
+ ASSERT(!generator.breakTarget(m_name));
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/RegisterID.h b/src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/RegisterID.h
new file mode 100644
index 0000000..78d49d2
--- /dev/null
+++ b/src/3rdparty/webkit/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/VectorTraits.h>
+
+namespace JSC {
+
+ class RegisterID {
+ WTF_MAKE_NONCOPYABLE(RegisterID);
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/config.h b/src/3rdparty/webkit/Source/JavaScriptCore/config.h
new file mode 100644
index 0000000..394bba5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/config.h
@@ -0,0 +1,126 @@
+/*
+ * 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>
+
+/* See note in wtf/Platform.h for more info on EXPORT_MACROS. */
+#if USE(EXPORT_MACROS)
+
+#include <wtf/ExportMacros.h>
+
+#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
+#define WTF_EXPORT_PRIVATE WTF_EXPORT
+#define JS_EXPORT_PRIVATE WTF_EXPORT
+#else
+#define WTF_EXPORT_PRIVATE WTF_IMPORT
+#define JS_EXPORT_PRIVATE WTF_IMPORT
+#endif
+
+#define JS_EXPORTDATA JS_EXPORT_PRIVATE
+#define JS_EXPORTCLASS JS_EXPORT_PRIVATE
+
+#else /* !USE(EXPORT_MACROS) */
+
+#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
+
+#define WTF_EXPORT_PRIVATE
+#define JS_EXPORT_PRIVATE
+
+#endif /* USE(EXPORT_MACROS) */
+
+#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(UNIX) || OS(WINDOWS)
+#define WTF_USE_OS_RANDOMNESS 1
+#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/src/3rdparty/webkit/Source/JavaScriptCore/create_hash_table b/src/3rdparty/webkit/Source/JavaScriptCore/create_hash_table
new file mode 100755
index 0000000..6078f97
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/create_jit_stubs b/src/3rdparty/webkit/Source/JavaScriptCore/create_jit_stubs
new file mode 100644
index 0000000..f0fcb53
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/create_jit_stubs
@@ -0,0 +1,75 @@
+#! /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 file";
+
+my $rtype_template = quotemeta("#rtype#");
+my $op_template = quotemeta("#op#");
+
+my $prefix;
+my $file;
+
+my $getOptionsResult = GetOptions(
+ 'prefix=s' => \$prefix
+);
+
+$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;
+ 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);
+ $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/src/3rdparty/webkit/Source/JavaScriptCore/create_regex_tables b/src/3rdparty/webkit/Source/JavaScriptCore/create_regex_tables
new file mode 100644
index 0000000..bd799ba
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/create_regex_tables
@@ -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. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED 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 sys
+
+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 = "";
+emitTables = (len(sys.argv) < 2 or sys.argv[1] != "--no-tables")
+
+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 emitTables and 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 emitTables and 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
+
+if (len(sys.argv) > 1):
+ f = open(sys.argv[-1], "w")
+ f.write(arrays)
+ f.write(functions)
+ f.close()
+else:
+ print(arrays)
+ print(functions)
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/debugger/Debugger.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/Debugger.cpp
new file mode 100644
index 0000000..64f6002
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/Debugger.cpp
@@ -0,0 +1,145 @@
+/*
+ * 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 "Error.h"
+#include "Interpreter.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "Parser.h"
+#include "Protect.h"
+
+namespace {
+
+using namespace JSC;
+
+class Recompiler {
+public:
+ Recompiler(Debugger*);
+ ~Recompiler();
+ void operator()(JSCell*);
+
+private:
+ typedef HashSet<FunctionExecutable*> FunctionExecutableSet;
+ typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;
+
+ Debugger* m_debugger;
+ FunctionExecutableSet m_functionExecutables;
+ SourceProviderMap m_sourceProviders;
+};
+
+inline Recompiler::Recompiler(Debugger* debugger)
+ : m_debugger(debugger)
+{
+}
+
+inline Recompiler::~Recompiler()
+{
+ // Call sourceParsed() after reparsing all functions because it will execute
+ // JavaScript in the inspector.
+ SourceProviderMap::const_iterator end = m_sourceProviders.end();
+ for (SourceProviderMap::const_iterator iter = m_sourceProviders.begin(); iter != end; ++iter)
+ m_debugger->sourceParsed(iter->second, iter->first, -1, UString());
+}
+
+inline void Recompiler::operator()(JSCell* cell)
+{
+ if (!cell->inherits(&JSFunction::s_info))
+ return;
+
+ JSFunction* function = asFunction(cell);
+ if (function->executable()->isHostFunction())
+ return;
+
+ 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 (!m_functionExecutables.add(executable).second)
+ return;
+
+ ExecState* exec = function->scope()->globalObject->JSGlobalObject::globalExec();
+ executable->discardCode();
+ if (m_debugger == function->scope()->globalObject->debugger())
+ m_sourceProviders.add(executable->source().provider(), exec);
+}
+
+} // namespace
+
+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;
+
+ Recompiler recompiler(this);
+ globalData->heap.forEach(recompiler);
+}
+
+JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
+{
+ CallFrame* globalCallFrame = globalObject->globalExec();
+ JSGlobalData& globalData = globalObject->globalData();
+
+ EvalExecutable* eval = EvalExecutable::create(globalCallFrame, makeSource(script), false);
+ if (!eval) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ return exception;
+ }
+
+ JSValue result = globalData.interpreter->execute(eval, globalCallFrame, globalObject, globalCallFrame->scopeChain());
+ if (globalData.exception) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ }
+ ASSERT(result);
+ return result;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/debugger/Debugger.h b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/Debugger.h
new file mode 100644
index 0000000..ec5cf37
--- /dev/null
+++ b/src/3rdparty/webkit/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 SourceProvider;
+ class UString;
+
+ class Debugger {
+ public:
+ virtual ~Debugger();
+
+ void attach(JSGlobalObject*);
+ virtual void detach(JSGlobalObject*);
+
+ virtual void sourceParsed(ExecState*, SourceProvider*, 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/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerActivation.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerActivation.cpp
new file mode 100644
index 0000000..bc5f408
--- /dev/null
+++ b/src/3rdparty/webkit/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(JSGlobalData& globalData, JSObject* activation)
+ : JSNonFinalObject(globalData, globalData.debuggerActivationStructure.get())
+{
+ ASSERT(activation);
+ ASSERT(activation->isActivationObject());
+ m_activation.set(globalData, this, static_cast<JSActivation*>(activation));
+}
+
+void DebuggerActivation::visitChildren(SlotVisitor& visitor)
+{
+ JSObject::visitChildren(visitor);
+
+ if (m_activation)
+ visitor.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/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerActivation.h b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerActivation.h
new file mode 100644
index 0000000..574986a
--- /dev/null
+++ b/src/3rdparty/webkit/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 JSNonFinalObject {
+ public:
+ DebuggerActivation(JSGlobalData&, JSObject*);
+
+ virtual void visitChildren(SlotVisitor&);
+ 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 Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | JSObject::StructureFlags;
+
+ private:
+ WriteBarrier<JSActivation> m_activation;
+ };
+
+} // namespace JSC
+
+#endif // DebuggerActivation_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
new file mode 100644
index 0000000..08fba4a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -0,0 +1,107 @@
+/*
+ * 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::s_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::s_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();
+
+ JSGlobalData& globalData = m_callFrame->globalData();
+ EvalExecutable* eval = EvalExecutable::create(m_callFrame, makeSource(script), m_callFrame->codeBlock()->isStrictMode());
+ if (globalData.exception) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ }
+
+ JSValue result = globalData.interpreter->execute(eval, m_callFrame, thisObject(), m_callFrame->scopeChain());
+ if (globalData.exception) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ }
+ ASSERT(result);
+ return result;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerCallFrame.h b/src/3rdparty/webkit/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
new file mode 100644
index 0000000..f6b415c
--- /dev/null
+++ b/src/3rdparty/webkit/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(); }
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGAliasTracker.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGAliasTracker.h
new file mode 100644
index 0000000..8710169
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGAliasTracker.h
@@ -0,0 +1,121 @@
+/*
+ * 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 DFGAliasTracker_h
+#define DFGAliasTracker_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGGraph.h>
+#include <wtf/Vector.h>
+
+namespace JSC { namespace DFG {
+
+// === AliasTracker ===
+//
+// This class id used to detect aliasing property accesses, which we may
+// be able to speculatively optimize (for example removing redundant loads
+// where we know a getter will not be called, or optimizing puts to arrays
+// where we know the value being written to in within length and is not a
+// hole value). In time, this should be more than a 1-deep buffer!
+class AliasTracker {
+public:
+ AliasTracker(Graph& graph)
+ : m_graph(graph)
+ , m_candidateAliasGetByVal(NoNode)
+ {
+ }
+
+ NodeIndex lookupGetByVal(NodeIndex base, NodeIndex property)
+ {
+ // Try to detect situations where a GetByVal follows another GetByVal to the same
+ // property; in these cases, we may be able to omit the subsequent get on the
+ // speculative path, where we know conditions hold to make this safe (for example,
+ // on the speculative path we will not have allowed getter access).
+ if (m_candidateAliasGetByVal != NoNode) {
+ Node& possibleAlias = m_graph[m_candidateAliasGetByVal];
+ ASSERT(possibleAlias.op == GetByVal);
+ // This check ensures the accesses alias, provided that the subscript is an
+ // integer index (this is good enough; the speculative path will only generate
+ // optimized accesses to handle integer subscripts).
+ if (possibleAlias.child1 == base && equalIgnoringLaterNumericConversion(possibleAlias.child2, property))
+ return m_candidateAliasGetByVal;
+ }
+ return NoNode;
+ }
+
+ void recordGetByVal(NodeIndex getByVal)
+ {
+ m_candidateAliasGetByVal = getByVal;
+ }
+
+ void recordPutByVal(NodeIndex putByVal)
+ {
+ ASSERT_UNUSED(putByVal, m_graph[putByVal].op == PutByVal || m_graph[putByVal].op == PutByValAlias);
+ m_candidateAliasGetByVal = NoNode;
+ }
+
+ void recordGetById(NodeIndex getById)
+ {
+ ASSERT_UNUSED(getById, m_graph[getById].op == GetById);
+ m_candidateAliasGetByVal = NoNode;
+ }
+
+ void recordPutById(NodeIndex putById)
+ {
+ ASSERT_UNUSED(putById, m_graph[putById].op == PutById);
+ m_candidateAliasGetByVal = NoNode;
+ }
+
+ void recordPutByIdDirect(NodeIndex putByVal)
+ {
+ ASSERT_UNUSED(putByVal, m_graph[putByVal].op == PutByIdDirect);
+ m_candidateAliasGetByVal = NoNode;
+ }
+
+private:
+ // This method returns true for arguments:
+ // - (X, X)
+ // - (X, ValueToNumber(X))
+ // - (X, ValueToInt32(X))
+ // - (X, NumberToInt32(X))
+ bool equalIgnoringLaterNumericConversion(NodeIndex op1, NodeIndex op2)
+ {
+ if (op1 == op2)
+ return true;
+ Node& node2 = m_graph[op2];
+ return (node2.op == ValueToNumber || node2.op == ValueToInt32 || node2.op == NumberToInt32) && op1 == node2.child1;
+ }
+
+ // The graph, to look up potentially aliasing nodes.
+ Graph& m_graph;
+ // Currently a 1-deep buffer!
+ NodeIndex m_candidateAliasGetByVal;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
new file mode 100644
index 0000000..7c333de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
@@ -0,0 +1,1198 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "DFGByteCodeParser.h"
+
+#if ENABLE(DFG_JIT)
+
+#include "DFGAliasTracker.h"
+#include "DFGScoreBoard.h"
+#include "CodeBlock.h"
+
+namespace JSC { namespace DFG {
+
+#if ENABLE(DFG_JIT_RESTRICTIONS)
+// FIXME: Temporarily disable arithmetic, until we fix associated performance regressions.
+#define ARITHMETIC_OP() m_parseFailed = true
+#else
+#define ARITHMETIC_OP() ((void)0)
+#endif
+
+// === ByteCodeParser ===
+//
+// This class is used to compile the dataflow graph from a CodeBlock.
+class ByteCodeParser {
+public:
+ ByteCodeParser(JSGlobalData* globalData, CodeBlock* codeBlock, Graph& graph)
+ : m_globalData(globalData)
+ , m_codeBlock(codeBlock)
+ , m_graph(graph)
+ , m_currentIndex(0)
+ , m_parseFailed(false)
+ , m_constantUndefined(UINT_MAX)
+ , m_constantNull(UINT_MAX)
+ , m_constant1(UINT_MAX)
+ , m_constants(codeBlock->numberOfConstantRegisters())
+ , m_numArguments(codeBlock->m_numParameters)
+ , m_numLocals(codeBlock->m_numCalleeRegisters)
+ , m_preservedVars(codeBlock->m_numVars)
+ {
+ }
+
+ // Parse a full CodeBlock of bytecode.
+ bool parse();
+
+private:
+ // Parse a single basic block of bytecode instructions.
+ bool parseBlock(unsigned limit);
+ // Setup predecessor links in the graph's BasicBlocks.
+ void setupPredecessors();
+ // Link GetLocal & SetLocal nodes, to ensure live values are generated.
+ enum PhiStackType {
+ LocalPhiStack,
+ ArgumentPhiStack
+ };
+ template<PhiStackType stackType>
+ void processPhiStack();
+ // Add spill locations to nodes.
+ void allocateVirtualRegisters();
+
+ // Get/Set the operands/result of a bytecode instruction.
+ NodeIndex get(int operand)
+ {
+ // Is this a constant?
+ if (operand >= FirstConstantRegisterIndex) {
+ unsigned constant = operand - FirstConstantRegisterIndex;
+ ASSERT(constant < m_constants.size());
+ return getJSConstant(constant);
+ }
+
+ // Is this an argument?
+ if (operandIsArgument(operand))
+ return getArgument(operand);
+
+ // Must be a local.
+ return getLocal((unsigned)operand);
+ }
+ void set(int operand, NodeIndex value, PredictedType prediction = PredictNone)
+ {
+ m_graph.predict(operand, prediction);
+
+ // Is this an argument?
+ if (operandIsArgument(operand)) {
+ setArgument(operand, value);
+ return;
+ }
+
+ // Must be a local.
+ setLocal((unsigned)operand, value);
+ }
+
+ // Used in implementing get/set, above, where the operand is a local variable.
+ NodeIndex getLocal(unsigned operand)
+ {
+ NodeIndex nodeIndex = m_currentBlock->m_locals[operand].value;
+
+ if (nodeIndex != NoNode) {
+ Node& node = m_graph[nodeIndex];
+ if (node.op == GetLocal)
+ return nodeIndex;
+ ASSERT(node.op == SetLocal);
+ return node.child1;
+ }
+
+ // Check for reads of temporaries from prior blocks,
+ // expand m_preservedVars to cover these.
+ m_preservedVars = std::max(m_preservedVars, operand + 1);
+
+ NodeIndex phi = addToGraph(Phi);
+ m_localPhiStack.append(PhiStackEntry(m_currentBlock, phi, operand));
+ nodeIndex = addToGraph(GetLocal, OpInfo(operand), phi);
+ m_currentBlock->m_locals[operand].value = nodeIndex;
+ return nodeIndex;
+ }
+ void setLocal(unsigned operand, NodeIndex value)
+ {
+ m_currentBlock->m_locals[operand].value = addToGraph(SetLocal, OpInfo(operand), value);
+ }
+
+ // Used in implementing get/set, above, where the operand is an argument.
+ NodeIndex getArgument(unsigned operand)
+ {
+ unsigned argument = operand + m_codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize;
+ ASSERT(argument < m_numArguments);
+
+ NodeIndex nodeIndex = m_currentBlock->m_arguments[argument].value;
+
+ if (nodeIndex != NoNode) {
+ Node& node = m_graph[nodeIndex];
+ if (node.op == GetLocal)
+ return nodeIndex;
+ ASSERT(node.op == SetLocal);
+ return node.child1;
+ }
+
+ NodeIndex phi = addToGraph(Phi);
+ m_argumentPhiStack.append(PhiStackEntry(m_currentBlock, phi, argument));
+ nodeIndex = addToGraph(GetLocal, OpInfo(operand), phi);
+ m_currentBlock->m_arguments[argument].value = nodeIndex;
+ return nodeIndex;
+ }
+ void setArgument(int operand, NodeIndex value)
+ {
+ unsigned argument = operand + m_codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize;
+ ASSERT(argument < m_numArguments);
+
+ m_currentBlock->m_arguments[argument].value = addToGraph(SetLocal, OpInfo(operand), value);
+ }
+
+ // Get an operand, and perform a ToInt32/ToNumber conversion on it.
+ NodeIndex getToInt32(int operand)
+ {
+ // Avoid wastefully adding a JSConstant node to the graph, only to
+ // replace it with a Int32Constant (which is what would happen if
+ // we called 'toInt32(get(operand))' in this case).
+ if (operand >= FirstConstantRegisterIndex) {
+ JSValue v = m_codeBlock->getConstant(operand);
+ if (v.isInt32())
+ return getInt32Constant(v.asInt32(), operand - FirstConstantRegisterIndex);
+ }
+ return toInt32(get(operand));
+ }
+ NodeIndex getToNumber(int operand)
+ {
+ // Avoid wastefully adding a JSConstant node to the graph, only to
+ // replace it with a DoubleConstant (which is what would happen if
+ // we called 'toNumber(get(operand))' in this case).
+ if (operand >= FirstConstantRegisterIndex) {
+ JSValue v = m_codeBlock->getConstant(operand);
+ if (v.isNumber())
+ return getDoubleConstant(v.uncheckedGetNumber(), operand - FirstConstantRegisterIndex);
+ }
+ return toNumber(get(operand));
+ }
+
+ // Perform an ES5 ToInt32 operation - returns a node of type NodeResultInt32.
+ NodeIndex toInt32(NodeIndex index)
+ {
+ Node& node = m_graph[index];
+
+ if (node.hasInt32Result())
+ return index;
+
+ if (node.hasDoubleResult()) {
+ if (node.op == DoubleConstant)
+ return getInt32Constant(JSC::toInt32(valueOfDoubleConstant(index)), node.constantNumber());
+ // 'NumberToInt32(Int32ToNumber(X))' == X, and 'NumberToInt32(UInt32ToNumber(X)) == X'
+ if (node.op == Int32ToNumber || node.op == UInt32ToNumber)
+ return node.child1;
+
+ // We unique NumberToInt32 nodes in a map to prevent duplicate conversions.
+ pair<UnaryOpMap::iterator, bool> result = m_numberToInt32Nodes.add(index, NoNode);
+ // Either we added a new value, or the existing value in the map is non-zero.
+ ASSERT(result.second == (result.first->second == NoNode));
+ if (result.second)
+ result.first->second = addToGraph(NumberToInt32, index);
+ return result.first->second;
+ }
+
+ // Check for numeric constants boxed as JSValues.
+ if (node.op == JSConstant) {
+ JSValue v = valueOfJSConstant(index);
+ if (v.isInt32())
+ return getInt32Constant(v.asInt32(), node.constantNumber());
+ if (v.isNumber())
+ return getInt32Constant(JSC::toInt32(v.uncheckedGetNumber()), node.constantNumber());
+ }
+
+ return addToGraph(ValueToInt32, index);
+ }
+
+ // Perform an ES5 ToNumber operation - returns a node of type NodeResultDouble.
+ NodeIndex toNumber(NodeIndex index)
+ {
+ Node& node = m_graph[index];
+
+ if (node.hasDoubleResult())
+ return index;
+
+ if (node.hasInt32Result()) {
+ if (node.op == Int32Constant)
+ return getDoubleConstant(valueOfInt32Constant(index), node.constantNumber());
+
+ // We unique Int32ToNumber nodes in a map to prevent duplicate conversions.
+ pair<UnaryOpMap::iterator, bool> result = m_int32ToNumberNodes.add(index, NoNode);
+ // Either we added a new value, or the existing value in the map is non-zero.
+ ASSERT(result.second == (result.first->second == NoNode));
+ if (result.second)
+ result.first->second = addToGraph(Int32ToNumber, index);
+ return result.first->second;
+ }
+
+ if (node.op == JSConstant) {
+ JSValue v = valueOfJSConstant(index);
+ if (v.isNumber())
+ return getDoubleConstant(v.uncheckedGetNumber(), node.constantNumber());
+ }
+
+ return addToGraph(ValueToNumber, index);
+ }
+
+
+ // Used in implementing get, above, where the operand is a constant.
+ NodeIndex getInt32Constant(int32_t value, unsigned constant)
+ {
+ NodeIndex index = m_constants[constant].asInt32;
+ if (index != NoNode)
+ return index;
+ NodeIndex resultIndex = addToGraph(Int32Constant, OpInfo(constant));
+ m_graph[resultIndex].setInt32Constant(value);
+ m_constants[constant].asInt32 = resultIndex;
+ return resultIndex;
+ }
+ NodeIndex getDoubleConstant(double value, unsigned constant)
+ {
+ NodeIndex index = m_constants[constant].asNumeric;
+ if (index != NoNode)
+ return index;
+ NodeIndex resultIndex = addToGraph(DoubleConstant, OpInfo(constant));
+ m_graph[resultIndex].setDoubleConstant(value);
+ m_constants[constant].asNumeric = resultIndex;
+ return resultIndex;
+ }
+ NodeIndex getJSConstant(unsigned constant)
+ {
+ NodeIndex index = m_constants[constant].asJSValue;
+ if (index != NoNode)
+ return index;
+
+ NodeIndex resultIndex = addToGraph(JSConstant, OpInfo(constant));
+ m_constants[constant].asJSValue = resultIndex;
+ return resultIndex;
+ }
+
+ // Helper functions to get/set the this value.
+ NodeIndex getThis()
+ {
+ return getArgument(m_codeBlock->thisRegister());
+ }
+ void setThis(NodeIndex value)
+ {
+ setArgument(m_codeBlock->thisRegister(), value);
+ }
+
+ // Convenience methods for checking nodes for constants.
+ bool isInt32Constant(NodeIndex index)
+ {
+ return m_graph[index].op == Int32Constant;
+ }
+ bool isDoubleConstant(NodeIndex index)
+ {
+ return m_graph[index].op == DoubleConstant;
+ }
+ bool isJSConstant(NodeIndex index)
+ {
+ return m_graph[index].op == JSConstant;
+ }
+
+ // Convenience methods for getting constant values.
+ int32_t valueOfInt32Constant(NodeIndex index)
+ {
+ ASSERT(isInt32Constant(index));
+ return m_graph[index].int32Constant();
+ }
+ double valueOfDoubleConstant(NodeIndex index)
+ {
+ ASSERT(isDoubleConstant(index));
+ return m_graph[index].numericConstant();
+ }
+ JSValue valueOfJSConstant(NodeIndex index)
+ {
+ ASSERT(isJSConstant(index));
+ return m_codeBlock->getConstant(FirstConstantRegisterIndex + m_graph[index].constantNumber());
+ }
+
+ // This method returns a JSConstant with the value 'undefined'.
+ NodeIndex constantUndefined()
+ {
+ // Has m_constantUndefined been set up yet?
+ if (m_constantUndefined == UINT_MAX) {
+ // Search the constant pool for undefined, if we find it, we can just reuse this!
+ unsigned numberOfConstants = m_codeBlock->numberOfConstantRegisters();
+ for (m_constantUndefined = 0; m_constantUndefined < numberOfConstants; ++m_constantUndefined) {
+ JSValue testMe = m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantUndefined);
+ if (testMe.isUndefined())
+ return getJSConstant(m_constantUndefined);
+ }
+
+ // Add undefined to the CodeBlock's constants, and add a corresponding slot in m_constants.
+ ASSERT(m_constants.size() == numberOfConstants);
+ m_codeBlock->addConstant(jsUndefined());
+ m_constants.append(ConstantRecord());
+ ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
+ }
+
+ // m_constantUndefined must refer to an entry in the CodeBlock's constant pool that has the value 'undefined'.
+ ASSERT(m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantUndefined).isUndefined());
+ return getJSConstant(m_constantUndefined);
+ }
+
+ // This method returns a JSConstant with the value 'null'.
+ NodeIndex constantNull()
+ {
+ // Has m_constantNull been set up yet?
+ if (m_constantNull == UINT_MAX) {
+ // Search the constant pool for null, if we find it, we can just reuse this!
+ unsigned numberOfConstants = m_codeBlock->numberOfConstantRegisters();
+ for (m_constantNull = 0; m_constantNull < numberOfConstants; ++m_constantNull) {
+ JSValue testMe = m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantNull);
+ if (testMe.isNull())
+ return getJSConstant(m_constantNull);
+ }
+
+ // Add null to the CodeBlock's constants, and add a corresponding slot in m_constants.
+ ASSERT(m_constants.size() == numberOfConstants);
+ m_codeBlock->addConstant(jsNull());
+ m_constants.append(ConstantRecord());
+ ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
+ }
+
+ // m_constantNull must refer to an entry in the CodeBlock's constant pool that has the value 'null'.
+ ASSERT(m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantNull).isNull());
+ return getJSConstant(m_constantNull);
+ }
+
+ // This method returns a DoubleConstant with the value 1.
+ NodeIndex one()
+ {
+ // Has m_constant1 been set up yet?
+ if (m_constant1 == UINT_MAX) {
+ // Search the constant pool for the value 1, if we find it, we can just reuse this!
+ unsigned numberOfConstants = m_codeBlock->numberOfConstantRegisters();
+ for (m_constant1 = 0; m_constant1 < numberOfConstants; ++m_constant1) {
+ JSValue testMe = m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constant1);
+ if (testMe.isInt32() && testMe.asInt32() == 1)
+ return getDoubleConstant(1, m_constant1);
+ }
+
+ // Add the value 1 to the CodeBlock's constants, and add a corresponding slot in m_constants.
+ ASSERT(m_constants.size() == numberOfConstants);
+ m_codeBlock->addConstant(jsNumber(1));
+ m_constants.append(ConstantRecord());
+ ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
+ }
+
+ // m_constant1 must refer to an entry in the CodeBlock's constant pool that has the integer value 1.
+ ASSERT(m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constant1).isInt32());
+ ASSERT(m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constant1).asInt32() == 1);
+ return getDoubleConstant(1, m_constant1);
+ }
+
+
+ // These methods create a node and add it to the graph. If nodes of this type are
+ // 'mustGenerate' then the node will implicitly be ref'ed to ensure generation.
+ NodeIndex addToGraph(NodeType op, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode)
+ {
+ NodeIndex resultIndex = (NodeIndex)m_graph.size();
+ m_graph.append(Node(op, m_currentIndex, child1, child2, child3));
+
+ if (op & NodeMustGenerate)
+ m_graph.ref(resultIndex);
+ return resultIndex;
+ }
+ NodeIndex addToGraph(NodeType op, OpInfo info, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode)
+ {
+ NodeIndex resultIndex = (NodeIndex)m_graph.size();
+ m_graph.append(Node(op, m_currentIndex, info, child1, child2, child3));
+
+ if (op & NodeMustGenerate)
+ m_graph.ref(resultIndex);
+ return resultIndex;
+ }
+ NodeIndex addToGraph(NodeType op, OpInfo info1, OpInfo info2, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode)
+ {
+ NodeIndex resultIndex = (NodeIndex)m_graph.size();
+ m_graph.append(Node(op, m_currentIndex, info1, info2, child1, child2, child3));
+
+ if (op & NodeMustGenerate)
+ m_graph.ref(resultIndex);
+ return resultIndex;
+ }
+
+ void predictArray(NodeIndex nodeIndex)
+ {
+ Node* nodePtr = &m_graph[nodeIndex];
+
+ if (nodePtr->op == GetLocal)
+ m_graph.predict(nodePtr->local(), PredictArray);
+ }
+
+ void predictInt32(NodeIndex nodeIndex)
+ {
+ Node* nodePtr = &m_graph[nodeIndex];
+
+ if (nodePtr->op == ValueToNumber)
+ nodePtr = &m_graph[nodePtr->child1];
+
+ if (nodePtr->op == ValueToInt32)
+ nodePtr = &m_graph[nodePtr->child1];
+
+ if (nodePtr->op == NumberToInt32)
+ nodePtr = &m_graph[nodePtr->child1];
+
+ if (nodePtr->op == GetLocal)
+ m_graph.predict(nodePtr->local(), PredictInt32);
+ }
+
+ JSGlobalData* m_globalData;
+ CodeBlock* m_codeBlock;
+ Graph& m_graph;
+
+ // The current block being generated.
+ BasicBlock* m_currentBlock;
+ // The bytecode index of the current instruction being generated.
+ unsigned m_currentIndex;
+
+ // Record failures due to unimplemented functionality or regressions.
+ bool m_parseFailed;
+
+ // We use these values during code generation, and to avoid the need for
+ // special handling we make sure they are available as constants in the
+ // CodeBlock's constant pool. These variables are initialized to
+ // UINT_MAX, and lazily updated to hold an index into the CodeBlock's
+ // constant pool, as necessary.
+ unsigned m_constantUndefined;
+ unsigned m_constantNull;
+ unsigned m_constant1;
+
+ // A constant in the constant pool may be represented by more than one
+ // node in the graph, depending on the context in which it is being used.
+ struct ConstantRecord {
+ ConstantRecord()
+ : asInt32(NoNode)
+ , asNumeric(NoNode)
+ , asJSValue(NoNode)
+ {
+ }
+
+ NodeIndex asInt32;
+ NodeIndex asNumeric;
+ NodeIndex asJSValue;
+ };
+
+ // Track the index of the node whose result is the current value for every
+ // register value in the bytecode - argument, local, and temporary.
+ Vector<ConstantRecord, 16> m_constants;
+
+ // The number of arguments passed to the function.
+ unsigned m_numArguments;
+ // The number of locals (vars + temporaries) used in the function.
+ unsigned m_numLocals;
+ // The number of registers we need to preserve across BasicBlock boundaries;
+ // typically equal to the number vars, but we expand this to cover all
+ // temporaries that persist across blocks (dues to ?:, &&, ||, etc).
+ unsigned m_preservedVars;
+
+ struct PhiStackEntry {
+ PhiStackEntry(BasicBlock* block, NodeIndex phi, unsigned varNo)
+ : m_block(block)
+ , m_phi(phi)
+ , m_varNo(varNo)
+ {
+ }
+
+ BasicBlock* m_block;
+ NodeIndex m_phi;
+ unsigned m_varNo;
+ };
+ Vector<PhiStackEntry, 16> m_argumentPhiStack;
+ Vector<PhiStackEntry, 16> m_localPhiStack;
+
+ // These maps are used to unique ToNumber and ToInt32 operations.
+ typedef HashMap<NodeIndex, NodeIndex> UnaryOpMap;
+ UnaryOpMap m_int32ToNumberNodes;
+ UnaryOpMap m_numberToInt32Nodes;
+};
+
+#define NEXT_OPCODE(name) \
+ m_currentIndex += OPCODE_LENGTH(name); \
+ continue
+
+#define LAST_OPCODE(name) \
+ m_currentIndex += OPCODE_LENGTH(name); \
+ return !m_parseFailed
+
+bool ByteCodeParser::parseBlock(unsigned limit)
+{
+ // No need to reset state initially, since it has been set by the constructor.
+ if (m_currentIndex) {
+ for (unsigned i = 0; i < m_constants.size(); ++i)
+ m_constants[i] = ConstantRecord();
+ }
+
+ AliasTracker aliases(m_graph);
+
+ Interpreter* interpreter = m_globalData->interpreter;
+ Instruction* instructionsBegin = m_codeBlock->instructions().begin();
+ while (true) {
+ // Don't extend over jump destinations.
+ if (m_currentIndex == limit) {
+ addToGraph(Jump, OpInfo(m_currentIndex));
+ return !m_parseFailed;
+ }
+
+ // Switch on the current bytecode opcode.
+ Instruction* currentInstruction = instructionsBegin + m_currentIndex;
+ switch (interpreter->getOpcodeID(currentInstruction->u.opcode)) {
+
+ // === Function entry opcodes ===
+
+ case op_enter:
+ // Initialize all locals to undefined.
+ for (int i = 0; i < m_codeBlock->m_numVars; ++i)
+ set(i, constantUndefined());
+ NEXT_OPCODE(op_enter);
+
+ case op_convert_this: {
+ NodeIndex op1 = getThis();
+ setThis(addToGraph(ConvertThis, op1));
+ NEXT_OPCODE(op_convert_this);
+ }
+
+ // === Bitwise operations ===
+
+ case op_bitand: {
+ NodeIndex op1 = getToInt32(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToInt32(currentInstruction[3].u.operand);
+ predictInt32(op1);
+ predictInt32(op2);
+ set(currentInstruction[1].u.operand, addToGraph(BitAnd, op1, op2), PredictInt32);
+ NEXT_OPCODE(op_bitand);
+ }
+
+ case op_bitor: {
+ NodeIndex op1 = getToInt32(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToInt32(currentInstruction[3].u.operand);
+ predictInt32(op1);
+ predictInt32(op2);
+ set(currentInstruction[1].u.operand, addToGraph(BitOr, op1, op2), PredictInt32);
+ NEXT_OPCODE(op_bitor);
+ }
+
+ case op_bitxor: {
+ NodeIndex op1 = getToInt32(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToInt32(currentInstruction[3].u.operand);
+ predictInt32(op1);
+ predictInt32(op2);
+ set(currentInstruction[1].u.operand, addToGraph(BitXor, op1, op2), PredictInt32);
+ NEXT_OPCODE(op_bitxor);
+ }
+
+ case op_rshift: {
+ NodeIndex op1 = getToInt32(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToInt32(currentInstruction[3].u.operand);
+ predictInt32(op1);
+ predictInt32(op2);
+ NodeIndex result;
+ // Optimize out shifts by zero.
+ if (isInt32Constant(op2) && !(valueOfInt32Constant(op2) & 0x1f))
+ result = op1;
+ else
+ result = addToGraph(BitRShift, op1, op2);
+ set(currentInstruction[1].u.operand, result, PredictInt32);
+ NEXT_OPCODE(op_rshift);
+ }
+
+ case op_lshift: {
+ NodeIndex op1 = getToInt32(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToInt32(currentInstruction[3].u.operand);
+ predictInt32(op1);
+ predictInt32(op2);
+ NodeIndex result;
+ // Optimize out shifts by zero.
+ if (isInt32Constant(op2) && !(valueOfInt32Constant(op2) & 0x1f))
+ result = op1;
+ else
+ result = addToGraph(BitLShift, op1, op2);
+ set(currentInstruction[1].u.operand, result, PredictInt32);
+ NEXT_OPCODE(op_lshift);
+ }
+
+ case op_urshift: {
+ NodeIndex op1 = getToInt32(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToInt32(currentInstruction[3].u.operand);
+ predictInt32(op1);
+ predictInt32(op2);
+ NodeIndex result;
+ // The result of a zero-extending right shift is treated as an unsigned value.
+ // This means that if the top bit is set, the result is not in the int32 range,
+ // and as such must be stored as a double. If the shift amount is a constant,
+ // we may be able to optimize.
+ if (isInt32Constant(op2)) {
+ // If we know we are shifting by a non-zero amount, then since the operation
+ // zero fills we know the top bit of the result must be zero, and as such the
+ // result must be within the int32 range. Conversely, if this is a shift by
+ // zero, then the result may be changed by the conversion to unsigned, but it
+ // is not necessary to perform the shift!
+ if (valueOfInt32Constant(op2) & 0x1f)
+ result = addToGraph(BitURShift, op1, op2);
+ else
+ result = addToGraph(UInt32ToNumber, op1);
+ } else {
+ // Cannot optimize at this stage; shift & potentially rebox as a double.
+ result = addToGraph(BitURShift, op1, op2);
+ result = addToGraph(UInt32ToNumber, result);
+ }
+ set(currentInstruction[1].u.operand, result, PredictInt32);
+ NEXT_OPCODE(op_urshift);
+ }
+
+ // === Increment/Decrement opcodes ===
+
+ case op_pre_inc: {
+ unsigned srcDst = currentInstruction[1].u.operand;
+ NodeIndex op = getToNumber(srcDst);
+ predictInt32(op);
+ set(srcDst, addToGraph(ArithAdd, op, one()));
+ NEXT_OPCODE(op_pre_inc);
+ }
+
+ case op_post_inc: {
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+ NodeIndex op = getToNumber(srcDst);
+ predictInt32(op);
+ set(result, op);
+ set(srcDst, addToGraph(ArithAdd, op, one()));
+ NEXT_OPCODE(op_post_inc);
+ }
+
+ case op_pre_dec: {
+ unsigned srcDst = currentInstruction[1].u.operand;
+ NodeIndex op = getToNumber(srcDst);
+ predictInt32(op);
+ set(srcDst, addToGraph(ArithSub, op, one()));
+ NEXT_OPCODE(op_pre_dec);
+ }
+
+ case op_post_dec: {
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+ NodeIndex op = getToNumber(srcDst);
+ predictInt32(op);
+ set(result, op);
+ set(srcDst, addToGraph(ArithSub, op, one()));
+ NEXT_OPCODE(op_post_dec);
+ }
+
+ // === Arithmetic operations ===
+
+ case op_add: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = get(currentInstruction[2].u.operand);
+ NodeIndex op2 = get(currentInstruction[3].u.operand);
+ // If both operands can statically be determined to the numbers, then this is an arithmetic add.
+ // Otherwise, we must assume this may be performing a concatenation to a string.
+ if (m_graph[op1].hasNumericResult() && m_graph[op2].hasNumericResult())
+ set(currentInstruction[1].u.operand, addToGraph(ArithAdd, toNumber(op1), toNumber(op2)));
+ else
+ set(currentInstruction[1].u.operand, addToGraph(ValueAdd, op1, op2));
+ NEXT_OPCODE(op_add);
+ }
+
+ case op_sub: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = getToNumber(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToNumber(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(ArithSub, op1, op2));
+ NEXT_OPCODE(op_sub);
+ }
+
+ case op_mul: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = getToNumber(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToNumber(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(ArithMul, op1, op2));
+ NEXT_OPCODE(op_mul);
+ }
+
+ case op_mod: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = getToNumber(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToNumber(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(ArithMod, op1, op2));
+ NEXT_OPCODE(op_mod);
+ }
+
+ case op_div: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = getToNumber(currentInstruction[2].u.operand);
+ NodeIndex op2 = getToNumber(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(ArithDiv, op1, op2));
+ NEXT_OPCODE(op_div);
+ }
+
+ // === Misc operations ===
+
+ case op_mov: {
+ NodeIndex op = get(currentInstruction[2].u.operand);
+ set(currentInstruction[1].u.operand, op);
+ NEXT_OPCODE(op_mov);
+ }
+
+ case op_not: {
+ ARITHMETIC_OP();
+ NodeIndex value = get(currentInstruction[2].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(LogicalNot, value));
+ NEXT_OPCODE(op_not);
+ }
+
+ case op_less: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = get(currentInstruction[2].u.operand);
+ NodeIndex op2 = get(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(CompareLess, op1, op2));
+ NEXT_OPCODE(op_less);
+ }
+
+ case op_lesseq: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = get(currentInstruction[2].u.operand);
+ NodeIndex op2 = get(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(CompareLessEq, op1, op2));
+ NEXT_OPCODE(op_lesseq);
+ }
+
+ case op_eq: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = get(currentInstruction[2].u.operand);
+ NodeIndex op2 = get(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(CompareEq, op1, op2));
+ NEXT_OPCODE(op_eq);
+ }
+
+ case op_eq_null: {
+ ARITHMETIC_OP();
+ NodeIndex value = get(currentInstruction[2].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(CompareEq, value, constantNull()));
+ NEXT_OPCODE(op_eq_null);
+ }
+
+ case op_stricteq: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = get(currentInstruction[2].u.operand);
+ NodeIndex op2 = get(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(CompareStrictEq, op1, op2));
+ NEXT_OPCODE(op_stricteq);
+ }
+
+ case op_neq: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = get(currentInstruction[2].u.operand);
+ NodeIndex op2 = get(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareEq, op1, op2)));
+ NEXT_OPCODE(op_neq);
+ }
+
+ case op_neq_null: {
+ ARITHMETIC_OP();
+ NodeIndex value = get(currentInstruction[2].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareEq, value, constantNull())));
+ NEXT_OPCODE(op_neq_null);
+ }
+
+ case op_nstricteq: {
+ ARITHMETIC_OP();
+ NodeIndex op1 = get(currentInstruction[2].u.operand);
+ NodeIndex op2 = get(currentInstruction[3].u.operand);
+ set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareStrictEq, op1, op2)));
+ NEXT_OPCODE(op_nstricteq);
+ }
+
+ // === Property access operations ===
+
+ case op_get_by_val: {
+ NodeIndex base = get(currentInstruction[2].u.operand);
+ NodeIndex property = get(currentInstruction[3].u.operand);
+ predictArray(base);
+ predictInt32(property);
+
+ NodeIndex getByVal = addToGraph(GetByVal, base, property, aliases.lookupGetByVal(base, property));
+ set(currentInstruction[1].u.operand, getByVal);
+ aliases.recordGetByVal(getByVal);
+
+ NEXT_OPCODE(op_get_by_val);
+ }
+
+ case op_put_by_val: {
+ NodeIndex base = get(currentInstruction[1].u.operand);
+ NodeIndex property = get(currentInstruction[2].u.operand);
+ NodeIndex value = get(currentInstruction[3].u.operand);
+ predictArray(base);
+ predictInt32(property);
+
+ NodeIndex aliasedGet = aliases.lookupGetByVal(base, property);
+ NodeIndex putByVal = addToGraph(aliasedGet != NoNode ? PutByValAlias : PutByVal, base, property, value);
+ aliases.recordPutByVal(putByVal);
+
+ NEXT_OPCODE(op_put_by_val);
+ }
+
+ case op_get_by_id: {
+ NodeIndex base = get(currentInstruction[2].u.operand);
+ unsigned identifier = currentInstruction[3].u.operand;
+
+ NodeIndex getById = addToGraph(GetById, OpInfo(identifier), base);
+ set(currentInstruction[1].u.operand, getById);
+ aliases.recordGetById(getById);
+
+ NEXT_OPCODE(op_get_by_id);
+ }
+
+ case op_put_by_id: {
+ NodeIndex value = get(currentInstruction[3].u.operand);
+ NodeIndex base = get(currentInstruction[1].u.operand);
+ unsigned identifier = currentInstruction[2].u.operand;
+ bool direct = currentInstruction[8].u.operand;
+
+ if (direct) {
+ NodeIndex putByIdDirect = addToGraph(PutByIdDirect, OpInfo(identifier), base, value);
+ aliases.recordPutByIdDirect(putByIdDirect);
+ } else {
+ NodeIndex putById = addToGraph(PutById, OpInfo(identifier), base, value);
+ aliases.recordPutById(putById);
+ }
+
+ NEXT_OPCODE(op_put_by_id);
+ }
+
+ case op_get_global_var: {
+ NodeIndex getGlobalVar = addToGraph(GetGlobalVar, OpInfo(currentInstruction[2].u.operand));
+ set(currentInstruction[1].u.operand, getGlobalVar);
+ NEXT_OPCODE(op_get_global_var);
+ }
+
+ case op_put_global_var: {
+ NodeIndex value = get(currentInstruction[2].u.operand);
+ addToGraph(PutGlobalVar, OpInfo(currentInstruction[1].u.operand), value);
+ NEXT_OPCODE(op_put_global_var);
+ }
+
+ // === Block terminators. ===
+
+ case op_jmp: {
+ unsigned relativeOffset = currentInstruction[1].u.operand;
+ addToGraph(Jump, OpInfo(m_currentIndex + relativeOffset));
+ LAST_OPCODE(op_jmp);
+ }
+
+ case op_loop: {
+ unsigned relativeOffset = currentInstruction[1].u.operand;
+ addToGraph(Jump, OpInfo(m_currentIndex + relativeOffset));
+ LAST_OPCODE(op_loop);
+ }
+
+ case op_jtrue: {
+ unsigned relativeOffset = currentInstruction[2].u.operand;
+ NodeIndex condition = get(currentInstruction[1].u.operand);
+ addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jtrue)), condition);
+ LAST_OPCODE(op_jtrue);
+ }
+
+ case op_jfalse: {
+ unsigned relativeOffset = currentInstruction[2].u.operand;
+ NodeIndex condition = get(currentInstruction[1].u.operand);
+ addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jfalse)), OpInfo(m_currentIndex + relativeOffset), condition);
+ LAST_OPCODE(op_jfalse);
+ }
+
+ case op_loop_if_true: {
+ unsigned relativeOffset = currentInstruction[2].u.operand;
+ NodeIndex condition = get(currentInstruction[1].u.operand);
+ addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_true)), condition);
+ LAST_OPCODE(op_loop_if_true);
+ }
+
+ case op_loop_if_false: {
+ unsigned relativeOffset = currentInstruction[2].u.operand;
+ NodeIndex condition = get(currentInstruction[1].u.operand);
+ addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_false)), OpInfo(m_currentIndex + relativeOffset), condition);
+ LAST_OPCODE(op_loop_if_false);
+ }
+
+ case op_jeq_null: {
+ unsigned relativeOffset = currentInstruction[2].u.operand;
+ NodeIndex value = get(currentInstruction[1].u.operand);
+ NodeIndex condition = addToGraph(CompareEq, value, constantNull());
+ addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jeq_null)), condition);
+ LAST_OPCODE(op_jeq_null);
+ }
+
+ case op_jneq_null: {
+ unsigned relativeOffset = currentInstruction[2].u.operand;
+ NodeIndex value = get(currentInstruction[1].u.operand);
+ NodeIndex condition = addToGraph(CompareEq, value, constantNull());
+ addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jneq_null)), OpInfo(m_currentIndex + relativeOffset), condition);
+ LAST_OPCODE(op_jneq_null);
+ }
+
+ case op_jnless: {
+ unsigned relativeOffset = currentInstruction[3].u.operand;
+ NodeIndex op1 = get(currentInstruction[1].u.operand);
+ NodeIndex op2 = get(currentInstruction[2].u.operand);
+ NodeIndex condition = addToGraph(CompareLess, op1, op2);
+ addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jnless)), OpInfo(m_currentIndex + relativeOffset), condition);
+ LAST_OPCODE(op_jnless);
+ }
+
+ case op_jnlesseq: {
+ unsigned relativeOffset = currentInstruction[3].u.operand;
+ NodeIndex op1 = get(currentInstruction[1].u.operand);
+ NodeIndex op2 = get(currentInstruction[2].u.operand);
+ NodeIndex condition = addToGraph(CompareLessEq, op1, op2);
+ addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jnlesseq)), OpInfo(m_currentIndex + relativeOffset), condition);
+ LAST_OPCODE(op_jnlesseq);
+ }
+
+ case op_jless: {
+ unsigned relativeOffset = currentInstruction[3].u.operand;
+ NodeIndex op1 = get(currentInstruction[1].u.operand);
+ NodeIndex op2 = get(currentInstruction[2].u.operand);
+ NodeIndex condition = addToGraph(CompareLess, op1, op2);
+ addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jless)), condition);
+ LAST_OPCODE(op_jless);
+ }
+
+ case op_jlesseq: {
+ unsigned relativeOffset = currentInstruction[3].u.operand;
+ NodeIndex op1 = get(currentInstruction[1].u.operand);
+ NodeIndex op2 = get(currentInstruction[2].u.operand);
+ NodeIndex condition = addToGraph(CompareLessEq, op1, op2);
+ addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jlesseq)), condition);
+ LAST_OPCODE(op_jlesseq);
+ }
+
+ case op_loop_if_less: {
+ unsigned relativeOffset = currentInstruction[3].u.operand;
+ NodeIndex op1 = get(currentInstruction[1].u.operand);
+ NodeIndex op2 = get(currentInstruction[2].u.operand);
+ NodeIndex condition = addToGraph(CompareLess, op1, op2);
+ addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_less)), condition);
+ LAST_OPCODE(op_loop_if_less);
+ }
+
+ case op_loop_if_lesseq: {
+ unsigned relativeOffset = currentInstruction[3].u.operand;
+ NodeIndex op1 = get(currentInstruction[1].u.operand);
+ NodeIndex op2 = get(currentInstruction[2].u.operand);
+ NodeIndex condition = addToGraph(CompareLessEq, op1, op2);
+ addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_loop_if_lesseq)), condition);
+ LAST_OPCODE(op_loop_if_lesseq);
+ }
+
+ case op_ret: {
+ addToGraph(Return, get(currentInstruction[1].u.operand));
+ LAST_OPCODE(op_ret);
+ }
+
+ default:
+ // Parse failed!
+ return false;
+ }
+ }
+}
+
+template<ByteCodeParser::PhiStackType stackType>
+void ByteCodeParser::processPhiStack()
+{
+ Vector<PhiStackEntry, 16>& phiStack = (stackType == ArgumentPhiStack) ? m_argumentPhiStack : m_localPhiStack;
+
+ while (!phiStack.isEmpty()) {
+ PhiStackEntry entry = phiStack.last();
+ phiStack.removeLast();
+
+ Node& phiNode = m_graph[entry.m_phi];
+ PredecessorList& predecessors = entry.m_block->m_predecessors;
+ unsigned varNo = entry.m_varNo;
+
+ for (size_t i = 0; i < predecessors.size(); ++i) {
+ BasicBlock* predecessorBlock = m_graph.m_blocks[predecessors[i]].get();
+
+ VariableRecord& var = (stackType == ArgumentPhiStack) ? predecessorBlock->m_arguments[varNo] : predecessorBlock->m_locals[varNo];
+
+ NodeIndex valueInPredecessor = var.value;
+ if (valueInPredecessor == NoNode) {
+ valueInPredecessor = addToGraph(Phi);
+ var.value = valueInPredecessor;
+ phiStack.append(PhiStackEntry(predecessorBlock, valueInPredecessor, varNo));
+ } else if (m_graph[valueInPredecessor].op == GetLocal)
+ valueInPredecessor = m_graph[valueInPredecessor].child1;
+ ASSERT(m_graph[valueInPredecessor].op == SetLocal || m_graph[valueInPredecessor].op == Phi);
+
+ if (phiNode.refCount())
+ m_graph.ref(valueInPredecessor);
+
+ if (phiNode.child1 == NoNode) {
+ phiNode.child1 = valueInPredecessor;
+ continue;
+ }
+ if (phiNode.child2 == NoNode) {
+ phiNode.child2 = valueInPredecessor;
+ continue;
+ }
+ if (phiNode.child3 == NoNode) {
+ phiNode.child3 = valueInPredecessor;
+ continue;
+ }
+
+ NodeIndex newPhi = addToGraph(Phi);
+ Node& newPhiNode = m_graph[newPhi];
+ if (phiNode.refCount())
+ m_graph.ref(newPhi);
+
+ newPhiNode.child1 = phiNode.child1;
+ newPhiNode.child2 = phiNode.child2;
+ newPhiNode.child3 = phiNode.child3;
+
+ phiNode.child1 = newPhi;
+ phiNode.child1 = valueInPredecessor;
+ phiNode.child3 = NoNode;
+ }
+ }
+}
+
+void ByteCodeParser::setupPredecessors()
+{
+ for (BlockIndex index = 0; index < m_graph.m_blocks.size(); ++index) {
+ BasicBlock* block = m_graph.m_blocks[index].get();
+ ASSERT(block->end != NoNode);
+ Node& node = m_graph[block->end - 1];
+ ASSERT(node.isTerminal());
+
+ if (node.isJump())
+ m_graph.blockForBytecodeOffset(node.takenBytecodeOffset()).m_predecessors.append(index);
+ else if (node.isBranch()) {
+ m_graph.blockForBytecodeOffset(node.takenBytecodeOffset()).m_predecessors.append(index);
+ m_graph.blockForBytecodeOffset(node.notTakenBytecodeOffset()).m_predecessors.append(index);
+ }
+ }
+}
+
+void ByteCodeParser::allocateVirtualRegisters()
+{
+ ScoreBoard scoreBoard(m_graph, m_preservedVars);
+ unsigned sizeExcludingPhiNodes = m_graph.m_blocks.last()->end;
+ for (size_t i = 0; i < sizeExcludingPhiNodes; ++i) {
+ Node& node = m_graph[i];
+ if (!node.shouldGenerate())
+ continue;
+
+ // GetLocal nodes are effectively phi nodes in the graph, referencing
+ // results from prior blocks.
+ if (node.op != GetLocal) {
+ // First, call use on all of the current node's children, then
+ // allocate a VirtualRegister for this node. We do so in this
+ // order so that if a child is on its last use, and a
+ // VirtualRegister is freed, then it may be reused for node.
+ scoreBoard.use(node.child1);
+ scoreBoard.use(node.child2);
+ scoreBoard.use(node.child3);
+ }
+
+ if (!node.hasResult())
+ continue;
+
+ node.setVirtualRegister(scoreBoard.allocate());
+ // 'mustGenerate' nodes have their useCount artificially elevated,
+ // call use now to account for this.
+ if (node.mustGenerate())
+ scoreBoard.use(i);
+ }
+
+ // 'm_numCalleeRegisters' is the number of locals and temporaries allocated
+ // for the function (and checked for on entry). Since we perform a new and
+ // different allocation of temporaries, more registers may now be required.
+ unsigned calleeRegisters = scoreBoard.allocatedCount() + m_preservedVars;
+ if ((unsigned)m_codeBlock->m_numCalleeRegisters < calleeRegisters)
+ m_codeBlock->m_numCalleeRegisters = calleeRegisters;
+}
+
+bool ByteCodeParser::parse()
+{
+ // Set during construction.
+ ASSERT(!m_currentIndex);
+
+ for (unsigned jumpTargetIndex = 0; jumpTargetIndex <= m_codeBlock->numberOfJumpTargets(); ++jumpTargetIndex) {
+ // The maximum bytecode offset to go into the current basicblock is either the next jump target, or the end of the instructions.
+ unsigned limit = jumpTargetIndex < m_codeBlock->numberOfJumpTargets() ? m_codeBlock->jumpTarget(jumpTargetIndex) : m_codeBlock->instructions().size();
+ ASSERT(m_currentIndex < limit);
+
+ // Loop until we reach the current limit (i.e. next jump target).
+ do {
+ OwnPtr<BasicBlock> block = adoptPtr(new BasicBlock(m_currentIndex, m_graph.size(), m_numArguments, m_numLocals));
+ m_currentBlock = block.get();
+ m_graph.m_blocks.append(block.release());
+
+ if (!parseBlock(limit))
+ return false;
+ // We should not have gone beyond the limit.
+ ASSERT(m_currentIndex <= limit);
+
+ m_currentBlock->end = m_graph.size();
+ } while (m_currentIndex < limit);
+ }
+
+ // Should have reached the end of the instructions.
+ ASSERT(m_currentIndex == m_codeBlock->instructions().size());
+
+ setupPredecessors();
+ processPhiStack<LocalPhiStack>();
+ processPhiStack<ArgumentPhiStack>();
+
+ allocateVirtualRegisters();
+
+#if DFG_DEBUG_VERBOSE
+ m_graph.dump(m_codeBlock);
+#endif
+
+ return true;
+}
+
+bool parse(Graph& graph, JSGlobalData* globalData, CodeBlock* codeBlock)
+{
+#if DFG_DEBUG_LOCAL_DISBALE
+ UNUSED_PARAM(graph);
+ UNUSED_PARAM(globalData);
+ UNUSED_PARAM(codeBlock);
+ return false;
+#else
+ return ByteCodeParser(globalData, codeBlock, graph).parse();
+#endif
+}
+
+} } // namespace JSC::DFG
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.h
new file mode 100644
index 0000000..d4efe61
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGByteCodeParser.h
@@ -0,0 +1,47 @@
+/*
+ * 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 DFGByteCodeParser_h
+#define DFGByteCodeParser_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGGraph.h>
+
+namespace JSC {
+
+class CodeBlock;
+class JSGlobalData;
+
+namespace DFG {
+
+// Populate the Graph with a basic block of code from the CodeBlock,
+// starting at the provided bytecode index.
+bool parse(Graph&, JSGlobalData*, CodeBlock*);
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGFPRInfo.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGFPRInfo.h
new file mode 100644
index 0000000..87e44ea
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGFPRInfo.h
@@ -0,0 +1,96 @@
+/*
+ * 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 DFGFPRInfo_h
+#define DFGFPRInfo_h
+
+#if ENABLE(DFG_JIT)
+
+#include <assembler/MacroAssembler.h>
+#include <dfg/DFGRegisterBank.h>
+
+namespace JSC { namespace DFG {
+
+typedef MacroAssembler::FPRegisterID FPRReg;
+#define InvalidFPRReg ((FPRReg)-1)
+
+class FPRInfo {
+public:
+ typedef FPRReg RegisterType;
+ static const unsigned numberOfRegisters = 6;
+
+ // Temporary registers.
+ static const FPRReg fpRegT0 = X86Registers::xmm0;
+ static const FPRReg fpRegT1 = X86Registers::xmm1;
+ static const FPRReg fpRegT2 = X86Registers::xmm2;
+ static const FPRReg fpRegT3 = X86Registers::xmm3;
+ static const FPRReg fpRegT4 = X86Registers::xmm4;
+ static const FPRReg fpRegT5 = X86Registers::xmm5;
+ // These constants provide the names for the general purpose argument & return value registers.
+ static const FPRReg argumentFPR0 = X86Registers::xmm0; // fpRegT0
+ static const FPRReg argumentFPR1 = X86Registers::xmm1; // fpRegT1
+ static const FPRReg argumentFPR2 = X86Registers::xmm2; // fpRegT2
+ static const FPRReg argumentFPR3 = X86Registers::xmm3; // fpRegT3
+ static const FPRReg returnValueFPR = X86Registers::xmm0; // fpRegT0
+
+ // FPRReg mapping is direct, the machine regsiter numbers can
+ // be used directly as indices into the FPR RegisterBank.
+ COMPILE_ASSERT(X86Registers::xmm0 == 0, xmm0_is_0);
+ COMPILE_ASSERT(X86Registers::xmm1 == 1, xmm1_is_1);
+ COMPILE_ASSERT(X86Registers::xmm2 == 2, xmm2_is_2);
+ COMPILE_ASSERT(X86Registers::xmm3 == 3, xmm3_is_3);
+ COMPILE_ASSERT(X86Registers::xmm4 == 4, xmm4_is_4);
+ COMPILE_ASSERT(X86Registers::xmm5 == 5, xmm5_is_5);
+ static FPRReg toRegister(unsigned index)
+ {
+ return (FPRReg)index;
+ }
+ static unsigned toIndex(FPRReg reg)
+ {
+ return (unsigned)reg;
+ }
+
+#ifndef NDEBUG
+ static const char* debugName(FPRReg reg)
+ {
+ ASSERT(reg != InvalidFPRReg);
+ ASSERT(reg < 16);
+ static const char* nameForRegister[16] = {
+ "xmm0", "xmm1", "xmm2", "xmm3",
+ "xmm4", "xmm5", "xmm6", "xmm7",
+ "xmm8", "xmm9", "xmm10", "xmm11",
+ "xmm12", "xmm13", "xmm14", "xmm15"
+ };
+ return nameForRegister[reg];
+ }
+#endif
+};
+
+typedef RegisterBank<FPRInfo>::iterator fpr_iterator;
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGPRInfo.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGPRInfo.h
new file mode 100644
index 0000000..f4e9f76
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGPRInfo.h
@@ -0,0 +1,108 @@
+/*
+ * 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 DFGGPRInfo_h
+#define DFGGPRInfo_h
+
+#if ENABLE(DFG_JIT)
+
+#include <assembler/MacroAssembler.h>
+#include <dfg/DFGRegisterBank.h>
+
+namespace JSC { namespace DFG {
+
+typedef MacroAssembler::RegisterID GPRReg;
+#define InvalidGPRReg ((GPRReg)-1)
+
+class GPRInfo {
+public:
+ typedef GPRReg RegisterType;
+ static const unsigned numberOfRegisters = 9;
+
+ // These registers match the old JIT.
+ static const GPRReg timeoutCheckRegister = X86Registers::r12;
+ static const GPRReg callFrameRegister = X86Registers::r13;
+ static const GPRReg tagTypeNumberRegister = X86Registers::r14;
+ static const GPRReg tagMaskRegister = X86Registers::r15;
+ // Temporary registers.
+ static const GPRReg regT0 = X86Registers::eax;
+ static const GPRReg regT1 = X86Registers::edx;
+ static const GPRReg regT2 = X86Registers::ecx;
+ static const GPRReg regT3 = X86Registers::ebx;
+ static const GPRReg regT4 = X86Registers::edi;
+ static const GPRReg regT5 = X86Registers::esi;
+ static const GPRReg regT6 = X86Registers::r8;
+ static const GPRReg regT7 = X86Registers::r9;
+ static const GPRReg regT8 = X86Registers::r10;
+ // These constants provide the names for the general purpose argument & return value registers.
+ static const GPRReg argumentGPR0 = X86Registers::edi; // regT4
+ static const GPRReg argumentGPR1 = X86Registers::esi; // regT5
+ static const GPRReg argumentGPR2 = X86Registers::edx; // regT1
+ static const GPRReg argumentGPR3 = X86Registers::ecx; // regT2
+ static const GPRReg returnValueGPR = X86Registers::eax; // regT0
+ static const GPRReg returnValueGPR2 = X86Registers::edx; // regT1
+
+ static GPRReg toRegister(unsigned index)
+ {
+ ASSERT(index < numberOfRegisters);
+ static const GPRReg registerForIndex[numberOfRegisters] = { regT0, regT1, regT2, regT3, regT4, regT5, regT6, regT7, regT8 };
+ return registerForIndex[index];
+ }
+
+ static unsigned toIndex(GPRReg reg)
+ {
+ ASSERT(reg != InvalidGPRReg);
+ ASSERT(reg < 16);
+ static const unsigned indexForRegister[16] = { 0, 2, 1, 3, InvalidIndex, InvalidIndex, 5, 4, 6, 7, 8, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex };
+ unsigned result = indexForRegister[reg];
+ ASSERT(result != InvalidIndex);
+ return result;
+ }
+
+#ifndef NDEBUG
+ static const char* debugName(GPRReg reg)
+ {
+ ASSERT(reg != InvalidGPRReg);
+ ASSERT(reg < 16);
+ static const char* nameForRegister[16] = {
+ "rax", "rcx", "rdx", "rbx",
+ "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15"
+ };
+ return nameForRegister[reg];
+ }
+#endif
+private:
+
+ static const unsigned InvalidIndex = 0xffffffff;
+};
+
+typedef RegisterBank<GPRInfo>::iterator gpr_iterator;
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGenerationInfo.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGenerationInfo.h
new file mode 100644
index 0000000..968ea20
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGenerationInfo.h
@@ -0,0 +1,230 @@
+/*
+ * 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 DFGGenerationInfo_h
+#define DFGGenerationInfo_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGJITCompiler.h>
+
+namespace JSC { namespace DFG {
+
+// === DataFormat ===
+//
+// This enum tracks the current representation in which a value is being held.
+// Values may be unboxed primitives (int32, double, or cell), or boxed as a JSValue.
+// For boxed values, we may know the type of boxing that has taken place.
+// (May also need bool, array, object, string types!)
+enum DataFormat {
+ DataFormatNone = 0,
+ DataFormatInteger = 1,
+ DataFormatDouble = 2,
+ DataFormatCell = 3,
+ DataFormatJS = 8,
+ DataFormatJSInteger = DataFormatJS | DataFormatInteger,
+ DataFormatJSDouble = DataFormatJS | DataFormatDouble,
+ DataFormatJSCell = DataFormatJS | DataFormatCell,
+};
+
+// === GenerationInfo ===
+//
+// This class is used to track the current status of a live values during code generation.
+// Can provide information as to whether a value is in machine registers, and if so which,
+// whether a value has been spilled to the RegsiterFile, and if so may be able to provide
+// details of the format in memory (all values are spilled in a boxed form, but we may be
+// able to track the type of box), and tracks how many outstanding uses of a value remain,
+// so that we know when the value is dead and the machine registers associated with it
+// may be released.
+class GenerationInfo {
+public:
+ GenerationInfo()
+ : m_nodeIndex(NoNode)
+ , m_useCount(0)
+ , m_registerFormat(DataFormatNone)
+ , m_spillFormat(DataFormatNone)
+ , m_canFill(false)
+ {
+ }
+
+ void initConstant(NodeIndex nodeIndex, uint32_t useCount)
+ {
+ m_nodeIndex = nodeIndex;
+ m_useCount = useCount;
+ m_registerFormat = DataFormatNone;
+ m_spillFormat = DataFormatNone;
+ m_canFill = true;
+ }
+ void initInteger(NodeIndex nodeIndex, uint32_t useCount, GPRReg gpr)
+ {
+ m_nodeIndex = nodeIndex;
+ m_useCount = useCount;
+ m_registerFormat = DataFormatInteger;
+ m_spillFormat = DataFormatNone;
+ m_canFill = false;
+ u.gpr = gpr;
+ }
+ void initJSValue(NodeIndex nodeIndex, uint32_t useCount, GPRReg gpr, DataFormat format = DataFormatJS)
+ {
+ ASSERT(format & DataFormatJS);
+
+ m_nodeIndex = nodeIndex;
+ m_useCount = useCount;
+ m_registerFormat = format;
+ m_spillFormat = DataFormatNone;
+ m_canFill = false;
+ u.gpr = gpr;
+ }
+ void initCell(NodeIndex nodeIndex, uint32_t useCount, GPRReg gpr)
+ {
+ m_nodeIndex = nodeIndex;
+ m_useCount = useCount;
+ m_registerFormat = DataFormatCell;
+ m_spillFormat = DataFormatNone;
+ m_canFill = false;
+ u.gpr = gpr;
+ }
+ void initDouble(NodeIndex nodeIndex, uint32_t useCount, FPRReg fpr)
+ {
+ m_nodeIndex = nodeIndex;
+ m_useCount = useCount;
+ m_registerFormat = DataFormatDouble;
+ m_spillFormat = DataFormatNone;
+ m_canFill = false;
+ u.fpr = fpr;
+ }
+
+ // Get the index of the node that produced this value.
+ NodeIndex nodeIndex() { return m_nodeIndex; }
+
+ // Mark the value as having been used (decrement the useCount).
+ // Returns true if this was the last use of the value, and any
+ // associated machine registers may be freed.
+ bool use()
+ {
+ return !--m_useCount;
+ }
+
+ // Used to check the operands of operations to see if they are on
+ // their last use; in some cases it may be safe to reuse the same
+ // machine register for the result of the operation.
+ bool canReuse()
+ {
+ ASSERT(m_useCount);
+ return m_useCount == 1;
+ }
+
+ // Get the format of the value in machine registers (or 'none').
+ DataFormat registerFormat() { return m_registerFormat; }
+ // Get the format of the value as it is spilled in the RegisterFile (or 'none').
+ DataFormat spillFormat() { return m_spillFormat; }
+
+ // Get the machine resister currently holding the value.
+ GPRReg gpr() { ASSERT(m_registerFormat && m_registerFormat != DataFormatDouble); return u.gpr; }
+ FPRReg fpr() { ASSERT(m_registerFormat == DataFormatDouble); return u.fpr; }
+
+ // Check whether a value needs spilling in order to free up any associated machine registers.
+ bool needsSpill()
+ {
+ // This should only be called on values that are currently in a register.
+ ASSERT(m_registerFormat != DataFormatNone);
+ // Constants do not need spilling, nor do values that have already been
+ // spilled to the RegisterFile.
+ return !m_canFill;
+ }
+
+ // Called when a VirtualRegister is being spilled to the RegisterFile for the first time.
+ void spill(DataFormat spillFormat)
+ {
+ // We shouldn't be spill values that don't need spilling.
+ ASSERT(!m_canFill);
+ ASSERT(m_spillFormat == DataFormatNone);
+ // We should only be spilling values that are currently in machine registers.
+ ASSERT(m_registerFormat != DataFormatNone);
+ // We only spill values that have been boxed as a JSValue; otherwise the GC
+ // would need a way to distinguish cell pointers from numeric primitives.
+ ASSERT(spillFormat & DataFormatJS);
+
+ m_registerFormat = DataFormatNone;
+ m_spillFormat = spillFormat;
+ m_canFill = true;
+ }
+
+ // Called on values that don't need spilling (constants and values that have
+ // already been spilled), to mark them as no longer being in machine registers.
+ void setSpilled()
+ {
+ // Should only be called on values that don't need spilling, and are currently in registers.
+ ASSERT(m_canFill && m_registerFormat != DataFormatNone);
+ m_registerFormat = DataFormatNone;
+ }
+
+ // Record that this value is filled into machine registers,
+ // tracking which registers, and what format the value has.
+ void fillJSValue(GPRReg gpr, DataFormat format = DataFormatJS)
+ {
+ ASSERT(format & DataFormatJS);
+ m_registerFormat = format;
+ u.gpr = gpr;
+ }
+ void fillInteger(GPRReg gpr)
+ {
+ m_registerFormat = DataFormatInteger;
+ u.gpr = gpr;
+ }
+ void fillDouble(FPRReg fpr)
+ {
+ m_registerFormat = DataFormatDouble;
+ u.fpr = fpr;
+ }
+
+#ifndef NDEBUG
+ bool alive()
+ {
+ return m_useCount;
+ }
+#endif
+
+private:
+ // The index of the node whose result is stored in this virtual register.
+ // FIXME: Can we remove this? - this is currently only used when collecting
+ // snapshots of the RegisterBank for SpeculationCheck/EntryLocation. Could
+ // investigate storing NodeIndex as the name in RegsiterBank, instead of
+ // VirtualRegister.
+ NodeIndex m_nodeIndex;
+ uint32_t m_useCount;
+ DataFormat m_registerFormat;
+ DataFormat m_spillFormat;
+ bool m_canFill;
+ union {
+ GPRReg gpr;
+ FPRReg fpr;
+ } u;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.cpp
new file mode 100644
index 0000000..b1e6991
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.cpp
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "DFGGraph.h"
+
+#include "CodeBlock.h"
+
+#if ENABLE(DFG_JIT)
+
+namespace JSC { namespace DFG {
+
+#ifndef NDEBUG
+
+// Creates an array of stringized names.
+static const char* dfgOpNames[] = {
+#define STRINGIZE_DFG_OP_ENUM(opcode, flags) #opcode ,
+ FOR_EACH_DFG_OP(STRINGIZE_DFG_OP_ENUM)
+#undef STRINGIZE_DFG_OP_ENUM
+};
+
+void Graph::dump(NodeIndex nodeIndex, CodeBlock* codeBlock)
+{
+ Node& node = at(nodeIndex);
+ NodeType op = node.op;
+
+ unsigned refCount = node.refCount();
+ if (!refCount)
+ return;
+ bool mustGenerate = node.mustGenerate();
+ if (mustGenerate)
+ --refCount;
+
+ // Example/explanation of dataflow dump output
+ //
+ // 14: <!2:7> GetByVal(@3, @13)
+ // ^1 ^2 ^3 ^4 ^5
+ //
+ // (1) The nodeIndex of this operation.
+ // (2) The reference count. The number printed is the 'real' count,
+ // not including the 'mustGenerate' ref. If the node is
+ // 'mustGenerate' then the count it prefixed with '!'.
+ // (3) The virtual register slot assigned to this node.
+ // (4) The name of the operation.
+ // (5) The arguments to the operation. The may be of the form:
+ // @# - a NodeIndex referencing a prior node in the graph.
+ // arg# - an argument number.
+ // $# - the index in the CodeBlock of a constant { for numeric constants the value is displayed | for integers, in both decimal and hex }.
+ // id# - the index in the CodeBlock of an identifier { if codeBlock is passed to dump(), the string representation is displayed }.
+ // var# - the index of a var on the global object, used by GetGlobalVar/PutGlobalVar operations.
+ printf("% 4d:\t<%c%u:", (int)nodeIndex, mustGenerate ? '!' : ' ', refCount);
+ if (node.hasResult())
+ printf("%u", node.virtualRegister());
+ else
+ printf("-");
+ printf(">\t%s(", dfgOpNames[op & NodeIdMask]);
+ if (node.child1 != NoNode)
+ printf("@%u", node.child1);
+ if (node.child2 != NoNode)
+ printf(", @%u", node.child2);
+ if (node.child3 != NoNode)
+ printf(", @%u", node.child3);
+ bool hasPrinted = node.child1 != NoNode;
+
+ if (node.hasVarNumber()) {
+ printf("%svar%u", hasPrinted ? ", " : "", node.varNumber());
+ hasPrinted = true;
+ }
+ if (node.hasIdentifier()) {
+ if (codeBlock)
+ printf("%sid%u{%s}", hasPrinted ? ", " : "", node.identifierNumber(), codeBlock->identifier(node.identifierNumber()).ustring().utf8().data());
+ else
+ printf("%sid%u", hasPrinted ? ", " : "", node.identifierNumber());
+ hasPrinted = true;
+ }
+ if (node.hasLocal()) {
+ int local = node.local();
+ if (operandIsArgument(local))
+ printf("%sarg%u", hasPrinted ? ", " : "", local - codeBlock->thisRegister());
+ else
+ printf("%sr%u", hasPrinted ? ", " : "", local);
+ hasPrinted = true;
+ }
+ if (op == Int32Constant) {
+ printf("%s$%u{%d|0x%08x}", hasPrinted ? ", " : "", node.constantNumber(), node.int32Constant(), node.int32Constant());
+ hasPrinted = true;
+ }
+ if (op == DoubleConstant) {
+ printf("%s$%u{%f})", hasPrinted ? ", " : "", node.constantNumber(), node.numericConstant());
+ hasPrinted = true;
+ }
+ if (op == JSConstant) {
+ printf("%s$%u", hasPrinted ? ", " : "", node.constantNumber());
+ hasPrinted = true;
+ }
+ if (node.isBranch() || node.isJump()) {
+ printf("%sT:#%u", hasPrinted ? ", " : "", blockIndexForBytecodeOffset(node.takenBytecodeOffset()));
+ hasPrinted = true;
+ }
+ if (node.isBranch()) {
+ printf("%sF:#%u", hasPrinted ? ", " : "", blockIndexForBytecodeOffset(node.notTakenBytecodeOffset()));
+ hasPrinted = true;
+ }
+
+ printf(")\n");
+}
+
+void Graph::dump(CodeBlock* codeBlock)
+{
+ for (size_t b = 0; b < m_blocks.size(); ++b) {
+ printf("Block #%u:\n", (int)b);
+ for (size_t i = m_blocks[b]->begin; i < m_blocks[b]->end; ++i)
+ dump(i, codeBlock);
+ }
+ printf("Phi Nodes:\n");
+ for (size_t i = m_blocks.last()->end; i < size(); ++i)
+ dump(i, codeBlock);
+}
+
+#endif
+
+// FIXME: Convert this method to be iterative, not recursive.
+void Graph::refChildren(NodeIndex op)
+{
+ Node& node = at(op);
+
+ if (node.child1 == NoNode) {
+ ASSERT(node.child2 == NoNode && node.child3 == NoNode);
+ return;
+ }
+ ref(node.child1);
+
+ if (node.child2 == NoNode) {
+ ASSERT(node.child3 == NoNode);
+ return;
+ }
+ ref(node.child2);
+
+ if (node.child3 == NoNode)
+ return;
+ ref(node.child3);
+}
+
+} } // namespace JSC::DFG
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.h
new file mode 100644
index 0000000..9fc490c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGGraph.h
@@ -0,0 +1,176 @@
+/*
+ * 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 DFGGraph_h
+#define DFGGraph_h
+
+#if ENABLE(DFG_JIT)
+
+#include <RegisterFile.h>
+#include <dfg/DFGNode.h>
+#include <wtf/Vector.h>
+#include <wtf/StdLibExtras.h>
+
+namespace JSC {
+
+class CodeBlock;
+
+namespace DFG {
+
+// helper function to distinguish vars & temporaries from arguments.
+inline bool operandIsArgument(int operand) { return operand < 0; }
+
+typedef uint8_t PredictedType;
+static const PredictedType PredictNone = 0;
+static const PredictedType PredictCell = 0x01;
+static const PredictedType PredictArray = 0x03;
+static const PredictedType PredictInt32 = 0x04;
+
+struct PredictionSlot {
+public:
+ PredictionSlot()
+ : m_value(PredictNone)
+ {
+ }
+ PredictedType m_value;
+};
+
+typedef uint32_t BlockIndex;
+
+// For every local variable we track any existing get or set of the value.
+// We track the get so that these may be shared, and we track the set to
+// retrieve the current value, and to reference the final definition.
+struct VariableRecord {
+ VariableRecord()
+ : value(NoNode)
+ {
+ }
+
+ NodeIndex value;
+};
+
+typedef Vector <BlockIndex, 2> PredecessorList;
+
+struct BasicBlock {
+ BasicBlock(unsigned bytecodeBegin, NodeIndex begin, unsigned numArguments, unsigned numLocals)
+ : bytecodeBegin(bytecodeBegin)
+ , begin(begin)
+ , end(NoNode)
+ , m_arguments(numArguments)
+ , m_locals(numLocals)
+ {
+ }
+
+ static inline BlockIndex getBytecodeBegin(OwnPtr<BasicBlock>* block)
+ {
+ return (*block)->bytecodeBegin;
+ }
+
+ unsigned bytecodeBegin;
+ NodeIndex begin;
+ NodeIndex end;
+
+ PredecessorList m_predecessors;
+ Vector <VariableRecord, 8> m_arguments;
+ Vector <VariableRecord, 16> m_locals;
+};
+
+//
+// === Graph ===
+//
+// The dataflow graph is an ordered vector of nodes.
+// The order may be significant for nodes with side-effects (property accesses, value conversions).
+// Nodes that are 'dead' remain in the vector with refCount 0.
+class Graph : public Vector<Node, 64> {
+public:
+ Graph(unsigned numArguments, unsigned numVariables)
+ : m_argumentPredictions(numArguments)
+ , m_variablePredictions(numVariables)
+ {
+ }
+
+ // Mark a node as being referenced.
+ void ref(NodeIndex nodeIndex)
+ {
+ Node& node = at(nodeIndex);
+ // If the value (before incrementing) was at refCount zero then we need to ref its children.
+ if (node.ref())
+ refChildren(nodeIndex);
+ }
+
+#ifndef NDEBUG
+ // CodeBlock is optional, but may allow additional information to be dumped (e.g. Identifier names).
+ void dump(CodeBlock* = 0);
+ void dump(NodeIndex, CodeBlock* = 0);
+#endif
+
+ BlockIndex blockIndexForBytecodeOffset(unsigned bytecodeBegin)
+ {
+ OwnPtr<BasicBlock>* begin = m_blocks.begin();
+ OwnPtr<BasicBlock>* block = binarySearch<OwnPtr<BasicBlock>, unsigned, BasicBlock::getBytecodeBegin>(begin, m_blocks.size(), bytecodeBegin);
+ ASSERT(block >= m_blocks.begin() && block < m_blocks.end());
+ return static_cast<BlockIndex>(block - begin);
+ }
+
+ BasicBlock& blockForBytecodeOffset(unsigned bytecodeBegin)
+ {
+ return *m_blocks[blockIndexForBytecodeOffset(bytecodeBegin)];
+ }
+
+ void predict(int operand, PredictedType prediction)
+ {
+ if (operandIsArgument(operand)) {
+ unsigned argument = operand + m_argumentPredictions.size() + RegisterFile::CallFrameHeaderSize;
+ m_argumentPredictions[argument].m_value |= prediction;
+ } else if ((unsigned)operand < m_variablePredictions.size())
+ m_variablePredictions[operand].m_value |= prediction;
+
+ }
+
+ PredictedType getPrediction(int operand)
+ {
+ if (operandIsArgument(operand)) {
+ unsigned argument = operand + m_argumentPredictions.size() + RegisterFile::CallFrameHeaderSize;
+ return m_argumentPredictions[argument].m_value;
+ }
+ if ((unsigned)operand < m_variablePredictions.size())
+ return m_variablePredictions[operand].m_value;
+ return PredictNone;
+ }
+
+ Vector< OwnPtr<BasicBlock> , 8> m_blocks;
+private:
+
+ // When a node's refCount goes from 0 to 1, it must (logically) recursively ref all of its children, and vice versa.
+ void refChildren(NodeIndex);
+
+ Vector<PredictionSlot, 16> m_argumentPredictions;
+ Vector<PredictionSlot, 16> m_variablePredictions;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp
new file mode 100644
index 0000000..781edbb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp
@@ -0,0 +1,568 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "DFGJITCodeGenerator.h"
+
+#if ENABLE(DFG_JIT)
+
+#include "DFGNonSpeculativeJIT.h"
+#include "DFGSpeculativeJIT.h"
+#include "LinkBuffer.h"
+
+namespace JSC { namespace DFG {
+
+GPRReg JITCodeGenerator::fillInteger(NodeIndex nodeIndex, DataFormat& returnFormat)
+{
+ Node& node = m_jit.graph()[nodeIndex];
+ VirtualRegister virtualRegister = node.virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+
+ if (info.registerFormat() == DataFormatNone) {
+ GPRReg gpr = allocate();
+
+ if (node.isConstant()) {
+ m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
+ if (isInt32Constant(nodeIndex)) {
+ m_jit.move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gpr);
+ info.fillInteger(gpr);
+ returnFormat = DataFormatInteger;
+ return gpr;
+ }
+ if (isDoubleConstant(nodeIndex)) {
+ JSValue jsValue = jsNumber(valueOfDoubleConstant(nodeIndex));
+ m_jit.move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ } else {
+ ASSERT(isJSConstant(nodeIndex));
+ JSValue jsValue = valueOfJSConstant(nodeIndex);
+ m_jit.move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ }
+ } else {
+ ASSERT(info.spillFormat() == DataFormatJS || info.spillFormat() == DataFormatJSInteger);
+ m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled);
+ m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), gpr);
+ }
+
+ // Since we statically know that we're filling an integer, and values
+ // in the RegisterFile are boxed, this must be DataFormatJSInteger.
+ // We will check this with a jitAssert below.
+ info.fillJSValue(gpr, DataFormatJSInteger);
+ unlock(gpr);
+ }
+
+ switch (info.registerFormat()) {
+ case DataFormatNone:
+ // Should have filled, above.
+ case DataFormatJSDouble:
+ case DataFormatDouble:
+ case DataFormatJS:
+ case DataFormatCell:
+ case DataFormatJSCell:
+ // Should only be calling this function if we know this operand to be integer.
+ ASSERT_NOT_REACHED();
+
+ case DataFormatJSInteger: {
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ m_jit.jitAssertIsJSInt32(gpr);
+ returnFormat = DataFormatJSInteger;
+ return gpr;
+ }
+
+ case DataFormatInteger: {
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ m_jit.jitAssertIsInt32(gpr);
+ returnFormat = DataFormatInteger;
+ return gpr;
+ }
+ }
+
+ ASSERT_NOT_REACHED();
+ return InvalidGPRReg;
+}
+
+FPRReg JITCodeGenerator::fillDouble(NodeIndex nodeIndex)
+{
+ Node& node = m_jit.graph()[nodeIndex];
+ VirtualRegister virtualRegister = node.virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+
+ if (info.registerFormat() == DataFormatNone) {
+ GPRReg gpr = allocate();
+
+ if (node.isConstant()) {
+ if (isInt32Constant(nodeIndex)) {
+ // FIXME: should not be reachable?
+ m_jit.move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gpr);
+ m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
+ info.fillInteger(gpr);
+ unlock(gpr);
+ } else if (isDoubleConstant(nodeIndex)) {
+ FPRReg fpr = fprAllocate();
+ m_jit.move(MacroAssembler::ImmPtr(reinterpret_cast<void*>(reinterpretDoubleToIntptr(valueOfDoubleConstant(nodeIndex)))), gpr);
+ m_jit.movePtrToDouble(gpr, fpr);
+ unlock(gpr);
+
+ m_fprs.retain(fpr, virtualRegister, SpillOrderDouble);
+ info.fillDouble(fpr);
+ return fpr;
+ } else {
+ // FIXME: should not be reachable?
+ ASSERT(isJSConstant(nodeIndex));
+ JSValue jsValue = valueOfJSConstant(nodeIndex);
+ m_jit.move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
+ info.fillJSValue(gpr, DataFormatJS);
+ unlock(gpr);
+ }
+ } else {
+ DataFormat spillFormat = info.spillFormat();
+ ASSERT(spillFormat & DataFormatJS);
+ m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled);
+ m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), gpr);
+ info.fillJSValue(gpr, m_isSpeculative ? spillFormat : DataFormatJS);
+ unlock(gpr);
+ }
+ }
+
+ switch (info.registerFormat()) {
+ case DataFormatNone:
+ // Should have filled, above.
+ case DataFormatCell:
+ case DataFormatJSCell:
+ // Should only be calling this function if we know this operand to be numeric.
+ ASSERT_NOT_REACHED();
+
+ case DataFormatJS: {
+ GPRReg jsValueGpr = info.gpr();
+ m_gprs.lock(jsValueGpr);
+ FPRReg fpr = fprAllocate();
+ GPRReg tempGpr = allocate(); // FIXME: can we skip this allocation on the last use of the virtual register?
+
+ JITCompiler::Jump isInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, jsValueGpr, GPRInfo::tagTypeNumberRegister);
+
+ m_jit.jitAssertIsJSDouble(jsValueGpr);
+
+ // First, if we get here we have a double encoded as a JSValue
+ m_jit.move(jsValueGpr, tempGpr);
+ m_jit.addPtr(GPRInfo::tagTypeNumberRegister, tempGpr);
+ m_jit.movePtrToDouble(tempGpr, fpr);
+ JITCompiler::Jump hasUnboxedDouble = m_jit.jump();
+
+ // Finally, handle integers.
+ isInteger.link(&m_jit);
+ m_jit.convertInt32ToDouble(jsValueGpr, fpr);
+ hasUnboxedDouble.link(&m_jit);
+
+ m_gprs.release(jsValueGpr);
+ m_gprs.unlock(jsValueGpr);
+ m_gprs.unlock(tempGpr);
+ m_fprs.retain(fpr, virtualRegister, SpillOrderDouble);
+ info.fillDouble(fpr);
+ return fpr;
+ }
+
+ case DataFormatJSInteger:
+ case DataFormatInteger: {
+ FPRReg fpr = fprAllocate();
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+
+ m_jit.convertInt32ToDouble(gpr, fpr);
+
+ m_gprs.release(gpr);
+ m_gprs.unlock(gpr);
+ m_fprs.retain(fpr, virtualRegister, SpillOrderDouble);
+ info.fillDouble(fpr);
+ return fpr;
+ }
+
+ // Unbox the double
+ case DataFormatJSDouble: {
+ GPRReg gpr = info.gpr();
+ FPRReg fpr = unboxDouble(gpr);
+
+ m_gprs.release(gpr);
+ m_fprs.retain(fpr, virtualRegister, SpillOrderDouble);
+
+ info.fillDouble(fpr);
+ return fpr;
+ }
+
+ case DataFormatDouble: {
+ FPRReg fpr = info.fpr();
+ m_fprs.lock(fpr);
+ return fpr;
+ }
+ }
+
+ ASSERT_NOT_REACHED();
+ return InvalidFPRReg;
+}
+
+GPRReg JITCodeGenerator::fillJSValue(NodeIndex nodeIndex)
+{
+ Node& node = m_jit.graph()[nodeIndex];
+ VirtualRegister virtualRegister = node.virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+
+ switch (info.registerFormat()) {
+ case DataFormatNone: {
+ GPRReg gpr = allocate();
+
+ if (node.isConstant()) {
+ if (isInt32Constant(nodeIndex)) {
+ info.fillJSValue(gpr, DataFormatJSInteger);
+ JSValue jsValue = jsNumber(valueOfInt32Constant(nodeIndex));
+ m_jit.move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ } else if (isDoubleConstant(nodeIndex)) {
+ info.fillJSValue(gpr, DataFormatJSDouble);
+ JSValue jsValue(JSValue::EncodeAsDouble, valueOfDoubleConstant(nodeIndex));
+ m_jit.move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ } else {
+ ASSERT(isJSConstant(nodeIndex));
+ JSValue jsValue = valueOfJSConstant(nodeIndex);
+ m_jit.move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ info.fillJSValue(gpr, DataFormatJS);
+ }
+
+ m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
+ } else {
+ DataFormat spillFormat = info.spillFormat();
+ ASSERT(spillFormat & DataFormatJS);
+ m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled);
+ m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), gpr);
+ info.fillJSValue(gpr, m_isSpeculative ? spillFormat : DataFormatJS);
+ }
+ return gpr;
+ }
+
+ case DataFormatInteger: {
+ GPRReg gpr = info.gpr();
+ // If the register has already been locked we need to take a copy.
+ // If not, we'll zero extend in place, so mark on the info that this is now type DataFormatInteger, not DataFormatJSInteger.
+ if (m_gprs.isLocked(gpr)) {
+ GPRReg result = allocate();
+ m_jit.orPtr(GPRInfo::tagTypeNumberRegister, gpr, result);
+ return result;
+ }
+ m_gprs.lock(gpr);
+ m_jit.orPtr(GPRInfo::tagTypeNumberRegister, gpr);
+ info.fillJSValue(gpr, DataFormatJSInteger);
+ return gpr;
+ }
+
+ case DataFormatDouble: {
+ FPRReg fpr = info.fpr();
+ GPRReg gpr = boxDouble(fpr);
+
+ // Update all info
+ info.fillJSValue(gpr, DataFormatJSDouble);
+ m_fprs.release(fpr);
+ m_gprs.retain(gpr, virtualRegister, SpillOrderJS);
+
+ return gpr;
+ }
+
+ case DataFormatCell:
+ // No retag required on JSVALUE64!
+ case DataFormatJS:
+ case DataFormatJSInteger:
+ case DataFormatJSDouble:
+ case DataFormatJSCell: {
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ return gpr;
+ }
+ }
+
+ ASSERT_NOT_REACHED();
+ return InvalidGPRReg;
+}
+
+void JITCodeGenerator::useChildren(Node& node)
+{
+ NodeIndex child1 = node.child1;
+ if (child1 == NoNode) {
+ ASSERT(node.child2 == NoNode && node.child3 == NoNode);
+ return;
+ }
+ use(child1);
+
+ NodeIndex child2 = node.child2;
+ if (child2 == NoNode) {
+ ASSERT(node.child3 == NoNode);
+ return;
+ }
+ use(child2);
+
+ NodeIndex child3 = node.child3;
+ if (child3 == NoNode)
+ return;
+ use(child3);
+}
+
+#ifndef NDEBUG
+static const char* dataFormatString(DataFormat format)
+{
+ // These values correspond to the DataFormat enum.
+ const char* strings[] = {
+ "[ ]",
+ "[ i]",
+ "[ d]",
+ "[ c]",
+ "Err!",
+ "Err!",
+ "Err!",
+ "Err!",
+ "[J ]",
+ "[Ji]",
+ "[Jd]",
+ "[Jc]",
+ "Err!",
+ "Err!",
+ "Err!",
+ "Err!",
+ };
+ return strings[format];
+}
+
+void JITCodeGenerator::dump(const char* label)
+{
+ if (label)
+ fprintf(stderr, "<%s>\n", label);
+
+ fprintf(stderr, " gprs:\n");
+ m_gprs.dump();
+ fprintf(stderr, " fprs:\n");
+ m_fprs.dump();
+ fprintf(stderr, " VirtualRegisters:\n");
+ for (unsigned i = 0; i < m_generationInfo.size(); ++i) {
+ GenerationInfo& info = m_generationInfo[i];
+ if (info.alive())
+ fprintf(stderr, " % 3d:%s%s", i, dataFormatString(info.registerFormat()), dataFormatString(info.spillFormat()));
+ else
+ fprintf(stderr, " % 3d:[__][__]", i);
+ if (info.registerFormat() == DataFormatDouble)
+ fprintf(stderr, ":fpr%d\n", info.fpr());
+ else if (info.registerFormat() != DataFormatNone) {
+ ASSERT(info.gpr() != InvalidGPRReg);
+ fprintf(stderr, ":%s\n", GPRInfo::debugName(info.gpr()));
+ } else
+ fprintf(stderr, "\n");
+ }
+ if (label)
+ fprintf(stderr, "</%s>\n", label);
+}
+#endif
+
+
+#if DFG_CONSISTENCY_CHECK
+void JITCodeGenerator::checkConsistency()
+{
+ bool failed = false;
+
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ if (iter.isLocked()) {
+ fprintf(stderr, "DFG_CONSISTENCY_CHECK failed: gpr %s is locked.\n", iter.debugName());
+ failed = true;
+ }
+ }
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ if (iter.isLocked()) {
+ fprintf(stderr, "DFG_CONSISTENCY_CHECK failed: fpr %s is locked.\n", iter.debugName());
+ failed = true;
+ }
+ }
+
+ for (unsigned i = 0; i < m_generationInfo.size(); ++i) {
+ VirtualRegister virtualRegister = (VirtualRegister)i;
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ if (!info.alive())
+ continue;
+ switch (info.registerFormat()) {
+ case DataFormatNone:
+ break;
+ case DataFormatInteger:
+ case DataFormatCell:
+ case DataFormatJS:
+ case DataFormatJSInteger:
+ case DataFormatJSDouble:
+ case DataFormatJSCell: {
+ GPRReg gpr = info.gpr();
+ ASSERT(gpr != InvalidGPRReg);
+ if (m_gprs.name(gpr) != virtualRegister) {
+ fprintf(stderr, "DFG_CONSISTENCY_CHECK failed: name mismatch for virtual register %d (gpr %s).\n", virtualRegister, GPRInfo::debugName(gpr));
+ failed = true;
+ }
+ break;
+ }
+ case DataFormatDouble: {
+ FPRReg fpr = info.fpr();
+ ASSERT(fpr != InvalidFPRReg);
+ if (m_fprs.name(fpr) != virtualRegister) {
+ fprintf(stderr, "DFG_CONSISTENCY_CHECK failed: name mismatch for virtual register %d (fpr %s).\n", virtualRegister, FPRInfo::debugName(fpr));
+ failed = true;
+ }
+ break;
+ }
+ }
+ }
+
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ VirtualRegister virtualRegister = iter.name();
+ if (virtualRegister == InvalidVirtualRegister)
+ continue;
+
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ if (iter.regID() != info.gpr()) {
+ fprintf(stderr, "DFG_CONSISTENCY_CHECK failed: name mismatch for gpr %s (virtual register %d).\n", iter.debugName(), virtualRegister);
+ failed = true;
+ }
+ }
+
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ VirtualRegister virtualRegister = iter.name();
+ if (virtualRegister == InvalidVirtualRegister)
+ continue;
+
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ if (iter.regID() != info.fpr()) {
+ fprintf(stderr, "DFG_CONSISTENCY_CHECK failed: name mismatch for fpr %s (virtual register %d).\n", iter.debugName(), virtualRegister);
+ failed = true;
+ }
+ }
+
+ if (failed) {
+ dump();
+ CRASH();
+ }
+}
+#endif
+
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit)
+ : m_jit(jit)
+ , m_gpr(InvalidGPRReg)
+{
+ m_gpr = m_jit->allocate();
+}
+
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit, SpeculateIntegerOperand& op1)
+ : m_jit(jit)
+ , m_gpr(InvalidGPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_gpr = m_jit->reuse(op1.gpr());
+ else
+ m_gpr = m_jit->allocate();
+}
+
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit, SpeculateIntegerOperand& op1, SpeculateIntegerOperand& op2)
+ : m_jit(jit)
+ , m_gpr(InvalidGPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_gpr = m_jit->reuse(op1.gpr());
+ else if (m_jit->canReuse(op2.index()))
+ m_gpr = m_jit->reuse(op2.gpr());
+ else
+ m_gpr = m_jit->allocate();
+}
+
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit, IntegerOperand& op1)
+ : m_jit(jit)
+ , m_gpr(InvalidGPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_gpr = m_jit->reuse(op1.gpr());
+ else
+ m_gpr = m_jit->allocate();
+}
+
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit, IntegerOperand& op1, IntegerOperand& op2)
+ : m_jit(jit)
+ , m_gpr(InvalidGPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_gpr = m_jit->reuse(op1.gpr());
+ else if (m_jit->canReuse(op2.index()))
+ m_gpr = m_jit->reuse(op2.gpr());
+ else
+ m_gpr = m_jit->allocate();
+}
+
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit, SpeculateCellOperand& op1)
+ : m_jit(jit)
+ , m_gpr(InvalidGPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_gpr = m_jit->reuse(op1.gpr());
+ else
+ m_gpr = m_jit->allocate();
+}
+
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit, JSValueOperand& op1)
+ : m_jit(jit)
+ , m_gpr(InvalidGPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_gpr = m_jit->reuse(op1.gpr());
+ else
+ m_gpr = m_jit->allocate();
+}
+
+FPRTemporary::FPRTemporary(JITCodeGenerator* jit)
+ : m_jit(jit)
+ , m_fpr(InvalidFPRReg)
+{
+ m_fpr = m_jit->fprAllocate();
+}
+
+FPRTemporary::FPRTemporary(JITCodeGenerator* jit, DoubleOperand& op1)
+ : m_jit(jit)
+ , m_fpr(InvalidFPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_fpr = m_jit->reuse(op1.fpr());
+ else
+ m_fpr = m_jit->fprAllocate();
+}
+
+FPRTemporary::FPRTemporary(JITCodeGenerator* jit, DoubleOperand& op1, DoubleOperand& op2)
+ : m_jit(jit)
+ , m_fpr(InvalidFPRReg)
+{
+ if (m_jit->canReuse(op1.index()))
+ m_fpr = m_jit->reuse(op1.fpr());
+ else if (m_jit->canReuse(op2.index()))
+ m_fpr = m_jit->reuse(op2.fpr());
+ else
+ m_fpr = m_jit->fprAllocate();
+}
+
+} } // namespace JSC::DFG
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h
new file mode 100644
index 0000000..3c0998d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h
@@ -0,0 +1,957 @@
+/*
+ * 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 DFGJITCodeGenerator_h
+#define DFGJITCodeGenerator_h
+
+#if ENABLE(DFG_JIT)
+
+#include "CodeBlock.h"
+#include <dfg/DFGGenerationInfo.h>
+#include <dfg/DFGGraph.h>
+#include <dfg/DFGJITCompiler.h>
+#include <dfg/DFGOperations.h>
+#include <dfg/DFGRegisterBank.h>
+
+namespace JSC { namespace DFG {
+
+class SpeculateIntegerOperand;
+class SpeculateStrictInt32Operand;
+class SpeculateCellOperand;
+
+
+// === JITCodeGenerator ===
+//
+// This class provides common infrastructure used by the speculative &
+// non-speculative JITs. Provides common mechanisms for virtual and
+// physical register management, calls out from JIT code to helper
+// functions, etc.
+class JITCodeGenerator {
+protected:
+ typedef MacroAssembler::TrustedImm32 TrustedImm32;
+ typedef MacroAssembler::Imm32 Imm32;
+
+ // These constants are used to set priorities for spill order for
+ // the register allocator.
+ enum SpillOrder {
+ SpillOrderConstant = 1, // no spill, and cheap fill
+ SpillOrderSpilled = 2, // no spill
+ SpillOrderJS = 4, // needs spill
+ SpillOrderCell = 4, // needs spill
+ SpillOrderInteger = 5, // needs spill and box
+ SpillOrderDouble = 6, // needs spill and convert
+ };
+
+
+public:
+ GPRReg fillInteger(NodeIndex, DataFormat& returnFormat);
+ FPRReg fillDouble(NodeIndex);
+ GPRReg fillJSValue(NodeIndex);
+
+ // lock and unlock GPR & FPR registers.
+ void lock(GPRReg reg)
+ {
+ m_gprs.lock(reg);
+ }
+ void lock(FPRReg reg)
+ {
+ m_fprs.lock(reg);
+ }
+ void unlock(GPRReg reg)
+ {
+ m_gprs.unlock(reg);
+ }
+ void unlock(FPRReg reg)
+ {
+ m_fprs.unlock(reg);
+ }
+
+ // Used to check whether a child node is on its last use,
+ // and its machine registers may be reused.
+ bool canReuse(NodeIndex nodeIndex)
+ {
+ VirtualRegister virtualRegister = m_jit.graph()[nodeIndex].virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ return info.canReuse();
+ }
+ GPRReg reuse(GPRReg reg)
+ {
+ m_gprs.lock(reg);
+ return reg;
+ }
+ FPRReg reuse(FPRReg reg)
+ {
+ m_fprs.lock(reg);
+ return reg;
+ }
+
+ // Allocate a gpr/fpr.
+ GPRReg allocate()
+ {
+ VirtualRegister spillMe;
+ GPRReg gpr = m_gprs.allocate(spillMe);
+ if (spillMe != InvalidVirtualRegister)
+ spill(spillMe);
+ return gpr;
+ }
+ FPRReg fprAllocate()
+ {
+ VirtualRegister spillMe;
+ FPRReg fpr = m_fprs.allocate(spillMe);
+ if (spillMe != InvalidVirtualRegister)
+ spill(spillMe);
+ return fpr;
+ }
+
+ // Check whether a VirtualRegsiter is currently in a machine register.
+ // We use this when filling operands to fill those that are already in
+ // machine registers first (by locking VirtualRegsiters that are already
+ // in machine register before filling those that are not we attempt to
+ // avoid spilling values we will need immediately).
+ bool isFilled(NodeIndex nodeIndex)
+ {
+ VirtualRegister virtualRegister = m_jit.graph()[nodeIndex].virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ return info.registerFormat() != DataFormatNone;
+ }
+ bool isFilledDouble(NodeIndex nodeIndex)
+ {
+ VirtualRegister virtualRegister = m_jit.graph()[nodeIndex].virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ return info.registerFormat() == DataFormatDouble;
+ }
+
+protected:
+ JITCodeGenerator(JITCompiler& jit, bool isSpeculative)
+ : m_jit(jit)
+ , m_isSpeculative(isSpeculative)
+ , m_compileIndex(0)
+ , m_generationInfo(m_jit.codeBlock()->m_numCalleeRegisters)
+ , m_blockHeads(jit.graph().m_blocks.size())
+ {
+ }
+
+ // These methods convert between doubles, and doubles boxed and JSValues.
+ GPRReg boxDouble(FPRReg fpr, GPRReg gpr)
+ {
+ m_jit.moveDoubleToPtr(fpr, gpr);
+ m_jit.subPtr(GPRInfo::tagTypeNumberRegister, gpr);
+ return gpr;
+ }
+ FPRReg unboxDouble(GPRReg gpr, FPRReg fpr)
+ {
+ m_jit.addPtr(GPRInfo::tagTypeNumberRegister, gpr);
+ m_jit.movePtrToDouble(gpr, fpr);
+ return fpr;
+ }
+ GPRReg boxDouble(FPRReg fpr)
+ {
+ return boxDouble(fpr, allocate());
+ }
+ FPRReg unboxDouble(GPRReg gpr)
+ {
+ return unboxDouble(gpr, fprAllocate());
+ }
+
+ // Called on an operand once it has been consumed by a parent node.
+ void use(NodeIndex nodeIndex)
+ {
+ VirtualRegister virtualRegister = m_jit.graph()[nodeIndex].virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+
+ // use() returns true when the value becomes dead, and any
+ // associated resources may be freed.
+ if (!info.use())
+ return;
+
+ // Release the associated machine registers.
+ DataFormat registerFormat = info.registerFormat();
+ if (registerFormat == DataFormatDouble)
+ m_fprs.release(info.fpr());
+ else if (registerFormat != DataFormatNone)
+ m_gprs.release(info.gpr());
+ }
+
+ // Spill a VirtualRegister to the RegisterFile.
+ void spill(VirtualRegister spillMe)
+ {
+ GenerationInfo& info = m_generationInfo[spillMe];
+
+ // Check the GenerationInfo to see if this value need writing
+ // to the RegisterFile - if not, mark it as spilled & return.
+ if (!info.needsSpill()) {
+ info.setSpilled();
+ return;
+ }
+
+ DataFormat spillFormat = info.registerFormat();
+ if (spillFormat == DataFormatDouble) {
+ // All values are spilled as JSValues, so box the double via a temporary gpr.
+ GPRReg gpr = boxDouble(info.fpr());
+ m_jit.storePtr(gpr, JITCompiler::addressFor(spillMe));
+ unlock(gpr);
+ info.spill(DataFormatJSDouble);
+ return;
+ }
+
+ // The following code handles JSValues, int32s, and cells.
+ ASSERT(spillFormat == DataFormatInteger || spillFormat == DataFormatCell || spillFormat & DataFormatJS);
+
+ GPRReg reg = info.gpr();
+ // We need to box int32 and cell values ...
+ // but on JSVALUE64 boxing a cell is a no-op!
+ if (spillFormat == DataFormatInteger)
+ m_jit.orPtr(GPRInfo::tagTypeNumberRegister, reg);
+
+ // Spill the value, and record it as spilled in its boxed form.
+ m_jit.storePtr(reg, JITCompiler::addressFor(spillMe));
+ info.spill((DataFormat)(spillFormat | DataFormatJS));
+ }
+
+ // Checks/accessors for constant values.
+ bool isConstant(NodeIndex nodeIndex) { return m_jit.isConstant(nodeIndex); }
+ bool isInt32Constant(NodeIndex nodeIndex) { return m_jit.isInt32Constant(nodeIndex); }
+ bool isDoubleConstant(NodeIndex nodeIndex) { return m_jit.isDoubleConstant(nodeIndex); }
+ bool isJSConstant(NodeIndex nodeIndex) { return m_jit.isJSConstant(nodeIndex); }
+ int32_t valueOfInt32Constant(NodeIndex nodeIndex) { return m_jit.valueOfInt32Constant(nodeIndex); }
+ double valueOfDoubleConstant(NodeIndex nodeIndex) { return m_jit.valueOfDoubleConstant(nodeIndex); }
+ JSValue valueOfJSConstant(NodeIndex nodeIndex) { return m_jit.valueOfJSConstant(nodeIndex); }
+
+ Identifier* identifier(unsigned index)
+ {
+ return &m_jit.codeBlock()->identifier(index);
+ }
+
+ // Spill all VirtualRegisters back to the RegisterFile.
+ void flushRegisters()
+ {
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister) {
+ spill(iter.name());
+ iter.release();
+ }
+ }
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister) {
+ spill(iter.name());
+ iter.release();
+ }
+ }
+ }
+
+#ifndef NDEBUG
+ // Used to ASSERT flushRegisters() has been called prior to
+ // calling out from JIT code to a C helper function.
+ bool isFlushed()
+ {
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ return false;
+ }
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ return false;
+ }
+ return true;
+ }
+#endif
+
+ // Get the JSValue representation of a constant.
+ JSValue constantAsJSValue(NodeIndex nodeIndex)
+ {
+ Node& node = m_jit.graph()[nodeIndex];
+ if (isInt32Constant(nodeIndex))
+ return jsNumber(node.int32Constant());
+ if (isDoubleConstant(nodeIndex))
+ return JSValue(JSValue::EncodeAsDouble, node.numericConstant());
+ ASSERT(isJSConstant(nodeIndex));
+ return valueOfJSConstant(nodeIndex);
+ }
+ MacroAssembler::ImmPtr constantAsJSValueAsImmPtr(NodeIndex nodeIndex)
+ {
+ return MacroAssembler::ImmPtr(JSValue::encode(constantAsJSValue(nodeIndex)));
+ }
+
+ // Helper functions to enable code sharing in implementations of bit/shift ops.
+ void bitOp(NodeType op, int32_t imm, GPRReg op1, GPRReg result)
+ {
+ switch (op) {
+ case BitAnd:
+ m_jit.and32(Imm32(imm), op1, result);
+ break;
+ case BitOr:
+ m_jit.or32(Imm32(imm), op1, result);
+ break;
+ case BitXor:
+ m_jit.xor32(Imm32(imm), op1, result);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+ void bitOp(NodeType op, GPRReg op1, GPRReg op2, GPRReg result)
+ {
+ switch (op) {
+ case BitAnd:
+ m_jit.and32(op1, op2, result);
+ break;
+ case BitOr:
+ m_jit.or32(op1, op2, result);
+ break;
+ case BitXor:
+ m_jit.xor32(op1, op2, result);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+ void shiftOp(NodeType op, GPRReg op1, int32_t shiftAmount, GPRReg result)
+ {
+ switch (op) {
+ case BitRShift:
+ m_jit.rshift32(op1, Imm32(shiftAmount), result);
+ break;
+ case BitLShift:
+ m_jit.lshift32(op1, Imm32(shiftAmount), result);
+ break;
+ case BitURShift:
+ m_jit.urshift32(op1, Imm32(shiftAmount), result);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+ void shiftOp(NodeType op, GPRReg op1, GPRReg shiftAmount, GPRReg result)
+ {
+ switch (op) {
+ case BitRShift:
+ m_jit.rshift32(op1, shiftAmount, result);
+ break;
+ case BitLShift:
+ m_jit.lshift32(op1, shiftAmount, result);
+ break;
+ case BitURShift:
+ m_jit.urshift32(op1, shiftAmount, result);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ // Called once a node has completed code generation but prior to setting
+ // its result, to free up its children. (This must happen prior to setting
+ // the nodes result, since the node may have the same VirtualRegister as
+ // a child, and as such will use the same GeneratioInfo).
+ void useChildren(Node&);
+
+ // These method called to initialize the the GenerationInfo
+ // to describe the result of an operation.
+ void integerResult(GPRReg reg, NodeIndex nodeIndex, DataFormat format = DataFormatInteger)
+ {
+ Node& node = m_jit.graph()[nodeIndex];
+ useChildren(node);
+
+ VirtualRegister virtualRegister = node.virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+
+ if (format == DataFormatInteger) {
+ m_jit.jitAssertIsInt32(reg);
+ m_gprs.retain(reg, virtualRegister, SpillOrderInteger);
+ info.initInteger(nodeIndex, node.refCount(), reg);
+ } else {
+ ASSERT(format == DataFormatJSInteger);
+ m_jit.jitAssertIsJSInt32(reg);
+ m_gprs.retain(reg, virtualRegister, SpillOrderJS);
+ info.initJSValue(nodeIndex, node.refCount(), reg, format);
+ }
+ }
+ void noResult(NodeIndex nodeIndex)
+ {
+ Node& node = m_jit.graph()[nodeIndex];
+ useChildren(node);
+ }
+ void cellResult(GPRReg reg, NodeIndex nodeIndex)
+ {
+ Node& node = m_jit.graph()[nodeIndex];
+ useChildren(node);
+
+ VirtualRegister virtualRegister = node.virtualRegister();
+ m_gprs.retain(reg, virtualRegister, SpillOrderCell);
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ info.initCell(nodeIndex, node.refCount(), reg);
+ }
+ void jsValueResult(GPRReg reg, NodeIndex nodeIndex, DataFormat format = DataFormatJS)
+ {
+ if (format == DataFormatJSInteger)
+ m_jit.jitAssertIsJSInt32(reg);
+
+ Node& node = m_jit.graph()[nodeIndex];
+ useChildren(node);
+
+ VirtualRegister virtualRegister = node.virtualRegister();
+ m_gprs.retain(reg, virtualRegister, SpillOrderJS);
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ info.initJSValue(nodeIndex, node.refCount(), reg, format);
+ }
+ void doubleResult(FPRReg reg, NodeIndex nodeIndex)
+ {
+ Node& node = m_jit.graph()[nodeIndex];
+ useChildren(node);
+
+ VirtualRegister virtualRegister = node.virtualRegister();
+ m_fprs.retain(reg, virtualRegister, SpillOrderDouble);
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+ info.initDouble(nodeIndex, node.refCount(), reg);
+ }
+ void initConstantInfo(NodeIndex nodeIndex)
+ {
+ ASSERT(isInt32Constant(nodeIndex) || isDoubleConstant(nodeIndex) || isJSConstant(nodeIndex));
+ Node& node = m_jit.graph()[nodeIndex];
+ m_generationInfo[node.virtualRegister()].initConstant(nodeIndex, node.refCount());
+ }
+
+ // These methods used to sort arguments into the correct registers.
+ template<GPRReg destA, GPRReg destB>
+ void setupTwoStubArgs(GPRReg srcA, GPRReg srcB)
+ {
+ // Assuming that srcA != srcB, there are 7 interesting states the registers may be in:
+ // (1) both are already in arg regs, the right way around.
+ // (2) both are already in arg regs, the wrong way around.
+ // (3) neither are currently in arg registers.
+ // (4) srcA in in its correct reg.
+ // (5) srcA in in the incorrect reg.
+ // (6) srcB in in its correct reg.
+ // (7) srcB in in the incorrect reg.
+ //
+ // The trivial approach is to simply emit two moves, to put srcA in place then srcB in
+ // place (the MacroAssembler will omit redundant moves). This apporach will be safe in
+ // cases 1, 3, 4, 5, 6, and in cases where srcA==srcB. The two problem cases are 2
+ // (requires a swap) and 7 (must move srcB first, to avoid trampling.)
+
+ if (srcB != destA) {
+ // Handle the easy cases - two simple moves.
+ m_jit.move(srcA, destA);
+ m_jit.move(srcB, destB);
+ } else if (srcA != destB) {
+ // Handle the non-swap case - just put srcB in place first.
+ m_jit.move(srcB, destB);
+ m_jit.move(srcA, destA);
+ } else
+ m_jit.swap(destB, destB);
+ }
+ template<FPRReg destA, FPRReg destB>
+ void setupTwoStubArgs(FPRReg srcA, FPRReg srcB)
+ {
+ // Assuming that srcA != srcB, there are 7 interesting states the registers may be in:
+ // (1) both are already in arg regs, the right way around.
+ // (2) both are already in arg regs, the wrong way around.
+ // (3) neither are currently in arg registers.
+ // (4) srcA in in its correct reg.
+ // (5) srcA in in the incorrect reg.
+ // (6) srcB in in its correct reg.
+ // (7) srcB in in the incorrect reg.
+ //
+ // The trivial approach is to simply emit two moves, to put srcA in place then srcB in
+ // place (the MacroAssembler will omit redundant moves). This apporach will be safe in
+ // cases 1, 3, 4, 5, 6, and in cases where srcA==srcB. The two problem cases are 2
+ // (requires a swap) and 7 (must move srcB first, to avoid trampling.)
+
+ if (srcB != destA) {
+ // Handle the easy cases - two simple moves.
+ m_jit.moveDouble(srcA, destA);
+ m_jit.moveDouble(srcB, destB);
+ return;
+ }
+
+ if (srcA != destB) {
+ // Handle the non-swap case - just put srcB in place first.
+ m_jit.moveDouble(srcB, destB);
+ m_jit.moveDouble(srcA, destA);
+ return;
+ }
+
+ ASSERT(srcB == destA && srcA == destB);
+ // Need to swap; pick a temporary register.
+ FPRReg temp;
+ if (destA != FPRInfo::argumentFPR3 && destA != FPRInfo::argumentFPR3)
+ temp = FPRInfo::argumentFPR3;
+ else if (destA != FPRInfo::argumentFPR2 && destA != FPRInfo::argumentFPR2)
+ temp = FPRInfo::argumentFPR2;
+ else {
+ ASSERT(destA != FPRInfo::argumentFPR1 && destA != FPRInfo::argumentFPR1);
+ temp = FPRInfo::argumentFPR1;
+ }
+ m_jit.moveDouble(destA, temp);
+ m_jit.moveDouble(destB, destA);
+ m_jit.moveDouble(temp, destB);
+ }
+ void setupStubArguments(GPRReg arg1, GPRReg arg2)
+ {
+ setupTwoStubArgs<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2>(arg1, arg2);
+ }
+ void setupStubArguments(GPRReg arg1, GPRReg arg2, GPRReg arg3)
+ {
+ // If neither of arg2/arg3 are in our way, then we can move arg1 into place.
+ // Then we can use setupTwoStubArgs to fix arg2/arg3.
+ if (arg2 != GPRInfo::argumentGPR1 && arg3 != GPRInfo::argumentGPR1) {
+ m_jit.move(arg1, GPRInfo::argumentGPR1);
+ setupTwoStubArgs<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3);
+ return;
+ }
+
+ // If neither of arg1/arg3 are in our way, then we can move arg2 into place.
+ // Then we can use setupTwoStubArgs to fix arg1/arg3.
+ if (arg1 != GPRInfo::argumentGPR2 && arg3 != GPRInfo::argumentGPR2) {
+ m_jit.move(arg2, GPRInfo::argumentGPR2);
+ setupTwoStubArgs<GPRInfo::argumentGPR1, GPRInfo::argumentGPR3>(arg1, arg3);
+ return;
+ }
+
+ // If neither of arg1/arg2 are in our way, then we can move arg3 into place.
+ // Then we can use setupTwoStubArgs to fix arg1/arg2.
+ if (arg1 != GPRInfo::argumentGPR3 && arg2 != GPRInfo::argumentGPR3) {
+ m_jit.move(arg3, GPRInfo::argumentGPR3);
+ setupTwoStubArgs<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2>(arg1, arg2);
+ return;
+ }
+
+ // If we get here, we haven't been able to move any of arg1/arg2/arg3.
+ // Since all three are blocked, then all three must already be in the argument register.
+ // But are they in the right ones?
+
+ // First, ensure arg1 is in place.
+ if (arg1 != GPRInfo::argumentGPR1) {
+ m_jit.swap(arg1, GPRInfo::argumentGPR1);
+
+ // If arg1 wasn't in argumentGPR1, one of arg2/arg3 must be.
+ ASSERT(arg2 == GPRInfo::argumentGPR1 || arg3 == GPRInfo::argumentGPR1);
+ // If arg2 was in argumentGPR1 it no longer is (due to the swap).
+ // Otherwise arg3 must have been. Mark him as moved.
+ if (arg2 == GPRInfo::argumentGPR1)
+ arg2 = arg1;
+ else
+ arg3 = arg1;
+ }
+
+ // Either arg2 & arg3 need swapping, or we're all done.
+ ASSERT((arg2 == GPRInfo::argumentGPR2 || arg3 == GPRInfo::argumentGPR3)
+ || (arg2 == GPRInfo::argumentGPR3 || arg3 == GPRInfo::argumentGPR2));
+
+ if (arg2 != GPRInfo::argumentGPR2)
+ m_jit.swap(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3);
+ }
+
+ // These methods add calls to C++ helper functions.
+ void callOperation(J_DFGOperation_EJP operation, GPRReg result, GPRReg arg1, void* pointer)
+ {
+ ASSERT(isFlushed());
+
+ m_jit.move(arg1, GPRInfo::argumentGPR1);
+ m_jit.move(JITCompiler::TrustedImmPtr(pointer), GPRInfo::argumentGPR2);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+ appendCallWithExceptionCheck(operation);
+ m_jit.move(GPRInfo::returnValueGPR, result);
+ }
+ void callOperation(J_DFGOperation_EJI operation, GPRReg result, GPRReg arg1, Identifier* identifier)
+ {
+ callOperation((J_DFGOperation_EJP)operation, result, arg1, identifier);
+ }
+ void callOperation(J_DFGOperation_EJ operation, GPRReg result, GPRReg arg1)
+ {
+ ASSERT(isFlushed());
+
+ m_jit.move(arg1, GPRInfo::argumentGPR1);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+ appendCallWithExceptionCheck(operation);
+ m_jit.move(GPRInfo::returnValueGPR, result);
+ }
+ void callOperation(Z_DFGOperation_EJ operation, GPRReg result, GPRReg arg1)
+ {
+ ASSERT(isFlushed());
+
+ m_jit.move(arg1, GPRInfo::argumentGPR1);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+ appendCallWithExceptionCheck(operation);
+ m_jit.move(GPRInfo::returnValueGPR, result);
+ }
+ void callOperation(Z_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
+ {
+ ASSERT(isFlushed());
+
+ setupStubArguments(arg1, arg2);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+ appendCallWithExceptionCheck(operation);
+ m_jit.move(GPRInfo::returnValueGPR, result);
+ }
+ void callOperation(J_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
+ {
+ ASSERT(isFlushed());
+
+ setupStubArguments(arg1, arg2);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+ appendCallWithExceptionCheck(operation);
+ m_jit.move(GPRInfo::returnValueGPR, result);
+ }
+ void callOperation(V_DFGOperation_EJJP operation, GPRReg arg1, GPRReg arg2, void* pointer)
+ {
+ ASSERT(isFlushed());
+
+ setupStubArguments(arg1, arg2);
+ m_jit.move(JITCompiler::TrustedImmPtr(pointer), GPRInfo::argumentGPR3);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+ appendCallWithExceptionCheck(operation);
+ }
+ void callOperation(V_DFGOperation_EJJI operation, GPRReg arg1, GPRReg arg2, Identifier* identifier)
+ {
+ callOperation((V_DFGOperation_EJJP)operation, arg1, arg2, identifier);
+ }
+ void callOperation(V_DFGOperation_EJJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
+ {
+ ASSERT(isFlushed());
+
+ setupStubArguments(arg1, arg2, arg3);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+ appendCallWithExceptionCheck(operation);
+ }
+ void callOperation(D_DFGOperation_DD operation, FPRReg result, FPRReg arg1, FPRReg arg2)
+ {
+ ASSERT(isFlushed());
+
+ setupTwoStubArgs<FPRInfo::argumentFPR0, FPRInfo::argumentFPR1>(arg1, arg2);
+
+ m_jit.appendCall(operation);
+ m_jit.moveDouble(FPRInfo::returnValueFPR, result);
+ }
+
+ void appendCallWithExceptionCheck(const FunctionPtr& function)
+ {
+ m_jit.appendCallWithExceptionCheck(function, m_jit.graph()[m_compileIndex].exceptionInfo);
+ }
+
+ void addBranch(const MacroAssembler::Jump& jump, BlockIndex destination)
+ {
+ m_branches.append(BranchRecord(jump, destination));
+ }
+
+ void linkBranches()
+ {
+ for (size_t i = 0; i < m_branches.size(); ++i) {
+ BranchRecord& branch = m_branches[i];
+ branch.jump.linkTo(m_blockHeads[branch.destination], &m_jit);
+ }
+ }
+
+#ifndef NDEBUG
+ void dump(const char* label = 0);
+#endif
+
+#if DFG_CONSISTENCY_CHECK
+ void checkConsistency();
+#else
+ void checkConsistency() {}
+#endif
+
+ // The JIT, while also provides MacroAssembler functionality.
+ JITCompiler& m_jit;
+ // This flag is used to distinguish speculative and non-speculative
+ // code generation. This is significant when filling spilled values
+ // from the RegisterFile. When spilling we attempt to store information
+ // as to the type of boxed value being stored (int32, double, cell), and
+ // when filling on the speculative path we will retrieve this type info
+ // where available. On the non-speculative path, however, we cannot rely
+ // on the spill format info, since the a value being loaded might have
+ // been spilled by either the speculative or non-speculative paths (where
+ // we entered the non-speculative path on an intervening bail-out), and
+ // the value may have been boxed differently on the two paths.
+ bool m_isSpeculative;
+ // The current node being generated.
+ BlockIndex m_block;
+ NodeIndex m_compileIndex;
+ // Virtual and physical register maps.
+ Vector<GenerationInfo, 32> m_generationInfo;
+ RegisterBank<GPRInfo> m_gprs;
+ RegisterBank<FPRInfo> m_fprs;
+
+ Vector<MacroAssembler::Label> m_blockHeads;
+ struct BranchRecord {
+ BranchRecord(MacroAssembler::Jump jump, BlockIndex destination)
+ : jump(jump)
+ , destination(destination)
+ {
+ }
+
+ MacroAssembler::Jump jump;
+ BlockIndex destination;
+ };
+ Vector<BranchRecord, 8> m_branches;
+};
+
+// === Operand types ===
+//
+// IntegerOperand, DoubleOperand and JSValueOperand.
+//
+// These classes are used to lock the operands to a node into machine
+// registers. These classes implement of pattern of locking a value
+// into register at the point of construction only if it is already in
+// registers, and otherwise loading it lazily at the point it is first
+// used. We do so in order to attempt to avoid spilling one operand
+// in order to make space available for another.
+
+class IntegerOperand {
+public:
+ explicit IntegerOperand(JITCodeGenerator* jit, NodeIndex index)
+ : m_jit(jit)
+ , m_index(index)
+ , m_gprOrInvalid(InvalidGPRReg)
+#ifndef NDEBUG
+ , m_format(DataFormatNone)
+#endif
+ {
+ ASSERT(m_jit);
+ if (jit->isFilled(index))
+ gpr();
+ }
+
+ ~IntegerOperand()
+ {
+ ASSERT(m_gprOrInvalid != InvalidGPRReg);
+ m_jit->unlock(m_gprOrInvalid);
+ }
+
+ NodeIndex index() const
+ {
+ return m_index;
+ }
+
+ DataFormat format()
+ {
+ gpr(); // m_format is set when m_gpr is locked.
+ ASSERT(m_format == DataFormatInteger || m_format == DataFormatJSInteger);
+ return m_format;
+ }
+
+ GPRReg gpr()
+ {
+ if (m_gprOrInvalid == InvalidGPRReg)
+ m_gprOrInvalid = m_jit->fillInteger(index(), m_format);
+ return m_gprOrInvalid;
+ }
+
+private:
+ JITCodeGenerator* m_jit;
+ NodeIndex m_index;
+ GPRReg m_gprOrInvalid;
+ DataFormat m_format;
+};
+
+class DoubleOperand {
+public:
+ explicit DoubleOperand(JITCodeGenerator* jit, NodeIndex index)
+ : m_jit(jit)
+ , m_index(index)
+ , m_fprOrInvalid(InvalidFPRReg)
+ {
+ ASSERT(m_jit);
+ if (jit->isFilledDouble(index))
+ fpr();
+ }
+
+ ~DoubleOperand()
+ {
+ ASSERT(m_fprOrInvalid != InvalidFPRReg);
+ m_jit->unlock(m_fprOrInvalid);
+ }
+
+ NodeIndex index() const
+ {
+ return m_index;
+ }
+
+ FPRReg fpr()
+ {
+ if (m_fprOrInvalid == InvalidFPRReg)
+ m_fprOrInvalid = m_jit->fillDouble(index());
+ return m_fprOrInvalid;
+ }
+
+private:
+ JITCodeGenerator* m_jit;
+ NodeIndex m_index;
+ FPRReg m_fprOrInvalid;
+};
+
+class JSValueOperand {
+public:
+ explicit JSValueOperand(JITCodeGenerator* jit, NodeIndex index)
+ : m_jit(jit)
+ , m_index(index)
+ , m_gprOrInvalid(InvalidGPRReg)
+ {
+ ASSERT(m_jit);
+ if (jit->isFilled(index))
+ gpr();
+ }
+
+ ~JSValueOperand()
+ {
+ ASSERT(m_gprOrInvalid != InvalidGPRReg);
+ m_jit->unlock(m_gprOrInvalid);
+ }
+
+ NodeIndex index() const
+ {
+ return m_index;
+ }
+
+ GPRReg gpr()
+ {
+ if (m_gprOrInvalid == InvalidGPRReg)
+ m_gprOrInvalid = m_jit->fillJSValue(index());
+ return m_gprOrInvalid;
+ }
+
+private:
+ JITCodeGenerator* m_jit;
+ NodeIndex m_index;
+ GPRReg m_gprOrInvalid;
+};
+
+
+// === Temporaries ===
+//
+// These classes are used to allocate temporary registers.
+// A mechanism is provided to attempt to reuse the registers
+// currently allocated to child nodes whose value is consumed
+// by, and not live after, this operation.
+
+class GPRTemporary {
+public:
+ GPRTemporary(JITCodeGenerator*);
+ GPRTemporary(JITCodeGenerator*, SpeculateIntegerOperand&);
+ GPRTemporary(JITCodeGenerator*, SpeculateIntegerOperand&, SpeculateIntegerOperand&);
+ GPRTemporary(JITCodeGenerator*, IntegerOperand&);
+ GPRTemporary(JITCodeGenerator*, IntegerOperand&, IntegerOperand&);
+ GPRTemporary(JITCodeGenerator*, SpeculateCellOperand&);
+ GPRTemporary(JITCodeGenerator*, JSValueOperand&);
+
+ ~GPRTemporary()
+ {
+ m_jit->unlock(gpr());
+ }
+
+ GPRReg gpr()
+ {
+ ASSERT(m_gpr != InvalidGPRReg);
+ return m_gpr;
+ }
+
+protected:
+ GPRTemporary(JITCodeGenerator* jit, GPRReg lockedGPR)
+ : m_jit(jit)
+ , m_gpr(lockedGPR)
+ {
+ }
+
+private:
+ JITCodeGenerator* m_jit;
+ GPRReg m_gpr;
+};
+
+class FPRTemporary {
+public:
+ FPRTemporary(JITCodeGenerator*);
+ FPRTemporary(JITCodeGenerator*, DoubleOperand&);
+ FPRTemporary(JITCodeGenerator*, DoubleOperand&, DoubleOperand&);
+
+ ~FPRTemporary()
+ {
+ m_jit->unlock(fpr());
+ }
+
+ FPRReg fpr() const
+ {
+ ASSERT(m_fpr != InvalidFPRReg);
+ return m_fpr;
+ }
+
+protected:
+ FPRTemporary(JITCodeGenerator* jit, FPRReg lockedFPR)
+ : m_jit(jit)
+ , m_fpr(lockedFPR)
+ {
+ }
+
+private:
+ JITCodeGenerator* m_jit;
+ FPRReg m_fpr;
+};
+
+
+// === Results ===
+//
+// These classes lock the result of a call to a C++ helper function.
+
+class GPRResult : public GPRTemporary {
+public:
+ GPRResult(JITCodeGenerator* jit)
+ : GPRTemporary(jit, lockedResult(jit))
+ {
+ }
+
+private:
+ static GPRReg lockedResult(JITCodeGenerator* jit)
+ {
+ jit->lock(GPRInfo::returnValueGPR);
+ return GPRInfo::returnValueGPR;
+ }
+};
+
+class FPRResult : public FPRTemporary {
+public:
+ FPRResult(JITCodeGenerator* jit)
+ : FPRTemporary(jit, lockedResult(jit))
+ {
+ }
+
+private:
+ static FPRReg lockedResult(JITCodeGenerator* jit)
+ {
+ jit->lock(FPRInfo::returnValueFPR);
+ return FPRInfo::returnValueFPR;
+ }
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
new file mode 100644
index 0000000..a47dce7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
@@ -0,0 +1,452 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "DFGJITCompiler.h"
+
+#if ENABLE(DFG_JIT)
+
+#include "CodeBlock.h"
+#include "DFGJITCodeGenerator.h"
+#include "DFGNonSpeculativeJIT.h"
+#include "DFGOperations.h"
+#include "DFGRegisterBank.h"
+#include "DFGSpeculativeJIT.h"
+#include "JSGlobalData.h"
+#include "LinkBuffer.h"
+
+namespace JSC { namespace DFG {
+
+// This method used to fill a numeric value to a FPR when linking speculative -> non-speculative.
+void JITCompiler::fillNumericToDouble(NodeIndex nodeIndex, FPRReg fpr, GPRReg temporary)
+{
+ Node& node = graph()[nodeIndex];
+
+ if (node.isConstant()) {
+ ASSERT(node.op == DoubleConstant);
+ move(MacroAssembler::ImmPtr(reinterpret_cast<void*>(reinterpretDoubleToIntptr(valueOfDoubleConstant(nodeIndex)))), temporary);
+ movePtrToDouble(temporary, fpr);
+ } else {
+ loadPtr(addressFor(node.virtualRegister()), temporary);
+ Jump isInteger = branchPtr(MacroAssembler::AboveOrEqual, temporary, GPRInfo::tagTypeNumberRegister);
+ jitAssertIsJSDouble(temporary);
+ addPtr(GPRInfo::tagTypeNumberRegister, temporary);
+ movePtrToDouble(temporary, fpr);
+ Jump hasUnboxedDouble = jump();
+ isInteger.link(this);
+ convertInt32ToDouble(temporary, fpr);
+ hasUnboxedDouble.link(this);
+ }
+}
+
+// This method used to fill an integer value to a GPR when linking speculative -> non-speculative.
+void JITCompiler::fillInt32ToInteger(NodeIndex nodeIndex, GPRReg gpr)
+{
+ Node& node = graph()[nodeIndex];
+
+ if (node.isConstant()) {
+ ASSERT(node.op == Int32Constant);
+ move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gpr);
+ } else {
+#if DFG_JIT_ASSERT
+ // Redundant load, just so we can check the tag!
+ loadPtr(addressFor(node.virtualRegister()), gpr);
+ jitAssertIsJSInt32(gpr);
+#endif
+ load32(addressFor(node.virtualRegister()), gpr);
+ }
+}
+
+// This method used to fill a JSValue to a GPR when linking speculative -> non-speculative.
+void JITCompiler::fillToJS(NodeIndex nodeIndex, GPRReg gpr)
+{
+ Node& node = graph()[nodeIndex];
+
+ if (node.isConstant()) {
+ if (isInt32Constant(nodeIndex)) {
+ JSValue jsValue = jsNumber(valueOfInt32Constant(nodeIndex));
+ move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ } else if (isDoubleConstant(nodeIndex)) {
+ JSValue jsValue(JSValue::EncodeAsDouble, valueOfDoubleConstant(nodeIndex));
+ move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ } else {
+ ASSERT(isJSConstant(nodeIndex));
+ JSValue jsValue = valueOfJSConstant(nodeIndex);
+ move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gpr);
+ }
+ return;
+ }
+
+ loadPtr(addressFor(node.virtualRegister()), gpr);
+}
+
+void JITCompiler::jumpFromSpeculativeToNonSpeculative(const SpeculationCheck& check, const EntryLocation& entry, SpeculationRecovery* recovery)
+{
+ ASSERT(check.m_nodeIndex == entry.m_nodeIndex);
+
+ // Link the jump from the Speculative path to here.
+ check.m_check.link(this);
+
+ // Does this speculation check require any additional recovery to be performed,
+ // to restore any state that has been overwritten before we enter back in to the
+ // non-speculative path.
+ if (recovery) {
+ // The only additional recovery we currently support is for integer add operation
+ ASSERT(recovery->type() == SpeculativeAdd);
+ // Revert the add.
+ sub32(recovery->src(), recovery->dest());
+ }
+
+ // FIXME: - This is hideously inefficient!
+ // Where a value is live in a register in the speculative path, and is required in a register
+ // on the non-speculative path, we should not need to be spilling it and reloading (we may
+ // need to spill anyway, if the value is marked as spilled on the non-speculative path).
+ // This may also be spilling values that don't need spilling, e.g. are already spilled,
+ // are constants, or are arguments.
+
+ // Spill all GPRs in use by the speculative path.
+ for (unsigned index = 0; index < GPRInfo::numberOfRegisters; ++index) {
+ NodeIndex nodeIndex = check.m_gprInfo[index].nodeIndex;
+ if (nodeIndex == NoNode)
+ continue;
+
+ DataFormat dataFormat = check.m_gprInfo[index].format;
+ VirtualRegister virtualRegister = graph()[nodeIndex].virtualRegister();
+
+ ASSERT(dataFormat == DataFormatInteger || DataFormatCell || dataFormat & DataFormatJS);
+ if (dataFormat == DataFormatInteger)
+ orPtr(GPRInfo::tagTypeNumberRegister, GPRInfo::toRegister(index));
+ storePtr(GPRInfo::toRegister(index), addressFor(virtualRegister));
+ }
+
+ // Spill all FPRs in use by the speculative path.
+ for (unsigned index = 0; index < FPRInfo::numberOfRegisters; ++index) {
+ NodeIndex nodeIndex = check.m_fprInfo[index];
+ if (nodeIndex == NoNode)
+ continue;
+
+ VirtualRegister virtualRegister = graph()[nodeIndex].virtualRegister();
+
+ moveDoubleToPtr(FPRInfo::toRegister(index), GPRInfo::regT0);
+ subPtr(GPRInfo::tagTypeNumberRegister, GPRInfo::regT0);
+ storePtr(GPRInfo::regT0, addressFor(virtualRegister));
+ }
+
+ // Fill all FPRs in use by the non-speculative path.
+ for (unsigned index = 0; index < FPRInfo::numberOfRegisters; ++index) {
+ NodeIndex nodeIndex = entry.m_fprInfo[index];
+ if (nodeIndex == NoNode)
+ continue;
+
+ fillNumericToDouble(nodeIndex, FPRInfo::toRegister(index), GPRInfo::regT0);
+ }
+
+ // Fill all GPRs in use by the non-speculative path.
+ for (unsigned index = 0; index < GPRInfo::numberOfRegisters; ++index) {
+ NodeIndex nodeIndex = entry.m_gprInfo[index].nodeIndex;
+ if (nodeIndex == NoNode)
+ continue;
+
+ DataFormat dataFormat = entry.m_gprInfo[index].format;
+ if (dataFormat == DataFormatInteger)
+ fillInt32ToInteger(nodeIndex, GPRInfo::toRegister(index));
+ else {
+ ASSERT(dataFormat & DataFormatJS || dataFormat == DataFormatCell); // Treat cell as JSValue for now!
+ fillToJS(nodeIndex, GPRInfo::toRegister(index));
+ // FIXME: For subtypes of DataFormatJS, should jitAssert the subtype?
+ }
+ }
+
+ // Jump into the non-speculative path.
+ jump(entry.m_entry);
+}
+
+void JITCompiler::linkSpeculationChecks(SpeculativeJIT& speculative, NonSpeculativeJIT& nonSpeculative)
+{
+ // Iterators to walk over the set of bail outs & corresponding entry points.
+ SpeculationCheckVector::Iterator checksIter = speculative.speculationChecks().begin();
+ SpeculationCheckVector::Iterator checksEnd = speculative.speculationChecks().end();
+ NonSpeculativeJIT::EntryLocationVector::Iterator entriesIter = nonSpeculative.entryLocations().begin();
+ NonSpeculativeJIT::EntryLocationVector::Iterator entriesEnd = nonSpeculative.entryLocations().end();
+
+ // Iterate over the speculation checks.
+ while (checksIter != checksEnd) {
+ // For every bail out from the speculative path, we must have provided an entry point
+ // into the non-speculative one.
+ ASSERT(checksIter->m_nodeIndex == entriesIter->m_nodeIndex);
+
+ // There may be multiple bail outs that map to the same entry point!
+ do {
+ ASSERT(checksIter != checksEnd);
+ ASSERT(entriesIter != entriesEnd);
+
+ // Plant code to link this speculation failure.
+ const SpeculationCheck& check = *checksIter;
+ const EntryLocation& entry = *entriesIter;
+ jumpFromSpeculativeToNonSpeculative(check, entry, speculative.speculationRecovery(check.m_recoveryIndex));
+ ++checksIter;
+ } while (checksIter != checksEnd && checksIter->m_nodeIndex == entriesIter->m_nodeIndex);
+ ++entriesIter;
+ }
+
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=56289
+ ASSERT(!(checksIter != checksEnd));
+ ASSERT(!(entriesIter != entriesEnd));
+}
+
+void JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWithArityCheck)
+{
+ // === Stage 1 - Function header code generation ===
+ //
+ // This code currently matches the old JIT. In the function header we need to
+ // pop the return address (since we do not allow any recursion on the machine
+ // stack), and perform a fast register file check.
+
+ // This is the main entry point, without performing an arity check.
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=56292
+ // We'll need to convert the remaining cti_ style calls (specifically the register file
+ // check) which will be dependent on stack layout. (We'd need to account for this in
+ // both normal return code and when jumping to an exception handler).
+ preserveReturnAddressAfterCall(GPRInfo::regT2);
+ emitPutToCallFrameHeader(GPRInfo::regT2, RegisterFile::ReturnPC);
+ // If we needed to perform an arity check we will already have moved the return address,
+ // so enter after this.
+ Label fromArityCheck(this);
+
+ // Setup a pointer to the codeblock in the CallFrameHeader.
+ emitPutImmediateToCallFrameHeader(m_codeBlock, RegisterFile::CodeBlock);
+
+ // Plant a check that sufficient space is available in the RegisterFile.
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=56291
+ addPtr(Imm32(m_codeBlock->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1);
+ Jump registerFileCheck = branchPtr(Below, AbsoluteAddress(m_globalData->interpreter->registerFile().addressOfEnd()), GPRInfo::regT1);
+ // Return here after register file check.
+ Label fromRegisterFileCheck = label();
+
+
+ // === Stage 2 - Function body code generation ===
+ //
+ // We generate the speculative code path, followed by the non-speculative
+ // code for the function. Next we need to link the two together, making
+ // bail-outs from the speculative path jump to the corresponding point on
+ // the non-speculative one (and generating any code necessary to juggle
+ // register values around, rebox values, and ensure spilled, to match the
+ // non-speculative path's requirements).
+
+#if DFG_JIT_BREAK_ON_EVERY_FUNCTION
+ // Handy debug tool!
+ breakpoint();
+#endif
+
+ // First generate the speculative path.
+ Label speculativePathBegin = label();
+ SpeculativeJIT speculative(*this);
+#if !DFG_DEBUG_LOCAL_DISBALE_SPECULATIVE
+ bool compiledSpeculative = speculative.compile();
+#else
+ bool compiledSpeculative = false;
+#endif
+
+ // Next, generate the non-speculative path. We pass this a SpeculationCheckIndexIterator
+ // to allow it to check which nodes in the graph may bail out, and may need to reenter the
+ // non-speculative path.
+ if (compiledSpeculative) {
+ SpeculationCheckIndexIterator checkIterator(speculative.speculationChecks());
+ NonSpeculativeJIT nonSpeculative(*this);
+ nonSpeculative.compile(checkIterator);
+
+ // Link the bail-outs from the speculative path to the corresponding entry points into the non-speculative one.
+ linkSpeculationChecks(speculative, nonSpeculative);
+ } else {
+ // If compilation through the SpeculativeJIT failed, throw away the code we generated.
+ m_calls.clear();
+ rewindToLabel(speculativePathBegin);
+
+ SpeculationCheckVector noChecks;
+ SpeculationCheckIndexIterator checkIterator(noChecks);
+ NonSpeculativeJIT nonSpeculative(*this);
+ nonSpeculative.compile(checkIterator);
+ }
+
+ // === Stage 3 - Function footer code generation ===
+ //
+ // Generate code to lookup and jump to exception handlers, to perform the slow
+ // register file check (if the fast one in the function header fails), and
+ // generate the entry point with arity check.
+
+ // Iterate over the m_calls vector, checking for exception checks,
+ // and linking them to here.
+ unsigned exceptionCheckCount = 0;
+ for (unsigned i = 0; i < m_calls.size(); ++i) {
+ Jump& exceptionCheck = m_calls[i].m_exceptionCheck;
+ if (exceptionCheck.isSet()) {
+ exceptionCheck.link(this);
+ ++exceptionCheckCount;
+ }
+ }
+ // If any exception checks were linked, generate code to lookup a handler.
+ if (exceptionCheckCount) {
+ // lookupExceptionHandler is passed two arguments, exec (the CallFrame*), and
+ // an identifier for the operation that threw the exception, which we can use
+ // to look up handler information. The identifier we use is the return address
+ // of the call out from JIT code that threw the exception; this is still
+ // available on the stack, just below the stack pointer!
+ move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+ peek(GPRInfo::argumentGPR1, -1);
+ m_calls.append(CallRecord(call(), lookupExceptionHandler));
+ // lookupExceptionHandler leaves the handler CallFrame* in the returnValueGPR,
+ // and the address of the handler in returnValueGPR2.
+ jump(GPRInfo::returnValueGPR2);
+ }
+
+ // Generate the register file check; if the fast check in the function head fails,
+ // we need to call out to a helper function to check whether more space is available.
+ // FIXME: change this from a cti call to a DFG style operation (normal C calling conventions).
+ registerFileCheck.link(this);
+ move(stackPointerRegister, GPRInfo::argumentGPR0);
+ poke(GPRInfo::callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+ Call callRegisterFileCheck = call();
+ jump(fromRegisterFileCheck);
+
+ // The fast entry point into a function does not check the correct number of arguments
+ // have been passed to the call (we only use the fast entry point where we can statically
+ // determine the correct number of arguments have been passed, or have already checked).
+ // In cases where an arity check is necessary, we enter here.
+ // FIXME: change this from a cti call to a DFG style operation (normal C calling conventions).
+ Label arityCheck = label();
+ preserveReturnAddressAfterCall(GPRInfo::regT2);
+ emitPutToCallFrameHeader(GPRInfo::regT2, RegisterFile::ReturnPC);
+ branch32(Equal, GPRInfo::regT1, Imm32(m_codeBlock->m_numParameters)).linkTo(fromArityCheck, this);
+ move(stackPointerRegister, GPRInfo::argumentGPR0);
+ poke(GPRInfo::callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+ Call callArityCheck = call();
+ move(GPRInfo::regT0, GPRInfo::callFrameRegister);
+ jump(fromArityCheck);
+
+
+ // === Stage 4 - Link ===
+ //
+ // Link the code, populate data in CodeBlock data structures.
+
+ LinkBuffer linkBuffer(this, m_globalData->executableAllocator);
+
+#if DFG_DEBUG_VERBOSE
+ fprintf(stderr, "JIT code start at %p\n", linkBuffer.debugAddress());
+#endif
+
+ // Link all calls out from the JIT code to their respective functions.
+ for (unsigned i = 0; i < m_calls.size(); ++i)
+ linkBuffer.link(m_calls[i].m_call, m_calls[i].m_function);
+
+ if (m_codeBlock->needsCallReturnIndices()) {
+ m_codeBlock->callReturnIndexVector().reserveCapacity(exceptionCheckCount);
+ for (unsigned i = 0; i < m_calls.size(); ++i) {
+ if (m_calls[i].m_exceptionCheck.isSet()) {
+ unsigned returnAddressOffset = linkBuffer.returnAddressOffset(m_calls[i].m_call);
+ unsigned exceptionInfo = m_calls[i].m_exceptionInfo;
+ m_codeBlock->callReturnIndexVector().append(CallReturnOffsetToBytecodeOffset(returnAddressOffset, exceptionInfo));
+ }
+ }
+ }
+
+ // FIXME: switch the register file check & arity check over to DFGOpertaion style calls, not JIT stubs.
+ linkBuffer.link(callRegisterFileCheck, cti_register_file_check);
+ linkBuffer.link(callArityCheck, m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck);
+
+ entryWithArityCheck = linkBuffer.locationOf(arityCheck);
+ entry = linkBuffer.finalizeCode();
+}
+
+#if DFG_JIT_ASSERT
+void JITCompiler::jitAssertIsInt32(GPRReg gpr)
+{
+#if CPU(X86_64)
+ Jump checkInt32 = branchPtr(BelowOrEqual, gpr, TrustedImmPtr(reinterpret_cast<void*>(static_cast<uintptr_t>(0xFFFFFFFFu))));
+ breakpoint();
+ checkInt32.link(this);
+#else
+ UNUSED_PARAM(gpr);
+#endif
+}
+
+void JITCompiler::jitAssertIsJSInt32(GPRReg gpr)
+{
+ Jump checkJSInt32 = branchPtr(AboveOrEqual, gpr, GPRInfo::tagTypeNumberRegister);
+ breakpoint();
+ checkJSInt32.link(this);
+}
+
+void JITCompiler::jitAssertIsJSNumber(GPRReg gpr)
+{
+ Jump checkJSNumber = branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagTypeNumberRegister);
+ breakpoint();
+ checkJSNumber.link(this);
+}
+
+void JITCompiler::jitAssertIsJSDouble(GPRReg gpr)
+{
+ Jump checkJSInt32 = branchPtr(AboveOrEqual, gpr, GPRInfo::tagTypeNumberRegister);
+ Jump checkJSNumber = branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagTypeNumberRegister);
+ checkJSInt32.link(this);
+ breakpoint();
+ checkJSNumber.link(this);
+}
+#endif
+
+#if ENABLE(SAMPLING_COUNTERS) && CPU(X86_64) // Or any other 64-bit platform!
+void JITCompiler::emitCount(AbstractSamplingCounter& counter, uint32_t increment)
+{
+ addPtr(TrustedImm32(increment), AbsoluteAddress(counter.addressOfCounter()));
+}
+#endif
+
+#if ENABLE(SAMPLING_COUNTERS) && CPU(X86) // Or any other little-endian 32-bit platform!
+void JITCompiler::emitCount(AbstractSamplingCounter& counter, uint32_t increment)
+{
+ intptr_t hiWord = reinterpret_cast<intptr_t>(counter.addressOfCounter()) + sizeof(int32_t);
+ add32(TrustedImm32(increment), AbsoluteAddress(counter.addressOfCounter()));
+ addWithCarry32(TrustedImm32(0), AbsoluteAddress(reinterpret_cast<void*>(hiWord)));
+}
+#endif
+
+#if ENABLE(SAMPLING_FLAGS)
+void JITCompiler::setSamplingFlag(int32_t flag)
+{
+ ASSERT(flag >= 1);
+ ASSERT(flag <= 32);
+ or32(TrustedImm32(1u << (flag - 1)), AbsoluteAddress(SamplingFlags::addressOfFlags()));
+}
+
+void JITCompiler::clearSamplingFlag(int32_t flag)
+{
+ ASSERT(flag >= 1);
+ ASSERT(flag <= 32);
+ and32(TrustedImm32(~(1u << (flag - 1))), AbsoluteAddress(SamplingFlags::addressOfFlags()));
+}
+#endif
+
+} } // namespace JSC::DFG
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.h
new file mode 100644
index 0000000..7ed9a2f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGJITCompiler.h
@@ -0,0 +1,260 @@
+/*
+ * 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 DFGJITCompiler_h
+#define DFGJITCompiler_h
+
+#if ENABLE(DFG_JIT)
+
+#include <assembler/MacroAssembler.h>
+#include <bytecode/CodeBlock.h>
+#include <dfg/DFGGraph.h>
+#include <dfg/DFGRegisterBank.h>
+#include <jit/JITCode.h>
+
+#include <dfg/DFGFPRInfo.h>
+#include <dfg/DFGGPRInfo.h>
+
+namespace JSC {
+
+class AbstractSamplingCounter;
+class CodeBlock;
+class JSGlobalData;
+
+namespace DFG {
+
+class JITCodeGenerator;
+class NonSpeculativeJIT;
+class SpeculativeJIT;
+class SpeculationRecovery;
+
+struct EntryLocation;
+struct SpeculationCheck;
+
+// === CallRecord ===
+//
+// A record of a call out from JIT code to a helper function.
+// Every CallRecord contains a reference to the call instruction & the function
+// that it needs to be linked to. Calls that might throw an exception also record
+// the Jump taken on exception (unset if not present), and ExceptionInfo (presently
+// an unsigned, bytecode index) used to recover handler/source info.
+struct CallRecord {
+ // Constructor for a call with no exception handler.
+ CallRecord(MacroAssembler::Call call, FunctionPtr function)
+ : m_call(call)
+ , m_function(function)
+ {
+ }
+
+ // Constructor for a call with an exception handler.
+ CallRecord(MacroAssembler::Call call, FunctionPtr function, MacroAssembler::Jump exceptionCheck, ExceptionInfo exceptionInfo)
+ : m_call(call)
+ , m_function(function)
+ , m_exceptionCheck(exceptionCheck)
+ , m_exceptionInfo(exceptionInfo)
+ {
+ }
+
+ MacroAssembler::Call m_call;
+ FunctionPtr m_function;
+ MacroAssembler::Jump m_exceptionCheck;
+ ExceptionInfo m_exceptionInfo;
+};
+
+// === JITCompiler ===
+//
+// DFG::JITCompiler is responsible for generating JIT code from the dataflow graph.
+// It does so by delegating to the speculative & non-speculative JITs, which
+// generate to a MacroAssembler (which the JITCompiler owns through an inheritance
+// relationship). The JITCompiler holds references to information required during
+// compilation, and also records information used in linking (e.g. a list of all
+// call to be linked).
+class JITCompiler : public MacroAssembler {
+public:
+ JITCompiler(JSGlobalData* globalData, Graph& dfg, CodeBlock* codeBlock)
+ : m_globalData(globalData)
+ , m_graph(dfg)
+ , m_codeBlock(codeBlock)
+ {
+ }
+
+ void compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWithArityCheck);
+
+ // Accessors for properties.
+ Graph& graph() { return m_graph; }
+ CodeBlock* codeBlock() { return m_codeBlock; }
+ JSGlobalData* globalData() { return m_globalData; }
+
+#if CPU(X86_64)
+ void preserveReturnAddressAfterCall(GPRReg reg)
+ {
+ pop(reg);
+ }
+
+ void restoreReturnAddressBeforeReturn(GPRReg reg)
+ {
+ push(reg);
+ }
+
+ void restoreReturnAddressBeforeReturn(Address address)
+ {
+ push(address);
+ }
+
+ void emitGetFromCallFrameHeaderPtr(RegisterFile::CallFrameHeaderEntry entry, GPRReg to)
+ {
+ loadPtr(Address(GPRInfo::callFrameRegister, entry * sizeof(Register)), to);
+ }
+ void emitPutToCallFrameHeader(GPRReg from, RegisterFile::CallFrameHeaderEntry entry)
+ {
+ storePtr(from, Address(GPRInfo::callFrameRegister, entry * sizeof(Register)));
+ }
+
+ void emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry)
+ {
+ storePtr(TrustedImmPtr(value), Address(GPRInfo::callFrameRegister, entry * sizeof(Register)));
+ }
+#endif
+
+ static Address addressForGlobalVar(GPRReg global, int32_t varNumber)
+ {
+ return Address(global, varNumber * sizeof(Register));
+ }
+
+ static Address addressFor(VirtualRegister virtualRegister)
+ {
+ return Address(GPRInfo::callFrameRegister, virtualRegister * sizeof(Register));
+ }
+
+ static Address tagFor(VirtualRegister virtualRegister)
+ {
+ return Address(GPRInfo::callFrameRegister, virtualRegister * sizeof(Register) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
+ }
+
+ static Address payloadFor(VirtualRegister virtualRegister)
+ {
+ return Address(GPRInfo::callFrameRegister, virtualRegister * sizeof(Register) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
+ }
+
+ // Add a call out from JIT code, without an exception check.
+ void appendCall(const FunctionPtr& function)
+ {
+ m_calls.append(CallRecord(call(), function));
+ // FIXME: should be able to JIT_ASSERT here that globalData->exception is null on return back to JIT code.
+ }
+
+ // Add a call out from JIT code, with an exception check.
+ void appendCallWithExceptionCheck(const FunctionPtr& function, unsigned exceptionInfo)
+ {
+ Call functionCall = call();
+ Jump exceptionCheck = branchTestPtr(NonZero, AbsoluteAddress(&globalData()->exception));
+ m_calls.append(CallRecord(functionCall, function, exceptionCheck, exceptionInfo));
+ }
+
+ // Helper methods to check nodes for constants.
+ bool isConstant(NodeIndex nodeIndex)
+ {
+ return graph()[nodeIndex].isConstant();
+ }
+ bool isInt32Constant(NodeIndex nodeIndex)
+ {
+ return graph()[nodeIndex].op == Int32Constant;
+ }
+ bool isDoubleConstant(NodeIndex nodeIndex)
+ {
+ return graph()[nodeIndex].op == DoubleConstant;
+ }
+ bool isJSConstant(NodeIndex nodeIndex)
+ {
+ return graph()[nodeIndex].op == JSConstant;
+ }
+
+ // Helper methods get constant values from nodes.
+ int32_t valueOfInt32Constant(NodeIndex nodeIndex)
+ {
+ ASSERT(isInt32Constant(nodeIndex));
+ return graph()[nodeIndex].int32Constant();
+ }
+ double valueOfDoubleConstant(NodeIndex nodeIndex)
+ {
+ ASSERT(isDoubleConstant(nodeIndex));
+ return graph()[nodeIndex].numericConstant();
+ }
+ JSValue valueOfJSConstant(NodeIndex nodeIndex)
+ {
+ ASSERT(isJSConstant(nodeIndex));
+ unsigned constantIndex = graph()[nodeIndex].constantNumber();
+ return codeBlock()->constantRegister(FirstConstantRegisterIndex + constantIndex).get();
+ }
+
+ // These methods JIT generate dynamic, debug-only checks - akin to ASSERTs.
+#if DFG_JIT_ASSERT
+ void jitAssertIsInt32(GPRReg);
+ void jitAssertIsJSInt32(GPRReg);
+ void jitAssertIsJSNumber(GPRReg);
+ void jitAssertIsJSDouble(GPRReg);
+#else
+ void jitAssertIsInt32(GPRReg) {}
+ void jitAssertIsJSInt32(GPRReg) {}
+ void jitAssertIsJSNumber(GPRReg) {}
+ void jitAssertIsJSDouble(GPRReg) {}
+#endif
+
+#if ENABLE(SAMPLING_COUNTERS)
+ // Debug profiling tool.
+ void emitCount(AbstractSamplingCounter&, uint32_t increment = 1);
+#endif
+
+#if ENABLE(SAMPLING_FLAGS)
+ void setSamplingFlag(int32_t flag);
+ void clearSamplingFlag(int32_t flag);
+#endif
+
+private:
+ // These methods used in linking the speculative & non-speculative paths together.
+ void fillNumericToDouble(NodeIndex, FPRReg, GPRReg temporary);
+ void fillInt32ToInteger(NodeIndex, GPRReg);
+ void fillToJS(NodeIndex, GPRReg);
+ void jumpFromSpeculativeToNonSpeculative(const SpeculationCheck&, const EntryLocation&, SpeculationRecovery*);
+ void linkSpeculationChecks(SpeculativeJIT&, NonSpeculativeJIT&);
+
+ // The globalData, used to access constants such as the vPtrs.
+ JSGlobalData* m_globalData;
+
+ // The dataflow graph currently being generated.
+ Graph& m_graph;
+
+ // The codeBlock currently being generated, used to access information such as constant values, immediates.
+ CodeBlock* m_codeBlock;
+
+ // Vector of calls out from JIT code, including exception handler information.
+ Vector<CallRecord> m_calls;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNode.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNode.h
new file mode 100644
index 0000000..903be46
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNode.h
@@ -0,0 +1,404 @@
+/*
+ * 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 DFGNode_h
+#define DFGNode_h
+
+// Emit various logging information for debugging, including dumping the dataflow graphs.
+#define DFG_DEBUG_VERBOSE 0
+// Enable generation of dynamic checks into the instruction stream.
+#define DFG_JIT_ASSERT 0
+// Consistency check contents compiler data structures.
+#define DFG_CONSISTENCY_CHECK 0
+// Emit a breakpoint into the head of every generated function, to aid debugging in GDB.
+#define DFG_JIT_BREAK_ON_EVERY_FUNCTION 0
+// Emit a breakpoint into the head of every generated node, to aid debugging in GDB.
+#define DFG_JIT_BREAK_ON_EVERY_BLOCK 0
+// Emit a breakpoint into the head of every generated node, to aid debugging in GDB.
+#define DFG_JIT_BREAK_ON_EVERY_NODE 0
+// Disable the DFG JIT without having to touch Platform.h!
+#define DFG_DEBUG_LOCAL_DISBALE 0
+// Disable the SpeculativeJIT without having to touch Platform.h!
+#define DFG_DEBUG_LOCAL_DISBALE_SPECULATIVE 0
+// Generate stats on how successful we were in making use of the DFG jit, and remaining on the hot path.
+#define DFG_SUCCESS_STATS 0
+
+
+#if ENABLE(DFG_JIT)
+
+#include <wtf/Vector.h>
+
+namespace JSC { namespace DFG {
+
+// Type for a virtual register number (spill location).
+// Using an enum to make this type-checked at compile time, to avert programmer errors.
+enum VirtualRegister { InvalidVirtualRegister = -1 };
+COMPILE_ASSERT(sizeof(VirtualRegister) == sizeof(int), VirtualRegister_is_32bit);
+
+// Type for a reference to another node in the graph.
+typedef uint32_t NodeIndex;
+static const NodeIndex NoNode = UINT_MAX;
+
+// Information used to map back from an exception to any handler/source information.
+// (Presently implemented as a bytecode index).
+typedef uint32_t ExceptionInfo;
+
+// Entries in the NodeType enum (below) are composed of an id, a result type (possibly none)
+// and some additional informative flags (must generate, is constant, etc).
+#define NodeIdMask 0xFFF
+#define NodeResultMask 0xF000
+#define NodeMustGenerate 0x10000 // set on nodes that have side effects, and may not trivially be removed by DCE.
+#define NodeIsConstant 0x20000
+#define NodeIsJump 0x40000
+#define NodeIsBranch 0x80000
+#define NodeIsTerminal 0x100000
+
+// These values record the result type of the node (as checked by NodeResultMask, above), 0 for no result.
+#define NodeResultJS 0x1000
+#define NodeResultDouble 0x2000
+#define NodeResultInt32 0x3000
+
+// This macro defines a set of information about all known node types, used to populate NodeId, NodeType below.
+#define FOR_EACH_DFG_OP(macro) \
+ /* Nodes for constants. */\
+ macro(JSConstant, NodeResultJS | NodeIsConstant) \
+ macro(Int32Constant, NodeResultJS | NodeIsConstant) \
+ macro(DoubleConstant, NodeResultJS | NodeIsConstant) \
+ macro(ConvertThis, NodeResultJS) \
+ \
+ /* Nodes for local variable access. */\
+ macro(GetLocal, NodeResultJS) \
+ macro(SetLocal, 0) \
+ macro(Phi, 0) \
+ \
+ /* Nodes for bitwise operations. */\
+ macro(BitAnd, NodeResultInt32) \
+ macro(BitOr, NodeResultInt32) \
+ macro(BitXor, NodeResultInt32) \
+ macro(BitLShift, NodeResultInt32) \
+ macro(BitRShift, NodeResultInt32) \
+ macro(BitURShift, NodeResultInt32) \
+ /* Bitwise operators call ToInt32 on their operands. */\
+ macro(NumberToInt32, NodeResultInt32) \
+ macro(ValueToInt32, NodeResultInt32 | NodeMustGenerate) \
+ /* Used to box the result of URShift nodes (result has range 0..2^32-1). */\
+ macro(UInt32ToNumber, NodeResultDouble) \
+ \
+ /* Nodes for arithmetic operations. */\
+ macro(ArithAdd, NodeResultDouble) \
+ macro(ArithSub, NodeResultDouble) \
+ macro(ArithMul, NodeResultDouble) \
+ macro(ArithDiv, NodeResultDouble) \
+ macro(ArithMod, NodeResultDouble) \
+ /* Arithmetic operators call ToNumber on their operands. */\
+ macro(Int32ToNumber, NodeResultDouble) \
+ macro(ValueToNumber, NodeResultDouble | NodeMustGenerate) \
+ \
+ /* Add of values may either be arithmetic, or result in string concatenation. */\
+ macro(ValueAdd, NodeResultJS | NodeMustGenerate) \
+ \
+ /* Property access. */\
+ /* PutByValAlias indicates a 'put' aliases a prior write to the same property. */\
+ /* Since a put to 'length' may invalidate optimizations here, */\
+ /* this must be the directly subsequent property put. */\
+ macro(GetByVal, NodeResultJS | NodeMustGenerate) \
+ macro(PutByVal, NodeMustGenerate) \
+ macro(PutByValAlias, NodeMustGenerate) \
+ macro(GetById, NodeResultJS | NodeMustGenerate) \
+ macro(PutById, NodeMustGenerate) \
+ macro(PutByIdDirect, NodeMustGenerate) \
+ macro(GetGlobalVar, NodeResultJS | NodeMustGenerate) \
+ macro(PutGlobalVar, NodeMustGenerate) \
+ \
+ /* Nodes for comparison operations. */\
+ macro(CompareLess, NodeResultJS | NodeMustGenerate) \
+ macro(CompareLessEq, NodeResultJS | NodeMustGenerate) \
+ macro(CompareEq, NodeResultJS | NodeMustGenerate) \
+ macro(CompareStrictEq, NodeResultJS) \
+ \
+ /* Nodes for misc operations. */\
+ macro(LogicalNot, NodeResultJS) \
+ \
+ /* Block terminals. */\
+ macro(Jump, NodeMustGenerate | NodeIsTerminal | NodeIsJump) \
+ macro(Branch, NodeMustGenerate | NodeIsTerminal | NodeIsBranch) \
+ macro(Return, NodeMustGenerate | NodeIsTerminal)
+
+// This enum generates a monotonically increasing id for all Node types,
+// and is used by the subsequent enum to fill out the id (as accessed via the NodeIdMask).
+enum NodeId {
+#define DFG_OP_ENUM(opcode, flags) opcode##_id,
+ FOR_EACH_DFG_OP(DFG_OP_ENUM)
+#undef DFG_OP_ENUM
+};
+
+// Entries in this enum describe all Node types.
+// The enum value contains a monotonically increasing id, a result type, and additional flags.
+enum NodeType {
+#define DFG_OP_ENUM(opcode, flags) opcode = opcode##_id | (flags),
+ FOR_EACH_DFG_OP(DFG_OP_ENUM)
+#undef DFG_OP_ENUM
+};
+
+// This type used in passing an immediate argument to Node constructor;
+// distinguishes an immediate value (typically an index into a CodeBlock data structure -
+// a constant index, argument, or identifier) from a NodeIndex.
+struct OpInfo {
+ explicit OpInfo(unsigned value) : m_value(value) {}
+ unsigned m_value;
+};
+
+// === Node ===
+//
+// Node represents a single operation in the data flow graph.
+struct Node {
+ // Construct a node with up to 3 children, no immediate value.
+ Node(NodeType op, ExceptionInfo exceptionInfo, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode)
+ : op(op)
+ , exceptionInfo(exceptionInfo)
+ , child1(child1)
+ , child2(child2)
+ , child3(child3)
+ , m_virtualRegister(InvalidVirtualRegister)
+ , m_refCount(0)
+ {
+ }
+
+ // Construct a node with up to 3 children and an immediate value.
+ Node(NodeType op, ExceptionInfo exceptionInfo, OpInfo imm, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode)
+ : op(op)
+ , exceptionInfo(exceptionInfo)
+ , child1(child1)
+ , child2(child2)
+ , child3(child3)
+ , m_virtualRegister(InvalidVirtualRegister)
+ , m_refCount(0)
+ , m_opInfo(imm.m_value)
+ {
+ }
+
+ // Construct a node with up to 3 children and two immediate values.
+ Node(NodeType op, ExceptionInfo exceptionInfo, OpInfo imm1, OpInfo imm2, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode)
+ : op(op)
+ , exceptionInfo(exceptionInfo)
+ , child1(child1)
+ , child2(child2)
+ , child3(child3)
+ , m_virtualRegister(InvalidVirtualRegister)
+ , m_refCount(0)
+ , m_opInfo(imm1.m_value)
+ {
+ m_constantValue.opInfo2 = imm2.m_value;
+ }
+
+ bool mustGenerate()
+ {
+ return op & NodeMustGenerate;
+ }
+
+ bool isConstant()
+ {
+ return op & NodeIsConstant;
+ }
+
+ unsigned constantNumber()
+ {
+ ASSERT(isConstant());
+ return m_opInfo;
+ }
+
+ bool hasLocal()
+ {
+ return op == GetLocal || op == SetLocal;
+ }
+
+ VirtualRegister local()
+ {
+ ASSERT(hasLocal());
+ return (VirtualRegister)m_opInfo;
+ }
+
+ bool hasIdentifier()
+ {
+ return op == GetById || op == PutById || op == PutByIdDirect;
+ }
+
+ unsigned identifierNumber()
+ {
+ ASSERT(hasIdentifier());
+ return m_opInfo;
+ }
+
+ bool hasVarNumber()
+ {
+ return op == GetGlobalVar || op == PutGlobalVar;
+ }
+
+ unsigned varNumber()
+ {
+ ASSERT(hasVarNumber());
+ return m_opInfo;
+ }
+
+ bool hasResult()
+ {
+ return op & NodeResultMask;
+ }
+
+ bool hasInt32Result()
+ {
+ return (op & NodeResultMask) == NodeResultInt32;
+ }
+
+ bool hasDoubleResult()
+ {
+ return (op & NodeResultMask) == NodeResultDouble;
+ }
+
+ bool hasJSResult()
+ {
+ return (op & NodeResultMask) == NodeResultJS;
+ }
+
+ // Check for integers or doubles.
+ bool hasNumericResult()
+ {
+ // This check will need updating if more result types are added.
+ ASSERT((hasInt32Result() || hasDoubleResult()) == !hasJSResult());
+ return !hasJSResult();
+ }
+
+ int32_t int32Constant()
+ {
+ ASSERT(op == Int32Constant);
+ return m_constantValue.asInt32;
+ }
+
+ void setInt32Constant(int32_t value)
+ {
+ ASSERT(op == Int32Constant);
+ m_constantValue.asInt32 = value;
+ }
+
+ double numericConstant()
+ {
+ ASSERT(op == DoubleConstant);
+ return m_constantValue.asDouble;
+ }
+
+ void setDoubleConstant(double value)
+ {
+ ASSERT(op == DoubleConstant);
+ m_constantValue.asDouble = value;
+ }
+
+ bool isJump()
+ {
+ return op & NodeIsJump;
+ }
+
+ bool isBranch()
+ {
+ return op & NodeIsBranch;
+ }
+
+ bool isTerminal()
+ {
+ return op & NodeIsTerminal;
+ }
+
+ unsigned takenBytecodeOffset()
+ {
+ ASSERT(isBranch() || isJump());
+ return m_opInfo;
+ }
+
+ unsigned notTakenBytecodeOffset()
+ {
+ ASSERT(isBranch());
+ return m_constantValue.opInfo2;
+ }
+
+ VirtualRegister virtualRegister()
+ {
+ ASSERT(hasResult());
+ ASSERT(m_virtualRegister != InvalidVirtualRegister);
+ return m_virtualRegister;
+ }
+
+ void setVirtualRegister(VirtualRegister virtualRegister)
+ {
+ ASSERT(hasResult());
+ ASSERT(m_virtualRegister == InvalidVirtualRegister);
+ m_virtualRegister = virtualRegister;
+ }
+
+ bool shouldGenerate()
+ {
+ return m_refCount && op != Phi;
+ }
+
+ unsigned refCount()
+ {
+ return m_refCount;
+ }
+
+ // returns true when ref count passes from 0 to 1.
+ bool ref()
+ {
+ return !m_refCount++;
+ }
+
+ unsigned adjustedRefCount()
+ {
+ return mustGenerate() ? m_refCount - 1 : m_refCount;
+ }
+
+ // This enum value describes the type of the node.
+ NodeType op;
+ // Used to look up exception handling information (currently implemented as a bytecode index).
+ ExceptionInfo exceptionInfo;
+ // References to up to 3 children (0 for no child).
+ NodeIndex child1, child2, child3;
+
+private:
+ // The virtual register number (spill location) associated with this .
+ VirtualRegister m_virtualRegister;
+ // The number of uses of the result of this operation (+1 for 'must generate' nodes, which have side-effects).
+ unsigned m_refCount;
+ // An immediate value, accesses type-checked via accessors above.
+ unsigned m_opInfo;
+ // The value of an int32/double constant.
+ union {
+ int32_t asInt32;
+ double asDouble;
+ unsigned opInfo2;
+ } m_constantValue;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp
new file mode 100644
index 0000000..7c50715
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp
@@ -0,0 +1,692 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "DFGNonSpeculativeJIT.h"
+
+#include "DFGSpeculativeJIT.h"
+
+#if ENABLE(DFG_JIT)
+
+namespace JSC { namespace DFG {
+
+const double twoToThe32 = (double)0x100000000ull;
+
+EntryLocation::EntryLocation(MacroAssembler::Label entry, NonSpeculativeJIT* jit)
+ : m_entry(entry)
+ , m_nodeIndex(jit->m_compileIndex)
+{
+ for (gpr_iterator iter = jit->m_gprs.begin(); iter != jit->m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister) {
+ GenerationInfo& info = jit->m_generationInfo[iter.name()];
+ m_gprInfo[iter.index()].nodeIndex = info.nodeIndex();
+ m_gprInfo[iter.index()].format = info.registerFormat();
+ } else
+ m_gprInfo[iter.index()].nodeIndex = NoNode;
+ }
+ for (fpr_iterator iter = jit->m_fprs.begin(); iter != jit->m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister) {
+ GenerationInfo& info = jit->m_generationInfo[iter.name()];
+ ASSERT(info.registerFormat() == DataFormatDouble);
+ m_fprInfo[iter.index()] = info.nodeIndex();
+ } else
+ m_fprInfo[iter.index()] = NoNode;
+ }
+}
+
+void NonSpeculativeJIT::valueToNumber(JSValueOperand& operand, FPRReg fpr)
+{
+ GPRReg jsValueGpr = operand.gpr();
+ GPRReg tempGpr = allocate(); // FIXME: can we skip this allocation on the last use of the virtual register?
+
+ JITCompiler::Jump isInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, jsValueGpr, GPRInfo::tagTypeNumberRegister);
+ JITCompiler::Jump nonNumeric = m_jit.branchTestPtr(MacroAssembler::Zero, jsValueGpr, GPRInfo::tagTypeNumberRegister);
+
+ // First, if we get here we have a double encoded as a JSValue
+ m_jit.move(jsValueGpr, tempGpr);
+ m_jit.addPtr(GPRInfo::tagTypeNumberRegister, tempGpr);
+ m_jit.movePtrToDouble(tempGpr, fpr);
+ JITCompiler::Jump hasUnboxedDouble = m_jit.jump();
+
+ // Next handle cells (& other JS immediates)
+ nonNumeric.link(&m_jit);
+ silentSpillAllRegisters(fpr, jsValueGpr);
+ m_jit.move(jsValueGpr, GPRInfo::argumentGPR1);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+ appendCallWithExceptionCheck(dfgConvertJSValueToNumber);
+ m_jit.moveDouble(FPRInfo::returnValueFPR, fpr);
+ silentFillAllRegisters(fpr);
+ JITCompiler::Jump hasCalledToNumber = m_jit.jump();
+
+ // Finally, handle integers.
+ isInteger.link(&m_jit);
+ m_jit.convertInt32ToDouble(jsValueGpr, fpr);
+ hasUnboxedDouble.link(&m_jit);
+ hasCalledToNumber.link(&m_jit);
+
+ m_gprs.unlock(tempGpr);
+}
+
+void NonSpeculativeJIT::valueToInt32(JSValueOperand& operand, GPRReg result)
+{
+ GPRReg jsValueGpr = operand.gpr();
+
+ JITCompiler::Jump isInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, jsValueGpr, GPRInfo::tagTypeNumberRegister);
+
+ // First handle non-integers
+ silentSpillAllRegisters(result, jsValueGpr);
+ m_jit.move(jsValueGpr, GPRInfo::argumentGPR1);
+ m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+ appendCallWithExceptionCheck(dfgConvertJSValueToInt32);
+ m_jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, result);
+ silentFillAllRegisters(result);
+ JITCompiler::Jump hasCalledToInt32 = m_jit.jump();
+
+ // Then handle integers.
+ isInteger.link(&m_jit);
+ m_jit.zeroExtend32ToPtr(jsValueGpr, result);
+ hasCalledToInt32.link(&m_jit);
+}
+
+void NonSpeculativeJIT::numberToInt32(FPRReg fpr, GPRReg gpr)
+{
+ JITCompiler::Jump truncatedToInteger = m_jit.branchTruncateDoubleToInt32(fpr, gpr, JITCompiler::BranchIfTruncateSuccessful);
+
+ silentSpillAllRegisters(gpr);
+
+ m_jit.moveDouble(fpr, FPRInfo::argumentFPR0);
+ appendCallWithExceptionCheck(toInt32);
+ m_jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, gpr);
+
+ silentFillAllRegisters(gpr);
+
+ truncatedToInteger.link(&m_jit);
+}
+
+bool NonSpeculativeJIT::isKnownInteger(NodeIndex nodeIndex)
+{
+ GenerationInfo& info = m_generationInfo[m_jit.graph()[nodeIndex].virtualRegister()];
+
+ DataFormat registerFormat = info.registerFormat();
+ if (registerFormat != DataFormatNone)
+ return (registerFormat | DataFormatJS) == DataFormatJSInteger;
+
+ DataFormat spillFormat = info.spillFormat();
+ if (spillFormat != DataFormatNone)
+ return (spillFormat | DataFormatJS) == DataFormatJSInteger;
+
+ ASSERT(isConstant(nodeIndex));
+ return isInt32Constant(nodeIndex);
+}
+
+bool NonSpeculativeJIT::isKnownNumeric(NodeIndex nodeIndex)
+{
+ GenerationInfo& info = m_generationInfo[m_jit.graph()[nodeIndex].virtualRegister()];
+
+ DataFormat registerFormat = info.registerFormat();
+ if (registerFormat != DataFormatNone)
+ return (registerFormat | DataFormatJS) == DataFormatJSInteger
+ || (registerFormat | DataFormatJS) == DataFormatJSDouble;
+
+ DataFormat spillFormat = info.spillFormat();
+ if (spillFormat != DataFormatNone)
+ return (spillFormat | DataFormatJS) == DataFormatJSInteger
+ || (spillFormat | DataFormatJS) == DataFormatJSDouble;
+
+ ASSERT(isConstant(nodeIndex));
+ return isInt32Constant(nodeIndex) || isDoubleConstant(nodeIndex);
+}
+
+void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, Node& node)
+{
+ // Check for speculation checks from the corresponding instruction in the
+ // speculative path. Do not check for NodeIndex 0, since this is checked
+ // in the outermost compile layer, at the head of the non-speculative path
+ // (for index 0 we may need to check regardless of whether or not the node
+ // will be generated, since argument type speculation checks will appear
+ // as speculation checks at this index).
+ if (m_compileIndex && checkIterator.hasCheckAtIndex(m_compileIndex))
+ trackEntry(m_jit.label());
+
+ NodeType op = node.op;
+
+ switch (op) {
+ case ConvertThis: {
+ JSValueOperand thisValue(this, node.child1);
+ GPRReg thisGPR = thisValue.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationConvertThis, result.gpr(), thisGPR);
+ cellResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case Int32Constant:
+ case DoubleConstant:
+ case JSConstant:
+ initConstantInfo(m_compileIndex);
+ break;
+
+ case GetLocal: {
+ GPRTemporary result(this);
+ m_jit.loadPtr(JITCompiler::addressFor(node.local()), result.gpr());
+
+ // Like jsValueResult, but don't useChildren - our children are phi nodes,
+ // and don't represent values within this dataflow with virtual registers.
+ VirtualRegister virtualRegister = node.virtualRegister();
+ m_gprs.retain(result.gpr(), virtualRegister, SpillOrderJS);
+ m_generationInfo[virtualRegister].initJSValue(m_compileIndex, node.refCount(), result.gpr(), DataFormatJS);
+ break;
+ }
+
+ case SetLocal: {
+ JSValueOperand value(this, node.child1);
+ m_jit.storePtr(value.gpr(), JITCompiler::addressFor(node.local()));
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case BitAnd:
+ case BitOr:
+ case BitXor:
+ if (isInt32Constant(node.child1)) {
+ IntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op2);
+
+ bitOp(op, valueOfInt32Constant(node.child1), op2.gpr(), result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ } else if (isInt32Constant(node.child2)) {
+ IntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+
+ bitOp(op, valueOfInt32Constant(node.child2), op1.gpr(), result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ } else {
+ IntegerOperand op1(this, node.child1);
+ IntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ GPRReg reg1 = op1.gpr();
+ GPRReg reg2 = op2.gpr();
+ bitOp(op, reg1, reg2, result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ }
+ break;
+
+ case BitRShift:
+ case BitLShift:
+ case BitURShift:
+ if (isInt32Constant(node.child2)) {
+ IntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+
+ int shiftAmount = valueOfInt32Constant(node.child2) & 0x1f;
+ // Shifts by zero should have been optimized out of the graph!
+ ASSERT(shiftAmount);
+ shiftOp(op, op1.gpr(), shiftAmount, result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ } else {
+ // Do not allow shift amount to be used as the result, MacroAssembler does not permit this.
+ IntegerOperand op1(this, node.child1);
+ IntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1);
+
+ GPRReg reg1 = op1.gpr();
+ GPRReg reg2 = op2.gpr();
+ shiftOp(op, reg1, reg2, result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ }
+ break;
+
+ case UInt32ToNumber: {
+ IntegerOperand op1(this, node.child1);
+ FPRTemporary result(this);
+ m_jit.convertInt32ToDouble(op1.gpr(), result.fpr());
+
+ MacroAssembler::Jump positive = m_jit.branch32(MacroAssembler::GreaterThanOrEqual, op1.gpr(), TrustedImm32(0));
+ m_jit.addDouble(JITCompiler::AbsoluteAddress(&twoToThe32), result.fpr());
+ positive.link(&m_jit);
+
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case Int32ToNumber: {
+ IntegerOperand op1(this, node.child1);
+ FPRTemporary result(this);
+ m_jit.convertInt32ToDouble(op1.gpr(), result.fpr());
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case NumberToInt32:
+ case ValueToInt32: {
+ ASSERT(!isInt32Constant(node.child1));
+
+ if (isKnownInteger(node.child1)) {
+ IntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+ m_jit.move(op1.gpr(), result.gpr());
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ if (isKnownNumeric(node.child1)) {
+ DoubleOperand op1(this, node.child1);
+ GPRTemporary result(this);
+ numberToInt32(op1.fpr(), result.gpr());
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ // We should have handled this via isKnownInteger, or isKnownNumeric!
+ ASSERT(op != NumberToInt32);
+
+ JSValueOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+ valueToInt32(op1, result.gpr());
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case ValueToNumber: {
+ ASSERT(!isInt32Constant(node.child1));
+ ASSERT(!isDoubleConstant(node.child1));
+
+ if (isKnownInteger(node.child1)) {
+ IntegerOperand op1(this, node.child1);
+ FPRTemporary result(this);
+ m_jit.convertInt32ToDouble(op1.gpr(), result.fpr());
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ if (isKnownNumeric(node.child1)) {
+ DoubleOperand op1(this, node.child1);
+ FPRTemporary result(this, op1);
+ m_jit.moveDouble(op1.fpr(), result.fpr());
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ JSValueOperand op1(this, node.child1);
+ FPRTemporary result(this);
+ valueToNumber(op1, result.fpr());
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case ValueAdd: {
+ JSValueOperand arg1(this, node.child1);
+ JSValueOperand arg2(this, node.child2);
+ GPRReg arg1GPR = arg1.gpr();
+ GPRReg arg2GPR = arg2.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationValueAdd, result.gpr(), arg1GPR, arg2GPR);
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithAdd: {
+ DoubleOperand op1(this, node.child1);
+ DoubleOperand op2(this, node.child2);
+ FPRTemporary result(this, op1, op2);
+
+ FPRReg reg1 = op1.fpr();
+ FPRReg reg2 = op2.fpr();
+ m_jit.addDouble(reg1, reg2, result.fpr());
+
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithSub: {
+ DoubleOperand op1(this, node.child1);
+ DoubleOperand op2(this, node.child2);
+ FPRTemporary result(this, op1);
+
+ FPRReg reg1 = op1.fpr();
+ FPRReg reg2 = op2.fpr();
+ m_jit.subDouble(reg1, reg2, result.fpr());
+
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithMul: {
+ DoubleOperand op1(this, node.child1);
+ DoubleOperand op2(this, node.child2);
+ FPRTemporary result(this, op1, op2);
+
+ FPRReg reg1 = op1.fpr();
+ FPRReg reg2 = op2.fpr();
+ m_jit.mulDouble(reg1, reg2, result.fpr());
+
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithDiv: {
+ DoubleOperand op1(this, node.child1);
+ DoubleOperand op2(this, node.child2);
+ FPRTemporary result(this, op1);
+
+ FPRReg reg1 = op1.fpr();
+ FPRReg reg2 = op2.fpr();
+ m_jit.divDouble(reg1, reg2, result.fpr());
+
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithMod: {
+ DoubleOperand arg1(this, node.child1);
+ DoubleOperand arg2(this, node.child2);
+ FPRReg arg1FPR = arg1.fpr();
+ FPRReg arg2FPR = arg2.fpr();
+ flushRegisters();
+
+ FPRResult result(this);
+ callOperation(fmod, result.fpr(), arg1FPR, arg2FPR);
+
+ doubleResult(result.fpr(), m_compileIndex);
+ break;
+ }
+
+ case LogicalNot: {
+ JSValueOperand arg1(this, node.child1);
+ GPRReg arg1GPR = arg1.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(dfgConvertJSValueToBoolean, result.gpr(), arg1GPR);
+
+ // If we add a DataFormatBool, we should use it here.
+ m_jit.xor32(TrustedImm32(ValueTrue), result.gpr());
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareLess: {
+ JSValueOperand arg1(this, node.child1);
+ JSValueOperand arg2(this, node.child2);
+ GPRReg arg1GPR = arg1.gpr();
+ GPRReg arg2GPR = arg2.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationCompareLess, result.gpr(), arg1GPR, arg2GPR);
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareLessEq: {
+ JSValueOperand arg1(this, node.child1);
+ JSValueOperand arg2(this, node.child2);
+ GPRReg arg1GPR = arg1.gpr();
+ GPRReg arg2GPR = arg2.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationCompareLessEq, result.gpr(), arg1GPR, arg2GPR);
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareEq: {
+ JSValueOperand arg1(this, node.child1);
+ JSValueOperand arg2(this, node.child2);
+ GPRReg arg1GPR = arg1.gpr();
+ GPRReg arg2GPR = arg2.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationCompareEq, result.gpr(), arg1GPR, arg2GPR);
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareStrictEq: {
+ JSValueOperand arg1(this, node.child1);
+ JSValueOperand arg2(this, node.child2);
+ GPRReg arg1GPR = arg1.gpr();
+ GPRReg arg2GPR = arg2.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationCompareStrictEq, result.gpr(), arg1GPR, arg2GPR);
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case GetByVal: {
+ JSValueOperand arg1(this, node.child1);
+ JSValueOperand arg2(this, node.child2);
+ GPRReg arg1GPR = arg1.gpr();
+ GPRReg arg2GPR = arg2.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationGetByVal, result.gpr(), arg1GPR, arg2GPR);
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case PutByVal:
+ case PutByValAlias: {
+ JSValueOperand arg1(this, node.child1);
+ JSValueOperand arg2(this, node.child2);
+ JSValueOperand arg3(this, node.child3);
+ GPRReg arg1GPR = arg1.gpr();
+ GPRReg arg2GPR = arg2.gpr();
+ GPRReg arg3GPR = arg3.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByValStrict : operationPutByValNonStrict, arg1GPR, arg2GPR, arg3GPR);
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case GetById: {
+ JSValueOperand base(this, node.child1);
+ GPRReg baseGPR = base.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationGetById, result.gpr(), baseGPR, identifier(node.identifierNumber()));
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case PutById: {
+ JSValueOperand base(this, node.child1);
+ JSValueOperand value(this, node.child2);
+ GPRReg valueGPR = value.gpr();
+ GPRReg baseGPR = base.gpr();
+ flushRegisters();
+
+ callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByIdStrict : operationPutByIdNonStrict, valueGPR, baseGPR, identifier(node.identifierNumber()));
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case PutByIdDirect: {
+ JSValueOperand base(this, node.child1);
+ JSValueOperand value(this, node.child2);
+ GPRReg valueGPR = value.gpr();
+ GPRReg baseGPR = base.gpr();
+ flushRegisters();
+
+ callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByIdDirectStrict : operationPutByIdDirectNonStrict, valueGPR, baseGPR, identifier(node.identifierNumber()));
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case GetGlobalVar: {
+ GPRTemporary result(this);
+
+ JSVariableObject* globalObject = m_jit.codeBlock()->globalObject();
+ m_jit.loadPtr(globalObject->addressOfRegisters(), result.gpr());
+ m_jit.loadPtr(JITCompiler::addressForGlobalVar(result.gpr(), node.varNumber()), result.gpr());
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case PutGlobalVar: {
+ JSValueOperand value(this, node.child1);
+ GPRTemporary temp(this);
+
+ JSVariableObject* globalObject = m_jit.codeBlock()->globalObject();
+ m_jit.loadPtr(globalObject->addressOfRegisters(), temp.gpr());
+ m_jit.storePtr(value.gpr(), JITCompiler::addressForGlobalVar(temp.gpr(), node.varNumber()));
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case DFG::Jump: {
+ BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset());
+ if (taken != (m_block + 1))
+ addBranch(m_jit.jump(), taken);
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case Branch: {
+ JSValueOperand value(this, node.child1);
+ GPRReg valueGPR = value.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(dfgConvertJSValueToBoolean, result.gpr(), valueGPR);
+
+ BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset());
+ BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset());
+
+ addBranch(m_jit.branchTest8(MacroAssembler::NonZero, result.gpr()), taken);
+ if (notTaken != (m_block + 1))
+ addBranch(m_jit.jump(), notTaken);
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case Return: {
+ ASSERT(GPRInfo::callFrameRegister != GPRInfo::regT1);
+ ASSERT(GPRInfo::regT1 != GPRInfo::returnValueGPR);
+ ASSERT(GPRInfo::returnValueGPR != GPRInfo::callFrameRegister);
+
+#if DFG_SUCCESS_STATS
+ static SamplingCounter counter("NonSpeculativeJIT");
+ m_jit.emitCount(counter);
+#endif
+
+ // Return the result in returnValueGPR.
+ JSValueOperand op1(this, node.child1);
+ m_jit.move(op1.gpr(), GPRInfo::returnValueGPR);
+
+ // Grab the return address.
+ m_jit.emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, GPRInfo::regT1);
+ // Restore our caller's "r".
+ m_jit.emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, GPRInfo::callFrameRegister);
+ // Return.
+ m_jit.restoreReturnAddressBeforeReturn(GPRInfo::regT1);
+ m_jit.ret();
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case Phi:
+ ASSERT_NOT_REACHED();
+ }
+
+ if (node.hasResult() && node.mustGenerate())
+ use(m_compileIndex);
+}
+
+void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator, BasicBlock& block)
+{
+ ASSERT(m_compileIndex == block.begin);
+ m_blockHeads[m_block] = m_jit.label();
+
+#if DFG_JIT_BREAK_ON_EVERY_BLOCK
+ m_jit.breakpoint();
+#endif
+
+ for (; m_compileIndex < block.end; ++m_compileIndex) {
+ Node& node = m_jit.graph()[m_compileIndex];
+ if (!node.shouldGenerate())
+ continue;
+
+#if DFG_DEBUG_VERBOSE
+ fprintf(stderr, "NonSpeculativeJIT generating Node @%d at code offset 0x%x\n", (int)m_compileIndex, m_jit.debugOffset());
+#endif
+#if DFG_JIT_BREAK_ON_EVERY_NODE
+ m_jit.breakpoint();
+#endif
+
+ checkConsistency();
+ compile(checkIterator, node);
+ checkConsistency();
+ }
+}
+
+void NonSpeculativeJIT::compile(SpeculationCheckIndexIterator& checkIterator)
+{
+ // Check for speculation checks added at function entry (checking argument types).
+ if (checkIterator.hasCheckAtIndex(m_compileIndex))
+ trackEntry(m_jit.label());
+
+ ASSERT(!m_compileIndex);
+ for (m_block = 0; m_block < m_jit.graph().m_blocks.size(); ++m_block)
+ compile(checkIterator, *m_jit.graph().m_blocks[m_block]);
+ linkBranches();
+}
+
+} } // namespace JSC::DFG
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h
new file mode 100644
index 0000000..e213671
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.h
@@ -0,0 +1,250 @@
+/*
+ * 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 DFGNonSpeculativeJIT_h
+#define DFGNonSpeculativeJIT_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGJITCodeGenerator.h>
+
+namespace JSC { namespace DFG {
+
+class SpeculationCheckIndexIterator;
+
+// === EntryLocation ===
+//
+// This structure describes an entry point into the non-speculative
+// code path. This is used in linking bail-outs from the speculative path.
+struct EntryLocation {
+ EntryLocation(MacroAssembler::Label, NonSpeculativeJIT*);
+
+ // The node this entry point corresponds to, and the label
+ // marking the start of code for the given node.
+ MacroAssembler::Label m_entry;
+ NodeIndex m_nodeIndex;
+
+ // For every entry point we record a map recording for every
+ // machine register which, if any, values it contains. For
+ // GPR registers we must also record the format of the value.
+ struct RegisterInfo {
+ NodeIndex nodeIndex;
+ DataFormat format;
+ };
+ RegisterInfo m_gprInfo[GPRInfo::numberOfRegisters];
+ NodeIndex m_fprInfo[FPRInfo::numberOfRegisters];
+};
+
+// === NonSpeculativeJIT ===
+//
+// This class is used to generate code for the non-speculative path.
+// Code generation will take advantage of static information available
+// in the dataflow to perform safe optimizations - for example, avoiding
+// boxing numeric values between arithmetic operations, but will not
+// perform any unsafe optimizations that would render the code unable
+// to produce the correct results for any possible input.
+class NonSpeculativeJIT : public JITCodeGenerator {
+ friend struct EntryLocation;
+public:
+ NonSpeculativeJIT(JITCompiler& jit)
+ : JITCodeGenerator(jit, false)
+ {
+ }
+
+ void compile(SpeculationCheckIndexIterator&);
+
+ typedef SegmentedVector<EntryLocation, 16> EntryLocationVector;
+ EntryLocationVector& entryLocations() { return m_entryLocations; }
+
+private:
+ void compile(SpeculationCheckIndexIterator&, Node&);
+ void compile(SpeculationCheckIndexIterator&, BasicBlock&);
+
+ bool isKnownInteger(NodeIndex);
+ bool isKnownNumeric(NodeIndex);
+
+ // These methods are used when generating 'unexpected'
+ // calls out from JIT code to C++ helper routines -
+ // they spill all live values to the appropriate
+ // slots in the RegisterFile without changing any state
+ // in the GenerationInfo.
+ void silentSpillGPR(VirtualRegister spillMe, GPRReg exclude = InvalidGPRReg)
+ {
+ GenerationInfo& info = m_generationInfo[spillMe];
+ ASSERT(info.registerFormat() != DataFormatNone && info.registerFormat() != DataFormatDouble);
+
+ if (!info.needsSpill() || (info.gpr() == exclude))
+ return;
+
+ DataFormat registerFormat = info.registerFormat();
+
+ if (registerFormat == DataFormatInteger) {
+ m_jit.orPtr(GPRInfo::tagTypeNumberRegister, info.gpr());
+ m_jit.storePtr(info.gpr(), JITCompiler::addressFor(spillMe));
+ } else {
+ ASSERT(registerFormat & DataFormatJS || registerFormat == DataFormatCell);
+ m_jit.storePtr(info.gpr(), JITCompiler::addressFor(spillMe));
+ }
+ }
+ void silentSpillFPR(VirtualRegister spillMe, GPRReg canTrample, FPRReg exclude = InvalidFPRReg)
+ {
+ GenerationInfo& info = m_generationInfo[spillMe];
+ ASSERT(info.registerFormat() == DataFormatDouble);
+
+ if (!info.needsSpill() || (info.fpr() == exclude))
+ return;
+
+ boxDouble(info.fpr(), canTrample);
+ m_jit.storePtr(canTrample, JITCompiler::addressFor(spillMe));
+ }
+
+ void silentFillGPR(VirtualRegister spillMe, GPRReg exclude = InvalidGPRReg)
+ {
+ GenerationInfo& info = m_generationInfo[spillMe];
+ if (info.gpr() == exclude)
+ return;
+
+ NodeIndex nodeIndex = info.nodeIndex();
+ Node& node = m_jit.graph()[nodeIndex];
+ ASSERT(info.registerFormat() != DataFormatNone && info.registerFormat() != DataFormatDouble);
+ DataFormat registerFormat = info.registerFormat();
+
+ if (registerFormat == DataFormatInteger) {
+ if (node.isConstant()) {
+ ASSERT(isInt32Constant(nodeIndex));
+ m_jit.move(Imm32(valueOfInt32Constant(nodeIndex)), info.gpr());
+ } else
+ m_jit.load32(JITCompiler::addressFor(spillMe), info.gpr());
+ return;
+ }
+
+ if (node.isConstant())
+ m_jit.move(constantAsJSValueAsImmPtr(nodeIndex), info.gpr());
+ else {
+ ASSERT(registerFormat & DataFormatJS || registerFormat == DataFormatCell);
+ m_jit.loadPtr(JITCompiler::addressFor(spillMe), info.gpr());
+ }
+ }
+ void silentFillFPR(VirtualRegister spillMe, GPRReg canTrample, FPRReg exclude = InvalidFPRReg)
+ {
+ GenerationInfo& info = m_generationInfo[spillMe];
+ if (info.fpr() == exclude)
+ return;
+
+ NodeIndex nodeIndex = info.nodeIndex();
+ Node& node = m_jit.graph()[nodeIndex];
+ ASSERT(info.registerFormat() == DataFormatDouble);
+
+ if (node.isConstant())
+ m_jit.move(constantAsJSValueAsImmPtr(nodeIndex), info.gpr());
+ else {
+ m_jit.loadPtr(JITCompiler::addressFor(spillMe), canTrample);
+ unboxDouble(canTrample, info.fpr());
+ }
+ }
+
+ void silentSpillAllRegisters(GPRReg exclude, GPRReg preserve = InvalidGPRReg)
+ {
+ GPRReg canTrample = GPRInfo::regT0;
+ if (preserve == GPRInfo::regT0)
+ canTrample = GPRInfo::regT1;
+
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ silentSpillGPR(iter.name(), exclude);
+ }
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ silentSpillFPR(iter.name(), canTrample);
+ }
+ }
+ void silentSpillAllRegisters(FPRReg exclude, GPRReg preserve = InvalidGPRReg)
+ {
+ GPRReg canTrample = GPRInfo::regT0;
+ if (preserve == GPRInfo::regT0)
+ canTrample = GPRInfo::regT1;
+
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ silentSpillGPR(iter.name());
+ }
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ silentSpillFPR(iter.name(), canTrample, exclude);
+ }
+ }
+ void silentFillAllRegisters(GPRReg exclude)
+ {
+ GPRReg canTrample = GPRInfo::regT0;
+ if (exclude == GPRInfo::regT0)
+ canTrample = GPRInfo::regT1;
+
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ silentFillFPR(iter.name(), canTrample);
+ }
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ silentFillGPR(iter.name(), exclude);
+ }
+ }
+ void silentFillAllRegisters(FPRReg exclude)
+ {
+ GPRReg canTrample = GPRInfo::regT0;
+
+ for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister) {
+ ASSERT_UNUSED(exclude, iter.regID() != exclude);
+ silentFillFPR(iter.name(), canTrample, exclude);
+ }
+ }
+ for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister)
+ silentFillGPR(iter.name());
+ }
+ }
+
+ // These methods are used to plant calls out to C++
+ // helper routines to convert between types.
+ void valueToNumber(JSValueOperand&, FPRReg result);
+ void valueToInt32(JSValueOperand&, GPRReg result);
+ void numberToInt32(FPRReg, GPRReg result);
+
+ // Record an entry location into the non-speculative code path;
+ // for every bail-out on the speculative path we record information
+ // to be able to re-enter into the non-speculative one.
+ void trackEntry(MacroAssembler::Label entry)
+ {
+ m_entryLocations.append(EntryLocation(entry, this));
+ }
+
+ EntryLocationVector m_entryLocations;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.cpp
new file mode 100644
index 0000000..a310d22
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.cpp
@@ -0,0 +1,245 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "DFGOperations.h"
+
+#if ENABLE(DFG_JIT)
+
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "JSByteArray.h"
+#include "JSGlobalData.h"
+#include "Operations.h"
+
+namespace JSC { namespace DFG {
+
+EncodedJSValue operationConvertThis(ExecState* exec, EncodedJSValue encodedOp)
+{
+ return JSValue::encode(JSValue::decode(encodedOp).toThisObject(exec));
+}
+
+EncodedJSValue operationValueAdd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
+{
+ JSValue op1 = JSValue::decode(encodedOp1);
+ JSValue op2 = JSValue::decode(encodedOp2);
+
+ if (op1.isInt32() && op2.isInt32()) {
+ int64_t result64 = static_cast<int64_t>(op1.asInt32()) + static_cast<int64_t>(op2.asInt32());
+ int32_t result32 = static_cast<int32_t>(result64);
+ if (LIKELY(result32 == result64))
+ return JSValue::encode(jsNumber(result32));
+ return JSValue::encode(jsNumber((double)result64));
+ }
+
+ double number1;
+ double number2;
+ if (op1.getNumber(number1) && op2.getNumber(number2))
+ return JSValue::encode(jsNumber(number1 + number2));
+
+ return JSValue::encode(jsAddSlowCase(exec, op1, op2));
+}
+
+EncodedJSValue operationGetByVal(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedProperty)
+{
+ JSValue baseValue = JSValue::decode(encodedBase);
+ JSValue property = JSValue::decode(encodedProperty);
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* base = baseValue.asCell();
+
+ if (property.isUInt32()) {
+ JSGlobalData* globalData = &exec->globalData();
+ uint32_t i = property.asUInt32();
+
+ // FIXME: the JIT used to handle these in compiled code!
+ if (isJSArray(globalData, base) && asArray(base)->canGetIndex(i))
+ return JSValue::encode(asArray(base)->getIndex(i));
+
+ // FIXME: the JITstub used to relink this to an optimized form!
+ if (isJSString(globalData, base) && asString(base)->canGetIndex(i))
+ return JSValue::encode(asString(base)->getIndex(exec, i));
+
+ // FIXME: the JITstub used to relink this to an optimized form!
+ if (isJSByteArray(globalData, base) && asByteArray(base)->canAccessIndex(i))
+ return JSValue::encode(asByteArray(base)->getIndex(exec, i));
+
+ return JSValue::encode(baseValue.get(exec, i));
+ }
+
+ if (property.isString()) {
+ Identifier propertyName(exec, asString(property)->value(exec));
+ PropertySlot slot(base);
+ if (base->fastGetOwnPropertySlot(exec, propertyName, slot))
+ return JSValue::encode(slot.getValue(exec, propertyName));
+ }
+ }
+
+ Identifier ident(exec, property.toString(exec));
+ return JSValue::encode(baseValue.get(exec, ident));
+}
+
+EncodedJSValue operationGetById(ExecState* exec, EncodedJSValue encodedBase, Identifier* identifier)
+{
+ JSValue baseValue = JSValue::decode(encodedBase);
+ PropertySlot slot(baseValue);
+ return JSValue::encode(baseValue.get(exec, *identifier, slot));
+}
+
+template<bool strict>
+ALWAYS_INLINE static void operationPutByValInternal(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue)
+{
+ JSGlobalData* globalData = &exec->globalData();
+
+ JSValue baseValue = JSValue::decode(encodedBase);
+ JSValue property = JSValue::decode(encodedProperty);
+ JSValue value = JSValue::decode(encodedValue);
+
+ if (LIKELY(property.isUInt32())) {
+ uint32_t i = property.asUInt32();
+
+ if (isJSArray(globalData, baseValue)) {
+ JSArray* jsArray = asArray(baseValue);
+ if (jsArray->canSetIndex(i)) {
+ jsArray->setIndex(*globalData, i, value);
+ return;
+ }
+
+ jsArray->JSArray::put(exec, i, value);
+ return;
+ }
+
+ if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
+ JSByteArray* jsByteArray = asByteArray(baseValue);
+ // FIXME: the JITstub used to relink this to an optimized form!
+ if (value.isInt32()) {
+ jsByteArray->setIndex(i, value.asInt32());
+ return;
+ }
+
+ double dValue = 0;
+ if (value.getNumber(dValue)) {
+ jsByteArray->setIndex(i, dValue);
+ return;
+ }
+ }
+
+ baseValue.put(exec, i, value);
+ return;
+ }
+
+ // Don't put to an object if toString throws an exception.
+ Identifier ident(exec, property.toString(exec));
+ if (!globalData->exception) {
+ PutPropertySlot slot(strict);
+ baseValue.put(exec, ident, value, slot);
+ }
+}
+
+void operationPutByValStrict(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue)
+{
+ operationPutByValInternal<true>(exec, encodedBase, encodedProperty, encodedValue);
+}
+
+void operationPutByValNonStrict(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue)
+{
+ operationPutByValInternal<false>(exec, encodedBase, encodedProperty, encodedValue);
+}
+
+void operationPutByIdStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier* identifier)
+{
+ PutPropertySlot slot(true);
+ JSValue::decode(encodedBase).put(exec, *identifier, JSValue::decode(encodedValue), slot);
+}
+
+void operationPutByIdNonStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier* identifier)
+{
+ PutPropertySlot slot(false);
+ JSValue::decode(encodedBase).put(exec, *identifier, JSValue::decode(encodedValue), slot);
+}
+
+void operationPutByIdDirectStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier* identifier)
+{
+ PutPropertySlot slot(true);
+ JSValue::decode(encodedBase).putDirect(exec, *identifier, JSValue::decode(encodedValue), slot);
+}
+
+void operationPutByIdDirectNonStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier* identifier)
+{
+ PutPropertySlot slot(false);
+ JSValue::decode(encodedBase).putDirect(exec, *identifier, JSValue::decode(encodedValue), slot);
+}
+
+bool operationCompareLess(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
+{
+ return jsLess(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
+}
+
+bool operationCompareLessEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
+{
+ return jsLessEq(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
+}
+
+bool operationCompareEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
+{
+ return JSValue::equal(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
+}
+
+bool operationCompareStrictEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
+{
+ return JSValue::strictEqual(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
+}
+
+DFGHandler lookupExceptionHandler(ExecState* exec, ReturnAddressPtr faultLocation)
+{
+ JSValue exceptionValue = exec->exception();
+ ASSERT(exceptionValue);
+
+ unsigned vPCIndex = exec->codeBlock()->bytecodeOffset(faultLocation);
+ HandlerInfo* handler = exec->globalData().interpreter->throwException(exec, exceptionValue, vPCIndex);
+
+ void* catchRoutine = handler ? handler->nativeCode.executableAddress() : (void*)ctiOpThrowNotCaught;
+ ASSERT(catchRoutine);
+ return DFGHandler(exec, catchRoutine);
+}
+
+double dfgConvertJSValueToNumber(ExecState* exec, EncodedJSValue value)
+{
+ return JSValue::decode(value).toNumber(exec);
+}
+
+int32_t dfgConvertJSValueToInt32(ExecState* exec, EncodedJSValue value)
+{
+ return JSValue::decode(value).toInt32(exec);
+}
+
+bool dfgConvertJSValueToBoolean(ExecState* exec, EncodedJSValue encodedOp)
+{
+ return JSValue::decode(encodedOp).toBoolean(exec);
+}
+
+} } // namespace JSC::DFG
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.h
new file mode 100644
index 0000000..d4c7c0f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGOperations.h
@@ -0,0 +1,90 @@
+/*
+ * 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 DFGOperations_h
+#define DFGOperations_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGJITCompiler.h>
+
+namespace JSC {
+
+class Identifier;
+
+namespace DFG {
+
+// These typedefs provide typechecking when generating calls out to helper routines;
+// this helps prevent calling a helper routine with the wrong arguments!
+typedef EncodedJSValue (*J_DFGOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue);
+typedef EncodedJSValue (*J_DFGOperation_EJ)(ExecState*, EncodedJSValue);
+typedef EncodedJSValue (*J_DFGOperation_EJP)(ExecState*, EncodedJSValue, void*);
+typedef EncodedJSValue (*J_DFGOperation_EJI)(ExecState*, EncodedJSValue, Identifier*);
+typedef bool (*Z_DFGOperation_EJ)(ExecState*, EncodedJSValue);
+typedef bool (*Z_DFGOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue);
+typedef void (*V_DFGOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue);
+typedef void (*V_DFGOperation_EJJP)(ExecState*, EncodedJSValue, EncodedJSValue, void*);
+typedef void (*V_DFGOperation_EJJI)(ExecState*, EncodedJSValue, EncodedJSValue, Identifier*);
+typedef double (*D_DFGOperation_DD)(double, double);
+
+// These routines are provide callbacks out to C++ implementations of operations too complex to JIT.
+EncodedJSValue operationConvertThis(ExecState*, EncodedJSValue encodedOp1);
+EncodedJSValue operationValueAdd(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
+EncodedJSValue operationGetByVal(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty);
+EncodedJSValue operationGetById(ExecState*, EncodedJSValue encodedBase, Identifier*);
+void operationPutByValStrict(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue);
+void operationPutByValNonStrict(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue);
+void operationPutByIdStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*);
+void operationPutByIdNonStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*);
+void operationPutByIdDirectStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*);
+void operationPutByIdDirectNonStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*);
+bool operationCompareLess(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
+bool operationCompareLessEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
+bool operationCompareEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
+bool operationCompareStrictEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
+
+// This method is used to lookup an exception hander, keyed by faultLocation, which is
+// the return location from one of the calls out to one of the helper operations above.
+struct DFGHandler {
+ DFGHandler(ExecState* exec, void* handler)
+ : exec(exec)
+ , handler(handler)
+ {
+ }
+
+ ExecState* exec;
+ void* handler;
+};
+DFGHandler lookupExceptionHandler(ExecState*, ReturnAddressPtr faultLocation);
+
+// These operations implement the implicitly called ToInt32, ToNumber, and ToBoolean conversions from ES5.
+double dfgConvertJSValueToNumber(ExecState*, EncodedJSValue);
+int32_t dfgConvertJSValueToInt32(ExecState*, EncodedJSValue);
+bool dfgConvertJSValueToBoolean(ExecState*, EncodedJSValue);
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGRegisterBank.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGRegisterBank.h
new file mode 100644
index 0000000..f4fdd50
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGRegisterBank.h
@@ -0,0 +1,350 @@
+/*
+ * 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 DFGRegisterBank_h
+#define DFGRegisterBank_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGNode.h>
+
+namespace JSC { namespace DFG {
+
+// === RegisterBank ===
+//
+// This class is used to implement the GPR and FPR register banks.
+// All registers have two pieces of state associated with them:
+// a lock count (used to indicate this register is already in use
+// in code generation of the current node, and cannot be spilled or
+// allocated as a temporary), and VirtualRegister 'name', recording
+// which value (if any) a machine register currently holds.
+// Either or both of these pieces of information may be valid for a
+// given register. A register may be:
+//
+// - unlocked, and unnamed: Available for allocation.
+// - locked, but unnamed: Already allocated as a temporary or
+// result for the current node.
+// - unlocked, but named: Contains the result of a prior operation,
+// not yet in use for this node,
+// - locked, but named: Contains the result of a prior operation,
+// already allocated as a operand to the
+// current operation.
+//
+// For every named register we also record a hint value indicating
+// the order in which registers should be selected to be spilled;
+// registers that can be more cheaply spilled and/or filled should
+// be selected first.
+//
+// Locking register is a strong retention mechanism; a locked register
+// will never be reallocated (this is used to ensure the operands to
+// the current node are in registers). Naming, conversely, in a weak
+// retention mechanism - allocating a register may force a named value
+// to be spilled.
+//
+// All named values must be given a hint that is greater than Min and
+// less than Max.
+template<class BankInfo>
+class RegisterBank {
+ typedef typename BankInfo::RegisterType RegID;
+ static const size_t NUM_REGS = BankInfo::numberOfRegisters;
+
+ typedef uint32_t SpillHint;
+ static const SpillHint SpillHintInvalid = 0xffffffff;
+
+public:
+ RegisterBank()
+ : m_lastAllocated(NUM_REGS - 1)
+ {
+ }
+
+ // Allocate a register - this function finds an unlocked register,
+ // locks it, and returns it. If any named registers exist, one
+ // of these should be selected to be allocated. If all unlocked
+ // registers are named, then one of the named registers will need
+ // to be spilled. In this case the register selected to be spilled
+ // will be one of the registers that has the lowest 'spillOrder'
+ // cost associated with it.
+ //
+ // This method select the register to be allocated, and calls the
+ // private 'allocateInternal' method to update internal data
+ // structures accordingly.
+ RegID allocate(VirtualRegister &spillMe)
+ {
+ uint32_t currentLowest = NUM_REGS;
+ SpillHint currentSpillOrder = SpillHintInvalid;
+
+ // Scan through all register, starting at the last allocated & looping around.
+ ASSERT(m_lastAllocated < NUM_REGS);
+
+ // This loop is broken into two halves, looping from the last allocated
+ // register (the register returned last time this method was called) to
+ // the maximum register value, then from 0 to the last allocated.
+ // This implements a simple round-robin like approach to try to reduce
+ // thrash, and minimize time spent scanning locked registers in allocation.
+ // If a unlocked and unnamed register is found return it immediately.
+ // Otherwise, find the first unlocked register with the lowest spillOrder.
+ for (uint32_t i = m_lastAllocated + 1; i < NUM_REGS; ++i) {
+ // (1) If the current register is locked, it is not a candidate.
+ if (m_data[i].lockCount)
+ continue;
+ // (2) If the current register's spill order is 0, pick this! – unassigned registers have spill order 0.
+ SpillHint spillOrder = m_data[i].spillOrder;
+ if (spillOrder == SpillHintInvalid)
+ return allocateInternal(i, spillMe);
+ // If this register is better (has a lower spill order value) than any prior
+ // candidate, then record it.
+ if (spillOrder < currentSpillOrder) {
+ currentSpillOrder = spillOrder;
+ currentLowest = i;
+ }
+ }
+ // Loop over the remaining entries.
+ for (uint32_t i = 0; i <= m_lastAllocated; ++i) {
+ if (m_data[i].lockCount)
+ continue;
+ SpillHint spillOrder = m_data[i].spillOrder;
+ if (spillOrder == SpillHintInvalid)
+ return allocateInternal(i, spillMe);
+ if (spillOrder < currentSpillOrder) {
+ currentSpillOrder = spillOrder;
+ currentLowest = i;
+ }
+ }
+
+ // Deadlock check - this could only occur is all registers are locked!
+ ASSERT(currentLowest != NUM_REGS && currentSpillOrder != SpillHintInvalid);
+ // There were no available registers; currentLowest will need to be spilled.
+ return allocateInternal(currentLowest, spillMe);
+ }
+
+ // retain/release - these methods are used to associate/disassociate names
+ // with values in registers. retain should only be called on locked registers.
+ void retain(RegID reg, VirtualRegister name, SpillHint spillOrder)
+ {
+ unsigned index = BankInfo::toIndex(reg);
+
+ // SpillHint must be valid.
+ ASSERT(spillOrder != SpillHintInvalid);
+ // 'index' must be a valid, locked register.
+ ASSERT(index < NUM_REGS);
+ ASSERT(m_data[index].lockCount);
+ // 'index' should not currently be named, the new name must be valid.
+ ASSERT(m_data[index].name == InvalidVirtualRegister);
+ ASSERT(name != InvalidVirtualRegister);
+ // 'index' should not currently have a spillOrder.
+ ASSERT(m_data[index].spillOrder == SpillHintInvalid);
+
+ m_data[index].name = name;
+ m_data[index].spillOrder = spillOrder;
+ }
+ void release(RegID reg)
+ {
+ releaseAtIndex(BankInfo::toIndex(reg));
+ }
+
+ // lock/unlock register, ensures that they are not spilled.
+ void lock(RegID reg)
+ {
+ unsigned index = BankInfo::toIndex(reg);
+
+ ASSERT(index < NUM_REGS);
+ ++m_data[index].lockCount;
+ ASSERT(m_data[index].lockCount);
+ }
+ void unlock(RegID reg)
+ {
+ unsigned index = BankInfo::toIndex(reg);
+
+ ASSERT(index < NUM_REGS);
+ ASSERT(m_data[index].lockCount);
+ --m_data[index].lockCount;
+ }
+ bool isLocked(RegID reg) const
+ {
+ return isLockedAtIndex(BankInfo::toIndex(reg));
+ }
+
+ // Get the name (VirtualRegister) associated with the
+ // given register (or InvalidVirtualRegister for none).
+ VirtualRegister name(RegID reg) const
+ {
+ return nameAtIndex(BankInfo::toIndex(reg));
+ }
+
+#ifndef NDEBUG
+ void dump()
+ {
+ // For each register, print the VirtualRegister 'name'.
+ for (uint32_t i =0; i < NUM_REGS; ++i) {
+ if (m_data[i].name != InvalidVirtualRegister)
+ fprintf(stderr, "[%02d]", m_data[i].name);
+ else
+ fprintf(stderr, "[--]");
+ }
+ fprintf(stderr, "\n");
+ }
+#endif
+
+ class iterator {
+ friend class RegisterBank<BankInfo>;
+ public:
+ VirtualRegister name() const
+ {
+ return m_bank->nameAtIndex(m_index);
+ }
+
+ bool isLocked() const
+ {
+ return m_bank->isLockedAtIndex(m_index);
+ }
+
+ void release() const
+ {
+ m_bank->releaseAtIndex(m_index);
+ }
+
+ RegID regID() const
+ {
+ return BankInfo::toRegister(m_index);
+ }
+
+#ifndef NDEBUG
+ const char* debugName() const
+ {
+ return BankInfo::debugName(regID());
+ }
+#endif
+
+ iterator& operator++()
+ {
+ ++m_index;
+ return *this;
+ }
+
+ bool operator!=(const iterator& other) const
+ {
+ ASSERT(m_bank == other.m_bank);
+ return m_index != other.m_index;
+ }
+
+ unsigned index() const
+ {
+ return m_index;
+ }
+
+ private:
+ iterator(RegisterBank<BankInfo>* bank, unsigned index)
+ : m_bank(bank)
+ , m_index(index)
+ {
+ }
+
+ RegisterBank<BankInfo>* m_bank;
+ unsigned m_index;
+ };
+
+ iterator begin()
+ {
+ return iterator(this, 0);
+ }
+
+ iterator end()
+ {
+ return iterator(this, NUM_REGS);
+ }
+
+private:
+ bool isLockedAtIndex(unsigned index) const
+ {
+ ASSERT(index < NUM_REGS);
+ return m_data[index].lockCount;
+ }
+
+ VirtualRegister nameAtIndex(unsigned index) const
+ {
+ ASSERT(index < NUM_REGS);
+ return m_data[index].name;
+ }
+
+ void releaseAtIndex(unsigned index)
+ {
+ // 'index' must be a valid register.
+ ASSERT(index < NUM_REGS);
+ // 'index' should currently be named.
+ ASSERT(m_data[index].name != InvalidVirtualRegister);
+ // 'index' should currently have a valid spill order.
+ ASSERT(m_data[index].spillOrder != SpillHintInvalid);
+
+ m_data[index].name = InvalidVirtualRegister;
+ m_data[index].spillOrder = SpillHintInvalid;
+ }
+
+ // Used by 'allocate', above, to update inforamtion in the map.
+ RegID allocateInternal(uint32_t i, VirtualRegister &spillMe)
+ {
+ // 'i' must be a valid, unlocked register.
+ ASSERT(i < NUM_REGS && !m_data[i].lockCount);
+
+ // Return the VirtualRegister of the named value currently stored in
+ // the register being returned - or InvalidVirtualRegister if none.
+ spillMe = m_data[i].name;
+
+ // Clear any name/spillOrder currently associated with the register,
+ m_data[i] = MapEntry();
+ // Mark the register as locked (with a lock count of 1).
+ m_data[i].lockCount = 1;
+
+ m_lastAllocated = i;
+ return BankInfo::toRegister(i);
+ }
+
+ // === MapEntry ===
+ //
+ // This structure provides information for an individual machine register
+ // being managed by the RegisterBank. For each register we track a lock
+ // count, name and spillOrder hint.
+ struct MapEntry {
+ MapEntry()
+ : name(InvalidVirtualRegister)
+ , spillOrder(SpillHintInvalid)
+ , lockCount(0)
+ {
+ }
+
+ VirtualRegister name;
+ SpillHint spillOrder;
+ uint32_t lockCount;
+ };
+
+ // Holds the current status of all registers.
+ MapEntry m_data[NUM_REGS];
+ // Used to to implement a simple round-robin like allocation scheme.
+ uint32_t m_lastAllocated;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGScoreBoard.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGScoreBoard.h
new file mode 100644
index 0000000..1e44292
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGScoreBoard.h
@@ -0,0 +1,149 @@
+/*
+ * 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 DFGScoreBoard_h
+#define DFGScoreBoard_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGGraph.h>
+#include <wtf/Vector.h>
+
+namespace JSC { namespace DFG {
+
+// === ScoreBoard ===
+//
+// This class is used in performing a virtual register allocation over the graph.
+// VirtualRegisters are allocated to nodes, with a used count for each virtual
+// register tracking the lifespan of the value; after the final use of a node
+// the VirtualRegister associated is freed such that it can be reused for
+// another node.
+class ScoreBoard {
+public:
+ ScoreBoard(Graph& graph, uint32_t firstTemporary)
+ : m_graph(graph)
+ , m_firstTemporary(firstTemporary)
+ {
+ }
+
+#if DFG_CONSISTENCY_CHECK
+ ~ScoreBoard()
+ {
+ // Every VirtualRegister that was allocated should now be free.
+ ASSERT(m_used.size() == m_free.size());
+ // Every entry in the used list should be available in the free list.
+ for (size_t i = 0; i < m_used.size(); ++i)
+ ASSERT(m_free.contains(i));
+ // For every entry in the used list the use count of the virtual register should be zero.
+ for (size_t i = 0; i < m_free.size(); ++i)
+ ASSERT(!m_used[i]);
+ }
+#endif
+
+ VirtualRegister allocate()
+ {
+ // Do we have any VirtualRegsiters in the free list, that were used by
+ // prior nodes, but are now available?
+ if (!m_free.isEmpty()) {
+ uint32_t index = m_free.last();
+ m_free.removeLast();
+ // Use count must have hit zero for it to have been added to the free list!
+ ASSERT(!m_used[index]);
+ return (VirtualRegister)(m_firstTemporary + index);
+ }
+
+ // Allocate a new VirtualRegister, and add a corresponding entry to m_used.
+ size_t next = allocatedCount();
+ m_used.append(0);
+ return (VirtualRegister)(m_firstTemporary + next);
+ }
+
+ // Increment the usecount for the VirtualRegsiter associated with 'child',
+ // if it reaches the node's refcount, free the VirtualRegsiter.
+ void use(NodeIndex child)
+ {
+ if (child == NoNode)
+ return;
+
+ // Find the virtual register number for this child, increment its use count.
+ Node& node = m_graph[child];
+ uint32_t index = node.virtualRegister() - m_firstTemporary;
+ if (node.refCount() == ++m_used[index]) {
+ // If the use count in the scoreboard reaches the use count for the node,
+ // then this was its last use; the virtual register is now free.
+ // Clear the use count & add to the free list.
+ m_used[index] = 0;
+ m_free.append(index);
+ }
+ }
+
+ unsigned allocatedCount()
+ {
+ // m_used contains an entry for every allocated VirtualRegister.
+ return m_used.size();
+ }
+
+#ifndef NDEBUG
+ void dump()
+ {
+ printf(" USED: [ ");
+ for (unsigned i = 0; i < m_used.size(); ++i) {
+ if (!m_free.contains(i))
+ printf("%d:%d ", m_firstTemporary + i, m_used[i]);
+ }
+ printf("]\n");
+
+ printf(" FREE: [ ");
+ for (unsigned i = 0; i < m_used.size(); ++i) {
+ if (m_free.contains(i)) {
+ ASSERT(!m_used[i]);
+ printf("%d ", m_firstTemporary + i);
+ }
+ }
+ printf("]\n");
+ }
+
+#endif
+
+private:
+ // The graph, so we can get refCounts for nodes, to determine when values are dead.
+ Graph& m_graph;
+ // The first VirtualRegsiter to be used as a temporary.
+ uint32_t m_firstTemporary;
+
+ // For every virtual register that has been allocated (either currently alive, or in
+ // the free list), we keep a count of the number of remaining uses until it is dead
+ // (0, in the case of entries in the free list). Since there is an entry for every
+ // allocated VirtualRegister, the length of this array conveniently provides the
+ // next available VirtualRegister number.
+ Vector<uint32_t, 64> m_used;
+ // A free list of VirtualRegsiters no longer alive.
+ Vector<uint32_t, 64> m_free;
+};
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
new file mode 100644
index 0000000..71004fe
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
@@ -0,0 +1,956 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "DFGSpeculativeJIT.h"
+
+#if ENABLE(DFG_JIT)
+
+namespace JSC { namespace DFG {
+
+template<bool strict>
+GPRReg SpeculativeJIT::fillSpeculateIntInternal(NodeIndex nodeIndex, DataFormat& returnFormat)
+{
+ Node& node = m_jit.graph()[nodeIndex];
+ VirtualRegister virtualRegister = node.virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+
+ switch (info.registerFormat()) {
+ case DataFormatNone: {
+ GPRReg gpr = allocate();
+
+ if (node.isConstant()) {
+ m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
+ if (isInt32Constant(nodeIndex)) {
+ m_jit.move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gpr);
+ info.fillInteger(gpr);
+ returnFormat = DataFormatInteger;
+ return gpr;
+ }
+ m_jit.move(constantAsJSValueAsImmPtr(nodeIndex), gpr);
+ } else {
+ DataFormat spillFormat = info.spillFormat();
+ ASSERT(spillFormat & DataFormatJS);
+
+ m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled);
+
+ if (spillFormat == DataFormatJSInteger) {
+ // If we know this was spilled as an integer we can fill without checking.
+ if (strict) {
+ m_jit.load32(JITCompiler::addressFor(virtualRegister), gpr);
+ info.fillInteger(gpr);
+ returnFormat = DataFormatInteger;
+ return gpr;
+ }
+ m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), gpr);
+ info.fillJSValue(gpr, DataFormatJSInteger);
+ returnFormat = DataFormatJSInteger;
+ return gpr;
+ }
+ m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), gpr);
+ }
+
+ // Fill as JSValue, and fall through.
+ info.fillJSValue(gpr, DataFormatJSInteger);
+ m_gprs.unlock(gpr);
+ }
+
+ case DataFormatJS: {
+ // Check the value is an integer.
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ speculationCheck(m_jit.branchPtr(MacroAssembler::Below, gpr, GPRInfo::tagTypeNumberRegister));
+ info.fillJSValue(gpr, DataFormatJSInteger);
+ // If !strict we're done, return.
+ if (!strict) {
+ returnFormat = DataFormatJSInteger;
+ return gpr;
+ }
+ // else fall through & handle as DataFormatJSInteger.
+ m_gprs.unlock(gpr);
+ }
+
+ case DataFormatJSInteger: {
+ // In a strict fill we need to strip off the value tag.
+ if (strict) {
+ GPRReg gpr = info.gpr();
+ GPRReg result;
+ // If the register has already been locked we need to take a copy.
+ // If not, we'll zero extend in place, so mark on the info that this is now type DataFormatInteger, not DataFormatJSInteger.
+ if (m_gprs.isLocked(gpr))
+ result = allocate();
+ else {
+ m_gprs.lock(gpr);
+ info.fillInteger(gpr);
+ result = gpr;
+ }
+ m_jit.zeroExtend32ToPtr(gpr, result);
+ returnFormat = DataFormatInteger;
+ return result;
+ }
+
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ returnFormat = DataFormatJSInteger;
+ return gpr;
+ }
+
+ case DataFormatInteger: {
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ returnFormat = DataFormatInteger;
+ return gpr;
+ }
+
+ case DataFormatDouble:
+ case DataFormatCell:
+ case DataFormatJSDouble:
+ case DataFormatJSCell: {
+ terminateSpeculativeExecution();
+ returnFormat = DataFormatInteger;
+ return allocate();
+ }
+ }
+
+ ASSERT_NOT_REACHED();
+ return InvalidGPRReg;
+}
+
+SpeculationCheck::SpeculationCheck(MacroAssembler::Jump check, SpeculativeJIT* jit, unsigned recoveryIndex)
+ : m_check(check)
+ , m_nodeIndex(jit->m_compileIndex)
+ , m_recoveryIndex(recoveryIndex)
+{
+ for (gpr_iterator iter = jit->m_gprs.begin(); iter != jit->m_gprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister) {
+ GenerationInfo& info = jit->m_generationInfo[iter.name()];
+ m_gprInfo[iter.index()].nodeIndex = info.nodeIndex();
+ m_gprInfo[iter.index()].format = info.registerFormat();
+ } else
+ m_gprInfo[iter.index()].nodeIndex = NoNode;
+ }
+ for (fpr_iterator iter = jit->m_fprs.begin(); iter != jit->m_fprs.end(); ++iter) {
+ if (iter.name() != InvalidVirtualRegister) {
+ GenerationInfo& info = jit->m_generationInfo[iter.name()];
+ ASSERT(info.registerFormat() == DataFormatDouble);
+ m_fprInfo[iter.index()] = info.nodeIndex();
+ } else
+ m_fprInfo[iter.index()] = NoNode;
+ }
+}
+
+GPRReg SpeculativeJIT::fillSpeculateInt(NodeIndex nodeIndex, DataFormat& returnFormat)
+{
+ return fillSpeculateIntInternal<false>(nodeIndex, returnFormat);
+}
+
+GPRReg SpeculativeJIT::fillSpeculateIntStrict(NodeIndex nodeIndex)
+{
+ DataFormat mustBeDataFormatInteger;
+ GPRReg result = fillSpeculateIntInternal<true>(nodeIndex, mustBeDataFormatInteger);
+ ASSERT(mustBeDataFormatInteger == DataFormatInteger);
+ return result;
+}
+
+GPRReg SpeculativeJIT::fillSpeculateCell(NodeIndex nodeIndex)
+{
+ Node& node = m_jit.graph()[nodeIndex];
+ VirtualRegister virtualRegister = node.virtualRegister();
+ GenerationInfo& info = m_generationInfo[virtualRegister];
+
+ switch (info.registerFormat()) {
+ case DataFormatNone: {
+ GPRReg gpr = allocate();
+
+ if (node.isConstant()) {
+ m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
+ JSValue jsValue = constantAsJSValue(nodeIndex);
+ if (jsValue.isCell()) {
+ m_jit.move(MacroAssembler::TrustedImmPtr(jsValue.asCell()), gpr);
+ info.fillJSValue(gpr, DataFormatJSCell);
+ return gpr;
+ }
+ terminateSpeculativeExecution();
+ return gpr;
+ }
+ ASSERT(info.spillFormat() & DataFormatJS);
+ m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled);
+ m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), gpr);
+
+ if (info.spillFormat() != DataFormatJSCell)
+ speculationCheck(m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagMaskRegister));
+ info.fillJSValue(gpr, DataFormatJSCell);
+ return gpr;
+ }
+
+ case DataFormatCell:
+ case DataFormatJSCell: {
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ return gpr;
+ }
+
+ case DataFormatJS: {
+ GPRReg gpr = info.gpr();
+ m_gprs.lock(gpr);
+ speculationCheck(m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagMaskRegister));
+ info.fillJSValue(gpr, DataFormatJSCell);
+ return gpr;
+ }
+
+ case DataFormatJSInteger:
+ case DataFormatInteger:
+ case DataFormatJSDouble:
+ case DataFormatDouble: {
+ terminateSpeculativeExecution();
+ return allocate();
+ }
+ }
+
+ ASSERT_NOT_REACHED();
+ return InvalidGPRReg;
+}
+
+void SpeculativeJIT::compilePeepHoleBranch(Node& node, JITCompiler::RelationalCondition condition)
+{
+ Node& branchNode = m_jit.graph()[m_compileIndex + 1];
+ BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(branchNode.takenBytecodeOffset());
+ BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(branchNode.notTakenBytecodeOffset());
+
+ // The branch instruction will branch to the taken block.
+ // If taken is next, switch taken with notTaken & invert the branch condition so we can fall through.
+ if (taken == (m_block + 1)) {
+ condition = JITCompiler::invert(condition);
+ BlockIndex tmp = taken;
+ taken = notTaken;
+ notTaken = tmp;
+ }
+
+ int32_t imm;
+ if (isJSConstantWithInt32Value(node.child1, imm)) {
+ SpeculateIntegerOperand op2(this, node.child2);
+ addBranch(m_jit.branch32(condition, JITCompiler::Imm32(imm), op2.gpr()), taken);
+ } else if (isJSConstantWithInt32Value(node.child2, imm)) {
+ SpeculateIntegerOperand op1(this, node.child1);
+ addBranch(m_jit.branch32(condition, op1.gpr(), JITCompiler::Imm32(imm)), taken);
+ } else {
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ addBranch(m_jit.branch32(condition, op1.gpr(), op2.gpr()), taken);
+ }
+
+ // Check for fall through, otherwise we need to jump.
+ if (notTaken != (m_block + 1))
+ addBranch(m_jit.jump(), notTaken);
+}
+
+void SpeculativeJIT::compile(Node& node)
+{
+ NodeType op = node.op;
+
+ switch (op) {
+ case Int32Constant:
+ case DoubleConstant:
+ case JSConstant:
+ initConstantInfo(m_compileIndex);
+ break;
+
+ case GetLocal: {
+ GPRTemporary result(this);
+ PredictedType prediction = m_jit.graph().getPrediction(node.local());
+ if (prediction == PredictInt32) {
+ m_jit.load32(JITCompiler::payloadFor(node.local()), result.gpr());
+
+ // Like integerResult, but don't useChildren - our children are phi nodes,
+ // and don't represent values within this dataflow with virtual registers.
+ VirtualRegister virtualRegister = node.virtualRegister();
+ m_gprs.retain(result.gpr(), virtualRegister, SpillOrderInteger);
+ m_generationInfo[virtualRegister].initInteger(m_compileIndex, node.refCount(), result.gpr());
+ } else {
+ m_jit.loadPtr(JITCompiler::addressFor(node.local()), result.gpr());
+
+ // Like jsValueResult, but don't useChildren - our children are phi nodes,
+ // and don't represent values within this dataflow with virtual registers.
+ VirtualRegister virtualRegister = node.virtualRegister();
+ m_gprs.retain(result.gpr(), virtualRegister, SpillOrderJS);
+ m_generationInfo[virtualRegister].initJSValue(m_compileIndex, node.refCount(), result.gpr(), (prediction == PredictArray) ? DataFormatJSCell : DataFormatJS);
+ }
+ break;
+ }
+
+ case SetLocal: {
+ switch (m_jit.graph().getPrediction(node.local())) {
+ case PredictInt32: {
+ SpeculateIntegerOperand value(this, node.child1);
+ m_jit.store32(value.gpr(), JITCompiler::payloadFor(node.local()));
+ noResult(m_compileIndex);
+ break;
+ }
+ case PredictArray: {
+ SpeculateCellOperand cell(this, node.child1);
+ m_jit.storePtr(cell.gpr(), JITCompiler::addressFor(node.local()));
+ noResult(m_compileIndex);
+ break;
+ }
+
+ default: {
+ JSValueOperand value(this, node.child1);
+ m_jit.storePtr(value.gpr(), JITCompiler::addressFor(node.local()));
+ noResult(m_compileIndex);
+ break;
+ }
+ }
+ break;
+ }
+
+ case BitAnd:
+ case BitOr:
+ case BitXor:
+ if (isInt32Constant(node.child1)) {
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op2);
+
+ bitOp(op, valueOfInt32Constant(node.child1), op2.gpr(), result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ } else if (isInt32Constant(node.child2)) {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+
+ bitOp(op, valueOfInt32Constant(node.child2), op1.gpr(), result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ } else {
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ GPRReg reg1 = op1.gpr();
+ GPRReg reg2 = op2.gpr();
+ bitOp(op, reg1, reg2, result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ }
+ break;
+
+ case BitRShift:
+ case BitLShift:
+ case BitURShift:
+ if (isInt32Constant(node.child2)) {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+
+ shiftOp(op, op1.gpr(), valueOfInt32Constant(node.child2) & 0x1f, result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ } else {
+ // Do not allow shift amount to be used as the result, MacroAssembler does not permit this.
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1);
+
+ GPRReg reg1 = op1.gpr();
+ GPRReg reg2 = op2.gpr();
+ shiftOp(op, reg1, reg2, result.gpr());
+
+ integerResult(result.gpr(), m_compileIndex);
+ }
+ break;
+
+ case UInt32ToNumber: {
+ IntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+
+ // Test the operand is positive.
+ speculationCheck(m_jit.branch32(MacroAssembler::LessThan, op1.gpr(), TrustedImm32(0)));
+
+ m_jit.move(op1.gpr(), result.gpr());
+ integerResult(result.gpr(), m_compileIndex, op1.format());
+ break;
+ }
+
+ case NumberToInt32: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+ m_jit.move(op1.gpr(), result.gpr());
+ integerResult(result.gpr(), m_compileIndex, op1.format());
+ break;
+ }
+
+ case Int32ToNumber: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+ m_jit.move(op1.gpr(), result.gpr());
+ integerResult(result.gpr(), m_compileIndex, op1.format());
+ break;
+ }
+
+ case ValueToInt32: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+ m_jit.move(op1.gpr(), result.gpr());
+ integerResult(result.gpr(), m_compileIndex, op1.format());
+ break;
+ }
+
+ case ValueToNumber: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this, op1);
+ m_jit.move(op1.gpr(), result.gpr());
+ integerResult(result.gpr(), m_compileIndex, op1.format());
+ break;
+ }
+
+ case ValueAdd:
+ case ArithAdd: {
+ int32_t imm1;
+ if (isDoubleConstantWithInt32Value(node.child1, imm1)) {
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this);
+
+ speculationCheck(m_jit.branchAdd32(MacroAssembler::Overflow, op2.gpr(), Imm32(imm1), result.gpr()));
+
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ int32_t imm2;
+ if (isDoubleConstantWithInt32Value(node.child2, imm2)) {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this);
+
+ speculationCheck(m_jit.branchAdd32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
+
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ GPRReg gpr1 = op1.gpr();
+ GPRReg gpr2 = op2.gpr();
+ GPRReg gprResult = result.gpr();
+ MacroAssembler::Jump check = m_jit.branchAdd32(MacroAssembler::Overflow, gpr1, gpr2, gprResult);
+
+ if (gpr1 == gprResult)
+ speculationCheck(check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr2));
+ else if (gpr2 == gprResult)
+ speculationCheck(check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr1));
+ else
+ speculationCheck(check);
+
+ integerResult(gprResult, m_compileIndex);
+ break;
+ }
+
+ case ArithSub: {
+ int32_t imm2;
+ if (isDoubleConstantWithInt32Value(node.child2, imm2)) {
+ SpeculateIntegerOperand op1(this, node.child1);
+ GPRTemporary result(this);
+
+ speculationCheck(m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
+
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this);
+
+ speculationCheck(m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), op2.gpr(), result.gpr()));
+
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithMul: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this);
+
+ GPRReg reg1 = op1.gpr();
+ GPRReg reg2 = op2.gpr();
+ speculationCheck(m_jit.branchMul32(MacroAssembler::Overflow, reg1, reg2, result.gpr()));
+
+ MacroAssembler::Jump resultNonZero = m_jit.branchTest32(MacroAssembler::NonZero, result.gpr());
+ speculationCheck(m_jit.branch32(MacroAssembler::LessThan, reg1, TrustedImm32(0)));
+ speculationCheck(m_jit.branch32(MacroAssembler::LessThan, reg2, TrustedImm32(0)));
+ resultNonZero.link(&m_jit);
+
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithDiv: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ op1.gpr();
+ op2.gpr();
+ terminateSpeculativeExecution();
+
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case ArithMod: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ op1.gpr();
+ op2.gpr();
+ terminateSpeculativeExecution();
+
+ integerResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case LogicalNot: {
+ JSValueOperand value(this, node.child1);
+ GPRTemporary result(this); // FIXME: We could reuse, but on speculation fail would need recovery to restore tag (akin to add).
+
+ m_jit.move(value.gpr(), result.gpr());
+ m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), result.gpr());
+ speculationCheck(m_jit.branchTestPtr(JITCompiler::NonZero, result.gpr(), TrustedImm32(static_cast<int32_t>(~1))));
+ m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueTrue)), result.gpr());
+
+ // If we add a DataFormatBool, we should use it here.
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareLess: {
+ // Fused compare & branch.
+ if (detectPeepHoleBranch()) {
+ // detectPeepHoleBranch currently only permits the branch to be the very next node,
+ // so can be no intervening nodes to also reference the compare.
+ ASSERT(node.adjustedRefCount() == 1);
+
+ compilePeepHoleBranch(node, JITCompiler::LessThan);
+
+ use(node.child1);
+ use(node.child2);
+ ++m_compileIndex;
+ return;
+ }
+
+ // Normal case, not fused to branch.
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ m_jit.compare32(JITCompiler::LessThan, op1.gpr(), op2.gpr(), result.gpr());
+
+ // If we add a DataFormatBool, we should use it here.
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareLessEq: {
+ // Fused compare & branch.
+ if (detectPeepHoleBranch()) {
+ // detectPeepHoleBranch currently only permits the branch to be the very next node,
+ // so can be no intervening nodes to also reference the compare.
+ ASSERT(node.adjustedRefCount() == 1);
+
+ compilePeepHoleBranch(node, JITCompiler::LessThanOrEqual);
+
+ use(node.child1);
+ use(node.child2);
+ ++m_compileIndex;
+ return;
+ }
+
+ // Normal case, not fused to branch.
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ m_jit.compare32(JITCompiler::LessThanOrEqual, op1.gpr(), op2.gpr(), result.gpr());
+
+ // If we add a DataFormatBool, we should use it here.
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareEq: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ m_jit.compare32(JITCompiler::Equal, op1.gpr(), op2.gpr(), result.gpr());
+
+ // If we add a DataFormatBool, we should use it here.
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case CompareStrictEq: {
+ SpeculateIntegerOperand op1(this, node.child1);
+ SpeculateIntegerOperand op2(this, node.child2);
+ GPRTemporary result(this, op1, op2);
+
+ m_jit.compare32(JITCompiler::Equal, op1.gpr(), op2.gpr(), result.gpr());
+
+ // If we add a DataFormatBool, we should use it here.
+ m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case GetByVal: {
+ NodeIndex alias = node.child3;
+ if (alias != NoNode) {
+ // FIXME: result should be able to reuse child1, child2. Should have an 'UnusedOperand' type.
+ JSValueOperand aliasedValue(this, node.child3);
+ GPRTemporary result(this, aliasedValue);
+ m_jit.move(aliasedValue.gpr(), result.gpr());
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ SpeculateCellOperand base(this, node.child1);
+ SpeculateStrictInt32Operand property(this, node.child2);
+ GPRTemporary storage(this);
+
+ GPRReg baseReg = base.gpr();
+ GPRReg propertyReg = property.gpr();
+ GPRReg storageReg = storage.gpr();
+
+ // Get the array storage. We haven't yet checked this is a JSArray, so this is only safe if
+ // an access with offset JSArray::storageOffset() is valid for all JSCells!
+ m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg);
+
+ // Check that base is an array, and that property is contained within m_vector (< m_vectorLength).
+ // If we have predicted the base to be type array, we can skip the check.
+ Node& baseNode = m_jit.graph()[node.child1];
+ if (baseNode.op != GetLocal || m_jit.graph().getPrediction(baseNode.local()) != PredictArray)
+ speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
+ speculationCheck(m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())));
+
+ // FIXME: In cases where there are subsequent by_val accesses to the same base it might help to cache
+ // the storage pointer - especially if there happens to be another register free right now. If we do so,
+ // then we'll need to allocate a new temporary for result.
+ GPRTemporary& result = storage;
+ m_jit.loadPtr(MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), result.gpr());
+ speculationCheck(m_jit.branchTestPtr(MacroAssembler::Zero, result.gpr()));
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case PutByVal: {
+ SpeculateCellOperand base(this, node.child1);
+ SpeculateStrictInt32Operand property(this, node.child2);
+ JSValueOperand value(this, node.child3);
+ GPRTemporary storage(this);
+
+ // Map base, property & value into registers, allocate a register for storage.
+ GPRReg baseReg = base.gpr();
+ GPRReg propertyReg = property.gpr();
+ GPRReg valueReg = value.gpr();
+ GPRReg storageReg = storage.gpr();
+
+ // Check that base is an array, and that property is contained within m_vector (< m_vectorLength).
+ // If we have predicted the base to be type array, we can skip the check.
+ Node& baseNode = m_jit.graph()[node.child1];
+ if (baseNode.op != GetLocal || m_jit.graph().getPrediction(baseNode.local()) != PredictArray)
+ speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
+ speculationCheck(m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())));
+
+ // Get the array storage.
+ m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg);
+
+ // Check if we're writing to a hole; if so increment m_numValuesInVector.
+ MacroAssembler::Jump notHoleValue = m_jit.branchTestPtr(MacroAssembler::NonZero, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
+ m_jit.add32(TrustedImm32(1), MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)));
+
+ // If we're writing to a hole we might be growing the array;
+ MacroAssembler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, propertyReg, MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_length)));
+ m_jit.add32(TrustedImm32(1), propertyReg);
+ m_jit.store32(propertyReg, MacroAssembler::Address(storageReg, OBJECT_OFFSETOF(ArrayStorage, m_length)));
+ m_jit.sub32(TrustedImm32(1), propertyReg);
+
+ lengthDoesNotNeedUpdate.link(&m_jit);
+ notHoleValue.link(&m_jit);
+
+ // Store the value to the array.
+ m_jit.storePtr(valueReg, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case PutByValAlias: {
+ SpeculateCellOperand base(this, node.child1);
+ SpeculateStrictInt32Operand property(this, node.child2);
+ JSValueOperand value(this, node.child3);
+ GPRTemporary storage(this, base); // storage may overwrite base.
+
+ // Get the array storage.
+ GPRReg storageReg = storage.gpr();
+ m_jit.loadPtr(MacroAssembler::Address(base.gpr(), JSArray::storageOffset()), storageReg);
+
+ // Map property & value into registers.
+ GPRReg propertyReg = property.gpr();
+ GPRReg valueReg = value.gpr();
+
+ // Store the value to the array.
+ m_jit.storePtr(valueReg, MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case DFG::Jump: {
+ BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset());
+ if (taken != (m_block + 1))
+ addBranch(m_jit.jump(), taken);
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case Branch: {
+ JSValueOperand value(this, node.child1);
+ GPRReg valueReg = value.gpr();
+
+ BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset());
+ BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset());
+
+ // Integers
+ addBranch(m_jit.branchPtr(MacroAssembler::Equal, valueReg, MacroAssembler::ImmPtr(JSValue::encode(jsNumber(0)))), notTaken);
+ MacroAssembler::Jump isNonZeroInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, valueReg, GPRInfo::tagTypeNumberRegister);
+
+ // Booleans
+ addBranch(m_jit.branchPtr(MacroAssembler::Equal, valueReg, MacroAssembler::ImmPtr(JSValue::encode(jsBoolean(false)))), notTaken);
+ speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, valueReg, MacroAssembler::ImmPtr(JSValue::encode(jsBoolean(true)))));
+
+ if (taken == (m_block + 1))
+ isNonZeroInteger.link(&m_jit);
+ else {
+ addBranch(isNonZeroInteger, taken);
+ addBranch(m_jit.jump(), taken);
+ }
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case Return: {
+ ASSERT(GPRInfo::callFrameRegister != GPRInfo::regT1);
+ ASSERT(GPRInfo::regT1 != GPRInfo::returnValueGPR);
+ ASSERT(GPRInfo::returnValueGPR != GPRInfo::callFrameRegister);
+
+#if DFG_SUCCESS_STATS
+ static SamplingCounter counter("SpeculativeJIT");
+ m_jit.emitCount(counter);
+#endif
+
+ // Return the result in returnValueGPR.
+ JSValueOperand op1(this, node.child1);
+ m_jit.move(op1.gpr(), GPRInfo::returnValueGPR);
+
+ // Grab the return address.
+ m_jit.emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, GPRInfo::regT1);
+ // Restore our caller's "r".
+ m_jit.emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, GPRInfo::callFrameRegister);
+ // Return.
+ m_jit.restoreReturnAddressBeforeReturn(GPRInfo::regT1);
+ m_jit.ret();
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case ConvertThis: {
+ SpeculateCellOperand thisValue(this, node.child1);
+ GPRTemporary temp(this);
+
+ m_jit.loadPtr(JITCompiler::Address(thisValue.gpr(), JSCell::structureOffset()), temp.gpr());
+ speculationCheck(m_jit.branchTest8(JITCompiler::NonZero, JITCompiler::Address(temp.gpr(), Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(NeedsThisConversion)));
+
+ cellResult(thisValue.gpr(), m_compileIndex);
+ break;
+ }
+
+ case GetById: {
+ JSValueOperand base(this, node.child1);
+ GPRReg baseGPR = base.gpr();
+ flushRegisters();
+
+ GPRResult result(this);
+ callOperation(operationGetById, result.gpr(), baseGPR, identifier(node.identifierNumber()));
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case PutById: {
+ JSValueOperand base(this, node.child1);
+ JSValueOperand value(this, node.child2);
+ GPRReg valueGPR = value.gpr();
+ GPRReg baseGPR = base.gpr();
+ flushRegisters();
+
+ callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByIdStrict : operationPutByIdNonStrict, valueGPR, baseGPR, identifier(node.identifierNumber()));
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case PutByIdDirect: {
+ JSValueOperand base(this, node.child1);
+ JSValueOperand value(this, node.child2);
+ GPRReg valueGPR = value.gpr();
+ GPRReg baseGPR = base.gpr();
+ flushRegisters();
+
+ callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByIdDirectStrict : operationPutByIdDirectNonStrict, valueGPR, baseGPR, identifier(node.identifierNumber()));
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case GetGlobalVar: {
+ GPRTemporary result(this);
+
+ JSVariableObject* globalObject = m_jit.codeBlock()->globalObject();
+ m_jit.loadPtr(globalObject->addressOfRegisters(), result.gpr());
+ m_jit.loadPtr(JITCompiler::addressForGlobalVar(result.gpr(), node.varNumber()), result.gpr());
+
+ jsValueResult(result.gpr(), m_compileIndex);
+ break;
+ }
+
+ case PutGlobalVar: {
+ JSValueOperand value(this, node.child1);
+ GPRTemporary temp(this);
+
+ JSVariableObject* globalObject = m_jit.codeBlock()->globalObject();
+ m_jit.loadPtr(globalObject->addressOfRegisters(), temp.gpr());
+ m_jit.storePtr(value.gpr(), JITCompiler::addressForGlobalVar(temp.gpr(), node.varNumber()));
+
+ noResult(m_compileIndex);
+ break;
+ }
+
+ case Phi:
+ ASSERT_NOT_REACHED();
+ }
+
+ if (node.hasResult() && node.mustGenerate())
+ use(m_compileIndex);
+}
+
+void SpeculativeJIT::compile(BasicBlock& block)
+{
+ ASSERT(m_compileIndex == block.begin);
+ m_blockHeads[m_block] = m_jit.label();
+#if DFG_JIT_BREAK_ON_EVERY_BLOCK
+ m_jit.breakpoint();
+#endif
+
+ for (; m_compileIndex < block.end; ++m_compileIndex) {
+ Node& node = m_jit.graph()[m_compileIndex];
+ if (!node.shouldGenerate())
+ continue;
+
+#if DFG_DEBUG_VERBOSE
+ fprintf(stderr, "SpeculativeJIT generating Node @%d at JIT offset 0x%x\n", (int)m_compileIndex, m_jit.debugOffset());
+#endif
+#if DFG_JIT_BREAK_ON_EVERY_NODE
+ m_jit.breakpoint();
+#endif
+ checkConsistency();
+ compile(node);
+ if (!m_compileOkay)
+ return;
+ checkConsistency();
+ }
+}
+
+// If we are making type predictions about our arguments then
+// we need to check that they are correct on function entry.
+void SpeculativeJIT::checkArgumentTypes()
+{
+ ASSERT(!m_compileIndex);
+ for (int i = 0; i < m_jit.codeBlock()->m_numParameters; ++i) {
+ VirtualRegister virtualRegister = (VirtualRegister)(m_jit.codeBlock()->thisRegister() + i);
+ switch (m_jit.graph().getPrediction(virtualRegister)) {
+ case PredictInt32:
+ speculationCheck(m_jit.branchPtr(MacroAssembler::Below, JITCompiler::addressFor(virtualRegister), GPRInfo::tagTypeNumberRegister));
+ break;
+
+ case PredictArray: {
+ GPRTemporary temp(this);
+ m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
+ speculationCheck(m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
+ speculationCheck(m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+}
+
+// For any vars that we will be treating as numeric, write 0 to
+// the var on entry. Throughout the block we will only read/write
+// to the payload, by writing the tag now we prevent the GC from
+// misinterpreting values as pointers.
+void SpeculativeJIT::initializeVariableTypes()
+{
+ ASSERT(!m_compileIndex);
+ for (int var = 0; var < m_jit.codeBlock()->m_numVars; ++var) {
+ if (m_jit.graph().getPrediction(var) == PredictInt32)
+ m_jit.storePtr(GPRInfo::tagTypeNumberRegister, JITCompiler::addressFor((VirtualRegister)var));
+ }
+}
+
+bool SpeculativeJIT::compile()
+{
+ checkArgumentTypes();
+ initializeVariableTypes();
+
+ ASSERT(!m_compileIndex);
+ for (m_block = 0; m_block < m_jit.graph().m_blocks.size(); ++m_block) {
+ compile(*m_jit.graph().m_blocks[m_block]);
+ if (!m_compileOkay)
+ return false;
+ }
+ linkBranches();
+ return true;
+}
+
+} } // namespace JSC::DFG
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
new file mode 100644
index 0000000..82fd403
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
@@ -0,0 +1,386 @@
+/*
+ * 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 DFGSpeculativeJIT_h
+#define DFGSpeculativeJIT_h
+
+#if ENABLE(DFG_JIT)
+
+#include <dfg/DFGJITCodeGenerator.h>
+
+namespace JSC { namespace DFG {
+
+class SpeculativeJIT;
+
+// This enum describes the types of additional recovery that
+// may need be performed should a speculation check fail.
+enum SpeculationRecoveryType {
+ SpeculativeAdd
+};
+
+// === SpeculationRecovery ===
+//
+// This class provides additional information that may be associated with a
+// speculation check - for example
+class SpeculationRecovery {
+public:
+ SpeculationRecovery(SpeculationRecoveryType type, GPRReg dest, GPRReg src)
+ : m_type(type)
+ , m_dest(dest)
+ , m_src(src)
+ {
+ }
+
+ SpeculationRecoveryType type() { return m_type; }
+ GPRReg dest() { return m_dest; }
+ GPRReg src() { return m_src; }
+
+private:
+ // Indicates the type of additional recovery to be performed.
+ SpeculationRecoveryType m_type;
+ // different recovery types may required different additional information here.
+ GPRReg m_dest;
+ GPRReg m_src;
+};
+
+// === SpeculationCheck ===
+//
+// This structure records a bail-out from the speculative path,
+// which will need to be linked in to the non-speculative one.
+struct SpeculationCheck {
+ SpeculationCheck(MacroAssembler::Jump, SpeculativeJIT*, unsigned recoveryIndex = 0);
+
+ // The location of the jump out from the speculative path,
+ // and the node we were generating code for.
+ MacroAssembler::Jump m_check;
+ NodeIndex m_nodeIndex;
+ // Used to record any additional recovery to be performed; this
+ // value is an index into the SpeculativeJIT's m_speculationRecoveryList
+ // array, offset by 1. (m_recoveryIndex == 0) means no recovery.
+ unsigned m_recoveryIndex;
+
+ struct RegisterInfo {
+ NodeIndex nodeIndex;
+ DataFormat format;
+ };
+ RegisterInfo m_gprInfo[GPRInfo::numberOfRegisters];
+ NodeIndex m_fprInfo[FPRInfo::numberOfRegisters];
+};
+typedef SegmentedVector<SpeculationCheck, 16> SpeculationCheckVector;
+
+
+// === SpeculativeJIT ===
+//
+// The SpeculativeJIT is used to generate a fast, but potentially
+// incomplete code path for the dataflow. When code generating
+// we may make assumptions about operand types, dynamically check,
+// and bail-out to an alternate code path if these checks fail.
+// Importantly, the speculative code path cannot be reentered once
+// a speculative check has failed. This allows the SpeculativeJIT
+// to propagate type information (including information that has
+// only speculatively been asserted) through the dataflow.
+class SpeculativeJIT : public JITCodeGenerator {
+ friend struct SpeculationCheck;
+public:
+ SpeculativeJIT(JITCompiler& jit)
+ : JITCodeGenerator(jit, true)
+ , m_compileOkay(true)
+ {
+ }
+
+ bool compile();
+
+ // Retrieve the list of bail-outs from the speculative path,
+ // and additional recovery information.
+ SpeculationCheckVector& speculationChecks()
+ {
+ return m_speculationChecks;
+ }
+ SpeculationRecovery* speculationRecovery(size_t index)
+ {
+ // SpeculationCheck::m_recoveryIndex is offset by 1,
+ // 0 means no recovery.
+ return index ? &m_speculationRecoveryList[index - 1] : 0;
+ }
+
+ // Called by the speculative operand types, below, to fill operand to
+ // machine registers, implicitly generating speculation checks as needed.
+ GPRReg fillSpeculateInt(NodeIndex, DataFormat& returnFormat);
+ GPRReg fillSpeculateIntStrict(NodeIndex);
+ GPRReg fillSpeculateCell(NodeIndex);
+
+private:
+ void compile(Node&);
+ void compile(BasicBlock&);
+
+ void checkArgumentTypes();
+ void initializeVariableTypes();
+
+ bool isDoubleConstantWithInt32Value(NodeIndex nodeIndex, int32_t& out)
+ {
+ if (!m_jit.isDoubleConstant(nodeIndex))
+ return false;
+ double value = m_jit.valueOfDoubleConstant(nodeIndex);
+
+ int32_t asInt32 = static_cast<int32_t>(value);
+ if (value != asInt32)
+ return false;
+ if (!asInt32 && signbit(value))
+ return false;
+
+ out = asInt32;
+ return true;
+ }
+
+ bool isJSConstantWithInt32Value(NodeIndex nodeIndex, int32_t& out)
+ {
+ if (!m_jit.isJSConstant(nodeIndex))
+ return false;
+ JSValue value = m_jit.valueOfJSConstant(nodeIndex);
+
+ if (!value.isInt32())
+ return false;
+
+ out = value.asInt32();
+ return true;
+ }
+
+ bool detectPeepHoleBranch()
+ {
+ // Check if the block contains precisely one more node.
+ if (m_compileIndex + 2 != m_jit.graph().m_blocks[m_block]->end)
+ return false;
+
+ // Check if the lastNode is a branch on this node.
+ Node& lastNode = m_jit.graph()[m_compileIndex + 1];
+ return lastNode.op == Branch && lastNode.child1 == m_compileIndex;
+ }
+
+ void compilePeepHoleBranch(Node&, JITCompiler::RelationalCondition);
+
+ // Add a speculation check without additional recovery.
+ void speculationCheck(MacroAssembler::Jump jumpToFail)
+ {
+ m_speculationChecks.append(SpeculationCheck(jumpToFail, this));
+ }
+ // Add a speculation check with additional recovery.
+ void speculationCheck(MacroAssembler::Jump jumpToFail, const SpeculationRecovery& recovery)
+ {
+ m_speculationRecoveryList.append(recovery);
+ m_speculationChecks.append(SpeculationCheck(jumpToFail, this, m_speculationRecoveryList.size()));
+ }
+
+ // Called when we statically determine that a speculation will fail.
+ void terminateSpeculativeExecution()
+ {
+ // FIXME: in cases where we can statically determine we're going to bail out from the speculative
+ // JIT we should probably rewind code generation and only produce the non-speculative path.
+ m_compileOkay = false;
+ speculationCheck(m_jit.jump());
+ }
+
+ template<bool strict>
+ GPRReg fillSpeculateIntInternal(NodeIndex, DataFormat& returnFormat);
+
+ // It is possible, during speculative generation, to reach a situation in which we
+ // can statically determine a speculation will fail (for example, when two nodes
+ // will make conflicting speculations about the same operand). In such cases this
+ // flag is cleared, indicating no further code generation should take place.
+ bool m_compileOkay;
+ // This vector tracks bail-outs from the speculative path to the non-speculative one.
+ SpeculationCheckVector m_speculationChecks;
+ // Some bail-outs need to record additional information recording specific recovery
+ // to be performed (for example, on detected overflow from an add, we may need to
+ // reverse the addition if an operand is being overwritten).
+ Vector<SpeculationRecovery, 16> m_speculationRecoveryList;
+};
+
+
+// === Speculative Operand types ===
+//
+// SpeculateIntegerOperand, SpeculateStrictInt32Operand and SpeculateCellOperand.
+//
+// These are used to lock the operands to a node into machine registers within the
+// SpeculativeJIT. The classes operate like those provided by the JITCodeGenerator,
+// however these will perform a speculative check for a more restrictive type than
+// we can statically determine the operand to have. If the operand does not have
+// the requested type, a bail-out to the non-speculative path will be taken.
+
+class SpeculateIntegerOperand {
+public:
+ explicit SpeculateIntegerOperand(SpeculativeJIT* jit, NodeIndex index)
+ : m_jit(jit)
+ , m_index(index)
+ , m_gprOrInvalid(InvalidGPRReg)
+#ifndef NDEBUG
+ , m_format(DataFormatNone)
+#endif
+ {
+ ASSERT(m_jit);
+ if (jit->isFilled(index))
+ gpr();
+ }
+
+ ~SpeculateIntegerOperand()
+ {
+ ASSERT(m_gprOrInvalid != InvalidGPRReg);
+ m_jit->unlock(m_gprOrInvalid);
+ }
+
+ NodeIndex index() const
+ {
+ return m_index;
+ }
+
+ DataFormat format()
+ {
+ gpr(); // m_format is set when m_gpr is locked.
+ ASSERT(m_format == DataFormatInteger || m_format == DataFormatJSInteger);
+ return m_format;
+ }
+
+ GPRReg gpr()
+ {
+ if (m_gprOrInvalid == InvalidGPRReg)
+ m_gprOrInvalid = m_jit->fillSpeculateInt(index(), m_format);
+ return m_gprOrInvalid;
+ }
+
+private:
+ SpeculativeJIT* m_jit;
+ NodeIndex m_index;
+ GPRReg m_gprOrInvalid;
+ DataFormat m_format;
+};
+
+class SpeculateStrictInt32Operand {
+public:
+ explicit SpeculateStrictInt32Operand(SpeculativeJIT* jit, NodeIndex index)
+ : m_jit(jit)
+ , m_index(index)
+ , m_gprOrInvalid(InvalidGPRReg)
+ {
+ ASSERT(m_jit);
+ if (jit->isFilled(index))
+ gpr();
+ }
+
+ ~SpeculateStrictInt32Operand()
+ {
+ ASSERT(m_gprOrInvalid != InvalidGPRReg);
+ m_jit->unlock(m_gprOrInvalid);
+ }
+
+ NodeIndex index() const
+ {
+ return m_index;
+ }
+
+ GPRReg gpr()
+ {
+ if (m_gprOrInvalid == InvalidGPRReg)
+ m_gprOrInvalid = m_jit->fillSpeculateIntStrict(index());
+ return m_gprOrInvalid;
+ }
+
+private:
+ SpeculativeJIT* m_jit;
+ NodeIndex m_index;
+ GPRReg m_gprOrInvalid;
+};
+
+class SpeculateCellOperand {
+public:
+ explicit SpeculateCellOperand(SpeculativeJIT* jit, NodeIndex index)
+ : m_jit(jit)
+ , m_index(index)
+ , m_gprOrInvalid(InvalidGPRReg)
+ {
+ ASSERT(m_jit);
+ if (jit->isFilled(index))
+ gpr();
+ }
+
+ ~SpeculateCellOperand()
+ {
+ ASSERT(m_gprOrInvalid != InvalidGPRReg);
+ m_jit->unlock(m_gprOrInvalid);
+ }
+
+ NodeIndex index() const
+ {
+ return m_index;
+ }
+
+ GPRReg gpr()
+ {
+ if (m_gprOrInvalid == InvalidGPRReg)
+ m_gprOrInvalid = m_jit->fillSpeculateCell(index());
+ return m_gprOrInvalid;
+ }
+
+private:
+ SpeculativeJIT* m_jit;
+ NodeIndex m_index;
+ GPRReg m_gprOrInvalid;
+};
+
+
+// === SpeculationCheckIndexIterator ===
+//
+// This class is used by the non-speculative JIT to check which
+// nodes require entry points from the speculative path.
+class SpeculationCheckIndexIterator {
+public:
+ SpeculationCheckIndexIterator(SpeculationCheckVector& speculationChecks)
+ : m_speculationChecks(speculationChecks)
+ , m_iter(m_speculationChecks.begin())
+ , m_end(m_speculationChecks.end())
+ {
+ }
+
+ bool hasCheckAtIndex(NodeIndex nodeIndex)
+ {
+ while (m_iter != m_end) {
+ NodeIndex current = m_iter->m_nodeIndex;
+ if (current >= nodeIndex)
+ return current == nodeIndex;
+ ++m_iter;
+ }
+ return false;
+ }
+
+private:
+ SpeculationCheckVector& m_speculationChecks;
+ SpeculationCheckVector::Iterator m_iter;
+ SpeculationCheckVector::Iterator m_end;
+};
+
+
+} } // namespace JSC::DFG
+
+#endif
+#endif
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/docs/make-bytecode-docs.pl b/src/3rdparty/webkit/Source/JavaScriptCore/docs/make-bytecode-docs.pl
new file mode 100755
index 0000000..5a95195
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/generated/ArrayPrototype.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/ArrayPrototype.lut.h
new file mode 100644
index 0000000..d03e521
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/ArrayPrototype.lut.h
@@ -0,0 +1,40 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/ArrayPrototype.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue arrayTableValues[22] = {
+ { "toString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncToString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toLocaleString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncToLocaleString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "concat", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncConcat), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "join", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncJoin), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "pop", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncPop), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "push", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncPush), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "reverse", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncReverse), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "shift", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncShift), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "slice", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSlice), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "sort", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSort), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "splice", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSplice), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "unshift", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncUnShift), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "every", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncEvery), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "forEach", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncForEach), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "some", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncSome), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "indexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncIndexOf), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "lastIndexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncLastIndexOf), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "filter", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncFilter), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "reduce", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncReduce), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "reduceRight", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncReduceRight), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "map", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(arrayProtoFuncMap), (intptr_t)1 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable arrayTable =
+ { 65, 63, arrayTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/DatePrototype.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/DatePrototype.lut.h
new file mode 100644
index 0000000..3949905
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/DatePrototype.lut.h
@@ -0,0 +1,65 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/DatePrototype.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue dateTableValues[47] = {
+ { "toString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toISOString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToISOString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toUTCString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToUTCString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toDateString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToDateString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toTimeString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToTimeString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toLocaleString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToLocaleString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toLocaleDateString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToLocaleDateString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toLocaleTimeString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToLocaleTimeString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "valueOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetTime), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getTime", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetTime), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetFullYear), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCFullYear), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toGMTString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToGMTString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetMonth), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCMonth), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetDate), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCDate), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getDay", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetDay), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCDay", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCDay), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetHours), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCHours), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetMinutes), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCMinutes), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetSeconds), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCSeconds), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetMilliSeconds), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getUTCMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetUTCMilliseconds), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "getTimezoneOffset", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetTimezoneOffset), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "setTime", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetTime), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "setMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetMilliSeconds), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "setUTCMilliseconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCMilliseconds), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "setSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetSeconds), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "setUTCSeconds", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCSeconds), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "setMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetMinutes), (intptr_t)3 THUNK_GENERATOR(0) },
+ { "setUTCMinutes", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCMinutes), (intptr_t)3 THUNK_GENERATOR(0) },
+ { "setHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetHours), (intptr_t)4 THUNK_GENERATOR(0) },
+ { "setUTCHours", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCHours), (intptr_t)4 THUNK_GENERATOR(0) },
+ { "setDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetDate), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "setUTCDate", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCDate), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "setMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetMonth), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "setUTCMonth", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCMonth), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "setFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetFullYear), (intptr_t)3 THUNK_GENERATOR(0) },
+ { "setUTCFullYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetUTCFullYear), (intptr_t)3 THUNK_GENERATOR(0) },
+ { "setYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncSetYear), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "getYear", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncGetYear), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toJSON", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(dateProtoFuncToJSON), (intptr_t)1 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable dateTable =
+ { 134, 127, dateTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_MSVC.asm b/src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_MSVC.asm
new file mode 100644
index 0000000..ec115c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_MSVC.asm
@@ -0,0 +1,1086 @@
+ AREA Trampoline, CODE
+
+ EXPORT ctiTrampoline
+ EXPORT ctiVMThrowTrampoline
+ EXPORT ctiOpThrowNotCaught
+
+ctiTrampoline PROC
+ stmdb sp!, {r1-r3}
+ stmdb sp!, {r4-r8, lr}
+ sub sp, sp, #68 ; sync with PRESERVEDR4_OFFSET
+ mov r4, r2
+ mov r5, #512
+ ; r0 contains the code
+ mov lr, pc
+ bx r0
+ add sp, sp, #68 ; sync with PRESERVEDR4_OFFSET
+ ldmia sp!, {r4-r8, lr}
+ add sp, sp, #12
+ bx lr
+ctiTrampoline ENDP
+
+ctiVMThrowTrampoline PROC
+ mov r0, sp
+ mov lr, pc
+ bl cti_vm_throw
+ctiOpThrowNotCaught
+ add sp, sp, #68 ; sync with PRESERVEDR4_OFFSET
+ ldmia sp!, {r4-r8, lr}
+ add sp, sp, #12
+ bx lr
+ctiVMThrowTrampoline ENDP
+
+ EXPORT cti_op_create_this
+ IMPORT JITStubThunked_op_create_this
+cti_op_create_this PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_create_this
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_create_this ENDP
+
+ EXPORT cti_op_convert_this
+ IMPORT JITStubThunked_op_convert_this
+cti_op_convert_this PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_convert_this
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_convert_this ENDP
+
+ EXPORT cti_op_convert_this_strict
+ IMPORT JITStubThunked_op_convert_this_strict
+cti_op_convert_this_strict PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_convert_this_strict
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_convert_this_strict ENDP
+
+ EXPORT cti_op_add
+ IMPORT JITStubThunked_op_add
+cti_op_add PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_add
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_add ENDP
+
+ EXPORT cti_op_pre_inc
+ IMPORT JITStubThunked_op_pre_inc
+cti_op_pre_inc PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_pre_inc
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_pre_inc ENDP
+
+ EXPORT cti_timeout_check
+ IMPORT JITStubThunked_timeout_check
+cti_timeout_check PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_timeout_check
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_timeout_check ENDP
+
+ EXPORT cti_register_file_check
+ IMPORT JITStubThunked_register_file_check
+cti_register_file_check PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_register_file_check
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_register_file_check ENDP
+
+ EXPORT cti_op_loop_if_lesseq
+ IMPORT JITStubThunked_op_loop_if_lesseq
+cti_op_loop_if_lesseq PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_loop_if_lesseq
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_loop_if_lesseq ENDP
+
+ EXPORT cti_op_new_object
+ IMPORT JITStubThunked_op_new_object
+cti_op_new_object PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_new_object
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_new_object ENDP
+
+ EXPORT cti_op_put_by_id_generic
+ IMPORT JITStubThunked_op_put_by_id_generic
+cti_op_put_by_id_generic PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_id_generic
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_id_generic ENDP
+
+ EXPORT cti_op_put_by_id_direct_generic
+ IMPORT JITStubThunked_op_put_by_id_direct_generic
+cti_op_put_by_id_direct_generic PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_id_direct_generic
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_id_direct_generic ENDP
+
+ EXPORT cti_op_get_by_id_generic
+ IMPORT JITStubThunked_op_get_by_id_generic
+cti_op_get_by_id_generic PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_generic
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_generic ENDP
+
+ EXPORT cti_op_put_by_id
+ IMPORT JITStubThunked_op_put_by_id
+cti_op_put_by_id PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_id
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_id ENDP
+
+ EXPORT cti_op_put_by_id_direct
+ IMPORT JITStubThunked_op_put_by_id_direct
+cti_op_put_by_id_direct PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_id_direct
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_id_direct ENDP
+
+ EXPORT cti_op_put_by_id_fail
+ IMPORT JITStubThunked_op_put_by_id_fail
+cti_op_put_by_id_fail PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_id_fail
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_id_fail ENDP
+
+ EXPORT cti_op_put_by_id_direct_fail
+ IMPORT JITStubThunked_op_put_by_id_direct_fail
+cti_op_put_by_id_direct_fail PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_id_direct_fail
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_id_direct_fail ENDP
+
+ EXPORT cti_op_put_by_id_transition_realloc
+ IMPORT JITStubThunked_op_put_by_id_transition_realloc
+cti_op_put_by_id_transition_realloc PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_id_transition_realloc
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_id_transition_realloc ENDP
+
+ EXPORT cti_op_get_by_id_method_check
+ IMPORT JITStubThunked_op_get_by_id_method_check
+cti_op_get_by_id_method_check PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_method_check
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_method_check ENDP
+
+ EXPORT cti_op_get_by_id
+ IMPORT JITStubThunked_op_get_by_id
+cti_op_get_by_id PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id ENDP
+
+ EXPORT cti_op_get_by_id_self_fail
+ IMPORT JITStubThunked_op_get_by_id_self_fail
+cti_op_get_by_id_self_fail PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_self_fail
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_self_fail ENDP
+
+ EXPORT cti_op_get_by_id_getter_stub
+ IMPORT JITStubThunked_op_get_by_id_getter_stub
+cti_op_get_by_id_getter_stub PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_getter_stub
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_getter_stub ENDP
+
+ EXPORT cti_op_get_by_id_custom_stub
+ IMPORT JITStubThunked_op_get_by_id_custom_stub
+cti_op_get_by_id_custom_stub PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_custom_stub
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_custom_stub ENDP
+
+ EXPORT cti_op_get_by_id_proto_list
+ IMPORT JITStubThunked_op_get_by_id_proto_list
+cti_op_get_by_id_proto_list PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_proto_list
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_proto_list ENDP
+
+ EXPORT cti_op_get_by_id_proto_list_full
+ IMPORT JITStubThunked_op_get_by_id_proto_list_full
+cti_op_get_by_id_proto_list_full PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_proto_list_full
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_proto_list_full ENDP
+
+ EXPORT cti_op_get_by_id_proto_fail
+ IMPORT JITStubThunked_op_get_by_id_proto_fail
+cti_op_get_by_id_proto_fail PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_proto_fail
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_proto_fail ENDP
+
+ EXPORT cti_op_get_by_id_array_fail
+ IMPORT JITStubThunked_op_get_by_id_array_fail
+cti_op_get_by_id_array_fail PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_array_fail
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_array_fail ENDP
+
+ EXPORT cti_op_get_by_id_string_fail
+ IMPORT JITStubThunked_op_get_by_id_string_fail
+cti_op_get_by_id_string_fail PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_id_string_fail
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_id_string_fail ENDP
+
+ EXPORT cti_op_check_has_instance
+ IMPORT JITStubThunked_op_check_has_instance
+cti_op_check_has_instance PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_check_has_instance
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_check_has_instance ENDP
+
+ EXPORT cti_op_instanceof
+ IMPORT JITStubThunked_op_instanceof
+cti_op_instanceof PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_instanceof
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_instanceof ENDP
+
+ EXPORT cti_op_del_by_id
+ IMPORT JITStubThunked_op_del_by_id
+cti_op_del_by_id PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_del_by_id
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_del_by_id ENDP
+
+ EXPORT cti_op_mul
+ IMPORT JITStubThunked_op_mul
+cti_op_mul PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_mul
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_mul ENDP
+
+ EXPORT cti_op_new_func
+ IMPORT JITStubThunked_op_new_func
+cti_op_new_func PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_new_func
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_new_func ENDP
+
+ EXPORT cti_op_call_jitCompile
+ IMPORT JITStubThunked_op_call_jitCompile
+cti_op_call_jitCompile PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_call_jitCompile
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_call_jitCompile ENDP
+
+ EXPORT cti_op_construct_jitCompile
+ IMPORT JITStubThunked_op_construct_jitCompile
+cti_op_construct_jitCompile PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_construct_jitCompile
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_construct_jitCompile ENDP
+
+ EXPORT cti_op_call_arityCheck
+ IMPORT JITStubThunked_op_call_arityCheck
+cti_op_call_arityCheck PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_call_arityCheck
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_call_arityCheck ENDP
+
+ EXPORT cti_op_construct_arityCheck
+ IMPORT JITStubThunked_op_construct_arityCheck
+cti_op_construct_arityCheck PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_construct_arityCheck
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_construct_arityCheck ENDP
+
+ EXPORT cti_vm_lazyLinkCall
+ IMPORT JITStubThunked_vm_lazyLinkCall
+cti_vm_lazyLinkCall PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_vm_lazyLinkCall
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_vm_lazyLinkCall ENDP
+
+ EXPORT cti_vm_lazyLinkConstruct
+ IMPORT JITStubThunked_vm_lazyLinkConstruct
+cti_vm_lazyLinkConstruct PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_vm_lazyLinkConstruct
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_vm_lazyLinkConstruct ENDP
+
+ EXPORT cti_op_push_activation
+ IMPORT JITStubThunked_op_push_activation
+cti_op_push_activation PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_push_activation
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_push_activation ENDP
+
+ EXPORT cti_op_call_NotJSFunction
+ IMPORT JITStubThunked_op_call_NotJSFunction
+cti_op_call_NotJSFunction PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_call_NotJSFunction
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_call_NotJSFunction ENDP
+
+ EXPORT cti_op_create_arguments
+ IMPORT JITStubThunked_op_create_arguments
+cti_op_create_arguments PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_create_arguments
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_create_arguments ENDP
+
+ EXPORT cti_op_create_arguments_no_params
+ IMPORT JITStubThunked_op_create_arguments_no_params
+cti_op_create_arguments_no_params PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_create_arguments_no_params
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_create_arguments_no_params ENDP
+
+ EXPORT cti_op_tear_off_activation
+ IMPORT JITStubThunked_op_tear_off_activation
+cti_op_tear_off_activation PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_tear_off_activation
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_tear_off_activation ENDP
+
+ EXPORT cti_op_tear_off_arguments
+ IMPORT JITStubThunked_op_tear_off_arguments
+cti_op_tear_off_arguments PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_tear_off_arguments
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_tear_off_arguments ENDP
+
+ EXPORT cti_op_profile_will_call
+ IMPORT JITStubThunked_op_profile_will_call
+cti_op_profile_will_call PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_profile_will_call
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_profile_will_call ENDP
+
+ EXPORT cti_op_profile_did_call
+ IMPORT JITStubThunked_op_profile_did_call
+cti_op_profile_did_call PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_profile_did_call
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_profile_did_call ENDP
+
+ EXPORT cti_op_new_array
+ IMPORT JITStubThunked_op_new_array
+cti_op_new_array PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_new_array
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_new_array ENDP
+
+ EXPORT cti_op_resolve
+ IMPORT JITStubThunked_op_resolve
+cti_op_resolve PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_resolve
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_resolve ENDP
+
+ EXPORT cti_op_construct_NotJSConstruct
+ IMPORT JITStubThunked_op_construct_NotJSConstruct
+cti_op_construct_NotJSConstruct PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_construct_NotJSConstruct
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_construct_NotJSConstruct ENDP
+
+ EXPORT cti_op_get_by_val
+ IMPORT JITStubThunked_op_get_by_val
+cti_op_get_by_val PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_val
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_val ENDP
+
+ EXPORT cti_op_get_by_val_string
+ IMPORT JITStubThunked_op_get_by_val_string
+cti_op_get_by_val_string PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_val_string
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_val_string ENDP
+
+ EXPORT cti_op_get_by_val_byte_array
+ IMPORT JITStubThunked_op_get_by_val_byte_array
+cti_op_get_by_val_byte_array PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_by_val_byte_array
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_by_val_byte_array ENDP
+
+ EXPORT cti_op_sub
+ IMPORT JITStubThunked_op_sub
+cti_op_sub PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_sub
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_sub ENDP
+
+ EXPORT cti_op_put_by_val
+ IMPORT JITStubThunked_op_put_by_val
+cti_op_put_by_val PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_val
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_val ENDP
+
+ EXPORT cti_op_put_by_val_byte_array
+ IMPORT JITStubThunked_op_put_by_val_byte_array
+cti_op_put_by_val_byte_array PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_val_byte_array
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_val_byte_array ENDP
+
+ EXPORT cti_op_lesseq
+ IMPORT JITStubThunked_op_lesseq
+cti_op_lesseq PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_lesseq
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_lesseq ENDP
+
+ EXPORT cti_op_load_varargs
+ IMPORT JITStubThunked_op_load_varargs
+cti_op_load_varargs PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_load_varargs
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_load_varargs ENDP
+
+ EXPORT cti_op_negate
+ IMPORT JITStubThunked_op_negate
+cti_op_negate PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_negate
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_negate ENDP
+
+ EXPORT cti_op_resolve_base
+ IMPORT JITStubThunked_op_resolve_base
+cti_op_resolve_base PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_resolve_base
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_resolve_base ENDP
+
+ EXPORT cti_op_resolve_base_strict_put
+ IMPORT JITStubThunked_op_resolve_base_strict_put
+cti_op_resolve_base_strict_put PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_resolve_base_strict_put
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_resolve_base_strict_put ENDP
+
+ EXPORT cti_op_ensure_property_exists
+ IMPORT JITStubThunked_op_ensure_property_exists
+cti_op_ensure_property_exists PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_ensure_property_exists
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_ensure_property_exists ENDP
+
+ EXPORT cti_op_resolve_skip
+ IMPORT JITStubThunked_op_resolve_skip
+cti_op_resolve_skip PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_resolve_skip
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_resolve_skip ENDP
+
+ EXPORT cti_op_resolve_global
+ IMPORT JITStubThunked_op_resolve_global
+cti_op_resolve_global PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_resolve_global
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_resolve_global ENDP
+
+ EXPORT cti_op_div
+ IMPORT JITStubThunked_op_div
+cti_op_div PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_div
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_div ENDP
+
+ EXPORT cti_op_pre_dec
+ IMPORT JITStubThunked_op_pre_dec
+cti_op_pre_dec PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_pre_dec
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_pre_dec ENDP
+
+ EXPORT cti_op_jless
+ IMPORT JITStubThunked_op_jless
+cti_op_jless PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_jless
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_jless ENDP
+
+ EXPORT cti_op_jlesseq
+ IMPORT JITStubThunked_op_jlesseq
+cti_op_jlesseq PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_jlesseq
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_jlesseq ENDP
+
+ EXPORT cti_op_not
+ IMPORT JITStubThunked_op_not
+cti_op_not PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_not
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_not ENDP
+
+ EXPORT cti_op_jtrue
+ IMPORT JITStubThunked_op_jtrue
+cti_op_jtrue PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_jtrue
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_jtrue ENDP
+
+ EXPORT cti_op_post_inc
+ IMPORT JITStubThunked_op_post_inc
+cti_op_post_inc PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_post_inc
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_post_inc ENDP
+
+ EXPORT cti_op_eq
+ IMPORT JITStubThunked_op_eq
+cti_op_eq PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_eq
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_eq ENDP
+
+ EXPORT cti_op_eq_strings
+ IMPORT JITStubThunked_op_eq_strings
+cti_op_eq_strings PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_eq_strings
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_eq_strings ENDP
+
+ EXPORT cti_op_lshift
+ IMPORT JITStubThunked_op_lshift
+cti_op_lshift PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_lshift
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_lshift ENDP
+
+ EXPORT cti_op_bitand
+ IMPORT JITStubThunked_op_bitand
+cti_op_bitand PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_bitand
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_bitand ENDP
+
+ EXPORT cti_op_rshift
+ IMPORT JITStubThunked_op_rshift
+cti_op_rshift PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_rshift
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_rshift ENDP
+
+ EXPORT cti_op_bitnot
+ IMPORT JITStubThunked_op_bitnot
+cti_op_bitnot PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_bitnot
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_bitnot ENDP
+
+ EXPORT cti_op_resolve_with_base
+ IMPORT JITStubThunked_op_resolve_with_base
+cti_op_resolve_with_base PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_resolve_with_base
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_resolve_with_base ENDP
+
+ EXPORT cti_op_new_func_exp
+ IMPORT JITStubThunked_op_new_func_exp
+cti_op_new_func_exp PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_new_func_exp
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_new_func_exp ENDP
+
+ EXPORT cti_op_mod
+ IMPORT JITStubThunked_op_mod
+cti_op_mod PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_mod
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_mod ENDP
+
+ EXPORT cti_op_less
+ IMPORT JITStubThunked_op_less
+cti_op_less PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_less
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_less ENDP
+
+ EXPORT cti_op_post_dec
+ IMPORT JITStubThunked_op_post_dec
+cti_op_post_dec PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_post_dec
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_post_dec ENDP
+
+ EXPORT cti_op_urshift
+ IMPORT JITStubThunked_op_urshift
+cti_op_urshift PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_urshift
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_urshift ENDP
+
+ EXPORT cti_op_bitxor
+ IMPORT JITStubThunked_op_bitxor
+cti_op_bitxor PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_bitxor
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_bitxor ENDP
+
+ EXPORT cti_op_new_regexp
+ IMPORT JITStubThunked_op_new_regexp
+cti_op_new_regexp PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_new_regexp
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_new_regexp ENDP
+
+ EXPORT cti_op_bitor
+ IMPORT JITStubThunked_op_bitor
+cti_op_bitor PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_bitor
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_bitor ENDP
+
+ EXPORT cti_op_call_eval
+ IMPORT JITStubThunked_op_call_eval
+cti_op_call_eval PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_call_eval
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_call_eval ENDP
+
+ EXPORT cti_op_throw
+ IMPORT JITStubThunked_op_throw
+cti_op_throw PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_throw
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_throw ENDP
+
+ EXPORT cti_op_get_pnames
+ IMPORT JITStubThunked_op_get_pnames
+cti_op_get_pnames PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_get_pnames
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_get_pnames ENDP
+
+ EXPORT cti_has_property
+ IMPORT JITStubThunked_has_property
+cti_has_property PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_has_property
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_has_property ENDP
+
+ EXPORT cti_op_push_scope
+ IMPORT JITStubThunked_op_push_scope
+cti_op_push_scope PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_push_scope
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_push_scope ENDP
+
+ EXPORT cti_op_pop_scope
+ IMPORT JITStubThunked_op_pop_scope
+cti_op_pop_scope PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_pop_scope
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_pop_scope ENDP
+
+ EXPORT cti_op_typeof
+ IMPORT JITStubThunked_op_typeof
+cti_op_typeof PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_typeof
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_typeof ENDP
+
+ EXPORT cti_op_is_undefined
+ IMPORT JITStubThunked_op_is_undefined
+cti_op_is_undefined PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_is_undefined
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_is_undefined ENDP
+
+ EXPORT cti_op_is_boolean
+ IMPORT JITStubThunked_op_is_boolean
+cti_op_is_boolean PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_is_boolean
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_is_boolean ENDP
+
+ EXPORT cti_op_is_number
+ IMPORT JITStubThunked_op_is_number
+cti_op_is_number PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_is_number
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_is_number ENDP
+
+ EXPORT cti_op_is_string
+ IMPORT JITStubThunked_op_is_string
+cti_op_is_string PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_is_string
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_is_string ENDP
+
+ EXPORT cti_op_is_object
+ IMPORT JITStubThunked_op_is_object
+cti_op_is_object PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_is_object
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_is_object ENDP
+
+ EXPORT cti_op_is_function
+ IMPORT JITStubThunked_op_is_function
+cti_op_is_function PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_is_function
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_is_function ENDP
+
+ EXPORT cti_op_stricteq
+ IMPORT JITStubThunked_op_stricteq
+cti_op_stricteq PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_stricteq
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_stricteq ENDP
+
+ EXPORT cti_op_to_primitive
+ IMPORT JITStubThunked_op_to_primitive
+cti_op_to_primitive PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_to_primitive
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_to_primitive ENDP
+
+ EXPORT cti_op_strcat
+ IMPORT JITStubThunked_op_strcat
+cti_op_strcat PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_strcat
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_strcat ENDP
+
+ EXPORT cti_op_nstricteq
+ IMPORT JITStubThunked_op_nstricteq
+cti_op_nstricteq PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_nstricteq
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_nstricteq ENDP
+
+ EXPORT cti_op_to_jsnumber
+ IMPORT JITStubThunked_op_to_jsnumber
+cti_op_to_jsnumber PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_to_jsnumber
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_to_jsnumber ENDP
+
+ EXPORT cti_op_in
+ IMPORT JITStubThunked_op_in
+cti_op_in PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_in
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_in ENDP
+
+ EXPORT cti_op_push_new_scope
+ IMPORT JITStubThunked_op_push_new_scope
+cti_op_push_new_scope PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_push_new_scope
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_push_new_scope ENDP
+
+ EXPORT cti_op_jmp_scopes
+ IMPORT JITStubThunked_op_jmp_scopes
+cti_op_jmp_scopes PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_jmp_scopes
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_jmp_scopes ENDP
+
+ EXPORT cti_op_put_by_index
+ IMPORT JITStubThunked_op_put_by_index
+cti_op_put_by_index PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_by_index
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_by_index ENDP
+
+ EXPORT cti_op_switch_imm
+ IMPORT JITStubThunked_op_switch_imm
+cti_op_switch_imm PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_switch_imm
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_switch_imm ENDP
+
+ EXPORT cti_op_switch_char
+ IMPORT JITStubThunked_op_switch_char
+cti_op_switch_char PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_switch_char
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_switch_char ENDP
+
+ EXPORT cti_op_switch_string
+ IMPORT JITStubThunked_op_switch_string
+cti_op_switch_string PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_switch_string
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_switch_string ENDP
+
+ EXPORT cti_op_del_by_val
+ IMPORT JITStubThunked_op_del_by_val
+cti_op_del_by_val PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_del_by_val
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_del_by_val ENDP
+
+ EXPORT cti_op_put_getter
+ IMPORT JITStubThunked_op_put_getter
+cti_op_put_getter PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_getter
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_getter ENDP
+
+ EXPORT cti_op_put_setter
+ IMPORT JITStubThunked_op_put_setter
+cti_op_put_setter PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_put_setter
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_put_setter ENDP
+
+ EXPORT cti_op_throw_reference_error
+ IMPORT JITStubThunked_op_throw_reference_error
+cti_op_throw_reference_error PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_throw_reference_error
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_throw_reference_error ENDP
+
+ EXPORT cti_op_debug
+ IMPORT JITStubThunked_op_debug
+cti_op_debug PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_op_debug
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_op_debug ENDP
+
+ EXPORT cti_vm_throw
+ IMPORT JITStubThunked_vm_throw
+cti_vm_throw PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_vm_throw
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_vm_throw ENDP
+
+ EXPORT cti_to_object
+ IMPORT JITStubThunked_to_object
+cti_to_object PROC
+ str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bl JITStubThunked_to_object
+ ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET
+ bx lr
+cti_to_object ENDP
+
+ END
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h
new file mode 100644
index 0000000..783586d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h
@@ -0,0 +1,1287 @@
+extern "C" EncodedJSValue JITStubThunked_op_create_this(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_create_this(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_create_this
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_create_this
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_convert_this(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_convert_this(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_convert_this
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_convert_this
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_convert_this_strict(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_convert_this_strict(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_convert_this_strict
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_convert_this_strict
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_add(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_add(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_add
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_add
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_pre_inc(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_pre_inc(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_pre_inc
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_pre_inc
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_timeout_check(STUB_ARGS_DECLARATION);
+__asm int cti_timeout_check(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_timeout_check
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_timeout_check
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_register_file_check(STUB_ARGS_DECLARATION);
+__asm void* cti_register_file_check(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_register_file_check
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_register_file_check
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_op_loop_if_lesseq(STUB_ARGS_DECLARATION);
+__asm int cti_op_loop_if_lesseq(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_loop_if_lesseq
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_loop_if_lesseq
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_new_object(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_new_object(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_new_object
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_new_object
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_id_generic(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_id_generic(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_id_generic
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_id_generic
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_id_direct_generic(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_id_direct_generic(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_id_direct_generic
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_id_direct_generic
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_generic(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_generic(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_generic
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_generic
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_id(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_id(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_id
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_id
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_id_direct(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_id_direct(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_id_direct
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_id_direct
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_id_fail(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_id_fail(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_id_fail
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_id_fail
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_id_direct_fail(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_id_direct_fail(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_id_direct_fail
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_id_direct_fail
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_id_transition_realloc
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_id_transition_realloc
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_method_check(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_method_check(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_method_check
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_method_check
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_self_fail(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_self_fail(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_self_fail
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_self_fail
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_getter_stub(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_getter_stub(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_getter_stub
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_getter_stub
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_custom_stub(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_custom_stub(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_custom_stub
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_custom_stub
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_proto_list(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_proto_list(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_proto_list
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_proto_list
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_proto_list_full(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_proto_list_full(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_proto_list_full
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_proto_list_full
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_proto_fail(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_proto_fail(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_proto_fail
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_proto_fail
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_array_fail(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_array_fail(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_array_fail
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_array_fail
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_id_string_fail(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_id_string_fail(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_id_string_fail
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_id_string_fail
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_check_has_instance(STUB_ARGS_DECLARATION);
+__asm void cti_op_check_has_instance(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_check_has_instance
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_check_has_instance
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_instanceof(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_instanceof(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_instanceof
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_instanceof
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_del_by_id(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_del_by_id(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_del_by_id
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_del_by_id
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_mul(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_mul(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_mul
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_mul
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_new_func(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_new_func(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_new_func
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_new_func
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_call_jitCompile(STUB_ARGS_DECLARATION);
+__asm void* cti_op_call_jitCompile(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_call_jitCompile
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_call_jitCompile
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_construct_jitCompile(STUB_ARGS_DECLARATION);
+__asm void* cti_op_construct_jitCompile(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_construct_jitCompile
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_construct_jitCompile
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_call_arityCheck(STUB_ARGS_DECLARATION);
+__asm void* cti_op_call_arityCheck(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_call_arityCheck
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_call_arityCheck
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_construct_arityCheck(STUB_ARGS_DECLARATION);
+__asm void* cti_op_construct_arityCheck(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_construct_arityCheck
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_construct_arityCheck
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_vm_lazyLinkCall(STUB_ARGS_DECLARATION);
+__asm void* cti_vm_lazyLinkCall(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_vm_lazyLinkCall
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_vm_lazyLinkCall
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_vm_lazyLinkConstruct(STUB_ARGS_DECLARATION);
+__asm void* cti_vm_lazyLinkConstruct(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_vm_lazyLinkConstruct
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_vm_lazyLinkConstruct
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_push_activation(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_push_activation(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_push_activation
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_push_activation
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_call_NotJSFunction(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_call_NotJSFunction(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_call_NotJSFunction
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_call_NotJSFunction
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_create_arguments(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_create_arguments(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_create_arguments
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_create_arguments
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_create_arguments_no_params(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_create_arguments_no_params
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_create_arguments_no_params
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_tear_off_activation(STUB_ARGS_DECLARATION);
+__asm void cti_op_tear_off_activation(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_tear_off_activation
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_tear_off_activation
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_tear_off_arguments(STUB_ARGS_DECLARATION);
+__asm void cti_op_tear_off_arguments(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_tear_off_arguments
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_tear_off_arguments
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_profile_will_call(STUB_ARGS_DECLARATION);
+__asm void cti_op_profile_will_call(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_profile_will_call
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_profile_will_call
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_profile_did_call(STUB_ARGS_DECLARATION);
+__asm void cti_op_profile_did_call(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_profile_did_call
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_profile_did_call
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_new_array(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_new_array(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_new_array
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_new_array
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_resolve(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_resolve(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_resolve
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_resolve
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_construct_NotJSConstruct(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_construct_NotJSConstruct(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_construct_NotJSConstruct
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_construct_NotJSConstruct
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_val(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_val(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_val
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_val
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_val_string(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_val_string(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_val_string
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_val_string
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_get_by_val_byte_array(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_get_by_val_byte_array(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_by_val_byte_array
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_by_val_byte_array
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_sub(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_sub(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_sub
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_sub
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_val(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_val(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_val
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_val
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_val_byte_array(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_val_byte_array(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_val_byte_array
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_val_byte_array
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_lesseq(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_lesseq(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_lesseq
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_lesseq
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_op_load_varargs(STUB_ARGS_DECLARATION);
+__asm int cti_op_load_varargs(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_load_varargs
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_load_varargs
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_negate(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_negate(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_negate
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_negate
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_resolve_base(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_resolve_base(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_resolve_base
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_resolve_base
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_resolve_base_strict_put(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_resolve_base_strict_put(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_resolve_base_strict_put
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_resolve_base_strict_put
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_ensure_property_exists(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_ensure_property_exists(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_ensure_property_exists
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_ensure_property_exists
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_resolve_skip(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_resolve_skip(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_resolve_skip
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_resolve_skip
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_resolve_global(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_resolve_global(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_resolve_global
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_resolve_global
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_div(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_div(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_div
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_div
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_pre_dec(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_pre_dec(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_pre_dec
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_pre_dec
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_op_jless(STUB_ARGS_DECLARATION);
+__asm int cti_op_jless(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_jless
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_jless
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_op_jlesseq(STUB_ARGS_DECLARATION);
+__asm int cti_op_jlesseq(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_jlesseq
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_jlesseq
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_not(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_not(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_not
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_not
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_op_jtrue(STUB_ARGS_DECLARATION);
+__asm int cti_op_jtrue(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_jtrue
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_jtrue
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_post_inc(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_post_inc(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_post_inc
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_post_inc
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_op_eq(STUB_ARGS_DECLARATION);
+__asm int cti_op_eq(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_eq
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_eq
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_op_eq_strings(STUB_ARGS_DECLARATION);
+__asm int cti_op_eq_strings(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_eq_strings
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_eq_strings
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_lshift(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_lshift(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_lshift
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_lshift
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_bitand(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_bitand(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_bitand
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_bitand
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_rshift(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_rshift(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_rshift
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_rshift
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_bitnot(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_bitnot(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_bitnot
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_bitnot
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_resolve_with_base(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_resolve_with_base(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_resolve_with_base
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_resolve_with_base
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_new_func_exp(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_new_func_exp(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_new_func_exp
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_new_func_exp
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_mod(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_mod(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_mod
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_mod
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_less(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_less(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_less
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_less
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_post_dec(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_post_dec(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_post_dec
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_post_dec
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_urshift(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_urshift(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_urshift
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_urshift
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_bitxor(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_bitxor(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_bitxor
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_bitxor
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_new_regexp(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_new_regexp(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_new_regexp
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_new_regexp
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_bitor(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_bitor(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_bitor
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_bitor
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_call_eval(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_call_eval(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_call_eval
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_call_eval
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_throw(STUB_ARGS_DECLARATION);
+__asm void* cti_op_throw(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_throw
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_throw
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSPropertyNameIterator* JITStubThunked_op_get_pnames(STUB_ARGS_DECLARATION);
+__asm JSPropertyNameIterator* cti_op_get_pnames(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_get_pnames
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_get_pnames
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" int JITStubThunked_has_property(STUB_ARGS_DECLARATION);
+__asm int cti_has_property(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_has_property
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_has_property
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_push_scope(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_push_scope(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_push_scope
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_push_scope
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_pop_scope(STUB_ARGS_DECLARATION);
+__asm void cti_op_pop_scope(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_pop_scope
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_pop_scope
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_typeof(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_typeof(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_typeof
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_typeof
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_is_undefined(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_is_undefined(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_is_undefined
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_is_undefined
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_is_boolean(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_is_boolean(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_is_boolean
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_is_boolean
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_is_number(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_is_number(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_is_number
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_is_number
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_is_string(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_is_string(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_is_string
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_is_string
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_is_object(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_is_object(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_is_object
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_is_object
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_is_function(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_is_function(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_is_function
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_is_function
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_stricteq(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_stricteq(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_stricteq
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_stricteq
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_to_primitive(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_to_primitive(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_to_primitive
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_to_primitive
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_strcat(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_strcat(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_strcat
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_strcat
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_nstricteq(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_nstricteq(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_nstricteq
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_nstricteq
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_to_jsnumber(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_to_jsnumber(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_to_jsnumber
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_to_jsnumber
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_in(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_in(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_in
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_in
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" JSObject* JITStubThunked_op_push_new_scope(STUB_ARGS_DECLARATION);
+__asm JSObject* cti_op_push_new_scope(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_push_new_scope
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_push_new_scope
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_jmp_scopes(STUB_ARGS_DECLARATION);
+__asm void cti_op_jmp_scopes(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_jmp_scopes
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_jmp_scopes
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_by_index(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_by_index(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_by_index
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_by_index
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_switch_imm(STUB_ARGS_DECLARATION);
+__asm void* cti_op_switch_imm(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_switch_imm
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_switch_imm
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_switch_char(STUB_ARGS_DECLARATION);
+__asm void* cti_op_switch_char(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_switch_char
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_switch_char
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_op_switch_string(STUB_ARGS_DECLARATION);
+__asm void* cti_op_switch_string(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_switch_string
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_switch_string
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_op_del_by_val(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_op_del_by_val(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_del_by_val
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_del_by_val
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_getter(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_getter(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_getter
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_getter
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_put_setter(STUB_ARGS_DECLARATION);
+__asm void cti_op_put_setter(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_put_setter
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_put_setter
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_throw_reference_error(STUB_ARGS_DECLARATION);
+__asm void cti_op_throw_reference_error(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_throw_reference_error
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_throw_reference_error
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void JITStubThunked_op_debug(STUB_ARGS_DECLARATION);
+__asm void cti_op_debug(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_op_debug
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_op_debug
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" void* JITStubThunked_vm_throw(STUB_ARGS_DECLARATION);
+__asm void* cti_vm_throw(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_vm_throw
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_vm_throw
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
+extern "C" EncodedJSValue JITStubThunked_to_object(STUB_ARGS_DECLARATION);
+__asm EncodedJSValue cti_to_object(STUB_ARGS_DECLARATION)
+{
+ PRESERVE8
+ IMPORT JITStubThunked_to_object
+ str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bl JITStubThunked_to_object
+ ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET]
+ bx lr
+}
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/JSONObject.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/JSONObject.lut.h
new file mode 100644
index 0000000..67a3a59
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/JSONObject.lut.h
@@ -0,0 +1,21 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/JSONObject.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue jsonTableValues[3] = {
+ { "parse", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(JSONProtoFuncParse), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "stringify", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(JSONProtoFuncStringify), (intptr_t)3 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable jsonTable =
+ { 4, 3, jsonTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/Lexer.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/Lexer.lut.h
new file mode 100644
index 0000000..b502cde
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/Lexer.lut.h
@@ -0,0 +1,55 @@
+// Automatically generated from ../Source/JavaScriptCore/parser/Keywords.table using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue mainTableValues[37] = {
+ { "null", 0, (intptr_t)(NULLTOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "true", 0, (intptr_t)(TRUETOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "false", 0, (intptr_t)(FALSETOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "break", 0, (intptr_t)(BREAK), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "case", 0, (intptr_t)(CASE), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "catch", 0, (intptr_t)(CATCH), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "const", 0, (intptr_t)(CONSTTOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "default", 0, (intptr_t)(DEFAULT), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "finally", 0, (intptr_t)(FINALLY), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "for", 0, (intptr_t)(FOR), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "instanceof", 0, (intptr_t)(INSTANCEOF), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "new", 0, (intptr_t)(NEW), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "var", 0, (intptr_t)(VAR), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "continue", 0, (intptr_t)(CONTINUE), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "function", 0, (intptr_t)(FUNCTION), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "return", 0, (intptr_t)(RETURN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "void", 0, (intptr_t)(VOIDTOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "delete", 0, (intptr_t)(DELETETOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "if", 0, (intptr_t)(IF), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "this", 0, (intptr_t)(THISTOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "do", 0, (intptr_t)(DO), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "while", 0, (intptr_t)(WHILE), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "else", 0, (intptr_t)(ELSE), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "in", 0, (intptr_t)(INTOKEN), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "switch", 0, (intptr_t)(SWITCH), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "throw", 0, (intptr_t)(THROW), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "try", 0, (intptr_t)(TRY), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "typeof", 0, (intptr_t)(TYPEOF), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "with", 0, (intptr_t)(WITH), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "debugger", 0, (intptr_t)(DEBUGGER), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "class", 0, (intptr_t)(RESERVED), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "enum", 0, (intptr_t)(RESERVED), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "export", 0, (intptr_t)(RESERVED), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "extends", 0, (intptr_t)(RESERVED), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "import", 0, (intptr_t)(RESERVED), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "super", 0, (intptr_t)(RESERVED), (intptr_t)0 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable mainTable =
+ { 133, 127, mainTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/MathObject.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/MathObject.lut.h
new file mode 100644
index 0000000..f557bea
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/MathObject.lut.h
@@ -0,0 +1,37 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/MathObject.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue mathTableValues[19] = {
+ { "abs", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncAbs), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "acos", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncACos), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "asin", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncASin), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "atan", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncATan), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "atan2", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncATan2), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "ceil", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncCeil), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "cos", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncCos), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "exp", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncExp), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "floor", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncFloor), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "log", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncLog), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "max", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncMax), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "min", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncMin), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "pow", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncPow), (intptr_t)2 THUNK_GENERATOR(powThunkGenerator) },
+ { "random", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncRandom), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "round", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncRound), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "sin", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncSin), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "sqrt", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncSqrt), (intptr_t)1 THUNK_GENERATOR(sqrtThunkGenerator) },
+ { "tan", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(mathProtoFuncTan), (intptr_t)1 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable mathTable =
+ { 67, 63, mathTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/NumberConstructor.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/NumberConstructor.lut.h
new file mode 100644
index 0000000..cc783e0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/NumberConstructor.lut.h
@@ -0,0 +1,24 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/NumberConstructor.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue numberTableValues[6] = {
+ { "NaN", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorNaNValue), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "NEGATIVE_INFINITY", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorNegInfinity), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "POSITIVE_INFINITY", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorPosInfinity), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "MAX_VALUE", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorMaxValue), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "MIN_VALUE", DontEnum|DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(numberConstructorMinValue), (intptr_t)0 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable numberTable =
+ { 16, 15, numberTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/ObjectConstructor.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/ObjectConstructor.lut.h
new file mode 100644
index 0000000..38abc04
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/ObjectConstructor.lut.h
@@ -0,0 +1,32 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/ObjectConstructor.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue objectConstructorTableValues[14] = {
+ { "getPrototypeOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorGetPrototypeOf), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "getOwnPropertyDescriptor", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorGetOwnPropertyDescriptor), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "getOwnPropertyNames", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorGetOwnPropertyNames), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "keys", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorKeys), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "defineProperty", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorDefineProperty), (intptr_t)3 THUNK_GENERATOR(0) },
+ { "defineProperties", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorDefineProperties), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "create", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorCreate), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "seal", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorSeal), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "freeze", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorFreeze), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "preventExtensions", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorPreventExtensions), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "isSealed", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorIsSealed), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "isFrozen", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorIsFrozen), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "isExtensible", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(objectConstructorIsExtensible), (intptr_t)1 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable objectConstructorTable =
+ { 34, 31, objectConstructorTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpConstructor.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpConstructor.lut.h
new file mode 100644
index 0000000..5fb416c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpConstructor.lut.h
@@ -0,0 +1,40 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/RegExpConstructor.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue regExpConstructorTableValues[22] = {
+ { "input", None, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorInput), (intptr_t)setRegExpConstructorInput THUNK_GENERATOR(0) },
+ { "$_", DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorInput), (intptr_t)setRegExpConstructorInput THUNK_GENERATOR(0) },
+ { "multiline", None, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorMultiline), (intptr_t)setRegExpConstructorMultiline THUNK_GENERATOR(0) },
+ { "$*", DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorMultiline), (intptr_t)setRegExpConstructorMultiline THUNK_GENERATOR(0) },
+ { "lastMatch", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastMatch), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$&", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastMatch), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "lastParen", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastParen), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$+", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLastParen), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "leftContext", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLeftContext), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$`", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorLeftContext), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "rightContext", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorRightContext), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$'", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorRightContext), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$1", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar1), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$2", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar2), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$3", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar3), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$4", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar4), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$5", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar5), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$6", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar6), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$7", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar7), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$8", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar8), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "$9", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpConstructorDollar9), (intptr_t)0 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable regExpConstructorTable =
+ { 65, 63, regExpConstructorTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpJitTables.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpJitTables.h
new file mode 100644
index 0000000..5b95836
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpJitTables.h
@@ -0,0 +1,2715 @@
+static const char _spacesData[65536] = {
+0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,
+1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+
+static const char _wordcharData[65536] = {
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
+1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,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,0,0,0,0,1,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+
+
+CharacterClass* digitsCreate()
+{
+ CharacterClass* characterClass = new CharacterClass(0);
+ characterClass->m_ranges.append(CharacterRange(0x30, 0x39));
+ return characterClass;
+}
+
+CharacterClass* nondigitsCreate()
+{
+ CharacterClass* characterClass = new CharacterClass(0);
+ characterClass->m_ranges.append(CharacterRange(0x00, 0x2f));
+ characterClass->m_ranges.append(CharacterRange(0x3a, 0x7f));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x0080, 0xffff));
+ return characterClass;
+}
+
+CharacterClass* newlineCreate()
+{
+ CharacterClass* characterClass = new CharacterClass(0);
+ characterClass->m_matches.append(0x0a);
+ characterClass->m_matches.append(0x0d);
+ characterClass->m_matchesUnicode.append(0x2028);
+ characterClass->m_matchesUnicode.append(0x2029);
+ return characterClass;
+}
+
+CharacterClass* spacesCreate()
+{
+ CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_spacesData, false));
+ characterClass->m_ranges.append(CharacterRange(0x09, 0x0d));
+ characterClass->m_matches.append(0x20);
+ characterClass->m_matchesUnicode.append(0x00a0);
+ characterClass->m_matchesUnicode.append(0x1680);
+ characterClass->m_matchesUnicode.append(0x180e);
+ characterClass->m_rangesUnicode.append(CharacterRange(0x2000, 0x200a));
+ characterClass->m_matchesUnicode.append(0x2028);
+ characterClass->m_matchesUnicode.append(0x2029);
+ characterClass->m_matchesUnicode.append(0x202f);
+ characterClass->m_matchesUnicode.append(0x205f);
+ characterClass->m_matchesUnicode.append(0x3000);
+ characterClass->m_matchesUnicode.append(0xfeff);
+ return characterClass;
+}
+
+CharacterClass* nonspacesCreate()
+{
+ CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_spacesData, true));
+ characterClass->m_ranges.append(CharacterRange(0x00, 0x08));
+ characterClass->m_ranges.append(CharacterRange(0x0e, 0x1f));
+ characterClass->m_ranges.append(CharacterRange(0x21, 0x7f));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x0080, 0x009f));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x00a1, 0x167f));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x1681, 0x180d));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x180f, 0x1fff));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x200b, 0x2027));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x202a, 0x202e));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x2030, 0x205e));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x2060, 0x2fff));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x3001, 0xfefe));
+ characterClass->m_rangesUnicode.append(CharacterRange(0xff00, 0xffff));
+ return characterClass;
+}
+
+CharacterClass* nonwordcharCreate()
+{
+ CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_wordcharData, true));
+ characterClass->m_ranges.append(CharacterRange(0x00, 0x2f));
+ characterClass->m_ranges.append(CharacterRange(0x3a, 0x40));
+ characterClass->m_ranges.append(CharacterRange(0x5b, 0x5e));
+ characterClass->m_matches.append(0x60);
+ characterClass->m_ranges.append(CharacterRange(0x7b, 0x7f));
+ characterClass->m_rangesUnicode.append(CharacterRange(0x0080, 0xffff));
+ return characterClass;
+}
+
+CharacterClass* wordcharCreate()
+{
+ CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_wordcharData, false));
+ characterClass->m_ranges.append(CharacterRange(0x30, 0x39));
+ characterClass->m_ranges.append(CharacterRange(0x41, 0x5a));
+ characterClass->m_matches.append(0x5f);
+ characterClass->m_ranges.append(CharacterRange(0x61, 0x7a));
+ return characterClass;
+}
+
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpObject.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpObject.lut.h
new file mode 100644
index 0000000..a4fdca3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/RegExpObject.lut.h
@@ -0,0 +1,24 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/RegExpObject.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue regExpTableValues[6] = {
+ { "global", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectGlobal), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "ignoreCase", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectIgnoreCase), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "multiline", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectMultiline), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "source", DontDelete|ReadOnly|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectSource), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "lastIndex", DontDelete|DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(regExpObjectLastIndex), (intptr_t)setRegExpObjectLastIndex THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable regExpTable =
+ { 17, 15, regExpTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/generated/StringPrototype.lut.h b/src/3rdparty/webkit/Source/JavaScriptCore/generated/StringPrototype.lut.h
new file mode 100644
index 0000000..f4cd05b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/generated/StringPrototype.lut.h
@@ -0,0 +1,54 @@
+// Automatically generated from ../Source/JavaScriptCore/runtime/StringPrototype.cpp using /Source/JavaScriptCore/create_hash_table. DO NOT EDIT!
+
+#include "Lookup.h"
+
+namespace JSC {
+#if ENABLE(JIT)
+#define THUNK_GENERATOR(generator) , generator
+#else
+#define THUNK_GENERATOR(generator)
+#endif
+
+static const struct HashTableValue stringTableValues[36] = {
+ { "toString", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "valueOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToString), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "charAt", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncCharAt), (intptr_t)1 THUNK_GENERATOR(charAtThunkGenerator) },
+ { "charCodeAt", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncCharCodeAt), (intptr_t)1 THUNK_GENERATOR(charCodeAtThunkGenerator) },
+ { "concat", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncConcat), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "indexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncIndexOf), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "lastIndexOf", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncLastIndexOf), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "match", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncMatch), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "replace", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncReplace), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "search", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSearch), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "slice", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSlice), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "split", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSplit), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "substr", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSubstr), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "substring", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSubstring), (intptr_t)2 THUNK_GENERATOR(0) },
+ { "toLowerCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToLowerCase), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toUpperCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToUpperCase), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "localeCompare", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncLocaleCompare), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "toLocaleLowerCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToLowerCase), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "toLocaleUpperCase", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncToUpperCase), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "big", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncBig), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "small", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSmall), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "blink", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncBlink), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "bold", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncBold), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "fixed", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncFixed), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "italics", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncItalics), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "strike", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncStrike), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "sub", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSub), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "sup", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncSup), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "fontcolor", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncFontcolor), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "fontsize", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncFontsize), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "anchor", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncAnchor), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "link", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncLink), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "trim", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncTrim), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "trimLeft", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncTrimLeft), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "trimRight", DontEnum|Function, (intptr_t)static_cast<NativeFunction>(stringProtoFuncTrimRight), (intptr_t)0 THUNK_GENERATOR(0) },
+ { 0, 0, 0, 0 THUNK_GENERATOR(0) }
+};
+
+#undef THUNK_GENERATOR
+extern JSC_CONST_HASHTABLE HashTable stringTable =
+ { 133, 127, stringTableValues, 0 };
+} // namespace
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/gyp/JavaScriptCore.gyp b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/JavaScriptCore.gyp
new file mode 100644
index 0000000..a520344
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/JavaScriptCore.gyp
@@ -0,0 +1,228 @@
+{
+ 'includes': [
+ '../../gyp/common.gypi',
+ '../JavaScriptCore.gypi',
+ ],
+ 'configurations': {
+ 'Production': {
+ 'xcode_config_file': '<(project_dir)/Configurations/Base.xcconfig',
+ },
+ 'Profiling': {
+ 'xcode_config_file': '<(project_dir)/Configurations/DebugRelease.xcconfig',
+ 'xcode_settings': {
+ 'STRIP_INSTALLED_PRODUCT': 'NO',
+ },
+ },
+ 'Release': {
+ 'xcode_config_file': '<(project_dir)/Configurations/DebugRelease.xcconfig',
+ 'xcode_settings': {
+ 'STRIP_INSTALLED_PRODUCT': 'NO',
+ },
+ },
+ 'Debug': {
+ 'xcode_config_file': '<(project_dir)/Configurations/DebugRelease.xcconfig',
+ 'xcode_settings': {
+ '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)',
+ },
+ },
+ },
+ 'variables': {
+ 'javascriptcore_include_dirs': [
+ '<(project_dir)',
+ '<(project_dir)/icu',
+ ],
+ },
+ 'target_defaults': {
+ 'configurations': {
+ 'Profiling': {},
+ },
+ },
+ 'targets': [
+ {
+ 'target_name': 'JavaScriptCore',
+ 'type': 'shared_library',
+ 'dependencies': [
+ 'Derived Sources',
+ 'Update Version',
+ ],
+ 'include_dirs': [
+ '<@(javascriptcore_include_dirs)',
+ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore',
+ ],
+ 'configurations': {
+ 'Production': {
+ 'INSTALL_PATH': '$(BUILT_PRODUCTS_DIR)',
+ },
+ },
+ 'sources': [
+ '<@(javascriptcore_files)',
+ '<@(javascriptcore_publicheader_files)',
+ '<@(javascriptcore_privateheader_files)',
+ '<@(javascriptcore_derived_source_files)',
+ '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+ '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
+ '/usr/lib/libicucore.dylib',
+ '/usr/lib/libobjc.dylib',
+ ],
+ 'mac_framework_headers': [
+ '<@(javascriptcore_publicheader_files)',
+ ],
+ 'mac_framework_private_headers': [
+ '<@(javascriptcore_privateheader_files)',
+ ],
+ 'xcode_config_file': '<(project_dir)/Configurations/JavaScriptCore.xcconfig',
+ 'sources/': [
+ ['exclude', 'API/tests/'],
+ ['exclude', 'ForwardingHeaders/'],
+ ['exclude', '(?<!unicode)/icu/'],
+ ['exclude', 'os-win32/'],
+ ['exclude', 'qt/'],
+ ['exclude', 'wtf/(android|brew|efl|gtk|haiku|qt|wince|wx)/'],
+ ['exclude', 'wtf/unicode/brew/'],
+ ['exclude', 'wtf/unicode/glib/'],
+ ['exclude', 'wtf/unicode/qt4/'],
+ ['exclude', 'wtf/unicode/wince/'],
+ ['exclude', 'wtf/url/'],
+ ['exclude', '/(gtk|glib|gobject)/.*\\.(cpp|h)$'],
+ ['exclude', '(Default|Gtk|Chromium|None|Qt|Win|Wx|Symbian)\\.(cpp|mm|h)$'],
+ ['exclude', 'GCActivityCallback\.cpp$'],
+ ['exclude', 'BSTR[^/]*$'],
+ ],
+ 'postbuilds': [
+ {
+ 'postbuild_name': 'Check For Global Initializers',
+ 'action': [
+ 'sh', '<(project_dir)/gyp/run-if-exists.sh', '<(DEPTH)/../Tools/Scripts/check-for-global-initializers'
+ ],
+ },
+ {
+ 'postbuild_name': 'Check For Exit Time Destructors',
+ 'action': [
+ 'sh', '<(project_dir)/gyp/run-if-exists.sh', '<(DEPTH)/../Tools/Scripts/check-for-exit-time-destructors'
+ ],
+ },
+ {
+ 'postbuild_name': 'Check For Weak VTables and Externals',
+ 'action': [
+ 'sh', '<(project_dir)/gyp/run-if-exists.sh', '<(DEPTH)/../Tools/Scripts/check-for-weak-vtables-and-externals'
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'mac_bundle': 1,
+ 'xcode_settings': {
+ # FIXME: Remove these overrides once JavaScriptCore.xcconfig is
+ # used only by this project.
+ 'GCC_PREFIX_HEADER': '<(project_dir)/JavaScriptCorePrefix.h',
+ 'INFOPLIST_FILE': '<(project_dir)/Info.plist',
+ },
+ }],
+ ],
+ },
+ {
+ 'target_name': 'Derived Sources',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'Generate Derived Sources',
+ 'inputs': [],
+ 'outputs': [
+ '<@(javascriptcore_derived_source_files)',
+ ],
+ 'action': [
+ 'sh', 'generate-derived-sources.sh'
+ ],
+ },
+ {
+ 'action_name': 'Generate DTrace Header',
+ 'inputs': [],
+ 'outputs': [],
+ 'action': [
+ 'sh', '<(project_dir)/gyp/generate-dtrace-header.sh', '<(project_dir)'
+ ]
+ }
+ ],
+ },
+ {
+ 'target_name': 'Update Version',
+ 'type': 'none',
+ 'actions': [{
+ 'action_name': 'Update Info.plist with version information',
+ 'inputs': [],
+ 'outputs': [],
+ 'action': [
+ 'sh', '<(project_dir)/gyp/update-info-plist.sh', '<(project_dir)/Info.plist'
+ ]
+ }],
+ },
+ {
+ 'target_name': 'minidom',
+ 'type': 'executable',
+ 'dependencies': [
+ 'JavaScriptCore',
+ ],
+ # FIXME: We should use a header map instead of listing these explicitly.
+ 'include_dirs': [
+ '<@(javascriptcore_include_dirs)',
+ ],
+ 'sources': [
+ '<@(minidom_files)',
+ '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+ ],
+ 'copies': [{
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<@(minidom_support_files)',
+ ],
+ }],
+ },
+ {
+ 'target_name': 'testapi',
+ 'type': 'executable',
+ 'dependencies': [
+ 'JavaScriptCore',
+ ],
+ # FIXME: We should use a header map instead of listing these explicitly.
+ 'include_dirs': [
+ '<@(javascriptcore_include_dirs)',
+ ],
+ 'sources': [
+ '<@(testapi_files)',
+ '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+ ],
+ 'copies': [{
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<@(testapi_support_files)',
+ ],
+ }],
+ },
+ {
+ 'target_name': 'jsc',
+ 'type': 'executable',
+ 'dependencies': [
+ 'JavaScriptCore',
+ ],
+ # FIXME: We should use a header map instead of listing these explicitly.
+ 'include_dirs': [
+ '<@(javascriptcore_include_dirs)',
+ ],
+ 'configurations': {
+ 'Production': {
+ 'xcode_settings': {
+ 'INSTALL_PATH': '$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/Resources',
+ },
+ },
+ },
+ 'sources': [
+ '<@(jsc_files)',
+ '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+ '/usr/lib/libedit.dylib',
+ ],
+ },
+ ], # targets
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-derived-sources.sh b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-derived-sources.sh
new file mode 100755
index 0000000..a03af7d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-derived-sources.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+mkdir -p "${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/docs"
+cd "${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore"
+
+/bin/ln -sfh "${SRCROOT}/.." JavaScriptCore
+export JavaScriptCore="JavaScriptCore"
+
+make --no-builtin-rules -f "JavaScriptCore/DerivedSources.make" -j `/usr/sbin/sysctl -n hw.ncpu`
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-dtrace-header.sh b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-dtrace-header.sh
new file mode 100755
index 0000000..a3c31dd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/generate-dtrace-header.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+TRACING_D="$1/runtime/Tracing.d";
+TRACING_H="$BUILT_PRODUCTS_DIR/DerivedSources/JavaScriptCore/TracingDtrace.h";
+
+if [[ "${HAVE_DTRACE}" = "1" && "${TRACING_D}" -nt "${TRACING_H}" ]]; then
+ dtrace -h -o "${TRACING_H}" -s "${TRACING_D}";
+fi;
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/gyp/gtk.gyp b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/gtk.gyp
new file mode 100644
index 0000000..33eaa17
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/gtk.gyp
@@ -0,0 +1,18 @@
+{ # Just a stub file to allow Source/gyp/configure to run successfully for testing.
+ 'includes': [
+ '../../gyp/common.gypi',
+ '../JavaScriptCore.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'JavaScriptCore',
+ 'type': 'static_library',
+ 'sources': [
+ '<@(javascriptcore_files)',
+ '<@(javascriptcore_publicheader_files)',
+ '<@(javascriptcore_privateheader_files)',
+ '<@(javascriptcore_derived_source_files)',
+ ],
+ },
+ ], # targets
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/gyp/run-if-exists.sh b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/run-if-exists.sh
new file mode 100755
index 0000000..242ffc8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/run-if-exists.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ -f $1 ]; then
+ $1 || exit $?;
+fi
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/gyp/update-info-plist.sh b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/update-info-plist.sh
new file mode 100755
index 0000000..d02ecce
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/gyp/update-info-plist.sh
@@ -0,0 +1,4 @@
+# Touch Info.plist to let Xcode know it needs to copy it into the built product
+if [[ "${CONFIGURATION}" != "Production" ]]; then
+ touch "$1";
+fi
diff --git a/src/3rdparty/webkit/JavaScriptCore/headers.pri b/src/3rdparty/webkit/Source/JavaScriptCore/headers.pri
index 3fb886b..3fb886b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/headers.pri
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/headers.pri
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.cpp
new file mode 100644
index 0000000..1aad779
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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. 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 "ConservativeRoots.h"
+
+namespace JSC {
+
+inline bool isPointerAligned(void* p)
+{
+ return !((intptr_t)(p) & (sizeof(char*) - 1));
+}
+
+void ConservativeRoots::grow()
+{
+ size_t newCapacity = m_capacity == inlineCapacity ? nonInlineCapacity : m_capacity * 2;
+ JSCell** newRoots = static_cast<JSCell**>(OSAllocator::reserveAndCommit(newCapacity * sizeof(JSCell*)));
+ memcpy(newRoots, m_roots, m_size * sizeof(JSCell*));
+ if (m_roots != m_inlineRoots)
+ OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(JSCell*));
+ m_capacity = newCapacity;
+ m_roots = newRoots;
+}
+
+void ConservativeRoots::add(void* begin, void* end)
+{
+ ASSERT(begin <= end);
+ ASSERT((static_cast<char*>(end) - static_cast<char*>(begin)) < 0x1000000);
+ ASSERT(isPointerAligned(begin));
+ ASSERT(isPointerAligned(end));
+
+ for (char** it = static_cast<char**>(begin); it != static_cast<char**>(end); ++it)
+ add(*it);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.h
new file mode 100644
index 0000000..d078606
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/ConservativeRoots.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 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 ConservativeRoots_h
+#define ConservativeRoots_h
+
+#include "Heap.h"
+#include <wtf/OSAllocator.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+class JSCell;
+class Heap;
+
+// May contain duplicates.
+
+class ConservativeRoots {
+public:
+ ConservativeRoots(Heap*);
+ ~ConservativeRoots();
+
+ void add(void*);
+ void add(void* begin, void* end);
+
+ size_t size();
+ JSCell** roots();
+
+private:
+ static const size_t inlineCapacity = 128;
+ static const size_t nonInlineCapacity = 8192 / sizeof(JSCell*);
+
+ void grow();
+
+ Heap* m_heap;
+ JSCell** m_roots;
+ size_t m_size;
+ size_t m_capacity;
+ JSCell* m_inlineRoots[inlineCapacity];
+};
+
+inline ConservativeRoots::ConservativeRoots(Heap* heap)
+ : m_heap(heap)
+ , m_roots(m_inlineRoots)
+ , m_size(0)
+ , m_capacity(inlineCapacity)
+{
+}
+
+inline ConservativeRoots::~ConservativeRoots()
+{
+ if (m_roots != m_inlineRoots)
+ OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(JSCell*));
+}
+
+inline void ConservativeRoots::add(void* p)
+{
+ if (!m_heap->contains(p))
+ return;
+
+ if (m_size == m_capacity)
+ grow();
+
+ m_roots[m_size++] = reinterpret_cast<JSCell*>(p);
+}
+
+inline size_t ConservativeRoots::size()
+{
+ return m_size;
+}
+
+inline JSCell** ConservativeRoots::roots()
+{
+ return m_roots;
+}
+
+} // namespace JSC
+
+#endif // ConservativeRoots_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/Handle.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Handle.h
new file mode 100644
index 0000000..531d535
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Handle.h
@@ -0,0 +1,219 @@
+/*
+ * 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. 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 Handle_h
+#define Handle_h
+
+#include "WriteBarrier.h"
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+/*
+ A Handle is a smart pointer that updates automatically when the garbage
+ collector moves the object to which it points.
+
+ The base Handle class represents a temporary reference to a pointer whose
+ lifetime is guaranteed by something else.
+*/
+
+template <class T> class Handle;
+
+// Creating a JSValue Handle is invalid
+template <> class Handle<JSValue>;
+
+// Forward declare WeakGCMap
+template<typename KeyType, typename MappedType, typename FinalizerCallback, typename HashArg, typename KeyTraitsArg> class WeakGCMap;
+
+class HandleBase {
+ friend class HandleHeap;
+ friend struct JSCallbackObjectData;
+ template <typename KeyType, typename MappedType, typename FinalizerCallback, typename HashArg, typename KeyTraitsArg> friend class WeakGCMap;
+
+public:
+ bool operator!() const { return !m_slot || !*m_slot; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef JSValue (HandleBase::*UnspecifiedBoolType);
+ operator UnspecifiedBoolType*() const { return (m_slot && *m_slot) ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+
+protected:
+ HandleBase(HandleSlot slot)
+ : m_slot(slot)
+ {
+ }
+
+ void swap(HandleBase& other) { std::swap(m_slot, other.m_slot); }
+
+ HandleSlot slot() const { return m_slot; }
+ void setSlot(HandleSlot slot)
+ {
+ m_slot = slot;
+ }
+
+private:
+ HandleSlot m_slot;
+};
+
+template <typename T> struct HandleTypes {
+ typedef T* ExternalType;
+ static ExternalType getFromSlot(HandleSlot slot) { return (slot && *slot) ? reinterpret_cast<ExternalType>(slot->asCell()) : 0; }
+ static JSValue toJSValue(T* cell) { return reinterpret_cast<JSCell*>(cell); }
+ template <typename U> static void validateUpcast() { T* temp; temp = (U*)0; }
+};
+
+template <> struct HandleTypes<Unknown> {
+ typedef JSValue ExternalType;
+ static ExternalType getFromSlot(HandleSlot slot) { return slot ? *slot : JSValue(); }
+ static JSValue toJSValue(const JSValue& v) { return v; }
+ template <typename U> static void validateUpcast() {}
+};
+
+template <typename Base, typename T> struct HandleConverter {
+ T* operator->()
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie());
+#endif
+ return static_cast<Base*>(this)->get();
+ }
+ const T* operator->() const
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie());
+#endif
+ return static_cast<const Base*>(this)->get();
+ }
+
+ T* operator*()
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie());
+#endif
+ return static_cast<Base*>(this)->get();
+ }
+ const T* operator*() const
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie());
+#endif
+ return static_cast<const Base*>(this)->get();
+ }
+};
+
+template <typename Base> struct HandleConverter<Base, Unknown> {
+ Handle<JSObject> asObject() const;
+ bool isObject() const { return jsValue().isObject(); }
+ bool getNumber(double number) const { return jsValue().getNumber(number); }
+ UString getString(ExecState*) const;
+ bool isUndefinedOrNull() const { return jsValue().isUndefinedOrNull(); }
+
+private:
+ JSValue jsValue() const
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get().isZombie());
+#endif
+ return static_cast<const Base*>(this)->get();
+ }
+};
+
+template <typename T> class Handle : public HandleBase, public HandleConverter<Handle<T>, T> {
+public:
+ template <typename A, typename B> friend class HandleConverter;
+ typedef typename HandleTypes<T>::ExternalType ExternalType;
+ template <typename U> Handle(Handle<U> o)
+ {
+ typename HandleTypes<T>::template validateUpcast<U>();
+ setSlot(o.slot());
+ }
+
+ void swap(Handle& other) { HandleBase::swap(other); }
+
+ ExternalType get() const { return HandleTypes<T>::getFromSlot(this->slot()); }
+
+protected:
+ Handle(HandleSlot slot = 0)
+ : HandleBase(slot)
+ {
+ }
+
+private:
+ friend class HandleHeap;
+
+ static Handle<T> wrapSlot(HandleSlot slot)
+ {
+ return Handle<T>(slot);
+ }
+};
+
+template <typename Base> Handle<JSObject> HandleConverter<Base, Unknown>::asObject() const
+{
+ return Handle<JSObject>::wrapSlot(static_cast<const Base*>(this)->slot());
+}
+
+template <typename T, typename U> inline bool operator==(const Handle<T>& a, const Handle<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template <typename T, typename U> inline bool operator==(const Handle<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template <typename T, typename U> inline bool operator==(T* a, const Handle<U>& b)
+{
+ return a == b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const Handle<T>& a, const Handle<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const Handle<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template <typename T, typename U> inline bool operator!=(T* a, const Handle<U>& b)
+{
+ return a != b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const Handle<T>& a, JSValue b)
+{
+ return a.get() != b;
+}
+
+template <typename T, typename U> inline bool operator!=(JSValue a, const Handle<U>& b)
+{
+ return a != b.get();
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.cpp
new file mode 100644
index 0000000..9b05db2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.cpp
@@ -0,0 +1,174 @@
+/*
+ * 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. 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 "HandleHeap.h"
+
+#include "JSObject.h"
+
+namespace JSC {
+
+WeakHandleOwner::~WeakHandleOwner()
+{
+}
+
+bool WeakHandleOwner::isReachableFromOpaqueRoots(Handle<Unknown>, void*, SlotVisitor&)
+{
+ return false;
+}
+
+void WeakHandleOwner::finalize(Handle<Unknown>, void*)
+{
+}
+
+HandleHeap::HandleHeap(JSGlobalData* globalData)
+ : m_globalData(globalData)
+ , m_nextToFinalize(0)
+{
+ grow();
+}
+
+void HandleHeap::grow()
+{
+ Node* block = m_blockStack.grow();
+ for (int i = m_blockStack.blockLength - 1; i >= 0; --i) {
+ Node* node = &block[i];
+ new (node) Node(this);
+ m_freeList.push(node);
+ }
+}
+
+void HandleHeap::markStrongHandles(HeapRootVisitor& heapRootMarker)
+{
+ Node* end = m_strongList.end();
+ for (Node* node = m_strongList.begin(); node != end; node = node->next())
+ heapRootMarker.mark(node->slot());
+}
+
+void HandleHeap::markWeakHandles(HeapRootVisitor& heapRootVisitor)
+{
+ SlotVisitor& visitor = heapRootVisitor.visitor();
+
+ Node* end = m_weakList.end();
+ for (Node* node = m_weakList.begin(); node != end; node = node->next()) {
+ ASSERT(isValidWeakNode(node));
+ JSCell* cell = node->slot()->asCell();
+ if (Heap::isMarked(cell))
+ continue;
+
+ WeakHandleOwner* weakOwner = node->weakOwner();
+ if (!weakOwner)
+ continue;
+
+ if (!weakOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(node->slot()), node->weakOwnerContext(), visitor))
+ continue;
+
+ heapRootVisitor.mark(node->slot());
+ }
+}
+
+void HandleHeap::finalizeWeakHandles()
+{
+ Node* end = m_weakList.end();
+ for (Node* node = m_weakList.begin(); node != end; node = m_nextToFinalize) {
+ m_nextToFinalize = node->next();
+
+ ASSERT(isValidWeakNode(node));
+ JSCell* cell = node->slot()->asCell();
+ if (Heap::isMarked(cell))
+ continue;
+
+ if (WeakHandleOwner* weakOwner = node->weakOwner()) {
+ weakOwner->finalize(Handle<Unknown>::wrapSlot(node->slot()), node->weakOwnerContext());
+ if (m_nextToFinalize != node->next()) // Owner deallocated node.
+ continue;
+ }
+
+ *node->slot() = JSValue();
+ SentinelLinkedList<Node>::remove(node);
+ m_immediateList.push(node);
+ }
+
+ m_nextToFinalize = 0;
+}
+
+void HandleHeap::writeBarrier(HandleSlot slot, const JSValue& value)
+{
+ ASSERT(!m_nextToFinalize); // Forbid assignment to handles during the finalization phase, since it would violate many GC invariants.
+
+ if (!value == !*slot && slot->isCell() == value.isCell())
+ return;
+
+ Node* node = toNode(slot);
+ SentinelLinkedList<Node>::remove(node);
+ if (!value || !value.isCell()) {
+ m_immediateList.push(node);
+ return;
+ }
+
+ if (node->isWeak()) {
+ m_weakList.push(node);
+ return;
+ }
+
+ m_strongList.push(node);
+}
+
+unsigned HandleHeap::protectedGlobalObjectCount()
+{
+ unsigned count = 0;
+ Node* end = m_strongList.end();
+ for (Node* node = m_strongList.begin(); node != end; node = node->next()) {
+ JSValue value = *node->slot();
+ if (value.isObject() && asObject(value.asCell())->isGlobalObject())
+ count++;
+ }
+ return count;
+}
+
+#if !ASSERT_DISABLED
+bool HandleHeap::isValidWeakNode(Node* node)
+{
+ if (!node->isWeak())
+ return false;
+
+ JSValue value = *node->slot();
+ if (!value || !value.isCell())
+ return false;
+
+ JSCell* cell = value.asCell();
+ if (!cell || !cell->structure())
+ return false;
+
+#if ENABLE(JSC_ZOMBIES)
+ if (cell->isZombie())
+ return false;
+#endif
+
+ return true;
+}
+#endif
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.h
new file mode 100644
index 0000000..5c151c3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleHeap.h
@@ -0,0 +1,277 @@
+/*
+ * 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. 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 HandleHeap_h
+#define HandleHeap_h
+
+#include "BlockStack.h"
+#include "Handle.h"
+#include "SentinelLinkedList.h"
+#include "SinglyLinkedList.h"
+
+namespace JSC {
+
+class HandleHeap;
+class HeapRootVisitor;
+class JSGlobalData;
+class JSValue;
+class MarkStack;
+class TypeCounter;
+typedef MarkStack SlotVisitor;
+
+class WeakHandleOwner {
+public:
+ virtual ~WeakHandleOwner();
+ virtual bool isReachableFromOpaqueRoots(Handle<Unknown>, void* context, SlotVisitor&);
+ virtual void finalize(Handle<Unknown>, void* context);
+};
+
+class HandleHeap {
+public:
+ static HandleHeap* heapFor(HandleSlot);
+
+ HandleHeap(JSGlobalData*);
+
+ JSGlobalData* globalData();
+
+ HandleSlot allocate();
+ void deallocate(HandleSlot);
+
+ void makeWeak(HandleSlot, WeakHandleOwner* = 0, void* context = 0);
+ HandleSlot copyWeak(HandleSlot);
+
+ void markStrongHandles(HeapRootVisitor&);
+ void markWeakHandles(HeapRootVisitor&);
+ void finalizeWeakHandles();
+
+ void writeBarrier(HandleSlot, const JSValue&);
+
+#if !ASSERT_DISABLED
+ bool hasWeakOwner(HandleSlot, WeakHandleOwner*);
+#endif
+
+ unsigned protectedGlobalObjectCount();
+ void protectedObjectTypeCounts(TypeCounter&);
+
+private:
+ class Node {
+ public:
+ Node(WTF::SentinelTag);
+ Node(HandleHeap*);
+
+ HandleSlot slot();
+ HandleHeap* handleHeap();
+
+ void makeWeak(WeakHandleOwner*, void* context);
+ bool isWeak();
+
+ WeakHandleOwner* weakOwner();
+ void* weakOwnerContext();
+
+ void setPrev(Node*);
+ Node* prev();
+
+ void setNext(Node*);
+ Node* next();
+
+ private:
+ WeakHandleOwner* emptyWeakOwner();
+
+ JSValue m_value;
+ HandleHeap* m_handleHeap;
+ WeakHandleOwner* m_weakOwner;
+ void* m_weakOwnerContext;
+ Node* m_prev;
+ Node* m_next;
+ };
+
+ static HandleSlot toHandle(Node*);
+ static Node* toNode(HandleSlot);
+
+ void grow();
+
+#if !ASSERT_DISABLED
+ bool isValidWeakNode(Node*);
+#endif
+
+ JSGlobalData* m_globalData;
+ BlockStack<Node> m_blockStack;
+
+ SentinelLinkedList<Node> m_strongList;
+ SentinelLinkedList<Node> m_weakList;
+ SentinelLinkedList<Node> m_immediateList;
+ SinglyLinkedList<Node> m_freeList;
+ Node* m_nextToFinalize;
+};
+
+inline HandleHeap* HandleHeap::heapFor(HandleSlot handle)
+{
+ return toNode(handle)->handleHeap();
+}
+
+inline JSGlobalData* HandleHeap::globalData()
+{
+ return m_globalData;
+}
+
+inline HandleSlot HandleHeap::toHandle(Node* node)
+{
+ return reinterpret_cast<HandleSlot>(node);
+}
+
+inline HandleHeap::Node* HandleHeap::toNode(HandleSlot handle)
+{
+ return reinterpret_cast<Node*>(handle);
+}
+
+inline HandleSlot HandleHeap::allocate()
+{
+ if (m_freeList.isEmpty())
+ grow();
+
+ Node* node = m_freeList.pop();
+ new (node) Node(this);
+ m_immediateList.push(node);
+ return toHandle(node);
+}
+
+inline void HandleHeap::deallocate(HandleSlot handle)
+{
+ Node* node = toNode(handle);
+ if (node == m_nextToFinalize) {
+ m_nextToFinalize = node->next();
+ ASSERT(m_nextToFinalize->next());
+ }
+
+ SentinelLinkedList<Node>::remove(node);
+ m_freeList.push(node);
+}
+
+inline HandleSlot HandleHeap::copyWeak(HandleSlot other)
+{
+ Node* node = toNode(allocate());
+ node->makeWeak(toNode(other)->weakOwner(), toNode(other)->weakOwnerContext());
+ writeBarrier(node->slot(), *other);
+ *node->slot() = *other;
+ return toHandle(node);
+}
+
+inline void HandleHeap::makeWeak(HandleSlot handle, WeakHandleOwner* weakOwner, void* context)
+{
+ Node* node = toNode(handle);
+ node->makeWeak(weakOwner, context);
+
+ SentinelLinkedList<Node>::remove(node);
+ if (!*handle || !handle->isCell()) {
+ m_immediateList.push(node);
+ return;
+ }
+
+ m_weakList.push(node);
+}
+
+#if !ASSERT_DISABLED
+inline bool HandleHeap::hasWeakOwner(HandleSlot handle, WeakHandleOwner* weakOwner)
+{
+ return toNode(handle)->weakOwner() == weakOwner;
+}
+#endif
+
+inline HandleHeap::Node::Node(HandleHeap* handleHeap)
+ : m_handleHeap(handleHeap)
+ , m_weakOwner(0)
+ , m_weakOwnerContext(0)
+{
+}
+
+inline HandleHeap::Node::Node(WTF::SentinelTag)
+ : m_handleHeap(0)
+ , m_weakOwner(0)
+ , m_weakOwnerContext(0)
+{
+}
+
+inline HandleSlot HandleHeap::Node::slot()
+{
+ return &m_value;
+}
+
+inline HandleHeap* HandleHeap::Node::handleHeap()
+{
+ return m_handleHeap;
+}
+
+inline void HandleHeap::Node::makeWeak(WeakHandleOwner* weakOwner, void* context)
+{
+ m_weakOwner = weakOwner ? weakOwner : emptyWeakOwner();
+ m_weakOwnerContext = context;
+}
+
+inline bool HandleHeap::Node::isWeak()
+{
+ return m_weakOwner; // True for emptyWeakOwner().
+}
+
+inline WeakHandleOwner* HandleHeap::Node::weakOwner()
+{
+ return m_weakOwner == emptyWeakOwner() ? 0 : m_weakOwner; // 0 for emptyWeakOwner().
+}
+
+inline void* HandleHeap::Node::weakOwnerContext()
+{
+ ASSERT(weakOwner());
+ return m_weakOwnerContext;
+}
+
+inline void HandleHeap::Node::setPrev(Node* prev)
+{
+ m_prev = prev;
+}
+
+inline HandleHeap::Node* HandleHeap::Node::prev()
+{
+ return m_prev;
+}
+
+inline void HandleHeap::Node::setNext(Node* next)
+{
+ m_next = next;
+}
+
+inline HandleHeap::Node* HandleHeap::Node::next()
+{
+ return m_next;
+}
+
+// Sentinel to indicate that a node is weak, but its owner has no meaningful
+// callbacks. This allows us to optimize by skipping such nodes.
+inline WeakHandleOwner* HandleHeap::Node::emptyWeakOwner()
+{
+ return reinterpret_cast<WeakHandleOwner*>(-1);
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.cpp
new file mode 100644
index 0000000..ada4f99
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.cpp
@@ -0,0 +1,63 @@
+/*
+ * 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 "HandleStack.h"
+
+#include "MarkStack.h"
+
+namespace JSC {
+
+HandleStack::HandleStack()
+#ifndef NDEBUG
+ : m_scopeDepth(0)
+#endif
+{
+ grow();
+}
+
+void HandleStack::mark(HeapRootVisitor& heapRootMarker)
+{
+ const Vector<HandleSlot>& blocks = m_blockStack.blocks();
+ size_t blockLength = m_blockStack.blockLength;
+
+ int end = blocks.size() - 1;
+ for (int i = 0; i < end; ++i) {
+ HandleSlot block = blocks[i];
+ heapRootMarker.mark(block, blockLength);
+ }
+ HandleSlot block = blocks[end];
+ heapRootMarker.mark(block, m_frame.m_next - block);
+}
+
+void HandleStack::grow()
+{
+ HandleSlot block = m_blockStack.grow();
+ m_frame.m_next = block;
+ m_frame.m_end = block + m_blockStack.blockLength;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.h
new file mode 100644
index 0000000..115784a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/HandleStack.h
@@ -0,0 +1,129 @@
+/*
+ * 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 HandleStack_h
+#define HandleStack_h
+
+#include "Assertions.h"
+#include "BlockStack.h"
+#include "Handle.h"
+
+#include <wtf/UnusedParam.h>
+
+namespace JSC {
+
+class LocalScope;
+class HeapRootVisitor;
+
+class HandleStack {
+public:
+ class Frame {
+ public:
+ HandleSlot m_next;
+ HandleSlot m_end;
+ };
+
+ HandleStack();
+
+ void enterScope(Frame&);
+ void leaveScope(Frame&);
+
+ HandleSlot push();
+
+ void mark(HeapRootVisitor&);
+
+private:
+ void grow();
+ void zapTo(Frame&);
+ HandleSlot findFirstAfter(HandleSlot);
+
+#ifndef NDEBUG
+ size_t m_scopeDepth;
+#endif
+ BlockStack<JSValue> m_blockStack;
+ Frame m_frame;
+};
+
+inline void HandleStack::enterScope(Frame& lastFrame)
+{
+#ifndef NDEBUG
+ ++m_scopeDepth;
+#endif
+
+ lastFrame = m_frame;
+}
+
+
+
+inline void HandleStack::zapTo(Frame& lastFrame)
+{
+#ifdef NDEBUG
+ UNUSED_PARAM(lastFrame);
+#else
+ const Vector<HandleSlot>& blocks = m_blockStack.blocks();
+
+ if (lastFrame.m_end != m_frame.m_end) { // Zapping to a frame in a different block.
+ int i = blocks.size() - 1;
+ for ( ; blocks[i] + m_blockStack.blockLength != lastFrame.m_end; --i) {
+ for (int j = m_blockStack.blockLength - 1; j >= 0; --j)
+ blocks[i][j] = JSValue();
+ }
+
+ for (HandleSlot it = blocks[i] + m_blockStack.blockLength - 1; it != lastFrame.m_next - 1; --it)
+ *it = JSValue();
+
+ return;
+ }
+
+ for (HandleSlot it = m_frame.m_next - 1; it != lastFrame.m_next - 1; --it)
+ *it = JSValue();
+#endif
+}
+
+inline void HandleStack::leaveScope(Frame& lastFrame)
+{
+#ifndef NDEBUG
+ --m_scopeDepth;
+#endif
+
+ zapTo(lastFrame);
+
+ if (lastFrame.m_end != m_frame.m_end) // Popping to a frame in a different block.
+ m_blockStack.shrink(lastFrame.m_end);
+
+ m_frame = lastFrame;
+}
+
+inline HandleSlot HandleStack::push()
+{
+ ASSERT(m_scopeDepth); // Creating a Local outside of a LocalScope is a memory leak.
+ if (m_frame.m_next == m_frame.m_end)
+ grow();
+ return m_frame.m_next++;
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.cpp
new file mode 100644
index 0000000..e3ed6f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.cpp
@@ -0,0 +1,436 @@
+/*
+ * 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 "Heap.h"
+
+#include "CodeBlock.h"
+#include "ConservativeRoots.h"
+#include "GCActivityCallback.h"
+#include "Interpreter.h"
+#include "JSGlobalData.h"
+#include "JSGlobalObject.h"
+#include "JSLock.h"
+#include "JSONObject.h"
+#include "Tracing.h"
+#include <algorithm>
+
+#define COLLECT_ON_EVERY_SLOW_ALLOCATION 0
+
+using namespace std;
+
+namespace JSC {
+
+const size_t minBytesPerCycle = 512 * 1024;
+
+Heap::Heap(JSGlobalData* globalData)
+ : m_operationInProgress(NoOperation)
+ , m_markedSpace(globalData)
+ , m_markListSet(0)
+ , m_activityCallback(DefaultGCActivityCallback::create(this))
+ , m_globalData(globalData)
+ , m_machineThreads(this)
+ , m_markStack(globalData->jsArrayVPtr)
+ , m_handleHeap(globalData)
+ , m_extraCost(0)
+{
+ m_markedSpace.setHighWaterMark(minBytesPerCycle);
+ (*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(m_operationInProgress == NoOperation);
+
+ // 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);
+
+#if ENABLE(JIT)
+ m_globalData->jitStubs->clearHostFunctionStubs();
+#endif
+
+ delete m_markListSet;
+ m_markListSet = 0;
+ m_markedSpace.clearMarks();
+ m_handleHeap.finalizeWeakHandles();
+ m_markedSpace.destroy();
+
+ m_globalData = 0;
+}
+
+void Heap::reportExtraMemoryCostSlowCase(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_extraCost > maxExtraCost && m_extraCost > m_markedSpace.highWaterMark() / 2)
+ collectAllGarbage();
+ m_extraCost += cost;
+}
+
+void* Heap::allocateSlowCase(size_t bytes)
+{
+ ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
+ ASSERT(JSLock::lockCount() > 0);
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+ ASSERT(bytes <= MarkedSpace::maxCellSize);
+ ASSERT(m_operationInProgress == NoOperation);
+
+#if COLLECT_ON_EVERY_SLOW_ALLOCATION
+ collectAllGarbage();
+ ASSERT(m_operationInProgress == NoOperation);
+#endif
+
+ reset(DoNotSweep);
+
+ m_operationInProgress = Allocation;
+ void* result = m_markedSpace.allocate(bytes);
+ m_operationInProgress = NoOperation;
+
+ ASSERT(result);
+ return result;
+}
+
+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(HeapRootVisitor& heapRootMarker)
+{
+ ProtectCountSet::iterator end = m_protectedValues.end();
+ for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it)
+ heapRootMarker.mark(&it->first);
+}
+
+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(HeapRootVisitor& heapRootMarker)
+{
+ 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)
+ heapRootMarker.mark(&vectorIt->first);
+ }
+ }
+}
+
+inline RegisterFile& Heap::registerFile()
+{
+ return m_globalData->interpreter->registerFile();
+}
+
+void Heap::markRoots()
+{
+#ifndef NDEBUG
+ if (m_globalData->isSharedInstance()) {
+ ASSERT(JSLock::lockCount() > 0);
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+ }
+#endif
+
+ void* dummy;
+
+ ASSERT(m_operationInProgress == NoOperation);
+ if (m_operationInProgress != NoOperation)
+ CRASH();
+
+ m_operationInProgress = Collection;
+
+ MarkStack& visitor = m_markStack;
+ HeapRootVisitor heapRootMarker(visitor);
+
+ // We gather conservative roots before clearing mark bits because
+ // conservative gathering uses the mark bits from our last mark pass to
+ // determine whether a reference is valid.
+ ConservativeRoots machineThreadRoots(this);
+ m_machineThreads.gatherConservativeRoots(machineThreadRoots, &dummy);
+
+ ConservativeRoots registerFileRoots(this);
+ registerFile().gatherConservativeRoots(registerFileRoots);
+
+ m_markedSpace.clearMarks();
+
+ visitor.append(machineThreadRoots);
+ visitor.drain();
+
+ visitor.append(registerFileRoots);
+ visitor.drain();
+
+ markProtectedObjects(heapRootMarker);
+ visitor.drain();
+
+ markTempSortVectors(heapRootMarker);
+ visitor.drain();
+
+ if (m_markListSet && m_markListSet->size())
+ MarkedArgumentBuffer::markLists(heapRootMarker, *m_markListSet);
+ if (m_globalData->exception)
+ heapRootMarker.mark(&m_globalData->exception);
+ visitor.drain();
+
+ m_handleHeap.markStrongHandles(heapRootMarker);
+ visitor.drain();
+
+ m_handleStack.mark(heapRootMarker);
+ visitor.drain();
+
+ // Mark the small strings cache as late as possible, since it will clear
+ // itself if nothing else has marked it.
+ // FIXME: Change the small strings cache to use Weak<T>.
+ m_globalData->smallStrings.visitChildren(heapRootMarker);
+ visitor.drain();
+
+ // Weak handles must be marked last, because their owners use the set of
+ // opaque roots to determine reachability.
+ int lastOpaqueRootCount;
+ do {
+ lastOpaqueRootCount = visitor.opaqueRootCount();
+ m_handleHeap.markWeakHandles(heapRootMarker);
+ visitor.drain();
+ // If the set of opaque roots has grown, more weak handles may have become reachable.
+ } while (lastOpaqueRootCount != visitor.opaqueRootCount());
+
+ visitor.reset();
+
+ m_operationInProgress = NoOperation;
+}
+
+size_t Heap::objectCount() const
+{
+ return m_markedSpace.objectCount();
+}
+
+size_t Heap::size() const
+{
+ return m_markedSpace.size();
+}
+
+size_t Heap::capacity() const
+{
+ return m_markedSpace.capacity();
+}
+
+size_t Heap::globalObjectCount()
+{
+ return m_globalData->globalObjectCount;
+}
+
+size_t Heap::protectedGlobalObjectCount()
+{
+ size_t count = m_handleHeap.protectedGlobalObjectCount();
+
+ ProtectCountSet::iterator end = m_protectedValues.end();
+ for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it) {
+ if (it->first->isObject() && asObject(it->first)->isGlobalObject())
+ count++;
+ }
+
+ return count;
+}
+
+size_t Heap::protectedObjectCount()
+{
+ return m_protectedValues.size();
+}
+
+class TypeCounter {
+public:
+ TypeCounter();
+ void operator()(JSCell*);
+ PassOwnPtr<TypeCountSet> take();
+
+private:
+ const char* typeName(JSCell*);
+ OwnPtr<TypeCountSet> m_typeCountSet;
+};
+
+inline TypeCounter::TypeCounter()
+ : m_typeCountSet(adoptPtr(new TypeCountSet))
+{
+}
+
+inline const char* TypeCounter::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 (const ClassInfo* info = cell->classInfo())
+ return info->className;
+ if (!cell->isObject())
+ return "[empty cell]";
+ return "Object";
+}
+
+inline void TypeCounter::operator()(JSCell* cell)
+{
+ m_typeCountSet->add(typeName(cell));
+}
+
+inline PassOwnPtr<TypeCountSet> TypeCounter::take()
+{
+ return m_typeCountSet.release();
+}
+
+PassOwnPtr<TypeCountSet> Heap::protectedObjectTypeCounts()
+{
+ TypeCounter typeCounter;
+
+ ProtectCountSet::iterator end = m_protectedValues.end();
+ for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it)
+ typeCounter(it->first);
+ m_handleHeap.protectedObjectTypeCounts(typeCounter);
+
+ return typeCounter.take();
+}
+
+void HandleHeap::protectedObjectTypeCounts(TypeCounter& typeCounter)
+{
+ Node* end = m_strongList.end();
+ for (Node* node = m_strongList.begin(); node != end; node = node->next()) {
+ JSValue value = *node->slot();
+ if (value && value.isCell())
+ typeCounter(value.asCell());
+ }
+}
+
+PassOwnPtr<TypeCountSet> Heap::objectTypeCounts()
+{
+ TypeCounter typeCounter;
+ forEach(typeCounter);
+ return typeCounter.take();
+}
+
+bool Heap::isBusy()
+{
+ return m_operationInProgress != NoOperation;
+}
+
+void Heap::collectAllGarbage()
+{
+ if (!m_globalData->dynamicGlobalObject)
+ m_globalData->recompileAllJSFunctions();
+
+ reset(DoSweep);
+}
+
+void Heap::reset(SweepToggle sweepToggle)
+{
+ ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
+ JAVASCRIPTCORE_GC_BEGIN();
+
+ markRoots();
+ m_handleHeap.finalizeWeakHandles();
+
+ JAVASCRIPTCORE_GC_MARKED();
+
+ m_markedSpace.reset();
+ m_extraCost = 0;
+
+#if ENABLE(JSC_ZOMBIES)
+ sweepToggle = DoSweep;
+#endif
+
+ if (sweepToggle == DoSweep) {
+ m_markedSpace.sweep();
+ m_markedSpace.shrink();
+ }
+
+ // To avoid pathological GC churn in large heaps, we set the allocation high
+ // water mark to be proportional to the current size of the heap. The exact
+ // proportion is a bit arbitrary. A 2X multiplier gives a 1:1 (heap size :
+ // new bytes allocated) proportion, and seems to work well in benchmarks.
+ size_t proportionalBytes = 2 * m_markedSpace.size();
+ m_markedSpace.setHighWaterMark(max(proportionalBytes, minBytesPerCycle));
+
+ JAVASCRIPTCORE_GC_END();
+
+ (*m_activityCallback)();
+}
+
+void Heap::setActivityCallback(PassOwnPtr<GCActivityCallback> activityCallback)
+{
+ m_activityCallback = activityCallback;
+}
+
+GCActivityCallback* Heap::activityCallback()
+{
+ return m_activityCallback.get();
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.h
new file mode 100644
index 0000000..b85eaa3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Heap.h
@@ -0,0 +1,179 @@
+/*
+ * 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 Heap_h
+#define Heap_h
+
+#include "HandleHeap.h"
+#include "HandleStack.h"
+#include "MarkStack.h"
+#include "MarkedSpace.h"
+#include <wtf/Forward.h>
+#include <wtf/HashCountedSet.h>
+#include <wtf/HashSet.h>
+
+namespace JSC {
+
+ class GCActivityCallback;
+ class GlobalCodeBlock;
+ class HeapRootVisitor;
+ class JSCell;
+ class JSGlobalData;
+ class JSValue;
+ class LiveObjectIterator;
+ class MarkStack;
+ class MarkedArgumentBuffer;
+ class RegisterFile;
+ class UString;
+ class WeakGCHandlePool;
+ typedef MarkStack SlotVisitor;
+
+ typedef std::pair<JSValue, UString> ValueStringPair;
+ typedef HashCountedSet<JSCell*> ProtectCountSet;
+ typedef HashCountedSet<const char*> TypeCountSet;
+
+ enum OperationInProgress { NoOperation, Allocation, Collection };
+
+ class Heap {
+ WTF_MAKE_NONCOPYABLE(Heap);
+ public:
+ static Heap* heap(JSValue); // 0 for immediate values
+ static Heap* heap(JSCell*);
+
+ static bool isMarked(const JSCell*);
+ static bool testAndSetMarked(const JSCell*);
+ static void setMarked(JSCell*);
+
+ Heap(JSGlobalData*);
+ ~Heap();
+ void destroy(); // JSGlobalData must call destroy() before ~Heap().
+
+ JSGlobalData* globalData() const { return m_globalData; }
+ MarkedSpace& markedSpace() { return m_markedSpace; }
+ MachineThreads& machineThreads() { return m_machineThreads; }
+
+ GCActivityCallback* activityCallback();
+ void setActivityCallback(PassOwnPtr<GCActivityCallback>);
+
+ bool isBusy(); // true if an allocation or collection is in progress
+ void* allocate(size_t);
+ void collectAllGarbage();
+
+ void reportExtraMemoryCost(size_t cost);
+
+ void protect(JSValue);
+ bool unprotect(JSValue); // True when the protect count drops to 0.
+
+ bool contains(void*);
+
+ size_t size() const;
+ size_t capacity() const;
+ size_t objectCount() const;
+ size_t globalObjectCount();
+ size_t protectedObjectCount();
+ size_t protectedGlobalObjectCount();
+ PassOwnPtr<TypeCountSet> protectedObjectTypeCounts();
+ PassOwnPtr<TypeCountSet> objectTypeCounts();
+
+ void pushTempSortVector(Vector<ValueStringPair>*);
+ void popTempSortVector(Vector<ValueStringPair>*);
+
+ HashSet<MarkedArgumentBuffer*>& markListSet() { if (!m_markListSet) m_markListSet = new HashSet<MarkedArgumentBuffer*>; return *m_markListSet; }
+
+ template <typename Functor> void forEach(Functor&);
+
+ HandleSlot allocateGlobalHandle() { return m_handleHeap.allocate(); }
+ HandleSlot allocateLocalHandle() { return m_handleStack.push(); }
+
+ HandleStack* handleStack() { return &m_handleStack; }
+
+ private:
+ friend class JSGlobalData;
+
+ static const size_t minExtraCost = 256;
+ static const size_t maxExtraCost = 1024 * 1024;
+
+ void* allocateSlowCase(size_t);
+ void reportExtraMemoryCostSlowCase(size_t);
+
+ void markRoots();
+ void markProtectedObjects(HeapRootVisitor&);
+ void markTempSortVectors(HeapRootVisitor&);
+
+ enum SweepToggle { DoNotSweep, DoSweep };
+ void reset(SweepToggle);
+
+ RegisterFile& registerFile();
+
+ OperationInProgress m_operationInProgress;
+ MarkedSpace m_markedSpace;
+
+ ProtectCountSet m_protectedValues;
+ Vector<Vector<ValueStringPair>* > m_tempSortingVectors;
+
+ HashSet<MarkedArgumentBuffer*>* m_markListSet;
+
+ OwnPtr<GCActivityCallback> m_activityCallback;
+
+ JSGlobalData* m_globalData;
+
+ MachineThreads m_machineThreads;
+ MarkStack m_markStack;
+ HandleHeap m_handleHeap;
+ HandleStack m_handleStack;
+
+ size_t m_extraCost;
+ };
+
+ inline bool Heap::isMarked(const JSCell* cell)
+ {
+ return MarkedSpace::isMarked(cell);
+ }
+
+ inline bool Heap::testAndSetMarked(const JSCell* cell)
+ {
+ return MarkedSpace::testAndSetMarked(cell);
+ }
+
+ inline void Heap::setMarked(JSCell* cell)
+ {
+ MarkedSpace::setMarked(cell);
+ }
+
+ inline bool Heap::contains(void* p)
+ {
+ return m_markedSpace.contains(p);
+ }
+
+ inline void Heap::reportExtraMemoryCost(size_t cost)
+ {
+ if (cost > minExtraCost)
+ reportExtraMemoryCostSlowCase(cost);
+ }
+
+ template <typename Functor> inline void Heap::forEach(Functor& functor)
+ {
+ m_markedSpace.forEach(functor);
+ }
+
+} // namespace JSC
+
+#endif // Heap_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/Local.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Local.h
new file mode 100644
index 0000000..ac7d136
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Local.h
@@ -0,0 +1,153 @@
+/*
+ * 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 Local_h
+#define Local_h
+
+#include "Handle.h"
+#include "JSGlobalData.h"
+
+/*
+ A strongly referenced handle whose lifetime is temporary, limited to a given
+ LocalScope. Use Locals for local values on the stack. It is an error to
+ create a Local outside of any LocalScope.
+*/
+
+namespace JSC {
+
+template <typename T> class Local : public Handle<T> {
+ friend class LocalScope;
+ using Handle<T>::slot;
+
+public:
+ typedef typename Handle<T>::ExternalType ExternalType;
+
+ Local(JSGlobalData&, ExternalType = ExternalType());
+ Local(JSGlobalData&, Handle<T>);
+ Local(const Local<T>&); // Adopting constructor. Used to return a Local to a calling function.
+
+ Local& operator=(ExternalType);
+ Local& operator=(Handle<T>);
+
+private:
+ Local(HandleSlot, ExternalType); // Used by LocalScope::release() to move a Local to a containing scope.
+ void set(ExternalType);
+};
+
+template <typename T> inline Local<T>::Local(JSGlobalData& globalData, ExternalType value)
+ : Handle<T>(globalData.allocateLocalHandle())
+{
+ set(value);
+}
+
+template <typename T> inline Local<T>::Local(JSGlobalData& globalData, Handle<T> other)
+ : Handle<T>(globalData.allocateLocalHandle())
+{
+ set(other.get());
+}
+
+template <typename T> inline Local<T>::Local(const Local<T>& other)
+ : Handle<T>(other.slot())
+{
+ const_cast<Local<T>&>(other).setSlot(0); // Prevent accidental sharing.
+}
+
+template <typename T> inline Local<T>::Local(HandleSlot slot, ExternalType value)
+ : Handle<T>(slot, value)
+{
+}
+
+template <typename T> inline Local<T>& Local<T>::operator=(ExternalType value)
+{
+ set(value);
+ return *this;
+}
+
+template <typename T> inline Local<T>& Local<T>::operator=(Handle<T> other)
+{
+ set(other.get());
+ return *this;
+}
+
+template <typename T> inline void Local<T>::set(ExternalType externalType)
+{
+ ASSERT(slot());
+ ASSERT(!HandleTypes<T>::toJSValue(externalType) || !HandleTypes<T>::toJSValue(externalType).isCell() || Heap::isMarked(HandleTypes<T>::toJSValue(externalType).asCell()));
+ *slot() = externalType;
+}
+
+
+template <typename T, unsigned inlineCapacity = 0> class LocalStack {
+ typedef typename Handle<T>::ExternalType ExternalType;
+public:
+ LocalStack(JSGlobalData& globalData)
+ : m_globalData(&globalData)
+ , m_count(0)
+ {
+ }
+
+ ExternalType peek() const
+ {
+ ASSERT(m_count > 0);
+ return m_stack[m_count - 1].get();
+ }
+
+ ExternalType pop()
+ {
+ ASSERT(m_count > 0);
+ return m_stack[--m_count].get();
+ }
+
+ void push(ExternalType value)
+ {
+ if (m_count == m_stack.size())
+ m_stack.append(Local<T>(*m_globalData, value));
+ else
+ m_stack[m_count] = value;
+ m_count++;
+ }
+
+ bool isEmpty() const { return !m_count; }
+ unsigned size() const { return m_count; }
+
+private:
+ RefPtr<JSGlobalData> m_globalData;
+ Vector<Local<T>, inlineCapacity> m_stack;
+ unsigned m_count;
+};
+
+}
+
+namespace WTF {
+
+template<typename T> struct VectorTraits<JSC::Local<T> > : SimpleClassVectorTraits {
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = false;
+ static const bool canCompareWithMemcmp = false;
+};
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/LocalScope.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/LocalScope.h
new file mode 100644
index 0000000..cd27b32
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/LocalScope.h
@@ -0,0 +1,78 @@
+/*
+ * 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 LocalScope_h
+#define LocalScope_h
+
+#include "HandleStack.h"
+#include "Local.h"
+
+namespace JSC {
+/*
+ A LocalScope is a temporary scope in which Locals are allocated. When a
+ LocalScope goes out of scope, all the Locals created in it are destroyed.
+
+ LocalScope is similar in concept to NSAutoreleasePool.
+*/
+
+class JSGlobalData;
+
+class LocalScope {
+public:
+ explicit LocalScope(JSGlobalData&);
+ ~LocalScope();
+
+ template <typename T> Local<T> release(Local<T>); // Destroys all other locals in the scope.
+
+private:
+ HandleStack* m_handleStack;
+ HandleStack::Frame m_lastFrame;
+};
+
+inline LocalScope::LocalScope(JSGlobalData& globalData)
+ : m_handleStack(globalData.heap.handleStack())
+{
+ m_handleStack->enterScope(m_lastFrame);
+}
+
+inline LocalScope::~LocalScope()
+{
+ m_handleStack->leaveScope(m_lastFrame);
+}
+
+template <typename T> Local<T> LocalScope::release(Local<T> local)
+{
+ typename Local<T>::ExternalType ptr = local.get();
+
+ m_handleStack->leaveScope(m_lastFrame);
+ HandleSlot slot = m_handleStack->push();
+ m_handleStack->enterScope(m_lastFrame);
+
+ return Local<T>(slot, ptr);
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp
new file mode 100644
index 0000000..73a3db6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp
@@ -0,0 +1,493 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2009 Acision BV. 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 "MachineStackMarker.h"
+
+#include "ConservativeRoots.h"
+#include "Heap.h"
+#include "JSArray.h"
+#include "JSGlobalData.h"
+#include <setjmp.h>
+#include <stdlib.h>
+#include <wtf/StdLibExtras.h>
+
+#if USE(PTHREAD_BASED_QT) && !defined(WTF_USE_PTHREADS)
+#define WTF_USE_PTHREADS 1
+#endif
+
+#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
+
+#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
+#include <signal.h>
+#ifndef SA_RESTART
+#error MachineThreads requires SA_RESTART
+#endif
+#endif
+
+#endif
+
+using namespace WTF;
+
+namespace JSC {
+
+static inline void swapIfBackwards(void*& begin, void*& end)
+{
+#if OS(WINCE)
+ if (begin <= end)
+ return;
+ std::swap(begin, end);
+#else
+UNUSED_PARAM(begin);
+UNUSED_PARAM(end);
+#endif
+}
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+#if OS(DARWIN)
+typedef mach_port_t PlatformThread;
+#elif OS(WINDOWS)
+typedef HANDLE PlatformThread;
+#elif USE(PTHREADS)
+typedef pthread_t PlatformThread;
+static const int SigThreadSuspendResume = SIGUSR2;
+
+static void pthreadSignalHandlerSuspendResume(int signo)
+{
+ sigset_t signalSet;
+ sigemptyset(&signalSet);
+ sigaddset(&signalSet, SigThreadSuspendResume);
+ sigsuspend(&signalSet);
+}
+#endif
+
+class MachineThreads::Thread {
+public:
+ Thread(pthread_t pthread, const PlatformThread& platThread, void* base)
+ : posixThread(pthread)
+ , platformThread(platThread)
+ , stackBase(base)
+ {
+#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
+ struct sigaction action;
+ action.sa_handler = pthreadSignalHandlerSuspendResume;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = SA_RESTART;
+ sigaction(SigThreadSuspendResume, &action, 0);
+
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SigThreadSuspendResume);
+ pthread_sigmask(SIG_UNBLOCK, &mask, 0);
+#endif
+ }
+
+ Thread* next;
+ pthread_t posixThread;
+ PlatformThread platformThread;
+ void* stackBase;
+};
+
+#endif
+
+MachineThreads::MachineThreads(Heap* heap)
+ : m_heap(heap)
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ , m_registeredThreads(0)
+ , m_threadSpecific(0)
+#endif
+{
+}
+
+MachineThreads::~MachineThreads()
+{
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ if (m_threadSpecific) {
+ int error = pthread_key_delete(m_threadSpecific);
+ ASSERT_UNUSED(error, !error);
+ }
+
+ MutexLocker registeredThreadsLock(m_registeredThreadsMutex);
+ for (Thread* t = m_registeredThreads; t;) {
+ Thread* next = t->next;
+ delete t;
+ t = next;
+ }
+#endif
+}
+
+#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());
+#elif USE(PTHREADS)
+ return pthread_self();
+#endif
+}
+
+void MachineThreads::makeUsableFromMultipleThreads()
+{
+ if (m_threadSpecific)
+ return;
+
+ int error = pthread_key_create(&m_threadSpecific, removeThread);
+ if (error)
+ CRASH();
+}
+
+void MachineThreads::addCurrentThread()
+{
+ ASSERT(!m_heap->globalData()->exclusiveThread || m_heap->globalData()->exclusiveThread == currentThread());
+
+ if (!m_threadSpecific || pthread_getspecific(m_threadSpecific))
+ return;
+
+ pthread_setspecific(m_threadSpecific, this);
+ Thread* thread = new Thread(pthread_self(), getCurrentPlatformThread(), m_heap->globalData()->stack().origin());
+
+ MutexLocker lock(m_registeredThreadsMutex);
+
+ thread->next = m_registeredThreads;
+ m_registeredThreads = thread;
+}
+
+void MachineThreads::removeThread(void* p)
+{
+ if (p)
+ static_cast<MachineThreads*>(p)->removeCurrentThread();
+}
+
+void MachineThreads::removeCurrentThread()
+{
+ 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 {
+ Thread* last = m_registeredThreads;
+ 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;
+ }
+}
+
+#endif
+
+#if COMPILER(GCC)
+#define REGISTER_BUFFER_ALIGNMENT __attribute__ ((aligned (sizeof(void*))))
+#else
+#define REGISTER_BUFFER_ALIGNMENT
+#endif
+
+void MachineThreads::gatherFromCurrentThread(ConservativeRoots& conservativeRoots, void* stackCurrent)
+{
+ // 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
+
+ void* registersBegin = &registers;
+ void* registersEnd = reinterpret_cast<void*>(roundUpToMultipleOf<sizeof(void*)>(reinterpret_cast<uintptr_t>(&registers + 1)));
+ swapIfBackwards(registersBegin, registersEnd);
+ conservativeRoots.add(registersBegin, registersEnd);
+
+ void* stackBegin = stackCurrent;
+ void* stackEnd = m_heap->globalData()->stack().origin();
+ swapIfBackwards(stackBegin, stackEnd);
+ conservativeRoots.add(stackBegin, stackEnd);
+}
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+static inline void suspendThread(const PlatformThread& platformThread)
+{
+#if OS(DARWIN)
+ thread_suspend(platformThread);
+#elif OS(WINDOWS)
+ SuspendThread(platformThread);
+#elif USE(PTHREADS)
+ pthread_kill(platformThread, SigThreadSuspendResume);
+#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);
+#elif USE(PTHREADS)
+ pthread_kill(platformThread, SigThreadSuspendResume);
+#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)
+typedef CONTEXT PlatformThreadRegisters;
+#elif USE(PTHREADS)
+typedef pthread_attr_t 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)
+ regs.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL | CONTEXT_SEGMENTS;
+ GetThreadContext(platformThread, &regs);
+ return sizeof(CONTEXT);
+#elif USE(PTHREADS)
+ pthread_attr_init(&regs);
+#if HAVE(PTHREAD_NP_H) || OS(NETBSD)
+ // e.g. on FreeBSD 5.4, neundorf@kde.org
+ pthread_attr_get_np(platformThread, &regs);
+#else
+ // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
+ pthread_getattr_np(platformThread, &regs);
+#endif
+ return 0;
+#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);
+#elif CPU(X86_64) && OS(WINDOWS)
+ return reinterpret_cast<void*>((uintptr_t) regs.Rsp);
+#elif USE(PTHREADS)
+ void* stackBase = 0;
+ size_t stackSize = 0;
+ int rc = pthread_attr_getstack(&regs, &stackBase, &stackSize);
+ (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
+ ASSERT(stackBase);
+ return static_cast<char*>(stackBase) + stackSize;
+#else
+#error Need a way to get the stack pointer for another thread on this platform
+#endif
+}
+
+static void freePlatformThreadRegisters(PlatformThreadRegisters& regs)
+{
+#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
+ pthread_attr_destroy(&regs);
+#else
+ UNUSED_PARAM(regs);
+#endif
+}
+
+void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, Thread* thread)
+{
+ suspendThread(thread->platformThread);
+
+ PlatformThreadRegisters regs;
+ size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
+
+ conservativeRoots.add(static_cast<void*>(&regs), static_cast<void*>(reinterpret_cast<char*>(&regs) + regSize));
+
+ void* stackPointer = otherThreadStackPointer(regs);
+ void* stackBase = thread->stackBase;
+ swapIfBackwards(stackPointer, stackBase);
+ conservativeRoots.add(stackPointer, stackBase);
+
+ resumeThread(thread->platformThread);
+
+ freePlatformThreadRegisters(regs);
+}
+
+#endif
+
+void MachineThreads::gatherConservativeRoots(ConservativeRoots& conservativeRoots, void* stackCurrent)
+{
+ gatherFromCurrentThread(conservativeRoots, stackCurrent);
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+ if (m_threadSpecific) {
+
+ MutexLocker lock(m_registeredThreadsMutex);
+
+#ifndef NDEBUG
+ // Forbid malloc during the gather phase. The gather phase suspends
+ // threads, so a malloc during gather 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()))
+ gatherFromOtherThread(conservativeRoots, thread);
+ }
+#ifndef NDEBUG
+ fastMallocAllow();
+#endif
+ }
+#endif
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.h
new file mode 100644
index 0000000..c814ac5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.h
@@ -0,0 +1,73 @@
+/*
+ * 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 MachineThreads_h
+#define MachineThreads_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/ThreadingPrimitives.h>
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+#include <pthread.h>
+#endif
+
+namespace JSC {
+
+ class Heap;
+ class ConservativeRoots;
+
+ class MachineThreads {
+ WTF_MAKE_NONCOPYABLE(MachineThreads);
+ public:
+ MachineThreads(Heap*);
+ ~MachineThreads();
+
+ void gatherConservativeRoots(ConservativeRoots&, void* stackCurrent);
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ void makeUsableFromMultipleThreads();
+ void addCurrentThread(); // Only needs to be called by clients that can use the same heap from multiple threads.
+#endif
+
+ private:
+ void gatherFromCurrentThread(ConservativeRoots&, void* stackCurrent);
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ class Thread;
+
+ static void removeThread(void*);
+ void removeCurrentThread();
+
+ void gatherFromOtherThread(ConservativeRoots&, Thread*);
+#endif
+
+ Heap* m_heap;
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ Mutex m_registeredThreadsMutex;
+ Thread* m_registeredThreads;
+ pthread_key_t m_threadSpecific;
+#endif
+ };
+
+} // namespace JSC
+
+#endif // MachineThreads_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.cpp
new file mode 100644
index 0000000..34f6d14
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2009, 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.
+ */
+
+#include "config.h"
+#include "MarkStack.h"
+
+#include "ConservativeRoots.h"
+#include "Heap.h"
+#include "JSArray.h"
+#include "JSCell.h"
+#include "JSObject.h"
+#include "ScopeChain.h"
+#include "Structure.h"
+
+namespace JSC {
+
+size_t MarkStack::s_pageSize = 0;
+
+void MarkStack::reset()
+{
+ ASSERT(s_pageSize);
+ m_values.shrinkAllocation(s_pageSize);
+ m_markSets.shrinkAllocation(s_pageSize);
+ m_opaqueRoots.clear();
+}
+
+void MarkStack::append(ConservativeRoots& conservativeRoots)
+{
+ JSCell** roots = conservativeRoots.roots();
+ size_t size = conservativeRoots.size();
+ for (size_t i = 0; i < size; ++i)
+ internalAppend(roots[i]);
+}
+
+inline void MarkStack::visitChildren(JSCell* cell)
+{
+ ASSERT(Heap::isMarked(cell));
+ if (cell->structure()->typeInfo().type() < CompoundType) {
+ cell->JSCell::visitChildren(*this);
+ return;
+ }
+
+ if (!cell->structure()->typeInfo().overridesVisitChildren()) {
+ ASSERT(cell->isObject());
+#ifdef NDEBUG
+ asObject(cell)->visitChildrenDirect(*this);
+#else
+ ASSERT(!m_isCheckingForDefaultMarkViolation);
+ m_isCheckingForDefaultMarkViolation = true;
+ cell->visitChildren(*this);
+ ASSERT(m_isCheckingForDefaultMarkViolation);
+ m_isCheckingForDefaultMarkViolation = false;
+#endif
+ return;
+ }
+ if (cell->vptr() == m_jsArrayVPtr) {
+ asArray(cell)->visitChildrenDirect(*this);
+ return;
+ }
+ cell->visitChildren(*this);
+}
+
+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::testAndSetMarked(cell = value.asCell())) {
+ if (current.m_values == end) {
+ m_markSets.removeLast();
+ continue;
+ }
+ goto findNextUnmarkedNullValue;
+ }
+
+ if (cell->structure()->typeInfo().type() < CompoundType) {
+ cell->JSCell::visitChildren(*this);
+ if (current.m_values == end) {
+ m_markSets.removeLast();
+ continue;
+ }
+ goto findNextUnmarkedNullValue;
+ }
+
+ if (current.m_values == end)
+ m_markSets.removeLast();
+
+ visitChildren(cell);
+ }
+ while (!m_values.isEmpty())
+ visitChildren(m_values.removeLast());
+ }
+#if !ASSERT_DISABLED
+ m_isDraining = false;
+#endif
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.h
new file mode 100644
index 0000000..e7796036
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStack.h
@@ -0,0 +1,290 @@
+/*
+ * Copyright (C) 2009, 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 MarkStack_h
+#define MarkStack_h
+
+#include "JSValue.h"
+#include "Register.h"
+#include "WriteBarrier.h"
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OSAllocator.h>
+
+namespace JSC {
+
+ class ConservativeRoots;
+ class JSGlobalData;
+ class Register;
+
+ enum MarkSetProperties { MayContainNullValues, NoNullValues };
+
+ class MarkStack {
+ WTF_MAKE_NONCOPYABLE(MarkStack);
+ public:
+ MarkStack(void* jsArrayVPtr)
+ : m_jsArrayVPtr(jsArrayVPtr)
+#if !ASSERT_DISABLED
+ , m_isCheckingForDefaultMarkViolation(false)
+ , m_isDraining(false)
+#endif
+ {
+ }
+
+ ~MarkStack()
+ {
+ ASSERT(m_markSets.isEmpty());
+ ASSERT(m_values.isEmpty());
+ }
+
+ template <typename T> void append(WriteBarrierBase<T>*);
+
+ void appendValues(WriteBarrierBase<Unknown>* barriers, size_t count, MarkSetProperties properties = NoNullValues)
+ {
+ JSValue* values = barriers->slot();
+ if (count)
+ m_markSets.append(MarkSet(values, values + count, properties));
+ }
+
+ void append(ConservativeRoots&);
+
+ bool addOpaqueRoot(void* root) { return m_opaqueRoots.add(root).second; }
+ bool containsOpaqueRoot(void* root) { return m_opaqueRoots.contains(root); }
+ int opaqueRootCount() { return m_opaqueRoots.size(); }
+
+ void drain();
+ void reset();
+
+ private:
+ friend class HeapRootVisitor; // Allowed to mark a JSValue* or JSCell** directly.
+ void append(JSValue*);
+ void append(JSValue*, size_t count);
+ void append(JSCell**);
+
+ void internalAppend(JSCell*);
+ void internalAppend(JSValue);
+ void visitChildren(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;
+ HashSet<void*> m_opaqueRoots; // Handle-owning data structures not visible to the garbage collector.
+
+#if !ASSERT_DISABLED
+ public:
+ bool m_isCheckingForDefaultMarkViolation;
+ bool m_isDraining;
+#endif
+ };
+
+ typedef MarkStack SlotVisitor;
+
+ inline void MarkStack::append(JSValue* slot, size_t count)
+ {
+ if (!count)
+ return;
+ m_markSets.append(MarkSet(slot, slot + count, NoNullValues));
+ }
+
+ template <typename T> inline void MarkStack::append(WriteBarrierBase<T>* slot)
+ {
+ internalAppend(*slot->slot());
+ }
+
+ ALWAYS_INLINE void MarkStack::append(JSValue* value)
+ {
+ ASSERT(value);
+ internalAppend(*value);
+ }
+
+ ALWAYS_INLINE void MarkStack::append(JSCell** value)
+ {
+ ASSERT(value);
+ internalAppend(*value);
+ }
+
+ ALWAYS_INLINE void MarkStack::internalAppend(JSValue value)
+ {
+ ASSERT(value);
+ if (value.isCell())
+ internalAppend(value.asCell());
+ }
+
+ // Privileged class for marking JSValues directly. It is only safe to use
+ // this class to mark direct heap roots that are marked during every GC pass.
+ // All other references should be wrapped in WriteBarriers and marked through
+ // the MarkStack.
+ class HeapRootVisitor {
+ private:
+ friend class Heap;
+ HeapRootVisitor(SlotVisitor&);
+
+ public:
+ void mark(JSValue*);
+ void mark(JSValue*, size_t);
+ void mark(JSString**);
+ void mark(JSCell**);
+
+ SlotVisitor& visitor();
+
+ private:
+ SlotVisitor& m_visitor;
+ };
+
+ inline HeapRootVisitor::HeapRootVisitor(SlotVisitor& visitor)
+ : m_visitor(visitor)
+ {
+ }
+
+ inline void HeapRootVisitor::mark(JSValue* slot)
+ {
+ m_visitor.append(slot);
+ }
+
+ inline void HeapRootVisitor::mark(JSValue* slot, size_t count)
+ {
+ m_visitor.append(slot, count);
+ }
+
+ inline void HeapRootVisitor::mark(JSString** slot)
+ {
+ m_visitor.append(reinterpret_cast<JSCell**>(slot));
+ }
+
+ inline void HeapRootVisitor::mark(JSCell** slot)
+ {
+ m_visitor.append(slot);
+ }
+
+ inline SlotVisitor& HeapRootVisitor::visitor()
+ {
+ return m_visitor;
+ }
+
+} // namespace JSC
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackPosix.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackPosix.cpp
new file mode 100644
index 0000000..2a5b298
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/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/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackSymbian.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackSymbian.cpp
new file mode 100644
index 0000000..a3893d7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/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/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackWin.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackWin.cpp
new file mode 100644
index 0000000..2d2a1b3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/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/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.cpp
new file mode 100644
index 0000000..a10a778
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.cpp
@@ -0,0 +1,89 @@
+/*
+ * 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. 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 "MarkedBlock.h"
+
+#include "JSCell.h"
+#include "JSObject.h"
+#include "JSZombie.h"
+#include "ScopeChain.h"
+
+namespace JSC {
+
+MarkedBlock* MarkedBlock::create(JSGlobalData* globalData, size_t cellSize)
+{
+ PageAllocationAligned allocation = PageAllocationAligned::allocate(blockSize, blockSize, OSAllocator::JSGCHeapPages);
+ if (!static_cast<bool>(allocation))
+ CRASH();
+ return new (allocation.base()) MarkedBlock(allocation, globalData, cellSize);
+}
+
+void MarkedBlock::destroy(MarkedBlock* block)
+{
+ for (size_t i = block->firstAtom(); i < block->m_endAtom; i += block->m_atomsPerCell)
+ reinterpret_cast<JSCell*>(&block->atoms()[i])->~JSCell();
+ block->m_allocation.deallocate();
+}
+
+MarkedBlock::MarkedBlock(const PageAllocationAligned& allocation, JSGlobalData* globalData, size_t cellSize)
+ : m_nextAtom(firstAtom())
+ , m_allocation(allocation)
+ , m_heap(&globalData->heap)
+ , m_prev(0)
+ , m_next(0)
+{
+ m_atomsPerCell = (cellSize + atomSize - 1) / atomSize;
+ m_endAtom = atomsPerBlock - m_atomsPerCell + 1;
+
+ Structure* dummyMarkableCellStructure = globalData->dummyMarkableCellStructure.get();
+ for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell)
+ new (&atoms()[i]) JSCell(*globalData, dummyMarkableCellStructure);
+}
+
+void MarkedBlock::sweep()
+{
+ Structure* dummyMarkableCellStructure = m_heap->globalData()->dummyMarkableCellStructure.get();
+
+ for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell) {
+ if (m_marks.get(i))
+ continue;
+
+ JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[i]);
+#if ENABLE(JSC_ZOMBIES)
+ if (cell->structure() && cell->structure() != dummyMarkableCellStructure && !cell->isZombie()) {
+ const ClassInfo* info = cell->classInfo();
+ cell->~JSCell();
+ new (cell) JSZombie(*m_heap->globalData(), info, m_heap->globalData()->zombieStructure.get());
+ m_marks.set(i);
+ }
+#else
+ cell->~JSCell();
+ new (cell) JSCell(*m_heap->globalData(), dummyMarkableCellStructure);
+#endif
+ }
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.h
new file mode 100644
index 0000000..c567502
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.h
@@ -0,0 +1,223 @@
+/*
+ * 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, 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 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 MarkedBlock_h
+#define MarkedBlock_h
+
+#include <wtf/Bitmap.h>
+#include <wtf/PageAllocationAligned.h>
+#include <wtf/StdLibExtras.h>
+
+namespace JSC {
+
+ class Heap;
+ class JSCell;
+ class JSGlobalData;
+
+ typedef uintptr_t Bits;
+
+ static const size_t KB = 1024;
+
+ class MarkedBlock {
+ public:
+ static const size_t atomSize = sizeof(double); // Ensures natural alignment for all built-in types.
+
+ static MarkedBlock* create(JSGlobalData*, size_t cellSize);
+ static void destroy(MarkedBlock*);
+
+ static bool isAtomAligned(const void*);
+ static MarkedBlock* blockFor(const void*);
+ static size_t firstAtom();
+
+ Heap* heap() const;
+
+ void setPrev(MarkedBlock*);
+ void setNext(MarkedBlock*);
+ MarkedBlock* prev() const;
+ MarkedBlock* next() const;
+
+ void* allocate();
+ void reset();
+ void sweep();
+
+ bool isEmpty();
+
+ void clearMarks();
+ size_t markCount();
+
+ size_t cellSize();
+
+ size_t size();
+ size_t capacity();
+
+ bool contains(const void*);
+ size_t atomNumber(const void*);
+ bool isMarked(const void*);
+ bool testAndSetMarked(const void*);
+ void setMarked(const void*);
+
+ template <typename Functor> void forEach(Functor&);
+
+ private:
+ static const size_t blockSize = 16 * KB;
+ static const size_t blockMask = ~(blockSize - 1); // blockSize must be a power of two.
+
+ static const size_t atomMask = ~(atomSize - 1); // atomSize must be a power of two.
+
+ static const size_t atomsPerBlock = blockSize / atomSize;
+
+ typedef char Atom[atomSize];
+
+ MarkedBlock(const PageAllocationAligned&, JSGlobalData*, size_t cellSize);
+ Atom* atoms();
+
+ size_t m_nextAtom;
+ size_t m_endAtom; // This is a fuzzy end. Always test for < m_endAtom.
+ size_t m_atomsPerCell;
+ WTF::Bitmap<blockSize / atomSize> m_marks;
+ PageAllocationAligned m_allocation;
+ Heap* m_heap;
+ MarkedBlock* m_prev;
+ MarkedBlock* m_next;
+ };
+
+ inline size_t MarkedBlock::firstAtom()
+ {
+ return WTF::roundUpToMultipleOf<atomSize>(sizeof(MarkedBlock)) / atomSize;
+ }
+
+ inline MarkedBlock::Atom* MarkedBlock::atoms()
+ {
+ return reinterpret_cast<Atom*>(this);
+ }
+
+ inline bool MarkedBlock::isAtomAligned(const void* p)
+ {
+ return !((intptr_t)(p) & ~atomMask);
+ }
+
+ inline MarkedBlock* MarkedBlock::blockFor(const void* p)
+ {
+ return reinterpret_cast<MarkedBlock*>(reinterpret_cast<uintptr_t>(p) & blockMask);
+ }
+
+ inline Heap* MarkedBlock::heap() const
+ {
+ return m_heap;
+ }
+
+ inline void MarkedBlock::setPrev(MarkedBlock* prev)
+ {
+ m_prev = prev;
+ }
+
+ inline void MarkedBlock::setNext(MarkedBlock* next)
+ {
+ m_next = next;
+ }
+
+ inline MarkedBlock* MarkedBlock::prev() const
+ {
+ return m_prev;
+ }
+
+ inline MarkedBlock* MarkedBlock::next() const
+ {
+ return m_next;
+ }
+
+ inline void MarkedBlock::reset()
+ {
+ m_nextAtom = firstAtom();
+ }
+
+ inline bool MarkedBlock::isEmpty()
+ {
+ return m_marks.isEmpty();
+ }
+
+ inline void MarkedBlock::clearMarks()
+ {
+ m_marks.clearAll();
+ }
+
+ inline size_t MarkedBlock::markCount()
+ {
+ return m_marks.count();
+ }
+
+ inline size_t MarkedBlock::cellSize()
+ {
+ return m_atomsPerCell * atomSize;
+ }
+
+ inline size_t MarkedBlock::size()
+ {
+ return markCount() * cellSize();
+ }
+
+ inline size_t MarkedBlock::capacity()
+ {
+ return m_allocation.size();
+ }
+
+ inline bool MarkedBlock::contains(const void* p)
+ {
+ ASSERT(p && isAtomAligned(p) && atomNumber(p) < atomsPerBlock);
+
+ // Even though we physically contain p, we only logically contain p if p
+ // points to a live cell. (Claiming to contain a dead cell would trick the
+ // conservative garbage collector into resurrecting the cell in a zombie state.)
+ return isMarked(p);
+ }
+
+ inline size_t MarkedBlock::atomNumber(const void* p)
+ {
+ return (reinterpret_cast<uintptr_t>(p) - reinterpret_cast<uintptr_t>(this)) / atomSize;
+ }
+
+ inline bool MarkedBlock::isMarked(const void* p)
+ {
+ return m_marks.get(atomNumber(p));
+ }
+
+ inline bool MarkedBlock::testAndSetMarked(const void* p)
+ {
+ return m_marks.testAndSet(atomNumber(p));
+ }
+
+ inline void MarkedBlock::setMarked(const void* p)
+ {
+ m_marks.set(atomNumber(p));
+ }
+
+ template <typename Functor> inline void MarkedBlock::forEach(Functor& functor)
+ {
+ for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell) {
+ if (!m_marks.get(i))
+ continue;
+ functor(reinterpret_cast<JSCell*>(&atoms()[i]));
+ }
+ }
+
+} // namespace JSC
+
+#endif // MarkedSpace_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.cpp
new file mode 100644
index 0000000..d9a1e42
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.cpp
@@ -0,0 +1,166 @@
+/*
+ * 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 "MarkedSpace.h"
+
+#include "JSCell.h"
+#include "JSGlobalData.h"
+#include "JSLock.h"
+#include "JSObject.h"
+#include "ScopeChain.h"
+
+namespace JSC {
+
+class Structure;
+
+MarkedSpace::MarkedSpace(JSGlobalData* globalData)
+ : m_waterMark(0)
+ , m_highWaterMark(0)
+ , m_globalData(globalData)
+{
+ for (size_t cellSize = preciseStep; cellSize < preciseCutoff; cellSize += preciseStep)
+ sizeClassFor(cellSize).cellSize = cellSize;
+
+ for (size_t cellSize = impreciseStep; cellSize < impreciseCutoff; cellSize += impreciseStep)
+ sizeClassFor(cellSize).cellSize = cellSize;
+}
+
+void MarkedSpace::destroy()
+{
+ clearMarks();
+ shrink();
+ ASSERT(!size());
+}
+
+MarkedBlock* MarkedSpace::allocateBlock(SizeClass& sizeClass)
+{
+ MarkedBlock* block = MarkedBlock::create(globalData(), sizeClass.cellSize);
+ sizeClass.blockList.append(block);
+ sizeClass.nextBlock = block;
+ m_blocks.add(block);
+
+ return block;
+}
+
+void MarkedSpace::freeBlocks(DoublyLinkedList<MarkedBlock>& blocks)
+{
+ MarkedBlock* next;
+ for (MarkedBlock* block = blocks.head(); block; block = next) {
+ next = block->next();
+
+ blocks.remove(block);
+ m_blocks.remove(block);
+ MarkedBlock::destroy(block);
+ }
+}
+
+void* MarkedSpace::allocateFromSizeClass(SizeClass& sizeClass)
+{
+ for (MarkedBlock*& block = sizeClass.nextBlock ; block; block = block->next()) {
+ if (void* result = block->allocate())
+ return result;
+
+ m_waterMark += block->capacity();
+ }
+
+ if (m_waterMark < m_highWaterMark)
+ return allocateBlock(sizeClass)->allocate();
+
+ return 0;
+}
+
+void MarkedSpace::shrink()
+{
+ // We record a temporary list of empties to avoid modifying m_blocks while iterating it.
+ DoublyLinkedList<MarkedBlock> empties;
+
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it) {
+ MarkedBlock* block = *it;
+ if (block->isEmpty()) {
+ SizeClass& sizeClass = sizeClassFor(block->cellSize());
+ sizeClass.blockList.remove(block);
+ sizeClass.nextBlock = sizeClass.blockList.head();
+ empties.append(block);
+ }
+ }
+
+ freeBlocks(empties);
+ ASSERT(empties.isEmpty());
+}
+
+void MarkedSpace::clearMarks()
+{
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it)
+ (*it)->clearMarks();
+}
+
+void MarkedSpace::sweep()
+{
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it)
+ (*it)->sweep();
+}
+
+size_t MarkedSpace::objectCount() const
+{
+ size_t result = 0;
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it)
+ result += (*it)->markCount();
+ return result;
+}
+
+size_t MarkedSpace::size() const
+{
+ size_t result = 0;
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it)
+ result += (*it)->size();
+ return result;
+}
+
+size_t MarkedSpace::capacity() const
+{
+ size_t result = 0;
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it)
+ result += (*it)->capacity();
+ return result;
+}
+
+void MarkedSpace::reset()
+{
+ m_waterMark = 0;
+
+ for (size_t cellSize = preciseStep; cellSize < preciseCutoff; cellSize += preciseStep)
+ sizeClassFor(cellSize).reset();
+
+ for (size_t cellSize = impreciseStep; cellSize < impreciseCutoff; cellSize += impreciseStep)
+ sizeClassFor(cellSize).reset();
+
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it)
+ (*it)->reset();
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.h
new file mode 100644
index 0000000..a49e5f0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedSpace.h
@@ -0,0 +1,188 @@
+/*
+ * 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, 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 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 MarkedSpace_h
+#define MarkedSpace_h
+
+#include "MachineStackMarker.h"
+#include "MarkedBlock.h"
+#include "PageAllocationAligned.h"
+#include <wtf/Bitmap.h>
+#include <wtf/DoublyLinkedList.h>
+#include <wtf/FixedArray.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+#define ASSERT_CLASS_FITS_IN_CELL(class) COMPILE_ASSERT(sizeof(class) < MarkedSpace::maxCellSize, class_fits_in_cell)
+
+namespace JSC {
+
+ class Heap;
+ class JSCell;
+ class JSGlobalData;
+ class LiveObjectIterator;
+ class MarkStack;
+ class WeakGCHandle;
+ typedef MarkStack SlotVisitor;
+
+ class MarkedSpace {
+ WTF_MAKE_NONCOPYABLE(MarkedSpace);
+ public:
+ // Currently public for use in assertions.
+ static const size_t maxCellSize = 1024;
+
+ static Heap* heap(JSCell*);
+
+ static bool isMarked(const JSCell*);
+ static bool testAndSetMarked(const JSCell*);
+ static void setMarked(const JSCell*);
+
+ MarkedSpace(JSGlobalData*);
+ void destroy();
+
+ JSGlobalData* globalData();
+
+ size_t highWaterMark();
+ void setHighWaterMark(size_t);
+
+ void* allocate(size_t);
+
+ void clearMarks();
+ void markRoots();
+ void reset();
+ void sweep();
+ void shrink();
+
+ size_t size() const;
+ size_t capacity() const;
+ size_t objectCount() const;
+
+ bool contains(const void*);
+
+ template<typename Functor> void forEach(Functor&);
+
+ private:
+ // [ 8, 16... 128 )
+ static const size_t preciseStep = MarkedBlock::atomSize;
+ static const size_t preciseCutoff = 128;
+ static const size_t preciseCount = preciseCutoff / preciseStep - 1;
+
+ // [ 128, 256... 1024 )
+ static const size_t impreciseStep = preciseCutoff;
+ static const size_t impreciseCutoff = maxCellSize;
+ static const size_t impreciseCount = impreciseCutoff / impreciseStep - 1;
+
+ typedef HashSet<MarkedBlock*>::iterator BlockIterator;
+
+ struct SizeClass {
+ SizeClass();
+ void reset();
+
+ MarkedBlock* nextBlock;
+ DoublyLinkedList<MarkedBlock> blockList;
+ size_t cellSize;
+ };
+
+ MarkedBlock* allocateBlock(SizeClass&);
+ void freeBlocks(DoublyLinkedList<MarkedBlock>&);
+
+ SizeClass& sizeClassFor(size_t);
+ void* allocateFromSizeClass(SizeClass&);
+
+ void clearMarks(MarkedBlock*);
+
+ SizeClass m_preciseSizeClasses[preciseCount];
+ SizeClass m_impreciseSizeClasses[impreciseCount];
+ HashSet<MarkedBlock*> m_blocks;
+ size_t m_waterMark;
+ size_t m_highWaterMark;
+ JSGlobalData* m_globalData;
+ };
+
+ inline Heap* MarkedSpace::heap(JSCell* cell)
+ {
+ return MarkedBlock::blockFor(cell)->heap();
+ }
+
+ inline bool MarkedSpace::isMarked(const JSCell* cell)
+ {
+ return MarkedBlock::blockFor(cell)->isMarked(cell);
+ }
+
+ inline bool MarkedSpace::testAndSetMarked(const JSCell* cell)
+ {
+ return MarkedBlock::blockFor(cell)->testAndSetMarked(cell);
+ }
+
+ inline void MarkedSpace::setMarked(const JSCell* cell)
+ {
+ MarkedBlock::blockFor(cell)->setMarked(cell);
+ }
+
+ inline bool MarkedSpace::contains(const void* x)
+ {
+ if (!MarkedBlock::isAtomAligned(x))
+ return false;
+
+ MarkedBlock* block = MarkedBlock::blockFor(x);
+ if (!block || !m_blocks.contains(block))
+ return false;
+
+ return block->contains(x);
+ }
+
+ template <typename Functor> inline void MarkedSpace::forEach(Functor& functor)
+ {
+ BlockIterator end = m_blocks.end();
+ for (BlockIterator it = m_blocks.begin(); it != end; ++it)
+ (*it)->forEach(functor);
+ }
+
+ inline JSGlobalData* MarkedSpace::globalData()
+ {
+ return m_globalData;
+ }
+
+ inline size_t MarkedSpace::highWaterMark()
+ {
+ return m_highWaterMark;
+ }
+
+ inline void MarkedSpace::setHighWaterMark(size_t highWaterMark)
+ {
+ m_highWaterMark = highWaterMark;
+ }
+
+ inline MarkedSpace::SizeClass::SizeClass()
+ : nextBlock(0)
+ , cellSize(0)
+ {
+ }
+
+ inline void MarkedSpace::SizeClass::reset()
+ {
+ nextBlock = blockList.head();
+ }
+
+} // namespace JSC
+
+#endif // MarkedSpace_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/Strong.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Strong.h
new file mode 100644
index 0000000..9f2aa05
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Strong.h
@@ -0,0 +1,164 @@
+/*
+ * 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. 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 Strong_h
+#define Strong_h
+
+#include "Assertions.h"
+#include "Handle.h"
+#include "HandleHeap.h"
+
+namespace JSC {
+
+class JSGlobalData;
+HandleSlot allocateGlobalHandle(JSGlobalData&);
+
+// A strongly referenced handle that prevents the object it points to from being garbage collected.
+template <typename T> class Strong : public Handle<T> {
+ using Handle<T>::slot;
+ using Handle<T>::setSlot;
+
+public:
+ typedef typename Handle<T>::ExternalType ExternalType;
+
+ Strong()
+ : Handle<T>()
+ {
+ }
+
+ Strong(JSGlobalData& globalData, ExternalType value = ExternalType())
+ : Handle<T>(allocateGlobalHandle(globalData))
+ {
+ set(value);
+ }
+
+ Strong(JSGlobalData& globalData, Handle<T> handle)
+ : Handle<T>(allocateGlobalHandle(globalData))
+ {
+ set(handle.get());
+ }
+
+ Strong(const Strong& other)
+ : Handle<T>()
+ {
+ if (!other.slot())
+ return;
+ setSlot(HandleHeap::heapFor(other.slot())->allocate());
+ set(other.get());
+ }
+
+ template <typename U> Strong(const Strong<U>& other)
+ : Handle<T>()
+ {
+ if (!other.slot())
+ return;
+ setSlot(HandleHeap::heapFor(other.slot())->allocate());
+ set(other.get());
+ }
+
+ enum HashTableDeletedValueTag { HashTableDeletedValue };
+ bool isHashTableDeletedValue() const { return slot() == hashTableDeletedValue(); }
+ Strong(HashTableDeletedValueTag)
+ : Handle<T>(hashTableDeletedValue())
+ {
+ }
+
+ ~Strong()
+ {
+ clear();
+ }
+
+ void swap(Strong& other)
+ {
+ Handle<T>::swap(other);
+ }
+
+ void set(JSGlobalData& globalData, ExternalType value)
+ {
+ if (!slot())
+ setSlot(allocateGlobalHandle(globalData));
+ set(value);
+ }
+
+ template <typename U> Strong& operator=(const Strong<U>& other)
+ {
+ if (!other.slot()) {
+ clear();
+ return *this;
+ }
+
+ set(*HandleHeap::heapFor(other.slot())->globalData(), other.get());
+ return *this;
+ }
+
+ Strong& operator=(const Strong& other)
+ {
+ if (!other.slot()) {
+ clear();
+ return *this;
+ }
+
+ set(*HandleHeap::heapFor(other.slot())->globalData(), other.get());
+ return *this;
+ }
+
+ void clear()
+ {
+ if (!slot())
+ return;
+ HandleHeap::heapFor(slot())->deallocate(slot());
+ setSlot(0);
+ }
+
+private:
+ static HandleSlot hashTableDeletedValue() { return reinterpret_cast<HandleSlot>(-1); }
+
+ void set(ExternalType externalType)
+ {
+ ASSERT(slot());
+ JSValue value = HandleTypes<T>::toJSValue(externalType);
+ HandleHeap::heapFor(slot())->writeBarrier(slot(), value);
+ *slot() = value;
+ }
+};
+
+template<class T> inline void swap(Strong<T>& a, Strong<T>& b)
+{
+ a.swap(b);
+}
+
+} // namespace JSC
+
+namespace WTF {
+
+template<typename T> struct VectorTraits<JSC::Strong<T> > : SimpleClassVectorTraits {
+ static const bool canCompareWithMemcmp = false;
+};
+
+template<typename P> struct HashTraits<JSC::Strong<P> > : SimpleClassHashTraits<JSC::Strong<P> > { };
+
+}
+
+#endif // Strong_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/Weak.h b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Weak.h
new file mode 100644
index 0000000..62e2596
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/Weak.h
@@ -0,0 +1,155 @@
+/*
+ * 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 Weak_h
+#define Weak_h
+
+#include "Assertions.h"
+#include "Handle.h"
+#include "HandleHeap.h"
+#include "JSGlobalData.h"
+
+namespace JSC {
+
+// A weakly referenced handle that becomes 0 when the value it points to is garbage collected.
+template <typename T> class Weak : public Handle<T> {
+ using Handle<T>::slot;
+ using Handle<T>::setSlot;
+
+public:
+ typedef typename Handle<T>::ExternalType ExternalType;
+
+ Weak()
+ : Handle<T>()
+ {
+ }
+
+ Weak(JSGlobalData& globalData, ExternalType value = ExternalType(), WeakHandleOwner* weakOwner = 0, void* context = 0)
+ : Handle<T>(globalData.allocateGlobalHandle())
+ {
+ HandleHeap::heapFor(slot())->makeWeak(slot(), weakOwner, context);
+ set(value);
+ }
+
+ Weak(const Weak& other)
+ : Handle<T>()
+ {
+ if (!other.slot())
+ return;
+ setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot()));
+ }
+
+ template <typename U> Weak(const Weak<U>& other)
+ : Handle<T>()
+ {
+ if (!other.slot())
+ return;
+ setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot()));
+ }
+
+ enum HashTableDeletedValueTag { HashTableDeletedValue };
+ bool isHashTableDeletedValue() const { return slot() == hashTableDeletedValue(); }
+ Weak(HashTableDeletedValueTag)
+ : Handle<T>(hashTableDeletedValue())
+ {
+ }
+
+ ~Weak()
+ {
+ clear();
+ }
+
+ void swap(Weak& other)
+ {
+ Handle<T>::swap(other);
+ }
+
+ ExternalType get() const { return HandleTypes<T>::getFromSlot(slot()); }
+
+ void clear()
+ {
+ if (!slot())
+ return;
+ HandleHeap::heapFor(slot())->deallocate(slot());
+ setSlot(0);
+ }
+
+ void set(JSGlobalData& globalData, ExternalType value, WeakHandleOwner* weakOwner = 0, void* context = 0)
+ {
+ if (!slot()) {
+ setSlot(globalData.allocateGlobalHandle());
+ HandleHeap::heapFor(slot())->makeWeak(slot(), weakOwner, context);
+ }
+ ASSERT(HandleHeap::heapFor(slot())->hasWeakOwner(slot(), weakOwner));
+ set(value);
+ }
+
+ template <typename U> Weak& operator=(const Weak<U>& other)
+ {
+ clear();
+ if (other.slot())
+ setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot()));
+ return *this;
+ }
+
+ Weak& operator=(const Weak& other)
+ {
+ clear();
+ if (other.slot())
+ setSlot(HandleHeap::heapFor(other.slot())->copyWeak(other.slot()));
+ return *this;
+ }
+
+private:
+ static HandleSlot hashTableDeletedValue() { return reinterpret_cast<HandleSlot>(-1); }
+
+ void set(ExternalType externalType)
+ {
+ ASSERT(slot());
+ JSValue value = HandleTypes<T>::toJSValue(externalType);
+ ASSERT(!value || !value.isCell() || Heap::isMarked(value.asCell()));
+ HandleHeap::heapFor(slot())->writeBarrier(slot(), value);
+ *slot() = value;
+ }
+};
+
+template<class T> inline void swap(Weak<T>& a, Weak<T>& b)
+{
+ a.swap(b);
+}
+
+} // namespace JSC
+
+namespace WTF {
+
+template<typename T> struct VectorTraits<JSC::Weak<T> > : SimpleClassVectorTraits {
+ static const bool canCompareWithMemcmp = false;
+};
+
+template<typename P> struct HashTraits<JSC::Weak<P> > : SimpleClassHashTraits<JSC::Weak<P> > { };
+
+}
+
+#endif // Weak_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CachedCall.h b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CachedCall.h
new file mode 100644
index 0000000..04f2210
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CachedCall.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 CachedCall_h
+#define CachedCall_h
+
+#include "CallFrameClosure.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "Interpreter.h"
+
+namespace JSC {
+ class CachedCall {
+ WTF_MAKE_NONCOPYABLE(CachedCall); WTF_MAKE_FAST_ALLOCATED;
+ public:
+ CachedCall(CallFrame* callFrame, JSFunction* function, int argCount)
+ : m_valid(false)
+ , m_interpreter(callFrame->interpreter())
+ , m_globalObjectScope(callFrame->globalData(), function->scope()->globalObject.get())
+ {
+ ASSERT(!function->isHostFunction());
+ m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argCount, function->scope());
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.cpp
new file mode 100644
index 0000000..5819875
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.h b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.h
new file mode 100644
index 0000000..28832e0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.h
@@ -0,0 +1,158 @@
+/*
+ * 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"
+
+namespace JSC {
+
+ class Arguments;
+ class JSActivation;
+ class Interpreter;
+ class ScopeChainNode;
+
+ // 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.
+ inline JSGlobalObject* lexicalGlobalObject() const;
+
+ // Differs from lexicalGlobalObject because this will have DOM window shell rather than
+ // the actual DOM window, which can't be "this" for security reasons.
+ inline JSObject* globalThisValue() const;
+
+ inline JSGlobalData& globalData() const;
+
+ // 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* objectConstructorTable(CallFrame* callFrame) { return callFrame->globalData().objectConstructorTable; }
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrameClosure.h b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrameClosure.h
new file mode 100644
index 0000000..b4b7efd
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Interpreter.cpp
new file mode 100644
index 0000000..4a6ffb6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Interpreter.cpp
@@ -0,0 +1,4907 @@
+/*
+ * 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 "Heap.h"
+#include "Debugger.h"
+#include "DebuggerCallFrame.h"
+#include "ErrorInstance.h"
+#include "EvalCodeCache.h"
+#include "ExceptionHelpers.h"
+#include "GetterSetter.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, ScopeChainNode* 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->get();
+ 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->get();
+ 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.get();
+ 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) {
+ vPC[3].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), 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.get();
+ 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->get();
+ 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->get();
+ ++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) {
+ vPC[3].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), 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->get();
+ 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;
+ EvalExecutable* eval = codeBlock->evalCodeCache().get(callFrame, codeBlock->ownerExecutable(), codeBlock->isStrictMode(), programSource, scopeChain, exceptionValue);
+
+ ASSERT(!eval == exceptionValue);
+ if (UNLIKELY(!eval))
+ return throwError(callFrame, exceptionValue);
+
+ return callFrame->globalData().interpreter->execute(eval, callFrame, callFrame->uncheckedR(codeBlock->thisRegister()).jsValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain);
+}
+
+Interpreter::Interpreter(JSGlobalData& globalData)
+ : m_sampleEntryDepth(0)
+ , m_reentryDepth(0)
+ , m_registerFile(globalData)
+{
+#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::s_info))
+ scopeChain = scopeChain->pop();
+
+ callFrame->setScopeChain(scopeChain);
+ JSActivation* activation = asActivation(scopeChain->object.get());
+ activation->copyRegisters(*scopeChain->globalData);
+ if (JSValue arguments = callFrame->uncheckedR(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue()) {
+ if (!oldCodeBlock->isStrictMode())
+ asArguments(arguments)->setActivation(callFrame->globalData(), activation);
+ }
+ } else if (oldCodeBlock->usesArguments() && !oldCodeBlock->isStrictMode()) {
+ if (JSValue arguments = callFrame->uncheckedR(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue())
+ asArguments(arguments)->copyRegisters(callFrame->globalData());
+ }
+
+ 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, 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 - 1]))
+ stop--;
+ message = makeUString(message, " (near '...", codeBlock->source()->getRange(start, stop), "...')");
+ }
+
+ exception->putDirect(*globalData, 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();
+ int scopeDelta = 0;
+ if (!codeBlock->needsFullScopeChain() || codeBlock->codeType() != FunctionCode
+ || callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
+ scopeDelta = depth(codeBlock, scopeChain) - 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));
+
+ DynamicGlobalObjectScope globalObjectScope(*scopeChain->globalData, scopeChain->globalObject.get());
+
+ 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);
+
+ 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;
+
+ DynamicGlobalObjectScope globalObjectScope(*callDataScopeChain->globalData, callDataScopeChain->globalObject.get());
+
+ 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);
+
+ 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(*scopeChain->globalData, scopeChain->globalObject.get());
+
+ 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;
+
+ DynamicGlobalObjectScope globalObjectScope(*constructDataScopeChain->globalData, constructDataScopeChain->globalObject.get());
+
+ 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);
+
+ 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(*scopeChain->globalData, scopeChain->globalObject.get());
+
+ 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);
+ // We initialise |this| unnecessarily here for the sake of code clarity
+ 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);
+
+ DynamicGlobalObjectScope globalObjectScope(*scopeChain->globalData, scopeChain->globalObject.get());
+
+ if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ 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.get()) {
+ ASSERT(node);
+ if (node->object->isVariableObject()) {
+ variableObject = static_cast<JSVariableObject*>(node->object.get());
+ 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(callFrame->globalData(), 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);
+
+ 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.get();
+ if (structure != lastStructure) {
+ // First miss: record Structure to compare against next time.
+ if (!lastStructure) {
+ vPC[4].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), 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);
+ JSCell* owner = codeBlock->ownerExecutable();
+ JSGlobalData& globalData = callFrame->globalData();
+ vPC[0] = getOpcode(op_put_by_id_transition);
+ vPC[4].u.structure.set(globalData, owner, structure->previousID());
+ vPC[5].u.structure.set(globalData, owner, structure);
+ vPC[6].u.structureChain.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure->prototypeChain(callFrame));
+ ASSERT(vPC[6].u.structureChain);
+ vPC[7] = slot.cachedOffset();
+ return;
+ }
+
+ vPC[0] = getOpcode(op_put_by_id_replace);
+ vPC[5] = slot.cachedOffset();
+}
+
+NEVER_INLINE void Interpreter::uncachePutByID(CodeBlock*, Instruction* 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.get();
+ if (structure != lastStructure) {
+ // First miss: record Structure to compare against next time.
+ if (!lastStructure) {
+ vPC[4].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), 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;
+ }
+ 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(callFrame->globalData());
+ offset = baseObject->structure()->get(callFrame->globalData(), 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].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), baseObject->structure());
+ 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].u.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure);
+ vPC[5].u.structureChain.set(callFrame->globalData(), codeBlock->ownerExecutable(), structure->prototypeChain(callFrame));
+ vPC[6] = count;
+}
+
+NEVER_INLINE void Interpreter::uncacheGetByID(CodeBlock*, Instruction* 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;
+ RegExp* regExp = codeBlock->regexp(vPC[2].u.operand);
+ if (!regExp->isValid()) {
+ exceptionValue = createSyntaxError(callFrame, "Invalid flags supplied to RegExp constructor.");
+ goto vm_throw;
+ }
+ callFrame->uncheckedR(dst) = JSValue(new (globalData) RegExpObject(callFrame->lexicalGlobalObject(), callFrame->scopeChain()->globalObject->regExpStructure(), 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).get();
+ 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).set(*globalData, scope, 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->get());
+ callFrame->uncheckedR(dst) = scope->registerAt(index).get();
+ 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->get());
+ ASSERT(callFrame->r(value).jsValue());
+ scope->registerAt(index).set(*globalData, scope, callFrame->r(value).jsValue());
+ vPC += OPCODE_LENGTH(op_put_scoped_var);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_resolve_base) {
+ /* resolve_base dst(r) property(id) isStrict(bool)
+
+ Searches the scope chain for an object containing
+ identifier property, and if one is found, writes it to
+ register dst. If none is found and isStrict is false, the
+ outermost scope (which will be the global object) is
+ stored in register dst.
+ */
+ resolveBase(callFrame, vPC);
+ CHECK_FOR_EXCEPTION();
+
+ 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;
+ }
+
+ vPC += OPCODE_LENGTH(op_ensure_property_exists);
+ 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.get();
+
+ 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.get();
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(structure->prototypeForLookup(callFrame).isObject());
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+ Structure* prototypeStructure = vPC[5].u.structure.get();
+
+ 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.get();
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(structure->prototypeForLookup(callFrame).isObject());
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+ Structure* prototypeStructure = vPC[5].u.structure.get();
+
+ 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.get();
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(structure->prototypeForLookup(callFrame).isObject());
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+ Structure* prototypeStructure = vPC[5].u.structure.get();
+
+ 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();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ goto *(&&skip_get_by_id_chain);
+#endif
+ 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.get();
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ WriteBarrier<Structure>* it = vPC[5].u.structureChain->head();
+ size_t count = vPC[6].u.operand;
+ WriteBarrier<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)
+ skip_get_by_id_chain:
+ 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.get();
+
+ 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.get();
+
+ 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.get();
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ WriteBarrier<Structure>* it = vPC[5].u.structureChain->head();
+ size_t count = vPC[6].u.operand;
+ WriteBarrier<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.get();
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ WriteBarrier<Structure>* it = vPC[5].u.structureChain->head();
+ size_t count = vPC[6].u.operand;
+ WriteBarrier<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:
+ goto *(&&skip_get_array_length);
+#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();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_get_array_length:
+ goto *(&&skip_get_string_length);
+#endif
+ 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();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_get_string_length:
+ goto *(&&skip_put_by_id);
+#endif
+ 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();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_put_by_id:
+#endif
+ 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.get();
+ Structure* newStructure = vPC[5].u.structure.get();
+
+ if (LIKELY(baseCell->structure() == oldStructure)) {
+ ASSERT(baseCell->isObject());
+ JSObject* baseObject = asObject(baseCell);
+ int direct = vPC[8].u.operand;
+
+ if (!direct) {
+ WriteBarrier<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(*globalData, newStructure);
+
+ int value = vPC[3].u.operand;
+ unsigned offset = vPC[7].u.operand;
+ ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(*globalData, codeBlock->identifier(vPC[2].u.operand))) == offset);
+ baseObject->putDirectOffset(callFrame->globalData(), 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.get();
+
+ 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(*globalData, codeBlock->identifier(vPC[2].u.operand))) == offset);
+ baseObject->putDirectOffset(callFrame->globalData(), 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(*globalData, 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;
+ int target = vPC[3].u.operand;
+ JSValue srcValue = callFrame->r(src).jsValue();
+ if (srcValue != vPC[2].u.jsCell.get()) {
+ 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->setScope(*globalData, 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.get();
+
+ 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::s_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::s_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(*globalData);
+
+ if (JSValue argumentsValue = callFrame->r(unmodifiedArgumentsRegister(arguments)).jsValue()) {
+ if (!codeBlock->isStrictMode())
+ asArguments(argumentsValue)->setActivation(*globalData, asActivation(activationValue));
+ }
+ } else if (JSValue argumentsValue = callFrame->r(unmodifiedArgumentsRegister(arguments)).jsValue()) {
+ if (!codeBlock->isStrictMode())
+ asArguments(argumentsValue)->copyRegisters(*globalData);
+ }
+
+ 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(*globalData);
+
+ 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;
+
+ 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;
+
+ 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()->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(callFrame->globalData());
+ else
+ structure = constructor->scope()->globalObject->emptyObjectStructure();
+ callFrame->uncheckedR(thisRegister) = constructEmptyObject(callFrame, 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_end) {
+ /* end result(r)
+
+ Return register result as the value of a global or eval
+ program. Return control to the calling native code.
+ */
+
+ 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);
+ }
+ JSGlobalObject* globalObject = callFrame->lexicalGlobalObject();
+ handler = throwException(callFrame, exceptionValue, vPC - codeBlock->instructions().begin());
+ if (!handler) {
+ // Can't use the callframe at this point as the scopechain, etc have
+ // been released.
+ return throwError(globalObject->globalExec(), 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();
+ int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister);
+ if (JSValue arguments = functionCallFrame->uncheckedR(argumentsRegister).jsValue())
+ return arguments;
+ JSValue arguments = JSValue(new (callFrame) Arguments(functionCallFrame));
+ functionCallFrame->r(argumentsRegister) = arguments;
+ functionCallFrame->r(realArgumentsRegister) = arguments;
+ return arguments;
+ }
+
+ Arguments* arguments = new (functionCallFrame) Arguments(functionCallFrame);
+ arguments->copyRegisters(functionCallFrame->globalData());
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Interpreter.h b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Interpreter.h
new file mode 100644
index 0000000..8f29f60
--- /dev/null
+++ b/src/3rdparty/webkit/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 "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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ friend class JIT;
+ friend class CachedCall;
+ public:
+ Interpreter(JSGlobalData&);
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Register.h b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Register.h
new file mode 100644
index 0000000..fb02c12
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/Register.h
@@ -0,0 +1,172 @@
+/*
+ * 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/VectorTraits.h>
+
+namespace JSC {
+
+ class CodeBlock;
+ class ExecState;
+ class JSActivation;
+ class JSObject;
+ class JSPropertyNameIterator;
+ class ScopeChainNode;
+
+ struct Instruction;
+
+ typedef ExecState CallFrame;
+
+ class Register {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ Register();
+
+ Register(const JSValue&);
+ Register& operator=(const JSValue&);
+ JSValue jsValue() const;
+ EncodedJSValue encodedJSValue() const;
+
+ Register& operator=(CallFrame*);
+ Register& operator=(CodeBlock*);
+ 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 = jsNumber(i);
+ return r;
+ }
+
+ static inline Register withCallee(JSObject* callee);
+
+ private:
+ union {
+ EncodedJSValue value;
+ CallFrame* callFrame;
+ CodeBlock* codeBlock;
+ 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);
+ }
+
+ ALWAYS_INLINE EncodedJSValue Register::encodedJSValue() const
+ {
+ return u.value;
+ }
+
+ // Interpreter functions
+
+ 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 int32_t Register::i() const
+ {
+ return jsValue().asInt32();
+ }
+
+ ALWAYS_INLINE CallFrame* Register::callFrame() const
+ {
+ return u.callFrame;
+ }
+
+ ALWAYS_INLINE CodeBlock* Register::codeBlock() const
+ {
+ return u.codeBlock;
+ }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.cpp
new file mode 100644
index 0000000..e3b34bb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.cpp
@@ -0,0 +1,101 @@
+/*
+ * 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 "ConservativeRoots.h"
+#include "Interpreter.h"
+#include "JSGlobalData.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::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
+{
+ for (Register* it = start(); it != end(); ++it) {
+ JSValue v = it->jsValue();
+ if (!v.isCell())
+ continue;
+ conservativeRoots.add(v.asCell());
+ }
+}
+
+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.set(globalObject->globalData(), globalObject, &m_globalObjectOwner, this);
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.h b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.h
new file mode 100644
index 0000000..f59c13a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/RegisterFile.h
@@ -0,0 +1,220 @@
+/*
+ * 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 "Heap.h"
+#include "ExecutableAllocator.h"
+#include "Register.h"
+#include "Weak.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 {
+ WTF_MAKE_NONCOPYABLE(RegisterFile);
+ 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(JSGlobalData&, size_t capacity = defaultCapacity, size_t maxGlobals = defaultMaxGlobals);
+ ~RegisterFile();
+
+ void gatherConservativeRoots(ConservativeRoots&);
+
+ Register* start() const { return m_start; }
+ Register* end() const { return m_end; }
+ size_t size() const { return m_end - m_start; }
+
+ void setGlobalObject(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; }
+
+ static size_t committedByteCount();
+ static void initializeThreading();
+
+ Register* const * addressOfEnd() const
+ {
+ return &m_end;
+ }
+
+ 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;
+
+ Weak<JSGlobalObject> m_globalObject; // The global object whose vars are currently stored in the register file.
+ class GlobalObjectOwner : public WeakHandleOwner {
+ virtual void finalize(Handle<Unknown>, void* context)
+ {
+ static_cast<RegisterFile*>(context)->setNumGlobals(0);
+ }
+ } m_globalObjectOwner;
+ };
+
+ inline RegisterFile::RegisterFile(JSGlobalData& globalData, size_t capacity, size_t maxGlobals)
+ : m_numGlobals(0)
+ , m_maxGlobals(maxGlobals)
+ , m_start(0)
+ , m_end(0)
+ , m_max(0)
+ , m_globalObject(globalData, 0, &m_globalObjectOwner, this)
+ {
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocator.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocator.cpp
new file mode 100644
index 0000000..35531d9
--- /dev/null
+++ b/src/3rdparty/webkit/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 OS(SYMBIAN) && 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, ProtectionSetting 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocator.h
new file mode 100644
index 0000000..77a2567
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocator.h
@@ -0,0 +1,378 @@
+/*
+ * 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 CPU(SH4) && OS(LINUX)
+#include <asm/cachectl.h>
+#include <asm/unistd.h>
+#include <sys/syscall.h>
+#include <unistd.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 ProtectionSetting { 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 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);
+ }
+#elif CPU(SH4) && OS(LINUX)
+ static void cacheFlush(void* code, size_t size)
+ {
+#ifdef CACHEFLUSH_D_L2
+ syscall(__NR_cacheflush, reinterpret_cast<unsigned>(code), size, CACHEFLUSH_D_WB | CACHEFLUSH_I | CACHEFLUSH_D_L2);
+#else
+ syscall(__NR_cacheflush, reinterpret_cast<unsigned>(code), size, CACHEFLUSH_D_WB | CACHEFLUSH_I);
+#endif
+ }
+#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, ProtectionSetting);
+#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/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
new file mode 100644
index 0000000..6a945b0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
@@ -0,0 +1,531 @@
+/*
+ * 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 OS(LINUX)
+#include <stdio.h>
+#endif
+
+using namespace WTF;
+
+namespace JSC {
+
+#define TwoPow(n) (1ull << n)
+
+class AllocationTableSizeClass {
+public:
+ AllocationTableSizeClass(size_t size, size_t blockSize, unsigned log2BlockSize)
+ : m_blockSize(blockSize)
+ {
+ ASSERT(blockSize == TwoPow(log2BlockSize));
+
+ // Calculate the number of blocks needed to hold size.
+ size_t blockMask = blockSize - 1;
+ m_blockCount = (size + blockMask) >> log2BlockSize;
+
+ // Align to the smallest power of two >= m_blockCount.
+ m_blockAlignment = 1;
+ while (m_blockAlignment < m_blockCount)
+ m_blockAlignment += m_blockAlignment;
+ }
+
+ size_t blockSize() const { return m_blockSize; }
+ size_t blockCount() const { return m_blockCount; }
+ size_t blockAlignment() const { return m_blockAlignment; }
+
+ size_t size()
+ {
+ return m_blockSize * m_blockCount;
+ }
+
+private:
+ size_t m_blockSize;
+ size_t m_blockCount;
+ size_t m_blockAlignment;
+};
+
+template<unsigned log2Entries>
+class AllocationTableLeaf {
+ typedef uint64_t BitField;
+
+public:
+ static const unsigned log2SubregionSize = 12; // 2^12 == pagesize
+ static const unsigned log2RegionSize = log2SubregionSize + log2Entries;
+
+ static const size_t subregionSize = TwoPow(log2SubregionSize);
+ static const size_t regionSize = TwoPow(log2RegionSize);
+ static const unsigned entries = TwoPow(log2Entries);
+ COMPILE_ASSERT(entries <= (sizeof(BitField) * 8), AllocationTableLeaf_entries_fit_in_BitField);
+
+ AllocationTableLeaf()
+ : m_allocated(0)
+ {
+ }
+
+ ~AllocationTableLeaf()
+ {
+ ASSERT(isEmpty());
+ }
+
+ size_t allocate(AllocationTableSizeClass& sizeClass)
+ {
+ ASSERT(sizeClass.blockSize() == subregionSize);
+ ASSERT(!isFull());
+
+ size_t alignment = sizeClass.blockAlignment();
+ size_t count = sizeClass.blockCount();
+ // Use this mask to check for spans of free blocks.
+ BitField mask = ((1ull << count) - 1) << (alignment - count);
+
+ // Step in units of alignment size.
+ for (unsigned i = 0; i < entries; i += alignment) {
+ if (!(m_allocated & mask)) {
+ m_allocated |= mask;
+ return (i + (alignment - count)) << log2SubregionSize;
+ }
+ mask <<= alignment;
+ }
+ return notFound;
+ }
+
+ void free(size_t location, AllocationTableSizeClass& sizeClass)
+ {
+ ASSERT(sizeClass.blockSize() == subregionSize);
+
+ size_t entry = location >> log2SubregionSize;
+ size_t count = sizeClass.blockCount();
+ BitField mask = ((1ull << count) - 1) << entry;
+
+ ASSERT((m_allocated & mask) == mask);
+ m_allocated &= ~mask;
+ }
+
+ bool isEmpty()
+ {
+ return !m_allocated;
+ }
+
+ bool isFull()
+ {
+ return !~m_allocated;
+ }
+
+ static size_t size()
+ {
+ return regionSize;
+ }
+
+ static AllocationTableSizeClass classForSize(size_t size)
+ {
+ return AllocationTableSizeClass(size, subregionSize, log2SubregionSize);
+ }
+
+#ifndef NDEBUG
+ void dump(size_t parentOffset = 0, unsigned indent = 0)
+ {
+ for (unsigned i = 0; i < indent; ++i)
+ fprintf(stderr, " ");
+ fprintf(stderr, "%08x: [%016llx]\n", (int)parentOffset, m_allocated);
+ }
+#endif
+
+private:
+ BitField m_allocated;
+};
+
+
+template<class NextLevel>
+class LazyAllocationTable {
+public:
+ static const unsigned log2RegionSize = NextLevel::log2RegionSize;
+ static const unsigned entries = NextLevel::entries;
+
+ LazyAllocationTable()
+ : m_ptr(0)
+ {
+ }
+
+ ~LazyAllocationTable()
+ {
+ ASSERT(isEmpty());
+ }
+
+ size_t allocate(AllocationTableSizeClass& sizeClass)
+ {
+ if (!m_ptr)
+ m_ptr = new NextLevel();
+ return m_ptr->allocate(sizeClass);
+ }
+
+ void free(size_t location, AllocationTableSizeClass& sizeClass)
+ {
+ ASSERT(m_ptr);
+ m_ptr->free(location, sizeClass);
+ if (m_ptr->isEmpty()) {
+ delete m_ptr;
+ m_ptr = 0;
+ }
+ }
+
+ bool isEmpty()
+ {
+ return !m_ptr;
+ }
+
+ bool isFull()
+ {
+ return m_ptr && m_ptr->isFull();
+ }
+
+ static size_t size()
+ {
+ return NextLevel::size();
+ }
+
+#ifndef NDEBUG
+ void dump(size_t parentOffset = 0, unsigned indent = 0)
+ {
+ ASSERT(m_ptr);
+ m_ptr->dump(parentOffset, indent);
+ }
+#endif
+
+ static AllocationTableSizeClass classForSize(size_t size)
+ {
+ return NextLevel::classForSize(size);
+ }
+
+private:
+ NextLevel* m_ptr;
+};
+
+template<class NextLevel, unsigned log2Entries>
+class AllocationTableDirectory {
+ typedef uint64_t BitField;
+
+public:
+ static const unsigned log2SubregionSize = NextLevel::log2RegionSize;
+ static const unsigned log2RegionSize = log2SubregionSize + log2Entries;
+
+ static const size_t subregionSize = TwoPow(log2SubregionSize);
+ static const size_t regionSize = TwoPow(log2RegionSize);
+ static const unsigned entries = TwoPow(log2Entries);
+ COMPILE_ASSERT(entries <= (sizeof(BitField) * 8), AllocationTableDirectory_entries_fit_in_BitField);
+
+ AllocationTableDirectory()
+ : m_full(0)
+ , m_hasSuballocation(0)
+ {
+ }
+
+ ~AllocationTableDirectory()
+ {
+ ASSERT(isEmpty());
+ }
+
+ size_t allocate(AllocationTableSizeClass& sizeClass)
+ {
+ ASSERT(sizeClass.blockSize() <= subregionSize);
+ ASSERT(!isFull());
+
+ if (sizeClass.blockSize() < subregionSize) {
+ BitField bit = 1;
+ for (unsigned i = 0; i < entries; ++i, bit += bit) {
+ if (m_full & bit)
+ continue;
+ size_t location = m_suballocations[i].allocate(sizeClass);
+ if (location != notFound) {
+ // If this didn't already have a subregion, it does now!
+ m_hasSuballocation |= bit;
+ // Mirror the suballocation's full bit.
+ if (m_suballocations[i].isFull())
+ m_full |= bit;
+ return (i * subregionSize) | location;
+ }
+ }
+ return notFound;
+ }
+
+ // A block is allocated if either it is fully allocated or contains suballocations.
+ BitField allocated = m_full | m_hasSuballocation;
+
+ size_t alignment = sizeClass.blockAlignment();
+ size_t count = sizeClass.blockCount();
+ // Use this mask to check for spans of free blocks.
+ BitField mask = ((1ull << count) - 1) << (alignment - count);
+
+ // Step in units of alignment size.
+ for (unsigned i = 0; i < entries; i += alignment) {
+ if (!(allocated & mask)) {
+ m_full |= mask;
+ return (i + (alignment - count)) << log2SubregionSize;
+ }
+ mask <<= alignment;
+ }
+ return notFound;
+ }
+
+ void free(size_t location, AllocationTableSizeClass& sizeClass)
+ {
+ ASSERT(sizeClass.blockSize() <= subregionSize);
+
+ size_t entry = location >> log2SubregionSize;
+
+ if (sizeClass.blockSize() < subregionSize) {
+ BitField bit = 1ull << entry;
+ m_suballocations[entry].free(location & (subregionSize - 1), sizeClass);
+ // Check if the suballocation is now empty.
+ if (m_suballocations[entry].isEmpty())
+ m_hasSuballocation &= ~bit;
+ // No need to check, it clearly isn't full any more!
+ m_full &= ~bit;
+ } else {
+ size_t count = sizeClass.blockCount();
+ BitField mask = ((1ull << count) - 1) << entry;
+ ASSERT((m_full & mask) == mask);
+ ASSERT(!(m_hasSuballocation & mask));
+ m_full &= ~mask;
+ }
+ }
+
+ bool isEmpty()
+ {
+ return !(m_full | m_hasSuballocation);
+ }
+
+ bool isFull()
+ {
+ return !~m_full;
+ }
+
+ static size_t size()
+ {
+ return regionSize;
+ }
+
+ static AllocationTableSizeClass classForSize(size_t size)
+ {
+ if (size < subregionSize) {
+ AllocationTableSizeClass sizeClass = NextLevel::classForSize(size);
+ if (sizeClass.size() < NextLevel::size())
+ return sizeClass;
+ }
+ return AllocationTableSizeClass(size, subregionSize, log2SubregionSize);
+ }
+
+#ifndef NDEBUG
+ void dump(size_t parentOffset = 0, unsigned indent = 0)
+ {
+ for (unsigned i = 0; i < indent; ++i)
+ fprintf(stderr, " ");
+ fprintf(stderr, "%08x: [", (int)parentOffset);
+ for (unsigned i = 0; i < entries; ++i) {
+ BitField bit = 1ull << i;
+ char c = m_hasSuballocation & bit
+ ? (m_full & bit ? 'N' : 'n')
+ : (m_full & bit ? 'F' : '-');
+ fprintf(stderr, "%c", c);
+ }
+ fprintf(stderr, "]\n");
+
+ for (unsigned i = 0; i < entries; ++i) {
+ BitField bit = 1ull << i;
+ size_t offset = parentOffset | (subregionSize * i);
+ if (m_hasSuballocation & bit)
+ m_suballocations[i].dump(offset, indent + 1);
+ }
+ }
+#endif
+
+private:
+ NextLevel m_suballocations[entries];
+ // Subregions exist in one of four states:
+ // (1) empty (both bits clear)
+ // (2) fully allocated as a single allocation (m_full set)
+ // (3) partially allocated through suballocations (m_hasSuballocation set)
+ // (4) fully allocated through suballocations (both bits set)
+ BitField m_full;
+ BitField m_hasSuballocation;
+};
+
+
+typedef AllocationTableLeaf<6> PageTables256KB;
+typedef AllocationTableDirectory<PageTables256KB, 6> PageTables16MB;
+typedef AllocationTableDirectory<LazyAllocationTable<PageTables16MB>, 1> PageTables32MB;
+typedef AllocationTableDirectory<LazyAllocationTable<PageTables16MB>, 6> PageTables1GB;
+
+#if CPU(ARM)
+typedef PageTables16MB FixedVMPoolPageTables;
+#elif CPU(X86_64)
+typedef PageTables1GB FixedVMPoolPageTables;
+#else
+typedef PageTables32MB FixedVMPoolPageTables;
+#endif
+
+
+class FixedVMPoolAllocator
+{
+public:
+ FixedVMPoolAllocator()
+ {
+ ASSERT(PageTables256KB::size() == 256 * 1024);
+ ASSERT(PageTables16MB::size() == 16 * 1024 * 1024);
+ ASSERT(PageTables32MB::size() == 32 * 1024 * 1024);
+ ASSERT(PageTables1GB::size() == 1024 * 1024 * 1024);
+
+ m_reservation = PageReservation::reserve(FixedVMPoolPageTables::size(), OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true);
+#if !ENABLE(INTERPRETER)
+ if (!isValid())
+ CRASH();
+#endif
+ }
+
+ ExecutablePool::Allocation alloc(size_t requestedSize)
+ {
+ ASSERT(requestedSize);
+ AllocationTableSizeClass sizeClass = classForSize(requestedSize);
+ size_t size = sizeClass.size();
+ ASSERT(size);
+
+ if (size >= FixedVMPoolPageTables::size())
+ CRASH();
+ if (m_pages.isFull())
+ CRASH();
+
+ size_t offset = m_pages.allocate(sizeClass);
+ if (offset == notFound)
+ CRASH();
+
+ void* pointer = offsetToPointer(offset);
+ m_reservation.commit(pointer, size);
+ return ExecutablePool::Allocation(pointer, size);
+ }
+
+ void free(ExecutablePool::Allocation allocation)
+ {
+ void* pointer = allocation.base();
+ size_t size = allocation.size();
+ ASSERT(size);
+
+ m_reservation.decommit(pointer, size);
+
+ AllocationTableSizeClass sizeClass = classForSize(size);
+ ASSERT(sizeClass.size() == size);
+ m_pages.free(pointerToOffset(pointer), sizeClass);
+ }
+
+ size_t allocated()
+ {
+ return m_reservation.committed();
+ }
+
+ bool isValid() const
+ {
+ return !!m_reservation;
+ }
+
+private:
+ AllocationTableSizeClass classForSize(size_t size)
+ {
+ return FixedVMPoolPageTables::classForSize(size);
+ }
+
+ void* offsetToPointer(size_t offset)
+ {
+ return reinterpret_cast<void*>(reinterpret_cast<intptr_t>(m_reservation.base()) + offset);
+ }
+
+ size_t pointerToOffset(void* pointer)
+ {
+ return reinterpret_cast<intptr_t>(pointer) - reinterpret_cast<intptr_t>(m_reservation.base());
+ }
+
+ PageReservation m_reservation;
+ FixedVMPoolPageTables m_pages;
+};
+
+
+static SpinLock spinlock = SPINLOCK_INITIALIZER;
+static FixedVMPoolAllocator* allocator = 0;
+
+
+size_t ExecutableAllocator::committedByteCount()
+{
+ SpinLockHolder lockHolder(&spinlock);
+ return allocator ? allocator->allocated() : 0;
+}
+
+void ExecutableAllocator::intializePageSize()
+{
+ ExecutableAllocator::pageSize = getpagesize();
+}
+
+bool ExecutableAllocator::isValid() const
+{
+ SpinLockHolder lock_holder(&spinlock);
+ if (!allocator)
+ allocator = new FixedVMPoolAllocator();
+ 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 allocator && (allocator->allocated() > (FixedVMPoolPageTables::size() / 2));
+}
+
+ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t size)
+{
+ SpinLockHolder lock_holder(&spinlock);
+ ASSERT(allocator);
+ return allocator->alloc(size);
+}
+
+void ExecutablePool::systemRelease(ExecutablePool::Allocation& allocation)
+{
+ SpinLockHolder lock_holder(&spinlock);
+ ASSERT(allocator);
+ allocator->free(allocation);
+}
+
+}
+
+
+#endif // HAVE(ASSEMBLER)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.cpp
new file mode 100644
index 0000000..981e2e1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.cpp
@@ -0,0 +1,633 @@
+/*
+ * 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"
+#include "dfg/DFGNode.h" // for DFG_SUCCESS_STATS
+
+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)
+ : 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
+{
+}
+
+#if USE(JSVALUE32_64)
+void JIT::emitTimeoutCheck()
+{
+ Jump skipTimeout = branchSub32(NonZero, TrustedImm32(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, TrustedImm32(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 (atJumpTarget())
+ 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_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) {
+#if DFG_SUCCESS_STATS
+ static SamplingCounter counter("orignalJIT");
+ emitCount(counter);
+#endif
+
+ // 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().addressOfEnd()), regT1);
+ }
+
+ Label functionBody = label();
+
+ privateCompileMainPass();
+ privateCompileLinkPass();
+ privateCompileSlowCases();
+
+ Label arityCheck;
+ 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, TrustedImm32(m_codeBlock->m_numParameters)).linkTo(beginLabel, this);
+ restoreArgumentReference();
+
+ JITStubCall(this, m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck).call(callFrameRegister);
+
+ jump(beginLabel);
+ }
+
+ ASSERT(m_jmpTable.isEmpty());
+
+ LinkBuffer patchBuffer(this, m_globalData->executableAllocator);
+
+ // 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.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)
+ *functionEntryArityCheck = patchBuffer.locationOf(arityCheck);
+
+ return patchBuffer.finalizeCode();
+}
+
+#if ENABLE(JIT_OPTIMIZE_CALL)
+
+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());
+ callLinkInfo->callee.set(*globalData, callerCodeBlock->ownerExecutable(), callee);
+ 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());
+ callLinkInfo->callee.set(*globalData, callerCodeBlock->ownerExecutable(), callee);
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.h
new file mode 100644
index 0000000..d05101f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JIT.h
@@ -0,0 +1,1045 @@
+/*
+ * 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_UNUSED(variable, actual, expected) ASSERT_WITH_MESSAGE_UNUSED(variable, actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(expected), static_cast<int>(actual));
+#define ASSERT_JIT_OFFSET(actual, expected) ASSERT_WITH_MESSAGE(actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(expected), static_cast<int>(actual));
+
+#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)
+ {
+ return JIT(globalData, codeBlock).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);
+ jit.privateCompileCTIMachineTrampolines(executablePool, globalData, trampolines);
+ }
+
+ static CodePtr compileCTINativeCall(JSGlobalData* globalData, PassRefPtr<ExecutablePool> executablePool, NativeFunction func)
+ {
+ if (!globalData->canUseJIT())
+ return CodePtr();
+ JIT jit(globalData, 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(JSGlobalData&, 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*);
+
+ private:
+ struct JSRInfo {
+ DataLabelPtr storeLocation;
+ Label target;
+
+ JSRInfo(DataLabelPtr storeLocation, Label targetLocation)
+ : storeLocation(storeLocation)
+ , target(targetLocation)
+ {
+ }
+ };
+
+ JIT(JSGlobalData*, CodeBlock* = 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, TrustedImm32 payload, bool indexIsInt32 = false);
+ void emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell = false);
+ void emitStoreBool(unsigned index, RegisterID payload, 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 resultTag, RegisterID resultPayload, size_t cachedOffset);
+ void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, 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 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 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 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 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 patchOffsetPutByIdPropertyMapOffset1 = 36;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 48;
+ // 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 patchOffsetGetByIdPropertyMapOffset1 = 36;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 48;
+ static const int patchOffsetGetByIdPutResult = 52;
+#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 patchOffsetPutByIdPropertyMapOffset1 = 56;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 72;
+ static const int patchOffsetGetByIdStructure = 16;
+ static const int patchOffsetGetByIdBranchToSlowCase = 48;
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 56;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 76;
+ static const int patchOffsetGetByIdPutResult = 96;
+#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 patchOffsetPutByIdPropertyMapOffset1 = 48;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 64;
+ static const int patchOffsetGetByIdStructure = 12;
+ static const int patchOffsetGetByIdBranchToSlowCase = 44;
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 48;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 64;
+ static const int patchOffsetGetByIdPutResult = 80;
+#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
+#elif CPU(SH4)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetGetByIdStructure = 6;
+ static const int patchOffsetPutByIdPropertyMapOffset = 24;
+ static const int patchOffsetPutByIdStructure = 6;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdBranchToSlowCase = 10;
+ static const int patchOffsetGetByIdPropertyMapOffset = 24;
+ static const int patchOffsetGetByIdPutResult = 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 = 5;
+ // sequenceGetByIdSlowCase
+ static const int sequenceGetByIdSlowCaseInstructionSpace = 26;
+ static const int sequenceGetByIdSlowCaseConstantSpace = 2;
+ // sequencePutById
+ static const int sequencePutByIdInstructionSpace = 36;
+ static const int sequencePutByIdConstantSpace = 5;
+
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 20;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 26;
+
+ static const int patchOffsetPutByIdPropertyMapOffset1 = 20;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 26;
+
+#if ENABLE(OPCODE_SAMPLING)
+ static const int patchOffsetGetByIdSlowCaseCall = 0; // FIMXE
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 22;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 4;
+
+ static const int patchOffsetMethodCheckProtoObj = 12;
+ static const int patchOffsetMethodCheckProtoStruct = 20;
+ static const int patchOffsetMethodCheckPutFunction = 32;
+#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 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 result, size_t cachedOffset);
+ void compileGetDirectOffset(RegisterID base, RegisterID result, 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 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 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 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 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 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 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 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 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 patchOffsetPutByIdPropertyMapOffset = 68;
+ static const int patchOffsetGetByIdStructure = 16;
+ static const int patchOffsetGetByIdBranchToSlowCase = 48;
+ 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 patchOffsetPutByIdPropertyMapOffset = 60;
+ static const int patchOffsetGetByIdStructure = 12;
+ static const int patchOffsetGetByIdBranchToSlowCase = 44;
+ 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_FOR_PUT(name, dst) do { endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace, dst); } while (false)
+#define END_UNINTERRUPTED_SEQUENCE(name) END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, 0)
+
+ void beginUninterruptedSequence(int, int);
+ void endUninterruptedSequence(int, int, int);
+
+#else
+#define BEGIN_UNINTERRUPTED_SEQUENCE(name) do { beginUninterruptedSequence(); } while (false)
+#define END_UNINTERRUPTED_SEQUENCE(name) do { endUninterruptedSequence(); } while (false)
+#define END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, dst) 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_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 emitPutCellToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry);
+ void emitPutIntToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry);
+ 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);
+
+ bool atJumpTarget();
+
+ 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;
+#endif
+ unsigned m_jumpTargetsPosition;
+
+#ifndef NDEBUG
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+ Label m_uninterruptedInstructionSequenceBegin;
+ int m_uninterruptedConstantSequenceBegin;
+#endif
+#endif
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITArithmetic.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITArithmetic.cpp
new file mode 100644
index 0000000..c2a84c5
--- /dev/null
+++ b/src/3rdparty/webkit/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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImmPtr(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(((TagTypeNumber + 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, types, 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, types, 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp
new file mode 100644
index 0000000..6865489
--- /dev/null
+++ b/src/3rdparty/webkit/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, TrustedImm32(JSValue::Int32Tag));
+ addSlowCase(branchTest32(Zero, regT0, TrustedImm32(0x7fffffff)));
+ neg32(regT0);
+ emitStoreInt32(dst, regT0, (dst == src));
+
+ Jump end = jump();
+
+ srcNotInt.link(this);
+ addSlowCase(branch32(Above, regT1, TrustedImm32(JSValue::LowestTag)));
+
+ xor32(TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThanOrEqual, regT2, Imm32(getConstantOperand(op1).asInt32())), target);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ notInt32Op1.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addJump(branch32(GreaterThanOrEqual, regT0, Imm32(getConstantOperand(op2).asInt32())), target);
+ } else {
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ addJump(branch32(GreaterThan, regT2, Imm32(getConstantOperand(op1).asInt32())), target);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ notInt32Op1.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThan, regT0, Imm32(getConstantOperand(op2).asInt32())), target);
+ } else {
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
+ if (isUnsigned) {
+ urshift32(regT2, regT0);
+ addSlowCase(branch32(LessThan, regT0, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::LowestTag)); // op1 is not a double
+ emitLoadDouble(op1, fpRegT0);
+ Jump notInt = branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ and32(Imm32(constant), regT0);
+ emitStoreInt32(dst, regT0, (op == dst));
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ or32(Imm32(constant), regT0);
+ emitStoreInt32(dst, regT0, (op == dst));
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ xor32(Imm32(constant), regT0);
+ emitStoreInt32(dst, regT0, (op == dst));
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+
+ if (dst == srcDst) // x = x++ is a noop for ints.
+ return;
+
+ emitStoreInt32(dst, regT0);
+
+ addSlowCase(branchAdd32(Overflow, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+
+ if (dst == srcDst) // x = x-- is a noop for ints.
+ return;
+
+ emitStoreInt32(dst, regT0);
+
+ addSlowCase(branchSub32(Overflow, TrustedImm32(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(TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branchAdd32(Overflow, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branchSub32(Overflow, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::LowestTag)));
+
+ if (!op2IsInRegisters)
+ emitLoad(op2, regT3, regT2);
+
+ Jump doubleOp2 = branch32(Below, regT3, TrustedImm32(JSValue::LowestTag));
+
+ if (!types.second().definitelyIsNumber())
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ if (getConstantOperand(op2).asInt32() == -1)
+ addSlowCase(branch32(Equal, regT0, TrustedImm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
+ } else {
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
+
+ addSlowCase(branch32(Equal, regT0, TrustedImm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
+ addSlowCase(branch32(Equal, regT2, TrustedImm32(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, TrustedImm32(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, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
+
+ addSlowCase(branch32(Equal, regT2, TrustedImm32(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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall.cpp
new file mode 100644
index 0000000..77c2a698
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall.cpp
@@ -0,0 +1,264 @@
+/*
+ * 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()
+{
+ // regT0 holds callee, regT1 holds argCount
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), regT3); // scopeChain
+ emitPutIntToCallFrameHeader(regT1, RegisterFile::ArgumentCount);
+ emitPutCellToCallFrameHeader(regT0, RegisterFile::Callee);
+ emitPutCellToCallFrameHeader(regT3, RegisterFile::ScopeChain);
+}
+
+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);
+ emitFastArithImmToInt(regT1);
+ emitGetVirtualRegister(callee, regT0);
+ addPtr(Imm32(registerOffset), regT1, regT2);
+
+ // Check for JSFunctions.
+ emitJumpSlowCaseIfNotJSCell(regT0);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ mul32(TrustedImm32(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, TrustedImmPtr(JSValue::encode(JSValue())));
+ }
+
+ emitGetVirtualRegister(callee, regT0);
+
+ // Check for JSFunctions.
+ emitJumpSlowCaseIfNotJSCell(regT0);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(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, TrustedImmPtr(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, TrustedImmPtr(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)), regT1); // newScopeChain
+
+ store32(TrustedImm32(Int32Tag), intTagFor(registerOffset + RegisterFile::ArgumentCount));
+ store32(Imm32(argCount), intPayloadFor(registerOffset + RegisterFile::ArgumentCount));
+ 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), TrustedImmPtr(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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall32_64.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall32_64.cpp
new file mode 100644
index 0000000..9ffa495
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCall32_64.cpp
@@ -0,0 +1,348 @@
+/*
+ * 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
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain)), regT3); // scopeChain
+ emitPutIntToCallFrameHeader(regT1, RegisterFile::ArgumentCount);
+ emitPutCellToCallFrameHeader(regT0, RegisterFile::Callee);
+ emitPutCellToCallFrameHeader(regT3, RegisterFile::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), TrustedImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ mul32(TrustedImm32(sizeof(Register)), regT3, regT3);
+ addPtr(callFrameRegister, regT3);
+ store32(TrustedImm32(JSValue::CellTag), tagFor(RegisterFile::CallerFrame, regT3));
+ storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame, regT3));
+ 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;
+
+ 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;
+
+ emitLoad(result, regT1, regT0);
+ Jump notJSCell = branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag));
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
+ Jump notObject = branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(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, TrustedImm32(JSValue::EmptyValueTag));
+ }
+
+ emitLoad(callee, regT1, regT0);
+
+ emitJumpSlowCaseIfNotJSCell(callee, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ store32(TrustedImm32(JSValue::CellTag), tagFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
+ storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
+ addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
+ move(TrustedImm32(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, TrustedImm32(JSValue::EmptyValueTag));
+ }
+
+ emitLoad(callee, regT1, regT0);
+
+ DataLabelPtr addressOfLinkedFunctionCheck;
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, TrustedImmPtr(0));
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ addSlowCase(jumpToSlow);
+ ASSERT_JIT_OFFSET(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow), patchOffsetOpCallCompareToJump);
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
+
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(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)), regT2);
+
+ store32(TrustedImm32(JSValue::Int32Tag), tagFor(registerOffset + RegisterFile::ArgumentCount));
+ store32(Imm32(argCount), payloadFor(registerOffset + RegisterFile::ArgumentCount));
+ storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
+ emitStore(registerOffset + RegisterFile::Callee, regT1, regT0);
+ store32(TrustedImm32(JSValue::CellTag), tagFor(registerOffset + RegisterFile::ScopeChain));
+ store32(regT2, payloadFor(registerOffset + RegisterFile::ScopeChain));
+ 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, TrustedImm32(JSValue::CellTag));
+ Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsFunctionVPtr));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ store32(TrustedImm32(JSValue::CellTag), tagFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
+ storePtr(callFrameRegister, payloadFor(RegisterFile::CallerFrame + registerOffset, callFrameRegister));
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCode.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITCode.h
new file mode 100644
index 0000000..7346fd5
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITInlineMethods.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITInlineMethods.h
new file mode 100644
index 0000000..693ae98
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITInlineMethods.h
@@ -0,0 +1,858 @@
+/*
+ * 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, payloadFor(entry, callFrameRegister));
+}
+
+ALWAYS_INLINE void JIT::emitPutCellToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry)
+{
+#if USE(JSVALUE32_64)
+ store32(TrustedImm32(JSValue::CellTag), tagFor(entry, callFrameRegister));
+#endif
+ storePtr(from, payloadFor(entry, callFrameRegister));
+}
+
+ALWAYS_INLINE void JIT::emitPutIntToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry)
+{
+ store32(TrustedImm32(Int32Tag), intTagFor(entry, callFrameRegister));
+ store32(from, intPayloadFor(entry, callFrameRegister));
+}
+
+ALWAYS_INLINE void JIT::emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry)
+{
+ storePtr(TrustedImmPtr(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), TrustedImmPtr(m_globalData->jsStringVPtr)));
+ failures.append(branchTest32(NonZero, Address(src, OBJECT_OFFSETOF(JSString, m_fiberCount))));
+ failures.append(branch32(NotEqual, MacroAssembler::Address(src, ThunkHelpers::jsStringLengthOffset()), TrustedImm32(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;
+}
+
+ALWAYS_INLINE bool JIT::atJumpTarget()
+{
+ while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= m_bytecodeOffset) {
+ if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == m_bytecodeOffset)
+ return true;
+ ++m_jumpTargetsPosition;
+ }
+ return false;
+}
+
+#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);
+
+#elif CPU(SH4)
+#ifndef NDEBUG
+ insnSpace += sizeof(SH4Word);
+ constSpace += sizeof(uint64_t);
+#endif
+
+ m_assembler.ensureSpace(insnSpace + m_assembler.maxInstructionSize + 2, constSpace + 8);
+#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, int dst)
+{
+ UNUSED_PARAM(dst);
+#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.
+ */
+#if CPU(SH4)
+ if ((dst > 15) || (dst < -16)) {
+ insnSpace += 8;
+ constSpace += 2;
+ }
+
+ if (((dst >= -16) && (dst < 0)) || ((dst > 7) && (dst <= 15)))
+ insnSpace += 8;
+#endif
+ 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(SH4)
+
+ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
+{
+ m_assembler.stspr(reg);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
+{
+ m_assembler.ldspr(reg);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
+{
+ loadPtrLinkReg(address);
+}
+
+#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(TrustedImm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister);
+#elif CPU(ARM)
+ move(stackPointerRegister, firstArgumentRegister);
+#elif CPU(SH4)
+ 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, JSCell::structureOffset()), TrustedImmPtr(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(TrustedImm32(1u << (flag - 1)), AbsoluteAddress(SamplingFlags::addressOfFlags()));
+}
+
+ALWAYS_INLINE void JIT::clearSamplingFlag(int32_t flag)
+{
+ ASSERT(flag >= 1);
+ ASSERT(flag <= 32);
+ and32(TrustedImm32(~(1u << (flag - 1))), AbsoluteAddress(SamplingFlags::addressOfFlags()));
+}
+#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(TrustedImm32(count), AbsoluteAddress(counter.addressOfCounter()));
+#elif CPU(X86) // Or any other little-endian 32-bit plattform.
+ intptr_t hiWord = reinterpret_cast<intptr_t>(counter.addressOfCounter()) + sizeof(int32_t);
+ add32(TrustedImm32(count), AbsoluteAddress(counter.addressOfCounter()));
+ addWithCarry32(TrustedImm32(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(TrustedImmPtr(m_interpreter->sampler()->sampleSlot()), X86Registers::ecx);
+ storePtr(TrustedImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), X86Registers::ecx);
+}
+#else
+ALWAYS_INLINE void JIT::sampleInstruction(Instruction* instruction, bool inHostFunction)
+{
+ storePtr(TrustedImmPtr(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(TrustedImmPtr(m_interpreter->sampler()->codeBlockSlot()), X86Registers::ecx);
+ storePtr(TrustedImmPtr(codeBlock), X86Registers::ecx);
+}
+#else
+ALWAYS_INLINE void JIT::sampleCodeBlock(CodeBlock* codeBlock)
+{
+ storePtr(TrustedImmPtr(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)) {
+ WriteBarrier<Unknown>& 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)) {
+ WriteBarrier<Unknown>& 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(TrustedImm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
+}
+
+inline void JIT::emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32)
+{
+ store32(payload, payloadFor(index, callFrameRegister));
+ if (!indexIsInt32)
+ store32(TrustedImm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
+}
+
+inline void JIT::emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell)
+{
+ store32(payload, payloadFor(index, callFrameRegister));
+ if (!indexIsCell)
+ store32(TrustedImm32(JSValue::CellTag), tagFor(index, callFrameRegister));
+}
+
+inline void JIT::emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool)
+{
+ store32(payload, payloadFor(index, callFrameRegister));
+ if (!indexIsBool)
+ store32(TrustedImm32(JSValue::BooleanTag), 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, TrustedImm32(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) && !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(TrustedImmPtr(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, TrustedImm32(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, TrustedImm32(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)) {
+ WriteBarrier<Unknown>& 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)) {
+ ASSERT(isOperandConstantImmediateInt(index));
+ convertInt32ToDouble(Imm32(getConstantOperand(index).asInt32()), 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, TrustedImm32(TagTypeNumber));
+#endif
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotImmediateInteger(RegisterID reg)
+{
+#if USE(JSVALUE64)
+ return branchPtr(Below, reg, tagTypeNumberRegister);
+#else
+ return branchTest32(Zero, reg, TrustedImm32(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(TrustedImm32(TagTypeNumber), reg);
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitFastArithDeTagImmediateJumpIfZero(RegisterID reg)
+{
+ return branchSubPtr(Zero, TrustedImm32(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(TrustedImm32(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)
+{
+ or32(TrustedImm32(static_cast<int32_t>(ValueFalse)), reg);
+}
+
+#endif // USE(JSVALUE32_64)
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes.cpp
new file mode 100644
index 0000000..f4c416d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes.cpp
@@ -0,0 +1,1750 @@
+/*
+ * 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)
+
+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), TrustedImmPtr(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(LessThan, regT0, TrustedImm32(0));
+
+ // 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)), TrustedImm32(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)), TrustedImm32(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(TrustedImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, 1 + OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+ poke(TrustedImmPtr(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);
+
+#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);
+ emitPutCellToCallFrameHeader(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(TrustedImm32(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(TrustedImm32(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);
+ emitPutCellToCallFrameHeader(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);
+ emitPutCellToCallFrameHeader(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(TrustedImm32(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(TrustedImm32(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(TrustedImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+
+ // Set the return address.
+ move(TrustedImmPtr(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)
+{
+ 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);
+}
+
+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, JSCell::structureOffset()), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, Structure::typeInfoFlagsOffset()), TrustedImm32(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, JSCell::structureOffset()), regT3);
+ addSlowCase(branch8(NotEqual, Address(regT3, Structure::typeInfoTypeOffset()), TrustedImm32(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, JSCell::structureOffset()), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, Structure::typeInfoFlagsOffset()), TrustedImm32(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(TrustedImmPtr(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, JSCell::structureOffset()), regT2);
+ loadPtr(Address(regT2, Structure::prototypeOffset()), 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(TrustedImmPtr(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();
+ loadPtr(&globalObject->m_registers, regT0);
+ loadPtr(Address(regT0, currentInstruction[2].u.operand * sizeof(Register)), 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();
+ loadPtr(&globalObject->m_registers, regT0);
+ storePtr(regT1, Address(regT0, currentInstruction[1].u.operand * sizeof(Register)));
+}
+
+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);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSVariableObject, m_registers)), regT0);
+ loadPtr(Address(regT0, currentInstruction[2].u.operand * sizeof(Register)), 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);
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSVariableObject, m_registers)), regT1);
+ storePtr(regT0, Address(regT1, currentInstruction[1].u.operand * sizeof(Register)));
+}
+
+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)
+{
+ 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)
+{
+ 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, JSCell::structureOffset()), regT2);
+ Jump notObject = branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(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(TrustedImmPtr(&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), TrustedImmPtr(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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(globalObject), regT0);
+ loadPtr(structureAddress, regT1);
+ addSlowCase(branchPtr(NotEqual, regT1, Address(regT0, JSCell::structureOffset()))); // Structures don't match
+
+ // Load cached property
+ // Assume that the global object always uses external storage.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_propertyStorage)), 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(TrustedImmPtr(ident));
+ stubCall.addArgument(Imm32(currentIndex));
+ stubCall.addArgument(regT0);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_not(Instruction* currentInstruction)
+{
+ emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
+
+ // Invert against JSValue(false); if the value was tagged as a boolean, then all bits will be
+ // clear other than the low bit (which will be 0 or 1 for false or true inputs respectively).
+ // Then invert against JSValue(true), which will add the tag back in, and flip the low bit.
+ xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), regT0);
+ addSlowCase(branchTestPtr(NonZero, regT0, TrustedImm32(static_cast<int32_t>(~1))));
+ xorPtr(TrustedImm32(static_cast<int32_t>(ValueTrue)), 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, TrustedImmPtr(JSValue::encode(jsNumber(0)))), target);
+ Jump isNonZero = emitJumpIfImmediateInteger(regT0);
+
+ addJump(branchPtr(Equal, regT0, TrustedImmPtr(JSValue::encode(jsBoolean(false)))), target);
+ addSlowCase(branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(jsBoolean(true)))));
+
+ isNonZero.link(this);
+}
+
+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, JSCell::structureOffset()), regT2);
+ addJump(branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target);
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+ andPtr(TrustedImm32(~TagBitUndefined), regT0);
+ addJump(branchPtr(Equal, regT0, TrustedImmPtr(JSValue::encode(jsNull()))), target);
+
+ wasNotImmediate.link(this);
+};
+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, JSCell::structureOffset()), regT2);
+ addJump(branchTest8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target);
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+ andPtr(TrustedImm32(~TagBitUndefined), regT0);
+ addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(jsNull()))), target);
+
+ wasNotImmediate.link(this);
+}
+
+void JIT::emit_op_jneq_ptr(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ JSCell* ptr = currentInstruction[2].u.jsCell.get();
+ unsigned target = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegister(src, regT0);
+ addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(JSValue(ptr)))), target);
+}
+
+void JIT::emit_op_jsr(Instruction* currentInstruction)
+{
+ int retAddrDst = currentInstruction[1].u.operand;
+ int target = currentInstruction[2].u.operand;
+ DataLabelPtr storeLocation = storePtrWithPatch(TrustedImmPtr(0), Address(callFrameRegister, sizeof(Register) * retAddrDst));
+ addJump(jump(), target);
+ m_jsrSites.append(JSRInfo(storeLocation, label()));
+ killLastResultRegister();
+}
+
+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);
+ compare32(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(TrustedImmPtr(&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(TrustedImmPtr(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, TrustedImmPtr(JSValue::encode(jsNumber(0))));
+ addJump(emitJumpIfImmediateInteger(regT0), target);
+
+ addJump(branchPtr(Equal, regT0, TrustedImmPtr(JSValue::encode(jsBoolean(true)))), target);
+ addSlowCase(branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(jsBoolean(false)))));
+
+ isZero.link(this);
+}
+
+void JIT::emit_op_neq(Instruction* currentInstruction)
+{
+ emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
+ emitJumpSlowCaseIfNotImmediateIntegers(regT0, regT1, regT2);
+ compare32(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, JSCell::structureOffset()), regT2);
+ isNotObject.append(branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(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);
+ storePtr(tagTypeNumberRegister, payloadFor(i));
+ store32(TrustedImm32(Int32Tag), intTagFor(size));
+ store32(regT3, intPayloadFor(size));
+ Jump end = jump();
+
+ isNotObject.link(this);
+ move(regT0, regT1);
+ and32(TrustedImm32(~TagBitUndefined), regT1);
+ addJump(branch32(Equal, regT1, TrustedImm32(ValueNull)), 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(intPayloadFor(i), regT0);
+ Jump end = branch32(Equal, regT0, intPayloadFor(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(TrustedImm32(1), regT0);
+ store32(regT0, intPayloadFor(i));
+
+ // Verify that i is valid:
+ emitGetVirtualRegister(base, regT0);
+
+ // Test base's structure
+ loadPtr(Address(regT0, JSCell::structureOffset()), 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, Structure::prototypeOffset()), regT2);
+ callHasProperty.append(emitJumpIfNotJSCell(regT2));
+ loadPtr(Address(regT2, JSCell::structureOffset()), regT2);
+ callHasProperty.append(branchPtr(NotEqual, regT2, Address(regT3)));
+ addPtr(TrustedImm32(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)
+ compare32(Equal, regT1, regT0, regT0);
+ else
+ compare32(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, JSCell::structureOffset()), regT2);
+ addSlowCase(branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(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(TrustedImmPtr(&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(TrustedImmPtr(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);
+}
+
+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_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, JSCell::structureOffset()), regT2);
+ test8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT0);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ andPtr(TrustedImm32(~TagBitUndefined), regT0);
+ comparePtr(Equal, regT0, TrustedImm32(ValueNull), 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, JSCell::structureOffset()), regT2);
+ test8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT0);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ andPtr(TrustedImm32(~TagBitUndefined), regT0);
+ comparePtr(NotEqual, regT0, TrustedImm32(ValueNull), 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(TrustedImmPtr(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, JSCell::structureOffset()), regT1);
+ addSlowCase(branchTest8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(NeedsThisConversion)));
+}
+
+void JIT::emit_op_convert_this_strict(Instruction* currentInstruction)
+{
+ emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
+ Jump notNull = branchTestPtr(NonZero, regT0);
+ move(TrustedImmPtr(JSValue::encode(jsNull())), regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand, regT0);
+ Jump setThis = jump();
+ notNull.link(this);
+ Jump isImmediate = emitJumpIfNotJSCell(regT0);
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT1);
+ Jump notAnObject = branch8(NotEqual, Address(regT1, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+ addSlowCase(branchTest8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(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(TrustedImm32(static_cast<int32_t>(ValueFalse)), 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(TrustedImm32(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(TrustedImm32(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(TrustedImmPtr(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(TrustedImm32(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(TrustedImm32(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(TrustedImmPtr(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(TrustedImmPtr(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(TrustedImmPtr(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), TrustedImm32(JSValue::EmptyValueTag)));
+#else
+ addSlowCase(branchTestPtr(NonZero, addressFor(argsOffset)));
+#endif
+ // Load arg count into regT0
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
+ store32(TrustedImm32(Int32Tag), intTagFor(argCountDst));
+ store32(regT0, intPayloadFor(argCountDst));
+ Jump endBranch = branch32(Equal, regT0, TrustedImm32(1));
+
+ mul32(TrustedImm32(sizeof(Register)), regT0, regT3);
+ addPtr(TrustedImm32(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().addressOfEnd()), regT3));
+
+ sub32(TrustedImm32(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, TrustedImm32(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();
+
+ store32(TrustedImm32(Int32Tag), intTagFor(argCountDst));
+ store32(returnValueRegister, intPayloadFor(argCountDst));
+}
+
+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), TrustedImm32(JSValue::EmptyValueTag));
+#else
+ lazyJump = branchTestPtr(NonZero, addressFor(dst));
+#endif
+ }
+ JITStubCall stubCall(this, cti_op_new_func);
+ stubCall.addArgument(TrustedImmPtr(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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
new file mode 100644
index 0000000..2f657e7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
@@ -0,0 +1,1847 @@
+/*
+ * 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, TrustedImm32(JSValue::CellTag));
+ Jump string_failureCases2 = branchPtr(NotEqual, Address(regT0), TrustedImmPtr(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, TrustedImm32(INT_MAX));
+ move(regT2, regT0);
+ move(TrustedImm32(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)), TrustedImm32(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)), TrustedImm32(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(TrustedImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, 1 + OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+ poke(TrustedImmPtr(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);
+
+#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);
+ emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ peek(regT1);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ReturnPC);
+
+ // Calling convention: f(ecx, edx, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, X86Registers::ecx);
+
+ subPtr(TrustedImm32(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(TrustedImm32(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);
+ emitPutCellToCallFrameHeader(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(SH4)
+ // 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 == regT4, r1 == regT5, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, regT4);
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT5);
+ move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ loadPtr(Address(regT5, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+
+ call(Address(regT2, executableOffsetToFunction), regT0);
+ 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);
+ emitPutCellToCallFrameHeader(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(TrustedImm32(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(TrustedImm32(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)), TrustedImm32(JSValue::EmptyValueTag));
+
+ // Return.
+ ret();
+
+ // Handle an exception
+ sawException.link(this);
+
+ // Grab the return address.
+ preserveReturnAddressAfterCall(regT1);
+
+ move(TrustedImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+
+ // Set the return address.
+ move(TrustedImmPtr(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);
+ emitPutCellToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ peek(regT1);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ReturnPC);
+
+ // Calling convention: f(ecx, edx, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, X86Registers::ecx);
+
+ subPtr(TrustedImm32(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(TrustedImm32(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);
+ emitPutCellToCallFrameHeader(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);
+ emitPutCellToCallFrameHeader(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(TrustedImm32(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(TrustedImm32(16), stackPointerRegister);
+
+ restoreReturnAddressBeforeReturn(regT3);
+#elif CPU(SH4)
+ // 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 == regT4, r1 == regT5, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, regT4);
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT5);
+ move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ loadPtr(Address(regT5, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+
+ // call the function
+ nativeCall = call();
+
+ 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)), TrustedImm32(JSValue::EmptyValueTag));
+
+ // Return.
+ ret();
+
+ // Handle an exception
+ sawException.link(this);
+
+ // Grab the return address.
+ preserveReturnAddressAfterCall(regT1);
+
+ move(TrustedImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+
+ // Set the return address.
+ move(TrustedImmPtr(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);
+
+ 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)
+{
+ 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, TrustedImm32(JSValue::Int32Tag)));
+ addJump(branch32(GreaterThanOrEqual, regT0, Imm32(getConstantOperand(op1).asInt32())), target);
+ return;
+ }
+
+ if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThanOrEqual, regT0, Imm32(getConstantOperand(op2).asInt32())), target);
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, TrustedImm32(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, JSCell::structureOffset()), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, Structure::typeInfoFlagsOffset()), TrustedImm32(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, JSCell::structureOffset()), regT3);
+ addSlowCase(branch8(NotEqual, Address(regT3, Structure::typeInfoTypeOffset()), TrustedImm32(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, JSCell::structureOffset()), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, Structure::typeInfoFlagsOffset()), TrustedImm32(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(TrustedImm32(1), 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, JSCell::structureOffset()), regT2);
+ load32(Address(regT2, Structure::prototypeOffset() + 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(TrustedImm32(0), 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->m_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->m_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()), TrustedImm32(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, m_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()), TrustedImm32(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, m_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), TrustedImm32(JSValue::EmptyValueTag));
+ Jump argumentsNotCreated = branch32(Equal, tagFor(arguments), TrustedImm32(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)), TrustedImm32(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(TrustedImmPtr(&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, TrustedImm32(JSValue::CellTag));
+ addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(globalObject), regT0);
+ loadPtr(structureAddress, regT1);
+ addSlowCase(branchPtr(NotEqual, regT1, Address(regT0, JSCell::structureOffset())));
+
+ // Load property.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_propertyStorage)), 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(TrustedImmPtr(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);
+
+ emitLoad(src, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::BooleanTag)));
+ xor32(TrustedImm32(1), 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);
+
+ ASSERT((JSValue::BooleanTag + 1 == JSValue::Int32Tag) && !(JSValue::Int32Tag + 1));
+ addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::BooleanTag)));
+ addJump(branchTest32(Zero, regT0), target);
+}
+
+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);
+
+ if (supportsFloatingPoint()) {
+ // regT1 contains the tag from the hot path.
+ Jump notNumber = branch32(Above, regT1, Imm32(JSValue::LowestTag));
+
+ emitLoadDouble(cond, fpRegT0);
+ emitJumpSlowToHot(branchDoubleZeroOrNaN(fpRegT0, fpRegT1), target);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jfalse));
+
+ notNumber.link(this);
+ }
+
+ 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);
+
+ ASSERT((JSValue::BooleanTag + 1 == JSValue::Int32Tag) && !(JSValue::Int32Tag + 1));
+ addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::BooleanTag)));
+ addJump(branchTest32(NonZero, regT0), target);
+}
+
+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);
+
+ if (supportsFloatingPoint()) {
+ // regT1 contains the tag from the hot path.
+ Jump notNumber = branch32(Above, regT1, Imm32(JSValue::LowestTag));
+
+ emitLoadDouble(cond, fpRegT0);
+ emitJumpSlowToHot(branchDoubleNonZero(fpRegT0, fpRegT1), target);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jtrue));
+
+ notNumber.link(this);
+ }
+
+ 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, TrustedImm32(JSValue::CellTag));
+
+ // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
+ addJump(branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target);
+
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+
+ ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && (JSValue::NullTag & 0x1));
+ or32(TrustedImm32(1), regT1);
+ addJump(branch32(Equal, regT1, TrustedImm32(JSValue::NullTag)), 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, TrustedImm32(JSValue::CellTag));
+
+ // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
+ addJump(branchTest8(Zero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)), target);
+
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+
+ ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && (JSValue::NullTag & 0x1));
+ or32(TrustedImm32(1), regT1);
+ addJump(branch32(NotEqual, regT1, TrustedImm32(JSValue::NullTag)), target);
+
+ wasNotImmediate.link(this);
+}
+
+void JIT::emit_op_jneq_ptr(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ JSCell* ptr = currentInstruction[2].u.jsCell.get();
+ unsigned target = currentInstruction[3].u.operand;
+
+ emitLoad(src, regT1, regT0);
+ addJump(branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)), target);
+ addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(ptr)), target);
+}
+
+void JIT::emit_op_jsr(Instruction* currentInstruction)
+{
+ int retAddrDst = currentInstruction[1].u.operand;
+ int target = currentInstruction[2].u.operand;
+ DataLabelPtr storeLocation = storePtrWithPatch(TrustedImmPtr(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, TrustedImm32(JSValue::CellTag)));
+ addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::LowestTag)));
+
+ compare32(Equal, regT0, regT2, 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), TrustedImmPtr(m_globalData->jsStringVPtr)));
+ genericCase.append(branchPtr(NotEqual, Address(regT2), TrustedImmPtr(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);
+ 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, TrustedImm32(JSValue::CellTag)));
+ addSlowCase(branch32(Below, regT1, TrustedImm32(JSValue::LowestTag)));
+
+ compare32(NotEqual, regT0, regT2, 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), TrustedImmPtr(m_globalData->jsStringVPtr)));
+ genericCase.append(branchPtr(NotEqual, Address(regT2), TrustedImmPtr(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(TrustedImm32(0x1), 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, TrustedImm32(JSValue::LowestTag)));
+ addSlowCase(branch32(AboveOrEqual, regT2, TrustedImm32(JSValue::CellTag)));
+
+ if (type == OpStrictEq)
+ compare32(Equal, regT0, regT1, regT0);
+ else
+ compare32(NotEqual, regT0, regT1, 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, TrustedImm32(JSValue::CellTag));
+
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT1);
+ test8(NonZero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT1);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ compare32(Equal, regT1, TrustedImm32(JSValue::NullTag), regT2);
+ compare32(Equal, regT1, TrustedImm32(JSValue::UndefinedTag), regT1);
+ or32(regT2, regT1);
+
+ wasNotImmediate.link(this);
+
+ 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, TrustedImm32(JSValue::CellTag));
+
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT1);
+ test8(Zero, Address(regT1, Structure::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined), regT1);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ compare32(NotEqual, regT1, TrustedImm32(JSValue::NullTag), regT2);
+ compare32(NotEqual, regT1, TrustedImm32(JSValue::UndefinedTag), regT1);
+ and32(regT2, regT1);
+
+ wasNotImmediate.link(this);
+
+ emitStoreBool(dst, regT1);
+}
+
+void JIT::emit_op_resolve_with_base(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_resolve_with_base);
+ stubCall.addArgument(TrustedImmPtr(&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(TrustedImmPtr(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, TrustedImm32(JSValue::CellTag)));
+ if (base != m_codeBlock->thisRegister() || m_codeBlock->isStrictMode()) {
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
+ isNotObject.append(branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(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(TrustedImm32(Int32Tag), intTagFor(i));
+ store32(TrustedImm32(0), intPayloadFor(i));
+ store32(TrustedImm32(Int32Tag), intTagFor(size));
+ store32(regT3, payloadFor(size));
+ Jump end = jump();
+
+ isNotObject.link(this);
+ addJump(branch32(Equal, regT1, TrustedImm32(JSValue::NullTag)), breakTarget);
+ addJump(branch32(Equal, regT1, TrustedImm32(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(intPayloadFor(i), regT0);
+ Jump end = branch32(Equal, regT0, intPayloadFor(size));
+
+ // Grab key @ i
+ loadPtr(payloadFor(it), regT1);
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStrings)), regT2);
+ load32(BaseIndex(regT2, regT0, TimesEight), regT2);
+ store32(TrustedImm32(JSValue::CellTag), tagFor(dst));
+ store32(regT2, payloadFor(dst));
+
+ // Increment i
+ add32(TrustedImm32(1), regT0);
+ store32(regT0, intPayloadFor(i));
+
+ // Verify that i is valid:
+ loadPtr(payloadFor(base), regT0);
+
+ // Test base's structure
+ loadPtr(Address(regT0, JSCell::structureOffset()), 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, Structure::prototypeOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), TrustedImm32(JSValue::NullTag)));
+ loadPtr(Address(regT2, Structure::prototypeOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT2);
+ loadPtr(Address(regT2, JSCell::structureOffset()), regT2);
+ callHasProperty.append(branchPtr(NotEqual, regT2, Address(regT3)));
+ addPtr(TrustedImm32(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, TrustedImm32(JSValue::Int32Tag));
+ addSlowCase(branch32(AboveOrEqual, regT1, TrustedImm32(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(TrustedImmPtr(&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(TrustedImm32(JSValue().payload()), Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)));
+ store32(TrustedImm32(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_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), TrustedImm32(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), TrustedImm32(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, TrustedImm32(JSValue::CellTag)));
+
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
+ addSlowCase(branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(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, TrustedImm32(JSValue::EmptyValueTag));
+ emitStore(thisRegister, jsNull());
+ Jump setThis = jump();
+ notNull.link(this);
+ Jump isImmediate = branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag));
+ loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
+ Jump notAnObject = branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+ addSlowCase(branchTest8(NonZero, Address(regT2, Structure::typeInfoFlagsOffset()), TrustedImm32(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), TrustedImm32(JSValue::EmptyValueTag)));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
+ sub32(TrustedImm32(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(TrustedImmPtr(&(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), TrustedImm32(JSValue::EmptyValueTag)));
+ emitLoad(property, regT1, regT2);
+ addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
+ add32(TrustedImm32(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(TrustedImm32(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(TrustedImm32(0), regT1);
+
+ // Check for negative result reminder
+ Jump positiveRegT3 = branch32(GreaterThanOrEqual, regT3, TrustedImm32(0));
+ neg32(regT3);
+ xor32(TrustedImm32(1), regT1);
+ positiveRegT3.link(this);
+
+ Jump positiveRegT2 = branch32(GreaterThanOrEqual, regT2, TrustedImm32(0));
+ neg32(regT2);
+ xor32(TrustedImm32(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(TrustedImm32(1), regT0);
+ Jump powerOfTwo = branchTest32(NonZero, 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, TrustedImm32(31));
+
+ neg32(regT1);
+ add32(TrustedImm32(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, TrustedImm32(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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
new file mode 100644
index 0000000..32e42af
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
@@ -0,0 +1,1038 @@
+/*
+ * 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"
+
+#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 {
+#if USE(JSVALUE64)
+
+JIT::CodePtr JIT::stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ JSInterfaceJIT jit;
+ JumpList failures;
+ failures.append(jit.branchPtr(NotEqual, Address(regT0), TrustedImmPtr(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, TrustedImm32(0x100)));
+ jit.move(TrustedImmPtr(globalData->smallStrings.singleCharacterStrings()), regT1);
+ jit.loadPtr(BaseIndex(regT1, regT0, ScalePtr, 0), regT0);
+ jit.ret();
+
+ failures.link(&jit);
+ jit.move(TrustedImm32(0), regT0);
+ jit.ret();
+
+ LinkBuffer patchBuffer(&jit, pool);
+ 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), TrustedImmPtr(m_globalData->jsArrayVPtr)));
+
+ loadPtr(Address(regT0, JSArray::storageOffset()), regT2);
+ addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, JSArray::vectorLengthOffset())));
+
+ 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), TrustedImmPtr(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 offset, RegisterID scratch)
+{
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), scratch);
+ loadPtr(BaseIndex(scratch, offset, ScalePtr, 0), result);
+}
+
+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, JSCell::structureOffset()), regT2);
+ addSlowCase(branchPtr(NotEqual, regT2, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure))));
+ load32(addressFor(i), regT3);
+ sub32(TrustedImm32(1), regT3);
+ addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots))));
+ compileGetDirectOffset(regT0, regT0, 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), TrustedImmPtr(m_globalData->jsArrayVPtr)));
+ addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, JSArray::vectorLengthOffset())));
+
+ loadPtr(Address(regT0, JSArray::storageOffset()), 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(TrustedImm32(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(TrustedImm32(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(TrustedImm32(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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(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(TrustedImmPtr(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, JSCell::structureOffset()), info.structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch(TrustedImmPtr(0), regT1);
+ Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT1, JSCell::structureOffset()), protoStructureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+
+ // This will be relinked to load the function without doing a load.
+ DataLabelPtr putFunction = moveWithPatch(TrustedImmPtr(0), regT0);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
+ Jump match = jump();
+
+ ASSERT_JIT_OFFSET_UNUSED(protoObj, differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj);
+ ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoStructureToCompare), patchOffsetMethodCheckProtoStruct);
+ ASSERT_JIT_OFFSET_UNUSED(putFunction, 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, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ addSlowCase(structureCheck);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetGetByIdStructure);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureCheck), patchOffsetGetByIdBranchToSlowCase)
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT0);
+ DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0);
+ ASSERT_JIT_OFFSET_UNUSED(displacementLabel, 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(TrustedImmPtr(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, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))));
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetPutByIdStructure);
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT0);
+ DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset));
+
+ END_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
+ ASSERT_JIT_OFFSET_UNUSED(displacementLabel, 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(TrustedImmPtr(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 += JSObject::offsetOfInlineStorage();
+ else
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), 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 += JSObject::offsetOfInlineStorage();
+ loadPtr(Address(base, offset), result);
+ } else {
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), result);
+ loadPtr(Address(result, offset), result);
+ }
+}
+
+void JIT::compileGetDirectOffset(JSObject* base, RegisterID result, size_t cachedOffset)
+{
+ loadPtr(static_cast<void*>(&base->m_propertyStorage[cachedOffset]), result);
+}
+
+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, JSCell::structureOffset()), TrustedImmPtr(oldStructure)));
+ testPrototype(oldStructure->storedPrototype(), failureCases);
+
+ // ecx = baseObject->m_structure
+ if (!direct) {
+ for (WriteBarrier<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(TrustedImm32(oldStructure->propertyStorageCapacity()));
+ stubCall.addArgument(TrustedImm32(newStructure->propertyStorageCapacity()));
+ stubCall.call(regT0);
+ emitGetJITStubArg(2, regT1);
+
+ restoreReturnAddressBeforeReturn(regT3);
+ }
+
+ storePtrWithWriteBarrier(TrustedImmPtr(newStructure), regT0, Address(regT0, JSCell::structureOffset()));
+
+ // 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());
+
+ 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;
+
+ // 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(JSGlobalData& globalData, CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ ASSERT(!methodCallLinkInfo.cachedStructure);
+ methodCallLinkInfo.cachedStructure.set(globalData, codeBlock->ownerExecutable(), structure);
+
+ Structure* prototypeStructure = proto->structure();
+ methodCallLinkInfo.cachedPrototypeStructure.set(globalData, codeBlock->ownerExecutable(), prototypeStructure);
+
+ 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;
+
+ // 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), TrustedImmPtr(m_globalData->jsArrayVPtr));
+
+ // Checks out okay! - get the length from the storage
+ loadPtr(Address(regT0, JSArray::storageOffset()), regT3);
+ load32(Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2);
+ Jump failureCases2 = branch32(LessThan, regT2, TrustedImm32(0));
+
+ emitFastArithIntToImmNoCheck(regT2, regT0);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ // 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.
+ move(TrustedImmPtr(protoObject), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, Address(regT3, JSCell::structureOffset()), TrustedImmPtr(prototypeStructure));
+
+ bool needsStubLink = false;
+
+ // Checks out okay!
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT0, cachedOffset);
+ Jump success = jump();
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ // 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;
+ compileGetDirectOffset(regT0, regT1, structure, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(regT0, regT0, structure, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ 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();
+
+ polymorphicStructures->list[currentIndex].set(*m_globalData, m_codeBlock->ownerExecutable(), 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.
+ move(TrustedImmPtr(protoObject), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, Address(regT3, JSCell::structureOffset()), TrustedImmPtr(prototypeStructure));
+
+ // Checks out okay!
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ 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();
+ prototypeStructures->list[currentIndex].set(*m_globalData, m_codeBlock->ownerExecutable(), 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;
+ WriteBarrier<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, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT0, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ 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.
+ prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), 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;
+ WriteBarrier<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, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT0, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ 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)
+
+#endif // USE(JSVALUE64)
+
+void JIT::testPrototype(JSValue prototype, JumpList& failureCases)
+{
+ if (prototype.isNull())
+ return;
+
+ ASSERT(prototype.isCell());
+ move(TrustedImmPtr(prototype.asCell()), regT3);
+ failureCases.append(branchPtr(NotEqual, Address(regT3, JSCell::structureOffset()), TrustedImmPtr(prototype.asCell()->structure())));
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
new file mode 100644
index 0000000..f18e277
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
@@ -0,0 +1,1112 @@
+/*
+ * 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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(&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(TrustedImmPtr(&(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(TrustedImmPtr(&(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, JSCell::structureOffset()), info.structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch(TrustedImmPtr(0), regT2);
+ Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT2, JSCell::structureOffset()), protoStructureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+
+ // This will be relinked to load the function without doing a load.
+ DataLabelPtr putFunction = moveWithPatch(TrustedImmPtr(0), regT0);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
+ move(TrustedImm32(JSValue::CellTag), regT1);
+ 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.
+ 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), TrustedImmPtr(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, TrustedImm32(0x100)));
+ jit.move(TrustedImmPtr(globalData->smallStrings.singleCharacterStrings()), regT1);
+ jit.loadPtr(BaseIndex(regT1, regT0, ScalePtr, 0), regT0);
+ jit.move(TrustedImm32(JSValue::CellTag), regT1); // We null check regT0 on return so this is safe
+ jit.ret();
+
+ failures.link(&jit);
+ jit.move(TrustedImm32(0), regT0);
+ jit.ret();
+
+ LinkBuffer patchBuffer(&jit, pool);
+ 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, TrustedImm32(JSValue::Int32Tag)));
+ emitJumpSlowCaseIfNotJSCell(base, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsArrayVPtr)));
+
+ loadPtr(Address(regT0, JSArray::storageOffset()), regT3);
+ addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, JSArray::vectorLengthOffset())));
+
+ 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, TrustedImm32(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), TrustedImmPtr(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, TrustedImm32(JSValue::Int32Tag)));
+ emitJumpSlowCaseIfNotJSCell(base, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsArrayVPtr)));
+ addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, JSArray::vectorLengthOffset())));
+
+ loadPtr(Address(regT0, JSArray::storageOffset()), regT3);
+
+ Jump empty = branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), TrustedImm32(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(TrustedImm32(1), Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)));
+ branch32(Below, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this);
+
+ add32(TrustedImm32(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, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ addSlowCase(structureCheck);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetGetByIdStructure);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureCheck), patchOffsetGetByIdBranchToSlowCase);
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT2);
+ DataLabel32 displacementLabel1 = loadPtrWithAddressOffsetPatch(Address(regT2, patchGetByIdDefaultOffset), regT0); // payload
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel1), patchOffsetGetByIdPropertyMapOffset1);
+ DataLabel32 displacementLabel2 = loadPtrWithAddressOffsetPatch(Address(regT2, patchGetByIdDefaultOffset), regT1); // tag
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel2), patchOffsetGetByIdPropertyMapOffset2);
+
+ Label putResult(this);
+ ASSERT_JIT_OFFSET(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(TrustedImmPtr(ident));
+ Call call = stubCall.call(dst);
+
+ END_UNINTERRUPTED_SEQUENCE_FOR_PUT(sequenceGetByIdSlowCase, dst);
+
+ 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)
+{
+ // 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, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))));
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetPutByIdStructure);
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT0);
+ DataLabel32 displacementLabel1 = storePtrWithAddressOffsetPatch(regT2, Address(regT0, patchGetByIdDefaultOffset)); // payload
+ DataLabel32 displacementLabel2 = storePtrWithAddressOffsetPatch(regT3, Address(regT0, patchGetByIdDefaultOffset)); // tag
+
+ END_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel1), patchOffsetPutByIdPropertyMapOffset1);
+ ASSERT_JIT_OFFSET(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(TrustedImmPtr(&(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 += JSObject::offsetOfInlineStorage() / sizeof(Register);
+ else
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), 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 += JSObject::offsetOfInlineStorage() / sizeof(Register);
+ emitLoad(offset, resultTag, resultPayload, base);
+ } else {
+ RegisterID temp = resultPayload;
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), temp);
+ emitLoad(offset, resultTag, resultPayload, temp);
+ }
+}
+
+void JIT::compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset)
+{
+ load32(reinterpret_cast<char*>(&base->m_propertyStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload), resultPayload);
+ load32(reinterpret_cast<char*>(&base->m_propertyStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag), resultTag);
+}
+
+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, TrustedImm32(JSValue::CellTag)));
+ failureCases.append(branchPtr(NotEqual, Address(regT0, JSCell::structureOffset()), TrustedImmPtr(oldStructure)));
+ testPrototype(oldStructure->storedPrototype(), failureCases);
+
+ if (!direct) {
+ // Verify that nothing in the prototype chain has a setter for this property.
+ for (WriteBarrier<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(TrustedImm32(oldStructure->propertyStorageCapacity()));
+ stubCall.addArgument(TrustedImm32(newStructure->propertyStorageCapacity()));
+ stubCall.call(regT0);
+
+ restoreReturnAddressBeforeReturn(regT3);
+ }
+
+ storePtrWithWriteBarrier(TrustedImmPtr(newStructure), regT0, Address(regT0, JSCell::structureOffset()));
+
+#if CPU(MIPS) || CPU(SH4)
+ // 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());
+
+ 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;
+
+ // 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(JSGlobalData& globalData, CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ ASSERT(!methodCallLinkInfo.cachedStructure);
+ methodCallLinkInfo.cachedStructure.set(globalData, codeBlock->ownerExecutable(), structure);
+ Structure* prototypeStructure = proto->structure();
+ methodCallLinkInfo.cachedPrototypeStructure.set(globalData, codeBlock->ownerExecutable(), prototypeStructure);
+
+ 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;
+
+ // 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), TrustedImmPtr(m_globalData->jsArrayVPtr));
+
+ // Checks out okay! - get the length from the storage
+ loadPtr(Address(regT0, JSArray::storageOffset()), regT2);
+ load32(Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2);
+
+ Jump failureCases2 = branch32(Above, regT2, TrustedImm32(INT_MAX));
+ move(regT2, regT0);
+ move(TrustedImm32(JSValue::Int32Tag), regT1);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ // 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.
+ move(TrustedImmPtr(protoObject), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, Address(regT3, JSCell::structureOffset()), TrustedImmPtr(prototypeStructure));
+
+ bool needsStubLink = false;
+ // Checks out okay!
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT2, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+
+ // 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;
+ compileGetDirectOffset(regT0, regT2, regT1, structure, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(regT0, regT1, regT0, structure, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+ 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();
+
+ polymorphicStructures->list[currentIndex].set(*m_globalData, m_codeBlock->ownerExecutable(), 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.
+ move(TrustedImmPtr(protoObject), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, Address(regT3, JSCell::structureOffset()), TrustedImmPtr(prototypeStructure));
+
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT2, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+ 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();
+
+ prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), 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;
+ WriteBarrier<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, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+ 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.
+ prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), 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;
+ WriteBarrier<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, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(TrustedImmPtr(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(TrustedImmPtr(protoObject));
+ stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool());
+ 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 offset)
+{
+ ASSERT(sizeof(JSValue) == 8);
+
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), 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);
+}
+
+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, JSCell::structureOffset()), regT0);
+ addSlowCase(branchPtr(NotEqual, regT0, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure))));
+ load32(addressFor(i), regT3);
+ sub32(TrustedImm32(1), regT3);
+ addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots))));
+ compileGetDirectOffset(regT2, regT1, 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubCall.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubCall.h
new file mode 100644
index 0000000..a0341d6
--- /dev/null
+++ b/src/3rdparty/webkit/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::TrustedImm32 argument)
+ {
+ m_jit->poke(argument, m_stackIndex);
+ m_stackIndex += stackIndexStep;
+ }
+
+ void addArgument(JIT::TrustedImmPtr 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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp
new file mode 100644
index 0000000..a589e11
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp
@@ -0,0 +1,3613 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ * Copyright (C) Research In Motion Limited 2010, 2011. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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 "Heap.h"
+#include "Debugger.h"
+#include "ExceptionHelpers.h"
+#include "GetterSetter.h"
+#include "Strong.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) && CPU(X86))
+#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) || OS(FREEBSD)) && CPU(X86_64)
+#define SYMBOL_STRING_RELOCATION(name) #name "@plt"
+#elif OS(DARWIN) || (CPU(X86_64) && COMPILER(MINGW) && !GCC_VERSION_AT_LEAST(4, 5, 0))
+#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) || COMPILER(RVCT)) && 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(MSVC) || COMPILER(RVCT)) && CPU(ARM_TRADITIONAL)
+
+// Also update the MSVC section (defined at DEFINE_STUB_FUNCTION)
+// when changing one of the following values.
+#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 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
+#elif CPU(SH4)
+#define SYMBOL_STRING(name) #name
+/* code (r4), RegisterFile* (r5), CallFrame* (r6), JSValue* exception (r7), Profiler**(sp), JSGlobalData (sp)*/
+
+asm volatile (
+".text\n"
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "mov.l r7, @-r15" "\n"
+ "mov.l r6, @-r15" "\n"
+ "mov.l r5, @-r15" "\n"
+ "mov.l r8, @-r15" "\n"
+ "mov #127, r8" "\n"
+ "mov.l r14, @-r15" "\n"
+ "sts.l pr, @-r15" "\n"
+ "mov.l r13, @-r15" "\n"
+ "mov.l r11, @-r15" "\n"
+ "mov.l r10, @-r15" "\n"
+ "add #-60, r15" "\n"
+ "mov r6, r14" "\n"
+ "jsr @r4" "\n"
+ "nop" "\n"
+ "add #60, r15" "\n"
+ "mov.l @r15+,r10" "\n"
+ "mov.l @r15+,r11" "\n"
+ "mov.l @r15+,r13" "\n"
+ "lds.l @r15+,pr" "\n"
+ "mov.l @r15+,r14" "\n"
+ "mov.l @r15+,r8" "\n"
+ "add #12, r15" "\n"
+ "rts" "\n"
+ "nop" "\n"
+);
+
+asm volatile (
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+ "mov.l .L2"SYMBOL_STRING(cti_vm_throw)",r0" "\n"
+ "mov r15, r4" "\n"
+ "mov.l @(r0,r12),r11" "\n"
+ "jsr @r11" "\n"
+ "nop" "\n"
+ "add #60, r15" "\n"
+ "mov.l @r15+,r10" "\n"
+ "mov.l @r15+,r11" "\n"
+ "mov.l @r15+,r13" "\n"
+ "lds.l @r15+,pr" "\n"
+ "mov.l @r15+,r14" "\n"
+ "mov.l @r15+,r8" "\n"
+ "add #12, r15" "\n"
+ "rts" "\n"
+ "nop" "\n"
+ ".align 2" "\n"
+ ".L2"SYMBOL_STRING(cti_vm_throw)":.long " SYMBOL_STRING(cti_vm_throw)"@GOT \n"
+);
+
+asm volatile (
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "add #60, r15" "\n"
+ "mov.l @r15+,r10" "\n"
+ "mov.l @r15+,r11" "\n"
+ "mov.l @r15+,r13" "\n"
+ "lds.l @r15+,pr" "\n"
+ "mov.l @r15+,r14" "\n"
+ "mov.l @r15+,r8" "\n"
+ "add #12, r15" "\n"
+ "rts" "\n"
+ "nop" "\n"
+);
+#else
+ #error "JIT not supported on this platform."
+#endif
+
+#else // USE(JSVALUE32_64)
+
+#if 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"
+);
+
+#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_THUMB2)
+
+__asm EncodedJSValue ctiTrampoline(void*, RegisterFile*, CallFrame*, JSValue*, Profiler**, JSGlobalData*)
+{
+ PRESERVE8
+ sub sp, sp, # ENABLE_PROFILER_REFERENCE_OFFSET
+ str lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
+ str r4, [sp, # PRESERVED_R4_OFFSET ]
+ str r5, [sp, # PRESERVED_R5_OFFSET ]
+ str r6, [sp, # PRESERVED_R6_OFFSET ]
+ str r1, [sp, # REGISTER_FILE_OFFSET ]
+ str r2, [sp, # CALLFRAME_OFFSET ]
+ str r3, [sp, # EXCEPTION_OFFSET ]
+ cpy r5, r2
+ mov r6, #512
+ blx r0
+ ldr r6, [sp, # PRESERVED_R6_OFFSET ]
+ ldr r5, [sp, # PRESERVED_R5_OFFSET ]
+ ldr r4, [sp, # PRESERVED_R4_OFFSET ]
+ ldr lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
+ add sp, sp, # ENABLE_PROFILER_REFERENCE_OFFSET
+ bx lr
+}
+
+__asm void ctiVMThrowTrampoline()
+{
+ PRESERVE8
+ cpy r0, sp
+ bl cti_vm_throw
+ ldr r6, [sp, # PRESERVED_R6_OFFSET ]
+ ldr r5, [sp, # PRESERVED_R5_OFFSET ]
+ ldr r4, [sp, # PRESERVED_R4_OFFSET ]
+ ldr lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
+ add sp, sp, # ENABLE_PROFILER_REFERENCE_OFFSET
+ bx lr
+}
+
+__asm void ctiOpThrowNotCaught()
+{
+ PRESERVE8
+ ldr r6, [sp, # PRESERVED_R6_OFFSET ]
+ ldr r5, [sp, # PRESERVED_R5_OFFSET ]
+ ldr r4, [sp, # PRESERVED_R4_OFFSET ]
+ ldr lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
+ add sp, sp, # ENABLE_PROFILER_REFERENCE_OFFSET
+ bx lr
+}
+
+#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)
+ : m_hostFunctionStubMap(adoptPtr(new HostFunctionStubMap))
+{
+ 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, unused1) == 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(callFrame->globalData(), codeBlock->ownerExecutable(), structure->previousID(), structure, prototypeChain);
+ JIT::compilePutByIdTransition(callFrame->scopeChain()->globalData, codeBlock, stubInfo, structure->previousID(), structure, slot.cachedOffset(), prototypeChain, returnAddress, direct);
+ return;
+ }
+
+ stubInfo->initPutByIdReplace(callFrame->globalData(), codeBlock->ownerExecutable(), 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(callFrame->globalData(), codeBlock->ownerExecutable(), 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(callFrame->globalData());
+ offset = slotBaseObject->structure()->get(callFrame->globalData(), propertyName);
+ }
+
+ stubInfo->initGetByIdProto(callFrame->globalData(), codeBlock->ownerExecutable(), 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(callFrame->globalData(), codeBlock->ownerExecutable(), 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) && COMPILER(GCC)
+
+#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_THUMB2) || 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( PRESERVE8)
+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, #68 ; sync with PRESERVEDR4_OFFSET)
+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, #68 ; sync with PRESERVEDR4_OFFSET)
+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, #68 ; sync with PRESERVEDR4_OFFSET)
+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, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET)
+MSVC( bl JITStubThunked_#op#)
+MSVC( ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET)
+MSVC( bx lr)
+MSVC(cti_#op# ENDP)
+MSVC()
+
+MSVC_END( END)
+*/
+
+#elif CPU(SH4)
+#define DEFINE_STUB_FUNCTION(rtype, op) \
+ extern "C" { \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
+ }; \
+ asm volatile( \
+ ".align 2" "\n" \
+ ".globl " SYMBOL_STRING(cti_##op) "\n" \
+ SYMBOL_STRING(cti_##op) ":" "\n" \
+ "sts pr, r11" "\n" \
+ "mov.l r11, @(0x38, r15)" "\n" \
+ "mov.l .L2"SYMBOL_STRING(JITStubThunked_##op)",r0" "\n" \
+ "mov.l @(r0,r12),r11" "\n" \
+ "jsr @r11" "\n" \
+ "nop" "\n" \
+ "mov.l @(0x38, r15), r11 " "\n" \
+ "lds r11, pr " "\n" \
+ "rts" "\n" \
+ "nop" "\n" \
+ ".align 2" "\n" \
+ ".L2"SYMBOL_STRING(JITStubThunked_##op)":.long " SYMBOL_STRING(JITStubThunked_##op)"@GOT \n" \
+ ); \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
+#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(*stackFrame.globalData);
+ else
+ structure = constructor->scope()->globalObject->emptyObjectStructure();
+ JSValue result = constructEmptyObject(callFrame, 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(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(callFrame->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(callFrame->globalData());
+
+ // 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(callFrame->globalData(), 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(callFrame->globalData(), 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(callFrame->globalData(), codeBlock->ownerExecutable(), CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure.get());
+ 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(JSGlobalData& globalData, ScriptExecutable* owner, StructureStubInfo* stubInfo, int& listIndex)
+{
+ PolymorphicAccessStructureList* prototypeStructureList = 0;
+ listIndex = 1;
+
+ switch (stubInfo->accessType) {
+ case access_get_by_id_proto:
+ prototypeStructureList = new PolymorphicAccessStructureList(globalData, owner, stubInfo->stubRoutine, stubInfo->u.getByIdProto.baseObjectStructure.get(), stubInfo->u.getByIdProto.prototypeStructure.get());
+ stubInfo->stubRoutine = CodeLocationLabel();
+ stubInfo->initGetByIdProtoList(prototypeStructureList, 2);
+ break;
+ case access_get_by_id_chain:
+ prototypeStructureList = new PolymorphicAccessStructureList(globalData, owner, stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure.get(), stubInfo->u.getByIdChain.chain.get());
+ 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(callFrame->globalData());
+ offset = slotBaseObject->structure()->get(callFrame->globalData(), propertyName);
+ }
+
+ int listIndex;
+ PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(callFrame->globalData(), codeBlock->ownerExecutable(), 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(callFrame->globalData(), codeBlock->ownerExecutable(), 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();
+ 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();
+ 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());
+ 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());
+ 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());
+ 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());
+ 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()->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(*stackFrame.globalData);
+ }
+ return;
+ }
+ JSActivation* activation = asActivation(stackFrame.args[0].jsValue());
+ activation->copyRegisters(*stackFrame.globalData);
+ if (JSValue v = stackFrame.args[1].jsValue()) {
+ if (!stackFrame.callFrame->codeBlock()->isStrictMode())
+ asArguments(v)->setActivation(*stackFrame.globalData, 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(*stackFrame.globalData);
+}
+
+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(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->get();
+ 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(*globalData, 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::s_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::s_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->get();
+ 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);
+ globalResolveInfo.structure.set(callFrame->globalData(), codeBlock->ownerExecutable(), 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->get();
+ 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->setScope(callFrame->globalData(), 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);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ RegExp* regExp = stackFrame.args[0].regExp();
+ if (!regExp->isValid()) {
+ stackFrame.globalData->exception = createSyntaxError(callFrame, "Invalid flags supplied to RegExp constructor.");
+ VM_THROW_EXCEPTION();
+ }
+
+ return new (stackFrame.globalData) RegExpObject(stackFrame.callFrame->lexicalGlobalObject(), stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), 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.get();
+
+ 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_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;
+}
+
+NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function)
+{
+ std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Weak<NativeExecutable>());
+ if (!*entry.first->second)
+ entry.first->second.set(*globalData, NativeExecutable::create(*globalData, JIT::compileCTINativeCall(globalData, m_executablePool, function), function, ctiNativeConstruct(), callHostFunctionAsConstructor));
+ return entry.first->second.get();
+}
+
+NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator)
+{
+ std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Weak<NativeExecutable>());
+ if (!*entry.first->second) {
+ MacroAssemblerCodePtr code = globalData->canUseJIT() ? generator(globalData, m_executablePool.get()) : MacroAssemblerCodePtr();
+ entry.first->second.set(*globalData, NativeExecutable::create(*globalData, code, function, ctiNativeConstruct(), callHostFunctionAsConstructor));
+ }
+ return entry.first->second.get();
+}
+
+void JITThunks::clearHostFunctionStubs()
+{
+ m_hostFunctionStubMap.clear();
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.h
new file mode 100644
index 0000000..624b6be
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.h
@@ -0,0 +1,440 @@
+/*
+ * 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;
+
+ template <typename T> class Weak;
+
+ 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; }
+ };
+#elif CPU(SH4)
+ struct JITStackFrame {
+ JITStubArg padding; // Unused
+ JITStubArg args[6];
+
+ ReturnAddressPtr thunkReturnAddress;
+ void* savedR10;
+ void* savedR11;
+ void* savedR13;
+ void* savedRPR;
+ void* savedR14;
+ void* savedTimeoutReg;
+
+ RegisterFile* registerFile;
+ CallFrame* callFrame;
+ JSValue* exception;
+ 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);
+
+ NativeExecutable* hostFunctionStub(JSGlobalData*, NativeFunction);
+ NativeExecutable* hostFunctionStub(JSGlobalData*, NativeFunction, ThunkGenerator);
+
+ void clearHostFunctionStubs();
+
+ private:
+ typedef HashMap<ThunkGenerator, MacroAssemblerCodePtr> CTIStubMap;
+ CTIStubMap m_ctiStubMap;
+ typedef HashMap<NativeFunction, Weak<NativeExecutable> > HostFunctionStubMap;
+ OwnPtr<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_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_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/src/3rdparty/webkit/Source/JavaScriptCore/jit/JSInterfaceJIT.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JSInterfaceJIT.h
new file mode 100644
index 0000000..e1d9353
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JSInterfaceJIT.h
@@ -0,0 +1,352 @@
+/*
+ * 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 "JSValue.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;
+#elif CPU(SH4)
+ static const RegisterID timeoutCheckRegister = SH4Registers::r8;
+ static const RegisterID callFrameRegister = SH4Registers::fp;
+
+ static const RegisterID regT0 = SH4Registers::r0;
+ static const RegisterID regT1 = SH4Registers::r1;
+ static const RegisterID regT2 = SH4Registers::r2;
+ static const RegisterID regT3 = SH4Registers::r10;
+ static const RegisterID regT4 = SH4Registers::r4;
+ static const RegisterID regT5 = SH4Registers::r5;
+ static const RegisterID regT6 = SH4Registers::r6;
+ static const RegisterID regT7 = SH4Registers::r7;
+ static const RegisterID firstArgumentRegister =regT4;
+
+ static const RegisterID returnValueRegister = SH4Registers::r0;
+ static const RegisterID cachedResultRegister = SH4Registers::r0;
+
+ static const FPRegisterID fpRegT0 = SH4Registers::fr0;
+ static const FPRegisterID fpRegT1 = SH4Registers::fr2;
+ static const FPRegisterID fpRegT2 = SH4Registers::fr4;
+ static const FPRegisterID fpRegT3 = SH4Registers::fr6;
+ static const FPRegisterID fpRegT4 = SH4Registers::fr8;
+ static const FPRegisterID fpRegT5 = SH4Registers::fr10;
+ static const FPRegisterID fpRegT6 = SH4Registers::fr12;
+ static const FPRegisterID fpRegT7 = SH4Registers::fr14;
+#else
+#error "JIT not supported on this platform."
+#endif
+
+#if USE(JSVALUE32_64)
+ // Can't just propogate JSValue::Int32Tag as visual studio doesn't like it
+ static const unsigned Int32Tag = 0xffffffff;
+ COMPILE_ASSERT(Int32Tag == JSValue::Int32Tag, Int32Tag_out_of_sync);
+#else
+ static const unsigned Int32Tag = TagTypeNumber >> 32;
+#endif
+ inline Jump emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID payload);
+ inline Jump emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst);
+ inline Jump emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch);
+
+ inline void storePtrWithWriteBarrier(TrustedImmPtr ptr, RegisterID /* owner */, Address dest)
+ {
+ storePtr(ptr, dest);
+ }
+
+#if USE(JSVALUE32_64)
+ inline Jump emitJumpIfNotJSCell(unsigned virtualRegisterIndex);
+ inline Address tagFor(int index, RegisterID base = callFrameRegister);
+#endif
+
+#if USE(JSVALUE64)
+ Jump emitJumpIfImmediateNumber(RegisterID reg);
+ Jump emitJumpIfNotImmediateNumber(RegisterID reg);
+ void emitFastArithImmToInt(RegisterID reg);
+#endif
+
+ inline Address payloadFor(int index, RegisterID base = callFrameRegister);
+ inline Address intPayloadFor(int index, RegisterID base = callFrameRegister);
+ inline Address intTagFor(int index, RegisterID base = callFrameRegister);
+ inline Address addressFor(int 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), TrustedImm32(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(static_cast<int>(virtualRegisterIndex)), TrustedImm32(JSValue::Int32Tag));
+ }
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::tagFor(int virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
+ return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
+ }
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(int virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
+ return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
+ }
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(int virtualRegisterIndex, RegisterID base)
+ {
+ return payloadFor(virtualRegisterIndex, base);
+ }
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(int virtualRegisterIndex, RegisterID base)
+ {
+ return tagFor(virtualRegisterIndex, base);
+ }
+
+ 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, TrustedImm32(JSValue::LowestTag));
+ Jump notInt = branch32(NotEqual, scratch, TrustedImm32(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(int virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
+ return addressFor(virtualRegisterIndex, base);
+ }
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(int virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
+ return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
+ }
+ inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(int virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
+ return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
+ }
+#endif
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::addressFor(int virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
+ return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)));
+ }
+
+}
+
+#endif // JSInterfaceJIT_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/jit/SpecializedThunkJIT.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/SpecializedThunkJIT.h
new file mode 100644
index 0000000..73d0848
--- /dev/null
+++ b/src/3rdparty/webkit/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)), TrustedImm32(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), TrustedImmPtr(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(payloadFor(RegisterFile::CallerFrame, callFrameRegister), 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(payloadFor(RegisterFile::CallerFrame, callFrameRegister), callFrameRegister);
+ ret();
+ }
+
+ void returnInt32(RegisterID src)
+ {
+ if (src != regT0)
+ move(src, regT0);
+ tagReturnAsInt32();
+ loadPtr(payloadFor(RegisterFile::CallerFrame, callFrameRegister), callFrameRegister);
+ ret();
+ }
+
+ void returnJSCell(RegisterID src)
+ {
+ if (src != regT0)
+ move(src, regT0);
+ tagReturnAsJSCell();
+ loadPtr(payloadFor(RegisterFile::CallerFrame, callFrameRegister), callFrameRegister);
+ ret();
+ }
+
+ MacroAssemblerCodePtr finalize(MacroAssemblerCodePtr fallback)
+ {
+ LinkBuffer patchBuffer(this, m_pool.get());
+ 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(TrustedImm32(JSValue::Int32Tag), regT1);
+#endif
+ }
+
+ void tagReturnAsJSCell()
+ {
+#if USE(JSVALUE32_64)
+ move(TrustedImm32(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/src/3rdparty/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp
new file mode 100644
index 0000000..1201696
--- /dev/null
+++ b/src/3rdparty/webkit/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::TrustedImm32(0x100)));
+ jit.move(MacroAssembler::TrustedImmPtr(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::TrustedImm32(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::TrustedImm32(1));
+ jit.mulDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1);
+ exponentIsEven.link(&jit);
+ jit.mulDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT0);
+ jit.rshift32(MacroAssembler::TrustedImm32(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/src/3rdparty/webkit/Source/JavaScriptCore/jit/ThunkGenerators.h b/src/3rdparty/webkit/Source/JavaScriptCore/jit/ThunkGenerators.h
new file mode 100644
index 0000000..15261f7
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/jsc.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jsc.cpp
new file mode 100644
index 0000000..6ef8e18
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/jsc.cpp
@@ -0,0 +1,575 @@
+/*
+ * 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 "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(JSGlobalData&, Structure*, 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(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments)
+ : JSGlobalObject(globalData, structure)
+{
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
+
+#if ENABLE(SAMPLING_FLAGS)
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
+ putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 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(globalExec()->globalData(), 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(exec->globalData(), GlobalObject::createStructure(exec->globalData(), jsNull()), 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 OS(WINDOWS)
+#if !OS(WINCE)
+ // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
+ // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
+ // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
+ ::SetErrorMode(0);
+#endif
+
+#if defined(_DEBUG)
+ _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
+
+ 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->clearBuiltinStructures();
+ 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(*globalData, GlobalObject::createStructure(*globalData, jsNull()), 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/src/3rdparty/webkit/Source/JavaScriptCore/make-generated-sources.sh b/src/3rdparty/webkit/Source/JavaScriptCore/make-generated-sources.sh
new file mode 100755
index 0000000..a6b0f63
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/os-win32/WinMain.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/WinMain.cpp
index 17800d0..17800d0 100644
--- a/src/3rdparty/webkit/JavaScriptCore/os-win32/WinMain.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/WinMain.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/inttypes.h b/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/inttypes.h
new file mode 100644
index 0000000..0ed6718
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/os-win32/stdbool.h b/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/stdbool.h
index fc8ee28..fc8ee28 100644
--- a/src/3rdparty/webkit/JavaScriptCore/os-win32/stdbool.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/stdbool.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/stdint.h b/src/3rdparty/webkit/Source/JavaScriptCore/os-win32/stdint.h
new file mode 100644
index 0000000..b5dff56
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/parser/ASTBuilder.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/ASTBuilder.h
new file mode 100644
index 0000000..9ab0f9d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/ASTBuilder.h
@@ -0,0 +1,977 @@
+/*
+ * 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_scope(globalData)
+ , m_evalCount(0)
+ {
+ }
+
+ struct BinaryExprContext {
+ BinaryExprContext(ASTBuilder&) {}
+ };
+ struct UnaryExprContext {
+ UnaryExprContext(ASTBuilder&) {}
+ };
+
+ 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;
+ static const bool CanUseFunctionCache = 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_scope.m_varDeclarations; }
+ ParserArenaData<DeclarationStacks::FunctionStack>* funcDeclarations() { return m_scope.m_funcDeclarations; }
+ int features() const { return m_scope.m_features; }
+ int numConstants() const { return m_scope.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* createRegExp(const Identifier& pattern, const Identifier& flags, int start)
+ {
+ if (Yarr::checkSyntax(pattern.ustring()))
+ return 0;
+ 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_scope.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_scope.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_scope.m_numConstants++; }
+ void usesThis() { m_scope.m_features |= ThisFeature; }
+ void usesCatch() { m_scope.m_features |= CatchFeature; }
+ void usesClosures() { m_scope.m_features |= ClosureFeature; }
+ void usesArguments() { m_scope.m_features |= ArgumentsFeature; }
+ void usesAssignment() { m_scope.m_features |= AssignFeature; }
+ void usesWith() { m_scope.m_features |= WithFeature; }
+ void usesEval()
+ {
+ m_evalCount++;
+ m_scope.m_features |= EvalFeature;
+ }
+ ExpressionNode* createNumber(double d)
+ {
+ return new (m_globalData) NumberNode(m_globalData, d);
+ }
+
+ JSGlobalData* m_globalData;
+ Lexer* m_lexer;
+ Scope m_scope;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/parser/JSParser.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/parser/JSParser.cpp
new file mode 100644
index 0000000..f36c668
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/JSParser.cpp
@@ -0,0 +1,2173 @@
+/*
+ * 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 "SourceProvider.h"
+#include "SourceProviderCacheItem.h"
+#include <wtf/HashFunctions.h>
+#include <wtf/OwnPtr.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*);
+ const char* 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;
+ };
+
+ struct ScopeLabelInfo {
+ ScopeLabelInfo(StringImpl* ident, bool isLoop)
+ : m_ident(ident)
+ , m_isLoop(isLoop)
+ {
+ }
+ StringImpl* m_ident;
+ bool m_isLoop;
+ };
+
+ 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());
+ }
+
+ bool nextTokenIsColon()
+ {
+ return m_lexer->nextTokenIsColon();
+ }
+
+ 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()
+ {
+ ScopeRef current = currentScope();
+ while (!current->breakIsValid()) {
+ if (!current.hasContainingScope())
+ return false;
+ current = current.containingScope();
+ }
+ return true;
+ }
+ bool continueIsValid()
+ {
+ ScopeRef current = currentScope();
+ while (!current->continueIsValid()) {
+ if (!current.hasContainingScope())
+ return false;
+ current = current.containingScope();
+ }
+ return true;
+ }
+ void pushLabel(const Identifier* label, bool isLoop) { currentScope()->pushLabel(label, isLoop); }
+ void popLabel() { currentScope()->popLabel(); }
+ ScopeLabelInfo* getLabel(const Identifier* label)
+ {
+ ScopeRef current = currentScope();
+ ScopeLabelInfo* result = 0;
+ while (!(result = current->getLabel(label))) {
+ if (!current.hasContainingScope())
+ return 0;
+ current = current.containingScope();
+ }
+ return result;
+ }
+
+ 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;
+ const char* m_errorMessage;
+ JSGlobalData* m_globalData;
+ JSToken m_token;
+ bool m_allowsIn;
+ 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_isFunctionBoundary(false)
+ , m_isValidStrictMode(true)
+ , m_loopDepth(0)
+ , m_switchDepth(0)
+ {
+ }
+
+ Scope(const Scope& rhs)
+ : m_globalData(rhs.m_globalData)
+ , m_shadowsArguments(rhs.m_shadowsArguments)
+ , m_usesEval(rhs.m_usesEval)
+ , m_needsFullActivation(rhs.m_needsFullActivation)
+ , m_allowsNewDecls(rhs.m_allowsNewDecls)
+ , m_strictMode(rhs.m_strictMode)
+ , m_isFunction(rhs.m_isFunction)
+ , m_isFunctionBoundary(rhs.m_isFunctionBoundary)
+ , m_isValidStrictMode(rhs.m_isValidStrictMode)
+ , m_loopDepth(rhs.m_loopDepth)
+ , m_switchDepth(rhs.m_switchDepth)
+ {
+ if (rhs.m_labels) {
+ m_labels = adoptPtr(new LabelStack);
+
+ typedef LabelStack::const_iterator iterator;
+ iterator end = rhs.m_labels->end();
+ for (iterator it = rhs.m_labels->begin(); it != end; ++it)
+ m_labels->append(ScopeLabelInfo(it->m_ident, it->m_isLoop));
+ }
+ }
+
+ 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; }
+ bool continueIsValid() { return m_loopDepth; }
+
+ void pushLabel(const Identifier* label, bool isLoop)
+ {
+ if (!m_labels)
+ m_labels = adoptPtr(new LabelStack);
+ m_labels->append(ScopeLabelInfo(label->impl(), isLoop));
+ }
+
+ void popLabel()
+ {
+ ASSERT(m_labels);
+ ASSERT(m_labels->size());
+ m_labels->removeLast();
+ }
+
+ ScopeLabelInfo* getLabel(const Identifier* label)
+ {
+ if (!m_labels)
+ return 0;
+ for (int i = m_labels->size(); i > 0; i--) {
+ if (m_labels->at(i - 1).m_ident == label->impl())
+ return &m_labels->at(i - 1);
+ }
+ return 0;
+ }
+
+ void setIsFunction()
+ {
+ m_isFunction = true;
+ m_isFunctionBoundary = true;
+ }
+ bool isFunction() { return m_isFunction; }
+ bool isFunctionBoundary() { return m_isFunctionBoundary; }
+
+ 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; }
+
+ void copyCapturedVariablesToVector(const IdentifierSet& capturedVariables, Vector<RefPtr<StringImpl> >& vector)
+ {
+ IdentifierSet::iterator end = capturedVariables.end();
+ for (IdentifierSet::iterator it = capturedVariables.begin(); it != end; ++it) {
+ if (m_declaredVariables.contains(*it))
+ continue;
+ vector.append(*it);
+ }
+ vector.shrinkToFit();
+ }
+
+ void saveFunctionInfo(SourceProviderCacheItem* info)
+ {
+ ASSERT(m_isFunction);
+ info->usesEval = m_usesEval;
+ copyCapturedVariablesToVector(m_writtenVariables, info->writtenVariables);
+ copyCapturedVariablesToVector(m_usedVariables, info->usedVariables);
+ }
+
+ void restoreFunctionInfo(const SourceProviderCacheItem* info)
+ {
+ ASSERT(m_isFunction);
+ m_usesEval = info->usesEval;
+ unsigned size = info->usedVariables.size();
+ for (unsigned i = 0; i < size; ++i)
+ m_usedVariables.add(info->usedVariables[i]);
+ size = info->writtenVariables.size();
+ for (unsigned i = 0; i < size; ++i)
+ m_writtenVariables.add(info->writtenVariables[i]);
+ }
+
+ 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_isFunctionBoundary : 1;
+ bool m_isValidStrictMode : 1;
+ int m_loopDepth;
+ int m_switchDepth;
+
+ typedef Vector<ScopeLabelInfo, 2> LabelStack;
+ OwnPtr<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; }
+
+ bool hasContainingScope()
+ {
+ return m_index && !m_scopeStack->at(m_index).isFunctionBoundary();
+ }
+
+ ScopeRef containingScope()
+ {
+ ASSERT(hasContainingScope());
+ return ScopeRef(m_scopeStack, m_index - 1);
+ }
+
+ private:
+ ScopeStack* m_scopeStack;
+ unsigned m_index;
+ };
+
+ struct AutoPopScopeRef : public ScopeRef {
+ AutoPopScopeRef(JSParser* parser, ScopeRef scope)
+ : ScopeRef(scope)
+ , m_parser(parser)
+ {
+ }
+
+ ~AutoPopScopeRef()
+ {
+ if (m_parser)
+ m_parser->popScope(*this, false);
+ }
+
+ void setPopped()
+ {
+ m_parser = 0;
+ }
+
+ private:
+ JSParser* m_parser;
+ };
+
+ 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 popScopeInternal(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 popScope(ScopeRef& scope, bool shouldTrackClosedVariables)
+ {
+ return popScopeInternal(scope, shouldTrackClosedVariables);
+ }
+
+ bool popScope(AutoPopScopeRef& scope, bool shouldTrackClosedVariables)
+ {
+ scope.setPopped();
+ return popScopeInternal(scope, shouldTrackClosedVariables);
+ }
+
+ 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;
+
+ const SourceProviderCacheItem* findCachedFunctionInfo(int openBracePos)
+ {
+ return m_functionCache ? m_functionCache->get(openBracePos) : 0;
+ }
+
+ SourceProviderCache* m_functionCache;
+};
+
+const char* 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_errorMessage("Parse error")
+ , m_globalData(globalData)
+ , m_allowsIn(true)
+ , 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)
+ , m_functionCache(m_lexer->sourceProvider()->cache())
+{
+ 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());
+}
+
+const char* JSParser::parseProgram()
+{
+ unsigned oldFunctionCacheSize = m_functionCache ? m_functionCache->byteSize() : 0;
+ 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 m_errorMessage;
+ IdentifierSet capturedVariables;
+ scope->getCapturedVariables(capturedVariables);
+ CodeFeatures features = context.features();
+ if (scope->strictMode())
+ features |= StrictModeFeature;
+ if (scope->shadowsArguments())
+ features |= ShadowsArgumentsFeature;
+
+ unsigned functionCacheSize = m_functionCache ? m_functionCache->byteSize() : 0;
+ if (functionCacheSize != oldFunctionCacheSize)
+ m_lexer->sourceProvider()->notifyCacheSizeChanged(functionCacheSize - oldFunctionCacheSize);
+
+ m_globalData->parser->didFinishParsing(sourceElements, context.varDeclarations(), context.funcDeclarations(), features,
+ m_lastLine, context.numConstants(), capturedVariables);
+ return 0;
+}
+
+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;
+ unsigned oldLastLineNumber = m_lexer->lastLineNumber();
+ unsigned oldLineNumber = m_lexer->lineNumber();
+ 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();
+ m_lexer->setLastLineNumber(oldLastLineNumber);
+ m_lexer->setLineNumber(oldLineNumber);
+ 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 (match(SEMICOLON))
+ goto standardForLoop;
+
+ failIfFalse(declarations == 1);
+
+ // 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()) {
+ failIfFalse(breakIsValid());
+ return context.createBreakStatement(startCol, endCol, startLine, endLine);
+ }
+ matchOrFail(IDENT);
+ const Identifier* ident = m_token.m_data.ident;
+ failIfFalse(getLabel(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()) {
+ failIfFalse(continueIsValid());
+ return context.createContinueStatement(startCol, endCol, startLine, endLine);
+ }
+ matchOrFail(IDENT);
+ const Identifier* ident = m_token.m_data.ident;
+ ScopeLabelInfo* label = getLabel(ident);
+ failIfFalse(label);
+ failIfFalse(label->m_isLoop);
+ 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));
+ failIfFalse(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();
+ AutoPopScopeRef catchScope(this, 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)
+{
+ AutoPopScopeRef functionScope(this, pushScope());
+ functionScope->setIsFunction();
+ if (match(IDENT)) {
+ name = m_token.m_data.ident;
+ failIfTrue(*name == m_globalData->propertyNames->underscoreProto);
+ 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();
+
+ if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(openBracePos) : 0) {
+ // If we know about this function already, we can use the cached info and skip the parser to the end of the function.
+ body = context.createFunctionBody(strictMode());
+
+ functionScope->restoreFunctionInfo(cachedInfo);
+ failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo));
+
+ closeBracePos = cachedInfo->closeBracePos;
+ m_token = cachedInfo->closeBraceToken();
+ m_lexer->setOffset(m_token.m_info.endOffset);
+ m_lexer->setLineNumber(m_token.m_info.line);
+
+ next();
+ return true;
+ }
+
+ next();
+
+ body = parseFunctionBody(context);
+ failIfFalse(body);
+ if (functionScope->strictMode() && name) {
+ failIfTrue(m_globalData->propertyNames->arguments == *name);
+ failIfTrue(m_globalData->propertyNames->eval == *name);
+ }
+ closeBracePos = m_token.m_data.intValue;
+
+ // Cache the tokenizer state and the function scope the first time the function is parsed.
+ // Any future reparsing can then skip the function.
+ static const int minimumFunctionLengthToCache = 64;
+ OwnPtr<SourceProviderCacheItem> newInfo;
+ int functionLength = closeBracePos - openBracePos;
+ if (TreeBuilder::CanUseFunctionCache && m_functionCache && functionLength > minimumFunctionLengthToCache) {
+ newInfo = adoptPtr(new SourceProviderCacheItem(m_token.m_info.line, closeBracePos));
+ functionScope->saveFunctionInfo(newInfo.get());
+ }
+
+ failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo));
+ matchOrFail(CLOSEBRACE);
+
+ if (newInfo) {
+ unsigned approximateByteSize = newInfo->approximateByteSize();
+ m_functionCache->add(openBracePos, newInfo.release(), approximateByteSize);
+ }
+
+ 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);
+}
+
+struct LabelInfo {
+ LabelInfo(const Identifier* ident, int start, int end)
+ : m_ident(ident)
+ , m_start(start)
+ , m_end(end)
+ {
+ }
+
+ const Identifier* m_ident;
+ int m_start;
+ int m_end;
+};
+
+template <class TreeBuilder> TreeStatement JSParser::parseExpressionOrLabelStatement(TreeBuilder& context)
+{
+
+ /* Expression and Label statements are ambiguous at LL(1), so we have a
+ * special case that looks for a colon as the next character in the input.
+ */
+ Vector<LabelInfo> labels;
+
+ do {
+ int start = tokenStart();
+ int startLine = tokenLine();
+ if (!nextTokenIsColon()) {
+ // If we hit this path we're making a expression statement, which
+ // by definition can't make use of continue/break so we can just
+ // ignore any labels we might have accumulated.
+ TreeExpression expression = parseExpression(context);
+ failIfFalse(expression);
+ failIfFalse(autoSemiColon());
+ return context.createExprStatement(expression, startLine, m_lastLine);
+ }
+ const Identifier* ident = m_token.m_data.ident;
+ int end = tokenEnd();
+ next();
+ consumeOrFail(COLON);
+ if (!m_syntaxAlreadyValidated) {
+ // This is O(N^2) over the current list of consecutive labels, but I
+ // have never seen more than one label in a row in the real world.
+ for (size_t i = 0; i < labels.size(); i++)
+ failIfTrue(ident->impl() == labels[i].m_ident->impl());
+ failIfTrue(getLabel(ident));
+ labels.append(LabelInfo(ident, start, end));
+ }
+ } while (match(IDENT));
+ bool isLoop = false;
+ switch (m_token.m_type) {
+ case FOR:
+ case WHILE:
+ case DO:
+ isLoop = true;
+ break;
+
+ default:
+ break;
+ }
+ const Identifier* unused = 0;
+ if (!m_syntaxAlreadyValidated) {
+ for (size_t i = 0; i < labels.size(); i++)
+ pushLabel(labels[i].m_ident, isLoop);
+ }
+ TreeStatement statement = parseStatement(context, unused);
+ if (!m_syntaxAlreadyValidated) {
+ for (size_t i = 0; i < labels.size(); i++)
+ popLabel();
+ }
+ failIfFalse(statement);
+ for (size_t i = 0; i < labels.size(); i++) {
+ const LabelInfo& info = labels[labels.size() - i - 1];
+ statement = context.createLabelStatement(info.m_ident, statement, info.m_start, info.m_end);
+ }
+ return statement;
+}
+
+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);
+ failIfTrueIfStrict(m_globalData->propertyNames->arguments == *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;
+ typename TreeBuilder::BinaryExprContext binaryExprContext(context);
+ 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(propertyEntryIter.first->second == PropertyNode::Constant);
+ failIfTrue(context.getType(property) == PropertyNode::Constant);
+ failIfTrue(context.getType(property) & propertyEntryIter.first->second);
+ propertyEntryIter.first->second |= context.getType(property);
+ }
+ }
+ 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();
+ TreeExpression re = context.createRegExp(*pattern, *flags, start);
+ if (!re) {
+ m_errorMessage = Yarr::checkSyntax(pattern->ustring());
+ ASSERT(m_errorMessage);
+ fail();
+ }
+ return re;
+ }
+ 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)
+{
+ typename TreeBuilder::UnaryExprContext unaryExprContext(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_lastIdentifier == m_globalData->propertyNames->eval || *m_lastIdentifier == m_globalData->propertyNames->arguments;
+ }
+ }
+ 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;
+}
+
+}
+
+namespace WTF
+{
+ template <> struct VectorTraits<JSC::JSParser::Scope> : SimpleClassVectorTraits {
+ static const bool canInitializeWithMemset = false; // Not all Scope data members initialize to 0.
+ };
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/JSParser.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/JSParser.h
new file mode 100644
index 0000000..8bb7dbb
--- /dev/null
+++ b/src/3rdparty/webkit/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 };
+
+const char* jsParse(JSGlobalData*, FunctionParameters*, JSParserStrictness, JSParserMode, const SourceCode*);
+}
+#endif // JSParser_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Keywords.table b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Keywords.table
index 490c1cc..490c1cc 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Keywords.table
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Keywords.table
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.cpp
new file mode 100644
index 0000000..35d0906
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.cpp
@@ -0,0 +1,1205 @@
+/*
+ * 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();
+ }
+}
+
+bool Lexer::nextTokenIsColon()
+{
+ const UChar* code = m_code;
+ while (code < m_codeEnd && (isWhiteSpace(*code) || isLineTerminator(*code)))
+ code++;
+
+ return code < m_codeEnd && *code == ':';
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.h
new file mode 100644
index 0000000..9dc553a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Lexer.h
@@ -0,0 +1,172 @@
+/*
+ * 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 {
+ WTF_MAKE_NONCOPYABLE(Lexer); WTF_MAKE_FAST_ALLOCATED;
+ 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);
+ bool nextTokenIsColon();
+ 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_error = 0;
+ m_code = m_codeStart + offset;
+ m_buffer8.resize(0);
+ m_buffer16.resize(0);
+ // Faster than an if-else sequence
+ m_current = -1;
+ if (LIKELY(m_code < m_codeEnd))
+ m_current = *m_code;
+ }
+ void setLineNumber(int line)
+ {
+ m_lineNumber = line;
+ }
+
+ SourceProvider* sourceProvider() const { return m_source->provider(); }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/parser/NodeConstructors.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/NodeConstructors.h
new file mode 100644
index 0000000..4e094b6
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/parser/NodeInfo.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/NodeInfo.h
index 7f4deff..7f4deff 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/NodeInfo.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/NodeInfo.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Nodes.cpp
new file mode 100644
index 0000000..34aa674
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/parser/Nodes.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Nodes.h
new file mode 100644
index 0000000..6e73c00
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Nodes.h
@@ -0,0 +1,1619 @@
+/*
+ * 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);
+
+ 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ 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> {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.cpp
new file mode 100644
index 0000000..fc1e986
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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"
+
+namespace JSC {
+
+void Parser::parse(JSGlobalData* globalData, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode mode, int* errLine, UString* errMsg)
+{
+ 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);
+
+ const char* parseError = jsParse(globalData, parameters, strictness, mode, m_source);
+ int lineNumber = lexer.lineNumber();
+ bool lexError = lexer.sawError();
+ lexer.clear();
+
+ if (parseError || lexError) {
+ *errLine = lineNumber;
+ *errMsg = parseError ? parseError : "Parse error";
+ m_sourceElements = 0;
+ }
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.h
new file mode 100644
index 0000000..58398d1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/Parser.h
@@ -0,0 +1,130 @@
+/*
+ * 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 {
+ WTF_MAKE_NONCOPYABLE(Parser); WTF_MAKE_FAST_ALLOCATED;
+ public:
+ Parser() { }
+ 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.provider(), errLine, errMsg);
+ return result.release();
+ }
+
+} // namespace JSC
+
+#endif // Parser_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/ParserArena.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/parser/ParserArena.cpp
new file mode 100644
index 0000000..9c96de7
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/parser/ParserArena.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/ParserArena.h
new file mode 100644
index 0000000..82fb808
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/ParserArena.h
@@ -0,0 +1,132 @@
+/*
+ * 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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 {
+ WTF_MAKE_NONCOPYABLE(ParserArena);
+ 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/src/3rdparty/webkit/JavaScriptCore/parser/ResultType.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/ResultType.h
index 27b8112..27b8112 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/ResultType.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/ResultType.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceCode.h
index 9ba4da3..9ba4da3 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/SourceCode.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceCode.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProvider.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProvider.h
new file mode 100644
index 0000000..e9b6b56
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProvider.h
@@ -0,0 +1,105 @@
+/*
+ * 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 "SourceProviderCache.h"
+#include "UString.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/text/TextPosition.h>
+
+namespace JSC {
+
+ class SourceProvider : public RefCounted<SourceProvider> {
+ public:
+ SourceProvider(const UString& url, SourceProviderCache* cache = 0)
+ : m_url(url)
+ , m_validated(false)
+ , m_cache(cache ? cache : new SourceProviderCache)
+ , m_cacheOwned(!cache)
+ {
+ }
+ virtual ~SourceProvider()
+ {
+ if (m_cacheOwned)
+ delete m_cache;
+ }
+
+ 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; }
+ virtual TextPosition1 startPosition() const { return TextPosition1::minimumPosition(); }
+ intptr_t asID() { return reinterpret_cast<intptr_t>(this); }
+
+ bool isValid() const { return m_validated; }
+ void setValid() { m_validated = true; }
+
+ SourceProviderCache* cache() const { return m_cache; }
+ void notifyCacheSizeChanged(int delta) { if (!m_cacheOwned) cacheSizeChanged(delta); }
+
+ private:
+ virtual void cacheSizeChanged(int delta) { UNUSED_PARAM(delta); }
+
+ UString m_url;
+ bool m_validated;
+ SourceProviderCache* m_cache;
+ bool m_cacheOwned;
+ };
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.cpp
new file mode 100644
index 0000000..afeec52
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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. 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 "SourceProviderCache.h"
+
+#include "SourceProviderCacheItem.h"
+
+namespace JSC {
+
+SourceProviderCache::~SourceProviderCache()
+{
+ clear();
+}
+
+void SourceProviderCache::clear()
+{
+ deleteAllValues(m_map);
+ m_map.clear();
+ m_contentByteSize = 0;
+}
+
+unsigned SourceProviderCache::byteSize() const
+{
+ return m_contentByteSize + sizeof(*this) + m_map.capacity() * sizeof(SourceProviderCacheItem*);
+}
+
+void SourceProviderCache::add(int sourcePosition, PassOwnPtr<SourceProviderCacheItem> item, unsigned size)
+{
+ m_map.add(sourcePosition, item.leakPtr());
+ m_contentByteSize += size;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.h
new file mode 100644
index 0000000..4df46f7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCache.h
@@ -0,0 +1,48 @@
+/*
+ * 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. 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 <wtf/HashMap.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+class SourceProviderCacheItem;
+
+class SourceProviderCache {
+public:
+ SourceProviderCache() : m_contentByteSize(0) {}
+ ~SourceProviderCache();
+
+ void clear();
+ unsigned byteSize() const;
+ void add(int sourcePosition, PassOwnPtr<SourceProviderCacheItem>, unsigned size);
+ const SourceProviderCacheItem* get(int sourcePosition) const { return m_map.get(sourcePosition); }
+
+private:
+ HashMap<int, SourceProviderCacheItem*> m_map;
+ unsigned m_contentByteSize;
+};
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCacheItem.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCacheItem.h
new file mode 100644
index 0000000..b9ab225
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SourceProviderCacheItem.h
@@ -0,0 +1,66 @@
+/*
+ * 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. 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 "JSParser.h"
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace JSC {
+
+class SourceProviderCacheItem {
+public:
+ SourceProviderCacheItem(int closeBraceLine, int closeBracePos)
+ : closeBraceLine(closeBraceLine)
+ , closeBracePos(closeBracePos)
+ {
+ }
+ unsigned approximateByteSize() const
+ {
+ // The identifiers are uniqued strings so most likely there are few names that actually use any additional memory.
+ static const unsigned assummedAverageIdentifierSize = sizeof(RefPtr<StringImpl>) + 2;
+ unsigned size = sizeof(*this);
+ size += usedVariables.size() * assummedAverageIdentifierSize;
+ size += writtenVariables.size() * assummedAverageIdentifierSize;
+ return size;
+ }
+ JSToken closeBraceToken() const
+ {
+ JSToken token;
+ token.m_type = CLOSEBRACE;
+ token.m_data.intValue = closeBracePos;
+ token.m_info.startOffset = closeBracePos;
+ token.m_info.endOffset = closeBracePos + 1;
+ token.m_info.line = closeBraceLine;
+ return token;
+ }
+
+ int closeBraceLine;
+ int closeBracePos;
+ bool usesEval;
+ Vector<RefPtr<StringImpl> > usedVariables;
+ Vector<RefPtr<StringImpl> > writtenVariables;
+};
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/parser/SyntaxChecker.h b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SyntaxChecker.h
new file mode 100644
index 0000000..8823566
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/parser/SyntaxChecker.h
@@ -0,0 +1,252 @@
+/*
+ * 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
+
+#include <yarr/YarrSyntaxChecker.h>
+
+namespace JSC {
+class SyntaxChecker {
+public:
+ struct BinaryExprContext {
+ BinaryExprContext(SyntaxChecker& context)
+ : m_context(&context)
+ {
+ m_context->m_topBinaryExprs.append(m_context->m_topBinaryExpr);
+ m_context->m_topBinaryExpr = 0;
+ }
+ ~BinaryExprContext()
+ {
+ m_context->m_topBinaryExpr = m_context->m_topBinaryExprs.last();
+ m_context->m_topBinaryExprs.removeLast();
+ }
+ private:
+ SyntaxChecker* m_context;
+ };
+ struct UnaryExprContext {
+ UnaryExprContext(SyntaxChecker& context)
+ : m_context(&context)
+ {
+ m_context->m_topUnaryTokens.append(m_context->m_topUnaryToken);
+ m_context->m_topUnaryToken = 0;
+ }
+ ~UnaryExprContext()
+ {
+ m_context->m_topUnaryToken = m_context->m_topUnaryTokens.last();
+ m_context->m_topUnaryTokens.removeLast();
+ }
+ private:
+ SyntaxChecker* m_context;
+ };
+
+ SyntaxChecker(JSGlobalData* , Lexer*)
+ {
+ }
+
+ 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;
+ static const bool CanUseFunctionCache = true;
+
+ 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 createRegExp(const Identifier& pattern, const Identifier&, int) { return Yarr::checkSyntax(pattern.ustring()) ? 0 : 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;
+ Vector<int, 8> m_topBinaryExprs;
+ Vector<int, 8> m_topUnaryTokens;
+};
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/profiler/CallIdentifier.h b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/CallIdentifier.h
new file mode 100644
index 0000000..1ba5ec6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/CallIdentifier.h
@@ -0,0 +1,101 @@
+/*
+ * 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 <wtf/text/CString.h>
+#include <wtf/text/StringHash.h>
+
+namespace JSC {
+
+ struct CallIdentifier {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ 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 StringHasher::hashMemory<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/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profile.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profile.cpp
new file mode 100644
index 0000000..1a84518
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/profiler/Profile.h b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profile.h
index 6bf29f7..6bf29f7 100644
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/Profile.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profile.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileGenerator.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileGenerator.cpp
new file mode 100644
index 0000000..5db38bc
--- /dev/null
+++ b/src/3rdparty/webkit/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(ExecState* exec, const UString& title, unsigned uid)
+{
+ return adoptRef(new ProfileGenerator(exec, title, uid));
+}
+
+ProfileGenerator::ProfileGenerator(ExecState* exec, const UString& title, unsigned uid)
+ : m_origin(exec ? exec->lexicalGlobalObject() : 0)
+ , m_profileGroup(exec ? exec->lexicalGlobalObject()->profileGroup() : 0)
+{
+ m_profile = Profile::create(title, uid);
+ m_currentNode = m_head = m_profile->head();
+ if (exec)
+ addParentForConsoleStart(exec);
+}
+
+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_origin)
+ 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_origin)
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileGenerator.h b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileGenerator.h
new file mode 100644
index 0000000..8c8b817
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileGenerator.h
@@ -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.
+ */
+
+#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 JSGlobalObject;
+ class Profile;
+ class ProfileNode;
+ class UString;
+ struct CallIdentifier;
+
+ class ProfileGenerator : public RefCounted<ProfileGenerator> {
+ public:
+ static PassRefPtr<ProfileGenerator> create(ExecState*, const UString& title, unsigned uid);
+
+ // Members
+ const UString& title() const;
+ PassRefPtr<Profile> profile() const { return m_profile; }
+ JSGlobalObject* origin() const { return m_origin; }
+ 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(ExecState*, const UString& title, unsigned uid);
+ void addParentForConsoleStart(ExecState*);
+
+ void removeProfileStart();
+ void removeProfileEnd();
+
+ RefPtr<Profile> m_profile;
+ JSGlobalObject* m_origin;
+ unsigned m_profileGroup;
+ RefPtr<ProfileNode> m_head;
+ RefPtr<ProfileNode> m_currentNode;
+ };
+
+} // namespace JSC
+
+#endif // ProfileGenerator_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileNode.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileNode.cpp
new file mode 100644
index 0000000..8f20bbe
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileNode.h b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfileNode.h
new file mode 100644
index 0000000..ffe7b6f
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.cpp
new file mode 100644
index 0000000..bcaaaac
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.cpp
@@ -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.
+ * 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.
+ JSGlobalObject* origin = exec ? exec->lexicalGlobalObject() : 0;
+
+ for (size_t i = 0; i < m_currentProfiles.size(); ++i) {
+ ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
+ if (profileGenerator->origin() == origin && profileGenerator->title() == title)
+ return;
+ }
+
+ s_sharedEnabledProfilerReference = this;
+ RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(exec, title, ++ProfilesUID);
+ m_currentProfiles.append(profileGenerator);
+}
+
+PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const UString& title)
+{
+ JSGlobalObject* origin = exec ? exec->lexicalGlobalObject() : 0;
+ for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
+ ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
+ if (profileGenerator->origin() == origin && (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;
+}
+
+void Profiler::stopProfiling(JSGlobalObject* origin)
+{
+ for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
+ ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
+ if (profileGenerator->origin() == origin) {
+ profileGenerator->stopProfiling();
+ m_currentProfiles.remove(i);
+ if (!m_currentProfiles.size())
+ s_sharedEnabledProfilerReference = 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]->origin())
+ (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::s_info)) {
+ JSFunction* function = asFunction(functionValue);
+ if (!function->executable()->isHostFunction())
+ return createCallIdentifierFromFunctionImp(exec, function);
+ }
+ if (asObject(functionValue)->inherits(&JSFunction::s_info))
+ return CallIdentifier(static_cast<JSFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
+ if (asObject(functionValue)->inherits(&InternalFunction::s_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/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.h b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.h
new file mode 100644
index 0000000..86366c1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/Profiler.h
@@ -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.
+ * 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 JSGlobalObject;
+ class JSObject;
+ class JSValue;
+ class ProfileGenerator;
+ class UString;
+ struct CallIdentifier;
+
+ class Profiler {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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 stopProfiling(JSGlobalObject*);
+
+ 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/src/3rdparty/webkit/JavaScriptCore/profiler/ProfilerServer.h b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfilerServer.h
index 5b7cc46..5b7cc46 100644
--- a/src/3rdparty/webkit/JavaScriptCore/profiler/ProfilerServer.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfilerServer.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfilerServer.mm b/src/3rdparty/webkit/Source/JavaScriptCore/profiler/ProfilerServer.mm
new file mode 100644
index 0000000..7d87f96
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.cpp
new file mode 100644
index 0000000..c1aa9dd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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"
+#include "JSObject.h"
+#include "ScopeChain.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(HeapRootVisitor& heapRootMarker, ListSet& markSet)
+{
+ ListSet::iterator end = markSet.end();
+ for (ListSet::iterator it = markSet.begin(); it != end; ++it) {
+ MarkedArgumentBuffer* list = *it;
+ heapRootMarker.mark(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) {
+ // FIXME: Even if v is not a JSCell*, if previous values in the buffer
+ // are, then they won't be marked!
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.h
new file mode 100644
index 0000000..bb2d2842
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.h
@@ -0,0 +1,246 @@
+/*
+ * 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/Vector.h>
+
+namespace JSC {
+
+ class MarkStack;
+ typedef MarkStack SlotVisitor;
+
+ class MarkedArgumentBuffer {
+ WTF_MAKE_NONCOPYABLE(MarkedArgumentBuffer);
+ 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(WriteBarrier<Unknown>* buffer, size_t size)
+ {
+ ASSERT(!m_markSet);
+ ASSERT(isEmpty());
+
+ m_buffer = reinterpret_cast<Register*>(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(HeapRootVisitor&, 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.cpp
new file mode 100644
index 0000000..838fd09
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.cpp
@@ -0,0 +1,353 @@
+/*
+ * 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::s_info = { "Arguments", &JSNonFinalObject::s_info, 0, 0 };
+
+Arguments::~Arguments()
+{
+ if (d->extraArguments != d->extraArgumentsFixedBuffer)
+ delete [] d->extraArguments;
+}
+
+void Arguments::visitChildren(SlotVisitor& visitor)
+{
+ JSObject::visitChildren(visitor);
+
+ if (d->registerArray)
+ visitor.appendValues(d->registerArray.get(), d->numParameters);
+
+ if (d->extraArguments) {
+ unsigned numExtraArguments = d->numArguments - d->numParameters;
+ visitor.appendValues(d->extraArguments, numExtraArguments);
+ }
+
+ visitor.append(&d->callee);
+
+ if (d->activation)
+ visitor.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].get();
+ for (; i < d->numArguments; ++i)
+ buffer[i] = d->extraArguments[i - d->numParameters].get();
+ 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].get();
+ else
+ buffer[i] = get(exec, i);
+ }
+ for (; i < d->numArguments; ++i) {
+ if (!d->deletedArguments[i])
+ buffer[i] = d->extraArguments[i - d->numParameters].get();
+ 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].get());
+ for (; i < d->numArguments; ++i)
+ args.append(d->extraArguments[i - d->numParameters].get());
+ 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].get());
+ else
+ args.append(get(exec, i));
+ }
+ for (; i < d->numArguments; ++i) {
+ if (!d->deletedArguments[i])
+ args.append(d->extraArguments[i - d->numParameters].get());
+ 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.setValue(d->registers[d->firstParameterIndex + i].get());
+ } else
+ slot.setValue(d->extraArguments[i - d->numParameters].get());
+ 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.setValue(d->registers[d->firstParameterIndex + i].get());
+ } else
+ slot.setValue(d->extraArguments[i - d->numParameters].get());
+ 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.get());
+ 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].get(), DontEnum);
+ } else
+ descriptor.setDescriptor(d->extraArguments[i - d->numParameters].get(), 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.get(), 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)
+{
+ if (i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
+ if (i < d->numParameters)
+ d->registers[d->firstParameterIndex + i].set(exec->globalData(), d->activation ? static_cast<JSCell*>(d->activation.get()) : static_cast<JSCell*>(this), value);
+ else
+ d->extraArguments[i - d->numParameters].set(exec->globalData(), this, value);
+ return;
+ }
+
+ PutPropertySlot slot;
+ 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].set(exec->globalData(), d->activation ? static_cast<JSCell*>(d->activation.get()) : static_cast<JSCell*>(this), value);
+ else
+ d->extraArguments[i - d->numParameters].set(exec->globalData(), this, value);
+ return;
+ }
+
+ if (propertyName == exec->propertyNames().length && !d->overrodeLength) {
+ d->overrodeLength = true;
+ putDirect(exec->globalData(), propertyName, value, DontEnum);
+ return;
+ }
+
+ if (propertyName == exec->propertyNames().callee && !d->overrodeCallee) {
+ if (!d->isStrictMode) {
+ d->overrodeCallee = true;
+ putDirect(exec->globalData(), 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 = adoptArrayPtr(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 = adoptArrayPtr(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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.h
new file mode 100644
index 0000000..9686d8b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Arguments.h
@@ -0,0 +1,257 @@
+/*
+ * 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"
+
+namespace JSC {
+
+ struct ArgumentsData {
+ WTF_MAKE_NONCOPYABLE(ArgumentsData); WTF_MAKE_FAST_ALLOCATED;
+ public:
+ ArgumentsData() { }
+ WriteBarrier<JSActivation> activation;
+
+ unsigned numParameters;
+ ptrdiff_t firstParameterIndex;
+ unsigned numArguments;
+
+ WriteBarrier<Unknown>* registers;
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray;
+
+ WriteBarrier<Unknown>* extraArguments;
+ OwnArrayPtr<bool> deletedArguments;
+ WriteBarrier<Unknown> extraArgumentsFixedBuffer[4];
+
+ WriteBarrier<JSFunction> callee;
+ bool overrodeLength : 1;
+ bool overrodeCallee : 1;
+ bool overrodeCaller : 1;
+ bool isStrictMode : 1;
+ };
+
+
+ class Arguments : public JSNonFinalObject {
+ 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 s_info;
+
+ virtual void visitChildren(SlotVisitor&);
+
+ 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(JSGlobalData&);
+ bool isTornOff() const { return d->registerArray; }
+ void setActivation(JSGlobalData& globalData, JSActivation* activation)
+ {
+ ASSERT(!d->registerArray);
+ d->activation.set(globalData, this, activation);
+ d->registers = &activation->registerAt(0);
+ }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | 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);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual bool deleteProperty(ExecState*, unsigned propertyName);
+ void createStrictModeCallerIfNecessary(ExecState*);
+ void createStrictModeCalleeIfNecessary(ExecState*);
+
+ void init(CallFrame*);
+
+ OwnPtr<ArgumentsData> d;
+ };
+
+ Arguments* asArguments(JSValue);
+
+ inline Arguments* asArguments(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&Arguments::s_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)
+ : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure())
+ , d(adoptPtr(new ArgumentsData))
+ {
+ ASSERT(inherits(&s_info));
+
+ 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->registers = reinterpret_cast<WriteBarrier<Unknown>*>(callFrame->registers());
+
+ WriteBarrier<Unknown>* extraArguments;
+ if (d->numArguments <= d->numParameters)
+ extraArguments = 0;
+ else {
+ unsigned numExtraArguments = d->numArguments - d->numParameters;
+ if (numExtraArguments > sizeof(d->extraArgumentsFixedBuffer) / sizeof(WriteBarrier<Unknown>))
+ extraArguments = new WriteBarrier<Unknown>[numExtraArguments];
+ else
+ extraArguments = d->extraArgumentsFixedBuffer;
+ for (unsigned i = 0; i < numExtraArguments; ++i)
+ extraArguments[i].set(callFrame->globalData(), this, argv[d->numParameters + i].jsValue());
+ }
+
+ d->extraArguments = extraArguments;
+
+ d->callee.set(callFrame->globalData(), this, callee);
+ d->overrodeLength = false;
+ d->overrodeCallee = false;
+ d->overrodeCaller = false;
+ d->isStrictMode = callFrame->codeBlock()->isStrictMode();
+ if (d->isStrictMode)
+ copyRegisters(callFrame->globalData());
+ }
+
+ inline Arguments::Arguments(CallFrame* callFrame, NoParametersType)
+ : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure())
+ , d(adoptPtr(new ArgumentsData))
+ {
+ ASSERT(inherits(&s_info));
+ ASSERT(!asFunction(callFrame->callee())->jsExecutable()->parameterCount());
+
+ unsigned numArguments = callFrame->argumentCount();
+
+ d->numParameters = 0;
+ d->numArguments = numArguments;
+
+ WriteBarrier<Unknown>* extraArguments;
+ if (numArguments > sizeof(d->extraArgumentsFixedBuffer) / sizeof(Register))
+ extraArguments = new WriteBarrier<Unknown>[numArguments];
+ else
+ extraArguments = d->extraArgumentsFixedBuffer;
+
+ Register* argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numArguments - 1;
+ for (unsigned i = 0; i < numArguments; ++i)
+ extraArguments[i].set(callFrame->globalData(), this, argv[i].jsValue());
+
+ d->extraArguments = extraArguments;
+
+ d->callee.set(callFrame->globalData(), this, asFunction(callFrame->callee()));
+ d->overrodeLength = false;
+ d->overrodeCallee = false;
+ d->overrodeCaller = false;
+ d->isStrictMode = callFrame->codeBlock()->isStrictMode();
+ if (d->isStrictMode)
+ copyRegisters(callFrame->globalData());
+ }
+
+ inline void Arguments::copyRegisters(JSGlobalData& globalData)
+ {
+ ASSERT(!isTornOff());
+
+ if (!d->numParameters)
+ return;
+
+ int registerOffset = d->numParameters + RegisterFile::CallFrameHeaderSize;
+ size_t registerArraySize = d->numParameters;
+
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[registerArraySize]);
+ for (size_t i = 0; i < registerArraySize; i++)
+ registerArray[i].set(globalData, this, d->registers[i - registerOffset].get());
+ d->registers = registerArray.get() + registerOffset;
+ d->registerArray = registerArray.release();
+ }
+
+ // This JSActivation function is defined here so it can get at Arguments::setRegisters.
+ inline void JSActivation::copyRegisters(JSGlobalData& globalData)
+ {
+ ASSERT(!m_registerArray);
+
+ size_t numLocals = m_numCapturedVars + m_numParametersMinusThis;
+
+ if (!numLocals)
+ return;
+
+ int registerOffset = m_numParametersMinusThis + RegisterFile::CallFrameHeaderSize;
+ size_t registerArraySize = numLocals + RegisterFile::CallFrameHeaderSize;
+
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData, m_registers - registerOffset, registerArraySize, m_numParametersMinusThis + 1);
+ WriteBarrier<Unknown>* registers = registerArray.get() + registerOffset;
+ setRegisters(registers, registerArray.release());
+ }
+
+} // namespace JSC
+
+#endif // Arguments_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
new file mode 100644
index 0000000..050e989
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
@@ -0,0 +1,101 @@
+/*
+ * 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"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
+
+static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*);
+
+ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype, Structure* functionStructure)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className))
+{
+ // ECMA 15.4.3.1 Array.prototype
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+
+ // ES5
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum);
+}
+
+static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args)
+{
+ JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
+
+ // 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->globalData(), globalObject->arrayStructure(), n, CreateInitialized);
+ }
+
+ // otherwise the array is constructed with the arguments in it
+ return new (exec) JSArray(exec->globalData(), globalObject->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::s_info)));
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayConstructor.h
new file mode 100644
index 0000000..97b26c5
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, ArrayPrototype*, Structure*);
+
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // ArrayConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
new file mode 100644
index 0000000..ef5f00e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -0,0 +1,1147 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008, 2009, 2011 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 "StringRecursionChecker.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::s_info = {"Array", &JSArray::s_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, Structure* structure)
+ : JSArray(globalObject->globalData(), structure)
+{
+ ASSERT(inherits(&s_info));
+ putAnonymousValue(globalObject->globalData(), 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::s_info))
+ return throwVMTypeError(exec);
+ JSArray* thisObj = asArray(thisValue);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ StringRecursionChecker checker(exec, thisObj);
+ if (EncodedJSValue earlyReturnValue = checker.earlyReturnValue())
+ return earlyReturnValue;
+
+ 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;
+ }
+ 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::s_info))
+ return throwVMTypeError(exec);
+ JSObject* thisObj = asArray(thisValue);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ StringRecursionChecker checker(exec, thisObj);
+ if (EncodedJSValue earlyReturnValue = checker.earlyReturnValue())
+ return earlyReturnValue;
+
+ JSStringBuilder strBuffer;
+ 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);
+ }
+ }
+
+ return JSValue::encode(strBuffer.build(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ StringRecursionChecker checker(exec, thisObj);
+ if (EncodedJSValue earlyReturnValue = checker.earlyReturnValue())
+ return earlyReturnValue;
+
+ JSStringBuilder strBuffer;
+
+ UString separator;
+ if (!exec->argument(0).isUndefined())
+ separator = exec->argument(0).toString(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));
+ }
+
+ 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::s_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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ JSValue result;
+ 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);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ for (unsigned n = 0; n < exec->argumentCount(); n++) {
+ // Check for integer overflow; where safe we can do a fast put by index.
+ if (length + n >= length)
+ thisObj->put(exec, length + n, exec->argument(n));
+ else {
+ PutPropertySlot slot;
+ Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toString(exec));
+ thisObj->put(exec, propertyName, exec->argument(n), slot);
+ }
+ }
+ JSValue newLength(static_cast<int64_t>(length) + static_cast<int64_t>(exec->argumentCount()));
+ putProperty(exec, thisObj, exec->propertyNames().length, newLength);
+ return JSValue::encode(newLength);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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 (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (!length || exec->hadException())
+ return JSValue::encode(thisObj);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+
+ if (thisObj->classInfo() == &JSArray::s_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);
+ }
+
+ // "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);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ unsigned themin = i;
+ JSValue minObj = iObj;
+ for (unsigned j = i + 1; j < length; ++j) {
+ JSValue jObj = thisObj->get(exec, j);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ 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)
+{
+ // 15.4.4.12
+
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ if (!exec->argumentCount())
+ return JSValue::encode(constructEmptyArray(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->globalData(), exec->lexicalGlobalObject()->arrayStructure(), deleteCount, CreateCompact);
+ JSValue result = resObj;
+ JSGlobalData& globalData = exec->globalData();
+ for (unsigned k = 0; k < deleteCount; k++)
+ resObj->uncheckedSetIndex(globalData, 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)
+{
+ // 15.4.4.13
+
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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 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);
+
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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, 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);
+
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ MarkedArgumentBuffer eachArguments;
+ eachArguments.append(v);
+ eachArguments.append(jsNumber(k));
+ eachArguments.append(thisObj);
+
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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 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);
+
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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 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);
+
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ call(exec, function, callType, callData, applyThis, eachArguments);
+ }
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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 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);
+
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ unsigned i = 0;
+ JSValue rv;
+ 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 (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ 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);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ unsigned i = 0;
+ JSValue rv;
+ 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 (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ 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)
+{
+ // 15.4.4.14
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ 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)
+{
+ // 15.4.4.15
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.h
new file mode 100644
index 0000000..6dadf51
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArrayPrototype.h
@@ -0,0 +1,49 @@
+/*
+ * 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*, Structure*);
+
+ bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned AnonymousSlotCount = JSArray::AnonymousSlotCount + 1;
+ };
+
+} // namespace JSC
+
+#endif // ArrayPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
new file mode 100644
index 0000000..610b8d1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
@@ -0,0 +1,56 @@
+// -*- 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 "JSObject.h"
+
+namespace JSC {
+
+ class BatchedTransitionOptimizer {
+ WTF_MAKE_NONCOPYABLE(BatchedTransitionOptimizer);
+ public:
+ BatchedTransitionOptimizer(JSGlobalData& globalData, JSObject* object)
+ : m_globalData(&globalData)
+ , m_object(object)
+ {
+ }
+
+ ~BatchedTransitionOptimizer()
+ {
+ if (m_object->structure()->isDictionary())
+ m_object->flattenDictionaryObject(*m_globalData);
+ }
+
+ private:
+ JSGlobalData* m_globalData;
+ JSObject* m_object;
+ };
+
+} // namespace JSC
+
+#endif // BatchedTransitionOptimizer_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
new file mode 100644
index 0000000..a1a4ed4
--- /dev/null
+++ b/src/3rdparty/webkit/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, Structure* structure, BooleanPrototype* booleanPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, booleanPrototype->classInfo()->className))
+{
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->globalData(), 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->globalData(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure());
+ obj->setInternalValue(exec->globalData(), 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, JSGlobalObject* globalObject, JSValue immediateBooleanValue)
+{
+ BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), globalObject->booleanObjectStructure());
+ obj->setInternalValue(exec->globalData(), immediateBooleanValue);
+ return obj;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanConstructor.h
new file mode 100644
index 0000000..fa0d05e
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, BooleanPrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+ JSObject* constructBooleanFromImmediateBoolean(ExecState*, JSGlobalObject*, JSValue);
+ JSObject* constructBoolean(ExecState*, const ArgList&);
+
+} // namespace JSC
+
+#endif // BooleanConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.cpp
new file mode 100644
index 0000000..e24a30a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.cpp
@@ -0,0 +1,36 @@
+/*
+ * 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::s_info = { "Boolean", &JSWrapperObject::s_info, 0, 0 };
+
+BooleanObject::BooleanObject(JSGlobalData& globalData, Structure* structure)
+ : JSWrapperObject(globalData, structure)
+{
+ ASSERT(inherits(&s_info));
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.h
new file mode 100644
index 0000000..def44b4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanObject.h
@@ -0,0 +1,50 @@
+/*
+ * 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(JSGlobalData&, Structure*);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+ };
+
+ BooleanObject* asBooleanObject(JSValue);
+
+ inline BooleanObject* asBooleanObject(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&BooleanObject::s_info));
+ return static_cast<BooleanObject*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // BooleanObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanPrototype.cpp
new file mode 100644
index 0000000..20990e1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanPrototype.cpp
@@ -0,0 +1,85 @@
+/*
+ * 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"
+
+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, Structure* structure, Structure* functionStructure)
+ : BooleanObject(exec->globalData(), structure)
+{
+ setInternalValue(exec->globalData(), jsBoolean(false));
+
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 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::s_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::s_info))
+ return throwVMTypeError(exec);
+
+ return JSValue::encode(asBooleanObject(thisValue)->internalValue());
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/BooleanPrototype.h
new file mode 100644
index 0000000..5ccbd2b
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, Structure* functionStructure);
+ };
+
+} // namespace JSC
+
+#endif // BooleanPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h
new file mode 100644
index 0000000..67c7af8
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CallData.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CallData.cpp
new file mode 100644
index 0000000..018e2ca
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CallData.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CallData.h
new file mode 100644
index 0000000..b138f54
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CallData.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 CallData_h
+#define CallData_h
+
+#include "JSValue.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/src/3rdparty/webkit/JavaScriptCore/runtime/ClassInfo.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ClassInfo.h
index acec4e7..acec4e7 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/ClassInfo.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ClassInfo.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp
new file mode 100644
index 0000000..1561102
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CommonIdentifiers.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CommonIdentifiers.h
new file mode 100644
index 0000000..478a639
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CommonIdentifiers.h
@@ -0,0 +1,100 @@
+/*
+ * 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(enumerable) \
+ macro(eval) \
+ macro(exec) \
+ macro(fromCharCode) \
+ macro(global) \
+ macro(get) \
+ macro(hasOwnProperty) \
+ macro(ignoreCase) \
+ macro(index) \
+ macro(input) \
+ macro(isArray) \
+ macro(isPrototypeOf) \
+ 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 {
+ WTF_MAKE_NONCOPYABLE(CommonIdentifiers); WTF_MAKE_FAST_ALLOCATED;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Completion.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Completion.cpp
new file mode 100644
index 0000000..ac19705
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Completion.cpp
@@ -0,0 +1,78 @@
+/*
+ * 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());
+
+ ProgramExecutable* program = ProgramExecutable::create(exec, source);
+ JSObject* error = program->checkSyntax(exec);
+ if (error)
+ return Completion(Throw, error);
+
+ return Completion(Normal);
+}
+
+Completion evaluate(ExecState* exec, ScopeChainNode* scopeChain, const SourceCode& source, JSValue thisValue)
+{
+ JSLock lock(exec);
+ ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable());
+
+ ProgramExecutable* program = ProgramExecutable::create(exec, source);
+ if (!program) {
+ JSValue exception = exec->globalData().exception;
+ exec->globalData().exception = JSValue();
+ return Completion(Throw, exception);
+ }
+
+ JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
+
+ JSValue result = exec->interpreter()->execute(program, exec, scopeChain, 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Completion.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Completion.h
new file mode 100644
index 0000000..1dd25fd
--- /dev/null
+++ b/src/3rdparty/webkit/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 ScopeChainNode;
+ 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*, ScopeChainNode*, const SourceCode&, JSValue thisValue = JSValue());
+
+} // namespace JSC
+
+#endif // Completion_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ConstructData.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ConstructData.cpp
new file mode 100644
index 0000000..5da2a91
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ConstructData.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ConstructData.h
new file mode 100644
index 0000000..3d5f732
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConstructor.cpp
new file mode 100644
index 0000000..9bbb688
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConstructor.cpp
@@ -0,0 +1,202 @@
+/*
+ * 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 <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, Structure* structure, Structure* functionStructure, DatePrototype* datePrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className))
+{
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly);
+
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
+
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
+}
+
+// ECMA 15.9.3
+JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, 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::s_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, globalObject->dateStructure(), value);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithDateConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructDate(exec, asInternalFunction(exec->callee())->globalObject(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConstructor.h
new file mode 100644
index 0000000..23a0311
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, Structure* functionStructure, DatePrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+ JSObject* constructDate(ExecState*, JSGlobalObject*, const ArgList&);
+
+} // namespace JSC
+
+#endif // DateConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConversion.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConversion.cpp
new file mode 100644
index 0000000..1418876
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConversion.cpp
@@ -0,0 +1,107 @@
+/*
+ * 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 "JSObject.h"
+#include "ScopeChain.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/src/3rdparty/webkit/JavaScriptCore/runtime/DateConversion.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConversion.h
index ff32b50..ff32b50 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConversion.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateConversion.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.cpp
new file mode 100644
index 0000000..d8ca072
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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::s_info = {"Date", &JSWrapperObject::s_info, 0, 0};
+
+DateInstance::DateInstance(ExecState* exec, Structure* structure)
+ : JSWrapperObject(exec->globalData(), structure)
+{
+ ASSERT(inherits(&s_info));
+ setInternalValue(exec->globalData(), jsNaN());
+}
+
+DateInstance::DateInstance(ExecState* exec, Structure* structure, double time)
+ : JSWrapperObject(exec->globalData(), structure)
+{
+ ASSERT(inherits(&s_info));
+ setInternalValue(exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.h
new file mode 100644
index 0000000..6195c85
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstance.h
@@ -0,0 +1,77 @@
+/*
+ * 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*, Structure*, double);
+ explicit DateInstance(ExecState*, Structure*);
+
+ double internalNumber() const { return internalValue().uncheckedGetNumber(); }
+
+ static JS_EXPORTDATA const ClassInfo s_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 Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ private:
+ const GregorianDateTime* calculateGregorianDateTime(ExecState*) const;
+ const GregorianDateTime* calculateGregorianDateTimeUTC(ExecState*) const;
+
+ mutable RefPtr<DateInstanceData> m_data;
+ };
+
+ DateInstance* asDateInstance(JSValue);
+
+ inline DateInstance* asDateInstance(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&DateInstance::s_info));
+ return static_cast<DateInstance*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // DateInstance_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstanceCache.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DateInstanceCache.h
new file mode 100644
index 0000000..b60c29a
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.cpp
new file mode 100644
index 0000000..444fa98
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.cpp
@@ -0,0 +1,1096 @@
+/*
+ * 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 USE(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::s_info = {"Date", &DateInstance::s_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, Structure* structure)
+ : DateInstance(exec, structure)
+{
+ ASSERT(inherits(&s_info));
+
+ // The constructor will be added later, after DateConstructor has been built.
+ putAnonymousValue(exec->globalData(), 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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_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::s_info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ double milli = timeClip(exec->argument(0).toNumber(exec));
+ JSValue result = jsNumber(milli);
+ thisDateObj->setInternalValue(exec->globalData(), result);
+ return JSValue::encode(result);
+}
+
+static EncodedJSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::s_info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ double milli = thisDateObj->internalNumber();
+
+ if (!exec->argumentCount() || isnan(milli)) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(exec->globalData(), 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(exec->globalData(), result);
+ return JSValue::encode(result);
+ }
+
+ JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
+ thisDateObj->setInternalValue(exec->globalData(), result);
+ return JSValue::encode(result);
+}
+
+static EncodedJSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::s_info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ if (!exec->argumentCount()) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(exec->globalData(), 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(exec->globalData(), result);
+ return JSValue::encode(result);
+ }
+
+ JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
+ thisDateObj->setInternalValue(exec->globalData(), 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::s_info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ if (!exec->argumentCount()) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(exec->globalData(), 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(exec->globalData(), 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(exec->globalData(), result);
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::s_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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.h
new file mode 100644
index 0000000..2e1030d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/DatePrototype.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 DatePrototype_h
+#define DatePrototype_h
+
+#include "DateInstance.h"
+
+namespace JSC {
+
+ class ObjectPrototype;
+
+ class DatePrototype : public DateInstance {
+ public:
+ DatePrototype(ExecState*, JSGlobalObject*, Structure*);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags;
+
+ COMPILE_ASSERT(!DateInstance::AnonymousSlotCount, DatePrototype_stomps_on_your_anonymous_slot);
+ static const unsigned AnonymousSlotCount = 1;
+ };
+
+} // namespace JSC
+
+#endif // DatePrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Error.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Error.cpp
new file mode 100644
index 0000000..7eda19f
--- /dev/null
+++ b/src/3rdparty/webkit/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, 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;
+};
+
+ASSERT_CLASS_FITS_IN_CELL(StrictModeTypeErrorFunction);
+
+JSValue createTypeErrorFunction(ExecState* exec, const UString& message)
+{
+ return new (exec) StrictModeTypeErrorFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->internalFunctionStructure(), message);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Error.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Error.h
new file mode 100644
index 0000000..c0f9d32
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
new file mode 100644
index 0000000..df112dd
--- /dev/null
+++ b/src/3rdparty/webkit/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, Structure* structure, ErrorPrototype* errorPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, errorPrototype->classInfo()->className))
+{
+ // ECMA 15.11.3.1 Error.prototype
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
+ putDirectWithoutTransition(exec->globalData(), 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 = asInternalFunction(exec->callee())->globalObject()->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 = asInternalFunction(exec->callee())->globalObject()->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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorConstructor.h
new file mode 100644
index 0000000..ceec005
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, ErrorPrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // ErrorConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.cpp
new file mode 100644
index 0000000..ed95ba4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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::s_info = { "Error", &JSNonFinalObject::s_info, 0, 0 };
+
+ErrorInstance::ErrorInstance(JSGlobalData* globalData, Structure* structure)
+ : JSNonFinalObject(*globalData, structure)
+ , m_appendSourceToMessage(false)
+{
+ ASSERT(inherits(&s_info));
+ putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, ""));
+}
+
+ErrorInstance::ErrorInstance(JSGlobalData* globalData, Structure* structure, const UString& message)
+ : JSNonFinalObject(*globalData, structure)
+ , m_appendSourceToMessage(false)
+{
+ ASSERT(inherits(&s_info));
+ putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message));
+}
+
+ErrorInstance* ErrorInstance::create(JSGlobalData* globalData, Structure* structure, const UString& message)
+{
+ return new (globalData) ErrorInstance(globalData, structure, message);
+}
+
+ErrorInstance* ErrorInstance::create(ExecState* exec, 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.h
new file mode 100644
index 0000000..afcf158
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorInstance.h
@@ -0,0 +1,56 @@
+/*
+ * 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 JSNonFinalObject {
+ public:
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ static ErrorInstance* create(JSGlobalData*, Structure*, const UString&);
+ static ErrorInstance* create(ExecState*, 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*, Structure*);
+ explicit ErrorInstance(JSGlobalData*, Structure*, const UString&);
+
+ bool m_appendSourceToMessage;
+ };
+
+} // namespace JSC
+
+#endif // ErrorInstance_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
new file mode 100644
index 0000000..a57e947
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -0,0 +1,70 @@
+/*
+ * 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 "StringRecursionChecker.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, Structure* structure, Structure* functionStructure)
+ : ErrorInstance(&exec->globalData(), structure)
+{
+ // The constructor will be added later in ErrorConstructor's constructor
+
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
+}
+
+EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ StringRecursionChecker checker(exec, thisObj);
+ if (EncodedJSValue earlyReturnValue = checker.earlyReturnValue())
+ return earlyReturnValue;
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ErrorPrototype.h
new file mode 100644
index 0000000..9437d3a
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, Structure* functionStructure);
+ };
+
+} // namespace JSC
+
+#endif // ErrorPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
new file mode 100644
index 0000000..1d74315
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -0,0 +1,150 @@
+/*
+ * 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 JSNonFinalObject {
+public:
+ InterruptedExecutionError(JSGlobalData* globalData)
+ : JSNonFinalObject(*globalData, globalData->interruptedExecutionErrorStructure.get())
+ {
+ }
+
+ 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 JSNonFinalObject {
+public:
+ TerminatedExecutionError(JSGlobalData* globalData)
+ : JSNonFinalObject(*globalData, globalData->terminatedExecutionErrorStructure.get())
+ {
+ }
+
+ 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* createOutOfMemoryError(JSGlobalObject* globalObject)
+{
+ return createError(globalObject, "Out of memory");
+}
+
+JSObject* throwOutOfMemoryError(ExecState* exec)
+{
+ return throwError(exec, createOutOfMemoryError(exec->lexicalGlobalObject()));
+}
+
+JSObject* throwStackOverflowError(ExecState* exec)
+{
+ return throwError(exec, createStackOverflowError(exec));
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.h
new file mode 100644
index 0000000..5f1ec6f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ExceptionHelpers.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.
+ * 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* createOutOfMemoryError(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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.cpp
new file mode 100644
index 0000000..cf51ac2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.cpp
@@ -0,0 +1,405 @@
+/*
+ * 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"
+
+#if ENABLE(DFG_JIT)
+#include "DFGByteCodeParser.h"
+#include "DFGJITCompiler.h"
+#endif
+
+namespace JSC {
+
+const ClassInfo ExecutableBase::s_info = { "Executable", 0, 0, 0 };
+
+const ClassInfo NativeExecutable::s_info = { "NativeExecutable", &ExecutableBase::s_info, 0, 0 };
+
+NativeExecutable::~NativeExecutable()
+{
+}
+
+const ClassInfo EvalExecutable::s_info = { "EvalExecutable", &ScriptExecutable::s_info, 0, 0 };
+
+EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext)
+ : ScriptExecutable(exec->globalData().evalExecutableStructure.get(), exec, source, inStrictContext)
+{
+}
+
+EvalExecutable::~EvalExecutable()
+{
+}
+
+const ClassInfo ProgramExecutable::s_info = { "ProgramExecutable", &ScriptExecutable::s_info, 0, 0 };
+
+ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source)
+ : ScriptExecutable(exec->globalData().programExecutableStructure.get(), exec, source, false)
+{
+}
+
+ProgramExecutable::~ProgramExecutable()
+{
+}
+
+const ClassInfo FunctionExecutable::s_info = { "FunctionExecutable", &ScriptExecutable::s_info, 0, 0 };
+
+FunctionExecutable::FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine)
+ : ScriptExecutable(globalData->functionExecutableStructure.get(), 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->globalData().functionExecutableStructure.get(), exec, source, inStrictContext)
+ , m_numCapturedVariables(0)
+ , m_forceUsesArguments(forceUsesArguments)
+ , m_parameters(parameters)
+ , m_name(name)
+ , m_symbolTable(0)
+{
+ m_firstLine = firstLine;
+ m_lastLine = lastLine;
+}
+
+
+JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ JSObject* exception = 0;
+ JSGlobalData* globalData = &exec->globalData();
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ if (!lexicalGlobalObject->isEvalEnabled())
+ return throwError(exec, createEvalError(exec, "Eval is disabled"));
+ 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());
+
+ JSGlobalObject* globalObject = scopeChainNode->globalObject.get();
+
+ ASSERT(!m_evalCodeBlock);
+ m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChainNode->localDepth()));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), scopeChainNode, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get())));
+ if ((exception = generator->generate())) {
+ m_evalCodeBlock.clear();
+ evalNode->destroyData();
+ return exception;
+ }
+
+ 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
+
+#if ENABLE(JIT)
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock) + m_jitCodeForCall.size());
+#else
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock));
+#endif
+
+ return 0;
+}
+
+void EvalExecutable::visitChildren(SlotVisitor& visitor)
+{
+ ScriptExecutable::visitChildren(visitor);
+ if (m_evalCodeBlock)
+ m_evalCodeBlock->visitAggregate(visitor);
+}
+
+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());
+
+ JSGlobalObject* globalObject = scopeChainNode->globalObject.get();
+
+ m_programCodeBlock = adoptPtr(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), scopeChainNode, &globalObject->symbolTable(), m_programCodeBlock.get())));
+ if ((exception = generator->generate())) {
+ m_programCodeBlock.clear();
+ programNode->destroyData();
+ return exception;
+ }
+
+ 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
+
+#if ENABLE(JIT)
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_programCodeBlock) + m_jitCodeForCall.size());
+#else
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_programCodeBlock));
+#endif
+
+ return 0;
+}
+
+#if ENABLE(JIT)
+static bool tryDFGCompile(JSGlobalData* globalData, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck)
+{
+#if ENABLE(DFG_JIT)
+#if ENABLE(DFG_JIT_RESTRICTIONS)
+ // FIXME: No flow control yet supported, don't bother scanning the bytecode if there are any jump targets.
+ // FIXME: temporarily disable property accesses until we fix regressions.
+ if (codeBlock->numberOfJumpTargets() || codeBlock->numberOfStructureStubInfos())
+ return false;
+#endif
+
+ DFG::Graph dfg(codeBlock->m_numParameters, codeBlock->m_numVars);
+ if (!parse(dfg, globalData, codeBlock))
+ return false;
+
+ DFG::JITCompiler dataFlowJIT(globalData, dfg, codeBlock);
+ dataFlowJIT.compileFunction(jitCode, jitCodeWithArityCheck);
+ return true;
+#else
+ UNUSED_PARAM(globalData);
+ UNUSED_PARAM(codeBlock);
+ UNUSED_PARAM(jitCode);
+ UNUSED_PARAM(jitCodeWithArityCheck);
+ return false;
+#endif
+}
+#endif
+
+void ProgramExecutable::visitChildren(SlotVisitor& visitor)
+{
+ ScriptExecutable::visitChildren(visitor);
+ if (m_programCodeBlock)
+ m_programCodeBlock->visitAggregate(visitor);
+}
+
+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());
+
+ JSGlobalObject* globalObject = scopeChainNode->globalObject.get();
+
+ ASSERT(!m_codeBlockForCall);
+ m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), false));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChainNode, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get())));
+ if ((exception = generator->generate())) {
+ m_codeBlockForCall.clear();
+ body->destroyData();
+ return exception;
+ }
+
+ 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()) {
+ bool dfgCompiled = tryDFGCompile(&exec->globalData(), m_codeBlockForCall.get(), m_jitCodeForCall, m_jitCodeForCallWithArityCheck);
+ if (!dfgCompiled)
+ m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_codeBlockForCall.get(), &m_jitCodeForCallWithArityCheck);
+
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ m_codeBlockForCall->discardBytecode();
+#endif
+ }
+#endif
+
+#if ENABLE(JIT)
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForCall) + m_jitCodeForCall.size());
+#else
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForCall));
+#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());
+
+ JSGlobalObject* globalObject = scopeChainNode->globalObject.get();
+
+ ASSERT(!m_codeBlockForConstruct);
+ m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), true));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChainNode, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get())));
+ if ((exception = generator->generate())) {
+ m_codeBlockForConstruct.clear();
+ body->destroyData();
+ return exception;
+ }
+
+ 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
+
+#if ENABLE(JIT)
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForConstruct) + m_jitCodeForConstruct.size());
+#else
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForConstruct));
+#endif
+
+ return 0;
+}
+
+void FunctionExecutable::visitChildren(SlotVisitor& visitor)
+{
+ ScriptExecutable::visitChildren(visitor);
+ if (m_codeBlockForCall)
+ m_codeBlockForCall->visitAggregate(visitor);
+ if (m_codeBlockForConstruct)
+ m_codeBlockForConstruct->visitAggregate(visitor);
+}
+
+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
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.h
new file mode 100644
index 0000000..70b12a5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Executable.h
@@ -0,0 +1,441 @@
+/*
+ * 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 JSCell {
+ friend class JIT;
+
+ protected:
+ static const int NUM_PARAMETERS_IS_HOST = 0;
+ static const int NUM_PARAMETERS_NOT_COMPILED = -1;
+
+ public:
+ ExecutableBase(JSGlobalData& globalData, Structure* structure, int numParameters)
+ : JSCell(globalData, structure)
+ , m_numParametersForCall(numParameters)
+ , m_numParametersForConstruct(numParameters)
+ {
+ }
+
+ bool isHostFunction() const
+ {
+ ASSERT((m_numParametersForCall == NUM_PARAMETERS_IS_HOST) == (m_numParametersForConstruct == NUM_PARAMETERS_IS_HOST));
+ return m_numParametersForCall == NUM_PARAMETERS_IS_HOST;
+ }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
+
+ protected:
+ static const unsigned StructureFlags = 0;
+ static const ClassInfo s_info;
+ 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
+ };
+
+ class NativeExecutable : public ExecutableBase {
+ friend class JIT;
+ public:
+#if ENABLE(JIT)
+ static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodePtr callThunk, NativeFunction function, MacroAssemblerCodePtr constructThunk, NativeFunction constructor)
+ {
+ if (!callThunk)
+ return new (&globalData) NativeExecutable(globalData, JITCode(), function, JITCode(), constructor);
+ return new (&globalData) NativeExecutable(globalData, JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor);
+ }
+#else
+ static NativeExecutable* create(JSGlobalData& globalData, NativeFunction function, NativeFunction constructor)
+ {
+ return new (&globalData) NativeExecutable(globalData, function, constructor);
+ }
+#endif
+
+ ~NativeExecutable();
+
+ NativeFunction function() { return m_function; }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(LeafType, StructureFlags), AnonymousSlotCount, &s_info); }
+
+ private:
+#if ENABLE(JIT)
+ NativeExecutable(JSGlobalData& globalData, JITCode callThunk, NativeFunction function, JITCode constructThunk, NativeFunction constructor)
+ : ExecutableBase(globalData, globalData.nativeExecutableStructure.get(), NUM_PARAMETERS_IS_HOST)
+ , m_function(function)
+ , m_constructor(constructor)
+ {
+ m_jitCodeForCall = callThunk;
+ m_jitCodeForConstruct = constructThunk;
+ m_jitCodeForCallWithArityCheck = callThunk.addressForCall();
+ m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall();
+ }
+#else
+ NativeExecutable(JSGlobalData& globalData, NativeFunction function, NativeFunction constructor)
+ : ExecutableBase(globalData, globalData.nativeExecutableStructure.get(), NUM_PARAMETERS_IS_HOST)
+ , m_function(function)
+ , m_constructor(constructor)
+ {
+ }
+#endif
+
+ 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;
+ static const ClassInfo s_info;
+ };
+
+ class ScriptExecutable : public ExecutableBase {
+ public:
+ ScriptExecutable(Structure* structure, JSGlobalData* globalData, const SourceCode& source, bool isInStrictContext)
+ : ExecutableBase(*globalData, structure, 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(Structure* structure, ExecState* exec, const SourceCode& source, bool isInStrictContext)
+ : ExecutableBase(exec->globalData(), structure, 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)
+ {
+ ASSERT(exec->globalData().dynamicGlobalObject);
+ 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 EvalExecutable* create(ExecState* exec, const SourceCode& source, bool isInStrictContext) { return new (exec) EvalExecutable(exec, source, isInStrictContext); }
+
+#if ENABLE(JIT)
+ JITCode& generatedJITCode()
+ {
+ return generatedJITCodeForCall();
+ }
+#endif
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ private:
+ static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
+ static const ClassInfo s_info;
+ EvalExecutable(ExecState*, const SourceCode&, bool);
+
+ JSObject* compileInternal(ExecState*, ScopeChainNode*);
+ virtual void visitChildren(SlotVisitor&);
+
+ OwnPtr<EvalCodeBlock> m_evalCodeBlock;
+ };
+
+ class ProgramExecutable : public ScriptExecutable {
+ public:
+ static ProgramExecutable* create(ExecState* exec, const SourceCode& source)
+ {
+ return new (exec) ProgramExecutable(exec, source);
+ }
+
+ ~ProgramExecutable();
+
+ JSObject* compile(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ ASSERT(exec->globalData().dynamicGlobalObject);
+ 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
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ private:
+ static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
+ static const ClassInfo s_info;
+ ProgramExecutable(ExecState*, const SourceCode&);
+
+ JSObject* compileInternal(ExecState*, ScopeChainNode*);
+ virtual void visitChildren(SlotVisitor&);
+
+ OwnPtr<ProgramCodeBlock> m_programCodeBlock;
+ };
+
+ class FunctionExecutable : public ScriptExecutable {
+ friend class JIT;
+ public:
+ static FunctionExecutable* create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
+ {
+ return new (exec) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
+ }
+
+ static FunctionExecutable* create(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
+ {
+ return new (globalData) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
+ }
+
+ 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)
+ {
+ ASSERT(exec->globalData().dynamicGlobalObject);
+ 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)
+ {
+ ASSERT(exec->globalData().dynamicGlobalObject);
+ 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 visitChildren(SlotVisitor&);
+ static FunctionExecutable* fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ 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*);
+
+ static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
+ static const ClassInfo s_info;
+ 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();
+ }
+
+ inline NativeFunction JSFunction::nativeFunction()
+ {
+ ASSERT(isHostFunction());
+ return static_cast<NativeExecutable*>(m_executable.get())->function();
+ }
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
new file mode 100644
index 0000000..9e7d8d5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -0,0 +1,118 @@
+/*
+ * 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, Structure* structure, FunctionPrototype* functionPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, functionPrototype->classInfo()->className))
+{
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // Number of arguments for constructor
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructFunction(exec, asInternalFunction(exec->callee())->globalObject(), 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, asInternalFunction(exec->callee())->globalObject(), 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, JSGlobalObject* globalObject, 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();
+ }
+
+ JSGlobalData& globalData = globalObject->globalData();
+ SourceCode source = makeSource(program, sourceURL, lineNumber);
+ JSObject* exception = 0;
+ FunctionExecutable* function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &exception);
+ if (!function) {
+ ASSERT(exception);
+ return throwError(exec, exception);
+ }
+
+ ScopeChainNode* scopeChain = new (exec) ScopeChainNode(0, globalObject, &globalData, globalObject, exec->globalThisValue());
+ return new (exec) JSFunction(exec, function, scopeChain);
+}
+
+// ECMA 15.3.2 The Function Constructor
+JSObject* constructFunction(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args)
+{
+ return constructFunction(exec, globalObject, args, Identifier(exec, "anonymous"), UString(), 1);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionConstructor.h
new file mode 100644
index 0000000..31a04c9
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, FunctionPrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+ JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, const Identifier& functionName, const UString& sourceURL, int lineNumber);
+ JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&);
+
+} // namespace JSC
+
+#endif // FunctionConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
new file mode 100644
index 0000000..e2a4941
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -0,0 +1,149 @@
+/*
+ * 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"
+
+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, Structure* structure)
+ : InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier)
+{
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
+}
+
+void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction)
+{
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
+ *applyFunction = new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);
+ putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum);
+ *callFunction = new (exec) JSFunction(exec, globalObject, functionStructure, 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::s_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::s_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::s_info)
+ asArguments(array)->fillArgList(exec, applyArgs);
+ else if (isJSArray(&exec->globalData(), array))
+ asArray(array)->fillArgList(exec, applyArgs);
+ else if (asObject(array)->inherits(&JSArray::s_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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.h
new file mode 100644
index 0000000..ab708dd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/FunctionPrototype.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 FunctionPrototype_h
+#define FunctionPrototype_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class FunctionPrototype : public InternalFunction {
+ public:
+ FunctionPrototype(ExecState*, JSGlobalObject*, Structure*);
+ void addFunctionProperties(ExecState*, JSGlobalObject*, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ private:
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // FunctionPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallback.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
new file mode 100644
index 0000000..308d245
--- /dev/null
+++ b/src/3rdparty/webkit/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*)
+{
+}
+
+DefaultGCActivityCallback::~DefaultGCActivityCallback()
+{
+}
+
+void DefaultGCActivityCallback::operator()()
+{
+}
+
+void DefaultGCActivityCallback::synchronize()
+{
+}
+
+}
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallback.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallback.h
new file mode 100644
index 0000000..f40ebee
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallback.h
@@ -0,0 +1,82 @@
+/*
+ * 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>
+
+#if USE(CF)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+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();
+
+#if USE(CF)
+protected:
+ DefaultGCActivityCallback(Heap*, CFRunLoopRef);
+ void commonConstructor(Heap*, CFRunLoopRef);
+#endif
+
+private:
+ OwnPtr<DefaultGCActivityCallbackPlatformData> d;
+};
+
+inline PassOwnPtr<DefaultGCActivityCallback> DefaultGCActivityCallback::create(Heap* heap)
+{
+ return adoptPtr(new DefaultGCActivityCallback(heap));
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp
new file mode 100644
index 0000000..2e878bf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp
@@ -0,0 +1,110 @@
+/*
+ * 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 "Heap.h"
+#include "JSGlobalData.h"
+#include "JSLock.h"
+#include "JSObject.h"
+#include "ScopeChain.h"
+#include <wtf/RetainPtr.h>
+#include <wtf/WTFThreadData.h>
+
+#if !USE(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 timer, void *info)
+{
+ Heap* heap = static_cast<Heap*>(info);
+ APIEntryShim shim(heap->globalData());
+ heap->collectAllGarbage();
+ CFRunLoopTimerSetNextFireDate(timer, CFAbsoluteTimeGetCurrent() + decade);
+}
+
+DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap)
+{
+ commonConstructor(heap, CFRunLoopGetCurrent());
+}
+
+DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap, CFRunLoopRef runLoop)
+{
+ commonConstructor(heap, runLoop);
+}
+
+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::commonConstructor(Heap* heap, CFRunLoopRef runLoop)
+{
+ d = adoptPtr(new DefaultGCActivityCallbackPlatformData);
+
+ memset(&d->context, 0, sizeof(CFRunLoopTimerContext));
+ d->context.info = heap;
+ d->runLoop = runLoop;
+ d->timer.adoptCF(CFRunLoopTimerCreate(0, decade, decade, 0, 0, DefaultGCActivityCallbackPlatformData::trigger, &d->context));
+ CFRunLoopAddTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes);
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GetterSetter.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GetterSetter.cpp
new file mode 100644
index 0000000..be9eb48
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GetterSetter.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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 {
+
+const ClassInfo GetterSetter::s_info = { "GetterSetter", 0, 0, 0 };
+
+void GetterSetter::visitChildren(SlotVisitor& visitor)
+{
+ JSCell::visitChildren(visitor);
+
+ if (m_getter)
+ visitor.append(&m_getter);
+ if (m_setter)
+ visitor.append(&m_setter);
+}
+
+bool GetterSetter::isGetterSetter() const
+{
+ return true;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GetterSetter.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/GetterSetter.h
new file mode 100644
index 0000000..ceb2af3
--- /dev/null
+++ b/src/3rdparty/webkit/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"
+#include "Structure.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(), exec->globalData().getterSetterStructure.get())
+ {
+ }
+
+ virtual void visitChildren(SlotVisitor&);
+
+ JSObject* getter() const { return m_getter.get(); }
+ void setGetter(JSGlobalData& globalData, JSObject* getter) { m_getter.set(globalData, this, getter); }
+ JSObject* setter() const { return m_setter.get(); }
+ void setSetter(JSGlobalData& globalData, JSObject* setter) { m_setter.set(globalData, this, setter); }
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(GetterSetterType, OverridesVisitChildren), AnonymousSlotCount, &s_info);
+ }
+ private:
+ virtual bool isGetterSetter() const;
+ static const ClassInfo s_info;
+
+ WriteBarrier<JSObject> m_getter;
+ WriteBarrier<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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.cpp
new file mode 100644
index 0000000..4a99b19
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.cpp
@@ -0,0 +1,314 @@
+/*
+ * 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 "JSObject.h"
+#include "NumericStrings.h"
+#include "ScopeChain.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 StringHasher::computeHash<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 StringHasher::computeHash<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 <= maxSingleCharacterString)
+ 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 <= maxSingleCharacterString)
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.h
new file mode 100644
index 0000000..3a8aed7
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InitializeThreading.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InitializeThreading.cpp
new file mode 100644
index 0000000..27611b7
--- /dev/null
+++ b/src/3rdparty/webkit/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 "Heap.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/src/3rdparty/webkit/JavaScriptCore/runtime/InitializeThreading.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InitializeThreading.h
index 1a93ccb..1a93ccb 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/InitializeThreading.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InitializeThreading.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.cpp
new file mode 100644
index 0000000..c3b07f8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.cpp
@@ -0,0 +1,76 @@
+/*
+ * 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 {
+
+// Ensure the compiler generates a vtable for InternalFunction!
+void InternalFunction::vtableAnchor() {}
+
+ASSERT_CLASS_FITS_IN_CELL(InternalFunction);
+
+const ClassInfo InternalFunction::s_info = { "Function", &JSObjectWithGlobalObject::s_info, 0, 0 };
+
+InternalFunction::InternalFunction(VPtrStealingHackType)
+ : JSObjectWithGlobalObject(VPtrStealingHack)
+{
+}
+
+InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* globalObject, Structure* structure, const Identifier& name)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+ ASSERT(inherits(&s_info));
+ putDirect(*globalData, globalData->propertyNames->name, jsString(globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+}
+
+const UString& InternalFunction::name(ExecState* exec)
+{
+ return asString(getDirect(exec->globalData(), exec->globalData().propertyNames->name))->tryGetValue();
+}
+
+const UString InternalFunction::displayName(ExecState* exec)
+{
+ JSValue displayName = getDirect(exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.h
new file mode 100644
index 0000000..28e260e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/InternalFunction.h
@@ -0,0 +1,71 @@
+/*
+ * 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:
+ static JS_EXPORTDATA const ClassInfo s_info;
+
+ const UString& name(ExecState*);
+ const UString displayName(ExecState*);
+ const UString calculatedDisplayName(ExecState*);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
+
+ // Only used to allow us to determine the JSFunction vptr
+ InternalFunction(VPtrStealingHackType);
+
+ InternalFunction(JSGlobalData*, JSGlobalObject*, Structure*, const Identifier&);
+
+ private:
+ virtual CallType getCallData(CallData&) = 0;
+
+ virtual void vtableAnchor();
+ };
+
+ InternalFunction* asInternalFunction(JSValue);
+
+ inline InternalFunction* asInternalFunction(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&InternalFunction::s_info));
+ return static_cast<InternalFunction*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // InternalFunction_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
new file mode 100644
index 0000000..9a92a93
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
@@ -0,0 +1,33 @@
+/*
+ * 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 {
+
+const ClassInfo JSAPIValueWrapper::s_info = { "API Wrapper", 0, 0, 0 };
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
new file mode 100644
index 0000000..4dca9f4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
@@ -0,0 +1,64 @@
+/*
+ * 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"
+#include "Structure.h"
+
+namespace JSC {
+
+ class JSAPIValueWrapper : public JSCell {
+ friend JSValue jsAPIValueWrapper(ExecState*, JSValue);
+ public:
+ JSValue value() const { return m_value.get(); }
+
+ virtual bool isAPIValueWrapper() const { return true; }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesVisitChildren | OverridesGetPropertyNames), AnonymousSlotCount, &s_info);
+ }
+
+
+ private:
+ JSAPIValueWrapper(ExecState* exec, JSValue value)
+ : JSCell(exec->globalData(), exec->globalData().apiWrapperStructure.get())
+ {
+ m_value.set(exec->globalData(), this, value);
+ ASSERT(!value.isCell());
+ }
+ static const ClassInfo s_info;
+
+ WriteBarrier<Unknown> m_value;
+ };
+
+ inline JSValue jsAPIValueWrapper(ExecState* exec, JSValue value)
+ {
+ return new (exec) JSAPIValueWrapper(exec, value);
+ }
+
+} // namespace JSC
+
+#endif // JSAPIValueWrapper_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.cpp
new file mode 100644
index 0000000..81e18c1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.cpp
@@ -0,0 +1,236 @@
+/*
+ * 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::s_info = { "JSActivation", &Base::s_info, 0, 0 };
+
+JSActivation::JSActivation(CallFrame* callFrame, FunctionExecutable* functionExecutable)
+ : Base(callFrame->globalData(), callFrame->globalData().activationStructure.get(), functionExecutable->symbolTable(), callFrame->registers())
+ , m_numParametersMinusThis(static_cast<int>(functionExecutable->parameterCount()))
+ , m_numCapturedVars(functionExecutable->capturedVariableCount())
+ , m_requiresDynamicChecks(functionExecutable->usesEval())
+ , m_argumentsRegister(functionExecutable->generatedBytecode().argumentsRegister())
+{
+ ASSERT(inherits(&s_info));
+
+ // We have to manually ref and deref the symbol table as JSVariableObject
+ // doesn't know about SharedSymbolTable
+ static_cast<SharedSymbolTable*>(m_symbolTable)->ref();
+}
+
+JSActivation::~JSActivation()
+{
+ static_cast<SharedSymbolTable*>(m_symbolTable)->deref();
+}
+
+void JSActivation::visitChildren(SlotVisitor& visitor)
+{
+ Base::visitChildren(visitor);
+
+ // No need to mark our registers if they're still in the RegisterFile.
+ WriteBarrier<Unknown>* registerArray = m_registerArray.get();
+ if (!registerArray)
+ return;
+
+ visitor.appendValues(registerArray, m_numParametersMinusThis);
+
+ // Skip the call frame, which sits between the parameters and vars.
+ visitor.appendValues(registerArray + m_numParametersMinusThis + RegisterFile::CallFrameHeaderSize, m_numCapturedVars, MayContainNullValues);
+}
+
+inline bool JSActivation::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
+{
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (entry.isNull())
+ return false;
+ if (entry.getIndex() >= m_numCapturedVars)
+ return false;
+
+ slot.setValue(registerAt(entry.getIndex()).get());
+ return true;
+}
+
+inline bool JSActivation::symbolTablePut(JSGlobalData& globalData, 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;
+ if (entry.getIndex() >= m_numCapturedVars)
+ return false;
+
+ registerAt(entry.getIndex()).set(globalData, this, 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) {
+ if (it->second.getAttributes() & DontEnum && mode != IncludeDontEnumProperties)
+ continue;
+ if (it->second.getIndex() >= m_numCapturedVars)
+ continue;
+ propertyNames.add(Identifier(exec, it->first.get()));
+ }
+ // Skip the JSVariableObject implementation of getOwnPropertyNames
+ JSObject::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData, 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() >= m_numCapturedVars)
+ return false;
+
+ entry.setAttributes(attributes);
+ registerAt(entry.getIndex()).set(globalData, this, 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 (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) {
+ slot.setValue(location->get());
+ 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* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ if (symbolTablePut(exec->globalData(), 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(exec->globalData(), 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(exec->globalData(), 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 = m_requiresDynamicChecks;
+ return false;
+}
+
+JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&)
+{
+ JSActivation* activation = asActivation(slotBase);
+ CallFrame* callFrame = CallFrame::create(reinterpret_cast<Register*>(activation->m_registers));
+ int argumentsRegister = activation->m_argumentsRegister;
+ if (JSValue arguments = callFrame->uncheckedR(argumentsRegister).jsValue())
+ return arguments;
+ int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister);
+
+ JSValue arguments = JSValue(new (callFrame) Arguments(callFrame));
+ callFrame->uncheckedR(argumentsRegister) = arguments;
+ callFrame->uncheckedR(realArgumentsRegister) = arguments;
+
+ ASSERT(callFrame->uncheckedR(realArgumentsRegister).jsValue().inherits(&Arguments::s_info));
+ return callFrame->uncheckedR(realArgumentsRegister).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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.h
new file mode 100644
index 0000000..5f4c935
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSActivation.h
@@ -0,0 +1,105 @@
+/*
+ * 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*, FunctionExecutable*);
+ virtual ~JSActivation();
+
+ virtual void visitChildren(SlotVisitor&);
+
+ 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(JSGlobalData&);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesVisitChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
+
+ private:
+ bool symbolTableGet(const Identifier&, PropertySlot&);
+ bool symbolTableGet(const Identifier&, PropertyDescriptor&);
+ bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
+ bool symbolTablePut(JSGlobalData&, const Identifier&, JSValue);
+ bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes);
+
+ static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&);
+ NEVER_INLINE PropertySlot::GetValueFunc getArgumentsGetter();
+
+ int m_numParametersMinusThis;
+ int m_numCapturedVars : 31;
+ bool m_requiresDynamicChecks : 1;
+ int m_argumentsRegister;
+ };
+
+ JSActivation* asActivation(JSValue);
+
+ inline JSActivation* asActivation(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&JSActivation::s_info));
+ return static_cast<JSActivation*>(asObject(value));
+ }
+
+ ALWAYS_INLINE JSActivation* Register::activation() const
+ {
+ return asActivation(jsValue());
+ }
+
+} // namespace JSC
+
+#endif // JSActivation_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.cpp
new file mode 100644
index 0000000..ff4ce75
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.cpp
@@ -0,0 +1,1328 @@
+/*
+ * 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::s_info = {"Array", &JSNonFinalObject::s_info, 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)
+ : JSNonFinalObject(VPtrStealingHack)
+{
+}
+
+JSArray::JSArray(JSGlobalData& globalData, Structure* structure)
+ : JSNonFinalObject(globalData, structure)
+{
+ ASSERT(inherits(&s_info));
+
+ 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(JSGlobalData& globalData, Structure* structure, unsigned initialLength, ArrayCreationMode creationMode)
+ : JSNonFinalObject(globalData, structure)
+{
+ ASSERT(inherits(&s_info));
+
+ 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;
+ WriteBarrier<Unknown>* vector = m_storage->m_vector;
+ for (size_t i = 0; i < initialCapacity; ++i)
+ vector[i].clear();
+ }
+
+ checkConsistency();
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity));
+}
+
+JSArray::JSArray(JSGlobalData& globalData, Structure* structure, const ArgList& list)
+ : JSNonFinalObject(globalData, structure)
+{
+ ASSERT(inherits(&s_info));
+
+ 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;
+ WriteBarrier<Unknown>* vector = m_storage->m_vector;
+ ArgList::const_iterator end = list.end();
+ for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i)
+ vector[i].set(globalData, this, *it);
+ for (; i < initialStorage; i++)
+ vector[i].clear();
+
+ 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 value = storage->m_vector[i].get();
+ if (value) {
+ slot.setValue(value);
+ 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.setValue(it->second.get());
+ 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) {
+ WriteBarrier<Unknown>& value = storage->m_vector[i];
+ if (value) {
+ descriptor.setDescriptor(value.get(), 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.get(), 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) {
+ WriteBarrier<Unknown>& valueSlot = storage->m_vector[i];
+ if (valueSlot) {
+ valueSlot.set(exec->globalData(), this, value);
+ checkConsistency();
+ return;
+ }
+ valueSlot.set(exec->globalData(), this, 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;
+ }
+
+ WriteBarrier<Unknown> temp;
+ pair<SparseArrayValueMap::iterator, bool> result = map->add(i, temp);
+ result.first->second.set(exec->globalData(), this, value);
+ if (!result.second) // pre-existing entry
+ 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].set(exec->globalData(), this, 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;
+ WriteBarrier<Unknown>* vector = storage->m_vector;
+
+ if (newNumValuesInVector == storage->m_numValuesInVector + 1) {
+ for (unsigned j = vectorLength; j < newVectorLength; ++j)
+ vector[j].clear();
+ if (i > MIN_SPARSE_ARRAY_INDEX)
+ map->remove(i);
+ } else {
+ for (unsigned j = vectorLength; j < max(vectorLength, MIN_SPARSE_ARRAY_INDEX); ++j)
+ vector[j].clear();
+ JSGlobalData& globalData = exec->globalData();
+ for (unsigned j = max(vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j)
+ vector[j].set(globalData, this, map->take(j).get());
+ }
+
+ ASSERT(i < newVectorLength);
+
+ m_vectorLength = newVectorLength;
+ storage->m_numValuesInVector = newNumValuesInVector;
+
+ storage->m_vector[i].set(exec->globalData(), this, 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) {
+ WriteBarrier<Unknown>& valueSlot = storage->m_vector[i];
+ if (!valueSlot) {
+ checkConsistency();
+ return false;
+ }
+ valueSlot.clear();
+ --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;
+
+ WriteBarrier<Unknown>* vector = storage->m_vector;
+ for (unsigned i = vectorLength; i < newVectorLength; ++i)
+ vector[i].clear();
+
+ 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) {
+ WriteBarrier<Unknown>& valueSlot = storage->m_vector[i];
+ bool hadValue = valueSlot;
+ valueSlot.clear();
+ 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) {
+ WriteBarrier<Unknown>& valueSlot = storage->m_vector[length];
+ if (valueSlot) {
+ --storage->m_numValuesInVector;
+ result = valueSlot.get();
+ valueSlot.clear();
+ } 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.get();
+ 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 (UNLIKELY(storage->m_length == 0xFFFFFFFFu)) {
+ put(exec, storage->m_length, value);
+ throwError(exec, createRangeError(exec, "Invalid array length"));
+ return;
+ }
+
+ if (storage->m_length < m_vectorLength) {
+ storage->m_vector[storage->m_length].set(exec->globalData(), this, 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].set(exec->globalData(), this, 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;
+ }
+
+ WriteBarrier<Unknown>* vector = m_storage->m_vector;
+ for (int i = 0; i < count; i++)
+ vector[i].clear();
+}
+
+void JSArray::visitChildren(SlotVisitor& visitor)
+{
+ visitChildrenDirect(visitor);
+}
+
+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].get();
+ 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()) {
+ Heap::heap(this)->popTempSortVector(&values);
+ 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;
+
+ JSGlobalData& globalData = exec->globalData();
+ for (size_t i = 0; i < lengthNotIncludingUndefined; i++)
+ storage->m_vector[i].set(globalData, this, 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].get();
+ 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].get();
+ 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.get();
+ 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);
+ JSGlobalData& globalData = exec->globalData();
+ for (unsigned i = 0; i < numDefined; ++i) {
+ storage->m_vector[i].set(globalData, this, tree.abstractor().m_nodes[*iter].value);
+ ++iter;
+ }
+
+ // Put undefined values back in.
+ for (unsigned i = numDefined; i < newUsedVectorLength; ++i)
+ storage->m_vector[i].setUndefined();
+
+ // Ensure that unused values in the vector are zeroed out.
+ for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
+ storage->m_vector[i].clear();
+
+ storage->m_numValuesInVector = newUsedVectorLength;
+
+ checkConsistency(SortConsistencyCheck);
+}
+
+void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args)
+{
+ ArrayStorage* storage = m_storage;
+
+ WriteBarrier<Unknown>* vector = storage->m_vector;
+ unsigned vectorEnd = min(storage->m_length, m_vectorLength);
+ unsigned i = 0;
+ for (; i < vectorEnd; ++i) {
+ WriteBarrier<Unknown>& v = vector[i];
+ if (!v)
+ break;
+ args.append(v.get());
+ }
+
+ 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);
+ WriteBarrier<Unknown>* vector = m_storage->m_vector;
+ unsigned vectorEnd = min(maxSize, m_vectorLength);
+ unsigned i = 0;
+ for (; i < vectorEnd; ++i) {
+ WriteBarrier<Unknown>& v = vector[i];
+ if (!v)
+ break;
+ buffer[i] = v.get();
+ }
+
+ 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].get();
+ if (!v || v.isUndefined())
+ break;
+ }
+
+ for (unsigned i = numDefined; i < usedVectorLength; ++i) {
+ JSValue v = storage->m_vector[i].get();
+ if (v) {
+ if (v.isUndefined())
+ ++numUndefined;
+ else
+ storage->m_vector[numDefined++].setWithoutWriteBarrier(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++].setWithoutWriteBarrier(it->second.get());
+
+ delete map;
+ storage->m_sparseValueMap = 0;
+ }
+
+ for (unsigned i = numDefined; i < newUsedVectorLength; ++i)
+ storage->m_vector[i].setUndefined();
+ for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
+ storage->m_vector[i].clear();
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.h
new file mode 100644
index 0000000..3cb8aad
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.h
@@ -0,0 +1,216 @@
+/*
+ * 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, WriteBarrier<Unknown> > 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
+ WriteBarrier<Unknown> 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 JSNonFinalObject {
+ friend class Walker;
+
+ public:
+ JSArray(VPtrStealingHackType);
+
+ explicit JSArray(JSGlobalData&, Structure*);
+ JSArray(JSGlobalData&, Structure*, unsigned initialLength, ArrayCreationMode);
+ JSArray(JSGlobalData&, 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 s_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].get();
+ }
+
+ bool canSetIndex(unsigned i) { return i < m_vectorLength; }
+ void setIndex(JSGlobalData& globalData, unsigned i, JSValue v)
+ {
+ ASSERT(canSetIndex(i));
+
+ WriteBarrier<Unknown>& 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.set(globalData, this, v);
+ }
+
+ void uncheckedSetIndex(JSGlobalData& globalData, unsigned i, JSValue v)
+ {
+ ASSERT(canSetIndex(i));
+ ArrayStorage *storage = m_storage;
+#if CHECK_ARRAY_CONSISTENCY
+ ASSERT(storage->m_inCompactInitialization);
+#endif
+ storage->m_vector[i].set(globalData, this, v);
+ }
+
+ void fillArgList(ExecState*, MarkedArgumentBuffer&);
+ void copyToRegisters(ExecState*, Register*, uint32_t);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ inline void visitChildrenDirect(SlotVisitor&);
+
+ static ptrdiff_t storageOffset()
+ {
+ return OBJECT_OFFSETOF(JSArray, m_storage);
+ }
+
+ static ptrdiff_t vectorLengthOffset()
+ {
+ return OBJECT_OFFSETOF(JSArray, m_vectorLength);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | 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 visitChildren(SlotVisitor&);
+
+ void* subclassData() const;
+ void setSubclassData(void*);
+
+ private:
+ 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::s_info));
+ return static_cast<JSArray*>(cell);
+ }
+
+ inline JSArray* asArray(JSValue value)
+ {
+ return asArray(value.asCell());
+ }
+
+ inline bool isJSArray(JSGlobalData* globalData, JSCell* cell) { return cell->vptr() == globalData->jsArrayVPtr; }
+ inline bool isJSArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && isJSArray(globalData, v.asCell()); }
+
+ inline void JSArray::visitChildrenDirect(SlotVisitor& visitor)
+ {
+ JSObject::visitChildrenDirect(visitor);
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned usedVectorLength = std::min(storage->m_length, m_vectorLength);
+ visitor.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)
+ visitor.append(&it->second);
+ }
+ }
+
+ // 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.cpp
new file mode 100644
index 0000000..c2abaee
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.cpp
@@ -0,0 +1,114 @@
+/*
+ * 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", &Base::s_info, 0, 0 };
+
+JSByteArray::JSByteArray(ExecState* exec, Structure* structure, ByteArray* storage)
+ : JSNonFinalObject(exec->globalData(), structure)
+ , m_storage(storage)
+{
+ putDirect(exec->globalData(), exec->globalData().propertyNames->length, jsNumber(m_storage->length()), ReadOnly | DontDelete);
+}
+
+#if !ASSERT_DISABLED
+JSByteArray::~JSByteArray()
+{
+ ASSERT(vptr() == JSGlobalData::jsByteArrayVPtr);
+}
+#endif
+
+
+Structure* JSByteArray::createStructure(JSGlobalData& globalData, JSValue prototype, const JSC::ClassInfo* classInfo)
+{
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, classInfo);
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.h
new file mode 100644
index 0000000..c481bb4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSByteArray.h
@@ -0,0 +1,121 @@
+/*
+ * 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 JSNonFinalObject {
+ friend class JSGlobalData;
+ public:
+ typedef JSNonFinalObject Base;
+
+ 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));
+ if (value & ~0xFF) {
+ if (value < 0)
+ value = 0;
+ else
+ value = 255;
+ }
+ m_storage->data()[i] = static_cast<unsigned char>(value);
+ }
+
+ void setIndex(unsigned i, double value)
+ {
+ ASSERT(canAccessIndex(i));
+ if (!(value > 0)) // Clamp NaN to 0
+ value = 0;
+ else if (value > 255)
+ value = 255;
+ m_storage->data()[i] = static_cast<unsigned char>(value + 0.5);
+ }
+
+ 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*, Structure*, WTF::ByteArray* storage);
+ static Structure* createStructure(JSGlobalData&, JSValue prototype, const JSC::ClassInfo* = &s_defaultInfo);
+
+ 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);
+
+ 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:
+ JSByteArray(VPtrStealingHackType)
+ : JSNonFinalObject(VPtrStealingHack)
+ {
+ }
+
+ RefPtr<WTF::ByteArray> m_storage;
+ };
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.cpp
new file mode 100644
index 0000000..93331b3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.cpp
@@ -0,0 +1,224 @@
+/*
+ * 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)
+
+const ClassInfo JSCell::s_dummyCellInfo = { "DummyCell", 0, 0, 0 };
+
+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, exec->lexicalGlobalObject());
+ 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, exec->lexicalGlobalObject());
+ 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, exec->lexicalGlobalObject())->put(exec, identifier, value, slot);
+}
+
+void JSCell::put(ExecState* exec, unsigned identifier, JSValue value)
+{
+ toObject(exec, exec->lexicalGlobalObject())->put(exec, identifier, value);
+}
+
+bool JSCell::deleteProperty(ExecState* exec, const Identifier& identifier)
+{
+ return toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier);
+}
+
+bool JSCell::deleteProperty(ExecState* exec, unsigned identifier)
+{
+ return toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier);
+}
+
+JSObject* JSCell::toThisObject(ExecState* exec) const
+{
+ return toObject(exec, exec->lexicalGlobalObject());
+}
+
+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*, JSGlobalObject*) const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+bool isZombie(const JSCell* cell)
+{
+#if ENABLE(JSC_ZOMBIES)
+ return cell && cell->isZombie();
+#else
+ UNUSED_PARAM(cell);
+ return false;
+#endif
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.h
new file mode 100644
index 0000000..1662163
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSCell.h
@@ -0,0 +1,408 @@
+/*
+ * 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 "CallFrame.h"
+#include "ConstructData.h"
+#include "Heap.h"
+#include "JSLock.h"
+#include "JSValueInlineMethods.h"
+#include "MarkStack.h"
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+
+ class JSGlobalObject;
+ class Structure;
+
+#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 ExecutableBase;
+ friend class GetterSetter;
+ friend class Heap;
+ friend class JSObject;
+ friend class JSPropertyNameIterator;
+ friend class JSString;
+ friend class JSValue;
+ friend class JSAPIValueWrapper;
+ friend class JSZombie;
+ friend class JSGlobalData;
+ friend class MarkedSpace;
+ friend class MarkedBlock;
+ friend class ScopeChainNode;
+ friend class Structure;
+ friend class StructureChain;
+
+ protected:
+ enum VPtrStealingHackType { VPtrStealingHack };
+
+ private:
+ explicit JSCell(VPtrStealingHackType) { }
+ JSCell(JSGlobalData&, Structure*);
+ virtual ~JSCell();
+ static const ClassInfo s_dummyCellInfo;
+
+ public:
+ static Structure* createDummyStructure(JSGlobalData&);
+
+ // 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*, JSGlobalObject*) 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 visitChildren(SlotVisitor&);
+#if ENABLE(JSC_ZOMBIES)
+ virtual bool isZombie() const { return false; }
+#endif
+
+ // Object operations, with the toObject operation included.
+ 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&);
+
+ static ptrdiff_t structureOffset()
+ {
+ return OBJECT_OFFSETOF(JSCell, m_structure);
+ }
+
+ 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&);
+
+ WriteBarrier<Structure> m_structure;
+ };
+
+ inline JSCell::JSCell(JSGlobalData& globalData, Structure* structure)
+ : m_structure(globalData, this, structure)
+ {
+ // Very first set of allocations won't have a real structure.
+ ASSERT(m_structure || !globalData.dummyMarkableCellStructure);
+ }
+
+ inline JSCell::~JSCell()
+ {
+ }
+
+ inline Structure* JSCell::structure() const
+ {
+ return m_structure.get();
+ }
+
+ inline void JSCell::visitChildren(SlotVisitor& visitor)
+ {
+ visitor.append(&m_structure);
+ }
+
+ // --- 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();
+ }
+
+ template <typename Base> UString HandleConverter<Base, Unknown>::getString(ExecState* exec) const
+ {
+ return jsValue().getString(exec);
+ }
+
+ 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;
+ }
+
+ 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 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, exec->lexicalGlobalObject()) : toObjectSlowCase(exec, exec->lexicalGlobalObject());
+ }
+
+ inline JSObject* JSValue::toObject(ExecState* exec, JSGlobalObject* globalObject) const
+ {
+ return isCell() ? asCell()->toObject(exec, globalObject) : toObjectSlowCase(exec, globalObject);
+ }
+
+ inline JSObject* JSValue::toThisObject(ExecState* exec) const
+ {
+ return isCell() ? asCell()->toThisObject(exec) : toThisObjectSlowCase(exec);
+ }
+
+ inline Heap* Heap::heap(JSValue v)
+ {
+ if (!v.isCell())
+ return 0;
+ return heap(v.asCell());
+ }
+
+ inline Heap* Heap::heap(JSCell* c)
+ {
+ return MarkedSpace::heap(c);
+ }
+
+#if ENABLE(JSC_ZOMBIES)
+ inline bool JSValue::isZombie() const
+ {
+ return isCell() && asCell() > (JSCell*)0x1ffffffffL && asCell()->isZombie();
+ }
+#endif
+
+ inline void* MarkedBlock::allocate()
+ {
+ while (m_nextAtom < m_endAtom) {
+ if (!m_marks.testAndSet(m_nextAtom)) {
+ JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[m_nextAtom]);
+ m_nextAtom += m_atomsPerCell;
+ cell->~JSCell();
+ return cell;
+ }
+ m_nextAtom += m_atomsPerCell;
+ }
+
+ return 0;
+ }
+
+ inline MarkedSpace::SizeClass& MarkedSpace::sizeClassFor(size_t bytes)
+ {
+ ASSERT(bytes && bytes < maxCellSize);
+ if (bytes < preciseCutoff)
+ return m_preciseSizeClasses[(bytes - 1) / preciseStep];
+ return m_impreciseSizeClasses[(bytes - 1) / impreciseStep];
+ }
+
+ inline void* MarkedSpace::allocate(size_t bytes)
+ {
+ SizeClass& sizeClass = sizeClassFor(bytes);
+ return allocateFromSizeClass(sizeClass);
+ }
+
+ inline void* Heap::allocate(size_t bytes)
+ {
+ ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
+ ASSERT(JSLock::lockCount() > 0);
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+ ASSERT(bytes <= MarkedSpace::maxCellSize);
+ ASSERT(m_operationInProgress == NoOperation);
+
+ m_operationInProgress = Allocation;
+ void* result = m_markedSpace.allocate(bytes);
+ m_operationInProgress = NoOperation;
+ if (result)
+ return result;
+
+ return allocateSlowCase(bytes);
+ }
+
+ 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);
+ }
+
+} // namespace JSC
+
+#endif // JSCell_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.cpp
new file mode 100644
index 0000000..f064de8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.cpp
@@ -0,0 +1,28 @@
+/*
+ * 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. 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 "JSChunk.h"
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.h
new file mode 100644
index 0000000..bae2bc7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSChunk.h
@@ -0,0 +1,31 @@
+/*
+ * 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. 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 JSChunk_h
+#define JSChunk_h
+
+
+
+#endif // JSChunk_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.cpp
new file mode 100644
index 0000000..407b3b1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.cpp
@@ -0,0 +1,333 @@
+/*
+ * 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 {
+EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec)
+{
+ return throwVMError(exec, createNotAConstructorError(exec, exec->callee()));
+}
+
+ASSERT_CLASS_FITS_IN_CELL(JSFunction);
+
+const ClassInfo JSFunction::s_info = { "Function", &Base::s_info, 0, 0 };
+
+bool JSFunction::isHostFunctionNonInline() const
+{
+ return isHostFunction();
+}
+
+JSFunction::JSFunction(VPtrStealingHackType)
+ : Base(VPtrStealingHack)
+{
+}
+
+JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, int length, const Identifier& name, NativeExecutable* thunk)
+ : Base(globalObject, structure)
+ , m_executable(exec->globalData(), this, thunk)
+ , m_scopeChain(exec->globalData(), this, globalObject->globalScopeChain())
+{
+ ASSERT(inherits(&s_info));
+ putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+ putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
+}
+
+JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, int length, const Identifier& name, NativeFunction func)
+ : Base(globalObject, structure)
+ , m_scopeChain(exec->globalData(), this, globalObject->globalScopeChain())
+{
+ ASSERT(inherits(&s_info));
+
+ // Can't do this during initialization because getHostFunction might do a GC allocation.
+ m_executable.set(exec->globalData(), this, exec->globalData().getHostFunction(func));
+
+ putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+ putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
+}
+
+JSFunction::JSFunction(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChainNode)
+ : Base(scopeChainNode->globalObject.get(), scopeChainNode->globalObject->functionStructure())
+ , m_executable(exec->globalData(), this, executable)
+ , m_scopeChain(exec->globalData(), this, scopeChainNode)
+{
+ ASSERT(inherits(&s_info));
+ const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name();
+ putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+}
+
+JSFunction::~JSFunction()
+{
+ ASSERT(vptr() == JSGlobalData::jsFunctionVPtr);
+}
+
+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(), exec->globalData().propertyNames->name))->tryGetValue();
+}
+
+const UString JSFunction::displayName(ExecState* exec)
+{
+ JSValue displayName = getDirect(exec->globalData(), 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::visitChildren(SlotVisitor& visitor)
+{
+ Base::visitChildren(visitor);
+
+ visitor.append(&m_scopeChain);
+ if (m_executable)
+ visitor.append(&m_executable);
+}
+
+CallType JSFunction::getCallData(CallData& callData)
+{
+ if (isHostFunction()) {
+ callData.native.function = nativeFunction();
+ return CallTypeHost;
+ }
+ callData.js.functionExecutable = jsExecutable();
+ callData.js.scopeChain = scope();
+ 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());
+}
+
+static inline WriteBarrierBase<Unknown>* createPrototypeProperty(JSGlobalData& globalData, JSGlobalObject* globalObject, JSFunction* function)
+{
+ ExecState* exec = globalObject->globalExec();
+ if (WriteBarrierBase<Unknown>* location = function->getDirectLocation(globalData, exec->propertyNames().prototype))
+ return location;
+ JSObject* prototype = constructEmptyObject(exec, globalObject->emptyObjectStructure());
+ prototype->putDirect(globalData, exec->propertyNames().constructor, function, DontEnum);
+ function->putDirect(globalData, exec->propertyNames().prototype, prototype, DontDelete | DontEnum);
+ return function->getDirectLocation(exec->globalData(), exec->propertyNames().prototype);
+}
+
+void JSFunction::preventExtensions(JSGlobalData& globalData)
+{
+ createPrototypeProperty(globalData, scope()->globalObject.get(), this);
+ JSObject::preventExtensions(globalData);
+}
+
+bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ if (isHostFunction())
+ return Base::getOwnPropertySlot(exec, propertyName, slot);
+
+ if (propertyName == exec->propertyNames().prototype) {
+ WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName);
+
+ if (!location)
+ location = createPrototypeProperty(exec->globalData(), scope()->globalObject.get(), this);
+
+ slot.setValue(this, location->get(), 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();
+ return ConstructTypeJS;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.h
new file mode 100644
index 0000000..42fd62a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSFunction.h
@@ -0,0 +1,121 @@
+/*
+ * 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;
+ class VPtrHackExecutable;
+
+ EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
+
+ class JSFunction : public JSObjectWithGlobalObject {
+ friend class JIT;
+ friend class JSGlobalData;
+
+ typedef JSObjectWithGlobalObject Base;
+
+ public:
+ JSFunction(ExecState*, JSGlobalObject*, Structure*, int length, const Identifier&, NativeFunction);
+ JSFunction(ExecState*, JSGlobalObject*, Structure*, int length, const Identifier&, NativeExecutable*);
+ JSFunction(ExecState*, FunctionExecutable*, ScopeChainNode*);
+ virtual ~JSFunction();
+
+ const UString& name(ExecState*);
+ const UString displayName(ExecState*);
+ const UString calculatedDisplayName(ExecState*);
+
+ ScopeChainNode* scope()
+ {
+ ASSERT(!isHostFunctionNonInline());
+ return m_scopeChain.get();
+ }
+ void setScope(JSGlobalData& globalData, ScopeChainNode* scopeChain)
+ {
+ ASSERT(!isHostFunctionNonInline());
+ m_scopeChain.set(globalData, this, 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 s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ NativeFunction nativeFunction();
+
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+
+ protected:
+ const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesVisitChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
+
+ private:
+ explicit JSFunction(VPtrStealingHackType);
+
+ bool isHostFunctionNonInline() const;
+
+ virtual void preventExtensions(JSGlobalData&);
+ 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 visitChildren(SlotVisitor&);
+
+ static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&);
+ static JSValue callerGetter(ExecState*, JSValue, const Identifier&);
+ static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
+
+ WriteBarrier<ExecutableBase> m_executable;
+ WriteBarrier<ScopeChainNode> m_scopeChain;
+ };
+
+ JSFunction* asFunction(JSValue);
+
+ inline JSFunction* asFunction(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&JSFunction::s_info));
+ return static_cast<JSFunction*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // JSFunction_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.cpp
new file mode 100644
index 0000000..61bbea0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -0,0 +1,445 @@
+/*
+ * 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 "Heap.h"
+#include "CommonIdentifiers.h"
+#include "DebuggerActivation.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 "JSZombie.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 {
+
+using namespace JSC;
+
+class Recompiler {
+public:
+ void operator()(JSCell*);
+};
+
+inline void Recompiler::operator()(JSCell* cell)
+{
+ if (!cell->inherits(&JSFunction::s_info))
+ return;
+ JSFunction* function = asFunction(cell);
+ if (function->executable()->isHostFunction())
+ return;
+ function->jsExecutable()->discardCode();
+}
+
+} // namespace
+
+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 objectConstructorTable;
+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;
+
+#if COMPILER(GCC)
+// Work around for gcc trying to coalesce our reads of the various cell vptrs
+#define CLOBBER_MEMORY() do { \
+ asm volatile ("" : : : "memory"); \
+} while (false)
+#else
+#define CLOBBER_MEMORY() do { } while (false)
+#endif
+
+void JSGlobalData::storeVPtrs()
+{
+ // Enough storage to fit a JSArray, JSByteArray, JSString, or JSFunction.
+ // COMPILE_ASSERTS below check that this is true.
+ char storage[64];
+
+ COMPILE_ASSERT(sizeof(JSArray) <= sizeof(storage), sizeof_JSArray_must_be_less_than_storage);
+ JSCell* jsArray = new (storage) JSArray(JSArray::VPtrStealingHack);
+ CLOBBER_MEMORY();
+ JSGlobalData::jsArrayVPtr = jsArray->vptr();
+
+ COMPILE_ASSERT(sizeof(JSByteArray) <= sizeof(storage), sizeof_JSByteArray_must_be_less_than_storage);
+ JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack);
+ CLOBBER_MEMORY();
+ JSGlobalData::jsByteArrayVPtr = jsByteArray->vptr();
+
+ COMPILE_ASSERT(sizeof(JSString) <= sizeof(storage), sizeof_JSString_must_be_less_than_storage);
+ JSCell* jsString = new (storage) JSString(JSString::VPtrStealingHack);
+ CLOBBER_MEMORY();
+ JSGlobalData::jsStringVPtr = jsString->vptr();
+
+ COMPILE_ASSERT(sizeof(JSFunction) <= sizeof(storage), sizeof_JSFunction_must_be_less_than_storage);
+ JSCell* jsFunction = new (storage) JSFunction(JSCell::VPtrStealingHack);
+ CLOBBER_MEMORY();
+ JSGlobalData::jsFunctionVPtr = jsFunction->vptr();
+}
+
+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))
+ , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable))
+ , regExpTable(fastNew<HashTable>(JSC::regExpTable))
+ , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable))
+ , stringTable(fastNew<HashTable>(JSC::stringTable))
+ , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable())
+ , propertyNames(new CommonIdentifiers(this))
+ , emptyList(new MarkedArgumentBuffer)
+ , lexer(new Lexer(this))
+ , parser(new Parser)
+ , interpreter(0)
+ , heap(this)
+ , globalObjectCount(0)
+ , dynamicGlobalObject(0)
+ , 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
+{
+ interpreter = new Interpreter(*this);
+ if (globalDataType == Default)
+ m_stack = wtfThreadData().stack();
+
+ // Need to be careful to keep everything consistent here
+ IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable);
+ JSLock lock(SilenceAssertionsOnly);
+ structureStructure.set(*this, Structure::createStructure(*this));
+ debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, jsNull()));
+ activationStructure.set(*this, JSActivation::createStructure(*this, jsNull()));
+ interruptedExecutionErrorStructure.set(*this, JSNonFinalObject::createStructure(*this, jsNull()));
+ terminatedExecutionErrorStructure.set(*this, JSNonFinalObject::createStructure(*this, jsNull()));
+ staticScopeStructure.set(*this, JSStaticScopeObject::createStructure(*this, jsNull()));
+ strictEvalActivationStructure.set(*this, StrictEvalActivation::createStructure(*this, jsNull()));
+ stringStructure.set(*this, JSString::createStructure(*this, jsNull()));
+ notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, jsNull()));
+ propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, jsNull()));
+ getterSetterStructure.set(*this, GetterSetter::createStructure(*this, jsNull()));
+ apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, jsNull()));
+ scopeChainNodeStructure.set(*this, ScopeChainNode::createStructure(*this, jsNull()));
+ executableStructure.set(*this, ExecutableBase::createStructure(*this, jsNull()));
+ nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, jsNull()));
+ evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, jsNull()));
+ programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, jsNull()));
+ functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, jsNull()));
+ dummyMarkableCellStructure.set(*this, JSCell::createDummyStructure(*this));
+ structureChainStructure.set(*this, StructureChain::createStructure(*this, jsNull()));
+
+#if ENABLE(JSC_ZOMBIES)
+ zombieStructure.set(*this, JSZombie::createStructure(*this, jsNull()));
+#endif
+
+ wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable);
+
+#if PLATFORM(MAC)
+ startProfilerServerIfNeeded();
+#endif
+#if ENABLE(JIT) && ENABLE(INTERPRETER)
+#if USE(CF)
+ CFStringRef canUseJITKey = CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman);
+ CFBooleanRef canUseJIT = (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication);
+ if (canUseJIT) {
+ m_canUseJIT = kCFBooleanTrue == canUseJIT;
+ CFRelease(canUseJIT);
+ } else {
+ char* canUseJITString = getenv("JavaScriptCoreUseJIT");
+ m_canUseJIT = !canUseJITString || atoi(canUseJITString);
+ }
+ CFRelease(canUseJITKey);
+#elif OS(UNIX)
+ char* canUseJITString = getenv("JavaScriptCoreUseJIT");
+ m_canUseJIT = !canUseJITString || atoi(canUseJITString);
+#else
+ m_canUseJIT = true;
+#endif
+#endif
+#if ENABLE(JIT)
+#if ENABLE(INTERPRETER)
+ if (m_canUseJIT)
+ m_canUseJIT = executableAllocator.isValid();
+#endif
+ jitStubs = adoptPtr(new JITThunks(this));
+#endif
+}
+
+void JSGlobalData::clearBuiltinStructures()
+{
+ structureStructure.clear();
+ debuggerActivationStructure.clear();
+ activationStructure.clear();
+ interruptedExecutionErrorStructure.clear();
+ terminatedExecutionErrorStructure.clear();
+ staticScopeStructure.clear();
+ strictEvalActivationStructure.clear();
+ stringStructure.clear();
+ notAnObjectStructure.clear();
+ propertyNameIteratorStructure.clear();
+ getterSetterStructure.clear();
+ apiWrapperStructure.clear();
+ scopeChainNodeStructure.clear();
+ executableStructure.clear();
+ nativeExecutableStructure.clear();
+ evalExecutableStructure.clear();
+ programExecutableStructure.clear();
+ functionExecutableStructure.clear();
+ dummyMarkableCellStructure.clear();
+ structureChainStructure.clear();
+
+#if ENABLE(JSC_ZOMBIES)
+ zombieStructure.clear();
+#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();
+ objectConstructorTable->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*>(objectConstructorTable));
+ 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)
+{
+ return create(type);
+}
+
+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)
+NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function)
+{
+ return jitStubs->hostFunctionStub(this, function);
+}
+NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function, ThunkGenerator generator)
+{
+ return jitStubs->hostFunctionStub(this, function, generator);
+}
+#else
+NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function)
+{
+ return NativeExecutable::create(*this, function, callHostFunctionAsConstructor);
+}
+#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);
+
+ Recompiler recompiler;
+ heap.forEach(recompiler);
+}
+
+#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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.h
new file mode 100644
index 0000000..df36016
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.h
@@ -0,0 +1,290 @@
+/*
+ * 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 "Heap.h"
+#include "DateInstanceCache.h"
+#include "ExecutableAllocator.h"
+#include "Strong.h"
+#include "JITStubs.h"
+#include "JSValue.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 HandleStack;
+ class IdentifierTable;
+ class Interpreter;
+ class JSGlobalObject;
+ class JSObject;
+ class Lexer;
+ class NativeExecutable;
+ 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.machineThreads().makeUsableFromMultipleThreads(); }
+#endif
+
+ GlobalDataType globalDataType;
+ ClientData* clientData;
+
+ const HashTable* arrayTable;
+ const HashTable* dateTable;
+ const HashTable* jsonTable;
+ const HashTable* mathTable;
+ const HashTable* numberTable;
+ const HashTable* objectConstructorTable;
+ const HashTable* regExpTable;
+ const HashTable* regExpConstructorTable;
+ const HashTable* stringTable;
+
+ Strong<Structure> structureStructure;
+ Strong<Structure> debuggerActivationStructure;
+ Strong<Structure> activationStructure;
+ Strong<Structure> interruptedExecutionErrorStructure;
+ Strong<Structure> terminatedExecutionErrorStructure;
+ Strong<Structure> staticScopeStructure;
+ Strong<Structure> strictEvalActivationStructure;
+ Strong<Structure> stringStructure;
+ Strong<Structure> notAnObjectStructure;
+ Strong<Structure> propertyNameIteratorStructure;
+ Strong<Structure> getterSetterStructure;
+ Strong<Structure> apiWrapperStructure;
+ Strong<Structure> scopeChainNodeStructure;
+ Strong<Structure> executableStructure;
+ Strong<Structure> nativeExecutableStructure;
+ Strong<Structure> evalExecutableStructure;
+ Strong<Structure> programExecutableStructure;
+ Strong<Structure> functionExecutableStructure;
+ Strong<Structure> dummyMarkableCellStructure;
+ Strong<Structure> structureChainStructure;
+
+#if ENABLE(JSC_ZOMBIES)
+ Strong<Structure> zombieStructure;
+#endif
+
+ 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);
+ }
+ NativeExecutable* getHostFunction(NativeFunction, ThunkGenerator);
+#endif
+ NativeExecutable* getHostFunction(NativeFunction);
+
+ TimeoutChecker timeoutChecker;
+ Terminator terminator;
+ Heap heap;
+
+ JSValue exception;
+#if ENABLE(JIT)
+ ReturnAddressPtr exceptionLocation;
+#endif
+
+ HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
+
+ unsigned globalObjectCount;
+ JSGlobalObject* dynamicGlobalObject;
+
+ HashSet<JSObject*> stringRecursionCheckVisitedObjects;
+
+ double cachedUTCOffset;
+ DSTOffsetCache dstOffsetCache;
+
+ UString cachedDateString;
+ double cachedDateStringValue;
+
+ int maxReentryDepth;
+
+ RegExpCache* m_regExpCache;
+ BumpPointerAllocator m_regExpAllocator;
+
+#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();
+ HandleSlot allocateGlobalHandle() { return heap.allocateGlobalHandle(); }
+ HandleSlot allocateLocalHandle() { return heap.allocateLocalHandle(); }
+ void clearBuiltinStructures();
+
+ private:
+ JSGlobalData(GlobalDataType, ThreadStackType);
+ static JSGlobalData*& sharedInstanceInternal();
+ void createNativeThunk();
+#if ENABLE(JIT) && ENABLE(INTERPRETER)
+ bool m_canUseJIT;
+#endif
+ StackBounds m_stack;
+ };
+
+ inline HandleSlot allocateGlobalHandle(JSGlobalData& globalData)
+ {
+ return globalData.allocateGlobalHandle();
+ }
+
+} // namespace JSC
+
+#endif // JSGlobalData_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
new file mode 100644
index 0000000..9c77146
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -0,0 +1,462 @@
+/*
+ * 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 "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 "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;
+
+template <typename T> static inline void visitIfNeeded(SlotVisitor& visitor, WriteBarrier<T>* v)
+{
+ if (*v)
+ visitor.append(v);
+}
+
+JSGlobalObject::~JSGlobalObject()
+{
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+
+ if (m_debugger)
+ m_debugger->detach(this);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (UNLIKELY(*profiler != 0)) {
+ (*profiler)->stopProfiling(this);
+ }
+}
+
+void JSGlobalObject::init(JSObject* thisValue)
+{
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+
+ structure()->disableSpecificFunctionTracking();
+
+ m_globalData = Heap::heap(this)->globalData();
+ m_globalScopeChain.set(*m_globalData, this, new (m_globalData.get()) ScopeChainNode(0, this, m_globalData.get(), this, thisValue));
+
+ JSGlobalObject::globalExec()->init(0, 0, m_globalScopeChain.get(), CallFrame::noCaller(), 0, 0);
+
+ m_debugger = 0;
+
+ m_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(exec->globalData(), 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(exec->globalData(), propertyName, value, attributes))
+ return;
+
+ JSValue valueBefore = getDirect(exec->globalData(), propertyName);
+ PutPropertySlot slot;
+ JSVariableObject::put(exec, propertyName, value, slot);
+ if (!valueBefore) {
+ JSValue valueAfter = getDirect(exec->globalData(), 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
+
+ m_functionPrototype.set(exec->globalData(), this, new (exec) FunctionPrototype(exec, this, FunctionPrototype::createStructure(exec->globalData(), jsNull()))); // The real prototype will be set once ObjectPrototype is created.
+ m_functionStructure.set(exec->globalData(), this, JSFunction::createStructure(exec->globalData(), m_functionPrototype.get()));
+ m_internalFunctionStructure.set(exec->globalData(), this, InternalFunction::createStructure(exec->globalData(), m_functionPrototype.get()));
+ JSFunction* callFunction = 0;
+ JSFunction* applyFunction = 0;
+ m_functionPrototype->addFunctionProperties(exec, this, m_functionStructure.get(), &callFunction, &applyFunction);
+ m_callFunction.set(exec->globalData(), this, callFunction);
+ m_applyFunction.set(exec->globalData(), this, applyFunction);
+ m_objectPrototype.set(exec->globalData(), this, new (exec) ObjectPrototype(exec, this, ObjectPrototype::createStructure(exec->globalData(), jsNull()), m_functionStructure.get()));
+ m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get());
+
+ m_emptyObjectStructure.set(exec->globalData(), this, m_objectPrototype->inheritorID(exec->globalData()));
+ m_nullPrototypeObjectStructure.set(exec->globalData(), this, createEmptyObjectStructure(exec->globalData(), jsNull()));
+
+ m_callbackFunctionStructure.set(exec->globalData(), this, JSCallbackFunction::createStructure(exec->globalData(), m_functionPrototype.get()));
+ m_argumentsStructure.set(exec->globalData(), this, Arguments::createStructure(exec->globalData(), m_objectPrototype.get()));
+ m_callbackConstructorStructure.set(exec->globalData(), this, JSCallbackConstructor::createStructure(exec->globalData(), m_objectPrototype.get()));
+ m_callbackObjectStructure.set(exec->globalData(), this, JSCallbackObject<JSObjectWithGlobalObject>::createStructure(exec->globalData(), m_objectPrototype.get()));
+
+ m_arrayPrototype.set(exec->globalData(), this, new (exec) ArrayPrototype(this, ArrayPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
+ m_arrayStructure.set(exec->globalData(), this, JSArray::createStructure(exec->globalData(), m_arrayPrototype.get()));
+ m_regExpMatchesArrayStructure.set(exec->globalData(), this, RegExpMatchesArray::createStructure(exec->globalData(), m_arrayPrototype.get()));
+
+ m_stringPrototype.set(exec->globalData(), this, new (exec) StringPrototype(exec, this, StringPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
+ m_stringObjectStructure.set(exec->globalData(), this, StringObject::createStructure(exec->globalData(), m_stringPrototype.get()));
+
+ m_booleanPrototype.set(exec->globalData(), this, new (exec) BooleanPrototype(exec, this, BooleanPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get()));
+ m_booleanObjectStructure.set(exec->globalData(), this, BooleanObject::createStructure(exec->globalData(), m_booleanPrototype.get()));
+
+ m_numberPrototype.set(exec->globalData(), this, new (exec) NumberPrototype(exec, this, NumberPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get()));
+ m_numberObjectStructure.set(exec->globalData(), this, NumberObject::createStructure(exec->globalData(), m_numberPrototype.get()));
+
+ m_datePrototype.set(exec->globalData(), this, new (exec) DatePrototype(exec, this, DatePrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
+ m_dateStructure.set(exec->globalData(), this, DateInstance::createStructure(exec->globalData(), m_datePrototype.get()));
+
+ m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get()));
+ m_regExpStructure.set(exec->globalData(), this, RegExpObject::createStructure(exec->globalData(), m_regExpPrototype.get()));
+
+ m_methodCallDummy.set(exec->globalData(), this, constructEmptyObject(exec));
+
+ ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, this, ErrorPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get());
+ m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), errorPrototype));
+
+ // Constructors
+
+ JSCell* objectConstructor = new (exec) ObjectConstructor(exec, this, ObjectConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_objectPrototype.get());
+ JSCell* functionConstructor = new (exec) FunctionConstructor(exec, this, FunctionConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionPrototype.get());
+ JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, this, ArrayConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_arrayPrototype.get(), m_functionStructure.get());
+ JSCell* stringConstructor = new (exec) StringConstructor(exec, this, StringConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionStructure.get(), m_stringPrototype.get());
+ JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, this, BooleanConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_booleanPrototype.get());
+ JSCell* numberConstructor = new (exec) NumberConstructor(exec, this, NumberConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_numberPrototype.get());
+ JSCell* dateConstructor = new (exec) DateConstructor(exec, this, DateConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionStructure.get(), m_datePrototype.get());
+
+ m_regExpConstructor.set(exec->globalData(), this, new (exec) RegExpConstructor(exec, this, RegExpConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_regExpPrototype.get()));
+
+ m_errorConstructor.set(exec->globalData(), this, new (exec) ErrorConstructor(exec, this, ErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), errorPrototype));
+
+ Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), errorPrototype);
+ Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get());
+ m_evalErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError"));
+ m_rangeErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError"));
+ m_referenceErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "ReferenceError"));
+ m_syntaxErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "SyntaxError"));
+ m_typeErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "TypeError"));
+ m_URIErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError"));
+
+ m_objectPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, objectConstructor, DontEnum);
+ m_functionPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, functionConstructor, DontEnum);
+ m_arrayPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, arrayConstructor, DontEnum);
+ m_booleanPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, booleanConstructor, DontEnum);
+ m_stringPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, stringConstructor, DontEnum);
+ m_numberPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, numberConstructor, DontEnum);
+ m_datePrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, dateConstructor, DontEnum);
+ m_regExpPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum);
+ errorPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum);
+
+ // Set global constructors
+
+ // FIXME: These properties could be handled by a static hash table.
+
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Function"), functionConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Array"), arrayConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Boolean"), booleanConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "String"), stringConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Number"), numberConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Date"), dateConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "RegExp"), m_regExpConstructor.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Error"), m_errorConstructor.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "EvalError"), m_evalErrorConstructor.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "RangeError"), m_rangeErrorConstructor.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "ReferenceError"), m_referenceErrorConstructor.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "SyntaxError"), m_syntaxErrorConstructor.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum);
+
+ // Set global values.
+ GlobalPropertyInfo staticGlobals[] = {
+ GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, this, MathObject::createStructure(exec->globalData(), m_objectPrototype.get())), 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(exec->globalData(), m_objectPrototype.get())), DontEnum | DontDelete)
+ };
+
+ addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
+
+ // Set global functions.
+
+ m_evalFunction.set(exec->globalData(), this, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, exec->propertyNames().eval, globalFuncEval));
+ putDirectFunctionWithoutTransition(exec, m_evalFunction.get(), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
+#ifndef NDEBUG
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum);
+#endif
+
+ resetPrototype(exec->globalData(), prototype);
+}
+
+// Set prototype, and also insert the object prototype at the end of the chain.
+void JSGlobalObject::resetPrototype(JSGlobalData& globalData, JSValue prototype)
+{
+ setPrototype(globalData, prototype);
+
+ JSObject* oldLastInPrototypeChain = lastInPrototypeChain(this);
+ JSObject* objectPrototype = m_objectPrototype.get();
+ if (oldLastInPrototypeChain != objectPrototype)
+ oldLastInPrototypeChain->setPrototype(globalData, objectPrototype);
+}
+
+void JSGlobalObject::visitChildren(SlotVisitor& visitor)
+{
+ JSVariableObject::visitChildren(visitor);
+
+ visitIfNeeded(visitor, &m_globalScopeChain);
+ visitIfNeeded(visitor, &m_methodCallDummy);
+
+ visitIfNeeded(visitor, &m_regExpConstructor);
+ visitIfNeeded(visitor, &m_errorConstructor);
+ visitIfNeeded(visitor, &m_evalErrorConstructor);
+ visitIfNeeded(visitor, &m_rangeErrorConstructor);
+ visitIfNeeded(visitor, &m_referenceErrorConstructor);
+ visitIfNeeded(visitor, &m_syntaxErrorConstructor);
+ visitIfNeeded(visitor, &m_typeErrorConstructor);
+ visitIfNeeded(visitor, &m_URIErrorConstructor);
+
+ visitIfNeeded(visitor, &m_evalFunction);
+ visitIfNeeded(visitor, &m_callFunction);
+ visitIfNeeded(visitor, &m_applyFunction);
+
+ visitIfNeeded(visitor, &m_objectPrototype);
+ visitIfNeeded(visitor, &m_functionPrototype);
+ visitIfNeeded(visitor, &m_arrayPrototype);
+ visitIfNeeded(visitor, &m_booleanPrototype);
+ visitIfNeeded(visitor, &m_stringPrototype);
+ visitIfNeeded(visitor, &m_numberPrototype);
+ visitIfNeeded(visitor, &m_datePrototype);
+ visitIfNeeded(visitor, &m_regExpPrototype);
+
+ visitIfNeeded(visitor, &m_argumentsStructure);
+ visitIfNeeded(visitor, &m_arrayStructure);
+ visitIfNeeded(visitor, &m_booleanObjectStructure);
+ visitIfNeeded(visitor, &m_callbackConstructorStructure);
+ visitIfNeeded(visitor, &m_callbackFunctionStructure);
+ visitIfNeeded(visitor, &m_callbackObjectStructure);
+ visitIfNeeded(visitor, &m_dateStructure);
+ visitIfNeeded(visitor, &m_emptyObjectStructure);
+ visitIfNeeded(visitor, &m_nullPrototypeObjectStructure);
+ visitIfNeeded(visitor, &m_errorStructure);
+ visitIfNeeded(visitor, &m_functionStructure);
+ visitIfNeeded(visitor, &m_numberObjectStructure);
+ visitIfNeeded(visitor, &m_regExpMatchesArrayStructure);
+ visitIfNeeded(visitor, &m_regExpStructure);
+ visitIfNeeded(visitor, &m_stringObjectStructure);
+ visitIfNeeded(visitor, &m_internalFunctionStructure);
+
+ if (m_registerArray) {
+ // Outside the execution of global code, when our variables are torn off,
+ // we can mark the torn-off array.
+ visitor.appendValues(m_registerArray.get(), m_registerArraySize);
+ } else if (m_registers) {
+ // During execution of global code, when our variables are in the register file,
+ // the symbol table tells us how many variables there are, and registers
+ // points to where they end, and the registers used for execution begin.
+ visitor.appendValues(m_registers - symbolTable().size(), symbolTable().size());
+ }
+}
+
+ExecState* JSGlobalObject::globalExec()
+{
+ return CallFrame::create(m_globalCallFrame + RegisterFile::CallFrameHeaderSize);
+}
+
+bool JSGlobalObject::isDynamicScope(bool&) const
+{
+ return true;
+}
+
+void JSGlobalObject::disableEval()
+{
+ ASSERT(m_isEvalEnabled);
+ m_isEvalEnabled = false;
+}
+
+void JSGlobalObject::copyGlobalsFrom(RegisterFile& registerFile)
+{
+ ASSERT(!m_registerArray);
+ ASSERT(!m_registerArraySize);
+
+ int numGlobals = registerFile.numGlobals();
+ if (!numGlobals) {
+ m_registers = 0;
+ return;
+ }
+
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData(), reinterpret_cast<WriteBarrier<Unknown>*>(registerFile.lastGlobal()), numGlobals, numGlobals);
+ WriteBarrier<Unknown>* registers = registerArray.get() + numGlobals;
+ setRegisters(registers, registerArray.release(), 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 (m_registerArray) {
+ // The register file is always a gc root so no barrier is needed here
+ memcpy(registerFile.start() - m_registerArraySize, m_registerArray.get(), m_registerArraySize * sizeof(WriteBarrier<Unknown>));
+ setRegisters(reinterpret_cast<WriteBarrier<Unknown>*>(registerFile.start()), nullptr, 0);
+ }
+}
+
+void JSGlobalObject::resizeRegisters(int oldSize, int newSize)
+{
+ ASSERT(oldSize <= newSize);
+ if (newSize == oldSize)
+ return;
+ ASSERT(newSize && newSize > oldSize);
+ if (m_registerArray || !m_registers) {
+ ASSERT(static_cast<size_t>(oldSize) == m_registerArraySize);
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[newSize]);
+ for (int i = 0; i < oldSize; i++)
+ registerArray[newSize - oldSize + i].set(globalData(), this, m_registerArray[i].get());
+ WriteBarrier<Unknown>* registers = registerArray.get() + newSize;
+ setRegisters(registers, registerArray.release(), newSize);
+ } else {
+ ASSERT(static_cast<size_t>(newSize) < globalData().interpreter->registerFile().maxGlobals());
+ globalData().interpreter->registerFile().setNumGlobals(newSize);
+ }
+
+ for (int i = -newSize; i < -oldSize; ++i)
+ m_registers[i].setUndefined();
+}
+
+void* JSGlobalObject::operator new(size_t size, JSGlobalData* globalData)
+{
+ return globalData->heap.allocate(size);
+}
+
+DynamicGlobalObjectScope::DynamicGlobalObjectScope(JSGlobalData& globalData, JSGlobalObject* dynamicGlobalObject)
+ : m_dynamicGlobalObjectSlot(globalData.dynamicGlobalObject)
+ , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)
+{
+ if (!m_dynamicGlobalObjectSlot) {
+#if ENABLE(ASSEMBLER)
+ if (ExecutableAllocator::underMemoryPressure())
+ globalData.recompileAllJSFunctions();
+#endif
+
+ m_dynamicGlobalObjectSlot = dynamicGlobalObject;
+
+ // Reset the date cache between JS invocations to force the VM
+ // to observe time zone changes.
+ globalData.resetDateCache();
+ }
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.h
new file mode 100644
index 0000000..b5503ee
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.h
@@ -0,0 +1,465 @@
+/*
+ * 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 "NumberPrototype.h"
+#include "StringPrototype.h"
+#include "StructureChain.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 NativeErrorConstructor;
+ class ProgramCodeBlock;
+ class RegExpConstructor;
+ class RegExpPrototype;
+ class RegisterFile;
+
+ struct ActivationStackNode;
+ struct HashTable;
+
+ typedef Vector<ExecState*, 16> ExecStateStack;
+
+ class JSGlobalObject : public JSVariableObject {
+ protected:
+ typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet;
+
+ RefPtr<JSGlobalData> m_globalData;
+
+ size_t m_registerArraySize;
+ Register m_globalCallFrame[RegisterFile::CallFrameHeaderSize];
+
+ WriteBarrier<ScopeChainNode> m_globalScopeChain;
+ WriteBarrier<JSObject> m_methodCallDummy;
+
+ WriteBarrier<RegExpConstructor> m_regExpConstructor;
+ WriteBarrier<ErrorConstructor> m_errorConstructor;
+ WriteBarrier<NativeErrorConstructor> m_evalErrorConstructor;
+ WriteBarrier<NativeErrorConstructor> m_rangeErrorConstructor;
+ WriteBarrier<NativeErrorConstructor> m_referenceErrorConstructor;
+ WriteBarrier<NativeErrorConstructor> m_syntaxErrorConstructor;
+ WriteBarrier<NativeErrorConstructor> m_typeErrorConstructor;
+ WriteBarrier<NativeErrorConstructor> m_URIErrorConstructor;
+
+ WriteBarrier<JSFunction> m_evalFunction;
+ WriteBarrier<JSFunction> m_callFunction;
+ WriteBarrier<JSFunction> m_applyFunction;
+
+ WriteBarrier<ObjectPrototype> m_objectPrototype;
+ WriteBarrier<FunctionPrototype> m_functionPrototype;
+ WriteBarrier<ArrayPrototype> m_arrayPrototype;
+ WriteBarrier<BooleanPrototype> m_booleanPrototype;
+ WriteBarrier<StringPrototype> m_stringPrototype;
+ WriteBarrier<NumberPrototype> m_numberPrototype;
+ WriteBarrier<DatePrototype> m_datePrototype;
+ WriteBarrier<RegExpPrototype> m_regExpPrototype;
+
+ WriteBarrier<Structure> m_argumentsStructure;
+ WriteBarrier<Structure> m_arrayStructure;
+ WriteBarrier<Structure> m_booleanObjectStructure;
+ WriteBarrier<Structure> m_callbackConstructorStructure;
+ WriteBarrier<Structure> m_callbackFunctionStructure;
+ WriteBarrier<Structure> m_callbackObjectStructure;
+ WriteBarrier<Structure> m_dateStructure;
+ WriteBarrier<Structure> m_emptyObjectStructure;
+ WriteBarrier<Structure> m_nullPrototypeObjectStructure;
+ WriteBarrier<Structure> m_errorStructure;
+ WriteBarrier<Structure> m_functionStructure;
+ WriteBarrier<Structure> m_numberObjectStructure;
+ WriteBarrier<Structure> m_regExpMatchesArrayStructure;
+ WriteBarrier<Structure> m_regExpStructure;
+ WriteBarrier<Structure> m_stringObjectStructure;
+ WriteBarrier<Structure> m_internalFunctionStructure;
+
+ unsigned m_profileGroup;
+ Debugger* m_debugger;
+
+ WeakMapSet m_weakMaps;
+ WeakRandom m_weakRandom;
+
+ SymbolTable m_symbolTable;
+
+ bool m_isEvalEnabled;
+
+ public:
+ void* operator new(size_t, JSGlobalData*);
+
+ explicit JSGlobalObject(JSGlobalData& globalData, Structure* structure)
+ : JSVariableObject(globalData, structure, &m_symbolTable, 0)
+ , m_registerArraySize(0)
+ , m_globalScopeChain()
+ , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
+ , m_isEvalEnabled(true)
+ {
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putThisToAnonymousValue(0);
+ init(this);
+ }
+
+ protected:
+ JSGlobalObject(JSGlobalData& globalData, Structure* structure, JSObject* thisValue)
+ : JSVariableObject(globalData, structure, &m_symbolTable, 0)
+ , m_registerArraySize(0)
+ , m_globalScopeChain()
+ , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
+ , m_isEvalEnabled(true)
+ {
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putThisToAnonymousValue(0);
+ init(thisValue);
+ }
+
+ public:
+ virtual ~JSGlobalObject();
+
+ virtual void visitChildren(SlotVisitor&);
+
+ 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);
+
+ // We use this in the code generator as we perform symbol table
+ // lookups prior to initializing the properties
+ bool symbolTableHasProperty(const Identifier& propertyName);
+
+ // The following accessors return pristine values, even if a script
+ // replaces the global object's associated property.
+
+ RegExpConstructor* regExpConstructor() const { return m_regExpConstructor.get(); }
+
+ ErrorConstructor* errorConstructor() const { return m_errorConstructor.get(); }
+ NativeErrorConstructor* evalErrorConstructor() const { return m_evalErrorConstructor.get(); }
+ NativeErrorConstructor* rangeErrorConstructor() const { return m_rangeErrorConstructor.get(); }
+ NativeErrorConstructor* referenceErrorConstructor() const { return m_referenceErrorConstructor.get(); }
+ NativeErrorConstructor* syntaxErrorConstructor() const { return m_syntaxErrorConstructor.get(); }
+ NativeErrorConstructor* typeErrorConstructor() const { return m_typeErrorConstructor.get(); }
+ NativeErrorConstructor* URIErrorConstructor() const { return m_URIErrorConstructor.get(); }
+
+ JSFunction* evalFunction() const { return m_evalFunction.get(); }
+ JSFunction* callFunction() const { return m_callFunction.get(); }
+ JSFunction* applyFunction() const { return m_applyFunction.get(); }
+
+ ObjectPrototype* objectPrototype() const { return m_objectPrototype.get(); }
+ FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); }
+ ArrayPrototype* arrayPrototype() const { return m_arrayPrototype.get(); }
+ BooleanPrototype* booleanPrototype() const { return m_booleanPrototype.get(); }
+ StringPrototype* stringPrototype() const { return m_stringPrototype.get(); }
+ NumberPrototype* numberPrototype() const { return m_numberPrototype.get(); }
+ DatePrototype* datePrototype() const { return m_datePrototype.get(); }
+ RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); }
+
+ JSObject* methodCallDummy() const { return m_methodCallDummy.get(); }
+
+ Structure* argumentsStructure() const { return m_argumentsStructure.get(); }
+ Structure* arrayStructure() const { return m_arrayStructure.get(); }
+ Structure* booleanObjectStructure() const { return m_booleanObjectStructure.get(); }
+ Structure* callbackConstructorStructure() const { return m_callbackConstructorStructure.get(); }
+ Structure* callbackFunctionStructure() const { return m_callbackFunctionStructure.get(); }
+ Structure* callbackObjectStructure() const { return m_callbackObjectStructure.get(); }
+ Structure* dateStructure() const { return m_dateStructure.get(); }
+ Structure* emptyObjectStructure() const { return m_emptyObjectStructure.get(); }
+ Structure* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure.get(); }
+ Structure* errorStructure() const { return m_errorStructure.get(); }
+ Structure* functionStructure() const { return m_functionStructure.get(); }
+ Structure* numberObjectStructure() const { return m_numberObjectStructure.get(); }
+ Structure* internalFunctionStructure() const { return m_internalFunctionStructure.get(); }
+ Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); }
+ Structure* regExpStructure() const { return m_regExpStructure.get(); }
+ Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); }
+
+ void setProfileGroup(unsigned value) { m_profileGroup = value; }
+ unsigned profileGroup() const { return m_profileGroup; }
+
+ Debugger* debugger() const { return m_debugger; }
+ void setDebugger(Debugger* debugger) { m_debugger = debugger; }
+
+ virtual bool supportsProfiling() const { return false; }
+ virtual bool supportsRichSourceInfo() const { return true; }
+
+ ScopeChainNode* globalScopeChain() { return m_globalScopeChain.get(); }
+
+ 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;
+
+ void disableEval();
+ bool isEvalEnabled() { return m_isEvalEnabled; }
+
+ void copyGlobalsFrom(RegisterFile&);
+ void copyGlobalsTo(RegisterFile&);
+ void resizeRegisters(int oldSize, int newSize);
+
+ void resetPrototype(JSGlobalData&, JSValue prototype);
+
+ JSGlobalData& globalData() const { return *m_globalData.get(); }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ void registerWeakMap(OpaqueJSWeakObjectMap* map)
+ {
+ m_weakMaps.add(map);
+ }
+
+ void deregisterWeakMap(OpaqueJSWeakObjectMap* map)
+ {
+ m_weakMaps.remove(map);
+ }
+
+ double weakRandomNumber() { return m_weakRandom.get(); }
+ protected:
+
+ static const unsigned AnonymousSlotCount = JSVariableObject::AnonymousSlotCount + 1;
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | 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:
+ // FIXME: Fold reset into init.
+ void init(JSObject* thisValue);
+ void reset(JSValue prototype);
+
+ void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > 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(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray, size_t count)
+ {
+ JSVariableObject::setRegisters(registers, registerArray);
+ m_registerArraySize = count;
+ }
+
+ inline void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count)
+ {
+ size_t oldSize = m_registerArraySize;
+ size_t newSize = oldSize + count;
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[newSize]);
+ if (m_registerArray) {
+ // memcpy is safe here as we're copying barriers we already own from the existing array
+ memcpy(registerArray.get() + count, m_registerArray.get(), oldSize * sizeof(Register));
+ }
+
+ WriteBarrier<Unknown>* registers = registerArray.get() + newSize;
+ setRegisters(registers, registerArray.release(), 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).set(globalData(), this, 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 bool JSGlobalObject::symbolTableHasProperty(const Identifier& propertyName)
+ {
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ return !entry.isNull();
+ }
+
+ inline JSValue Structure::prototypeForLookup(ExecState* exec) const
+ {
+ if (typeInfo().type() == ObjectType)
+ return m_prototype.get();
+
+ 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.set(exec->globalData(), this, StructureChain::create(exec->globalData(), 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);
+ WriteBarrier<Structure>* cachedStructure = cachedPrototypeChain->head();
+ while(*cachedStructure && !prototype.isNull()) {
+ if (asObject(prototype)->structure() != cachedStructure->get())
+ 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, JSGlobalObject* globalObject)
+ {
+ return constructEmptyObject(exec, globalObject->emptyObjectStructure());
+ }
+
+ inline JSObject* constructEmptyObject(ExecState* exec)
+ {
+ return constructEmptyObject(exec, exec->lexicalGlobalObject());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec, JSGlobalObject* globalObject)
+ {
+ return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec)
+ {
+ return constructEmptyArray(exec, exec->lexicalGlobalObject());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec, JSGlobalObject* globalObject, unsigned initialLength)
+ {
+ return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), initialLength, CreateInitialized);
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength)
+ {
+ return constructEmptyArray(exec, exec->lexicalGlobalObject(), initialLength);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, JSGlobalObject* globalObject, JSValue singleItemValue)
+ {
+ MarkedArgumentBuffer values;
+ values.append(singleItemValue);
+ return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), values);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, JSValue singleItemValue)
+ {
+ return constructArray(exec, exec->lexicalGlobalObject(), singleItemValue);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, JSGlobalObject* globalObject, const ArgList& values)
+ {
+ return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), values);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, const ArgList& values)
+ {
+ return constructArray(exec, exec->lexicalGlobalObject(), values);
+ }
+
+ class DynamicGlobalObjectScope {
+ WTF_MAKE_NONCOPYABLE(DynamicGlobalObjectScope);
+ public:
+ DynamicGlobalObjectScope(JSGlobalData&, JSGlobalObject*);
+
+ ~DynamicGlobalObjectScope()
+ {
+ m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;
+ }
+
+ private:
+ JSGlobalObject*& m_dynamicGlobalObjectSlot;
+ JSGlobalObject* m_savedDynamicGlobalObject;
+ };
+
+} // namespace JSC
+
+#endif // JSGlobalObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
new file mode 100644
index 0000000..f0da773
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -0,0 +1,599 @@
+/*
+ * 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 "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);
+
+ EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false);
+ JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain());
+ if (error)
+ return throwVMError(exec, error);
+
+ return JSValue::encode(exec->interpreter()->execute(eval, exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain()));
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
new file mode 100644
index 0000000..6dc7343
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.cpp
new file mode 100644
index 0000000..fc543f0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.cpp
@@ -0,0 +1,265 @@
+/*
+ * 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 "Heap.h"
+#include "CallFrame.h"
+#include "JSObject.h"
+#include "ScopeChain.h"
+
+#if USE(PTHREADS)
+#include <pthread.h>
+#endif
+
+namespace JSC {
+
+// JSLock is only needed to support an obsolete execution model where JavaScriptCore
+// automatically protected against concurrent access from multiple threads.
+// So it's safe to disable it on non-mac platforms where we don't have native pthreads.
+#if ENABLE(JSC_MULTIPLE_THREADS) && (OS(DARWIN) || USE(PTHREADS))
+
+// 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 // ENABLE(JSC_MULTIPLE_THREADS) && (OS(DARWIN) || USE(PTHREADS))
+
+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 // ENABLE(JSC_MULTIPLE_THREADS) && (OS(DARWIN) || USE(PTHREADS))
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.h
new file mode 100644
index 0000000..7b07b4f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSLock.h
@@ -0,0 +1,108 @@
+/*
+ * 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 {
+ WTF_MAKE_NONCOPYABLE(JSLock);
+ 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 {
+ WTF_MAKE_NONCOPYABLE(DropAllLocks);
+ public:
+ DropAllLocks(ExecState* exec);
+ DropAllLocks(JSLockBehavior);
+ ~DropAllLocks();
+
+ private:
+ intptr_t m_lockCount;
+ JSLockBehavior m_lockBehavior;
+ };
+ };
+
+} // namespace
+
+#endif // JSLock_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSNotAnObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
new file mode 100644
index 0000000..1115dc0
--- /dev/null
+++ b/src/3rdparty/webkit/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, JSGlobalObject*) 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSNotAnObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSNotAnObject.h
new file mode 100644
index 0000000..4c6806a
--- /dev/null
+++ b/src/3rdparty/webkit/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 JSNonFinalObject {
+ public:
+ JSNotAnObject(ExecState* exec)
+ : JSNonFinalObject(exec->globalData(), exec->globalData().notAnObjectStructure.get())
+ {
+ }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ 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*, JSGlobalObject*) 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.cpp
new file mode 100644
index 0000000..8742fdc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.cpp
@@ -0,0 +1,856 @@
+/*
+ * 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 "Local.h"
+#include "LocalScope.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, Structure* structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+ ASSERT(inherits(&s_info));
+}
+
+// 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 {
+ WTF_MAKE_NONCOPYABLE(Stringifier);
+public:
+ Stringifier(ExecState*, const Local<Unknown>& replacer, const Local<Unknown>& space);
+ Local<Unknown> stringify(Handle<Unknown>);
+
+ void visitAggregate(SlotVisitor&);
+
+private:
+ class Holder {
+ public:
+ Holder(JSGlobalData&, JSObject*);
+
+ JSObject* object() const { return m_object.get(); }
+
+ bool appendNextProperty(Stringifier&, UStringBuilder&);
+
+ private:
+ Local<JSObject> 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;
+
+ ExecState* const m_exec;
+ const Local<Unknown> m_replacer;
+ bool m_usingArrayReplacer;
+ PropertyNameArray m_arrayReplacerPropertyNames;
+ CallType m_replacerCallType;
+ CallData m_replacerCallData;
+ const UString m_gap;
+
+ 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::s_info))
+ return jsNumber(object->toNumber(exec));
+ if (object->inherits(&StringObject::s_info))
+ return jsString(exec, object->toString(exec));
+ if (object->inherits(&BooleanObject::s_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, const Local<Unknown>& replacer, const Local<Unknown>& space)
+ : m_exec(exec)
+ , m_replacer(replacer)
+ , m_usingArrayReplacer(false)
+ , m_arrayReplacerPropertyNames(exec)
+ , m_replacerCallType(CallTypeNone)
+ , m_gap(gap(exec, space.get()))
+{
+ if (!m_replacer.isObject())
+ return;
+
+ if (m_replacer.asObject()->inherits(&JSArray::s_info)) {
+ m_usingArrayReplacer = true;
+ Handle<JSObject> array = m_replacer.asObject();
+ 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::s_info) && !asObject(name)->inherits(&StringObject::s_info))
+ continue;
+ propertyName = name.toString(exec);
+ if (exec->hadException())
+ break;
+ m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
+ }
+ }
+ return;
+ }
+
+ m_replacerCallType = m_replacer.asObject()->getCallData(m_replacerCallData);
+}
+
+Local<Unknown> Stringifier::stringify(Handle<Unknown> value)
+{
+ JSObject* object = constructEmptyObject(m_exec);
+ if (m_exec->hadException())
+ return Local<Unknown>(m_exec->globalData(), jsNull());
+
+ PropertyNameForFunctionCall emptyPropertyName(m_exec->globalData().propertyNames->emptyIdentifier);
+ object->putDirect(m_exec->globalData(), m_exec->globalData().propertyNames->emptyIdentifier, value.get());
+
+ UStringBuilder result;
+ if (appendStringifiedValue(result, value.get(), object, emptyPropertyName) != StringifySucceeded)
+ return Local<Unknown>(m_exec->globalData(), jsUndefined());
+ if (m_exec->hadException())
+ return Local<Unknown>(m_exec->globalData(), jsNull());
+
+ return Local<Unknown>(m_exec->globalData(), jsString(m_exec, result.toUString()));
+}
+
+void Stringifier::appendQuotedString(UStringBuilder& builder, const UString& value)
+{
+ int length = value.length();
+
+ 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.get(), m_replacerCallType, m_replacerCallData, holder, args);
+ if (m_exec->hadException())
+ return StringifyFailed;
+ }
+
+ if (value.isUndefined() && !holder->inherits(&JSArray::s_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::s_info)) {
+ builder.append("null");
+ return StringifySucceeded;
+ }
+ return StringifyFailedDueToUndefinedValue;
+ }
+
+ // Handle cycle detection, and put the holder on the stack.
+ for (unsigned i = 0; i < m_holderStack.size(); i++) {
+ if (m_holderStack[i].object() == object) {
+ throwError(m_exec, createTypeError(m_exec, "JSON.stringify cannot serialize cyclic structures."));
+ return StringifyFailed;
+ }
+ }
+ bool holderStackWasEmpty = m_holderStack.isEmpty();
+ m_holderStack.append(Holder(m_exec->globalData(), 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_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(JSGlobalData& globalData, JSObject* object)
+ : m_object(globalData, object)
+ , m_isArray(object->inherits(&JSArray::s_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.get());
+ 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.get())->canGetIndex(index))
+ value = asArray(m_object.get())->getIndex(index);
+ else {
+ PropertySlot slot(m_object.get());
+ 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.get(), index);
+ } else {
+ // Get the value.
+ PropertySlot slot(m_object.get());
+ 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.get(), 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::s_info = { "JSON", &JSObjectWithGlobalObject::s_info, 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);
+}
+
+class Walker {
+public:
+ Walker(ExecState* exec, Handle<JSObject> function, CallType callType, CallData callData)
+ : m_exec(exec)
+ , m_function(exec->globalData(), 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.get(), m_callType, m_callData, thisObj, argList);
+ }
+
+ friend class Holder;
+
+ ExecState* m_exec;
+ Local<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;
+ LocalStack<JSObject, 16> objectStack(m_exec->globalData());
+ LocalStack<JSArray, 16> arrayStack(m_exec->globalData());
+
+ 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::s_info));
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion)
+ return throwError(m_exec, createStackOverflowError(m_exec));
+
+ JSArray* array = asArray(inValue);
+ arrayStack.push(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.peek();
+ uint32_t index = indexStack.last();
+ if (index == array->length()) {
+ outValue = array;
+ arrayStack.pop();
+ 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.peek();
+ 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(m_exec->globalData(), 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::s_info));
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion)
+ return throwError(m_exec, createStackOverflowError(m_exec));
+
+ JSObject* object = asObject(inValue);
+ objectStack.push(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.peek();
+ uint32_t index = indexStack.last();
+ PropertyNameArray& properties = propertyStack.last();
+ if (index == properties.size()) {
+ outValue = object;
+ objectStack.pop();
+ 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.peek();
+ 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::s_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());
+
+ LocalScope scope(exec->globalData());
+ 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, Local<JSObject>(exec->globalData(), 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"));
+ LocalScope scope(exec->globalData());
+ Local<Unknown> value(exec->globalData(), exec->argument(0));
+ Local<Unknown> replacer(exec->globalData(), exec->argument(1));
+ Local<Unknown> space(exec->globalData(), exec->argument(2));
+ return JSValue::encode(Stringifier(exec, replacer, space).stringify(value).get());
+}
+
+UString JSONStringify(ExecState* exec, JSValue value, unsigned indent)
+{
+ LocalScope scope(exec->globalData());
+ Local<Unknown> result = Stringifier(exec, Local<Unknown>(exec->globalData(), jsNull()), Local<Unknown>(exec->globalData(), jsNumber(indent))).stringify(Local<Unknown>(exec->globalData(), value));
+ if (result.isUndefinedOrNull())
+ return UString();
+ return result.getString(exec);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.h
new file mode 100644
index 0000000..c87c641
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.h
@@ -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.
+ */
+
+#ifndef JSONObject_h
+#define JSONObject_h
+
+#include "JSObjectWithGlobalObject.h"
+
+namespace JSC {
+
+ class Stringifier;
+
+ class JSONObject : public JSObjectWithGlobalObject {
+ public:
+ JSONObject(JSGlobalObject*, Structure*);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
+
+ private:
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static const ClassInfo s_info;
+ };
+
+ UString JSONStringify(ExecState* exec, JSValue value, unsigned indent);
+
+} // namespace JSC
+
+#endif // JSONObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.cpp
new file mode 100644
index 0000000..ce21703
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.cpp
@@ -0,0 +1,789 @@
+/*
+ * 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);
+ASSERT_CLASS_FITS_IN_CELL(JSNonFinalObject);
+ASSERT_CLASS_FITS_IN_CELL(JSFinalObject);
+
+const char* StrictModeReadonlyPropertyWriteError = "Attempted to assign to readonly property.";
+
+const ClassInfo JSObject::s_info = { "Object", 0, 0, 0 };
+
+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::visitChildren(SlotVisitor& visitor)
+{
+#ifndef NDEBUG
+ bool wasCheckingForDefaultMarkViolation = visitor.m_isCheckingForDefaultMarkViolation;
+ visitor.m_isCheckingForDefaultMarkViolation = false;
+#endif
+
+ visitChildrenDirect(visitor);
+
+#ifndef NDEBUG
+ visitor.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation;
+#endif
+}
+
+UString JSObject::className() const
+{
+ const ClassInfo* info = classInfo();
+ ASSERT(info);
+ return info->className;
+}
+
+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(exec->globalData(), 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(exec->globalData(), 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(exec->globalData(), 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(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) {
+ if ((attributes & DontDelete))
+ return false;
+ removeDirect(exec->globalData(), 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(exec->globalData(), propertyName);
+ if (object && object.isGetterSetter()) {
+ ASSERT(m_structure->hasGetterSetterProperties());
+ asGetterSetter(object)->setGetter(exec->globalData(), getterFunction);
+ return;
+ }
+
+ JSGlobalData& globalData = exec->globalData();
+ PutPropertySlot slot;
+ GetterSetter* getterSetter = new (exec) GetterSetter(exec);
+ putDirectInternal(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())
+ setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, m_structure.get()));
+ }
+
+ m_structure->setHasGetterSetterProperties(true);
+ getterSetter->setGetter(globalData, getterFunction);
+}
+
+void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
+{
+ JSValue object = getDirect(exec->globalData(), propertyName);
+ if (object && object.isGetterSetter()) {
+ ASSERT(m_structure->hasGetterSetterProperties());
+ asGetterSetter(object)->setSetter(exec->globalData(), 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())
+ setStructure(exec->globalData(), Structure::getterSetterTransition(exec->globalData(), m_structure.get()));
+ }
+
+ m_structure->setHasGetterSetterProperties(true);
+ getterSetter->setSetter(exec->globalData(), setterFunction);
+}
+
+JSValue JSObject::lookupGetter(ExecState* exec, const Identifier& propertyName)
+{
+ JSObject* object = this;
+ while (true) {
+ if (JSValue value = object->getDirect(exec->globalData(), 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* exec, const Identifier& propertyName)
+{
+ JSObject* object = this;
+ while (true) {
+ if (JSValue value = object->getDirect(exec->globalData(), 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* exec, const Identifier& propertyName, JSCell*& specificValue) const
+{
+ unsigned attributes;
+ if (m_structure->get(exec->globalData(), 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(exec->globalData(), 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*, JSGlobalObject*) 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::seal(JSGlobalData& globalData)
+{
+ if (isSealed(globalData))
+ return;
+ preventExtensions(globalData);
+ setStructure(globalData, Structure::sealTransition(globalData, m_structure.get()));
+}
+
+void JSObject::freeze(JSGlobalData& globalData)
+{
+ if (isFrozen(globalData))
+ return;
+ preventExtensions(globalData);
+ setStructure(globalData, Structure::freezeTransition(globalData, m_structure.get()));
+}
+
+void JSObject::preventExtensions(JSGlobalData& globalData)
+{
+ if (isExtensible())
+ setStructure(globalData, Structure::preventExtensionsTransition(globalData, m_structure.get()));
+}
+
+void JSObject::removeDirect(JSGlobalData& globalData, const Identifier& propertyName)
+{
+ if (m_structure->get(globalData, propertyName) == WTF::notFound)
+ return;
+
+ size_t offset;
+ if (m_structure->isUncacheableDictionary()) {
+ offset = m_structure->removePropertyWithoutTransition(globalData, propertyName);
+ if (offset != WTF::notFound)
+ putUndefinedAtDirectOffset(offset);
+ return;
+ }
+
+ setStructure(globalData, Structure::removePropertyTransition(globalData, m_structure.get(), propertyName, offset));
+ if (offset != WTF::notFound)
+ putUndefinedAtDirectOffset(offset);
+}
+
+void JSObject::putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr)
+{
+ putDirectFunction(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
+}
+
+void JSObject::putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr)
+{
+ putDirectFunction(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
+}
+
+void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr)
+{
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
+}
+
+void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr)
+{
+ putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
+}
+
+NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, WriteBarrierBase<Unknown>* location)
+{
+ if (JSObject* getterFunction = asGetterSetter(location->get())->getter()) {
+ if (!structure()->isDictionary())
+ slot.setCacheableGetterSlot(this, getterFunction, offsetForLocation(location));
+ else
+ slot.setGetterSlot(getterFunction);
+ } else
+ slot.setUndefined();
+}
+
+Structure* JSObject::createInheritorID(JSGlobalData& globalData)
+{
+ m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, this));
+ ASSERT(m_inheritorID->isEmpty());
+ return m_inheritorID.get();
+}
+
+void JSObject::allocatePropertyStorage(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::baseExternalStorageCapacity);
+
+ PropertyStorage oldPropertyStorage = m_propertyStorage;
+ PropertyStorage newPropertyStorage = new WriteBarrierBase<Unknown>[newSize];
+
+ for (unsigned i = 0; i < oldSize; ++i)
+ newPropertyStorage[i] = oldPropertyStorage[i];
+
+ if (!wasInline)
+ delete [] oldPropertyStorage;
+
+ m_propertyStorage = newPropertyStorage;
+}
+
+bool JSObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ unsigned attributes = 0;
+ JSCell* cell = 0;
+ size_t offset = m_structure->get(exec->globalData(), 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, const PropertyDescriptor& oldDescriptor)
+{
+ if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) {
+ if (descriptor.isGenericDescriptor() && oldDescriptor.isAccessorDescriptor()) {
+ GetterSetter* accessor = new (exec) GetterSetter(exec);
+ if (oldDescriptor.getter()) {
+ attributes |= Getter;
+ accessor->setGetter(exec->globalData(), asObject(oldDescriptor.getter()));
+ }
+ if (oldDescriptor.setter()) {
+ attributes |= Setter;
+ accessor->setSetter(exec->globalData(), asObject(oldDescriptor.setter()));
+ }
+ target->putWithAttributes(exec, propertyName, accessor, attributes);
+ return true;
+ }
+ JSValue newValue = jsUndefined();
+ if (descriptor.value())
+ newValue = descriptor.value();
+ else if (oldDescriptor.value())
+ newValue = oldDescriptor.value();
+ target->putWithAttributes(exec, propertyName, newValue, 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)) {
+ // unless extensions are prevented!
+ if (!isExtensible()) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to define property on object that is not extensible."));
+ return false;
+ }
+ PropertyDescriptor oldDescriptor;
+ oldDescriptor.setValue(jsUndefined());
+ return putDescriptor(exec, this, propertyName, descriptor, descriptor.attributes(), oldDescriptor);
+ }
+
+ 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);
+ }
+ 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);
+ }
+
+ // 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);
+ }
+
+ // Changing the accessor functions of an existing accessor property
+ ASSERT(descriptor.isAccessorDescriptor());
+ if (!current.configurable()) {
+ if (descriptor.setterPresent() && !(current.setterPresent() && 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.getterPresent() && 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(exec->globalData(), propertyName);
+ if (!accessor)
+ return false;
+ GetterSetter* getterSetter = asGetterSetter(accessor);
+ if (current.attributesEqual(descriptor)) {
+ if (descriptor.setter())
+ getterSetter->setSetter(exec->globalData(), asObject(descriptor.setter()));
+ if (descriptor.getter())
+ getterSetter->setGetter(exec->globalData(), asObject(descriptor.getter()));
+ return true;
+ }
+ deleteProperty(exec, propertyName);
+ unsigned attrs = current.attributesWithOverride(descriptor);
+ if (descriptor.setter())
+ attrs |= Setter;
+ if (descriptor.getter())
+ attrs |= Getter;
+ putDirect(exec->globalData(), propertyName, getterSetter, attrs);
+ return true;
+}
+
+JSObject* throwTypeError(ExecState* exec, const UString& message)
+{
+ return throwError(exec, createTypeError(exec, message));
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.h
new file mode 100644
index 0000000..768c457
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.h
@@ -0,0 +1,869 @@
+/*
+ * 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 "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 WriteBarrierBase<Unknown>* PropertyStorage;
+ typedef const WriteBarrierBase<Unknown>* 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:
+ virtual void visitChildren(SlotVisitor&);
+ ALWAYS_INLINE void visitChildrenDirect(SlotVisitor&);
+
+ // 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(JSGlobalData&, JSValue prototype);
+ bool setPrototypeWithCycleCheck(JSGlobalData&, JSValue prototype);
+
+ void setStructure(JSGlobalData&, Structure*);
+ Structure* inheritorID(JSGlobalData&);
+
+ 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*, JSGlobalObject*) 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(JSGlobalData& globalData, const Identifier& propertyName) const
+ {
+ size_t offset = m_structure->get(globalData, propertyName);
+ return offset != WTF::notFound ? getDirectOffset(offset) : JSValue();
+ }
+
+ WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName)
+ {
+ size_t offset = m_structure->get(globalData, propertyName);
+ return offset != WTF::notFound ? locationForOffset(offset) : 0;
+ }
+
+ WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes)
+ {
+ JSCell* specificFunction;
+ size_t offset = m_structure->get(globalData, propertyName, attributes, specificFunction);
+ return offset != WTF::notFound ? locationForOffset(offset) : 0;
+ }
+
+ size_t offsetForLocation(WriteBarrierBase<Unknown>* location) const
+ {
+ return location - propertyStorage();
+ }
+
+ void transitionTo(JSGlobalData&, Structure*);
+
+ void removeDirect(JSGlobalData&, const Identifier& propertyName);
+ bool hasCustomProperties() { return m_structure->didTransition(); }
+ bool hasGetterSetterProperties() { return m_structure->hasGetterSetterProperties(); }
+
+ bool putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&);
+ void putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr = 0);
+ bool putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, PutPropertySlot&);
+
+ void putDirectFunction(JSGlobalData&, const Identifier& propertyName, JSCell*, unsigned attr = 0);
+ void putDirectFunction(JSGlobalData&, const Identifier& propertyName, JSCell*, unsigned attr, bool checkReadOnly, PutPropertySlot&);
+ void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0);
+ void putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr = 0);
+
+ void putDirectWithoutTransition(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr = 0);
+ void putDirectFunctionWithoutTransition(JSGlobalData&, 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 propertyStorage()[offset].get(); }
+ void putDirectOffset(JSGlobalData& globalData, size_t offset, JSValue value) { propertyStorage()[offset].set(globalData, this, value); }
+ void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); }
+
+ void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* 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; }
+
+ void seal(JSGlobalData&);
+ void freeze(JSGlobalData&);
+ virtual void preventExtensions(JSGlobalData&);
+ bool isSealed(JSGlobalData& globalData) { return m_structure->isSealed(globalData); }
+ bool isFrozen(JSGlobalData& globalData) { return m_structure->isFrozen(globalData); }
+ bool isExtensible() { return m_structure->isExtensible(); }
+
+ virtual ComplType exceptionType() const { return Throw; }
+
+ void allocatePropertyStorage(size_t oldSize, size_t newSize);
+ bool isUsingInlineStorage() const { return static_cast<const void*>(m_propertyStorage) == static_cast<const void*>(this + 1); }
+
+ static const unsigned baseExternalStorageCapacity = 16;
+
+ void flattenDictionaryObject(JSGlobalData& globalData)
+ {
+ m_structure->flattenDictionaryStructure(globalData, this);
+ }
+
+ void putAnonymousValue(JSGlobalData& globalData, unsigned index, JSValue value)
+ {
+ ASSERT(index < m_structure->anonymousSlotCount());
+ locationForOffset(index)->set(globalData, this, value);
+ }
+ void clearAnonymousValue(unsigned index)
+ {
+ ASSERT(index < m_structure->anonymousSlotCount());
+ locationForOffset(index)->clear();
+ }
+ JSValue getAnonymousValue(unsigned index) const
+ {
+ ASSERT(index < m_structure->anonymousSlotCount());
+ return locationForOffset(index)->get();
+ }
+
+ static size_t offsetOfInlineStorage();
+
+ static JS_EXPORTDATA const ClassInfo s_info;
+
+ protected:
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ static const unsigned StructureFlags = 0;
+
+ void putThisToAnonymousValue(unsigned index)
+ {
+ locationForOffset(index)->setWithoutWriteBarrier(this);
+ }
+
+ // To instantiate objects you likely want JSFinalObject, below.
+ // To create derived types you likely want JSNonFinalObject, below.
+ JSObject(JSGlobalData&, Structure*, PropertyStorage inlineStorage);
+ JSObject(VPtrStealingHackType, PropertyStorage inlineStorage)
+ : JSCell(VPtrStealingHack)
+ , m_propertyStorage(inlineStorage)
+ {
+ }
+
+ 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 m_propertyStorage; }
+ PropertyStorage propertyStorage() { return m_propertyStorage; }
+
+ const WriteBarrierBase<Unknown>* locationForOffset(size_t offset) const
+ {
+ return &propertyStorage()[offset];
+ }
+
+ WriteBarrierBase<Unknown>* locationForOffset(size_t offset)
+ {
+ return &propertyStorage()[offset];
+ }
+
+ bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&, JSCell*);
+ bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&);
+ 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(JSGlobalData&);
+
+ PropertyStorage m_propertyStorage;
+ WriteBarrier<Structure> m_inheritorID;
+ };
+
+
+#if USE(JSVALUE32_64)
+#define JSNonFinalObject_inlineStorageCapacity 4
+#define JSFinalObject_inlineStorageCapacity 6
+#else
+#define JSNonFinalObject_inlineStorageCapacity 2
+#define JSFinalObject_inlineStorageCapacity 4
+#endif
+
+COMPILE_ASSERT((JSFinalObject_inlineStorageCapacity >= JSNonFinalObject_inlineStorageCapacity), final_storage_is_at_least_as_large_as_non_final);
+
+ // JSNonFinalObject is a type of JSObject that has some internal storage,
+ // but also preserves some space in the collector cell for additional
+ // data members in derived types.
+ class JSNonFinalObject : public JSObject {
+ friend class JSObject;
+
+ public:
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ explicit JSNonFinalObject(VPtrStealingHackType)
+ : JSObject(VPtrStealingHack, m_inlineStorage)
+ {
+ }
+
+ explicit JSNonFinalObject(JSGlobalData& globalData, Structure* structure)
+ : JSObject(globalData, structure, m_inlineStorage)
+ {
+ ASSERT(!(OBJECT_OFFSETOF(JSNonFinalObject, m_inlineStorage) % sizeof(double)));
+ ASSERT(this->structure()->propertyStorageCapacity() == JSNonFinalObject_inlineStorageCapacity);
+ }
+
+ private:
+ WriteBarrierBase<Unknown> m_inlineStorage[JSNonFinalObject_inlineStorageCapacity];
+ };
+
+ // JSFinalObject is a type of JSObject that contains sufficent internal
+ // storage to fully make use of the colloctor cell containing it.
+ class JSFinalObject : public JSObject {
+ friend class JSObject;
+
+ public:
+ static JSFinalObject* create(ExecState* exec, Structure* structure)
+ {
+ return new (exec) JSFinalObject(exec->globalData(), structure);
+ }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ private:
+ explicit JSFinalObject(JSGlobalData& globalData, Structure* structure)
+ : JSObject(globalData, structure, m_inlineStorage)
+ {
+ ASSERT(OBJECT_OFFSETOF(JSFinalObject, m_inlineStorage) % sizeof(double) == 0);
+ ASSERT(this->structure()->propertyStorageCapacity() == JSFinalObject_inlineStorageCapacity);
+ }
+
+ static const unsigned StructureFlags = JSObject::StructureFlags | IsJSFinalObject;
+
+ WriteBarrierBase<Unknown> m_inlineStorage[JSFinalObject_inlineStorageCapacity];
+ };
+
+inline size_t JSObject::offsetOfInlineStorage()
+{
+ ASSERT(OBJECT_OFFSETOF(JSFinalObject, m_inlineStorage) == OBJECT_OFFSETOF(JSNonFinalObject, m_inlineStorage));
+ return OBJECT_OFFSETOF(JSFinalObject, m_inlineStorage);
+}
+
+inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure)
+{
+ return JSFinalObject::create(exec, structure);
+}
+
+inline Structure* createEmptyObjectStructure(JSGlobalData& globalData, JSValue prototype)
+{
+ return JSFinalObject::createStructure(globalData, prototype);
+}
+
+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(JSGlobalData& globalData, Structure* structure, PropertyStorage inlineStorage)
+ : JSCell(globalData, structure)
+ , m_propertyStorage(inlineStorage)
+{
+ ASSERT(inherits(&s_info));
+ ASSERT(m_structure->propertyStorageCapacity() < baseExternalStorageCapacity);
+ ASSERT(m_structure->isEmpty());
+ ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
+ ASSERT(static_cast<void*>(inlineStorage) == static_cast<void*>(this + 1));
+ ASSERT(m_structure->typeInfo().type() == ObjectType);
+}
+
+inline JSObject::~JSObject()
+{
+ if (!isUsingInlineStorage())
+ delete [] m_propertyStorage;
+}
+
+inline JSValue JSObject::prototype() const
+{
+ return m_structure->storedPrototype();
+}
+
+inline bool JSObject::setPrototypeWithCycleCheck(JSGlobalData& globalData, JSValue prototype)
+{
+ JSValue nextPrototypeValue = prototype;
+ while (nextPrototypeValue && nextPrototypeValue.isObject()) {
+ JSObject* nextPrototype = asObject(nextPrototypeValue)->unwrappedObject();
+ if (nextPrototype == this)
+ return false;
+ nextPrototypeValue = nextPrototype->prototype();
+ }
+ setPrototype(globalData, prototype);
+ return true;
+}
+
+inline void JSObject::setPrototype(JSGlobalData& globalData, JSValue prototype)
+{
+ ASSERT(prototype);
+ setStructure(globalData, Structure::changePrototypeTransition(globalData, m_structure.get(), prototype));
+}
+
+inline void JSObject::setStructure(JSGlobalData& globalData, Structure* structure)
+{
+ m_structure.set(globalData, this, structure);
+}
+
+inline Structure* JSObject::inheritorID(JSGlobalData& globalData)
+{
+ if (m_inheritorID) {
+ ASSERT(m_inheritorID->isEmpty());
+ return m_inheritorID.get();
+ }
+ return createInheritorID(globalData);
+}
+
+inline bool Structure::isUsingInlineStorage() const
+{
+ return propertyStorageCapacity() < JSObject::baseExternalStorageCapacity;
+}
+
+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 (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) {
+ if (m_structure->hasGetterSetterProperties() && location->isGetterSetter())
+ fillGetterPropertySlot(slot, location);
+ else
+ slot.setValue(this, location->get(), 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(JSGlobalData& globalData, 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(globalData, 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(globalData, propertyName);
+ if (checkReadOnly && currentAttributes & ReadOnly)
+ return false;
+
+ putDirectOffset(globalData, 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;
+ }
+
+ if (!isExtensible())
+ return false;
+
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, specificFunction);
+ if (currentCapacity != m_structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
+
+ ASSERT(offset < m_structure->propertyStorageCapacity());
+ putDirectOffset(globalData, 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 (Structure* structure = Structure::addPropertyTransitionToExistingStructure(m_structure.get(), propertyName, attributes, specificFunction, offset)) {
+ if (currentCapacity != structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
+
+ ASSERT(offset < structure->propertyStorageCapacity());
+ setStructure(globalData, structure);
+ putDirectOffset(globalData, 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(globalData, 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(globalData, offset, value);
+ return true;
+ }
+ // case (2) Despecify, fall through to (3).
+ setStructure(globalData, Structure::despecifyFunctionTransition(globalData, m_structure.get(), propertyName));
+ }
+
+ // case (3) set the slot, do the put, return.
+ slot.setExistingProperty(this, offset);
+ putDirectOffset(globalData, offset, value);
+ return true;
+ }
+
+ if (!isExtensible())
+ return false;
+
+ Structure* structure = Structure::addPropertyTransition(globalData, m_structure.get(), propertyName, attributes, specificFunction, offset);
+
+ if (currentCapacity != structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
+
+ ASSERT(offset < structure->propertyStorageCapacity());
+ setStructure(globalData, structure);
+ putDirectOffset(globalData, 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(globalData, propertyName, value, attributes, checkReadOnly, slot, getJSFunction(globalData, value));
+}
+
+inline void JSObject::putDirectInternal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ PutPropertySlot slot;
+ putDirectInternal(globalData, propertyName, value, attributes, false, slot, getJSFunction(globalData, value));
+}
+
+inline bool JSObject::putDirect(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(globalData, propertyName, value, attributes, checkReadOnly, slot, 0);
+}
+
+inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ PutPropertySlot slot;
+ putDirectInternal(globalData, propertyName, value, attributes, false, slot, 0);
+}
+
+inline bool JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ return putDirectInternal(globalData, propertyName, value, 0, false, slot, 0);
+}
+
+inline void JSObject::putDirectFunction(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
+{
+ putDirectInternal(globalData, propertyName, value, attributes, checkReadOnly, slot, value);
+}
+
+inline void JSObject::putDirectFunction(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attr)
+{
+ PutPropertySlot slot;
+ putDirectInternal(globalData, propertyName, value, attr, false, slot, value);
+}
+
+inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, 0);
+ if (currentCapacity != m_structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
+ putDirectOffset(globalData, offset, value);
+}
+
+inline void JSObject::putDirectFunctionWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attributes)
+{
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, value);
+ if (currentCapacity != m_structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
+ putDirectOffset(globalData, offset, value);
+}
+
+inline void JSObject::transitionTo(JSGlobalData& globalData, Structure* newStructure)
+{
+ if (m_structure->propertyStorageCapacity() != newStructure->propertyStorageCapacity())
+ allocatePropertyStorage(m_structure->propertyStorageCapacity(), newStructure->propertyStorageCapacity());
+ setStructure(globalData, 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(exec->globalData(), 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::visitChildrenDirect(SlotVisitor& visitor)
+{
+ JSCell::visitChildren(visitor);
+
+ PropertyStorage storage = propertyStorage();
+ size_t storageSize = m_structure->propertyStorageSize();
+ visitor.appendValues(storage, storageSize);
+ if (m_inheritorID)
+ visitor.append(&m_inheritorID);
+}
+
+// --- 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);
+}
+
+ALWAYS_INLINE JSObject* Register::function() const
+{
+ if (!jsValue())
+ return 0;
+ return asObject(jsValue());
+}
+
+ALWAYS_INLINE Register Register::withCallee(JSObject* callee)
+{
+ Register r;
+ r = JSValue(callee);
+ return r;
+}
+
+} // namespace JSC
+
+#endif // JSObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp
new file mode 100644
index 0000000..2b489a2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.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 "JSObjectWithGlobalObject.h"
+
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject, Structure* structure)
+ : JSNonFinalObject(globalObject->globalData(), structure)
+{
+ COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
+ ASSERT(!globalObject || globalObject->isGlobalObject());
+ if (!globalObject)
+ clearAnonymousValue(GlobalObjectSlot);
+ else
+ putAnonymousValue(globalObject->globalData(), GlobalObjectSlot, globalObject);
+}
+
+JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalData& globalData, JSGlobalObject* globalObject, Structure* structure)
+ : JSNonFinalObject(globalData, structure)
+{
+ COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
+ ASSERT(!globalObject || globalObject->isGlobalObject());
+ if (!globalObject)
+ clearAnonymousValue(GlobalObjectSlot);
+ else
+ putAnonymousValue(globalData, GlobalObjectSlot, globalObject);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h
new file mode 100644
index 0000000..844bcd8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h
@@ -0,0 +1,62 @@
+/*
+ * 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 "JSGlobalObject.h"
+
+namespace JSC {
+
+class JSGlobalObject;
+
+class JSObjectWithGlobalObject : public JSNonFinalObject {
+public:
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ JSGlobalObject* globalObject() const
+ {
+ return asGlobalObject((getAnonymousValue(GlobalObjectSlot).asCell()));
+ }
+
+protected:
+ JSObjectWithGlobalObject(JSGlobalObject*, Structure*);
+ JSObjectWithGlobalObject(JSGlobalData&, JSGlobalObject*, Structure*);
+
+ JSObjectWithGlobalObject(VPtrStealingHackType)
+ : JSNonFinalObject(VPtrStealingHack)
+ {
+ // 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
new file mode 100644
index 0000000..e6010de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
@@ -0,0 +1,105 @@
+/*
+ * 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);
+
+const ClassInfo JSPropertyNameIterator::s_info = { "JSPropertyNameIterator", 0, 0, 0 };
+
+inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlots)
+ : JSCell(exec->globalData(), exec->globalData().propertyNameIteratorStructure.get())
+ , m_numCacheableSlots(numCacheableSlots)
+ , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
+ , m_jsStrings(adoptArrayPtr(new WriteBarrier<Unknown>[m_jsStringsSize]))
+{
+ PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector();
+ for (size_t i = 0; i < m_jsStringsSize; ++i)
+ m_jsStrings[i].set(exec->globalData(), this, jsOwnedString(exec, propertyNameVector[i].ustring()));
+}
+
+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);
+ WriteBarrier<Structure>* structure = structureChain->head();
+ for (size_t i = 0; i < count; ++i) {
+ if (structure[i]->typeInfo().overridesGetPropertyNames())
+ return jsPropertyNameIterator;
+ }
+
+ jsPropertyNameIterator->setCachedPrototypeChain(exec->globalData(), structureChain);
+ jsPropertyNameIterator->setCachedStructure(exec->globalData(), o->structure());
+ o->structure()->setEnumerationCache(exec->globalData(), jsPropertyNameIterator);
+ return jsPropertyNameIterator;
+}
+
+JSValue JSPropertyNameIterator::get(ExecState* exec, JSObject* base, size_t i)
+{
+ JSValue identifier = m_jsStrings[i].get();
+ if (m_cachedStructure.get() == base->structure() && m_cachedPrototypeChain.get() == base->structure()->prototypeChain(exec))
+ return identifier;
+
+ if (!base->hasProperty(exec, Identifier(exec, asString(identifier)->value(exec))))
+ return JSValue();
+ return identifier;
+}
+
+void JSPropertyNameIterator::visitChildren(SlotVisitor& visitor)
+{
+ visitor.appendValues(m_jsStrings.get(), m_jsStringsSize, MayContainNullValues);
+ if (m_cachedPrototypeChain)
+ visitor.append(&m_cachedPrototypeChain);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
new file mode 100644
index 0000000..1a57350
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
@@ -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.
+ */
+
+#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 Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesVisitChildren), AnonymousSlotCount, &s_info);
+ }
+
+ virtual bool isPropertyNameIterator() const { return true; }
+
+ virtual void visitChildren(SlotVisitor&);
+
+ 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(JSGlobalData& globalData, Structure* structure)
+ {
+ ASSERT(!m_cachedStructure);
+ ASSERT(structure);
+ m_cachedStructure.set(globalData, this, structure);
+ }
+ Structure* cachedStructure() { return m_cachedStructure.get(); }
+
+ void setCachedPrototypeChain(JSGlobalData& globalData, StructureChain* cachedPrototypeChain) { m_cachedPrototypeChain.set(globalData, this, cachedPrototypeChain); }
+ StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); }
+
+ private:
+ static const ClassInfo s_info;
+ JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot);
+
+ WriteBarrier<Structure> m_cachedStructure;
+ WriteBarrier<StructureChain> m_cachedPrototypeChain;
+ uint32_t m_numCacheableSlots;
+ uint32_t m_jsStringsSize;
+ OwnArrayPtr<WriteBarrier<Unknown> > m_jsStrings;
+ };
+
+ inline void Structure::setEnumerationCache(JSGlobalData& globalData, JSPropertyNameIterator* enumerationCache)
+ {
+ ASSERT(!isDictionary());
+ m_enumerationCache.set(globalData, this, enumerationCache);
+ }
+
+ inline JSPropertyNameIterator* Structure::enumerationCache()
+ {
+ return m_enumerationCache.get();
+ }
+
+ ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
+ {
+ return static_cast<JSPropertyNameIterator*>(jsValue().asCell());
+ }
+
+} // namespace JSC
+
+#endif // JSPropertyNameIterator_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
new file mode 100644
index 0000000..88e4538
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
@@ -0,0 +1,92 @@
+/*
+ * 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"
+
+#include "Error.h"
+
+namespace JSC {
+ASSERT_CLASS_FITS_IN_CELL(JSStaticScopeObject);
+
+void JSStaticScopeObject::visitChildren(SlotVisitor& visitor)
+{
+ JSVariableObject::visitChildren(visitor);
+ visitor.append(&m_registerStore);
+}
+
+JSObject* JSStaticScopeObject::toThisObject(ExecState* exec) const
+{
+ return exec->globalThisValue();
+}
+
+JSValue JSStaticScopeObject::toStrictThisObject(ExecState*) const
+{
+ return jsNull();
+}
+
+void JSStaticScopeObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ if (slot.isStrictMode()) {
+ // Double lookup in strict mode, but this only occurs when
+ // a) indirectly writing to an exception slot
+ // b) writing to a function expression name
+ // (a) is unlikely, and (b) is an error.
+ // Also with a single entry the symbol table lookup should simply be
+ // a pointer compare.
+ PropertySlot slot;
+ bool isWritable = true;
+ symbolTableGet(propertyName, slot, isWritable);
+ if (!isWritable) {
+ throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
+ return;
+ }
+ }
+ if (symbolTablePut(exec->globalData(), propertyName, value))
+ return;
+
+ ASSERT_NOT_REACHED();
+}
+
+void JSStaticScopeObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ if (symbolTablePutWithAttributes(exec->globalData(), propertyName, value, attributes))
+ return;
+
+ ASSERT_NOT_REACHED();
+}
+
+bool JSStaticScopeObject::isDynamicScope(bool&) const
+{
+ return false;
+}
+
+bool JSStaticScopeObject::getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot& slot)
+{
+ return symbolTableGet(propertyName, slot);
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
new file mode 100644
index 0000000..b201fe0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
@@ -0,0 +1,62 @@
+/*
+ * 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 {
+ public:
+ JSStaticScopeObject(ExecState* exec, const Identifier& ident, JSValue value, unsigned attributes)
+ : JSVariableObject(exec->globalData(), exec->globalData().staticScopeStructure.get(), &m_symbolTable, reinterpret_cast<Register*>(&m_registerStore + 1))
+ {
+ m_registerStore.set(exec->globalData(), this, value);
+ symbolTable().add(ident.impl(), SymbolTableEntry(-1, attributes));
+ }
+
+ virtual void visitChildren(SlotVisitor&);
+ 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 Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesVisitChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
+
+ private:
+ SymbolTable m_symbolTable;
+ WriteBarrier<Unknown> m_registerStore;
+ };
+
+}
+
+#endif // JSStaticScopeObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp
new file mode 100644
index 0000000..da15997
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp
@@ -0,0 +1,371 @@
+/*
+ * 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;
+
+const ClassInfo JSString::s_info = { "string", 0, 0, 0 };
+
+void JSString::resolveRope(ExecState* exec) const
+{
+ ASSERT(isRope());
+
+ UChar* buffer;
+ if (PassRefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer))
+ m_value = newImpl;
+ else {
+ outOfMemory(exec);
+ return;
+ }
+
+ RopeImpl::Fiber currentFiber = m_fibers[0];
+
+ if ((m_fiberCount > 2) || (RopeImpl::isRope(currentFiber))
+ || ((m_fiberCount == 2) && (RopeImpl::isRope(m_fibers[1])))) {
+ resolveRopeSlowCase(exec, buffer);
+ return;
+ }
+
+ UChar* position = buffer;
+ StringImpl* string = static_cast<StringImpl*>(currentFiber);
+ unsigned length = string->length();
+ StringImpl::copyChars(position, string->characters(), length);
+
+ if (m_fiberCount > 1) {
+ position += length;
+ currentFiber = m_fibers[1];
+ string = static_cast<StringImpl*>(currentFiber);
+ length = string->length();
+ StringImpl::copyChars(position, string->characters(), length);
+ position += length;
+ }
+
+ ASSERT((buffer + m_length) == position);
+ for (unsigned i = 0; i < m_fiberCount; ++i) {
+ RopeImpl::deref(m_fibers[i]);
+ m_fibers[i] = 0;
+ }
+ m_fiberCount = 0;
+
+ ASSERT(!isRope());
+}
+
+// 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::resolveRopeSlowCase(ExecState* exec, UChar* buffer) const
+{
+ UNUSED_PARAM(exec);
+
+ 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_fibers[i]);
+ currentFiber = 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_fibers[i]);
+ m_fibers[i] = 0;
+ }
+ m_fiberCount = 0;
+
+ ASSERT(!isRope());
+ return;
+ }
+
+ // No! - set the next item up to process.
+ currentFiber = workQueue.last();
+ workQueue.removeLast();
+ }
+ }
+}
+
+void JSString::outOfMemory(ExecState* exec) const
+{
+ for (unsigned i = 0; i < m_fiberCount; ++i) {
+ RopeImpl::deref(m_fibers[i]);
+ m_fibers[i] = 0;
+ }
+ m_fiberCount = 0;
+ ASSERT(!isRope());
+ ASSERT(m_value == UString());
+ if (exec)
+ throwOutOfMemoryError(exec);
+}
+
+// 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_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 <= maxSingleCharacterString)
+ 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_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_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, JSGlobalObject* globalObject, JSString* string)
+{
+ return new (exec) StringObject(exec->globalData(), globalObject->stringObjectStructure(), string);
+}
+
+JSObject* JSString::toObject(ExecState* exec, JSGlobalObject* globalObject) const
+{
+ return StringObject::create(exec, globalObject, const_cast<JSString*>(this));
+}
+
+JSObject* JSString::toThisObject(ExecState* exec) const
+{
+ return StringObject::create(exec, exec->lexicalGlobalObject(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.h
new file mode 100644
index 0000000..0ac64bd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.h
@@ -0,0 +1,614 @@
+/*
+ * 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 "PropertyDescriptor.h"
+#include "PropertySlot.h"
+#include "RopeImpl.h"
+#include "Structure.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&);
+
+ 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_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, 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, 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, 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, globalData->stringStructure.get())
+ , m_length(rope->length())
+ , m_fiberCount(1)
+ {
+ 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, 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, 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, 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(), 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, 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, 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()
+ {
+ ASSERT(vptr() == JSGlobalData::jsStringVPtr);
+ for (unsigned i = 0; i < m_fiberCount; ++i)
+ RopeImpl::deref(m_fibers[i]);
+ }
+
+ 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 Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount, &s_info);
+ }
+
+ private:
+ JSString(VPtrStealingHackType)
+ : JSCell(VPtrStealingHack)
+ , m_fiberCount(0)
+ {
+ }
+ static const ClassInfo s_info;
+
+ void resolveRope(ExecState*) const;
+ void resolveRopeSlowCase(ExecState*, UChar*) const;
+ void outOfMemory(ExecState*) const;
+ JSString* substringFromRope(ExecState*, unsigned offset, unsigned length);
+
+ void appendStringInConstruct(unsigned& index, const UString& string)
+ {
+ StringImpl* impl = string.impl();
+ impl->ref();
+ 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_fibers[i];
+ fiber->ref();
+ 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_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*, JSGlobalObject*) 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;
+ mutable FixedArray<RopeImpl::Fiber, s_maxInternalRopeLength> m_fibers;
+
+ 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* 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 <= maxSingleCharacterString)
+ 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 <= maxSingleCharacterString)
+ 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 <= maxSingleCharacterString)
+ return globalData->smallStrings.singleCharacterString(globalData, c);
+ }
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, s));
+ }
+
+ 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 <= maxSingleCharacterString)
+ 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 <= maxSingleCharacterString)
+ 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
+ {
+ ASSERT(!isString());
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStringBuilder.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSStringBuilder.h
new file mode 100644
index 0000000..49d4a63
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSType.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSType.h
new file mode 100644
index 0000000..dba03f6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSType.h
@@ -0,0 +1,45 @@
+/*
+ * 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,
+ LeafType = 6,
+ // The CompoundType value must come before any JSType that may have children
+ CompoundType = 7,
+ ObjectType = 8,
+ GetterSetterType = 9
+ };
+
+} // namespace JSC
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSTypeInfo.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSTypeInfo.h
new file mode 100644
index 0000000..a18c757
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSTypeInfo.h
@@ -0,0 +1,93 @@
+// -*- 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 OverridesVisitChildren = 1 << 6;
+ static const unsigned OverridesGetPropertyNames = 1 << 7;
+ static const unsigned IsJSFinalObject = 1 << 8;
+
+ class TypeInfo {
+ public:
+ TypeInfo(JSType type, unsigned flags = 0)
+ : m_type(type)
+ , m_flags(flags & 0xFF)
+ , m_flags2(flags >> 8)
+ {
+ ASSERT(flags <= 0x1FF);
+ ASSERT(type <= 0xFF);
+ ASSERT(type >= CompoundType || !(flags & OverridesVisitChildren));
+ // ImplementsDefaultHasInstance means (ImplementsHasInstance & !OverridesHasInstance)
+ if ((m_flags & (ImplementsHasInstance | OverridesHasInstance)) == ImplementsHasInstance)
+ m_flags |= ImplementsDefaultHasInstance;
+ }
+
+ 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 overridesVisitChildren() const { return m_flags & OverridesVisitChildren; }
+ bool overridesGetPropertyNames() const { return m_flags & OverridesGetPropertyNames; }
+ unsigned flags() const { return m_flags; }
+ unsigned isFinal() const { return m_flags2 && (IsJSFinalObject >> 8); }
+
+ static ptrdiff_t flagsOffset()
+ {
+ return OBJECT_OFFSETOF(TypeInfo, m_flags);
+ }
+
+ static ptrdiff_t typeOffset()
+ {
+ return OBJECT_OFFSETOF(TypeInfo, m_type);
+ }
+
+ private:
+ unsigned char m_type;
+ unsigned char m_flags;
+ unsigned char m_flags2;
+ };
+
+}
+
+#endif // JSTypeInfo_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.cpp
new file mode 100644
index 0000000..d3ee89e
--- /dev/null
+++ b/src/3rdparty/webkit/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, JSGlobalObject* globalObject) const
+{
+ ASSERT(!isCell());
+
+ if (isInt32() || isDouble())
+ return constructNumber(exec, globalObject, asValue());
+ if (isTrue() || isFalse())
+ return constructBooleanFromImmediateBoolean(exec, globalObject, 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, exec->lexicalGlobalObject(), asValue());
+ if (isTrue() || isFalse())
+ return constructBooleanFromImmediateBoolean(exec, exec->lexicalGlobalObject(), asValue());
+ ASSERT(isUndefinedOrNull());
+ return exec->globalThisValue();
+}
+
+JSObject* JSValue::synthesizeObject(ExecState* exec) const
+{
+ ASSERT(!isCell());
+ if (isNumber())
+ return constructNumber(exec, exec->lexicalGlobalObject(), asValue());
+ if (isBoolean())
+ return constructBooleanFromImmediateBoolean(exec, exec->lexicalGlobalObject(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.h
new file mode 100644
index 0000000..de50011
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.h
@@ -0,0 +1,471 @@
+/*
+ * 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>
+#include <wtf/StdLibExtras.h>
+
+namespace JSC {
+
+ extern const double NaN;
+ extern const double Inf;
+
+ class ExecState;
+ class Identifier;
+ class JSCell;
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSObject;
+ class JSString;
+ class PropertySlot;
+ class PutPropertySlot;
+ class UString;
+
+ struct ClassInfo;
+ struct Instruction;
+
+ template <class T> class WriteBarrierBase;
+
+ enum PreferredPrimitiveType { NoPreference, PreferNumber, PreferString };
+
+
+#if USE(JSVALUE32_64)
+ typedef int64_t EncodedJSValue;
+#else
+ typedef void* EncodedJSValue;
+#endif
+
+ union EncodedValueDescriptor {
+ int64_t asInt64;
+#if USE(JSVALUE32_64)
+ double asDouble;
+#elif USE(JSVALUE64)
+ JSCell* ptr;
+#endif
+
+#if CPU(BIG_ENDIAN)
+ struct {
+ int32_t tag;
+ int32_t payload;
+ } asBits;
+#else
+ struct {
+ int32_t payload;
+ int32_t tag;
+ } asBits;
+#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 struct EncodedJSValueHashTraits;
+ friend class JIT;
+ friend class JITStubs;
+ friend class JITStubCall;
+ friend class JSInterfaceJIT;
+ friend class SpecializedThunkJIT;
+
+ public:
+ static EncodedJSValue encode(JSValue);
+ static JSValue decode(EncodedJSValue);
+
+ 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;
+ JSObject* toObject(ExecState*, JSGlobalObject*) 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:
+ template <class T> JSValue(WriteBarrierBase<T>);
+
+ enum HashTableDeletedValueTag { HashTableDeletedValue };
+ JSValue(HashTableDeletedValueTag);
+
+ inline const JSValue asValue() const { return *this; }
+ JSObject* toObjectSlowCase(ExecState*, JSGlobalObject*) const;
+ JSObject* toThisObjectSlowCase(ExecState*) const;
+
+ JSObject* synthesizePrototype(ExecState*) const;
+ JSObject* synthesizeObject(ExecState*) const;
+
+#if USE(JSVALUE32_64)
+ /*
+ * On 32-bit platforms USE(JSVALUE32_64) should be defined, and we use a NaN-encoded
+ * form for immediates.
+ *
+ * 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).
+ *
+ * For JSValues that do not contain a double value, the high 32 bits contain the tag
+ * values listed in the enums below, which all correspond to NaN-space. In the case of
+ * cell, integer and bool values the lower 32 bits (the 'payload') contain the pointer
+ * integer or boolean value; in the case of all other tags the payload is 0.
+ */
+ enum { Int32Tag = 0xffffffff };
+ enum { BooleanTag = 0xfffffffe };
+ enum { NullTag = 0xfffffffd };
+ enum { UndefinedTag = 0xfffffffc };
+ enum { CellTag = 0xfffffffb };
+ enum { EmptyValueTag = 0xfffffffa };
+ enum { DeletedValueTag = 0xfffffff9 };
+
+ enum { LowestTag = DeletedValueTag };
+
+ uint32_t tag() const;
+ int32_t payload() const;
+#elif USE(JSVALUE64)
+ /*
+ * On 64-bit platforms USE(JSVALUE64) should be defined, and we use a NaN-encoded
+ * form for immediates.
+ *
+ * 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 top 16-bits denote the type of the encoded JSValue:
+ *
+ * Pointer { 0000:PPPP:PPPP:PPPP
+ * / 0001:****:****:****
+ * Double { ...
+ * \ FFFE:****:****:****
+ * Integer { FFFF:0000:IIII:IIII
+ *
+ * The scheme we have implemented encodes double precision values by performing a
+ * 64-bit integer addition of the value 2^48 to the number. After this manipulation
+ * no encoded double-precision value will begin with the pattern 0x0000 or 0xFFFF.
+ * Values must be decoded by reversing this operation before subsequent floating point
+ * operations my be peformed.
+ *
+ * 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 represented by specific, invalid pointer values:
+ *
+ * False: 0x06
+ * True: 0x07
+ * Undefined: 0x0a
+ * Null: 0x02
+ *
+ * These values have the following properties:
+ * - Bit 1 (TagBitTypeOther) is set for all four values, allowing real pointers to be
+ * quickly distinguished from all immediate values, including these invalid pointers.
+ * - With bit 3 is masked out (TagBitUndefined) Undefined and Null share the
+ * same value, allowing null & undefined to be quickly detected.
+ *
+ * No valid JSValue will have the bit pattern 0x0, this is used to represent array
+ * holes, and as a C++ 'no value' result (e.g. JSValue() has an internal value of 0).
+ */
+
+ // These values are #defines since using static const integers here is a ~1% regression!
+
+ // 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.
+ #define DoubleEncodeOffset 0x1000000000000ll
+ // 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.
+ #define TagTypeNumber 0xffff000000000000ll
+
+ // All non-numeric (bool, null, undefined) immediates have bit 2 set.
+ #define TagBitTypeOther 0x2ll
+ #define TagBitBool 0x4ll
+ #define TagBitUndefined 0x8ll
+ // Combined integer value for non-numeric immediates.
+ #define ValueFalse (TagBitTypeOther | TagBitBool | false)
+ #define ValueTrue (TagBitTypeOther | TagBitBool | true)
+ #define ValueUndefined (TagBitTypeOther | TagBitUndefined)
+ #define ValueNull (TagBitTypeOther)
+
+ // TagMask is used to check for all types of immediate values (either number or 'other').
+ #define TagMask (TagTypeNumber | TagBitTypeOther)
+
+ // These special values are never visible to JavaScript code; Empty is used to represent
+ // Array holes, and for uninitialized JSValues. Deleted is used in hash table code.
+ // These values would map to cell types in the JSValue encoding, but not valid GC cell
+ // pointer should have either of these values (Empty is null, deleted is at an invalid
+ // alignment for a GC cell, and in the zero page).
+ #define ValueEmpty 0x0ll
+ #define ValueDeleted 0x4ll
+#endif
+
+ EncodedValueDescriptor u;
+ };
+
+#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; }
+
+ bool isZombie(const JSCell*);
+
+} // namespace JSC
+
+#endif // JSValue_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h
new file mode 100644
index 0000000..b4f6f80
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h
@@ -0,0 +1,532 @@
+/*
+ * 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 JSValueInlineMethods_h
+#define JSValueInlineMethods_h
+
+#include "JSValue.h"
+
+namespace JSC {
+
+ 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);
+ }
+
+ inline bool JSValue::isUInt32() const
+ {
+ return isInt32() && asInt32() >= 0;
+ }
+
+ inline uint32_t JSValue::asUInt32() const
+ {
+ ASSERT(isUInt32());
+ return asInt32();
+ }
+
+ 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 JSValue jsNaN()
+ {
+ return JSValue(nonInlineNaN());
+ }
+
+ inline bool JSValue::getNumber(double& result) const
+ {
+ if (isInt32()) {
+ result = asInt32();
+ return true;
+ }
+ if (isDouble()) {
+ result = asDouble();
+ return true;
+ }
+ return false;
+ }
+
+ inline bool JSValue::getBoolean(bool& v) const
+ {
+ if (isTrue()) {
+ v = true;
+ return true;
+ }
+ if (isFalse()) {
+ v = false;
+ return true;
+ }
+
+ return false;
+ }
+
+ 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(unsigned i)
+ {
+ if (static_cast<int32_t>(i) < 0) {
+ *this = JSValue(EncodeAsDouble, 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(EncodeAsDouble, 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(EncodeAsDouble, 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(EncodeAsDouble, 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(EncodeAsDouble, static_cast<double>(i));
+ return;
+ }
+ *this = JSValue(static_cast<uint32_t>(i));
+ }
+
+ inline JSValue::JSValue(double d)
+ {
+ const int32_t asInt32 = static_cast<int32_t>(d);
+ if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0
+ *this = JSValue(EncodeAsDouble, d);
+ return;
+ }
+ *this = JSValue(static_cast<int32_t>(d));
+ }
+
+#if USE(JSVALUE32_64)
+ inline EncodedJSValue JSValue::encode(JSValue value)
+ {
+ return value.u.asInt64;
+ }
+
+ inline JSValue JSValue::decode(EncodedJSValue encodedJSValue)
+ {
+ JSValue v;
+ v.u.asInt64 = encodedJSValue;
+ 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 = BooleanTag;
+ u.asBits.payload = 1;
+ }
+
+ inline JSValue::JSValue(JSFalseTag)
+ {
+ u.asBits.tag = BooleanTag;
+ 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.asInt64 == other.u.asInt64;
+ }
+
+ inline bool JSValue::operator!=(const JSValue& other) const
+ {
+ return u.asInt64 != other.u.asInt64;
+ }
+
+ 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::isDouble() const
+ {
+ return tag() < LowestTag;
+ }
+
+ inline bool JSValue::isTrue() const
+ {
+ return tag() == BooleanTag && payload();
+ }
+
+ inline bool JSValue::isFalse() const
+ {
+ return tag() == BooleanTag && !payload();
+ }
+
+ 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 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(int i)
+ {
+ u.asBits.tag = Int32Tag;
+ u.asBits.payload = i;
+ }
+
+ inline bool JSValue::isNumber() const
+ {
+ return isInt32() || isDouble();
+ }
+
+ inline bool JSValue::isBoolean() const
+ {
+ return isTrue() || isFalse();
+ }
+
+ inline bool JSValue::getBoolean() const
+ {
+ ASSERT(isBoolean());
+ return payload();
+ }
+
+#else // USE(JSVALUE32_64)
+
+ // JSValue member functions.
+ inline EncodedJSValue JSValue::encode(JSValue value)
+ {
+ return value.u.ptr;
+ }
+
+ inline JSValue JSValue::decode(EncodedJSValue ptr)
+ {
+ return JSValue(reinterpret_cast<JSCell*>(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()
+ {
+ u.asInt64 = ValueEmpty;
+ }
+
+ // 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)
+ {
+ u.asInt64 = ValueDeleted;
+ }
+
+ inline JSValue::JSValue(JSCell* ptr)
+ {
+ u.ptr = ptr;
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+#endif
+ }
+
+ inline JSValue::JSValue(const JSCell* ptr)
+ {
+ u.ptr = const_cast<JSCell*>(ptr);
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+#endif
+ }
+
+ inline JSValue::operator bool() const
+ {
+ return u.ptr;
+ }
+
+ inline bool JSValue::operator==(const JSValue& other) const
+ {
+ return u.ptr == other.u.ptr;
+ }
+
+ inline bool JSValue::operator!=(const JSValue& other) const
+ {
+ return u.ptr != other.u.ptr;
+ }
+
+ inline bool JSValue::isUndefined() const
+ {
+ return asValue() == jsUndefined();
+ }
+
+ inline bool JSValue::isNull() const
+ {
+ return asValue() == jsNull();
+ }
+
+ inline bool JSValue::isTrue() const
+ {
+ return asValue() == JSValue(JSTrue);
+ }
+
+ inline bool JSValue::isFalse() const
+ {
+ return asValue() == JSValue(JSFalse);
+ }
+
+ inline bool JSValue::getBoolean() const
+ {
+ ASSERT(asValue() == jsBoolean(true) || asValue() == jsBoolean(false));
+ return asValue() == jsBoolean(true);
+ }
+
+ inline int32_t JSValue::asInt32() const
+ {
+ ASSERT(isInt32());
+ return static_cast<int32_t>(u.asInt64);
+ }
+
+ inline bool JSValue::isDouble() const
+ {
+ return isNumber() && !isInt32();
+ }
+
+ inline JSValue::JSValue(JSNullTag)
+ {
+ u.asInt64 = ValueNull;
+ }
+
+ inline JSValue::JSValue(JSUndefinedTag)
+ {
+ u.asInt64 = ValueUndefined;
+ }
+
+ inline JSValue::JSValue(JSTrueTag)
+ {
+ u.asInt64 = ValueTrue;
+ }
+
+ inline JSValue::JSValue(JSFalseTag)
+ {
+ u.asInt64 = ValueFalse;
+ }
+
+ inline bool JSValue::isUndefinedOrNull() const
+ {
+ // Undefined and null share the same value, bar the 'undefined' bit in the extended tag.
+ return (u.asInt64 & ~TagBitUndefined) == ValueNull;
+ }
+
+ inline bool JSValue::isBoolean() const
+ {
+ return (u.asInt64 & ~1) == ValueFalse;
+ }
+
+ inline bool JSValue::isCell() const
+ {
+ return !(u.asInt64 & TagMask);
+ }
+
+ inline bool JSValue::isInt32() const
+ {
+ return (u.asInt64 & TagTypeNumber) == TagTypeNumber;
+ }
+
+ inline intptr_t reinterpretDoubleToIntptr(double value)
+ {
+ return bitwise_cast<intptr_t>(value);
+ }
+ inline double reinterpretIntptrToDouble(intptr_t value)
+ {
+ return bitwise_cast<double>(value);
+ }
+
+ ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d)
+ {
+ u.asInt64 = reinterpretDoubleToIntptr(d) + DoubleEncodeOffset;
+ }
+
+ inline JSValue::JSValue(int i)
+ {
+ u.asInt64 = TagTypeNumber | static_cast<uint32_t>(i);
+ }
+
+ inline double JSValue::asDouble() const
+ {
+ return reinterpretIntptrToDouble(u.asInt64 - DoubleEncodeOffset);
+ }
+
+ inline bool JSValue::isNumber() const
+ {
+ return u.asInt64 & TagTypeNumber;
+ }
+
+ ALWAYS_INLINE JSCell* JSValue::asCell() const
+ {
+ ASSERT(isCell());
+ return u.ptr;
+ }
+
+#endif // USE(JSVALUE64)
+
+} // namespace JSC
+
+#endif // JSValueInlineMethods_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSVariableObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSVariableObject.cpp
new file mode 100644
index 0000000..abe9bbb
--- /dev/null
+++ b/src/3rdparty/webkit/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()).get(), entry.getAttributes() | DontDelete);
+ return true;
+ }
+ return false;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSVariableObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSVariableObject.h
new file mode 100644
index 0000000..89bb6b0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSVariableObject.h
@@ -0,0 +1,160 @@
+/*
+ * 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 JSNonFinalObject {
+ friend class JIT;
+
+ public:
+ SymbolTable& symbolTable() const { return *m_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;
+
+ WriteBarrier<Unknown>& registerAt(int index) const { return m_registers[index]; }
+
+ WriteBarrier<Unknown>* const * addressOfRegisters() const { return &m_registers; }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetPropertyNames | JSObject::StructureFlags;
+
+ JSVariableObject(JSGlobalData& globalData, Structure* structure, SymbolTable* symbolTable, Register* registers)
+ : JSNonFinalObject(globalData, structure)
+ , m_symbolTable(symbolTable)
+ , m_registers(reinterpret_cast<WriteBarrier<Unknown>*>(registers))
+ {
+ ASSERT(m_symbolTable);
+ COMPILE_ASSERT(sizeof(WriteBarrier<Unknown>) == sizeof(Register), Register_should_be_same_size_as_WriteBarrier);
+ }
+
+ PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts);
+ void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray);
+
+ bool symbolTableGet(const Identifier&, PropertySlot&);
+ bool symbolTableGet(const Identifier&, PropertyDescriptor&);
+ bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
+ bool symbolTablePut(JSGlobalData&, const Identifier&, JSValue);
+ bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes);
+
+ SymbolTable* m_symbolTable; // Maps name -> offset from "r" in register file.
+ WriteBarrier<Unknown>* m_registers; // "r" in the register file.
+ OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
+ };
+
+ inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
+ {
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (!entry.isNull()) {
+ slot.setValue(registerAt(entry.getIndex()).get());
+ 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.setValue(registerAt(entry.getIndex()).get());
+ slotIsWriteable = !entry.isReadOnly();
+ return true;
+ }
+ return false;
+ }
+
+ inline bool JSVariableObject::symbolTablePut(JSGlobalData& globalData, 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()).set(globalData, this, value);
+ return true;
+ }
+
+ inline bool JSVariableObject::symbolTablePutWithAttributes(JSGlobalData& globalData, 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()).set(globalData, this, value);
+ return true;
+ }
+
+ inline PassOwnArrayPtr<WriteBarrier<Unknown> > JSVariableObject::copyRegisterArray(JSGlobalData& globalData, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts)
+ {
+ OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[count]);
+ for (size_t i = 0; i < callframeStarts; i++)
+ registerArray[i].set(globalData, this, src[i].get());
+ for (size_t i = callframeStarts + RegisterFile::CallFrameHeaderSize; i < count; i++)
+ registerArray[i].set(globalData, this, src[i].get());
+
+ return registerArray.release();
+ }
+
+ inline void JSVariableObject::setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray)
+ {
+ ASSERT(registerArray != m_registerArray);
+ m_registerArray = registerArray;
+ m_registers = registers;
+ }
+
+} // namespace JSC
+
+#endif // JSVariableObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSWrapperObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSWrapperObject.cpp
new file mode 100644
index 0000000..2bf4a90
--- /dev/null
+++ b/src/3rdparty/webkit/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::visitChildren(SlotVisitor& visitor)
+{
+ JSObject::visitChildren(visitor);
+ if (m_internalValue)
+ visitor.append(&m_internalValue);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSWrapperObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSWrapperObject.h
new file mode 100644
index 0000000..8972648
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSWrapperObject.h
@@ -0,0 +1,72 @@
+/*
+ * 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 JSNonFinalObject {
+ protected:
+ explicit JSWrapperObject(JSGlobalData&, Structure*);
+
+ public:
+ JSValue internalValue() const;
+ void setInternalValue(JSGlobalData&, JSValue);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesVisitChildren | JSNonFinalObject::StructureFlags;
+
+ private:
+ virtual void visitChildren(SlotVisitor&);
+
+ WriteBarrier<Unknown> m_internalValue;
+ };
+
+ inline JSWrapperObject::JSWrapperObject(JSGlobalData& globalData, Structure* structure)
+ : JSNonFinalObject(globalData, structure)
+ {
+ }
+
+ inline JSValue JSWrapperObject::internalValue() const
+ {
+ return m_internalValue.get();
+ }
+
+ inline void JSWrapperObject::setInternalValue(JSGlobalData& globalData, JSValue value)
+ {
+ ASSERT(value);
+ ASSERT(!value.isObject());
+ m_internalValue.set(globalData, this, value);
+ }
+
+} // namespace JSC
+
+#endif // JSWrapperObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.cpp
new file mode 100644
index 0000000..efabc93
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.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 "JSZombie.h"
+#include "ClassInfo.h"
+#include "JSObject.h"
+#include "ScopeChain.h"
+
+#if ENABLE(JSC_ZOMBIES)
+
+namespace JSC {
+
+const ClassInfo JSZombie::s_info = { "Zombie", 0, 0, 0 };
+
+}
+
+#endif // ENABLE(JSC_ZOMBIES)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.h
new file mode 100644
index 0000000..795036e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSZombie.h
@@ -0,0 +1,84 @@
+/*
+ * 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"
+#include "Structure.h"
+
+#if ENABLE(JSC_ZOMBIES)
+namespace JSC {
+
+class JSZombie : public JSCell {
+public:
+ JSZombie(JSGlobalData& globalData, const ClassInfo* oldInfo, Structure* structure)
+ : JSCell(globalData, structure)
+ , m_oldInfo(oldInfo)
+ {
+ ASSERT(inherits(&s_info));
+ }
+
+ virtual bool isZombie() const { return true; }
+
+ 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 visitChildren(SlotVisitor&) { 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 Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(LeafType, 0), AnonymousSlotCount, &s_info);
+ }
+
+ static const ClassInfo s_info;
+
+private:
+ const ClassInfo* m_oldInfo;
+};
+
+}
+
+#endif // ENABLE(JSC_ZOMBIES)
+
+#endif // JSZombie_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/LiteralParser.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/LiteralParser.cpp
new file mode 100644
index 0000000..bc2e736
--- /dev/null
+++ b/src/3rdparty/webkit/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(m_exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/LiteralParser.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/LiteralParser.h
new file mode 100644
index 0000000..6df5d06
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.cpp
new file mode 100644
index 0000000..25b516e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.cpp
@@ -0,0 +1,95 @@
+/*
+ * 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"
+
+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);
+ WriteBarrierBase<Unknown>* location = thisObj->getDirectLocation(exec->globalData(), propertyName);
+
+ if (!location) {
+ JSFunction* function;
+ JSGlobalObject* globalObject = asGlobalObject(thisObj->getAnonymousValue(0).asCell());
+#if ENABLE(JIT) && ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+ if (entry->generator())
+ function = new (exec) JSFunction(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, exec->globalData().getHostFunction(entry->function(), entry->generator()));
+ else
+#endif
+ function = new (exec) JSFunction(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, entry->function());
+
+ thisObj->putDirectFunction(exec->globalData(), propertyName, function, entry->attributes());
+ location = thisObj->getDirectLocation(exec->globalData(), propertyName);
+ }
+
+ slot.setValue(thisObj, location->get(), thisObj->offsetForLocation(location));
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.h
new file mode 100644
index 0000000..43184e5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Lookup.h
@@ -0,0 +1,339 @@
+/*
+ * 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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(exec->globalData(), propertyName, value.asCell());
+ else
+ thisObj->putDirect(exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.cpp
new file mode 100644
index 0000000..52bd76a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.cpp
@@ -0,0 +1,243 @@
+/*
+ * 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::s_info = { "Math", &JSObjectWithGlobalObject::s_info, 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, Structure* structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+ ASSERT(inherits(&s_info));
+
+ putDirectWithoutTransition(exec->globalData(), Identifier(exec, "E"), jsNumber(exp(1.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(exec->globalData(), Identifier(exec, "LN2"), jsNumber(log(2.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(exec->globalData(), Identifier(exec, "LN10"), jsNumber(log(10.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(exec->globalData(), Identifier(exec, "LOG2E"), jsNumber(1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(exec->globalData(), Identifier(exec, "LOG10E"), jsNumber(0.4342944819032518), DontDelete | DontEnum | ReadOnly); // See ECMA-262 15.8.1.5
+ putDirectWithoutTransition(exec->globalData(), Identifier(exec, "PI"), jsNumber(piDouble), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(exec->globalData(), Identifier(exec, "SQRT1_2"), jsNumber(sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.h
new file mode 100644
index 0000000..75753be
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MathObject.h
@@ -0,0 +1,48 @@
+/*
+ * 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*, Structure*);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
+ };
+
+} // namespace JSC
+
+#endif // MathObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.cpp
new file mode 100644
index 0000000..86101f5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.cpp
@@ -0,0 +1,50 @@
+/*
+ * 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 {
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.h
new file mode 100644
index 0000000..d4b8b6f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/MemoryStatistics.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 MemoryStatistics_h
+#define MemoryStatistics_h
+
+#include "Heap.h"
+
+class JSGlobalData;
+
+namespace JSC {
+
+struct GlobalMemoryStatistics {
+ size_t stackBytes;
+ size_t JITBytes;
+};
+
+GlobalMemoryStatistics globalMemoryStatistics();
+
+}
+
+#endif // MemoryStatistics_h
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
new file mode 100644
index 0000000..5c4f009
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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::s_info = { "Function", &InternalFunction::s_info, 0, 0 };
+
+NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& nameAndMessage)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, nameAndMessage))
+{
+ ASSERT(inherits(&s_info));
+
+ NativeErrorPrototype* prototype = new (exec) NativeErrorPrototype(exec, globalObject, prototypeStructure, nameAndMessage, this);
+
+ putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
+ putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
+ m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), prototype));
+ ASSERT(m_errorStructure);
+ ASSERT(m_errorStructure->typeInfo().type() == ObjectType);
+}
+
+void NativeErrorConstructor::visitChildren(SlotVisitor& visitor)
+{
+ InternalFunction::visitChildren(visitor);
+ if (m_errorStructure)
+ visitor.append(&m_errorStructure);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecState* exec)
+{
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure();
+ ASSERT(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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.h
new file mode 100644
index 0000000..4fb16f1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorConstructor.h
@@ -0,0 +1,56 @@
+/*
+ * 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*, Structure*, Structure* prototypeStructure, const UString&);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ Structure* errorStructure() { return m_errorStructure.get(); }
+
+ private:
+ static const unsigned StructureFlags = OverridesVisitChildren | InternalFunction::StructureFlags;
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ virtual void visitChildren(SlotVisitor&);
+
+ WriteBarrier<Structure> m_errorStructure;
+ };
+
+} // namespace JSC
+
+#endif // NativeErrorConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp
new file mode 100644
index 0000000..de27d59
--- /dev/null
+++ b/src/3rdparty/webkit/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, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+ putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, nameAndMessage), 0);
+ putDirect(exec->globalData(), exec->propertyNames().message, jsString(exec, nameAndMessage), 0);
+ putDirect(exec->globalData(), exec->propertyNames().constructor, constructor, DontEnum);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NativeErrorPrototype.h
new file mode 100644
index 0000000..e1b05ce
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, const UString&, NativeErrorConstructor*);
+ };
+
+} // namespace JSC
+
+#endif // NativeErrorPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.cpp
new file mode 100644
index 0000000..4193f79
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.cpp
@@ -0,0 +1,131 @@
+/*
+ * 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::s_info = { "Function", &InternalFunction::s_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, Structure* structure, NumberPrototype* numberPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, numberPrototype->s_info.className))
+{
+ ASSERT(inherits(&s_info));
+
+ // Number.Prototype
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->globalData(), 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->globalData(), asInternalFunction(exec->callee())->globalObject()->numberObjectStructure());
+ double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0;
+ object->setInternalValue(exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.h
new file mode 100644
index 0000000..69aa8a1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberConstructor.h
@@ -0,0 +1,57 @@
+/*
+ * 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*, 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 s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // NumberConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.cpp
new file mode 100644
index 0000000..6ee103b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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::s_info = { "Number", &JSWrapperObject::s_info, 0, 0 };
+
+NumberObject::NumberObject(JSGlobalData& globalData, Structure* structure)
+ : JSWrapperObject(globalData, structure)
+{
+ ASSERT(inherits(&s_info));
+}
+
+JSValue NumberObject::getJSNumber()
+{
+ return internalValue();
+}
+
+NumberObject* constructNumber(ExecState* exec, JSGlobalObject* globalObject, JSValue number)
+{
+ NumberObject* object = new (exec) NumberObject(exec->globalData(), globalObject->numberObjectStructure());
+ object->setInternalValue(exec->globalData(), number);
+ return object;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.h
new file mode 100644
index 0000000..cba65dd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberObject.h
@@ -0,0 +1,47 @@
+/*
+ * 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(JSGlobalData&, Structure*);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ private:
+ virtual JSValue getJSNumber();
+ };
+
+ NumberObject* constructNumber(ExecState*, JSGlobalObject*, JSValue);
+
+} // namespace JSC
+
+#endif // NumberObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberPrototype.cpp
new file mode 100644
index 0000000..24532dd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -0,0 +1,309 @@
+/*
+ * 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 "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, Structure* structure, Structure* functionStructure)
+ : NumberObject(exec->globalData(), structure)
+{
+ setInternalValue(exec->globalData(), jsNumber(0));
+
+ // The constructor will be added later, after NumberConstructor has been constructed
+
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumberPrototype.h
new file mode 100644
index 0000000..45bdfe7
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, Structure* functionStructure);
+ };
+
+} // namespace JSC
+
+#endif // NumberPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumericStrings.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/NumericStrings.h
new file mode 100644
index 0000000..d65f142
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
new file mode 100644
index 0000000..c325fa0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -0,0 +1,404 @@
+/*
+ * 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 "Lookup.h"
+#include "ObjectPrototype.h"
+#include "PropertyDescriptor.h"
+#include "PropertyNameArray.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*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorSeal(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorFreeze(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorPreventExtensions(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorIsSealed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorIsFrozen(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorIsExtensible(ExecState*);
+
+}
+
+#include "ObjectConstructor.lut.h"
+
+namespace JSC {
+
+const ClassInfo ObjectConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::objectConstructorTable };
+
+/* Source for ObjectConstructor.lut.h
+@begin objectConstructorTable
+ getPrototypeOf objectConstructorGetPrototypeOf DontEnum|Function 1
+ getOwnPropertyDescriptor objectConstructorGetOwnPropertyDescriptor DontEnum|Function 2
+ getOwnPropertyNames objectConstructorGetOwnPropertyNames DontEnum|Function 1
+ keys objectConstructorKeys DontEnum|Function 1
+ defineProperty objectConstructorDefineProperty DontEnum|Function 3
+ defineProperties objectConstructorDefineProperties DontEnum|Function 2
+ create objectConstructorCreate DontEnum|Function 2
+ seal objectConstructorSeal DontEnum|Function 1
+ freeze objectConstructorFreeze DontEnum|Function 1
+ preventExtensions objectConstructorPreventExtensions DontEnum|Function 1
+ isSealed objectConstructorIsSealed DontEnum|Function 1
+ isFrozen objectConstructorIsFrozen DontEnum|Function 1
+ isExtensible objectConstructorIsExtensible DontEnum|Function 1
+@end
+*/
+
+ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objectPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object"))
+{
+ // ECMA 15.2.3.1
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+}
+
+bool ObjectConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
+{
+ return getStaticFunctionSlot<JSObject>(exec, ExecState::objectConstructorTable(exec), this, propertyName, slot);
+}
+
+bool ObjectConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, ExecState::objectConstructorTable(exec), this, propertyName, descriptor);
+}
+
+// ECMA 15.2.2
+static ALWAYS_INLINE JSObject* constructObject(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args)
+{
+ JSValue arg = args.at(0);
+ if (arg.isUndefinedOrNull())
+ return constructEmptyObject(exec, globalObject);
+ return arg.toObject(exec, globalObject);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithObjectConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructObject(exec, asInternalFunction(exec->callee())->globalObject(), 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, asInternalFunction(exec->callee())->globalObject(), 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->globalData(), exec->propertyNames().value, descriptor.value() ? descriptor.value() : jsUndefined(), 0);
+ description->putDirect(exec->globalData(), exec->propertyNames().writable, jsBoolean(descriptor.writable()), 0);
+ } else {
+ description->putDirect(exec->globalData(), exec->propertyNames().get, descriptor.getter() ? descriptor.getter() : jsUndefined(), 0);
+ description->putDirect(exec->globalData(), exec->propertyNames().set, descriptor.setter() ? descriptor.setter() : jsUndefined(), 0);
+ }
+
+ description->putDirect(exec->globalData(), exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0);
+ description->putDirect(exec->globalData(), 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."));
+ JSValue proto = exec->argument(0);
+ JSObject* newObject = proto.isObject() ? constructEmptyObject(exec, asObject(proto)->inheritorID(exec->globalData())) : constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure());
+ 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))));
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorSeal(ExecState* exec)
+{
+ JSValue obj = exec->argument(0);
+ if (!obj.isObject())
+ return throwVMError(exec, createTypeError(exec, "Object.seal can only be called on Objects."));
+ asObject(obj)->seal(exec->globalData());
+ return JSValue::encode(obj);
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorFreeze(ExecState* exec)
+{
+ JSValue obj = exec->argument(0);
+ if (!obj.isObject())
+ return throwVMError(exec, createTypeError(exec, "Object.freeze can only be called on Objects."));
+ asObject(obj)->freeze(exec->globalData());
+ return JSValue::encode(obj);
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorPreventExtensions(ExecState* exec)
+{
+ JSValue obj = exec->argument(0);
+ if (!obj.isObject())
+ return throwVMError(exec, createTypeError(exec, "Object.preventExtensions can only be called on Objects."));
+ asObject(obj)->preventExtensions(exec->globalData());
+ return JSValue::encode(obj);
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorIsSealed(ExecState* exec)
+{
+ JSValue obj = exec->argument(0);
+ if (!obj.isObject())
+ return throwVMError(exec, createTypeError(exec, "Object.isSealed can only be called on Objects."));
+ return JSValue::encode(jsBoolean(asObject(obj)->isSealed(exec->globalData())));
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorIsFrozen(ExecState* exec)
+{
+ JSValue obj = exec->argument(0);
+ if (!obj.isObject())
+ return throwVMError(exec, createTypeError(exec, "Object.isFrozen can only be called on Objects."));
+ return JSValue::encode(jsBoolean(asObject(obj)->isFrozen(exec->globalData())));
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorIsExtensible(ExecState* exec)
+{
+ JSValue obj = exec->argument(0);
+ if (!obj.isObject())
+ return throwVMError(exec, createTypeError(exec, "Object.isExtensible can only be called on Objects."));
+ return JSValue::encode(jsBoolean(asObject(obj)->isExtensible()));
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.h
new file mode 100644
index 0000000..6ebafcd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectConstructor.h
@@ -0,0 +1,54 @@
+/*
+ * 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*, Structure*, ObjectPrototype*);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // ObjectConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
new file mode 100644
index 0000000..7469172
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -0,0 +1,164 @@
+/*
+ * 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"
+
+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, Structure* stucture, Structure* functionStructure)
+ : JSNonFinalObject(exec->globalData(), stucture)
+ , m_hasNoPropertiesWithUInt32Names(true)
+{
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
+
+ // Mozilla extensions
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ObjectPrototype.h
new file mode 100644
index 0000000..9fb7fae
--- /dev/null
+++ b/src/3rdparty/webkit/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 JSNonFinalObject {
+ public:
+ ObjectPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure);
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Operations.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Operations.cpp
new file mode 100644
index 0000000..f129a80
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Operations.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Operations.h
new file mode 100644
index 0000000..c102eeb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Operations.h
@@ -0,0 +1,491 @@
+/*
+ * 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 "JSString.h"
+#include "JSValueInlineMethods.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(callFrame->globalData());
+ if (slotBase == cell)
+ slotOffset = cell->structure()->get(callFrame->globalData(), 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(callFrame->globalData());
+
+ ++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->get();
+ if (next == end) {
+ if (isStrictPut && !base->getPropertySlot(callFrame, property, slot))
+ return JSValue();
+ return 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/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
index 558ae28..558ae28 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyDescriptor.h
index ff9f160..ff9f160 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/PropertyDescriptor.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyDescriptor.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyMapHashTable.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyMapHashTable.h
new file mode 100644
index 0000000..0358f1a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyMapHashTable.h
@@ -0,0 +1,557 @@
+/*
+ * 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 "WriteBarrier.h"
+#include <wtf/HashTable.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+
+
+#ifndef NDEBUG
+#define DUMP_PROPERTYMAP_STATS 0
+#else
+#define DUMP_PROPERTYMAP_STATS 0
+#endif
+
+#if DUMP_PROPERTYMAP_STATS
+
+extern int numProbes;
+extern int numCollisions;
+extern int numRehashes;
+extern int numRemoves;
+
+#endif
+
+#define PROPERTY_MAP_DELETED_ENTRY_KEY ((StringImpl*)1)
+
+namespace JSC {
+
+inline bool isPowerOf2(unsigned v)
+{
+ // Taken from http://www.cs.utk.edu/~vose/c-stuff/bithacks.html
+
+ return !(v & (v - 1)) && v;
+}
+
+inline 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;
+}
+
+struct PropertyMapEntry {
+ StringImpl* key;
+ unsigned offset;
+ unsigned attributes;
+ WriteBarrier<JSCell> specificValue;
+
+ PropertyMapEntry(JSGlobalData& globalData, JSCell* owner, StringImpl* key, unsigned offset, unsigned attributes, JSCell* specificValue)
+ : key(key)
+ , offset(offset)
+ , attributes(attributes)
+ , specificValue(globalData, owner, specificValue)
+ {
+ }
+};
+
+class PropertyTable {
+ WTF_MAKE_FAST_ALLOCATED;
+
+ // This is the implementation for 'iterator' and 'const_iterator',
+ // used for iterating over the table in insertion order.
+ template<typename T>
+ class ordered_iterator {
+ public:
+ ordered_iterator<T>& operator++()
+ {
+ m_valuePtr = skipDeletedEntries(m_valuePtr + 1);
+ return *this;
+ }
+
+ bool operator==(const ordered_iterator<T>& other)
+ {
+ return m_valuePtr == other.m_valuePtr;
+ }
+
+ bool operator!=(const ordered_iterator<T>& other)
+ {
+ return m_valuePtr != other.m_valuePtr;
+ }
+
+ T& operator*()
+ {
+ return *m_valuePtr;
+ }
+
+ T* operator->()
+ {
+ return m_valuePtr;
+ }
+
+ ordered_iterator(T* valuePtr)
+ : m_valuePtr(valuePtr)
+ {
+ }
+
+ private:
+ T* m_valuePtr;
+ };
+
+public:
+ typedef StringImpl* KeyType;
+ typedef PropertyMapEntry ValueType;
+
+ // The in order iterator provides overloaded * and -> to access the Value at the current position.
+ typedef ordered_iterator<ValueType> iterator;
+ typedef ordered_iterator<const ValueType> const_iterator;
+
+ // The find_iterator is a pair of a pointer to a Value* an the entry in the index.
+ // If 'find' does not find an entry then iter.first will be 0, and iter.second will
+ // give the point in m_index where an entry should be inserted.
+ typedef std::pair<ValueType*, unsigned> find_iterator;
+
+ // Constructor is passed an initial capacity, a PropertyTable to copy, or both.
+ explicit PropertyTable(unsigned initialCapacity);
+ PropertyTable(JSGlobalData&, JSCell*, const PropertyTable&);
+ PropertyTable(JSGlobalData&, JSCell*, unsigned initialCapacity, const PropertyTable&);
+ ~PropertyTable();
+
+ // Ordered iteration methods.
+ iterator begin();
+ iterator end();
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ // Find a value in the table.
+ find_iterator find(const KeyType& key);
+ // Add a value to the table
+ std::pair<find_iterator, bool> add(const ValueType& entry);
+ // Remove a value from the table.
+ void remove(const find_iterator& iter);
+ void remove(const KeyType& key);
+
+ // Returns the number of values in the hashtable.
+ unsigned size() const;
+
+ // Checks if there are any values in the hashtable.
+ bool isEmpty() const;
+
+ // Number of slots in the property storage array in use, included deletedOffsets.
+ unsigned propertyStorageSize() const;
+
+ // Used to maintain a list of unused entries in the property storage.
+ void clearDeletedOffsets();
+ bool hasDeletedOffset();
+ unsigned getDeletedOffset();
+ void addDeletedOffset(unsigned offset);
+
+ // Copy this PropertyTable, ensuring the copy has at least the capacity provided.
+ PassOwnPtr<PropertyTable> copy(JSGlobalData&, JSCell* owner, unsigned newCapacity);
+
+#ifndef NDEBUG
+ size_t sizeInMemory();
+ void checkConsistency();
+#endif
+
+private:
+ PropertyTable(const PropertyTable&);
+ // Used to insert a value known not to be in the table, and where we know capacity to be available.
+ void reinsert(const ValueType& entry);
+
+ // Rehash the table. Used to grow, or to recover deleted slots.
+ void rehash(unsigned newCapacity);
+
+ // The capacity of the table of values is half of the size of the index.
+ unsigned tableCapacity() const;
+
+ // We keep an extra deleted slot after the array to make iteration work,
+ // and to use for deleted values. Index values into the array are 1-based,
+ // so this is tableCapacity() + 1.
+ // For example, if m_tableSize is 16, then tableCapacity() is 8 - but the
+ // values array is actually 9 long (the 9th used for the deleted value/
+ // iteration guard). The 8 valid entries are numbered 1..8, so the
+ // deleted index is 9 (0 being reserved for empty).
+ unsigned deletedEntryIndex() const;
+
+ // Used in iterator creation/progression.
+ template<typename T>
+ static T* skipDeletedEntries(T* valuePtr);
+
+ // The table of values lies after the hash index.
+ ValueType* table();
+ const ValueType* table() const;
+
+ // total number of used entries in the values array - by either valid entries, or deleted ones.
+ unsigned usedCount() const;
+
+ // The size in bytes of data needed for by the table.
+ size_t dataSize();
+
+ // Calculates the appropriate table size (rounds up to a power of two).
+ static unsigned sizeForCapacity(unsigned capacity);
+
+ // Check if capacity is available.
+ bool canInsert();
+
+ unsigned m_indexSize;
+ unsigned m_indexMask;
+ unsigned* m_index;
+ unsigned m_keyCount;
+ unsigned m_deletedCount;
+ OwnPtr< Vector<unsigned> > m_deletedOffsets;
+
+ static const unsigned MinimumTableSize = 16;
+ static const unsigned EmptyEntryIndex = 0;
+};
+
+inline PropertyTable::PropertyTable(unsigned initialCapacity)
+ : m_indexSize(sizeForCapacity(initialCapacity))
+ , m_indexMask(m_indexSize - 1)
+ , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
+ , m_keyCount(0)
+ , m_deletedCount(0)
+{
+ ASSERT(isPowerOf2(m_indexSize));
+}
+
+inline PropertyTable::PropertyTable(JSGlobalData& globalData, JSCell* owner, const PropertyTable& other)
+ : m_indexSize(other.m_indexSize)
+ , m_indexMask(other.m_indexMask)
+ , m_index(static_cast<unsigned*>(fastMalloc(dataSize())))
+ , m_keyCount(other.m_keyCount)
+ , m_deletedCount(other.m_deletedCount)
+{
+ ASSERT(isPowerOf2(m_indexSize));
+
+ memcpy(m_index, other.m_index, dataSize());
+
+ iterator end = this->end();
+ for (iterator iter = begin(); iter != end; ++iter) {
+ iter->key->ref();
+ writeBarrier(globalData, owner, iter->specificValue.get());
+ }
+
+ // Copy the m_deletedOffsets vector.
+ Vector<unsigned>* otherDeletedOffsets = other.m_deletedOffsets.get();
+ if (otherDeletedOffsets)
+ m_deletedOffsets = adoptPtr(new Vector<unsigned>(*otherDeletedOffsets));
+}
+
+inline PropertyTable::PropertyTable(JSGlobalData& globalData, JSCell* owner, unsigned initialCapacity, const PropertyTable& other)
+ : m_indexSize(sizeForCapacity(initialCapacity))
+ , m_indexMask(m_indexSize - 1)
+ , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
+ , m_keyCount(0)
+ , m_deletedCount(0)
+{
+ ASSERT(isPowerOf2(m_indexSize));
+ ASSERT(initialCapacity >= other.m_keyCount);
+
+ const_iterator end = other.end();
+ for (const_iterator iter = other.begin(); iter != end; ++iter) {
+ ASSERT(canInsert());
+ reinsert(*iter);
+ iter->key->ref();
+ writeBarrier(globalData, owner, iter->specificValue.get());
+ }
+
+ // Copy the m_deletedOffsets vector.
+ Vector<unsigned>* otherDeletedOffsets = other.m_deletedOffsets.get();
+ if (otherDeletedOffsets)
+ m_deletedOffsets = adoptPtr(new Vector<unsigned>(*otherDeletedOffsets));
+}
+
+inline PropertyTable::~PropertyTable()
+{
+ iterator end = this->end();
+ for (iterator iter = begin(); iter != end; ++iter)
+ iter->key->deref();
+
+ fastFree(m_index);
+}
+
+inline PropertyTable::iterator PropertyTable::begin()
+{
+ return iterator(skipDeletedEntries(table()));
+}
+
+inline PropertyTable::iterator PropertyTable::end()
+{
+ return iterator(table() + usedCount());
+}
+
+inline PropertyTable::const_iterator PropertyTable::begin() const
+{
+ return const_iterator(skipDeletedEntries(table()));
+}
+
+inline PropertyTable::const_iterator PropertyTable::end() const
+{
+ return const_iterator(table() + usedCount());
+}
+
+inline PropertyTable::find_iterator PropertyTable::find(const KeyType& key)
+{
+ ASSERT(key);
+ unsigned hash = key->existingHash();
+ unsigned step = 0;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ while (true) {
+ unsigned entryIndex = m_index[hash & m_indexMask];
+ if (entryIndex == EmptyEntryIndex)
+ return std::make_pair((ValueType*)0, hash & m_indexMask);
+ if (key == table()[entryIndex - 1].key)
+ return std::make_pair(&table()[entryIndex - 1], hash & m_indexMask);
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+
+ if (!step)
+ step =WTF::doubleHash(key->existingHash()) | 1;
+ hash += step;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+ }
+}
+
+inline std::pair<PropertyTable::find_iterator, bool> PropertyTable::add(const ValueType& entry)
+{
+ // Look for a value with a matching key already in the array.
+ find_iterator iter = find(entry.key);
+ if (iter.first)
+ return std::make_pair(iter, false);
+
+ // Ref the key
+ entry.key->ref();
+
+ // ensure capacity is available.
+ if (!canInsert()) {
+ rehash(m_keyCount + 1);
+ iter = find(entry.key);
+ ASSERT(!iter.first);
+ }
+
+ // Allocate a slot in the hashtable, and set the index to reference this.
+ unsigned entryIndex = usedCount() + 1;
+ m_index[iter.second] = entryIndex;
+ iter.first = &table()[entryIndex - 1];
+ *iter.first = entry;
+
+ ++m_keyCount;
+ return std::make_pair(iter, true);
+}
+
+inline void PropertyTable::remove(const find_iterator& iter)
+{
+ // Removing a key that doesn't exist does nothing!
+ if (!iter.first)
+ return;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRemoves;
+#endif
+
+ // Replace this one element with the deleted sentinel. Also clear out
+ // the entry so we can iterate all the entries as needed.
+ m_index[iter.second] = deletedEntryIndex();
+ iter.first->key->deref();
+ iter.first->key = PROPERTY_MAP_DELETED_ENTRY_KEY;
+
+ ASSERT(m_keyCount >= 1);
+ --m_keyCount;
+ ++m_deletedCount;
+
+ if (m_deletedCount * 4 >= m_indexSize)
+ rehash(m_keyCount);
+}
+
+inline void PropertyTable::remove(const KeyType& key)
+{
+ remove(find(key));
+}
+
+// returns the number of values in the hashtable.
+inline unsigned PropertyTable::size() const
+{
+ return m_keyCount;
+}
+
+inline bool PropertyTable::isEmpty() const
+{
+ return !m_keyCount;
+}
+
+inline unsigned PropertyTable::propertyStorageSize() const
+{
+ return size() + (m_deletedOffsets ? m_deletedOffsets->size() : 0);
+}
+
+inline void PropertyTable::clearDeletedOffsets()
+{
+ m_deletedOffsets.clear();
+}
+
+inline bool PropertyTable::hasDeletedOffset()
+{
+ return m_deletedOffsets && !m_deletedOffsets->isEmpty();
+}
+
+inline unsigned PropertyTable::getDeletedOffset()
+{
+ unsigned offset = m_deletedOffsets->last();
+ m_deletedOffsets->removeLast();
+ return offset;
+}
+
+inline void PropertyTable::addDeletedOffset(unsigned offset)
+{
+ if (!m_deletedOffsets)
+ m_deletedOffsets = adoptPtr(new Vector<unsigned>);
+ m_deletedOffsets->append(offset);
+}
+
+inline PassOwnPtr<PropertyTable> PropertyTable::copy(JSGlobalData& globalData, JSCell* owner, unsigned newCapacity)
+{
+ ASSERT(newCapacity >= m_keyCount);
+
+ // Fast case; if the new table will be the same m_indexSize as this one, we can memcpy it,
+ // save rehashing all keys.
+ if (sizeForCapacity(newCapacity) == m_indexSize)
+ return adoptPtr(new PropertyTable(globalData, owner, *this));
+ return adoptPtr(new PropertyTable(globalData, owner, newCapacity, *this));
+}
+
+#ifndef NDEBUG
+inline size_t PropertyTable::sizeInMemory()
+{
+ size_t result = sizeof(PropertyTable) + dataSize();
+ if (m_deletedOffsets)
+ result += (m_deletedOffsets->capacity() * sizeof(unsigned));
+ return result;
+}
+#endif
+
+inline void PropertyTable::reinsert(const ValueType& entry)
+{
+ // Used to insert a value known not to be in the table, and where
+ // we know capacity to be available.
+ ASSERT(canInsert());
+ find_iterator iter = find(entry.key);
+ ASSERT(!iter.first);
+
+ unsigned entryIndex = usedCount() + 1;
+ m_index[iter.second] = entryIndex;
+ table()[entryIndex - 1] = entry;
+
+ ++m_keyCount;
+}
+
+inline void PropertyTable::rehash(unsigned newCapacity)
+{
+ unsigned* oldEntryIndices = m_index;
+ iterator iter = this->begin();
+ iterator end = this->end();
+
+ m_indexSize = sizeForCapacity(newCapacity);
+ m_indexMask = m_indexSize - 1;
+ m_keyCount = 0;
+ m_deletedCount = 0;
+ m_index = static_cast<unsigned*>(fastZeroedMalloc(dataSize()));
+
+ for (; iter != end; ++iter) {
+ ASSERT(canInsert());
+ reinsert(*iter);
+ }
+
+ fastFree(oldEntryIndices);
+}
+
+inline unsigned PropertyTable::tableCapacity() const { return m_indexSize >> 1; }
+
+inline unsigned PropertyTable::deletedEntryIndex() const { return tableCapacity() + 1; }
+
+template<typename T>
+inline T* PropertyTable::skipDeletedEntries(T* valuePtr)
+{
+ while (valuePtr->key == PROPERTY_MAP_DELETED_ENTRY_KEY)
+ ++valuePtr;
+ return valuePtr;
+}
+
+inline PropertyTable::ValueType* PropertyTable::table()
+{
+ // The table of values lies after the hash index.
+ return reinterpret_cast<ValueType*>(m_index + m_indexSize);
+}
+
+inline const PropertyTable::ValueType* PropertyTable::table() const
+{
+ // The table of values lies after the hash index.
+ return reinterpret_cast<const ValueType*>(m_index + m_indexSize);
+}
+
+inline unsigned PropertyTable::usedCount() const
+{
+ // Total number of used entries in the values array - by either valid entries, or deleted ones.
+ return m_keyCount + m_deletedCount;
+}
+
+inline size_t PropertyTable::dataSize()
+{
+ // The size in bytes of data needed for by the table.
+ return m_indexSize * sizeof(unsigned) + ((tableCapacity()) + 1) * sizeof(ValueType);
+}
+
+inline unsigned PropertyTable::sizeForCapacity(unsigned capacity)
+{
+ if (capacity < 8)
+ return MinimumTableSize;
+ return nextPowerOf2(capacity + 1) * 2;
+}
+
+inline bool PropertyTable::canInsert()
+{
+ return usedCount() < tableCapacity();
+}
+
+} // namespace JSC
+
+#endif // PropertyMapHashTable_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyNameArray.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyNameArray.cpp
new file mode 100644
index 0000000..8efb406
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyNameArray.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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 "JSObject.h"
+#include "ScopeChain.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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyNameArray.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertyNameArray.h
new file mode 100644
index 0000000..0da930f
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertySlot.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertySlot.cpp
new file mode 100644
index 0000000..fd16c0c
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertySlot.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertySlot.h
new file mode 100644
index 0000000..ce29ac4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PropertySlot.h
@@ -0,0 +1,243 @@
+/*
+ * 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_MARKER 0
+#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_MARKER)
+ return m_value;
+ 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_MARKER)
+ return m_value;
+ 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 setValue(JSValue slotBase, JSValue value)
+ {
+ ASSERT(value);
+ clearOffset();
+ m_getValue = JSC_VALUE_MARKER;
+ m_slotBase = slotBase;
+ m_value = value;
+ }
+
+ void setValue(JSValue slotBase, JSValue value, size_t offset)
+ {
+ ASSERT(value);
+ m_getValue = JSC_VALUE_MARKER;
+ m_slotBase = slotBase;
+ m_value = value;
+ m_offset = offset;
+ m_cachedPropertyType = Value;
+ }
+
+ void setValue(JSValue value)
+ {
+ ASSERT(value);
+ clearBase();
+ clearOffset();
+ m_getValue = JSC_VALUE_MARKER;
+ m_value = value;
+ }
+
+ 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;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Protect.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Protect.h
new file mode 100644
index 0000000..843c9e1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Protect.h
@@ -0,0 +1,66 @@
+/*
+ * 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 "Heap.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());
+ }
+
+} // namespace JSC
+
+#endif // Protect_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PutPropertySlot.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PutPropertySlot.h
new file mode 100644
index 0000000..69d1f8b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/PutPropertySlot.h
@@ -0,0 +1,81 @@
+// -*- 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.cpp
new file mode 100644
index 0000000..25cb2d5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.cpp
@@ -0,0 +1,269 @@
+/*
+ * 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 "yarr/Yarr.h"
+#include "yarr/YarrJIT.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wtf/Assertions.h>
+#include <wtf/OwnArrayPtr.h>
+
+namespace JSC {
+
+RegExpFlags regExpFlags(const UString& string)
+{
+ RegExpFlags flags = NoFlags;
+
+ for (unsigned i = 0; i < string.length(); ++i) {
+ switch (string.characters()[i]) {
+ case 'g':
+ if (flags & FlagGlobal)
+ return InvalidFlags;
+ flags = static_cast<RegExpFlags>(flags | FlagGlobal);
+ break;
+
+ case 'i':
+ if (flags & FlagIgnoreCase)
+ return InvalidFlags;
+ flags = static_cast<RegExpFlags>(flags | FlagIgnoreCase);
+ break;
+
+ case 'm':
+ if (flags & FlagMultiline)
+ return InvalidFlags;
+ flags = static_cast<RegExpFlags>(flags | FlagMultiline);
+ break;
+
+ default:
+ return InvalidFlags;
+ }
+ }
+
+ return flags;
+}
+
+struct RegExpRepresentation {
+#if ENABLE(YARR_JIT)
+ Yarr::YarrCodeBlock m_regExpJITCode;
+#endif
+ OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
+};
+
+inline RegExp::RegExp(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags)
+ : m_patternString(patternString)
+ , m_flags(flags)
+ , m_constructionError(0)
+ , m_numSubpatterns(0)
+#if ENABLE(REGEXP_TRACING)
+ , m_rtMatchCallCount(0)
+ , m_rtMatchFoundCount(0)
+#endif
+ , m_representation(adoptPtr(new RegExpRepresentation))
+{
+ m_state = compile(globalData);
+}
+
+RegExp::~RegExp()
+{
+}
+
+PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& patternString, RegExpFlags 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::YarrPattern 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::jitCompile(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::byteCompile(pattern, &globalData->m_regExpAllocator);
+
+ 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::execute(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::interpret(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::interpret(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::YarrCodeBlock& codeBlock = m_representation->m_regExpJITCode;
+
+ const size_t jitAddrSize = 20;
+ char jitAddr[jitAddrSize];
+ if (m_state == JITCode)
+ snprintf(jitAddr, jitAddrSize, "fallback");
+ else
+ snprintf(jitAddr, jitAddrSize, "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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.h
new file mode 100644
index 0000000..000c33a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExp.h
@@ -0,0 +1,88 @@
+/*
+ * 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 "RegExpKey.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+
+namespace JSC {
+
+ struct RegExpRepresentation;
+ class JSGlobalData;
+
+ RegExpFlags regExpFlags(const UString&);
+
+ class RegExp : public RefCounted<RegExp> {
+ public:
+ static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern, RegExpFlags);
+ ~RegExp();
+
+ bool global() const { return m_flags & FlagGlobal; }
+ bool ignoreCase() const { return m_flags & FlagIgnoreCase; }
+ bool multiline() const { return m_flags & FlagMultiline; }
+
+ const UString& pattern() const { return m_patternString; }
+
+ bool isValid() const { return !m_constructionError && m_flags != InvalidFlags; }
+ 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, RegExpFlags);
+
+ 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
+
+ UString m_patternString;
+ RegExpFlags m_flags;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpCache.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpCache.cpp
new file mode 100644
index 0000000..c96b047
--- /dev/null
+++ b/src/3rdparty/webkit/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, RegExpFlags 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, RegExpFlags 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpCache.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpCache.h
new file mode 100644
index 0000000..b4a6ae5
--- /dev/null
+++ b/src/3rdparty/webkit/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, RegExpFlags);
+ PassRefPtr<RegExp> create(const UString& patternString, RegExpFlags, RegExpCacheMap::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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
new file mode 100644
index 0000000..3da0198
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -0,0 +1,373 @@
+/*
+ * 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::s_info = { "Function", &InternalFunction::s_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, Structure* structure, RegExpPrototype* regExpPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "RegExp"))
+ , d(adoptPtr(new RegExpConstructorPrivate))
+{
+ ASSERT(inherits(&s_info));
+
+ // ECMA 15.10.5.1 RegExp.prototype
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
+}
+
+RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate* data)
+ : JSArray(exec->globalData(), 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, JSGlobalObject* globalObject, const ArgList& args)
+{
+ JSValue arg0 = args.at(0);
+ JSValue arg1 = args.at(1);
+
+ if (arg0.inherits(&RegExpObject::s_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);
+ if (exec->hadException())
+ return 0;
+
+ RegExpFlags flags = NoFlags;
+ if (!arg1.isUndefined()) {
+ flags = regExpFlags(arg1.toString(exec));
+ if (exec->hadException())
+ return 0;
+ if (flags == InvalidFlags)
+ return throwError(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));
+ }
+
+ RefPtr<RegExp> regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
+ if (!regExp->isValid())
+ return throwError(exec, createSyntaxError(exec, regExp->errorMessage()));
+ return new (exec) RegExpObject(exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp.release());
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructRegExp(exec, asInternalFunction(exec->callee())->globalObject(), 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, asInternalFunction(exec->callee())->globalObject(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpConstructor.h
new file mode 100644
index 0000000..548664e
--- /dev/null
+++ b/src/3rdparty/webkit/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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ // 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*, Structure*, RegExpPrototype*);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ 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 s_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&);
+
+ OwnPtr<RegExpConstructorPrivate> d;
+ };
+
+ RegExpConstructor* asRegExpConstructor(JSValue);
+
+ JSObject* constructRegExp(ExecState*, JSGlobalObject*, const ArgList&);
+
+ inline RegExpConstructor* asRegExpConstructor(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&RegExpConstructor::s_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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpKey.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpKey.h
new file mode 100644
index 0000000..b4847f9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpKey.h
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+#ifndef RegExpKey_h
+#define RegExpKey_h
+
+#include "UString.h"
+#include <wtf/text/StringHash.h>
+
+namespace JSC {
+
+enum RegExpFlags {
+ NoFlags = 0,
+ FlagGlobal = 1,
+ FlagIgnoreCase = 2,
+ FlagMultiline = 4,
+ InvalidFlags = 8,
+ DeletedValueFlags = -1
+};
+
+struct RegExpKey {
+ RegExpFlags flagsValue;
+ RefPtr<StringImpl> pattern;
+
+ RegExpKey()
+ : flagsValue(NoFlags)
+ {
+ }
+
+ RegExpKey(RegExpFlags flags)
+ : flagsValue(flags)
+ {
+ }
+
+ RegExpKey(RegExpFlags flags, const UString& pattern)
+ : flagsValue(flags)
+ , pattern(pattern.impl())
+ {
+ }
+
+ RegExpKey(RegExpFlags flags, const PassRefPtr<StringImpl> pattern)
+ : flagsValue(flags)
+ , pattern(pattern)
+ {
+ }
+
+ RegExpKey(RegExpFlags flags, const RefPtr<StringImpl>& pattern)
+ : flagsValue(flags)
+ , pattern(pattern)
+ {
+ }
+};
+
+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 = JSC::DeletedValueFlags; }
+ static bool isDeletedValue(const JSC::RegExpKey& value) { return value.flagsValue == JSC::DeletedValueFlags; }
+};
+} // namespace WTF
+
+#endif // RegExpKey_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpMatchesArray.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
index b823621..b823621 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpMatchesArray.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.cpp
new file mode 100644
index 0000000..ffc0112
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.cpp
@@ -0,0 +1,181 @@
+/*
+ * 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::s_info = { "RegExp", &JSObjectWithGlobalObject::s_info, 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, Structure* structure, NonNullPassRefPtr<RegExp> regExp)
+ : JSObjectWithGlobalObject(globalObject, structure)
+ , d(adoptPtr(new RegExpObjectData(regExp)))
+{
+ ASSERT(inherits(&s_info));
+}
+
+RegExpObject::~RegExpObject()
+{
+}
+
+void RegExpObject::visitChildren(SlotVisitor& visitor)
+{
+ Base::visitChildren(visitor);
+ if (UNLIKELY(!d->lastIndex.get().isInt32()))
+ visitor.append(&d->lastIndex);
+}
+
+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 asRegExpObject(slotBase)->getLastIndex();
+}
+
+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(exec->globalData(), value);
+}
+
+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();
+}
+
+// Shared implementation used by test and exec.
+bool RegExpObject::match(ExecState* exec)
+{
+ RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
+ UString input = exec->argument(0).toString(exec);
+
+ if (!regExp()->global()) {
+ int position;
+ int length;
+ regExpConstructor->performMatch(d->regExp.get(), input, 0, position, length);
+ return position >= 0;
+ }
+
+ JSValue jsLastIndex = getLastIndex();
+ unsigned lastIndex;
+ if (LIKELY(jsLastIndex.isUInt32())) {
+ lastIndex = jsLastIndex.asUInt32();
+ if (lastIndex > input.length()) {
+ setLastIndex(0);
+ return false;
+ }
+ } else {
+ double doubleLastIndex = jsLastIndex.toInteger(exec);
+ if (doubleLastIndex < 0 || doubleLastIndex > input.length()) {
+ setLastIndex(0);
+ return false;
+ }
+ lastIndex = static_cast<unsigned>(doubleLastIndex);
+ }
+
+ int position;
+ int length = 0;
+ regExpConstructor->performMatch(d->regExp.get(), input, lastIndex, position, length);
+ if (position < 0) {
+ setLastIndex(0);
+ return false;
+ }
+
+ setLastIndex(position + length);
+ return true;
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.h
new file mode 100644
index 0000000..a0803eb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpObject.h
@@ -0,0 +1,102 @@
+/*
+ * 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:
+ typedef JSObjectWithGlobalObject Base;
+
+ RegExpObject(JSGlobalObject*, Structure*, NonNullPassRefPtr<RegExp>);
+ virtual ~RegExpObject();
+
+ void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; }
+ RegExp* regExp() const { return d->regExp.get(); }
+
+ void setLastIndex(size_t lastIndex)
+ {
+ d->lastIndex.setWithoutWriteBarrier(jsNumber(lastIndex));
+ }
+ void setLastIndex(JSGlobalData& globalData, JSValue lastIndex)
+ {
+ d->lastIndex.set(globalData, this, lastIndex);
+ }
+ JSValue getLastIndex() const
+ {
+ return d->lastIndex.get();
+ }
+
+ 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&);
+
+ static JS_EXPORTDATA const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesVisitChildren | OverridesGetOwnPropertySlot | JSObjectWithGlobalObject::StructureFlags;
+
+ private:
+ virtual void visitChildren(SlotVisitor&);
+
+ bool match(ExecState*);
+
+ struct RegExpObjectData {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ RegExpObjectData(NonNullPassRefPtr<RegExp> regExp)
+ : regExp(regExp)
+ {
+ lastIndex.setWithoutWriteBarrier(jsNumber(0));
+ }
+
+ RefPtr<RegExp> regExp;
+ WriteBarrier<Unknown> lastIndex;
+ };
+#if COMPILER(MSVC)
+ friend void WTF::deleteOwnedPtr<RegExpObjectData>(RegExpObjectData*);
+#endif
+ OwnPtr<RegExpObjectData> d;
+ };
+
+ RegExpObject* asRegExpObject(JSValue);
+
+ inline RegExpObject* asRegExpObject(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&RegExpObject::s_info));
+ return static_cast<RegExpObject*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // RegExpObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
new file mode 100644
index 0000000..5bb8ad8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -0,0 +1,143 @@
+/*
+ * 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 "RegExpObject.h"
+#include "RegExp.h"
+#include "RegExpCache.h"
+#include "StringRecursionChecker.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, Structure* structure, Structure* functionStructure)
+ : RegExpObject(globalObject, structure, RegExp::create(&exec->globalData(), "", NoFlags))
+{
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
+}
+
+// ------------------------------ Functions ---------------------------
+
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&RegExpObject::s_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::s_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::s_info))
+ return throwVMTypeError(exec);
+
+ RefPtr<RegExp> regExp;
+ JSValue arg0 = exec->argument(0);
+ JSValue arg1 = exec->argument(1);
+
+ if (arg0.inherits(&RegExpObject::s_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);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ RegExpFlags flags = NoFlags;
+ if (!arg1.isUndefined()) {
+ flags = regExpFlags(arg1.toString(exec));
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ if (flags == InvalidFlags)
+ return throwVMError(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));
+ }
+ regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
+ }
+
+ if (!regExp->isValid())
+ return throwVMError(exec, createSyntaxError(exec, 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::s_info)) {
+ if (thisValue.inherits(&RegExpPrototype::s_info))
+ return JSValue::encode(jsNontrivialString(exec, "//"));
+ return throwVMTypeError(exec);
+ }
+
+ RegExpObject* thisObject = asRegExpObject(thisValue);
+
+ StringRecursionChecker checker(exec, thisObject);
+ if (EncodedJSValue earlyReturnValue = checker.earlyReturnValue())
+ return earlyReturnValue;
+
+ char postfix[5] = { '/', 0, 0, 0, 0 };
+ int index = 1;
+ if (thisObject->get(exec, exec->propertyNames().global).toBoolean(exec))
+ postfix[index++] = 'g';
+ if (thisObject->get(exec, exec->propertyNames().ignoreCase).toBoolean(exec))
+ postfix[index++] = 'i';
+ if (thisObject->get(exec, exec->propertyNames().multiline).toBoolean(exec))
+ postfix[index] = 'm';
+ UString source = thisObject->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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RegExpPrototype.h
new file mode 100644
index 0000000..2cc5405
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, Structure* functionStructure);
+ };
+
+} // namespace JSC
+
+#endif // RegExpPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RopeImpl.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RopeImpl.cpp
new file mode 100644
index 0000000..09c24a9
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RopeImpl.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/RopeImpl.h
new file mode 100644
index 0000000..dfacbf5
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.cpp
new file mode 100644
index 0000000..ed60bb1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.cpp
@@ -0,0 +1,79 @@
+/*
+ * 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()
+{
+ ScopeChainIterator scopeEnd = end();
+ for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
+ JSObject* o = scopeIter->get();
+ 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
+
+const ClassInfo ScopeChainNode::s_info = { "ScopeChainNode", 0, 0, 0 };
+
+int ScopeChainNode::localDepth()
+{
+ int scopeDepth = 0;
+ ScopeChainIterator iter = this->begin();
+ ScopeChainIterator end = this->end();
+ while (!(*iter)->inherits(&JSActivation::s_info)) {
+ ++iter;
+ if (iter == end)
+ break;
+ ++scopeDepth;
+ }
+ return scopeDepth;
+}
+
+void ScopeChainNode::visitChildren(SlotVisitor& visitor)
+{
+ if (next)
+ visitor.append(&next);
+ visitor.append(&object);
+ visitor.append(&globalObject);
+ visitor.append(&globalThis);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.h
new file mode 100644
index 0000000..8481bdc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChain.h
@@ -0,0 +1,148 @@
+/*
+ * 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 "JSCell.h"
+#include "Structure.h"
+#include <wtf/FastAllocBase.h>
+
+namespace JSC {
+
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSObject;
+ class MarkStack;
+ class ScopeChainIterator;
+ typedef MarkStack SlotVisitor;
+
+ class ScopeChainNode : public JSCell {
+ public:
+ ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis)
+ : JSCell(*globalData, globalData->scopeChainNodeStructure.get())
+ , globalData(globalData)
+ , next(*globalData, this, next)
+ , object(*globalData, this, object)
+ , globalObject(*globalData, this, globalObject)
+ , globalThis(*globalData, this, globalThis)
+ {
+ ASSERT(globalData);
+ ASSERT(globalObject);
+ }
+
+ JSGlobalData* globalData;
+ WriteBarrier<ScopeChainNode> next;
+ WriteBarrier<JSObject> object;
+ WriteBarrier<JSGlobalObject> globalObject;
+ WriteBarrier<JSObject> globalThis;
+
+ ScopeChainNode* push(JSObject*);
+ ScopeChainNode* pop();
+
+ ScopeChainIterator begin();
+ ScopeChainIterator end();
+
+ int localDepth();
+
+#ifndef NDEBUG
+ void print();
+#endif
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
+ virtual void visitChildren(SlotVisitor&);
+ private:
+ static const unsigned StructureFlags = OverridesVisitChildren;
+ static const ClassInfo s_info;
+ };
+
+ inline ScopeChainNode* ScopeChainNode::push(JSObject* o)
+ {
+ ASSERT(o);
+ return new (globalData) ScopeChainNode(this, o, globalData, globalObject.get(), globalThis.get());
+ }
+
+ inline ScopeChainNode* ScopeChainNode::pop()
+ {
+ ASSERT(next);
+ return next.get();
+ }
+
+ class ScopeChainIterator {
+ public:
+ ScopeChainIterator(ScopeChainNode* node)
+ : m_node(node)
+ {
+ }
+
+ WriteBarrier<JSObject> const & operator*() const { return m_node->object; }
+ WriteBarrier<JSObject> const * operator->() const { return &(operator*()); }
+
+ ScopeChainIterator& operator++() { m_node = m_node->next.get(); 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:
+ ScopeChainNode* m_node;
+ };
+
+ inline ScopeChainIterator ScopeChainNode::begin()
+ {
+ return ScopeChainIterator(this);
+ }
+
+ inline ScopeChainIterator ScopeChainNode::end()
+ {
+ return ScopeChainIterator(0);
+ }
+
+ ALWAYS_INLINE JSGlobalData& ExecState::globalData() const
+ {
+ ASSERT(scopeChain()->globalData);
+ return *scopeChain()->globalData;
+ }
+
+ ALWAYS_INLINE JSGlobalObject* ExecState::lexicalGlobalObject() const
+ {
+ return scopeChain()->globalObject.get();
+ }
+
+ ALWAYS_INLINE JSObject* ExecState::globalThisValue() const
+ {
+ return scopeChain()->globalThis.get();
+ }
+
+ ALWAYS_INLINE ScopeChainNode* Register::scopeChain() const
+ {
+ return static_cast<ScopeChainNode*>(jsValue().asCell());
+ }
+
+ ALWAYS_INLINE Register& Register::operator=(ScopeChainNode* scopeChain)
+ {
+ *this = JSValue(scopeChain);
+ return *this;
+ }
+
+} // namespace JSC
+
+#endif // ScopeChain_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChainMark.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChainMark.h
new file mode 100644
index 0000000..35701f1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ScopeChainMark.h
@@ -0,0 +1,30 @@
+/*
+ * 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 {
+
+} // namespace JSC
+
+#endif // ScopeChainMark_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.cpp
new file mode 100644
index 0000000..8741e9b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.cpp
@@ -0,0 +1,146 @@
+/*
+ * 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 inline bool isMarked(JSCell* string)
+{
+ return string && Heap::isMarked(string);
+}
+
+class SmallStringsStorage {
+ WTF_MAKE_NONCOPYABLE(SmallStringsStorage); WTF_MAKE_FAST_ALLOCATED;
+public:
+ SmallStringsStorage();
+
+ StringImpl* rep(unsigned char character)
+ {
+ return m_reps[character].get();
+ }
+
+private:
+ static const unsigned singleCharacterStringCount = maxSingleCharacterString + 1;
+
+ RefPtr<StringImpl> m_reps[singleCharacterStringCount];
+};
+
+SmallStringsStorage::SmallStringsStorage()
+{
+ UChar* characterBuffer = 0;
+ RefPtr<StringImpl> baseString = StringImpl::createUninitialized(singleCharacterStringCount, characterBuffer);
+ for (unsigned i = 0; i < singleCharacterStringCount; ++i) {
+ characterBuffer[i] = i;
+ m_reps[i] = StringImpl::create(baseString, i, 1);
+ }
+}
+
+SmallStrings::SmallStrings()
+{
+ COMPILE_ASSERT(singleCharacterStringCount == sizeof(m_singleCharacterStrings) / sizeof(m_singleCharacterStrings[0]), IsNumCharactersConstInSyncWithClassUsage);
+ clear();
+}
+
+SmallStrings::~SmallStrings()
+{
+}
+
+void SmallStrings::visitChildren(HeapRootVisitor& heapRootMarker)
+{
+ /*
+ 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 < singleCharacterStringCount && !isAnyStringMarked; ++i)
+ isAnyStringMarked = isMarked(m_singleCharacterStrings[i]);
+
+ if (!isAnyStringMarked) {
+ clear();
+ return;
+ }
+
+ if (m_emptyString)
+ heapRootMarker.mark(&m_emptyString);
+ for (unsigned i = 0; i < singleCharacterStringCount; ++i) {
+ if (m_singleCharacterStrings[i])
+ heapRootMarker.mark(&m_singleCharacterStrings[i]);
+ }
+}
+
+void SmallStrings::clear()
+{
+ m_emptyString = 0;
+ for (unsigned i = 0; i < singleCharacterStringCount; ++i)
+ m_singleCharacterStrings[i] = 0;
+}
+
+unsigned SmallStrings::count() const
+{
+ unsigned count = 0;
+ if (m_emptyString)
+ ++count;
+ for (unsigned i = 0; i < singleCharacterStringCount; ++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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.h
new file mode 100644
index 0000000..17607bb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SmallStrings.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.
+ *
+ * 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 "WriteBarrier.h"
+#include <wtf/FixedArray.h>
+#include <wtf/OwnPtr.h>
+
+namespace JSC {
+
+ class HeapRootVisitor;
+ class JSGlobalData;
+ class JSString;
+ class MarkStack;
+ class SmallStringsStorage;
+ typedef MarkStack SlotVisitor;
+
+ static const unsigned maxSingleCharacterString = 0xFF;
+
+ class SmallStrings {
+ WTF_MAKE_NONCOPYABLE(SmallStrings);
+ 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 visitChildren(HeapRootVisitor&);
+ void clear();
+
+ unsigned count() const;
+
+ JSString** singleCharacterStrings() { return &m_singleCharacterStrings[0]; }
+
+ private:
+ static const unsigned singleCharacterStringCount = maxSingleCharacterString + 1;
+
+ void createEmptyString(JSGlobalData*);
+ void createSingleCharacterString(JSGlobalData*, unsigned char);
+
+ JSString* m_emptyString;
+ JSString* m_singleCharacterStrings[singleCharacterStringCount];
+ OwnPtr<SmallStringsStorage> m_storage;
+ };
+
+} // namespace JSC
+
+#endif // SmallStrings_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp
new file mode 100644
index 0000000..e666dee
--- /dev/null
+++ b/src/3rdparty/webkit/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)
+ : JSNonFinalObject(exec->globalData(), exec->globalData().strictEvalActivationStructure.get())
+{
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StrictEvalActivation.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StrictEvalActivation.h
new file mode 100644
index 0000000..e2885cc
--- /dev/null
+++ b/src/3rdparty/webkit/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 JSNonFinalObject {
+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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringConstructor.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringConstructor.cpp
new file mode 100644
index 0000000..560202a
--- /dev/null
+++ b/src/3rdparty/webkit/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 "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, Structure* structure, Structure* functionStructure, StringPrototype* stringPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, stringPrototype->classInfo()->className))
+{
+ // ECMA 15.5.3.1 String.prototype
+ putDirectWithoutTransition(exec->globalData(), 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) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().fromCharCode, exec->globalData().getHostFunction(stringFromCharCode, fromCharCodeThunkGenerator)), DontEnum);
+#else
+ putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
+#endif
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+}
+
+// ECMA 15.5.2
+static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* exec)
+{
+ JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
+ if (!exec->argumentCount())
+ return JSValue::encode(new (exec) StringObject(exec, globalObject->stringObjectStructure()));
+ return JSValue::encode(new (exec) StringObject(exec, globalObject->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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringConstructor.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringConstructor.h
new file mode 100644
index 0000000..117cce8
--- /dev/null
+++ b/src/3rdparty/webkit/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*, Structure*, Structure* functionStructure, StringPrototype*);
+
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // StringConstructor_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.cpp
new file mode 100644
index 0000000..67dc291
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.cpp
@@ -0,0 +1,102 @@
+/*
+ * 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::s_info = { "String", &JSWrapperObject::s_info, 0, 0 };
+
+StringObject::StringObject(ExecState* exec, Structure* structure)
+ : JSWrapperObject(exec->globalData(), structure)
+{
+ ASSERT(inherits(&s_info));
+ setInternalValue(exec->globalData(), jsEmptyString(exec));
+}
+
+StringObject::StringObject(JSGlobalData& globalData, Structure* structure, JSString* string)
+ : JSWrapperObject(globalData, structure)
+{
+ ASSERT(inherits(&s_info));
+ setInternalValue(globalData, string);
+}
+
+StringObject::StringObject(ExecState* exec, Structure* structure, const UString& string)
+ : JSWrapperObject(exec->globalData(), structure)
+{
+ ASSERT(inherits(&s_info));
+ setInternalValue(exec->globalData(), 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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.h
new file mode 100644
index 0000000..4c16044
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObject.h
@@ -0,0 +1,68 @@
+/*
+ * 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*, Structure*);
+ StringObject(ExecState*, Structure*, const UString&);
+
+ static StringObject* create(ExecState*, JSGlobalObject*, 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);
+
+ static const JS_EXPORTDATA ClassInfo s_info;
+
+ JSString* internalValue() const { return asString(JSWrapperObject::internalValue());}
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
+ StringObject(JSGlobalData&, Structure*, JSString*);
+ };
+
+ StringObject* asStringObject(JSValue);
+
+ inline StringObject* asStringObject(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&StringObject::s_info));
+ return static_cast<StringObject*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // StringObject_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
new file mode 100644
index 0000000..3133944
--- /dev/null
+++ b/src/3rdparty/webkit/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->globalData(), exec->lexicalGlobalObject()->stringPrototype()), string);
+ }
+
+ private:
+ StringObjectThatMasqueradesAsUndefined(ExecState* exec, Structure* structure, const UString& string)
+ : StringObject(exec, structure, string)
+ {
+ }
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
+ {
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames | StringObject::StructureFlags;
+
+ virtual bool toBoolean(ExecState*) const { return false; }
+ };
+
+} // namespace JSC
+
+#endif // StringObjectThatMasqueradesAsUndefined_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.cpp
new file mode 100644
index 0000000..4299344
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.cpp
@@ -0,0 +1,1150 @@
+/*
+ * 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::s_info = { "String", &StringObject::s_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, Structure* structure)
+ : StringObject(exec, structure)
+{
+ ASSERT(inherits(&s_info));
+
+ putAnonymousValue(exec->globalData(), 0, globalObject);
+ // The constructor will be added later, after StringConstructor has been built
+ putDirectWithoutTransition(exec->globalData(), 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::s_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::s_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);
+
+ RefPtr<RegExp> reg;
+ if (a0.inherits(&RegExpObject::s_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), NoFlags);
+ }
+ RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
+ int pos;
+ int matchLength = 0;
+ regExpConstructor->performMatch(reg.get(), s, 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;
+ while (pos >= 0) {
+ list.append(jsSubstring(exec, s, pos, matchLength));
+ pos += matchLength == 0 ? 1 : matchLength;
+ regExpConstructor->performMatch(reg.get(), s, pos, pos, matchLength);
+ }
+ 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);
+
+ RefPtr<RegExp> reg;
+ if (a0.inherits(&RegExpObject::s_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), NoFlags);
+ }
+ RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
+ int pos;
+ int matchLength = 0;
+ regExpConstructor->performMatch(reg.get(), s, 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::s_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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.h
new file mode 100644
index 0000000..6c4b475
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.h
@@ -0,0 +1,53 @@
+/*
+ * 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*, Structure*);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ {
+ return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ }
+
+ static const ClassInfo s_info;
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | StringObject::StructureFlags;
+
+ COMPILE_ASSERT(!StringObject::AnonymousSlotCount, StringPrototype_stomps_on_your_anonymous_slot);
+ static const unsigned AnonymousSlotCount = 1;
+ };
+
+} // namespace JSC
+
+#endif // StringPrototype_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.cpp
new file mode 100644
index 0000000..4e74735
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 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 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 "StringRecursionChecker.h"
+
+#include "Error.h"
+#include "ExceptionHelpers.h"
+
+namespace JSC {
+
+EncodedJSValue StringRecursionChecker::throwStackOverflowError()
+{
+ return throwVMError(m_exec, createStackOverflowError(m_exec));
+}
+
+EncodedJSValue StringRecursionChecker::emptyString()
+{
+ return JSValue::encode(jsEmptyString(m_exec));
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.h
new file mode 100644
index 0000000..314f14e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringRecursionChecker.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 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 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 StringRecursionChecker_h
+#define StringRecursionChecker_h
+
+#include "Interpreter.h"
+
+namespace JSC {
+
+class StringRecursionChecker {
+ WTF_MAKE_NONCOPYABLE(StringRecursionChecker);
+
+public:
+ StringRecursionChecker(ExecState*, JSObject* thisObject);
+ ~StringRecursionChecker();
+
+ EncodedJSValue earlyReturnValue() const; // 0 if everything is OK, value to return for failure cases
+
+private:
+ EncodedJSValue throwStackOverflowError();
+ EncodedJSValue emptyString();
+ EncodedJSValue performCheck();
+
+ ExecState* m_exec;
+ JSObject* m_thisObject;
+ EncodedJSValue m_earlyReturnValue;
+};
+
+inline EncodedJSValue StringRecursionChecker::performCheck()
+{
+ int size = m_exec->globalData().stringRecursionCheckVisitedObjects.size();
+ if (size >= MaxSmallThreadReentryDepth && size >= m_exec->globalData().maxReentryDepth)
+ return throwStackOverflowError();
+ bool alreadyVisited = !m_exec->globalData().stringRecursionCheckVisitedObjects.add(m_thisObject).second;
+ if (alreadyVisited)
+ return emptyString(); // Return empty string to avoid infinite recursion.
+ return 0; // Indicate success.
+}
+
+inline StringRecursionChecker::StringRecursionChecker(ExecState* exec, JSObject* thisObject)
+ : m_exec(exec)
+ , m_thisObject(thisObject)
+ , m_earlyReturnValue(performCheck())
+{
+}
+
+inline EncodedJSValue StringRecursionChecker::earlyReturnValue() const
+{
+ return m_earlyReturnValue;
+}
+
+inline StringRecursionChecker::~StringRecursionChecker()
+{
+ if (m_earlyReturnValue)
+ return;
+ ASSERT(m_exec->globalData().stringRecursionCheckVisitedObjects.contains(m_thisObject));
+ m_exec->globalData().stringRecursionCheckVisitedObjects.remove(m_thisObject);
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.cpp
new file mode 100644
index 0000000..6ba2777
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.cpp
@@ -0,0 +1,879 @@
+/*
+ * 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;
+
+#if DUMP_PROPERTYMAP_STATS
+
+int numProbes;
+int numCollisions;
+int numRehashes;
+int numRemoves;
+
+#endif
+
+namespace JSC {
+
+#if DUMP_STRUCTURE_ID_STATISTICS
+static HashSet<Structure*>& liveStructureSet = *(new HashSet<Structure*>);
+#endif
+
+bool StructureTransitionTable::contains(StringImpl* rep, unsigned attributes) const
+{
+ if (isUsingSingleSlot()) {
+ Structure* transition = singleTransition();
+ return transition && transition->m_nameInPrevious == rep && transition->m_attributesInPrevious == attributes;
+ }
+ return map()->contains(make_pair(rep, attributes));
+}
+
+inline Structure* StructureTransitionTable::get(StringImpl* rep, unsigned attributes) const
+{
+ if (isUsingSingleSlot()) {
+ Structure* transition = singleTransition();
+ return (transition && transition->m_nameInPrevious == rep && transition->m_attributesInPrevious == attributes) ? transition : 0;
+ }
+ return map()->get(make_pair(rep, attributes));
+}
+
+inline void StructureTransitionTable::remove(Structure* structure)
+{
+ if (isUsingSingleSlot()) {
+ // If more than one transition had been added, then we wouldn't be in
+ // single slot mode (even despecifying a from a specific value triggers
+ // map mode).
+ // As such, the passed structure *must* be the existing transition.
+ ASSERT(singleTransition() == structure);
+ clearSingleTransition();
+ } else {
+ // Check whether a mapping exists for structure's key, and whether the
+ // entry is structure (the latter check may fail if we initially had a
+ // transition with a specific value, and this has been despecified).
+
+ // Newer versions of the STL have an std::make_pair function that takes rvalue references.
+ // When either of the parameters are bitfields, the C++ compiler will try to bind them as lvalues, which is invalid. To work around this, use unary "+" to make the parameter an rvalue.
+ // See https://bugs.webkit.org/show_bug.cgi?id=59261 for more details
+ TransitionMap::iterator entry = map()->find(make_pair(structure->m_nameInPrevious, +structure->m_attributesInPrevious));
+ if (entry != map()->end() && structure == entry.get().second)
+ map()->remove(entry);
+ }
+}
+
+inline void StructureTransitionTable::add(JSGlobalData& globalData, Structure* structure)
+{
+ if (isUsingSingleSlot()) {
+ Structure* existingTransition = singleTransition();
+
+ // This handles the first transition being added.
+ if (!existingTransition) {
+ setSingleTransition(globalData, structure);
+ return;
+ }
+
+ // This handles the second transition being added
+ // (or the first transition being despecified!)
+ setMap(new TransitionMap());
+ add(globalData, existingTransition);
+ }
+
+ // Add the structure to the map.
+
+ // Newer versions of the STL have an std::make_pair function that takes rvalue references.
+ // When either of the parameters are bitfields, the C++ compiler will try to bind them as lvalues, which is invalid. To work around this, use unary "+" to make the parameter an rvalue.
+ // See https://bugs.webkit.org/show_bug.cgi?id=59261 for more details
+ std::pair<TransitionMap::iterator, bool> result = map()->add(globalData, make_pair(structure->m_nameInPrevious, +structure->m_attributesInPrevious), structure);
+ if (!result.second) {
+ // There already is an entry! - we should only hit this when despecifying.
+ ASSERT(result.first.get().second->m_specificValueInPrevious);
+ ASSERT(!structure->m_specificValueInPrevious);
+ map()->set(result.first, 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;
+
+ switch (structure->m_transitionTable.size()) {
+ case 0:
+ ++numberLeaf;
+ if (!structure->m_previous)
+ ++numberSingletons;
+ break;
+
+ case 1:
+ ++numberUsingSingleSlot;
+ break;
+ }
+
+ if (structure->m_propertyTable) {
+ ++numberWithPropertyMaps;
+ totalPropertyMapsSize += structure->m_propertyTable->sizeInMemory();
+ }
+ }
+
+ 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(JSGlobalData& globalData, JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount, const ClassInfo* classInfo)
+ : JSCell(globalData, globalData.structureStructure.get())
+ , m_typeInfo(typeInfo)
+ , m_prototype(globalData, this, prototype)
+ , m_classInfo(classInfo)
+ , m_propertyStorageCapacity(typeInfo.isFinal() ? JSFinalObject_inlineStorageCapacity : JSNonFinalObject_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_preventExtensions(false)
+ , m_didTransition(false)
+{
+ ASSERT(m_prototype);
+ ASSERT(m_prototype.isObject() || m_prototype.isNull());
+}
+
+const ClassInfo Structure::s_info = { "Structure", 0, 0, 0 };
+
+Structure::Structure(JSGlobalData& globalData)
+ : JSCell(globalData, this)
+ , m_typeInfo(CompoundType, OverridesVisitChildren)
+ , m_prototype(globalData, this, jsNull())
+ , m_classInfo(&s_info)
+ , m_propertyStorageCapacity(0)
+ , m_offset(noOffset)
+ , m_dictionaryKind(NoneDictionaryKind)
+ , m_isPinnedPropertyTable(false)
+ , m_hasGetterSetterProperties(false)
+ , m_hasNonEnumerableProperties(false)
+ , m_attributesInPrevious(0)
+ , m_specificFunctionThrashCount(0)
+ , m_anonymousSlotCount(0)
+ , m_preventExtensions(false)
+ , m_didTransition(false)
+{
+ ASSERT(m_prototype);
+ ASSERT(m_prototype.isNull());
+ ASSERT(!globalData.structureStructure);
+}
+
+Structure::Structure(JSGlobalData& globalData, const Structure* previous)
+ : JSCell(globalData, globalData.structureStructure.get())
+ , m_typeInfo(previous->typeInfo())
+ , m_prototype(globalData, this, previous->storedPrototype())
+ , m_classInfo(previous->m_classInfo)
+ , m_propertyStorageCapacity(previous->m_propertyStorageCapacity)
+ , m_offset(noOffset)
+ , m_dictionaryKind(NoneDictionaryKind)
+ , m_isPinnedPropertyTable(false)
+ , m_hasGetterSetterProperties(previous->m_hasGetterSetterProperties)
+ , m_hasNonEnumerableProperties(previous->m_hasNonEnumerableProperties)
+ , m_attributesInPrevious(0)
+ , m_specificFunctionThrashCount(previous->m_specificFunctionThrashCount)
+ , m_anonymousSlotCount(previous->anonymousSlotCount())
+ , m_preventExtensions(previous->m_preventExtensions)
+ , m_didTransition(true)
+{
+ ASSERT(m_prototype);
+ ASSERT(m_prototype.isObject() || m_prototype.isNull());
+}
+
+Structure::~Structure()
+{
+}
+
+void Structure::materializePropertyMap(JSGlobalData& globalData)
+{
+ ASSERT(structure()->classInfo() == &s_info);
+ 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->m_propertyTable->copy(globalData, 0, m_offset + 1);
+ break;
+ }
+
+ structures.append(structure);
+ }
+
+ if (!m_propertyTable)
+ createPropertyMap(m_offset + 1);
+
+ for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) {
+ structure = structures[i];
+ PropertyMapEntry entry(globalData, this, structure->m_nameInPrevious.get(), m_anonymousSlotCount + structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious.get());
+ m_propertyTable->add(entry);
+ }
+}
+
+void Structure::growPropertyStorageCapacity()
+{
+ if (isUsingInlineStorage())
+ m_propertyStorageCapacity = JSObject::baseExternalStorageCapacity;
+ else
+ m_propertyStorageCapacity *= 2;
+}
+
+void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, const Identifier& propertyName)
+{
+ StringImpl* rep = propertyName.impl();
+
+ materializePropertyMapIfNecessary(globalData);
+
+ ASSERT(isDictionary());
+ ASSERT(m_propertyTable);
+
+ PropertyMapEntry* entry = m_propertyTable->find(rep).first;
+ ASSERT(entry);
+ entry->specificValue.clear();
+}
+
+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->m_transitionTable.get(propertyName.impl(), attributes)) {
+ JSCell* specificValueInPrevious = existingTransition->m_specificValueInPrevious.get();
+ if (specificValueInPrevious && specificValueInPrevious != specificValue)
+ return 0;
+ 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;
+}
+
+Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
+{
+ // 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 (specificValue && structure->m_transitionTable.contains(propertyName.impl(), attributes))
+ specificValue = 0;
+
+ 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) {
+ Structure* transition = toCacheableDictionaryTransition(globalData, structure);
+ ASSERT(structure != transition);
+ offset = transition->putSpecificValue(globalData, propertyName, attributes, specificValue);
+ ASSERT(offset >= structure->m_anonymousSlotCount);
+ ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
+ if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
+ transition->growPropertyStorageCapacity();
+ return transition;
+ }
+
+ Structure* transition = create(globalData, structure);
+
+ transition->m_cachedPrototypeChain.set(globalData, transition, structure->m_cachedPrototypeChain.get());
+ transition->m_previous.set(globalData, transition, structure);
+ transition->m_nameInPrevious = propertyName.impl();
+ transition->m_attributesInPrevious = attributes;
+ transition->m_specificValueInPrevious.set(globalData, transition, specificValue);
+
+ if (structure->m_propertyTable) {
+ if (structure->m_isPinnedPropertyTable)
+ transition->m_propertyTable = structure->m_propertyTable->copy(globalData, 0, structure->m_propertyTable->size() + 1);
+ else
+ transition->m_propertyTable = structure->m_propertyTable.release();
+ } else {
+ if (structure->m_previous)
+ transition->materializePropertyMap(globalData);
+ else
+ transition->createPropertyMap();
+ }
+
+ offset = transition->putSpecificValue(globalData, 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->m_transitionTable.add(globalData, transition);
+ return transition;
+}
+
+Structure* Structure::removePropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, size_t& offset)
+{
+ ASSERT(!structure->isUncacheableDictionary());
+
+ Structure* transition = toUncacheableDictionaryTransition(globalData, structure);
+
+ offset = transition->remove(propertyName);
+ ASSERT(offset >= structure->m_anonymousSlotCount);
+ ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
+
+ return transition;
+}
+
+Structure* Structure::changePrototypeTransition(JSGlobalData& globalData, Structure* structure, JSValue prototype)
+{
+ Structure* transition = create(globalData, structure);
+
+ transition->m_prototype.set(globalData, transition, prototype);
+
+ // Don't set m_offset, as one can not transition to this.
+
+ structure->materializePropertyMapIfNecessary(globalData);
+ transition->m_propertyTable = structure->copyPropertyTable(globalData, transition);
+ transition->m_isPinnedPropertyTable = true;
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition;
+}
+
+Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Structure* structure, const Identifier& replaceFunction)
+{
+ ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount);
+ Structure* transition = create(globalData, structure);
+
+ ++transition->m_specificFunctionThrashCount;
+
+ // Don't set m_offset, as one can not transition to this.
+
+ structure->materializePropertyMapIfNecessary(globalData);
+ transition->m_propertyTable = structure->copyPropertyTable(globalData, transition);
+ transition->m_isPinnedPropertyTable = true;
+
+ if (transition->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
+ transition->despecifyAllFunctions(globalData);
+ else {
+ bool removed = transition->despecifyFunction(globalData, replaceFunction);
+ ASSERT_UNUSED(removed, removed);
+ }
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition;
+}
+
+Structure* Structure::getterSetterTransition(JSGlobalData& globalData, Structure* structure)
+{
+ Structure* transition = create(globalData, structure);
+
+ // Don't set m_offset, as one can not transition to this.
+
+ structure->materializePropertyMapIfNecessary(globalData);
+ transition->m_propertyTable = structure->copyPropertyTable(globalData, transition);
+ transition->m_isPinnedPropertyTable = true;
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition;
+}
+
+Structure* Structure::toDictionaryTransition(JSGlobalData& globalData, Structure* structure, DictionaryKind kind)
+{
+ ASSERT(!structure->isUncacheableDictionary());
+
+ Structure* transition = create(globalData, structure);
+
+ structure->materializePropertyMapIfNecessary(globalData);
+ transition->m_propertyTable = structure->copyPropertyTable(globalData, transition);
+ transition->m_isPinnedPropertyTable = true;
+ transition->m_dictionaryKind = kind;
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition;
+}
+
+Structure* Structure::toCacheableDictionaryTransition(JSGlobalData& globalData, Structure* structure)
+{
+ return toDictionaryTransition(globalData, structure, CachedDictionaryKind);
+}
+
+Structure* Structure::toUncacheableDictionaryTransition(JSGlobalData& globalData, Structure* structure)
+{
+ return toDictionaryTransition(globalData, structure, UncachedDictionaryKind);
+}
+
+// In future we may want to cache this transition.
+Structure* Structure::sealTransition(JSGlobalData& globalData, Structure* structure)
+{
+ Structure* transition = preventExtensionsTransition(globalData, structure);
+
+ if (transition->m_propertyTable) {
+ PropertyTable::iterator end = transition->m_propertyTable->end();
+ for (PropertyTable::iterator iter = transition->m_propertyTable->begin(); iter != end; ++iter)
+ iter->attributes |= DontDelete;
+ }
+
+ return transition;
+}
+
+// In future we may want to cache this transition.
+Structure* Structure::freezeTransition(JSGlobalData& globalData, Structure* structure)
+{
+ Structure* transition = preventExtensionsTransition(globalData, structure);
+
+ if (transition->m_propertyTable) {
+ PropertyTable::iterator end = transition->m_propertyTable->end();
+ for (PropertyTable::iterator iter = transition->m_propertyTable->begin(); iter != end; ++iter)
+ iter->attributes |= (DontDelete | ReadOnly);
+ }
+
+ return transition;
+}
+
+// In future we may want to cache this transition.
+Structure* Structure::preventExtensionsTransition(JSGlobalData& globalData, Structure* structure)
+{
+ Structure* transition = create(globalData, structure);
+
+ // Don't set m_offset, as one can not transition to this.
+
+ structure->materializePropertyMapIfNecessary(globalData);
+ transition->m_propertyTable = structure->copyPropertyTable(globalData, transition);
+ transition->m_isPinnedPropertyTable = true;
+ transition->m_preventExtensions = true;
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition;
+}
+
+// In future we may want to cache this property.
+bool Structure::isSealed(JSGlobalData& globalData)
+{
+ if (isExtensible())
+ return false;
+
+ materializePropertyMapIfNecessary(globalData);
+ if (!m_propertyTable)
+ return true;
+
+ PropertyTable::iterator end = m_propertyTable->end();
+ for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
+ if ((iter->attributes & DontDelete) != DontDelete)
+ return false;
+ }
+ return true;
+}
+
+// In future we may want to cache this property.
+bool Structure::isFrozen(JSGlobalData& globalData)
+{
+ if (isExtensible())
+ return false;
+
+ materializePropertyMapIfNecessary(globalData);
+ if (!m_propertyTable)
+ return true;
+
+ PropertyTable::iterator end = m_propertyTable->end();
+ for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
+ if ((iter->attributes & (DontDelete | ReadOnly)) != (DontDelete | ReadOnly))
+ return false;
+ }
+ return true;
+}
+
+Structure* Structure::flattenDictionaryStructure(JSGlobalData& globalData, JSObject* object)
+{
+ ASSERT(isDictionary());
+ if (isUncacheableDictionary()) {
+ ASSERT(m_propertyTable);
+
+ unsigned anonymousSlotCount = m_anonymousSlotCount;
+ size_t propertyCount = m_propertyTable->size();
+ Vector<JSValue> values(propertyCount);
+
+ unsigned i = 0;
+ PropertyTable::iterator end = m_propertyTable->end();
+ for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter, ++i) {
+ values[i] = object->getDirectOffset(iter->offset);
+ // Update property table to have the new property offsets
+ iter->offset = anonymousSlotCount + i;
+ }
+
+ // Copy the original property values into their final locations
+ for (unsigned i = 0; i < propertyCount; i++)
+ object->putDirectOffset(globalData, anonymousSlotCount + i, values[i]);
+
+ m_propertyTable->clearDeletedOffsets();
+ }
+
+ m_dictionaryKind = NoneDictionaryKind;
+ return this;
+}
+
+size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue)
+{
+ ASSERT(!m_enumerationCache);
+
+ if (m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
+ specificValue = 0;
+
+ materializePropertyMapIfNecessary(globalData);
+
+ m_isPinnedPropertyTable = true;
+
+ size_t offset = putSpecificValue(globalData, propertyName, attributes, specificValue);
+ ASSERT(offset >= m_anonymousSlotCount);
+ if (propertyStorageSize() > propertyStorageCapacity())
+ growPropertyStorageCapacity();
+ return offset;
+}
+
+size_t Structure::removePropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName)
+{
+ ASSERT(isUncacheableDictionary());
+ ASSERT(!m_enumerationCache);
+
+ materializePropertyMapIfNecessary(globalData);
+
+ m_isPinnedPropertyTable = true;
+ size_t offset = remove(propertyName);
+ ASSERT(offset >= m_anonymousSlotCount);
+ return offset;
+}
+
+#if DUMP_PROPERTYMAP_STATS
+
+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
+
+#if !DO_PROPERTYMAP_CONSTENCY_CHECK
+
+inline void Structure::checkConsistency()
+{
+}
+
+#endif
+
+PassOwnPtr<PropertyTable> Structure::copyPropertyTable(JSGlobalData& globalData, Structure* owner)
+{
+ return adoptPtr(m_propertyTable ? new PropertyTable(globalData, owner, *m_propertyTable) : 0);
+}
+
+size_t Structure::get(JSGlobalData& globalData, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue)
+{
+ materializePropertyMapIfNecessary(globalData);
+ if (!m_propertyTable)
+ return WTF::notFound;
+
+ PropertyMapEntry* entry = m_propertyTable->find(propertyName).first;
+ if (!entry)
+ return WTF::notFound;
+
+ attributes = entry->attributes;
+ specificValue = entry->specificValue.get();
+ ASSERT(entry->offset >= m_anonymousSlotCount);
+ return entry->offset;
+}
+
+bool Structure::despecifyFunction(JSGlobalData& globalData, const Identifier& propertyName)
+{
+ materializePropertyMapIfNecessary(globalData);
+ if (!m_propertyTable)
+ return false;
+
+ ASSERT(!propertyName.isNull());
+ PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first;
+ if (!entry)
+ return false;
+
+ ASSERT(entry->specificValue);
+ entry->specificValue.clear();
+ return true;
+}
+
+void Structure::despecifyAllFunctions(JSGlobalData& globalData)
+{
+ materializePropertyMapIfNecessary(globalData);
+ if (!m_propertyTable)
+ return;
+
+ PropertyTable::iterator end = m_propertyTable->end();
+ for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter)
+ iter->specificValue.clear();
+}
+
+size_t Structure::putSpecificValue(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue)
+{
+ ASSERT(!propertyName.isNull());
+ ASSERT(get(globalData, propertyName) == notFound);
+
+ checkConsistency();
+ if (attributes & DontEnum)
+ m_hasNonEnumerableProperties = true;
+
+ StringImpl* rep = propertyName.impl();
+
+ if (!m_propertyTable)
+ createPropertyMap();
+
+ unsigned newOffset;
+
+ if (m_propertyTable->hasDeletedOffset())
+ newOffset = m_propertyTable->getDeletedOffset();
+ else
+ newOffset = m_propertyTable->size() + m_anonymousSlotCount;
+ ASSERT(newOffset >= m_anonymousSlotCount);
+
+ m_propertyTable->add(PropertyMapEntry(globalData, this, rep, newOffset, attributes, specificValue));
+
+ checkConsistency();
+ return newOffset;
+}
+
+size_t Structure::remove(const Identifier& propertyName)
+{
+ ASSERT(!propertyName.isNull());
+
+ checkConsistency();
+
+ StringImpl* rep = propertyName.impl();
+
+ if (!m_propertyTable)
+ return notFound;
+
+ PropertyTable::find_iterator position = m_propertyTable->find(rep);
+ if (!position.first)
+ return notFound;
+
+ size_t offset = position.first->offset;
+ ASSERT(offset >= m_anonymousSlotCount);
+
+ m_propertyTable->remove(position);
+ m_propertyTable->addDeletedOffset(offset);
+
+ checkConsistency();
+ return offset;
+}
+
+void Structure::createPropertyMap(unsigned capacity)
+{
+ ASSERT(!m_propertyTable);
+
+ checkConsistency();
+ m_propertyTable = adoptPtr(new PropertyTable(capacity));
+ checkConsistency();
+}
+
+void Structure::getPropertyNames(JSGlobalData& globalData, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ materializePropertyMapIfNecessary(globalData);
+ if (!m_propertyTable)
+ return;
+
+ bool knownUnique = !propertyNames.size();
+
+ PropertyTable::iterator end = m_propertyTable->end();
+ for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
+ ASSERT(m_hasNonEnumerableProperties || !(iter->attributes & DontEnum));
+ if (!(iter->attributes & DontEnum) || (mode == IncludeDontEnumProperties)) {
+ if (knownUnique)
+ propertyNames.addKnownUnique(iter->key);
+ else
+ propertyNames.add(iter->key);
+ }
+ }
+}
+
+void Structure::visitChildren(SlotVisitor& visitor)
+{
+ JSCell::visitChildren(visitor);
+ if (m_prototype)
+ visitor.append(&m_prototype);
+ if (m_cachedPrototypeChain)
+ visitor.append(&m_cachedPrototypeChain);
+ if (m_previous)
+ visitor.append(&m_previous);
+ if (m_specificValueInPrevious)
+ visitor.append(&m_specificValueInPrevious);
+ if (m_enumerationCache)
+ visitor.append(&m_enumerationCache);
+ if (m_propertyTable) {
+ PropertyTable::iterator end = m_propertyTable->end();
+ for (PropertyTable::iterator ptr = m_propertyTable->begin(); ptr != end; ++ptr) {
+ if (ptr->specificValue)
+ visitor.append(&ptr->specificValue);
+ }
+ }
+}
+
+#if DO_PROPERTYMAP_CONSTENCY_CHECK
+
+void PropertyTable::checkConsistency()
+{
+ ASSERT(m_indexSize >= PropertyTable::MinimumTableSize);
+ ASSERT(m_indexMask);
+ ASSERT(m_indexSize == m_indexMask + 1);
+ ASSERT(!(m_indexSize & m_indexMask));
+
+ ASSERT(m_keyCount <= m_indexSize / 2);
+ ASSERT(m_keyCount + m_deletedCount <= m_indexSize / 2);
+ ASSERT(m_deletedCount <= m_indexSize / 4);
+
+ unsigned indexCount = 0;
+ unsigned deletedIndexCount = 0;
+ for (unsigned a = 0; a != m_indexSize; ++a) {
+ unsigned entryIndex = m_index[a];
+ if (entryIndex == PropertyTable::EmptyEntryIndex)
+ continue;
+ if (entryIndex == deletedEntryIndex()) {
+ ++deletedIndexCount;
+ continue;
+ }
+ ASSERT(entryIndex < deletedEntryIndex());
+ ASSERT(entryIndex - 1 <= usedCount());
+ ++indexCount;
+
+ for (unsigned b = a + 1; b != m_indexSize; ++b)
+ ASSERT(m_index[b] != entryIndex);
+ }
+ ASSERT(indexCount == m_keyCount);
+ ASSERT(deletedIndexCount == m_deletedCount);
+
+ ASSERT(!table()[deletedEntryIndex() - 1].key);
+
+ unsigned nonEmptyEntryCount = 0;
+ for (unsigned c = 0; c < usedCount(); ++c) {
+ StringImpl* rep = table()[c].key;
+ if (rep == PROPERTY_MAP_DELETED_ENTRY_KEY)
+ continue;
+ ++nonEmptyEntryCount;
+ unsigned i = rep->existingHash();
+ unsigned k = 0;
+ unsigned entryIndex;
+ while (1) {
+ entryIndex = m_index[i & m_indexMask];
+ ASSERT(entryIndex != PropertyTable::EmptyEntryIndex);
+ if (rep == table()[entryIndex - 1].key)
+ break;
+ if (k == 0)
+ k = 1 | doubleHash(rep->existingHash());
+ i += k;
+ }
+ ASSERT(entryIndex == c + 1);
+ }
+
+ ASSERT(nonEmptyEntryCount == m_keyCount);
+}
+
+void Structure::checkConsistency()
+{
+ if (!m_propertyTable)
+ return;
+
+ if (!m_hasNonEnumerableProperties) {
+ PropertyTable::iterator end = m_propertyTable->end();
+ for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
+ ASSERT(!(iter->attributes & DontEnum));
+ ASSERT(iter->offset >= m_anonymousSlotCount);
+ }
+ }
+
+ m_propertyTable->checkConsistency();
+}
+
+#endif // DO_PROPERTYMAP_CONSTENCY_CHECK
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.h
new file mode 100644
index 0000000..a2857e1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Structure.h
@@ -0,0 +1,316 @@
+/*
+ * 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 "JSCell.h"
+#include "JSType.h"
+#include "JSValue.h"
+#include "PropertyMapHashTable.h"
+#include "PropertyNameArray.h"
+#include "Protect.h"
+#include "StructureTransitionTable.h"
+#include "JSTypeInfo.h"
+#include "UString.h"
+#include "Weak.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+
+namespace JSC {
+
+ class MarkStack;
+ class PropertyNameArray;
+ class PropertyNameArrayData;
+ class StructureChain;
+ typedef MarkStack SlotVisitor;
+
+ struct ClassInfo;
+
+ enum EnumerationMode {
+ ExcludeDontEnumProperties,
+ IncludeDontEnumProperties
+ };
+
+ class Structure : public JSCell {
+ public:
+ friend class StructureTransitionTable;
+ static Structure* create(JSGlobalData& globalData, JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount, const ClassInfo* classInfo)
+ {
+ ASSERT(globalData.structureStructure);
+ ASSERT(classInfo);
+ return new (&globalData) Structure(globalData, prototype, typeInfo, anonymousSlotCount, classInfo);
+ }
+
+ static void dumpStatistics();
+
+ static Structure* addPropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset);
+ static Structure* addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset);
+ static Structure* removePropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, size_t& offset);
+ static Structure* changePrototypeTransition(JSGlobalData&, Structure*, JSValue prototype);
+ static Structure* despecifyFunctionTransition(JSGlobalData&, Structure*, const Identifier&);
+ static Structure* getterSetterTransition(JSGlobalData&, Structure*);
+ static Structure* toCacheableDictionaryTransition(JSGlobalData&, Structure*);
+ static Structure* toUncacheableDictionaryTransition(JSGlobalData&, Structure*);
+ static Structure* sealTransition(JSGlobalData&, Structure*);
+ static Structure* freezeTransition(JSGlobalData&, Structure*);
+ static Structure* preventExtensionsTransition(JSGlobalData&, Structure*);
+
+ bool isSealed(JSGlobalData&);
+ bool isFrozen(JSGlobalData&);
+ bool isExtensible() const { return !m_preventExtensions; }
+ bool didTransition() const { return m_didTransition; }
+
+ Structure* flattenDictionaryStructure(JSGlobalData&, JSObject*);
+
+ ~Structure();
+
+ // These should be used with caution.
+ size_t addPropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
+ size_t removePropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName);
+ void setPrototypeWithoutTransition(JSGlobalData& globalData, JSValue prototype) { m_prototype.set(globalData, this, prototype); }
+
+ bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; }
+ bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; }
+
+ const TypeInfo& typeInfo() const { ASSERT(structure()->classInfo() == &s_info); return m_typeInfo; }
+
+ JSValue storedPrototype() const { return m_prototype.get(); }
+ JSValue prototypeForLookup(ExecState*) const;
+ StructureChain* prototypeChain(ExecState*) const;
+ void visitChildren(SlotVisitor&);
+
+ Structure* previousID() const { ASSERT(structure()->classInfo() == &s_info); return m_previous.get(); }
+
+ void growPropertyStorageCapacity();
+ unsigned propertyStorageCapacity() const { ASSERT(structure()->classInfo() == &s_info); return m_propertyStorageCapacity; }
+ unsigned propertyStorageSize() const { ASSERT(structure()->classInfo() == &s_info); return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable->propertyStorageSize() : static_cast<unsigned>(m_offset + 1)); }
+ bool isUsingInlineStorage() const;
+
+ size_t get(JSGlobalData&, const Identifier& propertyName);
+ size_t get(JSGlobalData&, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue);
+ size_t get(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue)
+ {
+ ASSERT(!propertyName.isNull());
+ ASSERT(structure()->classInfo() == &s_info);
+ return get(globalData, propertyName.impl(), attributes, specificValue);
+ }
+
+ 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->isEmpty() : m_offset == noOffset; }
+
+ void despecifyDictionaryFunction(JSGlobalData&, const Identifier& propertyName);
+ void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; }
+
+ void setEnumerationCache(JSGlobalData&, JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h.
+ JSPropertyNameIterator* enumerationCache(); // Defined in JSPropertyNameIterator.h.
+ void getPropertyNames(JSGlobalData&, PropertyNameArray&, EnumerationMode mode);
+
+ const ClassInfo* classInfo() const { return m_classInfo; }
+
+ static ptrdiff_t prototypeOffset()
+ {
+ return OBJECT_OFFSETOF(Structure, m_prototype);
+ }
+
+ static ptrdiff_t typeInfoFlagsOffset()
+ {
+ return OBJECT_OFFSETOF(Structure, m_typeInfo) + TypeInfo::flagsOffset();
+ }
+
+ static ptrdiff_t typeInfoTypeOffset()
+ {
+ return OBJECT_OFFSETOF(Structure, m_typeInfo) + TypeInfo::typeOffset();
+ }
+
+ static Structure* createStructure(JSGlobalData& globalData)
+ {
+ ASSERT(!globalData.structureStructure);
+ return new (&globalData) Structure(globalData);
+ }
+
+ private:
+ Structure(JSGlobalData&, JSValue prototype, const TypeInfo&, unsigned anonymousSlotCount, const ClassInfo*);
+ Structure(JSGlobalData&);
+ Structure(JSGlobalData&, const Structure*);
+
+ static Structure* create(JSGlobalData& globalData, const Structure* structure)
+ {
+ ASSERT(globalData.structureStructure);
+ return new (&globalData) Structure(globalData, structure);
+ }
+
+ static JS_EXPORTDATA const ClassInfo s_info;
+
+ typedef enum {
+ NoneDictionaryKind = 0,
+ CachedDictionaryKind = 1,
+ UncachedDictionaryKind = 2
+ } DictionaryKind;
+ static Structure* toDictionaryTransition(JSGlobalData&, Structure*, DictionaryKind);
+
+ size_t putSpecificValue(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
+ size_t remove(const Identifier& propertyName);
+
+ void createPropertyMap(unsigned keyCount = 0);
+ void checkConsistency();
+
+ bool despecifyFunction(JSGlobalData&, const Identifier&);
+ void despecifyAllFunctions(JSGlobalData&);
+
+ PassOwnPtr<PropertyTable> copyPropertyTable(JSGlobalData&, Structure* owner);
+ void materializePropertyMap(JSGlobalData&);
+ void materializePropertyMapIfNecessary(JSGlobalData& globalData)
+ {
+ ASSERT(structure()->classInfo() == &s_info);
+ if (!m_propertyTable && m_previous)
+ materializePropertyMap(globalData);
+ }
+
+ 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;
+ }
+
+ bool isValid(ExecState*, StructureChain* cachedPrototypeChain) const;
+
+ static const signed char s_maxTransitionLength = 64;
+
+ static const signed char noOffset = -1;
+
+ static const unsigned maxSpecificFunctionThrashCount = 3;
+
+ TypeInfo m_typeInfo;
+
+ WriteBarrier<Unknown> m_prototype;
+ mutable WriteBarrier<StructureChain> m_cachedPrototypeChain;
+
+ WriteBarrier<Structure> m_previous;
+ RefPtr<StringImpl> m_nameInPrevious;
+ WriteBarrier<JSCell> m_specificValueInPrevious;
+
+ const ClassInfo* m_classInfo;
+
+ StructureTransitionTable m_transitionTable;
+
+ WriteBarrier<JSPropertyNameIterator> m_enumerationCache;
+
+ OwnPtr<PropertyTable> 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_preventExtensions : 1;
+ unsigned m_didTransition : 1;
+ // 3 free bits
+ };
+
+ inline size_t Structure::get(JSGlobalData& globalData, const Identifier& propertyName)
+ {
+ ASSERT(structure()->classInfo() == &s_info);
+ materializePropertyMapIfNecessary(globalData);
+ if (!m_propertyTable)
+ return notFound;
+
+ PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first;
+ ASSERT(!entry || entry->offset >= m_anonymousSlotCount);
+ return entry ? entry->offset : notFound;
+ }
+
+ inline bool JSCell::isObject() const
+ {
+ return m_structure->typeInfo().type() == ObjectType;
+ }
+
+ inline bool JSCell::isString() const
+ {
+ return m_structure->typeInfo().type() == StringType;
+ }
+
+ inline const ClassInfo* JSCell::classInfo() const
+ {
+ return m_structure->classInfo();
+ }
+
+ inline Structure* JSCell::createDummyStructure(JSGlobalData& globalData)
+ {
+ return Structure::create(globalData, jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount, &s_dummyCellInfo);
+ }
+
+ inline bool JSValue::needsThisConversion() const
+ {
+ if (UNLIKELY(!isCell()))
+ return true;
+ return asCell()->structure()->typeInfo().needsThisConversion();
+ }
+
+ ALWAYS_INLINE void MarkStack::internalAppend(JSCell* cell)
+ {
+ ASSERT(!m_isCheckingForDefaultMarkViolation);
+ ASSERT(cell);
+ if (Heap::testAndSetMarked(cell))
+ return;
+ if (cell->structure()->typeInfo().type() >= CompoundType)
+ m_values.append(cell);
+ }
+
+ inline StructureTransitionTable::Hash::Key StructureTransitionTable::keyForWeakGCMapFinalizer(void*, Structure* structure)
+ {
+ // Newer versions of the STL have an std::make_pair function that takes rvalue references.
+ // When either of the parameters are bitfields, the C++ compiler will try to bind them as lvalues, which is invalid. To work around this, use unary "+" to make the parameter an rvalue.
+ // See https://bugs.webkit.org/show_bug.cgi?id=59261 for more details.
+ return Hash::Key(structure->m_nameInPrevious.get(), +structure->m_attributesInPrevious);
+ }
+
+} // namespace JSC
+
+#endif // Structure_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.cpp
new file mode 100644
index 0000000..062951d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.cpp
@@ -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.
+ */
+
+#include "config.h"
+#include "StructureChain.h"
+
+#include "JSObject.h"
+#include "Structure.h"
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ClassInfo StructureChain::s_info = { "StructureChain", 0, 0, 0 };
+
+StructureChain::StructureChain(JSGlobalData& globalData, Structure* structure, Structure* head)
+ : JSCell(globalData, structure)
+{
+ size_t size = 0;
+ for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+ ++size;
+
+ m_vector = adoptArrayPtr(new WriteBarrier<Structure>[size + 1]);
+
+ size_t i = 0;
+ for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+ m_vector[i++].set(globalData, this, current);
+ m_vector[i].clear();
+}
+
+StructureChain::~StructureChain()
+{
+}
+
+void StructureChain::visitChildren(SlotVisitor& visitor)
+{
+ size_t i = 0;
+ while (m_vector[i])
+ visitor.append(&m_vector[i++]);
+}
+
+} // namespace JSC
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.h
new file mode 100644
index 0000000..50323fd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureChain.h
@@ -0,0 +1,60 @@
+/*
+ * 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 "JSCell.h"
+#include "Structure.h"
+
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ class Structure;
+
+ class StructureChain : public JSCell {
+ friend class JIT;
+
+ public:
+ static StructureChain* create(JSGlobalData& globalData, Structure* head) { return new (&globalData) StructureChain(globalData, globalData.structureChainStructure.get(), head); }
+ WriteBarrier<Structure>* head() { return m_vector.get(); }
+ void visitChildren(SlotVisitor&);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesVisitChildren), 0, &s_info); }
+
+ private:
+ StructureChain(JSGlobalData&, Structure*, Structure* head);
+ ~StructureChain();
+ OwnArrayPtr<WriteBarrier<Structure> > m_vector;
+ static ClassInfo s_info;
+ };
+
+} // namespace JSC
+
+#endif // StructureChain_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureTransitionTable.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureTransitionTable.h
new file mode 100644
index 0000000..adebad2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/StructureTransitionTable.h
@@ -0,0 +1,173 @@
+/*
+ * 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 "WeakGCMap.h"
+#include <wtf/HashFunctions.h>
+#include <wtf/HashTraits.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+class Structure;
+
+class StructureTransitionTable {
+ static const intptr_t UsingSingleSlotFlag = 1;
+
+ struct Hash {
+ 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 HashTraits {
+ 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); }
+ };
+
+ struct WeakGCMapFinalizerCallback {
+ static void* finalizerContextFor(Hash::Key)
+ {
+ return 0;
+ }
+
+ static inline Hash::Key keyForFinalizer(void* context, Structure* structure)
+ {
+ return keyForWeakGCMapFinalizer(context, structure);
+ }
+ };
+
+ typedef WeakGCMap<Hash::Key, Structure, WeakGCMapFinalizerCallback, Hash, HashTraits> TransitionMap;
+
+ static Hash::Key keyForWeakGCMapFinalizer(void* context, Structure*);
+
+public:
+ StructureTransitionTable()
+ : m_data(UsingSingleSlotFlag)
+ {
+ }
+
+ ~StructureTransitionTable()
+ {
+ if (!isUsingSingleSlot())
+ delete map();
+ else
+ clearSingleTransition();
+ }
+
+ inline void add(JSGlobalData&, Structure*);
+ inline void remove(Structure*);
+ inline bool contains(StringImpl* rep, unsigned attributes) const;
+ inline Structure* get(StringImpl* rep, unsigned attributes) const;
+
+private:
+ bool isUsingSingleSlot() const
+ {
+ return m_data & UsingSingleSlotFlag;
+ }
+
+ TransitionMap* map() const
+ {
+ ASSERT(!isUsingSingleSlot());
+ return reinterpret_cast<TransitionMap*>(m_data);
+ }
+
+ HandleSlot slot() const
+ {
+ ASSERT(isUsingSingleSlot());
+ return reinterpret_cast<HandleSlot>(m_data & ~UsingSingleSlotFlag);
+ }
+
+ void setMap(TransitionMap* map)
+ {
+ ASSERT(isUsingSingleSlot());
+
+ if (HandleSlot slot = this->slot())
+ HandleHeap::heapFor(slot)->deallocate(slot);
+
+ // This implicitly clears the flag that indicates we're using a single transition
+ m_data = reinterpret_cast<intptr_t>(map);
+
+ ASSERT(!isUsingSingleSlot());
+ }
+
+ Structure* singleTransition() const
+ {
+ ASSERT(isUsingSingleSlot());
+ if (HandleSlot slot = this->slot()) {
+ if (*slot)
+ return reinterpret_cast<Structure*>(slot->asCell());
+ }
+ return 0;
+ }
+
+ void clearSingleTransition()
+ {
+ ASSERT(isUsingSingleSlot());
+ if (HandleSlot slot = this->slot())
+ HandleHeap::heapFor(slot)->deallocate(slot);
+ }
+
+ void setSingleTransition(JSGlobalData& globalData, Structure* structure)
+ {
+ ASSERT(isUsingSingleSlot());
+ HandleSlot slot = this->slot();
+ if (!slot) {
+ slot = globalData.allocateGlobalHandle();
+ HandleHeap::heapFor(slot)->makeWeak(slot, 0, 0);
+ m_data = reinterpret_cast<intptr_t>(slot) | UsingSingleSlotFlag;
+ }
+ HandleHeap::heapFor(slot)->writeBarrier(slot, reinterpret_cast<JSCell*>(structure));
+ *slot = reinterpret_cast<JSCell*>(structure);
+ }
+
+ intptr_t m_data;
+};
+
+} // namespace JSC
+
+#endif // StructureTransitionTable_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SymbolTable.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SymbolTable.h
new file mode 100644
index 0000000..2635501
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/SymbolTable.h
@@ -0,0 +1,134 @@
+/*
+ * 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> {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ static PassRefPtr<SharedSymbolTable> create() { return adoptRef(new SharedSymbolTable); }
+ private:
+ SharedSymbolTable() { }
+ };
+
+} // namespace JSC
+
+#endif // SymbolTable_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Terminator.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Terminator.h
new file mode 100644
index 0000000..6b0f236
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/TimeoutChecker.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/TimeoutChecker.cpp
new file mode 100644
index 0000000..d3867d4
--- /dev/null
+++ b/src/3rdparty/webkit/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 static_cast<unsigned> ((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/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/TimeoutChecker.h
index 5925641..5925641 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/TimeoutChecker.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Tracing.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Tracing.h
index c28c85f..c28c85f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Tracing.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/Tracing.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UString.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UString.cpp
new file mode 100644
index 0000000..b70d505
--- /dev/null
+++ b/src/3rdparty/webkit/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 "Heap.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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UString.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UString.h
new file mode 100644
index 0000000..2d76809
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UString.h
@@ -0,0 +1,260 @@
+/*
+ * 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) || CPU(SPARC)
+ 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 { };
+
+} // namespace WTF
+
+#endif
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UStringBuilder.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UStringBuilder.h
new file mode 100644
index 0000000..31ccf38
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UStringConcatenate.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/UStringConcatenate.h
new file mode 100644
index 0000000..0990c72
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WeakGCMap.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WeakGCMap.h
new file mode 100644
index 0000000..5ad1c62
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WeakGCMap.h
@@ -0,0 +1,191 @@
+/*
+ * 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 "Handle.h"
+#include "JSGlobalData.h"
+#include <wtf/HashMap.h>
+
+namespace JSC {
+
+// A HashMap for GC'd values that removes entries when the associated value
+// dies.
+template <typename KeyType, typename MappedType> struct DefaultWeakGCMapFinalizerCallback {
+ static void* finalizerContextFor(KeyType key)
+ {
+ return reinterpret_cast<void*>(key);
+ }
+
+ static KeyType keyForFinalizer(void* context, typename HandleTypes<MappedType>::ExternalType)
+ {
+ return reinterpret_cast<KeyType>(context);
+ }
+};
+
+template<typename KeyType, typename MappedType, typename FinalizerCallback = DefaultWeakGCMapFinalizerCallback<KeyType, MappedType>, typename HashArg = typename DefaultHash<KeyType>::Hash, typename KeyTraitsArg = HashTraits<KeyType> >
+class WeakGCMap : private WeakHandleOwner {
+ WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(WeakGCMap);
+
+ typedef HashMap<KeyType, HandleSlot, HashArg, KeyTraitsArg> MapType;
+ typedef typename HandleTypes<MappedType>::ExternalType ExternalType;
+ typedef typename MapType::iterator map_iterator;
+
+public:
+
+ struct iterator {
+ friend class WeakGCMap;
+ iterator(map_iterator iter)
+ : m_iterator(iter)
+ {
+ }
+
+ std::pair<KeyType, ExternalType> get() const { return std::make_pair(m_iterator->first, HandleTypes<MappedType>::getFromSlot(m_iterator->second)); }
+ std::pair<KeyType, HandleSlot> getSlot() const { return *m_iterator; }
+
+ 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; }
+
+ private:
+ map_iterator m_iterator;
+ };
+
+ WeakGCMap()
+ {
+ }
+
+ bool isEmpty() { return m_map.isEmpty(); }
+ void clear()
+ {
+ map_iterator end = m_map.end();
+ for (map_iterator ptr = m_map.begin(); ptr != end; ++ptr)
+ HandleHeap::heapFor(ptr->second)->deallocate(ptr->second);
+ m_map.clear();
+ }
+
+ bool contains(const KeyType& key) const
+ {
+ return m_map.contains(key);
+ }
+
+ iterator find(const KeyType& key)
+ {
+ return m_map.find(key);
+ }
+
+ void remove(iterator iter)
+ {
+ ASSERT(iter.m_iterator != m_map.end());
+ HandleSlot slot = iter.m_iterator->second;
+ ASSERT(slot);
+ HandleHeap::heapFor(slot)->deallocate(slot);
+ m_map.remove(iter.m_iterator);
+ }
+
+ ExternalType get(const KeyType& key) const
+ {
+ return HandleTypes<MappedType>::getFromSlot(m_map.get(key));
+ }
+
+ HandleSlot getSlot(const KeyType& key) const
+ {
+ return m_map.get(key);
+ }
+
+ pair<iterator, bool> add(JSGlobalData& globalData, const KeyType& key, ExternalType value)
+ {
+ pair<typename MapType::iterator, bool> iter = m_map.add(key, 0);
+ if (iter.second) {
+ HandleSlot slot = globalData.allocateGlobalHandle();
+ iter.first->second = slot;
+ HandleHeap::heapFor(slot)->makeWeak(slot, this, FinalizerCallback::finalizerContextFor(key));
+ HandleHeap::heapFor(slot)->writeBarrier(slot, value);
+ *slot = value;
+ }
+ return iter;
+ }
+
+ void set(iterator iter, ExternalType value)
+ {
+ HandleSlot slot = iter.m_iterator->second;
+ ASSERT(slot);
+ HandleHeap::heapFor(slot)->writeBarrier(slot, value);
+ *slot = value;
+ }
+
+ void set(JSGlobalData& globalData, const KeyType& key, ExternalType value)
+ {
+ pair<typename MapType::iterator, bool> iter = m_map.add(key, 0);
+ HandleSlot slot = iter.first->second;
+ if (iter.second) {
+ slot = globalData.allocateGlobalHandle();
+ HandleHeap::heapFor(slot)->makeWeak(slot, this, key);
+ iter.first->second = slot;
+ }
+ HandleHeap::heapFor(slot)->writeBarrier(slot, value);
+ *slot = value;
+ }
+
+ ExternalType take(const KeyType& key)
+ {
+ HandleSlot slot = m_map.take(key);
+ if (!slot)
+ return HashTraits<ExternalType>::emptyValue();
+ ExternalType result = HandleTypes<MappedType>::getFromSlot(slot);
+ HandleHeap::heapFor(slot)->deallocate(slot);
+ return result;
+ }
+
+ size_t size() { return m_map.size(); }
+
+ iterator begin() { return iterator(m_map.begin()); }
+ iterator end() { return iterator(m_map.end()); }
+
+ ~WeakGCMap()
+ {
+ clear();
+ }
+
+private:
+ virtual void finalize(Handle<Unknown> handle, void* context)
+ {
+ HandleSlot slot = m_map.take(FinalizerCallback::keyForFinalizer(context, HandleTypes<MappedType>::getFromSlot(handle.slot())));
+ ASSERT(slot);
+ HandleHeap::heapFor(slot)->deallocate(slot);
+ }
+
+ MapType m_map;
+};
+
+} // namespace JSC
+
+#endif // WeakGCMap_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WeakRandom.h
index ff3995e..ff3995e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WeakRandom.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WriteBarrier.h b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WriteBarrier.h
new file mode 100644
index 0000000..32cb968
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/WriteBarrier.h
@@ -0,0 +1,190 @@
+/*
+ * 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. 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 WriteBarrier_h
+#define WriteBarrier_h
+
+#include "JSValue.h"
+
+namespace JSC {
+class JSCell;
+class JSGlobalData;
+
+inline void writeBarrier(JSGlobalData&, const JSCell*, JSValue)
+{
+}
+
+inline void writeBarrier(JSGlobalData&, const JSCell*, JSCell*)
+{
+}
+
+typedef enum { } Unknown;
+typedef JSValue* HandleSlot;
+
+template <typename T> struct JSValueChecker {
+ static const bool IsJSValue = false;
+};
+
+template <> struct JSValueChecker<JSValue> {
+ static const bool IsJSValue = true;
+};
+
+// We have a separate base class with no constructors for use in Unions.
+template <typename T> class WriteBarrierBase {
+public:
+ COMPILE_ASSERT(!JSValueChecker<T>::IsJSValue, WriteBarrier_JSValue_is_invalid__use_unknown);
+ void set(JSGlobalData& globalData, const JSCell* owner, T* value)
+ {
+ this->m_cell = reinterpret_cast<JSCell*>(value);
+ writeBarrier(globalData, owner, this->m_cell);
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie(owner));
+ ASSERT(!isZombie(m_cell));
+#endif
+ }
+
+ T* get() const
+ {
+ return reinterpret_cast<T*>(m_cell);
+ }
+
+ T* operator*() const
+ {
+ ASSERT(m_cell);
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie(m_cell));
+#endif
+ return static_cast<T*>(m_cell);
+ }
+
+ T* operator->() const
+ {
+ ASSERT(m_cell);
+ return static_cast<T*>(m_cell);
+ }
+
+ void clear() { m_cell = 0; }
+
+ JSCell** slot() { return &m_cell; }
+
+ typedef T* (WriteBarrierBase::*UnspecifiedBoolType);
+ operator UnspecifiedBoolType*() const { return m_cell ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+
+ bool operator!() const { return !m_cell; }
+
+ void setWithoutWriteBarrier(T* value)
+ {
+ this->m_cell = reinterpret_cast<JSCell*>(value);
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!m_cell || !isZombie(m_cell));
+#endif
+ }
+
+private:
+ JSCell* m_cell;
+};
+
+template <> class WriteBarrierBase<Unknown> {
+public:
+ void set(JSGlobalData& globalData, const JSCell* owner, JSValue value)
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie(owner));
+ ASSERT(!value.isZombie());
+#endif
+ m_value = JSValue::encode(value);
+ writeBarrier(globalData, owner, value);
+ }
+ void setWithoutWriteBarrier(JSValue value)
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!value.isZombie());
+#endif
+ m_value = JSValue::encode(value);
+ }
+
+ JSValue get() const
+ {
+ return JSValue::decode(m_value);
+ }
+ void clear() { m_value = JSValue::encode(JSValue()); }
+ void setUndefined() { m_value = JSValue::encode(jsUndefined()); }
+ bool isNumber() const { return get().isNumber(); }
+ bool isObject() const { return get().isObject(); }
+ bool isNull() const { return get().isNull(); }
+ bool isGetterSetter() const { return get().isGetterSetter(); }
+
+ JSValue* slot()
+ {
+ union {
+ EncodedJSValue* v;
+ JSValue* slot;
+ } u;
+ u.v = &m_value;
+ return u.slot;
+ }
+
+ typedef JSValue (WriteBarrierBase::*UnspecifiedBoolType);
+ operator UnspecifiedBoolType*() const { return get() ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+ bool operator!() const { return !get(); }
+
+private:
+ EncodedJSValue m_value;
+};
+
+template <typename T> class WriteBarrier : public WriteBarrierBase<T> {
+public:
+ WriteBarrier()
+ {
+ this->setWithoutWriteBarrier(0);
+ }
+
+ WriteBarrier(JSGlobalData& globalData, const JSCell* owner, T* value)
+ {
+ this->set(globalData, owner, value);
+ }
+};
+
+template <> class WriteBarrier<Unknown> : public WriteBarrierBase<Unknown> {
+public:
+ WriteBarrier()
+ {
+ this->setWithoutWriteBarrier(JSValue());
+ }
+
+ WriteBarrier(JSGlobalData& globalData, const JSCell* owner, JSValue value)
+ {
+ this->set(globalData, owner, value);
+ }
+};
+
+template <typename U, typename V> inline bool operator==(const WriteBarrierBase<U>& lhs, const WriteBarrierBase<V>& rhs)
+{
+ return lhs.get() == rhs.get();
+}
+
+} // namespace JSC
+
+#endif // WriteBarrier_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeLists.txt b/src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeLists.txt
new file mode 100644
index 0000000..a327204
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeListsEfl.txt b/src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeListsEfl.txt
new file mode 100644
index 0000000..58d44f4
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeListsWinCE.txt b/src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeListsWinCE.txt
new file mode 100644
index 0000000..0b7a3bf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/shell/CMakeListsWinCE.txt
@@ -0,0 +1,3 @@
+LIST(APPEND JSC_SOURCES
+ ../os-win32/WinMain.cpp
+)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wscript b/src/3rdparty/webkit/Source/JavaScriptCore/wscript
new file mode 100644
index 0000000..3df3ded
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wscript
@@ -0,0 +1,85 @@
+#! /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 *
+
+def build(bld):
+
+ import Options
+
+ jscore_excludes = ['jsc.cpp', 'ProfilerServer.mm', 'ExecutableAllocatorPosix.cpp']
+ jscore_excludes.extend(get_excludes(jscore_dir, ['*Brew.cpp', '*CF.cpp', '*Symbian.cpp']))
+
+ jscore_excludes.extend(get_excludes(jscore_dir, ['*None.cpp']))
+
+ sources = []
+
+ if Options.options.port == "wx":
+ if building_on_win32:
+ jscore_excludes += ['MarkStackPosix.cpp', 'OSAllocatorPosix.cpp', 'ThreadingPthreads.cpp']
+ sources += ['heap/MarkStackWin.cpp']
+ else:
+ jscore_excludes.append('JSStringRefBSTR.cpp')
+ jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp']))
+
+ full_dirs = get_dirs_for_features(jscore_dir, features=[Options.options.port.lower()], 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ASCIICType.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ASCIICType.h
new file mode 100644
index 0000000..c19b85a
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/AVLTree.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/AVLTree.h
new file mode 100644
index 0000000..ec8a639
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Alignment.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Alignment.h
new file mode 100644
index 0000000..1903aad
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Alignment.h
@@ -0,0 +1,36 @@
+/*
+ * 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_Alignment_h
+#define WTF_Alignment_h
+
+#include <wtf/Platform.h>
+
+#if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(WINSCW) || COMPILER(GCCE)
+ #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
+
+#endif // WTF_Alignment_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/AlwaysInline.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/AlwaysInline.h
new file mode 100644
index 0000000..bacbdd0
--- /dev/null
+++ b/src/3rdparty/webkit/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 COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
+#define UNLIKELY(x) __builtin_expect((x), 0)
+#else
+#define UNLIKELY(x) (x)
+#endif
+#endif
+
+#ifndef LIKELY
+#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.cpp
new file mode 100644
index 0000000..d52ac6d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.cpp
@@ -0,0 +1,298 @@
+/*
+ * 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.
+ */
+
+// The vprintf_stderr_common function triggers this error in the Mac build.
+// Feel free to remove this pragma if this file builds on Mac.
+// According to http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
+// we need to place this directive before any data or functions are defined.
+#pragma GCC diagnostic ignored "-Wmissing-format-attribute"
+
+#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
+
+#if PLATFORM(MAC)
+#include <cxxabi.h>
+#include <dlfcn.h>
+#include <execinfo.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);
+ return;
+ }
+#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(WINDOWS) && !OS(WINCE) && defined(_DEBUG)
+ _CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", function);
+#else
+ // By using this format, which matches the format used by MSVC for compiler errors, developers
+ // using Visual Studio can double-click the file/line number in the Output Window to have the
+ // editor navigate to that line of code. It seems fine for other developers, too.
+ 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 WTFReportBacktrace()
+{
+#if PLATFORM(MAC)
+ static const int maxFrames = 32;
+ void* samples[maxFrames];
+ int frames = backtrace(samples, maxFrames);
+
+ for (int i = 1; i < frames; ++i) {
+ void* pointer = samples[i];
+
+ // Try to get a symbol name from the dynamic linker.
+ Dl_info info;
+ if (dladdr(pointer, &info) && info.dli_sname) {
+ const char* mangledName = info.dli_sname;
+
+ // Assume c++ & try to demangle the name.
+ char* demangledName = abi::__cxa_demangle(mangledName, 0, 0, 0);
+ if (demangledName) {
+ fprintf(stderr, "%-3d %s\n", i, demangledName);
+ free(demangledName);
+ } else
+ fprintf(stderr, "%-3d %s\n", i, mangledName);
+ } else
+ fprintf(stderr, "%-3d %p\n", i, pointer);
+ }
+#endif
+}
+
+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);
+
+ size_t formatLength = strlen(format);
+ if (formatLength && format[formatLength - 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);
+
+ size_t formatLength = strlen(format);
+ if (formatLength && format[formatLength - 1] != '\n')
+ printf_stderr_common("\n");
+
+ printCallSite(file, line, function);
+}
+
+} // extern "C"
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.h
new file mode 100644
index 0000000..862158b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Assertions.h
@@ -0,0 +1,382 @@
+/*
+ * 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 BACKTRACE_DISABLED
+#define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#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;
+
+WTF_EXPORT_PRIVATE void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion);
+WTF_EXPORT_PRIVATE void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
+WTF_EXPORT_PRIVATE void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion);
+WTF_EXPORT_PRIVATE void WTFReportBacktrace();
+WTF_EXPORT_PRIVATE void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+WTF_EXPORT_PRIVATE void WTFReportError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+WTF_EXPORT_PRIVATE void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3);
+WTF_EXPORT_PRIVATE void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel*, 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 { \
+ WTFReportBacktrace(); \
+ *(int *)(uintptr_t)0xbbadbeef = 0; \
+ ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
+} while(false)
+#endif
+#endif
+
+/* BACKTRACE
+
+ Print a backtrace to the same location as ASSERT messages.
+*/
+
+#if BACKTRACE_DISABLED
+
+#define BACKTRACE() ((void)0)
+
+#else
+
+#define BACKTRACE() do { \
+ WTFReportBacktrace(); \
+} while(false)
+
+#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_WITH_MESSAGE_UNUSED */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion) ((void)0)
+#elif COMPILER(WINSCW)
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, arg...) ((void)0)
+#elif ASSERT_MSG_DISABLED
+#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
+template<typename T>
+inline void assertWithMessageUnused(T& x) { (void)x; }
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) (assertWithMessageUnused(variable))
+#else
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) ((void)variable)
+#endif
+#else
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Atomics.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Atomics.h
new file mode 100644
index 0000000..1ebd487
--- /dev/null
+++ b/src/3rdparty/webkit/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_THREADSAFEREFCOUNTED 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_THREADSAFEREFCOUNTED 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_THREADSAFEREFCOUNTED 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_THREADSAFEREFCOUNTED)
+using WTF::atomicDecrement;
+using WTF::atomicIncrement;
+#endif
+
+#endif // Atomics_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Bitmap.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Bitmap.h
new file mode 100644
index 0000000..9ee7f4a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Bitmap.h
@@ -0,0 +1,162 @@
+/*
+ * 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>
+#include <string.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);
+ bool testAndSet(size_t);
+ size_t nextPossiblyUnset(size_t) const;
+ void clear(size_t);
+ void clearAll();
+ int64_t findRunOfZeros(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 bool Bitmap<size>::testAndSet(size_t n)
+{
+ WordType mask = one << (n % wordSize);
+ size_t index = n / wordSize;
+ bool result = bits[index] & mask;
+ bits[index] |= mask;
+ return result;
+}
+
+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 size_t Bitmap<size>::nextPossiblyUnset(size_t start) const
+{
+ if (!~bits[start / wordSize])
+ return ((start / wordSize) + 1) * wordSize;
+ return start + 1;
+}
+
+template<size_t size>
+inline int64_t Bitmap<size>::findRunOfZeros(size_t runLength) const
+{
+ if (!runLength)
+ runLength = 1;
+
+ for (size_t i = 0; i <= (size - runLength) ; i++) {
+ bool found = true;
+ for (size_t j = i; j <= (i + runLength - 1) ; j++) {
+ if (get(j)) {
+ found = false;
+ break;
+ }
+ }
+ if (found)
+ return i;
+ }
+ return -1;
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BlockStack.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BlockStack.h
new file mode 100644
index 0000000..a4d7425
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BlockStack.h
@@ -0,0 +1,95 @@
+/*
+ * 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. 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 BlockStack_h
+#define BlockStack_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+template <typename T> class BlockStack {
+public:
+ static const size_t blockSize = 4096;
+ static const size_t blockLength = blockSize / sizeof(T);
+
+ BlockStack();
+ ~BlockStack();
+
+ T* grow();
+ void shrink(T*);
+
+ const Vector<T*>& blocks();
+
+private:
+ Vector<T*> m_blocks;
+ T* m_spareBlock; // Used to avoid thrash at block boundaries.
+};
+
+template <typename T> BlockStack<T>::BlockStack()
+ : m_spareBlock(0)
+{
+}
+
+template <typename T> BlockStack<T>::~BlockStack()
+{
+ if (m_spareBlock)
+ free(m_spareBlock);
+ for (size_t i = 0; i < m_blocks.size(); ++i)
+ free(m_blocks[i]);
+}
+
+template <typename T> inline const Vector<T*>& BlockStack<T>::blocks()
+{
+ return m_blocks;
+}
+
+template <typename T> T* BlockStack<T>::grow()
+{
+ T* block = m_spareBlock ? m_spareBlock : static_cast<T*>(malloc(blockSize));
+ m_spareBlock = 0;
+
+ m_blocks.append(block);
+ return block;
+}
+
+template <typename T> void BlockStack<T>::shrink(T* newEnd)
+{
+ ASSERT(newEnd != m_blocks.last() + blockLength);
+ m_spareBlock = m_blocks.last();
+ m_blocks.removeLast();
+
+ while (m_blocks.last() + blockLength != newEnd) {
+ free(m_blocks.last());
+ m_blocks.removeLast();
+ }
+}
+
+}
+
+using WTF::BlockStack;
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BloomFilter.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BloomFilter.h
new file mode 100644
index 0000000..f81d83e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BloomFilter.h
@@ -0,0 +1,139 @@
+/*
+ * 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. 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 BloomFilter_h
+#define BloomFilter_h
+
+#include <wtf/AlwaysInline.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WTF {
+
+// Counting bloom filter with k=2 and 8 bit counters. Uses 2^keyBits bytes of memory.
+// False positive rate is approximately (1-e^(-2n/m))^2, where n is the number of unique
+// keys and m is the table size (==2^keyBits).
+template <unsigned keyBits>
+class BloomFilter {
+public:
+ COMPILE_ASSERT(keyBits <= 16, bloom_filter_key_size);
+
+ static const size_t tableSize = 1 << keyBits;
+ static const unsigned keyMask = (1 << keyBits) - 1;
+ static uint8_t maximumCount() { return std::numeric_limits<uint8_t>::max(); }
+
+ BloomFilter() { clear(); }
+
+ void add(unsigned hash);
+ void remove(unsigned hash);
+
+ // The filter may give false positives (claim it may contain a key it doesn't)
+ // but never false negatives (claim it doesn't contain a key it does).
+ bool mayContain(unsigned hash) const { return firstSlot(hash) && secondSlot(hash); }
+
+ // The filter must be cleared before reuse even if all keys are removed.
+ // Otherwise overflowed keys will stick around.
+ void clear();
+
+ void add(const AtomicString& string) { add(string.impl()->existingHash()); }
+ void add(const String& string) { add(string.impl()->hash()); }
+ void remove(const AtomicString& string) { remove(string.impl()->existingHash()); }
+ void remove(const String& string) { remove(string.impl()->hash()); }
+
+ bool mayContain(const AtomicString& string) const { return mayContain(string.impl()->existingHash()); }
+ bool mayContain(const String& string) const { return mayContain(string.impl()->hash()); }
+
+#if !ASSERT_DISABLED
+ // Slow.
+ bool likelyEmpty() const;
+ bool isClear() const;
+#endif
+
+private:
+ uint8_t& firstSlot(unsigned hash) { return m_table[hash & keyMask]; }
+ uint8_t& secondSlot(unsigned hash) { return m_table[(hash >> 16) & keyMask]; }
+ const uint8_t& firstSlot(unsigned hash) const { return m_table[hash & keyMask]; }
+ const uint8_t& secondSlot(unsigned hash) const { return m_table[(hash >> 16) & keyMask]; }
+
+ uint8_t m_table[tableSize];
+};
+
+template <unsigned keyBits>
+inline void BloomFilter<keyBits>::add(unsigned hash)
+{
+ uint8_t& first = firstSlot(hash);
+ uint8_t& second = secondSlot(hash);
+ if (LIKELY(first < maximumCount()))
+ ++first;
+ if (LIKELY(second < maximumCount()))
+ ++second;
+}
+
+template <unsigned keyBits>
+inline void BloomFilter<keyBits>::remove(unsigned hash)
+{
+ uint8_t& first = firstSlot(hash);
+ uint8_t& second = secondSlot(hash);
+ ASSERT(first);
+ ASSERT(second);
+ // In case of an overflow, the slot sticks in the table until clear().
+ if (LIKELY(first < maximumCount()))
+ --first;
+ if (LIKELY(second < maximumCount()))
+ --second;
+}
+
+template <unsigned keyBits>
+inline void BloomFilter<keyBits>::clear()
+{
+ memset(m_table, 0, tableSize);
+}
+
+#if !ASSERT_DISABLED
+template <unsigned keyBits>
+bool BloomFilter<keyBits>::likelyEmpty() const
+{
+ for (size_t n = 0; n < tableSize; ++n) {
+ if (m_table[n] && m_table[n] != maximumCount())
+ return false;
+ }
+ return true;
+}
+
+template <unsigned keyBits>
+bool BloomFilter<keyBits>::isClear() const
+{
+ for (size_t n = 0; n < tableSize; ++n) {
+ if (m_table[n])
+ return false;
+ }
+ return true;
+}
+#endif
+
+}
+
+using WTF::BloomFilter;
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BumpPointerAllocator.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/BumpPointerAllocator.h
new file mode 100644
index 0000000..682283c
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ByteArray.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ByteArray.cpp
new file mode 100644
index 0000000..910af59
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ByteArray.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ByteArray.h
new file mode 100644
index 0000000..bdec630
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeLists.txt b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeLists.txt
new file mode 100644
index 0000000..87674b1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeLists.txt
@@ -0,0 +1,172 @@
+SET(WTF_HEADERS
+ ASCIICType.h
+ AVLTree.h
+ Alignment.h
+ AlwaysInline.h
+ Assertions.h
+ Atomics.h
+ Bitmap.h
+ BumpPointerAllocator.h
+ ByteArray.h
+ Complex.h
+ CrossThreadRefCounted.h
+ CryptographicallyRandomNumber.h
+ CurrentTime.h
+ DateMath.h
+ DecimalNumber.h
+ Decoder.h
+ Deque.h
+ DisallowCType.h
+ DoublyLinkedList.h
+ DynamicAnnotations.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
+ HexNumber.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
+ OSRandomSource.h
+ OwnArrayPtr.h
+ OwnFastMallocPtr.h
+ OwnPtr.h
+ OwnPtrCommon.h
+ PageAllocation.h
+ PageAllocationAligned.h
+ PageBlock.h
+ PageReservation.h
+ PassOwnArrayPtr.h
+ PassOwnPtr.h
+ PassRefPtr.h
+ PassTraits.h
+ ParallelJobs.h
+ ParallelJobsGeneric.h
+ ParallelJobsLibdispatch.h
+ ParallelJobsOpenMP.h
+ Platform.h
+ PossiblyNull.h
+ RandomNumber.h
+ RandomNumberSeed.h
+ RefCounted.h
+ RefCountedLeakCounter.h
+ RefPtr.h
+ RefPtrHashMap.h
+ RetainPtr.h
+ SegmentedVector.h
+ SHA1.h
+ StackBounds.h
+ StaticConstructors.h
+ StdLibExtras.h
+ StringExtras.h
+ StringHasher.h
+ TCPackedCache.h
+ TCPageMap.h
+ TCSpinLock.h
+ TCSystemAlloc.h
+ ThreadIdentifierDataPthreads.h
+ ThreadSafeRefCounted.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/CharacterNames.h
+ unicode/Collator.h
+ unicode/UTF8.h
+ unicode/Unicode.h
+)
+
+SET(WTF_SOURCES
+ Assertions.cpp
+ ByteArray.cpp
+ CryptographicallyRandomNumber.cpp
+ CurrentTime.cpp
+ DecimalNumber.cpp
+ DynamicAnnotations.cpp
+ FastMalloc.cpp
+ HashTable.cpp
+ MainThread.cpp
+ MD5.cpp
+ OSRandomSource.cpp
+ ParallelJobsGeneric.cpp
+ RandomNumber.cpp
+ RefCountedLeakCounter.cpp
+ SHA1.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}"
+ "${CMAKE_SOURCE_DIR}/ThirdParty"
+)
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeListsEfl.txt b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeListsEfl.txt
new file mode 100644
index 0000000..e5d8bd7
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeListsWinCE.txt b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CMakeListsWinCE.txt
new file mode 100644
index 0000000..9c558eb
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32 b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32
index 7de0f26..7de0f26 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Complex.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Complex.h
new file mode 100644
index 0000000..40fe56a
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h
new file mode 100644
index 0000000..9d093ee
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h
@@ -0,0 +1,175 @@
+/*
+ * 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 ThreadSafeRefCounted).
+ //
+ // Why not just use ThreadSafeRefCounted?
+ // ThreadSafeRefCounted 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 {
+ WTF_MAKE_NONCOPYABLE(CrossThreadRefCounted);
+ 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, ThreadSafeRefCountedBase* 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;
+ ThreadSafeRefCountedBase* 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 ThreadSafeRefCountedBase(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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp
new file mode 100644
index 0000000..ad8e716
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1996, David Mazieres <dm@uun.org>
+ * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, 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.
+ */
+
+/*
+ * Arc4 random number generator for OpenBSD.
+ *
+ * This code is derived from section 17.1 of Applied Cryptography,
+ * second edition, which describes a stream cipher allegedly
+ * compatible with RSA Labs "RC4" cipher (the actual description of
+ * which is a trade secret). The same algorithm is used as a stream
+ * cipher called "arcfour" in Tatu Ylonen's ssh package.
+ *
+ * RC4 is a registered trademark of RSA Laboratories.
+ */
+
+#include "config.h"
+#include "CryptographicallyRandomNumber.h"
+
+#include "MainThread.h"
+#include "OSRandomSource.h"
+#include "StdLibExtras.h"
+#include "ThreadingPrimitives.h"
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+
+namespace {
+
+class ARC4Stream {
+public:
+ ARC4Stream();
+
+ uint8_t i;
+ uint8_t j;
+ uint8_t s[256];
+};
+
+class ARC4RandomNumberGenerator {
+public:
+ ARC4RandomNumberGenerator();
+
+ uint32_t randomNumber();
+ void randomValues(void* buffer, size_t length);
+
+private:
+ inline void addRandomData(unsigned char *data, int length);
+ void stir();
+ void stirIfNeeded();
+ inline uint8_t getByte();
+ inline uint32_t getWord();
+
+ ARC4Stream m_stream;
+ int m_count;
+#if ENABLE(WTF_MULTIPLE_THREADS)
+ Mutex m_mutex;
+#endif
+};
+
+ARC4Stream::ARC4Stream()
+{
+ for (int n = 0; n < 256; n++)
+ s[n] = n;
+ i = 0;
+ j = 0;
+}
+
+ARC4RandomNumberGenerator::ARC4RandomNumberGenerator()
+ : m_count(0)
+{
+}
+
+void ARC4RandomNumberGenerator::addRandomData(unsigned char* data, int length)
+{
+ m_stream.i--;
+ for (int n = 0; n < 256; n++) {
+ m_stream.i++;
+ uint8_t si = m_stream.s[m_stream.i];
+ m_stream.j += si + data[n % length];
+ m_stream.s[m_stream.i] = m_stream.s[m_stream.j];
+ m_stream.s[m_stream.j] = si;
+ }
+ m_stream.j = m_stream.i;
+}
+
+void ARC4RandomNumberGenerator::stir()
+{
+ unsigned char randomness[128];
+ size_t length = sizeof(randomness);
+ cryptographicallyRandomValuesFromOS(randomness, length);
+ addRandomData(randomness, length);
+
+ // Discard early keystream, as per recommendations in:
+ // http://www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Rc4_ksa.ps
+ for (int i = 0; i < 256; i++)
+ getByte();
+ m_count = 1600000;
+}
+
+void ARC4RandomNumberGenerator::stirIfNeeded()
+{
+ if (m_count <= 0)
+ stir();
+}
+
+uint8_t ARC4RandomNumberGenerator::getByte()
+{
+ m_stream.i++;
+ uint8_t si = m_stream.s[m_stream.i];
+ m_stream.j += si;
+ uint8_t sj = m_stream.s[m_stream.j];
+ m_stream.s[m_stream.i] = sj;
+ m_stream.s[m_stream.j] = si;
+ return (m_stream.s[(si + sj) & 0xff]);
+}
+
+uint32_t ARC4RandomNumberGenerator::getWord()
+{
+ uint32_t val;
+ val = getByte() << 24;
+ val |= getByte() << 16;
+ val |= getByte() << 8;
+ val |= getByte();
+ return val;
+}
+
+uint32_t ARC4RandomNumberGenerator::randomNumber()
+{
+#if ENABLE(WTF_MULTIPLE_THREADS)
+ MutexLocker locker(m_mutex);
+#endif
+
+ m_count -= 4;
+ stirIfNeeded();
+ return getWord();
+}
+
+void ARC4RandomNumberGenerator::randomValues(void* buffer, size_t length)
+{
+#if ENABLE(WTF_MULTIPLE_THREADS)
+ MutexLocker locker(m_mutex);
+#endif
+
+ unsigned char* result = reinterpret_cast<unsigned char*>(buffer);
+ stirIfNeeded();
+ while (length--) {
+ m_count--;
+ stirIfNeeded();
+ result[length] = getByte();
+ }
+}
+
+ARC4RandomNumberGenerator& sharedRandomNumberGenerator()
+{
+ DEFINE_STATIC_LOCAL(ARC4RandomNumberGenerator, randomNumberGenerator, ());
+ return randomNumberGenerator;
+}
+
+}
+
+uint32_t cryptographicallyRandomNumber()
+{
+ return sharedRandomNumberGenerator().randomNumber();
+}
+
+void cryptographicallyRandomValues(void* buffer, size_t length)
+{
+ sharedRandomNumberGenerator().randomValues(buffer, length);
+}
+
+#endif
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.h
new file mode 100644
index 0000000..348242e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.h
@@ -0,0 +1,45 @@
+/*
+ * 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_CryptographicallyRandomNumber_h
+#define WTF_CryptographicallyRandomNumber_h
+
+#include <stdint.h>
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+uint32_t cryptographicallyRandomNumber();
+void cryptographicallyRandomValues(void* buffer, size_t length);
+#endif
+
+}
+
+#if USE(OS_RANDOMNESS)
+using WTF::cryptographicallyRandomNumber;
+using WTF::cryptographicallyRandomValues;
+#endif
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CurrentTime.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CurrentTime.cpp
new file mode 100644
index 0000000..4205227
--- /dev/null
+++ b/src/3rdparty/webkit/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 USE(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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CurrentTime.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/CurrentTime.h
new file mode 100644
index 0000000..5fcb63a
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.cpp
new file mode 100644
index 0000000..d414eae
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.cpp
@@ -0,0 +1,1160 @@
+/*
+ * 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"
+#if USE(JSC)
+#include "JSObject.h"
+#endif
+#include "MathExtras.h"
+#if USE(JSC)
+#include "ScopeChain.h"
+#endif
+#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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.h
new file mode 100644
index 0000000..2ac284e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DateMath.h
@@ -0,0 +1,233 @@
+/*
+ * 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 <stdint.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 {
+ WTF_MAKE_NONCOPYABLE(GregorianDateTime);
+public:
+ GregorianDateTime()
+ : second(0)
+ , minute(0)
+ , hour(0)
+ , weekDay(0)
+ , monthDay(0)
+ , yearDay(0)
+ , month(0)
+ , year(0)
+ , isDST(0)
+ , utcOffset(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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DecimalNumber.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DecimalNumber.cpp
new file mode 100644
index 0000000..70304e2
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DecimalNumber.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DecimalNumber.h
new file mode 100644
index 0000000..c42f00b
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Decoder.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Decoder.h
new file mode 100644
index 0000000..341d58d
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Deque.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Deque.h
new file mode 100644
index 0000000..8e42335
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Deque.h
@@ -0,0 +1,688 @@
+/*
+ * 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 "PassTraits.h"
+#include "Vector.h"
+
+namespace WTF {
+
+ template<typename T, size_t inlineCapacity> class DequeIteratorBase;
+ template<typename T, size_t inlineCapacity> class DequeIterator;
+ template<typename T, size_t inlineCapacity> class DequeConstIterator;
+ template<typename T, size_t inlineCapacity> class DequeReverseIterator;
+ template<typename T, size_t inlineCapacity> class DequeConstReverseIterator;
+
+ template<typename T, size_t inlineCapacity = 0>
+ class Deque {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ typedef DequeIterator<T, inlineCapacity> iterator;
+ typedef DequeConstIterator<T, inlineCapacity> const_iterator;
+ typedef DequeReverseIterator<T, inlineCapacity> reverse_iterator;
+ typedef DequeConstReverseIterator<T, inlineCapacity> const_reverse_iterator;
+ typedef PassTraits<T> Pass;
+ typedef typename PassTraits<T>::PassType PassType;
+
+ Deque();
+ Deque(const Deque<T, inlineCapacity>&);
+ Deque& operator=(const Deque<T, inlineCapacity>&);
+ ~Deque();
+
+ void swap(Deque<T, inlineCapacity>&);
+
+ 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]; }
+ PassType 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, inlineCapacity>;
+
+ typedef VectorBuffer<T, inlineCapacity> Buffer;
+ typedef VectorTypeOperations<T> TypeOperations;
+ typedef DequeIteratorBase<T, inlineCapacity> 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, size_t inlineCapacity = 0>
+ class DequeIteratorBase {
+ private:
+ typedef DequeIteratorBase<T, inlineCapacity> Base;
+
+ protected:
+ DequeIteratorBase();
+ DequeIteratorBase(const Deque<T, inlineCapacity>*, 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, inlineCapacity>* m_deque;
+ size_t m_index;
+
+ friend class Deque<T, inlineCapacity>;
+
+#ifndef NDEBUG
+ mutable DequeIteratorBase* m_next;
+ mutable DequeIteratorBase* m_previous;
+#endif
+ };
+
+ template<typename T, size_t inlineCapacity = 0>
+ class DequeIterator : public DequeIteratorBase<T, inlineCapacity> {
+ private:
+ typedef DequeIteratorBase<T, inlineCapacity> Base;
+ typedef DequeIterator<T, inlineCapacity> Iterator;
+
+ public:
+ DequeIterator(Deque<T, inlineCapacity>* 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, size_t inlineCapacity = 0>
+ class DequeConstIterator : public DequeIteratorBase<T, inlineCapacity> {
+ private:
+ typedef DequeIteratorBase<T, inlineCapacity> Base;
+ typedef DequeConstIterator<T, inlineCapacity> Iterator;
+ typedef DequeIterator<T, inlineCapacity> NonConstIterator;
+
+ public:
+ DequeConstIterator(const Deque<T, inlineCapacity>* 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, size_t inlineCapacity = 0>
+ class DequeReverseIterator : public DequeIteratorBase<T, inlineCapacity> {
+ private:
+ typedef DequeIteratorBase<T, inlineCapacity> Base;
+ typedef DequeReverseIterator<T, inlineCapacity> Iterator;
+
+ public:
+ DequeReverseIterator(const Deque<T, inlineCapacity>* 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, size_t inlineCapacity = 0>
+ class DequeConstReverseIterator : public DequeIteratorBase<T, inlineCapacity> {
+ private:
+ typedef DequeIteratorBase<T, inlineCapacity> Base;
+ typedef DequeConstReverseIterator<T, inlineCapacity> Iterator;
+ typedef DequeReverseIterator<T, inlineCapacity> NonConstIterator;
+
+ public:
+ DequeConstReverseIterator(const Deque<T, inlineCapacity>* 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, size_t inlineCapacity> inline void Deque<T, inlineCapacity>::checkValidity() const { }
+ template<typename T, size_t inlineCapacity> inline void Deque<T, inlineCapacity>::checkIndexValidity(size_t) const { }
+ template<typename T, size_t inlineCapacity> inline void Deque<T, inlineCapacity>::invalidateIterators() { }
+#else
+ template<typename T, size_t inlineCapacity>
+ void Deque<T, inlineCapacity>::checkValidity() const
+ {
+ // In this implementation a capacity of 1 would confuse append() and
+ // other places that assume the index after capacity - 1 is 0.
+ ASSERT(m_buffer.capacity() != 1);
+
+ 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, size_t inlineCapacity>
+ void Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ void Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline Deque<T, inlineCapacity>::Deque()
+ : m_start(0)
+ , m_end(0)
+#ifndef NDEBUG
+ , m_iterators(0)
+#endif
+ {
+ checkValidity();
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline Deque<T, inlineCapacity>::Deque(const Deque<T, inlineCapacity>& 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, size_t inlineCapacity>
+ void deleteAllValues(const Deque<T, inlineCapacity>& collection)
+ {
+ typedef typename Deque<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 Deque<T, inlineCapacity>& Deque<T, inlineCapacity>::operator=(const Deque<T, inlineCapacity>& other)
+ {
+ // FIXME: This is inefficient if we're using an inline buffer and T is
+ // expensive to copy since it will copy the buffer twice instead of once.
+ Deque<T> copy(other);
+ swap(copy);
+ return *this;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline Deque<T, inlineCapacity>::~Deque()
+ {
+ checkValidity();
+ invalidateIterators();
+ destroyAll();
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::swap(Deque<T, inlineCapacity>& 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, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::clear()
+ {
+ checkValidity();
+ invalidateIterators();
+ destroyAll();
+ m_start = 0;
+ m_end = 0;
+ checkValidity();
+ }
+
+ template<typename T, size_t inlineCapacity>
+ template<typename Predicate>
+ inline DequeIterator<T, inlineCapacity> Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ void Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline typename Deque<T, inlineCapacity>::PassType Deque<T, inlineCapacity>::takeFirst()
+ {
+ T oldFirst = Pass::transfer(first());
+ removeFirst();
+ return Pass::transfer(oldFirst);
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ inline void Deque<T, inlineCapacity>::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, size_t inlineCapacity> template<typename U>
+ inline void Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::remove(iterator& it)
+ {
+ it.checkValidity();
+ remove(it.m_index);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::remove(const_iterator& it)
+ {
+ it.checkValidity();
+ remove(it.m_index);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Deque<T, inlineCapacity>::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, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::checkValidity() const { }
+ template<typename T, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::checkValidity(const DequeIteratorBase<T, inlineCapacity>&) const { }
+ template<typename T, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::addToIteratorsList() { }
+ template<typename T, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::removeFromIteratorsList() { }
+#else
+ template<typename T, size_t inlineCapacity>
+ void DequeIteratorBase<T, inlineCapacity>::checkValidity() const
+ {
+ ASSERT(m_deque);
+ m_deque->checkIndexValidity(m_index);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void DequeIteratorBase<T, inlineCapacity>::checkValidity(const Base& other) const
+ {
+ checkValidity();
+ other.checkValidity();
+ ASSERT(m_deque == other.m_deque);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void DequeIteratorBase<T, inlineCapacity>::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, size_t inlineCapacity>
+ void DequeIteratorBase<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline DequeIteratorBase<T, inlineCapacity>::DequeIteratorBase()
+ : m_deque(0)
+ {
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline DequeIteratorBase<T, inlineCapacity>::DequeIteratorBase(const Deque<T, inlineCapacity>* deque, size_t index)
+ : m_deque(const_cast<Deque<T, inlineCapacity>*>(deque))
+ , m_index(index)
+ {
+ addToIteratorsList();
+ checkValidity();
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline DequeIteratorBase<T, inlineCapacity>::DequeIteratorBase(const Base& other)
+ : m_deque(other.m_deque)
+ , m_index(other.m_index)
+ {
+ addToIteratorsList();
+ checkValidity();
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline DequeIteratorBase<T, inlineCapacity>& DequeIteratorBase<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline DequeIteratorBase<T, inlineCapacity>::~DequeIteratorBase()
+ {
+#ifndef NDEBUG
+ removeFromIteratorsList();
+ m_deque = 0;
+#endif
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline bool DequeIteratorBase<T, inlineCapacity>::isEqual(const Base& other) const
+ {
+ checkValidity(other);
+ return m_index == other.m_index;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void DequeIteratorBase<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline void DequeIteratorBase<T, inlineCapacity>::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, size_t inlineCapacity>
+ inline T* DequeIteratorBase<T, inlineCapacity>::after() const
+ {
+ checkValidity();
+ ASSERT(m_index != m_deque->m_end);
+ return &m_deque->m_buffer.buffer()[m_index];
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline T* DequeIteratorBase<T, inlineCapacity>::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/src/3rdparty/webkit/JavaScriptCore/wtf/DisallowCType.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DisallowCType.h
index 436f7f2..436f7f2 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/DisallowCType.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DisallowCType.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DoublyLinkedList.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DoublyLinkedList.h
new file mode 100644
index 0000000..9351263
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DoublyLinkedList.h
@@ -0,0 +1,104 @@
+/*
+ * 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. 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 DoublyLinkedList_h
+#define DoublyLinkedList_h
+
+namespace WTF {
+
+template <typename Node> class DoublyLinkedList {
+public:
+ DoublyLinkedList();
+
+ bool isEmpty();
+
+ Node* head();
+
+ void append(Node*);
+ void remove(Node*);
+
+private:
+ Node* m_head;
+ Node* m_tail;
+};
+
+template <typename Node> inline DoublyLinkedList<Node>::DoublyLinkedList()
+ : m_head(0)
+ , m_tail(0)
+{
+}
+
+template <typename Node> inline bool DoublyLinkedList<Node>::isEmpty()
+{
+ return !m_head;
+}
+
+template <typename Node> inline Node* DoublyLinkedList<Node>::head()
+{
+ return m_head;
+}
+
+template <typename Node> inline void DoublyLinkedList<Node>::append(Node* node)
+{
+ if (!m_tail) {
+ ASSERT(!m_head);
+ m_head = node;
+ m_tail = node;
+ node->setPrev(0);
+ node->setNext(0);
+ return;
+ }
+
+ ASSERT(m_head);
+ m_tail->setNext(node);
+ node->setPrev(m_tail);
+ node->setNext(0);
+ m_tail = node;
+}
+
+template <typename Node> inline void DoublyLinkedList<Node>::remove(Node* node)
+{
+ if (node->prev()) {
+ ASSERT(node != m_head);
+ node->prev()->setNext(node->next());
+ } else {
+ ASSERT(node == m_head);
+ m_head = node->next();
+ }
+
+ if (node->next()) {
+ ASSERT(node != m_tail);
+ node->next()->setPrev(node->prev());
+ } else {
+ ASSERT(node == m_tail);
+ m_tail = node->prev();
+ }
+}
+
+} // namespace WTF
+
+using WTF::DoublyLinkedList;
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp
new file mode 100644
index 0000000..b7d4b41
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 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.
+ * * 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 "DynamicAnnotations.h"
+
+#if USE(DYNAMIC_ANNOTATIONS)
+void WTFAnnotateBenignRaceSized(const char*, int, const volatile void*, long, const char*) { }
+void WTFAnnotateHappensBefore(const char*, int, const volatile void*) { }
+void WTFAnnotateHappensAfter(const char*, int, const volatile void*) { }
+#endif // USE(DYNAMIC_ANNOTATIONS)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.h
new file mode 100644
index 0000000..38acce3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/DynamicAnnotations.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011 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.
+ * * 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_DynamicAnnotations_h
+#define WTF_DynamicAnnotations_h
+
+/* This file defines dynamic annotations for use with dynamic analysis
+ * tool such as ThreadSanitizer, Valgrind, etc.
+ *
+ * Dynamic annotation is a source code annotation that affects
+ * the generated code (that is, the annotation is not a comment).
+ * Each such annotation is attached to a particular
+ * instruction and/or to a particular object (address) in the program.
+ *
+ * By using dynamic annotations a developer can give more details to the dynamic
+ * analysis tool to improve its precision.
+ *
+ * In C/C++ program the annotations are represented as C macros.
+ * With the default build flags, these macros are empty, hence don't affect
+ * performance of a compiled binary.
+ * If dynamic annotations are enabled, they just call no-op functions.
+ * The dynamic analysis tools can intercept these functions and replace them
+ * with their own implementations.
+ *
+ * See http://code.google.com/p/data-race-test/wiki/DynamicAnnotations for more information.
+ */
+
+#if USE(DYNAMIC_ANNOTATIONS)
+/* Tell data race detector that we're not interested in reports on the given address range. */
+#define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) WTFAnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description)
+#define WTF_ANNOTATE_BENIGN_RACE(pointer, description) WTFAnnotateBenignRaceSized(__FILE__, __LINE__, pointer, sizeof(*(pointer)), description)
+
+/* Annotations for user-defined synchronization mechanisms.
+ * These annotations can be used to define happens-before arcs in user-defined
+ * synchronization mechanisms: the race detector will infer an arc from
+ * the former to the latter when they share the same argument pointer.
+ *
+ * The most common case requiring annotations is atomic reference counting:
+ * bool deref() {
+ * ANNOTATE_HAPPENS_BEFORE(&m_refCount);
+ * if (!atomicDecrement(&m_refCount)) {
+ * // m_refCount is now 0
+ * ANNOTATE_HAPPENS_AFTER(&m_refCount);
+ * // "return true; happens-after each atomicDecrement of m_refCount"
+ * return true;
+ * }
+ * return false;
+ * }
+ */
+#define WTF_ANNOTATE_HAPPENS_BEFORE(address) WTFAnnotateHappensBefore(__FILE__, __LINE__, address)
+#define WTF_ANNOTATE_HAPPENS_AFTER(address) WTFAnnotateHappensAfter(__FILE__, __LINE__, address)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* Don't use these directly, use the above macros instead. */
+void WTFAnnotateBenignRaceSized(const char* file, int line, const volatile void* memory, long size, const char* description);
+void WTFAnnotateHappensBefore(const char* file, int line, const volatile void* address);
+void WTFAnnotateHappensAfter(const char* file, int line, const volatile void* address);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#else // USE(DYNAMIC_ANNOTATIONS)
+/* These macros are empty when dynamic annotations are not enabled so you can
+ * use them without affecting the performance of release binaries. */
+#define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description)
+#define WTF_ANNOTATE_BENIGN_RACE(pointer, description)
+#define WTF_ANNOTATE_HAPPENS_BEFORE(address)
+#define WTF_ANNOTATE_HAPPENS_AFTER(address)
+#endif // USE(DYNAMIC_ANNOTATIONS)
+
+#endif // WTF_DynamicAnnotations_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Encoder.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Encoder.h
new file mode 100644
index 0000000..109b0db
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ExportMacros.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ExportMacros.h
new file mode 100644
index 0000000..3fadd37
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ExportMacros.h
@@ -0,0 +1,46 @@
+/*
+ * 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 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.
+ *
+ * This file handles shared library symbol export decorations. It is recommended
+ * that all WebKit projects use these definitions so that symbol exports work
+ * properly on all platforms and compilers that WebKit builds under.
+ */
+
+#ifndef ExportMacros_h
+#define ExportMacros_h
+
+#include "Platform.h"
+
+#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !COMPILER(GCC)
+#define WTF_EXPORT __declspec(dllexport)
+#define WTF_IMPORT __declspec(dllimport)
+#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__)
+#define WTF_EXPORT __attribute__((visibility("default")))
+#define WTF_IMPORT WTF_EXPORT
+#else
+#define WTF_EXPORT
+#define WTF_IMPORT
+#endif
+
+#endif /* ExportMacros_h */
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastAllocBase.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastAllocBase.h
new file mode 100644
index 0000000..e4899ab
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastAllocBase.h
@@ -0,0 +1,421 @@
+/*
+ * 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:
+// Macro: WTF_MAKE_FAST_ALLOCATED
+// namespace WTF {
+//
+// 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 {
+// WTF_MAKE_FAST_ALLOCATED
+// ...
+// };
+//
+// struct Data {
+// WTF_MAKE_FAST_ALLOCATED
+// public:
+// ...
+// };
+//
+// 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"
+
+#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: \
+typedef int ThisIsHereToForceASemicolonAfterThisMacro
+
+namespace WTF {
+
+ // 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::fastDeleteSkippingDestructor;
+
+#endif // FastAllocBase_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp
new file mode 100644
index 0000000..86b123d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp
@@ -0,0 +1,4652 @@
+// Copyright (c) 2005, 2007, Google Inc.
+// All rights reserved.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 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:
+//
+// * 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(WTF_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
+#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1
+
+#ifndef NDEBUG
+namespace WTF {
+
+#if ENABLE(WTF_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(WTF_MULTIPLE_THREADS)
+
+} // namespace WTF
+#endif // NDEBUG
+
+#include <string.h>
+
+namespace WTF {
+
+
+namespace Internal {
+#if !ENABLE(WTF_MALLOC_VALIDATION)
+void fastMallocMatchFailed(void*);
+#else
+COMPILE_ASSERT(((sizeof(ValidationHeader) % sizeof(AllocAlignmentInteger)) == 0), ValidationHeader_must_produce_correct_alignment);
+#endif
+void fastMallocMatchFailed(void*)
+{
+ CRASH();
+}
+
+} // namespace Internal
+
+
+void* fastZeroedMalloc(size_t n)
+{
+ void* result = fastMalloc(n);
+ memset(result, 0, n);
+ return result;
+}
+
+char* fastStrDup(const char* src)
+{
+ size_t len = strlen(src) + 1;
+ char* dup = static_cast<char*>(fastMalloc(len));
+ 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(WTF_MALLOC_VALIDATION)
+ if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= n) // If overflow would occur...
+ return 0;
+
+ void* result = malloc(n + Internal::ValidationBufferSize);
+ if (!result)
+ return 0;
+ Internal::ValidationHeader* header = static_cast<Internal::ValidationHeader*>(result);
+ header->m_size = n;
+ header->m_type = Internal::AllocTypeMalloc;
+ header->m_prefix = static_cast<unsigned>(Internal::ValidationPrefix);
+ result = header + 1;
+ *Internal::fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
+ fastMallocValidate(result);
+ return result;
+#else
+ return malloc(n);
+#endif
+}
+
+void* fastMalloc(size_t n)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ TryMallocReturnValue returnValue = tryFastMalloc(n);
+ void* result;
+ if (!returnValue.getValue(result))
+ CRASH();
+#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(WTF_MALLOC_VALIDATION)
+ size_t totalBytes = n_elements * element_size;
+ if (n_elements > 1 && element_size && (totalBytes / element_size) != n_elements)
+ return 0;
+
+ TryMallocReturnValue returnValue = tryFastMalloc(totalBytes);
+ void* result;
+ if (!returnValue.getValue(result))
+ return 0;
+ memset(result, 0, totalBytes);
+ fastMallocValidate(result);
+ return result;
+#else
+ return calloc(n_elements, element_size);
+#endif
+}
+
+void* fastCalloc(size_t n_elements, size_t element_size)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size);
+ void* result;
+ if (!returnValue.getValue(result))
+ CRASH();
+#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(WTF_MALLOC_VALIDATION)
+ if (!p)
+ return;
+
+ fastMallocMatchValidateFree(p, Internal::AllocTypeMalloc);
+ Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
+ memset(p, 0xCC, header->m_size);
+ free(header);
+#else
+ free(p);
+#endif
+}
+
+TryMallocReturnValue tryFastRealloc(void* p, size_t n)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ if (p) {
+ if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= n) // If overflow would occur...
+ return 0;
+ fastMallocValidate(p);
+ Internal::ValidationHeader* result = static_cast<Internal::ValidationHeader*>(realloc(Internal::fastMallocValidationHeader(p), n + Internal::ValidationBufferSize));
+ if (!result)
+ return 0;
+ result->m_size = n;
+ result = result + 1;
+ *fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
+ fastMallocValidate(result);
+ return result;
+ } else {
+ return fastMalloc(n);
+ }
+#else
+ return realloc(p, n);
+#endif
+}
+
+void* fastRealloc(void* p, size_t n)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ TryMallocReturnValue returnValue = tryFastRealloc(p, n);
+ void* result;
+ if (!returnValue.getValue(result))
+ CRASH();
+#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 ENABLE(WTF_MALLOC_VALIDATION)
+ return Internal::fastMallocValidationHeader(const_cast<void*>(p))->m_size;
+#elif 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(HEADER_DETECTION_H)
+#include "HeaderDetection.h"
+#endif
+
+#if HAVE(DISPATCH_H)
+#include <dispatch/dispatch.h>
+#endif
+
+#if HAVE(PTHREAD_MACHDEP_H)
+#include <System/pthread_machdep.h>
+
+#if defined(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0)
+#define WTF_USE_PTHREAD_GETSPECIFIC_DIRECT 1
+#endif
+#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)
+#if !USE(PTHREAD_GETSPECIFIC_DIRECT)
+static void* (*pthread_getspecific_function_pointer)(pthread_key_t) = pthread_getspecific;
+#define pthread_getspecific(key) pthread_getspecific_function_pointer(key)
+#else
+#define pthread_getspecific(key) _pthread_getspecific_direct(key)
+#define pthread_setspecific(key, val) _pthread_setspecific_direct(key, (val))
+#endif
+#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)
+ {
+ for (void* adminAllocation = allocated_regions_; adminAllocation; adminAllocation = reader.nextEntryInLinkedList(reinterpret_cast<void**>(adminAllocation)))
+ recorder.recordRegion(reinterpret_cast<vm_address_t>(adminAllocation), kAllocIncrement);
+ }
+#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
+
+static SpinLock pageheap_lock = SPINLOCK_INITIALIZER;
+
+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) || OS(WINDOWS)
+ void periodicScavenge();
+ ALWAYS_INLINE bool isScavengerSuspended();
+ ALWAYS_INLINE void scheduleScavenger();
+ ALWAYS_INLINE void rescheduleScavenger();
+ ALWAYS_INLINE void suspendScavenger();
+#endif
+
+#if HAVE(DISPATCH_H)
+ dispatch_queue_t m_scavengeQueue;
+ dispatch_source_t m_scavengeTimer;
+ bool m_scavengingSuspended;
+#elif OS(WINDOWS)
+ static void CALLBACK scavengerTimerFired(void*, BOOLEAN);
+ HANDLE m_scavengeQueueTimer;
+#else
+ 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;
+#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()
+{
+ 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_scavengingSuspended = true;
+}
+
+ALWAYS_INLINE bool TCMalloc_PageHeap::isScavengerSuspended()
+{
+ ASSERT(pageheap_lock.IsHeld());
+ return m_scavengingSuspended;
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::scheduleScavenger()
+{
+ ASSERT(pageheap_lock.IsHeld());
+ m_scavengingSuspended = false;
+ dispatch_resume(m_scavengeTimer);
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::rescheduleScavenger()
+{
+ // Nothing to do here for libdispatch.
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger()
+{
+ ASSERT(pageheap_lock.IsHeld());
+ m_scavengingSuspended = true;
+ dispatch_suspend(m_scavengeTimer);
+}
+
+#elif OS(WINDOWS)
+
+void TCMalloc_PageHeap::scavengerTimerFired(void* context, BOOLEAN)
+{
+ static_cast<TCMalloc_PageHeap*>(context)->periodicScavenge();
+}
+
+void TCMalloc_PageHeap::initializeScavenger()
+{
+ m_scavengeQueueTimer = 0;
+}
+
+ALWAYS_INLINE bool TCMalloc_PageHeap::isScavengerSuspended()
+{
+ ASSERT(IsHeld(pageheap_lock));
+ return !m_scavengeQueueTimer;
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::scheduleScavenger()
+{
+ // We need to use WT_EXECUTEONLYONCE here and reschedule the timer, because
+ // Windows will fire the timer event even when the function is already running.
+ ASSERT(IsHeld(pageheap_lock));
+ CreateTimerQueueTimer(&m_scavengeQueueTimer, 0, scavengerTimerFired, this, kScavengeDelayInSeconds * 1000, 0, WT_EXECUTEONLYONCE);
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::rescheduleScavenger()
+{
+ // We must delete the timer and create it again, because it is not possible to retrigger a timer on Windows.
+ suspendScavenger();
+ scheduleScavenger();
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger()
+{
+ ASSERT(IsHeld(pageheap_lock));
+ HANDLE scavengeQueueTimer = m_scavengeQueueTimer;
+ m_scavengeQueueTimer = 0;
+ DeleteTimerQueueTimer(0, scavengeQueueTimer, 0);
+}
+
+#else
+
+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) || COMPILER(SUNCC))
+ // Without this, Visual Studio and Sun 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);
+}
+
+#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.nextEntryInLinkedList(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.nextEntryInLinkedList(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 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) || OS(WINDOWS)
+
+void TCMalloc_PageHeap::periodicScavenge()
+{
+ SpinLockHolder h(&pageheap_lock);
+ pageheap->scavenge();
+
+ if (shouldScavenge()) {
+ rescheduleScavenger();
+ return;
+ }
+
+ suspendScavenger();
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger()
+{
+ ASSERT(pageheap_lock.IsHeld());
+ if (isScavengerSuspended() && shouldScavenge())
+ scheduleScavenger();
+}
+
+#else
+
+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();
+ }
+ }
+}
+
+#endif
+
+#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;
+#if USE(PTHREAD_GETSPECIFIC_DIRECT)
+static const pthread_key_t heap_key = __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0;
+#else
+static pthread_key_t heap_key;
+#endif
+#if OS(WINDOWS)
+DWORD tlsIndex = TLS_OUT_OF_INDEXES;
+#endif
+
+static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap)
+{
+#if USE(PTHREAD_GETSPECIFIC_DIRECT)
+ // Can't have two libraries both doing this in the same process,
+ // so check and make this crash right away.
+ if (pthread_getspecific(heap_key))
+ CRASH();
+#endif
+
+ // Still do pthread_setspecific even if there's an alternate form
+ // of thread-local storage in use, 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);
+#if USE(PTHREAD_GETSPECIFIC_DIRECT)
+ pthread_key_init_np(heap_key, DestroyThreadCache);
+#else
+ pthread_key_create(&heap_key, DestroyThreadCache);
+#endif
+#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(WTF_MALLOC_VALIDATION)
+ if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= size) // If overflow would occur...
+ return 0;
+ void* result = do_malloc(size + Internal::ValidationBufferSize);
+ if (!result)
+ return 0;
+
+ Internal::ValidationHeader* header = static_cast<Internal::ValidationHeader*>(result);
+ header->m_size = size;
+ header->m_type = Internal::AllocTypeMalloc;
+ header->m_prefix = static_cast<unsigned>(Internal::ValidationPrefix);
+ result = header + 1;
+ *Internal::fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
+ fastMallocValidate(result);
+#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(WTF_MALLOC_VALIDATION)
+ if (!ptr)
+ return;
+
+ fastMallocValidate(ptr);
+ Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(ptr);
+ memset(ptr, 0xCC, header->m_size);
+ 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)
+{
+ void* result = calloc<true>(n, elem_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ fastMallocValidate(result);
+#endif
+ return result;
+}
+
+TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size)
+{
+ void* result = calloc<false>(n, elem_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ fastMallocValidate(result);
+#endif
+ return result;
+}
+
+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(WTF_MALLOC_VALIDATION)
+ void* result = malloc<crashOnFailure>(totalBytes);
+ if (!result)
+ return 0;
+
+ memset(result, 0, totalBytes);
+ fastMallocValidate(result);
+#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)
+{
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ fastMallocValidate(old_ptr);
+#endif
+ void* result = realloc<true>(old_ptr, new_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ fastMallocValidate(result);
+#endif
+ return result;
+}
+
+TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size)
+{
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ fastMallocValidate(old_ptr);
+#endif
+ void* result = realloc<false>(old_ptr, new_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ fastMallocValidate(result);
+#endif
+ return result;
+}
+
+template <bool crashOnFailure>
+ALWAYS_INLINE
+#endif
+void* realloc(void* old_ptr, size_t new_size) {
+ if (old_ptr == NULL) {
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ void* result = malloc<crashOnFailure>(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(WTF_MALLOC_VALIDATION)
+ if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= new_size) // If overflow would occur...
+ return 0;
+ Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(old_ptr);
+ fastMallocValidate(old_ptr);
+ old_ptr = header;
+ header->m_size = new_size;
+ new_size += Internal::ValidationBufferSize;
+#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(WTF_MALLOC_VALIDATION)
+ new_ptr = static_cast<Internal::ValidationHeader*>(new_ptr) + 1;
+ *Internal::fastMallocValidationSuffix(new_ptr) = Internal::ValidationSuffix;
+#endif
+ return new_ptr;
+ } else {
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ old_ptr = static_cast<Internal::ValidationHeader*>(old_ptr) + 1; // Set old_ptr back to the user pointer.
+ *Internal::fastMallocValidationSuffix(old_ptr) = Internal::ValidationSuffix;
+#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)
+{
+#if ENABLE(WTF_MALLOC_VALIDATION)
+ return Internal::fastMallocValidationHeader(const_cast<void*>(ptr))->m_size;
+#else
+ 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;
+#endif
+}
+
+#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)
+ return 1;
+
+ 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.nextEntryInLinkedList(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 || !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
+
+#ifndef 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_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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.h
new file mode 100644
index 0000000..37cf086
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.h
@@ -0,0 +1,281 @@
+/*
+ * 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[].
+ };
+
+ enum {
+ ValidationPrefix = 0xf00df00d,
+ ValidationSuffix = 0x0badf00d
+ };
+
+ typedef unsigned ValidationTag;
+
+ struct ValidationHeader {
+ AllocType m_type;
+ unsigned m_size;
+ ValidationTag m_prefix;
+ unsigned m_alignment;
+ };
+
+ static const int ValidationBufferSize = sizeof(ValidationHeader) + sizeof(ValidationTag);
+ }
+
+#if ENABLE(WTF_MALLOC_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 {
+
+ // Handle a detected alloc/free mismatch. By default this calls CRASH().
+ void fastMallocMatchFailed(void* p);
+
+ inline ValidationHeader* fastMallocValidationHeader(void* p)
+ {
+ return reinterpret_cast<ValidationHeader*>(static_cast<char*>(p) - sizeof(ValidationHeader));
+ }
+
+ inline ValidationTag* fastMallocValidationSuffix(void* p)
+ {
+ ValidationHeader* header = fastMallocValidationHeader(p);
+ if (header->m_prefix != static_cast<unsigned>(ValidationPrefix))
+ fastMallocMatchFailed(p);
+
+ return reinterpret_cast<ValidationTag*>(static_cast<char*>(p) + header->m_size);
+ }
+
+ // Return the AllocType tag associated with the allocated block p.
+ inline AllocType fastMallocMatchValidationType(void* p)
+ {
+ return fastMallocValidationHeader(p)->m_type;
+ }
+
+ // Set the AllocType tag to be associaged with the allocated block p.
+ inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
+ {
+ fastMallocValidationHeader(p)->m_type = allocType;
+ }
+
+ } // 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)
+ {
+ if (!p)
+ return;
+
+ Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
+ if (header->m_prefix != static_cast<unsigned>(Internal::ValidationPrefix))
+ Internal::fastMallocMatchFailed(p);
+
+ if (*Internal::fastMallocValidationSuffix(p) != Internal::ValidationSuffix)
+ Internal::fastMallocMatchFailed(p);
+
+ Internal::setFastMallocMatchValidationType(p, Internal::AllocTypeMalloc); // Set it to this so that fastFree thinks it's OK.
+ }
+
+ inline void fastMallocValidate(void* p)
+ {
+ if (!p)
+ return;
+
+ Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
+ if (header->m_prefix != static_cast<unsigned>(Internal::ValidationPrefix))
+ Internal::fastMallocMatchFailed(p);
+
+ if (*Internal::fastMallocValidationSuffix(p) != Internal::ValidationSuffix)
+ Internal::fastMallocMatchFailed(p);
+ }
+
+#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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FixedArray.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FixedArray.h
new file mode 100644
index 0000000..c67d18c
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Forward.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Forward.h
new file mode 100644
index 0000000..28be168
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/wtf/GetPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/GetPtr.h
index 25a0e6d..25a0e6d 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/GetPtr.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/GetPtr.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashCountedSet.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashCountedSet.h
new file mode 100644
index 0000000..b97d8c8
--- /dev/null
+++ b/src/3rdparty/webkit/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 "HashMap.h"
+#include "Vector.h"
+
+namespace WTF {
+
+ template<typename Value, typename HashFunctions = typename DefaultHash<Value>::Hash,
+ typename Traits = HashTraits<Value> > class HashCountedSet {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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/src/3rdparty/webkit/JavaScriptCore/wtf/HashFunctions.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashFunctions.h
index 2c66a2d..2c66a2d 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashFunctions.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashFunctions.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashIterators.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashIterators.h
new file mode 100644
index 0000000..6afa2fa
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashIterators.h
@@ -0,0 +1,218 @@
+/*
+ * 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() {}
+ 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() {}
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashMap.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashMap.h
new file mode 100644
index 0000000..7731546
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashMap.h
@@ -0,0 +1,411 @@
+/*
+ * 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
new file mode 100644
index 0000000..82245f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
@@ -0,0 +1,260 @@
+/*
+ * 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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>
+ inline 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>
+ inline 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/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTable.cpp
index 71d3f86..71d3f86 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTable.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTable.h
new file mode 100644
index 0000000..79e8b3f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTable.h
@@ -0,0 +1,1183 @@
+/*
+ * 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(static_cast<const HashTableType*>(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;
+
+ // Work around MSVC's standard library, whose swap for pairs does not swap by component.
+ template<typename T> inline void hashTableSwap(T& a, T& b)
+ {
+ swap(a, b);
+ }
+
+ // Swap pairs by component, in case of pair members that specialize swap.
+ template<typename T, typename U> inline void hashTableSwap(pair<T, U>& a, pair<T, U>& b)
+ {
+ swap(a.first, b.first);
+ swap(a.second, b.second);
+ }
+
+ template<typename T, bool useSwap> struct Mover;
+ template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { hashTableSwap(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() {}
+ 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() {}
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTraits.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTraits.h
new file mode 100644
index 0000000..fba5afe
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashTraits.h
@@ -0,0 +1,117 @@
+/*
+ * 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 T> struct SimpleClassHashTraits : GenericHashTraits<T> {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(T& slot) { new (&slot) T(HashTableDeletedValue); }
+ static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); }
+ };
+
+ template<typename P> struct HashTraits<RefPtr<P> > : SimpleClassHashTraits<RefPtr<P> > { };
+
+ // 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HexNumber.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HexNumber.h
new file mode 100644
index 0000000..8fd6032
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HexNumber.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2011 Research In Motion Limited. 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 HexNumber_h
+#define HexNumber_h
+
+#include <wtf/text/StringConcatenate.h>
+
+namespace WTF {
+
+enum HexConversionMode {
+ Lowercase,
+ Uppercase
+};
+
+namespace Internal {
+
+static const char* hexDigitsForMode(HexConversionMode mode)
+{
+ static const char lowerHexDigits[17] = "0123456789abcdef";
+ static const char upperHexDigits[17] = "0123456789ABCDEF";
+ return mode == Lowercase ? lowerHexDigits : upperHexDigits;
+}
+
+}; // namespace Internal
+
+template<typename T>
+inline void appendByteAsHex(unsigned char byte, T& destination, HexConversionMode mode = Uppercase)
+{
+ const char* hexDigits = Internal::hexDigitsForMode(mode);
+ destination.append(hexDigits[byte >> 4]);
+ destination.append(hexDigits[byte & 0xF]);
+}
+
+template<typename T>
+inline void placeByteAsHexCompressIfPossible(unsigned char byte, T& destination, unsigned& index, HexConversionMode mode = Uppercase)
+{
+ const char* hexDigits = Internal::hexDigitsForMode(mode);
+ if (byte >= 0x10)
+ destination[index++] = hexDigits[byte >> 4];
+ destination[index++] = hexDigits[byte & 0xF];
+}
+
+template<typename T>
+inline void placeByteAsHex(unsigned char byte, T& destination, HexConversionMode mode = Uppercase)
+{
+ const char* hexDigits = Internal::hexDigitsForMode(mode);
+ *destination++ = hexDigits[byte >> 4];
+ *destination++ = hexDigits[byte & 0xF];
+}
+
+template<typename T>
+inline void appendUnsignedAsHex(unsigned number, T& destination, HexConversionMode mode = Uppercase)
+{
+ const char* hexDigits = Internal::hexDigitsForMode(mode);
+ Vector<UChar, 8> result;
+ do {
+ result.prepend(hexDigits[number % 16]);
+ number >>= 4;
+ } while (number > 0);
+
+ destination.append(result.data(), result.size());
+}
+
+// Same as appendUnsignedAsHex, but using exactly 'desiredDigits' for the conversion.
+template<typename T>
+inline void appendUnsignedAsHexFixedSize(unsigned number, T& destination, unsigned desiredDigits, HexConversionMode mode = Uppercase)
+{
+ ASSERT(desiredDigits);
+
+ const char* hexDigits = Internal::hexDigitsForMode(mode);
+ Vector<UChar, 8> result;
+ do {
+ result.prepend(hexDigits[number % 16]);
+ number >>= 4;
+ } while (result.size() < desiredDigits);
+
+ ASSERT(result.size() == desiredDigits);
+ destination.append(result.data(), result.size());
+}
+
+} // namespace WTF
+
+using WTF::appendByteAsHex;
+using WTF::appendUnsignedAsHex;
+using WTF::appendUnsignedAsHexFixedSize;
+using WTF::placeByteAsHex;
+using WTF::placeByteAsHexCompressIfPossible;
+using WTF::Lowercase;
+
+#endif // HexNumber_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ListHashSet.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ListHashSet.h
new file mode 100644
index 0000000..25b73c1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ListHashSet.h
@@ -0,0 +1,709 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, Benjamin Poulain <ikipou@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.
+ *
+ */
+
+#ifndef WTF_ListHashSet_h
+#define WTF_ListHashSet_h
+
+#include "Assertions.h"
+#include "HashSet.h"
+#include "OwnPtr.h"
+#include "PassOwnPtr.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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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;
+
+ ValueType& first();
+ const ValueType& first() const;
+
+ ValueType& last();
+ const ValueType& last() const;
+ void removeLast();
+
+ iterator find(const ValueType&);
+ 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.
+ // The HashTranslator interface is defined in HashSet.
+ 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;
+
+ // 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(adoptPtr(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(adoptPtr(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 T& ListHashSet<T, inlineCapacity, U>::first()
+ {
+ ASSERT(!isEmpty());
+ return m_head->m_value;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline const T& ListHashSet<T, inlineCapacity, U>::first() const
+ {
+ ASSERT(!isEmpty());
+ return m_head->m_value;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline T& ListHashSet<T, inlineCapacity, U>::last()
+ {
+ ASSERT(!isEmpty());
+ return m_tail->m_value;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline const T& ListHashSet<T, inlineCapacity, U>::last() const
+ {
+ ASSERT(!isEmpty());
+ return m_tail->m_value;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::removeLast()
+ {
+ ASSERT(!isEmpty());
+ m_impl.remove(m_tail);
+ unlinkAndDelete(m_tail);
+ }
+
+ 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 ValueType, size_t inlineCapacity, typename T, typename Translator>
+ struct ListHashSetTranslatorAdapter {
+ private:
+ typedef ListHashSetNode<ValueType, inlineCapacity> Node;
+ public:
+ static unsigned hash(const T& key) { return Translator::hash(key); }
+ static bool equal(Node* const& a, const T& b) { return Translator::equal(a->m_value, b); }
+ };
+
+ template<typename ValueType, size_t inlineCapacity, typename U>
+ template<typename T, typename HashTranslator>
+ inline typename ListHashSet<ValueType, inlineCapacity, U>::iterator ListHashSet<ValueType, inlineCapacity, U>::find(const T& value)
+ {
+ typedef ListHashSetTranslatorAdapter<ValueType, inlineCapacity, T, HashTranslator> Adapter;
+ ImplTypeConstIterator it = m_impl.template find<T, Adapter>(value);
+ if (it == m_impl.end())
+ return end();
+ return makeIterator(*it);
+ }
+
+ template<typename ValueType, size_t inlineCapacity, typename U>
+ template<typename T, typename HashTranslator>
+ inline typename ListHashSet<ValueType, inlineCapacity, U>::const_iterator ListHashSet<ValueType, inlineCapacity, U>::find(const T& value) const
+ {
+ typedef ListHashSetTranslatorAdapter<ValueType, inlineCapacity, T, HashTranslator> Adapter;
+ ImplTypeConstIterator it = m_impl.template find<T, Adapter>(value);
+ if (it == m_impl.end())
+ return end();
+ return makeConstIterator(*it);
+ }
+
+ template<typename ValueType, size_t inlineCapacity, typename U>
+ template<typename T, typename HashTranslator>
+ inline bool ListHashSet<ValueType, inlineCapacity, U>::contains(const T& value) const
+ {
+ typedef ListHashSetTranslatorAdapter<ValueType, inlineCapacity, T, HashTranslator> Adapter;
+ return m_impl.template contains<T, Adapter>(value);
+ }
+
+ 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/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ListRefPtr.h
index 8bf6447..8bf6447 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListRefPtr.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ListRefPtr.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Locker.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Locker.h
new file mode 100644
index 0000000..c465b99
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Locker.h
@@ -0,0 +1,48 @@
+/*
+ * 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 {
+ WTF_MAKE_NONCOPYABLE(Locker);
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MD5.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MD5.cpp
new file mode 100644
index 0000000..07bbadd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MD5.cpp
@@ -0,0 +1,309 @@
+// 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()
+{
+ // FIXME: Move unit tests somewhere outside the constructor. See bug 55853.
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MD5.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MD5.h
new file mode 100644
index 0000000..3caa810
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MainThread.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MainThread.cpp
new file mode 100644
index 0000000..09fea7b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MainThread.cpp
@@ -0,0 +1,241 @@
+/*
+ * 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) {
+ MutexLocker locker(mainThreadFunctionQueueMutex());
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MainThread.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MainThread.h
new file mode 100644
index 0000000..7703f3e
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MallocZoneSupport.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MallocZoneSupport.h
new file mode 100644
index 0000000..4332e40
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MallocZoneSupport.h
@@ -0,0 +1,73 @@
+/*
+ * 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));
+ 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));
+ }
+
+ template <typename T>
+ T* nextEntryInLinkedList(T** address) const
+ {
+ T** output = (*this)(address);
+ if (!output)
+ return 0;
+ return *output;
+ }
+};
+
+} // namespace WTF
+
+#endif // MallocZoneSupport_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h
new file mode 100644
index 0000000..f1b13a5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h
@@ -0,0 +1,258 @@
+/*
+ * 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 <algorithm>
+#include <cmath>
+#include <float.h>
+#include <limits>
+#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 copysign(1.0, x) < 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) && !(RVCT_VERSION_AT_LEAST(3, 0, 0, 0)))
+
+// 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; }
+
+inline int clampToInteger(double d)
+{
+ const double minIntAsDouble = std::numeric_limits<int>::min();
+ const double maxIntAsDouble = std::numeric_limits<int>::max();
+ return static_cast<int>(std::max(std::min(d, maxIntAsDouble), minIntAsDouble));
+}
+
+inline int clampToPositiveInteger(double d)
+{
+ const double maxIntAsDouble = std::numeric_limits<int>::max();
+ return static_cast<int>(std::max<double>(std::min(d, maxIntAsDouble), 0));
+}
+
+inline int clampToInteger(float x)
+{
+ static const int s_intMax = std::numeric_limits<int>::max();
+ static const int s_intMin = std::numeric_limits<int>::min();
+
+ if (x >= static_cast<float>(s_intMax))
+ return s_intMax;
+ if (x < static_cast<float>(s_intMin))
+ return s_intMin;
+ return static_cast<int>(x);
+}
+
+inline int clampToPositiveInteger(float x)
+{
+ static const int s_intMax = std::numeric_limits<int>::max();
+
+ if (x >= static_cast<float>(s_intMax))
+ return s_intMax;
+ if (x < 0)
+ return 0;
+ return static_cast<int>(x);
+}
+
+inline int clampToInteger(unsigned value)
+{
+ return static_cast<int>(std::min(value, static_cast<unsigned>(std::numeric_limits<int>::max())));
+}
+
+#if !COMPILER(MSVC) && !(COMPILER(RVCT) && PLATFORM(BREWMP)) && !OS(SOLARIS) && !OS(SYMBIAN)
+using std::isfinite;
+using std::isinf;
+using std::isnan;
+using std::signbit;
+#endif
+
+#endif // #ifndef WTF_MathExtras_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MessageQueue.h
new file mode 100644
index 0000000..3e48154
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MessageQueue.h
@@ -0,0 +1,219 @@
+/*
+ * 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 {
+ WTF_MAKE_NONCOPYABLE(MessageQueue);
+ 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;
+ OwnPtr<DataType> result = waitForMessageFilteredWithTimeout(exitReason, MessageQueue<DataType>::alwaysTruePredicate, infiniteTime());
+ ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueueMessageReceived);
+ return result.release();
+ }
+
+ 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 nullptr;
+ }
+
+ if (timedOut) {
+ result = MessageQueueTimeout;
+ return nullptr;
+ }
+
+ ASSERT(found != m_queue.end());
+ OwnPtr<DataType> message = adoptPtr(*found);
+ m_queue.remove(found);
+ result = MessageQueueMessageReceived;
+ return message.release();
+ }
+
+ template<typename DataType>
+ inline PassOwnPtr<DataType> MessageQueue<DataType>::tryGetMessage()
+ {
+ MutexLocker lock(m_mutex);
+ if (m_killed)
+ return nullptr;
+ if (m_queue.isEmpty())
+ return nullptr;
+
+ return adoptPtr(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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NonCopyingSort.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NonCopyingSort.h
new file mode 100644
index 0000000..fd611bd
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Noncopyable.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Noncopyable.h
new file mode 100644
index 0000000..cc6bc55
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Noncopyable.h
@@ -0,0 +1,44 @@
+/*
+ * 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
+
+#endif // WTF_Noncopyable_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/NotFound.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NotFound.h
index 4263bce..4263bce 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/NotFound.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NotFound.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.cpp
new file mode 100644
index 0000000..224f1f1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.cpp
@@ -0,0 +1,34 @@
+/*
+
+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 "NullPtr.h"
+
+#if !HAVE(NULLPTR)
+
+std::nullptr_t nullptr;
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.h
new file mode 100644
index 0000000..c0e7bd3
--- /dev/null
+++ b/src/3rdparty/webkit/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) || (GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocator.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocator.h
new file mode 100644
index 0000000..3fd4cef
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocator.h
@@ -0,0 +1,101 @@
+/*
+ * 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) || OS(SYMBIAN)
+ // 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.
+ // On Symbian, this makes implementation simpler and better aligned with the RChunk API
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp
new file mode 100644
index 0000000..8c3b809
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp
@@ -0,0 +1,133 @@
+/*
+ * 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(LINUX)
+ // Linux distros usually do not allow overcommit by default, so
+ // JSC's strategy of mmaping a large amount of memory upfront
+ // won't work very well on some systems. Fortunately there's a
+ // flag we can pass to mmap to disable the overcommit check for
+ // this particular call, so we can get away with it as long as the
+ // overcommit flag value in /proc/sys/vm/overcommit_memory is 0
+ // ('heuristic') and not 2 (always check). 0 is the usual default
+ // value, so this should work well in general.
+ flags |= MAP_NORESERVE;
+#endif
+
+#if OS(DARWIN)
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp
new file mode 100644
index 0000000..c63e609
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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 "PageAllocatorSymbian.h"
+
+namespace WTF {
+
+// Array to store code chunks used by JIT engine(s)
+static RPointerArray<SymbianChunk> codeChunksContainer;
+
+// The singleton data allocator (non code)
+static PageAllocatorSymbian dataAllocator;
+
+_LIT(KErrorStringInternalConsistency, "OSAllocator:ConsistencyError");
+_LIT(KErrorStringChunkCreation, "OSAllocator:ChunkInitError");
+_LIT(KErrorStringPageSize, "OSAllocator:WrongPageSize");
+
+// Makes a new code chunk for a JIT engine with everything in committed state
+static void* allocateCodeChunk(size_t bytes)
+{
+ RChunk c;
+ TInt error = c.CreateLocalCode(bytes, bytes);
+ __ASSERT_ALWAYS(error == KErrNone, User::Panic(KErrorStringChunkCreation, error));
+
+ codeChunksContainer.Append(new SymbianChunk(c.Handle()));
+ return static_cast<void*>(c.Base());
+}
+
+// Frees the _entire_ code chunk in which this address resides.
+static bool deallocateCodeChunk(void* address)
+{
+ bool found = false;
+ for (int i = 0; i < codeChunksContainer.Count(); i++) {
+ SymbianChunk* p = codeChunksContainer[i];
+ if (p && p->contains(address)) {
+ codeChunksContainer.Remove(i);
+ delete p;
+ found = true;
+ }
+ }
+ return found;
+}
+
+// Return the (singleton) object that manages all non-code VM operations
+static PageAllocatorSymbian* dataAllocatorInstance()
+{
+ return &dataAllocator;
+}
+
+// Reserve memory and return the base address of the region
+void* OSAllocator::reserveUncommitted(size_t reservationSize, Usage usage, bool , bool executable)
+{
+ void* base = 0;
+ if (executable)
+ base = allocateCodeChunk(reservationSize);
+ else
+ base = dataAllocatorInstance()->reserve(reservationSize);
+ return base;
+}
+
+// Inverse operation of reserveUncommitted()
+void OSAllocator::releaseDecommitted(void* parkedBase, size_t bytes)
+{
+ if (dataAllocatorInstance()->contains(parkedBase))
+ dataAllocatorInstance()->release(parkedBase, bytes);
+
+ // NOOP for code chunks (JIT) because we released them in decommit()
+}
+
+// Commit what was previously reserved via reserveUncommitted()
+void OSAllocator::commit(void* address, size_t bytes, bool, bool executable)
+{
+ // For code chunks, we commit (early) in reserveUncommitted(), so NOOP
+ // For data regions, do real work
+ if (!executable)
+ dataAllocatorInstance()->commit(address, bytes);
+}
+
+void OSAllocator::decommit(void* address, size_t bytes)
+{
+ if (dataAllocatorInstance()->contains(address))
+ dataAllocatorInstance()->decommit(address, bytes);
+ else
+ deallocateCodeChunk(address); // for code chunk, decommit AND release
+}
+
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bool executable)
+{
+ void* base = reserveUncommitted(bytes, usage, writable, executable);
+ commit(base, bytes, writable, executable);
+ return base;
+}
+
+
+// The PageAllocatorSymbian class helps map OSAllocator calls for reserve/commit/decommit
+// to a single large Symbian chunk. Only works with multiples of page size, and as a corollary
+// all addresses accepted or returned by it are also page-sized aligned.
+// Design notes:
+// - We initialize a chunk up-front with a large reservation size
+// - The entire reservation reserve is logically divided into pageSized blocks (4K on Symbian)
+// - The map maintains 1 bit for each of the 4K-sized region in our address space
+// - OSAllocator::reserveUncommitted() requests lead to 1 or more bits being set in map
+// to indicate internally reserved state. The VM address corresponding to the first bit is returned.
+// - OSAllocator::commit() actually calls RChunk.commit() and commits *all or part* of the region
+// reserved via reserveUncommitted() previously.
+// - OSAllocator::decommit() calls RChunk.decommit()
+// - OSAllocator::releaseDecommitted() unparks all the bits in the map, but trusts that a previously
+// call to decommit() would have returned the memory to the OS
+PageAllocatorSymbian::PageAllocatorSymbian()
+{
+ __ASSERT_ALWAYS(m_pageSize == WTF::pageSize(), User::Panic(KErrorStringPageSize, m_pageSize));
+
+ RChunk chunk;
+ TInt error = chunk.CreateDisconnectedLocal(0, 0, TInt(largeReservationSize));
+ __ASSERT_ALWAYS(error == KErrNone, User::Panic(KErrorStringChunkCreation, error));
+
+ m_chunk = new SymbianChunk(chunk.Handle()); // takes ownership of chunk
+}
+
+PageAllocatorSymbian::~PageAllocatorSymbian()
+{
+ delete m_chunk;
+}
+
+// Reserves a region internally in the bitmap
+void* PageAllocatorSymbian::reserve(size_t bytes)
+{
+ // Find first available region
+ const size_t nPages = bytes / m_pageSize;
+ const int64_t startIdx = m_map.findRunOfZeros(nPages);
+
+ // Pseudo OOM
+ if (startIdx < 0)
+ return 0;
+
+ for (size_t i = startIdx; i < startIdx + nPages ; i++)
+ m_map.set(i);
+
+ return static_cast<void*>( m_chunk->m_base + (TUint)(m_pageSize * startIdx) );
+}
+
+// Reverses the effects of a reserve() call
+void PageAllocatorSymbian::release(void* address, size_t bytes)
+{
+ const size_t startIdx = (static_cast<char*>(address) - m_chunk->m_base) / m_pageSize;
+ const size_t nPages = bytes / m_pageSize;
+ for (size_t i = startIdx; i < startIdx + nPages ; i++)
+ m_map.clear(i);
+}
+
+// Actually commit memory from the OS, after a previous call to reserve()
+bool PageAllocatorSymbian::commit(void* address, size_t bytes)
+{
+ // sanity check that bits were previously set
+ const size_t idx = (static_cast<char*>(address) - m_chunk->m_base) / m_pageSize;
+ const size_t nPages = bytes / m_pageSize;
+ __ASSERT_ALWAYS(m_map.get(idx), User::Panic(KErrorStringInternalConsistency, idx));
+ __ASSERT_ALWAYS(m_map.get(idx+nPages-1), User::Panic(KErrorStringInternalConsistency, idx+nPages-1));
+
+ TInt error = m_chunk->Commit(static_cast<char*>(address) - m_chunk->m_base, bytes);
+ return (error == KErrNone);
+}
+
+// Inverse operation of commit(), a release() should follow later
+bool PageAllocatorSymbian::decommit(void* address, size_t bytes)
+{
+ TInt error = m_chunk->Decommit(static_cast<char*>(address) - m_chunk->m_base, bytes);
+ return (error == KErrNone);
+}
+
+bool PageAllocatorSymbian::contains(const void* address) const
+{
+ return m_chunk->contains(address);
+}
+
+} // namespace WTF
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorWin.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorWin.cpp
new file mode 100644
index 0000000..e7beb8a
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.cpp
new file mode 100644
index 0000000..7d86f6f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2011 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 GOOGLE, 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 "OSRandomSource.h"
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#if OS(SYMBIAN)
+#include <e32math.h>
+#endif
+
+#if OS(UNIX)
+#include <fcntl.h>
+#include <unistd.h>
+#endif
+
+#if OS(WINDOWS)
+#include <windows.h>
+#include <wincrypt.h> // windows.h must be included before wincrypt.h.
+#endif
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
+{
+#if OS(SYMBIAN)
+ TInt random;
+ while (length > sizeof(random)) {
+ random = Math::Random();
+ memcpy(buffer, &random, sizeof(random));
+ length -= sizeof(random);
+ buffer += sizeof(random);
+ }
+ if (length > 0) {
+ random = Math::Random();
+ memcpy(buffer, &random, length);
+ }
+#elif OS(UNIX)
+ int fd = open("/dev/urandom", O_RDONLY, 0);
+ if (fd < 0)
+ CRASH(); // We need /dev/urandom for this API to work...
+
+ if (read(fd, buffer, length) != static_cast<ssize_t>(length))
+ CRASH();
+
+ close(fd);
+#elif OS(WINDOWS)
+ HCRYPTPROV hCryptProv = 0;
+ if (!CryptAcquireContext(&hCryptProv, 0, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+ CRASH();
+ if (!CryptGenRandom(hCryptProv, length, buffer))
+ CRASH();
+ CryptReleaseContext(hCryptProv, 0);
+#else
+ #error "This configuration doesn't have a strong source of randomness."
+ // WARNING: When adding new sources of OS randomness, the randomness must
+ // be of cryptographic quality!
+#endif
+}
+#endif
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.h
new file mode 100644
index 0000000..214a954
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSRandomSource.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 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 GOOGLE, 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_OSRandomSource_h
+#define WTF_OSRandomSource_h
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+// This function attempts to fill buffer with randomness from the operating
+// system. If insufficient randomness is available, the buffer will be
+// partially filled. Rather than calling this function directly, consider
+// calling cryptographicallyRandomNumber or cryptographicallyRandomValues.
+void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length);
+#endif
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnArrayPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnArrayPtr.h
new file mode 100644
index 0000000..2828698
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnArrayPtr.h
@@ -0,0 +1,176 @@
+/*
+ * 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 "PassOwnArrayPtr.h"
+#include <algorithm>
+
+namespace WTF {
+
+template<typename T> class PassOwnArrayPtr;
+template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*);
+
+template <typename T> class OwnArrayPtr {
+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;
+ deleteOwnedArrayPtr(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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h
new file mode 100644
index 0000000..9d4841a
--- /dev/null
+++ b/src/3rdparty/webkit/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"
+
+namespace WTF {
+
+ template<class T> class OwnFastMallocPtr {
+ WTF_MAKE_NONCOPYABLE(OwnFastMallocPtr);
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnPtr.h
new file mode 100644
index 0000000..f80ec54
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnPtr.h
@@ -0,0 +1,183 @@
+/*
+ * 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 "NullPtr.h"
+#include "OwnPtrCommon.h"
+#include "TypeTraits.h"
+#include <algorithm>
+#include <memory>
+
+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:
+ 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:
+ OwnPtr& operator=(const OwnPtr<T>&);
+
+ // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
+ // double-destruction), so these equality operators should never be needed.
+ template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+ template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+ template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+ template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnPtrCommon.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OwnPtrCommon.h
new file mode 100644
index 0000000..19256ea
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocation.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocation.h
new file mode 100644
index 0000000..ad3d217
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocation.h
@@ -0,0 +1,129 @@
+/*
+ * 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::size;
+ using PageBlock::base;
+
+#ifndef __clang__
+ using PageBlock::operator bool;
+#else
+ // FIXME: This is a workaround for <rdar://problem/8876150>, wherein Clang incorrectly emits an access
+ // control warning when a client tries to use operator bool exposed above via "using PageBlock::operator bool".
+ operator bool() const { return PageBlock::operator bool(); }
+#endif
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocationAligned.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocationAligned.cpp
new file mode 100644
index 0000000..6f54710
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocationAligned.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocationAligned.h
new file mode 100644
index 0000000..282c9e3
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h
new file mode 100644
index 0000000..eba5b03
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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 PageAllocatorSymbian_h
+#define PageAllocatorSymbian_h
+
+#include <e32std.h>
+#include <wtf/Bitmap.h>
+
+namespace WTF {
+
+size_t pageSize();
+
+// Convenience wrapper around an RChunk
+class SymbianChunk : public RChunk {
+
+public:
+ SymbianChunk(TInt handle)
+ {
+ SetHandle(handle);
+ // prevent kernel calls by caching these
+ m_base = reinterpret_cast<char*>(Base());
+ m_maxSize = MaxSize();
+ }
+
+ ~SymbianChunk()
+ {
+ Decommit(0, m_maxSize);
+ Close();
+ }
+
+ // checks if address is in chunk's virtual address space
+ bool contains(const void* address) const
+ {
+ return (static_cast<const char*>(address) >= m_base && static_cast<const char*>(address) < (m_base + m_maxSize));
+ }
+
+ char* m_base;
+ size_t m_maxSize;
+
+};
+
+// Size of the large up-front reservation
+#if defined(__WINS__)
+// Emulator has limited virtual address space
+const size_t largeReservationSize = 96*1024*1024;
+#else
+// HW has plenty of virtual addresses
+const size_t largeReservationSize = 256*1024*1024;
+#endif
+
+class PageAllocatorSymbian {
+
+public:
+ PageAllocatorSymbian();
+ ~PageAllocatorSymbian();
+
+ void* reserve(size_t);
+ void release(void*, size_t);
+ bool commit(void*, size_t);
+ bool decommit(void*, size_t);
+
+ bool contains(const void*) const;
+
+private:
+ static const size_t m_pageSize = 4096;
+ SymbianChunk* m_chunk;
+ Bitmap<largeReservationSize / m_pageSize> m_map;
+
+};
+
+} // namespace WTF
+
+#endif // PageAllocatorSymbian_h
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageBlock.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageBlock.cpp
new file mode 100644
index 0000000..6fb68e5
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageBlock.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageBlock.h
new file mode 100644
index 0000000..07452b3
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageReservation.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageReservation.h
new file mode 100644
index 0000000..6dff700
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PageReservation.h
@@ -0,0 +1,143 @@
+/*
+ * 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_committed(0)
+ , m_writable(false)
+ , m_executable(false)
+ {
+ }
+
+ using PageBlock::base;
+ using PageBlock::size;
+
+#ifndef __clang__
+ using PageBlock::operator bool;
+#else
+ // FIXME: This is a workaround for <rdar://problem/8876150>, wherein Clang incorrectly emits an access
+ // control warning when a client tries to use operator bool exposed above via "using PageBlock::operator bool".
+ operator bool() const { return PageBlock::operator bool(); }
+#endif
+
+ void commit(void* start, size_t size)
+ {
+ ASSERT(*this);
+ ASSERT(isPageAligned(start));
+ ASSERT(isPageAligned(size));
+ ASSERT(contains(start, size));
+
+ m_committed += size;
+ 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));
+
+ m_committed -= size;
+ OSAllocator::decommit(start, size);
+ }
+
+ size_t committed()
+ {
+ return m_committed;
+ }
+
+ 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_committed(0)
+ , m_writable(writable)
+ , m_executable(executable)
+ {
+ }
+
+ size_t m_committed;
+ bool m_writable;
+ bool m_executable;
+};
+
+}
+
+using WTF::PageReservation;
+
+#endif // PageReservation_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobs.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobs.h
new file mode 100644
index 0000000..2e0524d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobs.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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 ParallelJobs_h
+#define ParallelJobs_h
+
+#include "Assertions.h"
+#include "Noncopyable.h"
+#include "RefPtr.h"
+#include <wtf/Vector.h>
+
+#if ENABLE(PARALLEL_JOBS)
+
+// Usage:
+//
+// #if ENABLE(PARALLEL_JOBS)
+//
+// // Initialize parallel jobs
+// ParallelJobs<TypeOfParameter> parallelJobs(&worker [, requestedNumberOfJobs]);
+//
+// // Fill the parameter array
+// for(i = 0; i < parallelJobs.numberOfJobs(); ++i) {
+// TypeOfParameter& params = parallelJobs.parameter(i);
+// params.attr1 = localVars ...
+// ...
+// }
+//
+// // Execute parallel jobs
+// parallelJobs.execute();
+//
+// #else
+//
+// inlineFunction(args...);
+//
+// #endif // ENABLE(PARALLEL_JOBS)
+
+#if ENABLE(THREADING_GENERIC)
+#include "ParallelJobsGeneric.h"
+
+#elif ENABLE(THREADING_OPENMP)
+#include "ParallelJobsOpenMP.h"
+
+#elif ENABLE(THREADING_LIBDISPATCH)
+#include "ParallelJobsLibdispatch.h"
+
+#else
+#error "No parallel processing API for ParallelJobs"
+
+#endif
+
+namespace WTF {
+
+template<typename Type>
+class ParallelJobs {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ typedef void (*WorkerFunction)(Type*);
+
+ ParallelJobs(WorkerFunction func, int requestedJobNumber = 0) :
+ m_parallelEnvironment(reinterpret_cast<ParallelEnvironment::ThreadFunction>(func), sizeof(Type), requestedJobNumber)
+ {
+ m_parameters.grow(m_parallelEnvironment.numberOfJobs());
+ ASSERT(numberOfJobs() == m_parameters.size());
+ }
+
+ size_t numberOfJobs()
+ {
+ return m_parameters.size();
+ }
+
+ Type& parameter(size_t i)
+ {
+ return m_parameters[i];
+ }
+
+ void execute()
+ {
+ m_parallelEnvironment.execute(reinterpret_cast<unsigned char*>(m_parameters.data()));
+ }
+
+private:
+ ParallelEnvironment m_parallelEnvironment;
+ Vector<Type> m_parameters;
+};
+
+} // namespace WTF
+
+using WTF::ParallelJobs;
+
+#endif // ENABLE(PARALLEL_JOBS)
+
+#endif // ParallelJobs_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp
new file mode 100644
index 0000000..e241b83
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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(PARALLEL_JOBS) && ENABLE(THREADING_GENERIC)
+
+#include "ParallelJobs.h"
+
+namespace WTF {
+
+Vector< RefPtr<ParallelEnvironment::ThreadPrivate> >* ParallelEnvironment::s_threadPool = 0;
+
+bool ParallelEnvironment::ThreadPrivate::tryLockFor(ParallelEnvironment* parent)
+{
+ bool locked = m_mutex.tryLock();
+
+ if (!locked)
+ return false;
+
+ if (m_parent) {
+ m_mutex.unlock();
+ return false;
+ }
+
+ if (!m_threadID)
+ m_threadID = createThread(&ParallelEnvironment::ThreadPrivate::workerThread, this, "Parallel worker");
+
+ if (m_threadID)
+ m_parent = parent;
+
+ m_mutex.unlock();
+ return m_threadID;
+}
+
+void ParallelEnvironment::ThreadPrivate::execute(ThreadFunction threadFunction, void* parameters)
+{
+ MutexLocker lock(m_mutex);
+
+ m_threadFunction = threadFunction;
+ m_parameters = parameters;
+ m_running = true;
+ m_threadCondition.signal();
+}
+
+void ParallelEnvironment::ThreadPrivate::waitForFinish()
+{
+ MutexLocker lock(m_mutex);
+
+ while (m_running)
+ m_threadCondition.wait(m_mutex);
+}
+
+void* ParallelEnvironment::ThreadPrivate::workerThread(void* threadData)
+{
+ ThreadPrivate* sharedThread = reinterpret_cast<ThreadPrivate*>(threadData);
+ MutexLocker lock(sharedThread->m_mutex);
+
+ while (sharedThread->m_threadID) {
+ if (sharedThread->m_running) {
+ (*sharedThread->m_threadFunction)(sharedThread->m_parameters);
+ sharedThread->m_running = false;
+ sharedThread->m_parent = 0;
+ sharedThread->m_threadCondition.signal();
+ }
+
+ sharedThread->m_threadCondition.wait(sharedThread->m_mutex);
+ }
+ return 0;
+}
+
+} // namespace WTF
+
+#endif // ENABLE(PARALLEL_JOBS) && ENABLE(THREADING_GENERIC)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.h
new file mode 100644
index 0000000..2aa44d5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsGeneric.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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 ParallelJobsGeneric_h
+#define ParallelJobsGeneric_h
+
+#if ENABLE(THREADING_GENERIC)
+
+#include <wtf/RefCounted.h>
+#include <wtf/Threading.h>
+
+namespace WTF {
+
+static const unsigned int maxParallelThreads = 2;
+
+class ParallelEnvironment {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ typedef void (*ThreadFunction)(void*);
+
+ ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, unsigned int requestedJobNumber) :
+ m_threadFunction(threadFunction),
+ m_sizeOfParameter(sizeOfParameter)
+ {
+ if (!requestedJobNumber || requestedJobNumber > maxParallelThreads)
+ requestedJobNumber = maxParallelThreads;
+
+ if (!s_threadPool)
+ s_threadPool = new Vector< RefPtr<ThreadPrivate> >();
+
+ // The main thread should be also a worker.
+ unsigned int maxNewThreads = requestedJobNumber - 1;
+
+ for (unsigned int i = 0; i < maxParallelThreads && m_threads.size() < maxNewThreads; ++i) {
+ if (s_threadPool->size() < i + 1)
+ s_threadPool->append(ThreadPrivate::create());
+
+ if ((*s_threadPool)[i]->tryLockFor(this))
+ m_threads.append((*s_threadPool)[i]);
+ }
+
+ m_numberOfJobs = m_threads.size() + 1;
+ }
+
+ int numberOfJobs()
+ {
+ return m_numberOfJobs;
+ }
+
+ void execute(unsigned char* parameters)
+ {
+ size_t i;
+ for (i = 0; i < m_threads.size(); ++i) {
+ m_threads[i]->execute(m_threadFunction, parameters);
+ parameters += m_sizeOfParameter;
+ }
+
+ // The work for the main thread
+ (*m_threadFunction)(parameters);
+
+ // Wait until all jobs are done.
+ for (i = 0; i < m_threads.size(); ++i)
+ m_threads[i]->waitForFinish();
+ }
+
+ class ThreadPrivate : public RefCounted<ThreadPrivate> {
+ public:
+ ThreadPrivate()
+ : m_threadID(0)
+ , m_running(false)
+ , m_parent(0)
+ {
+ }
+
+ bool tryLockFor(ParallelEnvironment*);
+
+ void execute(ThreadFunction, void*);
+
+ void waitForFinish();
+
+ static PassRefPtr<ThreadPrivate> create()
+ {
+ return adoptRef(new ThreadPrivate());
+ }
+
+ static void* workerThread(void*);
+
+ private:
+ ThreadIdentifier m_threadID;
+ bool m_running;
+ ParallelEnvironment* m_parent;
+
+ mutable Mutex m_mutex;
+ ThreadCondition m_threadCondition;
+
+ ThreadFunction m_threadFunction;
+ void* m_parameters;
+ };
+
+private:
+ ThreadFunction m_threadFunction;
+ size_t m_sizeOfParameter;
+ int m_numberOfJobs;
+
+ Vector< RefPtr<ThreadPrivate> > m_threads;
+ static Vector< RefPtr<ThreadPrivate> >* s_threadPool;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(THREADING_GENERIC)
+
+
+#endif // ParallelJobsGeneric_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsLibdispatch.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsLibdispatch.h
new file mode 100644
index 0000000..687c771
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsLibdispatch.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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 ParallelJobsLibdispatch_h
+#define ParallelJobsLibdispatch_h
+
+#if ENABLE(THREADING_LIBDISPATCH)
+
+#include <dispatch/dispatch.h>
+
+namespace WTF {
+
+static const int maxParallelThreads = 2;
+
+class ParallelEnvironment {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ typedef void (*ThreadFunction)(void*);
+
+ ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber) :
+ m_threadFunction(threadFunction),
+ m_sizeOfParameter(sizeOfParameter)
+ {
+ if (!requestedJobNumber || requestedJobNumber > maxParallelThreads)
+ requestedJobNumber = maxParallelThreads;
+
+ ASSERT(requestedJobNumber > 0);
+
+ m_numberOfJobs = requestedJobNumber;
+ }
+
+ int numberOfJobs()
+ {
+ return m_numberOfJobs;
+ }
+
+ void execute(unsigned char* parameters)
+ {
+ // libdispatch is NOT supported inside a template
+ dispatch_queue_t parallelJobsQueue = dispatch_queue_create("ParallelJobs", 0);
+
+ for (int i = 0; i < m_numberOfJobs - 1; ++i) {
+ dispatch_async(parallelJobsQueue, ^{(*m_threadFunction)(parameters);});
+ parameters += m_sizeOfParameter;
+ }
+
+ // The work for the main thread. Wait until all jobs are done.
+ dispatch_sync(parallelJobsQueue, ^{(*m_threadFunction)(parameters);});
+ }
+
+private:
+ ThreadFunction m_threadFunction;
+ size_t m_sizeOfParameter;
+ int m_numberOfJobs;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(THREADING_LIBDISPATCH)
+
+#endif // ParallelJobsLibdispatch_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsOpenMP.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsOpenMP.h
new file mode 100644
index 0000000..706bd80
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ParallelJobsOpenMP.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 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 ParallelJobsOpenMP_h
+#define ParallelJobsOpenMP_h
+
+#if ENABLE(THREADING_OPENMP)
+
+#include <omp.h>
+
+namespace WTF {
+
+class ParallelEnvironment {
+ WTF_MAKE_NONCOPYABLE(ParallelEnvironment);
+public:
+ typedef void (*ThreadFunction)(void*);
+
+ ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber) :
+ m_threadFunction(threadFunction),
+ m_sizeOfParameter(sizeOfParameter)
+ {
+ int maxNumberOfThreads = omp_get_max_threads();
+
+ if (!requestedJobNumber || requestedJobNumber > maxNumberOfThreads)
+ requestedJobNumber = maxNumberOfThreads;
+
+ ASSERT(requestedJobNumber > 0);
+
+ m_numberOfJobs = requestedJobNumber;
+
+ }
+
+ int numberOfJobs()
+ {
+ return m_numberOfJobs;
+ }
+
+ void execute(unsigned char* parameters)
+ {
+ omp_set_num_threads(m_numberOfJobs);
+
+#pragma omp parallel for
+ for (int i = 0; i < m_numberOfJobs; ++i)
+ (*m_threadFunction)(parameters + i * m_sizeOfParameter);
+ }
+
+private:
+ ThreadFunction m_threadFunction;
+ size_t m_sizeOfParameter;
+ int m_numberOfJobs;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(THREADING_OPENMP)
+
+#endif // ParallelJobsOpenMP_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h
new file mode 100644
index 0000000..3f30924
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h
@@ -0,0 +1,227 @@
+/*
+ * 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 "TypeTraits.h"
+
+namespace WTF {
+
+template<typename T> class OwnArrayPtr;
+template<typename T> class PassOwnArrayPtr;
+template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*);
+template<typename T> void deleteOwnedArrayPtr(T* ptr);
+
+template<typename T> class PassOwnArrayPtr {
+public:
+ typedef T* PtrType;
+
+ PassOwnArrayPtr() : m_ptr(0) { }
+
+#if !defined(LOOSE_PASS_OWN_PTR) || !HAVE(NULLPTR)
+ PassOwnArrayPtr(std::nullptr_t) : m_ptr(0) { }
+#endif
+
+ // 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> inline void deleteOwnedArrayPtr(T* ptr)
+{
+ typedef char known[sizeof(T) ? 1 : -1];
+ if (sizeof(known))
+ delete [] 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnPtr.h
new file mode 100644
index 0000000..75d0643
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassOwnPtr.h
@@ -0,0 +1,226 @@
+/*
+ * 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) { }
+ PassOwnPtr(std::nullptr_t) : 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
+
+ // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
+ // double-destruction), so these equality operators should never be needed.
+ template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+ template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+ template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+ template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassRefPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassRefPtr.h
new file mode 100644
index 0000000..7b4af6b
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassTraits.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassTraits.h
new file mode 100644
index 0000000..3462734
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassTraits.h
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ * 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_PassTraits_h
+#define WTF_PassTraits_h
+
+#include "OwnPtr.h"
+#include "RefPtr.h"
+
+// The PassTraits template exists to help optimize (or make possible) use
+// of WTF data structures with WTF smart pointers that have a Pass
+// variant for transfer of ownership
+
+namespace WTF {
+
+template<typename T> struct PassTraits {
+ typedef T Type;
+ typedef T PassType;
+ static PassType transfer(Type& value) { return value; }
+};
+
+template<typename T> struct PassTraits<OwnPtr<T> > {
+ typedef OwnPtr<T> Type;
+ typedef PassOwnPtr<T> PassType;
+ static PassType transfer(Type& value) { return value.release(); }
+};
+
+template<typename T> struct PassTraits<RefPtr<T> > {
+ typedef RefPtr<T> Type;
+ typedef PassRefPtr<T> PassType;
+ static PassType transfer(Type& value) { return value.release(); }
+};
+
+} // namespace WTF
+
+using WTF::PassTraits;
+
+#endif // WTF_PassTraits_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h
new file mode 100644
index 0000000..716d9e1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h
@@ -0,0 +1,1224 @@
+/*
+ * 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
+#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) (__ARMCC_VERSION >= (major * 100000 + minor * 10000 + patch * 1000 + build))
+#else
+/* Define this for !RVCT compilers, just so we can write things like RVCT_VERSION_AT_LEAST(3, 0, 0, 0). */
+#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) 0
+#endif
+
+/* COMPILER(GCCE) - GNU Compiler Collection for Embedded */
+#if defined(__GCCE__)
+#define WTF_COMPILER_GCCE 1
+#define GCCE_VERSION (__GCCE__ * 10000 + __GCCE_MINOR__ * 100 + __GCCE_PATCHLEVEL__)
+#define GCCE_VERSION_AT_LEAST(major, minor, patch) (GCCE_VERSION >= (major * 10000 + minor * 100 + patch))
+#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 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
+
+/* COMPILER(SUNCC) */
+#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
+#define WTF_COMPILER_SUNCC 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) */
+
+#if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON)
+#define WTF_CPU_ARM_NEON 1
+#endif
+
+#endif /* ARM */
+
+#if CPU(ARM) || CPU(MIPS)
+#define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
+#endif
+
+/* ==== 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_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_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 */
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#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 */
+
+/* USE(CG) and PLATFORM(CI) */
+#if PLATFORM(MAC) || PLATFORM(IOS)
+#define WTF_USE_CG 1
+#endif
+#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
+#define WTF_USE_CA 1
+#endif
+
+/* USE(SKIA) for Win/Linux, CG for Mac */
+#if PLATFORM(CHROMIUM)
+#if OS(DARWIN)
+#define WTF_USE_CG 1
+#define WTF_USE_ATSUI 1
+#define WTF_USE_CORE_TEXT 1
+#define WTF_USE_ICCJPEG 1
+#else
+#define WTF_USE_SKIA 1
+#define WTF_USE_CHROMIUM_NET 1
+#endif
+#endif
+
+#if PLATFORM(BREWMP)
+#define WTF_USE_SKIA 1
+#endif
+
+#if PLATFORM(GTK)
+#define WTF_USE_CAIRO 1
+#endif
+
+
+#if OS(WINCE)
+#include <ce_time.h>
+#define WTF_USE_MERSENNE_TWISTER_19937 1
+#endif
+
+#if PLATFORM(QT) && OS(UNIX) && !OS(SYMBIAN) && !OS(DARWIN)
+#define WTF_USE_PTHREAD_BASED_QT 1
+#endif
+
+#if (PLATFORM(GTK) || PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && (OS(DARWIN) || USE(PTHREAD_BASED_QT)) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
+#define ENABLE_JSC_MULTIPLE_THREADS 1
+#endif
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+#define ENABLE_WTF_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)
+#if !defined(BUILDING_ON_LEOPARD) && CPU(X86_64)
+#define WTF_USE_PLUGIN_HOST_PROCESS 1
+#endif
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#define ENABLE_GESTURE_EVENTS 1
+#define ENABLE_RUBBER_BANDING 1
+#define WTF_USE_WK_SCROLLBAR_PAINTER 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 WTF_USE_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#define HAVE_READLINE 1
+#define HAVE_RUNLOOP_TIMER 1
+#define ENABLE_FULLSCREEN_API 1
+#define ENABLE_SMOOTH_SCROLLING 1
+#define ENABLE_WEB_ARCHIVE 1
+#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
+
+#if PLATFORM(CHROMIUM) && OS(DARWIN)
+#define WTF_USE_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#endif
+
+#if PLATFORM(BREWMP)
+#define ENABLE_SINGLE_THREADED 1
+#endif
+
+#if PLATFORM(QT) && OS(DARWIN)
+#define WTF_USE_CF 1
+#endif
+
+#if OS(DARWIN) && !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_DATA_TRANSFER_ITEMS 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_USE_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#define ENABLE_WEB_ARCHIVE 1
+#endif
+
+#if PLATFORM(ANDROID)
+#define WTF_USE_PTHREADS 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
+#if !defined(ENABLE_JIT) && !ENABLE(ANDROID_JSC_JIT)
+#define ENABLE_JIT 0
+#endif
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE)
+#define WTF_USE_CF 1
+#define WTF_USE_PTHREADS 0
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !defined(WIN_CAIRO)
+#define WTF_USE_CFNETWORK 1
+#endif
+
+#if USE(CFNETWORK) || PLATFORM(MAC)
+#define WTF_USE_CFURLCACHE 1
+#define WTF_USE_CFURLSTORAGESESSIONS 1
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
+#define ENABLE_WEB_ARCHIVE 1
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !defined(WIN_CAIRO) && !PLATFORM(QT)
+#define ENABLE_FULLSCREEN_API 1
+#endif
+
+#if PLATFORM(WX)
+#define ENABLE_ASSEMBLER 1
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
+#if OS(DARWIN)
+#define WTF_USE_CF 1
+#define WTF_USE_CORE_TEXT 1
+#define ENABLE_WEB_ARCHIVE 1
+#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 !defined(HAVE_STRNSTR)
+#if OS(DARWIN) || OS(FREEBSD)
+#define HAVE_STRNSTR 1
+#endif
+#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
+#define WTF_USE_ACCELERATE 1
+
+#ifndef 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
+#if !OS(UNIX) || OS(SYMBIAN)
+#define USE_SYSTEM_MALLOC 1
+#endif
+#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_DATA_TRANSFER_ITEMS)
+#define ENABLE_DATA_TRANSFER_ITEMS 0
+#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_GESTURE_RECOGNIZER)
+#define ENABLE_GESTURE_RECOGNIZER 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_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 versions 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
+
+/* Currently only implemented for JSVALUE64, only tested on PLATFORM(MAC) */
+#if ENABLE(JIT) && USE(JSVALUE64) && PLATFORM(MAC)
+#define ENABLE_DFG_JIT 1
+/* Enabled with restrictions to circumvent known performance regressions. */
+#define ENABLE_DFG_JIT_RESTRICTIONS 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
+
+#if CPU(SH4) && PLATFORM(QT)
+#define ENABLE_JIT 1
+#define ENABLE_YARR 1
+#define ENABLE_YARR_JIT 1
+#define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
+#define ENABLE_ASSEMBLER 1
+#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) || (RVCT_VERSION_AT_LEAST(4, 0, 0, 0) && 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 PLATFORM(CHROMIUM)
+#define ENABLE_YARR_JIT 0
+
+#elif 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
+#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
+
+#if !defined(ENABLE_WEB_ARCHIVE)
+#define ENABLE_WEB_ARCHIVE 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 */
+#ifndef 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(MAC) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) &&!defined(WIN_CAIRO))
+#define WTF_USE_ACCELERATED_COMPOSITING 1
+#endif
+
+#if (PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)) || PLATFORM(IOS)
+#define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
+#endif
+
+#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#define WTF_USE_AVFOUNDATION 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 !defined(ENABLE_THREADING_OPENMP) && defined(_OPENMP)
+#define ENABLE_THREADING_OPENMP 1
+#endif
+
+#if !defined(ENABLE_PARALLEL_JOBS) && !ENABLE(SINGLE_THREADED) && (ENABLE(THREADING_GENERIC) || ENABLE(THREADING_LIBDISPATCH) || ENABLE(THREADING_OPENMP))
+#define ENABLE_PARALLEL_JOBS 1
+#endif
+
+#if ENABLE(GLIB_SUPPORT)
+#include "GTypedefs.h"
+#endif
+
+/* FIXME: This define won't be needed once #27551 is fully landed. However,
+ since most ports try to support sub-project independence, adding new headers
+ to WTF causes many ports to break, and so this way we can address the build
+ breakages one port at a time. */
+#define WTF_USE_EXPORT_MACROS 0
+
+#if PLATFORM(QT) || PLATFORM(GTK)
+#define WTF_USE_UNIX_DOMAIN_SOCKETS 1
+#endif
+
+#endif /* WTF_Platform_h */
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PossiblyNull.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PossiblyNull.h
index 79c4d82..79c4d82 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/PossiblyNull.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PossiblyNull.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumber.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumber.cpp
new file mode 100644
index 0000000..490c591
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumber.cpp
@@ -0,0 +1,103 @@
+/*
+ * 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 "CryptographicallyRandomNumber.h"
+#include "RandomNumberSeed.h"
+
+#include <limits>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if USE(MERSENNE_TWISTER_19937)
+extern "C" {
+#include "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 USE(OS_RANDOMNESS)
+ uint32_t bits = cryptographicallyRandomNumber();
+ return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
+#else
+ // Without OS_RANDOMNESS, we fall back to other random number generators
+ // that might not be cryptographically secure. Ideally, most ports would
+ // define USE(OS_RANDOMNESS).
+
+#if !ENABLE(WTF_MULTIPLE_THREADS)
+ static bool s_initialized = false;
+ if (!s_initialized) {
+ initializeRandomNumberGenerator();
+ s_initialized = true;
+ }
+#endif
+
+#if USE(MERSENNE_TWISTER_19937)
+ return genrand_res53();
+#elif PLATFORM(BREWMP)
+ uint32_t bits;
+ // Is this a cryptographically strong source of random numbers? If so, we
+ // should move this into OSRandomSource.
+ // http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp851.pdf
+ // is slightly unclear on this point, although it seems to imply that it is
+ // secure.
+ 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
+#endif
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumber.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumber.h
new file mode 100644
index 0000000..f2e7e8f
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumberSeed.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumberSeed.h
new file mode 100644
index 0000000..0703abf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RandomNumberSeed.h
@@ -0,0 +1,83 @@
+/*
+ * 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 USE(MERSENNE_TWISTER_19937)
+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());
+#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
+
+#if USE(MERSENNE_TWISTER_19937)
+ // use rand() to initialize the Mersenne Twister random number generator.
+ 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);
+#endif
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCounted.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCounted.h
new file mode 100644
index 0000000..12b670e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCounted.h
@@ -0,0 +1,172 @@
+/*
+ * 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 "FastAllocBase.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
+ }
+
+ // Helper for generating JIT code. Please do not use for non-JIT purposes.
+ const int* addressOfCount() const
+ {
+ return &m_refCount;
+ }
+
+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;
+ }
+
+#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 {
+ WTF_MAKE_NONCOPYABLE(RefCounted); WTF_MAKE_FAST_ALLOCATED;
+public:
+ void deref()
+ {
+ if (derefBase())
+ delete static_cast<T*>(this);
+ }
+
+protected:
+ RefCounted() { }
+ ~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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp
new file mode 100644
index 0000000..08b32ab
--- /dev/null
+++ b/src/3rdparty/webkit/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(WTF_MULTIPLE_THREADS)
+ atomicIncrement(&m_count);
+#else
+ ++m_count;
+#endif
+}
+
+void RefCountedLeakCounter::decrement()
+{
+#if ENABLE(WTF_MULTIPLE_THREADS)
+ atomicDecrement(&m_count);
+#else
+ --m_count;
+#endif
+}
+
+#endif
+
+} // namespace WTF
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCountedLeakCounter.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCountedLeakCounter.h
index 57cc283..57cc283 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCountedLeakCounter.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCountedLeakCounter.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtr.h
new file mode 100644
index 0000000..353bd35
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtr.h
@@ -0,0 +1,232 @@
+/*
+ * 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtrHashMap.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtrHashMap.h
new file mode 100644
index 0000000..dbeabfa
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtrHashMap.h
@@ -0,0 +1,342 @@
+/*
+ * 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 RefPtrHashMap_h
+#define RefPtrHashMap_h
+
+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> {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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
+
+#endif // RefPtrHashMap_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RetainPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RetainPtr.h
new file mode 100644
index 0000000..a716390
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RetainPtr.h
@@ -0,0 +1,256 @@
+/*
+ * 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>
+
+#if USE(CF)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+#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> > : SimpleClassHashTraits<RetainPtr<P> > { };
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.cpp
new file mode 100644
index 0000000..e76f6ac
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.cpp
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+// A straightforward SHA-1 implementation based on RFC 3174.
+// http://www.ietf.org/rfc/rfc3174.txt
+// The names of functions and variables (such as "a", "b", and "f") follow notations in RFC 3174.
+
+#include "config.h"
+#include "SHA1.h"
+
+#include "Assertions.h"
+#ifndef NDEBUG
+#include "StringExtras.h"
+#include "text/CString.h"
+#endif
+
+namespace WTF {
+
+#ifdef NDEBUG
+static inline void testSHA1() { }
+#else
+static bool isTestSHA1Done;
+
+static void expectSHA1(CString input, int repeat, CString expected)
+{
+ SHA1 sha1;
+ for (int i = 0; i < repeat; ++i)
+ sha1.addBytes(reinterpret_cast<const uint8_t*>(input.data()), input.length());
+ Vector<uint8_t, 20> digest;
+ sha1.computeHash(digest);
+ char* buffer = 0;
+ CString actual = CString::newUninitialized(40, buffer);
+ for (size_t i = 0; i < 20; ++i) {
+ snprintf(buffer, 3, "%02X", digest.at(i));
+ buffer += 2;
+ }
+ ASSERT_WITH_MESSAGE(actual == expected, "input: %s, repeat: %d, actual: %s, expected: %s", input.data(), repeat, actual.data(), expected.data());
+}
+
+static void testSHA1()
+{
+ if (isTestSHA1Done)
+ return;
+ isTestSHA1Done = true;
+
+ // Examples taken from sample code in RFC 3174.
+ expectSHA1("abc", 1, "A9993E364706816ABA3E25717850C26C9CD0D89D");
+ expectSHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 1, "84983E441C3BD26EBAAE4AA1F95129E5E54670F1");
+ expectSHA1("a", 1000000, "34AA973CD4C4DAA4F61EEB2BDBAD27316534016F");
+ expectSHA1("0123456701234567012345670123456701234567012345670123456701234567", 10, "DEA356A2CDDD90C7A7ECEDC5EBB563934F460452");
+}
+#endif
+
+static inline uint32_t f(int t, uint32_t b, uint32_t c, uint32_t d)
+{
+ ASSERT(t >= 0 && t < 80);
+ if (t < 20)
+ return (b & c) | ((~b) & d);
+ if (t < 40)
+ return b ^ c ^ d;
+ if (t < 60)
+ return (b & c) | (b & d) | (c & d);
+ return b ^ c ^ d;
+}
+
+static inline uint32_t k(int t)
+{
+ ASSERT(t >= 0 && t < 80);
+ if (t < 20)
+ return 0x5a827999;
+ if (t < 40)
+ return 0x6ed9eba1;
+ if (t < 60)
+ return 0x8f1bbcdc;
+ return 0xca62c1d6;
+}
+
+static inline uint32_t rotateLeft(int n, uint32_t x)
+{
+ ASSERT(n >= 0 && n < 32);
+ return (x << n) | (x >> (32 - n));
+}
+
+SHA1::SHA1()
+{
+ // FIXME: Move unit tests somewhere outside the constructor. See bug 55853.
+ testSHA1();
+ reset();
+}
+
+void SHA1::addBytes(const uint8_t* input, size_t length)
+{
+ while (length--) {
+ ASSERT(m_cursor < 64);
+ m_buffer[m_cursor++] = *input++;
+ ++m_totalBytes;
+ if (m_cursor == 64)
+ processBlock();
+ }
+}
+
+void SHA1::computeHash(Vector<uint8_t, 20>& digest)
+{
+ finalize();
+
+ digest.clear();
+ digest.resize(20);
+ for (size_t i = 0; i < 5; ++i) {
+ // Treat hashValue as a big-endian value.
+ uint32_t hashValue = m_hash[i];
+ for (int j = 0; j < 4; ++j) {
+ digest[4 * i + (3 - j)] = hashValue & 0xFF;
+ hashValue >>= 8;
+ }
+ }
+
+ reset();
+}
+
+void SHA1::finalize()
+{
+ ASSERT(m_cursor < 64);
+ m_buffer[m_cursor++] = 0x80;
+ if (m_cursor > 56) {
+ // Pad out to next block.
+ while (m_cursor < 64)
+ m_buffer[m_cursor++] = 0x00;
+ processBlock();
+ }
+
+ for (size_t i = m_cursor; i < 56; ++i)
+ m_buffer[i] = 0x00;
+
+ // Write the length as a big-endian 64-bit value.
+ uint64_t bits = m_totalBytes * 8;
+ for (int i = 0; i < 8; ++i) {
+ m_buffer[56 + (7 - i)] = bits & 0xFF;
+ bits >>= 8;
+ }
+ m_cursor = 64;
+ processBlock();
+}
+
+void SHA1::processBlock()
+{
+ ASSERT(m_cursor == 64);
+
+ uint32_t w[80] = { 0 };
+ for (int t = 0; t < 16; ++t)
+ w[t] = (m_buffer[t * 4] << 24) | (m_buffer[t * 4 + 1] << 16) | (m_buffer[t * 4 + 2] << 8) | m_buffer[t * 4 + 3];
+ for (int t = 16; t < 80; ++t)
+ w[t] = rotateLeft(1, w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16]);
+
+ uint32_t a = m_hash[0];
+ uint32_t b = m_hash[1];
+ uint32_t c = m_hash[2];
+ uint32_t d = m_hash[3];
+ uint32_t e = m_hash[4];
+
+ for (int t = 0; t < 80; ++t) {
+ uint32_t temp = rotateLeft(5, a) + f(t, b, c, d) + e + w[t] + k(t);
+ e = d;
+ d = c;
+ c = rotateLeft(30, b);
+ b = a;
+ a = temp;
+ }
+
+ m_hash[0] += a;
+ m_hash[1] += b;
+ m_hash[2] += c;
+ m_hash[3] += d;
+ m_hash[4] += e;
+
+ m_cursor = 0;
+}
+
+void SHA1::reset()
+{
+ m_cursor = 0;
+ m_totalBytes = 0;
+ m_hash[0] = 0x67452301;
+ m_hash[1] = 0xefcdab89;
+ m_hash[2] = 0x98badcfe;
+ m_hash[3] = 0x10325476;
+ m_hash[4] = 0xc3d2e1f0;
+
+ // Clear the buffer after use in case it's sensitive.
+ memset(m_buffer, 0, sizeof(m_buffer));
+}
+
+} // namespace WTF
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.h
new file mode 100644
index 0000000..dad6dc8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SHA1.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2011 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_SHA1_h
+#define WTF_SHA1_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+class SHA1 {
+public:
+ SHA1();
+
+ void addBytes(const Vector<uint8_t>& input)
+ {
+ addBytes(input.data(), input.size());
+ }
+ void addBytes(const uint8_t* input, size_t length);
+
+ // computeHash has a side effect of resetting the state of the object.
+ void computeHash(Vector<uint8_t, 20>&);
+
+private:
+ void finalize();
+ void processBlock();
+ void reset();
+
+ uint8_t m_buffer[64];
+ size_t m_cursor; // Number of bytes filled in m_buffer (0-64).
+ uint64_t m_totalBytes; // Number of bytes added so far.
+ uint32_t m_hash[5];
+};
+
+} // namespace WTF
+
+using WTF::SHA1;
+
+#endif // WTF_SHA1_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/SegmentedVector.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SegmentedVector.h
index b1cbc4d..b1cbc4d 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/SegmentedVector.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SegmentedVector.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SentinelLinkedList.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SentinelLinkedList.h
new file mode 100644
index 0000000..610d2d2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SentinelLinkedList.h
@@ -0,0 +1,109 @@
+/*
+ * 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. 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.
+ */
+
+// A SentinelLinkedList is a linked list with dummy head and tail sentinels,
+// which allow for branch-less insertion and removal, and removal without a
+// pointer to the list.
+//
+// Requires: Node is a concrete class with:
+// Node(SentinelTag);
+// void setPrev(Node*);
+// Node* prev();
+// void setNext(Node*);
+// Node* next();
+
+#ifndef SentinelLinkedList_h
+#define SentinelLinkedList_h
+
+namespace WTF {
+
+enum SentinelTag { Sentinel };
+
+template <typename Node> class SentinelLinkedList {
+public:
+ typedef Node* iterator;
+
+ SentinelLinkedList();
+
+ void push(Node*);
+ static void remove(Node*);
+
+ iterator begin();
+ iterator end();
+
+private:
+ Node m_headSentinel;
+ Node m_tailSentinel;
+};
+
+template <typename Node> inline SentinelLinkedList<Node>::SentinelLinkedList()
+ : m_headSentinel(Sentinel)
+ , m_tailSentinel(Sentinel)
+{
+ m_headSentinel.setNext(&m_tailSentinel);
+ m_headSentinel.setPrev(0);
+
+ m_tailSentinel.setPrev(&m_headSentinel);
+ m_tailSentinel.setNext(0);
+}
+
+template <typename Node> inline typename SentinelLinkedList<Node>::iterator SentinelLinkedList<Node>::begin()
+{
+ return m_headSentinel.next();
+}
+
+template <typename Node> inline typename SentinelLinkedList<Node>::iterator SentinelLinkedList<Node>::end()
+{
+ return &m_tailSentinel;
+}
+
+template <typename Node> inline void SentinelLinkedList<Node>::push(Node* node)
+{
+ ASSERT(node);
+ Node* prev = &m_headSentinel;
+ Node* next = m_headSentinel.next();
+
+ node->setPrev(prev);
+ node->setNext(next);
+
+ prev->setNext(node);
+ next->setPrev(node);
+}
+
+template <typename Node> inline void SentinelLinkedList<Node>::remove(Node* node)
+{
+ Node* prev = node->prev();
+ Node* next = node->next();
+
+ prev->setNext(next);
+ next->setPrev(prev);
+}
+
+}
+
+using WTF::SentinelLinkedList;
+
+#endif
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SinglyLinkedList.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SinglyLinkedList.h
new file mode 100644
index 0000000..c00bf36
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SinglyLinkedList.h
@@ -0,0 +1,72 @@
+/*
+ * 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. 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 SinglyLinkedList_h
+#define SinglyLinkedList_h
+
+namespace WTF {
+
+template <typename Node> class SinglyLinkedList {
+public:
+ SinglyLinkedList();
+
+ bool isEmpty();
+
+ void push(Node*);
+ Node* pop();
+
+private:
+ Node* m_head;
+};
+
+template <typename Node> inline SinglyLinkedList<Node>::SinglyLinkedList()
+ : m_head(0)
+{
+}
+
+template <typename Node> inline bool SinglyLinkedList<Node>::isEmpty()
+{
+ return !m_head;
+}
+
+template <typename Node> inline void SinglyLinkedList<Node>::push(Node* node)
+{
+ ASSERT(node);
+ node->setNext(m_head);
+ m_head = node;
+}
+
+template <typename Node> inline Node* SinglyLinkedList<Node>::pop()
+{
+ Node* tmp = m_head;
+ m_head = m_head->next();
+ return tmp;
+}
+
+}
+
+using WTF::SinglyLinkedList;
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SizeLimits.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/SizeLimits.cpp
new file mode 100644
index 0000000..4e481bb
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp
new file mode 100644
index 0000000..41e0d60
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp
@@ -0,0 +1,285 @@
+/*
+ * 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, QNX, UNIX, SYMBIAN
+// These platforms are not:
+// WINDOWS, SOLARIS, OPENBSD, HAIKU, WINCE
+//
+// FIXME: remove this! - this code unsafely guesses at stack sizes!
+#if OS(WINDOWS) || OS(SOLARIS) || OS(OPENBSD) || 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 = (void*)info.iLimit;
+}
+
+#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)
+
+void StackBounds::initialize()
+{
+#if CPU(X86) && COMPILER(MSVC)
+ // offset 0x18 from the FS segment register gives a pointer to
+ // the thread information block for the current thread
+ NT_TIB* pTib;
+ __asm {
+ MOV EAX, FS:[18h]
+ MOV pTib, EAX
+ }
+ m_origin = static_cast<void*>(pTib->StackBase);
+#elif CPU(X86) && COMPILER(GCC)
+ // offset 0x18 from the FS segment register gives a pointer to
+ // the thread information block for the current thread
+ NT_TIB* pTib;
+ asm ( "movl %%fs:0x18, %0\n"
+ : "=r" (pTib)
+ );
+ m_origin = static_cast<void*>(pTib->StackBase);
+#elif CPU(X86_64)
+ PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
+ m_origin = reinterpret_cast<void*>(pTib->StackBase);
+#else
+#error Need a way to get the stack bounds on this platform (Windows)
+#endif
+ // Looks like we should be able to get pTib->StackLimit
+ m_bound = estimateStackBound(m_origin);
+}
+
+#else
+#error Need a way to get the stack bounds on this platform
+#endif
+
+} // namespace WTF
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.h
new file mode 100644
index 0000000..afce860
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StaticConstructors.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StaticConstructors.h
new file mode 100644
index 0000000..8b2df9d
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StdLibExtras.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StdLibExtras.h
new file mode 100644
index 0000000..a8582e9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StdLibExtras.h
@@ -0,0 +1,167 @@
+/*
+ * 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))
+
+// Efficient implementation that takes advantage of powers of two.
+template<size_t divisor> inline size_t roundUpToMultipleOf(size_t x)
+{
+ COMPILE_ASSERT(divisor && !(divisor & (divisor - 1)), divisor_is_a_power_of_two);
+
+ size_t remainderMask = divisor - 1;
+ return (x + remainderMask) & ~remainderMask;
+}
+
+// Binary search algorithm, calls extractKey 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(*extractKey)(ArrayType*)>
+inline ArrayType* binarySearch(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 = extractKey(&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 == extractKey(&array[0]));
+ return &array[0];
+}
+
+} // namespace WTF
+
+using WTF::binarySearch;
+using WTF::bitwise_cast;
+
+#endif // WTF_StdLibExtras_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringExtras.cpp
index 1b96417..1b96417 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringExtras.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringExtras.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringExtras.h
new file mode 100644
index 0000000..371e33b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringExtras.h
@@ -0,0 +1,126 @@
+/*
+ * 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 !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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringHasher.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringHasher.h
new file mode 100644
index 0000000..5a2c36c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StringHasher.h
@@ -0,0 +1,178 @@
+/*
+ * 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 computeHash(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 computeHash(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 computeHash(const T* data, unsigned length)
+ {
+ return computeHash<T, defaultCoverter>(data, length);
+ }
+
+ template<typename T> static inline unsigned computeHash(const T* data)
+ {
+ return computeHash<T, defaultCoverter>(data);
+ }
+
+ template<size_t length> static inline unsigned hashMemory(const void* data)
+ {
+ COMPILE_ASSERT(!(length % 4), length_must_be_a_multible_of_four);
+ return computeHash<UChar>(static_cast<const UChar*>(data), length / sizeof(UChar));
+ }
+
+ static inline unsigned hashMemory(const void* data, unsigned size)
+ {
+ ASSERT(!(size % 2));
+ return computeHash<UChar>(static_cast<const UChar*>(data), size / 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
+
+using WTF::StringHasher;
+
+#endif // WTF_StringHasher_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TCPackedCache.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCPackedCache.h
index 0464f8f..0464f8f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCPackedCache.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCPackedCache.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCPageMap.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCPageMap.h
new file mode 100644
index 0000000..99bdc40
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSpinLock.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSpinLock.h
new file mode 100644
index 0000000..81b7d0c
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp
new file mode 100644
index 0000000..3cb59e8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp
@@ -0,0 +1,525 @@
+// 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"
+#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC)
+#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
+
+#endif // #if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC)
+
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.h
index 1c67788..1c67788 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h
new file mode 100644
index 0000000..f1e1472
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp
index 042d49e..042d49e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h
new file mode 100644
index 0000000..ed1ba2c
--- /dev/null
+++ b/src/3rdparty/webkit/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/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 {
+ WTF_MAKE_NONCOPYABLE(ThreadIdentifierData);
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h
new file mode 100644
index 0000000..ca11db3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h
@@ -0,0 +1,153 @@
+/*
+ * 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 ThreadSafeRefCounted_h
+#define ThreadSafeRefCounted_h
+
+#include "Platform.h"
+
+#include <wtf/Atomics.h>
+#include <wtf/DynamicAnnotations.h>
+#include <wtf/ThreadingPrimitives.h>
+
+namespace WTF {
+
+class ThreadSafeRefCountedBase {
+ WTF_MAKE_NONCOPYABLE(ThreadSafeRefCountedBase);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ ThreadSafeRefCountedBase(int initialRefCount = 1)
+ : m_refCount(initialRefCount)
+ {
+ }
+
+ void ref()
+ {
+#if USE(LOCKFREE_THREADSAFEREFCOUNTED)
+ atomicIncrement(&m_refCount);
+#else
+ MutexLocker locker(m_mutex);
+ ++m_refCount;
+#endif
+ }
+
+ bool hasOneRef()
+ {
+ return refCount() == 1;
+ }
+
+ int refCount() const
+ {
+#if !USE(LOCKFREE_THREADSAFEREFCOUNTED)
+ 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_THREADSAFEREFCOUNTED)
+ WTF_ANNOTATE_HAPPENS_BEFORE(&m_refCount);
+ if (atomicDecrement(&m_refCount) <= 0) {
+ WTF_ANNOTATE_HAPPENS_AFTER(&m_refCount);
+ 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_THREADSAFEREFCOUNTED)
+ mutable Mutex m_mutex;
+#endif
+};
+
+template<class T> class ThreadSafeRefCounted : public ThreadSafeRefCountedBase {
+public:
+ void deref()
+ {
+ if (derefBase())
+ delete static_cast<T*>(this);
+ }
+
+protected:
+ ThreadSafeRefCounted()
+ {
+ }
+};
+
+} // namespace WTF
+
+using WTF::ThreadSafeRefCounted;
+
+#endif // ThreadSafeRefCounted_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecific.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecific.h
new file mode 100644
index 0000000..fa9a393
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecific.h
@@ -0,0 +1,332 @@
+/*
+ * 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 {
+ WTF_MAKE_NONCOPYABLE(ThreadSpecific);
+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 {
+ WTF_MAKE_NONCOPYABLE(Data);
+ public:
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp
new file mode 100644
index 0000000..d72996a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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"
+
+#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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Threading.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Threading.cpp
new file mode 100644
index 0000000..f2e0565
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Threading.cpp
@@ -0,0 +1,100 @@
+/*
+ * 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Threading.h
new file mode 100644
index 0000000..b6f8c24
--- /dev/null
+++ b/src/3rdparty/webkit/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/ThreadSafeRefCounted.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/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingNone.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingNone.cpp
index 2e8a259..2e8a259 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingNone.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingNone.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPrimitives.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPrimitives.h
new file mode 100644
index 0000000..831a99e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPrimitives.h
@@ -0,0 +1,169 @@
+/*
+ * 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/FastAllocBase.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 {
+ WTF_MAKE_NONCOPYABLE(Mutex); WTF_MAKE_FAST_ALLOCATED;
+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 {
+ WTF_MAKE_NONCOPYABLE(ReadWriteLock);
+public:
+ ReadWriteLock();
+ ~ReadWriteLock();
+
+ void readLock();
+ bool tryReadLock();
+
+ void writeLock();
+ bool tryWriteLock();
+
+ void unlock();
+
+private:
+ PlatformReadWriteLock m_readWriteLock;
+};
+
+class ThreadCondition {
+ WTF_MAKE_NONCOPYABLE(ThreadCondition);
+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;
+};
+
+#if OS(WINDOWS)
+// The absoluteTime is in seconds, starting on January 1, 1970. The time is assumed to use the same time zone as WTF::currentTime().
+// Returns an interval in milliseconds suitable for passing to one of the Win32 wait functions (e.g., ::WaitForSingleObject).
+DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime);
+#endif
+
+} // namespace WTF
+
+using WTF::Mutex;
+using WTF::MutexLocker;
+using WTF::ThreadCondition;
+
+#if OS(WINDOWS)
+using WTF::absoluteTimeToWaitTimeoutInterval;
+#endif
+
+#endif // ThreadingPrimitives_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
new file mode 100644
index 0000000..916aa36
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
@@ -0,0 +1,398 @@
+/*
+ * 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
+
+#if OS(MAC_OS_X) && !defined(BUILDING_ON_LEOPARD)
+#include <objc/objc-auto.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
+
+#if OS(MAC_OS_X) && !defined(BUILDING_ON_LEOPARD)
+ // All threads that potentially use APIs above the BSD layer must be registered with the Objective-C
+ // garbage collector in case API implementations use garbage-collected memory.
+ objc_registerThreadWithCollector();
+#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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingWin.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingWin.cpp
new file mode 100644
index 0000000..c452205
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ThreadingWin.cpp
@@ -0,0 +1,499 @@
+/*
+ * 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);
+
+ --mutex.m_recursionCount;
+ 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);
+ ++mutex.m_recursionCount;
+
+ 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)
+{
+ DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime);
+
+ if (!interval) {
+ // Consider the wait to have timed out, even if our condition has already been signaled, to
+ // match the pthreads implementation.
+ return false;
+ }
+
+ return m_condition.timedWait(mutex.impl(), interval);
+}
+
+void ThreadCondition::signal()
+{
+ m_condition.signal(false); // Unblock only 1 thread.
+}
+
+void ThreadCondition::broadcast()
+{
+ m_condition.signal(true); // Unblock all threads.
+}
+
+DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime)
+{
+ double currentTime = WTF::currentTime();
+
+ // Time is in the past - return immediately.
+ if (absoluteTime < currentTime)
+ return 0;
+
+ // Time is too far in the future (and would overflow unsigned long) - wait forever.
+ if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0)
+ return INFINITE;
+
+ return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0);
+}
+
+} // namespace WTF
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.cpp
new file mode 100644
index 0000000..afeaa5e
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.h
new file mode 100644
index 0000000..44103cd
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/UnusedParam.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/UnusedParam.h
new file mode 100644
index 0000000..6ff6fd8
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/VMTags.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/VMTags.h
new file mode 100644
index 0000000..117bc37
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/VMTags.h
@@ -0,0 +1,75 @@
+/*
+ * 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(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)
+
+#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/src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ValueCheck.h
index 2a86eb0..2a86eb0 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/ValueCheck.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Vector.h
new file mode 100644
index 0000000..03c03d5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Vector.h
@@ -0,0 +1,1168 @@
+/*
+ * 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>
+#include <wtf/Alignment.h>
+
+#if PLATFORM(QT)
+#include <QDataStream>
+#endif
+
+namespace WTF {
+
+ using std::min;
+ using std::max;
+
+ #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);
+#if COMPILER(SUNCC) && __SUNPRO_CC <= 0x590
+ const_cast<T*>(src)->~T(); // Work around obscure SunCC 12 compiler bug.
+#else
+ src->~T();
+#endif
+ ++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 {
+ WTF_MAKE_NONCOPYABLE(VectorBufferBase);
+ public:
+ void allocateBuffer(size_t newCapacity)
+ {
+ ASSERT(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)
+ {
+ ASSERT(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)
+ {
+ // Calling malloc(0) might take a lock and may actually do an
+ // allocation on some systems (e.g. Brew).
+ if (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> {
+ WTF_MAKE_NONCOPYABLE(VectorBuffer);
+ 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)
+ {
+ // FIXME: This should ASSERT(!m_buffer) to catch misuse/leaks.
+ 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+ 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> bool contains(const U&) const;
+ 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>
+ bool Vector<T, inlineCapacity>::contains(const U& value) const
+ {
+ return find(value) != notFound;
+ }
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/VectorTraits.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/VectorTraits.h
new file mode 100644
index 0000000..6777c9e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/VectorTraits.h
@@ -0,0 +1,99 @@
+/*
+ * 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 : VectorTraitsBase<false, void>
+ {
+ static const bool canInitializeWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/WTFThreadData.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/WTFThreadData.cpp
new file mode 100644
index 0000000..84e1856
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/WTFThreadData.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/WTFThreadData.h
new file mode 100644
index 0000000..243aa91
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/WTFThreadData.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.
+ *
+ * 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+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 {
+ WTF_MAKE_NONCOPYABLE(WTFThreadData);
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/dtoa.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/dtoa.cpp
new file mode 100644
index 0000000..b162543
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/dtoa.cpp
@@ -0,0 +1,1834 @@
+/****************************************************************
+ *
+ * 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(WTF_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 {
+ WTF_MAKE_NONCOPYABLE(P5Node); WTF_MAKE_FAST_ALLOCATED;
+public:
+ P5Node() { }
+ 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(WTF_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(WTF_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(WTF_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(WTF_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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/dtoa.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/dtoa.h
new file mode 100644
index 0000000..3924a1c
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp
new file mode 100644
index 0000000..8774d20
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp
new file mode 100644
index 0000000..7c51ee1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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);
+}
+
+} // namespace WTF
+
+#endif // ENABLE(GLIB_SUPPORT)
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h
new file mode 100644
index 0000000..8c7e837
--- /dev/null
+++ b/src/3rdparty/webkit/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 <typename T> class GOwnPtr {
+ WTF_MAKE_NONCOPYABLE(GOwnPtr);
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp
new file mode 100644
index 0000000..1cd22c5
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GRefPtr.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GRefPtr.h
new file mode 100644
index 0000000..10ebf07
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GTypedefs.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
new file mode 100644
index 0000000..c7f7ac4
--- /dev/null
+++ b/src/3rdparty/webkit/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 _GPatternSpec GPatternSpec;
+typedef struct _GPollableOutputStream GPollableOutputStream;
+typedef struct _GSocketClient GSocketClient;
+typedef struct _GSocketConnection GSocketConnection;
+typedef struct _GSource GSource;
+typedef struct _GVariant GVariant;
+typedef union _GdkEvent GdkEvent;
+
+#if USE(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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp
new file mode 100644
index 0000000..7624247
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
new file mode 100644
index 0000000..863ee81
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp
new file mode 100644
index 0000000..98b6a0c
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/StringQt.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/StringQt.cpp
new file mode 100644
index 0000000..16dd439
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp
new file mode 100644
index 0000000..8041dea
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.cpp
new file mode 100644
index 0000000..9dd655e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.cpp
@@ -0,0 +1,368 @@
+/*
+ * 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();
+}
+
+template<typename T, typename HashTranslator>
+static inline PassRefPtr<StringImpl> addToStringTable(const T& value)
+{
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<T, HashTranslator>(value);
+
+ // 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;
+}
+
+struct CStringTranslator {
+ static unsigned hash(const char* c)
+ {
+ return StringHasher::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();
+
+ return addToStringTable<const char*, CStringTranslator>(c);
+}
+
+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) || CPU(SPARC)
+ 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 StringHasher::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 == StringHasher::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 buffer = { s, length };
+ return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
+}
+
+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 };
+ return addToStringTable<HashAndCharacters, HashAndCharactersTranslator>(buffer);
+}
+
+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 buffer = { s, length };
+ return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
+}
+
+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::fromUTF8Internal(const char* charactersStart, const char* charactersEnd)
+{
+ HashAndUTF8Characters buffer;
+ buffer.characters = charactersStart;
+ buffer.hash = calculateStringHashAndLengthFromUTF8(charactersStart, charactersEnd, buffer.length, buffer.utf16Length);
+
+ if (!buffer.hash)
+ return nullAtom;
+
+ AtomicString atomicString;
+ atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer);
+ return atomicString;
+}
+
+} // namespace WTF
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.h
new file mode 100644
index 0000000..440700c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.h
@@ -0,0 +1,204 @@
+/*
+ * 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 USE(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*);
+ static AtomicString fromUTF8Internal(const char*, const char*);
+};
+
+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;
+
+inline AtomicString AtomicString::fromUTF8(const char* characters, size_t length)
+{
+ if (!characters)
+ return nullAtom;
+ if (!length)
+ return emptyAtom;
+ return fromUTF8Internal(characters, characters + length);
+}
+
+inline AtomicString AtomicString::fromUTF8(const char* characters)
+{
+ if (!characters)
+ return nullAtom;
+ if (!*characters)
+ return emptyAtom;
+ return fromUTF8Internal(characters, 0);
+}
+#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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicStringHash.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicStringHash.h
new file mode 100644
index 0000000..f6e4ad1
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicStringImpl.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicStringImpl.h
new file mode 100644
index 0000000..3f0c376
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/CString.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/CString.cpp
new file mode 100644
index 0000000..981d77a
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/CString.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/CString.h
new file mode 100644
index 0000000..343a7a5
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuffer.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuffer.h
new file mode 100644
index 0000000..e73d38e5
--- /dev/null
+++ b/src/3rdparty/webkit/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/unicode/Unicode.h>
+#include <limits>
+
+namespace WTF {
+
+class StringBuffer {
+ WTF_MAKE_NONCOPYABLE(StringBuffer);
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuilder.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuilder.cpp
new file mode 100644
index 0000000..dfc9ff3
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuilder.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringBuilder.h
new file mode 100644
index 0000000..f10af64
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringConcatenate.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringConcatenate.h
new file mode 100644
index 0000000..8500200
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringConcatenate.h
@@ -0,0 +1,583 @@
+/*
+ * 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 UChar*> {
+public:
+ StringTypeAdapter<const UChar*>(const UChar* buffer)
+ : m_buffer(buffer)
+ {
+ size_t len = 0;
+ while (m_buffer[len] != UChar(0))
+ len++;
+
+ if (len > std::numeric_limits<unsigned>::max())
+ CRASH();
+
+ m_length = len;
+ }
+
+ unsigned length() { return m_length; }
+
+ void writeTo(UChar* destination)
+ {
+ memcpy(destination, m_buffer, static_cast<size_t>(m_length) * sizeof(UChar));
+ }
+
+private:
+ const UChar* 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;
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+
+ return resultImpl.release();
+}
+
+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;
+ RefPtr<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.release();
+}
+
+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;
+ RefPtr<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.release();
+}
+
+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;
+ RefPtr<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.release();
+}
+
+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;
+ RefPtr<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.release();
+}
+
+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;
+ RefPtr<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.release();
+}
+
+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;
+ RefPtr<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.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8, typename StringType9>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8, StringType9 string9)
+{
+ 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);
+ StringTypeAdapter<StringType9> adapter9(string9);
+
+ 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);
+ sumWithOverflow(length, adapter9.length(), overflow);
+ if (overflow)
+ return 0;
+ RefPtr<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);
+ result += adapter8.length();
+ adapter9.writeTo(result);
+
+ return resultImpl.release();
+}
+
+
+// Convenience only.
+template<typename StringType1>
+String makeString(StringType1 string1)
+{
+ return String(string1);
+}
+
+template<typename StringType1, typename StringType2>
+String makeString(StringType1 string1, StringType2 string2)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+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)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+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)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+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)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8, typename StringType9>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8, StringType9 string9)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8, string9);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+} // namespace WTF
+
+using WTF::makeString;
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringHash.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringHash.h
new file mode 100644
index 0000000..4637c3d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringHash.h
@@ -0,0 +1,190 @@
+/*
+ * 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) || CPU(SPARC)
+ 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::computeHash<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::computeHash<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> : SimpleClassHashTraits<String> { };
+
+}
+
+using WTF::StringHash;
+using WTF::CaseFoldingHash;
+using WTF::AlreadyHashed;
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.cpp
new file mode 100644
index 0000000..17b4d7d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.cpp
@@ -0,0 +1,1081 @@
+/*
+ * 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, bool* didReadNumber)
+{
+ return charactersToDouble(m_data, m_length, ok, didReadNumber);
+}
+
+float StringImpl::toFloat(bool* ok, bool* didReadNumber)
+{
+ return charactersToFloat(m_data, m_length, ok, didReadNumber);
+}
+
+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* matchString, bool caseSensitive)
+{
+ ASSERT(matchString);
+ if (m_length >= matchString->m_length) {
+ unsigned start = m_length - matchString->m_length;
+ return (caseSensitive ? find(matchString, start) : findIgnoringCase(matchString, 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(bool* hasStrongDirectionality)
+{
+ for (unsigned i = 0; i < m_length; ++i) {
+ WTF::Unicode::Direction charDirection = WTF::Unicode::direction(m_data[i]);
+ if (charDirection == WTF::Unicode::LeftToRight) {
+ if (hasStrongDirectionality)
+ *hasStrongDirectionality = true;
+ return WTF::Unicode::LeftToRight;
+ }
+ if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::Unicode::RightToLeftArabic) {
+ if (hasStrongDirectionality)
+ *hasStrongDirectionality = true;
+ return WTF::Unicode::RightToLeft;
+ }
+ }
+ if (hasStrongDirectionality)
+ *hasStrongDirectionality = false;
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.h
new file mode 100644
index 0000000..81911b3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImpl.h
@@ -0,0 +1,415 @@
+/*
+ * 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 USE(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 == StringHasher::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 = StringHasher::computeHash(m_data, m_length); return m_hash; }
+ unsigned existingHash() const { ASSERT(m_hash); return m_hash; }
+
+ 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, bool* didReadNumber = 0);
+ float toFloat(bool* ok = 0, bool* didReadNumber = 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(bool* hasStrongDirectionality = 0);
+
+#if USE(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*);
+
+template<size_t inlineCapacity>
+bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, StringImpl* b)
+{
+ if (!b)
+ return !a.size();
+ if (a.size() != b->length())
+ return false;
+ return !memcmp(a.data(), b->characters(), b->length());
+}
+
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImplBase.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImplBase.h
new file mode 100644
index 0000000..26bc1d90
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringImplBase.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. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED 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/unicode/Unicode.h>
+
+namespace WTF {
+
+class StringImplBase {
+ WTF_MAKE_NONCOPYABLE(StringImplBase); WTF_MAKE_FAST_ALLOCATED;
+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,
+ };
+
+ // 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringStatics.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringStatics.cpp
new file mode 100644
index 0000000..ce08728
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/StringStatics.cpp
@@ -0,0 +1,82 @@
+/*
+ * 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 "DynamicAnnotations.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));
+ WTF_ANNOTATE_BENIGN_RACE(&emptyString, "Benign race on StringImpl::emptyString reference counter");
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/TextPosition.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/TextPosition.h
new file mode 100644
index 0000000..bb3ffa4
--- /dev/null
+++ b/src/3rdparty/webkit/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; }
+ int convertAsOneBasedInt() const { return m_value + 1; }
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.cpp
new file mode 100644
index 0000000..d862f96
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.cpp
@@ -0,0 +1,1012 @@
+/*
+ * (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, bool* didReadNumber) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ if (didReadNumber)
+ *didReadNumber = false;
+ return 0.0;
+ }
+ return m_impl->toDouble(ok, didReadNumber);
+}
+
+float String::toFloat(bool* ok, bool* didReadNumber) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ if (didReadNumber)
+ *didReadNumber = false;
+ return 0.0f;
+ }
+ return m_impl->toFloat(ok, didReadNumber);
+}
+
+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
+{
+ 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
+{
+ split(String(&separator, 1), false, result);
+}
+
+CString String::ascii() const
+{
+ // Printable ASCII characters 32..127 and the null character 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, bool* didReadNumber)
+{
+ if (!length) {
+ if (ok)
+ *ok = false;
+ if (didReadNumber)
+ *didReadNumber = 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* start = bytes.data();
+ char* end;
+ double val = WTF::strtod(start, &end);
+ if (ok)
+ *ok = (end == 0 || *end == '\0');
+ if (didReadNumber)
+ *didReadNumber = end - start;
+ return val;
+}
+
+float charactersToFloat(const UChar* data, size_t length, bool* ok, bool* didReadNumber)
+{
+ // 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, didReadNumber));
+}
+
+} // 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.h
new file mode 100644
index 0000000..b593d20
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/WTFString.h
@@ -0,0 +1,531 @@
+/*
+ * (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 USE(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);
+bool charactersAreAllLatin1(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, bool* didReadNumber = 0);
+float charactersToFloat(const UChar*, size_t, bool* ok = 0, bool* didReadNumber = 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 by copying the contents of a vector. To avoid
+ // copying, consider using String::adopt instead.
+ template<size_t inlineCapacity>
+ explicit String(const Vector<UChar, inlineCapacity>&);
+
+ // 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, bool* didReadNumber = 0) const;
+ float toFloat(bool* ok = 0, bool* didReadNumber = 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 USE(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(bool* hasStrongDirectionality = 0) const
+ {
+ if (m_impl)
+ return m_impl->defaultWritingDirection(hasStrongDirectionality);
+ if (hasStrongDirectionality)
+ *hasStrongDirectionality = false;
+ return WTF::Unicode::LeftToRight;
+ }
+
+ bool containsOnlyASCII() const { return charactersAreAllASCII(characters(), length()); }
+ bool containsOnlyLatin1() const { return charactersAreAllLatin1(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()); }
+
+template<size_t inlineCapacity>
+inline bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, const String& b) { return equalIgnoringNullity(a, 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
+
+template<size_t inlineCapacity>
+String::String(const Vector<UChar, inlineCapacity>& vector)
+ : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) : 0)
+{
+}
+
+#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);
+}
+
+inline bool charactersAreAllLatin1(const UChar* characters, size_t length)
+{
+ UChar ored = 0;
+ for (size_t i = 0; i < length; ++i)
+ ored |= characters[i];
+ return !(ored & 0xFF00);
+}
+
+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 { };
+
+}
+
+using WTF::CString;
+using WTF::String;
+using WTF::append;
+using WTF::appendNumber;
+using WTF::charactersAreAllASCII;
+using WTF::charactersAreAllLatin1;
+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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/CharacterNames.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/CharacterNames.h
new file mode 100644
index 0000000..10fdbf0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/CharacterNames.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2007, 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 CharacterNames_h
+#define CharacterNames_h
+
+#include "Unicode.h"
+
+namespace WTF {
+namespace Unicode {
+
+// Names here are taken from the Unicode standard.
+
+// Most of these are UChar constants, not UChar32, which makes them
+// more convenient for WebCore code that mostly uses UTF-16.
+
+const UChar32 aegeanWordSeparatorLine = 0x10100;
+const UChar32 aegeanWordSeparatorDot = 0x10101;
+const UChar blackCircle = 0x25CF;
+const UChar blackSquare = 0x25A0;
+const UChar blackUpPointingTriangle = 0x25B2;
+const UChar bullet = 0x2022;
+const UChar bullseye = 0x25CE;
+const UChar carriageReturn = 0x000D;
+const UChar ethiopicPrefaceColon = 0x1366;
+const UChar ethiopicWordspace = 0x1361;
+const UChar fisheye = 0x25C9;
+const UChar hebrewPunctuationGeresh = 0x05F3;
+const UChar hebrewPunctuationGershayim = 0x05F4;
+const UChar horizontalEllipsis = 0x2026;
+const UChar hyphen = 0x2010;
+const UChar hyphenMinus = 0x002D;
+const UChar ideographicComma = 0x3001;
+const UChar ideographicFullStop = 0x3002;
+const UChar ideographicSpace = 0x3000;
+const UChar leftDoubleQuotationMark = 0x201C;
+const UChar leftSingleQuotationMark = 0x2018;
+const UChar leftToRightEmbed = 0x202A;
+const UChar leftToRightMark = 0x200E;
+const UChar leftToRightOverride = 0x202D;
+const UChar minusSign = 0x2212;
+const UChar newlineCharacter = 0x000A;
+const UChar noBreakSpace = 0x00A0;
+const UChar objectReplacementCharacter = 0xFFFC;
+const UChar popDirectionalFormatting = 0x202C;
+const UChar replacementCharacter = 0xFFFD;
+const UChar rightDoubleQuotationMark = 0x201D;
+const UChar rightSingleQuotationMark = 0x2019;
+const UChar rightToLeftEmbed = 0x202B;
+const UChar rightToLeftMark = 0x200F;
+const UChar rightToLeftOverride = 0x202E;
+const UChar sesameDot = 0xFE45;
+const UChar softHyphen = 0x00AD;
+const UChar space = 0x0020;
+const UChar tibetanMarkIntersyllabicTsheg = 0x0F0B;
+const UChar tibetanMarkDelimiterTshegBstar = 0x0F0C;
+const UChar32 ugariticWordDivider = 0x1039F;
+const UChar whiteBullet = 0x25E6;
+const UChar whiteCircle = 0x25CB;
+const UChar whiteSesameDot = 0xFE46;
+const UChar whiteUpPointingTriangle = 0x25B3;
+const UChar yenSign = 0x00A5;
+const UChar zeroWidthJoiner = 0x200D;
+const UChar zeroWidthNonJoiner = 0x200C;
+const UChar zeroWidthSpace = 0x200B;
+const UChar zeroWidthNoBreakSpace = 0xFEFF;
+
+} // namespace Unicode
+} // namespace WTF
+
+using WTF::Unicode::aegeanWordSeparatorLine;
+using WTF::Unicode::aegeanWordSeparatorDot;
+using WTF::Unicode::blackCircle;
+using WTF::Unicode::blackSquare;
+using WTF::Unicode::blackUpPointingTriangle;
+using WTF::Unicode::bullet;
+using WTF::Unicode::bullseye;
+using WTF::Unicode::carriageReturn;
+using WTF::Unicode::ethiopicPrefaceColon;
+using WTF::Unicode::ethiopicWordspace;
+using WTF::Unicode::fisheye;
+using WTF::Unicode::hebrewPunctuationGeresh;
+using WTF::Unicode::hebrewPunctuationGershayim;
+using WTF::Unicode::horizontalEllipsis;
+using WTF::Unicode::hyphen;
+using WTF::Unicode::hyphenMinus;
+using WTF::Unicode::ideographicComma;
+using WTF::Unicode::ideographicFullStop;
+using WTF::Unicode::ideographicSpace;
+using WTF::Unicode::leftDoubleQuotationMark;
+using WTF::Unicode::leftSingleQuotationMark;
+using WTF::Unicode::leftToRightEmbed;
+using WTF::Unicode::leftToRightMark;
+using WTF::Unicode::leftToRightOverride;
+using WTF::Unicode::minusSign;
+using WTF::Unicode::newlineCharacter;
+using WTF::Unicode::noBreakSpace;
+using WTF::Unicode::objectReplacementCharacter;
+using WTF::Unicode::popDirectionalFormatting;
+using WTF::Unicode::replacementCharacter;
+using WTF::Unicode::rightDoubleQuotationMark;
+using WTF::Unicode::rightSingleQuotationMark;
+using WTF::Unicode::rightToLeftEmbed;
+using WTF::Unicode::rightToLeftMark;
+using WTF::Unicode::rightToLeftOverride;
+using WTF::Unicode::sesameDot;
+using WTF::Unicode::softHyphen;
+using WTF::Unicode::space;
+using WTF::Unicode::tibetanMarkIntersyllabicTsheg;
+using WTF::Unicode::tibetanMarkDelimiterTshegBstar;
+using WTF::Unicode::ugariticWordDivider;
+using WTF::Unicode::whiteBullet;
+using WTF::Unicode::whiteCircle;
+using WTF::Unicode::whiteSesameDot;
+using WTF::Unicode::whiteUpPointingTriangle;
+using WTF::Unicode::yenSign;
+using WTF::Unicode::zeroWidthJoiner;
+using WTF::Unicode::zeroWidthNonJoiner;
+using WTF::Unicode::zeroWidthSpace;
+using WTF::Unicode::zeroWidthNoBreakSpace;
+
+#endif // CharacterNames_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/Collator.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/Collator.h
new file mode 100644
index 0000000..00ab16e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/Collator.h
@@ -0,0 +1,69 @@
+/*
+ * 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/FastAllocBase.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 {
+ WTF_MAKE_NONCOPYABLE(Collator); WTF_MAKE_FAST_ALLOCATED;
+ 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/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/CollatorDefault.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp
index 4e05432..4e05432 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/CollatorDefault.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UTF8.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UTF8.cpp
new file mode 100644
index 0000000..3a88906
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UTF8.cpp
@@ -0,0 +1,407 @@
+/*
+ * 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 "ASCIICType.h"
+#include <wtf/StringHasher.h>
+#include <wtf/unicode/CharacterNames.h>
+
+namespace WTF {
+namespace Unicode {
+
+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 calculateStringHashAndLengthFromUTF8(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length)
+{
+ if (!data)
+ return 0;
+
+ StringHasher stringHasher;
+ dataLength = 0;
+ utf16Length = 0;
+
+ while (data < dataEnd || (!dataEnd && *data)) {
+ if (isASCII(*data)) {
+ stringHasher.addCharacter(*data++);
+ dataLength++;
+ utf16Length++;
+ continue;
+ }
+
+ int utf8SequenceLength = inlineUTF8SequenceLengthNonASCII(*data);
+ dataLength += utf8SequenceLength;
+
+ if (!dataEnd) {
+ for (int i = 1; i < utf8SequenceLength; ++i) {
+ if (!data[i])
+ return 0;
+ }
+ } else if (dataEnd - data < utf8SequenceLength)
+ return 0;
+
+ 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UTF8.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UTF8.h
new file mode 100644
index 0000000..7b7b75d
--- /dev/null
+++ b/src/3rdparty/webkit/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 calculateStringHashAndLengthFromUTF8(const char* data, const char* dataEnd, unsigned& dataLength, 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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/Unicode.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/Unicode.h
new file mode 100644
index 0000000..50524b1
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h
new file mode 100644
index 0000000..09a7036
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 1999-2004, International Business Machines Corporation and others. All Rights Reserved.
+ *
+ */
+
+#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))
+
+#define U8_MAX_LENGTH 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); \
+ } \
+}
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp
new file mode 100644
index 0000000..8367f17
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h
new file mode 100644
index 0000000..1d7576f
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp
new file mode 100644
index 0000000..a01c3ee
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h
index 46b00ea..46b00ea 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
new file mode 100644
index 0000000..348693f
--- /dev/null
+++ b/src/3rdparty/webkit/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) && USE(CF)
+ // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU default doesn't work.
+#if !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/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
index a2a5c0a..a2a5c0a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
new file mode 100644
index 0000000..eaa7a07
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp
new file mode 100644
index 0000000..96dac7d
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h
new file mode 100644
index 0000000..2688aa9
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp
new file mode 100644
index 0000000..abe0061
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/ParsedURL.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/ParsedURL.h
new file mode 100644
index 0000000..ebc19b7
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/URLString.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/api/URLString.h
new file mode 100644
index 0000000..7395d49
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h
new file mode 100644
index 0000000..9bb2e8e
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLBuffer.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLBuffer.h
new file mode 100644
index 0000000..e07402e
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp
new file mode 100644
index 0000000..ee2014e
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h
new file mode 100644
index 0000000..194f6b0
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLComponent.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLComponent.h
new file mode 100644
index 0000000..1b7976e
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLEscape.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLEscape.cpp
new file mode 100644
index 0000000..2987343
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLEscape.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLEscape.h
new file mode 100644
index 0000000..cc2b77f
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLParser.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLParser.h
new file mode 100644
index 0000000..4d5ca51
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h
new file mode 100644
index 0000000..7740200
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLSegments.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLSegments.cpp
new file mode 100644
index 0000000..bb9542f
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLSegments.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/src/URLSegments.h
new file mode 100644
index 0000000..436c7fe
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/wtfurl.gyp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/url/wtfurl.gyp
new file mode 100644
index 0000000..f254ae4
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h
new file mode 100644
index 0000000..d91a5f2
--- /dev/null
+++ b/src/3rdparty/webkit/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/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/MemoryManager.cpp
index 81d4f80..81d4f80 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/MemoryManager.cpp
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/MemoryManager.h
index f405612..f405612 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wince/MemoryManager.h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri
new file mode 100644
index 0000000..10b41e4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/wtf.pri
@@ -0,0 +1,52 @@
+# wtf - qmake build info
+
+SOURCES += \
+ wtf/Assertions.cpp \
+ wtf/ByteArray.cpp \
+ wtf/CryptographicallyRandomNumber.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/OSRandomSource.cpp \
+ wtf/qt/MainThreadQt.cpp \
+ wtf/qt/StringQt.cpp \
+ wtf/qt/ThreadingQt.cpp \
+ wtf/PageAllocationAligned.cpp \
+ wtf/PageBlock.cpp \
+ wtf/ParallelJobsGeneric.cpp \
+ wtf/RandomNumber.cpp \
+ wtf/RefCountedLeakCounter.cpp \
+ wtf/SHA1.cpp \
+ wtf/StackBounds.cpp \
+ wtf/TCSystemAlloc.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
+}
+
+unix:!symbian: SOURCES += wtf/OSAllocatorPosix.cpp
+symbian: SOURCES += wtf/OSAllocatorSymbian.cpp
+win*|wince*: SOURCES += wtf/OSAllocatorWin.cpp
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/Yarr.h b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/Yarr.h
new file mode 100644
index 0000000..de64fdd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/Yarr.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Peter Varga (pvarga@inf.u-szeged.hu), 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 Yarr_h
+#define Yarr_h
+
+#include "YarrInterpreter.h"
+#include "YarrPattern.h"
+
+namespace JSC { namespace Yarr {
+
+#define YarrStackSpaceForBackTrackInfoPatternCharacter 1 // Only for !fixed quantifiers.
+#define YarrStackSpaceForBackTrackInfoCharacterClass 1 // Only for !fixed quantifiers.
+#define YarrStackSpaceForBackTrackInfoBackReference 2
+#define YarrStackSpaceForBackTrackInfoAlternative 1 // One per alternative.
+#define YarrStackSpaceForBackTrackInfoParentheticalAssertion 1
+#define YarrStackSpaceForBackTrackInfoParenthesesOnce 1 // Only for !fixed quantifiers.
+#define YarrStackSpaceForBackTrackInfoParenthesesTerminal 1
+#define YarrStackSpaceForBackTrackInfoParentheses 2
+
+static const unsigned quantifyInfinite = UINT_MAX;
+
+// 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
+};
+
+PassOwnPtr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
+int interpret(BytecodePattern*, const UChar* input, unsigned start, unsigned length, int* output);
+
+} } // namespace JSC::Yarr
+
+#endif // Yarr_h
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
new file mode 100644
index 0000000..0b4ea32
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
@@ -0,0 +1,1909 @@
+/*
+ * 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 "YarrInterpreter.h"
+
+#include "Yarr.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(static_cast<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;
+ }
+ 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)));
+
+ 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;
+ }
+ 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();
+
+ case ByteTerm::TypeUncheckInput:
+ input.uncheckInput(currentTerm().checkInputCount);
+ MATCH_NEXT();
+ }
+
+ // 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();
+
+ case ByteTerm::TypeUncheckInput:
+ input.checkInput(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(YarrPattern& 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 uncheckInput(unsigned count)
+ {
+ m_bodyDisjunction->terms.append(ByteTerm::UncheckInput(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)
+ {
+ 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 = 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 += YarrStackSpaceForBackTrackInfoParenthesesOnce;
+ 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 + YarrStackSpaceForBackTrackInfoParenthesesOnce);
+ 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 + YarrStackSpaceForBackTrackInfoParentheticalAssertion;
+
+ ASSERT(currentCountAlreadyChecked >= static_cast<unsigned>(term.inputPosition));
+ int positiveInputOffset = currentCountAlreadyChecked - term.inputPosition;
+ int uncheckAmount = positiveInputOffset - term.parentheses.disjunction->m_minimumSize;
+
+ if (uncheckAmount > 0) {
+ uncheckInput(uncheckAmount);
+ currentCountAlreadyChecked -= uncheckAmount;
+ } else
+ uncheckAmount = 0;
+
+ atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invert(), term.frameLocation, alternativeFrameLocation);
+ emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, positiveInputOffset - uncheckAmount);
+ atomParentheticalAssertionEnd(0, term.frameLocation, term.quantityCount, term.quantityType);
+ if (uncheckAmount) {
+ checkInput(uncheckAmount);
+ currentCountAlreadyChecked += uncheckAmount;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+private:
+ YarrPattern& m_pattern;
+ OwnPtr<ByteDisjunction> m_bodyDisjunction;
+ unsigned m_currentAlternativeIndex;
+ Vector<ParenthesesStackEntry> m_parenthesesStack;
+ Vector<ByteDisjunction*> m_allParenthesesInfo;
+};
+
+PassOwnPtr<BytecodePattern> byteCompile(YarrPattern& pattern, BumpPointerAllocator* allocator)
+{
+ return ByteCompiler(pattern).compile(allocator);
+}
+
+int interpret(BytecodePattern* bytecode, const UChar* input, unsigned start, unsigned length, int* output)
+{
+ return Interpreter(bytecode, output, input, start, length).interpret();
+}
+
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoPatternCharacter) == (YarrStackSpaceForBackTrackInfoPatternCharacter * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoPatternCharacter);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoCharacterClass) == (YarrStackSpaceForBackTrackInfoCharacterClass * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoCharacterClass);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoBackReference) == (YarrStackSpaceForBackTrackInfoBackReference * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoBackReference);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoAlternative) == (YarrStackSpaceForBackTrackInfoAlternative * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoAlternative);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoParentheticalAssertion) == (YarrStackSpaceForBackTrackInfoParentheticalAssertion * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoParentheticalAssertion);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoParenthesesOnce) == (YarrStackSpaceForBackTrackInfoParenthesesOnce * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoParenthesesOnce);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoParentheses) == (YarrStackSpaceForBackTrackInfoParentheses * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoParentheses);
+
+
+} }
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.h b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.h
new file mode 100644
index 0000000..a9f4d48
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrInterpreter.h
@@ -0,0 +1,373 @@
+/*
+ * 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 YarrInterpreter_h
+#define YarrInterpreter_h
+
+#include "YarrPattern.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+class BumpPointerAllocator;
+}
+using WTF::BumpPointerAllocator;
+
+namespace JSC { namespace Yarr {
+
+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,
+ TypeUncheckInput,
+ } 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 UncheckInput(unsigned count)
+ {
+ ByteTerm term(TypeUncheckInput);
+ 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ ByteDisjunction(unsigned numSubpatterns, unsigned frameSize)
+ : m_numSubpatterns(numSubpatterns)
+ , m_frameSize(frameSize)
+ {
+ }
+
+ Vector<ByteTerm> terms;
+ unsigned m_numSubpatterns;
+ unsigned m_frameSize;
+};
+
+struct BytecodePattern {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ BytecodePattern(PassOwnPtr<ByteDisjunction> body, Vector<ByteDisjunction*> allParenthesesInfo, YarrPattern& 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 YarrPattern'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_regExpAllocator.
+ BumpPointerAllocator* m_allocator;
+
+ CharacterClass* newlineCharacterClass;
+ CharacterClass* wordcharCharacterClass;
+
+ Vector<BeginChar> m_beginChars;
+
+private:
+ Vector<ByteDisjunction*> m_allParenthesesInfo;
+ Vector<CharacterClass*> m_userCharacterClasses;
+};
+
+} } // namespace JSC::Yarr
+
+#endif // YarrInterpreter_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.cpp
new file mode 100644
index 0000000..ece2379
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.cpp
@@ -0,0 +1,2280 @@
+/*
+ * 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 "YarrJIT.h"
+
+#include "ASCIICType.h"
+#include "LinkBuffer.h"
+#include "Yarr.h"
+
+#if ENABLE(YARR_JIT)
+
+using namespace WTF;
+
+namespace JSC { namespace Yarr {
+
+class YarrGenerator : private MacroAssembler {
+ friend void jitCompile(JSGlobalData*, YarrCodeBlock& 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(SH4)
+ static const RegisterID input = SH4Registers::r4;
+ static const RegisterID index = SH4Registers::r5;
+ static const RegisterID length = SH4Registers::r6;
+ static const RegisterID output = SH4Registers::r7;
+
+ static const RegisterID regT0 = SH4Registers::r0;
+ static const RegisterID regT1 = SH4Registers::r1;
+
+ static const RegisterID returnRegister = SH4Registers::r0;
+#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, TrustedImm32(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(TrustedImm32(32), character);
+ for (unsigned i = 0; i < countAZaz; ++i)
+ matchDest.append(branch32(Equal, character, TrustedImm32(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(TrustedImm32 imm, unsigned frameLocation)
+ {
+ poke(imm, frameLocation);
+ }
+
+ DataLabelPtr storeToFrameWithPatch(unsigned frameLocation)
+ {
+ return storePtrWithPatch(TrustedImmPtr(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);
+ }
+
+ IndirectJumpEntry(int32_t stackOffset, DataLabelPtr dataLabel)
+ : m_stackOffset(stackOffset)
+ {
+ addDataLabel(dataLabel);
+ }
+
+ void addJump(Jump jump)
+ {
+ m_relJumps.append(jump);
+ }
+
+ void addDataLabel(DataLabelPtr dataLabel)
+ {
+ m_dataLabelPtrVector.append(dataLabel);
+ }
+
+ int32_t m_stackOffset;
+ JumpList m_relJumps;
+ Vector<DataLabelPtr, 16> m_dataLabelPtrVector;
+ };
+
+ 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 addIndirectJumpEntry(int32_t stackOffset, DataLabelPtr dataLabel)
+ {
+ 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, dataLabel));
+ else
+ result->second->addDataLabel(dataLabel);
+ }
+
+ void emitIndirectJumpTable(MacroAssembler* masm)
+ {
+ for (IndirectJumpHashMap::iterator iter = m_indirectJumpMap.begin(); iter != m_indirectJumpMap.end(); ++iter) {
+ IndirectJumpEntry* indJumpEntry = iter->second;
+ size_t size = indJumpEntry->m_dataLabelPtrVector.size();
+ if (size) {
+ // Link any associated DataLabelPtr's with indirect jump via label
+ Label hereLabel = masm->label();
+ for (size_t i = 0; i < size; ++i)
+ m_backtrackRecords.append(AlternativeBacktrackRecord(indJumpEntry->m_dataLabelPtrVector[i], hereLabel));
+ }
+ 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, JumpList* jumpListToPriorParen)
+ {
+ OwnPtr<ParenthesesTail> tail = adoptPtr(new ParenthesesTail(term, m_parenNestingLevel, jumpListToPriorParen));
+ ParenthesesTail* rawTail = tail.get();
+
+ m_parenTails.append(tail.release());
+ m_parenTailsForIteration.append(rawTail);
+
+ return rawTail;
+ }
+
+ void emitParenthesesTail(YarrGenerator* 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(YarrGenerator* 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 propagateBacktrackToLabel(const BacktrackDestination& rhs)
+ {
+ if (!m_backtrackToLabel && rhs.m_backtrackToLabel)
+ m_backtrackToLabel = rhs.m_backtrackToLabel;
+ }
+
+ void setBacktrackToLabel(Label* backtrackToLabel)
+ {
+ if (!m_backtrackToLabel)
+ m_backtrackToLabel = backtrackToLabel;
+ }
+
+ bool hasBacktrackToLabel()
+ {
+ return m_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 {
+ ASSERT(!hasDataLabel());
+ m_dataLabelPtr = dp;
+ }
+ }
+
+ void clearSubDataLabelPtr()
+ {
+ m_subDataLabelPtr = 0;
+ }
+
+ 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(YarrGenerator* 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(YarrGenerator* 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 plantJumpToBacktrackIfExists(YarrGenerator* 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 linkBacktrackToLabel(Label backtrackLabel)
+ {
+ if (m_backtrackToLabel)
+ *m_backtrackToLabel = backtrackLabel;
+ }
+
+ void linkAlternativeBacktracks(YarrGenerator* 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(YarrGenerator* 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_jumpList(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 setJumpListToPriorParen(JumpList* jumpList)
+ {
+ m_jumpList = jumpList;
+ }
+
+ JumpList* getJumpListToPriorParen()
+ {
+ return m_jumpList;
+ }
+
+ 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(YarrGenerator* generator, Jump jump)
+ {
+ m_backtrack.jumpToBacktrack(generator, jump);
+ }
+
+ void jumpToBacktrack(YarrGenerator* generator, JumpList& jumps)
+ {
+ m_backtrack.jumpToBacktrack(generator, jumps);
+ }
+
+ bool plantJumpToBacktrackIfExists(YarrGenerator* generator)
+ {
+ return m_backtrack.plantJumpToBacktrackIfExists(generator);
+ }
+
+ void linkDataLabelToBacktrackIfExists(YarrGenerator* generator, DataLabelPtr dataLabel)
+ {
+ // If we have a stack offset backtrack destination, use it directly
+ if (m_backtrack.isStackOffset()) {
+ generator->m_expressionState.addIndirectJumpEntry(m_backtrack.getStackOffset(), dataLabel);
+ m_backtrack.clearSubDataLabelPtr();
+ } else {
+ // If we have a backtrack label, connect the datalabel to it directly.
+ if (m_backtrack.isLabel()) {
+ generator->m_expressionState.m_backtrackRecords.append(AlternativeBacktrackRecord(dataLabel, m_backtrack.getLabel()));
+ m_backtrack.clearSubDataLabelPtr();
+ } else
+ setBacktrackDataLabel(dataLabel);
+ }
+ }
+
+ 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(YarrGenerator* generator, bool nextIteration = false)
+ {
+ m_backtrack.linkAlternativeBacktracks(generator, nextIteration);
+ m_linkedBacktrack = 0;
+ }
+
+ void linkAlternativeBacktracksTo(YarrGenerator* 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);
+ }
+
+ BacktrackDestination& getBacktrackDestination()
+ {
+ return m_backtrack;
+ }
+
+ void propagateBacktrackingFrom(YarrGenerator* generator, BacktrackDestination& backtrack, bool doJump = true)
+ {
+ if (doJump)
+ m_backtrack.jumpToBacktrack(generator, backtrack.getBacktrackJumps());
+
+ if (m_backtrack.isLabel() && backtrack.hasBacktrackToLabel())
+ backtrack.linkBacktrackToLabel(m_backtrack.getLabel());
+
+ 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;
+ JumpList* m_jumpList;
+ };
+
+ struct ParenthesesTail {
+ ParenthesesTail(PatternTerm& term, int nestingLevel, JumpList* jumpListToPriorParen)
+ : m_term(term)
+ , m_nestingLevel(nestingLevel)
+ , m_subParenIndex(0)
+ , m_jumpListToPriorParen(jumpListToPriorParen)
+ {
+ }
+
+ void processBacktracks(YarrGenerator* 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_afterBacktrackJumps);
+ stateBacktrack.setBacktrackSourceLabel(&m_backtrackFromAfterParens);
+ }
+ }
+
+ void setNextIteration(Label nextIteration)
+ {
+ if (!m_nestingLevel && !m_backtrackToLabel.isSet())
+ m_backtrackToLabel = nextIteration;
+ }
+
+ void addAfterParenJump(Jump jump)
+ {
+ m_afterBacktrackJumps.append(jump);
+ }
+
+ bool generateCode(YarrGenerator* 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_jumpListToPriorParen) {
+ // If we don't have a destination, go back to either the prior paren or the next outer paren.
+ m_backtrack.setBacktrackJumpList(m_jumpListToPriorParen);
+ 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_afterBacktrackJumps.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, TrustedImm32(-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, TrustedImm32(-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(TrustedImm32(-1), Address(output, (m_term.parentheses.subpatternId << 1) * sizeof(int)));
+
+ if (m_term.quantityType == QuantifierGreedy) {
+ generator->storeToFrame(TrustedImm32(-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;
+ JumpList* m_jumpListToPriorParen;
+ Label m_nonGreedyTryParentheses;
+ Label m_fallThrough;
+ Label m_backtrackToLabel;
+ Label m_backtrackFromAfterParens;
+ DataLabelPtr m_dataAfterLabelPtr;
+ JumpList m_withinBacktrackJumps;
+ JumpList m_afterBacktrackJumps;
+ 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(TrustedImm32(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(TrustedImm32(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(TrustedImm32(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(TrustedImm32(0), countRegister);
+
+ JumpList failures;
+ Label loop(this);
+ failures.append(atEndOfInput());
+ if (m_pattern.m_ignoreCase && isASCIIAlpha(ch)) {
+ readCharacter(state.inputOffset(), character);
+ or32(TrustedImm32(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(TrustedImm32(1), countRegister);
+ add32(TrustedImm32(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(TrustedImm32(1), countRegister);
+ sub32(TrustedImm32(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(TrustedImm32(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(TrustedImm32(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(TrustedImm32(1), countRegister);
+ add32(TrustedImm32(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(TrustedImm32(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(TrustedImm32(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(TrustedImm32(1), countRegister);
+ add32(TrustedImm32(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(TrustedImm32(1), countRegister);
+ sub32(TrustedImm32(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(TrustedImm32(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(TrustedImm32(1), countRegister);
+ add32(TrustedImm32(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;
+
+ // Save current state's paren jump list for use with each alternative
+ JumpList* outerJumpList = state.getJumpListToPriorParen();
+
+ for (state.resetAlternative(); state.alternativeValid(); state.nextAlternative(), state.setJumpListToPriorParen(outerJumpList)) {
+ 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.
+
+ // Do we have a backtrack destination?
+ // if so, link the data label to it.
+ state.linkDataLabelToBacktrackIfExists(this, dataLabel);
+
+ 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 += YarrStackSpaceForBackTrackInfoParenthesesOnce;
+
+ // 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);
+
+ // Use the current state's jump list for the nested parentheses.
+ parenthesesState.setJumpListToPriorParen(state.getJumpListToPriorParen());
+
+ 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();
+ BacktrackDestination& stateBacktrack = state.getBacktrackDestination();
+
+ state.propagateBacktrackingFrom(this, parenthesesBacktrack);
+ stateBacktrack.propagateBacktrackToLabel(parenthesesBacktrack);
+
+ state.setJumpListToPriorParen(parenthesesState.getJumpListToPriorParen());
+
+ m_expressionState.decrementParenNestingLevel();
+ } else {
+ Jump nonGreedySkipParentheses;
+ Label nonGreedyTryParentheses;
+ if (term.quantityType == QuantifierGreedy)
+ storeToFrame(index, parenthesesFrameLocation);
+ else if (term.quantityType == QuantifierNonGreedy) {
+ storeToFrame(TrustedImm32(-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.getJumpListToPriorParen());
+
+ m_expressionState.incrementParenNestingLevel();
+
+ TermGenerationState parenthesesState(disjunction, state.checkedTotal);
+
+ // Save the parenthesesTail for backtracking from nested parens to this one.
+ parenthesesState.setJumpListToPriorParen(&parenthesesTail->m_withinBacktrackJumps);
+
+ // 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());
+
+ state.setJumpListToPriorParen(&parenthesesTail->m_afterBacktrackJumps);
+
+ 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 + YarrStackSpaceForBackTrackInfoParentheticalAssertion;
+
+ 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()) {
+ state.setJumpListToPriorParen(0);
+ 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(TrustedImm32(-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(SH4)
+ push(SH4Registers::r11);
+ push(SH4Registers::r13);
+#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(SH4)
+ pop(SH4Registers::r13);
+ pop(SH4Registers::r11);
+#elif CPU(MIPS)
+ // Do nothing
+#endif
+ ret();
+ }
+
+public:
+ YarrGenerator(YarrPattern& 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, YarrCodeBlock& jitObject)
+ {
+ generate();
+
+ LinkBuffer patchBuffer(this, globalData->regexAllocator);
+
+ 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:
+ YarrPattern& m_pattern;
+ bool m_shouldFallBack;
+ GenerationState m_expressionState;
+};
+
+void jitCompile(YarrPattern& pattern, JSGlobalData* globalData, YarrCodeBlock& jitObject)
+{
+ YarrGenerator(pattern).compile(globalData, jitObject);
+}
+
+int execute(YarrCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output)
+{
+ return jitObject.execute(input, start, length, output);
+}
+
+}}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.h b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.h
new file mode 100644
index 0000000..91c5b85
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrJIT.h
@@ -0,0 +1,87 @@
+/*
+ * 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 YarrJIT_h
+#define YarrJIT_h
+
+#if ENABLE(YARR_JIT)
+
+#include "JSGlobalData.h"
+#include "MacroAssembler.h"
+#include "UString.h"
+#include "YarrPattern.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 YarrCodeBlock {
+ typedef int (*YarrJITCode)(const UChar* input, unsigned start, unsigned length, int* output) YARR_CALL;
+
+public:
+ YarrCodeBlock()
+ : m_needFallBack(false)
+ {
+ }
+
+ ~YarrCodeBlock()
+ {
+ }
+
+ 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<YarrJITCode>(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 jitCompile(YarrPattern&, JSGlobalData*, YarrCodeBlock& jitObject);
+int execute(YarrCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output);
+
+} } // namespace JSC::Yarr
+
+#endif
+
+#endif // YarrJIT_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrParser.h b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrParser.h
new file mode 100644
index 0000000..65fb41d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrParser.h
@@ -0,0 +1,872 @@
+/*
+ * 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 YarrParser_h
+#define YarrParser_h
+
+#include <runtime/UString.h>
+#include "Yarr.h"
+#include <wtf/ASCIICType.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace JSC { namespace Yarr {
+
+#define REGEXP_ERROR_PREFIX "Invalid regular expression: "
+
+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)
+ , m_character(0)
+ {
+ }
+
+ /*
+ * 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 parseTokens() to parse over the input and converts any
+ * error code to a const char* for a result.
+ */
+ const char* parse()
+ {
+ if (m_size > MAX_PATTERN_SIZE)
+ m_err = PatternTooLarge;
+ else
+ parseTokens();
+ ASSERT(atEndOfPattern() || m_err);
+
+ // The order of this array must match the ErrorCode enum.
+ static const char* errorMessages[NumberOfErrorCodes] = {
+ 0, // NoError
+ REGEXP_ERROR_PREFIX "regular expression too large",
+ REGEXP_ERROR_PREFIX "numbers out of order in {} quantifier",
+ REGEXP_ERROR_PREFIX "nothing to repeat",
+ REGEXP_ERROR_PREFIX "missing )",
+ REGEXP_ERROR_PREFIX "unmatched parentheses",
+ REGEXP_ERROR_PREFIX "unrecognized character after (?",
+ REGEXP_ERROR_PREFIX "missing terminating ] for character class",
+ REGEXP_ERROR_PREFIX "range out of order in character class",
+ REGEXP_ERROR_PREFIX "\\ 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();
+ *
+ * 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 // YarrParser_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.cpp
new file mode 100644
index 0000000..5913f7e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.cpp
@@ -0,0 +1,1011 @@
+/*
+ * 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 "YarrPattern.h"
+
+#include "Yarr.h"
+#include "YarrParser.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 YarrPatternConstructor {
+public:
+ YarrPatternConstructor(YarrPattern& pattern)
+ : m_pattern(pattern)
+ , m_characterClassConstructor(pattern.m_ignoreCase)
+ , m_beginCharHelper(&pattern.m_beginChars, pattern.m_ignoreCase)
+ , m_invertParentheticalAssertion(false)
+ {
+ m_pattern.m_body = new PatternDisjunction();
+ m_alternative = m_pattern.m_body->addNewAlternative();
+ m_pattern.m_disjunctions.append(m_pattern.m_body);
+ }
+
+ ~YarrPatternConstructor()
+ {
+ }
+
+ void reset()
+ {
+ m_pattern.reset();
+ m_characterClassConstructor.reset();
+
+ m_pattern.m_body = new PatternDisjunction();
+ m_alternative = m_pattern.m_body->addNewAlternative();
+ m_pattern.m_disjunctions.append(m_pattern.m_body);
+ }
+
+ 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;
+ bool containsEmptyAlternative = false;
+
+ for (unsigned i = 0; i < numParenAlternatives; i++) {
+ if (!parenthesesDisjunction->m_alternatives[i]->m_terms.size() && numParenAlternatives > 1) {
+ PatternAlternative* altToRemove = parenthesesDisjunction->m_alternatives[i];
+ parenthesesDisjunction->m_alternatives.remove(i);
+ delete altToRemove;
+ --numParenAlternatives;
+
+ containsEmptyAlternative = true;
+ continue;
+ }
+
+ // Bubble up BOL flags
+ 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;
+
+ if (containsEmptyAlternative) {
+ // Backup and remove the current disjunction's alternatives.
+ Vector<PatternAlternative*> alternatives;
+ alternatives.append(parenthesesDisjunction->m_alternatives);
+ parenthesesDisjunction->m_alternatives.clear();
+ PatternAlternative* alternative = parenthesesDisjunction->addNewAlternative();
+
+ // Insert a new non-capturing parentheses.
+ unsigned subpatternId = m_pattern.m_numSubpatterns + 1;
+ PatternDisjunction* newDisjunction = new PatternDisjunction(alternative);
+ m_pattern.m_disjunctions.append(newDisjunction);
+ alternative->m_terms.append(PatternTerm(PatternTerm::TypeParenthesesSubpattern, subpatternId, newDisjunction, false, false));
+ newDisjunction->m_alternatives.append(alternatives);
+
+ // Set the quantifier of the new parentheses to '?' and set the inherited properties.
+ PatternTerm& disjunctionTerm = alternative->lastTerm();
+ disjunctionTerm.quantify(1, QuantifierGreedy);
+ disjunctionTerm.parentheses.lastSubpatternId = m_pattern.m_numSubpatterns;
+ alternative->m_containsBOL = m_alternative->m_containsBOL;
+ alternative->m_startsWithBOL = m_alternative->m_startsWithBOL;
+ }
+ }
+
+ 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();
+ }
+
+ 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 += YarrStackSpaceForBackTrackInfoBackReference;
+ alternative->m_hasFixedSize = false;
+ break;
+
+ case PatternTerm::TypeForwardReference:
+ break;
+
+ case PatternTerm::TypePatternCharacter:
+ term.inputPosition = currentInputPosition;
+ if (term.quantityType != QuantifierFixedCount) {
+ term.frameLocation = currentCallFrameSize;
+ currentCallFrameSize += YarrStackSpaceForBackTrackInfoPatternCharacter;
+ alternative->m_hasFixedSize = false;
+ } else
+ currentInputPosition += term.quantityCount;
+ break;
+
+ case PatternTerm::TypeCharacterClass:
+ term.inputPosition = currentInputPosition;
+ if (term.quantityType != QuantifierFixedCount) {
+ term.frameLocation = currentCallFrameSize;
+ currentCallFrameSize += YarrStackSpaceForBackTrackInfoCharacterClass;
+ 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 += YarrStackSpaceForBackTrackInfoParenthesesOnce;
+ 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 += YarrStackSpaceForBackTrackInfoParenthesesTerminal;
+ currentCallFrameSize = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize, currentInputPosition);
+ term.inputPosition = currentInputPosition;
+ } else {
+ term.inputPosition = currentInputPosition;
+ setupDisjunctionOffsets(term.parentheses.disjunction, 0, currentInputPosition);
+ currentCallFrameSize += YarrStackSpaceForBackTrackInfoParentheses;
+ }
+ // 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 + YarrStackSpaceForBackTrackInfoParentheticalAssertion, 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 += YarrStackSpaceForBackTrackInfoAlternative;
+
+ 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();
+ }
+ }
+
+ // 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 (termIndex != numTerms - 1) {
+ beginTerms->append(TermChain(term));
+ termIndex++;
+ checkNext = true;
+ } else if (term.quantityType == QuantifierFixedCount) {
+ beginTerms->append(TermChain(term));
+ if (depth < 2 && termIndex < numTerms - 1 && term.quantityCount == 1)
+ if (!setupAlternativeBeginTerms(alternative, &beginTerms->last().hotTerms, termIndex + 1, depth + 1))
+ return false;
+ }
+
+ 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:
+ YarrPattern& m_pattern;
+ PatternAlternative* m_alternative;
+ CharacterClassConstructor m_characterClassConstructor;
+ BeginCharHelper m_beginCharHelper;
+ bool m_invertCharacterClass;
+ bool m_invertParentheticalAssertion;
+};
+
+const char* YarrPattern::compile(const UString& patternString)
+{
+ YarrPatternConstructor constructor(*this);
+
+ 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 (containsIllegalBackReference()) {
+ unsigned numSubpatterns = m_numSubpatterns;
+
+ constructor.reset();
+#if !ASSERT_DISABLED
+ const char* error =
+#endif
+ parse(constructor, patternString, numSubpatterns);
+
+ ASSERT(!error);
+ ASSERT(numSubpatterns == m_numSubpatterns);
+ }
+
+ constructor.checkForTerminalParentheses();
+ constructor.optimizeBOL();
+
+ constructor.setupOffsets();
+ constructor.setupBeginChars();
+
+ return 0;
+}
+
+YarrPattern::YarrPattern(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 = compile(pattern);
+}
+
+} }
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.h b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.h
new file mode 100644
index 0000000..cfe804f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrPattern.h
@@ -0,0 +1,422 @@
+/*
+ * 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 YarrPattern_h
+#define YarrPattern_h
+
+#include <runtime/UString.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace JSC { namespace Yarr {
+
+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 {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ // 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ 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 {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ 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 YarrPattern 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 YarrPattern {
+ YarrPattern(const UString& pattern, bool ignoreCase, bool multiline, const char** error);
+
+ ~YarrPattern()
+ {
+ 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:
+ const char* compile(const UString& patternString);
+
+ CharacterClass* newlineCached;
+ CharacterClass* digitsCached;
+ CharacterClass* spacesCached;
+ CharacterClass* wordcharCached;
+ CharacterClass* nondigitsCached;
+ CharacterClass* nonspacesCached;
+ CharacterClass* nonwordcharCached;
+};
+
+} } // namespace JSC::Yarr
+
+#endif // YarrPattern_h
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp
new file mode 100644
index 0000000..51fda94
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "YarrSyntaxChecker.h"
+
+#include "YarrParser.h"
+
+namespace JSC { namespace Yarr {
+
+class SyntaxChecker {
+public:
+ void assertionBOL() {}
+ void assertionEOL() {}
+ void assertionWordBoundary(bool) {}
+ void atomPatternCharacter(UChar) {}
+ void atomBuiltInCharacterClass(BuiltInCharacterClassID, bool) {}
+ void atomCharacterClassBegin(bool = false) {}
+ void atomCharacterClassAtom(UChar) {}
+ void atomCharacterClassRange(UChar, UChar) {}
+ void atomCharacterClassBuiltIn(BuiltInCharacterClassID, bool) {}
+ void atomCharacterClassEnd() {}
+ void atomParenthesesSubpatternBegin(bool = true) {}
+ void atomParentheticalAssertionBegin(bool = false) {}
+ void atomParenthesesEnd() {}
+ void atomBackReference(unsigned) {}
+ void quantifyAtom(unsigned, unsigned, bool) {}
+ void disjunction() {}
+};
+
+const char* checkSyntax(const UString& pattern)
+{
+ SyntaxChecker syntaxChecker;
+ return parse(syntaxChecker, pattern);
+}
+
+}} // JSC::YARR
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h
new file mode 100644
index 0000000..2013671
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h
@@ -0,0 +1,38 @@
+/*
+ * 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 YarrSyntaxChecker_h
+#define YarrSyntaxChecker_h
+
+#include <runtime/UString.h>
+
+namespace JSC { namespace Yarr {
+
+const char* checkSyntax(const UString& pattern);
+
+}} // JSC::YARR
+
+#endif // YarrSyntaxChecker_h
+
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/yarr/yarr.pri b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/yarr.pri
new file mode 100644
index 0000000..a7b1242
--- /dev/null
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/yarr/yarr.pri
@@ -0,0 +1,7 @@
+# Yet Another Regex Runtime - Qt4 build info
+
+SOURCES += \
+ yarr/YarrInterpreter.cpp \
+ yarr/YarrPattern.cpp \
+ yarr/YarrSyntaxChecker.cpp
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..aa91bdb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
@@ -0,0 +1,618 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 90D9B10212E11DCB002D4255 /* Compiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B0F912E11DCB002D4255 /* Compiler.cpp */; };
+ 90D9B10312E11DCB002D4255 /* ExtensionBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B0FA12E11DCB002D4255 /* ExtensionBehavior.h */; };
+ 90D9B10412E11DCB002D4255 /* glslang_lex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B0FB12E11DCB002D4255 /* glslang_lex.cpp */; };
+ 90D9B10512E11DCB002D4255 /* glslang_tab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B0FC12E11DCB002D4255 /* glslang_tab.cpp */; };
+ 90D9B10612E11DCB002D4255 /* glslang_tab.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B0FD12E11DCB002D4255 /* glslang_tab.h */; };
+ 90D9B10712E11DCB002D4255 /* glslang.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B0FE12E11DCB002D4255 /* glslang.h */; };
+ 90D9B10912E11DCB002D4255 /* SearchSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B10012E11DCB002D4255 /* SearchSymbol.cpp */; };
+ 90D9B10A12E11DCB002D4255 /* SearchSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B10112E11DCB002D4255 /* SearchSymbol.h */; };
+ 90D9B11312E11DD6002D4255 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B10B12E11DD6002D4255 /* util.cpp */; };
+ 90D9B11412E11DD6002D4255 /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B10C12E11DD6002D4255 /* util.h */; };
+ 90D9B11512E11DD6002D4255 /* ValidateLimitations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B10D12E11DD6002D4255 /* ValidateLimitations.cpp */; };
+ 90D9B11612E11DD6002D4255 /* ValidateLimitations.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B10E12E11DD6002D4255 /* ValidateLimitations.h */; };
+ 90D9B11712E11DD6002D4255 /* VariableInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B10F12E11DD6002D4255 /* VariableInfo.cpp */; };
+ 90D9B11812E11DD6002D4255 /* VariableInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B11012E11DD6002D4255 /* VariableInfo.h */; };
+ 90D9B11912E11DD6002D4255 /* VersionGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90D9B11112E11DD6002D4255 /* VersionGLSL.cpp */; };
+ 90D9B11A12E11DD6002D4255 /* VersionGLSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D9B11212E11DD6002D4255 /* VersionGLSL.h */; };
+ FB39D2711200F35A00088E69 /* CodeGenGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2221200F35A00088E69 /* CodeGenGLSL.cpp */; };
+ FB39D2751200F35A00088E69 /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2261200F35A00088E69 /* debug.cpp */; };
+ FB39D2791200F35A00088E69 /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D22A1200F35A00088E69 /* InfoSink.cpp */; };
+ FB39D27B1200F35A00088E69 /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D22C1200F35A00088E69 /* Initialize.cpp */; };
+ FB39D27D1200F35A00088E69 /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D22E1200F35A00088E69 /* InitializeDll.cpp */; };
+ FB39D2811200F35A00088E69 /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2321200F35A00088E69 /* Intermediate.cpp */; };
+ FB39D2831200F35A00088E69 /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2341200F35A00088E69 /* intermOut.cpp */; };
+ FB39D2841200F35A00088E69 /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2351200F35A00088E69 /* IntermTraverse.cpp */; };
+ FB39D2881200F35A00088E69 /* ossource_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2391200F35A00088E69 /* ossource_posix.cpp */; };
+ FB39D28A1200F35A00088E69 /* OutputGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D23B1200F35A00088E69 /* OutputGLSL.cpp */; };
+ FB39D28E1200F35A00088E69 /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D23F1200F35A00088E69 /* parseConst.cpp */; };
+ FB39D28F1200F35A00088E69 /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2401200F35A00088E69 /* ParseHelper.cpp */; };
+ FB39D2911200F35A00088E69 /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2421200F35A00088E69 /* PoolAlloc.cpp */; };
+ FB39D2931200F35A00088E69 /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2451200F35A00088E69 /* atom.c */; };
+ FB39D2961200F35A00088E69 /* cpp.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2481200F35A00088E69 /* cpp.c */; };
+ FB39D2981200F35A00088E69 /* cppstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D24A1200F35A00088E69 /* cppstruct.c */; };
+ FB39D2991200F35A00088E69 /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D24B1200F35A00088E69 /* memory.c */; };
+ FB39D29D1200F35A00088E69 /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D24F1200F35A00088E69 /* scanner.c */; };
+ FB39D2A01200F35A00088E69 /* symbols.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2521200F35A00088E69 /* symbols.c */; };
+ FB39D2A21200F35A00088E69 /* tokens.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2541200F35A00088E69 /* tokens.c */; };
+ FB39D2A41200F35A00088E69 /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2561200F35A00088E69 /* QualifierAlive.cpp */; };
+ FB39D2A61200F35A00088E69 /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2581200F35A00088E69 /* RemoveTree.cpp */; };
+ FB39D2A81200F35A00088E69 /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D25A1200F35A00088E69 /* ShaderLang.cpp */; };
+ FB39D2AA1200F35A00088E69 /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D25C1200F35A00088E69 /* SymbolTable.cpp */; };
+ FB39D2AC1200F35A00088E69 /* TranslatorGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2681200F35A00088E69 /* TranslatorGLSL.cpp */; };
+ FB39D2B11200F35A00088E69 /* UnfoldSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D26D1200F35A00088E69 /* UnfoldSelect.cpp */; };
+ FB39D76E120110FC00088E69 /* ShaderLang.h in Headers */ = {isa = PBXBuildFile; fileRef = FB39D2BF1200F3E600088E69 /* ShaderLang.h */; settings = {ATTRIBUTES = (Public, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ANGLE.xcconfig; sourceTree = "<group>"; };
+ 5D7C59C61208C68B001C873E /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
+ 5D7C59C71208C68B001C873E /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
+ 90D9B0F912E11DCB002D4255 /* Compiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Compiler.cpp; sourceTree = "<group>"; };
+ 90D9B0FA12E11DCB002D4255 /* ExtensionBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionBehavior.h; sourceTree = "<group>"; };
+ 90D9B0FB12E11DCB002D4255 /* glslang_lex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_lex.cpp; sourceTree = "<group>"; };
+ 90D9B0FC12E11DCB002D4255 /* glslang_tab.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_tab.cpp; sourceTree = "<group>"; };
+ 90D9B0FD12E11DCB002D4255 /* glslang_tab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glslang_tab.h; sourceTree = "<group>"; };
+ 90D9B0FE12E11DCB002D4255 /* glslang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glslang.h; sourceTree = "<group>"; };
+ 90D9B0FF12E11DCB002D4255 /* ossource_nspr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_nspr.cpp; sourceTree = "<group>"; };
+ 90D9B10012E11DCB002D4255 /* SearchSymbol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SearchSymbol.cpp; sourceTree = "<group>"; };
+ 90D9B10112E11DCB002D4255 /* SearchSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchSymbol.h; sourceTree = "<group>"; };
+ 90D9B10B12E11DD6002D4255 /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
+ 90D9B10C12E11DD6002D4255 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
+ 90D9B10D12E11DD6002D4255 /* ValidateLimitations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValidateLimitations.cpp; sourceTree = "<group>"; };
+ 90D9B10E12E11DD6002D4255 /* ValidateLimitations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidateLimitations.h; sourceTree = "<group>"; };
+ 90D9B10F12E11DD6002D4255 /* VariableInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VariableInfo.cpp; sourceTree = "<group>"; };
+ 90D9B11012E11DD6002D4255 /* VariableInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VariableInfo.h; sourceTree = "<group>"; };
+ 90D9B11112E11DD6002D4255 /* VersionGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VersionGLSL.cpp; sourceTree = "<group>"; };
+ 90D9B11212E11DD6002D4255 /* VersionGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VersionGLSL.h; sourceTree = "<group>"; };
+ FB39D0D11200F0E300088E69 /* libANGLE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libANGLE.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ FB39D1861200F26200088E69 /* BaseTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTypes.h; sourceTree = "<group>"; };
+ FB39D1871200F26200088E69 /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
+ FB39D1881200F26200088E69 /* CodeGenHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenHLSL.cpp; sourceTree = "<group>"; };
+ FB39D1891200F26200088E69 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
+ FB39D18A1200F26200088E69 /* ConstantUnion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstantUnion.h; sourceTree = "<group>"; };
+ FB39D18B1200F26200088E69 /* debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = debug.cpp; sourceTree = "<group>"; };
+ FB39D18C1200F26200088E69 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
+ FB39D18F1200F26200088E69 /* InfoSink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = InfoSink.cpp; sourceTree = "<group>"; };
+ FB39D1901200F26200088E69 /* InfoSink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoSink.h; sourceTree = "<group>"; };
+ FB39D1911200F26200088E69 /* Initialize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = Initialize.cpp; sourceTree = "<group>"; };
+ FB39D1921200F26200088E69 /* Initialize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Initialize.h; sourceTree = "<group>"; };
+ FB39D1931200F26200088E69 /* InitializeDll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeDll.cpp; sourceTree = "<group>"; };
+ FB39D1941200F26200088E69 /* InitializeDll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeDll.h; sourceTree = "<group>"; };
+ FB39D1951200F26200088E69 /* InitializeGlobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeGlobals.h; sourceTree = "<group>"; };
+ FB39D1961200F26200088E69 /* InitializeParseContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeParseContext.h; sourceTree = "<group>"; };
+ FB39D1971200F26200088E69 /* Intermediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = "<group>"; };
+ FB39D1981200F26200088E69 /* intermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intermediate.h; sourceTree = "<group>"; };
+ FB39D1991200F26200088E69 /* intermOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = "<group>"; };
+ FB39D19A1200F26200088E69 /* IntermTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = "<group>"; };
+ FB39D19B1200F26200088E69 /* localintermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = "<group>"; };
+ FB39D19C1200F26200088E69 /* MMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMap.h; sourceTree = "<group>"; };
+ FB39D19D1200F26200088E69 /* osinclude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = "<group>"; };
+ FB39D19E1200F26200088E69 /* ossource_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_posix.cpp; sourceTree = "<group>"; };
+ FB39D19F1200F26200088E69 /* ossource_win.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_win.cpp; sourceTree = "<group>"; };
+ FB39D1A01200F26200088E69 /* OutputGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSL.cpp; sourceTree = "<group>"; };
+ FB39D1A11200F26200088E69 /* OutputGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputGLSL.h; sourceTree = "<group>"; };
+ FB39D1A21200F26200088E69 /* OutputHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = OutputHLSL.cpp; sourceTree = "<group>"; };
+ FB39D1A31200F26200088E69 /* OutputHLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputHLSL.h; sourceTree = "<group>"; };
+ FB39D1A41200F26200088E69 /* parseConst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = parseConst.cpp; sourceTree = "<group>"; };
+ FB39D1A51200F26200088E69 /* ParseHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = ParseHelper.cpp; sourceTree = "<group>"; };
+ FB39D1A61200F26200088E69 /* ParseHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseHelper.h; sourceTree = "<group>"; };
+ FB39D1A71200F26200088E69 /* PoolAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = "<group>"; };
+ FB39D1A81200F26200088E69 /* PoolAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoolAlloc.h; sourceTree = "<group>"; };
+ FB39D1AA1200F26200088E69 /* atom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atom.c; sourceTree = "<group>"; };
+ FB39D1AB1200F26200088E69 /* atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atom.h; sourceTree = "<group>"; };
+ FB39D1AC1200F26200088E69 /* compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
+ FB39D1AD1200F26200088E69 /* cpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpp.c; sourceTree = "<group>"; };
+ FB39D1AE1200F26200088E69 /* cpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpp.h; sourceTree = "<group>"; };
+ FB39D1AF1200F26200088E69 /* cppstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cppstruct.c; sourceTree = "<group>"; };
+ FB39D1B01200F26200088E69 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; };
+ FB39D1B11200F26200088E69 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
+ FB39D1B21200F26200088E69 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = "<group>"; };
+ FB39D1B31200F26200088E69 /* preprocess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preprocess.h; sourceTree = "<group>"; };
+ FB39D1B41200F26200088E69 /* scanner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = "<group>"; };
+ FB39D1B51200F26200088E69 /* scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scanner.h; sourceTree = "<group>"; };
+ FB39D1B61200F26200088E69 /* slglobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slglobals.h; sourceTree = "<group>"; };
+ FB39D1B71200F26200088E69 /* symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = symbols.c; sourceTree = "<group>"; };
+ FB39D1B81200F26200088E69 /* symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = symbols.h; sourceTree = "<group>"; };
+ FB39D1B91200F26200088E69 /* tokens.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tokens.c; sourceTree = "<group>"; };
+ FB39D1BA1200F26200088E69 /* tokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tokens.h; sourceTree = "<group>"; };
+ FB39D1BB1200F26200088E69 /* QualifierAlive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = "<group>"; };
+ FB39D1BC1200F26200088E69 /* QualifierAlive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QualifierAlive.h; sourceTree = "<group>"; };
+ FB39D1BD1200F26200088E69 /* RemoveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = "<group>"; };
+ FB39D1BE1200F26200088E69 /* RemoveTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveTree.h; sourceTree = "<group>"; };
+ FB39D1BF1200F26200088E69 /* ShaderLang.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; includeInIndex = 0; path = ShaderLang.cpp; sourceTree = "<group>"; };
+ FB39D1C01200F26200088E69 /* ShHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShHandle.h; sourceTree = "<group>"; };
+ FB39D1C11200F26200088E69 /* SymbolTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = "<group>"; };
+ FB39D1C21200F26200088E69 /* SymbolTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; };
+ FB39D1CB1200F26200088E69 /* translator_common.vcproj */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = translator_common.vcproj; sourceTree = "<group>"; };
+ FB39D1CC1200F26200088E69 /* translator_hlsl.vcproj */ = {isa = PBXFileReference; explicitFileType = text.xml; fileEncoding = 4; path = translator_hlsl.vcproj; sourceTree = "<group>"; };
+ FB39D1CD1200F26200088E69 /* TranslatorGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorGLSL.cpp; sourceTree = "<group>"; };
+ FB39D1CE1200F26200088E69 /* TranslatorGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslatorGLSL.h; sourceTree = "<group>"; };
+ FB39D1CF1200F26200088E69 /* TranslatorHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorHLSL.cpp; sourceTree = "<group>"; };
+ FB39D1D01200F26200088E69 /* TranslatorHLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslatorHLSL.h; sourceTree = "<group>"; };
+ FB39D1D11200F26200088E69 /* Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = "<group>"; };
+ FB39D1D21200F26200088E69 /* UnfoldSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = UnfoldSelect.cpp; sourceTree = "<group>"; };
+ FB39D1D31200F26200088E69 /* UnfoldSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnfoldSelect.h; sourceTree = "<group>"; };
+ FB39D2211200F35A00088E69 /* BaseTypes.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = BaseTypes.h; sourceTree = "<group>"; };
+ FB39D2221200F35A00088E69 /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
+ FB39D2241200F35A00088E69 /* Common.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = Common.h; sourceTree = "<group>"; };
+ FB39D2251200F35A00088E69 /* ConstantUnion.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ConstantUnion.h; sourceTree = "<group>"; };
+ FB39D2261200F35A00088E69 /* debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = debug.cpp; sourceTree = "<group>"; };
+ FB39D2271200F35A00088E69 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
+ FB39D22A1200F35A00088E69 /* InfoSink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InfoSink.cpp; sourceTree = "<group>"; };
+ FB39D22B1200F35A00088E69 /* InfoSink.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = InfoSink.h; sourceTree = "<group>"; };
+ FB39D22C1200F35A00088E69 /* Initialize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Initialize.cpp; sourceTree = "<group>"; };
+ FB39D22D1200F35A00088E69 /* Initialize.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = Initialize.h; sourceTree = "<group>"; };
+ FB39D22E1200F35A00088E69 /* InitializeDll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeDll.cpp; sourceTree = "<group>"; };
+ FB39D22F1200F35A00088E69 /* InitializeDll.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = InitializeDll.h; sourceTree = "<group>"; };
+ FB39D2301200F35A00088E69 /* InitializeGlobals.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = InitializeGlobals.h; sourceTree = "<group>"; };
+ FB39D2311200F35A00088E69 /* InitializeParseContext.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = InitializeParseContext.h; sourceTree = "<group>"; };
+ FB39D2321200F35A00088E69 /* Intermediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = "<group>"; };
+ FB39D2331200F35A00088E69 /* intermediate.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = intermediate.h; sourceTree = "<group>"; };
+ FB39D2341200F35A00088E69 /* intermOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = "<group>"; };
+ FB39D2351200F35A00088E69 /* IntermTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = "<group>"; };
+ FB39D2361200F35A00088E69 /* localintermediate.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = localintermediate.h; sourceTree = "<group>"; };
+ FB39D2371200F35A00088E69 /* MMap.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = MMap.h; sourceTree = "<group>"; };
+ FB39D2381200F35A00088E69 /* osinclude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = "<group>"; };
+ FB39D2391200F35A00088E69 /* ossource_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_posix.cpp; sourceTree = "<group>"; };
+ FB39D23A1200F35A00088E69 /* ossource_win.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_win.cpp; sourceTree = "<group>"; };
+ FB39D23B1200F35A00088E69 /* OutputGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSL.cpp; sourceTree = "<group>"; };
+ FB39D23C1200F35A00088E69 /* OutputGLSL.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = OutputGLSL.h; sourceTree = "<group>"; };
+ FB39D23F1200F35A00088E69 /* parseConst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parseConst.cpp; sourceTree = "<group>"; };
+ FB39D2401200F35A00088E69 /* ParseHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseHelper.cpp; sourceTree = "<group>"; };
+ FB39D2411200F35A00088E69 /* ParseHelper.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ParseHelper.h; sourceTree = "<group>"; };
+ FB39D2421200F35A00088E69 /* PoolAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = "<group>"; };
+ FB39D2431200F35A00088E69 /* PoolAlloc.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = PoolAlloc.h; sourceTree = "<group>"; };
+ FB39D2451200F35A00088E69 /* atom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atom.c; sourceTree = "<group>"; };
+ FB39D2461200F35A00088E69 /* atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atom.h; sourceTree = "<group>"; };
+ FB39D2471200F35A00088E69 /* compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
+ FB39D2481200F35A00088E69 /* cpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpp.c; sourceTree = "<group>"; };
+ FB39D2491200F35A00088E69 /* cpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpp.h; sourceTree = "<group>"; };
+ FB39D24A1200F35A00088E69 /* cppstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cppstruct.c; sourceTree = "<group>"; };
+ FB39D24B1200F35A00088E69 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; };
+ FB39D24C1200F35A00088E69 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
+ FB39D24D1200F35A00088E69 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = "<group>"; };
+ FB39D24E1200F35A00088E69 /* preprocess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preprocess.h; sourceTree = "<group>"; };
+ FB39D24F1200F35A00088E69 /* scanner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = "<group>"; };
+ FB39D2501200F35A00088E69 /* scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scanner.h; sourceTree = "<group>"; };
+ FB39D2511200F35A00088E69 /* slglobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slglobals.h; sourceTree = "<group>"; };
+ FB39D2521200F35A00088E69 /* symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = symbols.c; sourceTree = "<group>"; };
+ FB39D2531200F35A00088E69 /* symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = symbols.h; sourceTree = "<group>"; };
+ FB39D2541200F35A00088E69 /* tokens.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tokens.c; sourceTree = "<group>"; };
+ FB39D2551200F35A00088E69 /* tokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tokens.h; sourceTree = "<group>"; };
+ FB39D2561200F35A00088E69 /* QualifierAlive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = "<group>"; };
+ FB39D2571200F35A00088E69 /* QualifierAlive.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = QualifierAlive.h; sourceTree = "<group>"; };
+ FB39D2581200F35A00088E69 /* RemoveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = "<group>"; };
+ FB39D2591200F35A00088E69 /* RemoveTree.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = RemoveTree.h; sourceTree = "<group>"; };
+ FB39D25A1200F35A00088E69 /* ShaderLang.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderLang.cpp; sourceTree = "<group>"; };
+ FB39D25B1200F35A00088E69 /* ShHandle.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ShHandle.h; sourceTree = "<group>"; };
+ FB39D25C1200F35A00088E69 /* SymbolTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = "<group>"; };
+ FB39D25D1200F35A00088E69 /* SymbolTable.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = SymbolTable.h; sourceTree = "<group>"; };
+ FB39D2681200F35A00088E69 /* TranslatorGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorGLSL.cpp; sourceTree = "<group>"; };
+ FB39D2691200F35A00088E69 /* TranslatorGLSL.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = TranslatorGLSL.h; sourceTree = "<group>"; };
+ FB39D26C1200F35A00088E69 /* Types.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = Types.h; sourceTree = "<group>"; };
+ FB39D26D1200F35A00088E69 /* UnfoldSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnfoldSelect.cpp; sourceTree = "<group>"; };
+ FB39D26E1200F35A00088E69 /* UnfoldSelect.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = UnfoldSelect.h; sourceTree = "<group>"; };
+ FB39D2BF1200F3E600088E69 /* ShaderLang.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ShaderLang.h; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ FB39D0CF1200F0E300088E69 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 5D7C59C41208C68B001C873E /* Configurations */ = {
+ isa = PBXGroup;
+ children = (
+ 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */,
+ 5D7C59C61208C68B001C873E /* Base.xcconfig */,
+ 5D7C59C71208C68B001C873E /* DebugRelease.xcconfig */,
+ );
+ path = Configurations;
+ sourceTree = "<group>";
+ };
+ FB39D06E1200ED9200088E69 = {
+ isa = PBXGroup;
+ children = (
+ FB39D2201200F35A00088E69 /* compiler */,
+ FB39D0841200EDEB00088E69 /* Source */,
+ 5D7C59C41208C68B001C873E /* Configurations */,
+ FB39D0CC1200EF9B00088E69 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ FB39D0841200EDEB00088E69 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ FB39D2BD1200F3E600088E69 /* GLSLANG */,
+ FB39D1851200F26200088E69 /* compiler */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ FB39D0CC1200EF9B00088E69 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ FB39D0D11200F0E300088E69 /* libANGLE.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ FB39D1851200F26200088E69 /* compiler */ = {
+ isa = PBXGroup;
+ children = (
+ FB39D1861200F26200088E69 /* BaseTypes.h */,
+ FB39D1871200F26200088E69 /* CodeGenGLSL.cpp */,
+ FB39D1881200F26200088E69 /* CodeGenHLSL.cpp */,
+ FB39D1891200F26200088E69 /* Common.h */,
+ FB39D18A1200F26200088E69 /* ConstantUnion.h */,
+ FB39D18B1200F26200088E69 /* debug.cpp */,
+ FB39D18C1200F26200088E69 /* debug.h */,
+ FB39D18F1200F26200088E69 /* InfoSink.cpp */,
+ FB39D1901200F26200088E69 /* InfoSink.h */,
+ FB39D1911200F26200088E69 /* Initialize.cpp */,
+ FB39D1921200F26200088E69 /* Initialize.h */,
+ FB39D1931200F26200088E69 /* InitializeDll.cpp */,
+ FB39D1941200F26200088E69 /* InitializeDll.h */,
+ FB39D1951200F26200088E69 /* InitializeGlobals.h */,
+ FB39D1961200F26200088E69 /* InitializeParseContext.h */,
+ FB39D1971200F26200088E69 /* Intermediate.cpp */,
+ FB39D1981200F26200088E69 /* intermediate.h */,
+ FB39D1991200F26200088E69 /* intermOut.cpp */,
+ FB39D19A1200F26200088E69 /* IntermTraverse.cpp */,
+ FB39D19B1200F26200088E69 /* localintermediate.h */,
+ FB39D19C1200F26200088E69 /* MMap.h */,
+ FB39D19D1200F26200088E69 /* osinclude.h */,
+ FB39D19E1200F26200088E69 /* ossource_posix.cpp */,
+ FB39D19F1200F26200088E69 /* ossource_win.cpp */,
+ FB39D1A01200F26200088E69 /* OutputGLSL.cpp */,
+ FB39D1A11200F26200088E69 /* OutputGLSL.h */,
+ FB39D1A21200F26200088E69 /* OutputHLSL.cpp */,
+ FB39D1A31200F26200088E69 /* OutputHLSL.h */,
+ FB39D1A41200F26200088E69 /* parseConst.cpp */,
+ FB39D1A51200F26200088E69 /* ParseHelper.cpp */,
+ FB39D1A61200F26200088E69 /* ParseHelper.h */,
+ FB39D1A71200F26200088E69 /* PoolAlloc.cpp */,
+ FB39D1A81200F26200088E69 /* PoolAlloc.h */,
+ FB39D1A91200F26200088E69 /* preprocessor */,
+ FB39D1BB1200F26200088E69 /* QualifierAlive.cpp */,
+ FB39D1BC1200F26200088E69 /* QualifierAlive.h */,
+ FB39D1BD1200F26200088E69 /* RemoveTree.cpp */,
+ FB39D1BE1200F26200088E69 /* RemoveTree.h */,
+ FB39D1BF1200F26200088E69 /* ShaderLang.cpp */,
+ FB39D1C01200F26200088E69 /* ShHandle.h */,
+ FB39D1C11200F26200088E69 /* SymbolTable.cpp */,
+ FB39D1C21200F26200088E69 /* SymbolTable.h */,
+ FB39D1CB1200F26200088E69 /* translator_common.vcproj */,
+ FB39D1CC1200F26200088E69 /* translator_hlsl.vcproj */,
+ FB39D1CD1200F26200088E69 /* TranslatorGLSL.cpp */,
+ FB39D1CE1200F26200088E69 /* TranslatorGLSL.h */,
+ FB39D1CF1200F26200088E69 /* TranslatorHLSL.cpp */,
+ FB39D1D01200F26200088E69 /* TranslatorHLSL.h */,
+ FB39D1D11200F26200088E69 /* Types.h */,
+ FB39D1D21200F26200088E69 /* UnfoldSelect.cpp */,
+ FB39D1D31200F26200088E69 /* UnfoldSelect.h */,
+ );
+ includeInIndex = 0;
+ name = compiler;
+ path = src/compiler;
+ sourceTree = "<group>";
+ };
+ FB39D1A91200F26200088E69 /* preprocessor */ = {
+ isa = PBXGroup;
+ children = (
+ FB39D1AA1200F26200088E69 /* atom.c */,
+ FB39D1AB1200F26200088E69 /* atom.h */,
+ FB39D1AC1200F26200088E69 /* compile.h */,
+ FB39D1AD1200F26200088E69 /* cpp.c */,
+ FB39D1AE1200F26200088E69 /* cpp.h */,
+ FB39D1AF1200F26200088E69 /* cppstruct.c */,
+ FB39D1B01200F26200088E69 /* memory.c */,
+ FB39D1B11200F26200088E69 /* memory.h */,
+ FB39D1B21200F26200088E69 /* parser.h */,
+ FB39D1B31200F26200088E69 /* preprocess.h */,
+ FB39D1B41200F26200088E69 /* scanner.c */,
+ FB39D1B51200F26200088E69 /* scanner.h */,
+ FB39D1B61200F26200088E69 /* slglobals.h */,
+ FB39D1B71200F26200088E69 /* symbols.c */,
+ FB39D1B81200F26200088E69 /* symbols.h */,
+ FB39D1B91200F26200088E69 /* tokens.c */,
+ FB39D1BA1200F26200088E69 /* tokens.h */,
+ );
+ includeInIndex = 0;
+ path = preprocessor;
+ sourceTree = "<group>";
+ };
+ FB39D2201200F35A00088E69 /* compiler */ = {
+ isa = PBXGroup;
+ children = (
+ FB39D2441200F35A00088E69 /* preprocessor */,
+ FB39D2211200F35A00088E69 /* BaseTypes.h */,
+ FB39D2221200F35A00088E69 /* CodeGenGLSL.cpp */,
+ FB39D2241200F35A00088E69 /* Common.h */,
+ 90D9B0F912E11DCB002D4255 /* Compiler.cpp */,
+ FB39D2251200F35A00088E69 /* ConstantUnion.h */,
+ FB39D2261200F35A00088E69 /* debug.cpp */,
+ FB39D2271200F35A00088E69 /* debug.h */,
+ 90D9B0FA12E11DCB002D4255 /* ExtensionBehavior.h */,
+ 90D9B0FB12E11DCB002D4255 /* glslang_lex.cpp */,
+ 90D9B0FC12E11DCB002D4255 /* glslang_tab.cpp */,
+ 90D9B0FD12E11DCB002D4255 /* glslang_tab.h */,
+ 90D9B0FE12E11DCB002D4255 /* glslang.h */,
+ FB39D22A1200F35A00088E69 /* InfoSink.cpp */,
+ FB39D22B1200F35A00088E69 /* InfoSink.h */,
+ FB39D22C1200F35A00088E69 /* Initialize.cpp */,
+ FB39D22D1200F35A00088E69 /* Initialize.h */,
+ FB39D22E1200F35A00088E69 /* InitializeDll.cpp */,
+ FB39D22F1200F35A00088E69 /* InitializeDll.h */,
+ FB39D2301200F35A00088E69 /* InitializeGlobals.h */,
+ FB39D2311200F35A00088E69 /* InitializeParseContext.h */,
+ FB39D2321200F35A00088E69 /* Intermediate.cpp */,
+ FB39D2331200F35A00088E69 /* intermediate.h */,
+ FB39D2341200F35A00088E69 /* intermOut.cpp */,
+ FB39D2351200F35A00088E69 /* IntermTraverse.cpp */,
+ FB39D2361200F35A00088E69 /* localintermediate.h */,
+ FB39D2371200F35A00088E69 /* MMap.h */,
+ FB39D2381200F35A00088E69 /* osinclude.h */,
+ 90D9B0FF12E11DCB002D4255 /* ossource_nspr.cpp */,
+ FB39D2391200F35A00088E69 /* ossource_posix.cpp */,
+ FB39D23A1200F35A00088E69 /* ossource_win.cpp */,
+ FB39D23B1200F35A00088E69 /* OutputGLSL.cpp */,
+ FB39D23C1200F35A00088E69 /* OutputGLSL.h */,
+ FB39D23F1200F35A00088E69 /* parseConst.cpp */,
+ FB39D2401200F35A00088E69 /* ParseHelper.cpp */,
+ FB39D2411200F35A00088E69 /* ParseHelper.h */,
+ FB39D2421200F35A00088E69 /* PoolAlloc.cpp */,
+ FB39D2431200F35A00088E69 /* PoolAlloc.h */,
+ FB39D2561200F35A00088E69 /* QualifierAlive.cpp */,
+ FB39D2571200F35A00088E69 /* QualifierAlive.h */,
+ FB39D2581200F35A00088E69 /* RemoveTree.cpp */,
+ FB39D2591200F35A00088E69 /* RemoveTree.h */,
+ 90D9B10012E11DCB002D4255 /* SearchSymbol.cpp */,
+ 90D9B10112E11DCB002D4255 /* SearchSymbol.h */,
+ FB39D25A1200F35A00088E69 /* ShaderLang.cpp */,
+ FB39D25B1200F35A00088E69 /* ShHandle.h */,
+ FB39D25C1200F35A00088E69 /* SymbolTable.cpp */,
+ FB39D25D1200F35A00088E69 /* SymbolTable.h */,
+ FB39D2681200F35A00088E69 /* TranslatorGLSL.cpp */,
+ FB39D2691200F35A00088E69 /* TranslatorGLSL.h */,
+ FB39D26C1200F35A00088E69 /* Types.h */,
+ FB39D26D1200F35A00088E69 /* UnfoldSelect.cpp */,
+ FB39D26E1200F35A00088E69 /* UnfoldSelect.h */,
+ 90D9B10B12E11DD6002D4255 /* util.cpp */,
+ 90D9B10C12E11DD6002D4255 /* util.h */,
+ 90D9B10D12E11DD6002D4255 /* ValidateLimitations.cpp */,
+ 90D9B10E12E11DD6002D4255 /* ValidateLimitations.h */,
+ 90D9B10F12E11DD6002D4255 /* VariableInfo.cpp */,
+ 90D9B11012E11DD6002D4255 /* VariableInfo.h */,
+ 90D9B11112E11DD6002D4255 /* VersionGLSL.cpp */,
+ 90D9B11212E11DD6002D4255 /* VersionGLSL.h */,
+ );
+ name = compiler;
+ path = src/compiler;
+ sourceTree = "<group>";
+ };
+ FB39D2441200F35A00088E69 /* preprocessor */ = {
+ isa = PBXGroup;
+ children = (
+ FB39D2451200F35A00088E69 /* atom.c */,
+ FB39D2461200F35A00088E69 /* atom.h */,
+ FB39D2471200F35A00088E69 /* compile.h */,
+ FB39D2481200F35A00088E69 /* cpp.c */,
+ FB39D2491200F35A00088E69 /* cpp.h */,
+ FB39D24A1200F35A00088E69 /* cppstruct.c */,
+ FB39D24B1200F35A00088E69 /* memory.c */,
+ FB39D24C1200F35A00088E69 /* memory.h */,
+ FB39D24D1200F35A00088E69 /* parser.h */,
+ FB39D24E1200F35A00088E69 /* preprocess.h */,
+ FB39D24F1200F35A00088E69 /* scanner.c */,
+ FB39D2501200F35A00088E69 /* scanner.h */,
+ FB39D2511200F35A00088E69 /* slglobals.h */,
+ FB39D2521200F35A00088E69 /* symbols.c */,
+ FB39D2531200F35A00088E69 /* symbols.h */,
+ FB39D2541200F35A00088E69 /* tokens.c */,
+ FB39D2551200F35A00088E69 /* tokens.h */,
+ );
+ path = preprocessor;
+ sourceTree = "<group>";
+ };
+ FB39D2BD1200F3E600088E69 /* GLSLANG */ = {
+ isa = PBXGroup;
+ children = (
+ FB39D2BF1200F3E600088E69 /* ShaderLang.h */,
+ );
+ name = GLSLANG;
+ path = include/GLSLANG;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ FB39D77B1201110C00088E69 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FB39D76E120110FC00088E69 /* ShaderLang.h in Headers */,
+ 90D9B10312E11DCB002D4255 /* ExtensionBehavior.h in Headers */,
+ 90D9B10612E11DCB002D4255 /* glslang_tab.h in Headers */,
+ 90D9B10712E11DCB002D4255 /* glslang.h in Headers */,
+ 90D9B10A12E11DCB002D4255 /* SearchSymbol.h in Headers */,
+ 90D9B11412E11DD6002D4255 /* util.h in Headers */,
+ 90D9B11612E11DD6002D4255 /* ValidateLimitations.h in Headers */,
+ 90D9B11812E11DD6002D4255 /* VariableInfo.h in Headers */,
+ 90D9B11A12E11DD6002D4255 /* VersionGLSL.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ FB39D0D01200F0E300088E69 /* ANGLE */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = FB39D0D61200F11E00088E69 /* Build configuration list for PBXNativeTarget "ANGLE" */;
+ buildPhases = (
+ FB39D77B1201110C00088E69 /* Headers */,
+ FB39D0CE1200F0E300088E69 /* Sources */,
+ FB39D0CF1200F0E300088E69 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ANGLE;
+ productName = angle;
+ productReference = FB39D0D11200F0E300088E69 /* libANGLE.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ FB39D0701200ED9200088E69 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = FB39D0731200ED9200088E69 /* Build configuration list for PBXProject "ANGLE" */;
+ compatibilityVersion = "Xcode 2.4";
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = FB39D06E1200ED9200088E69;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ FB39D0D01200F0E300088E69 /* ANGLE */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ FB39D0CE1200F0E300088E69 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FB39D2711200F35A00088E69 /* CodeGenGLSL.cpp in Sources */,
+ FB39D2751200F35A00088E69 /* debug.cpp in Sources */,
+ FB39D2791200F35A00088E69 /* InfoSink.cpp in Sources */,
+ FB39D27B1200F35A00088E69 /* Initialize.cpp in Sources */,
+ FB39D27D1200F35A00088E69 /* InitializeDll.cpp in Sources */,
+ FB39D2811200F35A00088E69 /* Intermediate.cpp in Sources */,
+ FB39D2831200F35A00088E69 /* intermOut.cpp in Sources */,
+ FB39D2841200F35A00088E69 /* IntermTraverse.cpp in Sources */,
+ FB39D2881200F35A00088E69 /* ossource_posix.cpp in Sources */,
+ FB39D28A1200F35A00088E69 /* OutputGLSL.cpp in Sources */,
+ FB39D28E1200F35A00088E69 /* parseConst.cpp in Sources */,
+ FB39D28F1200F35A00088E69 /* ParseHelper.cpp in Sources */,
+ FB39D2911200F35A00088E69 /* PoolAlloc.cpp in Sources */,
+ FB39D2931200F35A00088E69 /* atom.c in Sources */,
+ FB39D2961200F35A00088E69 /* cpp.c in Sources */,
+ FB39D2981200F35A00088E69 /* cppstruct.c in Sources */,
+ FB39D2991200F35A00088E69 /* memory.c in Sources */,
+ FB39D29D1200F35A00088E69 /* scanner.c in Sources */,
+ FB39D2A01200F35A00088E69 /* symbols.c in Sources */,
+ FB39D2A21200F35A00088E69 /* tokens.c in Sources */,
+ FB39D2A41200F35A00088E69 /* QualifierAlive.cpp in Sources */,
+ FB39D2A61200F35A00088E69 /* RemoveTree.cpp in Sources */,
+ FB39D2A81200F35A00088E69 /* ShaderLang.cpp in Sources */,
+ FB39D2AA1200F35A00088E69 /* SymbolTable.cpp in Sources */,
+ FB39D2AC1200F35A00088E69 /* TranslatorGLSL.cpp in Sources */,
+ FB39D2B11200F35A00088E69 /* UnfoldSelect.cpp in Sources */,
+ 90D9B10212E11DCB002D4255 /* Compiler.cpp in Sources */,
+ 90D9B10412E11DCB002D4255 /* glslang_lex.cpp in Sources */,
+ 90D9B10512E11DCB002D4255 /* glslang_tab.cpp in Sources */,
+ 90D9B10912E11DCB002D4255 /* SearchSymbol.cpp in Sources */,
+ 90D9B11312E11DD6002D4255 /* util.cpp in Sources */,
+ 90D9B11512E11DD6002D4255 /* ValidateLimitations.cpp in Sources */,
+ 90D9B11712E11DD6002D4255 /* VariableInfo.cpp in Sources */,
+ 90D9B11912E11DD6002D4255 /* VersionGLSL.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 5D7C59DB1208C6C3001C873E /* Production */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 5D7C59C61208C68B001C873E /* Base.xcconfig */;
+ buildSettings = {
+ };
+ name = Production;
+ };
+ 5D7C59DC1208C6C3001C873E /* Production */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */;
+ buildSettings = {
+ };
+ name = Production;
+ };
+ FB39D0711200ED9200088E69 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 5D7C59C71208C68B001C873E /* DebugRelease.xcconfig */;
+ buildSettings = {
+ GCC_OPTIMIZATION_LEVEL = 0;
+ };
+ name = Debug;
+ };
+ FB39D0721200ED9200088E69 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 5D7C59C71208C68B001C873E /* DebugRelease.xcconfig */;
+ buildSettings = {
+ };
+ name = Release;
+ };
+ FB39D0D21200F0E400088E69 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */;
+ buildSettings = {
+ };
+ name = Debug;
+ };
+ FB39D0D31200F0E400088E69 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */;
+ buildSettings = {
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ FB39D0731200ED9200088E69 /* Build configuration list for PBXProject "ANGLE" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ FB39D0711200ED9200088E69 /* Debug */,
+ FB39D0721200ED9200088E69 /* Release */,
+ 5D7C59DB1208C6C3001C873E /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+ FB39D0D61200F11E00088E69 /* Build configuration list for PBXNativeTarget "ANGLE" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ FB39D0D21200F0E400088E69 /* Debug */,
+ FB39D0D31200F0E400088E69 /* Release */,
+ 5D7C59DC1208C6C3001C873E /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = FB39D0701200ED9200088E69 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/ChangeLog b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/ChangeLog
new file mode 100644
index 0000000..f08cd49
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/ChangeLog
@@ -0,0 +1,1260 @@
+2011-05-04 David Kilzer <ddkilzer@apple.com>
+
+ Part 2 of 2: <http://webkit.org/b/56337> Enable -Werror on ANGLE
+
+ Reviewed by Adam Barth.
+
+ * Configurations/Base.xcconfig:
+ (GCC_TREAT_WARNINGS_AS_ERRORS): Set to YES.
+
+2011-05-04 David Kilzer <ddkilzer@apple.com>
+
+ Part 1 of 2: <http://webkit.org/b/56337> Enable -Werror on ANGLE
+
+ Merge ANGLE upstream commits r572, r573, r574, r575.
+
+ This unblocks enabling -Werror on ANGLE. Since all changes are
+ in the upstream repository, they may be safely overwritten
+ during the next ANGLE update.
+
+ * src/compiler/ConstantUnion.h:
+ (ConstantUnion::operator==): Added a default case.
+ * src/compiler/Intermediate.cpp:
+ (TIntermBinary::promote): Added parentheses.
+ * src/compiler/ParseHelper.cpp:
+ (TParseContext::precisionErrorCheck): Added a default case.
+ * src/compiler/PoolAlloc.cpp:
+ (TAllocation::checkGuardBlock): Changed '%u' to '%lu' for size_t
+ variable. Put for loop inside #ifdef GUARD_BLOCKS/#endif macros
+ to fix tautological-compare warning.
+ (TAllocation::checkAllocList): Added newline to end of file.
+
+2011-04-26 Dan Bernstein <mitz@apple.com>
+
+ Build fix.
+
+ * Configurations/CompilerVersion.xcconfig:
+
+2011-04-26 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Choose the compiler based on the Xcode version for Snow Leopard debug builds.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/CompilerVersion.xcconfig: Added.
+
+2011-03-17 Jeff Miller <jeffm@apple.com>
+
+ Use a consistent set of file patterns in the svn:ignore property for all .xcodeproj directories, specifically:
+
+ *.mode*
+ *.pbxuser
+ *.perspective*
+ project.xcworkspace
+ xcuserdata
+
+ * ANGLE.xcodeproj: Modified property svn:ignore.
+ * src/build_angle.xcodeproj: Modified property svn:ignore.
+
+2011-01-18 Kenneth Russell <kbr@google.com>
+
+ Unreviewed, Leopard build fix. Remove flex/bison targets for GLSL
+ grammar because the generated sources are already checked in.
+
+ * ANGLE.xcodeproj/project.pbxproj:
+ * src/build_angle.xcodeproj/project.pbxproj:
+
+2011-01-18 Kenneth Russell <kbr@google.com>
+
+ Unreviewed, release build fix. Explicitly cast away const.
+
+ * src/compiler/preprocessor/scanner.c:
+ (ScanFromString):
+
+2011-01-18 Ben Vanik <ben.vanik@gmail.com>
+
+ Reviewed by Kenneth Russell.
+
+ Updating ANGLE in WebKit to r533.
+ https://bugs.webkit.org/show_bug.cgi?id=47194
+
+ * ANGLE.xcodeproj/project.pbxproj:
+ * include/GLSLANG/ShaderLang.h:
+ * src/common/debug.cpp:
+ (gl::trace):
+ * src/common/debug.h:
+ * src/compiler/CodeGenGLSL.cpp:
+ (ConstructCompiler):
+ * src/compiler/CodeGenHLSL.cpp:
+ (ConstructCompiler):
+ * src/compiler/Common.h:
+ (EncodeSourceLoc):
+ (DecodeSourceLoc):
+ * src/compiler/Compiler.cpp: Added.
+ (TShHandleBase::TShHandleBase):
+ (TShHandleBase::~TShHandleBase):
+ (TCompiler::TCompiler):
+ (TCompiler::~TCompiler):
+ (TCompiler::Init):
+ (TCompiler::compile):
+ (TCompiler::InitBuiltInSymbolTable):
+ (TCompiler::clearResults):
+ (TCompiler::validateLimitations):
+ (TCompiler::collectAttribsUniforms):
+ * src/compiler/ExtensionBehavior.h: Added.
+ * src/compiler/InfoSink.cpp:
+ (TInfoSinkBase::location):
+ * src/compiler/InfoSink.h:
+ (TInfoSinkBase::size):
+ * src/compiler/Initialize.cpp:
+ (BuiltInFunctionsCommon):
+ (BuiltInFunctionsVertex):
+ (BuiltInFunctionsFragment):
+ (StandardUniforms):
+ (DefaultPrecisionVertex):
+ (DefaultPrecisionFragment):
+ (BuiltInConstants):
+ (TBuiltIns::initialize):
+ (IdentifyBuiltIns):
+ (InitExtensionBehavior):
+ * src/compiler/Initialize.h:
+ * src/compiler/IntermTraverse.cpp:
+ (TIntermLoop::traverse):
+ * src/compiler/Intermediate.cpp:
+ (getOperatorString):
+ (TIntermediate::addBinaryMath):
+ (TIntermediate::addLoop):
+ (TIntermediate::postProcess):
+ (TIntermBinary::promote):
+ * src/compiler/OutputGLSL.cpp:
+ (TOutputGLSL::visitUnary):
+ (TOutputGLSL::visitLoop):
+ * src/compiler/OutputHLSL.cpp:
+ (sh::OutputHLSL::OutputHLSL):
+ (sh::OutputHLSL::header):
+ (sh::OutputHLSL::visitBinary):
+ (sh::OutputHLSL::visitUnary):
+ (sh::OutputHLSL::visitAggregate):
+ (sh::OutputHLSL::visitLoop):
+ (sh::OutputHLSL::handleExcessiveLoop):
+ (sh::OutputHLSL::argumentString):
+ * src/compiler/OutputHLSL.h:
+ * src/compiler/ParseHelper.cpp:
+ (ReportInfo):
+ (DefineExtensionMacros):
+ (TParseContext::error):
+ (TParseContext::warning):
+ (TParseContext::reservedErrorCheck):
+ (TParseContext::constructorErrorCheck):
+ (TParseContext::arrayQualifierErrorCheck):
+ (TParseContext::extensionErrorCheck):
+ (TParseContext::areAllChildConst):
+ (PaParseStrings):
+ * src/compiler/ParseHelper.h:
+ (TParseContext::TParseContext):
+ * src/compiler/PoolAlloc.cpp:
+ (InitializeGlobalPools):
+ (FreeGlobalPools):
+ (SetGlobalPoolAllocator):
+ (TPoolAllocator::TPoolAllocator):
+ (TPoolAllocator::~TPoolAllocator):
+ (TAllocation::checkAllocList):
+ * src/compiler/PoolAlloc.h:
+ * src/compiler/SearchSymbol.cpp: Added.
+ (sh::SearchSymbol::SearchSymbol):
+ (sh::SearchSymbol::traverse):
+ (sh::SearchSymbol::visitSymbol):
+ (sh::SearchSymbol::foundMatch):
+ * src/compiler/SearchSymbol.h: Added.
+ * src/compiler/ShHandle.h:
+ (TCompiler::getAsCompiler):
+ (TCompiler::getInfoSink):
+ (TCompiler::getAttribs):
+ (TCompiler::getUniforms):
+ (TCompiler::getShaderType):
+ (TCompiler::getShaderSpec):
+ * src/compiler/ShaderLang.cpp:
+ (getVariableMaxLength):
+ (getVariableInfo):
+ (ShInitBuiltInResources):
+ (ShConstructCompiler):
+ (ShCompile):
+ (ShGetInfo):
+ (ShGetInfoLog):
+ (ShGetObjectCode):
+ (ShGetActiveAttrib):
+ (ShGetActiveUniform):
+ * src/compiler/SymbolTable.cpp:
+ (TSymbolTableLevel::relateToExtension):
+ * src/compiler/SymbolTable.h:
+ (TVariable::shareConstPointer):
+ (TFunction::relateToExtension):
+ (TFunction::getExtension):
+ (TFunction::getParamCount):
+ (TFunction::getParam):
+ (TSymbolTable::getGlobalLevel):
+ (TSymbolTable::relateToOperator):
+ (TSymbolTable::relateToExtension):
+ * src/compiler/TranslatorGLSL.cpp:
+ (writeVersion):
+ (TranslatorGLSL::TranslatorGLSL):
+ (TranslatorGLSL::translate):
+ * src/compiler/TranslatorGLSL.h:
+ * src/compiler/TranslatorHLSL.cpp:
+ (TranslatorHLSL::TranslatorHLSL):
+ (TranslatorHLSL::translate):
+ * src/compiler/TranslatorHLSL.h:
+ * src/compiler/Types.h:
+ (TType::TType):
+ * src/compiler/UnfoldSelect.cpp:
+ (sh::UnfoldSelect::visitSelection):
+ * src/compiler/UnfoldSelect.h:
+ * src/compiler/ValidateLimitations.cpp: Added.
+ (ValidateLimitations::ValidateLimitations):
+ (ValidateLimitations::visitSymbol):
+ (ValidateLimitations::visitConstantUnion):
+ (ValidateLimitations::visitBinary):
+ (ValidateLimitations::visitUnary):
+ (ValidateLimitations::visitSelection):
+ (ValidateLimitations::visitAggregate):
+ (ValidateLimitations::visitLoop):
+ (ValidateLimitations::visitBranch):
+ (ValidateLimitations::error):
+ (ValidateLimitations::withinLoopBody):
+ (ValidateLimitations::isLoopIndex):
+ (ValidateLimitations::validateLoopType):
+ (ValidateLimitations::validateForLoopHeader):
+ (ValidateLimitations::validateForLoopInit):
+ (ValidateLimitations::validateForLoopCond):
+ (ValidateLimitations::validateForLoopExpr):
+ (ValidateLimitations::validateFunctionCall):
+ (ValidateLimitations::validateOperation):
+ (ValidateLimitations::isConstExpr):
+ (ValidateLimitations::isConstIndexExpr):
+ (ValidateLimitations::validateIndexing):
+ * src/compiler/ValidateLimitations.h: Added.
+ (ValidateLimitations::numErrors):
+ * src/compiler/VariableInfo.cpp: Added.
+ (arrayBrackets):
+ (getVariableDataType):
+ (getVariableInfo):
+ (getBuiltInVariableInfo):
+ (getUserDefinedVariableInfo):
+ (CollectAttribsUniforms::CollectAttribsUniforms):
+ (CollectAttribsUniforms::visitSymbol):
+ (CollectAttribsUniforms::visitConstantUnion):
+ (CollectAttribsUniforms::visitBinary):
+ (CollectAttribsUniforms::visitUnary):
+ (CollectAttribsUniforms::visitSelection):
+ (CollectAttribsUniforms::visitAggregate):
+ (CollectAttribsUniforms::visitLoop):
+ (CollectAttribsUniforms::visitBranch):
+ * src/compiler/VariableInfo.h: Added.
+ * src/compiler/VersionGLSL.cpp: Added.
+ (TVersionGLSL::TVersionGLSL):
+ (TVersionGLSL::visitSymbol):
+ (TVersionGLSL::visitConstantUnion):
+ (TVersionGLSL::visitBinary):
+ (TVersionGLSL::visitUnary):
+ (TVersionGLSL::visitSelection):
+ (TVersionGLSL::visitAggregate):
+ (TVersionGLSL::visitLoop):
+ (TVersionGLSL::visitBranch):
+ (TVersionGLSL::updateVersion):
+ * src/compiler/VersionGLSL.h: Added.
+ (TVersionGLSL::getVersion):
+ * src/compiler/generate_glslang_lexer.sh: Added.
+ * src/compiler/generate_glslang_parser.sh: Added.
+ * src/compiler/glslang.h: Added.
+ * src/compiler/glslang.l:
+ * src/compiler/glslang.y:
+ * src/compiler/glslang_lex.cpp: Added.
+ (yy_get_next_buffer):
+ (yy_get_previous_state):
+ (yy_try_NUL_trans):
+ (input):
+ (yyrestart):
+ (yy_switch_to_buffer):
+ (yy_load_buffer_state):
+ (yy_create_buffer):
+ (yy_delete_buffer):
+ (yy_init_buffer):
+ (yy_flush_buffer):
+ (yypush_buffer_state):
+ (yypop_buffer_state):
+ (yyensure_buffer_stack):
+ (yy_scan_buffer):
+ (yy_scan_string):
+ (yy_scan_bytes):
+ (yy_push_state):
+ (yy_pop_state):
+ (yy_top_state):
+ (yy_fatal_error):
+ (yyget_extra):
+ (yyget_lineno):
+ (yyget_column):
+ (yyget_in):
+ (yyget_out):
+ (yyget_leng):
+ (yyget_text):
+ (yyset_extra):
+ (yyset_lineno):
+ (yyset_column):
+ (yyset_in):
+ (yyset_out):
+ (yyget_debug):
+ (yyset_debug):
+ (yyget_lval):
+ (yyset_lval):
+ (yylex_init):
+ (yylex_init_extra):
+ (yy_init_globals):
+ (yylex_destroy):
+ (yy_flex_strncpy):
+ (yy_flex_strlen):
+ (yyalloc):
+ (yyrealloc):
+ (yyfree):
+ (string_input):
+ (check_type):
+ (reserved_word):
+ (yyerror):
+ (glslang_initialize):
+ (glslang_finalize):
+ (glslang_scan):
+ * src/compiler/glslang_tab.cpp: Added.
+ (yytnamerr):
+ (yysyntax_error):
+ (glslang_parse):
+ * src/compiler/glslang_tab.h: Added.
+ * src/compiler/intermOut.cpp:
+ (TOutputTraverser::TOutputTraverser):
+ (OutputTreeText):
+ (TOutputTraverser::visitSymbol):
+ (TOutputTraverser::visitBinary):
+ (TOutputTraverser::visitUnary):
+ (TOutputTraverser::visitAggregate):
+ (TOutputTraverser::visitSelection):
+ (TOutputTraverser::visitConstantUnion):
+ (TOutputTraverser::visitLoop):
+ (TOutputTraverser::visitBranch):
+ (TIntermediate::outputTree):
+ * src/compiler/intermediate.h:
+ (TIntermLoop::TIntermLoop):
+ (TIntermLoop::getType):
+ (TIntermLoop::getInit):
+ (TIntermLoop::getCondition):
+ (TIntermLoop::getExpression):
+ (TIntermLoop::getBody):
+ * src/compiler/localintermediate.h:
+ * src/compiler/osinclude.h:
+ (OS_GetTLSValue):
+ * src/compiler/ossource_nspr.cpp: Added.
+ (OS_AllocTLSIndex):
+ (OS_SetTLSValue):
+ (OS_FreeTLSIndex):
+ * src/compiler/preprocessor/compile.h:
+ * src/compiler/preprocessor/cpp.c:
+ (CPPdefine):
+ (CPPelse):
+ (CPPif):
+ (CPPifdef):
+ (CPPerror):
+ (CPPextension):
+ (readCPPline):
+ * src/compiler/preprocessor/preprocess.h:
+ * src/compiler/preprocessor/scanner.c:
+ (str_getch):
+ (str_ungetch):
+ (ScanFromString):
+ (lFloatConst):
+ (byte_scan):
+ (yylex_CPP):
+ (check_EOF):
+ * src/compiler/preprocessor/scanner.h:
+ * src/compiler/preprocessor/tokens.c:
+ (RecordToken):
+ (ReadToken):
+ * src/compiler/tools: Removed.
+ * src/compiler/unistd.h: Removed.
+ * src/compiler/util.cpp: Added.
+ (atof_dot):
+ * src/compiler/util.h: Added.
+ * src/libEGL/Config.cpp:
+ (egl::Config::set):
+ * src/libEGL/Display.cpp:
+ (egl::Display::Display):
+ (egl::Display::initialize):
+ (egl::Display::terminate):
+ (egl::Display::createDevice):
+ (egl::Display::resetDevice):
+ (egl::Display::createContext):
+ (egl::Display::destroyContext):
+ (egl::Display::getMinSwapInterval):
+ (egl::Display::getMaxSwapInterval):
+ (egl::Display::getDevice):
+ (egl::Display::getFloatTextureSupport):
+ (egl::Display::getHalfFloatTextureSupport):
+ (egl::Display::getLuminanceTextureSupport):
+ (egl::Display::getLuminanceAlphaTextureSupport):
+ (egl::Display::getBufferPool):
+ (egl::Display::getEventQuerySupport):
+ (egl::Display::getDefaultPresentParameters):
+ * src/libEGL/Display.h:
+ * src/libEGL/Surface.cpp:
+ (egl::Surface::Surface):
+ (egl::Surface::~Surface):
+ (egl::Surface::release):
+ (egl::Surface::resetSwapChain):
+ (egl::Surface::writeRecordableFlipState):
+ (egl::Surface::restoreState):
+ (egl::SurfaceWindowProc):
+ (egl::Surface::subclassWindow):
+ (egl::Surface::unsubclassWindow):
+ (egl::Surface::checkForOutOfDateSwapChain):
+ (egl::Surface::convertInterval):
+ (egl::Surface::swap):
+ (egl::Surface::getRenderTarget):
+ (egl::Surface::setSwapInterval):
+ * src/libEGL/Surface.h:
+ * src/libEGL/libEGL.cpp:
+ * src/libGLESv2/Blit.cpp:
+ (gl::Blit::copySurfaceToTexture):
+ (gl::Blit::setCommonBlitState):
+ * src/libGLESv2/Buffer.cpp:
+ (gl::Buffer::Buffer):
+ (gl::Buffer::~Buffer):
+ (gl::Buffer::bufferData):
+ (gl::Buffer::bufferSubData):
+ (gl::Buffer::getVertexBuffer):
+ (gl::Buffer::getIndexBuffer):
+ (gl::Buffer::invalidateStaticData):
+ * src/libGLESv2/Buffer.h:
+ * src/libGLESv2/Context.cpp:
+ (gl::Context::Context):
+ (gl::Context::~Context):
+ (gl::Context::makeCurrent):
+ (gl::Context::markAllStateDirty):
+ (gl::Context::setFragmentShaderDerivativeHint):
+ (gl::Context::setEnableVertexAttribArray):
+ (gl::Context::getVertexAttribState):
+ (gl::Context::getVertexAttributes):
+ (gl::Context::createFence):
+ (gl::Context::deleteFence):
+ (gl::Context::bindTexture2D):
+ (gl::Context::bindTextureCubeMap):
+ (gl::Context::getFence):
+ (gl::Context::getTexture2D):
+ (gl::Context::getTextureCubeMap):
+ (gl::Context::getSamplerTexture):
+ (gl::Context::getBooleanv):
+ (gl::Context::getIntegerv):
+ (gl::Context::getQueryParameterInfo):
+ (gl::Context::applyRenderTarget):
+ (gl::Context::applyState):
+ (gl::Context::lookupAttributeMapping):
+ (gl::Context::applyVertexBuffer):
+ (gl::Context::applyIndexBuffer):
+ (gl::Context::readPixels):
+ (gl::Context::clear):
+ (gl::Context::drawArrays):
+ (gl::Context::drawElements):
+ (gl::Context::finish):
+ (gl::Context::drawClosingLine):
+ (gl::Context::getMaximumVaryingVectors):
+ (gl::Context::getMaximumFragmentUniformVectors):
+ (gl::Context::supportsEventQueries):
+ (gl::Context::supportsFloatTextures):
+ (gl::Context::supportsFloatLinearFilter):
+ (gl::Context::supportsFloatRenderableTextures):
+ (gl::Context::supportsHalfFloatTextures):
+ (gl::Context::supportsHalfFloatLinearFilter):
+ (gl::Context::supportsHalfFloatRenderableTextures):
+ (gl::Context::getMaximumRenderbufferDimension):
+ (gl::Context::getMaximumTextureDimension):
+ (gl::Context::getMaximumCubeTextureDimension):
+ (gl::Context::getMaximumTextureLevel):
+ (gl::Context::supportsLuminanceTextures):
+ (gl::Context::supportsLuminanceAlphaTextures):
+ (gl::Context::supports32bitIndices):
+ (gl::Context::getIncompleteTexture):
+ (gl::Context::setVertexAttrib):
+ (gl::Context::initExtensionString):
+ (gl::Context::blitFramebuffer):
+ * src/libGLESv2/Context.h:
+ (gl::VertexAttribute::VertexAttribute):
+ (gl::VertexAttribute::typeSize):
+ (gl::VertexAttribute::stride):
+ * src/libGLESv2/Fence.cpp: Added.
+ (gl::Fence::Fence):
+ (gl::Fence::~Fence):
+ (gl::Fence::isFence):
+ (gl::Fence::setFence):
+ (gl::Fence::testFence):
+ (gl::Fence::finishFence):
+ (gl::Fence::getFenceiv):
+ * src/libGLESv2/Fence.h: Added.
+ * src/libGLESv2/Framebuffer.cpp:
+ (gl::Framebuffer::completeness):
+ (gl::DefaultFramebuffer::DefaultFramebuffer):
+ (gl::DefaultFramebuffer::completeness):
+ * src/libGLESv2/Program.cpp:
+ (gl::Program::Program):
+ (gl::Program::getSamplerMapping):
+ (gl::Program::getUniformLocation):
+ (gl::Program::setUniform1iv):
+ (gl::Program::applyUniforms):
+ (gl::Program::packVaryings):
+ (gl::Program::linkVaryings):
+ (gl::Program::link):
+ (gl::Program::defineUniform):
+ (gl::Program::createUniform):
+ (gl::Program::applyUniform1iv):
+ (gl::Program::resetInfoLog):
+ (gl::Program::unlink):
+ (gl::Program::getActiveAttribute):
+ (gl::Program::getActiveUniform):
+ (gl::Program::getDxDepthRangeLocation):
+ * src/libGLESv2/Program.h:
+ * src/libGLESv2/RefCountObject.cpp:
+ (gl::RefCountObject::~RefCountObject):
+ * src/libGLESv2/Renderbuffer.cpp:
+ (gl::RenderbufferStorage::RenderbufferStorage):
+ (gl::RenderbufferStorage::isFloatingPoint):
+ (gl::Colorbuffer::Colorbuffer):
+ (gl::DepthStencilbuffer::DepthStencilbuffer):
+ * src/libGLESv2/Renderbuffer.h:
+ * src/libGLESv2/Shader.cpp:
+ (gl::Shader::Shader):
+ (gl::Shader::parseVaryings):
+ (gl::Shader::compileToHLSL):
+ (gl::VertexShader::parseAttributes):
+ * src/libGLESv2/Texture.cpp:
+ (gl::Texture::Texture):
+ (gl::Texture::isFloatingPoint):
+ (gl::Texture::isRenderableFormat):
+ (gl::Texture::selectFormat):
+ (gl::Texture::loadImageData):
+ (gl::Texture::loadAlphaFloatImageData):
+ (gl::Texture::loadAlphaHalfFloatImageData):
+ (gl::Texture::loadLuminanceImageData):
+ (gl::Texture::loadLuminanceFloatImageData):
+ (gl::Texture::loadLuminanceHalfFloatImageData):
+ (gl::Texture::loadLuminanceAlphaImageData):
+ (gl::Texture::loadLuminanceAlphaFloatImageData):
+ (gl::Texture::loadLuminanceAlphaHalfFloatImageData):
+ (gl::Texture::loadRGBFloatImageData):
+ (gl::Texture::loadRGBHalfFloatImageData):
+ (gl::Texture::loadRGBAFloatImageData):
+ (gl::Texture::loadRGBAHalfFloatImageData):
+ (gl::Texture::createSurface):
+ (gl::Texture::setImage):
+ (gl::Texture::setCompressedImage):
+ (gl::Texture::subImage):
+ (gl::Texture::subImageCompressed):
+ (gl::Texture::copyNonRenderable):
+ (gl::Texture::getD3DFormat):
+ (gl::Texture::isRenderable):
+ (gl::Texture2D::Texture2D):
+ (gl::Texture2D::~Texture2D):
+ (gl::Texture2D::redefineTexture):
+ (gl::Texture2D::setImage):
+ (gl::Texture2D::setCompressedImage):
+ (gl::Texture2D::copyImage):
+ (gl::Texture2D::copySubImage):
+ (gl::Texture2D::isComplete):
+ (gl::Texture2D::createTexture):
+ (gl::Texture2D::convertToRenderTarget):
+ (gl::Texture2D::generateMipmaps):
+ (gl::Texture2D::getColorbuffer):
+ (gl::Texture2D::getRenderTarget):
+ (gl::TextureCubeMap::TextureCubeMap):
+ (gl::TextureCubeMap::~TextureCubeMap):
+ (gl::TextureCubeMap::subImage):
+ (gl::TextureCubeMap::subImageCompressed):
+ (gl::TextureCubeMap::isComplete):
+ (gl::TextureCubeMap::createTexture):
+ (gl::TextureCubeMap::convertToRenderTarget):
+ (gl::TextureCubeMap::redefineTexture):
+ (gl::TextureCubeMap::copyImage):
+ (gl::TextureCubeMap::copySubImage):
+ (gl::TextureCubeMap::generateMipmaps):
+ (gl::TextureCubeMap::getColorbuffer):
+ (gl::TextureCubeMap::getRenderTarget):
+ (gl::Texture::TextureColorbufferProxy::TextureColorbufferProxy):
+ (gl::Texture::TextureColorbufferProxy::isFloatingPoint):
+ * src/libGLESv2/Texture.h:
+ * src/libGLESv2/geometry/IndexDataManager.cpp:
+ (gl::IndexDataManager::IndexDataManager):
+ (gl::IndexDataManager::~IndexDataManager):
+ (gl::convertIndices):
+ (gl::computeRange):
+ (gl::IndexDataManager::prepareIndexData):
+ (gl::IndexDataManager::indexSize):
+ (gl::IndexDataManager::typeSize):
+ (gl::IndexBuffer::IndexBuffer):
+ (gl::IndexBuffer::~IndexBuffer):
+ (gl::IndexBuffer::getBuffer):
+ (gl::IndexBuffer::unmap):
+ (gl::StreamingIndexBuffer::StreamingIndexBuffer):
+ (gl::StreamingIndexBuffer::~StreamingIndexBuffer):
+ (gl::StreamingIndexBuffer::map):
+ (gl::StreamingIndexBuffer::reserveSpace):
+ (gl::StaticIndexBuffer::StaticIndexBuffer):
+ (gl::StaticIndexBuffer::~StaticIndexBuffer):
+ (gl::StaticIndexBuffer::map):
+ (gl::StaticIndexBuffer::reserveSpace):
+ (gl::StaticIndexBuffer::lookupType):
+ (gl::StaticIndexBuffer::lookupRange):
+ (gl::StaticIndexBuffer::addRange):
+ * src/libGLESv2/geometry/IndexDataManager.h:
+ (gl::IndexBuffer::size):
+ * src/libGLESv2/geometry/VertexDataManager.cpp:
+ (gl::VertexDataManager::VertexDataManager):
+ (gl::VertexDataManager::~VertexDataManager):
+ (gl::VertexDataManager::writeAttributeData):
+ (gl::VertexDataManager::prepareVertexData):
+ (gl::VertexDataManager::spaceRequired):
+ (gl::VertexDataManager::checkVertexCaps):
+ (gl::VertexDataManager::typeIndex):
+ (gl::VertexDataManager::setupAttributes):
+ (gl::VertexBuffer::VertexBuffer):
+ (gl::VertexBuffer::~VertexBuffer):
+ (gl::VertexBuffer::unmap):
+ (gl::VertexBuffer::getBuffer):
+ (gl::ConstantVertexBuffer::ConstantVertexBuffer):
+ (gl::ConstantVertexBuffer::~ConstantVertexBuffer):
+ (gl::ArrayVertexBuffer::ArrayVertexBuffer):
+ (gl::ArrayVertexBuffer::~ArrayVertexBuffer):
+ (gl::ArrayVertexBuffer::addRequiredSpace):
+ (gl::ArrayVertexBuffer::addRequiredSpaceFor):
+ (gl::StreamingVertexBuffer::StreamingVertexBuffer):
+ (gl::StreamingVertexBuffer::~StreamingVertexBuffer):
+ (gl::StreamingVertexBuffer::map):
+ (gl::StreamingVertexBuffer::reserveRequiredSpace):
+ (gl::StaticVertexBuffer::StaticVertexBuffer):
+ (gl::StaticVertexBuffer::~StaticVertexBuffer):
+ (gl::StaticVertexBuffer::map):
+ (gl::StaticVertexBuffer::reserveRequiredSpace):
+ (gl::StaticVertexBuffer::lookupAttribute):
+ (gl::VertexDataManager::formatConverter):
+ * src/libGLESv2/geometry/VertexDataManager.h:
+ (gl::ArrayVertexBuffer::size):
+ (gl::VertexDataManager::dirtyCurrentValue):
+ * src/libGLESv2/geometry/backend.cpp: Removed.
+ * src/libGLESv2/geometry/backend.h: Removed.
+ * src/libGLESv2/geometry/dx9.cpp: Removed.
+ * src/libGLESv2/geometry/dx9.h: Removed.
+ * src/libGLESv2/libGLESv2.cpp:
+ * src/libGLESv2/libGLESv2.def:
+ * src/libGLESv2/libGLESv2.vcproj:
+ * src/libGLESv2/utilities.cpp:
+ (gl::UniformComponentCount):
+ (gl::UniformComponentType):
+ (gl::ComputePixelSize):
+ (gl::CheckTextureFormatType):
+ (gl::IsColorRenderable):
+ (gl::IsDepthRenderable):
+ (gl::IsStencilRenderable):
+ (es2dx::GetAlphaSize):
+ (es2dx::GetRedSize):
+ (es2dx::GetGreenSize):
+ (es2dx::GetBlueSize):
+ (es2dx::GetDepthSize):
+ (es2dx::ConvertPrimitiveType):
+ (dx2es::ConvertBackBufferFormat):
+ (dx2es::ConvertDepthStencilFormat):
+ * src/libGLESv2/utilities.h:
+
+2011-01-17 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Update xcodeproj svn:ignore to include xcuserdata.
+
+ * ANGLE.xcodeproj: Modified property svn:ignore.
+ * src/build_angle.xcodeproj: Modified property svn:ignore.
+
+2010-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
+
+ * src/libEGL/libEGL.vcproj: Added property svn:eol-style.
+ * src/libGLESv2/libGLESv2.vcproj: Added property svn:eol-style.
+
+2010-11-03 Darin Adler <darin@apple.com>
+
+ Updated Xcode projects by opening them with Xcode 3.2.4.
+ Updated svn:ignore for Xcode projects.
+
+ * ANGLE.xcodeproj: Added property svn:ignore.
+ * ANGLE.xcodeproj/project.pbxproj: Updated with Xcode 3.2.4.
+ * src/build_angle.xcodeproj: Added property svn:ignore.
+ * src/build_angle.xcodeproj/project.pbxproj: Updated with Xcode 3.2.4.
+
+2010-09-01 Zhenyao Mo <zmo@google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Roll ANGLE under webkit to r402
+ https://bugs.webkit.org/show_bug.cgi?id=45004
+
+ * ANGLE.xcodeproj/project.pbxproj:
+ * include/GLES2/gl2ext.h:
+ * include/GLSLANG/ResourceLimits.h: Removed.
+ * include/GLSLANG/ShaderLang.h:
+ * src/compiler/BaseTypes.h:
+ (getPrecisionString):
+ (getBasicString):
+ (IsSampler):
+ (getQualifierString):
+ * src/compiler/Initialize.cpp:
+ (BuiltInConstants):
+ (IdentifyBuiltIns):
+ * src/compiler/Initialize.h:
+ * src/compiler/InitializeDll.cpp:
+ (InitProcess):
+ (DetachProcess):
+ (InitThread):
+ (DetachThread):
+ * src/compiler/InitializeDll.h:
+ * src/compiler/InitializeParseContext.h:
+ * src/compiler/Intermediate.cpp:
+ (GetHigherPrecision):
+ (TIntermediate::addBinaryMath):
+ (TIntermediate::setAggregateOperator):
+ (TIntermediate::addComma):
+ (TIntermediate::postProcess):
+ (TIntermBinary::promote):
+ (CompareStruct):
+ * src/compiler/OutputGLSL.cpp:
+ (TOutputGLSL::writeFunctionParameters):
+ (TOutputGLSL::visitUnary):
+ (TOutputGLSL::visitBranch):
+ * src/compiler/OutputHLSL.cpp:
+ (sh::OutputHLSL::header):
+ (sh::OutputHLSL::visitBinary):
+ (sh::OutputHLSL::visitAggregate):
+ (sh::OutputHLSL::handleExcessiveLoop):
+ (sh::OutputHLSL::addConstructor):
+ * src/compiler/ParseHelper.cpp:
+ (TParseContext::constructorErrorCheck):
+ (TParseContext::samplerErrorCheck):
+ (TParseContext::paramErrorCheck):
+ (TParseContext::findFunction):
+ (TParseContext::executeInitializer):
+ (TParseContext::addConstructor):
+ (TParseContext::addConstStruct):
+ (FreeParseContextIndex):
+ (GetGlobalParseContext):
+ * src/compiler/PoolAlloc.h:
+ (TPoolAllocator::tHeader::tHeader):
+ (pool_allocator::allocate):
+ (pool_allocator::deallocate):
+ * src/compiler/ShaderLang.cpp:
+ (ShInitialize):
+ (ShFinalize):
+ (ShInitBuiltInResource):
+ * src/compiler/SymbolTable.cpp:
+ (TType::getStructSize):
+ * src/compiler/SymbolTable.h:
+ (TVariable::setQualifier):
+ * src/compiler/Types.h:
+ (TType::TType):
+ (TType::getBasicType):
+ (TType::setBasicType):
+ (TType::getPrecision):
+ (TType::setPrecision):
+ (TType::getQualifier):
+ (TType::setQualifier):
+ (TType::getNominalSize):
+ (TType::setNominalSize):
+ (TType::isMatrix):
+ (TType::setMatrix):
+ (TType::isArray):
+ (TType::getArraySize):
+ (TType::setArraySize):
+ (TType::getMaxArraySize):
+ (TType::setMaxArraySize):
+ (TType::clearArrayness):
+ (TType::setArrayInformationType):
+ (TType::getArrayInformationType):
+ (TType::isVector):
+ (TType::isScalar):
+ (TType::setStruct):
+ (TType::getTypeName):
+ (TType::setTypeName):
+ (TType::isField):
+ (TType::getFieldName):
+ (TType::setFieldName):
+ (TType::getBasicString):
+ (TType::getPrecisionString):
+ (TType::getQualifierString):
+ * src/compiler/glslang.l:
+ * src/compiler/glslang.y:
+ * src/compiler/intermediate.h:
+ (TIntermNode::getLine):
+ (TIntermNode::setLine):
+ (TIntermTyped::getAsTyped):
+ (TIntermTyped::setType):
+ (TIntermTyped::getType):
+ (TIntermTyped::getTypePointer):
+ (TIntermTyped::getBasicType):
+ (TIntermTyped::getQualifier):
+ (TIntermTyped::getPrecision):
+ (TIntermTyped::getNominalSize):
+ (TIntermTyped::isMatrix):
+ (TIntermTyped::isArray):
+ (TIntermTyped::isVector):
+ (TIntermTyped::isScalar):
+ (TIntermTyped::getBasicString):
+ (TIntermTyped::getQualifierString):
+ (TIntermSymbol::getId):
+ (TIntermSymbol::getSymbol):
+ (TIntermOperator::setOp):
+ (TIntermBinary::setLeft):
+ (TIntermBinary::setRight):
+ (TIntermBinary::getLeft):
+ (TIntermBinary::getRight):
+ (TIntermUnary::setOperand):
+ (TIntermUnary::getOperand):
+ (TIntermAggregate::getAsAggregate):
+ (TIntermAggregate::getSequence):
+ (TIntermAggregate::setName):
+ (TIntermAggregate::getName):
+ (TIntermAggregate::setUserDefined):
+ (TIntermAggregate::isUserDefined):
+ (TIntermAggregate::getQualifier):
+ (TIntermAggregate::setOptimize):
+ (TIntermAggregate::setDebug):
+ (TIntermSelection::getCondition):
+ (TIntermSelection::getTrueBlock):
+ (TIntermSelection::getFalseBlock):
+ (TIntermSelection::getAsSelectionNode):
+ * src/compiler/parseConst.cpp:
+ (TConstTraverser::TConstTraverser):
+ * src/compiler/preprocessor/atom.c:
+ (InitAtomTable):
+ * src/compiler/preprocessor/atom.h:
+ * src/compiler/preprocessor/compile.h:
+ * src/compiler/preprocessor/cpp.c:
+ * src/compiler/preprocessor/cpp.h:
+ * src/compiler/preprocessor/cppstruct.c:
+ * src/compiler/preprocessor/memory.c:
+ * src/compiler/preprocessor/memory.h:
+ * src/compiler/preprocessor/parser.h:
+ * src/compiler/preprocessor/preprocess.h:
+ * src/compiler/preprocessor/scanner.c:
+ * src/compiler/preprocessor/scanner.h:
+ * src/compiler/preprocessor/slglobals.h:
+ * src/compiler/preprocessor/symbols.c:
+ (NewSymbol):
+ * src/compiler/preprocessor/symbols.h:
+ * src/compiler/preprocessor/tokens.c:
+ (RecordToken):
+ * src/compiler/preprocessor/tokens.h:
+ * src/libEGL/Display.cpp:
+ (egl::Display::Display):
+ (egl::Display::initialize):
+ (egl::Display::terminate):
+ (egl::Display::createDevice):
+ (egl::Display::createWindowSurface):
+ (egl::Display::createContext):
+ (egl::Display::getMultiSampleSupport):
+ (egl::Display::getCompressedTextureSupport):
+ * src/libEGL/Display.h:
+ * src/libEGL/Surface.cpp:
+ (egl::Surface::Surface):
+ (egl::Surface::resetSwapChain):
+ (egl::Surface::getWindowHandle):
+ (egl::Surface::writeRecordableFlipState):
+ (egl::Surface::applyFlipState):
+ (egl::Surface::releaseRecordedState):
+ (egl::Surface::checkForWindowResize):
+ (egl::Surface::swap):
+ * src/libEGL/Surface.h:
+ * src/libEGL/libEGL.cpp:
+ * src/libEGL/libEGL.vcproj:
+ * src/libGLESv2/Blit.cpp:
+ (gl::Blit::setVertexShader):
+ (gl::Blit::setPixelShader):
+ (gl::Blit::setFormatConvertShaders):
+ * src/libGLESv2/Buffer.cpp:
+ (gl::Buffer::Buffer):
+ * src/libGLESv2/Buffer.h:
+ * src/libGLESv2/Context.cpp:
+ (gl::Context::Context):
+ (gl::Context::~Context):
+ (gl::Context::makeCurrent):
+ (gl::Context::markAllStateDirty):
+ (gl::Context::getReadFramebufferHandle):
+ (gl::Context::getDrawFramebufferHandle):
+ (gl::Context::getRenderbufferHandle):
+ (gl::Context::getArrayBufferHandle):
+ (gl::Context::setVertexAttribState):
+ (gl::Context::createBuffer):
+ (gl::Context::createProgram):
+ (gl::Context::createShader):
+ (gl::Context::createTexture):
+ (gl::Context::createRenderbuffer):
+ (gl::Context::deleteBuffer):
+ (gl::Context::deleteShader):
+ (gl::Context::deleteProgram):
+ (gl::Context::deleteTexture):
+ (gl::Context::deleteRenderbuffer):
+ (gl::Context::getBuffer):
+ (gl::Context::getShader):
+ (gl::Context::getProgram):
+ (gl::Context::getTexture):
+ (gl::Context::getRenderbuffer):
+ (gl::Context::getReadFramebuffer):
+ (gl::Context::getDrawFramebuffer):
+ (gl::Context::bindArrayBuffer):
+ (gl::Context::bindElementArrayBuffer):
+ (gl::Context::bindTexture2D):
+ (gl::Context::bindTextureCubeMap):
+ (gl::Context::bindReadFramebuffer):
+ (gl::Context::bindDrawFramebuffer):
+ (gl::Context::bindRenderbuffer):
+ (gl::Context::useProgram):
+ (gl::Context::setFramebufferZero):
+ (gl::Context::setRenderbufferStorage):
+ (gl::Context::getFramebuffer):
+ (gl::Context::getArrayBuffer):
+ (gl::Context::getElementArrayBuffer):
+ (gl::Context::getCurrentProgram):
+ (gl::Context::getTexture2D):
+ (gl::Context::getTextureCubeMap):
+ (gl::Context::getSamplerTexture):
+ (gl::Context::getFloatv):
+ (gl::Context::getIntegerv):
+ (gl::Context::getQueryParameterInfo):
+ (gl::Context::applyRenderTarget):
+ (gl::Context::applyState):
+ (gl::Context::applyIndexBuffer):
+ (gl::Context::readPixels):
+ (gl::Context::clear):
+ (gl::Context::finish):
+ (gl::Context::flush):
+ (gl::Context::supportsShaderModel3):
+ (gl::Context::getMaxSupportedSamples):
+ (gl::Context::getNearestSupportedSamples):
+ (gl::Context::supportsCompressedTextures):
+ (gl::Context::detachBuffer):
+ (gl::Context::detachTexture):
+ (gl::Context::detachFramebuffer):
+ (gl::Context::detachRenderbuffer):
+ (gl::Context::getIncompleteTexture):
+ (gl::Context::initExtensionString):
+ (gl::Context::blitFramebuffer):
+ * src/libGLESv2/Context.h:
+ (gl::AttributeState::AttributeState):
+ * src/libGLESv2/Framebuffer.cpp:
+ (gl::Framebuffer::Framebuffer):
+ (gl::Framebuffer::~Framebuffer):
+ (gl::Framebuffer::lookupRenderbuffer):
+ (gl::Framebuffer::setColorbuffer):
+ (gl::Framebuffer::setDepthbuffer):
+ (gl::Framebuffer::setStencilbuffer):
+ (gl::Framebuffer::detachTexture):
+ (gl::Framebuffer::detachRenderbuffer):
+ (gl::Framebuffer::getRenderTargetSerial):
+ (gl::Framebuffer::getRenderTarget):
+ (gl::Framebuffer::getDepthStencil):
+ (gl::Framebuffer::getDepthbufferSerial):
+ (gl::Framebuffer::getStencilbufferSerial):
+ (gl::Framebuffer::getColorbuffer):
+ (gl::Framebuffer::getDepthbuffer):
+ (gl::Framebuffer::getStencilbuffer):
+ (gl::Framebuffer::getColorbufferHandle):
+ (gl::Framebuffer::getDepthbufferHandle):
+ (gl::Framebuffer::getStencilbufferHandle):
+ (gl::Framebuffer::hasStencil):
+ (gl::Framebuffer::isMultisample):
+ (gl::Framebuffer::completeness):
+ (gl::DefaultFramebuffer::DefaultFramebuffer):
+ (gl::Framebuffer::getSamples):
+ (gl::DefaultFramebuffer::completeness):
+ * src/libGLESv2/Framebuffer.h:
+ * src/libGLESv2/Program.cpp:
+ (gl::Program::Program):
+ (gl::Program::~Program):
+ (gl::Program::attachShader):
+ (gl::Program::detachShader):
+ (gl::Program::linkVaryings):
+ (gl::Program::link):
+ (gl::Program::unlink):
+ (gl::Program::release):
+ (gl::Program::addRef):
+ (gl::Program::getRefCount):
+ (gl::Program::getDxViewportLocation):
+ * src/libGLESv2/Program.h:
+ * src/libGLESv2/RefCountObject.cpp: Added.
+ (gl::RefCountObject::RefCountObject):
+ (gl::RefCountObject::~RefCountObject):
+ (gl::RefCountObject::addRef):
+ (gl::RefCountObject::release):
+ (gl::RefCountObjectBindingPointer::set):
+ * src/libGLESv2/RefCountObject.h: Added.
+ (gl::RefCountObject::id):
+ (gl::RefCountObjectBindingPointer::RefCountObjectBindingPointer):
+ (gl::RefCountObjectBindingPointer::~RefCountObjectBindingPointer):
+ (gl::RefCountObjectBindingPointer::get):
+ (gl::RefCountObjectBindingPointer::id):
+ (gl::RefCountObjectBindingPointer::operator ! ):
+ (gl::BindingPointer::set):
+ (gl::BindingPointer::get):
+ (gl::BindingPointer::operator -> ):
+ * src/libGLESv2/Renderbuffer.cpp:
+ (gl::Renderbuffer::Renderbuffer):
+ (gl::Renderbuffer::~Renderbuffer):
+ (gl::Renderbuffer::isColorbuffer):
+ (gl::Renderbuffer::isDepthbuffer):
+ (gl::Renderbuffer::isStencilbuffer):
+ (gl::Renderbuffer::getRenderTarget):
+ (gl::Renderbuffer::getDepthStencil):
+ (gl::Renderbuffer::getWidth):
+ (gl::Renderbuffer::getHeight):
+ (gl::Renderbuffer::getFormat):
+ (gl::Renderbuffer::getD3DFormat):
+ (gl::Renderbuffer::getSerial):
+ (gl::Renderbuffer::setStorage):
+ (gl::RenderbufferStorage::RenderbufferStorage):
+ (gl::RenderbufferStorage::~RenderbufferStorage):
+ (gl::RenderbufferStorage::isColorbuffer):
+ (gl::RenderbufferStorage::isDepthbuffer):
+ (gl::RenderbufferStorage::isStencilbuffer):
+ (gl::RenderbufferStorage::getRenderTarget):
+ (gl::RenderbufferStorage::getDepthStencil):
+ (gl::RenderbufferStorage::getWidth):
+ (gl::RenderbufferStorage::getHeight):
+ (gl::RenderbufferStorage::setSize):
+ (gl::RenderbufferStorage::getFormat):
+ (gl::RenderbufferStorage::getD3DFormat):
+ (gl::RenderbufferStorage::getSamples):
+ (gl::RenderbufferStorage::getSerial):
+ (gl::RenderbufferStorage::issueSerial):
+ (gl::Colorbuffer::Colorbuffer):
+ (gl::Colorbuffer::isColorbuffer):
+ (gl::Colorbuffer::getRedSize):
+ (gl::Colorbuffer::getGreenSize):
+ (gl::Colorbuffer::getBlueSize):
+ (gl::Colorbuffer::getAlphaSize):
+ (gl::DepthStencilbuffer::DepthStencilbuffer):
+ (gl::DepthStencilbuffer::~DepthStencilbuffer):
+ (gl::DepthStencilbuffer::isDepthbuffer):
+ (gl::DepthStencilbuffer::isStencilbuffer):
+ (gl::DepthStencilbuffer::getDepthSize):
+ (gl::DepthStencilbuffer::getStencilSize):
+ (gl::DepthStencilbuffer::getDepthStencil):
+ (gl::Depthbuffer::Depthbuffer):
+ (gl::Depthbuffer::~Depthbuffer):
+ (gl::Depthbuffer::isDepthbuffer):
+ (gl::Depthbuffer::isStencilbuffer):
+ (gl::Stencilbuffer::Stencilbuffer):
+ (gl::Stencilbuffer::~Stencilbuffer):
+ (gl::Stencilbuffer::isDepthbuffer):
+ (gl::Stencilbuffer::isStencilbuffer):
+ * src/libGLESv2/Renderbuffer.h:
+ (gl::Renderbuffer::getStorage):
+ * src/libGLESv2/ResourceManager.cpp: Added.
+ (gl::ResourceManager::ResourceManager):
+ (gl::ResourceManager::~ResourceManager):
+ (gl::ResourceManager::addRef):
+ (gl::ResourceManager::release):
+ (gl::ResourceManager::createBuffer):
+ (gl::ResourceManager::createShader):
+ (gl::ResourceManager::createProgram):
+ (gl::ResourceManager::createTexture):
+ (gl::ResourceManager::createRenderbuffer):
+ (gl::ResourceManager::deleteBuffer):
+ (gl::ResourceManager::deleteShader):
+ (gl::ResourceManager::deleteProgram):
+ (gl::ResourceManager::deleteTexture):
+ (gl::ResourceManager::deleteRenderbuffer):
+ (gl::ResourceManager::getBuffer):
+ (gl::ResourceManager::getShader):
+ (gl::ResourceManager::getTexture):
+ (gl::ResourceManager::getProgram):
+ (gl::ResourceManager::getRenderbuffer):
+ (gl::ResourceManager::setRenderbuffer):
+ (gl::ResourceManager::checkBufferAllocation):
+ (gl::ResourceManager::checkTextureAllocation):
+ (gl::ResourceManager::checkRenderbufferAllocation):
+ * src/libGLESv2/ResourceManager.h: Added.
+ * src/libGLESv2/Shader.cpp:
+ (gl::Shader::Shader):
+ (gl::Shader::addRef):
+ (gl::Shader::release):
+ (gl::Shader::getRefCount):
+ (gl::Shader::parseVaryings):
+ (gl::VertexShader::VertexShader):
+ (gl::FragmentShader::FragmentShader):
+ * src/libGLESv2/Shader.h:
+ * src/libGLESv2/Texture.cpp:
+ (gl::Texture::Image::Image):
+ (gl::Texture::Texture):
+ (gl::Texture::getBlitter):
+ (gl::Texture::selectFormat):
+ (gl::Texture::loadImageData):
+ (gl::Texture::loadAlphaImageData):
+ (gl::Texture::loadLuminanceImageData):
+ (gl::Texture::loadLuminanceAlphaImageData):
+ (gl::Texture::loadRGBUByteImageData):
+ (gl::Texture::loadRGB565ImageData):
+ (gl::Texture::loadRGBAUByteImageData):
+ (gl::Texture::loadRGBA4444ImageData):
+ (gl::Texture::loadRGBA5551ImageData):
+ (gl::Texture::loadBGRAImageData):
+ (gl::Texture::createSurface):
+ (gl::Texture::setImage):
+ (gl::Texture::setCompressedImage):
+ (gl::Texture::subImage):
+ (gl::Texture::subImageCompressed):
+ (gl::Texture2D::Texture2D):
+ (gl::Texture2D::getFormat):
+ (gl::Texture2D::setCompressedImage):
+ (gl::Texture2D::subImage):
+ (gl::Texture2D::subImageCompressed):
+ (gl::Texture2D::copyImage):
+ (gl::Texture2D::copySubImage):
+ (gl::Texture2D::isCompressed):
+ (gl::Texture2D::getColorbuffer):
+ (gl::TextureCubeMap::TextureCubeMap):
+ (gl::TextureCubeMap::getFormat):
+ (gl::TextureCubeMap::setCompressedImage):
+ (gl::TextureCubeMap::subImage):
+ (gl::TextureCubeMap::subImageCompressed):
+ (gl::TextureCubeMap::isCompressed):
+ (gl::TextureCubeMap::copyImage):
+ (gl::TextureCubeMap::copySubImage):
+ (gl::TextureCubeMap::getColorbuffer):
+ (gl::Texture::TextureColorbufferProxy::addRef):
+ (gl::Texture::TextureColorbufferProxy::release):
+ (gl::Texture::TextureColorbufferProxy::getWidth):
+ (gl::Texture::TextureColorbufferProxy::getHeight):
+ (gl::Texture::TextureColorbufferProxy::getFormat):
+ * src/libGLESv2/Texture.h:
+ * src/libGLESv2/libGLESv2.cpp:
+ * src/libGLESv2/libGLESv2.def:
+ * src/libGLESv2/libGLESv2.vcproj:
+ * src/libGLESv2/main.h:
+ * src/libGLESv2/utilities.cpp:
+ (gl::ComputeCompressedPitch):
+ (gl::ComputeCompressedSize):
+ (gl::IsCompressed):
+ (gl::ComputePixelSize):
+ (gl::CheckTextureFormatType):
+ (es2dx::ConvertRenderbufferFormat):
+ (es2dx::GetSamplesFromMultisampleType):
+ (es2dx::GetMultisampleTypeFromSamples):
+ * src/libGLESv2/utilities.h:
+
+2010-08-17 Chris Marrin <cmarrin@apple.com>
+
+ Unreviewed.
+
+ Moved previous link error fix to Base.xcconfig.
+
+ * ANGLE.xcodeproj/project.pbxproj:
+ * Configurations/Base.xcconfig:
+
+2010-08-17 Chris Marrin <cmarrin@apple.com>
+
+ Unreviewed.
+
+ Got rid of link errors in WebCore.
+
+ Changed GCC_INLINES_ARE_PRIVATE_EXTERN to YES and
+ GCC_SYMBOLS_PRIVATE_EXTERN to NO to match WebCore
+ flags.
+
+ * ANGLE.xcodeproj/project.pbxproj:
+
+2010-08-04 Kenneth Russell <kbr@google.com>
+
+ Reviewed by Dimitri Glazkov.
+
+ Update ANGLE to r352
+ https://bugs.webkit.org/show_bug.cgi?id=43500
+
+ Updated ANGLE to r352 (July 26, 2010). Built WebKit to test.
+
+ * include/GLSLANG/ShaderLang.h:
+ * src/compiler/Initialize.cpp:
+ (BuiltInFunctionsCommon):
+ (BuiltInFunctionsVertex):
+ (BuiltInFunctionsFragment):
+ (StandardUniforms):
+ (DefaultPrecisionVertex):
+ (DefaultPrecisionFragment):
+ (BuiltInConstants):
+ (TBuiltIns::initialize):
+ (IdentifyBuiltIns):
+ * src/compiler/Initialize.h:
+ (TBuiltIns::getBuiltInStrings):
+ * src/compiler/OutputGLSL.cpp:
+ (TOutputGLSL::visitSelection):
+ * src/compiler/ShHandle.h:
+ (TCompiler::getLanguage):
+ (TCompiler::getSpec):
+ (TCompiler::getSymbolTable):
+ (TCompiler::getInfoSink):
+ * src/compiler/ShaderLang.cpp:
+ (InitializeSymbolTable):
+ (GenerateBuiltInSymbolTable):
+ (ShInitialize):
+ (ShConstructCompiler):
+ (ShFinalize):
+ (ShCompile):
+ * src/compiler/SymbolTable.h:
+ (TSymbolTable::atBuiltInLevel):
+ (TSymbolTable::atGlobalLevel):
+ (TSymbolTable::push):
+ (TSymbolTable::getGlobalLevel):
+ (TSymbolTable::currentLevel):
+ * src/libGLESv2/Shader.cpp:
+ (gl::Shader::Shader):
+ (gl::Shader::compileToHLSL):
+
+2010-08-03 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Adele Peterson.
+
+ Remove some unnecessary files from the ANGLE tree.
+
+ * src/compiler/tools/COPYING.bison: Removed.
+ * src/compiler/tools/COPYING.flex: Removed.
+ * src/compiler/tools/README: Removed.
+ * src/compiler/tools/bison.hairy: Removed.
+ * src/compiler/tools/bison.simple: Removed.
+
+2010-08-03 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Adele Peterson.
+
+ Clean up the ANGLE Xcode project.
+
+ Main changes include:
+ • Adding a Production configuration.
+ • Modifying the library name from libangle.a to libANGLE.a.
+ • Installing the headers in a subdirectory of /usr/local/include to avoid polluting the top-level directory.
+ • Generating derived sources in to the built products directory so they're saved along with the symroot.
+ • Switching to using .xcconfig files for maximum cleanliness.
+
+ * ANGLE.xcodeproj/project.pbxproj:
+ * Configurations/ANGLE.xcconfig: Added.
+ * Configurations/Base.xcconfig: Added.
+ * Configurations/DebugRelease.xcconfig: Added.
+
+2010-08-02 Paul Sawaya <psawaya@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Add ANGLE library to WebKit. From the repository (http://angleproject.googlecode.com) as of July 22.
+ https://bugs.webkit.org/show_bug.cgi?id=42789
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/ANGLE.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/ANGLE.xcconfig
new file mode 100644
index 0000000..644b71d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/ANGLE.xcconfig
@@ -0,0 +1,5 @@
+PRODUCT_NAME = ANGLE;
+
+HEADER_SEARCH_PATHS = include src;
+INSTALL_PATH = /usr/local/lib;
+PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/ANGLE;
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig
new file mode 100644
index 0000000..598c75a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig
@@ -0,0 +1,40 @@
+#include "CompilerVersion.xcconfig"
+
+DEAD_CODE_STRIPPING = YES;
+DEBUG_INFORMATION_FORMAT = dwarf;
+GCC_C_LANGUAGE_STANDARD = gnu99;
+GCC_DEBUGGING_SYMBOLS = default;
+GCC_ENABLE_CPP_RTTI = NO;
+GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+GCC_ENABLE_OBJC_GC = supported;
+GCC_ENABLE_SYMBOL_SEPARATION = NO;
+GCC_FAST_OBJC_DISPATCH = YES;
+GCC_MODEL_TUNING = G5;
+GCC_OBJC_CALL_CXX_CDTORS = YES;
+GCC_OPTIMIZATION_LEVEL = s;
+GCC_PRECOMPILE_PREFIX_HEADER = NO;
+GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
+GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+GCC_THREADSAFE_STATICS = NO;
+GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
+LINKER_DISPLAYS_MANGLED_NAMES = YES;
+PREBINDING = NO;
+STRIP_INSTALLED_PRODUCT = NO;
+
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR);
+
+
+// FIXME: Disable C++ exceptions in the LLVM Compiler once it supports enabling Obj-C exceptions without C++ exceptions.
+GCC_ENABLE_CPP_EXCEPTIONS = $(GCC_ENABLE_CPP_EXCEPTIONS_$(TARGET_GCC_VERSION));
+GCC_ENABLE_CPP_EXCEPTIONS_GCC_40 = NO;
+GCC_ENABLE_CPP_EXCEPTIONS_GCC_42 = NO;
+GCC_ENABLE_CPP_EXCEPTIONS_LLVM_GCC = NO;
+GCC_ENABLE_CPP_EXCEPTIONS_LLVM_COMPILER = YES;
+
+// 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_1060_1050 = macosx10.5internal;
+SDKROOT_1070_1050 = macosx10.5internal;
+SDKROOT_1070_1060 = macosx10.6internal;
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/CompilerVersion.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/CompilerVersion.xcconfig
new file mode 100644
index 0000000..cb7e89d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/CompilerVersion.xcconfig
@@ -0,0 +1,56 @@
+// Copyright (C) 2009, 2010, 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.
+
+IS_XCODE_0400 = $(IS_XCODE_0400_$(XCODE_VERSION_MINOR));
+IS_XCODE_0400_0400 = 1;
+
+// 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_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+
+TARGET_GCC_VERSION_1050 = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_MINOR));
+TARGET_GCC_VERSION_1050_ = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_ACTUAL));
+TARGET_GCC_VERSION_1050_0310 = GCC_42;
+TARGET_GCC_VERSION_1050_0320 = GCC_42;
+
+TARGET_GCC_VERSION_1060 = $(TARGET_GCC_VERSION_1060_$(CONFIGURATION));
+TARGET_GCC_VERSION_1060_Debug = $(TARGET_GCC_VERSION_1060_Debug_$(XCODE_VERSION_MAJOR));
+TARGET_GCC_VERSION_1060_Debug_0300 = GCC_42;
+TARGET_GCC_VERSION_1060_Debug_0400 = $(TARGET_GCC_VERSION_1060_Debug_0400_$(IS_XCODE_0400));
+TARGET_GCC_VERSION_1060_Debug_0400_ = LLVM_COMPILER;
+TARGET_GCC_VERSION_1060_Debug_0400_1 = GCC_42;
+TARGET_GCC_VERSION_1060_Release = GCC_42;
+TARGET_GCC_VERSION_1060_Production = GCC_42;
+
+TARGET_GCC_VERSION_1070 = $(TARGET_GCC_VERSION_1070_$(CONFIGURATION));
+TARGET_GCC_VERSION_1070_Debug = LLVM_COMPILER;
+TARGET_GCC_VERSION_1070_Release = LLVM_GCC_42;
+TARGET_GCC_VERSION_1070_Production = 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;
+GCC_VERSION_LLVM_COMPILER = com.apple.compilers.llvm.clang.1_0;
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig
new file mode 100644
index 0000000..e34aa0d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig
@@ -0,0 +1,15 @@
+#include "Base.xcconfig"
+
+ARCHS = $(ARCHS_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+ARCHS_1050 = $(NATIVE_ARCH);
+ARCHS_1060 = $(ARCHS_STANDARD_32_64_BIT);
+ARCHS_1070 = $(ARCHS_STANDARD_32_64_BIT);
+
+ONLY_ACTIVE_ARCH = YES;
+
+MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+MACOSX_DEPLOYMENT_TARGET_1050 = 10.5;
+MACOSX_DEPLOYMENT_TARGET_1060 = 10.6;
+MACOSX_DEPLOYMENT_TARGET_1070 = 10.7;
+
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/egl.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/egl.h
new file mode 100644
index 0000000..99ea342
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/egl.h
@@ -0,0 +1,329 @@
+/* -*- mode: c; tab-width: 8; -*- */
+/* vi: set sw=4 ts=8: */
+/* Reference version of egl.h for EGL 1.4.
+ * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ */
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are 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 Materials.
+**
+** THE MATERIALS ARE 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+#ifndef __egl_h_
+#define __egl_h_
+
+/* All platform-dependent types and macro boilerplate (such as EGLAPI
+ * and EGLAPIENTRY) should go in eglplatform.h.
+ */
+#include <EGL/eglplatform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* EGL Types */
+/* EGLint is defined in eglplatform.h */
+typedef unsigned int EGLBoolean;
+typedef unsigned int EGLenum;
+typedef void *EGLConfig;
+typedef void *EGLContext;
+typedef void *EGLDisplay;
+typedef void *EGLSurface;
+typedef void *EGLClientBuffer;
+
+/* EGL Versioning */
+#define EGL_VERSION_1_0 1
+#define EGL_VERSION_1_1 1
+#define EGL_VERSION_1_2 1
+#define EGL_VERSION_1_3 1
+#define EGL_VERSION_1_4 1
+
+/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
+ * enums are assigned unique values starting at 0x3000.
+ */
+
+/* EGL aliases */
+#define EGL_FALSE 0
+#define EGL_TRUE 1
+
+/* Out-of-band handle values */
+#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+#define EGL_NO_CONTEXT ((EGLContext)0)
+#define EGL_NO_DISPLAY ((EGLDisplay)0)
+#define EGL_NO_SURFACE ((EGLSurface)0)
+
+/* Out-of-band attribute value */
+#define EGL_DONT_CARE ((EGLint)-1)
+
+/* Errors / GetError return values */
+#define EGL_SUCCESS 0x3000
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
+
+/* Reserved 0x300F-0x301F for additional errors */
+
+/* Config attributes */
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_RED_SIZE 0x3024
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_NONE 0x3038 /* Attrib list terminator */
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
+#define EGL_CONFORMANT 0x3042
+
+/* Reserved 0x3041-0x304F for additional config attributes */
+
+/* Config attribute values */
+#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
+#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
+#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
+#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
+#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
+
+/* More config attribute values, for EGL_TEXTURE_FORMAT */
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_2D 0x305F
+
+/* Config attribute mask bits */
+#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
+
+#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
+
+/* QueryString targets */
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_EXTENSIONS 0x3055
+#define EGL_CLIENT_APIS 0x308D
+
+/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
+#define EGL_HEIGHT 0x3056
+#define EGL_WIDTH 0x3057
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_TARGET 0x3081
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_VERTICAL_RESOLUTION 0x3091
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+
+/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_SINGLE_BUFFER 0x3085
+
+/* OpenVG color spaces */
+#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
+#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
+
+/* OpenVG alpha formats */
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
+
+/* Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+ */
+#define EGL_DISPLAY_SCALING 10000
+
+/* Unknown display resolution/aspect ratio */
+#define EGL_UNKNOWN ((EGLint)-1)
+
+/* Back buffer swap behaviors */
+#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
+#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
+
+/* CreatePbufferFromClientBuffer buffer types */
+#define EGL_OPENVG_IMAGE 0x3096
+
+/* QueryContext targets */
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+
+/* CreateContext attributes */
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+
+/* Multisample resolution behaviors */
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
+
+/* BindAPI/QueryAPI targets */
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENGL_API 0x30A2
+
+/* GetCurrentSurface targets */
+#define EGL_DRAW 0x3059
+#define EGL_READ 0x305A
+
+/* WaitNative engines */
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+
+/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
+#define EGL_COLORSPACE EGL_VG_COLORSPACE
+#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
+#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
+#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
+#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
+#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
+
+/* EGL extensions must request enum blocks from the Khronos
+ * API Registrar, who maintains the enumerant registry. Submit
+ * a bug in Khronos Bugzilla against task "Registry".
+ */
+
+
+
+/* EGL Functions */
+
+EGLAPI EGLint EGLAPIENTRY eglGetError(void);
+
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
+
+EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
+ EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size,
+ EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
+
+
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx);
+
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
+ EGLNativePixmapType target);
+
+/* This is a generic function pointer type, whose name indicates it must
+ * be cast to the proper type *and calling convention* before use.
+ */
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+
+/* Now, define eglGetProcAddress using the generic function ptr. type */
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
+ eglGetProcAddress(const char *procname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __egl_h_ */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglext.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglext.h
new file mode 100644
index 0000000..638e336
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglext.h
@@ -0,0 +1,222 @@
+#ifndef __eglext_h_
+#define __eglext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are 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 Materials.
+**
+** THE MATERIALS ARE 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+#include <EGL/eglplatform.h>
+
+/*************************************************************/
+
+/* Header file version number */
+/* Current version at http://www.khronos.org/registry/egl/ */
+/* $Revision: 10795 $ on $Date: 2010-03-19 17:04:17 -0700 (Fri, 19 Mar 2010) $ */
+#define EGL_EGLEXT_VERSION 5
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
+#endif
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
+#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
+#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
+#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
+#endif
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
+typedef void *EGLImageKHR;
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#endif
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+
+typedef void* EGLSyncKHR;
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+/* Most interfaces defined by EGL_KHR_image_pixmap above */
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+/* Interfaces defined by EGL_KHR_image above */
+#endif
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+typedef void* EGLSyncNV;
+typedef unsigned long long EGLTimeNV;
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
+EGLBoolean eglFenceNV (EGLSyncNV sync);
+EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h
new file mode 100644
index 0000000..22e855f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h
@@ -0,0 +1,110 @@
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are 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 Materials.
+**
+** THE MATERIALS ARE 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Platform-specific types and definitions for egl.h
+ * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "EGL" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+/* Macros used in EGL function prototype declarations.
+ *
+ * EGL functions should be prototyped as:
+ *
+ * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+ * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+ *
+ * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+ */
+
+#ifndef EGLAPI
+#define EGLAPI KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+ * are aliases of window-system-dependent types, such as X Display * or
+ * Windows Device Context. They must be defined in platform-specific
+ * code below. The EGL-prefixed versions of Native*Type are the same
+ * types, renamed in EGL 1.3 so all types in the API start with "EGL".
+ */
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+
+typedef HDC EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND EGLNativeWindowType;
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#elif defined(__unix__)
+
+/* X11 (tentative) */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+ * all legal attribute names and values passed into and out of EGL, whether
+ * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+ * handle, or other. While in general a 32-bit integer will suffice, if
+ * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+ * integer type.
+ */
+typedef khronos_int32_t EGLint;
+
+#endif /* __eglplatform_h */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2.h
new file mode 100644
index 0000000..e1d3b87
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2.h
@@ -0,0 +1,621 @@
+#ifndef __gl2_h_
+#define __gl2_h_
+
+/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+
+#include <GLES2/gl2platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+typedef void GLvoid;
+typedef char GLchar;
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef khronos_int8_t GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef khronos_float_t GLfloat;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+
+/* GL types for handling large vertex buffer objects */
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_2_0 1
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* AlphaFunction (not supported in ES20) */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+/* GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+/* GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+#define GL_TEXTURE 0x1702
+
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX 0x1901
+#define GL_STENCIL_INDEX8 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+
+#define GL_NONE 0
+
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+
+/*-------------------------------------------------------------------------
+ * GL core functions.
+ *-----------------------------------------------------------------------*/
+
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2_h_ */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h
new file mode 100644
index 0000000..01844de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h
@@ -0,0 +1,831 @@
+#ifndef __gl2ext_h_
+#define __gl2ext_h_
+
+/* $Revision: 10798 $ on $Date:: 2010-03-19 17:34:30 -0700 #$ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+#ifndef GL_APIENTRYP
+# define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/*------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif
+
+/* GL_OES_depth_texture */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_UNSIGNED_INT 0x1405
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#endif
+
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif
+
+/* GL_OES_texture_3D */
+#ifndef GL_OES_texture_3D
+#define GL_TEXTURE_WRAP_R_OES 0x8072
+#define GL_TEXTURE_3D_OES 0x806F
+#define GL_TEXTURE_BINDING_3D_OES 0x806A
+#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
+#define GL_SAMPLER_3D_OES 0x8B5F
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
+#endif
+
+/* GL_OES_texture_float */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_float_linear */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
+
+/* GL_OES_texture_half_float_linear */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_npot */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_vertex_array_object */
+#ifndef GL_OES_vertex_array_object
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+#endif
+
+/* GL_OES_vertex_half_float */
+/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
+#define GL_INT_10_10_10_2_OES 0x8DF7
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif
+
+/* GL_AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_Z400_BINARY_AMD 0x8740
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#endif
+
+/* GL_EXT_discard_framebuffer */
+#ifndef GL_EXT_discard_framebuffer
+#define GL_COLOR_EXT 0x1800
+#define GL_DEPTH_EXT 0x1801
+#define GL_STENCIL_EXT 0x1802
+#endif
+
+/* GL_EXT_multi_draw_arrays */
+/* No new tokens introduced by this extension. */
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_BGRA_EXT 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_BGRA_EXT 0x80E1
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_program_binary */
+#ifndef GL_IMG_program_binary
+#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
+#endif
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif
+
+/* GL_IMG_shader_binary */
+#ifndef GL_IMG_shader_binary
+#define GL_SGX_BINARY_IMG 0x8C0A
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+#endif
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_COVERAGE_COMPONENT_NV 0x8ED0
+#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
+#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
+#define GL_COVERAGE_BUFFERS_NV 0x8ED3
+#define GL_COVERAGE_SAMPLES_NV 0x8ED4
+#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
+#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
+#define GL_COVERAGE_BUFFER_BIT_NV 0x8000
+#endif
+
+/* GL_NV_depth_nonlinear */
+#ifndef GL_NV_depth_nonlinear
+#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+#endif
+
+/*------------------------------------------------------------------------*
+ * QCOM extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_driver_control */
+/* No new tokens introduced by this extension. */
+
+/* GL_QCOM_extended_get */
+#ifndef GL_QCOM_extended_get
+#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+#define GL_STATE_RESTORE 0x8BDC
+#endif
+
+/* GL_QCOM_extended_get2 */
+/* No new tokens introduced by this extension. */
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+#endif
+
+/* GL_QCOM_writeonly_rendering */
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+#endif
+
+/* GL_QCOM_tiled_rendering */
+#ifndef GL_QCOM_tiled_rendering
+#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+#endif
+
+/*------------------------------------------------------------------------*
+ * ANGLE extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_ANGLE_framebuffer_blit */
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 // alias GL_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+#endif
+
+/* GL_ANGLE_framebuffer_multisample */
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
+#define GL_MAX_SAMPLES_ANGLE 0x8D57
+#endif
+
+/*------------------------------------------------------------------------*
+ * End of extension tokens, start of corresponding extension functions
+ *------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------*
+ * OES extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#endif
+
+/* GL_OES_depth_texture */
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif
+
+/* GL_OES_fbo_render_mipmap */
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif
+
+/* GL_OES_fragment_precision_high */
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif
+
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#endif
+
+/* GL_OES_texture_3D */
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+
+/* GL_OES_texture_float */
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif
+
+/* GL_OES_texture_float_linear */
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#endif
+
+/* GL_OES_texture_half_float_linear */
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif
+
+/* GL_OES_texture_npot */
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif
+
+/* GL_OES_vertex_array_object */
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+#endif
+
+/* GL_OES_vertex_half_float */
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#endif
+
+/* AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#endif
+
+/* GL_EXT_discard_framebuffer */
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+#endif
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_program_binary */
+#ifndef GL_IMG_program_binary
+#define GL_IMG_program_binary 1
+#endif
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#endif
+
+/* GL_IMG_shader_binary */
+#ifndef GL_IMG_shader_binary
+#define GL_IMG_shader_binary 1
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum);
+#endif
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#endif
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#endif
+
+/* GL_NV_depth_nonlinear */
+#ifndef GL_NV_depth_nonlinear
+#define GL_NV_depth_nonlinear 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * QCOM extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_driver_control */
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#endif
+
+/* GL_QCOM_extended_get */
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
+#endif
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
+#endif
+
+/* GL_QCOM_extended_get2 */
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#endif
+
+/* GL_QCOM_writeonly_rendering */
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#endif
+
+/* GL_QCOM_tiled_rendering */
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#endif
+
+/*------------------------------------------------------------------------*
+ * ANGLE extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_ANGLE_framebuffer_blit */
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_ANGLE_framebuffer_blit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter);
+#endif
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter);
+#endif
+
+/* GL_ANGLE_framebuffer_multisample */
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_ANGLE_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat,
+ GLsizei width, GLsizei height);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat,
+ GLsizei width, GLsizei height);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2ext_h_ */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2platform.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2platform.h
new file mode 100644
index 0000000..c9fa3c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLES2/gl2platform.h
@@ -0,0 +1,30 @@
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl2platform_h_ */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
new file mode 100644
index 0000000..d0664e4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
@@ -0,0 +1,256 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+#ifndef _COMPILER_INTERFACE_INCLUDED_
+#define _COMPILER_INTERFACE_INCLUDED_
+
+//
+// This is the platform independent interface between an OGL driver
+// and the shading language compiler.
+//
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Version number for shader translation API.
+// It is incremented everytime the API changes.
+#define SH_VERSION 103
+
+//
+// The names of the following enums have been derived by replacing GL prefix
+// with SH. For example, SH_INFO_LOG_LENGTH is equivalent to GL_INFO_LOG_LENGTH.
+// The enum values are also equal to the values of their GL counterpart. This
+// is done to make it easier for applications to use the shader library.
+//
+typedef enum {
+ SH_FRAGMENT_SHADER = 0x8B30,
+ SH_VERTEX_SHADER = 0x8B31
+} ShShaderType;
+
+typedef enum {
+ SH_GLES2_SPEC = 0x8B40,
+ SH_WEBGL_SPEC = 0x8B41
+} ShShaderSpec;
+
+typedef enum {
+ SH_NONE = 0,
+ SH_INT = 0x1404,
+ SH_FLOAT = 0x1406,
+ SH_FLOAT_VEC2 = 0x8B50,
+ SH_FLOAT_VEC3 = 0x8B51,
+ SH_FLOAT_VEC4 = 0x8B52,
+ SH_INT_VEC2 = 0x8B53,
+ SH_INT_VEC3 = 0x8B54,
+ SH_INT_VEC4 = 0x8B55,
+ SH_BOOL = 0x8B56,
+ SH_BOOL_VEC2 = 0x8B57,
+ SH_BOOL_VEC3 = 0x8B58,
+ SH_BOOL_VEC4 = 0x8B59,
+ SH_FLOAT_MAT2 = 0x8B5A,
+ SH_FLOAT_MAT3 = 0x8B5B,
+ SH_FLOAT_MAT4 = 0x8B5C,
+ SH_SAMPLER_2D = 0x8B5E,
+ SH_SAMPLER_CUBE = 0x8B60
+} ShDataType;
+
+typedef enum {
+ SH_INFO_LOG_LENGTH = 0x8B84,
+ SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH
+ SH_ACTIVE_UNIFORMS = 0x8B86,
+ SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
+ SH_ACTIVE_ATTRIBUTES = 0x8B89,
+ SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A
+} ShShaderInfo;
+
+// Compile options.
+typedef enum {
+ SH_VALIDATE = 0,
+ SH_VALIDATE_LOOP_INDEXING = 0x0001,
+ SH_INTERMEDIATE_TREE = 0x0002,
+ SH_OBJECT_CODE = 0x0004,
+ SH_ATTRIBUTES_UNIFORMS = 0x0008
+} ShCompileOptions;
+
+//
+// Driver must call this first, once, before doing any other
+// compiler operations.
+// If the function succeeds, the return value is nonzero, else zero.
+//
+int ShInitialize();
+//
+// Driver should call this at shutdown.
+// If the function succeeds, the return value is nonzero, else zero.
+//
+int ShFinalize();
+
+//
+// Implementation dependent built-in resources (constants and extensions).
+// The names for these resources has been obtained by stripping gl_/GL_.
+//
+typedef struct
+{
+ // Constants.
+ int MaxVertexAttribs;
+ int MaxVertexUniformVectors;
+ int MaxVaryingVectors;
+ int MaxVertexTextureImageUnits;
+ int MaxCombinedTextureImageUnits;
+ int MaxTextureImageUnits;
+ int MaxFragmentUniformVectors;
+ int MaxDrawBuffers;
+
+ // Extensions.
+ // Set to 1 to enable the extension, else 0.
+ int OES_standard_derivatives;
+} ShBuiltInResources;
+
+//
+// Initialize built-in resources with minimum expected values.
+//
+void ShInitBuiltInResources(ShBuiltInResources* resources);
+
+//
+// ShHandle held by but opaque to the driver. It is allocated,
+// managed, and de-allocated by the compiler. It's contents
+// are defined by and used by the compiler.
+//
+// If handle creation fails, 0 will be returned.
+//
+typedef void* ShHandle;
+
+//
+// Driver calls these to create and destroy compiler objects.
+//
+// Returns the handle of constructed compiler.
+// Parameters:
+// type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
+// spec: Specifies the language spec the compiler must conform to -
+// SH_GLES2_SPEC or SH_WEBGL_SPEC.
+// resources: Specifies the built-in resources.
+ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources* resources);
+void ShDestruct(ShHandle handle);
+
+//
+// Compiles the given shader source.
+// If the function succeeds, the return value is nonzero, else zero.
+// Parameters:
+// handle: Specifies the handle of compiler to be used.
+// shaderStrings: Specifies an array of pointers to null-terminated strings
+// containing the shader source code.
+// numStrings: Specifies the number of elements in shaderStrings array.
+// compileOptions: A mask containing the following parameters:
+// SH_VALIDATE: Validates shader to ensure that it conforms to the spec
+// specified during compiler construction.
+// SH_VALIDATE_LOOP_INDEXING: Validates loop and indexing in the shader to
+// ensure that they do not exceed the minimum
+// functionality mandated in GLSL 1.0 spec,
+// Appendix A, Section 4 and 5.
+// There is no need to specify this parameter when
+// compiling for WebGL - it is implied.
+// SH_INTERMEDIATE_TREE: Writes intermediate tree to info log.
+// Can be queried by calling ShGetInfoLog().
+// SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader.
+// Can be queried by calling ShGetObjectCode().
+// SH_ATTRIBUTES_UNIFORMS: Extracts attributes and uniforms.
+// Can be queried by calling ShGetActiveAttrib() and
+// ShGetActiveUniform().
+//
+int ShCompile(
+ const ShHandle handle,
+ const char* const shaderStrings[],
+ const int numStrings,
+ int compileOptions
+ );
+
+// Returns a parameter from a compiled shader.
+// Parameters:
+// handle: Specifies the compiler
+// pname: Specifies the parameter to query.
+// The following parameters are defined:
+// SH_INFO_LOG_LENGTH: the number of characters in the information log
+// including the null termination character.
+// SH_OBJECT_CODE_LENGTH: the number of characters in the object code
+// including the null termination character.
+// SH_ACTIVE_ATTRIBUTES: the number of active attribute variables.
+// SH_ACTIVE_ATTRIBUTE_MAX_LENGTH: the length of the longest active attribute
+// variable name including the null
+// termination character.
+// SH_ACTIVE_UNIFORMS: the number of active uniform variables.
+// SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform
+// variable name including the null
+// termination character.
+//
+// params: Requested parameter
+void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params);
+
+// Returns nul-terminated information log for a compiled shader.
+// Parameters:
+// handle: Specifies the compiler
+// infoLog: Specifies an array of characters that is used to return
+// the information log. It is assumed that infoLog has enough memory
+// to accomodate the information log. The size of the buffer required
+// to store the returned information log can be obtained by calling
+// ShGetInfo with SH_INFO_LOG_LENGTH.
+void ShGetInfoLog(const ShHandle handle, char* infoLog);
+
+// Returns null-terminated object code for a compiled shader.
+// Parameters:
+// handle: Specifies the compiler
+// infoLog: Specifies an array of characters that is used to return
+// the object code. It is assumed that infoLog has enough memory to
+// accomodate the object code. The size of the buffer required to
+// store the returned object code can be obtained by calling
+// ShGetInfo with SH_OBJECT_CODE_LENGTH.
+void ShGetObjectCode(const ShHandle handle, char* objCode);
+
+// Returns information about an active attribute variable.
+// Parameters:
+// handle: Specifies the compiler
+// index: Specifies the index of the attribute variable to be queried.
+// length: Returns the number of characters actually written in the string
+// indicated by name (excluding the null terminator) if a value other
+// than NULL is passed.
+// size: Returns the size of the attribute variable.
+// type: Returns the data type of the attribute variable.
+// name: Returns a null terminated string containing the name of the
+// attribute variable. It is assumed that name has enough memory to
+// accomodate the attribute variable name. The size of the buffer
+// required to store the attribute variable name can be obtained by
+// calling ShGetInfo with SH_ACTIVE_ATTRIBUTE_MAX_LENGTH.
+void ShGetActiveAttrib(const ShHandle handle,
+ int index,
+ int* length,
+ int* size,
+ ShDataType* type,
+ char* name);
+
+// Returns information about an active uniform variable.
+// Parameters:
+// handle: Specifies the compiler
+// index: Specifies the index of the uniform variable to be queried.
+// length: Returns the number of characters actually written in the string
+// indicated by name (excluding the null terminator) if a value
+// other than NULL is passed.
+// size: Returns the size of the uniform variable.
+// type: Returns the data type of the uniform variable.
+// name: Returns a null terminated string containing the name of the
+// uniform variable. It is assumed that name has enough memory to
+// accomodate the uniform variable name. The size of the buffer required
+// to store the uniform variable name can be obtained by calling
+// ShGetInfo with SH_ACTIVE_UNIFORMS_MAX_LENGTH.
+void ShGetActiveUniform(const ShHandle handle,
+ int index,
+ int* length,
+ int* size,
+ ShDataType* type,
+ char* name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _COMPILER_INTERFACE_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/KHR/khrplatform.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/KHR/khrplatform.h
new file mode 100644
index 0000000..8ec0d19
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/include/KHR/khrplatform.h
@@ -0,0 +1,269 @@
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are 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 Materials.
+**
+** THE MATERIALS ARE 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by sending them to the public Khronos Bugzilla
+ * (http://khronos.org/bugzilla) by filing a bug against product
+ * "Khronos (general)" component "Registry".
+ *
+ * A predefined template which fills in some of the bug fields can be
+ * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+ * must create a Bugzilla login first.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ * http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ * #include <KHR/khrplatform.h>
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ * khronos_int8_t signed 8 bit
+ * khronos_uint8_t unsigned 8 bit
+ * khronos_int16_t signed 16 bit
+ * khronos_uint16_t unsigned 16 bit
+ * khronos_int32_t signed 32 bit
+ * khronos_uint32_t unsigned 32 bit
+ * khronos_int64_t signed 64 bit
+ * khronos_uint64_t unsigned 64 bit
+ * khronos_intptr_t signed same number of bits as a pointer
+ * khronos_uintptr_t unsigned same number of bits as a pointer
+ * khronos_ssize_t signed size
+ * khronos_usize_t unsigned size
+ * khronos_float_t signed 32 bit floating point
+ * khronos_time_ns_t unsigned 64 bit time in nanoseconds
+ * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ * nanoseconds
+ * khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ * khronos_boolean_enum_t enumerated boolean type. This should
+ * only be used as a base type when a client API's boolean type is
+ * an enum. Client APIs which use an integer or other type for
+ * booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ * KHRONOS_APICALL
+ * KHRONOS_APIENTRY
+ * KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+ * int arg1,
+ * int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIENTRY
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+ /* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using <stdint.h>
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using <inttypes.h>
+ */
+#include <inttypes.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time. Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted). The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years. Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true. Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..67f7e29
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj
@@ -0,0 +1,601 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXAggregateTarget section */
+ 1563D9916BFDAD853032CE1A /* All */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 77CEFB7B40F05B0A804E6B2B /* Build configuration list for PBXAggregateTarget "All" */;
+ buildPhases = (
+ );
+ dependencies = (
+ FB3C506411F792970081F5BA /* PBXTargetDependency */,
+ );
+ name = All;
+ productName = All;
+ };
+ 31349D665FAE642AEB49135E /* ANGLE Support */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 0AA54825BF5DF0A3FBA92B60 /* Build configuration list for PBXAggregateTarget "ANGLE Support" */;
+ buildPhases = (
+ FA0D7125DB06A7A7716A5910 /* Action "flex_glslang" */,
+ 0D513F8B923949C156DB02C5 /* Action "bison_glslang" */,
+ );
+ dependencies = (
+ );
+ name = "ANGLE Support";
+ productName = "translator_common Support";
+ };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+ 05563ADFEA15116D7233332F /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4857E18799D332C30EF460C7 /* QualifierAlive.cpp */; };
+ 0A216949103E1E228F9C12F0 /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */; };
+ 3065D29E97FAC6E127388D15 /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */; };
+ 32B1DBCD6B83F2146D787A62 /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9B4616A65A5ABEF91FD6DC /* atom.c */; };
+ 35BE1BBEE6135A1CB0608EA8 /* cppstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 8058A0A2A0A02386867517EA /* cppstruct.c */; };
+ 3A96E9CAC8A25AF1564B652C /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 294F442A2606FEC55F12A28E /* memory.c */; };
+ 40FC189B8A246EDF14C2FDE3 /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEAF6F3126C2EC4397785C3F /* intermOut.cpp */; };
+ 50DF00005CC4212F6FB1291D /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F7C486C370A72938FE8160F /* Intermediate.cpp */; };
+ 6F9F875017A68ABE5D39FF19 /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976C831A75EBE009A9861796 /* ParseHelper.cpp */; };
+ 888F1382498E2D74AF2801C8 /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ABA230FEA3654B030E4C4FB /* debug.cpp */; };
+ 9E8DFE1CCEF038BF2B65428C /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */; };
+ AC23F58FDD3C55F5CA18EED7 /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */; };
+ AD85517F086FDCEF3947C403 /* symbols.c in Sources */ = {isa = PBXBuildFile; fileRef = F013A7240BDAE8A61413D8C0 /* symbols.c */; };
+ B4858417E54365BE8CDE3919 /* ossource_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE258486005F6696CC031622 /* ossource_posix.cpp */; };
+ B8BD2685A16B188CCDFB052B /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */; };
+ BEBBF4F0819EA3D03977A8FC /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */; };
+ CB7F0EF0D6A89FA8C4DF5513 /* cpp.c in Sources */ = {isa = PBXBuildFile; fileRef = B75707B393B7EAB7DD9999CB /* cpp.c */; };
+ E1C7C5DFF0B2DFEC09387F4E /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */; };
+ E8C727AA8E9DC5E7B58857DF /* tokens.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D00745DA9914FDE274D03D5 /* tokens.c */; };
+ F098F463EDABCF0769007678 /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = FF3AA694DF9A4455A813234D /* scanner.c */; };
+ F5AE2A292DFAF8C158412AA2 /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */; };
+ F6ABD58F8CAB7641D8BFE935 /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */; };
+ FB3C505711F7924A0081F5BA /* CodeGenGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */; };
+ FB3C505811F7924A0081F5BA /* OutputGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */; };
+ FB3C505911F7924A0081F5BA /* TranslatorGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */; };
+ FB3C509211F794CE0081F5BA /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ABA230FEA3654B030E4C4FB /* debug.cpp */; };
+ FB3C509311F794CE0081F5BA /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */; };
+ FB3C509411F794CE0081F5BA /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */; };
+ FB3C509511F794CE0081F5BA /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */; };
+ FB3C509611F794CE0081F5BA /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F7C486C370A72938FE8160F /* Intermediate.cpp */; };
+ FB3C509711F794CE0081F5BA /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEAF6F3126C2EC4397785C3F /* intermOut.cpp */; };
+ FB3C509811F794CE0081F5BA /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */; };
+ FB3C509A11F794CE0081F5BA /* ossource_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE258486005F6696CC031622 /* ossource_posix.cpp */; };
+ FB3C509B11F794CE0081F5BA /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */; };
+ FB3C509C11F794CE0081F5BA /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976C831A75EBE009A9861796 /* ParseHelper.cpp */; };
+ FB3C509D11F794CE0081F5BA /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */; };
+ FB3C509E11F794CE0081F5BA /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4857E18799D332C30EF460C7 /* QualifierAlive.cpp */; };
+ FB3C509F11F794CE0081F5BA /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */; };
+ FB3C50A011F794CE0081F5BA /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */; };
+ FB3C50A111F794CE0081F5BA /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */; };
+ FB3C50A411F794FF0081F5BA /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9B4616A65A5ABEF91FD6DC /* atom.c */; };
+ FB3C50A511F794FF0081F5BA /* cpp.c in Sources */ = {isa = PBXBuildFile; fileRef = B75707B393B7EAB7DD9999CB /* cpp.c */; };
+ FB3C50A611F794FF0081F5BA /* cppstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 8058A0A2A0A02386867517EA /* cppstruct.c */; };
+ FB3C50A711F794FF0081F5BA /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 294F442A2606FEC55F12A28E /* memory.c */; };
+ FB3C50A811F794FF0081F5BA /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = FF3AA694DF9A4455A813234D /* scanner.c */; };
+ FB3C50A911F794FF0081F5BA /* symbols.c in Sources */ = {isa = PBXBuildFile; fileRef = F013A7240BDAE8A61413D8C0 /* symbols.c */; };
+ FB3C50AA11F794FF0081F5BA /* tokens.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D00745DA9914FDE274D03D5 /* tokens.c */; };
+ FB3C50AB11F7951B0081F5BA /* TranslatorGLSL.h in Sources */ = {isa = PBXBuildFile; fileRef = DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */; };
+ FB3C50AC11F7951B0081F5BA /* OutputGLSL.h in Sources */ = {isa = PBXBuildFile; fileRef = 93D61CB0BCE54E069D71F920 /* OutputGLSL.h */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ E69BFBE2D1272620E46C3F8A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = DA188D8C6BF8073122539131 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 31349D665FAE642AEB49135E;
+ remoteInfo = "translator_common Support";
+ };
+ FB3C506311F792970081F5BA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = DA188D8C6BF8073122539131 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = FB3C505511F7924A0081F5BA;
+ remoteInfo = angle;
+ };
+ FB3C50D011F79CCC0081F5BA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = DA188D8C6BF8073122539131 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 31349D665FAE642AEB49135E;
+ remoteInfo = "ANGLE Support";
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 056FEADC7D95C6D4C9CF1113 /* scanner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scanner.h; sourceTree = "<group>"; };
+ 0C9B4616A65A5ABEF91FD6DC /* atom.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atom.c; sourceTree = "<group>"; };
+ 12EAF028311EEA4753E82818 /* PoolAlloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PoolAlloc.h; sourceTree = "<group>"; };
+ 153BF06BF12C6F50496C6156 /* localintermediate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = "<group>"; };
+ 27E4C7ED0B82E18DCBEDF1C9 /* BaseTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseTypes.h; sourceTree = "<group>"; };
+ 294F442A2606FEC55F12A28E /* memory.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; };
+ 2A765B86CBAF0D4A3E69DCA7 /* UnfoldSelect.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnfoldSelect.h; sourceTree = "<group>"; };
+ 2D00745DA9914FDE274D03D5 /* tokens.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tokens.c; sourceTree = "<group>"; };
+ 2E7C9B6E6DB751E12A2F6CB6 /* InitializeGlobals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeGlobals.h; sourceTree = "<group>"; };
+ 3DDDC77216202A4DE1808BDB /* libtranslator_common.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtranslator_common.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 3F7C486C370A72938FE8160F /* Intermediate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = "<group>"; };
+ 4857E18799D332C30EF460C7 /* QualifierAlive.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = "<group>"; };
+ 48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSL.cpp; sourceTree = "<group>"; };
+ 4ABA230FEA3654B030E4C4FB /* debug.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = debug.cpp; sourceTree = "<group>"; };
+ 528FF201839C6F233E26FFDA /* cpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpp.h; sourceTree = "<group>"; };
+ 56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderLang.cpp; sourceTree = "<group>"; };
+ 580B2A31F7C51A59B40F11A3 /* compile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
+ 5A21599C59BC1A75A7FABA34 /* OutputHLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputHLSL.h; sourceTree = "<group>"; };
+ 60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeDll.cpp; sourceTree = "<group>"; };
+ 6BBC8224B9D8E234D117FA0C /* preprocess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = preprocess.h; sourceTree = "<group>"; };
+ 6E02565112E6934D00B3431F /* glslang_lex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_lex.cpp; sourceTree = "<group>"; };
+ 6E02565212E6934D00B3431F /* glslang_tab.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_tab.cpp; sourceTree = "<group>"; };
+ 6E02565312E6934D00B3431F /* glslang_tab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glslang_tab.h; sourceTree = "<group>"; };
+ 6E02565412E6934D00B3431F /* glslang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glslang.h; sourceTree = "<group>"; };
+ 6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InfoSink.cpp; sourceTree = "<group>"; };
+ 6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorGLSL.cpp; sourceTree = "<group>"; };
+ 799DC9611EE2EA3BA7CF5477 /* intermediate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = intermediate.h; sourceTree = "<group>"; };
+ 7C6BB12AB099556CF379D78F /* SymbolTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; };
+ 7D9CF376DC5799B4C6B3331E /* symbols.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = symbols.h; sourceTree = "<group>"; };
+ 8058A0A2A0A02386867517EA /* cppstruct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cppstruct.c; sourceTree = "<group>"; };
+ 831399DEE5DABA09570FB3E7 /* memory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
+ 8513FAC699DB1558D1D49A48 /* Initialize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Initialize.h; sourceTree = "<group>"; };
+ 85845FFF5A8E63364308236D /* InitializeParseContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeParseContext.h; sourceTree = "<group>"; };
+ 89A6F7B1AD3918E64DF76EB1 /* slglobals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = slglobals.h; sourceTree = "<group>"; };
+ 93D61CB0BCE54E069D71F920 /* OutputGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputGLSL.h; sourceTree = "<group>"; };
+ 95276AA6B36FC1B1D913FCE4 /* debug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
+ 976C831A75EBE009A9861796 /* ParseHelper.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ParseHelper.cpp; sourceTree = "<group>"; };
+ 9A5B5BB2526802479E19F993 /* OutputHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputHLSL.cpp; sourceTree = "<group>"; };
+ 9CED3AFF1E61B45EE1005656 /* atom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atom.h; sourceTree = "<group>"; };
+ 9D47B1AC82E4EE859AC54243 /* QualifierAlive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QualifierAlive.h; sourceTree = "<group>"; };
+ A0CE43631849276A31187C7B /* InitializeDll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeDll.h; sourceTree = "<group>"; };
+ A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Initialize.cpp; sourceTree = "<group>"; };
+ AA53B6632C76F905DF08E564 /* Types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = "<group>"; };
+ AE65E139AE10DE9EFAD8D5B1 /* ShHandle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShHandle.h; sourceTree = "<group>"; };
+ AE7674C52BDDDB28AF5FFD9F /* unistd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = unistd.h; sourceTree = "<group>"; };
+ B2F5CA11EEA92DF2384EFD93 /* ConstantUnion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConstantUnion.h; sourceTree = "<group>"; };
+ B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = "<group>"; };
+ B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = "<group>"; };
+ B75707B393B7EAB7DD9999CB /* cpp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpp.c; sourceTree = "<group>"; };
+ B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
+ B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = "<group>"; };
+ BE258486005F6696CC031622 /* ossource_posix.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_posix.cpp; sourceTree = "<group>"; };
+ C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorHLSL.cpp; sourceTree = "<group>"; };
+ C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenHLSL.cpp; sourceTree = "<group>"; };
+ C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = "<group>"; };
+ C8BD59BD7056FFC21373C50A /* osinclude.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = "<group>"; };
+ CEE0C90DF6D504D1F3629711 /* ParseHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParseHelper.h; sourceTree = "<group>"; };
+ CF2B62E0820C831AF812D000 /* build_angle.gyp */ = {isa = PBXFileReference; lastKnownFileType = text; path = build_angle.gyp; sourceTree = "<group>"; };
+ CFD12C6E46EBE0839BBE52B5 /* parser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = "<group>"; };
+ D13C3693B9E40D37F2FAB34A /* tokens.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tokens.h; sourceTree = "<group>"; };
+ D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = parseConst.cpp; sourceTree = "<group>"; };
+ D40F78CB9BA0C89921FA319D /* RemoveTree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoveTree.h; sourceTree = "<group>"; };
+ DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorGLSL.h; sourceTree = "<group>"; };
+ DEAF6F3126C2EC4397785C3F /* intermOut.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = "<group>"; };
+ DEEAFC618A3B33F1FBFE3536 /* MMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMap.h; sourceTree = "<group>"; };
+ E3711A48A0BF16B1CBD77AC9 /* UnfoldSelect.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnfoldSelect.cpp; sourceTree = "<group>"; };
+ E3A29B6E9C21B67C25FF0D2B /* TranslatorHLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorHLSL.h; sourceTree = "<group>"; };
+ F013A7240BDAE8A61413D8C0 /* symbols.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = symbols.c; sourceTree = "<group>"; };
+ F74618F18FE5448115017C44 /* Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
+ F7B2971D4EB3836B94B7ECAF /* InfoSink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoSink.h; sourceTree = "<group>"; };
+ FB3C505D11F7924A0081F5BA /* libangle.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libangle.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ FF3AA694DF9A4455A813234D /* scanner.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ A5C994E74DB1E60338E7BC11 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ FB3C505A11F7924A0081F5BA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 0E8D65F584FDB84DAABD3969 /* preprocessor */ = {
+ isa = PBXGroup;
+ children = (
+ 0C9B4616A65A5ABEF91FD6DC /* atom.c */,
+ 9CED3AFF1E61B45EE1005656 /* atom.h */,
+ 580B2A31F7C51A59B40F11A3 /* compile.h */,
+ B75707B393B7EAB7DD9999CB /* cpp.c */,
+ 528FF201839C6F233E26FFDA /* cpp.h */,
+ 8058A0A2A0A02386867517EA /* cppstruct.c */,
+ 294F442A2606FEC55F12A28E /* memory.c */,
+ 831399DEE5DABA09570FB3E7 /* memory.h */,
+ CFD12C6E46EBE0839BBE52B5 /* parser.h */,
+ 6BBC8224B9D8E234D117FA0C /* preprocess.h */,
+ FF3AA694DF9A4455A813234D /* scanner.c */,
+ 056FEADC7D95C6D4C9CF1113 /* scanner.h */,
+ 89A6F7B1AD3918E64DF76EB1 /* slglobals.h */,
+ F013A7240BDAE8A61413D8C0 /* symbols.c */,
+ 7D9CF376DC5799B4C6B3331E /* symbols.h */,
+ 2D00745DA9914FDE274D03D5 /* tokens.c */,
+ D13C3693B9E40D37F2FAB34A /* tokens.h */,
+ );
+ path = preprocessor;
+ sourceTree = "<group>";
+ };
+ 196DB6AB006BB83503C7D786 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 6E02565112E6934D00B3431F /* glslang_lex.cpp */,
+ 6E02565212E6934D00B3431F /* glslang_tab.cpp */,
+ 6E02565312E6934D00B3431F /* glslang_tab.h */,
+ 6E02565412E6934D00B3431F /* glslang.h */,
+ 0E8D65F584FDB84DAABD3969 /* preprocessor */,
+ 27E4C7ED0B82E18DCBEDF1C9 /* BaseTypes.h */,
+ B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */,
+ C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */,
+ F74618F18FE5448115017C44 /* Common.h */,
+ B2F5CA11EEA92DF2384EFD93 /* ConstantUnion.h */,
+ 6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */,
+ F7B2971D4EB3836B94B7ECAF /* InfoSink.h */,
+ A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */,
+ 8513FAC699DB1558D1D49A48 /* Initialize.h */,
+ 60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */,
+ A0CE43631849276A31187C7B /* InitializeDll.h */,
+ 2E7C9B6E6DB751E12A2F6CB6 /* InitializeGlobals.h */,
+ 85845FFF5A8E63364308236D /* InitializeParseContext.h */,
+ C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */,
+ 3F7C486C370A72938FE8160F /* Intermediate.cpp */,
+ DEEAFC618A3B33F1FBFE3536 /* MMap.h */,
+ 48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */,
+ 93D61CB0BCE54E069D71F920 /* OutputGLSL.h */,
+ 9A5B5BB2526802479E19F993 /* OutputHLSL.cpp */,
+ 5A21599C59BC1A75A7FABA34 /* OutputHLSL.h */,
+ 976C831A75EBE009A9861796 /* ParseHelper.cpp */,
+ CEE0C90DF6D504D1F3629711 /* ParseHelper.h */,
+ B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */,
+ 12EAF028311EEA4753E82818 /* PoolAlloc.h */,
+ 4857E18799D332C30EF460C7 /* QualifierAlive.cpp */,
+ 9D47B1AC82E4EE859AC54243 /* QualifierAlive.h */,
+ B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */,
+ D40F78CB9BA0C89921FA319D /* RemoveTree.h */,
+ AE65E139AE10DE9EFAD8D5B1 /* ShHandle.h */,
+ 56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */,
+ B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */,
+ 7C6BB12AB099556CF379D78F /* SymbolTable.h */,
+ 6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */,
+ DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */,
+ C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */,
+ E3A29B6E9C21B67C25FF0D2B /* TranslatorHLSL.h */,
+ AA53B6632C76F905DF08E564 /* Types.h */,
+ E3711A48A0BF16B1CBD77AC9 /* UnfoldSelect.cpp */,
+ 2A765B86CBAF0D4A3E69DCA7 /* UnfoldSelect.h */,
+ 4ABA230FEA3654B030E4C4FB /* debug.cpp */,
+ 95276AA6B36FC1B1D913FCE4 /* debug.h */,
+ DEAF6F3126C2EC4397785C3F /* intermOut.cpp */,
+ 799DC9611EE2EA3BA7CF5477 /* intermediate.h */,
+ 153BF06BF12C6F50496C6156 /* localintermediate.h */,
+ C8BD59BD7056FFC21373C50A /* osinclude.h */,
+ BE258486005F6696CC031622 /* ossource_posix.cpp */,
+ D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */,
+ AE7674C52BDDDB28AF5FFD9F /* unistd.h */,
+ );
+ name = Source;
+ path = compiler;
+ sourceTree = "<group>";
+ };
+ 5BBEFF9B91738297B95C568D = {
+ isa = PBXGroup;
+ children = (
+ 196DB6AB006BB83503C7D786 /* Source */,
+ E0EDC4130E7D374318CE72BE /* Products */,
+ B2C184C3543198BA51592EA4 /* Build */,
+ );
+ sourceTree = "<group>";
+ };
+ B2C184C3543198BA51592EA4 /* Build */ = {
+ isa = PBXGroup;
+ children = (
+ CF2B62E0820C831AF812D000 /* build_angle.gyp */,
+ );
+ name = Build;
+ sourceTree = "<group>";
+ };
+ E0EDC4130E7D374318CE72BE /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 3DDDC77216202A4DE1808BDB /* libtranslator_common.a */,
+ FB3C505D11F7924A0081F5BA /* libangle.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 6F4FD35CB3DFC89D70ECD432 /* translator_common */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 34BB38E3A74418B2A063B49E /* Build configuration list for PBXNativeTarget "translator_common" */;
+ buildPhases = (
+ EAA22CA63FD572FCCB913D22 /* Sources */,
+ A5C994E74DB1E60338E7BC11 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 291EE04202EC7967835FCC38 /* PBXTargetDependency */,
+ );
+ name = translator_common;
+ productName = translator_common;
+ productReference = 3DDDC77216202A4DE1808BDB /* libtranslator_common.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ FB3C505511F7924A0081F5BA /* angle */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = FB3C505B11F7924A0081F5BA /* Build configuration list for PBXNativeTarget "angle" */;
+ buildPhases = (
+ FB3C505611F7924A0081F5BA /* Sources */,
+ FB3C505A11F7924A0081F5BA /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ FB3C50D111F79CCC0081F5BA /* PBXTargetDependency */,
+ );
+ name = angle;
+ productName = translator_glsl;
+ productReference = FB3C505D11F7924A0081F5BA /* libangle.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ DA188D8C6BF8073122539131 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ BuildIndependentTargetsInParallel = YES;
+ };
+ buildConfigurationList = 0E59F8FE4A8099E8DDCA4CE7 /* Build configuration list for PBXProject "build_angle" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 5BBEFF9B91738297B95C568D;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1563D9916BFDAD853032CE1A /* All */,
+ 6F4FD35CB3DFC89D70ECD432 /* translator_common */,
+ 31349D665FAE642AEB49135E /* ANGLE Support */,
+ FB3C505511F7924A0081F5BA /* angle */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 0D513F8B923949C156DB02C5 /* Action "bison_glslang" */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ compiler/glslang.y,
+ );
+ name = "Action \"bison_glslang\"";
+ outputPaths = (
+ "$(INTERMEDIATE_DIR)/glslang_tab.cpp",
+ "$(INTERMEDIATE_DIR)/glslang_tab.h",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "echo note: \"Executing bison on compiler/glslang.y\"\nexec bison --no-lines \"--defines=${INTERMEDIATE_DIR}/glslang_tab.h\" \"--skeleton=yacc.c\" \"--output=${INTERMEDIATE_DIR}/glslang_tab.cpp\" compiler/glslang.y\nexit 1\n";
+ showEnvVarsInLog = 0;
+ };
+ FA0D7125DB06A7A7716A5910 /* Action "flex_glslang" */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ compiler/glslang.l,
+ );
+ name = "Action \"flex_glslang\"";
+ outputPaths = (
+ "$(INTERMEDIATE_DIR)/glslang.cpp",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "echo note: \"Executing flex on compiler/glslang.l\"\nexec flex --noline --nounistd \"--outfile=${INTERMEDIATE_DIR}/glslang.cpp\" compiler/glslang.l\nexit 1\n";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ EAA22CA63FD572FCCB913D22 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 888F1382498E2D74AF2801C8 /* debug.cpp in Sources */,
+ BEBBF4F0819EA3D03977A8FC /* InfoSink.cpp in Sources */,
+ 3065D29E97FAC6E127388D15 /* Initialize.cpp in Sources */,
+ 0A216949103E1E228F9C12F0 /* InitializeDll.cpp in Sources */,
+ 50DF00005CC4212F6FB1291D /* Intermediate.cpp in Sources */,
+ 40FC189B8A246EDF14C2FDE3 /* intermOut.cpp in Sources */,
+ F5AE2A292DFAF8C158412AA2 /* IntermTraverse.cpp in Sources */,
+ 9E8DFE1CCEF038BF2B65428C /* parseConst.cpp in Sources */,
+ 6F9F875017A68ABE5D39FF19 /* ParseHelper.cpp in Sources */,
+ E1C7C5DFF0B2DFEC09387F4E /* PoolAlloc.cpp in Sources */,
+ 05563ADFEA15116D7233332F /* QualifierAlive.cpp in Sources */,
+ AC23F58FDD3C55F5CA18EED7 /* RemoveTree.cpp in Sources */,
+ B8BD2685A16B188CCDFB052B /* ShaderLang.cpp in Sources */,
+ F6ABD58F8CAB7641D8BFE935 /* SymbolTable.cpp in Sources */,
+ 32B1DBCD6B83F2146D787A62 /* atom.c in Sources */,
+ CB7F0EF0D6A89FA8C4DF5513 /* cpp.c in Sources */,
+ 35BE1BBEE6135A1CB0608EA8 /* cppstruct.c in Sources */,
+ 3A96E9CAC8A25AF1564B652C /* memory.c in Sources */,
+ F098F463EDABCF0769007678 /* scanner.c in Sources */,
+ AD85517F086FDCEF3947C403 /* symbols.c in Sources */,
+ E8C727AA8E9DC5E7B58857DF /* tokens.c in Sources */,
+ B4858417E54365BE8CDE3919 /* ossource_posix.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ FB3C505611F7924A0081F5BA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FB3C50AB11F7951B0081F5BA /* TranslatorGLSL.h in Sources */,
+ FB3C50AC11F7951B0081F5BA /* OutputGLSL.h in Sources */,
+ FB3C50A411F794FF0081F5BA /* atom.c in Sources */,
+ FB3C50A511F794FF0081F5BA /* cpp.c in Sources */,
+ FB3C50A611F794FF0081F5BA /* cppstruct.c in Sources */,
+ FB3C50A711F794FF0081F5BA /* memory.c in Sources */,
+ FB3C50A811F794FF0081F5BA /* scanner.c in Sources */,
+ FB3C50A911F794FF0081F5BA /* symbols.c in Sources */,
+ FB3C50AA11F794FF0081F5BA /* tokens.c in Sources */,
+ FB3C505711F7924A0081F5BA /* CodeGenGLSL.cpp in Sources */,
+ FB3C509211F794CE0081F5BA /* debug.cpp in Sources */,
+ FB3C509311F794CE0081F5BA /* InfoSink.cpp in Sources */,
+ FB3C509411F794CE0081F5BA /* Initialize.cpp in Sources */,
+ FB3C509511F794CE0081F5BA /* InitializeDll.cpp in Sources */,
+ FB3C509611F794CE0081F5BA /* Intermediate.cpp in Sources */,
+ FB3C509711F794CE0081F5BA /* intermOut.cpp in Sources */,
+ FB3C509811F794CE0081F5BA /* IntermTraverse.cpp in Sources */,
+ FB3C509A11F794CE0081F5BA /* ossource_posix.cpp in Sources */,
+ FB3C505811F7924A0081F5BA /* OutputGLSL.cpp in Sources */,
+ FB3C509B11F794CE0081F5BA /* parseConst.cpp in Sources */,
+ FB3C509C11F794CE0081F5BA /* ParseHelper.cpp in Sources */,
+ FB3C509D11F794CE0081F5BA /* PoolAlloc.cpp in Sources */,
+ FB3C509E11F794CE0081F5BA /* QualifierAlive.cpp in Sources */,
+ FB3C509F11F794CE0081F5BA /* RemoveTree.cpp in Sources */,
+ FB3C50A011F794CE0081F5BA /* ShaderLang.cpp in Sources */,
+ FB3C50A111F794CE0081F5BA /* SymbolTable.cpp in Sources */,
+ FB3C505911F7924A0081F5BA /* TranslatorGLSL.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 291EE04202EC7967835FCC38 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 31349D665FAE642AEB49135E /* ANGLE Support */;
+ targetProxy = E69BFBE2D1272620E46C3F8A /* PBXContainerItemProxy */;
+ };
+ FB3C506411F792970081F5BA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = FB3C505511F7924A0081F5BA /* angle */;
+ targetProxy = FB3C506311F792970081F5BA /* PBXContainerItemProxy */;
+ };
+ FB3C50D111F79CCC0081F5BA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 31349D665FAE642AEB49135E /* ANGLE Support */;
+ targetProxy = FB3C50D011F79CCC0081F5BA /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 00BF2EBCBDF5678F4BA2FA92 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "translator_common Support";
+ };
+ name = Default;
+ };
+ 1A12AA5D65ACDE71AE089EE3 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = All;
+ };
+ name = Default;
+ };
+ 1F3F1218B5135FBB067DE809 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ EXECUTABLE_PREFIX = lib;
+ HEADER_SEARCH_PATHS = (
+ .,
+ ../include,
+ );
+ PRODUCT_NAME = translator_common;
+ };
+ name = Default;
+ };
+ BC5793C9A1FF021A81C66559 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
+ INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)";
+ OBJROOT = "";
+ ONLY_ACTIVE_ARCH = YES;
+ SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)";
+ SYMROOT = "$(BUILD_DIR)";
+ };
+ name = Default;
+ };
+ FB3C505C11F7924A0081F5BA /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ EXECUTABLE_PREFIX = lib;
+ HEADER_SEARCH_PATHS = (
+ .,
+ ../include,
+ );
+ PRODUCT_NAME = angle;
+ };
+ name = Default;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 0AA54825BF5DF0A3FBA92B60 /* Build configuration list for PBXAggregateTarget "ANGLE Support" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 00BF2EBCBDF5678F4BA2FA92 /* Default */,
+ );
+ defaultConfigurationIsVisible = 1;
+ defaultConfigurationName = Default;
+ };
+ 0E59F8FE4A8099E8DDCA4CE7 /* Build configuration list for PBXProject "build_angle" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ BC5793C9A1FF021A81C66559 /* Default */,
+ );
+ defaultConfigurationIsVisible = 1;
+ defaultConfigurationName = Default;
+ };
+ 34BB38E3A74418B2A063B49E /* Build configuration list for PBXNativeTarget "translator_common" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1F3F1218B5135FBB067DE809 /* Default */,
+ );
+ defaultConfigurationIsVisible = 1;
+ defaultConfigurationName = Default;
+ };
+ 77CEFB7B40F05B0A804E6B2B /* Build configuration list for PBXAggregateTarget "All" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1A12AA5D65ACDE71AE089EE3 /* Default */,
+ );
+ defaultConfigurationIsVisible = 1;
+ defaultConfigurationName = Default;
+ };
+ FB3C505B11F7924A0081F5BA /* Build configuration list for PBXNativeTarget "angle" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ FB3C505C11F7924A0081F5BA /* Default */,
+ );
+ defaultConfigurationIsVisible = 1;
+ defaultConfigurationName = Default;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = DA188D8C6BF8073122539131 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/angleutils.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/angleutils.h
new file mode 100644
index 0000000..24c766b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/angleutils.h
@@ -0,0 +1,18 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// angleutils.h: Common ANGLE utilities.
+
+#ifndef COMMON_ANGLEUTILS_H_
+#define COMMON_ANGLEUTILS_H_
+
+// A macro to disallow the copy constructor and operator= functions
+// This must be used in the private: declarations for a class
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ void operator=(const TypeName&)
+
+#endif // COMMON_ANGLEUTILS_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.cpp
new file mode 100644
index 0000000..3de5d4e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.cpp
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.cpp: Debugging utilities.
+
+#include "common/debug.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#ifndef TRACE_OUTPUT_FILE
+#define TRACE_OUTPUT_FILE "debug.txt"
+#endif
+
+static bool trace_on = true;
+
+namespace gl
+{
+void trace(const char *format, ...)
+{
+#if !defined(ANGLE_DISABLE_TRACE)
+ if (trace_on)
+ {
+ if (format)
+ {
+ FILE *file = fopen(TRACE_OUTPUT_FILE, "a");
+
+ if (file)
+ {
+ va_list vararg;
+ va_start(vararg, format);
+ vfprintf(file, format, vararg);
+ va_end(vararg);
+
+ fclose(file);
+ }
+ }
+ }
+#endif // !defined(ANGLE_DISABLE_TRACE)
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h
new file mode 100644
index 0000000..2c4ec70
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.h: Debugging utilities.
+
+#ifndef COMMON_DEBUG_H_
+#define COMMON_DEBUG_H_
+
+#include <stdio.h>
+#include <assert.h>
+
+namespace gl
+{
+ // Outputs text to the debugging log
+ void trace(const char *format, ...);
+}
+
+// A macro to output a trace of a function call and its arguments to the debugging log
+#if !defined(NDEBUG) && !defined(ANGLE_DISABLE_TRACE)
+ #define TRACE(message, ...) gl::trace("trace: %s"message"\n", __FUNCTION__, __VA_ARGS__)
+#else
+ #define TRACE(...) ((void)0)
+#endif
+
+// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing. Will occur even in release mode.
+#define FIXME(message, ...) gl::trace("fixme: %s"message"\n", __FUNCTION__, __VA_ARGS__)
+
+// A macro to output a function call and its arguments to the debugging log, in case of error. Will occur even in release mode.
+#define ERR(message, ...) gl::trace("err: %s"message"\n", __FUNCTION__, __VA_ARGS__)
+
+// A macro asserting a condition and outputting failures to the debug log
+#define ASSERT(expression) do { \
+ if(!(expression)) \
+ ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
+ assert(expression); \
+ } while(0)
+
+
+// A macro to indicate unimplemented functionality
+#ifndef NDEBUG
+ #define UNIMPLEMENTED() do { \
+ FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
+ assert(false); \
+ } while(0)
+#else
+ #define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
+#endif
+
+// A macro for code which is not expected to be reached under valid assumptions
+#ifndef NDEBUG
+ #define UNREACHABLE() do { \
+ ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
+ assert(false); \
+ } while(0)
+#else
+ #define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
+#endif
+
+// A macro functioning as a compile-time assert to validate constant conditions
+#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition)?1:-1]
+
+#endif // COMMON_DEBUG_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/BaseTypes.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/BaseTypes.h
new file mode 100644
index 0000000..9f4a860
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/BaseTypes.h
@@ -0,0 +1,147 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _BASICTYPES_INCLUDED_
+#define _BASICTYPES_INCLUDED_
+
+//
+// Precision qualifiers
+//
+enum TPrecision
+{
+ // These need to be kept sorted
+ EbpUndefined,
+ EbpLow,
+ EbpMedium,
+ EbpHigh,
+};
+
+inline const char* getPrecisionString(TPrecision p)
+{
+ switch(p)
+ {
+ case EbpHigh: return "highp"; break;
+ case EbpMedium: return "mediump"; break;
+ case EbpLow: return "lowp"; break;
+ default: return "mediump"; break; // Safest fallback
+ }
+}
+
+//
+// Basic type. Arrays, vectors, etc., are orthogonal to this.
+//
+enum TBasicType
+{
+ EbtVoid,
+ EbtFloat,
+ EbtInt,
+ EbtBool,
+ EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
+ EbtSampler2D,
+ EbtSamplerCube,
+ EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
+ EbtStruct,
+ EbtAddress, // should be deprecated??
+};
+
+inline const char* getBasicString(TBasicType t)
+{
+ switch (t)
+ {
+ case EbtVoid: return "void"; break;
+ case EbtFloat: return "float"; break;
+ case EbtInt: return "int"; break;
+ case EbtBool: return "bool"; break;
+ case EbtSampler2D: return "sampler2D"; break;
+ case EbtSamplerCube: return "samplerCube"; break;
+ case EbtStruct: return "structure"; break;
+ default: return "unknown type";
+ }
+}
+
+inline bool IsSampler(TBasicType type)
+{
+ return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd;
+}
+
+//
+// Qualifiers and built-ins. These are mainly used to see what can be read
+// or written, and by the machine dependent translator to know which registers
+// to allocate variables in. Since built-ins tend to go to different registers
+// than varying or uniform, it makes sense they are peers, not sub-classes.
+//
+enum TQualifier
+{
+ EvqTemporary, // For temporaries (within a function), read/write
+ EvqGlobal, // For globals read/write
+ EvqConst, // User defined constants and non-output parameters in functions
+ EvqAttribute, // Readonly
+ EvqVaryingIn, // readonly, fragment shaders only
+ EvqVaryingOut, // vertex shaders only read/write
+ EvqInvariantVaryingIn, // readonly, fragment shaders only
+ EvqInvariantVaryingOut, // vertex shaders only read/write
+ EvqUniform, // Readonly, vertex and fragment
+
+ // pack/unpack input and output
+ EvqInput,
+ EvqOutput,
+
+ // parameters
+ EvqIn,
+ EvqOut,
+ EvqInOut,
+ EvqConstReadOnly,
+
+ // built-ins written by vertex shader
+ EvqPosition,
+ EvqPointSize,
+
+ // built-ins read by fragment shader
+ EvqFragCoord,
+ EvqFrontFacing,
+ EvqPointCoord,
+
+ // built-ins written by fragment shader
+ EvqFragColor,
+ EvqFragData,
+
+ // end of list
+ EvqLast,
+};
+
+//
+// This is just for debug print out, carried along with the definitions above.
+//
+inline const char* getQualifierString(TQualifier q)
+{
+ switch(q)
+ {
+ case EvqTemporary: return "Temporary"; break;
+ case EvqGlobal: return "Global"; break;
+ case EvqConst: return "const"; break;
+ case EvqConstReadOnly: return "const"; break;
+ case EvqAttribute: return "attribute"; break;
+ case EvqVaryingIn: return "varying"; break;
+ case EvqVaryingOut: return "varying"; break;
+ case EvqInvariantVaryingIn: return "invariant varying"; break;
+ case EvqInvariantVaryingOut:return "invariant varying"; break;
+ case EvqUniform: return "uniform"; break;
+ case EvqIn: return "in"; break;
+ case EvqOut: return "out"; break;
+ case EvqInOut: return "inout"; break;
+ case EvqInput: return "input"; break;
+ case EvqOutput: return "output"; break;
+ case EvqPosition: return "Position"; break;
+ case EvqPointSize: return "PointSize"; break;
+ case EvqFragCoord: return "FragCoord"; break;
+ case EvqFrontFacing: return "FrontFacing"; break;
+ case EvqFragColor: return "FragColor"; break;
+ case EvqFragData: return "FragData"; break;
+ default: return "unknown qualifier";
+ }
+}
+
+#endif // _BASICTYPES_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenGLSL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenGLSL.cpp
new file mode 100644
index 0000000..d140b37
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenGLSL.cpp
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/TranslatorGLSL.h"
+
+//
+// This function must be provided to create the actual
+// compile object used by higher level code. It returns
+// a subclass of TCompiler.
+//
+TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
+{
+ return new TranslatorGLSL(type, spec);
+}
+
+//
+// Delete the compiler made by ConstructCompiler
+//
+void DeleteCompiler(TCompiler* compiler)
+{
+ delete compiler;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenHLSL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenHLSL.cpp
new file mode 100644
index 0000000..e04e789
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/CodeGenHLSL.cpp
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/TranslatorHLSL.h"
+
+//
+// This function must be provided to create the actual
+// compile object used by higher level code. It returns
+// a subclass of TCompiler.
+//
+TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
+{
+ return new TranslatorHLSL(type, spec);
+}
+
+//
+// Delete the compiler made by ConstructCompiler
+//
+void DeleteCompiler(TCompiler* compiler)
+{
+ delete compiler;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Common.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Common.h
new file mode 100644
index 0000000..27a5598
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Common.h
@@ -0,0 +1,89 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _COMMON_INCLUDED_
+#define _COMMON_INCLUDED_
+
+#include <map>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "compiler/PoolAlloc.h"
+
+// We need two pieces of information to report errors/warnings - string and
+// line number. We encode these into a single int so that it can be easily
+// incremented/decremented by lexer. The right SOURCE_LOC_LINE_SIZE bits store
+// line number while the rest store the string number. Since the shaders are
+// usually small, we should not run out of memory. SOURCE_LOC_LINE_SIZE
+// can be increased to alleviate this issue.
+typedef int TSourceLoc;
+const unsigned int SOURCE_LOC_LINE_SIZE = 16; // in bits.
+const unsigned int SOURCE_LOC_LINE_MASK = (1 << SOURCE_LOC_LINE_SIZE) - 1;
+
+inline TSourceLoc EncodeSourceLoc(int string, int line) {
+ return (string << SOURCE_LOC_LINE_SIZE) | (line & SOURCE_LOC_LINE_MASK);
+}
+
+inline void DecodeSourceLoc(TSourceLoc loc, int* string, int* line) {
+ if (string) *string = loc >> SOURCE_LOC_LINE_SIZE;
+ if (line) *line = loc & SOURCE_LOC_LINE_MASK;
+}
+
+//
+// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.
+//
+#define POOL_ALLOCATOR_NEW_DELETE(A) \
+ void* operator new(size_t s) { return (A).allocate(s); } \
+ void* operator new(size_t, void *_Where) { return (_Where); } \
+ void operator delete(void*) { } \
+ void operator delete(void *, void *) { } \
+ void* operator new[](size_t s) { return (A).allocate(s); } \
+ void* operator new[](size_t, void *_Where) { return (_Where); } \
+ void operator delete[](void*) { } \
+ void operator delete[](void *, void *) { }
+
+//
+// Pool version of string.
+//
+typedef pool_allocator<char> TStringAllocator;
+typedef std::basic_string <char, std::char_traits<char>, TStringAllocator> TString;
+typedef std::basic_ostringstream<char, std::char_traits<char>, TStringAllocator> TStringStream;
+inline TString* NewPoolTString(const char* s)
+{
+ void* memory = GlobalPoolAllocator.allocate(sizeof(TString));
+ return new(memory) TString(s);
+}
+
+//
+// Persistent string memory. Should only be used for strings that survive
+// across compiles.
+//
+#define TPersistString std::string
+#define TPersistStringStream std::ostringstream
+
+//
+// Pool allocator versions of vectors, lists, and maps
+//
+template <class T> class TVector : public std::vector<T, pool_allocator<T> > {
+public:
+ typedef typename std::vector<T, pool_allocator<T> >::size_type size_type;
+ TVector() : std::vector<T, pool_allocator<T> >() {}
+ TVector(const pool_allocator<T>& a) : std::vector<T, pool_allocator<T> >(a) {}
+ TVector(size_type i): std::vector<T, pool_allocator<T> >(i) {}
+};
+
+template <class K, class D, class CMP = std::less<K> >
+class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<const K, D> > > {
+public:
+ typedef pool_allocator<std::pair<const K, D> > tAllocator;
+
+ TMap() : std::map<K, D, CMP, tAllocator>() {}
+ // use correct two-stage name lookup supported in gcc 3.4 and above
+ TMap(const tAllocator& a) : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a) {}
+};
+
+#endif // _COMMON_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp
new file mode 100644
index 0000000..649b457
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp
@@ -0,0 +1,189 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/Initialize.h"
+#include "compiler/ParseHelper.h"
+#include "compiler/ShHandle.h"
+#include "compiler/ValidateLimitations.h"
+
+namespace {
+bool InitializeSymbolTable(
+ const TBuiltInStrings& builtInStrings,
+ ShShaderType type, ShShaderSpec spec, const ShBuiltInResources& resources,
+ TInfoSink& infoSink, TSymbolTable& symbolTable)
+{
+ TIntermediate intermediate(infoSink);
+ TExtensionBehavior extBehavior;
+ TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, infoSink);
+
+ GlobalParseContext = &parseContext;
+
+ assert(symbolTable.isEmpty());
+ //
+ // Parse the built-ins. This should only happen once per
+ // language symbol table.
+ //
+ // Push the symbol table to give it an initial scope. This
+ // push should not have a corresponding pop, so that built-ins
+ // are preserved, and the test for an empty table fails.
+ //
+ symbolTable.push();
+
+ for (TBuiltInStrings::const_iterator i = builtInStrings.begin(); i != builtInStrings.end(); ++i)
+ {
+ const char* builtInShaders = i->c_str();
+ int builtInLengths = static_cast<int>(i->size());
+ if (builtInLengths <= 0)
+ continue;
+
+ if (PaParseStrings(1, &builtInShaders, &builtInLengths, &parseContext) != 0)
+ {
+ infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
+ return false;
+ }
+ }
+
+ IdentifyBuiltIns(type, spec, resources, symbolTable);
+
+ return true;
+}
+
+class TScopedPoolAllocator {
+public:
+ TScopedPoolAllocator(TPoolAllocator* allocator, bool pushPop)
+ : mAllocator(allocator), mPushPopAllocator(pushPop) {
+ if (mPushPopAllocator) mAllocator->push();
+ SetGlobalPoolAllocator(mAllocator);
+ }
+ ~TScopedPoolAllocator() {
+ SetGlobalPoolAllocator(NULL);
+ if (mPushPopAllocator) mAllocator->pop();
+ }
+
+private:
+ TPoolAllocator* mAllocator;
+ bool mPushPopAllocator;
+};
+} // namespace
+
+TShHandleBase::TShHandleBase() {
+ allocator.push();
+ SetGlobalPoolAllocator(&allocator);
+}
+
+TShHandleBase::~TShHandleBase() {
+ SetGlobalPoolAllocator(NULL);
+ allocator.popAll();
+}
+
+TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
+ : shaderType(type),
+ shaderSpec(spec)
+{
+}
+
+TCompiler::~TCompiler()
+{
+}
+
+bool TCompiler::Init(const ShBuiltInResources& resources)
+{
+ TScopedPoolAllocator scopedAlloc(&allocator, false);
+
+ // Generate built-in symbol table.
+ if (!InitBuiltInSymbolTable(resources))
+ return false;
+ InitExtensionBehavior(resources, extensionBehavior);
+
+ return true;
+}
+
+bool TCompiler::compile(const char* const shaderStrings[],
+ const int numStrings,
+ int compileOptions)
+{
+ TScopedPoolAllocator scopedAlloc(&allocator, true);
+ clearResults();
+
+ if (numStrings == 0)
+ return true;
+
+ // If compiling for WebGL, validate loop and indexing as well.
+ if (shaderSpec == SH_WEBGL_SPEC)
+ compileOptions |= SH_VALIDATE_LOOP_INDEXING;
+
+ TIntermediate intermediate(infoSink);
+ TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
+ shaderType, shaderSpec, infoSink);
+ GlobalParseContext = &parseContext;
+
+ // We preserve symbols at the built-in level from compile-to-compile.
+ // Start pushing the user-defined symbols at global level.
+ symbolTable.push();
+ if (!symbolTable.atGlobalLevel())
+ infoSink.info.message(EPrefixInternalError, "Wrong symbol table level");
+
+ // Parse shader.
+ bool success =
+ (PaParseStrings(numStrings, shaderStrings, NULL, &parseContext) == 0) &&
+ (parseContext.treeRoot != NULL);
+ if (success) {
+ TIntermNode* root = parseContext.treeRoot;
+ success = intermediate.postProcess(root);
+
+ if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
+ success = validateLimitations(root);
+
+ if (success && (compileOptions & SH_INTERMEDIATE_TREE))
+ intermediate.outputTree(root);
+
+ if (success && (compileOptions & SH_OBJECT_CODE))
+ translate(root);
+
+ if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS))
+ collectAttribsUniforms(root);
+ }
+
+ // Cleanup memory.
+ intermediate.remove(parseContext.treeRoot);
+ // Ensure symbol table is returned to the built-in level,
+ // throwing away all but the built-ins.
+ while (!symbolTable.atBuiltInLevel())
+ symbolTable.pop();
+
+ return success;
+}
+
+bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources)
+{
+ TBuiltIns builtIns;
+
+ builtIns.initialize(shaderType, shaderSpec, resources);
+ return InitializeSymbolTable(builtIns.getBuiltInStrings(),
+ shaderType, shaderSpec, resources, infoSink, symbolTable);
+}
+
+void TCompiler::clearResults()
+{
+ infoSink.info.erase();
+ infoSink.obj.erase();
+ infoSink.debug.erase();
+
+ attribs.clear();
+ uniforms.clear();
+}
+
+bool TCompiler::validateLimitations(TIntermNode* root) {
+ ValidateLimitations validate(shaderType, infoSink.info);
+ root->traverse(&validate);
+ return validate.numErrors() == 0;
+}
+
+void TCompiler::collectAttribsUniforms(TIntermNode* root)
+{
+ CollectAttribsUniforms collect(attribs, uniforms);
+ root->traverse(&collect);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h
new file mode 100644
index 0000000..aa1b875
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h
@@ -0,0 +1,290 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _CONSTANT_UNION_INCLUDED_
+#define _CONSTANT_UNION_INCLUDED_
+
+#include <assert.h>
+
+class ConstantUnion {
+public:
+
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+ void setIConst(int i) {iConst = i; type = EbtInt; }
+ void setFConst(float f) {fConst = f; type = EbtFloat; }
+ void setBConst(bool b) {bConst = b; type = EbtBool; }
+
+ int getIConst() { return iConst; }
+ float getFConst() { return fConst; }
+ bool getBConst() { return bConst; }
+ int getIConst() const { return iConst; }
+ float getFConst() const { return fConst; }
+ bool getBConst() const { return bConst; }
+
+ bool operator==(const int i) const
+ {
+ if (i == iConst)
+ return true;
+
+ return false;
+ }
+
+ bool operator==(const float f) const
+ {
+ if (f == fConst)
+ return true;
+
+ return false;
+ }
+
+ bool operator==(const bool b) const
+ {
+ if (b == bConst)
+ return true;
+
+ return false;
+ }
+
+ bool operator==(const ConstantUnion& constant) const
+ {
+ if (constant.type != type)
+ return false;
+
+ switch (type) {
+ case EbtInt:
+ if (constant.iConst == iConst)
+ return true;
+
+ break;
+ case EbtFloat:
+ if (constant.fConst == fConst)
+ return true;
+
+ break;
+ case EbtBool:
+ if (constant.bConst == bConst)
+ return true;
+
+ break;
+ default:
+ return false;
+ }
+
+ return false;
+ }
+
+ bool operator!=(const int i) const
+ {
+ return !operator==(i);
+ }
+
+ bool operator!=(const float f) const
+ {
+ return !operator==(f);
+ }
+
+ bool operator!=(const bool b) const
+ {
+ return !operator==(b);
+ }
+
+ bool operator!=(const ConstantUnion& constant) const
+ {
+ return !operator==(constant);
+ }
+
+ bool operator>(const ConstantUnion& constant) const
+ {
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt:
+ if (iConst > constant.iConst)
+ return true;
+
+ return false;
+ case EbtFloat:
+ if (fConst > constant.fConst)
+ return true;
+
+ return false;
+ default:
+ assert(false && "Default missing");
+ return false;
+ }
+
+ return false;
+ }
+
+ bool operator<(const ConstantUnion& constant) const
+ {
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt:
+ if (iConst < constant.iConst)
+ return true;
+
+ return false;
+ case EbtFloat:
+ if (fConst < constant.fConst)
+ return true;
+
+ return false;
+ default:
+ assert(false && "Default missing");
+ return false;
+ }
+
+ return false;
+ }
+
+ ConstantUnion operator+(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
+ case EbtFloat: returnValue.setFConst(fConst + constant.fConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator-(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
+ case EbtFloat: returnValue.setFConst(fConst - constant.fConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator*(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
+ case EbtFloat: returnValue.setFConst(fConst * constant.fConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator%(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator>>(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator<<(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator&(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator|(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator^(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator&&(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtBool: returnValue.setBConst(bConst && constant.bConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ ConstantUnion operator||(const ConstantUnion& constant) const
+ {
+ ConstantUnion returnValue;
+ assert(type == constant.type);
+ switch (type) {
+ case EbtBool: returnValue.setBConst(bConst || constant.bConst); break;
+ default: assert(false && "Default missing");
+ }
+
+ return returnValue;
+ }
+
+ TBasicType getType() const { return type; }
+private:
+
+ union {
+ int iConst; // used for ivec, scalar ints
+ bool bConst; // used for bvec, scalar bools
+ float fConst; // used for vec, mat, scalar floats
+ } ;
+
+ TBasicType type;
+};
+
+#endif // _CONSTANT_UNION_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ExtensionBehavior.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ExtensionBehavior.h
new file mode 100644
index 0000000..da96c24
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ExtensionBehavior.h
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _EXTENSION_BEHAVIOR_INCLUDED_
+#define _EXTENSION_BEHAVIOR_INCLUDED_
+
+#include "compiler/Common.h"
+
+typedef enum {
+ EBhRequire,
+ EBhEnable,
+ EBhWarn,
+ EBhDisable
+} TBehavior;
+
+typedef TMap<TString, TBehavior> TExtensionBehavior;
+
+#endif // _EXTENSION_TABLE_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.cpp
new file mode 100644
index 0000000..ba32f78
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.cpp
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/InfoSink.h"
+
+void TInfoSinkBase::prefix(TPrefixType message) {
+ switch(message) {
+ case EPrefixNone:
+ break;
+ case EPrefixWarning:
+ sink.append("WARNING: ");
+ break;
+ case EPrefixError:
+ sink.append("ERROR: ");
+ break;
+ case EPrefixInternalError:
+ sink.append("INTERNAL ERROR: ");
+ break;
+ case EPrefixUnimplemented:
+ sink.append("UNIMPLEMENTED: ");
+ break;
+ case EPrefixNote:
+ sink.append("NOTE: ");
+ break;
+ default:
+ sink.append("UNKOWN ERROR: ");
+ break;
+ }
+}
+
+void TInfoSinkBase::location(TSourceLoc loc) {
+ int string = 0, line = 0;
+ DecodeSourceLoc(loc, &string, &line);
+
+ TPersistStringStream stream;
+ if (line)
+ stream << string << ":" << line;
+ else
+ stream << string << ":? ";
+ stream << ": ";
+
+ sink.append(stream.str());
+}
+
+void TInfoSinkBase::message(TPrefixType message, const char* s) {
+ prefix(message);
+ sink.append(s);
+ sink.append("\n");
+}
+
+void TInfoSinkBase::message(TPrefixType message, const char* s, TSourceLoc loc) {
+ prefix(message);
+ location(loc);
+ sink.append(s);
+ sink.append("\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.h
new file mode 100644
index 0000000..e2224e9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InfoSink.h
@@ -0,0 +1,115 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _INFOSINK_INCLUDED_
+#define _INFOSINK_INCLUDED_
+
+#include <math.h>
+#include "compiler/Common.h"
+
+// Returns the fractional part of the given floating-point number.
+inline float fractionalPart(float f) {
+ float intPart = 0.0f;
+ return modff(f, &intPart);
+}
+
+//
+// TPrefixType is used to centralize how info log messages start.
+// See below.
+//
+enum TPrefixType {
+ EPrefixNone,
+ EPrefixWarning,
+ EPrefixError,
+ EPrefixInternalError,
+ EPrefixUnimplemented,
+ EPrefixNote
+};
+
+//
+// Encapsulate info logs for all objects that have them.
+//
+// The methods are a general set of tools for getting a variety of
+// messages and types inserted into the log.
+//
+class TInfoSinkBase {
+public:
+ TInfoSinkBase() {}
+
+ template <typename T>
+ TInfoSinkBase& operator<<(const T& t) {
+ TPersistStringStream stream;
+ stream << t;
+ sink.append(stream.str());
+ return *this;
+ }
+ // Override << operator for specific types. It is faster to append strings
+ // and characters directly to the sink.
+ TInfoSinkBase& operator<<(char c) {
+ sink.append(1, c);
+ return *this;
+ }
+ TInfoSinkBase& operator<<(const char* str) {
+ sink.append(str);
+ return *this;
+ }
+ TInfoSinkBase& operator<<(const TPersistString& str) {
+ sink.append(str);
+ return *this;
+ }
+ TInfoSinkBase& operator<<(const TString& str) {
+ sink.append(str.c_str());
+ return *this;
+ }
+ // Make sure floats are written with correct precision.
+ TInfoSinkBase& operator<<(float f) {
+ // Make sure that at least one decimal point is written. If a number
+ // does not have a fractional part, the default precision format does
+ // not write the decimal portion which gets interpreted as integer by
+ // the compiler.
+ TPersistStringStream stream;
+ if (fractionalPart(f) == 0.0f) {
+ stream.precision(1);
+ stream << std::showpoint << std::fixed << f;
+ } else {
+ stream.unsetf(std::ios::fixed);
+ stream.unsetf(std::ios::scientific);
+ stream.precision(8);
+ stream << f;
+ }
+ sink.append(stream.str());
+ return *this;
+ }
+ // Write boolean values as their names instead of integral value.
+ TInfoSinkBase& operator<<(bool b) {
+ const char* str = b ? "true" : "false";
+ sink.append(str);
+ return *this;
+ }
+
+ void erase() { sink.clear(); }
+ int size() { return static_cast<int>(sink.size()); }
+
+ const TPersistString& str() const { return sink; }
+ const char* c_str() const { return sink.c_str(); }
+
+ void prefix(TPrefixType message);
+ void location(TSourceLoc loc);
+ void message(TPrefixType message, const char* s);
+ void message(TPrefixType message, const char* s, TSourceLoc loc);
+
+private:
+ TPersistString sink;
+};
+
+class TInfoSink {
+public:
+ TInfoSinkBase info;
+ TInfoSinkBase debug;
+ TInfoSinkBase obj;
+};
+
+#endif // _INFOSINK_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.cpp
new file mode 100644
index 0000000..12b53fe
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.cpp
@@ -0,0 +1,631 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Create strings that declare built-in definitions, add built-ins that
+// cannot be expressed in the files, and establish mappings between
+// built-in functions and operators.
+//
+
+#include "compiler/Initialize.h"
+
+#include "compiler/intermediate.h"
+
+//============================================================================
+//
+// Prototypes for built-in functions seen by both vertex and fragment shaders.
+//
+//============================================================================
+static TString BuiltInFunctionsCommon()
+{
+ TString s;
+
+ //
+ // Angle and Trigonometric Functions.
+ //
+ s.append(TString("float radians(float degrees);"));
+ s.append(TString("vec2 radians(vec2 degrees);"));
+ s.append(TString("vec3 radians(vec3 degrees);"));
+ s.append(TString("vec4 radians(vec4 degrees);"));
+
+ s.append(TString("float degrees(float radians);"));
+ s.append(TString("vec2 degrees(vec2 radians);"));
+ s.append(TString("vec3 degrees(vec3 radians);"));
+ s.append(TString("vec4 degrees(vec4 radians);"));
+
+ s.append(TString("float sin(float angle);"));
+ s.append(TString("vec2 sin(vec2 angle);"));
+ s.append(TString("vec3 sin(vec3 angle);"));
+ s.append(TString("vec4 sin(vec4 angle);"));
+
+ s.append(TString("float cos(float angle);"));
+ s.append(TString("vec2 cos(vec2 angle);"));
+ s.append(TString("vec3 cos(vec3 angle);"));
+ s.append(TString("vec4 cos(vec4 angle);"));
+
+ s.append(TString("float tan(float angle);"));
+ s.append(TString("vec2 tan(vec2 angle);"));
+ s.append(TString("vec3 tan(vec3 angle);"));
+ s.append(TString("vec4 tan(vec4 angle);"));
+
+ s.append(TString("float asin(float x);"));
+ s.append(TString("vec2 asin(vec2 x);"));
+ s.append(TString("vec3 asin(vec3 x);"));
+ s.append(TString("vec4 asin(vec4 x);"));
+
+ s.append(TString("float acos(float x);"));
+ s.append(TString("vec2 acos(vec2 x);"));
+ s.append(TString("vec3 acos(vec3 x);"));
+ s.append(TString("vec4 acos(vec4 x);"));
+
+ s.append(TString("float atan(float y, float x);"));
+ s.append(TString("vec2 atan(vec2 y, vec2 x);"));
+ s.append(TString("vec3 atan(vec3 y, vec3 x);"));
+ s.append(TString("vec4 atan(vec4 y, vec4 x);"));
+
+ s.append(TString("float atan(float y_over_x);"));
+ s.append(TString("vec2 atan(vec2 y_over_x);"));
+ s.append(TString("vec3 atan(vec3 y_over_x);"));
+ s.append(TString("vec4 atan(vec4 y_over_x);"));
+
+ //
+ // Exponential Functions.
+ //
+ s.append(TString("float pow(float x, float y);"));
+ s.append(TString("vec2 pow(vec2 x, vec2 y);"));
+ s.append(TString("vec3 pow(vec3 x, vec3 y);"));
+ s.append(TString("vec4 pow(vec4 x, vec4 y);"));
+
+ s.append(TString("float exp(float x);"));
+ s.append(TString("vec2 exp(vec2 x);"));
+ s.append(TString("vec3 exp(vec3 x);"));
+ s.append(TString("vec4 exp(vec4 x);"));
+
+ s.append(TString("float log(float x);"));
+ s.append(TString("vec2 log(vec2 x);"));
+ s.append(TString("vec3 log(vec3 x);"));
+ s.append(TString("vec4 log(vec4 x);"));
+
+ s.append(TString("float exp2(float x);"));
+ s.append(TString("vec2 exp2(vec2 x);"));
+ s.append(TString("vec3 exp2(vec3 x);"));
+ s.append(TString("vec4 exp2(vec4 x);"));
+
+ s.append(TString("float log2(float x);"));
+ s.append(TString("vec2 log2(vec2 x);"));
+ s.append(TString("vec3 log2(vec3 x);"));
+ s.append(TString("vec4 log2(vec4 x);"));
+
+ s.append(TString("float sqrt(float x);"));
+ s.append(TString("vec2 sqrt(vec2 x);"));
+ s.append(TString("vec3 sqrt(vec3 x);"));
+ s.append(TString("vec4 sqrt(vec4 x);"));
+
+ s.append(TString("float inversesqrt(float x);"));
+ s.append(TString("vec2 inversesqrt(vec2 x);"));
+ s.append(TString("vec3 inversesqrt(vec3 x);"));
+ s.append(TString("vec4 inversesqrt(vec4 x);"));
+
+ //
+ // Common Functions.
+ //
+ s.append(TString("float abs(float x);"));
+ s.append(TString("vec2 abs(vec2 x);"));
+ s.append(TString("vec3 abs(vec3 x);"));
+ s.append(TString("vec4 abs(vec4 x);"));
+
+ s.append(TString("float sign(float x);"));
+ s.append(TString("vec2 sign(vec2 x);"));
+ s.append(TString("vec3 sign(vec3 x);"));
+ s.append(TString("vec4 sign(vec4 x);"));
+
+ s.append(TString("float floor(float x);"));
+ s.append(TString("vec2 floor(vec2 x);"));
+ s.append(TString("vec3 floor(vec3 x);"));
+ s.append(TString("vec4 floor(vec4 x);"));
+
+ s.append(TString("float ceil(float x);"));
+ s.append(TString("vec2 ceil(vec2 x);"));
+ s.append(TString("vec3 ceil(vec3 x);"));
+ s.append(TString("vec4 ceil(vec4 x);"));
+
+ s.append(TString("float fract(float x);"));
+ s.append(TString("vec2 fract(vec2 x);"));
+ s.append(TString("vec3 fract(vec3 x);"));
+ s.append(TString("vec4 fract(vec4 x);"));
+
+ s.append(TString("float mod(float x, float y);"));
+ s.append(TString("vec2 mod(vec2 x, float y);"));
+ s.append(TString("vec3 mod(vec3 x, float y);"));
+ s.append(TString("vec4 mod(vec4 x, float y);"));
+ s.append(TString("vec2 mod(vec2 x, vec2 y);"));
+ s.append(TString("vec3 mod(vec3 x, vec3 y);"));
+ s.append(TString("vec4 mod(vec4 x, vec4 y);"));
+
+ s.append(TString("float min(float x, float y);"));
+ s.append(TString("vec2 min(vec2 x, float y);"));
+ s.append(TString("vec3 min(vec3 x, float y);"));
+ s.append(TString("vec4 min(vec4 x, float y);"));
+ s.append(TString("vec2 min(vec2 x, vec2 y);"));
+ s.append(TString("vec3 min(vec3 x, vec3 y);"));
+ s.append(TString("vec4 min(vec4 x, vec4 y);"));
+
+ s.append(TString("float max(float x, float y);"));
+ s.append(TString("vec2 max(vec2 x, float y);"));
+ s.append(TString("vec3 max(vec3 x, float y);"));
+ s.append(TString("vec4 max(vec4 x, float y);"));
+ s.append(TString("vec2 max(vec2 x, vec2 y);"));
+ s.append(TString("vec3 max(vec3 x, vec3 y);"));
+ s.append(TString("vec4 max(vec4 x, vec4 y);"));
+
+ s.append(TString("float clamp(float x, float minVal, float maxVal);"));
+ s.append(TString("vec2 clamp(vec2 x, float minVal, float maxVal);"));
+ s.append(TString("vec3 clamp(vec3 x, float minVal, float maxVal);"));
+ s.append(TString("vec4 clamp(vec4 x, float minVal, float maxVal);"));
+ s.append(TString("vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);"));
+ s.append(TString("vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);"));
+ s.append(TString("vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);"));
+
+ s.append(TString("float mix(float x, float y, float a);"));
+ s.append(TString("vec2 mix(vec2 x, vec2 y, float a);"));
+ s.append(TString("vec3 mix(vec3 x, vec3 y, float a);"));
+ s.append(TString("vec4 mix(vec4 x, vec4 y, float a);"));
+ s.append(TString("vec2 mix(vec2 x, vec2 y, vec2 a);"));
+ s.append(TString("vec3 mix(vec3 x, vec3 y, vec3 a);"));
+ s.append(TString("vec4 mix(vec4 x, vec4 y, vec4 a);"));
+
+ s.append(TString("float step(float edge, float x);"));
+ s.append(TString("vec2 step(vec2 edge, vec2 x);"));
+ s.append(TString("vec3 step(vec3 edge, vec3 x);"));
+ s.append(TString("vec4 step(vec4 edge, vec4 x);"));
+ s.append(TString("vec2 step(float edge, vec2 x);"));
+ s.append(TString("vec3 step(float edge, vec3 x);"));
+ s.append(TString("vec4 step(float edge, vec4 x);"));
+
+ s.append(TString("float smoothstep(float edge0, float edge1, float x);"));
+ s.append(TString("vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);"));
+ s.append(TString("vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);"));
+ s.append(TString("vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);"));
+ s.append(TString("vec2 smoothstep(float edge0, float edge1, vec2 x);"));
+ s.append(TString("vec3 smoothstep(float edge0, float edge1, vec3 x);"));
+ s.append(TString("vec4 smoothstep(float edge0, float edge1, vec4 x);"));
+
+ //
+ // Geometric Functions.
+ //
+ s.append(TString("float length(float x);"));
+ s.append(TString("float length(vec2 x);"));
+ s.append(TString("float length(vec3 x);"));
+ s.append(TString("float length(vec4 x);"));
+
+ s.append(TString("float distance(float p0, float p1);"));
+ s.append(TString("float distance(vec2 p0, vec2 p1);"));
+ s.append(TString("float distance(vec3 p0, vec3 p1);"));
+ s.append(TString("float distance(vec4 p0, vec4 p1);"));
+
+ s.append(TString("float dot(float x, float y);"));
+ s.append(TString("float dot(vec2 x, vec2 y);"));
+ s.append(TString("float dot(vec3 x, vec3 y);"));
+ s.append(TString("float dot(vec4 x, vec4 y);"));
+
+ s.append(TString("vec3 cross(vec3 x, vec3 y);"));
+ s.append(TString("float normalize(float x);"));
+ s.append(TString("vec2 normalize(vec2 x);"));
+ s.append(TString("vec3 normalize(vec3 x);"));
+ s.append(TString("vec4 normalize(vec4 x);"));
+
+ s.append(TString("float faceforward(float N, float I, float Nref);"));
+ s.append(TString("vec2 faceforward(vec2 N, vec2 I, vec2 Nref);"));
+ s.append(TString("vec3 faceforward(vec3 N, vec3 I, vec3 Nref);"));
+ s.append(TString("vec4 faceforward(vec4 N, vec4 I, vec4 Nref);"));
+
+ s.append(TString("float reflect(float I, float N);"));
+ s.append(TString("vec2 reflect(vec2 I, vec2 N);"));
+ s.append(TString("vec3 reflect(vec3 I, vec3 N);"));
+ s.append(TString("vec4 reflect(vec4 I, vec4 N);"));
+
+ s.append(TString("float refract(float I, float N, float eta);"));
+ s.append(TString("vec2 refract(vec2 I, vec2 N, float eta);"));
+ s.append(TString("vec3 refract(vec3 I, vec3 N, float eta);"));
+ s.append(TString("vec4 refract(vec4 I, vec4 N, float eta);"));
+
+ //
+ // Matrix Functions.
+ //
+ s.append(TString("mat2 matrixCompMult(mat2 x, mat2 y);"));
+ s.append(TString("mat3 matrixCompMult(mat3 x, mat3 y);"));
+ s.append(TString("mat4 matrixCompMult(mat4 x, mat4 y);"));
+
+ //
+ // Vector relational functions.
+ //
+ s.append(TString("bvec2 lessThan(vec2 x, vec2 y);"));
+ s.append(TString("bvec3 lessThan(vec3 x, vec3 y);"));
+ s.append(TString("bvec4 lessThan(vec4 x, vec4 y);"));
+
+ s.append(TString("bvec2 lessThan(ivec2 x, ivec2 y);"));
+ s.append(TString("bvec3 lessThan(ivec3 x, ivec3 y);"));
+ s.append(TString("bvec4 lessThan(ivec4 x, ivec4 y);"));
+
+ s.append(TString("bvec2 lessThanEqual(vec2 x, vec2 y);"));
+ s.append(TString("bvec3 lessThanEqual(vec3 x, vec3 y);"));
+ s.append(TString("bvec4 lessThanEqual(vec4 x, vec4 y);"));
+
+ s.append(TString("bvec2 lessThanEqual(ivec2 x, ivec2 y);"));
+ s.append(TString("bvec3 lessThanEqual(ivec3 x, ivec3 y);"));
+ s.append(TString("bvec4 lessThanEqual(ivec4 x, ivec4 y);"));
+
+ s.append(TString("bvec2 greaterThan(vec2 x, vec2 y);"));
+ s.append(TString("bvec3 greaterThan(vec3 x, vec3 y);"));
+ s.append(TString("bvec4 greaterThan(vec4 x, vec4 y);"));
+
+ s.append(TString("bvec2 greaterThan(ivec2 x, ivec2 y);"));
+ s.append(TString("bvec3 greaterThan(ivec3 x, ivec3 y);"));
+ s.append(TString("bvec4 greaterThan(ivec4 x, ivec4 y);"));
+
+ s.append(TString("bvec2 greaterThanEqual(vec2 x, vec2 y);"));
+ s.append(TString("bvec3 greaterThanEqual(vec3 x, vec3 y);"));
+ s.append(TString("bvec4 greaterThanEqual(vec4 x, vec4 y);"));
+
+ s.append(TString("bvec2 greaterThanEqual(ivec2 x, ivec2 y);"));
+ s.append(TString("bvec3 greaterThanEqual(ivec3 x, ivec3 y);"));
+ s.append(TString("bvec4 greaterThanEqual(ivec4 x, ivec4 y);"));
+
+ s.append(TString("bvec2 equal(vec2 x, vec2 y);"));
+ s.append(TString("bvec3 equal(vec3 x, vec3 y);"));
+ s.append(TString("bvec4 equal(vec4 x, vec4 y);"));
+
+ s.append(TString("bvec2 equal(ivec2 x, ivec2 y);"));
+ s.append(TString("bvec3 equal(ivec3 x, ivec3 y);"));
+ s.append(TString("bvec4 equal(ivec4 x, ivec4 y);"));
+
+ s.append(TString("bvec2 equal(bvec2 x, bvec2 y);"));
+ s.append(TString("bvec3 equal(bvec3 x, bvec3 y);"));
+ s.append(TString("bvec4 equal(bvec4 x, bvec4 y);"));
+
+ s.append(TString("bvec2 notEqual(vec2 x, vec2 y);"));
+ s.append(TString("bvec3 notEqual(vec3 x, vec3 y);"));
+ s.append(TString("bvec4 notEqual(vec4 x, vec4 y);"));
+
+ s.append(TString("bvec2 notEqual(ivec2 x, ivec2 y);"));
+ s.append(TString("bvec3 notEqual(ivec3 x, ivec3 y);"));
+ s.append(TString("bvec4 notEqual(ivec4 x, ivec4 y);"));
+
+ s.append(TString("bvec2 notEqual(bvec2 x, bvec2 y);"));
+ s.append(TString("bvec3 notEqual(bvec3 x, bvec3 y);"));
+ s.append(TString("bvec4 notEqual(bvec4 x, bvec4 y);"));
+
+ s.append(TString("bool any(bvec2 x);"));
+ s.append(TString("bool any(bvec3 x);"));
+ s.append(TString("bool any(bvec4 x);"));
+
+ s.append(TString("bool all(bvec2 x);"));
+ s.append(TString("bool all(bvec3 x);"));
+ s.append(TString("bool all(bvec4 x);"));
+
+ s.append(TString("bvec2 not(bvec2 x);"));
+ s.append(TString("bvec3 not(bvec3 x);"));
+ s.append(TString("bvec4 not(bvec4 x);"));
+
+ //
+ // Noise functions.
+ //
+ //s.append(TString("float noise1(float x);"));
+ //s.append(TString("float noise1(vec2 x);"));
+ //s.append(TString("float noise1(vec3 x);"));
+ //s.append(TString("float noise1(vec4 x);"));
+
+ //s.append(TString("vec2 noise2(float x);"));
+ //s.append(TString("vec2 noise2(vec2 x);"));
+ //s.append(TString("vec2 noise2(vec3 x);"));
+ //s.append(TString("vec2 noise2(vec4 x);"));
+
+ //s.append(TString("vec3 noise3(float x);"));
+ //s.append(TString("vec3 noise3(vec2 x);"));
+ //s.append(TString("vec3 noise3(vec3 x);"));
+ //s.append(TString("vec3 noise3(vec4 x);"));
+
+ //s.append(TString("vec4 noise4(float x);"));
+ //s.append(TString("vec4 noise4(vec2 x);"));
+ //s.append(TString("vec4 noise4(vec3 x);"));
+ //s.append(TString("vec4 noise4(vec4 x);"));
+
+ return s;
+}
+
+//============================================================================
+//
+// Prototypes for built-in functions seen by vertex shaders only.
+//
+//============================================================================
+static TString BuiltInFunctionsVertex(const ShBuiltInResources& resources)
+{
+ TString s;
+
+ //
+ // Geometric Functions.
+ //
+ //s.append(TString("vec4 ftransform();"));
+
+ //
+ // Texture Functions.
+ //
+ if (resources.MaxVertexTextureImageUnits > 0) {
+ s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord);"));
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord);"));
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord);"));
+ s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord);"));
+
+ s.append(TString("vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);"));
+ s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);"));
+ s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);"));
+ s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);"));
+ }
+
+ return s;
+}
+
+//============================================================================
+//
+// Prototypes for built-in functions seen by fragment shaders only.
+//
+//============================================================================
+static TString BuiltInFunctionsFragment(const ShBuiltInResources& resources)
+{
+ TString s;
+
+ //
+ // Texture Functions.
+ //
+ s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord);"));
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord);"));
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord);"));
+ s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord);"));
+
+ s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord, float bias);"));
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias);"));
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);"));
+ s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord, float bias);"));
+
+ if (resources.OES_standard_derivatives) {
+ s.append(TString("float dFdx(float p);"));
+ s.append(TString("vec2 dFdx(vec2 p);"));
+ s.append(TString("vec3 dFdx(vec3 p);"));
+ s.append(TString("vec4 dFdx(vec4 p);"));
+
+ s.append(TString("float dFdy(float p);"));
+ s.append(TString("vec2 dFdy(vec2 p);"));
+ s.append(TString("vec3 dFdy(vec3 p);"));
+ s.append(TString("vec4 dFdy(vec4 p);"));
+
+ s.append(TString("float fwidth(float p);"));
+ s.append(TString("vec2 fwidth(vec2 p);"));
+ s.append(TString("vec3 fwidth(vec3 p);"));
+ s.append(TString("vec4 fwidth(vec4 p);"));
+ }
+
+ return s;
+}
+
+//============================================================================
+//
+// Standard uniforms.
+//
+//============================================================================
+static TString StandardUniforms()
+{
+ TString s;
+
+ //
+ // Depth range in window coordinates
+ //
+ s.append(TString("struct gl_DepthRangeParameters {"));
+ s.append(TString(" highp float near;")); // n
+ s.append(TString(" highp float far;")); // f
+ s.append(TString(" highp float diff;")); // f - n
+ s.append(TString("};"));
+ s.append(TString("uniform gl_DepthRangeParameters gl_DepthRange;"));
+
+ return s;
+}
+
+//============================================================================
+//
+// Default precision for vertex shaders.
+//
+//============================================================================
+static TString DefaultPrecisionVertex()
+{
+ TString s;
+
+ s.append(TString("precision highp int;"));
+ s.append(TString("precision highp float;"));
+
+ return s;
+}
+
+//============================================================================
+//
+// Default precision for fragment shaders.
+//
+//============================================================================
+static TString DefaultPrecisionFragment()
+{
+ TString s;
+
+ s.append(TString("precision mediump int;"));
+ // No default precision for float in fragment shaders
+
+ return s;
+}
+
+//============================================================================
+//
+// Implementation dependent built-in constants.
+//
+//============================================================================
+static TString BuiltInConstants(const ShBuiltInResources &resources)
+{
+ TStringStream s;
+
+ s << "const int gl_MaxVertexAttribs = " << resources.MaxVertexAttribs << ";";
+ s << "const int gl_MaxVertexUniformVectors = " << resources.MaxVertexUniformVectors << ";";
+
+ s << "const int gl_MaxVaryingVectors = " << resources.MaxVaryingVectors << ";";
+ s << "const int gl_MaxVertexTextureImageUnits = " << resources.MaxVertexTextureImageUnits << ";";
+ s << "const int gl_MaxCombinedTextureImageUnits = " << resources.MaxCombinedTextureImageUnits << ";";
+ s << "const int gl_MaxTextureImageUnits = " << resources.MaxTextureImageUnits << ";";
+ s << "const int gl_MaxFragmentUniformVectors = " << resources.MaxFragmentUniformVectors << ";";
+ s << "const int gl_MaxDrawBuffers = " << resources.MaxDrawBuffers << ";";
+
+ return s.str();
+}
+
+void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources& resources)
+{
+ switch (type) {
+ case SH_FRAGMENT_SHADER:
+ builtInStrings.push_back(DefaultPrecisionFragment());
+ builtInStrings.push_back(BuiltInFunctionsCommon());
+ builtInStrings.push_back(BuiltInFunctionsFragment(resources));
+ builtInStrings.push_back(StandardUniforms());
+ break;
+
+ case SH_VERTEX_SHADER:
+ builtInStrings.push_back(DefaultPrecisionVertex());
+ builtInStrings.push_back(BuiltInFunctionsCommon());
+ builtInStrings.push_back(BuiltInFunctionsVertex(resources));
+ builtInStrings.push_back(StandardUniforms());
+ break;
+
+ default: assert(false && "Language not supported");
+ }
+
+ builtInStrings.push_back(BuiltInConstants(resources));
+}
+
+void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources& resources,
+ TSymbolTable& symbolTable)
+{
+ //
+ // First, insert some special built-in variables that are not in
+ // the built-in header files.
+ //
+ switch(type) {
+ case SH_FRAGMENT_SHADER:
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
+ break;
+
+ case SH_VERTEX_SHADER:
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
+ break;
+
+ default: assert(false && "Language not supported");
+ }
+
+ //
+ // Next, identify which built-ins from the already loaded headers have
+ // a mapping to an operator. Those that are not identified as such are
+ // expected to be resolved through a library of functions, versus as
+ // operations.
+ //
+ symbolTable.relateToOperator("not", EOpVectorLogicalNot);
+
+ symbolTable.relateToOperator("matrixCompMult", EOpMul);
+
+ symbolTable.relateToOperator("equal", EOpVectorEqual);
+ symbolTable.relateToOperator("notEqual", EOpVectorNotEqual);
+ symbolTable.relateToOperator("lessThan", EOpLessThan);
+ symbolTable.relateToOperator("greaterThan", EOpGreaterThan);
+ symbolTable.relateToOperator("lessThanEqual", EOpLessThanEqual);
+ symbolTable.relateToOperator("greaterThanEqual", EOpGreaterThanEqual);
+
+ symbolTable.relateToOperator("radians", EOpRadians);
+ symbolTable.relateToOperator("degrees", EOpDegrees);
+ symbolTable.relateToOperator("sin", EOpSin);
+ symbolTable.relateToOperator("cos", EOpCos);
+ symbolTable.relateToOperator("tan", EOpTan);
+ symbolTable.relateToOperator("asin", EOpAsin);
+ symbolTable.relateToOperator("acos", EOpAcos);
+ symbolTable.relateToOperator("atan", EOpAtan);
+
+ symbolTable.relateToOperator("pow", EOpPow);
+ symbolTable.relateToOperator("exp2", EOpExp2);
+ symbolTable.relateToOperator("log", EOpLog);
+ symbolTable.relateToOperator("exp", EOpExp);
+ symbolTable.relateToOperator("log2", EOpLog2);
+ symbolTable.relateToOperator("sqrt", EOpSqrt);
+ symbolTable.relateToOperator("inversesqrt", EOpInverseSqrt);
+
+ symbolTable.relateToOperator("abs", EOpAbs);
+ symbolTable.relateToOperator("sign", EOpSign);
+ symbolTable.relateToOperator("floor", EOpFloor);
+ symbolTable.relateToOperator("ceil", EOpCeil);
+ symbolTable.relateToOperator("fract", EOpFract);
+ symbolTable.relateToOperator("mod", EOpMod);
+ symbolTable.relateToOperator("min", EOpMin);
+ symbolTable.relateToOperator("max", EOpMax);
+ symbolTable.relateToOperator("clamp", EOpClamp);
+ symbolTable.relateToOperator("mix", EOpMix);
+ symbolTable.relateToOperator("step", EOpStep);
+ symbolTable.relateToOperator("smoothstep", EOpSmoothStep);
+
+ symbolTable.relateToOperator("length", EOpLength);
+ symbolTable.relateToOperator("distance", EOpDistance);
+ symbolTable.relateToOperator("dot", EOpDot);
+ symbolTable.relateToOperator("cross", EOpCross);
+ symbolTable.relateToOperator("normalize", EOpNormalize);
+ symbolTable.relateToOperator("faceforward", EOpFaceForward);
+ symbolTable.relateToOperator("reflect", EOpReflect);
+ symbolTable.relateToOperator("refract", EOpRefract);
+
+ symbolTable.relateToOperator("any", EOpAny);
+ symbolTable.relateToOperator("all", EOpAll);
+
+ // Map language-specific operators.
+ switch(type) {
+ case SH_VERTEX_SHADER:
+ break;
+ case SH_FRAGMENT_SHADER:
+ if (resources.OES_standard_derivatives) {
+ symbolTable.relateToOperator("dFdx", EOpDFdx);
+ symbolTable.relateToOperator("dFdy", EOpDFdy);
+ symbolTable.relateToOperator("fwidth", EOpFwidth);
+
+ symbolTable.relateToExtension("dFdx", "GL_OES_standard_derivatives");
+ symbolTable.relateToExtension("dFdy", "GL_OES_standard_derivatives");
+ symbolTable.relateToExtension("fwidth", "GL_OES_standard_derivatives");
+ }
+ break;
+ default: break;
+ }
+
+ // Finally add resource-specific variables.
+ switch(type) {
+ case SH_FRAGMENT_SHADER: {
+ // Set up gl_FragData. The array size.
+ TType fragData(EbtFloat, EbpMedium, EvqFragColor, 4, false, true);
+ fragData.setArraySize(resources.MaxDrawBuffers);
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));
+ }
+ break;
+ default: break;
+ }
+}
+
+void InitExtensionBehavior(const ShBuiltInResources& resources,
+ TExtensionBehavior& extBehavior)
+{
+ if (resources.OES_standard_derivatives)
+ extBehavior["GL_OES_standard_derivatives"] = EBhDisable;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.h
new file mode 100644
index 0000000..8b0adc6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Initialize.h
@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _INITIALIZE_INCLUDED_
+#define _INITIALIZE_INCLUDED_
+
+#include "compiler/Common.h"
+#include "compiler/ShHandle.h"
+#include "compiler/SymbolTable.h"
+
+typedef TVector<TString> TBuiltInStrings;
+
+class TBuiltIns {
+public:
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+
+ void initialize(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources& resources);
+ const TBuiltInStrings& getBuiltInStrings() { return builtInStrings; }
+
+protected:
+ TBuiltInStrings builtInStrings;
+};
+
+void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources& resources,
+ TSymbolTable& symbolTable);
+
+void InitExtensionBehavior(const ShBuiltInResources& resources,
+ TExtensionBehavior& extensionBehavior);
+
+#endif // _INITIALIZE_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.cpp
new file mode 100644
index 0000000..8763cfe
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.cpp
@@ -0,0 +1,115 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/InitializeDll.h"
+
+#include "compiler/InitializeGlobals.h"
+#include "compiler/InitializeParseContext.h"
+#include "compiler/osinclude.h"
+
+OS_TLSIndex ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
+
+bool InitProcess()
+{
+ if (ThreadInitializeIndex != OS_INVALID_TLS_INDEX) {
+ //
+ // Function is re-entrant.
+ //
+ return true;
+ }
+
+ ThreadInitializeIndex = OS_AllocTLSIndex();
+
+ if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "InitProcess(): Failed to allocate TLS area for init flag");
+ return false;
+ }
+
+
+ if (!InitializePoolIndex()) {
+ assert(0 && "InitProcess(): Failed to initalize global pool");
+ return false;
+ }
+
+ if (!InitializeParseContextIndex()) {
+ assert(0 && "InitProcess(): Failed to initalize parse context");
+ return false;
+ }
+
+ return InitThread();
+}
+
+bool DetachProcess()
+{
+ bool success = true;
+
+ if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
+ return true;
+
+ success = DetachThread();
+
+ if (!FreeParseContextIndex())
+ success = false;
+
+ FreePoolIndex();
+
+ OS_FreeTLSIndex(ThreadInitializeIndex);
+ ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
+
+ return success;
+}
+
+bool InitThread()
+{
+ //
+ // This function is re-entrant
+ //
+ if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "InitThread(): Process hasn't been initalised.");
+ return false;
+ }
+
+ if (OS_GetTLSValue(ThreadInitializeIndex) != 0)
+ return true;
+
+ InitializeGlobalPools();
+
+ if (!InitializeGlobalParseContext())
+ return false;
+
+ if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) {
+ assert(0 && "InitThread(): Unable to set init flag.");
+ return false;
+ }
+
+ return true;
+}
+
+bool DetachThread()
+{
+ bool success = true;
+
+ if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
+ return true;
+
+ //
+ // Function is re-entrant and this thread may not have been initalised.
+ //
+ if (OS_GetTLSValue(ThreadInitializeIndex) != 0) {
+ if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) {
+ assert(0 && "DetachThread(): Unable to clear init flag.");
+ success = false;
+ }
+
+ if (!FreeParseContext())
+ success = false;
+
+ FreeGlobalPools();
+ }
+
+ return success;
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.h
new file mode 100644
index 0000000..857238e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeDll.h
@@ -0,0 +1,16 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+#ifndef __INITIALIZEDLL_H
+#define __INITIALIZEDLL_H
+
+bool InitProcess();
+bool DetachProcess();
+
+bool InitThread();
+bool DetachThread();
+
+#endif // __INITIALIZEDLL_H
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeGlobals.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeGlobals.h
new file mode 100644
index 0000000..842a452
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeGlobals.h
@@ -0,0 +1,15 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef __INITIALIZE_GLOBALS_INCLUDED_
+#define __INITIALIZE_GLOBALS_INCLUDED_
+
+void InitializeGlobalPools();
+void FreeGlobalPools();
+bool InitializePoolIndex();
+void FreePoolIndex();
+
+#endif // __INITIALIZE_GLOBALS_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeParseContext.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeParseContext.h
new file mode 100644
index 0000000..760fd09
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/InitializeParseContext.h
@@ -0,0 +1,16 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef __INITIALIZE_PARSE_CONTEXT_INCLUDED_
+#define __INITIALIZE_PARSE_CONTEXT_INCLUDED_
+
+bool InitializeParseContextIndex();
+bool FreeParseContextIndex();
+
+bool InitializeGlobalParseContext();
+bool FreeParseContext();
+
+#endif // __INITIALIZE_PARSE_CONTEXT_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/IntermTraverse.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/IntermTraverse.cpp
new file mode 100644
index 0000000..a13877f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/IntermTraverse.cpp
@@ -0,0 +1,293 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/intermediate.h"
+
+//
+// Traverse the intermediate representation tree, and
+// call a node type specific function for each node.
+// Done recursively through the member function Traverse().
+// Node types can be skipped if their function to call is 0,
+// but their subtree will still be traversed.
+// Nodes with children can have their whole subtree skipped
+// if preVisit is turned on and the type specific function
+// returns false.
+//
+// preVisit, postVisit, and rightToLeft control what order
+// nodes are visited in.
+//
+
+//
+// Traversal functions for terminals are straighforward....
+//
+void TIntermSymbol::traverse(TIntermTraverser* it)
+{
+ it->visitSymbol(this);
+}
+
+void TIntermConstantUnion::traverse(TIntermTraverser* it)
+{
+ it->visitConstantUnion(this);
+}
+
+//
+// Traverse a binary node.
+//
+void TIntermBinary::traverse(TIntermTraverser* it)
+{
+ bool visit = true;
+
+ //
+ // visit the node before children if pre-visiting.
+ //
+ if(it->preVisit)
+ {
+ visit = it->visitBinary(PreVisit, this);
+ }
+
+ //
+ // Visit the children, in the right order.
+ //
+ if(visit)
+ {
+ it->incrementDepth();
+
+ if(it->rightToLeft)
+ {
+ if(right)
+ {
+ right->traverse(it);
+ }
+
+ if(it->inVisit)
+ {
+ visit = it->visitBinary(InVisit, this);
+ }
+
+ if(visit && left)
+ {
+ left->traverse(it);
+ }
+ }
+ else
+ {
+ if(left)
+ {
+ left->traverse(it);
+ }
+
+ if(it->inVisit)
+ {
+ visit = it->visitBinary(InVisit, this);
+ }
+
+ if(visit && right)
+ {
+ right->traverse(it);
+ }
+ }
+
+ it->decrementDepth();
+ }
+
+ //
+ // Visit the node after the children, if requested and the traversal
+ // hasn't been cancelled yet.
+ //
+ if(visit && it->postVisit)
+ {
+ it->visitBinary(PostVisit, this);
+ }
+}
+
+//
+// Traverse a unary node. Same comments in binary node apply here.
+//
+void TIntermUnary::traverse(TIntermTraverser* it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitUnary(PreVisit, this);
+
+ if (visit) {
+ it->incrementDepth();
+ operand->traverse(it);
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitUnary(PostVisit, this);
+}
+
+//
+// Traverse an aggregate node. Same comments in binary node apply here.
+//
+void TIntermAggregate::traverse(TIntermTraverser* it)
+{
+ bool visit = true;
+
+ if(it->preVisit)
+ {
+ visit = it->visitAggregate(PreVisit, this);
+ }
+
+ if(visit)
+ {
+ it->incrementDepth();
+
+ if(it->rightToLeft)
+ {
+ for(TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
+ {
+ (*sit)->traverse(it);
+
+ if(visit && it->inVisit)
+ {
+ if(*sit != sequence.front())
+ {
+ visit = it->visitAggregate(InVisit, this);
+ }
+ }
+ }
+ }
+ else
+ {
+ for(TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ (*sit)->traverse(it);
+
+ if(visit && it->inVisit)
+ {
+ if(*sit != sequence.back())
+ {
+ visit = it->visitAggregate(InVisit, this);
+ }
+ }
+ }
+ }
+
+ it->decrementDepth();
+ }
+
+ if(visit && it->postVisit)
+ {
+ it->visitAggregate(PostVisit, this);
+ }
+}
+
+//
+// Traverse a selection node. Same comments in binary node apply here.
+//
+void TIntermSelection::traverse(TIntermTraverser* it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitSelection(PreVisit, this);
+
+ if (visit) {
+ it->incrementDepth();
+ if (it->rightToLeft) {
+ if (falseBlock)
+ falseBlock->traverse(it);
+ if (trueBlock)
+ trueBlock->traverse(it);
+ condition->traverse(it);
+ } else {
+ condition->traverse(it);
+ if (trueBlock)
+ trueBlock->traverse(it);
+ if (falseBlock)
+ falseBlock->traverse(it);
+ }
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitSelection(PostVisit, this);
+}
+
+//
+// Traverse a loop node. Same comments in binary node apply here.
+//
+void TIntermLoop::traverse(TIntermTraverser* it)
+{
+ bool visit = true;
+
+ if(it->preVisit)
+ {
+ visit = it->visitLoop(PreVisit, this);
+ }
+
+ if(visit)
+ {
+ it->incrementDepth();
+
+ if(it->rightToLeft)
+ {
+ if(expr)
+ {
+ expr->traverse(it);
+ }
+
+ if(body)
+ {
+ body->traverse(it);
+ }
+
+ if(cond)
+ {
+ cond->traverse(it);
+ }
+ }
+ else
+ {
+ if(cond)
+ {
+ cond->traverse(it);
+ }
+
+ if(body)
+ {
+ body->traverse(it);
+ }
+
+ if(expr)
+ {
+ expr->traverse(it);
+ }
+ }
+
+ it->decrementDepth();
+ }
+
+ if(visit && it->postVisit)
+ {
+ it->visitLoop(PostVisit, this);
+ }
+}
+
+//
+// Traverse a branch node. Same comments in binary node apply here.
+//
+void TIntermBranch::traverse(TIntermTraverser* it)
+{
+ bool visit = true;
+
+ if (it->preVisit)
+ visit = it->visitBranch(PreVisit, this);
+
+ if (visit && expression) {
+ it->incrementDepth();
+ expression->traverse(it);
+ it->decrementDepth();
+ }
+
+ if (visit && it->postVisit)
+ it->visitBranch(PostVisit, this);
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp
new file mode 100644
index 0000000..e1e8da2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp
@@ -0,0 +1,1454 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Build the intermediate representation.
+//
+
+#include <float.h>
+#include <limits.h>
+#include <algorithm>
+
+#include "compiler/localintermediate.h"
+#include "compiler/QualifierAlive.h"
+#include "compiler/RemoveTree.h"
+
+bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
+
+static TPrecision GetHigherPrecision( TPrecision left, TPrecision right ){
+ return left > right ? left : right;
+}
+
+const char* getOperatorString(TOperator op) {
+ switch (op) {
+ case EOpInitialize: return "=";
+ case EOpAssign: return "=";
+ case EOpAddAssign: return "+=";
+ case EOpSubAssign: return "-=";
+ case EOpDivAssign: return "/=";
+
+ // Fall-through.
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign: return "*=";
+
+ // Fall-through.
+ case EOpIndexDirect:
+ case EOpIndexIndirect: return "[]";
+
+ case EOpIndexDirectStruct: return ".";
+ case EOpVectorSwizzle: return ".";
+ case EOpAdd: return "+";
+ case EOpSub: return "-";
+ case EOpMul: return "*";
+ case EOpDiv: return "/";
+ case EOpMod: UNIMPLEMENTED(); break;
+ case EOpEqual: return "==";
+ case EOpNotEqual: return "!=";
+ case EOpLessThan: return "<";
+ case EOpGreaterThan: return ">";
+ case EOpLessThanEqual: return "<=";
+ case EOpGreaterThanEqual: return ">=";
+
+ // Fall-through.
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesMatrix: return "*";
+
+ case EOpLogicalOr: return "||";
+ case EOpLogicalXor: return "^^";
+ case EOpLogicalAnd: return "&&";
+ case EOpNegative: return "-";
+ case EOpVectorLogicalNot: return "not";
+ case EOpLogicalNot: return "!";
+ case EOpPostIncrement: return "++";
+ case EOpPostDecrement: return "--";
+ case EOpPreIncrement: return "++";
+ case EOpPreDecrement: return "--";
+
+ // Fall-through.
+ case EOpConvIntToBool:
+ case EOpConvFloatToBool: return "bool";
+
+ // Fall-through.
+ case EOpConvBoolToFloat:
+ case EOpConvIntToFloat: return "float";
+
+ // Fall-through.
+ case EOpConvFloatToInt:
+ case EOpConvBoolToInt: return "int";
+
+ case EOpRadians: return "radians";
+ case EOpDegrees: return "degrees";
+ case EOpSin: return "sin";
+ case EOpCos: return "cos";
+ case EOpTan: return "tan";
+ case EOpAsin: return "asin";
+ case EOpAcos: return "acos";
+ case EOpAtan: return "atan";
+ case EOpExp: return "exp";
+ case EOpLog: return "log";
+ case EOpExp2: return "exp2";
+ case EOpLog2: return "log2";
+ case EOpSqrt: return "sqrt";
+ case EOpInverseSqrt: return "inversesqrt";
+ case EOpAbs: return "abs";
+ case EOpSign: return "sign";
+ case EOpFloor: return "floor";
+ case EOpCeil: return "ceil";
+ case EOpFract: return "fract";
+ case EOpLength: return "length";
+ case EOpNormalize: return "normalize";
+ case EOpDFdx: return "dFdx";
+ case EOpDFdy: return "dFdy";
+ case EOpFwidth: return "fwidth";
+ case EOpAny: return "any";
+ case EOpAll: return "all";
+
+ default: break;
+ }
+ return "";
+}
+
+////////////////////////////////////////////////////////////////////////////
+//
+// First set of functions are to help build the intermediate representation.
+// These functions are not member functions of the nodes.
+// They are called from parser productions.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+//
+// Add a terminal node for an identifier in an expression.
+//
+// Returns the added node.
+//
+TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, TSourceLoc line)
+{
+ TIntermSymbol* node = new TIntermSymbol(id, name, type);
+ node->setLine(line);
+
+ return node;
+}
+
+//
+// Connect two nodes with a new parent that does a binary operation on the nodes.
+//
+// Returns the added node.
+//
+TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TSymbolTable& symbolTable)
+{
+ switch (op) {
+ case EOpEqual:
+ case EOpNotEqual:
+ if (left->isArray())
+ return 0;
+ break;
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ if (left->isMatrix() || left->isArray() || left->isVector() || left->getBasicType() == EbtStruct) {
+ return 0;
+ }
+ break;
+ case EOpLogicalOr:
+ case EOpLogicalXor:
+ case EOpLogicalAnd:
+ if (left->getBasicType() != EbtBool || left->isMatrix() || left->isArray() || left->isVector()) {
+ return 0;
+ }
+ break;
+ case EOpAdd:
+ case EOpSub:
+ case EOpDiv:
+ case EOpMul:
+ if (left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool)
+ return 0;
+ default: break;
+ }
+
+ //
+ // First try converting the children to compatible types.
+ //
+ if (left->getType().getStruct() && right->getType().getStruct()) {
+ if (left->getType() != right->getType())
+ return 0;
+ } else {
+ TIntermTyped* child = addConversion(op, left->getType(), right);
+ if (child)
+ right = child;
+ else {
+ child = addConversion(op, right->getType(), left);
+ if (child)
+ left = child;
+ else
+ return 0;
+ }
+ }
+
+ //
+ // Need a new node holding things together then. Make
+ // one and promote it to the right type.
+ //
+ TIntermBinary* node = new TIntermBinary(op);
+ if (line == 0)
+ line = right->getLine();
+ node->setLine(line);
+
+ node->setLeft(left);
+ node->setRight(right);
+ if (!node->promote(infoSink))
+ return 0;
+
+ //
+ // See if we can fold constants.
+ //
+ TIntermTyped* typedReturnNode = 0;
+ TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
+ TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
+ if (leftTempConstant && rightTempConstant) {
+ typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
+
+ if (typedReturnNode)
+ return typedReturnNode;
+ }
+
+ return node;
+}
+
+//
+// Connect two nodes through an assignment.
+//
+// Returns the added node.
+//
+TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
+{
+ //
+ // Like adding binary math, except the conversion can only go
+ // from right to left.
+ //
+ TIntermBinary* node = new TIntermBinary(op);
+ if (line == 0)
+ line = left->getLine();
+ node->setLine(line);
+
+ TIntermTyped* child = addConversion(op, left->getType(), right);
+ if (child == 0)
+ return 0;
+
+ node->setLeft(left);
+ node->setRight(child);
+ if (! node->promote(infoSink))
+ return 0;
+
+ return node;
+}
+
+//
+// Connect two nodes through an index operator, where the left node is the base
+// of an array or struct, and the right node is a direct or indirect offset.
+//
+// Returns the added node.
+// The caller should set the type of the returned node.
+//
+TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc line)
+{
+ TIntermBinary* node = new TIntermBinary(op);
+ if (line == 0)
+ line = index->getLine();
+ node->setLine(line);
+ node->setLeft(base);
+ node->setRight(index);
+
+ // caller should set the type
+
+ return node;
+}
+
+//
+// Add one node as the parent of another that it operates on.
+//
+// Returns the added node.
+//
+TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, TSourceLoc line, TSymbolTable& symbolTable)
+{
+ TIntermUnary* node;
+ TIntermTyped* child = childNode->getAsTyped();
+
+ if (child == 0) {
+ infoSink.info.message(EPrefixInternalError, "Bad type in AddUnaryMath", line);
+ return 0;
+ }
+
+ switch (op) {
+ case EOpLogicalNot:
+ if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) {
+ return 0;
+ }
+ break;
+
+ case EOpPostIncrement:
+ case EOpPreIncrement:
+ case EOpPostDecrement:
+ case EOpPreDecrement:
+ case EOpNegative:
+ if (child->getType().getBasicType() == EbtStruct || child->getType().isArray())
+ return 0;
+ default: break;
+ }
+
+ //
+ // Do we need to promote the operand?
+ //
+ // Note: Implicit promotions were removed from the language.
+ //
+ TBasicType newType = EbtVoid;
+ switch (op) {
+ case EOpConstructInt: newType = EbtInt; break;
+ case EOpConstructBool: newType = EbtBool; break;
+ case EOpConstructFloat: newType = EbtFloat; break;
+ default: break;
+ }
+
+ if (newType != EbtVoid) {
+ child = addConversion(op, TType(newType, child->getPrecision(), EvqTemporary,
+ child->getNominalSize(),
+ child->isMatrix(),
+ child->isArray()),
+ child);
+ if (child == 0)
+ return 0;
+ }
+
+ //
+ // For constructors, we are now done, it's all in the conversion.
+ //
+ switch (op) {
+ case EOpConstructInt:
+ case EOpConstructBool:
+ case EOpConstructFloat:
+ return child;
+ default: break;
+ }
+
+ TIntermConstantUnion *childTempConstant = 0;
+ if (child->getAsConstantUnion())
+ childTempConstant = child->getAsConstantUnion();
+
+ //
+ // Make a new node for the operator.
+ //
+ node = new TIntermUnary(op);
+ if (line == 0)
+ line = child->getLine();
+ node->setLine(line);
+ node->setOperand(child);
+
+ if (! node->promote(infoSink))
+ return 0;
+
+ if (childTempConstant) {
+ TIntermTyped* newChild = childTempConstant->fold(op, 0, infoSink);
+
+ if (newChild)
+ return newChild;
+ }
+
+ return node;
+}
+
+//
+// This is the safe way to change the operator on an aggregate, as it
+// does lots of error checking and fixing. Especially for establishing
+// a function call's operation on it's set of parameters. Sequences
+// of instructions are also aggregates, but they just direnctly set
+// their operator to EOpSequence.
+//
+// Returns an aggregate node, which could be the one passed in if
+// it was already an aggregate.
+//
+TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, TSourceLoc line)
+{
+ TIntermAggregate* aggNode;
+
+ //
+ // Make sure we have an aggregate. If not turn it into one.
+ //
+ if (node) {
+ aggNode = node->getAsAggregate();
+ if (aggNode == 0 || aggNode->getOp() != EOpNull) {
+ //
+ // Make an aggregate containing this node.
+ //
+ aggNode = new TIntermAggregate();
+ aggNode->getSequence().push_back(node);
+ if (line == 0)
+ line = node->getLine();
+ }
+ } else
+ aggNode = new TIntermAggregate();
+
+ //
+ // Set the operator.
+ //
+ aggNode->setOp(op);
+ if (line != 0)
+ aggNode->setLine(line);
+
+ return aggNode;
+}
+
+//
+// Convert one type to another.
+//
+// Returns the node representing the conversion, which could be the same
+// node passed in if no conversion was needed.
+//
+// Return 0 if a conversion can't be done.
+//
+TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node)
+{
+ //
+ // Does the base type allow operation?
+ //
+ switch (node->getBasicType()) {
+ case EbtVoid:
+ case EbtSampler2D:
+ case EbtSamplerCube:
+ return 0;
+ default: break;
+ }
+
+ //
+ // Otherwise, if types are identical, no problem
+ //
+ if (type == node->getType())
+ return node;
+
+ //
+ // If one's a structure, then no conversions.
+ //
+ if (type.getStruct() || node->getType().getStruct())
+ return 0;
+
+ //
+ // If one's an array, then no conversions.
+ //
+ if (type.isArray() || node->getType().isArray())
+ return 0;
+
+ TBasicType promoteTo;
+
+ switch (op) {
+ //
+ // Explicit conversions
+ //
+ case EOpConstructBool:
+ promoteTo = EbtBool;
+ break;
+ case EOpConstructFloat:
+ promoteTo = EbtFloat;
+ break;
+ case EOpConstructInt:
+ promoteTo = EbtInt;
+ break;
+ default:
+ //
+ // implicit conversions were removed from the language.
+ //
+ if (type.getBasicType() != node->getType().getBasicType())
+ return 0;
+ //
+ // Size and structure could still differ, but that's
+ // handled by operator promotion.
+ //
+ return node;
+ }
+
+ if (node->getAsConstantUnion()) {
+
+ return (promoteConstantUnion(promoteTo, node->getAsConstantUnion()));
+ } else {
+
+ //
+ // Add a new newNode for the conversion.
+ //
+ TIntermUnary* newNode = 0;
+
+ TOperator newOp = EOpNull;
+ switch (promoteTo) {
+ case EbtFloat:
+ switch (node->getBasicType()) {
+ case EbtInt: newOp = EOpConvIntToFloat; break;
+ case EbtBool: newOp = EOpConvBoolToFloat; break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
+ return 0;
+ }
+ break;
+ case EbtBool:
+ switch (node->getBasicType()) {
+ case EbtInt: newOp = EOpConvIntToBool; break;
+ case EbtFloat: newOp = EOpConvFloatToBool; break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
+ return 0;
+ }
+ break;
+ case EbtInt:
+ switch (node->getBasicType()) {
+ case EbtBool: newOp = EOpConvBoolToInt; break;
+ case EbtFloat: newOp = EOpConvFloatToInt; break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
+ return 0;
+ }
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Bad promotion type", node->getLine());
+ return 0;
+ }
+
+ TType type(promoteTo, node->getPrecision(), EvqTemporary, node->getNominalSize(), node->isMatrix(), node->isArray());
+ newNode = new TIntermUnary(newOp, type);
+ newNode->setLine(node->getLine());
+ newNode->setOperand(node);
+
+ return newNode;
+ }
+}
+
+//
+// Safe way to combine two nodes into an aggregate. Works with null pointers,
+// a node that's not a aggregate yet, etc.
+//
+// Returns the resulting aggregate, unless 0 was passed in for
+// both existing nodes.
+//
+TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc line)
+{
+ if (left == 0 && right == 0)
+ return 0;
+
+ TIntermAggregate* aggNode = 0;
+ if (left)
+ aggNode = left->getAsAggregate();
+ if (!aggNode || aggNode->getOp() != EOpNull) {
+ aggNode = new TIntermAggregate;
+ if (left)
+ aggNode->getSequence().push_back(left);
+ }
+
+ if (right)
+ aggNode->getSequence().push_back(right);
+
+ if (line != 0)
+ aggNode->setLine(line);
+
+ return aggNode;
+}
+
+//
+// Turn an existing node into an aggregate.
+//
+// Returns an aggregate, unless 0 was passed in for the existing node.
+//
+TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc line)
+{
+ if (node == 0)
+ return 0;
+
+ TIntermAggregate* aggNode = new TIntermAggregate;
+ aggNode->getSequence().push_back(node);
+
+ if (line != 0)
+ aggNode->setLine(line);
+ else
+ aggNode->setLine(node->getLine());
+
+ return aggNode;
+}
+
+//
+// For "if" test nodes. There are three children; a condition,
+// a true path, and a false path. The two paths are in the
+// nodePair.
+//
+// Returns the selection node created.
+//
+TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, TSourceLoc line)
+{
+ //
+ // For compile time constant selections, prune the code and
+ // test now.
+ //
+
+ if (cond->getAsTyped() && cond->getAsTyped()->getAsConstantUnion()) {
+ if (cond->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getBConst())
+ return nodePair.node1;
+ else
+ return nodePair.node2;
+ }
+
+ TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2);
+ node->setLine(line);
+
+ return node;
+}
+
+
+TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
+{
+ if (left->getType().getQualifier() == EvqConst && right->getType().getQualifier() == EvqConst) {
+ return right;
+ } else {
+ TIntermTyped *commaAggregate = growAggregate(left, right, line);
+ commaAggregate->getAsAggregate()->setOp(EOpComma);
+ commaAggregate->setType(right->getType());
+ commaAggregate->getTypePointer()->setQualifier(EvqTemporary);
+ return commaAggregate;
+ }
+}
+
+//
+// For "?:" test nodes. There are three children; a condition,
+// a true path, and a false path. The two paths are specified
+// as separate parameters.
+//
+// Returns the selection node created, or 0 if one could not be.
+//
+TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc line)
+{
+ //
+ // Get compatible types.
+ //
+ TIntermTyped* child = addConversion(EOpSequence, trueBlock->getType(), falseBlock);
+ if (child)
+ falseBlock = child;
+ else {
+ child = addConversion(EOpSequence, falseBlock->getType(), trueBlock);
+ if (child)
+ trueBlock = child;
+ else
+ return 0;
+ }
+
+ //
+ // See if all the operands are constant, then fold it otherwise not.
+ //
+
+ if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
+ if (cond->getAsConstantUnion()->getUnionArrayPointer()->getBConst())
+ return trueBlock;
+ else
+ return falseBlock;
+ }
+
+ //
+ // Make a selection node.
+ //
+ TIntermSelection* node = new TIntermSelection(cond, trueBlock, falseBlock, trueBlock->getType());
+ node->setLine(line);
+
+ return node;
+}
+
+//
+// Constant terminal nodes. Has a union that contains bool, float or int constants
+//
+// Returns the constant union node created.
+//
+
+TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType& t, TSourceLoc line)
+{
+ TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t);
+ node->setLine(line);
+
+ return node;
+}
+
+TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line)
+{
+
+ TIntermAggregate* node = new TIntermAggregate(EOpSequence);
+
+ node->setLine(line);
+ TIntermConstantUnion* constIntNode;
+ TIntermSequence &sequenceVector = node->getSequence();
+ ConstantUnion* unionArray;
+
+ for (int i = 0; i < fields.num; i++) {
+ unionArray = new ConstantUnion[1];
+ unionArray->setIConst(fields.offsets[i]);
+ constIntNode = addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), line);
+ sequenceVector.push_back(constIntNode);
+ }
+
+ return node;
+}
+
+//
+// Create loop nodes.
+//
+TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTyped* cond, TIntermTyped* expr, TIntermNode* body, TSourceLoc line)
+{
+ TIntermNode* node = new TIntermLoop(type, init, cond, expr, body);
+ node->setLine(line);
+
+ return node;
+}
+
+//
+// Add branches.
+//
+TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TSourceLoc line)
+{
+ return addBranch(branchOp, 0, line);
+}
+
+TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, TSourceLoc line)
+{
+ TIntermBranch* node = new TIntermBranch(branchOp, expression);
+ node->setLine(line);
+
+ return node;
+}
+
+//
+// This is to be executed once the final root is put on top by the parsing
+// process.
+//
+bool TIntermediate::postProcess(TIntermNode* root)
+{
+ if (root == 0)
+ return true;
+
+ //
+ // First, finish off the top level sequence, if any
+ //
+ TIntermAggregate* aggRoot = root->getAsAggregate();
+ if (aggRoot && aggRoot->getOp() == EOpNull)
+ aggRoot->setOp(EOpSequence);
+
+ return true;
+}
+
+//
+// This deletes the tree.
+//
+void TIntermediate::remove(TIntermNode* root)
+{
+ if (root)
+ RemoveAllTreeNodes(root);
+}
+
+////////////////////////////////////////////////////////////////
+//
+// Member functions of the nodes used for building the tree.
+//
+////////////////////////////////////////////////////////////////
+
+//
+// Say whether or not an operation node changes the value of a variable.
+//
+// Returns true if state is modified.
+//
+bool TIntermOperator::modifiesState() const
+{
+ switch (op) {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ case EOpAssign:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ case EOpDivAssign:
+ return true;
+ default:
+ return false;
+ }
+}
+
+//
+// returns true if the operator is for one of the constructors
+//
+bool TIntermOperator::isConstructor() const
+{
+ switch (op) {
+ case EOpConstructVec2:
+ case EOpConstructVec3:
+ case EOpConstructVec4:
+ case EOpConstructMat2:
+ case EOpConstructMat3:
+ case EOpConstructMat4:
+ case EOpConstructFloat:
+ case EOpConstructIVec2:
+ case EOpConstructIVec3:
+ case EOpConstructIVec4:
+ case EOpConstructInt:
+ case EOpConstructBVec2:
+ case EOpConstructBVec3:
+ case EOpConstructBVec4:
+ case EOpConstructBool:
+ case EOpConstructStruct:
+ return true;
+ default:
+ return false;
+ }
+}
+//
+// Make sure the type of a unary operator is appropriate for its
+// combination of operation and operand type.
+//
+// Returns false in nothing makes sense.
+//
+bool TIntermUnary::promote(TInfoSink&)
+{
+ switch (op) {
+ case EOpLogicalNot:
+ if (operand->getBasicType() != EbtBool)
+ return false;
+ break;
+ case EOpNegative:
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ if (operand->getBasicType() == EbtBool)
+ return false;
+ break;
+
+ // operators for built-ins are already type checked against their prototype
+ case EOpAny:
+ case EOpAll:
+ case EOpVectorLogicalNot:
+ return true;
+
+ default:
+ if (operand->getBasicType() != EbtFloat)
+ return false;
+ }
+
+ setType(operand->getType());
+
+ return true;
+}
+
+//
+// Establishes the type of the resultant operation, as well as
+// makes the operator the correct one for the operands.
+//
+// Returns false if operator can't work on operands.
+//
+bool TIntermBinary::promote(TInfoSink& infoSink)
+{
+ // This function only handles scalars, vectors, and matrices.
+ if (left->isArray() || right->isArray()) {
+ infoSink.info.message(EPrefixInternalError, "Invalid operation for arrays", getLine());
+ return false;
+ }
+
+ // GLSL ES 2.0 does not support implicit type casting.
+ // So the basic type should always match.
+ if (left->getBasicType() != right->getBasicType())
+ return false;
+
+ //
+ // Base assumption: just make the type the same as the left
+ // operand. Then only deviations from this need be coded.
+ //
+ setType(left->getType());
+
+ // The result gets promoted to the highest precision.
+ TPrecision higherPrecision = GetHigherPrecision(left->getPrecision(), right->getPrecision());
+ getTypePointer()->setPrecision(higherPrecision);
+
+ // Binary operations results in temporary variables unless both
+ // operands are const.
+ if (left->getQualifier() != EvqConst || right->getQualifier() != EvqConst) {
+ getTypePointer()->setQualifier(EvqTemporary);
+ }
+
+ int size = std::max(left->getNominalSize(), right->getNominalSize());
+
+ //
+ // All scalars. Code after this test assumes this case is removed!
+ //
+ if (size == 1) {
+ switch (op) {
+ //
+ // Promote to conditional
+ //
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ setType(TType(EbtBool, EbpUndefined));
+ break;
+
+ //
+ // And and Or operate on conditionals
+ //
+ case EOpLogicalAnd:
+ case EOpLogicalOr:
+ // Both operands must be of type bool.
+ if (left->getBasicType() != EbtBool || right->getBasicType() != EbtBool)
+ return false;
+ setType(TType(EbtBool, EbpUndefined));
+ break;
+
+ default:
+ break;
+ }
+ return true;
+ }
+
+ // If we reach here, at least one of the operands is vector or matrix.
+ // The other operand could be a scalar, vector, or matrix.
+ // Are the sizes compatible?
+ //
+ if (left->getNominalSize() != right->getNominalSize()) {
+ // If the nominal size of operands do not match:
+ // One of them must be scalar.
+ if (left->getNominalSize() != 1 && right->getNominalSize() != 1)
+ return false;
+ // Operator cannot be of type pure assignment.
+ if (op == EOpAssign || op == EOpInitialize)
+ return false;
+ }
+
+ //
+ // Can these two operands be combined?
+ //
+ TBasicType basicType = left->getBasicType();
+ switch (op) {
+ case EOpMul:
+ if (!left->isMatrix() && right->isMatrix()) {
+ if (left->isVector())
+ op = EOpVectorTimesMatrix;
+ else {
+ op = EOpMatrixTimesScalar;
+ setType(TType(basicType, higherPrecision, EvqTemporary, size, true));
+ }
+ } else if (left->isMatrix() && !right->isMatrix()) {
+ if (right->isVector()) {
+ op = EOpMatrixTimesVector;
+ setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
+ } else {
+ op = EOpMatrixTimesScalar;
+ }
+ } else if (left->isMatrix() && right->isMatrix()) {
+ op = EOpMatrixTimesMatrix;
+ } else if (!left->isMatrix() && !right->isMatrix()) {
+ if (left->isVector() && right->isVector()) {
+ // leave as component product
+ } else if (left->isVector() || right->isVector()) {
+ op = EOpVectorTimesScalar;
+ setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
+ }
+ } else {
+ infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
+ return false;
+ }
+ break;
+ case EOpMulAssign:
+ if (!left->isMatrix() && right->isMatrix()) {
+ if (left->isVector())
+ op = EOpVectorTimesMatrixAssign;
+ else {
+ return false;
+ }
+ } else if (left->isMatrix() && !right->isMatrix()) {
+ if (right->isVector()) {
+ return false;
+ } else {
+ op = EOpMatrixTimesScalarAssign;
+ }
+ } else if (left->isMatrix() && right->isMatrix()) {
+ op = EOpMatrixTimesMatrixAssign;
+ } else if (!left->isMatrix() && !right->isMatrix()) {
+ if (left->isVector() && right->isVector()) {
+ // leave as component product
+ } else if (left->isVector() || right->isVector()) {
+ if (! left->isVector())
+ return false;
+ op = EOpVectorTimesScalarAssign;
+ setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
+ }
+ } else {
+ infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
+ return false;
+ }
+ break;
+
+ case EOpAssign:
+ case EOpInitialize:
+ case EOpAdd:
+ case EOpSub:
+ case EOpDiv:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpDivAssign:
+ if ((left->isMatrix() && right->isVector()) ||
+ (left->isVector() && right->isMatrix()))
+ return false;
+ setType(TType(basicType, higherPrecision, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
+ break;
+
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ if ((left->isMatrix() && right->isVector()) ||
+ (left->isVector() && right->isMatrix()))
+ return false;
+ setType(TType(EbtBool, EbpUndefined));
+ break;
+
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
+{
+ const TTypeList* fields = leftNodeType.getStruct();
+
+ size_t structSize = fields->size();
+ int index = 0;
+
+ for (size_t j = 0; j < structSize; j++) {
+ int size = (*fields)[j].type->getObjectSize();
+ for (int i = 0; i < size; i++) {
+ if ((*fields)[j].type->getBasicType() == EbtStruct) {
+ if (!CompareStructure(*(*fields)[j].type, &rightUnionArray[index], &leftUnionArray[index]))
+ return false;
+ } else {
+ if (leftUnionArray[index] != rightUnionArray[index])
+ return false;
+ index++;
+ }
+
+ }
+ }
+ return true;
+}
+
+bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
+{
+ if (leftNodeType.isArray()) {
+ TType typeWithoutArrayness = leftNodeType;
+ typeWithoutArrayness.clearArrayness();
+
+ int arraySize = leftNodeType.getArraySize();
+
+ for (int i = 0; i < arraySize; ++i) {
+ int offset = typeWithoutArrayness.getObjectSize() * i;
+ if (!CompareStruct(typeWithoutArrayness, &rightUnionArray[offset], &leftUnionArray[offset]))
+ return false;
+ }
+ } else
+ return CompareStruct(leftNodeType, rightUnionArray, leftUnionArray);
+
+ return true;
+}
+
+//
+// The fold functions see if an operation on a constant can be done in place,
+// without generating run-time code.
+//
+// Returns the node to keep using, which may or may not be the node passed in.
+//
+
+TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink)
+{
+ ConstantUnion *unionArray = getUnionArrayPointer();
+ int objectSize = getType().getObjectSize();
+
+ if (constantNode) { // binary operations
+ TIntermConstantUnion *node = constantNode->getAsConstantUnion();
+ ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+ TType returnType = getType();
+
+ // for a case like float f = 1.2 + vec4(2,3,4,5);
+ if (constantNode->getType().getObjectSize() == 1 && objectSize > 1) {
+ rightUnionArray = new ConstantUnion[objectSize];
+ for (int i = 0; i < objectSize; ++i)
+ rightUnionArray[i] = *node->getUnionArrayPointer();
+ returnType = getType();
+ } else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1) {
+ // for a case like float f = vec4(2,3,4,5) + 1.2;
+ unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
+ for (int i = 0; i < constantNode->getType().getObjectSize(); ++i)
+ unionArray[i] = *getUnionArrayPointer();
+ returnType = node->getType();
+ objectSize = constantNode->getType().getObjectSize();
+ }
+
+ ConstantUnion* tempConstArray = 0;
+ TIntermConstantUnion *tempNode;
+
+ bool boolNodeFlag = false;
+ switch(op) {
+ case EOpAdd:
+ tempConstArray = new ConstantUnion[objectSize];
+ {// support MSVC++6.0
+ for (int i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] + rightUnionArray[i];
+ }
+ break;
+ case EOpSub:
+ tempConstArray = new ConstantUnion[objectSize];
+ {// support MSVC++6.0
+ for (int i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] - rightUnionArray[i];
+ }
+ break;
+
+ case EOpMul:
+ case EOpVectorTimesScalar:
+ case EOpMatrixTimesScalar:
+ tempConstArray = new ConstantUnion[objectSize];
+ {// support MSVC++6.0
+ for (int i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] * rightUnionArray[i];
+ }
+ break;
+ case EOpMatrixTimesMatrix:
+ if (getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat) {
+ infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix multiply", getLine());
+ return 0;
+ }
+ {// support MSVC++6.0
+ int size = getNominalSize();
+ tempConstArray = new ConstantUnion[size*size];
+ for (int row = 0; row < size; row++) {
+ for (int column = 0; column < size; column++) {
+ tempConstArray[size * column + row].setFConst(0.0f);
+ for (int i = 0; i < size; i++) {
+ tempConstArray[size * column + row].setFConst(tempConstArray[size * column + row].getFConst() + unionArray[i * size + row].getFConst() * (rightUnionArray[column * size + i].getFConst()));
+ }
+ }
+ }
+ }
+ break;
+ case EOpDiv:
+ tempConstArray = new ConstantUnion[objectSize];
+ {// support MSVC++6.0
+ for (int i = 0; i < objectSize; i++) {
+ switch (getType().getBasicType()) {
+ case EbtFloat:
+ if (rightUnionArray[i] == 0.0f) {
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
+ tempConstArray[i].setFConst(FLT_MAX);
+ } else
+ tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
+ break;
+
+ case EbtInt:
+ if (rightUnionArray[i] == 0) {
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
+ tempConstArray[i].setIConst(INT_MAX);
+ } else
+ tempConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", getLine());
+ return 0;
+ }
+ }
+ }
+ break;
+
+ case EOpMatrixTimesVector:
+ if (node->getBasicType() != EbtFloat) {
+ infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix times vector", getLine());
+ return 0;
+ }
+ tempConstArray = new ConstantUnion[getNominalSize()];
+
+ {// support MSVC++6.0
+ for (int size = getNominalSize(), i = 0; i < size; i++) {
+ tempConstArray[i].setFConst(0.0f);
+ for (int j = 0; j < size; j++) {
+ tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j*size + i].getFConst()) * rightUnionArray[j].getFConst()));
+ }
+ }
+ }
+
+ tempNode = new TIntermConstantUnion(tempConstArray, node->getType());
+ tempNode->setLine(getLine());
+
+ return tempNode;
+
+ case EOpVectorTimesMatrix:
+ if (getType().getBasicType() != EbtFloat) {
+ infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for vector times matrix", getLine());
+ return 0;
+ }
+
+ tempConstArray = new ConstantUnion[getNominalSize()];
+ {// support MSVC++6.0
+ for (int size = getNominalSize(), i = 0; i < size; i++) {
+ tempConstArray[i].setFConst(0.0f);
+ for (int j = 0; j < size; j++) {
+ tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j].getFConst()) * rightUnionArray[i*size + j].getFConst()));
+ }
+ }
+ }
+ break;
+
+ case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
+ tempConstArray = new ConstantUnion[objectSize];
+ {// support MSVC++6.0
+ for (int i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] && rightUnionArray[i];
+ }
+ break;
+
+ case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
+ tempConstArray = new ConstantUnion[objectSize];
+ {// support MSVC++6.0
+ for (int i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] || rightUnionArray[i];
+ }
+ break;
+
+ case EOpLogicalXor:
+ tempConstArray = new ConstantUnion[objectSize];
+ {// support MSVC++6.0
+ for (int i = 0; i < objectSize; i++)
+ switch (getType().getBasicType()) {
+ case EbtBool: tempConstArray[i].setBConst((unionArray[i] == rightUnionArray[i]) ? false : true); break;
+ default: assert(false && "Default missing");
+ }
+ }
+ break;
+
+ case EOpLessThan:
+ assert(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray < *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+ case EOpGreaterThan:
+ assert(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray > *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+ case EOpLessThanEqual:
+ {
+ assert(objectSize == 1);
+ ConstantUnion constant;
+ constant.setBConst(*unionArray > *rightUnionArray);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(!constant.getBConst());
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+ }
+ case EOpGreaterThanEqual:
+ {
+ assert(objectSize == 1);
+ ConstantUnion constant;
+ constant.setBConst(*unionArray < *rightUnionArray);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(!constant.getBConst());
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+ }
+
+ case EOpEqual:
+ if (getType().getBasicType() == EbtStruct) {
+ if (!CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ boolNodeFlag = true;
+ } else {
+ for (int i = 0; i < objectSize; i++) {
+ if (unionArray[i] != rightUnionArray[i]) {
+ boolNodeFlag = true;
+ break; // break out of for loop
+ }
+ }
+ }
+
+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag) {
+ tempConstArray->setBConst(true);
+ }
+ else {
+ tempConstArray->setBConst(false);
+ }
+
+ tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
+
+ return tempNode;
+
+ case EOpNotEqual:
+ if (getType().getBasicType() == EbtStruct) {
+ if (CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ boolNodeFlag = true;
+ } else {
+ for (int i = 0; i < objectSize; i++) {
+ if (unionArray[i] == rightUnionArray[i]) {
+ boolNodeFlag = true;
+ break; // break out of for loop
+ }
+ }
+ }
+
+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag) {
+ tempConstArray->setBConst(true);
+ }
+ else {
+ tempConstArray->setBConst(false);
+ }
+
+ tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
+
+ return tempNode;
+
+ default:
+ infoSink.info.message(EPrefixInternalError, "Invalid operator for constant folding", getLine());
+ return 0;
+ }
+ tempNode = new TIntermConstantUnion(tempConstArray, returnType);
+ tempNode->setLine(getLine());
+
+ return tempNode;
+ } else {
+ //
+ // Do unary operations
+ //
+ TIntermConstantUnion *newNode = 0;
+ ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
+ for (int i = 0; i < objectSize; i++) {
+ switch(op) {
+ case EOpNegative:
+ switch (getType().getBasicType()) {
+ case EbtFloat: tempConstArray[i].setFConst(-unionArray[i].getFConst()); break;
+ case EbtInt: tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
+ return 0;
+ }
+ break;
+ case EOpLogicalNot: // this code is written for possible future use, will not get executed currently
+ switch (getType().getBasicType()) {
+ case EbtBool: tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
+ return 0;
+ }
+ break;
+ default:
+ return 0;
+ }
+ }
+ newNode = new TIntermConstantUnion(tempConstArray, getType());
+ newNode->setLine(getLine());
+ return newNode;
+ }
+
+ return this;
+}
+
+TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
+{
+ ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+ int size = node->getType().getObjectSize();
+
+ ConstantUnion *leftUnionArray = new ConstantUnion[size];
+
+ for (int i=0; i < size; i++) {
+
+ switch (promoteTo) {
+ case EbtFloat:
+ switch (node->getType().getBasicType()) {
+ case EbtInt:
+ leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getIConst()));
+ break;
+ case EbtBool:
+ leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getBConst()));
+ break;
+ case EbtFloat:
+ leftUnionArray[i] = rightUnionArray[i];
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
+ return 0;
+ }
+ break;
+ case EbtInt:
+ switch (node->getType().getBasicType()) {
+ case EbtInt:
+ leftUnionArray[i] = rightUnionArray[i];
+ break;
+ case EbtBool:
+ leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getBConst()));
+ break;
+ case EbtFloat:
+ leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getFConst()));
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
+ return 0;
+ }
+ break;
+ case EbtBool:
+ switch (node->getType().getBasicType()) {
+ case EbtInt:
+ leftUnionArray[i].setBConst(rightUnionArray[i].getIConst() != 0);
+ break;
+ case EbtBool:
+ leftUnionArray[i] = rightUnionArray[i];
+ break;
+ case EbtFloat:
+ leftUnionArray[i].setBConst(rightUnionArray[i].getFConst() != 0.0f);
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
+ return 0;
+ }
+
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, "Incorrect data type found", node->getLine());
+ return 0;
+ }
+
+ }
+
+ const TType& t = node->getType();
+
+ return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());
+}
+
+void TIntermAggregate::addToPragmaTable(const TPragmaTable& pTable)
+{
+ assert(!pragmaTable);
+ pragmaTable = new TPragmaTable();
+ *pragmaTable = pTable;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/MMap.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/MMap.h
new file mode 100644
index 0000000..a308671
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/MMap.h
@@ -0,0 +1,56 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _MMAP_INCLUDED_
+#define _MMAP_INCLUDED_
+
+//
+// Encapsulate memory mapped files
+//
+
+class TMMap {
+public:
+ TMMap(const char* fileName) :
+ fSize(-1), // -1 is the error value returned by GetFileSize()
+ fp(NULL),
+ fBuff(0) // 0 is the error value returned by MapViewOfFile()
+ {
+ if ((fp = fopen(fileName, "r")) == NULL)
+ return;
+ char c = getc(fp);
+ fSize = 0;
+ while (c != EOF) {
+ fSize++;
+ c = getc(fp);
+ }
+ if (c == EOF)
+ fSize++;
+ rewind(fp);
+ fBuff = (char*)malloc(sizeof(char) * fSize);
+ int count = 0;
+ c = getc(fp);
+ while (c != EOF) {
+ fBuff[count++] = c;
+ c = getc(fp);
+ }
+ fBuff[count++] = c;
+ }
+
+ char* getData() { return fBuff; }
+ int getSize() { return fSize; }
+
+ ~TMMap() {
+ if (fp != NULL)
+ fclose(fp);
+ }
+
+private:
+ int fSize; // size of file to map in
+ FILE *fp;
+ char* fBuff; // the actual data;
+};
+
+#endif // _MMAP_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp
new file mode 100644
index 0000000..23476f2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp
@@ -0,0 +1,690 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/OutputGLSL.h"
+#include "compiler/debug.h"
+
+namespace
+{
+TString getTypeName(const TType& type)
+{
+ TInfoSinkBase out;
+ if (type.isMatrix())
+ {
+ out << "mat";
+ out << type.getNominalSize();
+ }
+ else if (type.isVector())
+ {
+ switch (type.getBasicType())
+ {
+ case EbtFloat: out << "vec"; break;
+ case EbtInt: out << "ivec"; break;
+ case EbtBool: out << "bvec"; break;
+ default: UNREACHABLE(); break;
+ }
+ out << type.getNominalSize();
+ }
+ else
+ {
+ if (type.getBasicType() == EbtStruct)
+ out << type.getTypeName();
+ else
+ out << type.getBasicString();
+ }
+ return TString(out.c_str());
+}
+
+TString arrayBrackets(const TType& type)
+{
+ ASSERT(type.isArray());
+ TInfoSinkBase out;
+ out << "[" << type.getArraySize() << "]";
+ return TString(out.c_str());
+}
+
+bool isSingleStatement(TIntermNode* node) {
+ if (const TIntermAggregate* aggregate = node->getAsAggregate())
+ {
+ return (aggregate->getOp() != EOpFunction) &&
+ (aggregate->getOp() != EOpSequence);
+ }
+ else if (const TIntermSelection* selection = node->getAsSelectionNode())
+ {
+ // Ternary operators are usually part of an assignment operator.
+ // This handles those rare cases in which they are all by themselves.
+ return selection->usesTernaryOperator();
+ }
+ else if (node->getAsLoopNode())
+ {
+ return false;
+ }
+ return true;
+}
+} // namespace
+
+TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink)
+ : TIntermTraverser(true, true, true),
+ mObjSink(objSink),
+ mDeclaringVariables(false)
+{
+}
+
+void TOutputGLSL::writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr)
+{
+ TInfoSinkBase& out = objSink();
+ if (visit == PreVisit && preStr)
+ {
+ out << preStr;
+ }
+ else if (visit == InVisit && inStr)
+ {
+ out << inStr;
+ }
+ else if (visit == PostVisit && postStr)
+ {
+ out << postStr;
+ }
+}
+
+void TOutputGLSL::writeVariableType(const TType& type)
+{
+ TInfoSinkBase& out = objSink();
+ TQualifier qualifier = type.getQualifier();
+ // TODO(alokp): Validate qualifier for variable declarations.
+ if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
+ out << type.getQualifierString() << " ";
+
+ // Declare the struct if we have not done so already.
+ if ((type.getBasicType() == EbtStruct) &&
+ (mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
+ {
+ out << "struct " << type.getTypeName() << "{\n";
+ const TTypeList* structure = type.getStruct();
+ ASSERT(structure != NULL);
+ for (size_t i = 0; i < structure->size(); ++i)
+ {
+ const TType* fieldType = (*structure)[i].type;
+ ASSERT(fieldType != NULL);
+ out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
+ if (fieldType->isArray())
+ out << arrayBrackets(*fieldType);
+ out << ";\n";
+ }
+ out << "}";
+ mDeclaredStructs.insert(type.getTypeName());
+ }
+ else
+ {
+ out << getTypeName(type);
+ }
+}
+
+void TOutputGLSL::writeFunctionParameters(const TIntermSequence& args)
+{
+ TInfoSinkBase& out = objSink();
+ for (TIntermSequence::const_iterator iter = args.begin();
+ iter != args.end(); ++iter)
+ {
+ const TIntermSymbol* arg = (*iter)->getAsSymbolNode();
+ ASSERT(arg != NULL);
+
+ const TType& type = arg->getType();
+ TQualifier qualifier = type.getQualifier();
+ // TODO(alokp): Validate qualifier for function arguments.
+ if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
+ out << type.getQualifierString() << " ";
+
+ out << getTypeName(type);
+
+ const TString& name = arg->getSymbol();
+ if (!name.empty())
+ out << " " << name;
+ if (type.isArray())
+ out << arrayBrackets(type);
+
+ // Put a comma if this is not the last argument.
+ if (iter != args.end() - 1)
+ out << ", ";
+ }
+}
+
+const ConstantUnion* TOutputGLSL::writeConstantUnion(const TType& type,
+ const ConstantUnion* pConstUnion)
+{
+ TInfoSinkBase& out = objSink();
+
+ if (type.getBasicType() == EbtStruct)
+ {
+ out << type.getTypeName() << "(";
+ const TTypeList* structure = type.getStruct();
+ ASSERT(structure != NULL);
+ for (size_t i = 0; i < structure->size(); ++i)
+ {
+ const TType* fieldType = (*structure)[i].type;
+ ASSERT(fieldType != NULL);
+ pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
+ if (i != structure->size() - 1) out << ", ";
+ }
+ out << ")";
+ }
+ else
+ {
+ int size = type.getObjectSize();
+ bool writeType = size > 1;
+ if (writeType) out << getTypeName(type) << "(";
+ for (int i = 0; i < size; ++i, ++pConstUnion)
+ {
+ switch (pConstUnion->getType())
+ {
+ case EbtFloat: out << pConstUnion->getFConst(); break;
+ case EbtInt: out << pConstUnion->getIConst(); break;
+ case EbtBool: out << pConstUnion->getBConst(); break;
+ default: UNREACHABLE();
+ }
+ if (i != size - 1) out << ", ";
+ }
+ if (writeType) out << ")";
+ }
+ return pConstUnion;
+}
+
+void TOutputGLSL::visitSymbol(TIntermSymbol* node)
+{
+ TInfoSinkBase& out = objSink();
+ out << node->getSymbol();
+
+ if (mDeclaringVariables && node->getType().isArray())
+ out << arrayBrackets(node->getType());
+}
+
+void TOutputGLSL::visitConstantUnion(TIntermConstantUnion* node)
+{
+ writeConstantUnion(node->getType(), node->getUnionArrayPointer());
+}
+
+bool TOutputGLSL::visitBinary(Visit visit, TIntermBinary* node)
+{
+ bool visitChildren = true;
+ TInfoSinkBase& out = objSink();
+ switch (node->getOp())
+ {
+ case EOpInitialize:
+ if (visit == InVisit)
+ {
+ out << " = ";
+ // RHS of initialize is not being declared.
+ mDeclaringVariables = false;
+ }
+ break;
+ case EOpAssign: writeTriplet(visit, "(", " = ", ")"); break;
+ case EOpAddAssign: writeTriplet(visit, "(", " += ", ")"); break;
+ case EOpSubAssign: writeTriplet(visit, "(", " -= ", ")"); break;
+ case EOpDivAssign: writeTriplet(visit, "(", " /= ", ")"); break;
+ // Notice the fall-through.
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ writeTriplet(visit, "(", " *= ", ")");
+ break;
+
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ writeTriplet(visit, NULL, "[", "]");
+ break;
+ case EOpIndexDirectStruct:
+ if (visit == InVisit)
+ {
+ out << ".";
+ // TODO(alokp): ASSERT
+ out << node->getType().getFieldName();
+ visitChildren = false;
+ }
+ break;
+ case EOpVectorSwizzle:
+ if (visit == InVisit)
+ {
+ out << ".";
+ TIntermAggregate* rightChild = node->getRight()->getAsAggregate();
+ TIntermSequence& sequence = rightChild->getSequence();
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
+ {
+ TIntermConstantUnion* element = (*sit)->getAsConstantUnion();
+ ASSERT(element->getBasicType() == EbtInt);
+ ASSERT(element->getNominalSize() == 1);
+ const ConstantUnion& data = element->getUnionArrayPointer()[0];
+ ASSERT(data.getType() == EbtInt);
+ switch (data.getIConst())
+ {
+ case 0: out << "x"; break;
+ case 1: out << "y"; break;
+ case 2: out << "z"; break;
+ case 3: out << "w"; break;
+ default: UNREACHABLE(); break;
+ }
+ }
+ visitChildren = false;
+ }
+ break;
+
+ case EOpAdd: writeTriplet(visit, "(", " + ", ")"); break;
+ case EOpSub: writeTriplet(visit, "(", " - ", ")"); break;
+ case EOpMul: writeTriplet(visit, "(", " * ", ")"); break;
+ case EOpDiv: writeTriplet(visit, "(", " / ", ")"); break;
+ case EOpMod: UNIMPLEMENTED(); break;
+ case EOpEqual: writeTriplet(visit, "(", " == ", ")"); break;
+ case EOpNotEqual: writeTriplet(visit, "(", " != ", ")"); break;
+ case EOpLessThan: writeTriplet(visit, "(", " < ", ")"); break;
+ case EOpGreaterThan: writeTriplet(visit, "(", " > ", ")"); break;
+ case EOpLessThanEqual: writeTriplet(visit, "(", " <= ", ")"); break;
+ case EOpGreaterThanEqual: writeTriplet(visit, "(", " >= ", ")"); break;
+
+ // Notice the fall-through.
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesMatrix:
+ writeTriplet(visit, "(", " * ", ")");
+ break;
+
+ case EOpLogicalOr: writeTriplet(visit, "(", " || ", ")"); break;
+ case EOpLogicalXor: writeTriplet(visit, "(", " ^^ ", ")"); break;
+ case EOpLogicalAnd: writeTriplet(visit, "(", " && ", ")"); break;
+ default: UNREACHABLE(); break;
+ }
+
+ return visitChildren;
+}
+
+bool TOutputGLSL::visitUnary(Visit visit, TIntermUnary* node)
+{
+ switch (node->getOp())
+ {
+ case EOpNegative: writeTriplet(visit, "(-", NULL, ")"); break;
+ case EOpVectorLogicalNot: writeTriplet(visit, "not(", NULL, ")"); break;
+ case EOpLogicalNot: writeTriplet(visit, "(!", NULL, ")"); break;
+
+ case EOpPostIncrement: writeTriplet(visit, "(", NULL, "++)"); break;
+ case EOpPostDecrement: writeTriplet(visit, "(", NULL, "--)"); break;
+ case EOpPreIncrement: writeTriplet(visit, "(++", NULL, ")"); break;
+ case EOpPreDecrement: writeTriplet(visit, "(--", NULL, ")"); break;
+
+ case EOpConvIntToBool:
+ case EOpConvFloatToBool:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: writeTriplet(visit, "bool(", NULL, ")"); break;
+ case 2: writeTriplet(visit, "bvec2(", NULL, ")"); break;
+ case 3: writeTriplet(visit, "bvec3(", NULL, ")"); break;
+ case 4: writeTriplet(visit, "bvec4(", NULL, ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpConvBoolToFloat:
+ case EOpConvIntToFloat:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: writeTriplet(visit, "float(", NULL, ")"); break;
+ case 2: writeTriplet(visit, "vec2(", NULL, ")"); break;
+ case 3: writeTriplet(visit, "vec3(", NULL, ")"); break;
+ case 4: writeTriplet(visit, "vec4(", NULL, ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpConvFloatToInt:
+ case EOpConvBoolToInt:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: writeTriplet(visit, "int(", NULL, ")"); break;
+ case 2: writeTriplet(visit, "ivec2(", NULL, ")"); break;
+ case 3: writeTriplet(visit, "ivec3(", NULL, ")"); break;
+ case 4: writeTriplet(visit, "ivec4(", NULL, ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+
+ case EOpRadians: writeTriplet(visit, "radians(", NULL, ")"); break;
+ case EOpDegrees: writeTriplet(visit, "degrees(", NULL, ")"); break;
+ case EOpSin: writeTriplet(visit, "sin(", NULL, ")"); break;
+ case EOpCos: writeTriplet(visit, "cos(", NULL, ")"); break;
+ case EOpTan: writeTriplet(visit, "tan(", NULL, ")"); break;
+ case EOpAsin: writeTriplet(visit, "asin(", NULL, ")"); break;
+ case EOpAcos: writeTriplet(visit, "acos(", NULL, ")"); break;
+ case EOpAtan: writeTriplet(visit, "atan(", NULL, ")"); break;
+
+ case EOpExp: writeTriplet(visit, "exp(", NULL, ")"); break;
+ case EOpLog: writeTriplet(visit, "log(", NULL, ")"); break;
+ case EOpExp2: writeTriplet(visit, "exp2(", NULL, ")"); break;
+ case EOpLog2: writeTriplet(visit, "log2(", NULL, ")"); break;
+ case EOpSqrt: writeTriplet(visit, "sqrt(", NULL, ")"); break;
+ case EOpInverseSqrt: writeTriplet(visit, "inversesqrt(", NULL, ")"); break;
+
+ case EOpAbs: writeTriplet(visit, "abs(", NULL, ")"); break;
+ case EOpSign: writeTriplet(visit, "sign(", NULL, ")"); break;
+ case EOpFloor: writeTriplet(visit, "floor(", NULL, ")"); break;
+ case EOpCeil: writeTriplet(visit, "ceil(", NULL, ")"); break;
+ case EOpFract: writeTriplet(visit, "fract(", NULL, ")"); break;
+
+ case EOpLength: writeTriplet(visit, "length(", NULL, ")"); break;
+ case EOpNormalize: writeTriplet(visit, "normalize(", NULL, ")"); break;
+
+ case EOpDFdx: writeTriplet(visit, "dFdx(", NULL, ")"); break;
+ case EOpDFdy: writeTriplet(visit, "dFdy(", NULL, ")"); break;
+ case EOpFwidth: writeTriplet(visit, "fwidth(", NULL, ")"); break;
+
+ case EOpAny: writeTriplet(visit, "any(", NULL, ")"); break;
+ case EOpAll: writeTriplet(visit, "all(", NULL, ")"); break;
+
+ default: UNREACHABLE(); break;
+ }
+
+ return true;
+}
+
+bool TOutputGLSL::visitSelection(Visit visit, TIntermSelection* node)
+{
+ TInfoSinkBase& out = objSink();
+
+ if (node->usesTernaryOperator())
+ {
+ // Notice two brackets at the beginning and end. The outer ones
+ // encapsulate the whole ternary expression. This preserves the
+ // order of precedence when ternary expressions are used in a
+ // compound expression, i.e., c = 2 * (a < b ? 1 : 2).
+ out << "((";
+ node->getCondition()->traverse(this);
+ out << ") ? (";
+ node->getTrueBlock()->traverse(this);
+ out << ") : (";
+ node->getFalseBlock()->traverse(this);
+ out << "))";
+ }
+ else
+ {
+ out << "if (";
+ node->getCondition()->traverse(this);
+ out << ")\n";
+
+ incrementDepth();
+ visitCodeBlock(node->getTrueBlock());
+
+ if (node->getFalseBlock())
+ {
+ out << "else\n";
+ visitCodeBlock(node->getFalseBlock());
+ }
+ decrementDepth();
+ }
+ return false;
+}
+
+bool TOutputGLSL::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+ bool visitChildren = true;
+ TInfoSinkBase& out = objSink();
+ switch (node->getOp())
+ {
+ case EOpSequence: {
+ // Scope the sequences except when at the global scope.
+ if (depth > 0) out << "{\n";
+
+ incrementDepth();
+ const TIntermSequence& sequence = node->getSequence();
+ for (TIntermSequence::const_iterator iter = sequence.begin();
+ iter != sequence.end(); ++iter)
+ {
+ TIntermNode* node = *iter;
+ ASSERT(node != NULL);
+ node->traverse(this);
+
+ if (isSingleStatement(node))
+ out << ";\n";
+ }
+ decrementDepth();
+
+ // Scope the sequences except when at the global scope.
+ if (depth > 0) out << "}\n";
+ visitChildren = false;
+ break;
+ }
+ case EOpPrototype: {
+ // Function declaration.
+ ASSERT(visit == PreVisit);
+ TString returnType = getTypeName(node->getType());
+ out << returnType << " " << node->getName();
+
+ out << "(";
+ writeFunctionParameters(node->getSequence());
+ out << ")";
+
+ visitChildren = false;
+ break;
+ }
+ case EOpFunction: {
+ // Function definition.
+ ASSERT(visit == PreVisit);
+ TString returnType = getTypeName(node->getType());
+ TString functionName = TFunction::unmangleName(node->getName());
+ out << returnType << " " << functionName;
+
+ incrementDepth();
+ // Function definition node contains one or two children nodes
+ // representing function parameters and function body. The latter
+ // is not present in case of empty function bodies.
+ const TIntermSequence& sequence = node->getSequence();
+ ASSERT((sequence.size() == 1) || (sequence.size() == 2));
+ TIntermSequence::const_iterator seqIter = sequence.begin();
+
+ // Traverse function parameters.
+ TIntermAggregate* params = (*seqIter)->getAsAggregate();
+ ASSERT(params != NULL);
+ ASSERT(params->getOp() == EOpParameters);
+ params->traverse(this);
+
+ // Traverse function body.
+ TIntermAggregate* body = ++seqIter != sequence.end() ?
+ (*seqIter)->getAsAggregate() : NULL;
+ visitCodeBlock(body);
+ decrementDepth();
+
+ // Fully processed; no need to visit children.
+ visitChildren = false;
+ break;
+ }
+ case EOpFunctionCall:
+ // Function call.
+ if (visit == PreVisit)
+ {
+ TString functionName = TFunction::unmangleName(node->getName());
+ out << functionName << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ }
+ else
+ {
+ out << ")";
+ }
+ break;
+ case EOpParameters: {
+ // Function parameters.
+ ASSERT(visit == PreVisit);
+ out << "(";
+ writeFunctionParameters(node->getSequence());
+ out << ")";
+ visitChildren = false;
+ break;
+ }
+ case EOpDeclaration: {
+ // Variable declaration.
+ if (visit == PreVisit)
+ {
+ const TIntermSequence& sequence = node->getSequence();
+ const TIntermTyped* variable = sequence.front()->getAsTyped();
+ writeVariableType(variable->getType());
+ out << " ";
+ mDeclaringVariables = true;
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ mDeclaringVariables = true;
+ }
+ else
+ {
+ mDeclaringVariables = false;
+ }
+ break;
+ }
+ case EOpConstructFloat: writeTriplet(visit, "float(", NULL, ")"); break;
+ case EOpConstructVec2: writeTriplet(visit, "vec2(", ", ", ")"); break;
+ case EOpConstructVec3: writeTriplet(visit, "vec3(", ", ", ")"); break;
+ case EOpConstructVec4: writeTriplet(visit, "vec4(", ", ", ")"); break;
+ case EOpConstructBool: writeTriplet(visit, "bool(", NULL, ")"); break;
+ case EOpConstructBVec2: writeTriplet(visit, "bvec2(", ", ", ")"); break;
+ case EOpConstructBVec3: writeTriplet(visit, "bvec3(", ", ", ")"); break;
+ case EOpConstructBVec4: writeTriplet(visit, "bvec4(", ", ", ")"); break;
+ case EOpConstructInt: writeTriplet(visit, "int(", NULL, ")"); break;
+ case EOpConstructIVec2: writeTriplet(visit, "ivec2(", ", ", ")"); break;
+ case EOpConstructIVec3: writeTriplet(visit, "ivec3(", ", ", ")"); break;
+ case EOpConstructIVec4: writeTriplet(visit, "ivec4(", ", ", ")"); break;
+ case EOpConstructMat2: writeTriplet(visit, "mat2(", ", ", ")"); break;
+ case EOpConstructMat3: writeTriplet(visit, "mat3(", ", ", ")"); break;
+ case EOpConstructMat4: writeTriplet(visit, "mat4(", ", ", ")"); break;
+ case EOpConstructStruct:
+ if (visit == PreVisit)
+ {
+ const TType& type = node->getType();
+ ASSERT(type.getBasicType() == EbtStruct);
+ out << type.getTypeName() << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ }
+ else
+ {
+ out << ")";
+ }
+ break;
+
+ case EOpLessThan: writeTriplet(visit, "lessThan(", ", ", ")"); break;
+ case EOpGreaterThan: writeTriplet(visit, "greaterThan(", ", ", ")"); break;
+ case EOpLessThanEqual: writeTriplet(visit, "lessThanEqual(", ", ", ")"); break;
+ case EOpGreaterThanEqual: writeTriplet(visit, "greaterThanEqual(", ", ", ")"); break;
+ case EOpVectorEqual: writeTriplet(visit, "equal(", ", ", ")"); break;
+ case EOpVectorNotEqual: writeTriplet(visit, "notEqual(", ", ", ")"); break;
+ case EOpComma: writeTriplet(visit, NULL, ", ", NULL); break;
+
+ case EOpMod: writeTriplet(visit, "mod(", ", ", ")"); break;
+ case EOpPow: writeTriplet(visit, "pow(", ", ", ")"); break;
+ case EOpAtan: writeTriplet(visit, "atan(", ", ", ")"); break;
+ case EOpMin: writeTriplet(visit, "min(", ", ", ")"); break;
+ case EOpMax: writeTriplet(visit, "max(", ", ", ")"); break;
+ case EOpClamp: writeTriplet(visit, "clamp(", ", ", ")"); break;
+ case EOpMix: writeTriplet(visit, "mix(", ", ", ")"); break;
+ case EOpStep: writeTriplet(visit, "step(", ", ", ")"); break;
+ case EOpSmoothStep: writeTriplet(visit, "smoothstep(", ", ", ")"); break;
+
+ case EOpDistance: writeTriplet(visit, "distance(", ", ", ")"); break;
+ case EOpDot: writeTriplet(visit, "dot(", ", ", ")"); break;
+ case EOpCross: writeTriplet(visit, "cross(", ", ", ")"); break;
+ case EOpFaceForward: writeTriplet(visit, "faceforward(", ", ", ")"); break;
+ case EOpReflect: writeTriplet(visit, "reflect(", ", ", ")"); break;
+ case EOpRefract: writeTriplet(visit, "refract(", ", ", ")"); break;
+ case EOpMul: writeTriplet(visit, "matrixCompMult(", ", ", ")"); break;
+
+ default: UNREACHABLE(); break;
+ }
+ return visitChildren;
+}
+
+bool TOutputGLSL::visitLoop(Visit visit, TIntermLoop* node)
+{
+ TInfoSinkBase& out = objSink();
+
+ incrementDepth();
+ // Loop header.
+ TLoopType loopType = node->getType();
+ if (loopType == ELoopFor) // for loop
+ {
+ out << "for (";
+ if (node->getInit())
+ node->getInit()->traverse(this);
+ out << "; ";
+
+ if (node->getCondition())
+ node->getCondition()->traverse(this);
+ out << "; ";
+
+ if (node->getExpression())
+ node->getExpression()->traverse(this);
+ out << ")\n";
+ }
+ else if (loopType == ELoopWhile) // while loop
+ {
+ out << "while (";
+ ASSERT(node->getCondition() != NULL);
+ node->getCondition()->traverse(this);
+ out << ")\n";
+ }
+ else // do-while loop
+ {
+ ASSERT(loopType == ELoopDoWhile);
+ out << "do\n";
+ }
+
+ // Loop body.
+ visitCodeBlock(node->getBody());
+
+ // Loop footer.
+ if (loopType == ELoopDoWhile) // do-while loop
+ {
+ out << "while (";
+ ASSERT(node->getCondition() != NULL);
+ node->getCondition()->traverse(this);
+ out << ");\n";
+ }
+ decrementDepth();
+
+ // No need to visit children. They have been already processed in
+ // this function.
+ return false;
+}
+
+bool TOutputGLSL::visitBranch(Visit visit, TIntermBranch* node)
+{
+ switch (node->getFlowOp())
+ {
+ case EOpKill: writeTriplet(visit, "discard", NULL, NULL); break;
+ case EOpBreak: writeTriplet(visit, "break", NULL, NULL); break;
+ case EOpContinue: writeTriplet(visit, "continue", NULL, NULL); break;
+ case EOpReturn: writeTriplet(visit, "return ", NULL, NULL); break;
+ default: UNREACHABLE(); break;
+ }
+
+ return true;
+}
+
+void TOutputGLSL::visitCodeBlock(TIntermNode* node) {
+ TInfoSinkBase &out = objSink();
+ if (node != NULL)
+ {
+ node->traverse(this);
+ // Single statements not part of a sequence need to be terminated
+ // with semi-colon.
+ if (isSingleStatement(node))
+ out << ";\n";
+ }
+ else
+ {
+ out << "{\n}\n"; // Empty code block.
+ }
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h
new file mode 100644
index 0000000..aa203d4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h
@@ -0,0 +1,49 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
+#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
+
+#include <set>
+
+#include "compiler/intermediate.h"
+#include "compiler/ParseHelper.h"
+
+class TOutputGLSL : public TIntermTraverser
+{
+public:
+ TOutputGLSL(TInfoSinkBase& objSink);
+
+protected:
+ TInfoSinkBase& objSink() { return mObjSink; }
+ void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
+ void writeVariableType(const TType& type);
+ void writeFunctionParameters(const TIntermSequence& args);
+ const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
+
+ virtual void visitSymbol(TIntermSymbol* node);
+ virtual void visitConstantUnion(TIntermConstantUnion* node);
+ virtual bool visitBinary(Visit visit, TIntermBinary* node);
+ virtual bool visitUnary(Visit visit, TIntermUnary* node);
+ virtual bool visitSelection(Visit visit, TIntermSelection* node);
+ virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
+ virtual bool visitLoop(Visit visit, TIntermLoop* node);
+ virtual bool visitBranch(Visit visit, TIntermBranch* node);
+
+ void visitCodeBlock(TIntermNode* node);
+
+private:
+ TInfoSinkBase& mObjSink;
+ bool mDeclaringVariables;
+
+ // Structs are declared as the tree is traversed. This set contains all
+ // the structs already declared. It is maintained so that a struct is
+ // declared only once.
+ typedef std::set<TString> DeclaredStructs;
+ DeclaredStructs mDeclaredStructs;
+};
+
+#endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp
new file mode 100644
index 0000000..57e99d2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp
@@ -0,0 +1,2194 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/OutputHLSL.h"
+
+#include "compiler/debug.h"
+#include "compiler/InfoSink.h"
+#include "compiler/UnfoldSelect.h"
+#include "compiler/SearchSymbol.h"
+
+#include <stdio.h>
+#include <algorithm>
+
+namespace sh
+{
+// Integer to TString conversion
+TString str(int i)
+{
+ char buffer[20];
+ sprintf(buffer, "%d", i);
+ return buffer;
+}
+
+OutputHLSL::OutputHLSL(TParseContext &context) : TIntermTraverser(true, true, true), mContext(context)
+{
+ mUnfoldSelect = new UnfoldSelect(context, this);
+ mInsideFunction = false;
+
+ mUsesTexture2D = false;
+ mUsesTexture2D_bias = false;
+ mUsesTexture2DProj = false;
+ mUsesTexture2DProj_bias = false;
+ mUsesTextureCube = false;
+ mUsesTextureCube_bias = false;
+ mUsesDepthRange = false;
+ mUsesFragCoord = false;
+ mUsesPointCoord = false;
+ mUsesFrontFacing = false;
+ mUsesPointSize = false;
+ mUsesXor = false;
+ mUsesMod1 = false;
+ mUsesMod2 = false;
+ mUsesMod3 = false;
+ mUsesMod4 = false;
+ mUsesFaceforward1 = false;
+ mUsesFaceforward2 = false;
+ mUsesFaceforward3 = false;
+ mUsesFaceforward4 = false;
+ mUsesEqualMat2 = false;
+ mUsesEqualMat3 = false;
+ mUsesEqualMat4 = false;
+ mUsesEqualVec2 = false;
+ mUsesEqualVec3 = false;
+ mUsesEqualVec4 = false;
+ mUsesEqualIVec2 = false;
+ mUsesEqualIVec3 = false;
+ mUsesEqualIVec4 = false;
+ mUsesEqualBVec2 = false;
+ mUsesEqualBVec3 = false;
+ mUsesEqualBVec4 = false;
+ mUsesAtan2 = false;
+
+ mScopeDepth = 0;
+
+ mUniqueIndex = 0;
+}
+
+OutputHLSL::~OutputHLSL()
+{
+ delete mUnfoldSelect;
+}
+
+void OutputHLSL::output()
+{
+ mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
+ header();
+
+ mContext.infoSink.obj << mHeader.c_str();
+ mContext.infoSink.obj << mBody.c_str();
+}
+
+TInfoSinkBase &OutputHLSL::getBodyStream()
+{
+ return mBody;
+}
+
+int OutputHLSL::vectorSize(const TType &type) const
+{
+ int elementSize = type.isMatrix() ? type.getNominalSize() : 1;
+ int arraySize = type.isArray() ? type.getArraySize() : 1;
+
+ return elementSize * arraySize;
+}
+
+void OutputHLSL::header()
+{
+ ShShaderType shaderType = mContext.shaderType;
+ TInfoSinkBase &out = mHeader;
+
+ for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
+ {
+ out << *structDeclaration;
+ }
+
+ for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
+ {
+ out << *constructor;
+ }
+
+ if (shaderType == SH_FRAGMENT_SHADER)
+ {
+ TString uniforms;
+ TString varyings;
+
+ TSymbolTableLevel *symbols = mContext.symbolTable.getGlobalLevel();
+ int semanticIndex = 0;
+
+ for (TSymbolTableLevel::const_iterator namedSymbol = symbols->begin(); namedSymbol != symbols->end(); namedSymbol++)
+ {
+ const TSymbol *symbol = (*namedSymbol).second;
+ const TString &name = symbol->getName();
+
+ if (symbol->isVariable())
+ {
+ const TVariable *variable = static_cast<const TVariable*>(symbol);
+ const TType &type = variable->getType();
+ TQualifier qualifier = type.getQualifier();
+
+ if (qualifier == EvqUniform)
+ {
+ if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
+ {
+ uniforms += "uniform " + typeString(type) + " " + decorate(name) + arrayString(type) + ";\n";
+ }
+ }
+ else if (qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
+ {
+ if (mReferencedVaryings.find(name.c_str()) != mReferencedVaryings.end())
+ {
+ // Program linking depends on this exact format
+ varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+
+ semanticIndex += type.isArray() ? type.getArraySize() : 1;
+ }
+ }
+ else if (qualifier == EvqGlobal || qualifier == EvqTemporary)
+ {
+ // Globals are declared and intialized as an aggregate node
+ }
+ else if (qualifier == EvqConst)
+ {
+ // Constants are repeated as literals where used
+ }
+ else UNREACHABLE();
+ }
+ }
+
+ out << "// Varyings\n";
+ out << varyings;
+ out << "\n"
+ "static float4 gl_Color[1] = {float4(0, 0, 0, 0)};\n";
+
+ if (mUsesFragCoord)
+ {
+ out << "static float4 gl_FragCoord = float4(0, 0, 0, 0);\n";
+ }
+
+ if (mUsesPointCoord)
+ {
+ out << "static float2 gl_PointCoord = float2(0.5, 0.5);\n";
+ }
+
+ if (mUsesFrontFacing)
+ {
+ out << "static bool gl_FrontFacing = false;\n";
+ }
+
+ out << "\n";
+
+ if (mUsesFragCoord)
+ {
+ out << "uniform float4 dx_Viewport;\n"
+ "uniform float2 dx_Depth;\n";
+ }
+
+ if (mUsesFrontFacing)
+ {
+ out << "uniform bool dx_PointsOrLines;\n"
+ "uniform bool dx_FrontCCW;\n";
+ }
+
+ out << "\n";
+ out << uniforms;
+ out << "\n";
+
+ if (mUsesTexture2D)
+ {
+ out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
+ "{\n"
+ " return tex2D(s, t);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesTexture2D_bias)
+ {
+ out << "float4 gl_texture2D(sampler2D s, float2 t, float bias)\n"
+ "{\n"
+ " return tex2Dbias(s, float4(t.x, t.y, 0, bias));\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesTexture2DProj)
+ {
+ out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
+ "{\n"
+ " return tex2Dproj(s, float4(t.x, t.y, 0, t.z));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
+ "{\n"
+ " return tex2Dproj(s, t);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesTexture2DProj_bias)
+ {
+ out << "float4 gl_texture2DProj(sampler2D s, float3 t, float bias)\n"
+ "{\n"
+ " return tex2Dbias(s, float4(t.x / t.z, t.y / t.z, 0, bias));\n"
+ "}\n"
+ "\n"
+ "float4 gl_texture2DProj(sampler2D s, float4 t, float bias)\n"
+ "{\n"
+ " return tex2Dbias(s, float4(t.x / t.w, t.y / t.w, 0, bias));\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesTextureCube)
+ {
+ out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
+ "{\n"
+ " return texCUBE(s, t);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesTextureCube_bias)
+ {
+ out << "float4 gl_textureCube(samplerCUBE s, float3 t, float bias)\n"
+ "{\n"
+ " return texCUBEbias(s, float4(t.x, t.y, t.z, bias));\n"
+ "}\n"
+ "\n";
+ }
+ }
+ else // Vertex shader
+ {
+ TString uniforms;
+ TString attributes;
+ TString varyings;
+
+ TSymbolTableLevel *symbols = mContext.symbolTable.getGlobalLevel();
+
+ for (TSymbolTableLevel::const_iterator namedSymbol = symbols->begin(); namedSymbol != symbols->end(); namedSymbol++)
+ {
+ const TSymbol *symbol = (*namedSymbol).second;
+ const TString &name = symbol->getName();
+
+ if (symbol->isVariable())
+ {
+ const TVariable *variable = static_cast<const TVariable*>(symbol);
+ const TType &type = variable->getType();
+ TQualifier qualifier = type.getQualifier();
+
+ if (qualifier == EvqUniform)
+ {
+ if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
+ {
+ uniforms += "uniform " + typeString(type) + " " + decorate(name) + arrayString(type) + ";\n";
+ }
+ }
+ else if (qualifier == EvqAttribute)
+ {
+ if (mReferencedAttributes.find(name.c_str()) != mReferencedAttributes.end())
+ {
+ attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+ }
+ }
+ else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut)
+ {
+ if (mReferencedVaryings.find(name.c_str()) != mReferencedVaryings.end())
+ {
+ // Program linking depends on this exact format
+ varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+ }
+ }
+ else if (qualifier == EvqGlobal || qualifier == EvqTemporary)
+ {
+ // Globals are declared and intialized as an aggregate node
+ }
+ else if (qualifier == EvqConst)
+ {
+ // Constants are repeated as literals where used
+ }
+ else UNREACHABLE();
+ }
+ }
+
+ out << "// Attributes\n";
+ out << attributes;
+ out << "\n"
+ "static float4 gl_Position = float4(0, 0, 0, 0);\n";
+
+ if (mUsesPointSize)
+ {
+ out << "static float gl_PointSize = float(1);\n";
+ }
+
+ out << "\n"
+ "// Varyings\n";
+ out << varyings;
+ out << "\n"
+ "uniform float2 dx_HalfPixelSize;\n"
+ "\n";
+ out << uniforms;
+ out << "\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << "#define GL_USES_FRAG_COORD\n";
+ }
+
+ if (mUsesPointCoord)
+ {
+ out << "#define GL_USES_POINT_COORD\n";
+ }
+
+ if (mUsesFrontFacing)
+ {
+ out << "#define GL_USES_FRONT_FACING\n";
+ }
+
+ if (mUsesPointSize)
+ {
+ out << "#define GL_USES_POINT_SIZE\n";
+ }
+
+ if (mUsesDepthRange)
+ {
+ out << "struct gl_DepthRangeParameters\n"
+ "{\n"
+ " float near;\n"
+ " float far;\n"
+ " float diff;\n"
+ "};\n"
+ "\n"
+ "uniform float3 dx_DepthRange;"
+ "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
+ "\n";
+ }
+
+ if (mUsesXor)
+ {
+ out << "bool xor(bool p, bool q)\n"
+ "{\n"
+ " return (p || q) && !(p && q);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod1)
+ {
+ out << "float mod(float x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod2)
+ {
+ out << "float2 mod(float2 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod3)
+ {
+ out << "float3 mod(float3 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod4)
+ {
+ out << "float4 mod(float4 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward1)
+ {
+ out << "float faceforward(float N, float I, float Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward2)
+ {
+ out << "float2 faceforward(float2 N, float2 I, float2 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward3)
+ {
+ out << "float3 faceforward(float3 N, float3 I, float3 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward4)
+ {
+ out << "float4 faceforward(float4 N, float4 I, float4 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesEqualMat2)
+ {
+ out << "bool equal(float2x2 m, float2x2 n)\n"
+ "{\n"
+ " return m[0][0] == n[0][0] && m[0][1] == n[0][1] &&\n"
+ " m[1][0] == n[1][0] && m[1][1] == n[1][1];\n"
+ "}\n";
+ }
+
+ if (mUsesEqualMat3)
+ {
+ out << "bool equal(float3x3 m, float3x3 n)\n"
+ "{\n"
+ " return m[0][0] == n[0][0] && m[0][1] == n[0][1] && m[0][2] == n[0][2] &&\n"
+ " m[1][0] == n[1][0] && m[1][1] == n[1][1] && m[1][2] == n[1][2] &&\n"
+ " m[2][0] == n[2][0] && m[2][1] == n[2][1] && m[2][2] == n[2][2];\n"
+ "}\n";
+ }
+
+ if (mUsesEqualMat4)
+ {
+ out << "bool equal(float4x4 m, float4x4 n)\n"
+ "{\n"
+ " return m[0][0] == n[0][0] && m[0][1] == n[0][1] && m[0][2] == n[0][2] && m[0][3] == n[0][3] &&\n"
+ " m[1][0] == n[1][0] && m[1][1] == n[1][1] && m[1][2] == n[1][2] && m[1][3] == n[1][3] &&\n"
+ " m[2][0] == n[2][0] && m[2][1] == n[2][1] && m[2][2] == n[2][2] && m[2][3] == n[2][3] &&\n"
+ " m[3][0] == n[3][0] && m[3][1] == n[3][1] && m[3][2] == n[3][2] && m[3][3] == n[3][3];\n"
+ "}\n";
+ }
+
+ if (mUsesEqualVec2)
+ {
+ out << "bool equal(float2 v, float2 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualVec3)
+ {
+ out << "bool equal(float3 v, float3 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y && v.z == u.z;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualVec4)
+ {
+ out << "bool equal(float4 v, float4 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y && v.z == u.z && v.w == u.w;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualIVec2)
+ {
+ out << "bool equal(int2 v, int2 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualIVec3)
+ {
+ out << "bool equal(int3 v, int3 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y && v.z == u.z;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualIVec4)
+ {
+ out << "bool equal(int4 v, int4 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y && v.z == u.z && v.w == u.w;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualBVec2)
+ {
+ out << "bool equal(bool2 v, bool2 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualBVec3)
+ {
+ out << "bool equal(bool3 v, bool3 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y && v.z == u.z;\n"
+ "}\n";
+ }
+
+ if (mUsesEqualBVec4)
+ {
+ out << "bool equal(bool4 v, bool4 u)\n"
+ "{\n"
+ " return v.x == u.x && v.y == u.y && v.z == u.z && v.w == u.w;\n"
+ "}\n";
+ }
+
+ if (mUsesAtan2)
+ {
+ out << "float atanyx(float y, float x)\n"
+ "{\n"
+ " if(x == 0 && y == 0) x = 1;\n" // Avoid producing a NaN
+ " return atan2(y, x);\n"
+ "}\n";
+ }
+}
+
+void OutputHLSL::visitSymbol(TIntermSymbol *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ TString name = node->getSymbol();
+
+ if (name == "gl_FragColor")
+ {
+ out << "gl_Color[0]";
+ }
+ else if (name == "gl_FragData")
+ {
+ out << "gl_Color";
+ }
+ else if (name == "gl_DepthRange")
+ {
+ mUsesDepthRange = true;
+ out << name;
+ }
+ else if (name == "gl_FragCoord")
+ {
+ mUsesFragCoord = true;
+ out << name;
+ }
+ else if (name == "gl_PointCoord")
+ {
+ mUsesPointCoord = true;
+ out << name;
+ }
+ else if (name == "gl_FrontFacing")
+ {
+ mUsesFrontFacing = true;
+ out << name;
+ }
+ else if (name == "gl_PointSize")
+ {
+ mUsesPointSize = true;
+ out << name;
+ }
+ else
+ {
+ TQualifier qualifier = node->getQualifier();
+
+ if (qualifier == EvqUniform)
+ {
+ mReferencedUniforms.insert(name.c_str());
+ }
+ else if (qualifier == EvqAttribute)
+ {
+ mReferencedAttributes.insert(name.c_str());
+ }
+ else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut || qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
+ {
+ mReferencedVaryings.insert(name.c_str());
+ }
+
+ out << decorate(name);
+ }
+}
+
+bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ switch (node->getOp())
+ {
+ case EOpAssign: outputTriplet(visit, "(", " = ", ")"); break;
+ case EOpInitialize:
+ if (visit == PreVisit)
+ {
+ // GLSL allows to write things like "float x = x;" where a new variable x is defined
+ // and the value of an existing variable x is assigned. HLSL uses C semantics (the
+ // new variable is created before the assignment is evaluated), so we need to convert
+ // this to "float t = x, x = t;".
+
+ TIntermSymbol *symbolNode = node->getLeft()->getAsSymbolNode();
+ TIntermTyped *expression = node->getRight();
+
+ sh::SearchSymbol searchSymbol(symbolNode->getSymbol());
+ expression->traverse(&searchSymbol);
+ bool sameSymbol = searchSymbol.foundMatch();
+
+ if (sameSymbol)
+ {
+ // Type already printed
+ out << "t" + str(mUniqueIndex) + " = ";
+ expression->traverse(this);
+ out << ", ";
+ symbolNode->traverse(this);
+ out << " = t" + str(mUniqueIndex);
+
+ mUniqueIndex++;
+ return false;
+ }
+ }
+ else if (visit == InVisit)
+ {
+ out << " = ";
+ }
+ break;
+ case EOpAddAssign: outputTriplet(visit, "(", " += ", ")"); break;
+ case EOpSubAssign: outputTriplet(visit, "(", " -= ", ")"); break;
+ case EOpMulAssign: outputTriplet(visit, "(", " *= ", ")"); break;
+ case EOpVectorTimesScalarAssign: outputTriplet(visit, "(", " *= ", ")"); break;
+ case EOpMatrixTimesScalarAssign: outputTriplet(visit, "(", " *= ", ")"); break;
+ case EOpVectorTimesMatrixAssign:
+ if (visit == PreVisit)
+ {
+ out << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << " = mul(";
+ node->getLeft()->traverse(this);
+ out << ", transpose(";
+ }
+ else
+ {
+ out << ")))";
+ }
+ break;
+ case EOpMatrixTimesMatrixAssign:
+ if (visit == PreVisit)
+ {
+ out << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << " = mul(";
+ node->getLeft()->traverse(this);
+ out << ", ";
+ }
+ else
+ {
+ out << "))";
+ }
+ break;
+ case EOpDivAssign: outputTriplet(visit, "(", " /= ", ")"); break;
+ case EOpIndexDirect: outputTriplet(visit, "", "[", "]"); break;
+ case EOpIndexIndirect: outputTriplet(visit, "", "[", "]"); break;
+ case EOpIndexDirectStruct:
+ if (visit == InVisit)
+ {
+ out << "." + node->getType().getFieldName();
+
+ return false;
+ }
+ break;
+ case EOpVectorSwizzle:
+ if (visit == InVisit)
+ {
+ out << ".";
+
+ TIntermAggregate *swizzle = node->getRight()->getAsAggregate();
+
+ if (swizzle)
+ {
+ TIntermSequence &sequence = swizzle->getSequence();
+
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ TIntermConstantUnion *element = (*sit)->getAsConstantUnion();
+
+ if (element)
+ {
+ int i = element->getUnionArrayPointer()[0].getIConst();
+
+ switch (i)
+ {
+ case 0: out << "x"; break;
+ case 1: out << "y"; break;
+ case 2: out << "z"; break;
+ case 3: out << "w"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+
+ return false; // Fully processed
+ }
+ break;
+ case EOpAdd: outputTriplet(visit, "(", " + ", ")"); break;
+ case EOpSub: outputTriplet(visit, "(", " - ", ")"); break;
+ case EOpMul: outputTriplet(visit, "(", " * ", ")"); break;
+ case EOpDiv: outputTriplet(visit, "(", " / ", ")"); break;
+ case EOpEqual:
+ case EOpNotEqual:
+ if (node->getLeft()->isScalar())
+ {
+ if (node->getOp() == EOpEqual)
+ {
+ outputTriplet(visit, "(", " == ", ")");
+ }
+ else
+ {
+ outputTriplet(visit, "(", " != ", ")");
+ }
+ }
+ else if (node->getLeft()->getBasicType() == EbtStruct)
+ {
+ if (node->getOp() == EOpEqual)
+ {
+ out << "(";
+ }
+ else
+ {
+ out << "!(";
+ }
+
+ const TTypeList *fields = node->getLeft()->getType().getStruct();
+
+ for (size_t i = 0; i < fields->size(); i++)
+ {
+ const TType *fieldType = (*fields)[i].type;
+
+ node->getLeft()->traverse(this);
+ out << "." + fieldType->getFieldName() + " == ";
+ node->getRight()->traverse(this);
+ out << "." + fieldType->getFieldName();
+
+ if (i < fields->size() - 1)
+ {
+ out << " && ";
+ }
+ }
+
+ out << ")";
+
+ return false;
+ }
+ else
+ {
+ if (node->getLeft()->isMatrix())
+ {
+ switch (node->getLeft()->getNominalSize())
+ {
+ case 2: mUsesEqualMat2 = true; break;
+ case 3: mUsesEqualMat3 = true; break;
+ case 4: mUsesEqualMat4 = true; break;
+ default: UNREACHABLE();
+ }
+ }
+ else if (node->getLeft()->isVector())
+ {
+ switch (node->getLeft()->getBasicType())
+ {
+ case EbtFloat:
+ switch (node->getLeft()->getNominalSize())
+ {
+ case 2: mUsesEqualVec2 = true; break;
+ case 3: mUsesEqualVec3 = true; break;
+ case 4: mUsesEqualVec4 = true; break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EbtInt:
+ switch (node->getLeft()->getNominalSize())
+ {
+ case 2: mUsesEqualIVec2 = true; break;
+ case 3: mUsesEqualIVec3 = true; break;
+ case 4: mUsesEqualIVec4 = true; break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EbtBool:
+ switch (node->getLeft()->getNominalSize())
+ {
+ case 2: mUsesEqualBVec2 = true; break;
+ case 3: mUsesEqualBVec3 = true; break;
+ case 4: mUsesEqualBVec4 = true; break;
+ default: UNREACHABLE();
+ }
+ break;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+
+ if (node->getOp() == EOpEqual)
+ {
+ outputTriplet(visit, "equal(", ", ", ")");
+ }
+ else
+ {
+ outputTriplet(visit, "!equal(", ", ", ")");
+ }
+ }
+ break;
+ case EOpLessThan: outputTriplet(visit, "(", " < ", ")"); break;
+ case EOpGreaterThan: outputTriplet(visit, "(", " > ", ")"); break;
+ case EOpLessThanEqual: outputTriplet(visit, "(", " <= ", ")"); break;
+ case EOpGreaterThanEqual: outputTriplet(visit, "(", " >= ", ")"); break;
+ case EOpVectorTimesScalar: outputTriplet(visit, "(", " * ", ")"); break;
+ case EOpMatrixTimesScalar: outputTriplet(visit, "(", " * ", ")"); break;
+ case EOpVectorTimesMatrix: outputTriplet(visit, "mul(", ", transpose(", "))"); break;
+ case EOpMatrixTimesVector: outputTriplet(visit, "mul(transpose(", "), ", ")"); break;
+ case EOpMatrixTimesMatrix: outputTriplet(visit, "transpose(mul(transpose(", "), transpose(", ")))"); break;
+ case EOpLogicalOr: outputTriplet(visit, "(", " || ", ")"); break;
+ case EOpLogicalXor:
+ mUsesXor = true;
+ outputTriplet(visit, "xor(", ", ", ")");
+ break;
+ case EOpLogicalAnd: outputTriplet(visit, "(", " && ", ")"); break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ switch (node->getOp())
+ {
+ case EOpNegative: outputTriplet(visit, "(-", "", ")"); break;
+ case EOpVectorLogicalNot: outputTriplet(visit, "(!", "", ")"); break;
+ case EOpLogicalNot: outputTriplet(visit, "(!", "", ")"); break;
+ case EOpPostIncrement: outputTriplet(visit, "(", "", "++)"); break;
+ case EOpPostDecrement: outputTriplet(visit, "(", "", "--)"); break;
+ case EOpPreIncrement: outputTriplet(visit, "(++", "", ")"); break;
+ case EOpPreDecrement: outputTriplet(visit, "(--", "", ")"); break;
+ case EOpConvIntToBool:
+ case EOpConvFloatToBool:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "bool(", "", ")"); break;
+ case 2: outputTriplet(visit, "bool2(", "", ")"); break;
+ case 3: outputTriplet(visit, "bool3(", "", ")"); break;
+ case 4: outputTriplet(visit, "bool4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpConvBoolToFloat:
+ case EOpConvIntToFloat:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "float(", "", ")"); break;
+ case 2: outputTriplet(visit, "float2(", "", ")"); break;
+ case 3: outputTriplet(visit, "float3(", "", ")"); break;
+ case 4: outputTriplet(visit, "float4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpConvFloatToInt:
+ case EOpConvBoolToInt:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "int(", "", ")"); break;
+ case 2: outputTriplet(visit, "int2(", "", ")"); break;
+ case 3: outputTriplet(visit, "int3(", "", ")"); break;
+ case 4: outputTriplet(visit, "int4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpRadians: outputTriplet(visit, "radians(", "", ")"); break;
+ case EOpDegrees: outputTriplet(visit, "degrees(", "", ")"); break;
+ case EOpSin: outputTriplet(visit, "sin(", "", ")"); break;
+ case EOpCos: outputTriplet(visit, "cos(", "", ")"); break;
+ case EOpTan: outputTriplet(visit, "tan(", "", ")"); break;
+ case EOpAsin: outputTriplet(visit, "asin(", "", ")"); break;
+ case EOpAcos: outputTriplet(visit, "acos(", "", ")"); break;
+ case EOpAtan: outputTriplet(visit, "atan(", "", ")"); break;
+ case EOpExp: outputTriplet(visit, "exp(", "", ")"); break;
+ case EOpLog: outputTriplet(visit, "log(", "", ")"); break;
+ case EOpExp2: outputTriplet(visit, "exp2(", "", ")"); break;
+ case EOpLog2: outputTriplet(visit, "log2(", "", ")"); break;
+ case EOpSqrt: outputTriplet(visit, "sqrt(", "", ")"); break;
+ case EOpInverseSqrt: outputTriplet(visit, "rsqrt(", "", ")"); break;
+ case EOpAbs: outputTriplet(visit, "abs(", "", ")"); break;
+ case EOpSign: outputTriplet(visit, "sign(", "", ")"); break;
+ case EOpFloor: outputTriplet(visit, "floor(", "", ")"); break;
+ case EOpCeil: outputTriplet(visit, "ceil(", "", ")"); break;
+ case EOpFract: outputTriplet(visit, "frac(", "", ")"); break;
+ case EOpLength: outputTriplet(visit, "length(", "", ")"); break;
+ case EOpNormalize: outputTriplet(visit, "normalize(", "", ")"); break;
+ case EOpDFdx: outputTriplet(visit, "ddx(", "", ")"); break;
+ case EOpDFdy: outputTriplet(visit, "ddy(", "", ")"); break;
+ case EOpFwidth: outputTriplet(visit, "fwidth(", "", ")"); break;
+ case EOpAny: outputTriplet(visit, "any(", "", ")"); break;
+ case EOpAll: outputTriplet(visit, "all(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ ShShaderType shaderType = mContext.shaderType;
+ TInfoSinkBase &out = mBody;
+
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ {
+ if (mInsideFunction)
+ {
+ out << "{\n";
+
+ mScopeDepth++;
+
+ if (mScopeBracket.size() < mScopeDepth)
+ {
+ mScopeBracket.push_back(0); // New scope level
+ }
+ else
+ {
+ mScopeBracket[mScopeDepth - 1]++; // New scope at existing level
+ }
+ }
+
+ for (TIntermSequence::iterator sit = node->getSequence().begin(); sit != node->getSequence().end(); sit++)
+ {
+ if (isSingleStatement(*sit))
+ {
+ mUnfoldSelect->traverse(*sit);
+ }
+
+ (*sit)->traverse(this);
+
+ out << ";\n";
+ }
+
+ if (mInsideFunction)
+ {
+ out << "}\n";
+
+ mScopeDepth--;
+ }
+
+ return false;
+ }
+ case EOpDeclaration:
+ if (visit == PreVisit)
+ {
+ TIntermSequence &sequence = node->getSequence();
+ TIntermTyped *variable = sequence[0]->getAsTyped();
+ bool visit = true;
+
+ if (variable && (variable->getQualifier() == EvqTemporary || variable->getQualifier() == EvqGlobal))
+ {
+ if (variable->getType().getStruct())
+ {
+ addConstructor(variable->getType(), scopedStruct(variable->getType().getTypeName()), NULL);
+ }
+
+ if (!variable->getAsSymbolNode() || variable->getAsSymbolNode()->getSymbol() != "") // Variable declaration
+ {
+ if (!mInsideFunction)
+ {
+ out << "static ";
+ }
+
+ out << typeString(variable->getType()) + " ";
+
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ TIntermSymbol *symbol = (*sit)->getAsSymbolNode();
+
+ if (symbol)
+ {
+ symbol->traverse(this);
+ out << arrayString(symbol->getType());
+ out << " = " + initializer(variable->getType());
+ }
+ else
+ {
+ (*sit)->traverse(this);
+ }
+
+ if (visit && this->inVisit)
+ {
+ if (*sit != sequence.back())
+ {
+ visit = this->visitAggregate(InVisit, node);
+ }
+ }
+ }
+
+ if (visit && this->postVisit)
+ {
+ this->visitAggregate(PostVisit, node);
+ }
+ }
+ else if (variable->getAsSymbolNode() && variable->getAsSymbolNode()->getSymbol() == "") // Type (struct) declaration
+ {
+ // Already added to constructor map
+ }
+ else UNREACHABLE();
+ }
+
+ return false;
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ }
+ break;
+ case EOpPrototype:
+ if (visit == PreVisit)
+ {
+ out << typeString(node->getType()) << " " << decorate(node->getName()) << "(";
+
+ TIntermSequence &arguments = node->getSequence();
+
+ for (unsigned int i = 0; i < arguments.size(); i++)
+ {
+ TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
+
+ if (symbol)
+ {
+ out << argumentString(symbol);
+
+ if (i < arguments.size() - 1)
+ {
+ out << ", ";
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ out << ");\n";
+
+ return false;
+ }
+ break;
+ case EOpComma: outputTriplet(visit, "", ", ", ""); break;
+ case EOpFunction:
+ {
+ TString name = TFunction::unmangleName(node->getName());
+
+ if (visit == PreVisit)
+ {
+ out << typeString(node->getType()) << " ";
+
+ if (name == "main")
+ {
+ out << "gl_main(";
+ }
+ else
+ {
+ out << decorate(name) << "(";
+ }
+
+ TIntermSequence &sequence = node->getSequence();
+ TIntermSequence &arguments = sequence[0]->getAsAggregate()->getSequence();
+
+ for (unsigned int i = 0; i < arguments.size(); i++)
+ {
+ TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
+
+ if (symbol)
+ {
+ out << argumentString(symbol);
+
+ if (i < arguments.size() - 1)
+ {
+ out << ", ";
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ sequence.erase(sequence.begin());
+
+ out << ")\n"
+ "{\n";
+
+ mInsideFunction = true;
+ }
+ else if (visit == PostVisit)
+ {
+ out << "}\n";
+
+ mInsideFunction = false;
+ }
+ }
+ break;
+ case EOpFunctionCall:
+ {
+ if (visit == PreVisit)
+ {
+ TString name = TFunction::unmangleName(node->getName());
+
+ if (node->isUserDefined())
+ {
+ out << decorate(name) << "(";
+ }
+ else
+ {
+ if (name == "texture2D")
+ {
+ if (node->getSequence().size() == 2)
+ {
+ mUsesTexture2D = true;
+ }
+ else if (node->getSequence().size() == 3)
+ {
+ mUsesTexture2D_bias = true;
+ }
+ else UNREACHABLE();
+
+ out << "gl_texture2D(";
+ }
+ else if (name == "texture2DProj")
+ {
+ if (node->getSequence().size() == 2)
+ {
+ mUsesTexture2DProj = true;
+ }
+ else if (node->getSequence().size() == 3)
+ {
+ mUsesTexture2DProj_bias = true;
+ }
+ else UNREACHABLE();
+
+ out << "gl_texture2DProj(";
+ }
+ else if (name == "textureCube")
+ {
+ if (node->getSequence().size() == 2)
+ {
+ mUsesTextureCube = true;
+ }
+ else if (node->getSequence().size() == 3)
+ {
+ mUsesTextureCube_bias = true;
+ }
+ else UNREACHABLE();
+
+ out << "gl_textureCube(";
+ }
+ else if (name == "texture2DLod")
+ {
+ UNIMPLEMENTED(); // Requires the vertex shader texture sampling extension
+ }
+ else if (name == "texture2DProjLod")
+ {
+ UNIMPLEMENTED(); // Requires the vertex shader texture sampling extension
+ }
+ else if (name == "textureCubeLod")
+ {
+ UNIMPLEMENTED(); // Requires the vertex shader texture sampling extension
+ }
+ else UNREACHABLE();
+ }
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ }
+ else
+ {
+ out << ")";
+ }
+ }
+ break;
+ case EOpParameters: outputTriplet(visit, "(", ", ", ")\n{\n"); break;
+ case EOpConstructFloat:
+ addConstructor(node->getType(), "vec1", &node->getSequence());
+ outputTriplet(visit, "vec1(", "", ")");
+ break;
+ case EOpConstructVec2:
+ addConstructor(node->getType(), "vec2", &node->getSequence());
+ outputTriplet(visit, "vec2(", ", ", ")");
+ break;
+ case EOpConstructVec3:
+ addConstructor(node->getType(), "vec3", &node->getSequence());
+ outputTriplet(visit, "vec3(", ", ", ")");
+ break;
+ case EOpConstructVec4:
+ addConstructor(node->getType(), "vec4", &node->getSequence());
+ outputTriplet(visit, "vec4(", ", ", ")");
+ break;
+ case EOpConstructBool:
+ addConstructor(node->getType(), "bvec1", &node->getSequence());
+ outputTriplet(visit, "bvec1(", "", ")");
+ break;
+ case EOpConstructBVec2:
+ addConstructor(node->getType(), "bvec2", &node->getSequence());
+ outputTriplet(visit, "bvec2(", ", ", ")");
+ break;
+ case EOpConstructBVec3:
+ addConstructor(node->getType(), "bvec3", &node->getSequence());
+ outputTriplet(visit, "bvec3(", ", ", ")");
+ break;
+ case EOpConstructBVec4:
+ addConstructor(node->getType(), "bvec4", &node->getSequence());
+ outputTriplet(visit, "bvec4(", ", ", ")");
+ break;
+ case EOpConstructInt:
+ addConstructor(node->getType(), "ivec1", &node->getSequence());
+ outputTriplet(visit, "ivec1(", "", ")");
+ break;
+ case EOpConstructIVec2:
+ addConstructor(node->getType(), "ivec2", &node->getSequence());
+ outputTriplet(visit, "ivec2(", ", ", ")");
+ break;
+ case EOpConstructIVec3:
+ addConstructor(node->getType(), "ivec3", &node->getSequence());
+ outputTriplet(visit, "ivec3(", ", ", ")");
+ break;
+ case EOpConstructIVec4:
+ addConstructor(node->getType(), "ivec4", &node->getSequence());
+ outputTriplet(visit, "ivec4(", ", ", ")");
+ break;
+ case EOpConstructMat2:
+ addConstructor(node->getType(), "mat2", &node->getSequence());
+ outputTriplet(visit, "mat2(", ", ", ")");
+ break;
+ case EOpConstructMat3:
+ addConstructor(node->getType(), "mat3", &node->getSequence());
+ outputTriplet(visit, "mat3(", ", ", ")");
+ break;
+ case EOpConstructMat4:
+ addConstructor(node->getType(), "mat4", &node->getSequence());
+ outputTriplet(visit, "mat4(", ", ", ")");
+ break;
+ case EOpConstructStruct:
+ addConstructor(node->getType(), scopedStruct(node->getType().getTypeName()), &node->getSequence());
+ outputTriplet(visit, structLookup(node->getType().getTypeName()) + "_ctor(", ", ", ")");
+ break;
+ case EOpLessThan: outputTriplet(visit, "(", " < ", ")"); break;
+ case EOpGreaterThan: outputTriplet(visit, "(", " > ", ")"); break;
+ case EOpLessThanEqual: outputTriplet(visit, "(", " <= ", ")"); break;
+ case EOpGreaterThanEqual: outputTriplet(visit, "(", " >= ", ")"); break;
+ case EOpVectorEqual: outputTriplet(visit, "(", " == ", ")"); break;
+ case EOpVectorNotEqual: outputTriplet(visit, "(", " != ", ")"); break;
+ case EOpMod:
+ {
+ switch (node->getSequence()[0]->getAsTyped()->getNominalSize()) // Number of components in the first argument
+ {
+ case 1: mUsesMod1 = true; break;
+ case 2: mUsesMod2 = true; break;
+ case 3: mUsesMod3 = true; break;
+ case 4: mUsesMod4 = true; break;
+ default: UNREACHABLE();
+ }
+
+ outputTriplet(visit, "mod(", ", ", ")");
+ }
+ break;
+ case EOpPow: outputTriplet(visit, "pow(", ", ", ")"); break;
+ case EOpAtan:
+ ASSERT(node->getSequence().size() == 2); // atan(x) is a unary operator
+ mUsesAtan2 = true;
+ outputTriplet(visit, "atanyx(", ", ", ")");
+ break;
+ case EOpMin: outputTriplet(visit, "min(", ", ", ")"); break;
+ case EOpMax: outputTriplet(visit, "max(", ", ", ")"); break;
+ case EOpClamp: outputTriplet(visit, "clamp(", ", ", ")"); break;
+ case EOpMix: outputTriplet(visit, "lerp(", ", ", ")"); break;
+ case EOpStep: outputTriplet(visit, "step(", ", ", ")"); break;
+ case EOpSmoothStep: outputTriplet(visit, "smoothstep(", ", ", ")"); break;
+ case EOpDistance: outputTriplet(visit, "distance(", ", ", ")"); break;
+ case EOpDot: outputTriplet(visit, "dot(", ", ", ")"); break;
+ case EOpCross: outputTriplet(visit, "cross(", ", ", ")"); break;
+ case EOpFaceForward:
+ {
+ switch (node->getSequence()[0]->getAsTyped()->getNominalSize()) // Number of components in the first argument
+ {
+ case 1: mUsesFaceforward1 = true; break;
+ case 2: mUsesFaceforward2 = true; break;
+ case 3: mUsesFaceforward3 = true; break;
+ case 4: mUsesFaceforward4 = true; break;
+ default: UNREACHABLE();
+ }
+
+ outputTriplet(visit, "faceforward(", ", ", ")");
+ }
+ break;
+ case EOpReflect: outputTriplet(visit, "reflect(", ", ", ")"); break;
+ case EOpRefract: outputTriplet(visit, "refract(", ", ", ")"); break;
+ case EOpMul: outputTriplet(visit, "(", " * ", ")"); break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ if (node->usesTernaryOperator())
+ {
+ out << "t" << mUnfoldSelect->getTemporaryIndex();
+ }
+ else // if/else statement
+ {
+ mUnfoldSelect->traverse(node->getCondition());
+
+ out << "if(";
+
+ node->getCondition()->traverse(this);
+
+ out << ")\n"
+ "{\n";
+
+ if (node->getTrueBlock())
+ {
+ node->getTrueBlock()->traverse(this);
+ }
+
+ out << ";}\n";
+
+ if (node->getFalseBlock())
+ {
+ out << "else\n"
+ "{\n";
+
+ node->getFalseBlock()->traverse(this);
+
+ out << ";}\n";
+ }
+ }
+
+ return false;
+}
+
+void OutputHLSL::visitConstantUnion(TIntermConstantUnion *node)
+{
+ writeConstantUnion(node->getType(), node->getUnionArrayPointer());
+}
+
+bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
+{
+ if (handleExcessiveLoop(node))
+ {
+ return false;
+ }
+
+ TInfoSinkBase &out = mBody;
+
+ if (node->getType() == ELoopDoWhile)
+ {
+ out << "do\n"
+ "{\n";
+ }
+ else
+ {
+ if (node->getInit())
+ {
+ mUnfoldSelect->traverse(node->getInit());
+ }
+
+ if (node->getCondition())
+ {
+ mUnfoldSelect->traverse(node->getCondition());
+ }
+
+ if (node->getExpression())
+ {
+ mUnfoldSelect->traverse(node->getExpression());
+ }
+
+ out << "for(";
+
+ if (node->getInit())
+ {
+ node->getInit()->traverse(this);
+ }
+
+ out << "; ";
+
+ if (node->getCondition())
+ {
+ node->getCondition()->traverse(this);
+ }
+
+ out << "; ";
+
+ if (node->getExpression())
+ {
+ node->getExpression()->traverse(this);
+ }
+
+ out << ")\n"
+ "{\n";
+ }
+
+ if (node->getBody())
+ {
+ node->getBody()->traverse(this);
+ }
+
+ out << "}\n";
+
+ if (node->getType() == ELoopDoWhile)
+ {
+ out << "while(\n";
+
+ node->getCondition()->traverse(this);
+
+ out << ")";
+ }
+
+ out << ";\n";
+
+ return false;
+}
+
+bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ switch (node->getFlowOp())
+ {
+ case EOpKill: outputTriplet(visit, "discard", "", ""); break;
+ case EOpBreak: outputTriplet(visit, "break", "", ""); break;
+ case EOpContinue: outputTriplet(visit, "continue", "", ""); break;
+ case EOpReturn:
+ if (visit == PreVisit)
+ {
+ if (node->getExpression())
+ {
+ out << "return ";
+ }
+ else
+ {
+ out << "return;\n";
+ }
+ }
+ else if (visit == PostVisit)
+ {
+ out << ";\n";
+ }
+ break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::isSingleStatement(TIntermNode *node)
+{
+ TIntermAggregate *aggregate = node->getAsAggregate();
+
+ if (aggregate)
+ {
+ if (aggregate->getOp() == EOpSequence)
+ {
+ return false;
+ }
+ else
+ {
+ for (TIntermSequence::iterator sit = aggregate->getSequence().begin(); sit != aggregate->getSequence().end(); sit++)
+ {
+ if (!isSingleStatement(*sit))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }
+
+ return true;
+}
+
+// Handle loops with more than 255 iterations (unsupported by D3D9) by splitting them
+bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ // Parse loops of the form:
+ // for(int index = initial; index [comparator] limit; index += increment)
+ TIntermSymbol *index = NULL;
+ TOperator comparator = EOpNull;
+ int initial = 0;
+ int limit = 0;
+ int increment = 0;
+
+ // Parse index name and intial value
+ if (node->getInit())
+ {
+ TIntermAggregate *init = node->getInit()->getAsAggregate();
+
+ if (init)
+ {
+ TIntermSequence &sequence = init->getSequence();
+ TIntermTyped *variable = sequence[0]->getAsTyped();
+
+ if (variable && variable->getQualifier() == EvqTemporary)
+ {
+ TIntermBinary *assign = variable->getAsBinaryNode();
+
+ if (assign->getOp() == EOpInitialize)
+ {
+ TIntermSymbol *symbol = assign->getLeft()->getAsSymbolNode();
+ TIntermConstantUnion *constant = assign->getRight()->getAsConstantUnion();
+
+ if (symbol && constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
+ {
+ index = symbol;
+ initial = constant->getUnionArrayPointer()[0].getIConst();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Parse comparator and limit value
+ if (index != NULL && node->getCondition())
+ {
+ TIntermBinary *test = node->getCondition()->getAsBinaryNode();
+
+ if (test && test->getLeft()->getAsSymbolNode()->getId() == index->getId())
+ {
+ TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();
+
+ if (constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
+ {
+ comparator = test->getOp();
+ limit = constant->getUnionArrayPointer()[0].getIConst();
+ }
+ }
+ }
+ }
+
+ // Parse increment
+ if (index != NULL && comparator != EOpNull && node->getExpression())
+ {
+ TIntermBinary *binaryTerminal = node->getExpression()->getAsBinaryNode();
+ TIntermUnary *unaryTerminal = node->getExpression()->getAsUnaryNode();
+
+ if (binaryTerminal)
+ {
+ TOperator op = binaryTerminal->getOp();
+ TIntermConstantUnion *constant = binaryTerminal->getRight()->getAsConstantUnion();
+
+ if (constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
+ {
+ int value = constant->getUnionArrayPointer()[0].getIConst();
+
+ switch (op)
+ {
+ case EOpAddAssign: increment = value; break;
+ case EOpSubAssign: increment = -value; break;
+ default: UNIMPLEMENTED();
+ }
+ }
+ }
+ }
+ else if (unaryTerminal)
+ {
+ TOperator op = unaryTerminal->getOp();
+
+ switch (op)
+ {
+ case EOpPostIncrement: increment = 1; break;
+ case EOpPostDecrement: increment = -1; break;
+ case EOpPreIncrement: increment = 1; break;
+ case EOpPreDecrement: increment = -1; break;
+ default: UNIMPLEMENTED();
+ }
+ }
+ }
+
+ if (index != NULL && comparator != EOpNull && increment != 0)
+ {
+ if (comparator == EOpLessThanEqual)
+ {
+ comparator = EOpLessThan;
+ limit += 1;
+ }
+
+ if (comparator == EOpLessThan)
+ {
+ int iterations = (limit - initial + 1) / increment;
+
+ if (iterations <= 255)
+ {
+ return false; // Not an excessive loop
+ }
+
+ while (iterations > 0)
+ {
+ int remainder = (limit - initial + 1) % increment;
+ int clampedLimit = initial + increment * std::min(255, iterations) - 1 - remainder;
+
+ // for(int index = initial; index < clampedLimit; index += increment)
+
+ out << "for(int ";
+ index->traverse(this);
+ out << " = ";
+ out << initial;
+
+ out << "; ";
+ index->traverse(this);
+ out << " < ";
+ out << clampedLimit;
+
+ out << "; ";
+ index->traverse(this);
+ out << " += ";
+ out << increment;
+ out << ")\n"
+ "{\n";
+
+ if (node->getBody())
+ {
+ node->getBody()->traverse(this);
+ }
+
+ out << "}\n";
+
+ initial += 255 * increment;
+ iterations -= 255;
+ }
+
+ return true;
+ }
+ else UNIMPLEMENTED();
+ }
+
+ return false; // Not handled as an excessive loop
+}
+
+void OutputHLSL::outputTriplet(Visit visit, const TString &preString, const TString &inString, const TString &postString)
+{
+ TInfoSinkBase &out = mBody;
+
+ if (visit == PreVisit)
+ {
+ out << preString;
+ }
+ else if (visit == InVisit)
+ {
+ out << inString;
+ }
+ else if (visit == PostVisit)
+ {
+ out << postString;
+ }
+}
+
+TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
+{
+ TQualifier qualifier = symbol->getQualifier();
+ const TType &type = symbol->getType();
+ TString name = symbol->getSymbol();
+
+ if (name.empty()) // HLSL demands named arguments, also for prototypes
+ {
+ name = "x" + str(mUniqueIndex++);
+ }
+ else
+ {
+ name = decorate(name);
+ }
+
+ return qualifierString(qualifier) + " " + typeString(type) + " " + name + arrayString(type);
+}
+
+TString OutputHLSL::qualifierString(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqIn: return "in";
+ case EvqOut: return "out";
+ case EvqInOut: return "inout";
+ case EvqConstReadOnly: return "const";
+ default: UNREACHABLE();
+ }
+
+ return "";
+}
+
+TString OutputHLSL::typeString(const TType &type)
+{
+ if (type.getBasicType() == EbtStruct)
+ {
+ if (type.getTypeName() != "")
+ {
+ return structLookup(type.getTypeName());
+ }
+ else // Nameless structure, define in place
+ {
+ const TTypeList &fields = *type.getStruct();
+
+ TString string = "struct\n"
+ "{\n";
+
+ for (unsigned int i = 0; i < fields.size(); i++)
+ {
+ const TType &field = *fields[i].type;
+
+ string += " " + typeString(field) + " " + field.getFieldName() + arrayString(field) + ";\n";
+ }
+
+ string += "} ";
+
+ return string;
+ }
+ }
+ else if (type.isMatrix())
+ {
+ switch (type.getNominalSize())
+ {
+ case 2: return "float2x2";
+ case 3: return "float3x3";
+ case 4: return "float4x4";
+ }
+ }
+ else
+ {
+ switch (type.getBasicType())
+ {
+ case EbtFloat:
+ switch (type.getNominalSize())
+ {
+ case 1: return "float";
+ case 2: return "float2";
+ case 3: return "float3";
+ case 4: return "float4";
+ }
+ case EbtInt:
+ switch (type.getNominalSize())
+ {
+ case 1: return "int";
+ case 2: return "int2";
+ case 3: return "int3";
+ case 4: return "int4";
+ }
+ case EbtBool:
+ switch (type.getNominalSize())
+ {
+ case 1: return "bool";
+ case 2: return "bool2";
+ case 3: return "bool3";
+ case 4: return "bool4";
+ }
+ case EbtVoid:
+ return "void";
+ case EbtSampler2D:
+ return "sampler2D";
+ case EbtSamplerCube:
+ return "samplerCUBE";
+ }
+ }
+
+ UNIMPLEMENTED(); // FIXME
+ return "<unknown type>";
+}
+
+TString OutputHLSL::arrayString(const TType &type)
+{
+ if (!type.isArray())
+ {
+ return "";
+ }
+
+ return "[" + str(type.getArraySize()) + "]";
+}
+
+TString OutputHLSL::initializer(const TType &type)
+{
+ TString string;
+
+ for (int component = 0; component < type.getObjectSize(); component++)
+ {
+ string += "0";
+
+ if (component < type.getObjectSize() - 1)
+ {
+ string += ", ";
+ }
+ }
+
+ return "{" + string + "}";
+}
+
+void OutputHLSL::addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters)
+{
+ if (name == "")
+ {
+ return; // Nameless structures don't have constructors
+ }
+
+ TType ctorType = type;
+ ctorType.clearArrayness();
+ ctorType.setPrecision(EbpHigh);
+ ctorType.setQualifier(EvqTemporary);
+
+ TString ctorName = type.getStruct() ? decorate(name) : name;
+
+ typedef std::vector<TType> ParameterArray;
+ ParameterArray ctorParameters;
+
+ if (parameters)
+ {
+ for (TIntermSequence::const_iterator parameter = parameters->begin(); parameter != parameters->end(); parameter++)
+ {
+ ctorParameters.push_back((*parameter)->getAsTyped()->getType());
+ }
+ }
+ else if (type.getStruct())
+ {
+ mStructNames.insert(decorate(name));
+
+ TString structure;
+ structure += "struct " + decorate(name) + "\n"
+ "{\n";
+
+ const TTypeList &fields = *type.getStruct();
+
+ for (unsigned int i = 0; i < fields.size(); i++)
+ {
+ const TType &field = *fields[i].type;
+
+ structure += " " + typeString(field) + " " + field.getFieldName() + arrayString(field) + ";\n";
+ }
+
+ structure += "};\n";
+
+ if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structure) == mStructDeclarations.end())
+ {
+ mStructDeclarations.push_back(structure);
+ }
+
+ for (unsigned int i = 0; i < fields.size(); i++)
+ {
+ ctorParameters.push_back(*fields[i].type);
+ }
+ }
+ else UNREACHABLE();
+
+ TString constructor;
+
+ if (ctorType.getStruct())
+ {
+ constructor += ctorName + " " + ctorName + "_ctor(";
+ }
+ else // Built-in type
+ {
+ constructor += typeString(ctorType) + " " + ctorName + "(";
+ }
+
+ for (unsigned int parameter = 0; parameter < ctorParameters.size(); parameter++)
+ {
+ const TType &type = ctorParameters[parameter];
+
+ constructor += typeString(type) + " x" + str(parameter) + arrayString(type);
+
+ if (parameter < ctorParameters.size() - 1)
+ {
+ constructor += ", ";
+ }
+ }
+
+ constructor += ")\n"
+ "{\n";
+
+ if (ctorType.getStruct())
+ {
+ constructor += " " + ctorName + " structure = {";
+ }
+ else
+ {
+ constructor += " return " + typeString(ctorType) + "(";
+ }
+
+ if (ctorType.isMatrix() && ctorParameters.size() == 1)
+ {
+ int dim = ctorType.getNominalSize();
+ const TType &parameter = ctorParameters[0];
+
+ if (parameter.isScalar())
+ {
+ for (int row = 0; row < dim; row++)
+ {
+ for (int col = 0; col < dim; col++)
+ {
+ constructor += TString((row == col) ? "x0" : "0.0");
+
+ if (row < dim - 1 || col < dim - 1)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+ }
+ else if (parameter.isMatrix())
+ {
+ for (int row = 0; row < dim; row++)
+ {
+ for (int col = 0; col < dim; col++)
+ {
+ if (row < parameter.getNominalSize() && col < parameter.getNominalSize())
+ {
+ constructor += TString("x0") + "[" + str(row) + "]" + "[" + str(col) + "]";
+ }
+ else
+ {
+ constructor += TString((row == col) ? "1.0" : "0.0");
+ }
+
+ if (row < dim - 1 || col < dim - 1)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+ }
+ else UNREACHABLE();
+ }
+ else
+ {
+ int remainingComponents = ctorType.getObjectSize();
+ int parameterIndex = 0;
+
+ while (remainingComponents > 0)
+ {
+ const TType &parameter = ctorParameters[parameterIndex];
+ bool moreParameters = parameterIndex < (int)ctorParameters.size() - 1;
+
+ constructor += "x" + str(parameterIndex);
+
+ if (parameter.isScalar())
+ {
+ remainingComponents -= parameter.getObjectSize();
+ }
+ else if (parameter.isVector())
+ {
+ if (remainingComponents == parameter.getObjectSize() || moreParameters)
+ {
+ remainingComponents -= parameter.getObjectSize();
+ }
+ else if (remainingComponents < parameter.getNominalSize())
+ {
+ switch (remainingComponents)
+ {
+ case 1: constructor += ".x"; break;
+ case 2: constructor += ".xy"; break;
+ case 3: constructor += ".xyz"; break;
+ case 4: constructor += ".xyzw"; break;
+ default: UNREACHABLE();
+ }
+
+ remainingComponents = 0;
+ }
+ else UNREACHABLE();
+ }
+ else if (parameter.isMatrix() || parameter.getStruct())
+ {
+ ASSERT(remainingComponents == parameter.getObjectSize() || moreParameters);
+
+ remainingComponents -= parameter.getObjectSize();
+ }
+ else UNREACHABLE();
+
+ if (moreParameters)
+ {
+ parameterIndex++;
+ }
+
+ if (remainingComponents)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+
+ if (ctorType.getStruct())
+ {
+ constructor += "};\n"
+ " return structure;\n"
+ "}\n";
+ }
+ else
+ {
+ constructor += ");\n"
+ "}\n";
+ }
+
+ mConstructors.insert(constructor);
+}
+
+const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const ConstantUnion *constUnion)
+{
+ TInfoSinkBase &out = mBody;
+
+ if (type.getBasicType() == EbtStruct)
+ {
+ out << structLookup(type.getTypeName()) + "_ctor(";
+
+ const TTypeList *structure = type.getStruct();
+
+ for (size_t i = 0; i < structure->size(); i++)
+ {
+ const TType *fieldType = (*structure)[i].type;
+
+ constUnion = writeConstantUnion(*fieldType, constUnion);
+
+ if (i != structure->size() - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ out << ")";
+ }
+ else
+ {
+ int size = type.getObjectSize();
+ bool writeType = size > 1;
+
+ if (writeType)
+ {
+ out << typeString(type) << "(";
+ }
+
+ for (int i = 0; i < size; i++, constUnion++)
+ {
+ switch (constUnion->getType())
+ {
+ case EbtFloat: out << constUnion->getFConst(); break;
+ case EbtInt: out << constUnion->getIConst(); break;
+ case EbtBool: out << constUnion->getBConst(); break;
+ default: UNREACHABLE();
+ }
+
+ if (i != size - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ if (writeType)
+ {
+ out << ")";
+ }
+ }
+
+ return constUnion;
+}
+
+TString OutputHLSL::scopeString(unsigned int depthLimit)
+{
+ TString string;
+
+ for (unsigned int i = 0; i < mScopeBracket.size() && i < depthLimit; i++)
+ {
+ string += "_" + str(i);
+ }
+
+ return string;
+}
+
+TString OutputHLSL::scopedStruct(const TString &typeName)
+{
+ if (typeName == "")
+ {
+ return typeName;
+ }
+
+ return typeName + scopeString(mScopeDepth);
+}
+
+TString OutputHLSL::structLookup(const TString &typeName)
+{
+ for (int depth = mScopeDepth; depth >= 0; depth--)
+ {
+ TString scopedName = decorate(typeName + scopeString(depth));
+
+ for (StructNames::iterator structName = mStructNames.begin(); structName != mStructNames.end(); structName++)
+ {
+ if (*structName == scopedName)
+ {
+ return scopedName;
+ }
+ }
+ }
+
+ UNREACHABLE(); // Should have found a matching constructor
+
+ return typeName;
+}
+
+TString OutputHLSL::decorate(const TString &string)
+{
+ if (string.substr(0, 3) != "gl_" && string.substr(0, 3) != "dx_")
+ {
+ return "_" + string;
+ }
+ else
+ {
+ return string;
+ }
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h
new file mode 100644
index 0000000..ddbd077
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h
@@ -0,0 +1,127 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_OUTPUTHLSL_H_
+#define COMPILER_OUTPUTHLSL_H_
+
+#include <list>
+#include <set>
+
+#include "compiler/intermediate.h"
+#include "compiler/ParseHelper.h"
+
+namespace sh
+{
+class UnfoldSelect;
+
+class OutputHLSL : public TIntermTraverser
+{
+ public:
+ explicit OutputHLSL(TParseContext &context);
+ ~OutputHLSL();
+
+ void output();
+
+ TInfoSinkBase &getBodyStream();
+
+ TString typeString(const TType &type);
+ static TString qualifierString(TQualifier qualifier);
+ static TString arrayString(const TType &type);
+ static TString initializer(const TType &type);
+ static TString decorate(const TString &string); // Prepend an underscore to avoid naming clashes
+
+ protected:
+ void header();
+
+ // Visit AST nodes and output their code to the body stream
+ void visitSymbol(TIntermSymbol*);
+ void visitConstantUnion(TIntermConstantUnion*);
+ bool visitBinary(Visit visit, TIntermBinary*);
+ bool visitUnary(Visit visit, TIntermUnary*);
+ bool visitSelection(Visit visit, TIntermSelection*);
+ bool visitAggregate(Visit visit, TIntermAggregate*);
+ bool visitLoop(Visit visit, TIntermLoop*);
+ bool visitBranch(Visit visit, TIntermBranch*);
+
+ bool isSingleStatement(TIntermNode *node);
+ bool handleExcessiveLoop(TIntermLoop *node);
+ void outputTriplet(Visit visit, const TString &preString, const TString &inString, const TString &postString);
+ TString argumentString(const TIntermSymbol *symbol);
+ int vectorSize(const TType &type) const;
+
+ void addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters);
+ const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *constUnion);
+
+ TString scopeString(unsigned int depthLimit);
+ TString scopedStruct(const TString &typeName);
+ TString structLookup(const TString &typeName);
+
+ TParseContext &mContext;
+ UnfoldSelect *mUnfoldSelect;
+ bool mInsideFunction;
+
+ // Output streams
+ TInfoSinkBase mHeader;
+ TInfoSinkBase mBody;
+ TInfoSinkBase mFooter;
+
+ std::set<std::string> mReferencedUniforms;
+ std::set<std::string> mReferencedAttributes;
+ std::set<std::string> mReferencedVaryings;
+
+ // Parameters determining what goes in the header output
+ bool mUsesTexture2D;
+ bool mUsesTexture2D_bias;
+ bool mUsesTexture2DProj;
+ bool mUsesTexture2DProj_bias;
+ bool mUsesTextureCube;
+ bool mUsesTextureCube_bias;
+ bool mUsesDepthRange;
+ bool mUsesFragCoord;
+ bool mUsesPointCoord;
+ bool mUsesFrontFacing;
+ bool mUsesPointSize;
+ bool mUsesXor;
+ bool mUsesMod1;
+ bool mUsesMod2;
+ bool mUsesMod3;
+ bool mUsesMod4;
+ bool mUsesFaceforward1;
+ bool mUsesFaceforward2;
+ bool mUsesFaceforward3;
+ bool mUsesFaceforward4;
+ bool mUsesEqualMat2;
+ bool mUsesEqualMat3;
+ bool mUsesEqualMat4;
+ bool mUsesEqualVec2;
+ bool mUsesEqualVec3;
+ bool mUsesEqualVec4;
+ bool mUsesEqualIVec2;
+ bool mUsesEqualIVec3;
+ bool mUsesEqualIVec4;
+ bool mUsesEqualBVec2;
+ bool mUsesEqualBVec3;
+ bool mUsesEqualBVec4;
+ bool mUsesAtan2;
+
+ typedef std::set<TString> Constructors;
+ Constructors mConstructors;
+
+ typedef std::set<TString> StructNames;
+ StructNames mStructNames;
+
+ typedef std::list<TString> StructDeclarations;
+ StructDeclarations mStructDeclarations;
+
+ typedef std::vector<int> ScopeBracket;
+ ScopeBracket mScopeBracket;
+ unsigned int mScopeDepth;
+
+ int mUniqueIndex; // For creating unique names
+};
+}
+
+#endif // COMPILER_OUTPUTHLSL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp
new file mode 100644
index 0000000..e149430
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp
@@ -0,0 +1,1530 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/ParseHelper.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "compiler/glslang.h"
+#include "compiler/osinclude.h"
+#include "compiler/InitializeParseContext.h"
+
+extern "C" {
+extern int InitPreprocessor();
+extern int FinalizePreprocessor();
+extern void PredefineIntMacro(const char *name, int value);
+}
+
+static void ReportInfo(TInfoSinkBase& sink,
+ TPrefixType type, TSourceLoc loc,
+ const char* reason, const char* token,
+ const char* extraInfo)
+{
+ /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
+ sink.prefix(type);
+ sink.location(loc);
+ sink << "'" << token << "' : " << reason << " " << extraInfo << "\n";
+}
+
+static void DefineExtensionMacros(const TExtensionBehavior& extBehavior)
+{
+ for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
+ iter != extBehavior.end(); ++iter) {
+ PredefineIntMacro(iter->first.c_str(), 1);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// Sub- vector and matrix fields
+//
+////////////////////////////////////////////////////////////////////////
+
+//
+// Look at a '.' field selector string and change it into offsets
+// for a vector.
+//
+bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TVectorFields& fields, int line)
+{
+ fields.num = (int) compString.size();
+ if (fields.num > 4) {
+ error(line, "illegal vector field selection", compString.c_str(), "");
+ return false;
+ }
+
+ enum {
+ exyzw,
+ ergba,
+ estpq,
+ } fieldSet[4];
+
+ for (int i = 0; i < fields.num; ++i) {
+ switch (compString[i]) {
+ case 'x':
+ fields.offsets[i] = 0;
+ fieldSet[i] = exyzw;
+ break;
+ case 'r':
+ fields.offsets[i] = 0;
+ fieldSet[i] = ergba;
+ break;
+ case 's':
+ fields.offsets[i] = 0;
+ fieldSet[i] = estpq;
+ break;
+ case 'y':
+ fields.offsets[i] = 1;
+ fieldSet[i] = exyzw;
+ break;
+ case 'g':
+ fields.offsets[i] = 1;
+ fieldSet[i] = ergba;
+ break;
+ case 't':
+ fields.offsets[i] = 1;
+ fieldSet[i] = estpq;
+ break;
+ case 'z':
+ fields.offsets[i] = 2;
+ fieldSet[i] = exyzw;
+ break;
+ case 'b':
+ fields.offsets[i] = 2;
+ fieldSet[i] = ergba;
+ break;
+ case 'p':
+ fields.offsets[i] = 2;
+ fieldSet[i] = estpq;
+ break;
+
+ case 'w':
+ fields.offsets[i] = 3;
+ fieldSet[i] = exyzw;
+ break;
+ case 'a':
+ fields.offsets[i] = 3;
+ fieldSet[i] = ergba;
+ break;
+ case 'q':
+ fields.offsets[i] = 3;
+ fieldSet[i] = estpq;
+ break;
+ default:
+ error(line, "illegal vector field selection", compString.c_str(), "");
+ return false;
+ }
+ }
+
+ for (int i = 0; i < fields.num; ++i) {
+ if (fields.offsets[i] >= vecSize) {
+ error(line, "vector field selection out of range", compString.c_str(), "");
+ return false;
+ }
+
+ if (i > 0) {
+ if (fieldSet[i] != fieldSet[i-1]) {
+ error(line, "illegal - vector component fields not from the same set", compString.c_str(), "");
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+
+//
+// Look at a '.' field selector string and change it into offsets
+// for a matrix.
+//
+bool TParseContext::parseMatrixFields(const TString& compString, int matSize, TMatrixFields& fields, int line)
+{
+ fields.wholeRow = false;
+ fields.wholeCol = false;
+ fields.row = -1;
+ fields.col = -1;
+
+ if (compString.size() != 2) {
+ error(line, "illegal length of matrix field selection", compString.c_str(), "");
+ return false;
+ }
+
+ if (compString[0] == '_') {
+ if (compString[1] < '0' || compString[1] > '3') {
+ error(line, "illegal matrix field selection", compString.c_str(), "");
+ return false;
+ }
+ fields.wholeCol = true;
+ fields.col = compString[1] - '0';
+ } else if (compString[1] == '_') {
+ if (compString[0] < '0' || compString[0] > '3') {
+ error(line, "illegal matrix field selection", compString.c_str(), "");
+ return false;
+ }
+ fields.wholeRow = true;
+ fields.row = compString[0] - '0';
+ } else {
+ if (compString[0] < '0' || compString[0] > '3' ||
+ compString[1] < '0' || compString[1] > '3') {
+ error(line, "illegal matrix field selection", compString.c_str(), "");
+ return false;
+ }
+ fields.row = compString[0] - '0';
+ fields.col = compString[1] - '0';
+ }
+
+ if (fields.row >= matSize || fields.col >= matSize) {
+ error(line, "matrix field selection out of range", compString.c_str(), "");
+ return false;
+ }
+
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// Errors
+//
+////////////////////////////////////////////////////////////////////////
+
+//
+// Track whether errors have occurred.
+//
+void TParseContext::recover()
+{
+ recoveredFromError = true;
+}
+
+//
+// Used by flex/bison to output all syntax and parsing errors.
+//
+void TParseContext::error(TSourceLoc loc,
+ const char* reason, const char* token,
+ const char* extraInfoFormat, ...)
+{
+ char extraInfo[512];
+ va_list marker;
+ va_start(marker, extraInfoFormat);
+ vsnprintf(extraInfo, sizeof(extraInfo), extraInfoFormat, marker);
+
+ ReportInfo(infoSink.info, EPrefixError, loc, reason, token, extraInfo);
+
+ va_end(marker);
+ ++numErrors;
+}
+
+void TParseContext::warning(TSourceLoc loc,
+ const char* reason, const char* token,
+ const char* extraInfoFormat, ...) {
+ char extraInfo[512];
+ va_list marker;
+ va_start(marker, extraInfoFormat);
+ vsnprintf(extraInfo, sizeof(extraInfo), extraInfoFormat, marker);
+
+ ReportInfo(infoSink.info, EPrefixWarning, loc, reason, token, extraInfo);
+
+ va_end(marker);
+}
+
+//
+// Same error message for all places assignments don't work.
+//
+void TParseContext::assignError(int line, const char* op, TString left, TString right)
+{
+ error(line, "", op, "cannot convert from '%s' to '%s'",
+ right.c_str(), left.c_str());
+}
+
+//
+// Same error message for all places unary operations don't work.
+//
+void TParseContext::unaryOpError(int line, const char* op, TString operand)
+{
+ error(line, " wrong operand type", op,
+ "no operation '%s' exists that takes an operand of type %s (or there is no acceptable conversion)",
+ op, operand.c_str());
+}
+
+//
+// Same error message for all binary operations don't work.
+//
+void TParseContext::binaryOpError(int line, const char* op, TString left, TString right)
+{
+ error(line, " wrong operand types ", op,
+ "no operation '%s' exists that takes a left-hand operand of type '%s' and "
+ "a right operand of type '%s' (or there is no acceptable conversion)",
+ op, left.c_str(), right.c_str());
+}
+
+bool TParseContext::precisionErrorCheck(int line, TPrecision precision, TBasicType type){
+ switch( type ){
+ case EbtFloat:
+ if( precision == EbpUndefined ){
+ error( line, "No precision specified for (float)", "", "" );
+ return true;
+ }
+ break;
+ case EbtInt:
+ if( precision == EbpUndefined ){
+ error( line, "No precision specified (int)", "", "" );
+ return true;
+ }
+ break;
+ default:
+ return false;
+ }
+ return false;
+}
+
+//
+// Both test and if necessary, spit out an error, to see if the node is really
+// an l-value that can be operated on this way.
+//
+// Returns true if the was an error.
+//
+bool TParseContext::lValueErrorCheck(int line, const char* op, TIntermTyped* node)
+{
+ TIntermSymbol* symNode = node->getAsSymbolNode();
+ TIntermBinary* binaryNode = node->getAsBinaryNode();
+
+ if (binaryNode) {
+ bool errorReturn;
+
+ switch(binaryNode->getOp()) {
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ case EOpIndexDirectStruct:
+ return lValueErrorCheck(line, op, binaryNode->getLeft());
+ case EOpVectorSwizzle:
+ errorReturn = lValueErrorCheck(line, op, binaryNode->getLeft());
+ if (!errorReturn) {
+ int offset[4] = {0,0,0,0};
+
+ TIntermTyped* rightNode = binaryNode->getRight();
+ TIntermAggregate *aggrNode = rightNode->getAsAggregate();
+
+ for (TIntermSequence::iterator p = aggrNode->getSequence().begin();
+ p != aggrNode->getSequence().end(); p++) {
+ int value = (*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getIConst();
+ offset[value]++;
+ if (offset[value] > 1) {
+ error(line, " l-value of swizzle cannot have duplicate components", op, "", "");
+
+ return true;
+ }
+ }
+ }
+
+ return errorReturn;
+ default:
+ break;
+ }
+ error(line, " l-value required", op, "", "");
+
+ return true;
+ }
+
+
+ const char* symbol = 0;
+ if (symNode != 0)
+ symbol = symNode->getSymbol().c_str();
+
+ const char* message = 0;
+ switch (node->getQualifier()) {
+ case EvqConst: message = "can't modify a const"; break;
+ case EvqConstReadOnly: message = "can't modify a const"; break;
+ case EvqAttribute: message = "can't modify an attribute"; break;
+ case EvqUniform: message = "can't modify a uniform"; break;
+ case EvqVaryingIn: message = "can't modify a varying"; break;
+ case EvqInput: message = "can't modify an input"; break;
+ case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
+ case EvqFrontFacing: message = "can't modify gl_FrontFacing"; break;
+ case EvqPointCoord: message = "can't modify gl_PointCoord"; break;
+ default:
+
+ //
+ // Type that can't be written to?
+ //
+ switch (node->getBasicType()) {
+ case EbtSampler2D:
+ case EbtSamplerCube:
+ message = "can't modify a sampler";
+ break;
+ case EbtVoid:
+ message = "can't modify void";
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (message == 0 && binaryNode == 0 && symNode == 0) {
+ error(line, " l-value required", op, "", "");
+
+ return true;
+ }
+
+
+ //
+ // Everything else is okay, no error.
+ //
+ if (message == 0)
+ return false;
+
+ //
+ // If we get here, we have an error and a message.
+ //
+ if (symNode)
+ error(line, " l-value required", op, "\"%s\" (%s)", symbol, message);
+ else
+ error(line, " l-value required", op, "(%s)", message);
+
+ return true;
+}
+
+//
+// Both test, and if necessary spit out an error, to see if the node is really
+// a constant.
+//
+// Returns true if the was an error.
+//
+bool TParseContext::constErrorCheck(TIntermTyped* node)
+{
+ if (node->getQualifier() == EvqConst)
+ return false;
+
+ error(node->getLine(), "constant expression required", "", "");
+
+ return true;
+}
+
+//
+// Both test, and if necessary spit out an error, to see if the node is really
+// an integer.
+//
+// Returns true if the was an error.
+//
+bool TParseContext::integerErrorCheck(TIntermTyped* node, const char* token)
+{
+ if (node->getBasicType() == EbtInt && node->getNominalSize() == 1)
+ return false;
+
+ error(node->getLine(), "integer expression required", token, "");
+
+ return true;
+}
+
+//
+// Both test, and if necessary spit out an error, to see if we are currently
+// globally scoped.
+//
+// Returns true if the was an error.
+//
+bool TParseContext::globalErrorCheck(int line, bool global, const char* token)
+{
+ if (global)
+ return false;
+
+ error(line, "only allowed at global scope", token, "");
+
+ return true;
+}
+
+//
+// For now, keep it simple: if it starts "gl_", it's reserved, independent
+// of scope. Except, if the symbol table is at the built-in push-level,
+// which is when we are parsing built-ins.
+// Also checks for "webgl_" and "_webgl_" reserved identifiers if parsing a
+// webgl shader.
+//
+// Returns true if there was an error.
+//
+bool TParseContext::reservedErrorCheck(int line, const TString& identifier)
+{
+ static const char* reservedErrMsg = "reserved built-in name";
+ if (!symbolTable.atBuiltInLevel()) {
+ if (identifier.substr(0, 3) == TString("gl_")) {
+ error(line, reservedErrMsg, "gl_", "");
+ return true;
+ }
+ if (shaderSpec == SH_WEBGL_SPEC) {
+ if (identifier.substr(0, 6) == TString("webgl_")) {
+ error(line, reservedErrMsg, "webgl_", "");
+ return true;
+ }
+ if (identifier.substr(0, 7) == TString("_webgl_")) {
+ error(line, reservedErrMsg, "_webgl_", "");
+ return true;
+ }
+ }
+ if (identifier.find("__") != TString::npos) {
+ //error(line, "Two consecutive underscores are reserved for future use.", identifier.c_str(), "", "");
+ //return true;
+ infoSink.info.message(EPrefixWarning, "Two consecutive underscores are reserved for future use.", line);
+ return false;
+ }
+ }
+
+ return false;
+}
+
+//
+// Make sure there is enough data provided to the constructor to build
+// something of the type of the constructor. Also returns the type of
+// the constructor.
+//
+// Returns true if there was an error in construction.
+//
+bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction& function, TOperator op, TType* type)
+{
+ *type = function.getReturnType();
+
+ bool constructingMatrix = false;
+ switch(op) {
+ case EOpConstructMat2:
+ case EOpConstructMat3:
+ case EOpConstructMat4:
+ constructingMatrix = true;
+ break;
+ default:
+ break;
+ }
+
+ //
+ // Note: It's okay to have too many components available, but not okay to have unused
+ // arguments. 'full' will go to true when enough args have been seen. If we loop
+ // again, there is an extra argument, so 'overfull' will become true.
+ //
+
+ int size = 0;
+ bool constType = true;
+ bool full = false;
+ bool overFull = false;
+ bool matrixInMatrix = false;
+ bool arrayArg = false;
+ for (int i = 0; i < function.getParamCount(); ++i) {
+ const TParameter& param = function.getParam(i);
+ size += param.type->getObjectSize();
+
+ if (constructingMatrix && param.type->isMatrix())
+ matrixInMatrix = true;
+ if (full)
+ overFull = true;
+ if (op != EOpConstructStruct && !type->isArray() && size >= type->getObjectSize())
+ full = true;
+ if (param.type->getQualifier() != EvqConst)
+ constType = false;
+ if (param.type->isArray())
+ arrayArg = true;
+ }
+
+ if (constType)
+ type->setQualifier(EvqConst);
+
+ if (type->isArray() && type->getArraySize() != function.getParamCount()) {
+ error(line, "array constructor needs one argument per array element", "constructor", "");
+ return true;
+ }
+
+ if (arrayArg && op != EOpConstructStruct) {
+ error(line, "constructing from a non-dereferenced array", "constructor", "");
+ return true;
+ }
+
+ if (matrixInMatrix && !type->isArray()) {
+ if (function.getParamCount() != 1) {
+ error(line, "constructing matrix from matrix can only take one argument", "constructor", "");
+ return true;
+ }
+ }
+
+ if (overFull) {
+ error(line, "too many arguments", "constructor", "");
+ return true;
+ }
+
+ if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->size()) != function.getParamCount()) {
+ error(line, "Number of constructor parameters does not match the number of structure fields", "constructor", "");
+ return true;
+ }
+
+ if (!type->isMatrix()) {
+ if ((op != EOpConstructStruct && size != 1 && size < type->getObjectSize()) ||
+ (op == EOpConstructStruct && size < type->getObjectSize())) {
+ error(line, "not enough data provided for construction", "constructor", "");
+ return true;
+ }
+ }
+
+ TIntermTyped* typed = node->getAsTyped();
+ if (typed == 0) {
+ error(line, "constructor argument does not have a type", "constructor", "");
+ return true;
+ }
+ if (op != EOpConstructStruct && IsSampler(typed->getBasicType())) {
+ error(line, "cannot convert a sampler", "constructor", "");
+ return true;
+ }
+ if (typed->getBasicType() == EbtVoid) {
+ error(line, "cannot convert a void", "constructor", "");
+ return true;
+ }
+
+ return false;
+}
+
+// This function checks to see if a void variable has been declared and raise an error message for such a case
+//
+// returns true in case of an error
+//
+bool TParseContext::voidErrorCheck(int line, const TString& identifier, const TPublicType& pubType)
+{
+ if (pubType.type == EbtVoid) {
+ error(line, "illegal use of type 'void'", identifier.c_str(), "");
+ return true;
+ }
+
+ return false;
+}
+
+// This function checks to see if the node (for the expression) contains a scalar boolean expression or not
+//
+// returns true in case of an error
+//
+bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type)
+{
+ if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector()) {
+ error(line, "boolean expression expected", "", "");
+ return true;
+ }
+
+ return false;
+}
+
+// This function checks to see if the node (for the expression) contains a scalar boolean expression or not
+//
+// returns true in case of an error
+//
+bool TParseContext::boolErrorCheck(int line, const TPublicType& pType)
+{
+ if (pType.type != EbtBool || pType.array || pType.matrix || (pType.size > 1)) {
+ error(line, "boolean expression expected", "", "");
+ return true;
+ }
+
+ return false;
+}
+
+bool TParseContext::samplerErrorCheck(int line, const TPublicType& pType, const char* reason)
+{
+ if (pType.type == EbtStruct) {
+ if (containsSampler(*pType.userDef)) {
+ error(line, reason, getBasicString(pType.type), "(structure contains a sampler)");
+
+ return true;
+ }
+
+ return false;
+ } else if (IsSampler(pType.type)) {
+ error(line, reason, getBasicString(pType.type), "");
+
+ return true;
+ }
+
+ return false;
+}
+
+bool TParseContext::structQualifierErrorCheck(int line, const TPublicType& pType)
+{
+ if ((pType.qualifier == EvqVaryingIn || pType.qualifier == EvqVaryingOut || pType.qualifier == EvqAttribute) &&
+ pType.type == EbtStruct) {
+ error(line, "cannot be used with a structure", getQualifierString(pType.qualifier), "");
+
+ return true;
+ }
+
+ if (pType.qualifier != EvqUniform && samplerErrorCheck(line, pType, "samplers must be uniform"))
+ return true;
+
+ return false;
+}
+
+bool TParseContext::parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type)
+{
+ if ((qualifier == EvqOut || qualifier == EvqInOut) &&
+ type.getBasicType() != EbtStruct && IsSampler(type.getBasicType())) {
+ error(line, "samplers cannot be output parameters", type.getBasicString(), "");
+ return true;
+ }
+
+ return false;
+}
+
+bool TParseContext::containsSampler(TType& type)
+{
+ if (IsSampler(type.getBasicType()))
+ return true;
+
+ if (type.getBasicType() == EbtStruct) {
+ TTypeList& structure = *type.getStruct();
+ for (unsigned int i = 0; i < structure.size(); ++i) {
+ if (containsSampler(*structure[i].type))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//
+// Do size checking for an array type's size.
+//
+// Returns true if there was an error.
+//
+bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
+{
+ TIntermConstantUnion* constant = expr->getAsConstantUnion();
+ if (constant == 0 || constant->getBasicType() != EbtInt) {
+ error(line, "array size must be a constant integer expression", "", "");
+ return true;
+ }
+
+ size = constant->getUnionArrayPointer()->getIConst();
+
+ if (size <= 0) {
+ error(line, "array size must be a positive integer", "", "");
+ size = 1;
+ return true;
+ }
+
+ return false;
+}
+
+//
+// See if this qualifier can be an array.
+//
+// Returns true if there is an error.
+//
+bool TParseContext::arrayQualifierErrorCheck(int line, TPublicType type)
+{
+ if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqConst)) {
+ error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str(), "");
+ return true;
+ }
+
+ return false;
+}
+
+//
+// See if this type can be an array.
+//
+// Returns true if there is an error.
+//
+bool TParseContext::arrayTypeErrorCheck(int line, TPublicType type)
+{
+ //
+ // Can the type be an array?
+ //
+ if (type.array) {
+ error(line, "cannot declare arrays of arrays", TType(type).getCompleteString().c_str(), "");
+ return true;
+ }
+
+ return false;
+}
+
+//
+// Do all the semantic checking for declaring an array, with and
+// without a size, and make the right changes to the symbol table.
+//
+// size == 0 means no specified size.
+//
+// Returns true if there was an error.
+//
+bool TParseContext::arrayErrorCheck(int line, TString& identifier, TPublicType type, TVariable*& variable)
+{
+ //
+ // Don't check for reserved word use until after we know it's not in the symbol table,
+ // because reserved arrays can be redeclared.
+ //
+
+ bool builtIn = false;
+ bool sameScope = false;
+ TSymbol* symbol = symbolTable.find(identifier, &builtIn, &sameScope);
+ if (symbol == 0 || !sameScope) {
+ if (reservedErrorCheck(line, identifier))
+ return true;
+
+ variable = new TVariable(&identifier, TType(type));
+
+ if (type.arraySize)
+ variable->getType().setArraySize(type.arraySize);
+
+ if (! symbolTable.insert(*variable)) {
+ delete variable;
+ error(line, "INTERNAL ERROR inserting new symbol", identifier.c_str(), "");
+ return true;
+ }
+ } else {
+ if (! symbol->isVariable()) {
+ error(line, "variable expected", identifier.c_str(), "");
+ return true;
+ }
+
+ variable = static_cast<TVariable*>(symbol);
+ if (! variable->getType().isArray()) {
+ error(line, "redeclaring non-array as array", identifier.c_str(), "");
+ return true;
+ }
+ if (variable->getType().getArraySize() > 0) {
+ error(line, "redeclaration of array with size", identifier.c_str(), "");
+ return true;
+ }
+
+ if (! variable->getType().sameElementType(TType(type))) {
+ error(line, "redeclaration of array with a different type", identifier.c_str(), "");
+ return true;
+ }
+
+ TType* t = variable->getArrayInformationType();
+ while (t != 0) {
+ if (t->getMaxArraySize() > type.arraySize) {
+ error(line, "higher index value already used for the array", identifier.c_str(), "");
+ return true;
+ }
+ t->setArraySize(type.arraySize);
+ t = t->getArrayInformationType();
+ }
+
+ if (type.arraySize)
+ variable->getType().setArraySize(type.arraySize);
+ }
+
+ if (voidErrorCheck(line, identifier, type))
+ return true;
+
+ return false;
+}
+
+bool TParseContext::arraySetMaxSize(TIntermSymbol *node, TType* type, int size, bool updateFlag, TSourceLoc line)
+{
+ bool builtIn = false;
+ TSymbol* symbol = symbolTable.find(node->getSymbol(), &builtIn);
+ if (symbol == 0) {
+ error(line, " undeclared identifier", node->getSymbol().c_str(), "");
+ return true;
+ }
+ TVariable* variable = static_cast<TVariable*>(symbol);
+
+ type->setArrayInformationType(variable->getArrayInformationType());
+ variable->updateArrayInformationType(type);
+
+ // special casing to test index value of gl_FragData. If the accessed index is >= gl_MaxDrawBuffers
+ // its an error
+ if (node->getSymbol() == "gl_FragData") {
+ TSymbol* fragData = symbolTable.find("gl_MaxDrawBuffers", &builtIn);
+ if (fragData == 0) {
+ infoSink.info.message(EPrefixInternalError, "gl_MaxDrawBuffers not defined", line);
+ return true;
+ }
+
+ int fragDataValue = static_cast<TVariable*>(fragData)->getConstPointer()[0].getIConst();
+ if (fragDataValue <= size) {
+ error(line, "", "[", "gl_FragData can only have a max array size of up to gl_MaxDrawBuffers", "");
+ return true;
+ }
+ }
+
+ // we dont want to update the maxArraySize when this flag is not set, we just want to include this
+ // node type in the chain of node types so that its updated when a higher maxArraySize comes in.
+ if (!updateFlag)
+ return false;
+
+ size++;
+ variable->getType().setMaxArraySize(size);
+ type->setMaxArraySize(size);
+ TType* tt = type;
+
+ while(tt->getArrayInformationType() != 0) {
+ tt = tt->getArrayInformationType();
+ tt->setMaxArraySize(size);
+ }
+
+ return false;
+}
+
+//
+// Enforce non-initializer type/qualifier rules.
+//
+// Returns true if there was an error.
+//
+bool TParseContext::nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type)
+{
+ //
+ // Make the qualifier make sense.
+ //
+ if (type.qualifier == EvqConst) {
+ type.qualifier = EvqTemporary;
+ error(line, "variables with qualifier 'const' must be initialized", identifier.c_str(), "");
+ return true;
+ }
+
+ return false;
+}
+
+//
+// Do semantic checking for a variable declaration that has no initializer,
+// and update the symbol table.
+//
+// Returns true if there was an error.
+//
+bool TParseContext::nonInitErrorCheck(int line, TString& identifier, TPublicType& type)
+{
+ if (reservedErrorCheck(line, identifier))
+ recover();
+
+ TVariable* variable = new TVariable(&identifier, TType(type));
+
+ if (! symbolTable.insert(*variable)) {
+ error(line, "redefinition", variable->getName().c_str(), "");
+ delete variable;
+ return true;
+ }
+
+ if (voidErrorCheck(line, identifier, type))
+ return true;
+
+ return false;
+}
+
+bool TParseContext::paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type)
+{
+ if (qualifier != EvqConst && qualifier != EvqTemporary) {
+ error(line, "qualifier not allowed on function parameter", getQualifierString(qualifier), "");
+ return true;
+ }
+ if (qualifier == EvqConst && paramQualifier != EvqIn) {
+ error(line, "qualifier not allowed with ", getQualifierString(qualifier), getQualifierString(paramQualifier));
+ return true;
+ }
+
+ if (qualifier == EvqConst)
+ type->setQualifier(EvqConstReadOnly);
+ else
+ type->setQualifier(paramQualifier);
+
+ return false;
+}
+
+bool TParseContext::extensionErrorCheck(int line, const TString& extension)
+{
+ TExtensionBehavior::const_iterator iter = extensionBehavior.find(extension);
+ if (iter == extensionBehavior.end()) {
+ error(line, "extension", extension.c_str(), "is not supported");
+ return true;
+ }
+ if (iter->second == EBhDisable) {
+ error(line, "extension", extension.c_str(), "is disabled");
+ return true;
+ }
+ if (iter->second == EBhWarn) {
+ TString msg = "extension " + extension + " is being used";
+ infoSink.info.message(EPrefixWarning, msg.c_str(), line);
+ return false;
+ }
+
+ return false;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Non-Errors.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+//
+// Look up a function name in the symbol table, and make sure it is a function.
+//
+// Return the function symbol if found, otherwise 0.
+//
+const TFunction* TParseContext::findFunction(int line, TFunction* call, bool *builtIn)
+{
+ // First find by unmangled name to check whether the function name has been
+ // hidden by a variable name or struct typename.
+ const TSymbol* symbol = symbolTable.find(call->getName(), builtIn);
+ if (symbol == 0) {
+ symbol = symbolTable.find(call->getMangledName(), builtIn);
+ }
+
+ if (symbol == 0) {
+ error(line, "no matching overloaded function found", call->getName().c_str(), "");
+ return 0;
+ }
+
+ if (!symbol->isFunction()) {
+ error(line, "function name expected", call->getName().c_str(), "");
+ return 0;
+ }
+
+ return static_cast<const TFunction*>(symbol);
+}
+
+//
+// Initializers show up in several places in the grammar. Have one set of
+// code to handle them here.
+//
+bool TParseContext::executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType,
+ TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable)
+{
+ TType type = TType(pType);
+
+ if (variable == 0) {
+ if (reservedErrorCheck(line, identifier))
+ return true;
+
+ if (voidErrorCheck(line, identifier, pType))
+ return true;
+
+ //
+ // add variable to symbol table
+ //
+ variable = new TVariable(&identifier, type);
+ if (! symbolTable.insert(*variable)) {
+ error(line, "redefinition", variable->getName().c_str(), "");
+ return true;
+ // don't delete variable, it's used by error recovery, and the pool
+ // pop will take care of the memory
+ }
+ }
+
+ //
+ // identifier must be of type constant, a global, or a temporary
+ //
+ TQualifier qualifier = variable->getType().getQualifier();
+ if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal) && (qualifier != EvqConst)) {
+ error(line, " cannot initialize this type of qualifier ", variable->getType().getQualifierString(), "");
+ return true;
+ }
+ //
+ // test for and propagate constant
+ //
+
+ if (qualifier == EvqConst) {
+ if (qualifier != initializer->getType().getQualifier()) {
+ error(line, " assigning non-constant to", "=", "'%s'", variable->getType().getCompleteString().c_str());
+ variable->getType().setQualifier(EvqTemporary);
+ return true;
+ }
+ if (type != initializer->getType()) {
+ error(line, " non-matching types for const initializer ",
+ variable->getType().getQualifierString(), "");
+ variable->getType().setQualifier(EvqTemporary);
+ return true;
+ }
+ if (initializer->getAsConstantUnion()) {
+ ConstantUnion* unionArray = variable->getConstPointer();
+
+ if (type.getObjectSize() == 1 && type.getBasicType() != EbtStruct) {
+ *unionArray = (initializer->getAsConstantUnion()->getUnionArrayPointer())[0];
+ } else {
+ variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer());
+ }
+ } else if (initializer->getAsSymbolNode()) {
+ const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol());
+ const TVariable* tVar = static_cast<const TVariable*>(symbol);
+
+ ConstantUnion* constArray = tVar->getConstPointer();
+ variable->shareConstPointer(constArray);
+ } else {
+ error(line, " cannot assign to", "=", "'%s'", variable->getType().getCompleteString().c_str());
+ variable->getType().setQualifier(EvqTemporary);
+ return true;
+ }
+ }
+
+ if (qualifier != EvqConst) {
+ TIntermSymbol* intermSymbol = intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), line);
+ intermNode = intermediate.addAssign(EOpInitialize, intermSymbol, initializer, line);
+ if (intermNode == 0) {
+ assignError(line, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
+ return true;
+ }
+ } else
+ intermNode = 0;
+
+ return false;
+}
+
+bool TParseContext::areAllChildConst(TIntermAggregate* aggrNode)
+{
+ ASSERT(aggrNode != NULL);
+ if (!aggrNode->isConstructor())
+ return false;
+
+ bool allConstant = true;
+
+ // check if all the child nodes are constants so that they can be inserted into
+ // the parent node
+ TIntermSequence &sequence = aggrNode->getSequence() ;
+ for (TIntermSequence::iterator p = sequence.begin(); p != sequence.end(); ++p) {
+ if (!(*p)->getAsTyped()->getAsConstantUnion())
+ return false;
+ }
+
+ return allConstant;
+}
+
+// This function is used to test for the correctness of the parameters passed to various constructor functions
+// and also convert them to the right datatype if it is allowed and required.
+//
+// Returns 0 for an error or the constructed node (aggregate or typed) for no error.
+//
+TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type, TOperator op, TFunction* fnCall, TSourceLoc line)
+{
+ if (node == 0)
+ return 0;
+
+ TIntermAggregate* aggrNode = node->getAsAggregate();
+
+ TTypeList::const_iterator memberTypes;
+ if (op == EOpConstructStruct)
+ memberTypes = type->getStruct()->begin();
+
+ TType elementType = *type;
+ if (type->isArray())
+ elementType.clearArrayness();
+
+ bool singleArg;
+ if (aggrNode) {
+ if (aggrNode->getOp() != EOpNull || aggrNode->getSequence().size() == 1)
+ singleArg = true;
+ else
+ singleArg = false;
+ } else
+ singleArg = true;
+
+ TIntermTyped *newNode;
+ if (singleArg) {
+ // If structure constructor or array constructor is being called
+ // for only one parameter inside the structure, we need to call constructStruct function once.
+ if (type->isArray())
+ newNode = constructStruct(node, &elementType, 1, node->getLine(), false);
+ else if (op == EOpConstructStruct)
+ newNode = constructStruct(node, (*memberTypes).type, 1, node->getLine(), false);
+ else
+ newNode = constructBuiltIn(type, op, node, node->getLine(), false);
+
+ if (newNode && newNode->getAsAggregate()) {
+ TIntermTyped* constConstructor = foldConstConstructor(newNode->getAsAggregate(), *type);
+ if (constConstructor)
+ return constConstructor;
+ }
+
+ return newNode;
+ }
+
+ //
+ // Handle list of arguments.
+ //
+ TIntermSequence &sequenceVector = aggrNode->getSequence() ; // Stores the information about the parameter to the constructor
+ // if the structure constructor contains more than one parameter, then construct
+ // each parameter
+
+ int paramCount = 0; // keeps a track of the constructor parameter number being checked
+
+ // for each parameter to the constructor call, check to see if the right type is passed or convert them
+ // to the right type if possible (and allowed).
+ // for structure constructors, just check if the right type is passed, no conversion is allowed.
+
+ for (TIntermSequence::iterator p = sequenceVector.begin();
+ p != sequenceVector.end(); p++, paramCount++) {
+ if (type->isArray())
+ newNode = constructStruct(*p, &elementType, paramCount+1, node->getLine(), true);
+ else if (op == EOpConstructStruct)
+ newNode = constructStruct(*p, (memberTypes[paramCount]).type, paramCount+1, node->getLine(), true);
+ else
+ newNode = constructBuiltIn(type, op, *p, node->getLine(), true);
+
+ if (newNode) {
+ *p = newNode;
+ }
+ }
+
+ TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, line);
+ TIntermTyped* constConstructor = foldConstConstructor(constructor->getAsAggregate(), *type);
+ if (constConstructor)
+ return constConstructor;
+
+ return constructor;
+}
+
+TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, const TType& type)
+{
+ bool canBeFolded = areAllChildConst(aggrNode);
+ aggrNode->setType(type);
+ if (canBeFolded) {
+ bool returnVal = false;
+ ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
+ if (aggrNode->getSequence().size() == 1) {
+ returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), symbolTable, type, true);
+ }
+ else {
+ returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), symbolTable, type);
+ }
+ if (returnVal)
+ return 0;
+
+ return intermediate.addConstantUnion(unionArray, type, aggrNode->getLine());
+ }
+
+ return 0;
+}
+
+// Function for constructor implementation. Calls addUnaryMath with appropriate EOp value
+// for the parameter to the constructor (passed to this function). Essentially, it converts
+// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a
+// float, then float is converted to int.
+//
+// Returns 0 for an error or the constructed node.
+//
+TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, TIntermNode* node, TSourceLoc line, bool subset)
+{
+ TIntermTyped* newNode;
+ TOperator basicOp;
+
+ //
+ // First, convert types as needed.
+ //
+ switch (op) {
+ case EOpConstructVec2:
+ case EOpConstructVec3:
+ case EOpConstructVec4:
+ case EOpConstructMat2:
+ case EOpConstructMat3:
+ case EOpConstructMat4:
+ case EOpConstructFloat:
+ basicOp = EOpConstructFloat;
+ break;
+
+ case EOpConstructIVec2:
+ case EOpConstructIVec3:
+ case EOpConstructIVec4:
+ case EOpConstructInt:
+ basicOp = EOpConstructInt;
+ break;
+
+ case EOpConstructBVec2:
+ case EOpConstructBVec3:
+ case EOpConstructBVec4:
+ case EOpConstructBool:
+ basicOp = EOpConstructBool;
+ break;
+
+ default:
+ error(line, "unsupported construction", "", "");
+ recover();
+
+ return 0;
+ }
+ newNode = intermediate.addUnaryMath(basicOp, node, node->getLine(), symbolTable);
+ if (newNode == 0) {
+ error(line, "can't convert", "constructor", "");
+ return 0;
+ }
+
+ //
+ // Now, if there still isn't an operation to do the construction, and we need one, add one.
+ //
+
+ // Otherwise, skip out early.
+ if (subset || (newNode != node && newNode->getType() == *type))
+ return newNode;
+
+ // setAggregateOperator will insert a new node for the constructor, as needed.
+ return intermediate.setAggregateOperator(newNode, op, line);
+}
+
+// This function tests for the type of the parameters to the structures constructors. Raises
+// an error message if the expected type does not match the parameter passed to the constructor.
+//
+// Returns 0 for an error or the input node itself if the expected and the given parameter types match.
+//
+TIntermTyped* TParseContext::constructStruct(TIntermNode* node, TType* type, int paramCount, TSourceLoc line, bool subset)
+{
+ if (*type == node->getAsTyped()->getType()) {
+ if (subset)
+ return node->getAsTyped();
+ else
+ return intermediate.setAggregateOperator(node->getAsTyped(), EOpConstructStruct, line);
+ } else {
+ error(line, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount,
+ node->getAsTyped()->getType().getBasicString(), type->getBasicString());
+ recover();
+ }
+
+ return 0;
+}
+
+//
+// This function returns the tree representation for the vector field(s) being accessed from contant vector.
+// If only one component of vector is accessed (v.x or v[0] where v is a contant vector), then a contant node is
+// returned, else an aggregate node is returned (for v.xy). The input to this function could either be the symbol
+// node or it could be the intermediate tree representation of accessing fields in a constant structure or column of
+// a constant matrix.
+//
+TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTyped* node, TSourceLoc line)
+{
+ TIntermTyped* typedNode;
+ TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
+
+ ConstantUnion *unionArray;
+ if (tempConstantNode) {
+ unionArray = tempConstantNode->getUnionArrayPointer();
+
+ if (!unionArray) { // this error message should never be raised
+ infoSink.info.message(EPrefixInternalError, "ConstantUnion not initialized in addConstVectorNode function", line);
+ recover();
+
+ return node;
+ }
+ } else { // The node has to be either a symbol node or an aggregate node or a tempConstant node, else, its an error
+ error(line, "Cannot offset into the vector", "Error", "");
+ recover();
+
+ return 0;
+ }
+
+ ConstantUnion* constArray = new ConstantUnion[fields.num];
+
+ for (int i = 0; i < fields.num; i++) {
+ if (fields.offsets[i] >= node->getType().getObjectSize()) {
+ error(line, "", "[", "vector field selection out of range '%d'", fields.offsets[i]);
+ recover();
+ fields.offsets[i] = 0;
+ }
+
+ constArray[i] = unionArray[fields.offsets[i]];
+
+ }
+ typedNode = intermediate.addConstantUnion(constArray, node->getType(), line);
+ return typedNode;
+}
+
+//
+// This function returns the column being accessed from a constant matrix. The values are retrieved from
+// the symbol table and parse-tree is built for a vector (each column of a matrix is a vector). The input
+// to the function could either be a symbol node (m[0] where m is a constant matrix)that represents a
+// constant matrix or it could be the tree representation of the constant matrix (s.m1[0] where s is a constant structure)
+//
+TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, TSourceLoc line)
+{
+ TIntermTyped* typedNode;
+ TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
+
+ if (index >= node->getType().getNominalSize()) {
+ error(line, "", "[", "matrix field selection out of range '%d'", index);
+ recover();
+ index = 0;
+ }
+
+ if (tempConstantNode) {
+ ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
+ int size = tempConstantNode->getType().getNominalSize();
+ typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
+ } else {
+ error(line, "Cannot offset into the matrix", "Error", "");
+ recover();
+
+ return 0;
+ }
+
+ return typedNode;
+}
+
+
+//
+// This function returns an element of an array accessed from a constant array. The values are retrieved from
+// the symbol table and parse-tree is built for the type of the element. The input
+// to the function could either be a symbol node (a[0] where a is a constant array)that represents a
+// constant array or it could be the tree representation of the constant array (s.a1[0] where s is a constant structure)
+//
+TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line)
+{
+ TIntermTyped* typedNode;
+ TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
+ TType arrayElementType = node->getType();
+ arrayElementType.clearArrayness();
+
+ if (index >= node->getType().getArraySize()) {
+ error(line, "", "[", "array field selection out of range '%d'", index);
+ recover();
+ index = 0;
+ }
+
+ int arrayElementSize = arrayElementType.getObjectSize();
+
+ if (tempConstantNode) {
+ ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
+ typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
+ } else {
+ error(line, "Cannot offset into the array", "Error", "");
+ recover();
+
+ return 0;
+ }
+
+ return typedNode;
+}
+
+
+//
+// This function returns the value of a particular field inside a constant structure from the symbol table.
+// If there is an embedded/nested struct, it appropriately calls addConstStructNested or addConstStructFromAggr
+// function and returns the parse-tree with the values of the embedded/nested struct.
+//
+TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* node, TSourceLoc line)
+{
+ const TTypeList* fields = node->getType().getStruct();
+ TIntermTyped *typedNode;
+ int instanceSize = 0;
+ unsigned int index = 0;
+ TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
+
+ for ( index = 0; index < fields->size(); ++index) {
+ if ((*fields)[index].type->getFieldName() == identifier) {
+ break;
+ } else {
+ instanceSize += (*fields)[index].type->getObjectSize();
+ }
+ }
+
+ if (tempConstantNode) {
+ ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
+
+ typedNode = intermediate.addConstantUnion(constArray+instanceSize, tempConstantNode->getType(), line); // type will be changed in the calling function
+ } else {
+ error(line, "Cannot offset into the structure", "Error", "");
+ recover();
+
+ return 0;
+ }
+
+ return typedNode;
+}
+
+//
+// Parse an array of strings using yyparse.
+//
+// Returns 0 for success.
+//
+int PaParseStrings(int count, const char* const string[], const int length[],
+ TParseContext* context) {
+ if ((count == 0) || (string == NULL))
+ return 1;
+
+ // setup preprocessor.
+ if (InitPreprocessor())
+ return 1;
+ DefineExtensionMacros(context->extensionBehavior);
+
+ if (glslang_initialize(context))
+ return 1;
+
+ glslang_scan(count, string, length, context);
+ int error = glslang_parse(context);
+
+ glslang_finalize(context);
+ FinalizePreprocessor();
+ return (error == 0) && (context->numErrors == 0) ? 0 : 1;
+}
+
+OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
+
+bool InitializeParseContextIndex()
+{
+ if (GlobalParseContextIndex != OS_INVALID_TLS_INDEX) {
+ assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
+ return false;
+ }
+
+ //
+ // Allocate a TLS index.
+ //
+ GlobalParseContextIndex = OS_AllocTLSIndex();
+
+ if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
+ return false;
+ }
+
+ return true;
+}
+
+bool FreeParseContextIndex()
+{
+ OS_TLSIndex tlsiIndex = GlobalParseContextIndex;
+
+ if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "FreeParseContextIndex(): Parse Context index not initalised");
+ return false;
+ }
+
+ GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
+
+ return OS_FreeTLSIndex(tlsiIndex);
+}
+
+bool InitializeGlobalParseContext()
+{
+ if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "InitializeGlobalParseContext(): Parse Context index not initalised");
+ return false;
+ }
+
+ TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
+ if (lpParseContext != 0) {
+ assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
+ return false;
+ }
+
+ TThreadParseContext *lpThreadData = new TThreadParseContext();
+ if (lpThreadData == 0) {
+ assert(0 && "InitializeGlobalParseContext(): Unable to create thread parse context");
+ return false;
+ }
+
+ lpThreadData->lpGlobalParseContext = 0;
+ OS_SetTLSValue(GlobalParseContextIndex, lpThreadData);
+
+ return true;
+}
+
+bool FreeParseContext()
+{
+ if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "FreeParseContext(): Parse Context index not initalised");
+ return false;
+ }
+
+ TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
+ if (lpParseContext)
+ delete lpParseContext;
+
+ return true;
+}
+
+TParseContextPointer& GetGlobalParseContext()
+{
+ //
+ // Minimal error checking for speed
+ //
+
+ TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
+
+ return lpParseContext->lpGlobalParseContext;
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h
new file mode 100644
index 0000000..cb6e0d0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h
@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+#ifndef _PARSER_HELPER_INCLUDED_
+#define _PARSER_HELPER_INCLUDED_
+
+#include "compiler/ExtensionBehavior.h"
+#include "compiler/localintermediate.h"
+#include "compiler/ShHandle.h"
+#include "compiler/SymbolTable.h"
+
+struct TMatrixFields {
+ bool wholeRow;
+ bool wholeCol;
+ int row;
+ int col;
+};
+
+struct TPragma {
+ TPragma(bool o, bool d) : optimize(o), debug(d) { }
+ bool optimize;
+ bool debug;
+ TPragmaTable pragmaTable;
+};
+
+//
+// The following are extra variables needed during parsing, grouped together so
+// they can be passed to the parser without needing a global.
+//
+struct TParseContext {
+ TParseContext(TSymbolTable& symt, const TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, TInfoSink& is) :
+ intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), shaderType(type), shaderSpec(spec), treeRoot(0),
+ recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
+ inTypeParen(false), scanner(NULL), contextPragma(true, false) { }
+ TIntermediate& intermediate; // to hold and build a parse tree
+ TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
+ TExtensionBehavior extensionBehavior; // mapping between supported extensions and current behavior.
+ TInfoSink& infoSink;
+ ShShaderType shaderType; // vertex or fragment language (future: pack or unpack)
+ ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
+ TIntermNode* treeRoot; // root of parse tree being created
+ bool recoveredFromError; // true if a parse error has occurred, but we continue to parse
+ int numErrors;
+ bool lexAfterType; // true if we've recognized a type, so can only be looking for an identifier
+ int loopNestingLevel; // 0 if outside all loops
+ bool inTypeParen; // true if in parentheses, looking only for an identifier
+ const TType* currentFunctionType; // the return type of the function that's currently being parsed
+ bool functionReturnsValue; // true if a non-void function has a return
+
+ void error(TSourceLoc loc, const char *reason, const char* token,
+ const char* extraInfoFormat, ...);
+ void warning(TSourceLoc loc, const char* reason, const char* token,
+ const char* extraInfoFormat, ...);
+ bool reservedErrorCheck(int line, const TString& identifier);
+ void recover();
+
+ bool parseVectorFields(const TString&, int vecSize, TVectorFields&, int line);
+ bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, int line);
+ void assignError(int line, const char* op, TString left, TString right);
+ void unaryOpError(int line, const char* op, TString operand);
+ void binaryOpError(int line, const char* op, TString left, TString right);
+ bool precisionErrorCheck(int line, TPrecision precision, TBasicType type);
+ bool lValueErrorCheck(int line, const char* op, TIntermTyped*);
+ bool constErrorCheck(TIntermTyped* node);
+ bool integerErrorCheck(TIntermTyped* node, const char* token);
+ bool globalErrorCheck(int line, bool global, const char* token);
+ bool constructorErrorCheck(int line, TIntermNode*, TFunction&, TOperator, TType*);
+ bool arraySizeErrorCheck(int line, TIntermTyped* expr, int& size);
+ bool arrayQualifierErrorCheck(int line, TPublicType type);
+ bool arrayTypeErrorCheck(int line, TPublicType type);
+ bool arrayErrorCheck(int line, TString& identifier, TPublicType type, TVariable*& variable);
+ bool voidErrorCheck(int, const TString&, const TPublicType&);
+ bool boolErrorCheck(int, const TIntermTyped*);
+ bool boolErrorCheck(int, const TPublicType&);
+ bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason);
+ bool structQualifierErrorCheck(int line, const TPublicType& pType);
+ bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type);
+ bool containsSampler(TType& type);
+ bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type);
+ bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type);
+ bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
+ bool extensionErrorCheck(int line, const TString&);
+ const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0);
+ bool executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType,
+ TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
+ bool areAllChildConst(TIntermAggregate* aggrNode);
+ TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, TSourceLoc);
+ TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
+ TIntermTyped* constructStruct(TIntermNode*, TType*, int, TSourceLoc, bool subset);
+ TIntermTyped* constructBuiltIn(const TType*, TOperator, TIntermNode*, TSourceLoc, bool subset);
+ TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, TSourceLoc);
+ TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc);
+ TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line);
+ TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc);
+ bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);
+ void* scanner;
+ struct TPragma contextPragma;
+ TString HashErrMsg;
+ bool AfterEOF;
+};
+
+int PaParseStrings(int count, const char* const string[], const int length[],
+ TParseContext* context);
+
+typedef TParseContext* TParseContextPointer;
+extern TParseContextPointer& GetGlobalParseContext();
+#define GlobalParseContext GetGlobalParseContext()
+
+typedef struct TThreadParseContextRec
+{
+ TParseContext *lpGlobalParseContext;
+} TThreadParseContext;
+
+#endif // _PARSER_HELPER_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.cpp
new file mode 100644
index 0000000..e286c7d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.cpp
@@ -0,0 +1,304 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/PoolAlloc.h"
+
+#ifndef _MSC_VER
+#include <stdint.h>
+#endif
+#include <stdio.h>
+
+#include "compiler/InitializeGlobals.h"
+#include "compiler/osinclude.h"
+
+OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
+
+void InitializeGlobalPools()
+{
+ TThreadGlobalPools* globalPools= static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
+ if (globalPools)
+ return;
+
+ TThreadGlobalPools* threadData = new TThreadGlobalPools();
+ threadData->globalPoolAllocator = 0;
+
+ OS_SetTLSValue(PoolIndex, threadData);
+}
+
+void FreeGlobalPools()
+{
+ // Release the allocated memory for this thread.
+ TThreadGlobalPools* globalPools= static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
+ if (!globalPools)
+ return;
+
+ delete globalPools;
+}
+
+bool InitializePoolIndex()
+{
+ // Allocate a TLS index.
+ if ((PoolIndex = OS_AllocTLSIndex()) == OS_INVALID_TLS_INDEX)
+ return false;
+
+ return true;
+}
+
+void FreePoolIndex()
+{
+ // Release the TLS index.
+ OS_FreeTLSIndex(PoolIndex);
+}
+
+TPoolAllocator& GetGlobalPoolAllocator()
+{
+ TThreadGlobalPools* threadData = static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
+
+ return *threadData->globalPoolAllocator;
+}
+
+void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator)
+{
+ TThreadGlobalPools* threadData = static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
+
+ threadData->globalPoolAllocator = poolAllocator;
+}
+
+//
+// Implement the functionality of the TPoolAllocator class, which
+// is documented in PoolAlloc.h.
+//
+TPoolAllocator::TPoolAllocator(int growthIncrement, int allocationAlignment) :
+ pageSize(growthIncrement),
+ alignment(allocationAlignment),
+ freeList(0),
+ inUseList(0),
+ numCalls(0),
+ totalBytes(0)
+{
+ //
+ // Don't allow page sizes we know are smaller than all common
+ // OS page sizes.
+ //
+ if (pageSize < 4*1024)
+ pageSize = 4*1024;
+
+ //
+ // A large currentPageOffset indicates a new page needs to
+ // be obtained to allocate memory.
+ //
+ currentPageOffset = pageSize;
+
+ //
+ // Adjust alignment to be at least pointer aligned and
+ // power of 2.
+ //
+ size_t minAlign = sizeof(void*);
+ alignment &= ~(minAlign - 1);
+ if (alignment < minAlign)
+ alignment = minAlign;
+ size_t a = 1;
+ while (a < alignment)
+ a <<= 1;
+ alignment = a;
+ alignmentMask = a - 1;
+
+ //
+ // Align header skip
+ //
+ headerSkip = minAlign;
+ if (headerSkip < sizeof(tHeader)) {
+ headerSkip = (sizeof(tHeader) + alignmentMask) & ~alignmentMask;
+ }
+}
+
+TPoolAllocator::~TPoolAllocator()
+{
+ while (inUseList) {
+ tHeader* next = inUseList->nextPage;
+ inUseList->~tHeader();
+ delete [] reinterpret_cast<char*>(inUseList);
+ inUseList = next;
+ }
+
+ // We should not check the guard blocks
+ // here, because we did it already when the block was
+ // placed into the free list.
+ //
+ while (freeList) {
+ tHeader* next = freeList->nextPage;
+ delete [] reinterpret_cast<char*>(freeList);
+ freeList = next;
+ }
+}
+
+// Support MSVC++ 6.0
+const unsigned char TAllocation::guardBlockBeginVal = 0xfb;
+const unsigned char TAllocation::guardBlockEndVal = 0xfe;
+const unsigned char TAllocation::userDataFill = 0xcd;
+
+#ifdef GUARD_BLOCKS
+ const size_t TAllocation::guardBlockSize = 16;
+#else
+ const size_t TAllocation::guardBlockSize = 0;
+#endif
+
+//
+// Check a single guard block for damage
+//
+void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const
+{
+#ifdef GUARD_BLOCKS
+ for (size_t x = 0; x < guardBlockSize; x++) {
+ if (blockMem[x] != val) {
+ char assertMsg[80];
+
+ // We don't print the assert message. It's here just to be helpful.
+ sprintf(assertMsg, "PoolAlloc: Damage %s %lu byte allocation at 0x%p\n",
+ locText, size, data());
+ assert(0 && "PoolAlloc: Damage in guard block");
+ }
+ }
+#endif
+}
+
+
+void TPoolAllocator::push()
+{
+ tAllocState state = { currentPageOffset, inUseList };
+
+ stack.push_back(state);
+
+ //
+ // Indicate there is no current page to allocate from.
+ //
+ currentPageOffset = pageSize;
+}
+
+//
+// Do a mass-deallocation of all the individual allocations
+// that have occurred since the last push(), or since the
+// last pop(), or since the object's creation.
+//
+// The deallocated pages are saved for future allocations.
+//
+void TPoolAllocator::pop()
+{
+ if (stack.size() < 1)
+ return;
+
+ tHeader* page = stack.back().page;
+ currentPageOffset = stack.back().offset;
+
+ while (inUseList != page) {
+ // invoke destructor to free allocation list
+ inUseList->~tHeader();
+
+ tHeader* nextInUse = inUseList->nextPage;
+ if (inUseList->pageCount > 1)
+ delete [] reinterpret_cast<char*>(inUseList);
+ else {
+ inUseList->nextPage = freeList;
+ freeList = inUseList;
+ }
+ inUseList = nextInUse;
+ }
+
+ stack.pop_back();
+}
+
+//
+// Do a mass-deallocation of all the individual allocations
+// that have occurred.
+//
+void TPoolAllocator::popAll()
+{
+ while (stack.size() > 0)
+ pop();
+}
+
+void* TPoolAllocator::allocate(size_t numBytes)
+{
+ // If we are using guard blocks, all allocations are bracketed by
+ // them: [guardblock][allocation][guardblock]. numBytes is how
+ // much memory the caller asked for. allocationSize is the total
+ // size including guard blocks. In release build,
+ // guardBlockSize=0 and this all gets optimized away.
+ size_t allocationSize = TAllocation::allocationSize(numBytes);
+
+ //
+ // Just keep some interesting statistics.
+ //
+ ++numCalls;
+ totalBytes += numBytes;
+
+ //
+ // Do the allocation, most likely case first, for efficiency.
+ // This step could be moved to be inline sometime.
+ //
+ if (currentPageOffset + allocationSize <= pageSize) {
+ //
+ // Safe to allocate from currentPageOffset.
+ //
+ unsigned char* memory = reinterpret_cast<unsigned char *>(inUseList) + currentPageOffset;
+ currentPageOffset += allocationSize;
+ currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask;
+
+ return initializeAllocation(inUseList, memory, numBytes);
+ }
+
+ if (allocationSize + headerSkip > pageSize) {
+ //
+ // Do a multi-page allocation. Don't mix these with the others.
+ // The OS is efficient and allocating and free-ing multiple pages.
+ //
+ size_t numBytesToAlloc = allocationSize + headerSkip;
+ tHeader* memory = reinterpret_cast<tHeader*>(::new char[numBytesToAlloc]);
+ if (memory == 0)
+ return 0;
+
+ // Use placement-new to initialize header
+ new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize);
+ inUseList = memory;
+
+ currentPageOffset = pageSize; // make next allocation come from a new page
+
+ // No guard blocks for multi-page allocations (yet)
+ return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(memory) + headerSkip);
+ }
+
+ //
+ // Need a simple page to allocate from.
+ //
+ tHeader* memory;
+ if (freeList) {
+ memory = freeList;
+ freeList = freeList->nextPage;
+ } else {
+ memory = reinterpret_cast<tHeader*>(::new char[pageSize]);
+ if (memory == 0)
+ return 0;
+ }
+
+ // Use placement-new to initialize header
+ new(memory) tHeader(inUseList, 1);
+ inUseList = memory;
+
+ unsigned char* ret = reinterpret_cast<unsigned char *>(inUseList) + headerSkip;
+ currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask;
+
+ return initializeAllocation(inUseList, ret, numBytes);
+}
+
+
+//
+// Check all allocations in a list for damage by calling check on each.
+//
+void TAllocation::checkAllocList() const
+{
+ for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc)
+ alloc->check();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.h
new file mode 100644
index 0000000..051dc00
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.h
@@ -0,0 +1,300 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _POOLALLOC_INCLUDED_
+#define _POOLALLOC_INCLUDED_
+
+#ifdef _DEBUG
+#define GUARD_BLOCKS // define to enable guard block sanity checking
+#endif
+
+//
+// This header defines an allocator that can be used to efficiently
+// allocate a large number of small requests for heap memory, with the
+// intention that they are not individually deallocated, but rather
+// collectively deallocated at one time.
+//
+// This simultaneously
+//
+// * Makes each individual allocation much more efficient; the
+// typical allocation is trivial.
+// * Completely avoids the cost of doing individual deallocation.
+// * Saves the trouble of tracking down and plugging a large class of leaks.
+//
+// Individual classes can use this allocator by supplying their own
+// new and delete methods.
+//
+// STL containers can use this allocator by using the pool_allocator
+// class as the allocator (second) template argument.
+//
+
+#include <stddef.h>
+#include <string.h>
+#include <vector>
+
+// If we are using guard blocks, we must track each indivual
+// allocation. If we aren't using guard blocks, these
+// never get instantiated, so won't have any impact.
+//
+
+class TAllocation {
+public:
+ TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) :
+ size(size), mem(mem), prevAlloc(prev) {
+ // Allocations are bracketed:
+ // [allocationHeader][initialGuardBlock][userData][finalGuardBlock]
+ // This would be cleaner with if (guardBlockSize)..., but that
+ // makes the compiler print warnings about 0 length memsets,
+ // even with the if() protecting them.
+#ifdef GUARD_BLOCKS
+ memset(preGuard(), guardBlockBeginVal, guardBlockSize);
+ memset(data(), userDataFill, size);
+ memset(postGuard(), guardBlockEndVal, guardBlockSize);
+#endif
+ }
+
+ void check() const {
+ checkGuardBlock(preGuard(), guardBlockBeginVal, "before");
+ checkGuardBlock(postGuard(), guardBlockEndVal, "after");
+ }
+
+ void checkAllocList() const;
+
+ // Return total size needed to accomodate user buffer of 'size',
+ // plus our tracking data.
+ inline static size_t allocationSize(size_t size) {
+ return size + 2 * guardBlockSize + headerSize();
+ }
+
+ // Offset from surrounding buffer to get to user data buffer.
+ inline static unsigned char* offsetAllocation(unsigned char* m) {
+ return m + guardBlockSize + headerSize();
+ }
+
+private:
+ void checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const;
+
+ // Find offsets to pre and post guard blocks, and user data buffer
+ unsigned char* preGuard() const { return mem + headerSize(); }
+ unsigned char* data() const { return preGuard() + guardBlockSize; }
+ unsigned char* postGuard() const { return data() + size; }
+
+ size_t size; // size of the user data area
+ unsigned char* mem; // beginning of our allocation (pts to header)
+ TAllocation* prevAlloc; // prior allocation in the chain
+
+ // Support MSVC++ 6.0
+ const static unsigned char guardBlockBeginVal;
+ const static unsigned char guardBlockEndVal;
+ const static unsigned char userDataFill;
+
+ const static size_t guardBlockSize;
+#ifdef GUARD_BLOCKS
+ inline static size_t headerSize() { return sizeof(TAllocation); }
+#else
+ inline static size_t headerSize() { return 0; }
+#endif
+};
+
+//
+// There are several stacks. One is to track the pushing and popping
+// of the user, and not yet implemented. The others are simply a
+// repositories of free pages or used pages.
+//
+// Page stacks are linked together with a simple header at the beginning
+// of each allocation obtained from the underlying OS. Multi-page allocations
+// are returned to the OS. Individual page allocations are kept for future
+// re-use.
+//
+// The "page size" used is not, nor must it match, the underlying OS
+// page size. But, having it be about that size or equal to a set of
+// pages is likely most optimal.
+//
+class TPoolAllocator {
+public:
+ TPoolAllocator(int growthIncrement = 8*1024, int allocationAlignment = 16);
+
+ //
+ // Don't call the destructor just to free up the memory, call pop()
+ //
+ ~TPoolAllocator();
+
+ //
+ // Call push() to establish a new place to pop memory too. Does not
+ // have to be called to get things started.
+ //
+ void push();
+
+ //
+ // Call pop() to free all memory allocated since the last call to push(),
+ // or if no last call to push, frees all memory since first allocation.
+ //
+ void pop();
+
+ //
+ // Call popAll() to free all memory allocated.
+ //
+ void popAll();
+
+ //
+ // Call allocate() to actually acquire memory. Returns 0 if no memory
+ // available, otherwise a properly aligned pointer to 'numBytes' of memory.
+ //
+ void* allocate(size_t numBytes);
+
+ //
+ // There is no deallocate. The point of this class is that
+ // deallocation can be skipped by the user of it, as the model
+ // of use is to simultaneously deallocate everything at once
+ // by calling pop(), and to not have to solve memory leak problems.
+ //
+
+protected:
+ friend struct tHeader;
+
+ struct tHeader {
+ tHeader(tHeader* nextPage, size_t pageCount) :
+ nextPage(nextPage),
+ pageCount(pageCount)
+#ifdef GUARD_BLOCKS
+ , lastAllocation(0)
+#endif
+ { }
+
+ ~tHeader() {
+#ifdef GUARD_BLOCKS
+ if (lastAllocation)
+ lastAllocation->checkAllocList();
+#endif
+ }
+
+ tHeader* nextPage;
+ size_t pageCount;
+#ifdef GUARD_BLOCKS
+ TAllocation* lastAllocation;
+#endif
+ };
+
+ struct tAllocState {
+ size_t offset;
+ tHeader* page;
+ };
+ typedef std::vector<tAllocState> tAllocStack;
+
+ // Track allocations if and only if we're using guard blocks
+ void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) {
+#ifdef GUARD_BLOCKS
+ new(memory) TAllocation(numBytes, memory, block->lastAllocation);
+ block->lastAllocation = reinterpret_cast<TAllocation*>(memory);
+#endif
+ // This is optimized entirely away if GUARD_BLOCKS is not defined.
+ return TAllocation::offsetAllocation(memory);
+ }
+
+ size_t pageSize; // granularity of allocation from the OS
+ size_t alignment; // all returned allocations will be aligned at
+ // this granularity, which will be a power of 2
+ size_t alignmentMask;
+ size_t headerSkip; // amount of memory to skip to make room for the
+ // header (basically, size of header, rounded
+ // up to make it aligned
+ size_t currentPageOffset; // next offset in top of inUseList to allocate from
+ tHeader* freeList; // list of popped memory
+ tHeader* inUseList; // list of all memory currently being used
+ tAllocStack stack; // stack of where to allocate from, to partition pool
+
+ int numCalls; // just an interesting statistic
+ size_t totalBytes; // just an interesting statistic
+private:
+ TPoolAllocator& operator=(const TPoolAllocator&); // dont allow assignment operator
+ TPoolAllocator(const TPoolAllocator&); // dont allow default copy constructor
+};
+
+
+//
+// There could potentially be many pools with pops happening at
+// different times. But a simple use is to have a global pop
+// with everyone using the same global allocator.
+//
+extern TPoolAllocator& GetGlobalPoolAllocator();
+extern void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator);
+#define GlobalPoolAllocator GetGlobalPoolAllocator()
+
+struct TThreadGlobalPools
+{
+ TPoolAllocator* globalPoolAllocator;
+};
+
+//
+// This STL compatible allocator is intended to be used as the allocator
+// parameter to templatized STL containers, like vector and map.
+//
+// It will use the pools for allocation, and not
+// do any deallocation, but will still do destruction.
+//
+template<class T>
+class pool_allocator {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T value_type;
+
+ template<class Other>
+ struct rebind {
+ typedef pool_allocator<Other> other;
+ };
+ pointer address(reference x) const { return &x; }
+ const_pointer address(const_reference x) const { return &x; }
+
+ pool_allocator() : allocator(GlobalPoolAllocator) { }
+ pool_allocator(TPoolAllocator& a) : allocator(a) { }
+ pool_allocator(const pool_allocator<T>& p) : allocator(p.allocator) { }
+
+ template<class Other>
+ pool_allocator(const pool_allocator<Other>& p) : allocator(p.getAllocator()) { }
+
+#if defined(__SUNPRO_CC) && !defined(_RWSTD_ALLOCATOR)
+ // libCStd on some platforms have a different allocate/deallocate interface.
+ // Caller pre-bakes sizeof(T) into 'n' which is the number of bytes to be
+ // allocated, not the number of elements.
+ void* allocate(size_type n) {
+ return getAllocator().allocate(n);
+ }
+ void* allocate(size_type n, const void*) {
+ return getAllocator().allocate(n);
+ }
+ void deallocate(void*, size_type) {}
+#else
+ pointer allocate(size_type n) {
+ return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
+ }
+ pointer allocate(size_type n, const void*) {
+ return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
+ }
+ void deallocate(pointer, size_type) {}
+#endif // _RWSTD_ALLOCATOR
+
+ void construct(pointer p, const T& val) { new ((void *)p) T(val); }
+ void destroy(pointer p) { p->T::~T(); }
+
+ bool operator==(const pool_allocator& rhs) const { return &getAllocator() == &rhs.getAllocator(); }
+ bool operator!=(const pool_allocator& rhs) const { return &getAllocator() != &rhs.getAllocator(); }
+
+ size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); }
+ size_type max_size(int size) const { return static_cast<size_type>(-1) / size; }
+
+ void setAllocator(TPoolAllocator* a) { allocator = *a; }
+ TPoolAllocator& getAllocator() const { return allocator; }
+
+protected:
+ TPoolAllocator& allocator;
+};
+
+#endif // _POOLALLOC_INCLUDED_ \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.cpp
new file mode 100644
index 0000000..92a6874
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.cpp
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/intermediate.h"
+
+class TAliveTraverser : public TIntermTraverser {
+public:
+ TAliveTraverser(TQualifier q) : TIntermTraverser(true, false, false, true), found(false), qualifier(q)
+ {
+ }
+
+ bool wasFound() { return found; }
+
+protected:
+ bool found;
+ TQualifier qualifier;
+
+ void visitSymbol(TIntermSymbol*);
+ bool visitSelection(Visit, TIntermSelection*);
+};
+
+//
+// Report whether or not a variable of the given qualifier type
+// is guaranteed written. Not always possible to determine if
+// it is written conditionally.
+//
+// ?? It does not do this well yet, this is just a place holder
+// that simply determines if it was reference at all, anywhere.
+//
+bool QualifierWritten(TIntermNode* node, TQualifier qualifier)
+{
+ TAliveTraverser it(qualifier);
+
+ if (node)
+ node->traverse(&it);
+
+ return it.wasFound();
+}
+
+void TAliveTraverser::visitSymbol(TIntermSymbol* node)
+{
+ //
+ // If it's what we're looking for, record it.
+ //
+ if (node->getQualifier() == qualifier)
+ found = true;
+}
+
+bool TAliveTraverser::visitSelection(Visit preVisit, TIntermSelection* node)
+{
+ if (wasFound())
+ return false;
+
+ return true;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.h
new file mode 100644
index 0000000..872a06f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.h
@@ -0,0 +1,7 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+bool QualifierWritten(TIntermNode* root, TQualifier);
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.cpp
new file mode 100644
index 0000000..a4b8c1e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.cpp
@@ -0,0 +1,77 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/intermediate.h"
+#include "compiler/RemoveTree.h"
+
+//
+// Code to recursively delete the intermediate tree.
+//
+
+class RemoveTree : public TIntermTraverser
+{
+public:
+ RemoveTree() : TIntermTraverser(false, false, true)
+ {
+ }
+
+protected:
+ void visitSymbol(TIntermSymbol*);
+ void visitConstantUnion(TIntermConstantUnion*);
+ bool visitBinary(Visit visit, TIntermBinary*);
+ bool visitUnary(Visit visit, TIntermUnary*);
+ bool visitSelection(Visit visit, TIntermSelection*);
+ bool visitAggregate(Visit visit, TIntermAggregate*);
+};
+
+void RemoveTree::visitSymbol(TIntermSymbol* node)
+{
+ delete node;
+}
+
+bool RemoveTree::visitBinary(Visit visit, TIntermBinary* node)
+{
+ delete node;
+
+ return true;
+}
+
+bool RemoveTree::visitUnary(Visit visit, TIntermUnary* node)
+{
+ delete node;
+
+ return true;
+}
+
+bool RemoveTree::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+ delete node;
+
+ return true;
+}
+
+bool RemoveTree::visitSelection(Visit visit, TIntermSelection* node)
+{
+ delete node;
+
+ return true;
+}
+
+void RemoveTree::visitConstantUnion(TIntermConstantUnion* node)
+{
+ delete node;
+}
+
+//
+// Entry point.
+//
+void RemoveAllTreeNodes(TIntermNode* root)
+{
+ RemoveTree it;
+
+ root->traverse(&it);
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.h
new file mode 100644
index 0000000..97a8216
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/RemoveTree.h
@@ -0,0 +1,7 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+void RemoveAllTreeNodes(TIntermNode*);
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.cpp
new file mode 100644
index 0000000..9368f1a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.cpp
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SearchSymbol is an AST traverser to detect the use of a given symbol name
+//
+
+#include "compiler/SearchSymbol.h"
+
+#include "compiler/InfoSink.h"
+#include "compiler/OutputHLSL.h"
+
+namespace sh
+{
+SearchSymbol::SearchSymbol(const TString &symbol) : mSymbol(symbol)
+{
+ match = false;
+}
+
+void SearchSymbol::traverse(TIntermNode *node)
+{
+ node->traverse(this);
+}
+
+void SearchSymbol::visitSymbol(TIntermSymbol *symbolNode)
+{
+ if (symbolNode->getSymbol() == mSymbol)
+ {
+ match = true;
+ }
+}
+
+bool SearchSymbol::foundMatch() const
+{
+ return match;
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.h
new file mode 100644
index 0000000..6bc0b90
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SearchSymbol.h
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SearchSymbol is an AST traverser to detect the use of a given symbol name
+//
+
+#ifndef COMPILER_SEARCHSYMBOL_H_
+#define COMPILER_SEARCHSYMBOL_H_
+
+#include "compiler/intermediate.h"
+#include "compiler/ParseHelper.h"
+
+namespace sh
+{
+class SearchSymbol : public TIntermTraverser
+{
+ public:
+ SearchSymbol(const TString &symbol);
+
+ void traverse(TIntermNode *node);
+ void visitSymbol(TIntermSymbol *symbolNode);
+
+ bool foundMatch() const;
+
+ protected:
+ const TString &mSymbol;
+ bool match;
+};
+}
+
+#endif // COMPILER_SEARCHSYMBOL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h
new file mode 100644
index 0000000..e65c1ee
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h
@@ -0,0 +1,104 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _SHHANDLE_INCLUDED_
+#define _SHHANDLE_INCLUDED_
+
+//
+// Machine independent part of the compiler private objects
+// sent as ShHandle to the driver.
+//
+// This should not be included by driver code.
+//
+
+#include "GLSLANG/ShaderLang.h"
+
+#include "compiler/ExtensionBehavior.h"
+#include "compiler/InfoSink.h"
+#include "compiler/SymbolTable.h"
+#include "compiler/VariableInfo.h"
+
+class TCompiler;
+
+//
+// The base class used to back handles returned to the driver.
+//
+class TShHandleBase {
+public:
+ TShHandleBase();
+ virtual ~TShHandleBase();
+ virtual TCompiler* getAsCompiler() { return 0; }
+
+protected:
+ // Memory allocator. Allocates and tracks memory required by the compiler.
+ // Deallocates all memory when compiler is destructed.
+ TPoolAllocator allocator;
+};
+
+//
+// The base class for the machine dependent compiler to derive from
+// for managing object code from the compile.
+//
+class TCompiler : public TShHandleBase {
+public:
+ TCompiler(ShShaderType type, ShShaderSpec spec);
+ virtual ~TCompiler();
+ virtual TCompiler* getAsCompiler() { return this; }
+
+ bool Init(const ShBuiltInResources& resources);
+ bool compile(const char* const shaderStrings[],
+ const int numStrings,
+ int compileOptions);
+
+ // Get results of the last compilation.
+ TInfoSink& getInfoSink() { return infoSink; }
+ const TVariableInfoList& getAttribs() const { return attribs; }
+ const TVariableInfoList& getUniforms() const { return uniforms; }
+
+protected:
+ ShShaderType getShaderType() const { return shaderType; }
+ ShShaderSpec getShaderSpec() const { return shaderSpec; }
+ // Initialize symbol-table with built-in symbols.
+ bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
+ // Clears the results from the previous compilation.
+ void clearResults();
+ // Returns true if the given shader does not exceed the minimum
+ // functionality mandated in GLSL 1.0 spec Appendix A.
+ bool validateLimitations(TIntermNode* root);
+ // Collect info for all attribs and uniforms.
+ void collectAttribsUniforms(TIntermNode* root);
+ // Translate to object code.
+ virtual void translate(TIntermNode* root) = 0;
+
+private:
+ ShShaderType shaderType;
+ ShShaderSpec shaderSpec;
+
+ // Built-in symbol table for the given language, spec, and resources.
+ // It is preserved from compile-to-compile.
+ TSymbolTable symbolTable;
+ // Built-in extensions with default behavior.
+ TExtensionBehavior extensionBehavior;
+
+ // Results of compilation.
+ TInfoSink infoSink; // Output sink.
+ TVariableInfoList attribs; // Active attributes in the compiled shader.
+ TVariableInfoList uniforms; // Active uniforms in the compiled shader.
+};
+
+//
+// This is the interface between the machine independent code
+// and the machine dependent code.
+//
+// The machine dependent code should derive from the classes
+// above. Then Construct*() and Delete*() will create and
+// destroy the machine dependent objects, which contain the
+// above machine independent information.
+//
+TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec);
+void DeleteCompiler(TCompiler*);
+
+#endif // _SHHANDLE_INCLUDED_ \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp
new file mode 100644
index 0000000..6cac61d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp
@@ -0,0 +1,254 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Implement the top-level of interface to the compiler,
+// as defined in ShaderLang.h
+//
+
+#include "GLSLANG/ShaderLang.h"
+
+#include "compiler/InitializeDll.h"
+#include "compiler/ShHandle.h"
+
+//
+// This is the platform independent interface between an OGL driver
+// and the shading language compiler.
+//
+
+static int getVariableMaxLength(const TVariableInfoList& varList)
+{
+ TString::size_type maxLen = 0;
+ for (TVariableInfoList::const_iterator i = varList.begin();
+ i != varList.end(); ++i)
+ {
+ maxLen = std::max(maxLen, i->name.size());
+ }
+ // Add 1 to include null-termination character.
+ return static_cast<int>(maxLen) + 1;
+}
+
+static void getVariableInfo(ShShaderInfo varType,
+ const ShHandle handle,
+ int index,
+ int* length,
+ int* size,
+ ShDataType* type,
+ char* name)
+{
+ if (!handle || !size || !type || !name)
+ return;
+ ASSERT((varType == SH_ACTIVE_ATTRIBUTES) ||
+ (varType == SH_ACTIVE_UNIFORMS));
+
+ TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
+ TCompiler* compiler = base->getAsCompiler();
+ if (compiler == 0)
+ return;
+
+ const TVariableInfoList& varList = varType == SH_ACTIVE_ATTRIBUTES ?
+ compiler->getAttribs() : compiler->getUniforms();
+ if (index < 0 || index >= static_cast<int>(varList.size()))
+ return;
+
+ const TVariableInfo& varInfo = varList[index];
+ if (length) *length = varInfo.name.size();
+ *size = varInfo.size;
+ *type = varInfo.type;
+ strcpy(name, varInfo.name.c_str());
+}
+
+//
+// Driver must call this first, once, before doing any other
+// compiler operations.
+//
+int ShInitialize()
+{
+ if (!InitProcess())
+ return 0;
+
+ return 1;
+}
+
+//
+// Cleanup symbol tables
+//
+int ShFinalize()
+{
+ if (!DetachProcess())
+ return 0;
+
+ return 1;
+}
+
+//
+// Initialize built-in resources with minimum expected values.
+//
+void ShInitBuiltInResources(ShBuiltInResources* resources)
+{
+ // Constants.
+ resources->MaxVertexAttribs = 8;
+ resources->MaxVertexUniformVectors = 128;
+ resources->MaxVaryingVectors = 8;
+ resources->MaxVertexTextureImageUnits = 0;
+ resources->MaxCombinedTextureImageUnits = 8;
+ resources->MaxTextureImageUnits = 8;
+ resources->MaxFragmentUniformVectors = 16;
+ resources->MaxDrawBuffers = 1;
+
+ // Extensions.
+ resources->OES_standard_derivatives = 0;
+}
+
+//
+// Driver calls these to create and destroy compiler objects.
+//
+ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources* resources)
+{
+ if (!InitThread())
+ return 0;
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec));
+ TCompiler* compiler = base->getAsCompiler();
+ if (compiler == 0)
+ return 0;
+
+ // Generate built-in symbol table.
+ if (!compiler->Init(*resources)) {
+ ShDestruct(base);
+ return 0;
+ }
+
+ return reinterpret_cast<void*>(base);
+}
+
+void ShDestruct(ShHandle handle)
+{
+ if (handle == 0)
+ return;
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+
+ if (base->getAsCompiler())
+ DeleteCompiler(base->getAsCompiler());
+}
+
+//
+// Do an actual compile on the given strings. The result is left
+// in the given compile object.
+//
+// Return: The return value of ShCompile is really boolean, indicating
+// success or failure.
+//
+int ShCompile(
+ const ShHandle handle,
+ const char* const shaderStrings[],
+ const int numStrings,
+ int compileOptions)
+{
+ if (!InitThread())
+ return 0;
+
+ if (handle == 0)
+ return 0;
+
+ TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
+ TCompiler* compiler = base->getAsCompiler();
+ if (compiler == 0)
+ return 0;
+
+ bool success = compiler->compile(shaderStrings, numStrings, compileOptions);
+ return success ? 1 : 0;
+}
+
+void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
+{
+ if (!handle || !params)
+ return;
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+ TCompiler* compiler = base->getAsCompiler();
+ if (!compiler) return;
+
+ switch(pname)
+ {
+ case SH_INFO_LOG_LENGTH:
+ *params = compiler->getInfoSink().info.size() + 1;
+ break;
+ case SH_OBJECT_CODE_LENGTH:
+ *params = compiler->getInfoSink().obj.size() + 1;
+ break;
+ case SH_ACTIVE_UNIFORMS:
+ *params = compiler->getUniforms().size();
+ break;
+ case SH_ACTIVE_UNIFORM_MAX_LENGTH:
+ *params = getVariableMaxLength(compiler->getUniforms());
+ break;
+ case SH_ACTIVE_ATTRIBUTES:
+ *params = compiler->getAttribs().size();
+ break;
+ case SH_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ *params = getVariableMaxLength(compiler->getAttribs());
+ break;
+
+ default: UNREACHABLE();
+ }
+}
+
+//
+// Return any compiler log of messages for the application.
+//
+void ShGetInfoLog(const ShHandle handle, char* infoLog)
+{
+ if (!handle || !infoLog)
+ return;
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+ TCompiler* compiler = base->getAsCompiler();
+ if (!compiler) return;
+
+ TInfoSink& infoSink = compiler->getInfoSink();
+ strcpy(infoLog, infoSink.info.c_str());
+}
+
+//
+// Return any object code.
+//
+void ShGetObjectCode(const ShHandle handle, char* objCode)
+{
+ if (!handle || !objCode)
+ return;
+
+ TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+ TCompiler* compiler = base->getAsCompiler();
+ if (!compiler) return;
+
+ TInfoSink& infoSink = compiler->getInfoSink();
+ strcpy(objCode, infoSink.obj.c_str());
+}
+
+void ShGetActiveAttrib(const ShHandle handle,
+ int index,
+ int* length,
+ int* size,
+ ShDataType* type,
+ char* name)
+{
+ getVariableInfo(SH_ACTIVE_ATTRIBUTES,
+ handle, index, length, size, type, name);
+}
+
+void ShGetActiveUniform(const ShHandle handle,
+ int index,
+ int* length,
+ int* size,
+ ShDataType* type,
+ char* name)
+{
+ getVariableInfo(SH_ACTIVE_UNIFORMS,
+ handle, index, length, size, type, name);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp
new file mode 100644
index 0000000..02817d4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp
@@ -0,0 +1,232 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Symbol table for parsing. Most functionaliy and main ideas
+// are documented in the header file.
+//
+
+#include "compiler/SymbolTable.h"
+
+#include <stdio.h>
+
+//
+// TType helper function needs a place to live.
+//
+
+//
+// Recursively generate mangled names.
+//
+void TType::buildMangledName(TString& mangledName)
+{
+ if (isMatrix())
+ mangledName += 'm';
+ else if (isVector())
+ mangledName += 'v';
+
+ switch (type) {
+ case EbtFloat: mangledName += 'f'; break;
+ case EbtInt: mangledName += 'i'; break;
+ case EbtBool: mangledName += 'b'; break;
+ case EbtSampler2D: mangledName += "s2"; break;
+ case EbtSamplerCube: mangledName += "sC"; break;
+ case EbtStruct:
+ mangledName += "struct-";
+ if (typeName)
+ mangledName += *typeName;
+ {// support MSVC++6.0
+ for (unsigned int i = 0; i < structure->size(); ++i) {
+ mangledName += '-';
+ (*structure)[i].type->buildMangledName(mangledName);
+ }
+ }
+ default:
+ break;
+ }
+
+ mangledName += static_cast<char>('0' + getNominalSize());
+ if (isArray()) {
+ char buf[20];
+ sprintf(buf, "%d", arraySize);
+ mangledName += '[';
+ mangledName += buf;
+ mangledName += ']';
+ }
+}
+
+int TType::getStructSize() const
+{
+ if (!getStruct()) {
+ assert(false && "Not a struct");
+ return 0;
+ }
+
+ if (structureSize == 0)
+ for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++)
+ structureSize += ((*tl).type)->getObjectSize();
+
+ return structureSize;
+}
+
+//
+// Dump functions.
+//
+
+void TVariable::dump(TInfoSink& infoSink) const
+{
+ infoSink.debug << getName().c_str() << ": " << type.getQualifierString() << " " << type.getPrecisionString() << " " << type.getBasicString();
+ if (type.isArray()) {
+ infoSink.debug << "[0]";
+ }
+ infoSink.debug << "\n";
+}
+
+void TFunction::dump(TInfoSink &infoSink) const
+{
+ infoSink.debug << getName().c_str() << ": " << returnType.getBasicString() << " " << getMangledName().c_str() << "\n";
+}
+
+void TSymbolTableLevel::dump(TInfoSink &infoSink) const
+{
+ tLevel::const_iterator it;
+ for (it = level.begin(); it != level.end(); ++it)
+ (*it).second->dump(infoSink);
+}
+
+void TSymbolTable::dump(TInfoSink &infoSink) const
+{
+ for (int level = currentLevel(); level >= 0; --level) {
+ infoSink.debug << "LEVEL " << level << "\n";
+ table[level]->dump(infoSink);
+ }
+}
+
+//
+// Functions have buried pointers to delete.
+//
+TFunction::~TFunction()
+{
+ for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)
+ delete (*i).type;
+}
+
+//
+// Symbol table levels are a map of pointers to symbols that have to be deleted.
+//
+TSymbolTableLevel::~TSymbolTableLevel()
+{
+ for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
+ delete (*it).second;
+}
+
+//
+// Change all function entries in the table with the non-mangled name
+// to be related to the provided built-in operation. This is a low
+// performance operation, and only intended for symbol tables that
+// live across a large number of compiles.
+//
+void TSymbolTableLevel::relateToOperator(const char* name, TOperator op)
+{
+ tLevel::iterator it;
+ for (it = level.begin(); it != level.end(); ++it) {
+ if ((*it).second->isFunction()) {
+ TFunction* function = static_cast<TFunction*>((*it).second);
+ if (function->getName() == name)
+ function->relateToOperator(op);
+ }
+ }
+}
+
+//
+// Change all function entries in the table with the non-mangled name
+// to be related to the provided built-in extension. This is a low
+// performance operation, and only intended for symbol tables that
+// live across a large number of compiles.
+//
+void TSymbolTableLevel::relateToExtension(const char* name, const TString& ext)
+{
+ for (tLevel::iterator it = level.begin(); it != level.end(); ++it) {
+ if (it->second->isFunction()) {
+ TFunction* function = static_cast<TFunction*>(it->second);
+ if (function->getName() == name)
+ function->relateToExtension(ext);
+ }
+ }
+}
+
+TSymbol::TSymbol(const TSymbol& copyOf)
+{
+ name = NewPoolTString(copyOf.name->c_str());
+ uniqueId = copyOf.uniqueId;
+}
+
+TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
+{
+ type.copyType(copyOf.type, remapper);
+ userType = copyOf.userType;
+ // for builtIn symbol table level, unionArray and arrayInformation pointers should be NULL
+ assert(copyOf.arrayInformationType == 0);
+ arrayInformationType = 0;
+
+ if (copyOf.unionArray) {
+ assert(!copyOf.type.getStruct());
+ assert(copyOf.type.getObjectSize() == 1);
+ unionArray = new ConstantUnion[1];
+ unionArray[0] = copyOf.unionArray[0];
+ } else
+ unionArray = 0;
+}
+
+TVariable* TVariable::clone(TStructureMap& remapper)
+{
+ TVariable *variable = new TVariable(*this, remapper);
+
+ return variable;
+}
+
+TFunction::TFunction(const TFunction& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
+{
+ for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
+ TParameter param;
+ parameters.push_back(param);
+ parameters.back().copyParam(copyOf.parameters[i], remapper);
+ }
+
+ returnType.copyType(copyOf.returnType, remapper);
+ mangledName = copyOf.mangledName;
+ op = copyOf.op;
+ defined = copyOf.defined;
+}
+
+TFunction* TFunction::clone(TStructureMap& remapper)
+{
+ TFunction *function = new TFunction(*this, remapper);
+
+ return function;
+}
+
+TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper)
+{
+ TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
+ tLevel::iterator iter;
+ for (iter = level.begin(); iter != level.end(); ++iter) {
+ symTableLevel->insert(*iter->second->clone(remapper));
+ }
+
+ return symTableLevel;
+}
+
+void TSymbolTable::copyTable(const TSymbolTable& copyOf)
+{
+ TStructureMap remapper;
+ uniqueId = copyOf.uniqueId;
+ for (unsigned int i = 0; i < copyOf.table.size(); ++i) {
+ table.push_back(copyOf.table[i]->clone(remapper));
+ }
+ for( unsigned int i = 0; i < copyOf.precisionStack.size(); i++) {
+ precisionStack.push_back( copyOf.precisionStack[i] );
+ }
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h
new file mode 100644
index 0000000..38bc657
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h
@@ -0,0 +1,348 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _SYMBOL_TABLE_INCLUDED_
+#define _SYMBOL_TABLE_INCLUDED_
+
+//
+// Symbol table for parsing. Has these design characteristics:
+//
+// * Same symbol table can be used to compile many shaders, to preserve
+// effort of creating and loading with the large numbers of built-in
+// symbols.
+//
+// * Name mangling will be used to give each function a unique name
+// so that symbol table lookups are never ambiguous. This allows
+// a simpler symbol table structure.
+//
+// * Pushing and popping of scope, so symbol table will really be a stack
+// of symbol tables. Searched from the top, with new inserts going into
+// the top.
+//
+// * Constants: Compile time constant symbols will keep their values
+// in the symbol table. The parser can substitute constants at parse
+// time, including doing constant folding and constant propagation.
+//
+// * No temporaries: Temporaries made from operations (+, --, .xy, etc.)
+// are tracked in the intermediate representation, not the symbol table.
+//
+
+#include <assert.h>
+
+#include "compiler/InfoSink.h"
+#include "compiler/intermediate.h"
+
+//
+// Symbol base class. (Can build functions or variables out of these...)
+//
+class TSymbol {
+public:
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+ TSymbol(const TString *n) : name(n) { }
+ virtual ~TSymbol() { /* don't delete name, it's from the pool */ }
+ const TString& getName() const { return *name; }
+ virtual const TString& getMangledName() const { return getName(); }
+ virtual bool isFunction() const { return false; }
+ virtual bool isVariable() const { return false; }
+ void setUniqueId(int id) { uniqueId = id; }
+ int getUniqueId() const { return uniqueId; }
+ virtual void dump(TInfoSink &infoSink) const = 0;
+ TSymbol(const TSymbol&);
+ virtual TSymbol* clone(TStructureMap& remapper) = 0;
+
+protected:
+ const TString *name;
+ unsigned int uniqueId; // For real comparing during code generation
+};
+
+//
+// Variable class, meaning a symbol that's not a function.
+//
+// There could be a separate class heirarchy for Constant variables;
+// Only one of int, bool, or float, (or none) is correct for
+// any particular use, but it's easy to do this way, and doesn't
+// seem worth having separate classes, and "getConst" can't simply return
+// different values for different types polymorphically, so this is
+// just simple and pragmatic.
+//
+class TVariable : public TSymbol {
+public:
+ TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), type(t), userType(uT), unionArray(0), arrayInformationType(0) { }
+ virtual ~TVariable() { }
+ virtual bool isVariable() const { return true; }
+ TType& getType() { return type; }
+ const TType& getType() const { return type; }
+ bool isUserType() const { return userType; }
+ void setQualifier(TQualifier qualifier) { type.setQualifier(qualifier); }
+ void updateArrayInformationType(TType *t) { arrayInformationType = t; }
+ TType* getArrayInformationType() { return arrayInformationType; }
+
+ virtual void dump(TInfoSink &infoSink) const;
+
+ ConstantUnion* getConstPointer()
+ {
+ if (!unionArray)
+ unionArray = new ConstantUnion[type.getObjectSize()];
+
+ return unionArray;
+ }
+
+ ConstantUnion* getConstPointer() const { return unionArray; }
+
+ void shareConstPointer( ConstantUnion *constArray)
+ {
+ if (unionArray == constArray)
+ return;
+
+ delete[] unionArray;
+ unionArray = constArray;
+ }
+ TVariable(const TVariable&, TStructureMap& remapper); // copy constructor
+ virtual TVariable* clone(TStructureMap& remapper);
+
+protected:
+ TType type;
+ bool userType;
+ // we are assuming that Pool Allocator will free the memory allocated to unionArray
+ // when this object is destroyed
+ ConstantUnion *unionArray;
+ TType *arrayInformationType; // this is used for updating maxArraySize in all the references to a given symbol
+};
+
+//
+// The function sub-class of symbols and the parser will need to
+// share this definition of a function parameter.
+//
+struct TParameter {
+ TString *name;
+ TType* type;
+ void copyParam(const TParameter& param, TStructureMap& remapper)
+ {
+ name = NewPoolTString(param.name->c_str());
+ type = param.type->clone(remapper);
+ }
+};
+
+//
+// The function sub-class of a symbol.
+//
+class TFunction : public TSymbol {
+public:
+ TFunction(TOperator o) :
+ TSymbol(0),
+ returnType(TType(EbtVoid, EbpUndefined)),
+ op(o),
+ defined(false) { }
+ TFunction(const TString *name, TType& retType, TOperator tOp = EOpNull) :
+ TSymbol(name),
+ returnType(retType),
+ mangledName(TFunction::mangleName(*name)),
+ op(tOp),
+ defined(false) { }
+ virtual ~TFunction();
+ virtual bool isFunction() const { return true; }
+
+ static TString mangleName(const TString& name) { return name + '('; }
+ static TString unmangleName(const TString& mangledName)
+ {
+ return TString(mangledName.c_str(), mangledName.find_first_of('('));
+ }
+
+ void addParameter(TParameter& p)
+ {
+ parameters.push_back(p);
+ mangledName = mangledName + p.type->getMangledName();
+ }
+
+ const TString& getMangledName() const { return mangledName; }
+ const TType& getReturnType() const { return returnType; }
+
+ void relateToOperator(TOperator o) { op = o; }
+ TOperator getBuiltInOp() const { return op; }
+
+ void relateToExtension(const TString& ext) { extension = ext; }
+ const TString& getExtension() const { return extension; }
+
+ void setDefined() { defined = true; }
+ bool isDefined() { return defined; }
+
+ int getParamCount() const { return static_cast<int>(parameters.size()); }
+ const TParameter& getParam(int i) const { return parameters[i]; }
+
+ virtual void dump(TInfoSink &infoSink) const;
+ TFunction(const TFunction&, TStructureMap& remapper);
+ virtual TFunction* clone(TStructureMap& remapper);
+
+protected:
+ typedef TVector<TParameter> TParamList;
+ TParamList parameters;
+ TType returnType;
+ TString mangledName;
+ TOperator op;
+ TString extension;
+ bool defined;
+};
+
+
+class TSymbolTableLevel {
+public:
+ typedef TMap<TString, TSymbol*> tLevel;
+ typedef tLevel::const_iterator const_iterator;
+ typedef const tLevel::value_type tLevelPair;
+ typedef std::pair<tLevel::iterator, bool> tInsertResult;
+
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+ TSymbolTableLevel() { }
+ ~TSymbolTableLevel();
+
+ bool insert(TSymbol& symbol)
+ {
+ //
+ // returning true means symbol was added to the table
+ //
+ tInsertResult result;
+ result = level.insert(tLevelPair(symbol.getMangledName(), &symbol));
+
+ return result.second;
+ }
+
+ TSymbol* find(const TString& name) const
+ {
+ tLevel::const_iterator it = level.find(name);
+ if (it == level.end())
+ return 0;
+ else
+ return (*it).second;
+ }
+
+ const_iterator begin() const
+ {
+ return level.begin();
+ }
+
+ const_iterator end() const
+ {
+ return level.end();
+ }
+
+ void relateToOperator(const char* name, TOperator op);
+ void relateToExtension(const char* name, const TString& ext);
+ void dump(TInfoSink &infoSink) const;
+ TSymbolTableLevel* clone(TStructureMap& remapper);
+
+protected:
+ tLevel level;
+};
+
+class TSymbolTable {
+public:
+ TSymbolTable() : uniqueId(0)
+ {
+ //
+ // The symbol table cannot be used until push() is called, but
+ // the lack of an initial call to push() can be used to detect
+ // that the symbol table has not been preloaded with built-ins.
+ //
+ }
+
+ ~TSymbolTable()
+ {
+ // level 0 is always built In symbols, so we never pop that out
+ while (table.size() > 1)
+ pop();
+ }
+
+ //
+ // When the symbol table is initialized with the built-ins, there should
+ // 'push' calls, so that built-ins are at level 0 and the shader
+ // globals are at level 1.
+ //
+ bool isEmpty() { return table.size() == 0; }
+ bool atBuiltInLevel() { return table.size() == 1; }
+ bool atGlobalLevel() { return table.size() <= 2; }
+ void push()
+ {
+ table.push_back(new TSymbolTableLevel);
+ precisionStack.push_back( PrecisionStackLevel() );
+ }
+
+ void pop()
+ {
+ delete table[currentLevel()];
+ table.pop_back();
+ precisionStack.pop_back();
+ }
+
+ bool insert(TSymbol& symbol)
+ {
+ symbol.setUniqueId(++uniqueId);
+ return table[currentLevel()]->insert(symbol);
+ }
+
+ TSymbol* find(const TString& name, bool* builtIn = 0, bool *sameScope = 0)
+ {
+ int level = currentLevel();
+ TSymbol* symbol;
+ do {
+ symbol = table[level]->find(name);
+ --level;
+ } while (symbol == 0 && level >= 0);
+ level++;
+ if (builtIn)
+ *builtIn = level == 0;
+ if (sameScope)
+ *sameScope = level == currentLevel();
+ return symbol;
+ }
+
+ TSymbolTableLevel* getGlobalLevel() {
+ assert(table.size() >= 2);
+ return table[1];
+ }
+ void relateToOperator(const char* name, TOperator op) {
+ table[0]->relateToOperator(name, op);
+ }
+ void relateToExtension(const char* name, const TString& ext) {
+ table[0]->relateToExtension(name, ext);
+ }
+ int getMaxSymbolId() { return uniqueId; }
+ void dump(TInfoSink &infoSink) const;
+ void copyTable(const TSymbolTable& copyOf);
+
+ void setDefaultPrecision( TBasicType type, TPrecision prec ){
+ if( type != EbtFloat && type != EbtInt ) return; // Only set default precision for int/float
+ int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
+ precisionStack[indexOfLastElement][type] = prec; // Uses map operator [], overwrites the current value
+ }
+
+ // Searches down the precisionStack for a precision qualifier for the specified TBasicType
+ TPrecision getDefaultPrecision( TBasicType type){
+ if( type != EbtFloat && type != EbtInt ) return EbpUndefined;
+ int level = static_cast<int>(precisionStack.size()) - 1;
+ assert( level >= 0); // Just to be safe. Should not happen.
+ PrecisionStackLevel::iterator it;
+ TPrecision prec = EbpUndefined; // If we dont find anything we return this. Should we error check this?
+ while( level >= 0 ){
+ it = precisionStack[level].find( type );
+ if( it != precisionStack[level].end() ){
+ prec = (*it).second;
+ break;
+ }
+ level--;
+ }
+ return prec;
+ }
+
+protected:
+ int currentLevel() const { return static_cast<int>(table.size()) - 1; }
+
+ std::vector<TSymbolTableLevel*> table;
+ typedef std::map< TBasicType, TPrecision > PrecisionStackLevel;
+ std::vector< PrecisionStackLevel > precisionStack;
+ int uniqueId; // for unique identification in code generation
+};
+
+#endif // _SYMBOL_TABLE_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp
new file mode 100644
index 0000000..7a63ae1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/TranslatorGLSL.h"
+
+#include "compiler/OutputGLSL.h"
+#include "compiler/VersionGLSL.h"
+
+static void writeVersion(ShShaderType type, TIntermNode* root,
+ TInfoSinkBase& sink) {
+ TVersionGLSL versionGLSL(type);
+ root->traverse(&versionGLSL);
+ int version = versionGLSL.getVersion();
+ // We need to write version directive only if it is greater than 110.
+ // If there is no version directive in the shader, 110 is implied.
+ if (version > 110) {
+ sink << "#version " << version << "\n";
+ }
+}
+
+TranslatorGLSL::TranslatorGLSL(ShShaderType type, ShShaderSpec spec)
+ : TCompiler(type, spec) {
+}
+
+void TranslatorGLSL::translate(TIntermNode* root) {
+ TInfoSinkBase& sink = getInfoSink().obj;
+
+ // Write GLSL version.
+ writeVersion(getShaderType(), root, sink);
+
+ // Write translated shader.
+ TOutputGLSL outputGLSL(sink);
+ root->traverse(&outputGLSL);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.h
new file mode 100644
index 0000000..c2ce06d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.h
@@ -0,0 +1,20 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATORGLSL_H_
+#define COMPILER_TRANSLATORGLSL_H_
+
+#include "compiler/ShHandle.h"
+
+class TranslatorGLSL : public TCompiler {
+public:
+ TranslatorGLSL(ShShaderType type, ShShaderSpec spec);
+
+protected:
+ virtual void translate(TIntermNode* root);
+};
+
+#endif // COMPILER_TRANSLATORGLSL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.cpp
new file mode 100644
index 0000000..96d7f10
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.cpp
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/TranslatorHLSL.h"
+
+#include "compiler/OutputHLSL.h"
+
+TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec)
+ : TCompiler(type, spec)
+{
+}
+
+void TranslatorHLSL::translate(TIntermNode *root)
+{
+ TParseContext& parseContext = *GetGlobalParseContext();
+ sh::OutputHLSL outputHLSL(parseContext);
+
+ outputHLSL.output();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.h
new file mode 100644
index 0000000..c3f672b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/TranslatorHLSL.h
@@ -0,0 +1,20 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATORHLSL_H_
+#define COMPILER_TRANSLATORHLSL_H_
+
+#include "compiler/ShHandle.h"
+
+class TranslatorHLSL : public TCompiler {
+public:
+ TranslatorHLSL(ShShaderType type, ShShaderSpec spec);
+
+protected:
+ virtual void translate(TIntermNode* root);
+};
+
+#endif // COMPILER_TRANSLATORHLSL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Types.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Types.h
new file mode 100644
index 0000000..d0fcc08
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/Types.h
@@ -0,0 +1,293 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _TYPES_INCLUDED
+#define _TYPES_INCLUDED
+
+#include "compiler/BaseTypes.h"
+#include "compiler/Common.h"
+#include "compiler/debug.h"
+
+//
+// Need to have association of line numbers to types in a list for building structs.
+//
+class TType;
+struct TTypeLine {
+ TType* type;
+ int line;
+};
+typedef TVector<TTypeLine> TTypeList;
+
+inline TTypeList* NewPoolTTypeList()
+{
+ void* memory = GlobalPoolAllocator.allocate(sizeof(TTypeList));
+ return new(memory) TTypeList;
+}
+
+//
+// This is a workaround for a problem with the yacc stack, It can't have
+// types that it thinks have non-trivial constructors. It should
+// just be used while recognizing the grammar, not anything else. Pointers
+// could be used, but also trying to avoid lots of memory management overhead.
+//
+// Not as bad as it looks, there is no actual assumption that the fields
+// match up or are name the same or anything like that.
+//
+class TPublicType {
+public:
+ TBasicType type;
+ TQualifier qualifier;
+ TPrecision precision;
+ int size; // size of vector or matrix, not size of array
+ bool matrix;
+ bool array;
+ int arraySize;
+ TType* userDef;
+ int line;
+
+ void setBasic(TBasicType bt, TQualifier q, int ln = 0)
+ {
+ type = bt;
+ qualifier = q;
+ precision = EbpUndefined;
+ size = 1;
+ matrix = false;
+ array = false;
+ arraySize = 0;
+ userDef = 0;
+ line = ln;
+ }
+
+ void setAggregate(int s, bool m = false)
+ {
+ size = s;
+ matrix = m;
+ }
+
+ void setArray(bool a, int s = 0)
+ {
+ array = a;
+ arraySize = s;
+ }
+};
+
+typedef TMap<TTypeList*, TTypeList*> TStructureMap;
+typedef TMap<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
+//
+// Base class for things that have a type.
+//
+class TType {
+public:
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+ TType() {}
+ TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) :
+ type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0),
+ maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), fieldName(0), mangled(0), typeName(0)
+ {
+ }
+ explicit TType(const TPublicType &p) :
+ type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize),
+ maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), fieldName(0), mangled(0), typeName(0)
+ {
+ if (p.userDef) {
+ structure = p.userDef->getStruct();
+ typeName = NewPoolTString(p.userDef->getTypeName().c_str());
+ }
+ }
+ TType(TTypeList* userDef, const TString& n, TPrecision p = EbpUndefined) :
+ type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0),
+ maxArraySize(0), arrayInformationType(0), structure(userDef), structureSize(0), fieldName(0), mangled(0)
+ {
+ typeName = NewPoolTString(n.c_str());
+ }
+
+ void copyType(const TType& copyOf, TStructureMap& remapper)
+ {
+ type = copyOf.type;
+ precision = copyOf.precision;
+ qualifier = copyOf.qualifier;
+ size = copyOf.size;
+ matrix = copyOf.matrix;
+ array = copyOf.array;
+ arraySize = copyOf.arraySize;
+
+ TStructureMapIterator iter;
+ if (copyOf.structure) {
+ if ((iter = remapper.find(structure)) == remapper.end()) {
+ // create the new structure here
+ structure = NewPoolTTypeList();
+ for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {
+ TTypeLine typeLine;
+ typeLine.line = (*copyOf.structure)[i].line;
+ typeLine.type = (*copyOf.structure)[i].type->clone(remapper);
+ structure->push_back(typeLine);
+ }
+ } else {
+ structure = iter->second;
+ }
+ } else
+ structure = 0;
+
+ fieldName = 0;
+ if (copyOf.fieldName)
+ fieldName = NewPoolTString(copyOf.fieldName->c_str());
+ typeName = 0;
+ if (copyOf.typeName)
+ typeName = NewPoolTString(copyOf.typeName->c_str());
+
+ mangled = 0;
+ if (copyOf.mangled)
+ mangled = NewPoolTString(copyOf.mangled->c_str());
+
+ structureSize = copyOf.structureSize;
+ maxArraySize = copyOf.maxArraySize;
+ assert(copyOf.arrayInformationType == 0);
+ arrayInformationType = 0; // arrayInformationType should not be set for builtIn symbol table level
+ }
+
+ TType* clone(TStructureMap& remapper)
+ {
+ TType *newType = new TType();
+ newType->copyType(*this, remapper);
+
+ return newType;
+ }
+
+ TBasicType getBasicType() const { return type; }
+ void setBasicType(TBasicType t) { type = t; }
+
+ TPrecision getPrecision() const { return precision; }
+ void setPrecision(TPrecision p) { precision = p; }
+
+ TQualifier getQualifier() const { return qualifier; }
+ void setQualifier(TQualifier q) { qualifier = q; }
+
+ // One-dimensional size of single instance type
+ int getNominalSize() const { return size; }
+ void setNominalSize(int s) { size = s; }
+ // Full size of single instance of type
+ int getObjectSize() const
+ {
+ int totalSize;
+
+ if (getBasicType() == EbtStruct)
+ totalSize = getStructSize();
+ else if (matrix)
+ totalSize = size * size;
+ else
+ totalSize = size;
+
+ if (isArray())
+ totalSize *= std::max(getArraySize(), getMaxArraySize());
+
+ return totalSize;
+ }
+
+ bool isMatrix() const { return matrix ? true : false; }
+ void setMatrix(bool m) { matrix = m; }
+
+ bool isArray() const { return array ? true : false; }
+ int getArraySize() const { return arraySize; }
+ void setArraySize(int s) { array = true; arraySize = s; }
+ int getMaxArraySize () const { return maxArraySize; }
+ void setMaxArraySize (int s) { maxArraySize = s; }
+ void clearArrayness() { array = false; arraySize = 0; maxArraySize = 0; }
+ void setArrayInformationType(TType* t) { arrayInformationType = t; }
+ TType* getArrayInformationType() const { return arrayInformationType; }
+
+ bool isVector() const { return size > 1 && !matrix; }
+ bool isScalar() const { return size == 1 && !matrix && !structure; }
+
+ TTypeList* getStruct() const { return structure; }
+ void setStruct(TTypeList* s) { structure = s; }
+
+ const TString& getTypeName() const
+ {
+ assert(typeName);
+ return *typeName;
+ }
+ void setTypeName(const TString& n)
+ {
+ typeName = NewPoolTString(n.c_str());
+ }
+
+ bool isField() const { return fieldName != 0; }
+ const TString& getFieldName() const
+ {
+ assert(fieldName);
+ return *fieldName;
+ }
+ void setFieldName(const TString& n)
+ {
+ fieldName = NewPoolTString(n.c_str());
+ }
+
+ TString& getMangledName() {
+ if (!mangled) {
+ mangled = NewPoolTString("");
+ buildMangledName(*mangled);
+ *mangled += ';' ;
+ }
+
+ return *mangled;
+ }
+
+ bool sameElementType(const TType& right) const {
+ return type == right.type &&
+ size == right.size &&
+ matrix == right.matrix &&
+ structure == right.structure;
+ }
+ bool operator==(const TType& right) const {
+ return type == right.type &&
+ size == right.size &&
+ matrix == right.matrix &&
+ array == right.array && (!array || arraySize == right.arraySize) &&
+ structure == right.structure;
+ // don't check the qualifier, it's not ever what's being sought after
+ }
+ bool operator!=(const TType& right) const {
+ return !operator==(right);
+ }
+ bool operator<(const TType& right) const {
+ if (type != right.type) return type < right.type;
+ if (size != right.size) return size < right.size;
+ if (matrix != right.matrix) return matrix < right.matrix;
+ if (array != right.array) return array < right.array;
+ if (arraySize != right.arraySize) return arraySize < right.arraySize;
+ if (structure != right.structure) return structure < right.structure;
+
+ return false;
+ }
+
+ const char* getBasicString() const { return ::getBasicString(type); }
+ const char* getPrecisionString() const { return ::getPrecisionString(precision); }
+ const char* getQualifierString() const { return ::getQualifierString(qualifier); }
+ TString getCompleteString() const;
+
+protected:
+ void buildMangledName(TString&);
+ int getStructSize() const;
+
+ TBasicType type : 6;
+ TPrecision precision;
+ TQualifier qualifier : 7;
+ int size : 8; // size of vector or matrix, not size of array
+ unsigned int matrix : 1;
+ unsigned int array : 1;
+ int arraySize;
+ int maxArraySize;
+ TType* arrayInformationType;
+
+ TTypeList* structure; // 0 unless this is a struct
+ mutable int structureSize;
+
+ TString *fieldName; // for structure field names
+ TString *mangled;
+ TString *typeName; // for structure field type name
+};
+
+#endif // _TYPES_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.cpp
new file mode 100644
index 0000000..a36c393
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.cpp
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// UnfoldSelect is an AST traverser to output the select operator ?: as if-else statements
+//
+
+#include "compiler/UnfoldSelect.h"
+
+#include "compiler/InfoSink.h"
+#include "compiler/OutputHLSL.h"
+
+namespace sh
+{
+UnfoldSelect::UnfoldSelect(TParseContext &context, OutputHLSL *outputHLSL) : mContext(context), mOutputHLSL(outputHLSL)
+{
+ mTemporaryIndex = 0;
+}
+
+void UnfoldSelect::traverse(TIntermNode *node)
+{
+ mTemporaryIndex++;
+ node->traverse(this);
+}
+
+bool UnfoldSelect::visitSelection(Visit visit, TIntermSelection *node)
+{
+ TInfoSinkBase &out = mOutputHLSL->getBodyStream();
+
+ if (node->usesTernaryOperator())
+ {
+ int i = mTemporaryIndex++;
+
+ out << mOutputHLSL->typeString(node->getType()) << " t" << i << ";\n";
+
+ node->getCondition()->traverse(this);
+ out << "if(";
+ node->getCondition()->traverse(mOutputHLSL);
+ out << ")\n"
+ "{\n";
+ node->getTrueBlock()->traverse(this);
+ out << " t" << i << " = ";
+ node->getTrueBlock()->traverse(mOutputHLSL);
+ out << ";\n"
+ "}\n"
+ "else\n"
+ "{\n";
+ node->getFalseBlock()->traverse(this);
+ out << " t" << i << " = ";
+ node->getFalseBlock()->traverse(mOutputHLSL);
+ out << ";\n"
+ "}\n";
+
+ mTemporaryIndex--;
+ }
+
+ return false;
+}
+
+int UnfoldSelect::getTemporaryIndex()
+{
+ return mTemporaryIndex;
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.h
new file mode 100644
index 0000000..de296e4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/UnfoldSelect.h
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// UnfoldSelect is an AST traverser to output the select operator ?: as if-else statements
+//
+
+#ifndef COMPILER_UNFOLDSELECT_H_
+#define COMPILER_UNFOLDSELECT_H_
+
+#include "compiler/intermediate.h"
+#include "compiler/ParseHelper.h"
+
+namespace sh
+{
+class OutputHLSL;
+
+class UnfoldSelect : public TIntermTraverser
+{
+ public:
+ UnfoldSelect(TParseContext &context, OutputHLSL *outputHLSL);
+
+ void traverse(TIntermNode *node);
+ bool visitSelection(Visit visit, TIntermSelection *node);
+
+ int getTemporaryIndex();
+
+ protected:
+ TParseContext &mContext;
+ OutputHLSL *const mOutputHLSL;
+
+ int mTemporaryIndex;
+};
+}
+
+#endif // COMPILER_UNFOLDSELECT_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.cpp
new file mode 100644
index 0000000..886f693
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.cpp
@@ -0,0 +1,468 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/ValidateLimitations.h"
+#include "compiler/InfoSink.h"
+#include "compiler/ParseHelper.h"
+
+namespace {
+bool IsLoopIndex(const TIntermSymbol* symbol, const TLoopStack& stack) {
+ for (TLoopStack::const_iterator i = stack.begin(); i != stack.end(); ++i) {
+ if (i->index.id == symbol->getId())
+ return true;
+ }
+ return false;
+}
+
+// Traverses a node to check if it represents a constant index expression.
+// Definition:
+// constant-index-expressions are a superset of constant-expressions.
+// Constant-index-expressions can include loop indices as defined in
+// GLSL ES 1.0 spec, Appendix A, section 4.
+// The following are constant-index-expressions:
+// - Constant expressions
+// - Loop indices as defined in section 4
+// - Expressions composed of both of the above
+class ValidateConstIndexExpr : public TIntermTraverser {
+public:
+ ValidateConstIndexExpr(const TLoopStack& stack)
+ : mValid(true), mLoopStack(stack) {}
+
+ // Returns true if the parsed node represents a constant index expression.
+ bool isValid() const { return mValid; }
+
+ virtual void visitSymbol(TIntermSymbol* symbol) {
+ // Only constants and loop indices are allowed in a
+ // constant index expression.
+ if (mValid) {
+ mValid = (symbol->getQualifier() == EvqConst) ||
+ IsLoopIndex(symbol, mLoopStack);
+ }
+ }
+ virtual void visitConstantUnion(TIntermConstantUnion*) {}
+ virtual bool visitBinary(Visit, TIntermBinary*) { return true; }
+ virtual bool visitUnary(Visit, TIntermUnary*) { return true; }
+ virtual bool visitSelection(Visit, TIntermSelection*) { return true; }
+ virtual bool visitAggregate(Visit, TIntermAggregate*) { return true; }
+ virtual bool visitLoop(Visit, TIntermLoop*) { return true; }
+ virtual bool visitBranch(Visit, TIntermBranch*) { return true; }
+
+private:
+ bool mValid;
+ const TLoopStack& mLoopStack;
+};
+} // namespace
+
+ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
+ TInfoSinkBase& sink)
+ : mShaderType(shaderType),
+ mSink(sink),
+ mNumErrors(0)
+{
+}
+
+void ValidateLimitations::visitSymbol(TIntermSymbol*)
+{
+}
+
+void ValidateLimitations::visitConstantUnion(TIntermConstantUnion*)
+{
+}
+
+bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node)
+{
+ // Check if loop index is modified in the loop body.
+ validateOperation(node, node->getLeft());
+
+ // Check indexing.
+ switch (node->getOp()) {
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ validateIndexing(node);
+ break;
+ default: break;
+ }
+ return true;
+}
+
+bool ValidateLimitations::visitUnary(Visit, TIntermUnary* node)
+{
+ // Check if loop index is modified in the loop body.
+ validateOperation(node, node->getOperand());
+
+ return true;
+}
+
+bool ValidateLimitations::visitSelection(Visit, TIntermSelection*)
+{
+ return true;
+}
+
+bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate* node)
+{
+ switch (node->getOp()) {
+ case EOpFunctionCall:
+ validateFunctionCall(node);
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+bool ValidateLimitations::visitLoop(Visit, TIntermLoop* node)
+{
+ if (!validateLoopType(node))
+ return false;
+
+ TLoopInfo info;
+ memset(&info, 0, sizeof(TLoopInfo));
+ if (!validateForLoopHeader(node, &info))
+ return false;
+
+ TIntermNode* body = node->getBody();
+ if (body != NULL) {
+ mLoopStack.push_back(info);
+ body->traverse(this);
+ mLoopStack.pop_back();
+ }
+
+ // The loop is fully processed - no need to visit children.
+ return false;
+}
+
+bool ValidateLimitations::visitBranch(Visit, TIntermBranch*)
+{
+ return true;
+}
+
+void ValidateLimitations::error(TSourceLoc loc,
+ const char *reason, const char* token)
+{
+ mSink.prefix(EPrefixError);
+ mSink.location(loc);
+ mSink << "'" << token << "' : " << reason << "\n";
+ ++mNumErrors;
+}
+
+bool ValidateLimitations::withinLoopBody() const
+{
+ return !mLoopStack.empty();
+}
+
+bool ValidateLimitations::isLoopIndex(const TIntermSymbol* symbol) const
+{
+ return IsLoopIndex(symbol, mLoopStack);
+}
+
+bool ValidateLimitations::validateLoopType(TIntermLoop* node) {
+ TLoopType type = node->getType();
+ if (type == ELoopFor)
+ return true;
+
+ // Reject while and do-while loops.
+ error(node->getLine(),
+ "This type of loop is not allowed",
+ type == ELoopWhile ? "while" : "do");
+ return false;
+}
+
+bool ValidateLimitations::validateForLoopHeader(TIntermLoop* node,
+ TLoopInfo* info)
+{
+ ASSERT(node->getType() == ELoopFor);
+
+ //
+ // The for statement has the form:
+ // for ( init-declaration ; condition ; expression ) statement
+ //
+ if (!validateForLoopInit(node, info))
+ return false;
+ if (!validateForLoopCond(node, info))
+ return false;
+ if (!validateForLoopExpr(node, info))
+ return false;
+
+ return true;
+}
+
+bool ValidateLimitations::validateForLoopInit(TIntermLoop* node,
+ TLoopInfo* info)
+{
+ TIntermNode* init = node->getInit();
+ if (init == NULL) {
+ error(node->getLine(), "Missing init declaration", "for");
+ return false;
+ }
+
+ //
+ // init-declaration has the form:
+ // type-specifier identifier = constant-expression
+ //
+ TIntermAggregate* decl = init->getAsAggregate();
+ if ((decl == NULL) || (decl->getOp() != EOpDeclaration)) {
+ error(init->getLine(), "Invalid init declaration", "for");
+ return false;
+ }
+ // To keep things simple do not allow declaration list.
+ TIntermSequence& declSeq = decl->getSequence();
+ if (declSeq.size() != 1) {
+ error(decl->getLine(), "Invalid init declaration", "for");
+ return false;
+ }
+ TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
+ if ((declInit == NULL) || (declInit->getOp() != EOpInitialize)) {
+ error(decl->getLine(), "Invalid init declaration", "for");
+ return false;
+ }
+ TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
+ if (symbol == NULL) {
+ error(declInit->getLine(), "Invalid init declaration", "for");
+ return false;
+ }
+ // The loop index has type int or float.
+ TBasicType type = symbol->getBasicType();
+ if ((type != EbtInt) && (type != EbtFloat)) {
+ error(symbol->getLine(),
+ "Invalid type for loop index", getBasicString(type));
+ return false;
+ }
+ // The loop index is initialized with constant expression.
+ if (!isConstExpr(declInit->getRight())) {
+ error(declInit->getLine(),
+ "Loop index cannot be initialized with non-constant expression",
+ symbol->getSymbol().c_str());
+ return false;
+ }
+
+ info->index.id = symbol->getId();
+ return true;
+}
+
+bool ValidateLimitations::validateForLoopCond(TIntermLoop* node,
+ TLoopInfo* info)
+{
+ TIntermNode* cond = node->getCondition();
+ if (cond == NULL) {
+ error(node->getLine(), "Missing condition", "for");
+ return false;
+ }
+ //
+ // condition has the form:
+ // loop_index relational_operator constant_expression
+ //
+ TIntermBinary* binOp = cond->getAsBinaryNode();
+ if (binOp == NULL) {
+ error(node->getLine(), "Invalid condition", "for");
+ return false;
+ }
+ // Loop index should be to the left of relational operator.
+ TIntermSymbol* symbol = binOp->getLeft()->getAsSymbolNode();
+ if (symbol == NULL) {
+ error(binOp->getLine(), "Invalid condition", "for");
+ return false;
+ }
+ if (symbol->getId() != info->index.id) {
+ error(symbol->getLine(),
+ "Expected loop index", symbol->getSymbol().c_str());
+ return false;
+ }
+ // Relational operator is one of: > >= < <= == or !=.
+ switch (binOp->getOp()) {
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ break;
+ default:
+ error(binOp->getLine(),
+ "Invalid relational operator",
+ getOperatorString(binOp->getOp()));
+ break;
+ }
+ // Loop index must be compared with a constant.
+ if (!isConstExpr(binOp->getRight())) {
+ error(binOp->getLine(),
+ "Loop index cannot be compared with non-constant expression",
+ symbol->getSymbol().c_str());
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLimitations::validateForLoopExpr(TIntermLoop* node,
+ TLoopInfo* info)
+{
+ TIntermNode* expr = node->getExpression();
+ if (expr == NULL) {
+ error(node->getLine(), "Missing expression", "for");
+ return false;
+ }
+
+ // for expression has one of the following forms:
+ // loop_index++
+ // loop_index--
+ // loop_index += constant_expression
+ // loop_index -= constant_expression
+ // ++loop_index
+ // --loop_index
+ // The last two forms are not specified in the spec, but I am assuming
+ // its an oversight.
+ TIntermUnary* unOp = expr->getAsUnaryNode();
+ TIntermBinary* binOp = unOp ? NULL : expr->getAsBinaryNode();
+
+ TOperator op = EOpNull;
+ TIntermSymbol* symbol = NULL;
+ if (unOp != NULL) {
+ op = unOp->getOp();
+ symbol = unOp->getOperand()->getAsSymbolNode();
+ } else if (binOp != NULL) {
+ op = binOp->getOp();
+ symbol = binOp->getLeft()->getAsSymbolNode();
+ }
+
+ // The operand must be loop index.
+ if (symbol == NULL) {
+ error(expr->getLine(), "Invalid expression", "for");
+ return false;
+ }
+ if (symbol->getId() != info->index.id) {
+ error(symbol->getLine(),
+ "Expected loop index", symbol->getSymbol().c_str());
+ return false;
+ }
+
+ // The operator is one of: ++ -- += -=.
+ switch (op) {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ ASSERT((unOp != NULL) && (binOp == NULL));
+ break;
+ case EOpAddAssign:
+ case EOpSubAssign:
+ ASSERT((unOp == NULL) && (binOp != NULL));
+ break;
+ default:
+ error(expr->getLine(), "Invalid operator", getOperatorString(op));
+ return false;
+ }
+
+ // Loop index must be incremented/decremented with a constant.
+ if (binOp != NULL) {
+ if (!isConstExpr(binOp->getRight())) {
+ error(binOp->getLine(),
+ "Loop index cannot be modified by non-constant expression",
+ symbol->getSymbol().c_str());
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
+{
+ ASSERT(node->getOp() == EOpFunctionCall);
+
+ // If not within loop body, there is nothing to check.
+ if (!withinLoopBody())
+ return true;
+
+ // List of param indices for which loop indices are used as argument.
+ typedef std::vector<int> ParamIndex;
+ ParamIndex pIndex;
+ TIntermSequence& params = node->getSequence();
+ for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
+ TIntermSymbol* symbol = params[i]->getAsSymbolNode();
+ if (symbol && isLoopIndex(symbol))
+ pIndex.push_back(i);
+ }
+ // If none of the loop indices are used as arguments,
+ // there is nothing to check.
+ if (pIndex.empty())
+ return true;
+
+ bool valid = true;
+ TSymbolTable& symbolTable = GlobalParseContext->symbolTable;
+ TSymbol* symbol = symbolTable.find(node->getName());
+ ASSERT(symbol && symbol->isFunction());
+ TFunction* function = static_cast<TFunction*>(symbol);
+ for (ParamIndex::const_iterator i = pIndex.begin();
+ i != pIndex.end(); ++i) {
+ const TParameter& param = function->getParam(*i);
+ TQualifier qual = param.type->getQualifier();
+ if ((qual == EvqOut) || (qual == EvqInOut)) {
+ error(params[*i]->getLine(),
+ "Loop index cannot be used as argument to a function out or inout parameter",
+ params[*i]->getAsSymbolNode()->getSymbol().c_str());
+ valid = false;
+ }
+ }
+
+ return valid;
+}
+
+bool ValidateLimitations::validateOperation(TIntermOperator* node,
+ TIntermNode* operand) {
+ // Check if loop index is modified in the loop body.
+ if (!withinLoopBody() || !node->modifiesState())
+ return true;
+
+ const TIntermSymbol* symbol = operand->getAsSymbolNode();
+ if (symbol && isLoopIndex(symbol)) {
+ error(node->getLine(),
+ "Loop index cannot be statically assigned to within the body of the loop",
+ symbol->getSymbol().c_str());
+ }
+ return true;
+}
+
+bool ValidateLimitations::isConstExpr(TIntermNode* node)
+{
+ ASSERT(node != NULL);
+ return node->getAsConstantUnion() != NULL;
+}
+
+bool ValidateLimitations::isConstIndexExpr(TIntermNode* node)
+{
+ ASSERT(node != NULL);
+
+ ValidateConstIndexExpr validate(mLoopStack);
+ node->traverse(&validate);
+ return validate.isValid();
+}
+
+bool ValidateLimitations::validateIndexing(TIntermBinary* node)
+{
+ ASSERT((node->getOp() == EOpIndexDirect) ||
+ (node->getOp() == EOpIndexIndirect));
+
+ bool valid = true;
+ TIntermTyped* index = node->getRight();
+ // The index expression must have integral type.
+ if (!index->isScalar() || (index->getBasicType() != EbtInt)) {
+ error(index->getLine(),
+ "Index expression must have integral type",
+ index->getCompleteString().c_str());
+ valid = false;
+ }
+ // The index expession must be a constant-index-expression unless
+ // the operand is a uniform in a vertex shader.
+ TIntermTyped* operand = node->getLeft();
+ bool skip = (mShaderType == SH_VERTEX_SHADER) &&
+ (operand->getQualifier() == EvqUniform);
+ if (!skip && !isConstIndexExpr(index)) {
+ error(index->getLine(), "Index expression must be constant", "[]");
+ valid = false;
+ }
+ return valid;
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.h
new file mode 100644
index 0000000..a4f5a28
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.h
@@ -0,0 +1,62 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "GLSLANG/ShaderLang.h"
+#include "compiler/intermediate.h"
+
+class TInfoSinkBase;
+
+struct TLoopInfo {
+ struct TIndex {
+ int id; // symbol id.
+ } index;
+};
+typedef TVector<TLoopInfo> TLoopStack;
+
+// Traverses intermediate tree to ensure that the shader does not exceed the
+// minimum functionality mandated in GLSL 1.0 spec, Appendix A.
+class ValidateLimitations : public TIntermTraverser {
+public:
+ ValidateLimitations(ShShaderType shaderType, TInfoSinkBase& sink);
+
+ int numErrors() const { return mNumErrors; }
+
+ virtual void visitSymbol(TIntermSymbol*);
+ virtual void visitConstantUnion(TIntermConstantUnion*);
+ virtual bool visitBinary(Visit, TIntermBinary*);
+ virtual bool visitUnary(Visit, TIntermUnary*);
+ virtual bool visitSelection(Visit, TIntermSelection*);
+ virtual bool visitAggregate(Visit, TIntermAggregate*);
+ virtual bool visitLoop(Visit, TIntermLoop*);
+ virtual bool visitBranch(Visit, TIntermBranch*);
+
+private:
+ void error(TSourceLoc loc, const char *reason, const char* token);
+
+ bool withinLoopBody() const;
+ bool isLoopIndex(const TIntermSymbol* symbol) const;
+ bool validateLoopType(TIntermLoop* node);
+ bool validateForLoopHeader(TIntermLoop* node, TLoopInfo* info);
+ bool validateForLoopInit(TIntermLoop* node, TLoopInfo* info);
+ bool validateForLoopCond(TIntermLoop* node, TLoopInfo* info);
+ bool validateForLoopExpr(TIntermLoop* node, TLoopInfo* info);
+ // Returns true if none of the loop indices is used as the argument to
+ // the given function out or inout parameter.
+ bool validateFunctionCall(TIntermAggregate* node);
+ bool validateOperation(TIntermOperator* node, TIntermNode* operand);
+
+ // Returns true if indexing does not exceed the minimum functionality
+ // mandated in GLSL 1.0 spec, Appendix A, Section 5.
+ bool isConstExpr(TIntermNode* node);
+ bool isConstIndexExpr(TIntermNode* node);
+ bool validateIndexing(TIntermBinary* node);
+
+ ShShaderType mShaderType;
+ TInfoSinkBase& mSink;
+ int mNumErrors;
+ TLoopStack mLoopStack;
+};
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp
new file mode 100644
index 0000000..ad2e08f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp
@@ -0,0 +1,210 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/VariableInfo.h"
+
+static TString arrayBrackets(int index)
+{
+ TStringStream stream;
+ stream << "[" << index << "]";
+ return stream.str();
+}
+
+// Returns the data type for an attribute or uniform.
+static ShDataType getVariableDataType(const TType& type)
+{
+ switch (type.getBasicType()) {
+ case EbtFloat:
+ if (type.isMatrix()) {
+ switch (type.getNominalSize()) {
+ case 2: return SH_FLOAT_MAT2;
+ case 3: return SH_FLOAT_MAT3;
+ case 4: return SH_FLOAT_MAT4;
+ default: UNREACHABLE();
+ }
+ } else if (type.isVector()) {
+ switch (type.getNominalSize()) {
+ case 2: return SH_FLOAT_VEC2;
+ case 3: return SH_FLOAT_VEC3;
+ case 4: return SH_FLOAT_VEC4;
+ default: UNREACHABLE();
+ }
+ } else {
+ return SH_FLOAT;
+ }
+ case EbtInt:
+ if (type.isMatrix()) {
+ UNREACHABLE();
+ } else if (type.isVector()) {
+ switch (type.getNominalSize()) {
+ case 2: return SH_INT_VEC2;
+ case 3: return SH_INT_VEC3;
+ case 4: return SH_INT_VEC4;
+ default: UNREACHABLE();
+ }
+ } else {
+ return SH_INT;
+ }
+ case EbtBool:
+ if (type.isMatrix()) {
+ UNREACHABLE();
+ } else if (type.isVector()) {
+ switch (type.getNominalSize()) {
+ case 2: return SH_BOOL_VEC2;
+ case 3: return SH_BOOL_VEC3;
+ case 4: return SH_BOOL_VEC4;
+ default: UNREACHABLE();
+ }
+ } else {
+ return SH_BOOL;
+ }
+ case EbtSampler2D: return SH_SAMPLER_2D;
+ case EbtSamplerCube: return SH_SAMPLER_CUBE;
+ default: UNREACHABLE();
+ }
+ return SH_NONE;
+}
+
+static void getBuiltInVariableInfo(const TType& type,
+ const TString& name,
+ TVariableInfoList& infoList);
+static void getUserDefinedVariableInfo(const TType& type,
+ const TString& name,
+ TVariableInfoList& infoList);
+
+// Returns info for an attribute or uniform.
+static void getVariableInfo(const TType& type,
+ const TString& name,
+ TVariableInfoList& infoList)
+{
+ if (type.getBasicType() == EbtStruct) {
+ if (type.isArray()) {
+ for (int i = 0; i < type.getArraySize(); ++i) {
+ TString lname = name + arrayBrackets(i);
+ getUserDefinedVariableInfo(type, lname, infoList);
+ }
+ } else {
+ getUserDefinedVariableInfo(type, name, infoList);
+ }
+ } else {
+ getBuiltInVariableInfo(type, name, infoList);
+ }
+}
+
+void getBuiltInVariableInfo(const TType& type,
+ const TString& name,
+ TVariableInfoList& infoList)
+{
+ ASSERT(type.getBasicType() != EbtStruct);
+
+ TVariableInfo varInfo;
+ if (type.isArray()) {
+ varInfo.name = (name + "[0]").c_str();
+ varInfo.size = type.getArraySize();
+ } else {
+ varInfo.name = name.c_str();
+ varInfo.size = 1;
+ }
+ varInfo.type = getVariableDataType(type);
+ infoList.push_back(varInfo);
+}
+
+void getUserDefinedVariableInfo(const TType& type,
+ const TString& name,
+ TVariableInfoList& infoList)
+{
+ ASSERT(type.getBasicType() == EbtStruct);
+
+ TString lname = name + ".";
+ const TTypeList* structure = type.getStruct();
+ for (size_t i = 0; i < structure->size(); ++i) {
+ const TType* fieldType = (*structure)[i].type;
+ getVariableInfo(*fieldType,
+ lname + fieldType->getFieldName(),
+ infoList);
+ }
+}
+
+CollectAttribsUniforms::CollectAttribsUniforms(TVariableInfoList& attribs,
+ TVariableInfoList& uniforms)
+ : mAttribs(attribs),
+ mUniforms(uniforms)
+{
+}
+
+// We are only interested in attribute and uniform variable declaration.
+void CollectAttribsUniforms::visitSymbol(TIntermSymbol*)
+{
+}
+
+void CollectAttribsUniforms::visitConstantUnion(TIntermConstantUnion*)
+{
+}
+
+bool CollectAttribsUniforms::visitBinary(Visit, TIntermBinary*)
+{
+ return false;
+}
+
+bool CollectAttribsUniforms::visitUnary(Visit, TIntermUnary*)
+{
+ return false;
+}
+
+bool CollectAttribsUniforms::visitSelection(Visit, TIntermSelection*)
+{
+ return false;
+}
+
+bool CollectAttribsUniforms::visitAggregate(Visit, TIntermAggregate* node)
+{
+ bool visitChildren = false;
+
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ // We need to visit sequence children to get to variable declarations.
+ visitChildren = true;
+ break;
+ case EOpDeclaration: {
+ const TIntermSequence& sequence = node->getSequence();
+ TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier();
+ if (qualifier == EvqAttribute || qualifier == EvqUniform)
+ {
+ TVariableInfoList& infoList = qualifier == EvqAttribute ?
+ mAttribs : mUniforms;
+ for (TIntermSequence::const_iterator i = sequence.begin();
+ i != sequence.end(); ++i)
+ {
+ const TIntermSymbol* variable = (*i)->getAsSymbolNode();
+ // The only case in which the sequence will not contain a
+ // TIntermSymbol node is initialization. It will contain a
+ // TInterBinary node in that case. Since attributes and unifroms
+ // cannot be initialized in a shader, we must have only
+ // TIntermSymbol nodes in the sequence.
+ ASSERT(variable != NULL);
+ getVariableInfo(variable->getType(), variable->getSymbol(),
+ infoList);
+ }
+ }
+ break;
+ }
+ default: break;
+ }
+
+ return visitChildren;
+}
+
+bool CollectAttribsUniforms::visitLoop(Visit, TIntermLoop*)
+{
+ return false;
+}
+
+bool CollectAttribsUniforms::visitBranch(Visit, TIntermBranch*)
+{
+ return false;
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h
new file mode 100644
index 0000000..15a5c57
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "GLSLANG/ShaderLang.h"
+#include "compiler/intermediate.h"
+
+// Provides information about a variable.
+// It is currently being used to store info about active attribs and uniforms.
+struct TVariableInfo {
+ TPersistString name;
+ ShDataType type;
+ int size;
+};
+typedef std::vector<TVariableInfo> TVariableInfoList;
+
+// Traverses intermediate tree to collect all attributes and uniforms.
+class CollectAttribsUniforms : public TIntermTraverser {
+public:
+ CollectAttribsUniforms(TVariableInfoList& attribs,
+ TVariableInfoList& uniforms);
+
+ virtual void visitSymbol(TIntermSymbol*);
+ virtual void visitConstantUnion(TIntermConstantUnion*);
+ virtual bool visitBinary(Visit, TIntermBinary*);
+ virtual bool visitUnary(Visit, TIntermUnary*);
+ virtual bool visitSelection(Visit, TIntermSelection*);
+ virtual bool visitAggregate(Visit, TIntermAggregate*);
+ virtual bool visitLoop(Visit, TIntermLoop*);
+ virtual bool visitBranch(Visit, TIntermBranch*);
+
+private:
+ TVariableInfoList& mAttribs;
+ TVariableInfoList& mUniforms;
+};
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp
new file mode 100644
index 0000000..3f87820
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp
@@ -0,0 +1,108 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/VersionGLSL.h"
+
+static const int GLSL_VERSION_110 = 110;
+static const int GLSL_VERSION_120 = 120;
+
+// We need to scan for two things:
+// 1. "invariant" keyword: This can occur in both - vertex and fragment shaders
+// but only at the global scope.
+// 2. "gl_PointCoord" built-in variable: This can only occur in fragment shader
+// but inside any scope.
+// So we need to scan the entire fragment shader but only the global scope
+// of vertex shader.
+//
+// TODO(alokp): The following two cases of invariant decalaration get lost
+// during parsing - they do not get carried over to the intermediate tree.
+// Handle these cases:
+// 1. When a pragma is used to force all output variables to be invariant:
+// - #pragma STDGL invariant(all)
+// 2. When a previously decalared or built-in variable is marked invariant:
+// - invariant gl_Position;
+// - varying vec3 color; invariant color;
+//
+TVersionGLSL::TVersionGLSL(ShShaderType type)
+ : mShaderType(type),
+ mVersion(GLSL_VERSION_110)
+{
+}
+
+void TVersionGLSL::visitSymbol(TIntermSymbol* node)
+{
+ ASSERT(mShaderType == SH_FRAGMENT_SHADER);
+
+ if (node->getSymbol() == "gl_PointCoord")
+ updateVersion(GLSL_VERSION_120);
+}
+
+void TVersionGLSL::visitConstantUnion(TIntermConstantUnion*)
+{
+ ASSERT(mShaderType == SH_FRAGMENT_SHADER);
+}
+
+bool TVersionGLSL::visitBinary(Visit, TIntermBinary*)
+{
+ ASSERT(mShaderType == SH_FRAGMENT_SHADER);
+ return true;
+}
+
+bool TVersionGLSL::visitUnary(Visit, TIntermUnary*)
+{
+ ASSERT(mShaderType == SH_FRAGMENT_SHADER);
+ return true;
+}
+
+bool TVersionGLSL::visitSelection(Visit, TIntermSelection*)
+{
+ ASSERT(mShaderType == SH_FRAGMENT_SHADER);
+ return true;
+}
+
+bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node)
+{
+ // We need to scan the entire fragment shader but only the global scope
+ // of vertex shader.
+ bool visitChildren = mShaderType == SH_FRAGMENT_SHADER ? true : false;
+
+ switch (node->getOp()) {
+ case EOpSequence:
+ // We need to visit sequence children to get to global or inner scope.
+ visitChildren = true;
+ break;
+ case EOpDeclaration: {
+ const TIntermSequence& sequence = node->getSequence();
+ TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier();
+ if ((qualifier == EvqInvariantVaryingIn) ||
+ (qualifier == EvqInvariantVaryingOut)) {
+ updateVersion(GLSL_VERSION_120);
+ }
+ break;
+ }
+ default: break;
+ }
+
+ return visitChildren;
+}
+
+bool TVersionGLSL::visitLoop(Visit, TIntermLoop*)
+{
+ ASSERT(mShaderType == SH_FRAGMENT_SHADER);
+ return true;
+}
+
+bool TVersionGLSL::visitBranch(Visit, TIntermBranch*)
+{
+ ASSERT(mShaderType == SH_FRAGMENT_SHADER);
+ return true;
+}
+
+void TVersionGLSL::updateVersion(int version)
+{
+ mVersion = std::max(version, mVersion);
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h
new file mode 100644
index 0000000..64d002b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_VERSIONGLSL_H_
+#define COMPILER_VERSIONGLSL_H_
+
+#include "GLSLANG/ShaderLang.h"
+#include "compiler/intermediate.h"
+
+// Traverses the intermediate tree to return the minimum GLSL version
+// required to legally access all built-in features used in the shader.
+// GLSL 1.1 which is mandated by OpenGL 2.0 provides:
+// - #version and #extension to declare version and extensions.
+// - built-in functions refract, exp, and log.
+// - updated step() to compare x < edge instead of x <= edge.
+// GLSL 1.2 which is mandated by OpenGL 2.1 provides:
+// - many changes to reduce differences when compared to the ES specification.
+// - invariant keyword and its support.
+// - c++ style name hiding rules.
+// - built-in variable gl_PointCoord for fragment shaders.
+//
+class TVersionGLSL : public TIntermTraverser {
+public:
+ TVersionGLSL(ShShaderType type);
+
+ // Returns 120 if "invariant" keyword or "gl_PointCoord" is used
+ // in the shader. Else 110 is returned.
+ int getVersion() { return mVersion; }
+
+ virtual void visitSymbol(TIntermSymbol*);
+ virtual void visitConstantUnion(TIntermConstantUnion*);
+ virtual bool visitBinary(Visit, TIntermBinary*);
+ virtual bool visitUnary(Visit, TIntermUnary*);
+ virtual bool visitSelection(Visit, TIntermSelection*);
+ virtual bool visitAggregate(Visit, TIntermAggregate*);
+ virtual bool visitLoop(Visit, TIntermLoop*);
+ virtual bool visitBranch(Visit, TIntermBranch*);
+
+protected:
+ void updateVersion(int version);
+
+private:
+ ShShaderType mShaderType;
+ int mVersion;
+};
+
+#endif // COMPILER_VERSIONGLSL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.cpp
new file mode 100644
index 0000000..9642e1e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.cpp
@@ -0,0 +1,36 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.cpp: Debugging utilities.
+
+#include "compiler/debug.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "compiler/ParseHelper.h"
+
+static const int kTraceBufferLen = 1024;
+
+#ifdef TRACE_ENABLED
+extern "C" {
+void Trace(const char *format, ...) {
+ if (!format) return;
+
+ TParseContext* parseContext = GetGlobalParseContext();
+ if (parseContext) {
+ char buf[kTraceBufferLen];
+ va_list args;
+ va_start(args, format);
+ vsnprintf(buf, kTraceBufferLen, format, args);
+ va_end(args);
+
+ parseContext->infoSink.debug << buf;
+ }
+}
+} // extern "C"
+#endif // TRACE_ENABLED
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.h
new file mode 100644
index 0000000..7a37151
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/debug.h
@@ -0,0 +1,53 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.h: Debugging utilities.
+
+#ifndef COMPILER_DEBUG_H_
+#define COMPILER_DEBUG_H_
+
+#include <assert.h>
+
+#ifdef _DEBUG
+#define TRACE_ENABLED // define to enable debug message tracing
+#endif // _DEBUG
+
+// Outputs text to the debug log
+#ifdef TRACE_ENABLED
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+void Trace(const char* format, ...);
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#else // TRACE_ENABLED
+
+#define Trace(...) ((void)0)
+
+#endif // TRACE_ENABLED
+
+// A macro asserting a condition and outputting failures to the debug log
+#define ASSERT(expression) do { \
+ if(!(expression)) \
+ Trace("Assert failed: %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
+ assert(expression); \
+} while(0)
+
+#define UNIMPLEMENTED() do { \
+ Trace("Unimplemented invoked: %s(%d)\n", __FUNCTION__, __LINE__); \
+ assert(false); \
+} while(0)
+
+#define UNREACHABLE() do { \
+ Trace("Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
+ assert(false); \
+} while(0)
+
+#endif // COMPILER_DEBUG_H_
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_lexer.sh b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_lexer.sh
new file mode 100644
index 0000000..268479d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_lexer.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Generates GLSL ES lexer - glslang_lex.cpp
+
+script_dir=$(dirname $0)
+input_file=$script_dir/glslang.l
+output_file=$script_dir/glslang_lex.cpp
+flex --noline --nounistd --outfile=$output_file $input_file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_parser.sh b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_parser.sh
new file mode 100644
index 0000000..889f5c0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/generate_glslang_parser.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Generates GLSL ES parser - glslang_tab.h and glslang_tab.cpp
+
+script_dir=$(dirname $0)
+input_file=$script_dir/glslang.y
+output_header=$script_dir/glslang_tab.h
+output_source=$script_dir/glslang_tab.cpp
+bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.h
new file mode 100644
index 0000000..26f1457
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.h
@@ -0,0 +1,16 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+struct TParseContext;
+extern int glslang_initialize(TParseContext* context);
+extern int glslang_finalize(TParseContext* context);
+
+extern void glslang_scan(int count,
+ const char* const string[],
+ const int length[],
+ TParseContext* context);
+extern int glslang_parse(TParseContext* context);
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.l b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.l
new file mode 100644
index 0000000..5a7c5d5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.l
@@ -0,0 +1,570 @@
+/*
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+This file contains the Lex specification for GLSL ES.
+Based on ANSI C grammar, Lex specification:
+http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
+
+IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_glslang_lexer.sh,
+WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
+*/
+
+%top{
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_glslang_lexer.sh. DO NOT EDIT!
+}
+
+%{
+#include "compiler/glslang.h"
+#include "compiler/ParseHelper.h"
+#include "compiler/util.h"
+#include "glslang_tab.h"
+
+/* windows only pragma */
+#ifdef _MSC_VER
+#pragma warning(disable : 4102)
+#endif
+
+#define YY_USER_ACTION yylval->lex.line = yylineno;
+#define YY_INPUT(buf, result, max_size) \
+ result = string_input(buf, max_size, yyscanner);
+
+static int string_input(char* buf, int max_size, yyscan_t yyscanner);
+static int check_type(yyscan_t yyscanner);
+static int reserved_word(yyscan_t yyscanner);
+%}
+
+%option noyywrap nounput never-interactive
+%option yylineno reentrant bison-bridge
+%option stack
+%option extra-type="TParseContext*"
+%x COMMENT FIELDS
+
+D [0-9]
+L [a-zA-Z_]
+H [a-fA-F0-9]
+E [Ee][+-]?{D}+
+O [0-7]
+
+%%
+
+%{
+ TParseContext* context = yyextra;
+%}
+
+ /* Single-line comments */
+"//"[^\n]* ;
+
+ /* Multi-line comments */
+"/*" { yy_push_state(COMMENT, yyscanner); }
+<COMMENT>. |
+<COMMENT>\n ;
+<COMMENT>"*/" { yy_pop_state(yyscanner); }
+
+"invariant" { return(INVARIANT); }
+"highp" { return(HIGH_PRECISION); }
+"mediump" { return(MEDIUM_PRECISION); }
+"lowp" { return(LOW_PRECISION); }
+"precision" { return(PRECISION); }
+
+"attribute" { return(ATTRIBUTE); }
+"const" { return(CONST_QUAL); }
+"uniform" { return(UNIFORM); }
+"varying" { return(VARYING); }
+
+"break" { return(BREAK); }
+"continue" { return(CONTINUE); }
+"do" { return(DO); }
+"for" { return(FOR); }
+"while" { return(WHILE); }
+
+"if" { return(IF); }
+"else" { return(ELSE); }
+
+"in" { return(IN_QUAL); }
+"out" { return(OUT_QUAL); }
+"inout" { return(INOUT_QUAL); }
+
+"float" { context->lexAfterType = true; return(FLOAT_TYPE); }
+"int" { context->lexAfterType = true; return(INT_TYPE); }
+"void" { context->lexAfterType = true; return(VOID_TYPE); }
+"bool" { context->lexAfterType = true; return(BOOL_TYPE); }
+"true" { yylval->lex.b = true; return(BOOLCONSTANT); }
+"false" { yylval->lex.b = false; return(BOOLCONSTANT); }
+
+"discard" { return(DISCARD); }
+"return" { return(RETURN); }
+
+"mat2" { context->lexAfterType = true; return(MATRIX2); }
+"mat3" { context->lexAfterType = true; return(MATRIX3); }
+"mat4" { context->lexAfterType = true; return(MATRIX4); }
+
+"vec2" { context->lexAfterType = true; return (VEC2); }
+"vec3" { context->lexAfterType = true; return (VEC3); }
+"vec4" { context->lexAfterType = true; return (VEC4); }
+"ivec2" { context->lexAfterType = true; return (IVEC2); }
+"ivec3" { context->lexAfterType = true; return (IVEC3); }
+"ivec4" { context->lexAfterType = true; return (IVEC4); }
+"bvec2" { context->lexAfterType = true; return (BVEC2); }
+"bvec3" { context->lexAfterType = true; return (BVEC3); }
+"bvec4" { context->lexAfterType = true; return (BVEC4); }
+
+"sampler2D" { context->lexAfterType = true; return SAMPLER2D; }
+"samplerCube" { context->lexAfterType = true; return SAMPLERCUBE; }
+
+"struct" { context->lexAfterType = true; return(STRUCT); }
+
+"asm" { return reserved_word(yyscanner); }
+
+"class" { return reserved_word(yyscanner); }
+"union" { return reserved_word(yyscanner); }
+"enum" { return reserved_word(yyscanner); }
+"typedef" { return reserved_word(yyscanner); }
+"template" { return reserved_word(yyscanner); }
+"this" { return reserved_word(yyscanner); }
+"packed" { return reserved_word(yyscanner); }
+
+"goto" { return reserved_word(yyscanner); }
+"switch" { return reserved_word(yyscanner); }
+"default" { return reserved_word(yyscanner); }
+
+"inline" { return reserved_word(yyscanner); }
+"noinline" { return reserved_word(yyscanner); }
+"volatile" { return reserved_word(yyscanner); }
+"public" { return reserved_word(yyscanner); }
+"static" { return reserved_word(yyscanner); }
+"extern" { return reserved_word(yyscanner); }
+"external" { return reserved_word(yyscanner); }
+"interface" { return reserved_word(yyscanner); }
+
+"long" { return reserved_word(yyscanner); }
+"short" { return reserved_word(yyscanner); }
+"double" { return reserved_word(yyscanner); }
+"half" { return reserved_word(yyscanner); }
+"fixed" { return reserved_word(yyscanner); }
+"unsigned" { return reserved_word(yyscanner); }
+
+"input" { return reserved_word(yyscanner); }
+"output" { return reserved_word(yyscanner); }
+
+"hvec2" { return reserved_word(yyscanner); }
+"hvec3" { return reserved_word(yyscanner); }
+"hvec4" { return reserved_word(yyscanner); }
+"fvec2" { return reserved_word(yyscanner); }
+"fvec3" { return reserved_word(yyscanner); }
+"fvec4" { return reserved_word(yyscanner); }
+"dvec2" { return reserved_word(yyscanner); }
+"dvec3" { return reserved_word(yyscanner); }
+"dvec4" { return reserved_word(yyscanner); }
+
+"sizeof" { return reserved_word(yyscanner); }
+"cast" { return reserved_word(yyscanner); }
+
+"namespace" { return reserved_word(yyscanner); }
+"using" { return reserved_word(yyscanner); }
+
+{L}({L}|{D})* {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+}
+
+0[xX]{H}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+0{O}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+0{D}+ { context->error(yylineno, "Invalid Octal number.", yytext, "", ""); context->recover(); return 0;}
+{D}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+
+{D}+{E} { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
+{D}+"."{D}*({E})? { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
+"."{D}+({E})? { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
+
+"+=" { return(ADD_ASSIGN); }
+"-=" { return(SUB_ASSIGN); }
+"*=" { return(MUL_ASSIGN); }
+"/=" { return(DIV_ASSIGN); }
+"%=" { return(MOD_ASSIGN); }
+"<<=" { return(LEFT_ASSIGN); }
+">>=" { return(RIGHT_ASSIGN); }
+"&=" { return(AND_ASSIGN); }
+"^=" { return(XOR_ASSIGN); }
+"|=" { return(OR_ASSIGN); }
+
+"++" { return(INC_OP); }
+"--" { return(DEC_OP); }
+"&&" { return(AND_OP); }
+"||" { return(OR_OP); }
+"^^" { return(XOR_OP); }
+"<=" { return(LE_OP); }
+">=" { return(GE_OP); }
+"==" { return(EQ_OP); }
+"!=" { return(NE_OP); }
+"<<" { return(LEFT_OP); }
+">>" { return(RIGHT_OP); }
+";" { context->lexAfterType = false; return(SEMICOLON); }
+("{"|"<%") { context->lexAfterType = false; return(LEFT_BRACE); }
+("}"|"%>") { return(RIGHT_BRACE); }
+"," { if (context->inTypeParen) context->lexAfterType = false; return(COMMA); }
+":" { return(COLON); }
+"=" { context->lexAfterType = false; return(EQUAL); }
+"(" { context->lexAfterType = false; context->inTypeParen = true; return(LEFT_PAREN); }
+")" { context->inTypeParen = false; return(RIGHT_PAREN); }
+("["|"<:") { return(LEFT_BRACKET); }
+("]"|":>") { return(RIGHT_BRACKET); }
+"." { BEGIN(FIELDS); return(DOT); }
+"!" { return(BANG); }
+"-" { return(DASH); }
+"~" { return(TILDE); }
+"+" { return(PLUS); }
+"*" { return(STAR); }
+"/" { return(SLASH); }
+"%" { return(PERCENT); }
+"<" { return(LEFT_ANGLE); }
+">" { return(RIGHT_ANGLE); }
+"|" { return(VERTICAL_BAR); }
+"^" { return(CARET); }
+"&" { return(AMPERSAND); }
+"?" { return(QUESTION); }
+
+<FIELDS>{L}({L}|{D})* {
+ BEGIN(INITIAL);
+ yylval->lex.string = NewPoolTString(yytext);
+ return FIELD_SELECTION;
+}
+<FIELDS>[ \t\v\f\r] {}
+
+[ \t\v\n\f\r] { }
+<*><<EOF>> { context->AfterEOF = true; yyterminate(); }
+<*>. { context->warning(yylineno, "Unknown char", yytext, ""); return 0; }
+
+%%
+
+extern "C" {
+// Preprocessor interface.
+#include "compiler/preprocessor/preprocess.h"
+
+#define SETUP_CONTEXT(pp) \
+ TParseContext* context = (TParseContext*) pp->pC; \
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+// Preprocessor callbacks.
+void CPPDebugLogMsg(const char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->infoSink.debug.message(EPrefixNone, msg);
+}
+
+void CPPWarningToInfoLog(const char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->warning(yylineno, msg, "", "");
+}
+
+void CPPShInfoLogMsg(const char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->error(yylineno, msg, "", "");
+ context->recover();
+}
+
+void CPPErrorToInfoLog(char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->error(yylineno, msg, "", "");
+ context->recover();
+}
+
+void SetLineNumber(int line)
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0;
+ DecodeSourceLoc(yylineno, &string, NULL);
+ yylineno = EncodeSourceLoc(string, line);
+}
+
+void SetStringNumber(int string)
+{
+ SETUP_CONTEXT(cpp);
+ int line = 0;
+ DecodeSourceLoc(yylineno, NULL, &line);
+ yylineno = EncodeSourceLoc(string, line);
+}
+
+int GetStringNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0;
+ DecodeSourceLoc(yylineno, &string, NULL);
+ return string;
+}
+
+int GetLineNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int line = 0;
+ DecodeSourceLoc(yylineno, NULL, &line);
+ return line;
+}
+
+void IncLineNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0, line = 0;
+ DecodeSourceLoc(yylineno, &string, &line);
+ yylineno = EncodeSourceLoc(string, ++line);
+}
+
+void DecLineNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0, line = 0;
+ DecodeSourceLoc(yylineno, &string, &line);
+ yylineno = EncodeSourceLoc(string, --line);
+}
+
+void HandlePragma(const char **tokens, int numTokens)
+{
+ SETUP_CONTEXT(cpp);
+ if (!strcmp(tokens[0], "optimize")) {
+ if (numTokens != 4) {
+ CPPShInfoLogMsg("optimize pragma syntax is incorrect");
+ return;
+ }
+
+ if (strcmp(tokens[1], "(")) {
+ CPPShInfoLogMsg("\"(\" expected after 'optimize' keyword");
+ return;
+ }
+
+ if (!strcmp(tokens[2], "on"))
+ context->contextPragma.optimize = true;
+ else if (!strcmp(tokens[2], "off"))
+ context->contextPragma.optimize = false;
+ else {
+ CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'optimize' pragma");
+ return;
+ }
+
+ if (strcmp(tokens[3], ")")) {
+ CPPShInfoLogMsg("\")\" expected to end 'optimize' pragma");
+ return;
+ }
+ } else if (!strcmp(tokens[0], "debug")) {
+ if (numTokens != 4) {
+ CPPShInfoLogMsg("debug pragma syntax is incorrect");
+ return;
+ }
+
+ if (strcmp(tokens[1], "(")) {
+ CPPShInfoLogMsg("\"(\" expected after 'debug' keyword");
+ return;
+ }
+
+ if (!strcmp(tokens[2], "on"))
+ context->contextPragma.debug = true;
+ else if (!strcmp(tokens[2], "off"))
+ context->contextPragma.debug = false;
+ else {
+ CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'debug' pragma");
+ return;
+ }
+
+ if (strcmp(tokens[3], ")")) {
+ CPPShInfoLogMsg("\")\" expected to end 'debug' pragma");
+ return;
+ }
+ } else {
+#ifdef PRAGMA_TABLE
+ //
+ // implementation specific pragma
+ // use ((TParseContext *)cpp->pC)->contextPragma.pragmaTable to store the information about pragma
+ // For now, just ignore the pragma that the implementation cannot recognize
+ // An Example of one such implementation for a pragma that has a syntax like
+ // #pragma pragmaname(pragmavalue)
+ // This implementation stores the current pragmavalue against the pragma name in pragmaTable.
+ //
+ if (numTokens == 4 && !strcmp(tokens[1], "(") && !strcmp(tokens[3], ")")) {
+ TPragmaTable& pragmaTable = ((TParseContext *)cpp->pC)->contextPragma.pragmaTable;
+ TPragmaTable::iterator iter;
+ iter = pragmaTable.find(TString(tokens[0]));
+ if (iter != pragmaTable.end()) {
+ iter->second = tokens[2];
+ } else {
+ pragmaTable[ tokens[0] ] = tokens[2];
+ }
+ } else if (numTokens >= 2) {
+ TPragmaTable& pragmaTable = ((TParseContext *)cpp->pC)->contextPragma.pragmaTable;
+ TPragmaTable::iterator iter;
+ iter = pragmaTable.find(TString(tokens[0]));
+ if (iter != pragmaTable.end()) {
+ iter->second = tokens[1];
+ } else {
+ pragmaTable[ tokens[0] ] = tokens[1];
+ }
+ }
+#endif // PRAGMA_TABLE
+ }
+}
+
+void StoreStr(char *string)
+{
+ SETUP_CONTEXT(cpp);
+ TString strSrc;
+ strSrc = TString(string);
+
+ context->HashErrMsg = context->HashErrMsg + " " + strSrc;
+}
+
+const char* GetStrfromTStr(void)
+{
+ SETUP_CONTEXT(cpp);
+ cpp->ErrMsg = context->HashErrMsg.c_str();
+ return cpp->ErrMsg;
+}
+
+void ResetTString(void)
+{
+ SETUP_CONTEXT(cpp);
+ context->HashErrMsg = "";
+}
+
+TBehavior GetBehavior(const char* behavior)
+{
+ if (!strcmp("require", behavior))
+ return EBhRequire;
+ else if (!strcmp("enable", behavior))
+ return EBhEnable;
+ else if (!strcmp("disable", behavior))
+ return EBhDisable;
+ else if (!strcmp("warn", behavior))
+ return EBhWarn;
+ else {
+ CPPShInfoLogMsg((TString("behavior '") + behavior + "' is not supported").c_str());
+ return EBhDisable;
+ }
+}
+
+void updateExtensionBehavior(const char* extName, const char* behavior)
+{
+ SETUP_CONTEXT(cpp);
+ TBehavior behaviorVal = GetBehavior(behavior);
+ TMap<TString, TBehavior>:: iterator iter;
+ TString msg;
+
+ // special cased for all extension
+ if (!strcmp(extName, "all")) {
+ if (behaviorVal == EBhRequire || behaviorVal == EBhEnable) {
+ CPPShInfoLogMsg("extension 'all' cannot have 'require' or 'enable' behavior");
+ return;
+ } else {
+ for (iter = context->extensionBehavior.begin(); iter != context->extensionBehavior.end(); ++iter)
+ iter->second = behaviorVal;
+ }
+ } else {
+ iter = context->extensionBehavior.find(TString(extName));
+ if (iter == context->extensionBehavior.end()) {
+ switch (behaviorVal) {
+ case EBhRequire:
+ CPPShInfoLogMsg((TString("extension '") + extName + "' is not supported").c_str());
+ break;
+ case EBhEnable:
+ case EBhWarn:
+ case EBhDisable:
+ msg = TString("extension '") + extName + "' is not supported";
+ context->infoSink.info.message(EPrefixWarning, msg.c_str(), yylineno);
+ break;
+ }
+ return;
+ } else
+ iter->second = behaviorVal;
+ }
+}
+} // extern "C"
+
+int string_input(char* buf, int max_size, yyscan_t yyscanner) {
+ int len;
+
+ if ((len = yylex_CPP(buf, max_size)) == 0)
+ return 0;
+ if (len >= max_size)
+ YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT");
+
+ buf[len] = ' ';
+ return len+1;
+}
+
+int check_type(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ int token = IDENTIFIER;
+ TSymbol* symbol = yyextra->symbolTable.find(yytext);
+ if (yyextra->lexAfterType == false && symbol && symbol->isVariable()) {
+ TVariable* variable = static_cast<TVariable*>(symbol);
+ if (variable->isUserType()) {
+ yyextra->lexAfterType = true;
+ token = TYPE_NAME;
+ }
+ }
+ yylval->lex.symbol = symbol;
+ return token;
+}
+
+int reserved_word(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ yyextra->error(yylineno, "Illegal use of reserved word", yytext, "");
+ yyextra->recover();
+ return 0;
+}
+
+void yyerror(TParseContext* context, const char* reason) {
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+ if (context->AfterEOF) {
+ context->error(yylineno, reason, "unexpected EOF", "");
+ } else {
+ context->error(yylineno, reason, yytext, "");
+ }
+ context->recover();
+}
+
+int glslang_initialize(TParseContext* context) {
+ yyscan_t scanner = NULL;
+ if (yylex_init_extra(context, &scanner))
+ return 1;
+
+ context->scanner = scanner;
+ return 0;
+}
+
+int glslang_finalize(TParseContext* context) {
+ yyscan_t scanner = context->scanner;
+ if (scanner == NULL) return 0;
+
+ context->scanner = NULL;
+ return yylex_destroy(scanner);
+}
+
+void glslang_scan(int count, const char* const string[], const int length[],
+ TParseContext* context) {
+ yyrestart(NULL, context->scanner);
+ yyset_lineno(EncodeSourceLoc(0, 1), context->scanner);
+ context->AfterEOF = false;
+
+ // Init preprocessor.
+ cpp->pC = context;
+ cpp->PaWhichStr = 0;
+ cpp->PaArgv = string;
+ cpp->PaArgc = count;
+ cpp->PaStrLen = length;
+ cpp->pastFirstStatement = 0;
+ ScanFromString(string[0]);
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.y b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.y
new file mode 100644
index 0000000..5eae4b5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang.y
@@ -0,0 +1,2072 @@
+/*
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+This file contains the Yacc grammar for GLSL ES.
+Based on ANSI C Yacc grammar:
+http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
+
+IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_glslang_parser.sh,
+WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
+*/
+
+%{
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_glslang_parser.sh. DO NOT EDIT!
+
+#include "compiler/SymbolTable.h"
+#include "compiler/ParseHelper.h"
+#include "GLSLANG/ShaderLang.h"
+
+#define YYLEX_PARAM context->scanner
+%}
+
+%expect 1 /* One shift reduce conflict because of if | else */
+%pure-parser
+%parse-param {TParseContext* context}
+
+%union {
+ struct {
+ TSourceLoc line;
+ union {
+ TString *string;
+ float f;
+ int i;
+ bool b;
+ };
+ TSymbol* symbol;
+ } lex;
+ struct {
+ TSourceLoc line;
+ TOperator op;
+ union {
+ TIntermNode* intermNode;
+ TIntermNodePair nodePair;
+ TIntermTyped* intermTypedNode;
+ TIntermAggregate* intermAggregate;
+ };
+ union {
+ TPublicType type;
+ TPrecision precision;
+ TQualifier qualifier;
+ TFunction* function;
+ TParameter param;
+ TTypeLine typeLine;
+ TTypeList* typeList;
+ };
+ } interm;
+}
+
+%{
+extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
+extern void yyerror(TParseContext* context, const char* reason);
+
+#define FRAG_VERT_ONLY(S, L) { \
+ if (context->shaderType != SH_FRAGMENT_SHADER && \
+ context->shaderType != SH_VERTEX_SHADER) { \
+ context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
+ context->recover(); \
+ } \
+}
+
+#define VERTEX_ONLY(S, L) { \
+ if (context->shaderType != SH_VERTEX_SHADER) { \
+ context->error(L, " supported in vertex shaders only ", S, "", ""); \
+ context->recover(); \
+ } \
+}
+
+#define FRAG_ONLY(S, L) { \
+ if (context->shaderType != SH_FRAGMENT_SHADER) { \
+ context->error(L, " supported in fragment shaders only ", S, "", ""); \
+ context->recover(); \
+ } \
+}
+%}
+
+%token <lex> INVARIANT HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
+%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE
+%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN
+%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4
+%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
+%token <lex> STRUCT VOID_TYPE WHILE
+%token <lex> SAMPLER2D SAMPLERCUBE
+
+%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT
+%token <lex> FIELD_SELECTION
+%token <lex> LEFT_OP RIGHT_OP
+%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
+%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
+%token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
+%token <lex> SUB_ASSIGN
+
+%token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
+%token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
+%token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
+
+%type <interm> assignment_operator unary_operator
+%type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
+%type <interm.intermTypedNode> expression integer_expression assignment_expression
+%type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
+%type <interm.intermTypedNode> relational_expression equality_expression
+%type <interm.intermTypedNode> conditional_expression constant_expression
+%type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
+%type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
+%type <interm.intermTypedNode> function_call initializer condition conditionopt
+
+%type <interm.intermNode> translation_unit function_definition
+%type <interm.intermNode> statement simple_statement
+%type <interm.intermAggregate> statement_list compound_statement
+%type <interm.intermNode> declaration_statement selection_statement expression_statement
+%type <interm.intermNode> declaration external_declaration
+%type <interm.intermNode> for_init_statement compound_statement_no_new_scope
+%type <interm.nodePair> selection_rest_statement for_rest_statement
+%type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope
+%type <interm> single_declaration init_declarator_list
+
+%type <interm> parameter_declaration parameter_declarator parameter_type_specifier
+%type <interm.qualifier> parameter_qualifier
+
+%type <interm.precision> precision_qualifier
+%type <interm.type> type_qualifier fully_specified_type type_specifier
+%type <interm.type> type_specifier_no_prec type_specifier_nonarray
+%type <interm.type> struct_specifier
+%type <interm.typeLine> struct_declarator
+%type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list
+%type <interm.function> function_header function_declarator function_identifier
+%type <interm.function> function_header_with_parameters function_call_header
+%type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
+%type <interm> function_call_or_method
+
+%start translation_unit
+%%
+
+variable_identifier
+ : IDENTIFIER {
+ // The symbol table search was done in the lexical phase
+ const TSymbol* symbol = $1.symbol;
+ const TVariable* variable;
+ if (symbol == 0) {
+ context->error($1.line, "undeclared identifier", $1.string->c_str(), "");
+ context->recover();
+ TType type(EbtFloat, EbpUndefined);
+ TVariable* fakeVariable = new TVariable($1.string, type);
+ context->symbolTable.insert(*fakeVariable);
+ variable = fakeVariable;
+ } else {
+ // This identifier can only be a variable type symbol
+ if (! symbol->isVariable()) {
+ context->error($1.line, "variable expected", $1.string->c_str(), "");
+ context->recover();
+ }
+ variable = static_cast<const TVariable*>(symbol);
+ }
+
+ // don't delete $1.string, it's used by error recovery, and the pool
+ // pop will reclaim the memory
+
+ if (variable->getType().getQualifier() == EvqConst ) {
+ ConstantUnion* constArray = variable->getConstPointer();
+ TType t(variable->getType());
+ $$ = context->intermediate.addConstantUnion(constArray, t, $1.line);
+ } else
+ $$ = context->intermediate.addSymbol(variable->getUniqueId(),
+ variable->getName(),
+ variable->getType(), $1.line);
+ }
+ ;
+
+primary_expression
+ : variable_identifier {
+ $$ = $1;
+ }
+ | INTCONSTANT {
+ //
+ // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
+ // check for overflow for constants
+ //
+ if (abs($1.i) >= (1 << 16)) {
+ context->error($1.line, " integer constant overflow", "", "");
+ context->recover();
+ }
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst($1.i);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $1.line);
+ }
+ | FLOATCONSTANT {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setFConst($1.f);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), $1.line);
+ }
+ | BOOLCONSTANT {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst($1.b);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $1.line);
+ }
+ | LEFT_PAREN expression RIGHT_PAREN {
+ $$ = $2;
+ }
+ ;
+
+postfix_expression
+ : primary_expression {
+ $$ = $1;
+ }
+ | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
+ if (!$1->isArray() && !$1->isMatrix() && !$1->isVector()) {
+ if ($1->getAsSymbolNode())
+ context->error($2.line, " left of '[' is not of type array, matrix, or vector ", $1->getAsSymbolNode()->getSymbol().c_str(), "");
+ else
+ context->error($2.line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
+ context->recover();
+ }
+ if ($1->getType().getQualifier() == EvqConst && $3->getQualifier() == EvqConst) {
+ if ($1->isArray()) { // constant folding for arrays
+ $$ = context->addConstArrayNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
+ } else if ($1->isVector()) { // constant folding for vectors
+ TVectorFields fields;
+ fields.num = 1;
+ fields.offsets[0] = $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
+ $$ = context->addConstVectorNode(fields, $1, $2.line);
+ } else if ($1->isMatrix()) { // constant folding for matrices
+ $$ = context->addConstMatrixNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
+ }
+ } else {
+ if ($3->getQualifier() == EvqConst) {
+ if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !$1->isArray() ) {
+ context->error($2.line, "", "[", "field selection out of range '%d'", $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
+ context->recover();
+ } else {
+ if ($1->isArray()) {
+ if ($1->getType().getArraySize() == 0) {
+ if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
+ if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, $2.line))
+ context->recover();
+ } else {
+ if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), 0, false, $2.line))
+ context->recover();
+ }
+ } else if ( $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= $1->getType().getArraySize()) {
+ context->error($2.line, "", "[", "array index out of range '%d'", $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
+ context->recover();
+ }
+ }
+ $$ = context->intermediate.addIndex(EOpIndexDirect, $1, $3, $2.line);
+ }
+ } else {
+ if ($1->isArray() && $1->getType().getArraySize() == 0) {
+ context->error($2.line, "", "[", "array must be redeclared with a size before being indexed with a variable");
+ context->recover();
+ }
+
+ $$ = context->intermediate.addIndex(EOpIndexIndirect, $1, $3, $2.line);
+ }
+ }
+ if ($$ == 0) {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setFConst(0.0f);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), $2.line);
+ } else if ($1->isArray()) {
+ if ($1->getType().getStruct())
+ $$->setType(TType($1->getType().getStruct(), $1->getType().getTypeName()));
+ else
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, $1->getNominalSize(), $1->isMatrix()));
+
+ if ($1->getType().getQualifier() == EvqConst)
+ $$->getTypePointer()->setQualifier(EvqConst);
+ } else if ($1->isMatrix() && $1->getType().getQualifier() == EvqConst)
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqConst, $1->getNominalSize()));
+ else if ($1->isMatrix())
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, $1->getNominalSize()));
+ else if ($1->isVector() && $1->getType().getQualifier() == EvqConst)
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqConst));
+ else if ($1->isVector())
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary));
+ else
+ $$->setType($1->getType());
+ }
+ | function_call {
+ $$ = $1;
+ }
+ | postfix_expression DOT FIELD_SELECTION {
+ if ($1->isArray()) {
+ context->error($3.line, "cannot apply dot operator to an array", ".", "");
+ context->recover();
+ }
+
+ if ($1->isVector()) {
+ TVectorFields fields;
+ if (! context->parseVectorFields(*$3.string, $1->getNominalSize(), fields, $3.line)) {
+ fields.num = 1;
+ fields.offsets[0] = 0;
+ context->recover();
+ }
+
+ if ($1->getType().getQualifier() == EvqConst) { // constant folding for vector fields
+ $$ = context->addConstVectorNode(fields, $1, $3.line);
+ if ($$ == 0) {
+ context->recover();
+ $$ = $1;
+ }
+ else
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqConst, (int) (*$3.string).size()));
+ } else {
+ if (fields.num == 1) {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(fields.offsets[0]);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $3.line);
+ $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
+ $$->setType(TType($1->getBasicType(), $1->getPrecision()));
+ } else {
+ TString vectorString = *$3.string;
+ TIntermTyped* index = context->intermediate.addSwizzle(fields, $3.line);
+ $$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, (int) vectorString.size()));
+ }
+ }
+ } else if ($1->isMatrix()) {
+ TMatrixFields fields;
+ if (! context->parseMatrixFields(*$3.string, $1->getNominalSize(), fields, $3.line)) {
+ fields.wholeRow = false;
+ fields.wholeCol = false;
+ fields.row = 0;
+ fields.col = 0;
+ context->recover();
+ }
+
+ if (fields.wholeRow || fields.wholeCol) {
+ context->error($2.line, " non-scalar fields not implemented yet", ".", "");
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(0);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $3.line);
+ $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
+ $$->setType(TType($1->getBasicType(), $1->getPrecision(),EvqTemporary, $1->getNominalSize()));
+ } else {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(fields.col * $1->getNominalSize() + fields.row);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $3.line);
+ $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
+ $$->setType(TType($1->getBasicType(), $1->getPrecision()));
+ }
+ } else if ($1->getBasicType() == EbtStruct) {
+ bool fieldFound = false;
+ const TTypeList* fields = $1->getType().getStruct();
+ if (fields == 0) {
+ context->error($2.line, "structure has no fields", "Internal Error", "");
+ context->recover();
+ $$ = $1;
+ } else {
+ unsigned int i;
+ for (i = 0; i < fields->size(); ++i) {
+ if ((*fields)[i].type->getFieldName() == *$3.string) {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound) {
+ if ($1->getType().getQualifier() == EvqConst) {
+ $$ = context->addConstStruct(*$3.string, $1, $2.line);
+ if ($$ == 0) {
+ context->recover();
+ $$ = $1;
+ }
+ else {
+ $$->setType(*(*fields)[i].type);
+ // change the qualifier of the return type, not of the structure field
+ // as the structure definition is shared between various structures.
+ $$->getTypePointer()->setQualifier(EvqConst);
+ }
+ } else {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(i);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, $3.line);
+ $$ = context->intermediate.addIndex(EOpIndexDirectStruct, $1, index, $2.line);
+ $$->setType(*(*fields)[i].type);
+ }
+ } else {
+ context->error($2.line, " no such field in structure", $3.string->c_str(), "");
+ context->recover();
+ $$ = $1;
+ }
+ }
+ } else {
+ context->error($2.line, " field selection requires structure, vector, or matrix on left hand side", $3.string->c_str(), "");
+ context->recover();
+ $$ = $1;
+ }
+ // don't delete $3.string, it's from the pool
+ }
+ | postfix_expression INC_OP {
+ if (context->lValueErrorCheck($2.line, "++", $1))
+ context->recover();
+ $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->unaryOpError($2.line, "++", $1->getCompleteString());
+ context->recover();
+ $$ = $1;
+ }
+ }
+ | postfix_expression DEC_OP {
+ if (context->lValueErrorCheck($2.line, "--", $1))
+ context->recover();
+ $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->unaryOpError($2.line, "--", $1->getCompleteString());
+ context->recover();
+ $$ = $1;
+ }
+ }
+ ;
+
+integer_expression
+ : expression {
+ if (context->integerErrorCheck($1, "[]"))
+ context->recover();
+ $$ = $1;
+ }
+ ;
+
+function_call
+ : function_call_or_method {
+ TFunction* fnCall = $1.function;
+ TOperator op = fnCall->getBuiltInOp();
+
+ if (op != EOpNull)
+ {
+ //
+ // Then this should be a constructor.
+ // Don't go through the symbol table for constructors.
+ // Their parameters will be verified algorithmically.
+ //
+ TType type(EbtVoid, EbpUndefined); // use this to get the type back
+ if (context->constructorErrorCheck($1.line, $1.intermNode, *fnCall, op, &type)) {
+ $$ = 0;
+ } else {
+ //
+ // It's a constructor, of type 'type'.
+ //
+ $$ = context->addConstructor($1.intermNode, &type, op, fnCall, $1.line);
+ }
+
+ if ($$ == 0) {
+ context->recover();
+ $$ = context->intermediate.setAggregateOperator(0, op, $1.line);
+ }
+ $$->setType(type);
+ } else {
+ //
+ // Not a constructor. Find it in the symbol table.
+ //
+ const TFunction* fnCandidate;
+ bool builtIn;
+ fnCandidate = context->findFunction($1.line, fnCall, &builtIn);
+ if (fnCandidate) {
+ //
+ // A declared function.
+ //
+ if (builtIn && !fnCandidate->getExtension().empty() &&
+ context->extensionErrorCheck($1.line, fnCandidate->getExtension())) {
+ context->recover();
+ }
+ op = fnCandidate->getBuiltInOp();
+ if (builtIn && op != EOpNull) {
+ //
+ // A function call mapped to a built-in operation.
+ //
+ if (fnCandidate->getParamCount() == 1) {
+ //
+ // Treat it like a built-in unary operator.
+ //
+ $$ = context->intermediate.addUnaryMath(op, $1.intermNode, 0, context->symbolTable);
+ if ($$ == 0) {
+ context->error($1.intermNode->getLine(), " wrong operand type", "Internal Error",
+ "built in unary operator function. Type: %s",
+ static_cast<TIntermTyped*>($1.intermNode)->getCompleteString().c_str());
+ YYERROR;
+ }
+ } else {
+ $$ = context->intermediate.setAggregateOperator($1.intermAggregate, op, $1.line);
+ }
+ } else {
+ // This is a real function call
+
+ $$ = context->intermediate.setAggregateOperator($1.intermAggregate, EOpFunctionCall, $1.line);
+ $$->setType(fnCandidate->getReturnType());
+
+ // this is how we know whether the given function is a builtIn function or a user defined function
+ // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
+ // if builtIn == true, it's definitely a builtIn function with EOpNull
+ if (!builtIn)
+ $$->getAsAggregate()->setUserDefined();
+ $$->getAsAggregate()->setName(fnCandidate->getMangledName());
+
+ TQualifier qual;
+ for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
+ qual = fnCandidate->getParam(i).type->getQualifier();
+ if (qual == EvqOut || qual == EvqInOut) {
+ if (context->lValueErrorCheck($$->getLine(), "assign", $$->getAsAggregate()->getSequence()[i]->getAsTyped())) {
+ context->error($1.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
+ context->recover();
+ }
+ }
+ }
+ }
+ $$->setType(fnCandidate->getReturnType());
+ } else {
+ // error message was put out by PaFindFunction()
+ // Put on a dummy node for error recovery
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setFConst(0.0f);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), $1.line);
+ context->recover();
+ }
+ }
+ delete fnCall;
+ }
+ ;
+
+function_call_or_method
+ : function_call_generic {
+ $$ = $1;
+ }
+ | postfix_expression DOT function_call_generic {
+ context->error($3.line, "methods are not supported", "", "");
+ context->recover();
+ $$ = $3;
+ }
+ ;
+
+function_call_generic
+ : function_call_header_with_parameters RIGHT_PAREN {
+ $$ = $1;
+ $$.line = $2.line;
+ }
+ | function_call_header_no_parameters RIGHT_PAREN {
+ $$ = $1;
+ $$.line = $2.line;
+ }
+ ;
+
+function_call_header_no_parameters
+ : function_call_header VOID_TYPE {
+ $$.function = $1;
+ $$.intermNode = 0;
+ }
+ | function_call_header {
+ $$.function = $1;
+ $$.intermNode = 0;
+ }
+ ;
+
+function_call_header_with_parameters
+ : function_call_header assignment_expression {
+ TParameter param = { 0, new TType($2->getType()) };
+ $1->addParameter(param);
+ $$.function = $1;
+ $$.intermNode = $2;
+ }
+ | function_call_header_with_parameters COMMA assignment_expression {
+ TParameter param = { 0, new TType($3->getType()) };
+ $1.function->addParameter(param);
+ $$.function = $1.function;
+ $$.intermNode = context->intermediate.growAggregate($1.intermNode, $3, $2.line);
+ }
+ ;
+
+function_call_header
+ : function_identifier LEFT_PAREN {
+ $$ = $1;
+ }
+ ;
+
+// Grammar Note: Constructors look like functions, but are recognized as types.
+
+function_identifier
+ : type_specifier {
+ //
+ // Constructor
+ //
+ if ($1.array) {
+ // Constructors for arrays are not allowed.
+ context->error($1.line, "cannot construct this type", "array", "");
+ context->recover();
+ $1.setArray(false);
+ }
+
+ TOperator op = EOpNull;
+ if ($1.userDef) {
+ op = EOpConstructStruct;
+ } else {
+ switch ($1.type) {
+ case EbtFloat:
+ if ($1.matrix) {
+ switch($1.size) {
+ case 2: op = EOpConstructMat2; break;
+ case 3: op = EOpConstructMat3; break;
+ case 4: op = EOpConstructMat4; break;
+ }
+ } else {
+ switch($1.size) {
+ case 1: op = EOpConstructFloat; break;
+ case 2: op = EOpConstructVec2; break;
+ case 3: op = EOpConstructVec3; break;
+ case 4: op = EOpConstructVec4; break;
+ }
+ }
+ break;
+ case EbtInt:
+ switch($1.size) {
+ case 1: op = EOpConstructInt; break;
+ case 2: FRAG_VERT_ONLY("ivec2", $1.line); op = EOpConstructIVec2; break;
+ case 3: FRAG_VERT_ONLY("ivec3", $1.line); op = EOpConstructIVec3; break;
+ case 4: FRAG_VERT_ONLY("ivec4", $1.line); op = EOpConstructIVec4; break;
+ }
+ break;
+ case EbtBool:
+ switch($1.size) {
+ case 1: op = EOpConstructBool; break;
+ case 2: FRAG_VERT_ONLY("bvec2", $1.line); op = EOpConstructBVec2; break;
+ case 3: FRAG_VERT_ONLY("bvec3", $1.line); op = EOpConstructBVec3; break;
+ case 4: FRAG_VERT_ONLY("bvec4", $1.line); op = EOpConstructBVec4; break;
+ }
+ break;
+ default: break;
+ }
+ if (op == EOpNull) {
+ context->error($1.line, "cannot construct this type", getBasicString($1.type), "");
+ context->recover();
+ $1.type = EbtFloat;
+ op = EOpConstructFloat;
+ }
+ }
+ TString tempString;
+ TType type($1);
+ TFunction *function = new TFunction(&tempString, type, op);
+ $$ = function;
+ }
+ | IDENTIFIER {
+ if (context->reservedErrorCheck($1.line, *$1.string))
+ context->recover();
+ TType type(EbtVoid, EbpUndefined);
+ TFunction *function = new TFunction($1.string, type);
+ $$ = function;
+ }
+ | FIELD_SELECTION {
+ if (context->reservedErrorCheck($1.line, *$1.string))
+ context->recover();
+ TType type(EbtVoid, EbpUndefined);
+ TFunction *function = new TFunction($1.string, type);
+ $$ = function;
+ }
+ ;
+
+unary_expression
+ : postfix_expression {
+ $$ = $1;
+ }
+ | INC_OP unary_expression {
+ if (context->lValueErrorCheck($1.line, "++", $2))
+ context->recover();
+ $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, $1.line, context->symbolTable);
+ if ($$ == 0) {
+ context->unaryOpError($1.line, "++", $2->getCompleteString());
+ context->recover();
+ $$ = $2;
+ }
+ }
+ | DEC_OP unary_expression {
+ if (context->lValueErrorCheck($1.line, "--", $2))
+ context->recover();
+ $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, $1.line, context->symbolTable);
+ if ($$ == 0) {
+ context->unaryOpError($1.line, "--", $2->getCompleteString());
+ context->recover();
+ $$ = $2;
+ }
+ }
+ | unary_operator unary_expression {
+ if ($1.op != EOpNull) {
+ $$ = context->intermediate.addUnaryMath($1.op, $2, $1.line, context->symbolTable);
+ if ($$ == 0) {
+ const char* errorOp = "";
+ switch($1.op) {
+ case EOpNegative: errorOp = "-"; break;
+ case EOpLogicalNot: errorOp = "!"; break;
+ default: break;
+ }
+ context->unaryOpError($1.line, errorOp, $2->getCompleteString());
+ context->recover();
+ $$ = $2;
+ }
+ } else
+ $$ = $2;
+ }
+ ;
+// Grammar Note: No traditional style type casts.
+
+unary_operator
+ : PLUS { $$.line = $1.line; $$.op = EOpNull; }
+ | DASH { $$.line = $1.line; $$.op = EOpNegative; }
+ | BANG { $$.line = $1.line; $$.op = EOpLogicalNot; }
+ ;
+// Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
+
+multiplicative_expression
+ : unary_expression { $$ = $1; }
+ | multiplicative_expression STAR unary_expression {
+ FRAG_VERT_ONLY("*", $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "*", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ $$ = $1;
+ }
+ }
+ | multiplicative_expression SLASH unary_expression {
+ FRAG_VERT_ONLY("/", $2.line);
+ $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "/", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ $$ = $1;
+ }
+ }
+ ;
+
+additive_expression
+ : multiplicative_expression { $$ = $1; }
+ | additive_expression PLUS multiplicative_expression {
+ $$ = context->intermediate.addBinaryMath(EOpAdd, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "+", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ $$ = $1;
+ }
+ }
+ | additive_expression DASH multiplicative_expression {
+ $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "-", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ $$ = $1;
+ }
+ }
+ ;
+
+shift_expression
+ : additive_expression { $$ = $1; }
+ ;
+
+relational_expression
+ : shift_expression { $$ = $1; }
+ | relational_expression LEFT_ANGLE shift_expression {
+ $$ = context->intermediate.addBinaryMath(EOpLessThan, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "<", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ | relational_expression RIGHT_ANGLE shift_expression {
+ $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, ">", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ | relational_expression LE_OP shift_expression {
+ $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "<=", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ | relational_expression GE_OP shift_expression {
+ $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, ">=", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ ;
+
+equality_expression
+ : relational_expression { $$ = $1; }
+ | equality_expression EQ_OP relational_expression {
+ $$ = context->intermediate.addBinaryMath(EOpEqual, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "==", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ | equality_expression NE_OP relational_expression {
+ $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "!=", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ ;
+
+and_expression
+ : equality_expression { $$ = $1; }
+ ;
+
+exclusive_or_expression
+ : and_expression { $$ = $1; }
+ ;
+
+inclusive_or_expression
+ : exclusive_or_expression { $$ = $1; }
+ ;
+
+logical_and_expression
+ : inclusive_or_expression { $$ = $1; }
+ | logical_and_expression AND_OP inclusive_or_expression {
+ $$ = context->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "&&", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ ;
+
+logical_xor_expression
+ : logical_and_expression { $$ = $1; }
+ | logical_xor_expression XOR_OP logical_and_expression {
+ $$ = context->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "^^", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ ;
+
+logical_or_expression
+ : logical_xor_expression { $$ = $1; }
+ | logical_or_expression OR_OP logical_xor_expression {
+ $$ = context->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, $2.line, context->symbolTable);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, "||", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
+ }
+ }
+ ;
+
+conditional_expression
+ : logical_or_expression { $$ = $1; }
+ | logical_or_expression QUESTION expression COLON assignment_expression {
+ if (context->boolErrorCheck($2.line, $1))
+ context->recover();
+
+ $$ = context->intermediate.addSelection($1, $3, $5, $2.line);
+ if ($3->getType() != $5->getType())
+ $$ = 0;
+
+ if ($$ == 0) {
+ context->binaryOpError($2.line, ":", $3->getCompleteString(), $5->getCompleteString());
+ context->recover();
+ $$ = $5;
+ }
+ }
+ ;
+
+assignment_expression
+ : conditional_expression { $$ = $1; }
+ | unary_expression assignment_operator assignment_expression {
+ if (context->lValueErrorCheck($2.line, "assign", $1))
+ context->recover();
+ $$ = context->intermediate.addAssign($2.op, $1, $3, $2.line);
+ if ($$ == 0) {
+ context->assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ $$ = $1;
+ }
+ }
+ ;
+
+assignment_operator
+ : EQUAL { $$.line = $1.line; $$.op = EOpAssign; }
+ | MUL_ASSIGN { FRAG_VERT_ONLY("*=", $1.line); $$.line = $1.line; $$.op = EOpMulAssign; }
+ | DIV_ASSIGN { FRAG_VERT_ONLY("/=", $1.line); $$.line = $1.line; $$.op = EOpDivAssign; }
+ | ADD_ASSIGN { $$.line = $1.line; $$.op = EOpAddAssign; }
+ | SUB_ASSIGN { $$.line = $1.line; $$.op = EOpSubAssign; }
+ ;
+
+expression
+ : assignment_expression {
+ $$ = $1;
+ }
+ | expression COMMA assignment_expression {
+ $$ = context->intermediate.addComma($1, $3, $2.line);
+ if ($$ == 0) {
+ context->binaryOpError($2.line, ",", $1->getCompleteString(), $3->getCompleteString());
+ context->recover();
+ $$ = $3;
+ }
+ }
+ ;
+
+constant_expression
+ : conditional_expression {
+ if (context->constErrorCheck($1))
+ context->recover();
+ $$ = $1;
+ }
+ ;
+
+declaration
+ : function_prototype SEMICOLON {
+ TFunction &function = *($1.function);
+
+ TIntermAggregate *prototype = new TIntermAggregate;
+ prototype->setType(function.getReturnType());
+ prototype->setName(function.getName());
+
+ for (int i = 0; i < function.getParamCount(); i++)
+ {
+ const TParameter &param = function.getParam(i);
+ if (param.name != 0)
+ {
+ TVariable *variable = new TVariable(param.name, *param.type);
+
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), $1.line), $1.line);
+ }
+ else
+ {
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, $1.line), $1.line);
+ }
+ }
+
+ prototype->setOp(EOpPrototype);
+ $$ = prototype;
+ }
+ | init_declarator_list SEMICOLON {
+ if ($1.intermAggregate)
+ $1.intermAggregate->setOp(EOpDeclaration);
+ $$ = $1.intermAggregate;
+ }
+ | PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
+ context->symbolTable.setDefaultPrecision( $3.type, $2 );
+ $$ = 0;
+ }
+ ;
+
+function_prototype
+ : function_declarator RIGHT_PAREN {
+ //
+ // Multiple declarations of the same function are allowed.
+ //
+ // If this is a definition, the definition production code will check for redefinitions
+ // (we don't know at this point if it's a definition or not).
+ //
+ // Redeclarations are allowed. But, return types and parameter qualifiers must match.
+ //
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find($1->getMangledName()));
+ if (prevDec) {
+ if (prevDec->getReturnType() != $1->getReturnType()) {
+ context->error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString(), "");
+ context->recover();
+ }
+ for (int i = 0; i < prevDec->getParamCount(); ++i) {
+ if (prevDec->getParam(i).type->getQualifier() != $1->getParam(i).type->getQualifier()) {
+ context->error($2.line, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString(), "");
+ context->recover();
+ }
+ }
+ }
+
+ //
+ // If this is a redeclaration, it could also be a definition,
+ // in which case, we want to use the variable names from this one, and not the one that's
+ // being redeclared. So, pass back up this declaration, not the one in the symbol table.
+ //
+ $$.function = $1;
+ $$.line = $2.line;
+
+ context->symbolTable.insert(*$$.function);
+ }
+ ;
+
+function_declarator
+ : function_header {
+ $$ = $1;
+ }
+ | function_header_with_parameters {
+ $$ = $1;
+ }
+ ;
+
+
+function_header_with_parameters
+ : function_header parameter_declaration {
+ // Add the parameter
+ $$ = $1;
+ if ($2.param.type->getBasicType() != EbtVoid)
+ $1->addParameter($2.param);
+ else
+ delete $2.param.type;
+ }
+ | function_header_with_parameters COMMA parameter_declaration {
+ //
+ // Only first parameter of one-parameter functions can be void
+ // The check for named parameters not being void is done in parameter_declarator
+ //
+ if ($3.param.type->getBasicType() == EbtVoid) {
+ //
+ // This parameter > first is void
+ //
+ context->error($2.line, "cannot be an argument type except for '(void)'", "void", "");
+ context->recover();
+ delete $3.param.type;
+ } else {
+ // Add the parameter
+ $$ = $1;
+ $1->addParameter($3.param);
+ }
+ }
+ ;
+
+function_header
+ : fully_specified_type IDENTIFIER LEFT_PAREN {
+ if ($1.qualifier != EvqGlobal && $1.qualifier != EvqTemporary) {
+ context->error($2.line, "no qualifiers allowed for function return", getQualifierString($1.qualifier), "");
+ context->recover();
+ }
+ // make sure a sampler is not involved as well...
+ if (context->structQualifierErrorCheck($2.line, $1))
+ context->recover();
+
+ // Add the function as a prototype after parsing it (we do not support recursion)
+ TFunction *function;
+ TType type($1);
+ function = new TFunction($2.string, type);
+ $$ = function;
+ }
+ ;
+
+parameter_declarator
+ // Type + name
+ : type_specifier IDENTIFIER {
+ if ($1.type == EbtVoid) {
+ context->error($2.line, "illegal use of type 'void'", $2.string->c_str(), "");
+ context->recover();
+ }
+ if (context->reservedErrorCheck($2.line, *$2.string))
+ context->recover();
+ TParameter param = {$2.string, new TType($1)};
+ $$.line = $2.line;
+ $$.param = param;
+ }
+ | type_specifier IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
+ // Check that we can make an array out of this type
+ if (context->arrayTypeErrorCheck($3.line, $1))
+ context->recover();
+
+ if (context->reservedErrorCheck($2.line, *$2.string))
+ context->recover();
+
+ int size;
+ if (context->arraySizeErrorCheck($3.line, $4, size))
+ context->recover();
+ $1.setArray(true, size);
+
+ TType* type = new TType($1);
+ TParameter param = { $2.string, type };
+ $$.line = $2.line;
+ $$.param = param;
+ }
+ ;
+
+parameter_declaration
+ //
+ // The only parameter qualifier a parameter can have are
+ // IN_QUAL, OUT_QUAL, INOUT_QUAL, or CONST.
+ //
+
+ //
+ // Type + name
+ //
+ : type_qualifier parameter_qualifier parameter_declarator {
+ $$ = $3;
+ if (context->paramErrorCheck($3.line, $1.qualifier, $2, $$.param.type))
+ context->recover();
+ }
+ | parameter_qualifier parameter_declarator {
+ $$ = $2;
+ if (context->parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
+ context->recover();
+ if (context->paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
+ context->recover();
+ }
+ //
+ // Only type
+ //
+ | type_qualifier parameter_qualifier parameter_type_specifier {
+ $$ = $3;
+ if (context->paramErrorCheck($3.line, $1.qualifier, $2, $$.param.type))
+ context->recover();
+ }
+ | parameter_qualifier parameter_type_specifier {
+ $$ = $2;
+ if (context->parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
+ context->recover();
+ if (context->paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
+ context->recover();
+ }
+ ;
+
+parameter_qualifier
+ : /* empty */ {
+ $$ = EvqIn;
+ }
+ | IN_QUAL {
+ $$ = EvqIn;
+ }
+ | OUT_QUAL {
+ $$ = EvqOut;
+ }
+ | INOUT_QUAL {
+ $$ = EvqInOut;
+ }
+ ;
+
+parameter_type_specifier
+ : type_specifier {
+ TParameter param = { 0, new TType($1) };
+ $$.param = param;
+ }
+ ;
+
+init_declarator_list
+ : single_declaration {
+ $$ = $1;
+
+ if ($$.type.precision == EbpUndefined) {
+ $$.type.precision = context->symbolTable.getDefaultPrecision($1.type.type);
+ if (context->precisionErrorCheck($1.line, $$.type.precision, $1.type.type)) {
+ context->recover();
+ }
+ }
+ }
+ | init_declarator_list COMMA IDENTIFIER {
+ $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(0, *$3.string, TType($1.type), $3.line), $3.line);
+
+ if (context->structQualifierErrorCheck($3.line, $$.type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck($3.line, *$3.string, $$.type))
+ context->recover();
+
+ if (context->nonInitErrorCheck($3.line, *$3.string, $$.type))
+ context->recover();
+ }
+ | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
+ if (context->structQualifierErrorCheck($3.line, $1.type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type))
+ context->recover();
+
+ $$ = $1;
+
+ if (context->arrayTypeErrorCheck($4.line, $1.type) || context->arrayQualifierErrorCheck($4.line, $1.type))
+ context->recover();
+ else {
+ $1.type.setArray(true);
+ TVariable* variable;
+ if (context->arrayErrorCheck($4.line, *$3.string, $1.type, variable))
+ context->recover();
+ }
+ }
+ | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
+ if (context->structQualifierErrorCheck($3.line, $1.type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type))
+ context->recover();
+
+ $$ = $1;
+
+ if (context->arrayTypeErrorCheck($4.line, $1.type) || context->arrayQualifierErrorCheck($4.line, $1.type))
+ context->recover();
+ else {
+ int size;
+ if (context->arraySizeErrorCheck($4.line, $5, size))
+ context->recover();
+ $1.type.setArray(true, size);
+ TVariable* variable;
+ if (context->arrayErrorCheck($4.line, *$3.string, $1.type, variable))
+ context->recover();
+ TType type = TType($1.type);
+ type.setArraySize(size);
+ $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(0, *$3.string, type, $3.line), $3.line);
+ }
+ }
+ | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
+ if (context->structQualifierErrorCheck($3.line, $1.type))
+ context->recover();
+
+ $$ = $1;
+
+ TIntermNode* intermNode;
+ if (!context->executeInitializer($3.line, *$3.string, $1.type, $5, intermNode)) {
+ //
+ // build the intermediate representation
+ //
+ if (intermNode)
+ $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, intermNode, $4.line);
+ else
+ $$.intermAggregate = $1.intermAggregate;
+ } else {
+ context->recover();
+ $$.intermAggregate = 0;
+ }
+ }
+ ;
+
+single_declaration
+ : fully_specified_type {
+ $$.type = $1;
+ $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType($1), $1.line), $1.line);
+ }
+ | fully_specified_type IDENTIFIER {
+ $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line);
+
+ if (context->structQualifierErrorCheck($2.line, $$.type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck($2.line, *$2.string, $$.type))
+ context->recover();
+
+ $$.type = $1;
+
+ if (context->nonInitErrorCheck($2.line, *$2.string, $$.type))
+ context->recover();
+ }
+ | fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
+ $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, TType($1), $2.line), $2.line);
+
+ if (context->structQualifierErrorCheck($2.line, $1))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
+ context->recover();
+
+ $$.type = $1;
+
+ if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifierErrorCheck($3.line, $1))
+ context->recover();
+ else {
+ $1.setArray(true);
+ TVariable* variable;
+ if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
+ context->recover();
+ }
+ }
+ | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
+ TType type = TType($1);
+ int size;
+ if (context->arraySizeErrorCheck($2.line, $4, size))
+ context->recover();
+ type.setArraySize(size);
+ $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *$2.string, type, $2.line), $2.line);
+
+ if (context->structQualifierErrorCheck($2.line, $1))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
+ context->recover();
+
+ $$.type = $1;
+
+ if (context->arrayTypeErrorCheck($3.line, $1) || context->arrayQualifierErrorCheck($3.line, $1))
+ context->recover();
+ else {
+ int size;
+ if (context->arraySizeErrorCheck($3.line, $4, size))
+ context->recover();
+
+ $1.setArray(true, size);
+ TVariable* variable;
+ if (context->arrayErrorCheck($3.line, *$2.string, $1, variable))
+ context->recover();
+ }
+ }
+ | fully_specified_type IDENTIFIER EQUAL initializer {
+ if (context->structQualifierErrorCheck($2.line, $1))
+ context->recover();
+
+ $$.type = $1;
+
+ TIntermNode* intermNode;
+ if (!context->executeInitializer($2.line, *$2.string, $1, $4, intermNode)) {
+ //
+ // Build intermediate representation
+ //
+ if(intermNode)
+ $$.intermAggregate = context->intermediate.makeAggregate(intermNode, $3.line);
+ else
+ $$.intermAggregate = 0;
+ } else {
+ context->recover();
+ $$.intermAggregate = 0;
+ }
+ }
+ | INVARIANT IDENTIFIER {
+ VERTEX_ONLY("invariant declaration", $1.line);
+ $$.qualifier = EvqInvariantVaryingOut;
+ $$.intermAggregate = 0;
+ }
+
+//
+// Place holder for the pack/unpack languages.
+//
+// | buffer_specifier {
+// $$.intermAggregate = 0;
+// }
+ ;
+
+// Grammar Note: No 'enum', or 'typedef'.
+
+//
+// Place holder for the pack/unpack languages.
+//
+//%type <interm> buffer_declaration
+//%type <interm.type> buffer_specifier input_or_output buffer_declaration_list
+//buffer_specifier
+// : input_or_output LEFT_BRACE buffer_declaration_list RIGHT_BRACE {
+// }
+// ;
+//
+//input_or_output
+// : INPUT {
+// if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "input"))
+// context->recover();
+// UNPACK_ONLY("input", $1.line);
+// $$.qualifier = EvqInput;
+// }
+// | OUTPUT {
+// if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "output"))
+// context->recover();
+// PACK_ONLY("output", $1.line);
+// $$.qualifier = EvqOutput;
+// }
+// ;
+
+//
+// Place holder for the pack/unpack languages.
+//
+//buffer_declaration_list
+// : buffer_declaration {
+// }
+// | buffer_declaration_list buffer_declaration {
+// }
+// ;
+
+//
+// Input/output semantics:
+// float must be 16 or 32 bits
+// float alignment restrictions?
+// check for only one input and only one output
+// sum of bitfields has to be multiple of 32
+//
+
+//
+// Place holder for the pack/unpack languages.
+//
+//buffer_declaration
+// : type_specifier IDENTIFIER COLON constant_expression SEMICOLON {
+// if (context->reservedErrorCheck($2.line, *$2.string, context))
+// context->recover();
+// $$.variable = new TVariable($2.string, $1);
+// if (! context->symbolTable.insert(*$$.variable)) {
+// context->error($2.line, "redefinition", $$.variable->getName().c_str(), "");
+// context->recover();
+// // don't have to delete $$.variable, the pool pop will take care of it
+// }
+// }
+// ;
+
+fully_specified_type
+ : type_specifier {
+ $$ = $1;
+
+ if ($1.array) {
+ context->error($1.line, "not supported", "first-class array", "");
+ context->recover();
+ $1.setArray(false);
+ }
+ }
+ | type_qualifier type_specifier {
+ if ($2.array) {
+ context->error($2.line, "not supported", "first-class array", "");
+ context->recover();
+ $2.setArray(false);
+ }
+
+ if ($1.qualifier == EvqAttribute &&
+ ($2.type == EbtBool || $2.type == EbtInt)) {
+ context->error($2.line, "cannot be bool or int", getQualifierString($1.qualifier), "");
+ context->recover();
+ }
+ if (($1.qualifier == EvqVaryingIn || $1.qualifier == EvqVaryingOut) &&
+ ($2.type == EbtBool || $2.type == EbtInt)) {
+ context->error($2.line, "cannot be bool or int", getQualifierString($1.qualifier), "");
+ context->recover();
+ }
+ $$ = $2;
+ $$.qualifier = $1.qualifier;
+ }
+ ;
+
+type_qualifier
+ : CONST_QUAL {
+ $$.setBasic(EbtVoid, EvqConst, $1.line);
+ }
+ | ATTRIBUTE {
+ VERTEX_ONLY("attribute", $1.line);
+ if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "attribute"))
+ context->recover();
+ $$.setBasic(EbtVoid, EvqAttribute, $1.line);
+ }
+ | VARYING {
+ if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "varying"))
+ context->recover();
+ if (context->shaderType == SH_VERTEX_SHADER)
+ $$.setBasic(EbtVoid, EvqVaryingOut, $1.line);
+ else
+ $$.setBasic(EbtVoid, EvqVaryingIn, $1.line);
+ }
+ | INVARIANT VARYING {
+ if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "invariant varying"))
+ context->recover();
+ if (context->shaderType == SH_VERTEX_SHADER)
+ $$.setBasic(EbtVoid, EvqInvariantVaryingOut, $1.line);
+ else
+ $$.setBasic(EbtVoid, EvqInvariantVaryingIn, $1.line);
+ }
+ | UNIFORM {
+ if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "uniform"))
+ context->recover();
+ $$.setBasic(EbtVoid, EvqUniform, $1.line);
+ }
+ ;
+
+type_specifier
+ : type_specifier_no_prec {
+ $$ = $1;
+ }
+ | precision_qualifier type_specifier_no_prec {
+ $$ = $2;
+ $$.precision = $1;
+ }
+ ;
+
+precision_qualifier
+ : HIGH_PRECISION {
+ $$ = EbpHigh;
+ }
+ | MEDIUM_PRECISION {
+ $$ = EbpMedium;
+ }
+ | LOW_PRECISION {
+ $$ = EbpLow;
+ }
+ ;
+
+type_specifier_no_prec
+ : type_specifier_nonarray {
+ $$ = $1;
+ }
+ | type_specifier_nonarray LEFT_BRACKET constant_expression RIGHT_BRACKET {
+ $$ = $1;
+
+ if (context->arrayTypeErrorCheck($2.line, $1))
+ context->recover();
+ else {
+ int size;
+ if (context->arraySizeErrorCheck($2.line, $3, size))
+ context->recover();
+ $$.setArray(true, size);
+ }
+ }
+ ;
+
+type_specifier_nonarray
+ : VOID_TYPE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtVoid, qual, $1.line);
+ }
+ | FLOAT_TYPE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, $1.line);
+ }
+ | INT_TYPE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtInt, qual, $1.line);
+ }
+ | BOOL_TYPE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtBool, qual, $1.line);
+ }
+// | UNSIGNED INT_TYPE {
+// PACK_UNPACK_ONLY("unsigned", $1.line);
+// TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+// $$.setBasic(EbtInt, qual, $1.line);
+// }
+ | VEC2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setAggregate(2);
+ }
+ | VEC3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setAggregate(3);
+ }
+ | VEC4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setAggregate(4);
+ }
+ | BVEC2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtBool, qual, $1.line);
+ $$.setAggregate(2);
+ }
+ | BVEC3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtBool, qual, $1.line);
+ $$.setAggregate(3);
+ }
+ | BVEC4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtBool, qual, $1.line);
+ $$.setAggregate(4);
+ }
+ | IVEC2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtInt, qual, $1.line);
+ $$.setAggregate(2);
+ }
+ | IVEC3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtInt, qual, $1.line);
+ $$.setAggregate(3);
+ }
+ | IVEC4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtInt, qual, $1.line);
+ $$.setAggregate(4);
+ }
+ | MATRIX2 {
+ FRAG_VERT_ONLY("mat2", $1.line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setAggregate(2, true);
+ }
+ | MATRIX3 {
+ FRAG_VERT_ONLY("mat3", $1.line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setAggregate(3, true);
+ }
+ | MATRIX4 {
+ FRAG_VERT_ONLY("mat4", $1.line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, $1.line);
+ $$.setAggregate(4, true);
+ }
+ | SAMPLER2D {
+ FRAG_VERT_ONLY("sampler2D", $1.line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler2D, qual, $1.line);
+ }
+ | SAMPLERCUBE {
+ FRAG_VERT_ONLY("samplerCube", $1.line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSamplerCube, qual, $1.line);
+ }
+ | struct_specifier {
+ FRAG_VERT_ONLY("struct", $1.line);
+ $$ = $1;
+ $$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ }
+ | TYPE_NAME {
+ //
+ // This is for user defined type names. The lexical phase looked up the
+ // type.
+ //
+ TType& structure = static_cast<TVariable*>($1.symbol)->getType();
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtStruct, qual, $1.line);
+ $$.userDef = &structure;
+ }
+ ;
+
+struct_specifier
+ : STRUCT IDENTIFIER LEFT_BRACE struct_declaration_list RIGHT_BRACE {
+ if (context->reservedErrorCheck($2.line, *$2.string))
+ context->recover();
+
+ TType* structure = new TType($4, *$2.string);
+ TVariable* userTypeDef = new TVariable($2.string, *structure, true);
+ if (! context->symbolTable.insert(*userTypeDef)) {
+ context->error($2.line, "redefinition", $2.string->c_str(), "struct");
+ context->recover();
+ }
+ $$.setBasic(EbtStruct, EvqTemporary, $1.line);
+ $$.userDef = structure;
+ }
+ | STRUCT LEFT_BRACE struct_declaration_list RIGHT_BRACE {
+ TType* structure = new TType($3, TString(""));
+ $$.setBasic(EbtStruct, EvqTemporary, $1.line);
+ $$.userDef = structure;
+ }
+ ;
+
+struct_declaration_list
+ : struct_declaration {
+ $$ = $1;
+ }
+ | struct_declaration_list struct_declaration {
+ $$ = $1;
+ for (unsigned int i = 0; i < $2->size(); ++i) {
+ for (unsigned int j = 0; j < $$->size(); ++j) {
+ if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) {
+ context->error((*$2)[i].line, "duplicate field name in structure:", "struct", (*$2)[i].type->getFieldName().c_str());
+ context->recover();
+ }
+ }
+ $$->push_back((*$2)[i]);
+ }
+ }
+ ;
+
+struct_declaration
+ : type_specifier struct_declarator_list SEMICOLON {
+ $$ = $2;
+
+ if (context->voidErrorCheck($1.line, (*$2)[0].type->getFieldName(), $1)) {
+ context->recover();
+ }
+ for (unsigned int i = 0; i < $$->size(); ++i) {
+ //
+ // Careful not to replace already known aspects of type, like array-ness
+ //
+ TType* type = (*$$)[i].type;
+ type->setBasicType($1.type);
+ type->setNominalSize($1.size);
+ type->setMatrix($1.matrix);
+
+ // don't allow arrays of arrays
+ if (type->isArray()) {
+ if (context->arrayTypeErrorCheck($1.line, $1))
+ context->recover();
+ }
+ if ($1.array)
+ type->setArraySize($1.arraySize);
+ if ($1.userDef) {
+ type->setStruct($1.userDef->getStruct());
+ type->setTypeName($1.userDef->getTypeName());
+ }
+ }
+ }
+ ;
+
+struct_declarator_list
+ : struct_declarator {
+ $$ = NewPoolTTypeList();
+ $$->push_back($1);
+ }
+ | struct_declarator_list COMMA struct_declarator {
+ $$->push_back($3);
+ }
+ ;
+
+struct_declarator
+ : IDENTIFIER {
+ if (context->reservedErrorCheck($1.line, *$1.string))
+ context->recover();
+
+ $$.type = new TType(EbtVoid, EbpUndefined);
+ $$.line = $1.line;
+ $$.type->setFieldName(*$1.string);
+ }
+ | IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
+ if (context->reservedErrorCheck($1.line, *$1.string))
+ context->recover();
+
+ $$.type = new TType(EbtVoid, EbpUndefined);
+ $$.line = $1.line;
+ $$.type->setFieldName(*$1.string);
+
+ int size;
+ if (context->arraySizeErrorCheck($2.line, $3, size))
+ context->recover();
+ $$.type->setArraySize(size);
+ }
+ ;
+
+initializer
+ : assignment_expression { $$ = $1; }
+ ;
+
+declaration_statement
+ : declaration { $$ = $1; }
+ ;
+
+statement
+ : compound_statement { $$ = $1; }
+ | simple_statement { $$ = $1; }
+ ;
+
+// Grammar Note: No labeled statements; 'goto' is not supported.
+
+simple_statement
+ : declaration_statement { $$ = $1; }
+ | expression_statement { $$ = $1; }
+ | selection_statement { $$ = $1; }
+ | iteration_statement { $$ = $1; }
+ | jump_statement { $$ = $1; }
+ ;
+
+compound_statement
+ : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
+ | LEFT_BRACE { context->symbolTable.push(); } statement_list { context->symbolTable.pop(); } RIGHT_BRACE {
+ if ($3 != 0)
+ $3->setOp(EOpSequence);
+ $$ = $3;
+ }
+ ;
+
+statement_no_new_scope
+ : compound_statement_no_new_scope { $$ = $1; }
+ | simple_statement { $$ = $1; }
+ ;
+
+compound_statement_no_new_scope
+ // Statement that doesn't create a new scope, for selection_statement, iteration_statement
+ : LEFT_BRACE RIGHT_BRACE {
+ $$ = 0;
+ }
+ | LEFT_BRACE statement_list RIGHT_BRACE {
+ if ($2)
+ $2->setOp(EOpSequence);
+ $$ = $2;
+ }
+ ;
+
+statement_list
+ : statement {
+ $$ = context->intermediate.makeAggregate($1, 0);
+ }
+ | statement_list statement {
+ $$ = context->intermediate.growAggregate($1, $2, 0);
+ }
+ ;
+
+expression_statement
+ : SEMICOLON { $$ = 0; }
+ | expression SEMICOLON { $$ = static_cast<TIntermNode*>($1); }
+ ;
+
+selection_statement
+ : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
+ if (context->boolErrorCheck($1.line, $3))
+ context->recover();
+ $$ = context->intermediate.addSelection($3, $5, $1.line);
+ }
+ ;
+
+selection_rest_statement
+ : statement ELSE statement {
+ $$.node1 = $1;
+ $$.node2 = $3;
+ }
+ | statement {
+ $$.node1 = $1;
+ $$.node2 = 0;
+ }
+ ;
+
+// Grammar Note: No 'switch'. Switch statements not supported.
+
+condition
+ // In 1996 c++ draft, conditions can include single declarations
+ : expression {
+ $$ = $1;
+ if (context->boolErrorCheck($1->getLine(), $1))
+ context->recover();
+ }
+ | fully_specified_type IDENTIFIER EQUAL initializer {
+ TIntermNode* intermNode;
+ if (context->structQualifierErrorCheck($2.line, $1))
+ context->recover();
+ if (context->boolErrorCheck($2.line, $1))
+ context->recover();
+
+ if (!context->executeInitializer($2.line, *$2.string, $1, $4, intermNode))
+ $$ = $4;
+ else {
+ context->recover();
+ $$ = 0;
+ }
+ }
+ ;
+
+iteration_statement
+ : WHILE LEFT_PAREN { context->symbolTable.push(); ++context->loopNestingLevel; } condition RIGHT_PAREN statement_no_new_scope {
+ context->symbolTable.pop();
+ $$ = context->intermediate.addLoop(ELoopWhile, 0, $4, 0, $6, $1.line);
+ --context->loopNestingLevel;
+ }
+ | DO { ++context->loopNestingLevel; } statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
+ if (context->boolErrorCheck($8.line, $6))
+ context->recover();
+
+ $$ = context->intermediate.addLoop(ELoopDoWhile, 0, $6, 0, $3, $4.line);
+ --context->loopNestingLevel;
+ }
+ | FOR LEFT_PAREN { context->symbolTable.push(); ++context->loopNestingLevel; } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
+ context->symbolTable.pop();
+ $$ = context->intermediate.addLoop(ELoopFor, $4, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), $7, $1.line);
+ --context->loopNestingLevel;
+ }
+ ;
+
+for_init_statement
+ : expression_statement {
+ $$ = $1;
+ }
+ | declaration_statement {
+ $$ = $1;
+ }
+ ;
+
+conditionopt
+ : condition {
+ $$ = $1;
+ }
+ | /* May be null */ {
+ $$ = 0;
+ }
+ ;
+
+for_rest_statement
+ : conditionopt SEMICOLON {
+ $$.node1 = $1;
+ $$.node2 = 0;
+ }
+ | conditionopt SEMICOLON expression {
+ $$.node1 = $1;
+ $$.node2 = $3;
+ }
+ ;
+
+jump_statement
+ : CONTINUE SEMICOLON {
+ if (context->loopNestingLevel <= 0) {
+ context->error($1.line, "continue statement only allowed in loops", "", "");
+ context->recover();
+ }
+ $$ = context->intermediate.addBranch(EOpContinue, $1.line);
+ }
+ | BREAK SEMICOLON {
+ if (context->loopNestingLevel <= 0) {
+ context->error($1.line, "break statement only allowed in loops", "", "");
+ context->recover();
+ }
+ $$ = context->intermediate.addBranch(EOpBreak, $1.line);
+ }
+ | RETURN SEMICOLON {
+ $$ = context->intermediate.addBranch(EOpReturn, $1.line);
+ if (context->currentFunctionType->getBasicType() != EbtVoid) {
+ context->error($1.line, "non-void function must return a value", "return", "");
+ context->recover();
+ }
+ }
+ | RETURN expression SEMICOLON {
+ $$ = context->intermediate.addBranch(EOpReturn, $2, $1.line);
+ context->functionReturnsValue = true;
+ if (context->currentFunctionType->getBasicType() == EbtVoid) {
+ context->error($1.line, "void function cannot return a value", "return", "");
+ context->recover();
+ } else if (*(context->currentFunctionType) != $2->getType()) {
+ context->error($1.line, "function return is not matching type:", "return", "");
+ context->recover();
+ }
+ }
+ | DISCARD SEMICOLON {
+ FRAG_ONLY("discard", $1.line);
+ $$ = context->intermediate.addBranch(EOpKill, $1.line);
+ }
+ ;
+
+// Grammar Note: No 'goto'. Gotos are not supported.
+
+translation_unit
+ : external_declaration {
+ $$ = $1;
+ context->treeRoot = $$;
+ }
+ | translation_unit external_declaration {
+ $$ = context->intermediate.growAggregate($1, $2, 0);
+ context->treeRoot = $$;
+ }
+ ;
+
+external_declaration
+ : function_definition {
+ $$ = $1;
+ }
+ | declaration {
+ $$ = $1;
+ }
+ ;
+
+function_definition
+ : function_prototype {
+ TFunction* function = $1.function;
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
+ //
+ // Note: 'prevDec' could be 'function' if this is the first time we've seen function
+ // as it would have just been put in the symbol table. Otherwise, we're looking up
+ // an earlier occurance.
+ //
+ if (prevDec->isDefined()) {
+ //
+ // Then this function already has a body.
+ //
+ context->error($1.line, "function already has a body", function->getName().c_str(), "");
+ context->recover();
+ }
+ prevDec->setDefined();
+
+ //
+ // Raise error message if main function takes any parameters or return anything other than void
+ //
+ if (function->getName() == "main") {
+ if (function->getParamCount() > 0) {
+ context->error($1.line, "function cannot take any parameter(s)", function->getName().c_str(), "");
+ context->recover();
+ }
+ if (function->getReturnType().getBasicType() != EbtVoid) {
+ context->error($1.line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
+ context->recover();
+ }
+ }
+
+ //
+ // New symbol table scope for body of function plus its arguments
+ //
+ context->symbolTable.push();
+
+ //
+ // Remember the return type for later checking for RETURN statements.
+ //
+ context->currentFunctionType = &(prevDec->getReturnType());
+ context->functionReturnsValue = false;
+
+ //
+ // Insert parameters into the symbol table.
+ // If the parameter has no name, it's not an error, just don't insert it
+ // (could be used for unused args).
+ //
+ // Also, accumulate the list of parameters into the HIL, so lower level code
+ // knows where to find parameters.
+ //
+ TIntermAggregate* paramNodes = new TIntermAggregate;
+ for (int i = 0; i < function->getParamCount(); i++) {
+ const TParameter& param = function->getParam(i);
+ if (param.name != 0) {
+ TVariable *variable = new TVariable(param.name, *param.type);
+ //
+ // Insert the parameters with name in the symbol table.
+ //
+ if (! context->symbolTable.insert(*variable)) {
+ context->error($1.line, "redefinition", variable->getName().c_str(), "");
+ context->recover();
+ delete variable;
+ }
+
+ //
+ // Add the parameter to the HIL
+ //
+ paramNodes = context->intermediate.growAggregate(
+ paramNodes,
+ context->intermediate.addSymbol(variable->getUniqueId(),
+ variable->getName(),
+ variable->getType(), $1.line),
+ $1.line);
+ } else {
+ paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, $1.line), $1.line);
+ }
+ }
+ context->intermediate.setAggregateOperator(paramNodes, EOpParameters, $1.line);
+ $1.intermAggregate = paramNodes;
+ context->loopNestingLevel = 0;
+ }
+ compound_statement_no_new_scope {
+ //?? Check that all paths return a value if return type != void ?
+ // May be best done as post process phase on intermediate code
+ if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
+ context->error($1.line, "function does not return a value:", "", $1.function->getName().c_str());
+ context->recover();
+ }
+ context->symbolTable.pop();
+ $$ = context->intermediate.growAggregate($1.intermAggregate, $3, 0);
+ context->intermediate.setAggregateOperator($$, EOpFunction, $1.line);
+ $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
+ $$->getAsAggregate()->setType($1.function->getReturnType());
+
+ // store the pragma information for debug and optimize and other vendor specific
+ // information. This information can be queried from the parse tree
+ $$->getAsAggregate()->setOptimize(context->contextPragma.optimize);
+ $$->getAsAggregate()->setDebug(context->contextPragma.debug);
+ $$->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
+ }
+ ;
+
+%%
+
+int glslang_parse(TParseContext* context) {
+ return yyparse(context);
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp
new file mode 100644
index 0000000..9d5f53f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp
@@ -0,0 +1,3186 @@
+#line 17 "compiler/glslang.l"
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_glslang_lexer.sh. DO NOT EDIT!
+
+
+
+#line 13 "compiler/glslang_lex.cpp"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+/* For convenience, these vars (plus the bison vars far below)
+ are macros in the reentrant scanner. */
+#define yyin yyg->yyin_r
+#define yyout yyg->yyout_r
+#define yyextra yyg->yyextra_r
+#define yyleng yyg->yyleng_r
+#define yytext yyg->yytext_r
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug yyg->yy_flex_debug_r
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yyg->yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yyg->yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin ,yyscanner )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE yylex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ int yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = yyg->yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
+ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+
+void yyrestart (FILE *input_file ,yyscan_t yyscanner );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+void yypop_buffer_state (yyscan_t yyscanner );
+
+static void yyensure_buffer_stack (yyscan_t yyscanner );
+static void yy_load_buffer_state (yyscan_t yyscanner );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+
+void *yyalloc (yy_size_t ,yyscan_t yyscanner );
+void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
+void yyfree (void * ,yyscan_t yyscanner );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (yyscanner); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (yyscanner); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+#define yywrap(n) 1
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+typedef int yy_state_type;
+
+#define yytext_ptr yytext_r
+
+static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
+static int yy_get_next_buffer (yyscan_t yyscanner );
+static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yyg->yytext_ptr = yy_bp; \
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ yyg->yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yyg->yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 145
+#define YY_END_OF_BUFFER 146
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[411] =
+ { 0,
+ 0, 0, 0, 0, 0, 0, 146, 144, 143, 143,
+ 128, 134, 139, 123, 124, 132, 131, 120, 129, 127,
+ 133, 92, 92, 121, 117, 135, 122, 136, 140, 88,
+ 125, 126, 138, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 118, 137, 119, 130, 3, 4, 3,
+ 142, 145, 141, 114, 100, 119, 108, 103, 98, 106,
+ 96, 107, 97, 95, 2, 1, 99, 94, 90, 91,
+ 0, 0, 92, 126, 118, 125, 115, 111, 113, 112,
+ 116, 88, 104, 110, 88, 88, 88, 88, 88, 88,
+
+ 88, 88, 88, 88, 17, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 20, 22,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 105, 109, 5, 141,
+ 0, 1, 94, 0, 0, 93, 89, 101, 102, 48,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 18, 88, 88,
+ 88, 88, 88, 88, 88, 88, 26, 88, 88, 88,
+ 88, 88, 88, 88, 88, 23, 88, 88, 88, 88,
+
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 0, 95,
+ 0, 94, 88, 28, 88, 88, 85, 88, 88, 88,
+ 88, 88, 88, 88, 21, 51, 88, 88, 88, 88,
+ 88, 56, 70, 88, 88, 88, 88, 88, 88, 88,
+ 88, 67, 9, 33, 34, 35, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 54, 29, 88, 88, 88, 88, 88, 88, 36,
+ 37, 38, 27, 88, 88, 88, 15, 42, 43, 44,
+ 49, 12, 88, 88, 88, 88, 81, 82, 83, 88,
+
+ 30, 71, 25, 78, 79, 80, 7, 75, 76, 77,
+ 88, 24, 73, 88, 88, 39, 40, 41, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 68, 88, 88,
+ 88, 88, 88, 88, 88, 50, 88, 87, 88, 88,
+ 19, 88, 88, 88, 88, 69, 64, 59, 88, 88,
+ 88, 88, 88, 74, 55, 88, 62, 32, 88, 84,
+ 63, 47, 57, 88, 88, 88, 88, 88, 88, 88,
+ 88, 58, 31, 88, 88, 88, 8, 88, 88, 88,
+ 88, 88, 52, 13, 88, 14, 88, 88, 16, 65,
+ 88, 88, 88, 60, 88, 88, 88, 53, 72, 61,
+
+ 11, 66, 6, 86, 10, 45, 88, 88, 46, 0
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 4, 1, 1, 1, 5, 6, 1, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 16, 16, 16, 20, 20, 21, 22, 23,
+ 24, 25, 26, 1, 27, 27, 28, 29, 30, 27,
+ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 32, 31, 31,
+ 33, 1, 34, 35, 31, 1, 36, 37, 38, 39,
+
+ 40, 41, 42, 43, 44, 31, 45, 46, 47, 48,
+ 49, 50, 31, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 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, 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,
+ 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, 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, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[64] =
+ { 0,
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
+ 1, 1, 1, 1, 1, 1, 3, 3, 3, 3,
+ 4, 4, 1, 1, 1, 3, 3, 3, 3, 3,
+ 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
+ 1, 1, 1
+ } ;
+
+static yyconst flex_int16_t yy_base[416] =
+ { 0,
+ 0, 0, 61, 62, 71, 0, 606, 607, 607, 607,
+ 581, 42, 129, 607, 607, 580, 126, 607, 125, 123,
+ 137, 149, 157, 578, 607, 175, 578, 44, 607, 0,
+ 607, 607, 120, 95, 103, 142, 146, 136, 156, 552,
+ 168, 162, 551, 120, 158, 545, 173, 558, 172, 178,
+ 111, 186, 554, 607, 159, 607, 607, 607, 607, 582,
+ 607, 607, 0, 607, 607, 607, 607, 607, 607, 607,
+ 607, 607, 607, 222, 607, 0, 607, 228, 254, 262,
+ 281, 0, 290, 607, 607, 607, 571, 607, 607, 607,
+ 570, 0, 607, 607, 546, 539, 542, 550, 549, 536,
+
+ 551, 538, 544, 532, 529, 542, 529, 526, 526, 532,
+ 520, 527, 524, 534, 520, 526, 529, 530, 0, 204,
+ 529, 207, 515, 528, 519, 521, 511, 525, 522, 524,
+ 507, 512, 509, 498, 183, 512, 508, 510, 499, 502,
+ 212, 507, 499, 511, 186, 504, 607, 607, 607, 0,
+ 306, 0, 316, 332, 270, 342, 0, 607, 607, 0,
+ 496, 500, 509, 506, 490, 490, 161, 505, 502, 502,
+ 500, 497, 489, 495, 482, 493, 496, 0, 493, 481,
+ 488, 485, 489, 482, 471, 470, 483, 486, 483, 478,
+ 469, 294, 474, 477, 468, 465, 469, 475, 466, 457,
+
+ 460, 458, 468, 454, 452, 452, 454, 451, 462, 461,
+ 278, 456, 451, 440, 320, 458, 460, 449, 348, 354,
+ 360, 366, 450, 0, 448, 336, 0, 440, 438, 446,
+ 435, 452, 441, 370, 0, 0, 435, 445, 445, 430,
+ 373, 0, 0, 432, 376, 433, 427, 426, 427, 426,
+ 379, 0, 0, 0, 0, 0, 422, 423, 428, 419,
+ 432, 427, 426, 418, 422, 414, 417, 421, 426, 425,
+ 416, 0, 0, 422, 411, 411, 416, 415, 412, 0,
+ 0, 0, 0, 402, 414, 416, 0, 0, 0, 0,
+ 0, 0, 404, 405, 399, 409, 0, 0, 0, 400,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 407, 0, 0, 405, 401, 0, 0, 0, 397, 393,
+ 398, 388, 401, 387, 400, 389, 396, 0, 394, 396,
+ 380, 389, 395, 390, 378, 0, 380, 0, 379, 382,
+ 0, 371, 370, 370, 383, 0, 385, 0, 384, 383,
+ 368, 381, 368, 0, 0, 371, 0, 0, 363, 0,
+ 0, 0, 0, 360, 371, 364, 368, 303, 297, 288,
+ 300, 0, 0, 283, 290, 269, 0, 277, 274, 255,
+ 232, 255, 0, 0, 244, 0, 236, 226, 0, 0,
+ 225, 208, 211, 0, 185, 202, 131, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0, 134, 117, 0, 607,
+ 398, 400, 402, 406, 142
+ } ;
+
+static yyconst flex_int16_t yy_def[416] =
+ { 0,
+ 410, 1, 411, 411, 410, 5, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 412,
+ 410, 410, 410, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 413, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 414, 410, 410, 410, 410,
+ 410, 415, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 412, 410, 410, 412, 412, 412, 412, 412, 412,
+
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 410, 410, 410, 413,
+ 410, 414, 410, 410, 410, 410, 415, 410, 410, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 410, 410,
+ 410, 410, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 0,
+ 410, 410, 410, 410, 410
+ } ;
+
+static yyconst flex_int16_t yy_nxt[671] =
+ { 0,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 23, 23, 23, 23,
+ 24, 25, 26, 27, 28, 29, 30, 30, 30, 30,
+ 30, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 30, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 30, 30, 30, 54,
+ 55, 56, 57, 59, 59, 65, 66, 90, 91, 60,
+ 60, 8, 61, 62, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 63, 63, 63,
+
+ 63, 63, 63, 8, 8, 8, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 8, 8, 8, 8, 67, 70, 72, 74, 74, 74,
+ 74, 74, 74, 93, 157, 75, 95, 96, 73, 71,
+ 76, 97, 68, 98, 94, 123, 409, 99, 141, 124,
+ 77, 78, 142, 79, 79, 79, 79, 79, 80, 78,
+ 408, 83, 83, 83, 83, 83, 83, 100, 81, 85,
+ 82, 107, 147, 108, 407, 103, 81, 101, 81, 104,
+ 102, 110, 109, 125, 105, 86, 81, 87, 88, 111,
+
+ 106, 112, 119, 116, 113, 82, 126, 132, 128, 120,
+ 114, 117, 229, 230, 133, 134, 121, 137, 204, 148,
+ 138, 143, 118, 129, 135, 144, 130, 136, 139, 216,
+ 406, 217, 405, 205, 145, 140, 74, 74, 74, 74,
+ 74, 74, 153, 153, 153, 153, 153, 153, 396, 184,
+ 404, 151, 185, 186, 190, 211, 187, 154, 188, 397,
+ 403, 151, 191, 212, 402, 401, 78, 154, 79, 79,
+ 79, 79, 79, 80, 78, 400, 80, 80, 80, 80,
+ 80, 80, 399, 81, 156, 156, 156, 156, 156, 156,
+ 155, 81, 155, 81, 398, 156, 156, 156, 156, 156,
+
+ 156, 81, 78, 395, 83, 83, 83, 83, 83, 83,
+ 254, 255, 256, 394, 393, 219, 392, 219, 275, 81,
+ 220, 220, 220, 220, 220, 220, 276, 391, 390, 81,
+ 153, 153, 153, 153, 153, 153, 280, 281, 282, 389,
+ 388, 221, 387, 221, 386, 154, 222, 222, 222, 222,
+ 222, 222, 288, 289, 290, 154, 156, 156, 156, 156,
+ 156, 156, 220, 220, 220, 220, 220, 220, 220, 220,
+ 220, 220, 220, 220, 222, 222, 222, 222, 222, 222,
+ 222, 222, 222, 222, 222, 222, 297, 298, 299, 304,
+ 305, 306, 308, 309, 310, 316, 317, 318, 58, 58,
+
+ 58, 58, 92, 92, 150, 150, 152, 385, 152, 152,
+ 384, 383, 382, 381, 380, 379, 378, 377, 376, 375,
+ 374, 373, 372, 371, 370, 369, 368, 367, 366, 365,
+ 364, 363, 362, 361, 360, 359, 358, 357, 356, 355,
+ 354, 353, 352, 351, 350, 349, 348, 347, 346, 345,
+ 344, 343, 342, 341, 340, 339, 338, 337, 336, 335,
+ 334, 333, 332, 331, 330, 329, 328, 327, 326, 325,
+ 324, 323, 322, 321, 320, 319, 315, 314, 313, 312,
+ 311, 307, 303, 302, 301, 300, 296, 295, 294, 293,
+ 292, 291, 287, 286, 285, 284, 283, 279, 278, 277,
+
+ 274, 273, 272, 271, 270, 269, 268, 267, 266, 265,
+ 264, 263, 262, 261, 260, 259, 258, 257, 253, 252,
+ 251, 250, 249, 248, 247, 246, 245, 244, 243, 242,
+ 241, 240, 239, 238, 237, 236, 235, 234, 233, 232,
+ 231, 228, 227, 226, 225, 224, 223, 218, 215, 214,
+ 213, 210, 209, 208, 207, 206, 203, 202, 201, 200,
+ 199, 198, 197, 196, 195, 194, 193, 192, 189, 183,
+ 182, 181, 180, 179, 178, 177, 176, 175, 174, 173,
+ 172, 171, 170, 169, 168, 167, 166, 165, 164, 163,
+ 162, 161, 160, 159, 158, 149, 146, 131, 127, 122,
+
+ 115, 89, 84, 69, 64, 410, 7, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410
+ } ;
+
+static yyconst flex_int16_t yy_chk[671] =
+ { 0,
+ 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, 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, 3, 4, 12, 12, 28, 28, 3,
+ 4, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 13, 17, 19, 20, 20, 20,
+ 20, 20, 20, 33, 415, 21, 34, 34, 19, 17,
+ 21, 35, 13, 35, 33, 44, 408, 35, 51, 44,
+ 21, 22, 51, 22, 22, 22, 22, 22, 22, 23,
+ 407, 23, 23, 23, 23, 23, 23, 36, 22, 26,
+ 22, 38, 55, 38, 397, 37, 23, 36, 22, 37,
+ 36, 39, 38, 45, 37, 26, 23, 26, 26, 39,
+
+ 37, 39, 42, 41, 39, 22, 45, 49, 47, 42,
+ 39, 41, 167, 167, 49, 49, 42, 50, 135, 55,
+ 50, 52, 41, 47, 49, 52, 47, 49, 50, 145,
+ 396, 145, 395, 135, 52, 50, 74, 74, 74, 74,
+ 74, 74, 78, 78, 78, 78, 78, 78, 381, 120,
+ 393, 74, 120, 120, 122, 141, 120, 78, 120, 381,
+ 392, 74, 122, 141, 391, 388, 79, 78, 79, 79,
+ 79, 79, 79, 79, 80, 387, 80, 80, 80, 80,
+ 80, 80, 385, 79, 155, 155, 155, 155, 155, 155,
+ 81, 80, 81, 79, 382, 81, 81, 81, 81, 81,
+
+ 81, 80, 83, 380, 83, 83, 83, 83, 83, 83,
+ 192, 192, 192, 379, 378, 151, 376, 151, 211, 83,
+ 151, 151, 151, 151, 151, 151, 211, 375, 374, 83,
+ 153, 153, 153, 153, 153, 153, 215, 215, 215, 371,
+ 370, 154, 369, 154, 368, 153, 154, 154, 154, 154,
+ 154, 154, 226, 226, 226, 153, 156, 156, 156, 156,
+ 156, 156, 219, 219, 219, 219, 219, 219, 220, 220,
+ 220, 220, 220, 220, 221, 221, 221, 221, 221, 221,
+ 222, 222, 222, 222, 222, 222, 234, 234, 234, 241,
+ 241, 241, 245, 245, 245, 251, 251, 251, 411, 411,
+
+ 411, 411, 412, 412, 413, 413, 414, 367, 414, 414,
+ 366, 365, 364, 359, 356, 353, 352, 351, 350, 349,
+ 347, 345, 344, 343, 342, 340, 339, 337, 335, 334,
+ 333, 332, 331, 330, 329, 327, 326, 325, 324, 323,
+ 322, 321, 320, 319, 315, 314, 311, 300, 296, 295,
+ 294, 293, 286, 285, 284, 279, 278, 277, 276, 275,
+ 274, 271, 270, 269, 268, 267, 266, 265, 264, 263,
+ 262, 261, 260, 259, 258, 257, 250, 249, 248, 247,
+ 246, 244, 240, 239, 238, 237, 233, 232, 231, 230,
+ 229, 228, 225, 223, 218, 217, 216, 214, 213, 212,
+
+ 210, 209, 208, 207, 206, 205, 204, 203, 202, 201,
+ 200, 199, 198, 197, 196, 195, 194, 193, 191, 190,
+ 189, 188, 187, 186, 185, 184, 183, 182, 181, 180,
+ 179, 177, 176, 175, 174, 173, 172, 171, 170, 169,
+ 168, 166, 165, 164, 163, 162, 161, 146, 144, 143,
+ 142, 140, 139, 138, 137, 136, 134, 133, 132, 131,
+ 130, 129, 128, 127, 126, 125, 124, 123, 121, 118,
+ 117, 116, 115, 114, 113, 112, 111, 110, 109, 108,
+ 107, 106, 105, 104, 103, 102, 101, 100, 99, 98,
+ 97, 96, 95, 91, 87, 60, 53, 48, 46, 43,
+
+ 40, 27, 24, 16, 11, 7, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
+ 410, 410, 410, 410, 410, 410, 410, 410, 410, 410
+ } ;
+
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[146] =
+ { 0,
+0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, };
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+/*
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+This file contains the Lex specification for GLSL ES.
+Based on ANSI C grammar, Lex specification:
+http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
+
+IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_glslang_lexer.sh,
+WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
+*/
+
+#include "compiler/glslang.h"
+#include "compiler/ParseHelper.h"
+#include "compiler/util.h"
+#include "glslang_tab.h"
+
+/* windows only pragma */
+#ifdef _MSC_VER
+#pragma warning(disable : 4102)
+#endif
+
+#define YY_USER_ACTION yylval->lex.line = yylineno;
+#define YY_INPUT(buf, result, max_size) \
+ result = string_input(buf, max_size, yyscanner);
+
+static int string_input(char* buf, int max_size, yyscan_t yyscanner);
+static int check_type(yyscan_t yyscanner);
+static int reserved_word(yyscan_t yyscanner);
+
+#define INITIAL 0
+#define COMMENT 1
+#define FIELDS 2
+
+#define YY_EXTRA_TYPE TParseContext*
+
+/* Holds the entire state of the reentrant scanner. */
+struct yyguts_t
+ {
+
+ /* User-defined. Not touched by flex. */
+ YY_EXTRA_TYPE yyextra_r;
+
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
+ FILE *yyin_r, *yyout_r;
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
+ char yy_hold_char;
+ int yy_n_chars;
+ int yyleng_r;
+ char *yy_c_buf_p;
+ int yy_init;
+ int yy_start;
+ int yy_did_buffer_switch_on_eof;
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int *yy_start_stack;
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ int yylineno_r;
+ int yy_flex_debug_r;
+
+ char *yytext_r;
+ int yy_more_flag;
+ int yy_more_len;
+
+ YYSTYPE * yylval_r;
+
+ }; /* end struct yyguts_t */
+
+static int yy_init_globals (yyscan_t yyscanner );
+
+ /* This must go here because YYSTYPE and YYLTYPE are included
+ * from bison output in section 1.*/
+ # define yylval yyg->yylval_r
+
+int yylex_init (yyscan_t* scanner);
+
+int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (yyscan_t yyscanner );
+
+int yyget_debug (yyscan_t yyscanner );
+
+void yyset_debug (int debug_flag ,yyscan_t yyscanner );
+
+YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+
+FILE *yyget_in (yyscan_t yyscanner );
+
+void yyset_in (FILE * in_str ,yyscan_t yyscanner );
+
+FILE *yyget_out (yyscan_t yyscanner );
+
+void yyset_out (FILE * out_str ,yyscan_t yyscanner );
+
+int yyget_leng (yyscan_t yyscanner );
+
+char *yyget_text (yyscan_t yyscanner );
+
+int yyget_lineno (yyscan_t yyscanner );
+
+void yyset_lineno (int line_number ,yyscan_t yyscanner );
+
+YYSTYPE * yyget_lval (yyscan_t yyscanner );
+
+void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (yyscan_t yyscanner );
+#else
+extern int yywrap (yyscan_t yyscanner );
+#endif
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (yyscan_t yyscanner );
+#else
+static int input (yyscan_t yyscanner );
+#endif
+
+#endif
+
+ static void yy_push_state (int new_state ,yyscan_t yyscanner);
+
+ static void yy_pop_state (yyscan_t yyscanner );
+
+ static int yy_top_state (yyscan_t yyscanner );
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ int n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex \
+ (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+
+#define YY_DECL int yylex \
+ (YYSTYPE * yylval_param , yyscan_t yyscanner)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ TParseContext* context = yyextra;
+
+ /* Single-line comments */
+
+ yylval = yylval_param;
+
+ if ( !yyg->yy_init )
+ {
+ yyg->yy_init = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! yyg->yy_start )
+ yyg->yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack (yyscanner);
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ }
+
+ yy_load_buffer_state(yyscanner );
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yyg->yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yyg->yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yyg->yy_start;
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ yyg->yy_last_accepting_state = yy_current_state;
+ yyg->yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 411 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_current_state != 410 );
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+
+ YY_DO_BEFORE_ACTION;
+
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ int yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
+
+ do{ yylineno++;
+ yycolumn=0;
+ }while(0)
+;
+ }
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = yyg->yy_hold_char;
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+;
+ YY_BREAK
+/* Multi-line comments */
+case 2:
+YY_RULE_SETUP
+{ yy_push_state(COMMENT, yyscanner); }
+ YY_BREAK
+case 3:
+case 4:
+/* rule 4 can match eol */
+YY_RULE_SETUP
+;
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+{ yy_pop_state(yyscanner); }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+{ return(INVARIANT); }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+{ return(HIGH_PRECISION); }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+{ return(MEDIUM_PRECISION); }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+{ return(LOW_PRECISION); }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+{ return(PRECISION); }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+{ return(ATTRIBUTE); }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+{ return(CONST_QUAL); }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+{ return(UNIFORM); }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+{ return(VARYING); }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+{ return(BREAK); }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+{ return(CONTINUE); }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+{ return(DO); }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+{ return(FOR); }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+{ return(WHILE); }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+{ return(IF); }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+{ return(ELSE); }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+{ return(IN_QUAL); }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+{ return(OUT_QUAL); }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+{ return(INOUT_QUAL); }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(FLOAT_TYPE); }
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(INT_TYPE); }
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(VOID_TYPE); }
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(BOOL_TYPE); }
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+{ yylval->lex.b = true; return(BOOLCONSTANT); }
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+{ yylval->lex.b = false; return(BOOLCONSTANT); }
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+{ return(DISCARD); }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+{ return(RETURN); }
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(MATRIX2); }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(MATRIX3); }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(MATRIX4); }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (VEC2); }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (VEC3); }
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (VEC4); }
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (IVEC2); }
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (IVEC3); }
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (IVEC4); }
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (BVEC2); }
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (BVEC3); }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return (BVEC4); }
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return SAMPLER2D; }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return SAMPLERCUBE; }
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+{ context->lexAfterType = true; return(STRUCT); }
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 55:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 59:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 60:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 61:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 62:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 63:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 64:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 65:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 66:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 67:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 68:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 69:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 70:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 71:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 72:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 73:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 74:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 75:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 76:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 77:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 78:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 79:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 80:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 81:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 82:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 83:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 84:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 85:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 86:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 87:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 88:
+YY_RULE_SETUP
+{
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+}
+ YY_BREAK
+case 89:
+YY_RULE_SETUP
+{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+ YY_BREAK
+case 90:
+YY_RULE_SETUP
+{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+ YY_BREAK
+case 91:
+YY_RULE_SETUP
+{ context->error(yylineno, "Invalid Octal number.", yytext, "", ""); context->recover(); return 0;}
+ YY_BREAK
+case 92:
+YY_RULE_SETUP
+{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
+ YY_BREAK
+case 93:
+YY_RULE_SETUP
+{ yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
+ YY_BREAK
+case 94:
+YY_RULE_SETUP
+{ yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
+ YY_BREAK
+case 95:
+YY_RULE_SETUP
+{ yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
+ YY_BREAK
+case 96:
+YY_RULE_SETUP
+{ return(ADD_ASSIGN); }
+ YY_BREAK
+case 97:
+YY_RULE_SETUP
+{ return(SUB_ASSIGN); }
+ YY_BREAK
+case 98:
+YY_RULE_SETUP
+{ return(MUL_ASSIGN); }
+ YY_BREAK
+case 99:
+YY_RULE_SETUP
+{ return(DIV_ASSIGN); }
+ YY_BREAK
+case 100:
+YY_RULE_SETUP
+{ return(MOD_ASSIGN); }
+ YY_BREAK
+case 101:
+YY_RULE_SETUP
+{ return(LEFT_ASSIGN); }
+ YY_BREAK
+case 102:
+YY_RULE_SETUP
+{ return(RIGHT_ASSIGN); }
+ YY_BREAK
+case 103:
+YY_RULE_SETUP
+{ return(AND_ASSIGN); }
+ YY_BREAK
+case 104:
+YY_RULE_SETUP
+{ return(XOR_ASSIGN); }
+ YY_BREAK
+case 105:
+YY_RULE_SETUP
+{ return(OR_ASSIGN); }
+ YY_BREAK
+case 106:
+YY_RULE_SETUP
+{ return(INC_OP); }
+ YY_BREAK
+case 107:
+YY_RULE_SETUP
+{ return(DEC_OP); }
+ YY_BREAK
+case 108:
+YY_RULE_SETUP
+{ return(AND_OP); }
+ YY_BREAK
+case 109:
+YY_RULE_SETUP
+{ return(OR_OP); }
+ YY_BREAK
+case 110:
+YY_RULE_SETUP
+{ return(XOR_OP); }
+ YY_BREAK
+case 111:
+YY_RULE_SETUP
+{ return(LE_OP); }
+ YY_BREAK
+case 112:
+YY_RULE_SETUP
+{ return(GE_OP); }
+ YY_BREAK
+case 113:
+YY_RULE_SETUP
+{ return(EQ_OP); }
+ YY_BREAK
+case 114:
+YY_RULE_SETUP
+{ return(NE_OP); }
+ YY_BREAK
+case 115:
+YY_RULE_SETUP
+{ return(LEFT_OP); }
+ YY_BREAK
+case 116:
+YY_RULE_SETUP
+{ return(RIGHT_OP); }
+ YY_BREAK
+case 117:
+YY_RULE_SETUP
+{ context->lexAfterType = false; return(SEMICOLON); }
+ YY_BREAK
+case 118:
+YY_RULE_SETUP
+{ context->lexAfterType = false; return(LEFT_BRACE); }
+ YY_BREAK
+case 119:
+YY_RULE_SETUP
+{ return(RIGHT_BRACE); }
+ YY_BREAK
+case 120:
+YY_RULE_SETUP
+{ if (context->inTypeParen) context->lexAfterType = false; return(COMMA); }
+ YY_BREAK
+case 121:
+YY_RULE_SETUP
+{ return(COLON); }
+ YY_BREAK
+case 122:
+YY_RULE_SETUP
+{ context->lexAfterType = false; return(EQUAL); }
+ YY_BREAK
+case 123:
+YY_RULE_SETUP
+{ context->lexAfterType = false; context->inTypeParen = true; return(LEFT_PAREN); }
+ YY_BREAK
+case 124:
+YY_RULE_SETUP
+{ context->inTypeParen = false; return(RIGHT_PAREN); }
+ YY_BREAK
+case 125:
+YY_RULE_SETUP
+{ return(LEFT_BRACKET); }
+ YY_BREAK
+case 126:
+YY_RULE_SETUP
+{ return(RIGHT_BRACKET); }
+ YY_BREAK
+case 127:
+YY_RULE_SETUP
+{ BEGIN(FIELDS); return(DOT); }
+ YY_BREAK
+case 128:
+YY_RULE_SETUP
+{ return(BANG); }
+ YY_BREAK
+case 129:
+YY_RULE_SETUP
+{ return(DASH); }
+ YY_BREAK
+case 130:
+YY_RULE_SETUP
+{ return(TILDE); }
+ YY_BREAK
+case 131:
+YY_RULE_SETUP
+{ return(PLUS); }
+ YY_BREAK
+case 132:
+YY_RULE_SETUP
+{ return(STAR); }
+ YY_BREAK
+case 133:
+YY_RULE_SETUP
+{ return(SLASH); }
+ YY_BREAK
+case 134:
+YY_RULE_SETUP
+{ return(PERCENT); }
+ YY_BREAK
+case 135:
+YY_RULE_SETUP
+{ return(LEFT_ANGLE); }
+ YY_BREAK
+case 136:
+YY_RULE_SETUP
+{ return(RIGHT_ANGLE); }
+ YY_BREAK
+case 137:
+YY_RULE_SETUP
+{ return(VERTICAL_BAR); }
+ YY_BREAK
+case 138:
+YY_RULE_SETUP
+{ return(CARET); }
+ YY_BREAK
+case 139:
+YY_RULE_SETUP
+{ return(AMPERSAND); }
+ YY_BREAK
+case 140:
+YY_RULE_SETUP
+{ return(QUESTION); }
+ YY_BREAK
+case 141:
+YY_RULE_SETUP
+{
+ BEGIN(INITIAL);
+ yylval->lex.string = NewPoolTString(yytext);
+ return FIELD_SELECTION;
+}
+ YY_BREAK
+case 142:
+YY_RULE_SETUP
+{}
+ YY_BREAK
+case 143:
+/* rule 143 can match eol */
+YY_RULE_SETUP
+{ }
+ YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(COMMENT):
+case YY_STATE_EOF(FIELDS):
+{ context->AfterEOF = true; yyterminate(); }
+ YY_BREAK
+case 144:
+YY_RULE_SETUP
+{ context->warning(yylineno, "Unknown char", yytext, ""); return 0; }
+ YY_BREAK
+case 145:
+YY_RULE_SETUP
+ECHO;
+ YY_BREAK
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yyg->yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yyg->yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( yyscanner ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yyg->yy_did_buffer_switch_on_eof = 0;
+
+ if ( yywrap(yyscanner ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p =
+ yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yyg->yy_c_buf_p =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ register char *source = yyg->yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+ int yy_c_buf_p_offset =
+ (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ yyg->yy_n_chars, (size_t) num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
+
+ if ( yyg->yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin ,yyscanner);
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ yyg->yy_n_chars += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ yy_current_state = yyg->yy_start;
+
+ for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ yyg->yy_last_accepting_state = yy_current_state;
+ yyg->yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 411 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
+{
+ register int yy_is_jam;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+ register char *yy_cp = yyg->yy_c_buf_p;
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ yyg->yy_last_accepting_state = yy_current_state;
+ yyg->yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 411 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 410);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (yyscan_t yyscanner)
+#else
+ static int input (yyscan_t yyscanner)
+#endif
+
+{
+ int c;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+
+ if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+ /* This was really a NUL. */
+ *yyg->yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+ ++yyg->yy_c_buf_p;
+
+ switch ( yy_get_next_buffer( yyscanner ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin ,yyscanner);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap(yyscanner ) )
+ return EOF;
+
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput(yyscanner);
+#else
+ return input(yyscanner);
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
+ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
+ yyg->yy_hold_char = *++yyg->yy_c_buf_p;
+
+ if ( c == '\n' )
+
+ do{ yylineno++;
+ yycolumn=0;
+ }while(0)
+;
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * @param yyscanner The scanner object.
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack (yyscanner);
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+ yy_load_buffer_state(yyscanner );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * @param yyscanner The scanner object.
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack (yyscanner);
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state(yyscanner );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+static void yy_load_buffer_state (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ yyg->yy_hold_char = *yyg->yy_c_buf_p;
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * @param yyscanner The scanner object.
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file ,yyscanner);
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * @param yyscanner The scanner object.
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf ,yyscanner );
+
+ yyfree((void *) b ,yyscanner );
+}
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
+
+{
+ int oerrno = errno;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ yy_flush_buffer(b ,yyscanner);
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * @param yyscanner The scanner object.
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state(yyscanner );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ * @param yyscanner The scanner object.
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack(yyscanner);
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ yyg->yy_buffer_stack_top++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state(yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ * @param yyscanner The scanner object.
+ */
+void yypop_buffer_state (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if (yyg->yy_buffer_stack_top > 0)
+ --yyg->yy_buffer_stack_top;
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state(yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (yyscan_t yyscanner)
+{
+ int num_to_alloc;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if (!yyg->yy_buffer_stack) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ , yyscanner);
+ if ( ! yyg->yy_buffer_stack )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ yyg->yy_buffer_stack_max = num_to_alloc;
+ yyg->yy_buffer_stack_top = 0;
+ return;
+ }
+
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
+ (yyg->yy_buffer_stack,
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ , yyscanner);
+ if ( ! yyg->yy_buffer_stack )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
+ yyg->yy_buffer_stack_max = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b ,yyscanner );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
+{
+
+ return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc(n ,yyscanner );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n ,yyscanner);
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+ static void yy_push_state (int new_state , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
+ {
+ yy_size_t new_size;
+
+ yyg->yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yyg->yy_start_stack_depth * sizeof( int );
+
+ if ( ! yyg->yy_start_stack )
+ yyg->yy_start_stack = (int *) yyalloc(new_size ,yyscanner );
+
+ else
+ yyg->yy_start_stack = (int *) yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
+
+ if ( ! yyg->yy_start_stack )
+ YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+ }
+
+ yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+}
+
+ static void yy_pop_state (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if ( --yyg->yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
+}
+
+ static int yy_top_state (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = yyg->yy_hold_char; \
+ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+ yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+ *yyg->yy_c_buf_p = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the user-defined data for this scanner.
+ * @param yyscanner The scanner object.
+ */
+YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyextra;
+}
+
+/** Get the current line number.
+ * @param yyscanner The scanner object.
+ */
+int yyget_lineno (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+
+ return yylineno;
+}
+
+/** Get the current column number.
+ * @param yyscanner The scanner object.
+ */
+int yyget_column (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+
+ return yycolumn;
+}
+
+/** Get the input stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *yyget_in (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyin;
+}
+
+/** Get the output stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *yyget_out (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyout;
+}
+
+/** Get the length of the current token.
+ * @param yyscanner The scanner object.
+ */
+int yyget_leng (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyleng;
+}
+
+/** Get the current token.
+ * @param yyscanner The scanner object.
+ */
+
+char *yyget_text (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yytext;
+}
+
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * @param yyscanner The scanner object.
+ */
+void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyextra = user_defined ;
+}
+
+/** Set the current line number.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+void yyset_lineno (int line_number , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ /* lineno is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner);
+
+ yylineno = line_number;
+}
+
+/** Set the current column.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+void yyset_column (int column_no , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ /* column is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ yy_fatal_error( "yyset_column called with no buffer" , yyscanner);
+
+ yycolumn = column_no;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * @param yyscanner The scanner object.
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * in_str , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyin = in_str ;
+}
+
+void yyset_out (FILE * out_str , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyout = out_str ;
+}
+
+int yyget_debug (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yy_flex_debug;
+}
+
+void yyset_debug (int bdebug , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yy_flex_debug = bdebug ;
+}
+
+/* Accessor methods for yylval and yylloc */
+
+YYSTYPE * yyget_lval (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yylval;
+}
+
+void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yylval = yylval_param;
+}
+
+/* User-visible API */
+
+/* yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+
+int yylex_init(yyscan_t* ptr_yy_globals)
+
+{
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ return yy_init_globals ( *ptr_yy_globals );
+}
+
+/* yylex_init_extra has the same functionality as yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to yyalloc in
+ * the yyextra field.
+ */
+
+int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
+
+{
+ struct yyguts_t dummy_yyguts;
+
+ yyset_extra (yy_user_defined, &dummy_yyguts);
+
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in
+ yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ yyset_extra (yy_user_defined, *ptr_yy_globals);
+
+ return yy_init_globals ( *ptr_yy_globals );
+}
+
+static int yy_init_globals (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ yyg->yy_buffer_stack = 0;
+ yyg->yy_buffer_stack_top = 0;
+ yyg->yy_buffer_stack_max = 0;
+ yyg->yy_c_buf_p = (char *) 0;
+ yyg->yy_init = 0;
+ yyg->yy_start = 0;
+
+ yyg->yy_start_stack_ptr = 0;
+ yyg->yy_start_stack_depth = 0;
+ yyg->yy_start_stack = NULL;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state(yyscanner);
+ }
+
+ /* Destroy the stack itself. */
+ yyfree(yyg->yy_buffer_stack ,yyscanner);
+ yyg->yy_buffer_stack = NULL;
+
+ /* Destroy the start condition stack. */
+ yyfree(yyg->yy_start_stack ,yyscanner );
+ yyg->yy_start_stack = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( yyscanner);
+
+ /* Destroy the main struct (reentrant only). */
+ yyfree ( yyscanner , yyscanner );
+ yyscanner = NULL;
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+{
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+{
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size , yyscan_t yyscanner)
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
+{
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr , yyscan_t yyscanner)
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+extern "C" {
+// Preprocessor interface.
+#include "compiler/preprocessor/preprocess.h"
+
+#define SETUP_CONTEXT(pp) \
+ TParseContext* context = (TParseContext*) pp->pC; \
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+// Preprocessor callbacks.
+void CPPDebugLogMsg(const char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->infoSink.debug.message(EPrefixNone, msg);
+}
+
+void CPPWarningToInfoLog(const char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->warning(yylineno, msg, "", "");
+}
+
+void CPPShInfoLogMsg(const char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->error(yylineno, msg, "", "");
+ context->recover();
+}
+
+void CPPErrorToInfoLog(char *msg)
+{
+ SETUP_CONTEXT(cpp);
+ context->error(yylineno, msg, "", "");
+ context->recover();
+}
+
+void SetLineNumber(int line)
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0;
+ DecodeSourceLoc(yylineno, &string, NULL);
+ yylineno = EncodeSourceLoc(string, line);
+}
+
+void SetStringNumber(int string)
+{
+ SETUP_CONTEXT(cpp);
+ int line = 0;
+ DecodeSourceLoc(yylineno, NULL, &line);
+ yylineno = EncodeSourceLoc(string, line);
+}
+
+int GetStringNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0;
+ DecodeSourceLoc(yylineno, &string, NULL);
+ return string;
+}
+
+int GetLineNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int line = 0;
+ DecodeSourceLoc(yylineno, NULL, &line);
+ return line;
+}
+
+void IncLineNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0, line = 0;
+ DecodeSourceLoc(yylineno, &string, &line);
+ yylineno = EncodeSourceLoc(string, ++line);
+}
+
+void DecLineNumber()
+{
+ SETUP_CONTEXT(cpp);
+ int string = 0, line = 0;
+ DecodeSourceLoc(yylineno, &string, &line);
+ yylineno = EncodeSourceLoc(string, --line);
+}
+
+void HandlePragma(const char **tokens, int numTokens)
+{
+ SETUP_CONTEXT(cpp);
+ if (!strcmp(tokens[0], "optimize")) {
+ if (numTokens != 4) {
+ CPPShInfoLogMsg("optimize pragma syntax is incorrect");
+ return;
+ }
+
+ if (strcmp(tokens[1], "(")) {
+ CPPShInfoLogMsg("\"(\" expected after 'optimize' keyword");
+ return;
+ }
+
+ if (!strcmp(tokens[2], "on"))
+ context->contextPragma.optimize = true;
+ else if (!strcmp(tokens[2], "off"))
+ context->contextPragma.optimize = false;
+ else {
+ CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'optimize' pragma");
+ return;
+ }
+
+ if (strcmp(tokens[3], ")")) {
+ CPPShInfoLogMsg("\")\" expected to end 'optimize' pragma");
+ return;
+ }
+ } else if (!strcmp(tokens[0], "debug")) {
+ if (numTokens != 4) {
+ CPPShInfoLogMsg("debug pragma syntax is incorrect");
+ return;
+ }
+
+ if (strcmp(tokens[1], "(")) {
+ CPPShInfoLogMsg("\"(\" expected after 'debug' keyword");
+ return;
+ }
+
+ if (!strcmp(tokens[2], "on"))
+ context->contextPragma.debug = true;
+ else if (!strcmp(tokens[2], "off"))
+ context->contextPragma.debug = false;
+ else {
+ CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'debug' pragma");
+ return;
+ }
+
+ if (strcmp(tokens[3], ")")) {
+ CPPShInfoLogMsg("\")\" expected to end 'debug' pragma");
+ return;
+ }
+ } else {
+#ifdef PRAGMA_TABLE
+ //
+ // implementation specific pragma
+ // use ((TParseContext *)cpp->pC)->contextPragma.pragmaTable to store the information about pragma
+ // For now, just ignore the pragma that the implementation cannot recognize
+ // An Example of one such implementation for a pragma that has a syntax like
+ // #pragma pragmaname(pragmavalue)
+ // This implementation stores the current pragmavalue against the pragma name in pragmaTable.
+ //
+ if (numTokens == 4 && !strcmp(tokens[1], "(") && !strcmp(tokens[3], ")")) {
+ TPragmaTable& pragmaTable = ((TParseContext *)cpp->pC)->contextPragma.pragmaTable;
+ TPragmaTable::iterator iter;
+ iter = pragmaTable.find(TString(tokens[0]));
+ if (iter != pragmaTable.end()) {
+ iter->second = tokens[2];
+ } else {
+ pragmaTable[ tokens[0] ] = tokens[2];
+ }
+ } else if (numTokens >= 2) {
+ TPragmaTable& pragmaTable = ((TParseContext *)cpp->pC)->contextPragma.pragmaTable;
+ TPragmaTable::iterator iter;
+ iter = pragmaTable.find(TString(tokens[0]));
+ if (iter != pragmaTable.end()) {
+ iter->second = tokens[1];
+ } else {
+ pragmaTable[ tokens[0] ] = tokens[1];
+ }
+ }
+#endif // PRAGMA_TABLE
+ }
+}
+
+void StoreStr(char *string)
+{
+ SETUP_CONTEXT(cpp);
+ TString strSrc;
+ strSrc = TString(string);
+
+ context->HashErrMsg = context->HashErrMsg + " " + strSrc;
+}
+
+const char* GetStrfromTStr(void)
+{
+ SETUP_CONTEXT(cpp);
+ cpp->ErrMsg = context->HashErrMsg.c_str();
+ return cpp->ErrMsg;
+}
+
+void ResetTString(void)
+{
+ SETUP_CONTEXT(cpp);
+ context->HashErrMsg = "";
+}
+
+TBehavior GetBehavior(const char* behavior)
+{
+ if (!strcmp("require", behavior))
+ return EBhRequire;
+ else if (!strcmp("enable", behavior))
+ return EBhEnable;
+ else if (!strcmp("disable", behavior))
+ return EBhDisable;
+ else if (!strcmp("warn", behavior))
+ return EBhWarn;
+ else {
+ CPPShInfoLogMsg((TString("behavior '") + behavior + "' is not supported").c_str());
+ return EBhDisable;
+ }
+}
+
+void updateExtensionBehavior(const char* extName, const char* behavior)
+{
+ SETUP_CONTEXT(cpp);
+ TBehavior behaviorVal = GetBehavior(behavior);
+ TMap<TString, TBehavior>:: iterator iter;
+ TString msg;
+
+ // special cased for all extension
+ if (!strcmp(extName, "all")) {
+ if (behaviorVal == EBhRequire || behaviorVal == EBhEnable) {
+ CPPShInfoLogMsg("extension 'all' cannot have 'require' or 'enable' behavior");
+ return;
+ } else {
+ for (iter = context->extensionBehavior.begin(); iter != context->extensionBehavior.end(); ++iter)
+ iter->second = behaviorVal;
+ }
+ } else {
+ iter = context->extensionBehavior.find(TString(extName));
+ if (iter == context->extensionBehavior.end()) {
+ switch (behaviorVal) {
+ case EBhRequire:
+ CPPShInfoLogMsg((TString("extension '") + extName + "' is not supported").c_str());
+ break;
+ case EBhEnable:
+ case EBhWarn:
+ case EBhDisable:
+ msg = TString("extension '") + extName + "' is not supported";
+ context->infoSink.info.message(EPrefixWarning, msg.c_str(), yylineno);
+ break;
+ }
+ return;
+ } else
+ iter->second = behaviorVal;
+ }
+}
+} // extern "C"
+
+int string_input(char* buf, int max_size, yyscan_t yyscanner) {
+ int len;
+
+ if ((len = yylex_CPP(buf, max_size)) == 0)
+ return 0;
+ if (len >= max_size)
+ YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT");
+
+ buf[len] = ' ';
+ return len+1;
+}
+
+int check_type(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ int token = IDENTIFIER;
+ TSymbol* symbol = yyextra->symbolTable.find(yytext);
+ if (yyextra->lexAfterType == false && symbol && symbol->isVariable()) {
+ TVariable* variable = static_cast<TVariable*>(symbol);
+ if (variable->isUserType()) {
+ yyextra->lexAfterType = true;
+ token = TYPE_NAME;
+ }
+ }
+ yylval->lex.symbol = symbol;
+ return token;
+}
+
+int reserved_word(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ yyextra->error(yylineno, "Illegal use of reserved word", yytext, "");
+ yyextra->recover();
+ return 0;
+}
+
+void yyerror(TParseContext* context, const char* reason) {
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+ if (context->AfterEOF) {
+ context->error(yylineno, reason, "unexpected EOF", "");
+ } else {
+ context->error(yylineno, reason, yytext, "");
+ }
+ context->recover();
+}
+
+int glslang_initialize(TParseContext* context) {
+ yyscan_t scanner = NULL;
+ if (yylex_init_extra(context,&scanner))
+ return 1;
+
+ context->scanner = scanner;
+ return 0;
+}
+
+int glslang_finalize(TParseContext* context) {
+ yyscan_t scanner = context->scanner;
+ if (scanner == NULL) return 0;
+
+ context->scanner = NULL;
+ return yylex_destroy(scanner);
+}
+
+void glslang_scan(int count, const char* const string[], const int length[],
+ TParseContext* context) {
+ yyrestart(NULL,context->scanner);
+ yyset_lineno(EncodeSourceLoc(0, 1),context->scanner);
+ context->AfterEOF = false;
+
+ // Init preprocessor.
+ cpp->pC = context;
+ cpp->PaWhichStr = 0;
+ cpp->PaArgv = string;
+ cpp->PaArgc = count;
+ cpp->PaStrLen = length;
+ cpp->pastFirstStatement = 0;
+ ScanFromString(string[0]);
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp
new file mode 100644
index 0000000..d00c7a3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp
@@ -0,0 +1,4710 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ 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 this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "2.3"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 1
+
+/* Using locations. */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ INVARIANT = 258,
+ HIGH_PRECISION = 259,
+ MEDIUM_PRECISION = 260,
+ LOW_PRECISION = 261,
+ PRECISION = 262,
+ ATTRIBUTE = 263,
+ CONST_QUAL = 264,
+ BOOL_TYPE = 265,
+ FLOAT_TYPE = 266,
+ INT_TYPE = 267,
+ BREAK = 268,
+ CONTINUE = 269,
+ DO = 270,
+ ELSE = 271,
+ FOR = 272,
+ IF = 273,
+ DISCARD = 274,
+ RETURN = 275,
+ BVEC2 = 276,
+ BVEC3 = 277,
+ BVEC4 = 278,
+ IVEC2 = 279,
+ IVEC3 = 280,
+ IVEC4 = 281,
+ VEC2 = 282,
+ VEC3 = 283,
+ VEC4 = 284,
+ MATRIX2 = 285,
+ MATRIX3 = 286,
+ MATRIX4 = 287,
+ IN_QUAL = 288,
+ OUT_QUAL = 289,
+ INOUT_QUAL = 290,
+ UNIFORM = 291,
+ VARYING = 292,
+ STRUCT = 293,
+ VOID_TYPE = 294,
+ WHILE = 295,
+ SAMPLER2D = 296,
+ SAMPLERCUBE = 297,
+ IDENTIFIER = 298,
+ TYPE_NAME = 299,
+ FLOATCONSTANT = 300,
+ INTCONSTANT = 301,
+ BOOLCONSTANT = 302,
+ FIELD_SELECTION = 303,
+ LEFT_OP = 304,
+ RIGHT_OP = 305,
+ INC_OP = 306,
+ DEC_OP = 307,
+ LE_OP = 308,
+ GE_OP = 309,
+ EQ_OP = 310,
+ NE_OP = 311,
+ AND_OP = 312,
+ OR_OP = 313,
+ XOR_OP = 314,
+ MUL_ASSIGN = 315,
+ DIV_ASSIGN = 316,
+ ADD_ASSIGN = 317,
+ MOD_ASSIGN = 318,
+ LEFT_ASSIGN = 319,
+ RIGHT_ASSIGN = 320,
+ AND_ASSIGN = 321,
+ XOR_ASSIGN = 322,
+ OR_ASSIGN = 323,
+ SUB_ASSIGN = 324,
+ LEFT_PAREN = 325,
+ RIGHT_PAREN = 326,
+ LEFT_BRACKET = 327,
+ RIGHT_BRACKET = 328,
+ LEFT_BRACE = 329,
+ RIGHT_BRACE = 330,
+ DOT = 331,
+ COMMA = 332,
+ COLON = 333,
+ EQUAL = 334,
+ SEMICOLON = 335,
+ BANG = 336,
+ DASH = 337,
+ TILDE = 338,
+ PLUS = 339,
+ STAR = 340,
+ SLASH = 341,
+ PERCENT = 342,
+ LEFT_ANGLE = 343,
+ RIGHT_ANGLE = 344,
+ VERTICAL_BAR = 345,
+ CARET = 346,
+ AMPERSAND = 347,
+ QUESTION = 348
+ };
+#endif
+/* Tokens. */
+#define INVARIANT 258
+#define HIGH_PRECISION 259
+#define MEDIUM_PRECISION 260
+#define LOW_PRECISION 261
+#define PRECISION 262
+#define ATTRIBUTE 263
+#define CONST_QUAL 264
+#define BOOL_TYPE 265
+#define FLOAT_TYPE 266
+#define INT_TYPE 267
+#define BREAK 268
+#define CONTINUE 269
+#define DO 270
+#define ELSE 271
+#define FOR 272
+#define IF 273
+#define DISCARD 274
+#define RETURN 275
+#define BVEC2 276
+#define BVEC3 277
+#define BVEC4 278
+#define IVEC2 279
+#define IVEC3 280
+#define IVEC4 281
+#define VEC2 282
+#define VEC3 283
+#define VEC4 284
+#define MATRIX2 285
+#define MATRIX3 286
+#define MATRIX4 287
+#define IN_QUAL 288
+#define OUT_QUAL 289
+#define INOUT_QUAL 290
+#define UNIFORM 291
+#define VARYING 292
+#define STRUCT 293
+#define VOID_TYPE 294
+#define WHILE 295
+#define SAMPLER2D 296
+#define SAMPLERCUBE 297
+#define IDENTIFIER 298
+#define TYPE_NAME 299
+#define FLOATCONSTANT 300
+#define INTCONSTANT 301
+#define BOOLCONSTANT 302
+#define FIELD_SELECTION 303
+#define LEFT_OP 304
+#define RIGHT_OP 305
+#define INC_OP 306
+#define DEC_OP 307
+#define LE_OP 308
+#define GE_OP 309
+#define EQ_OP 310
+#define NE_OP 311
+#define AND_OP 312
+#define OR_OP 313
+#define XOR_OP 314
+#define MUL_ASSIGN 315
+#define DIV_ASSIGN 316
+#define ADD_ASSIGN 317
+#define MOD_ASSIGN 318
+#define LEFT_ASSIGN 319
+#define RIGHT_ASSIGN 320
+#define AND_ASSIGN 321
+#define XOR_ASSIGN 322
+#define OR_ASSIGN 323
+#define SUB_ASSIGN 324
+#define LEFT_PAREN 325
+#define RIGHT_PAREN 326
+#define LEFT_BRACKET 327
+#define RIGHT_BRACKET 328
+#define LEFT_BRACE 329
+#define RIGHT_BRACE 330
+#define DOT 331
+#define COMMA 332
+#define COLON 333
+#define EQUAL 334
+#define SEMICOLON 335
+#define BANG 336
+#define DASH 337
+#define TILDE 338
+#define PLUS 339
+#define STAR 340
+#define SLASH 341
+#define PERCENT 342
+#define LEFT_ANGLE 343
+#define RIGHT_ANGLE 344
+#define VERTICAL_BAR 345
+#define CARET 346
+#define AMPERSAND 347
+#define QUESTION 348
+
+
+
+
+/* Copy the first part of user declarations. */
+
+
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_glslang_parser.sh. DO NOT EDIT!
+
+#include "compiler/SymbolTable.h"
+#include "compiler/ParseHelper.h"
+#include "GLSLANG/ShaderLang.h"
+
+#define YYLEX_PARAM context->scanner
+
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+
+{
+ struct {
+ TSourceLoc line;
+ union {
+ TString *string;
+ float f;
+ int i;
+ bool b;
+ };
+ TSymbol* symbol;
+ } lex;
+ struct {
+ TSourceLoc line;
+ TOperator op;
+ union {
+ TIntermNode* intermNode;
+ TIntermNodePair nodePair;
+ TIntermTyped* intermTypedNode;
+ TIntermAggregate* intermAggregate;
+ };
+ union {
+ TPublicType type;
+ TPrecision precision;
+ TQualifier qualifier;
+ TFunction* function;
+ TParameter param;
+ TTypeLine typeLine;
+ TTypeList* typeList;
+ };
+ } interm;
+}
+/* Line 187 of yacc.c. */
+
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations. */
+
+
+extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
+extern void yyerror(TParseContext* context, const char* reason);
+
+#define FRAG_VERT_ONLY(S, L) { \
+ if (context->shaderType != SH_FRAGMENT_SHADER && \
+ context->shaderType != SH_VERTEX_SHADER) { \
+ context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
+ context->recover(); \
+ } \
+}
+
+#define VERTEX_ONLY(S, L) { \
+ if (context->shaderType != SH_VERTEX_SHADER) { \
+ context->error(L, " supported in vertex shaders only ", S, "", ""); \
+ context->recover(); \
+ } \
+}
+
+#define FRAG_ONLY(S, L) { \
+ if (context->shaderType != SH_FRAGMENT_SHADER) { \
+ context->error(L, " supported in fragment shaders only ", S, "", ""); \
+ context->recover(); \
+ } \
+}
+
+
+/* Line 216 of yacc.c. */
+
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int i)
+#else
+static int
+YYID (i)
+ int i;
+#endif
+{
+ return i;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss;
+ YYSTYPE yyvs;
+ };
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
+
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 69
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 1334
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 94
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 78
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 193
+/* YYNRULES -- Number of states. */
+#define YYNSTATES 296
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 348
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 87, 88, 89, 90, 91, 92, 93
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint16 yyprhs[] =
+{
+ 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
+ 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
+ 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
+ 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
+ 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
+ 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
+ 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
+ 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
+ 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
+ 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
+ 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
+ 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
+ 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
+ 368, 370, 372, 374, 376, 378, 380, 386, 391, 393,
+ 396, 400, 402, 406, 408, 413, 415, 417, 419, 421,
+ 423, 425, 427, 429, 431, 434, 435, 436, 442, 444,
+ 446, 449, 453, 455, 458, 460, 463, 469, 473, 475,
+ 477, 482, 483, 490, 491, 500, 501, 509, 511, 513,
+ 515, 516, 519, 523, 526, 529, 532, 536, 539, 541,
+ 544, 546, 548, 549
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int16 yyrhs[] =
+{
+ 168, 0, -1, 43, -1, 95, -1, 46, -1, 45,
+ -1, 47, -1, 70, 122, 71, -1, 96, -1, 97,
+ 72, 98, 73, -1, 99, -1, 97, 76, 48, -1,
+ 97, 51, -1, 97, 52, -1, 122, -1, 100, -1,
+ 101, -1, 97, 76, 101, -1, 103, 71, -1, 102,
+ 71, -1, 104, 39, -1, 104, -1, 104, 120, -1,
+ 103, 77, 120, -1, 105, 70, -1, 137, -1, 43,
+ -1, 48, -1, 97, -1, 51, 106, -1, 52, 106,
+ -1, 107, 106, -1, 84, -1, 82, -1, 81, -1,
+ 106, -1, 108, 85, 106, -1, 108, 86, 106, -1,
+ 108, -1, 109, 84, 108, -1, 109, 82, 108, -1,
+ 109, -1, 110, -1, 111, 88, 110, -1, 111, 89,
+ 110, -1, 111, 53, 110, -1, 111, 54, 110, -1,
+ 111, -1, 112, 55, 111, -1, 112, 56, 111, -1,
+ 112, -1, 113, -1, 114, -1, 115, -1, 116, 57,
+ 115, -1, 116, -1, 117, 59, 116, -1, 117, -1,
+ 118, 58, 117, -1, 118, -1, 118, 93, 122, 78,
+ 120, -1, 119, -1, 106, 121, 120, -1, 79, -1,
+ 60, -1, 61, -1, 62, -1, 69, -1, 120, -1,
+ 122, 77, 120, -1, 119, -1, 125, 80, -1, 133,
+ 80, -1, 7, 138, 139, 80, -1, 126, 71, -1,
+ 128, -1, 127, -1, 128, 130, -1, 127, 77, 130,
+ -1, 135, 43, 70, -1, 137, 43, -1, 137, 43,
+ 72, 123, 73, -1, 136, 131, 129, -1, 131, 129,
+ -1, 136, 131, 132, -1, 131, 132, -1, -1, 33,
+ -1, 34, -1, 35, -1, 137, -1, 134, -1, 133,
+ 77, 43, -1, 133, 77, 43, 72, 73, -1, 133,
+ 77, 43, 72, 123, 73, -1, 133, 77, 43, 79,
+ 146, -1, 135, -1, 135, 43, -1, 135, 43, 72,
+ 73, -1, 135, 43, 72, 123, 73, -1, 135, 43,
+ 79, 146, -1, 3, 43, -1, 137, -1, 136, 137,
+ -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
+ 36, -1, 139, -1, 138, 139, -1, 4, -1, 5,
+ -1, 6, -1, 140, -1, 140, 72, 123, 73, -1,
+ 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
+ 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
+ 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
+ 32, -1, 41, -1, 42, -1, 141, -1, 44, -1,
+ 38, 43, 74, 142, 75, -1, 38, 74, 142, 75,
+ -1, 143, -1, 142, 143, -1, 137, 144, 80, -1,
+ 145, -1, 144, 77, 145, -1, 43, -1, 43, 72,
+ 123, 73, -1, 120, -1, 124, -1, 150, -1, 149,
+ -1, 147, -1, 156, -1, 157, -1, 160, -1, 167,
+ -1, 74, 75, -1, -1, -1, 74, 151, 155, 152,
+ 75, -1, 154, -1, 149, -1, 74, 75, -1, 74,
+ 155, 75, -1, 148, -1, 155, 148, -1, 80, -1,
+ 122, 80, -1, 18, 70, 122, 71, 158, -1, 148,
+ 16, 148, -1, 148, -1, 122, -1, 135, 43, 79,
+ 146, -1, -1, 40, 70, 161, 159, 71, 153, -1,
+ -1, 15, 162, 148, 40, 70, 122, 71, 80, -1,
+ -1, 17, 70, 163, 164, 166, 71, 153, -1, 156,
+ -1, 147, -1, 159, -1, -1, 165, 80, -1, 165,
+ 80, 122, -1, 14, 80, -1, 13, 80, -1, 20,
+ 80, -1, 20, 122, 80, -1, 19, 80, -1, 169,
+ -1, 168, 169, -1, 170, -1, 124, -1, -1, 125,
+ 171, 154, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const yytype_uint16 yyrline[] =
+{
+ 0, 153, 153, 188, 191, 204, 209, 214, 220, 223,
+ 296, 299, 408, 418, 431, 439, 538, 541, 549, 553,
+ 560, 564, 571, 577, 586, 594, 656, 663, 673, 676,
+ 686, 696, 717, 718, 719, 724, 725, 734, 746, 747,
+ 755, 766, 770, 771, 781, 791, 801, 814, 815, 825,
+ 838, 842, 846, 850, 851, 864, 865, 878, 879, 892,
+ 893, 910, 911, 924, 925, 926, 927, 928, 932, 935,
+ 946, 954, 979, 984, 991, 1027, 1030, 1037, 1045, 1066,
+ 1085, 1096, 1125, 1130, 1140, 1145, 1155, 1158, 1161, 1164,
+ 1170, 1177, 1187, 1199, 1217, 1241, 1264, 1268, 1282, 1302,
+ 1331, 1351, 1427, 1436, 1459, 1462, 1468, 1476, 1484, 1492,
+ 1495, 1502, 1505, 1508, 1514, 1517, 1532, 1536, 1540, 1544,
+ 1553, 1558, 1563, 1568, 1573, 1578, 1583, 1588, 1593, 1598,
+ 1604, 1610, 1616, 1621, 1626, 1631, 1644, 1657, 1665, 1668,
+ 1683, 1714, 1718, 1724, 1732, 1748, 1752, 1756, 1757, 1763,
+ 1764, 1765, 1766, 1767, 1771, 1772, 1772, 1772, 1780, 1781,
+ 1786, 1789, 1797, 1800, 1806, 1807, 1811, 1819, 1823, 1833,
+ 1838, 1855, 1855, 1860, 1860, 1867, 1867, 1875, 1878, 1884,
+ 1887, 1893, 1897, 1904, 1911, 1918, 1925, 1936, 1945, 1949,
+ 1956, 1959, 1965, 1965
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
+ "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
+ "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
+ "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
+ "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
+ "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
+ "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
+ "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
+ "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP",
+ "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP",
+ "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN",
+ "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN",
+ "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
+ "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
+ "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
+ "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
+ "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
+ "primary_expression", "postfix_expression", "integer_expression",
+ "function_call", "function_call_or_method", "function_call_generic",
+ "function_call_header_no_parameters",
+ "function_call_header_with_parameters", "function_call_header",
+ "function_identifier", "unary_expression", "unary_operator",
+ "multiplicative_expression", "additive_expression", "shift_expression",
+ "relational_expression", "equality_expression", "and_expression",
+ "exclusive_or_expression", "inclusive_or_expression",
+ "logical_and_expression", "logical_xor_expression",
+ "logical_or_expression", "conditional_expression",
+ "assignment_expression", "assignment_operator", "expression",
+ "constant_expression", "declaration", "function_prototype",
+ "function_declarator", "function_header_with_parameters",
+ "function_header", "parameter_declarator", "parameter_declaration",
+ "parameter_qualifier", "parameter_type_specifier",
+ "init_declarator_list", "single_declaration", "fully_specified_type",
+ "type_qualifier", "type_specifier", "precision_qualifier",
+ "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
+ "struct_declaration_list", "struct_declaration",
+ "struct_declarator_list", "struct_declarator", "initializer",
+ "declaration_statement", "statement", "simple_statement",
+ "compound_statement", "@1", "@2", "statement_no_new_scope",
+ "compound_statement_no_new_scope", "statement_list",
+ "expression_statement", "selection_statement",
+ "selection_rest_statement", "condition", "iteration_statement", "@3",
+ "@4", "@5", "for_init_statement", "conditionopt", "for_rest_statement",
+ "jump_statement", "translation_unit", "external_declaration",
+ "function_definition", "@6", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
+ 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
+ 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
+ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
+ 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
+ 345, 346, 347, 348
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 94, 95, 96, 96, 96, 96, 96, 97, 97,
+ 97, 97, 97, 97, 98, 99, 100, 100, 101, 101,
+ 102, 102, 103, 103, 104, 105, 105, 105, 106, 106,
+ 106, 106, 107, 107, 107, 108, 108, 108, 109, 109,
+ 109, 110, 111, 111, 111, 111, 111, 112, 112, 112,
+ 113, 114, 115, 116, 116, 117, 117, 118, 118, 119,
+ 119, 120, 120, 121, 121, 121, 121, 121, 122, 122,
+ 123, 124, 124, 124, 125, 126, 126, 127, 127, 128,
+ 129, 129, 130, 130, 130, 130, 131, 131, 131, 131,
+ 132, 133, 133, 133, 133, 133, 134, 134, 134, 134,
+ 134, 134, 135, 135, 136, 136, 136, 136, 136, 137,
+ 137, 138, 138, 138, 139, 139, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 141, 141, 142, 142,
+ 143, 144, 144, 145, 145, 146, 147, 148, 148, 149,
+ 149, 149, 149, 149, 150, 151, 152, 150, 153, 153,
+ 154, 154, 155, 155, 156, 156, 157, 158, 158, 159,
+ 159, 161, 160, 162, 160, 163, 160, 164, 164, 165,
+ 165, 166, 166, 167, 167, 167, 167, 167, 168, 168,
+ 169, 169, 171, 170
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
+ 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
+ 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
+ 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
+ 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
+ 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
+ 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
+ 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
+ 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
+ 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
+ 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
+ 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 5, 4, 1, 2,
+ 3, 1, 3, 1, 4, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 0, 0, 5, 1, 1,
+ 2, 3, 1, 2, 1, 2, 5, 3, 1, 1,
+ 4, 0, 6, 0, 8, 0, 7, 1, 1, 1,
+ 0, 2, 3, 2, 2, 2, 3, 2, 1, 2,
+ 1, 1, 0, 3
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
+ 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
+ 129, 130, 131, 108, 106, 0, 116, 132, 133, 135,
+ 191, 192, 0, 76, 86, 0, 91, 96, 0, 102,
+ 0, 109, 114, 134, 0, 188, 190, 107, 101, 0,
+ 0, 0, 71, 0, 74, 86, 0, 87, 88, 89,
+ 77, 0, 86, 0, 72, 97, 103, 110, 0, 1,
+ 189, 0, 0, 0, 0, 138, 0, 193, 78, 83,
+ 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
+ 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
+ 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
+ 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
+ 59, 70, 0, 25, 73, 0, 143, 0, 141, 137,
+ 139, 0, 0, 173, 0, 0, 0, 0, 0, 155,
+ 160, 164, 35, 61, 68, 0, 146, 0, 102, 149,
+ 162, 148, 147, 0, 150, 151, 152, 153, 80, 82,
+ 84, 0, 0, 98, 0, 145, 100, 29, 30, 0,
+ 12, 13, 0, 0, 19, 18, 0, 116, 22, 24,
+ 31, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 115, 136, 0, 0, 140,
+ 184, 183, 0, 175, 0, 187, 185, 0, 171, 154,
+ 0, 64, 65, 66, 67, 63, 0, 0, 165, 161,
+ 163, 0, 93, 0, 95, 99, 7, 0, 14, 26,
+ 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
+ 44, 48, 49, 54, 56, 58, 0, 0, 142, 0,
+ 0, 0, 186, 0, 156, 62, 69, 0, 94, 9,
+ 0, 144, 0, 178, 177, 180, 0, 169, 0, 0,
+ 0, 81, 60, 0, 179, 0, 0, 168, 166, 0,
+ 0, 157, 0, 181, 0, 0, 0, 159, 172, 158,
+ 0, 182, 176, 167, 170, 174
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
+{
+ -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
+ 106, 107, 142, 109, 110, 111, 112, 113, 114, 115,
+ 116, 117, 118, 119, 120, 143, 144, 216, 145, 122,
+ 146, 147, 32, 33, 34, 79, 60, 61, 80, 35,
+ 36, 37, 38, 123, 40, 41, 42, 43, 74, 75,
+ 127, 128, 166, 149, 150, 151, 152, 210, 270, 288,
+ 289, 153, 154, 155, 278, 269, 156, 253, 202, 250,
+ 265, 275, 276, 157, 44, 45, 46, 53
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -250
+static const yytype_int16 yypact[] =
+{
+ 1225, 36, -250, -250, -250, 150, -250, -250, -250, -250,
+ -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,
+ -250, -250, -250, -250, -250, -33, -250, -250, -250, -250,
+ -250, -60, -22, -17, 21, -62, -250, 22, 1266, -250,
+ 1290, -250, 11, -250, 1138, -250, -250, -250, -250, 1290,
+ 14, 1266, -250, 27, -250, 34, 41, -250, -250, -250,
+ -250, 1266, 129, 61, -250, 17, -250, -250, 908, -250,
+ -250, 31, 1266, 72, 1042, -250, 283, -250, -250, -250,
+ -250, 90, 1266, -46, -250, 194, 908, 65, -250, -250,
+ -250, -250, 908, 908, 908, -250, -250, -250, -250, -250,
+ -40, -250, -250, -250, 80, -25, 975, 87, -250, 908,
+ 35, 13, -250, -26, 68, -250, -250, -250, 110, 109,
+ -54, -250, 96, -250, -250, 1083, 98, 33, -250, -250,
+ -250, 91, 92, -250, 104, 107, 99, 760, 108, 105,
+ -250, -250, 24, -250, -250, 37, -250, -60, 112, -250,
+ -250, -250, -250, 365, -250, -250, -250, -250, 111, -250,
+ -250, 827, 908, -250, 113, -250, -250, -250, -250, 4,
+ -250, -250, 908, 1179, -250, -250, 908, 114, -250, -250,
+ -250, 908, 908, 908, 908, 908, 908, 908, 908, 908,
+ 908, 908, 908, 908, 908, -250, -250, 908, 72, -250,
+ -250, -250, 447, -250, 908, -250, -250, 42, -250, -250,
+ 447, -250, -250, -250, -250, -250, 908, 908, -250, -250,
+ -250, 908, -250, 115, -250, -250, -250, 116, 117, -250,
+ 120, -250, -250, -250, -250, 35, 35, -250, -250, -250,
+ -250, -26, -26, -250, 110, 109, 51, 119, -250, 144,
+ 611, 23, -250, 693, 447, -250, -250, 122, -250, -250,
+ 908, -250, 123, -250, -250, 693, 447, 117, 153, 126,
+ 128, -250, -250, 908, -250, 127, 137, 171, -250, 130,
+ 529, -250, 28, 908, 529, 447, 908, -250, -250, -250,
+ 131, 117, -250, -250, -250, -250
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int16 yypgoto[] =
+{
+ -250, -250, -250, -250, -250, -250, -250, 39, -250, -250,
+ -250, -250, -45, -250, -18, -250, -79, -30, -250, -250,
+ -250, 38, 52, 20, -250, -63, -85, -250, -92, -71,
+ 6, 9, -250, -250, -250, 132, 172, 166, 148, -250,
+ -250, -246, -21, 0, 226, -24, -250, -250, 162, -66,
+ -250, 45, -159, -3, -136, -249, -250, -250, -250, -36,
+ 196, 46, 1, -250, -250, -13, -250, -250, -250, -250,
+ -250, -250, -250, -250, -250, 211, -250, -250
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what YYDEFACT says.
+ If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -76
+static const yytype_int16 yytable[] =
+{
+ 39, 165, 169, 224, 193, 121, 30, 268, 130, 31,
+ 50, 170, 171, 62, 164, 63, 67, 220, 64, 268,
+ 52, 178, 121, 108, 56, 71, 161, 185, 186, 6,
+ 7, 287, 172, 162, 62, 287, 173, 56, 66, 194,
+ 108, 51, 6, 7, 39, 207, 175, 167, 168, 54,
+ 30, 73, 176, 31, 57, 58, 59, 23, 24, 130,
+ 55, 81, 187, 188, 180, 65, 249, 57, 58, 59,
+ 23, 24, 73, 47, 73, 226, 148, 165, 47, 48,
+ 228, 217, 81, 68, 211, 212, 213, 84, 72, 85,
+ 223, 232, -75, 214, 266, 183, 86, 184, 121, 290,
+ 217, 76, 246, 215, 83, 217, 237, 238, 239, 240,
+ 198, 124, 251, 199, 217, 126, 108, 218, 220, 217,
+ 181, 182, 252, 189, 190, 73, 247, 294, 217, 260,
+ 277, 255, 256, 158, 121, -26, 233, 234, 108, 108,
+ 108, 108, 108, 108, 108, 108, 108, 108, 108, 293,
+ 257, 174, 108, 148, 2, 3, 4, 179, 121, 241,
+ 242, 267, 57, 58, 59, 235, 236, 191, 192, 195,
+ 197, 200, 201, 267, 203, 272, 108, 204, 208, 205,
+ 209, 282, -25, 221, 262, -20, 225, 285, 258, 259,
+ -27, 291, 261, 273, 217, 271, 279, 280, 2, 3,
+ 4, 165, 148, 281, 8, 9, 10, 283, 284, 286,
+ 148, 295, 231, 245, 159, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 78, 82, 243,
+ 160, 49, 25, 26, 125, 27, 28, 87, 29, 88,
+ 89, 90, 91, 248, 244, 92, 93, 263, 292, 77,
+ 148, 264, 274, 148, 148, 70, 254, 0, 0, 0,
+ 0, 0, 0, 0, 94, 148, 148, 163, 0, 0,
+ 0, 0, 0, 0, 0, 95, 96, 0, 97, 0,
+ 148, 0, 0, 0, 148, 148, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 131, 132, 133, 0,
+ 134, 135, 136, 137, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
+ 24, 25, 26, 138, 27, 28, 87, 29, 88, 89,
+ 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 94, 0, 0, 0, 139, 140, 0,
+ 0, 0, 0, 141, 95, 96, 0, 97, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 131, 132,
+ 133, 0, 134, 135, 136, 137, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
+ 0, 23, 24, 25, 26, 138, 27, 28, 87, 29,
+ 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 94, 0, 0, 0, 139,
+ 219, 0, 0, 0, 0, 141, 95, 96, 0, 97,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 131, 132, 133, 0, 134, 135, 136, 137, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 0, 0, 0, 23, 24, 25, 26, 138, 27, 28,
+ 87, 29, 88, 89, 90, 91, 0, 0, 92, 93,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
+ 0, 139, 0, 0, 0, 0, 0, 141, 95, 96,
+ 0, 97, 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 131, 132, 133, 0, 134, 135, 136, 137,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 0, 0, 0, 23, 24, 25, 26, 138,
+ 27, 28, 87, 29, 88, 89, 90, 91, 0, 0,
+ 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
+ 0, 0, 0, 76, 0, 0, 0, 0, 0, 141,
+ 95, 96, 0, 97, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 0, 0, 0, 0, 0, 0,
+ 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
+ 26, 0, 27, 28, 87, 29, 88, 89, 90, 91,
+ 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 94, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 141, 95, 96, 0, 97, 56, 2, 3, 4,
+ 0, 6, 7, 8, 9, 10, 0, 0, 0, 0,
+ 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
+ 24, 25, 26, 0, 27, 28, 87, 29, 88, 89,
+ 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 94, 2, 3, 4, 0, 0, 0,
+ 8, 9, 10, 0, 95, 96, 0, 97, 0, 0,
+ 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
+ 0, 27, 28, 87, 29, 88, 89, 90, 91, 0,
+ 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 94, 2, 3, 4, 0, 0, 0, 8, 9, 10,
+ 206, 95, 96, 0, 97, 0, 0, 0, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
+ 87, 29, 88, 89, 90, 91, 0, 0, 92, 93,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
+ 222, 0, 0, 0, 0, 0, 0, 0, 95, 96,
+ 0, 97, 2, 3, 4, 0, 0, 0, 8, 9,
+ 10, 0, 0, 0, 0, 0, 0, 0, 0, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
+ 28, 87, 29, 88, 89, 90, 91, 0, 0, 92,
+ 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 94, 2,
+ 3, 4, 0, 0, 0, 8, 9, 10, 0, 95,
+ 96, 0, 97, 0, 0, 0, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
+ 0, 0, 0, 25, 177, 0, 27, 28, 87, 29,
+ 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 94, 2, 3, 4, 0,
+ 0, 0, 8, 9, 10, 0, 95, 96, 0, 97,
+ 0, 0, 0, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 0, 0, 0, 0, 0,
+ 25, 26, 0, 27, 28, 0, 29, 2, 3, 4,
+ 0, 0, 0, 8, 9, 10, 0, 0, 0, 0,
+ 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 0, 129, 0, 0,
+ 0, 25, 26, 0, 27, 28, 0, 29, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 69, 0,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 0, 0, 0, 0, 0, 0, 0, 196, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 0, 0, 0, 23, 24, 25, 26, 0, 27,
+ 28, 0, 29, 2, 3, 4, 0, 0, 0, 8,
+ 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
+ 27, 28, 229, 29, 0, 0, 0, 230, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 0, 0,
+ 0, 0, 0, 0, 0, 0, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
+ 0, 23, 24, 25, 26, 0, 27, 28, 0, 29,
+ 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
+ 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
+ 8, 9, 10, 0, 25, 26, 0, 27, 28, 0,
+ 29, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
+ 0, 27, 28, 0, 29
+};
+
+static const yytype_int16 yycheck[] =
+{
+ 0, 86, 94, 162, 58, 68, 0, 253, 74, 0,
+ 43, 51, 52, 34, 85, 77, 40, 153, 80, 265,
+ 80, 106, 85, 68, 3, 49, 72, 53, 54, 8,
+ 9, 280, 72, 79, 55, 284, 76, 3, 38, 93,
+ 85, 74, 8, 9, 44, 137, 71, 92, 93, 71,
+ 44, 51, 77, 44, 33, 34, 35, 36, 37, 125,
+ 77, 61, 88, 89, 109, 43, 202, 33, 34, 35,
+ 36, 37, 72, 37, 74, 71, 76, 162, 37, 43,
+ 172, 77, 82, 72, 60, 61, 62, 70, 74, 72,
+ 161, 176, 71, 69, 71, 82, 79, 84, 161, 71,
+ 77, 74, 194, 79, 43, 77, 185, 186, 187, 188,
+ 77, 80, 204, 80, 77, 43, 161, 80, 254, 77,
+ 85, 86, 80, 55, 56, 125, 197, 286, 77, 78,
+ 266, 216, 217, 43, 197, 70, 181, 182, 183, 184,
+ 185, 186, 187, 188, 189, 190, 191, 192, 193, 285,
+ 221, 71, 197, 153, 4, 5, 6, 70, 221, 189,
+ 190, 253, 33, 34, 35, 183, 184, 57, 59, 73,
+ 72, 80, 80, 265, 70, 260, 221, 70, 70, 80,
+ 75, 273, 70, 72, 40, 71, 73, 16, 73, 73,
+ 70, 283, 73, 70, 77, 73, 43, 71, 4, 5,
+ 6, 286, 202, 75, 10, 11, 12, 80, 71, 79,
+ 210, 80, 173, 193, 82, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 55, 62, 191,
+ 82, 5, 38, 39, 72, 41, 42, 43, 44, 45,
+ 46, 47, 48, 198, 192, 51, 52, 250, 284, 53,
+ 250, 250, 265, 253, 254, 44, 210, -1, -1, -1,
+ -1, -1, -1, -1, 70, 265, 266, 73, -1, -1,
+ -1, -1, -1, -1, -1, 81, 82, -1, 84, -1,
+ 280, -1, -1, -1, 284, 285, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, -1,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, -1, -1, 51, 52, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 70, -1, -1, -1, 74, 75, -1,
+ -1, -1, -1, 80, 81, 82, -1, 84, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
+ -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, -1, -1, 51, 52, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 70, -1, -1, -1, 74,
+ 75, -1, -1, -1, -1, 80, 81, 82, -1, 84,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, -1, -1, 51, 52,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 70, -1, -1,
+ -1, 74, -1, -1, -1, -1, -1, 80, 81, 82,
+ -1, 84, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, -1, -1,
+ 51, 52, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 70,
+ -1, -1, -1, 74, -1, -1, -1, -1, -1, 80,
+ 81, 82, -1, 84, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
+ -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
+ 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
+ -1, -1, 51, 52, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 70, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 80, 81, 82, -1, 84, 3, 4, 5, 6,
+ -1, 8, 9, 10, 11, 12, -1, -1, -1, -1,
+ -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
+ 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
+ 47, 48, -1, -1, 51, 52, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 70, 4, 5, 6, -1, -1, -1,
+ 10, 11, 12, -1, 81, 82, -1, 84, -1, -1,
+ -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
+ -1, 41, 42, 43, 44, 45, 46, 47, 48, -1,
+ -1, 51, 52, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 70, 4, 5, 6, -1, -1, -1, 10, 11, 12,
+ 80, 81, 82, -1, 84, -1, -1, -1, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
+ 43, 44, 45, 46, 47, 48, -1, -1, 51, 52,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 70, -1, -1,
+ 73, -1, -1, -1, -1, -1, -1, -1, 81, 82,
+ -1, 84, 4, 5, 6, -1, -1, -1, 10, 11,
+ 12, -1, -1, -1, -1, -1, -1, -1, -1, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
+ 42, 43, 44, 45, 46, 47, 48, -1, -1, 51,
+ 52, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 70, 4,
+ 5, 6, -1, -1, -1, 10, 11, 12, -1, 81,
+ 82, -1, 84, -1, -1, -1, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
+ -1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
+ 45, 46, 47, 48, -1, -1, 51, 52, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 70, 4, 5, 6, -1,
+ -1, -1, 10, 11, 12, -1, 81, 82, -1, 84,
+ -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, -1, -1, -1, -1, -1,
+ 38, 39, -1, 41, 42, -1, 44, 4, 5, 6,
+ -1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
+ -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, -1, 75, -1, -1,
+ -1, 38, 39, -1, 41, 42, -1, 44, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 0, -1,
+ -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, -1, -1, -1, -1, -1, -1, -1, 75, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, -1, -1, -1, 36, 37, 38, 39, -1, 41,
+ 42, -1, 44, 4, 5, 6, -1, -1, -1, 10,
+ 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
+ 41, 42, 43, 44, -1, -1, -1, 48, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, -1, -1,
+ -1, -1, -1, -1, -1, -1, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
+ -1, 36, 37, 38, 39, -1, 41, 42, -1, 44,
+ 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
+ -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
+ 10, 11, 12, -1, 38, 39, -1, 41, 42, -1,
+ 44, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
+ -1, 41, 42, -1, 44
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 36, 37, 38, 39, 41, 42, 44,
+ 124, 125, 126, 127, 128, 133, 134, 135, 136, 137,
+ 138, 139, 140, 141, 168, 169, 170, 37, 43, 138,
+ 43, 74, 80, 171, 71, 77, 3, 33, 34, 35,
+ 130, 131, 136, 77, 80, 43, 137, 139, 72, 0,
+ 169, 139, 74, 137, 142, 143, 74, 154, 130, 129,
+ 132, 137, 131, 43, 70, 72, 79, 43, 45, 46,
+ 47, 48, 51, 52, 70, 81, 82, 84, 95, 96,
+ 97, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+ 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
+ 118, 119, 123, 137, 80, 142, 43, 144, 145, 75,
+ 143, 13, 14, 15, 17, 18, 19, 20, 40, 74,
+ 75, 80, 106, 119, 120, 122, 124, 125, 137, 147,
+ 148, 149, 150, 155, 156, 157, 160, 167, 43, 129,
+ 132, 72, 79, 73, 123, 120, 146, 106, 106, 122,
+ 51, 52, 72, 76, 71, 71, 77, 39, 120, 70,
+ 106, 85, 86, 82, 84, 53, 54, 88, 89, 55,
+ 56, 57, 59, 58, 93, 73, 75, 72, 77, 80,
+ 80, 80, 162, 70, 70, 80, 80, 122, 70, 75,
+ 151, 60, 61, 62, 69, 79, 121, 77, 80, 75,
+ 148, 72, 73, 123, 146, 73, 71, 98, 122, 43,
+ 48, 101, 120, 106, 106, 108, 108, 110, 110, 110,
+ 110, 111, 111, 115, 116, 117, 122, 123, 145, 148,
+ 163, 122, 80, 161, 155, 120, 120, 123, 73, 73,
+ 78, 73, 40, 147, 156, 164, 71, 122, 135, 159,
+ 152, 73, 120, 70, 159, 165, 166, 148, 158, 43,
+ 71, 75, 122, 80, 71, 16, 79, 149, 153, 154,
+ 71, 122, 153, 148, 146, 80
+};
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define YYFAIL goto yyerrlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yytoken = YYTRANSLATE (yychar); \
+ YYPOPSTACK (1); \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (context, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (YYID (0))
+
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
+#ifndef YY_LOCATION_PRINT
+# if YYLTYPE_IS_TRIVIAL
+# define YY_LOCATION_PRINT(File, Loc) \
+ fprintf (File, "%d.%d-%d.%d", \
+ (Loc).first_line, (Loc).first_column, \
+ (Loc).last_line, (Loc).last_column)
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, YYLEX_PARAM)
+#else
+# define YYLEX yylex (&yylval)
+#endif
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, context); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+ TParseContext* context;
+#endif
+{
+ if (!yyvaluep)
+ return;
+ YYUSE (context);
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
+# endif
+ switch (yytype)
+ {
+ default:
+ break;
+ }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep, context)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+ TParseContext* context;
+#endif
+{
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ yytype_int16 *bottom;
+ yytype_int16 *top;
+#endif
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; bottom <= top; ++bottom)
+ YYFPRINTF (stderr, " %d", *bottom);
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule, context)
+ YYSTYPE *yyvsp;
+ int yyrule;
+ TParseContext* context;
+#endif
+{
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ unsigned long int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ fprintf (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , context);
+ fprintf (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule, context); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into YYRESULT an error message about the unexpected token
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
+ including the terminating null byte. If YYRESULT is null, do not
+ copy anything; just return the number of bytes that would be
+ copied. As a special case, return 0 if an ordinary "syntax error"
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
+ size calculation. */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+ int yyn = yypact[yystate];
+
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+ return 0;
+ else
+ {
+ int yytype = YYTRANSLATE (yychar);
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ int yysize_overflow = 0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ int yyx;
+
+# if 0
+ /* This is so xgettext sees the translatable formats that are
+ constructed on the fly. */
+ YY_("syntax error, unexpected %s");
+ YY_("syntax error, unexpected %s, expecting %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+ char *yyfmt;
+ char const *yyf;
+ static char const yyunexpected[] = "syntax error, unexpected %s";
+ static char const yyexpecting[] = ", expecting %s";
+ static char const yyor[] = " or %s";
+ char yyformat[sizeof yyunexpected
+ + sizeof yyexpecting - 1
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+ * (sizeof yyor - 1))];
+ char const *yyprefix = yyexpecting;
+
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 1;
+
+ yyarg[0] = yytname[yytype];
+ yyfmt = yystpcpy (yyformat, yyunexpected);
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ yyformat[sizeof yyunexpected - 1] = '\0';
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+ yyfmt = yystpcpy (yyfmt, yyprefix);
+ yyprefix = yyor;
+ }
+
+ yyf = YY_(yyformat);
+ yysize1 = yysize + yystrlen (yyf);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+
+ if (yysize_overflow)
+ return YYSIZE_MAXIMUM;
+
+ if (yyresult)
+ {
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ char *yyp = yyresult;
+ int yyi = 0;
+ while ((*yyp = *yyf) != '\0')
+ {
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyf += 2;
+ }
+ else
+ {
+ yyp++;
+ yyf++;
+ }
+ }
+ }
+ return yysize;
+ }
+}
+#endif /* YYERROR_VERBOSE */
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep, context)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+ TParseContext* context;
+#endif
+{
+ YYUSE (yyvaluep);
+ YYUSE (context);
+
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes. */
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (TParseContext* context);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (TParseContext* context)
+#else
+int
+yyparse (context)
+ TParseContext* context;
+#endif
+#endif
+{
+ /* The look-ahead symbol. */
+int yychar;
+
+/* The semantic value of the look-ahead symbol. */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far. */
+int yynerrs;
+
+ int yystate;
+ int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Look-ahead token as an internal (translated) token number. */
+ int yytoken = 0;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss = yyssa;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ YYSIZE_T yystacksize = YYINITDEPTH;
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss);
+ YYSTACK_RELOCATE (yyvs);
+
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ look-ahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to look-ahead token. */
+ yyn = yypact[yystate];
+ if (yyn == YYPACT_NINF)
+ goto yydefault;
+
+ /* Not known => get a look-ahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yyn == 0 || yyn == YYTABLE_NINF)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the look-ahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ *++yyvsp = yylval;
+
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+
+ {
+ // The symbol table search was done in the lexical phase
+ const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
+ const TVariable* variable;
+ if (symbol == 0) {
+ context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
+ context->recover();
+ TType type(EbtFloat, EbpUndefined);
+ TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
+ context->symbolTable.insert(*fakeVariable);
+ variable = fakeVariable;
+ } else {
+ // This identifier can only be a variable type symbol
+ if (! symbol->isVariable()) {
+ context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
+ context->recover();
+ }
+ variable = static_cast<const TVariable*>(symbol);
+ }
+
+ // don't delete $1.string, it's used by error recovery, and the pool
+ // pop will reclaim the memory
+
+ if (variable->getType().getQualifier() == EvqConst ) {
+ ConstantUnion* constArray = variable->getConstPointer();
+ TType t(variable->getType());
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
+ } else
+ (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
+ variable->getName(),
+ variable->getType(), (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 3:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 4:
+
+ {
+ //
+ // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
+ // check for overflow for constants
+ //
+ if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
+ context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
+ context->recover();
+ }
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 5:
+
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 6:
+
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 7:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 8:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 9:
+
+ {
+ if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
+ context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str(), "");
+ else
+ context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
+ context->recover();
+ }
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
+ (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
+ } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
+ TVectorFields fields;
+ fields.num = 1;
+ fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
+ (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
+ } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
+ (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
+ }
+ } else {
+ if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
+ if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
+ context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
+ context->recover();
+ } else {
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
+ if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line))
+ context->recover();
+ } else {
+ if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
+ context->recover();
+ }
+ } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
+ context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
+ context->recover();
+ }
+ }
+ (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
+ }
+ } else {
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
+ context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
+ context->recover();
+ }
+
+ (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
+ }
+ }
+ if ((yyval.interm.intermTypedNode) == 0) {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setFConst(0.0f);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
+ } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
+ else
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()));
+
+ if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
+ (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
+ } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
+ else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
+ else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
+ else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
+ else
+ (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
+ ;}
+ break;
+
+ case 10:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 11:
+
+ {
+ if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
+ context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
+ context->recover();
+ }
+
+ if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
+ TVectorFields fields;
+ if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
+ fields.num = 1;
+ fields.offsets[0] = 0;
+ context->recover();
+ }
+
+ if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
+ (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ else
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
+ } else {
+ if (fields.num == 1) {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(fields.offsets[0]);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
+ } else {
+ TString vectorString = *(yyvsp[(3) - (3)].lex).string;
+ TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
+ }
+ }
+ } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
+ TMatrixFields fields;
+ if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
+ fields.wholeRow = false;
+ fields.wholeCol = false;
+ fields.row = 0;
+ fields.col = 0;
+ context->recover();
+ }
+
+ if (fields.wholeRow || fields.wholeCol) {
+ context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(0);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
+ } else {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
+ }
+ } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
+ bool fieldFound = false;
+ const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
+ if (fields == 0) {
+ context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ } else {
+ unsigned int i;
+ for (i = 0; i < fields->size(); ++i) {
+ if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound) {
+ if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
+ (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ else {
+ (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
+ // change the qualifier of the return type, not of the structure field
+ // as the structure definition is shared between various structures.
+ (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
+ }
+ } else {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(i);
+ TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
+ }
+ } else {
+ context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ }
+ } else {
+ context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str(), "");
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ // don't delete $3.string, it's from the pool
+ ;}
+ break;
+
+ case 12:
+
+ {
+ if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
+ context->recover();
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 13:
+
+ {
+ if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
+ context->recover();
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 14:
+
+ {
+ if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 15:
+
+ {
+ TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
+ TOperator op = fnCall->getBuiltInOp();
+
+ if (op != EOpNull)
+ {
+ //
+ // Then this should be a constructor.
+ // Don't go through the symbol table for constructors.
+ // Their parameters will be verified algorithmically.
+ //
+ TType type(EbtVoid, EbpUndefined); // use this to get the type back
+ if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
+ (yyval.interm.intermTypedNode) = 0;
+ } else {
+ //
+ // It's a constructor, of type 'type'.
+ //
+ (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
+ }
+
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->recover();
+ (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
+ }
+ (yyval.interm.intermTypedNode)->setType(type);
+ } else {
+ //
+ // Not a constructor. Find it in the symbol table.
+ //
+ const TFunction* fnCandidate;
+ bool builtIn;
+ fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
+ if (fnCandidate) {
+ //
+ // A declared function.
+ //
+ if (builtIn && !fnCandidate->getExtension().empty() &&
+ context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
+ context->recover();
+ }
+ op = fnCandidate->getBuiltInOp();
+ if (builtIn && op != EOpNull) {
+ //
+ // A function call mapped to a built-in operation.
+ //
+ if (fnCandidate->getParamCount() == 1) {
+ //
+ // Treat it like a built-in unary operator.
+ //
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
+ "built in unary operator function. Type: %s",
+ static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
+ YYERROR;
+ }
+ } else {
+ (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
+ }
+ } else {
+ // This is a real function call
+
+ (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
+ (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
+
+ // this is how we know whether the given function is a builtIn function or a user defined function
+ // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
+ // if builtIn == true, it's definitely a builtIn function with EOpNull
+ if (!builtIn)
+ (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
+ (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
+
+ TQualifier qual;
+ for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
+ qual = fnCandidate->getParam(i).type->getQualifier();
+ if (qual == EvqOut || qual == EvqInOut) {
+ if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
+ context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
+ context->recover();
+ }
+ }
+ }
+ }
+ (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
+ } else {
+ // error message was put out by PaFindFunction()
+ // Put on a dummy node for error recovery
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setFConst(0.0f);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
+ context->recover();
+ }
+ }
+ delete fnCall;
+ ;}
+ break;
+
+ case 16:
+
+ {
+ (yyval.interm) = (yyvsp[(1) - (1)].interm);
+ ;}
+ break;
+
+ case 17:
+
+ {
+ context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
+ context->recover();
+ (yyval.interm) = (yyvsp[(3) - (3)].interm);
+ ;}
+ break;
+
+ case 18:
+
+ {
+ (yyval.interm) = (yyvsp[(1) - (2)].interm);
+ (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
+ ;}
+ break;
+
+ case 19:
+
+ {
+ (yyval.interm) = (yyvsp[(1) - (2)].interm);
+ (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
+ ;}
+ break;
+
+ case 20:
+
+ {
+ (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
+ (yyval.interm).intermNode = 0;
+ ;}
+ break;
+
+ case 21:
+
+ {
+ (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
+ (yyval.interm).intermNode = 0;
+ ;}
+ break;
+
+ case 22:
+
+ {
+ TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
+ (yyvsp[(1) - (2)].interm.function)->addParameter(param);
+ (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
+ (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 23:
+
+ {
+ TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
+ (yyvsp[(1) - (3)].interm).function->addParameter(param);
+ (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
+ (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ ;}
+ break;
+
+ case 24:
+
+ {
+ (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
+ ;}
+ break;
+
+ case 25:
+
+ {
+ //
+ // Constructor
+ //
+ if ((yyvsp[(1) - (1)].interm.type).array) {
+ // Constructors for arrays are not allowed.
+ context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", "array", "");
+ context->recover();
+ (yyvsp[(1) - (1)].interm.type).setArray(false);
+ }
+
+ TOperator op = EOpNull;
+ if ((yyvsp[(1) - (1)].interm.type).userDef) {
+ op = EOpConstructStruct;
+ } else {
+ switch ((yyvsp[(1) - (1)].interm.type).type) {
+ case EbtFloat:
+ if ((yyvsp[(1) - (1)].interm.type).matrix) {
+ switch((yyvsp[(1) - (1)].interm.type).size) {
+ case 2: op = EOpConstructMat2; break;
+ case 3: op = EOpConstructMat3; break;
+ case 4: op = EOpConstructMat4; break;
+ }
+ } else {
+ switch((yyvsp[(1) - (1)].interm.type).size) {
+ case 1: op = EOpConstructFloat; break;
+ case 2: op = EOpConstructVec2; break;
+ case 3: op = EOpConstructVec3; break;
+ case 4: op = EOpConstructVec4; break;
+ }
+ }
+ break;
+ case EbtInt:
+ switch((yyvsp[(1) - (1)].interm.type).size) {
+ case 1: op = EOpConstructInt; break;
+ case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
+ case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
+ case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
+ }
+ break;
+ case EbtBool:
+ switch((yyvsp[(1) - (1)].interm.type).size) {
+ case 1: op = EOpConstructBool; break;
+ case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
+ case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
+ case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
+ }
+ break;
+ default: break;
+ }
+ if (op == EOpNull) {
+ context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
+ context->recover();
+ (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
+ op = EOpConstructFloat;
+ }
+ }
+ TString tempString;
+ TType type((yyvsp[(1) - (1)].interm.type));
+ TFunction *function = new TFunction(&tempString, type, op);
+ (yyval.interm.function) = function;
+ ;}
+ break;
+
+ case 26:
+
+ {
+ if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
+ context->recover();
+ TType type(EbtVoid, EbpUndefined);
+ TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
+ (yyval.interm.function) = function;
+ ;}
+ break;
+
+ case 27:
+
+ {
+ if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
+ context->recover();
+ TType type(EbtVoid, EbpUndefined);
+ TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
+ (yyval.interm.function) = function;
+ ;}
+ break;
+
+ case 28:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 29:
+
+ {
+ if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
+ context->recover();
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 30:
+
+ {
+ if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
+ context->recover();
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 31:
+
+ {
+ if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ const char* errorOp = "";
+ switch((yyvsp[(1) - (2)].interm).op) {
+ case EOpNegative: errorOp = "-"; break;
+ case EOpLogicalNot: errorOp = "!"; break;
+ default: break;
+ }
+ context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
+ }
+ } else
+ (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 32:
+
+ { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
+ break;
+
+ case 33:
+
+ { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
+ break;
+
+ case 34:
+
+ { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
+ break;
+
+ case 35:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 36:
+
+ {
+ FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 37:
+
+ {
+ FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 38:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 39:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 40:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 41:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 42:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 43:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 44:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 45:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 46:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 47:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 48:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 49:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 50:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 51:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 52:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 53:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 54:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 55:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 56:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 57:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 58:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst(false);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
+ }
+ ;}
+ break;
+
+ case 59:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 60:
+
+ {
+ if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
+ context->recover();
+
+ (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yyvsp[(2) - (5)].lex).line);
+ if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
+ (yyval.interm.intermTypedNode) = 0;
+
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 61:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 62:
+
+ {
+ if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
+ context->recover();
+ (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 63:
+
+ { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
+ break;
+
+ case 64:
+
+ { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;}
+ break;
+
+ case 65:
+
+ { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;}
+ break;
+
+ case 66:
+
+ { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
+ break;
+
+ case 67:
+
+ { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
+ break;
+
+ case 68:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 69:
+
+ {
+ (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
+ if ((yyval.interm.intermTypedNode) == 0) {
+ context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
+ }
+ ;}
+ break;
+
+ case 70:
+
+ {
+ if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
+ context->recover();
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 71:
+
+ {
+ TFunction &function = *((yyvsp[(1) - (2)].interm).function);
+
+ TIntermAggregate *prototype = new TIntermAggregate;
+ prototype->setType(function.getReturnType());
+ prototype->setName(function.getName());
+
+ for (int i = 0; i < function.getParamCount(); i++)
+ {
+ const TParameter &param = function.getParam(i);
+ if (param.name != 0)
+ {
+ TVariable *variable = new TVariable(param.name, *param.type);
+
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
+ }
+ else
+ {
+ prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
+ }
+ }
+
+ prototype->setOp(EOpPrototype);
+ (yyval.interm.intermNode) = prototype;
+ ;}
+ break;
+
+ case 72:
+
+ {
+ if ((yyvsp[(1) - (2)].interm).intermAggregate)
+ (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
+ (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
+ ;}
+ break;
+
+ case 73:
+
+ {
+ context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
+ (yyval.interm.intermNode) = 0;
+ ;}
+ break;
+
+ case 74:
+
+ {
+ //
+ // Multiple declarations of the same function are allowed.
+ //
+ // If this is a definition, the definition production code will check for redefinitions
+ // (we don't know at this point if it's a definition or not).
+ //
+ // Redeclarations are allowed. But, return types and parameter qualifiers must match.
+ //
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
+ if (prevDec) {
+ if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
+ context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
+ context->recover();
+ }
+ for (int i = 0; i < prevDec->getParamCount(); ++i) {
+ if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
+ context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
+ context->recover();
+ }
+ }
+ }
+
+ //
+ // If this is a redeclaration, it could also be a definition,
+ // in which case, we want to use the variable names from this one, and not the one that's
+ // being redeclared. So, pass back up this declaration, not the one in the symbol table.
+ //
+ (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
+ (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
+
+ context->symbolTable.insert(*(yyval.interm).function);
+ ;}
+ break;
+
+ case 75:
+
+ {
+ (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
+ ;}
+ break;
+
+ case 76:
+
+ {
+ (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
+ ;}
+ break;
+
+ case 77:
+
+ {
+ // Add the parameter
+ (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
+ if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
+ (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
+ else
+ delete (yyvsp[(2) - (2)].interm).param.type;
+ ;}
+ break;
+
+ case 78:
+
+ {
+ //
+ // Only first parameter of one-parameter functions can be void
+ // The check for named parameters not being void is done in parameter_declarator
+ //
+ if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
+ //
+ // This parameter > first is void
+ //
+ context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
+ context->recover();
+ delete (yyvsp[(3) - (3)].interm).param.type;
+ } else {
+ // Add the parameter
+ (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
+ (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
+ }
+ ;}
+ break;
+
+ case 79:
+
+ {
+ if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
+ context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
+ context->recover();
+ }
+ // make sure a sampler is not involved as well...
+ if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
+ context->recover();
+
+ // Add the function as a prototype after parsing it (we do not support recursion)
+ TFunction *function;
+ TType type((yyvsp[(1) - (3)].interm.type));
+ function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
+ (yyval.interm.function) = function;
+ ;}
+ break;
+
+ case 80:
+
+ {
+ if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
+ context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
+ context->recover();
+ }
+ if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
+ context->recover();
+ TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
+ (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
+ (yyval.interm).param = param;
+ ;}
+ break;
+
+ case 81:
+
+ {
+ // Check that we can make an array out of this type
+ if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
+ context->recover();
+
+ if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
+ context->recover();
+
+ int size;
+ if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
+ context->recover();
+ (yyvsp[(1) - (5)].interm.type).setArray(true, size);
+
+ TType* type = new TType((yyvsp[(1) - (5)].interm.type));
+ TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
+ (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
+ (yyval.interm).param = param;
+ ;}
+ break;
+
+ case 82:
+
+ {
+ (yyval.interm) = (yyvsp[(3) - (3)].interm);
+ if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
+ context->recover();
+ ;}
+ break;
+
+ case 83:
+
+ {
+ (yyval.interm) = (yyvsp[(2) - (2)].interm);
+ if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
+ context->recover();
+ if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
+ context->recover();
+ ;}
+ break;
+
+ case 84:
+
+ {
+ (yyval.interm) = (yyvsp[(3) - (3)].interm);
+ if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
+ context->recover();
+ ;}
+ break;
+
+ case 85:
+
+ {
+ (yyval.interm) = (yyvsp[(2) - (2)].interm);
+ if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
+ context->recover();
+ if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
+ context->recover();
+ ;}
+ break;
+
+ case 86:
+
+ {
+ (yyval.interm.qualifier) = EvqIn;
+ ;}
+ break;
+
+ case 87:
+
+ {
+ (yyval.interm.qualifier) = EvqIn;
+ ;}
+ break;
+
+ case 88:
+
+ {
+ (yyval.interm.qualifier) = EvqOut;
+ ;}
+ break;
+
+ case 89:
+
+ {
+ (yyval.interm.qualifier) = EvqInOut;
+ ;}
+ break;
+
+ case 90:
+
+ {
+ TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
+ (yyval.interm).param = param;
+ ;}
+ break;
+
+ case 91:
+
+ {
+ (yyval.interm) = (yyvsp[(1) - (1)].interm);
+
+ if ((yyval.interm).type.precision == EbpUndefined) {
+ (yyval.interm).type.precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm).type.type);
+ if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm).line, (yyval.interm).type.precision, (yyvsp[(1) - (1)].interm).type.type)) {
+ context->recover();
+ }
+ }
+ ;}
+ break;
+
+ case 92:
+
+ {
+ (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line), (yyvsp[(3) - (3)].lex).line);
+
+ if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
+ context->recover();
+
+ if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
+ context->recover();
+ ;}
+ break;
+
+ case 93:
+
+ {
+ if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
+ context->recover();
+
+ (yyval.interm) = (yyvsp[(1) - (5)].interm);
+
+ if (context->arrayTypeErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
+ context->recover();
+ else {
+ (yyvsp[(1) - (5)].interm).type.setArray(true);
+ TVariable* variable;
+ if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
+ context->recover();
+ }
+ ;}
+ break;
+
+ case 94:
+
+ {
+ if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
+ context->recover();
+
+ (yyval.interm) = (yyvsp[(1) - (6)].interm);
+
+ if (context->arrayTypeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
+ context->recover();
+ else {
+ int size;
+ if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
+ context->recover();
+ (yyvsp[(1) - (6)].interm).type.setArray(true, size);
+ TVariable* variable;
+ if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
+ context->recover();
+ TType type = TType((yyvsp[(1) - (6)].interm).type);
+ type.setArraySize(size);
+ (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(0, *(yyvsp[(3) - (6)].lex).string, type, (yyvsp[(3) - (6)].lex).line), (yyvsp[(3) - (6)].lex).line);
+ }
+ ;}
+ break;
+
+ case 95:
+
+ {
+ if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
+ context->recover();
+
+ (yyval.interm) = (yyvsp[(1) - (5)].interm);
+
+ TIntermNode* intermNode;
+ if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
+ //
+ // build the intermediate representation
+ //
+ if (intermNode)
+ (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
+ else
+ (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
+ } else {
+ context->recover();
+ (yyval.interm).intermAggregate = 0;
+ }
+ ;}
+ break;
+
+ case 96:
+
+ {
+ (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
+ (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yyvsp[(1) - (1)].interm.type).line), (yyvsp[(1) - (1)].interm.type).line);
+ ;}
+ break;
+
+ case 97:
+
+ {
+ (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line), (yyvsp[(2) - (2)].lex).line);
+
+ if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
+ context->recover();
+
+ (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
+
+ if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
+ context->recover();
+ ;}
+ break;
+
+ case 98:
+
+ {
+ (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line), (yyvsp[(2) - (4)].lex).line);
+
+ if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type)))
+ context->recover();
+
+ (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
+
+ if (context->arrayTypeErrorCheck((yyvsp[(3) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)) || context->arrayQualifierErrorCheck((yyvsp[(3) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ context->recover();
+ else {
+ (yyvsp[(1) - (4)].interm.type).setArray(true);
+ TVariable* variable;
+ if (context->arrayErrorCheck((yyvsp[(3) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), variable))
+ context->recover();
+ }
+ ;}
+ break;
+
+ case 99:
+
+ {
+ TType type = TType((yyvsp[(1) - (5)].interm.type));
+ int size;
+ if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
+ context->recover();
+ type.setArraySize(size);
+ (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line), (yyvsp[(2) - (5)].lex).line);
+
+ if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
+ context->recover();
+
+ if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
+ context->recover();
+
+ (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
+
+ if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
+ context->recover();
+ else {
+ int size;
+ if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
+ context->recover();
+
+ (yyvsp[(1) - (5)].interm.type).setArray(true, size);
+ TVariable* variable;
+ if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
+ context->recover();
+ }
+ ;}
+ break;
+
+ case 100:
+
+ {
+ if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ context->recover();
+
+ (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
+
+ TIntermNode* intermNode;
+ if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
+ //
+ // Build intermediate representation
+ //
+ if(intermNode)
+ (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
+ else
+ (yyval.interm).intermAggregate = 0;
+ } else {
+ context->recover();
+ (yyval.interm).intermAggregate = 0;
+ }
+ ;}
+ break;
+
+ case 101:
+
+ {
+ VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm).qualifier = EvqInvariantVaryingOut;
+ (yyval.interm).intermAggregate = 0;
+ ;}
+ break;
+
+ case 102:
+
+ {
+ (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
+
+ if ((yyvsp[(1) - (1)].interm.type).array) {
+ context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
+ context->recover();
+ (yyvsp[(1) - (1)].interm.type).setArray(false);
+ }
+ ;}
+ break;
+
+ case 103:
+
+ {
+ if ((yyvsp[(2) - (2)].interm.type).array) {
+ context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
+ context->recover();
+ (yyvsp[(2) - (2)].interm.type).setArray(false);
+ }
+
+ if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
+ ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
+ context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
+ context->recover();
+ }
+ if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
+ ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
+ context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
+ context->recover();
+ }
+ (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
+ (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
+ ;}
+ break;
+
+ case 104:
+
+ {
+ (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 105:
+
+ {
+ VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
+ if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
+ context->recover();
+ (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 106:
+
+ {
+ if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
+ context->recover();
+ if (context->shaderType == SH_VERTEX_SHADER)
+ (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
+ else
+ (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 107:
+
+ {
+ if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
+ context->recover();
+ if (context->shaderType == SH_VERTEX_SHADER)
+ (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
+ else
+ (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
+ ;}
+ break;
+
+ case 108:
+
+ {
+ if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
+ context->recover();
+ (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 109:
+
+ {
+ (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
+ ;}
+ break;
+
+ case 110:
+
+ {
+ (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
+ (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
+ ;}
+ break;
+
+ case 111:
+
+ {
+ (yyval.interm.precision) = EbpHigh;
+ ;}
+ break;
+
+ case 112:
+
+ {
+ (yyval.interm.precision) = EbpMedium;
+ ;}
+ break;
+
+ case 113:
+
+ {
+ (yyval.interm.precision) = EbpLow;
+ ;}
+ break;
+
+ case 114:
+
+ {
+ (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
+ ;}
+ break;
+
+ case 115:
+
+ {
+ (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
+
+ if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ context->recover();
+ else {
+ int size;
+ if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
+ context->recover();
+ (yyval.interm.type).setArray(true, size);
+ }
+ ;}
+ break;
+
+ case 116:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 117:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 118:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 119:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 120:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(2);
+ ;}
+ break;
+
+ case 121:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(3);
+ ;}
+ break;
+
+ case 122:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(4);
+ ;}
+ break;
+
+ case 123:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(2);
+ ;}
+ break;
+
+ case 124:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(3);
+ ;}
+ break;
+
+ case 125:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(4);
+ ;}
+ break;
+
+ case 126:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(2);
+ ;}
+ break;
+
+ case 127:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(3);
+ ;}
+ break;
+
+ case 128:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(4);
+ ;}
+ break;
+
+ case 129:
+
+ {
+ FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(2, true);
+ ;}
+ break;
+
+ case 130:
+
+ {
+ FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(3, true);
+ ;}
+ break;
+
+ case 131:
+
+ {
+ FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).setAggregate(4, true);
+ ;}
+ break;
+
+ case 132:
+
+ {
+ FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 133:
+
+ {
+ FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
+ ;}
+ break;
+
+ case 134:
+
+ {
+ FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
+ (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
+ (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ ;}
+ break;
+
+ case 135:
+
+ {
+ //
+ // This is for user defined type names. The lexical phase looked up the
+ // type.
+ //
+ TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
+ (yyval.interm.type).userDef = &structure;
+ ;}
+ break;
+
+ case 136:
+
+ {
+ if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
+ context->recover();
+
+ TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), *(yyvsp[(2) - (5)].lex).string);
+ TVariable* userTypeDef = new TVariable((yyvsp[(2) - (5)].lex).string, *structure, true);
+ if (! context->symbolTable.insert(*userTypeDef)) {
+ context->error((yyvsp[(2) - (5)].lex).line, "redefinition", (yyvsp[(2) - (5)].lex).string->c_str(), "struct");
+ context->recover();
+ }
+ (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
+ (yyval.interm.type).userDef = structure;
+ ;}
+ break;
+
+ case 137:
+
+ {
+ TType* structure = new TType((yyvsp[(3) - (4)].interm.typeList), TString(""));
+ (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (4)].lex).line);
+ (yyval.interm.type).userDef = structure;
+ ;}
+ break;
+
+ case 138:
+
+ {
+ (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
+ ;}
+ break;
+
+ case 139:
+
+ {
+ (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
+ for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
+ for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
+ if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
+ context->error((*(yyvsp[(2) - (2)].interm.typeList))[i].line, "duplicate field name in structure:", "struct", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str());
+ context->recover();
+ }
+ }
+ (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
+ }
+ ;}
+ break;
+
+ case 140:
+
+ {
+ (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
+
+ if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
+ context->recover();
+ }
+ for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
+ //
+ // Careful not to replace already known aspects of type, like array-ness
+ //
+ TType* type = (*(yyval.interm.typeList))[i].type;
+ type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
+ type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
+ type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
+
+ // don't allow arrays of arrays
+ if (type->isArray()) {
+ if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
+ context->recover();
+ }
+ if ((yyvsp[(1) - (3)].interm.type).array)
+ type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
+ if ((yyvsp[(1) - (3)].interm.type).userDef) {
+ type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
+ type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
+ }
+ }
+ ;}
+ break;
+
+ case 141:
+
+ {
+ (yyval.interm.typeList) = NewPoolTTypeList();
+ (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
+ ;}
+ break;
+
+ case 142:
+
+ {
+ (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
+ ;}
+ break;
+
+ case 143:
+
+ {
+ if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
+ context->recover();
+
+ (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
+ (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
+ (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
+ ;}
+ break;
+
+ case 144:
+
+ {
+ if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
+ context->recover();
+
+ (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
+ (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
+ (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
+
+ int size;
+ if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
+ context->recover();
+ (yyval.interm.typeLine).type->setArraySize(size);
+ ;}
+ break;
+
+ case 145:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
+ break;
+
+ case 146:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 147:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
+ break;
+
+ case 148:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 149:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 150:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 151:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 152:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 153:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 154:
+
+ { (yyval.interm.intermAggregate) = 0; ;}
+ break;
+
+ case 155:
+
+ { context->symbolTable.push(); ;}
+ break;
+
+ case 156:
+
+ { context->symbolTable.pop(); ;}
+ break;
+
+ case 157:
+
+ {
+ if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0)
+ (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
+ (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
+ ;}
+ break;
+
+ case 158:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 159:
+
+ { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
+ break;
+
+ case 160:
+
+ {
+ (yyval.interm.intermNode) = 0;
+ ;}
+ break;
+
+ case 161:
+
+ {
+ if ((yyvsp[(2) - (3)].interm.intermAggregate))
+ (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
+ (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
+ ;}
+ break;
+
+ case 162:
+
+ {
+ (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
+ ;}
+ break;
+
+ case 163:
+
+ {
+ (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
+ ;}
+ break;
+
+ case 164:
+
+ { (yyval.interm.intermNode) = 0; ;}
+ break;
+
+ case 165:
+
+ { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
+ break;
+
+ case 166:
+
+ {
+ if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
+ context->recover();
+ (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
+ ;}
+ break;
+
+ case 167:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
+ (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
+ ;}
+ break;
+
+ case 168:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
+ (yyval.interm.nodePair).node2 = 0;
+ ;}
+ break;
+
+ case 169:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
+ context->recover();
+ ;}
+ break;
+
+ case 170:
+
+ {
+ TIntermNode* intermNode;
+ if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ context->recover();
+ if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
+ context->recover();
+
+ if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
+ (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
+ else {
+ context->recover();
+ (yyval.interm.intermTypedNode) = 0;
+ }
+ ;}
+ break;
+
+ case 171:
+
+ { context->symbolTable.push(); ++context->loopNestingLevel; ;}
+ break;
+
+ case 172:
+
+ {
+ context->symbolTable.pop();
+ (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
+ --context->loopNestingLevel;
+ ;}
+ break;
+
+ case 173:
+
+ { ++context->loopNestingLevel; ;}
+ break;
+
+ case 174:
+
+ {
+ if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
+ context->recover();
+
+ (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
+ --context->loopNestingLevel;
+ ;}
+ break;
+
+ case 175:
+
+ { context->symbolTable.push(); ++context->loopNestingLevel; ;}
+ break;
+
+ case 176:
+
+ {
+ context->symbolTable.pop();
+ (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yyvsp[(1) - (7)].lex).line);
+ --context->loopNestingLevel;
+ ;}
+ break;
+
+ case 177:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
+ ;}
+ break;
+
+ case 178:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
+ ;}
+ break;
+
+ case 179:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 180:
+
+ {
+ (yyval.interm.intermTypedNode) = 0;
+ ;}
+ break;
+
+ case 181:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
+ (yyval.interm.nodePair).node2 = 0;
+ ;}
+ break;
+
+ case 182:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
+ (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
+ ;}
+ break;
+
+ case 183:
+
+ {
+ if (context->loopNestingLevel <= 0) {
+ context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
+ context->recover();
+ }
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
+ ;}
+ break;
+
+ case 184:
+
+ {
+ if (context->loopNestingLevel <= 0) {
+ context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
+ context->recover();
+ }
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
+ ;}
+ break;
+
+ case 185:
+
+ {
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
+ if (context->currentFunctionType->getBasicType() != EbtVoid) {
+ context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
+ context->recover();
+ }
+ ;}
+ break;
+
+ case 186:
+
+ {
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
+ context->functionReturnsValue = true;
+ if (context->currentFunctionType->getBasicType() == EbtVoid) {
+ context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
+ context->recover();
+ } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
+ context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
+ context->recover();
+ }
+ ;}
+ break;
+
+ case 187:
+
+ {
+ FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
+ (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
+ ;}
+ break;
+
+ case 188:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
+ context->treeRoot = (yyval.interm.intermNode);
+ ;}
+ break;
+
+ case 189:
+
+ {
+ (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
+ context->treeRoot = (yyval.interm.intermNode);
+ ;}
+ break;
+
+ case 190:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
+ ;}
+ break;
+
+ case 191:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
+ ;}
+ break;
+
+ case 192:
+
+ {
+ TFunction* function = (yyvsp[(1) - (1)].interm).function;
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
+ //
+ // Note: 'prevDec' could be 'function' if this is the first time we've seen function
+ // as it would have just been put in the symbol table. Otherwise, we're looking up
+ // an earlier occurance.
+ //
+ if (prevDec->isDefined()) {
+ //
+ // Then this function already has a body.
+ //
+ context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
+ context->recover();
+ }
+ prevDec->setDefined();
+
+ //
+ // Raise error message if main function takes any parameters or return anything other than void
+ //
+ if (function->getName() == "main") {
+ if (function->getParamCount() > 0) {
+ context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
+ context->recover();
+ }
+ if (function->getReturnType().getBasicType() != EbtVoid) {
+ context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
+ context->recover();
+ }
+ }
+
+ //
+ // New symbol table scope for body of function plus its arguments
+ //
+ context->symbolTable.push();
+
+ //
+ // Remember the return type for later checking for RETURN statements.
+ //
+ context->currentFunctionType = &(prevDec->getReturnType());
+ context->functionReturnsValue = false;
+
+ //
+ // Insert parameters into the symbol table.
+ // If the parameter has no name, it's not an error, just don't insert it
+ // (could be used for unused args).
+ //
+ // Also, accumulate the list of parameters into the HIL, so lower level code
+ // knows where to find parameters.
+ //
+ TIntermAggregate* paramNodes = new TIntermAggregate;
+ for (int i = 0; i < function->getParamCount(); i++) {
+ const TParameter& param = function->getParam(i);
+ if (param.name != 0) {
+ TVariable *variable = new TVariable(param.name, *param.type);
+ //
+ // Insert the parameters with name in the symbol table.
+ //
+ if (! context->symbolTable.insert(*variable)) {
+ context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
+ context->recover();
+ delete variable;
+ }
+
+ //
+ // Add the parameter to the HIL
+ //
+ paramNodes = context->intermediate.growAggregate(
+ paramNodes,
+ context->intermediate.addSymbol(variable->getUniqueId(),
+ variable->getName(),
+ variable->getType(), (yyvsp[(1) - (1)].interm).line),
+ (yyvsp[(1) - (1)].interm).line);
+ } else {
+ paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
+ }
+ }
+ context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
+ (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
+ context->loopNestingLevel = 0;
+ ;}
+ break;
+
+ case 193:
+
+ {
+ //?? Check that all paths return a value if return type != void ?
+ // May be best done as post process phase on intermediate code
+ if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
+ context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
+ context->recover();
+ }
+ context->symbolTable.pop();
+ (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
+ context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
+ (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
+ (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
+
+ // store the pragma information for debug and optimize and other vendor specific
+ // information. This information can be queried from the parse tree
+ (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
+ (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
+ (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
+ ;}
+ break;
+
+
+/* Line 1267 of yacc.c. */
+
+ default: break;
+ }
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (context, YY_("syntax error"));
+#else
+ {
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+ {
+ YYSIZE_T yyalloc = 2 * yysize;
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+ if (yymsg)
+ yymsg_alloc = yyalloc;
+ else
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ }
+ }
+
+ if (0 < yysize && yysize <= yymsg_alloc)
+ {
+ (void) yysyntax_error (yymsg, yystate, yychar);
+ yyerror (context, yymsg);
+ }
+ else
+ {
+ yyerror (context, YY_("syntax error"));
+ if (yysize != 0)
+ goto yyexhaustedlab;
+ }
+ }
+#endif
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse look-ahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, context);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse look-ahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp, context);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ *++yyvsp = yylval;
+
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (context, YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEOF && yychar != YYEMPTY)
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, context);
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp, context);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
+}
+
+
+
+
+
+int glslang_parse(TParseContext* context) {
+ return yyparse(context);
+}
+
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h
new file mode 100644
index 0000000..05cbfd4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.h
@@ -0,0 +1,274 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ 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 this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ INVARIANT = 258,
+ HIGH_PRECISION = 259,
+ MEDIUM_PRECISION = 260,
+ LOW_PRECISION = 261,
+ PRECISION = 262,
+ ATTRIBUTE = 263,
+ CONST_QUAL = 264,
+ BOOL_TYPE = 265,
+ FLOAT_TYPE = 266,
+ INT_TYPE = 267,
+ BREAK = 268,
+ CONTINUE = 269,
+ DO = 270,
+ ELSE = 271,
+ FOR = 272,
+ IF = 273,
+ DISCARD = 274,
+ RETURN = 275,
+ BVEC2 = 276,
+ BVEC3 = 277,
+ BVEC4 = 278,
+ IVEC2 = 279,
+ IVEC3 = 280,
+ IVEC4 = 281,
+ VEC2 = 282,
+ VEC3 = 283,
+ VEC4 = 284,
+ MATRIX2 = 285,
+ MATRIX3 = 286,
+ MATRIX4 = 287,
+ IN_QUAL = 288,
+ OUT_QUAL = 289,
+ INOUT_QUAL = 290,
+ UNIFORM = 291,
+ VARYING = 292,
+ STRUCT = 293,
+ VOID_TYPE = 294,
+ WHILE = 295,
+ SAMPLER2D = 296,
+ SAMPLERCUBE = 297,
+ IDENTIFIER = 298,
+ TYPE_NAME = 299,
+ FLOATCONSTANT = 300,
+ INTCONSTANT = 301,
+ BOOLCONSTANT = 302,
+ FIELD_SELECTION = 303,
+ LEFT_OP = 304,
+ RIGHT_OP = 305,
+ INC_OP = 306,
+ DEC_OP = 307,
+ LE_OP = 308,
+ GE_OP = 309,
+ EQ_OP = 310,
+ NE_OP = 311,
+ AND_OP = 312,
+ OR_OP = 313,
+ XOR_OP = 314,
+ MUL_ASSIGN = 315,
+ DIV_ASSIGN = 316,
+ ADD_ASSIGN = 317,
+ MOD_ASSIGN = 318,
+ LEFT_ASSIGN = 319,
+ RIGHT_ASSIGN = 320,
+ AND_ASSIGN = 321,
+ XOR_ASSIGN = 322,
+ OR_ASSIGN = 323,
+ SUB_ASSIGN = 324,
+ LEFT_PAREN = 325,
+ RIGHT_PAREN = 326,
+ LEFT_BRACKET = 327,
+ RIGHT_BRACKET = 328,
+ LEFT_BRACE = 329,
+ RIGHT_BRACE = 330,
+ DOT = 331,
+ COMMA = 332,
+ COLON = 333,
+ EQUAL = 334,
+ SEMICOLON = 335,
+ BANG = 336,
+ DASH = 337,
+ TILDE = 338,
+ PLUS = 339,
+ STAR = 340,
+ SLASH = 341,
+ PERCENT = 342,
+ LEFT_ANGLE = 343,
+ RIGHT_ANGLE = 344,
+ VERTICAL_BAR = 345,
+ CARET = 346,
+ AMPERSAND = 347,
+ QUESTION = 348
+ };
+#endif
+/* Tokens. */
+#define INVARIANT 258
+#define HIGH_PRECISION 259
+#define MEDIUM_PRECISION 260
+#define LOW_PRECISION 261
+#define PRECISION 262
+#define ATTRIBUTE 263
+#define CONST_QUAL 264
+#define BOOL_TYPE 265
+#define FLOAT_TYPE 266
+#define INT_TYPE 267
+#define BREAK 268
+#define CONTINUE 269
+#define DO 270
+#define ELSE 271
+#define FOR 272
+#define IF 273
+#define DISCARD 274
+#define RETURN 275
+#define BVEC2 276
+#define BVEC3 277
+#define BVEC4 278
+#define IVEC2 279
+#define IVEC3 280
+#define IVEC4 281
+#define VEC2 282
+#define VEC3 283
+#define VEC4 284
+#define MATRIX2 285
+#define MATRIX3 286
+#define MATRIX4 287
+#define IN_QUAL 288
+#define OUT_QUAL 289
+#define INOUT_QUAL 290
+#define UNIFORM 291
+#define VARYING 292
+#define STRUCT 293
+#define VOID_TYPE 294
+#define WHILE 295
+#define SAMPLER2D 296
+#define SAMPLERCUBE 297
+#define IDENTIFIER 298
+#define TYPE_NAME 299
+#define FLOATCONSTANT 300
+#define INTCONSTANT 301
+#define BOOLCONSTANT 302
+#define FIELD_SELECTION 303
+#define LEFT_OP 304
+#define RIGHT_OP 305
+#define INC_OP 306
+#define DEC_OP 307
+#define LE_OP 308
+#define GE_OP 309
+#define EQ_OP 310
+#define NE_OP 311
+#define AND_OP 312
+#define OR_OP 313
+#define XOR_OP 314
+#define MUL_ASSIGN 315
+#define DIV_ASSIGN 316
+#define ADD_ASSIGN 317
+#define MOD_ASSIGN 318
+#define LEFT_ASSIGN 319
+#define RIGHT_ASSIGN 320
+#define AND_ASSIGN 321
+#define XOR_ASSIGN 322
+#define OR_ASSIGN 323
+#define SUB_ASSIGN 324
+#define LEFT_PAREN 325
+#define RIGHT_PAREN 326
+#define LEFT_BRACKET 327
+#define RIGHT_BRACKET 328
+#define LEFT_BRACE 329
+#define RIGHT_BRACE 330
+#define DOT 331
+#define COMMA 332
+#define COLON 333
+#define EQUAL 334
+#define SEMICOLON 335
+#define BANG 336
+#define DASH 337
+#define TILDE 338
+#define PLUS 339
+#define STAR 340
+#define SLASH 341
+#define PERCENT 342
+#define LEFT_ANGLE 343
+#define RIGHT_ANGLE 344
+#define VERTICAL_BAR 345
+#define CARET 346
+#define AMPERSAND 347
+#define QUESTION 348
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+
+{
+ struct {
+ TSourceLoc line;
+ union {
+ TString *string;
+ float f;
+ int i;
+ bool b;
+ };
+ TSymbol* symbol;
+ } lex;
+ struct {
+ TSourceLoc line;
+ TOperator op;
+ union {
+ TIntermNode* intermNode;
+ TIntermNodePair nodePair;
+ TIntermTyped* intermTypedNode;
+ TIntermAggregate* intermAggregate;
+ };
+ union {
+ TPublicType type;
+ TPrecision precision;
+ TQualifier qualifier;
+ TFunction* function;
+ TParameter param;
+ TTypeLine typeLine;
+ TTypeList* typeList;
+ };
+ } interm;
+}
+/* Line 1489 of yacc.c. */
+
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermOut.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermOut.cpp
new file mode 100644
index 0000000..798a69a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermOut.cpp
@@ -0,0 +1,417 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/localintermediate.h"
+
+//
+// Two purposes:
+// 1. Show an example of how to iterate tree. Functions can
+// also directly call Traverse() on children themselves to
+// have finer grained control over the process than shown here.
+// See the last function for how to get started.
+// 2. Print out a text based description of the tree.
+//
+
+//
+// Use this class to carry along data from node to node in
+// the traversal
+//
+class TOutputTraverser : public TIntermTraverser {
+public:
+ TOutputTraverser(TInfoSinkBase& i) : sink(i) { }
+ TInfoSinkBase& sink;
+
+protected:
+ void visitSymbol(TIntermSymbol*);
+ void visitConstantUnion(TIntermConstantUnion*);
+ bool visitBinary(Visit visit, TIntermBinary*);
+ bool visitUnary(Visit visit, TIntermUnary*);
+ bool visitSelection(Visit visit, TIntermSelection*);
+ bool visitAggregate(Visit visit, TIntermAggregate*);
+ bool visitLoop(Visit visit, TIntermLoop*);
+ bool visitBranch(Visit visit, TIntermBranch*);
+};
+
+TString TType::getCompleteString() const
+{
+ TStringStream stream;
+
+ if (qualifier != EvqTemporary && qualifier != EvqGlobal)
+ stream << getQualifierString() << " " << getPrecisionString() << " ";
+ if (array)
+ stream << "array of ";
+ if (matrix)
+ stream << size << "X" << size << " matrix of ";
+ else if (size > 1)
+ stream << size << "-component vector of ";
+
+ stream << getBasicString();
+ return stream.str();
+}
+
+//
+// Helper functions for printing, not part of traversing.
+//
+
+void OutputTreeText(TInfoSinkBase& sink, TIntermNode* node, const int depth)
+{
+ int i;
+
+ sink.location(node->getLine());
+
+ for (i = 0; i < depth; ++i)
+ sink << " ";
+}
+
+//
+// The rest of the file are the traversal functions. The last one
+// is the one that starts the traversal.
+//
+// Return true from interior nodes to have the external traversal
+// continue on to children. If you process children yourself,
+// return false.
+//
+
+void TOutputTraverser::visitSymbol(TIntermSymbol* node)
+{
+ OutputTreeText(sink, node, depth);
+
+ sink << "'" << node->getSymbol() << "' ";
+ sink << "(" << node->getCompleteString() << ")\n";
+}
+
+bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
+{
+ TInfoSinkBase& out = sink;
+
+ OutputTreeText(out, node, depth);
+
+ switch (node->getOp()) {
+ case EOpAssign: out << "move second child to first child"; break;
+ case EOpInitialize: out << "initialize first child with second child"; break;
+ case EOpAddAssign: out << "add second child into first child"; break;
+ case EOpSubAssign: out << "subtract second child into first child"; break;
+ case EOpMulAssign: out << "multiply second child into first child"; break;
+ case EOpVectorTimesMatrixAssign: out << "matrix mult second child into first child"; break;
+ case EOpVectorTimesScalarAssign: out << "vector scale second child into first child"; break;
+ case EOpMatrixTimesScalarAssign: out << "matrix scale second child into first child"; break;
+ case EOpMatrixTimesMatrixAssign: out << "matrix mult second child into first child"; break;
+ case EOpDivAssign: out << "divide second child into first child"; break;
+ case EOpIndexDirect: out << "direct index"; break;
+ case EOpIndexIndirect: out << "indirect index"; break;
+ case EOpIndexDirectStruct: out << "direct index for structure"; break;
+ case EOpVectorSwizzle: out << "vector swizzle"; break;
+
+ case EOpAdd: out << "add"; break;
+ case EOpSub: out << "subtract"; break;
+ case EOpMul: out << "component-wise multiply"; break;
+ case EOpDiv: out << "divide"; break;
+ case EOpEqual: out << "Compare Equal"; break;
+ case EOpNotEqual: out << "Compare Not Equal"; break;
+ case EOpLessThan: out << "Compare Less Than"; break;
+ case EOpGreaterThan: out << "Compare Greater Than"; break;
+ case EOpLessThanEqual: out << "Compare Less Than or Equal"; break;
+ case EOpGreaterThanEqual: out << "Compare Greater Than or Equal"; break;
+
+ case EOpVectorTimesScalar: out << "vector-scale"; break;
+ case EOpVectorTimesMatrix: out << "vector-times-matrix"; break;
+ case EOpMatrixTimesVector: out << "matrix-times-vector"; break;
+ case EOpMatrixTimesScalar: out << "matrix-scale"; break;
+ case EOpMatrixTimesMatrix: out << "matrix-multiply"; break;
+
+ case EOpLogicalOr: out << "logical-or"; break;
+ case EOpLogicalXor: out << "logical-xor"; break;
+ case EOpLogicalAnd: out << "logical-and"; break;
+ default: out << "<unknown op>";
+ }
+
+ out << " (" << node->getCompleteString() << ")";
+
+ out << "\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
+{
+ TInfoSinkBase& out = sink;
+
+ OutputTreeText(out, node, depth);
+
+ switch (node->getOp()) {
+ case EOpNegative: out << "Negate value"; break;
+ case EOpVectorLogicalNot:
+ case EOpLogicalNot: out << "Negate conditional"; break;
+
+ case EOpPostIncrement: out << "Post-Increment"; break;
+ case EOpPostDecrement: out << "Post-Decrement"; break;
+ case EOpPreIncrement: out << "Pre-Increment"; break;
+ case EOpPreDecrement: out << "Pre-Decrement"; break;
+
+ case EOpConvIntToBool: out << "Convert int to bool"; break;
+ case EOpConvFloatToBool:out << "Convert float to bool";break;
+ case EOpConvBoolToFloat:out << "Convert bool to float";break;
+ case EOpConvIntToFloat: out << "Convert int to float"; break;
+ case EOpConvFloatToInt: out << "Convert float to int"; break;
+ case EOpConvBoolToInt: out << "Convert bool to int"; break;
+
+ case EOpRadians: out << "radians"; break;
+ case EOpDegrees: out << "degrees"; break;
+ case EOpSin: out << "sine"; break;
+ case EOpCos: out << "cosine"; break;
+ case EOpTan: out << "tangent"; break;
+ case EOpAsin: out << "arc sine"; break;
+ case EOpAcos: out << "arc cosine"; break;
+ case EOpAtan: out << "arc tangent"; break;
+
+ case EOpExp: out << "exp"; break;
+ case EOpLog: out << "log"; break;
+ case EOpExp2: out << "exp2"; break;
+ case EOpLog2: out << "log2"; break;
+ case EOpSqrt: out << "sqrt"; break;
+ case EOpInverseSqrt: out << "inverse sqrt"; break;
+
+ case EOpAbs: out << "Absolute value"; break;
+ case EOpSign: out << "Sign"; break;
+ case EOpFloor: out << "Floor"; break;
+ case EOpCeil: out << "Ceiling"; break;
+ case EOpFract: out << "Fraction"; break;
+
+ case EOpLength: out << "length"; break;
+ case EOpNormalize: out << "normalize"; break;
+ // case EOpDPdx: out << "dPdx"; break;
+ // case EOpDPdy: out << "dPdy"; break;
+ // case EOpFwidth: out << "fwidth"; break;
+
+ case EOpAny: out << "any"; break;
+ case EOpAll: out << "all"; break;
+
+ default: out.message(EPrefixError, "Bad unary op");
+ }
+
+ out << " (" << node->getCompleteString() << ")";
+
+ out << "\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+ TInfoSinkBase& out = sink;
+
+ if (node->getOp() == EOpNull) {
+ out.message(EPrefixError, "node is still EOpNull!");
+ return true;
+ }
+
+ OutputTreeText(out, node, depth);
+
+ switch (node->getOp()) {
+ case EOpSequence: out << "Sequence\n"; return true;
+ case EOpComma: out << "Comma\n"; return true;
+ case EOpFunction: out << "Function Definition: " << node->getName(); break;
+ case EOpFunctionCall: out << "Function Call: " << node->getName(); break;
+ case EOpParameters: out << "Function Parameters: "; break;
+
+ case EOpConstructFloat: out << "Construct float"; break;
+ case EOpConstructVec2: out << "Construct vec2"; break;
+ case EOpConstructVec3: out << "Construct vec3"; break;
+ case EOpConstructVec4: out << "Construct vec4"; break;
+ case EOpConstructBool: out << "Construct bool"; break;
+ case EOpConstructBVec2: out << "Construct bvec2"; break;
+ case EOpConstructBVec3: out << "Construct bvec3"; break;
+ case EOpConstructBVec4: out << "Construct bvec4"; break;
+ case EOpConstructInt: out << "Construct int"; break;
+ case EOpConstructIVec2: out << "Construct ivec2"; break;
+ case EOpConstructIVec3: out << "Construct ivec3"; break;
+ case EOpConstructIVec4: out << "Construct ivec4"; break;
+ case EOpConstructMat2: out << "Construct mat2"; break;
+ case EOpConstructMat3: out << "Construct mat3"; break;
+ case EOpConstructMat4: out << "Construct mat4"; break;
+ case EOpConstructStruct: out << "Construct structure"; break;
+
+ case EOpLessThan: out << "Compare Less Than"; break;
+ case EOpGreaterThan: out << "Compare Greater Than"; break;
+ case EOpLessThanEqual: out << "Compare Less Than or Equal"; break;
+ case EOpGreaterThanEqual: out << "Compare Greater Than or Equal"; break;
+ case EOpVectorEqual: out << "Equal"; break;
+ case EOpVectorNotEqual: out << "NotEqual"; break;
+
+ case EOpMod: out << "mod"; break;
+ case EOpPow: out << "pow"; break;
+
+ case EOpAtan: out << "arc tangent"; break;
+
+ case EOpMin: out << "min"; break;
+ case EOpMax: out << "max"; break;
+ case EOpClamp: out << "clamp"; break;
+ case EOpMix: out << "mix"; break;
+ case EOpStep: out << "step"; break;
+ case EOpSmoothStep: out << "smoothstep"; break;
+
+ case EOpDistance: out << "distance"; break;
+ case EOpDot: out << "dot-product"; break;
+ case EOpCross: out << "cross-product"; break;
+ case EOpFaceForward: out << "face-forward"; break;
+ case EOpReflect: out << "reflect"; break;
+ case EOpRefract: out << "refract"; break;
+ case EOpMul: out << "component-wise multiply"; break;
+
+ default: out.message(EPrefixError, "Bad aggregation op");
+ }
+
+ if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
+ out << " (" << node->getCompleteString() << ")";
+
+ out << "\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection* node)
+{
+ TInfoSinkBase& out = sink;
+
+ OutputTreeText(out, node, depth);
+
+ out << "Test condition and select";
+ out << " (" << node->getCompleteString() << ")\n";
+
+ ++depth;
+
+ OutputTreeText(sink, node, depth);
+ out << "Condition\n";
+ node->getCondition()->traverse(this);
+
+ OutputTreeText(sink, node, depth);
+ if (node->getTrueBlock()) {
+ out << "true case\n";
+ node->getTrueBlock()->traverse(this);
+ } else
+ out << "true case is null\n";
+
+ if (node->getFalseBlock()) {
+ OutputTreeText(sink, node, depth);
+ out << "false case\n";
+ node->getFalseBlock()->traverse(this);
+ }
+
+ --depth;
+
+ return false;
+}
+
+void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
+{
+ TInfoSinkBase& out = sink;
+
+ int size = node->getType().getObjectSize();
+
+ for (int i = 0; i < size; i++) {
+ OutputTreeText(out, node, depth);
+ switch (node->getUnionArrayPointer()[i].getType()) {
+ case EbtBool:
+ if (node->getUnionArrayPointer()[i].getBConst())
+ out << "true";
+ else
+ out << "false";
+
+ out << " (" << "const bool" << ")";
+ out << "\n";
+ break;
+ case EbtFloat:
+ out << node->getUnionArrayPointer()[i].getFConst();
+ out << " (const float)\n";
+ break;
+ case EbtInt:
+ out << node->getUnionArrayPointer()[i].getIConst();
+ out << " (const int)\n";
+ break;
+ default:
+ out.message(EPrefixInternalError, "Unknown constant", node->getLine());
+ break;
+ }
+ }
+}
+
+bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop* node)
+{
+ TInfoSinkBase& out = sink;
+
+ OutputTreeText(out, node, depth);
+
+ out << "Loop with condition ";
+ if (node->getType() == ELoopDoWhile)
+ out << "not ";
+ out << "tested first\n";
+
+ ++depth;
+
+ OutputTreeText(sink, node, depth);
+ if (node->getCondition()) {
+ out << "Loop Condition\n";
+ node->getCondition()->traverse(this);
+ } else
+ out << "No loop condition\n";
+
+ OutputTreeText(sink, node, depth);
+ if (node->getBody()) {
+ out << "Loop Body\n";
+ node->getBody()->traverse(this);
+ } else
+ out << "No loop body\n";
+
+ if (node->getExpression()) {
+ OutputTreeText(sink, node, depth);
+ out << "Loop Terminal Expression\n";
+ node->getExpression()->traverse(this);
+ }
+
+ --depth;
+
+ return false;
+}
+
+bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch* node)
+{
+ TInfoSinkBase& out = sink;
+
+ OutputTreeText(out, node, depth);
+
+ switch (node->getFlowOp()) {
+ case EOpKill: out << "Branch: Kill"; break;
+ case EOpBreak: out << "Branch: Break"; break;
+ case EOpContinue: out << "Branch: Continue"; break;
+ case EOpReturn: out << "Branch: Return"; break;
+ default: out << "Branch: Unknown Branch"; break;
+ }
+
+ if (node->getExpression()) {
+ out << " with expression\n";
+ ++depth;
+ node->getExpression()->traverse(this);
+ --depth;
+ } else
+ out << "\n";
+
+ return false;
+}
+
+//
+// This function is the one to call externally to start the traversal.
+// Individual functions can be initialized to 0 to skip processing of that
+// type of node. It's children will still be processed.
+//
+void TIntermediate::outputTree(TIntermNode* root)
+{
+ if (root == 0)
+ return;
+
+ TOutputTraverser it(infoSink.info);
+
+ root->traverse(&it);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermediate.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermediate.h
new file mode 100644
index 0000000..f9fa1de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/intermediate.h
@@ -0,0 +1,529 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Definition of the in-memory high-level intermediate representation
+// of shaders. This is a tree that parser creates.
+//
+// Nodes in the tree are defined as a hierarchy of classes derived from
+// TIntermNode. Each is a node in a tree. There is no preset branching factor;
+// each node can have it's own type of list of children.
+//
+
+#ifndef __INTERMEDIATE_H
+#define __INTERMEDIATE_H
+
+#include "compiler/Common.h"
+#include "compiler/Types.h"
+#include "compiler/ConstantUnion.h"
+
+//
+// Operators used by the high-level (parse tree) representation.
+//
+enum TOperator {
+ EOpNull, // if in a node, should only mean a node is still being built
+ EOpSequence, // denotes a list of statements, or parameters, etc.
+ EOpFunctionCall,
+ EOpFunction, // For function definition
+ EOpParameters, // an aggregate listing the parameters to a function
+
+ EOpDeclaration,
+ EOpPrototype,
+
+ //
+ // Unary operators
+ //
+
+ EOpNegative,
+ EOpLogicalNot,
+ EOpVectorLogicalNot,
+
+ EOpPostIncrement,
+ EOpPostDecrement,
+ EOpPreIncrement,
+ EOpPreDecrement,
+
+ EOpConvIntToBool,
+ EOpConvFloatToBool,
+ EOpConvBoolToFloat,
+ EOpConvIntToFloat,
+ EOpConvFloatToInt,
+ EOpConvBoolToInt,
+
+ //
+ // binary operations
+ //
+
+ EOpAdd,
+ EOpSub,
+ EOpMul,
+ EOpDiv,
+ EOpEqual,
+ EOpNotEqual,
+ EOpVectorEqual,
+ EOpVectorNotEqual,
+ EOpLessThan,
+ EOpGreaterThan,
+ EOpLessThanEqual,
+ EOpGreaterThanEqual,
+ EOpComma,
+
+ EOpVectorTimesScalar,
+ EOpVectorTimesMatrix,
+ EOpMatrixTimesVector,
+ EOpMatrixTimesScalar,
+
+ EOpLogicalOr,
+ EOpLogicalXor,
+ EOpLogicalAnd,
+
+ EOpIndexDirect,
+ EOpIndexIndirect,
+ EOpIndexDirectStruct,
+
+ EOpVectorSwizzle,
+
+ //
+ // Built-in functions potentially mapped to operators
+ //
+
+ EOpRadians,
+ EOpDegrees,
+ EOpSin,
+ EOpCos,
+ EOpTan,
+ EOpAsin,
+ EOpAcos,
+ EOpAtan,
+
+ EOpPow,
+ EOpExp,
+ EOpLog,
+ EOpExp2,
+ EOpLog2,
+ EOpSqrt,
+ EOpInverseSqrt,
+
+ EOpAbs,
+ EOpSign,
+ EOpFloor,
+ EOpCeil,
+ EOpFract,
+ EOpMod,
+ EOpMin,
+ EOpMax,
+ EOpClamp,
+ EOpMix,
+ EOpStep,
+ EOpSmoothStep,
+
+ EOpLength,
+ EOpDistance,
+ EOpDot,
+ EOpCross,
+ EOpNormalize,
+ EOpFaceForward,
+ EOpReflect,
+ EOpRefract,
+
+ EOpDFdx, // Fragment only, OES_standard_derivatives extension
+ EOpDFdy, // Fragment only, OES_standard_derivatives extension
+ EOpFwidth, // Fragment only, OES_standard_derivatives extension
+
+ EOpMatrixTimesMatrix,
+
+ EOpAny,
+ EOpAll,
+
+ //
+ // Branch
+ //
+
+ EOpKill, // Fragment only
+ EOpReturn,
+ EOpBreak,
+ EOpContinue,
+
+ //
+ // Constructors
+ //
+
+ EOpConstructInt,
+ EOpConstructBool,
+ EOpConstructFloat,
+ EOpConstructVec2,
+ EOpConstructVec3,
+ EOpConstructVec4,
+ EOpConstructBVec2,
+ EOpConstructBVec3,
+ EOpConstructBVec4,
+ EOpConstructIVec2,
+ EOpConstructIVec3,
+ EOpConstructIVec4,
+ EOpConstructMat2,
+ EOpConstructMat3,
+ EOpConstructMat4,
+ EOpConstructStruct,
+
+ //
+ // moves
+ //
+
+ EOpAssign,
+ EOpInitialize,
+ EOpAddAssign,
+ EOpSubAssign,
+ EOpMulAssign,
+ EOpVectorTimesMatrixAssign,
+ EOpVectorTimesScalarAssign,
+ EOpMatrixTimesScalarAssign,
+ EOpMatrixTimesMatrixAssign,
+ EOpDivAssign,
+};
+
+extern const char* getOperatorString(TOperator op);
+
+class TIntermTraverser;
+class TIntermAggregate;
+class TIntermBinary;
+class TIntermUnary;
+class TIntermConstantUnion;
+class TIntermSelection;
+class TIntermTyped;
+class TIntermSymbol;
+class TIntermLoop;
+class TInfoSink;
+
+//
+// Base class for the tree nodes
+//
+class TIntermNode {
+public:
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+
+ TIntermNode() : line(0) {}
+
+ TSourceLoc getLine() const { return line; }
+ void setLine(TSourceLoc l) { line = l; }
+
+ virtual void traverse(TIntermTraverser*) = 0;
+ virtual TIntermTyped* getAsTyped() { return 0; }
+ virtual TIntermConstantUnion* getAsConstantUnion() { return 0; }
+ virtual TIntermAggregate* getAsAggregate() { return 0; }
+ virtual TIntermBinary* getAsBinaryNode() { return 0; }
+ virtual TIntermUnary* getAsUnaryNode() { return 0; }
+ virtual TIntermSelection* getAsSelectionNode() { return 0; }
+ virtual TIntermSymbol* getAsSymbolNode() { return 0; }
+ virtual TIntermLoop* getAsLoopNode() { return 0; }
+ virtual ~TIntermNode() { }
+
+protected:
+ TSourceLoc line;
+};
+
+//
+// This is just to help yacc.
+//
+struct TIntermNodePair {
+ TIntermNode* node1;
+ TIntermNode* node2;
+};
+
+//
+// Intermediate class for nodes that have a type.
+//
+class TIntermTyped : public TIntermNode {
+public:
+ TIntermTyped(const TType& t) : type(t) { }
+ virtual TIntermTyped* getAsTyped() { return this; }
+
+ void setType(const TType& t) { type = t; }
+ const TType& getType() const { return type; }
+ TType* getTypePointer() { return &type; }
+
+ TBasicType getBasicType() const { return type.getBasicType(); }
+ TQualifier getQualifier() const { return type.getQualifier(); }
+ TPrecision getPrecision() const { return type.getPrecision(); }
+ int getNominalSize() const { return type.getNominalSize(); }
+
+ bool isMatrix() const { return type.isMatrix(); }
+ bool isArray() const { return type.isArray(); }
+ bool isVector() const { return type.isVector(); }
+ bool isScalar() const { return type.isScalar(); }
+ const char* getBasicString() const { return type.getBasicString(); }
+ const char* getQualifierString() const { return type.getQualifierString(); }
+ TString getCompleteString() const { return type.getCompleteString(); }
+
+protected:
+ TType type;
+};
+
+//
+// Handle for, do-while, and while loops.
+//
+enum TLoopType {
+ ELoopFor,
+ ELoopWhile,
+ ELoopDoWhile,
+};
+
+class TIntermLoop : public TIntermNode {
+public:
+ TIntermLoop(TLoopType aType,
+ TIntermNode *aInit, TIntermTyped* aCond, TIntermTyped* aExpr,
+ TIntermNode* aBody) :
+ type(aType),
+ init(aInit),
+ cond(aCond),
+ expr(aExpr),
+ body(aBody) { }
+
+ virtual TIntermLoop* getAsLoopNode() { return this; }
+ virtual void traverse(TIntermTraverser*);
+
+ TLoopType getType() const { return type; }
+ TIntermNode* getInit() { return init; }
+ TIntermTyped* getCondition() { return cond; }
+ TIntermTyped* getExpression() { return expr; }
+ TIntermNode* getBody() { return body; }
+
+protected:
+ TLoopType type;
+ TIntermNode* init; // for-loop initialization
+ TIntermTyped* cond; // loop exit condition
+ TIntermTyped* expr; // for-loop expression
+ TIntermNode* body; // loop body
+};
+
+//
+// Handle break, continue, return, and kill.
+//
+class TIntermBranch : public TIntermNode {
+public:
+ TIntermBranch(TOperator op, TIntermTyped* e) :
+ flowOp(op),
+ expression(e) { }
+
+ virtual void traverse(TIntermTraverser*);
+
+ TOperator getFlowOp() { return flowOp; }
+ TIntermTyped* getExpression() { return expression; }
+
+protected:
+ TOperator flowOp;
+ TIntermTyped* expression; // non-zero except for "return exp;" statements
+};
+
+//
+// Nodes that correspond to symbols or constants in the source code.
+//
+class TIntermSymbol : public TIntermTyped {
+public:
+ // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym. If sym comes from
+ // per process globalpoolallocator, then it causes increased memory usage per compile
+ // it is essential to use "symbol = sym" to assign to symbol
+ TIntermSymbol(int i, const TString& sym, const TType& t) :
+ TIntermTyped(t), id(i) { symbol = sym;}
+
+ int getId() const { return id; }
+ const TString& getSymbol() const { return symbol; }
+
+ virtual void traverse(TIntermTraverser*);
+ virtual TIntermSymbol* getAsSymbolNode() { return this; }
+
+protected:
+ int id;
+ TString symbol;
+};
+
+class TIntermConstantUnion : public TIntermTyped {
+public:
+ TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
+
+ ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
+ void setUnionArrayPointer(ConstantUnion *c) { unionArrayPointer = c; }
+
+ virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
+ virtual void traverse(TIntermTraverser*);
+
+ TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
+
+protected:
+ ConstantUnion *unionArrayPointer;
+};
+
+//
+// Intermediate class for node types that hold operators.
+//
+class TIntermOperator : public TIntermTyped {
+public:
+ TOperator getOp() const { return op; }
+ void setOp(TOperator o) { op = o; }
+
+ bool modifiesState() const;
+ bool isConstructor() const;
+
+protected:
+ TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {}
+ TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
+ TOperator op;
+};
+
+//
+// Nodes for all the basic binary math operators.
+//
+class TIntermBinary : public TIntermOperator {
+public:
+ TIntermBinary(TOperator o) : TIntermOperator(o) {}
+
+ virtual TIntermBinary* getAsBinaryNode() { return this; }
+ virtual void traverse(TIntermTraverser*);
+
+ void setLeft(TIntermTyped* n) { left = n; }
+ void setRight(TIntermTyped* n) { right = n; }
+ TIntermTyped* getLeft() const { return left; }
+ TIntermTyped* getRight() const { return right; }
+ bool promote(TInfoSink&);
+
+protected:
+ TIntermTyped* left;
+ TIntermTyped* right;
+};
+
+//
+// Nodes for unary math operators.
+//
+class TIntermUnary : public TIntermOperator {
+public:
+ TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
+ TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
+
+ virtual void traverse(TIntermTraverser*);
+ virtual TIntermUnary* getAsUnaryNode() { return this; }
+
+ void setOperand(TIntermTyped* o) { operand = o; }
+ TIntermTyped* getOperand() { return operand; }
+ bool promote(TInfoSink&);
+
+protected:
+ TIntermTyped* operand;
+};
+
+typedef TVector<TIntermNode*> TIntermSequence;
+typedef TVector<int> TQualifierList;
+typedef TMap<TString, TString> TPragmaTable;
+//
+// Nodes that operate on an arbitrary sized set of children.
+//
+class TIntermAggregate : public TIntermOperator {
+public:
+ TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { }
+ TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }
+ ~TIntermAggregate() { delete pragmaTable; }
+
+ virtual TIntermAggregate* getAsAggregate() { return this; }
+ virtual void traverse(TIntermTraverser*);
+
+ TIntermSequence& getSequence() { return sequence; }
+
+ void setName(const TString& n) { name = n; }
+ const TString& getName() const { return name; }
+
+ void setUserDefined() { userDefined = true; }
+ bool isUserDefined() { return userDefined; }
+
+ void setOptimize(bool o) { optimize = o; }
+ bool getOptimize() { return optimize; }
+ void setDebug(bool d) { debug = d; }
+ bool getDebug() { return debug; }
+ void addToPragmaTable(const TPragmaTable& pTable);
+ const TPragmaTable& getPragmaTable() const { return *pragmaTable; }
+
+protected:
+ TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
+ TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
+ TIntermSequence sequence;
+ TString name;
+ bool userDefined; // used for user defined function names
+
+ bool optimize;
+ bool debug;
+ TPragmaTable *pragmaTable;
+};
+
+//
+// For if tests. Simplified since there is no switch statement.
+//
+class TIntermSelection : public TIntermTyped {
+public:
+ TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) :
+ TIntermTyped(TType(EbtVoid, EbpUndefined)), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
+ TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) :
+ TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
+
+ virtual void traverse(TIntermTraverser*);
+
+ bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
+ TIntermNode* getCondition() const { return condition; }
+ TIntermNode* getTrueBlock() const { return trueBlock; }
+ TIntermNode* getFalseBlock() const { return falseBlock; }
+ TIntermSelection* getAsSelectionNode() { return this; }
+
+protected:
+ TIntermTyped* condition;
+ TIntermNode* trueBlock;
+ TIntermNode* falseBlock;
+};
+
+enum Visit
+{
+ PreVisit,
+ InVisit,
+ PostVisit
+};
+
+//
+// For traversing the tree. User should derive from this,
+// put their traversal specific data in it, and then pass
+// it to a Traverse method.
+//
+// When using this, just fill in the methods for nodes you want visited.
+// Return false from a pre-visit to skip visiting that node's subtree.
+//
+class TIntermTraverser
+{
+public:
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+
+ TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) :
+ preVisit(preVisit),
+ inVisit(inVisit),
+ postVisit(postVisit),
+ rightToLeft(rightToLeft),
+ depth(0) {}
+
+ virtual void visitSymbol(TIntermSymbol*) {}
+ virtual void visitConstantUnion(TIntermConstantUnion*) {}
+ virtual bool visitBinary(Visit visit, TIntermBinary*) {return true;}
+ virtual bool visitUnary(Visit visit, TIntermUnary*) {return true;}
+ virtual bool visitSelection(Visit visit, TIntermSelection*) {return true;}
+ virtual bool visitAggregate(Visit visit, TIntermAggregate*) {return true;}
+ virtual bool visitLoop(Visit visit, TIntermLoop*) {return true;}
+ virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
+
+ void incrementDepth() {depth++;}
+ void decrementDepth() {depth--;}
+
+ const bool preVisit;
+ const bool inVisit;
+ const bool postVisit;
+ const bool rightToLeft;
+
+protected:
+ int depth;
+};
+
+#endif // __INTERMEDIATE_H
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/localintermediate.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/localintermediate.h
new file mode 100644
index 0000000..56890bd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/localintermediate.h
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _LOCAL_INTERMEDIATE_INCLUDED_
+#define _LOCAL_INTERMEDIATE_INCLUDED_
+
+#include "GLSLANG/ShaderLang.h"
+#include "compiler/intermediate.h"
+#include "compiler/SymbolTable.h"
+
+struct TVectorFields {
+ int offsets[4];
+ int num;
+};
+
+//
+// Set of helper functions to help parse and build the tree.
+//
+class TInfoSink;
+class TIntermediate {
+public:
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+
+ TIntermediate(TInfoSink& i) : infoSink(i) { }
+ TIntermSymbol* addSymbol(int Id, const TString&, const TType&, TSourceLoc);
+ TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
+ TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc, TSymbolTable&);
+ TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
+ TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc);
+ TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, TSourceLoc, TSymbolTable&);
+ TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc);
+ TIntermAggregate* makeAggregate(TIntermNode* node, TSourceLoc);
+ TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, TSourceLoc);
+ TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, TSourceLoc);
+ TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc);
+ TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc);
+ TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, TSourceLoc);
+ TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
+ bool parseConstTree(TSourceLoc, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
+ TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, TSourceLoc);
+ TIntermBranch* addBranch(TOperator, TSourceLoc);
+ TIntermBranch* addBranch(TOperator, TIntermTyped*, TSourceLoc);
+ TIntermTyped* addSwizzle(TVectorFields&, TSourceLoc);
+ bool postProcess(TIntermNode*);
+ void remove(TIntermNode*);
+ void outputTree(TIntermNode*);
+
+protected:
+ TInfoSink& infoSink;
+
+private:
+ void operator=(TIntermediate&); // prevent assignments
+};
+
+#endif // _LOCAL_INTERMEDIATE_INCLUDED_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/osinclude.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/osinclude.h
new file mode 100644
index 0000000..1af5064
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/osinclude.h
@@ -0,0 +1,70 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef __OSINCLUDE_H
+#define __OSINCLUDE_H
+
+//
+// This file contains contains os-specific datatypes and
+// declares any os-specific functions.
+//
+
+#if defined(_WIN32) || defined(_WIN64)
+#define ANGLE_OS_WIN
+#elif defined(__APPLE__) || defined(__linux__) || \
+ defined(__FreeBSD__) || defined(__OpenBSD__) || \
+ defined(__sun)
+#define ANGLE_OS_POSIX
+#else
+#error Unsupported platform.
+#endif
+
+#if defined(ANGLE_USE_NSPR)
+#include "prthread.h"
+#elif defined(ANGLE_OS_WIN)
+#define STRICT
+#define VC_EXTRALEAN 1
+#include <windows.h>
+#elif defined(ANGLE_OS_POSIX)
+#include <pthread.h>
+#include <semaphore.h>
+#include <errno.h>
+#endif // ANGLE_USE_NSPR
+
+
+#include "compiler/debug.h"
+
+//
+// Thread Local Storage Operations
+//
+#if defined(ANGLE_USE_NSPR)
+typedef PRUintn OS_TLSIndex;
+#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
+#elif defined(ANGLE_OS_WIN)
+typedef DWORD OS_TLSIndex;
+#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
+#elif defined(ANGLE_OS_POSIX)
+typedef unsigned int OS_TLSIndex;
+#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
+#endif // ANGLE_USE_NSPR
+
+OS_TLSIndex OS_AllocTLSIndex();
+bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
+bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
+
+inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
+{
+ ASSERT(nIndex != OS_INVALID_TLS_INDEX);
+#if defined(ANGLE_USE_NSPR)
+ return PR_GetThreadPrivate(nIndex);
+#elif defined(ANGLE_OS_WIN)
+ return TlsGetValue(nIndex);
+#elif defined(ANGLE_OS_POSIX)
+ return pthread_getspecific(nIndex);
+#endif // ANGLE_OS_WIN
+}
+
+#endif // __OSINCLUDE_H
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_nspr.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_nspr.cpp
new file mode 100644
index 0000000..f63d81e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_nspr.cpp
@@ -0,0 +1,43 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// This file contains the nspr specific functions
+//
+#include "compiler/osinclude.h"
+
+//
+// Thread Local Storage Operations
+//
+OS_TLSIndex OS_AllocTLSIndex()
+{
+ PRUintn index;
+ PRStatus status = PR_NewThreadPrivateIndex(&index, NULL);
+
+ if (status) {
+ assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
+ return OS_INVALID_TLS_INDEX;
+ }
+
+ return index;
+}
+
+bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
+{
+ if (nIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
+ return false;
+ }
+
+ return PR_SetThreadPrivate(nIndex, lpvValue) == 0;
+}
+
+bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
+{
+ // Can't delete TLS keys with nspr
+ return true;
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_posix.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_posix.cpp
new file mode 100644
index 0000000..1e1e699
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_posix.cpp
@@ -0,0 +1,64 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// This file contains the posix specific functions
+//
+#include "compiler/osinclude.h"
+
+#if !defined(ANGLE_OS_POSIX)
+#error Trying to build a posix specific file in a non-posix build.
+#endif
+
+//
+// Thread Local Storage Operations
+//
+OS_TLSIndex OS_AllocTLSIndex()
+{
+ pthread_key_t pPoolIndex;
+
+ //
+ // Create global pool key.
+ //
+ if ((pthread_key_create(&pPoolIndex, NULL)) != 0) {
+ assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
+ return false;
+ }
+ else {
+ return pPoolIndex;
+ }
+}
+
+
+bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
+{
+ if (nIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
+ return false;
+ }
+
+ if (pthread_setspecific(nIndex, lpvValue) == 0)
+ return true;
+ else
+ return false;
+}
+
+
+bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
+{
+ if (nIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
+ return false;
+ }
+
+ //
+ // Delete the global pool key.
+ //
+ if (pthread_key_delete(nIndex) == 0)
+ return true;
+ else
+ return false;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_win.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_win.cpp
new file mode 100644
index 0000000..89922fe
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/ossource_win.cpp
@@ -0,0 +1,57 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/osinclude.h"
+//
+// This file contains contains the window's specific functions
+//
+
+#if !defined(ANGLE_OS_WIN)
+#error Trying to build a windows specific file in a non windows build.
+#endif
+
+
+//
+// Thread Local Storage Operations
+//
+OS_TLSIndex OS_AllocTLSIndex()
+{
+ DWORD dwIndex = TlsAlloc();
+ if (dwIndex == TLS_OUT_OF_INDEXES) {
+ assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
+ return OS_INVALID_TLS_INDEX;
+ }
+
+ return dwIndex;
+}
+
+
+bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
+{
+ if (nIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
+ return false;
+ }
+
+ if (TlsSetValue(nIndex, lpvValue))
+ return true;
+ else
+ return false;
+}
+
+
+bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
+{
+ if (nIndex == OS_INVALID_TLS_INDEX) {
+ assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
+ return false;
+ }
+
+ if (TlsFree(nIndex))
+ return true;
+ else
+ return false;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/parseConst.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/parseConst.cpp
new file mode 100644
index 0000000..9a8a50c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/parseConst.cpp
@@ -0,0 +1,238 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/ParseHelper.h"
+
+//
+// Use this class to carry along data from node to node in
+// the traversal
+//
+class TConstTraverser : public TIntermTraverser {
+public:
+ TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType& t)
+ : error(false),
+ index(0),
+ unionArray(cUnion),
+ type(t),
+ constructorType(constructType),
+ singleConstantParam(singleConstParam),
+ infoSink(sink),
+ symbolTable(symTable),
+ size(0),
+ isMatrix(false),
+ matrixSize(0) {
+ }
+
+ bool error;
+
+protected:
+ void visitSymbol(TIntermSymbol*);
+ void visitConstantUnion(TIntermConstantUnion*);
+ bool visitBinary(Visit visit, TIntermBinary*);
+ bool visitUnary(Visit visit, TIntermUnary*);
+ bool visitSelection(Visit visit, TIntermSelection*);
+ bool visitAggregate(Visit visit, TIntermAggregate*);
+ bool visitLoop(Visit visit, TIntermLoop*);
+ bool visitBranch(Visit visit, TIntermBranch*);
+
+ int index;
+ ConstantUnion *unionArray;
+ TType type;
+ TOperator constructorType;
+ bool singleConstantParam;
+ TInfoSink& infoSink;
+ TSymbolTable& symbolTable;
+ int size; // size of the constructor ( 4 for vec4)
+ bool isMatrix;
+ int matrixSize; // dimension of the matrix (nominal size and not the instance size)
+};
+
+//
+// The rest of the file are the traversal functions. The last one
+// is the one that starts the traversal.
+//
+// Return true from interior nodes to have the external traversal
+// continue on to children. If you process children yourself,
+// return false.
+//
+
+void TConstTraverser::visitSymbol(TIntermSymbol* node)
+{
+ infoSink.info.message(EPrefixInternalError, "Symbol Node found in constant constructor", node->getLine());
+ return;
+
+}
+
+bool TConstTraverser::visitBinary(Visit visit, TIntermBinary* node)
+{
+ TQualifier qualifier = node->getType().getQualifier();
+
+ if (qualifier != EvqConst) {
+ TString buf;
+ buf.append("'constructor' : assigning non-constant to ");
+ buf.append(type.getCompleteString());
+ infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
+ error = true;
+ return false;
+ }
+
+ infoSink.info.message(EPrefixInternalError, "Binary Node found in constant constructor", node->getLine());
+
+ return false;
+}
+
+bool TConstTraverser::visitUnary(Visit visit, TIntermUnary* node)
+{
+ TString buf;
+ buf.append("'constructor' : assigning non-constant to ");
+ buf.append(type.getCompleteString());
+ infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
+ error = true;
+ return false;
+}
+
+bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+ if (!node->isConstructor() && node->getOp() != EOpComma) {
+ TString buf;
+ buf.append("'constructor' : assigning non-constant to ");
+ buf.append(type.getCompleteString());
+ infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
+ error = true;
+ return false;
+ }
+
+ if (node->getSequence().size() == 0) {
+ error = true;
+ return false;
+ }
+
+ bool flag = node->getSequence().size() == 1 && node->getSequence()[0]->getAsTyped()->getAsConstantUnion();
+ if (flag)
+ {
+ singleConstantParam = true;
+ constructorType = node->getOp();
+ size = node->getType().getObjectSize();
+
+ if (node->getType().isMatrix()) {
+ isMatrix = true;
+ matrixSize = node->getType().getNominalSize();
+ }
+ }
+
+ for (TIntermSequence::iterator p = node->getSequence().begin();
+ p != node->getSequence().end(); p++) {
+
+ if (node->getOp() == EOpComma)
+ index = 0;
+
+ (*p)->traverse(this);
+ }
+ if (flag)
+ {
+ singleConstantParam = false;
+ constructorType = EOpNull;
+ size = 0;
+ isMatrix = false;
+ matrixSize = 0;
+ }
+ return false;
+}
+
+bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
+{
+ infoSink.info.message(EPrefixInternalError, "Selection Node found in constant constructor", node->getLine());
+ error = true;
+ return false;
+}
+
+void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
+{
+ ConstantUnion* leftUnionArray = unionArray;
+ int instanceSize = type.getObjectSize();
+
+ if (index >= instanceSize)
+ return;
+
+ if (!singleConstantParam) {
+ int size = node->getType().getObjectSize();
+
+ ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+ for (int i=0; i < size; i++) {
+ if (index >= instanceSize)
+ return;
+ leftUnionArray[index] = rightUnionArray[i];
+
+ (index)++;
+ }
+ } else {
+ int totalSize = index + size;
+ ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+ if (!isMatrix) {
+ int count = 0;
+ for (int i = index; i < totalSize; i++) {
+ if (i >= instanceSize)
+ return;
+
+ leftUnionArray[i] = rightUnionArray[count];
+
+ (index)++;
+
+ if (node->getType().getObjectSize() > 1)
+ count++;
+ }
+ } else { // for matrix constructors
+ int count = 0;
+ int element = index;
+ for (int i = index; i < totalSize; i++) {
+ if (i >= instanceSize)
+ return;
+ if (element - i == 0 || (i - element) % (matrixSize + 1) == 0 )
+ leftUnionArray[i] = rightUnionArray[count];
+ else
+ leftUnionArray[i].setFConst(0.0f);
+
+ (index)++;
+
+ if (node->getType().getObjectSize() > 1)
+ count++;
+ }
+ }
+ }
+}
+
+bool TConstTraverser::visitLoop(Visit visit, TIntermLoop* node)
+{
+ infoSink.info.message(EPrefixInternalError, "Loop Node found in constant constructor", node->getLine());
+ error = true;
+ return false;
+}
+
+bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
+{
+ infoSink.info.message(EPrefixInternalError, "Branch Node found in constant constructor", node->getLine());
+ error = true;
+ return false;
+}
+
+//
+// This function is the one to call externally to start the traversal.
+// Individual functions can be initialized to 0 to skip processing of that
+// type of node. It's children will still be processed.
+//
+bool TIntermediate::parseConstTree(TSourceLoc line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam)
+{
+ if (root == 0)
+ return false;
+
+ TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, symbolTable, t);
+
+ root->traverse(&it);
+ if (it.error)
+ return true;
+ else
+ return false;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c
new file mode 100644
index 0000000..c5636b7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c
@@ -0,0 +1,735 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+
+//
+// atom.c
+//
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "compiler/debug.h"
+#include "compiler/preprocessor/slglobals.h"
+
+#undef malloc
+#undef realloc
+#undef free
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////// String table: //////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+static const struct {
+ int val;
+ const char *str;
+} tokens[] = {
+ { CPP_AND_OP, "&&" },
+ { CPP_AND_ASSIGN, "&=" },
+ { CPP_SUB_ASSIGN, "-=" },
+ { CPP_MOD_ASSIGN, "%=" },
+ { CPP_ADD_ASSIGN, "+=" },
+ { CPP_DIV_ASSIGN, "/=" },
+ { CPP_MUL_ASSIGN, "*=" },
+ { CPP_RIGHT_BRACKET, ":>" },
+ { CPP_EQ_OP, "==" },
+ { CPP_XOR_OP, "^^" },
+ { CPP_XOR_ASSIGN, "^=" },
+ { CPP_FLOATCONSTANT, "<float-const>" },
+ { CPP_GE_OP, ">=" },
+ { CPP_RIGHT_OP, ">>" },
+ { CPP_RIGHT_ASSIGN, ">>=" },
+ { CPP_IDENTIFIER, "<ident>" },
+ { CPP_INTCONSTANT, "<int-const>" },
+ { CPP_LE_OP, "<=" },
+ { CPP_LEFT_OP, "<<" },
+ { CPP_LEFT_ASSIGN, "<<=" },
+ { CPP_LEFT_BRACKET, "<:" },
+ { CPP_LEFT_BRACE, "<%" },
+ { CPP_DEC_OP, "--" },
+ { CPP_RIGHT_BRACE, "%>" },
+ { CPP_NE_OP, "!=" },
+ { CPP_OR_OP, "||" },
+ { CPP_OR_ASSIGN, "|=" },
+ { CPP_INC_OP, "++" },
+ { CPP_STRCONSTANT, "<string-const>" },
+ { CPP_TYPEIDENTIFIER, "<type-ident>" },
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////// String table: //////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+#define INIT_STRING_TABLE_SIZE 16384
+
+typedef struct StringTable_Rec {
+ char *strings;
+ int nextFree;
+ int size;
+} StringTable;
+
+/*
+ * InitStringTable() - Initialize the string table.
+ *
+ */
+
+static int InitStringTable(StringTable *stable)
+{
+ stable->strings = (char *) malloc(INIT_STRING_TABLE_SIZE);
+ if (!stable->strings)
+ return 0;
+ // Zero-th offset means "empty" so don't use it.
+ stable->nextFree = 1;
+ stable->size = INIT_STRING_TABLE_SIZE;
+ return 1;
+} // InitStringTable
+
+/*
+ * FreeStringTable() - Free the string table.
+ *
+ */
+
+static void FreeStringTable(StringTable *stable)
+{
+ if (stable->strings)
+ free(stable->strings);
+ stable->strings = NULL;
+ stable->nextFree = 0;
+ stable->size = 0;
+} // FreeStringTable
+
+/*
+ * HashString() - Hash a string with the base hash function.
+ *
+ */
+
+static int HashString(const char *s)
+{
+ int hval = 0;
+
+ while (*s) {
+ hval = (hval*13507 + *s*197) ^ (hval >> 2);
+ s++;
+ }
+ return hval & 0x7fffffff;
+} // HashString
+
+/*
+ * HashString2() - Hash a string with the incrimenting hash function.
+ *
+ */
+
+static int HashString2(const char *s)
+{
+ int hval = 0;
+
+ while (*s) {
+ hval = (hval*729 + *s*37) ^ (hval >> 1);
+ s++;
+ }
+ return hval;
+} // HashString2
+
+/*
+ * AddString() - Add a string to a string table. Return it's offset.
+ *
+ */
+
+static int AddString(StringTable *stable, const char *s)
+{
+ int len, loc;
+ char *str;
+
+ len = (int) strlen(s);
+ if (stable->nextFree + len + 1 >= stable->size) {
+ assert(stable->size < 1000000);
+ str = (char *) malloc(stable->size*2);
+ memcpy(str, stable->strings, stable->size);
+ free(stable->strings);
+ stable->strings = str;
+ }
+ loc = stable->nextFree;
+ strcpy(&stable->strings[loc], s);
+ stable->nextFree += len + 1;
+ return loc;
+} // AddString
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////// Hash table: ///////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+#define INIT_HASH_TABLE_SIZE 2047
+#define HASH_TABLE_MAX_COLLISIONS 3
+
+typedef struct HashEntry_Rec {
+ int index; // String table offset of string representation
+ int value; // Atom (symbol) value
+} HashEntry;
+
+typedef struct HashTable_Rec {
+ HashEntry *entry;
+ int size;
+ int entries;
+ int counts[HASH_TABLE_MAX_COLLISIONS + 1];
+} HashTable;
+
+/*
+ * InitHashTable() - Initialize the hash table.
+ *
+ */
+
+static int InitHashTable(HashTable *htable, int fsize)
+{
+ int ii;
+
+ htable->entry = (HashEntry *) malloc(sizeof(HashEntry)*fsize);
+ if (!htable->entry)
+ return 0;
+ htable->size = fsize;
+ for (ii = 0; ii < fsize; ii++) {
+ htable->entry[ii].index = 0;
+ htable->entry[ii].value = 0;
+ }
+ htable->entries = 0;
+ for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++)
+ htable->counts[ii] = 0;
+ return 1;
+} // InitHashTable
+
+/*
+ * FreeHashTable() - Free the hash table.
+ *
+ */
+
+static void FreeHashTable(HashTable *htable)
+{
+ if (htable->entry)
+ free(htable->entry);
+ htable->entry = NULL;
+ htable->size = 0;
+ htable->entries = 0;
+} // FreeHashTable
+
+/*
+ * Empty() - See if a hash table entry is empty.
+ *
+ */
+
+static int Empty(HashTable *htable, int hashloc)
+{
+ assert(hashloc >= 0 && hashloc < htable->size);
+ if (htable->entry[hashloc].index == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+} // Empty
+
+/*
+ * Match() - See if a hash table entry is matches a string.
+ *
+ */
+
+static int Match(HashTable *htable, StringTable *stable, const char *s, int hashloc)
+{
+ int strloc;
+
+ strloc = htable->entry[hashloc].index;
+ if (!strcmp(s, &stable->strings[strloc])) {
+ return 1;
+ } else {
+ return 0;
+ }
+} // Match
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////// Atom table: ///////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+#define INIT_ATOM_TABLE_SIZE 1024
+
+
+struct AtomTable_Rec {
+ StringTable stable; // String table.
+ HashTable htable; // Hashes string to atom number and token value. Multiple strings can
+ // have the same token value but each unique string is a unique atom.
+ int *amap; // Maps atom value to offset in string table. Atoms all map to unique
+ // strings except for some undefined values in the lower, fixed part
+ // of the atom table that map to "<undefined>". The lowest 256 atoms
+ // correspond to single character ASCII values except for alphanumeric
+ // characters and '_', which can be other tokens. Next come the
+ // language tokens with their atom values equal to the token value.
+ // Then come predefined atoms, followed by user specified identifiers.
+ int *arev; // Reversed atom for symbol table use.
+ int nextFree;
+ int size;
+};
+
+static AtomTable latable = { { 0 } };
+AtomTable *atable = &latable;
+
+static int AddAtomFixed(AtomTable *atable, const char *s, int atom);
+
+/*
+ * GrowAtomTable() - Grow the atom table to at least "size" if it's smaller.
+ *
+ */
+
+static int GrowAtomTable(AtomTable *atable, int size)
+{
+ int *newmap, *newrev;
+
+ if (atable->size < size) {
+ if (atable->amap) {
+ newmap = realloc(atable->amap, sizeof(int)*size);
+ newrev = realloc(atable->arev, sizeof(int)*size);
+ } else {
+ newmap = malloc(sizeof(int)*size);
+ newrev = malloc(sizeof(int)*size);
+ atable->size = 0;
+ }
+ if (!newmap || !newrev) {
+ /* failed to grow -- error */
+ if (newmap)
+ atable->amap = newmap;
+ if (newrev)
+ atable->amap = newrev;
+ return -1;
+ }
+ memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));
+ memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));
+ atable->amap = newmap;
+ atable->arev = newrev;
+ atable->size = size;
+ }
+ return 0;
+} // GrowAtomTable
+
+/*
+ * lReverse() - Reverse the bottom 20 bits of a 32 bit int.
+ *
+ */
+
+static int lReverse(int fval)
+{
+ unsigned int in = fval;
+ int result = 0, cnt = 0;
+
+ while(in) {
+ result <<= 1;
+ result |= in&1;
+ in >>= 1;
+ cnt++;
+ }
+
+ // Don't use all 31 bits. One million atoms is plenty and sometimes the
+ // upper bits are used for other things.
+
+ if (cnt < 20)
+ result <<= 20 - cnt;
+ return result;
+} // lReverse
+
+/*
+ * AllocateAtom() - Allocate a new atom. Associated with the "undefined" value of -1.
+ *
+ */
+
+static int AllocateAtom(AtomTable *atable)
+{
+ if (atable->nextFree >= atable->size)
+ GrowAtomTable(atable, atable->nextFree*2);
+ atable->amap[atable->nextFree] = -1;
+ atable->arev[atable->nextFree] = lReverse(atable->nextFree);
+ atable->nextFree++;
+ return atable->nextFree - 1;
+} // AllocateAtom
+
+/*
+ * SetAtomValue() - Allocate a new atom associated with "hashindex".
+ *
+ */
+
+static void SetAtomValue(AtomTable *atable, int atomnumber, int hashindex)
+{
+ atable->amap[atomnumber] = atable->htable.entry[hashindex].index;
+ atable->htable.entry[hashindex].value = atomnumber;
+} // SetAtomValue
+
+/*
+ * FindHashLoc() - Find the hash location for this string. Return -1 it hash table is full.
+ *
+ */
+
+static int FindHashLoc(AtomTable *atable, const char *s)
+{
+ int hashloc, hashdelta, count;
+ int FoundEmptySlot = 0;
+ int collision[HASH_TABLE_MAX_COLLISIONS + 1];
+
+ hashloc = HashString(s) % atable->htable.size;
+ if (!Empty(&atable->htable, hashloc)) {
+ if (Match(&atable->htable, &atable->stable, s, hashloc))
+ return hashloc;
+ collision[0] = hashloc;
+ hashdelta = HashString2(s);
+ count = 0;
+ while (count < HASH_TABLE_MAX_COLLISIONS) {
+ hashloc = ((hashloc + hashdelta) & 0x7fffffff) % atable->htable.size;
+ if (!Empty(&atable->htable, hashloc)) {
+ if (Match(&atable->htable, &atable->stable, s, hashloc)) {
+ return hashloc;
+ }
+ } else {
+ FoundEmptySlot = 1;
+ break;
+ }
+ count++;
+ collision[count] = hashloc;
+ }
+
+ if (!FoundEmptySlot) {
+ if (cpp->options.DumpAtomTable) {
+ int ii;
+ char str[200];
+ sprintf(str, "*** Hash failed with more than %d collisions. Must increase hash table size. ***",
+ HASH_TABLE_MAX_COLLISIONS);
+ CPPShInfoLogMsg(str);
+
+ sprintf(str, "*** New string \"%s\", hash=%04x, delta=%04x", s, collision[0], hashdelta);
+ CPPShInfoLogMsg(str);
+ for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++) {
+ sprintf(str, "*** Collides on try %d at hash entry %04x with \"%s\"",
+ ii + 1, collision[ii], GetAtomString(atable, atable->htable.entry[collision[ii]].value));
+ CPPShInfoLogMsg(str);
+ }
+ }
+ return -1;
+ } else {
+ atable->htable.counts[count]++;
+ }
+ }
+ return hashloc;
+} // FindHashLoc
+
+/*
+ * IncreaseHashTableSize()
+ *
+ */
+
+static int IncreaseHashTableSize(AtomTable *atable)
+{
+ int ii, strloc, oldhashloc, value, size;
+ AtomTable oldtable;
+ char *s;
+
+ // Save the old atom table and create a new one:
+
+ oldtable = *atable;
+ size = oldtable.htable.size*2 + 1;
+ if (!InitAtomTable(atable, size))
+ return 0;
+
+ // Add all the existing values to the new atom table preserving their atom values:
+
+ for (ii = atable->nextFree; ii < oldtable.nextFree; ii++) {
+ strloc = oldtable.amap[ii];
+ s = &oldtable.stable.strings[strloc];
+ oldhashloc = FindHashLoc(&oldtable, s);
+ assert(oldhashloc >= 0);
+ value = oldtable.htable.entry[oldhashloc].value;
+ AddAtomFixed(atable, s, value);
+ }
+ FreeAtomTable(&oldtable);
+ return 1;
+} // IncreaseHashTableSize
+
+/*
+ * LookUpAddStringHash() - Lookup a string in the hash table. If it's not there, add it and
+ * initialize the atom value in the hash table to 0. Return the hash table index.
+ */
+
+static int LookUpAddStringHash(AtomTable *atable, const char *s)
+{
+ int hashloc, strloc;
+
+ while(1) {
+ hashloc = FindHashLoc(atable, s);
+ if (hashloc >= 0)
+ break;
+ IncreaseHashTableSize(atable);
+ }
+
+ if (Empty(&atable->htable, hashloc)) {
+ atable->htable.entries++;
+ strloc = AddString(&atable->stable, s);
+ atable->htable.entry[hashloc].index = strloc;
+ atable->htable.entry[hashloc].value = 0;
+ }
+ return hashloc;
+} // LookUpAddStringHash
+
+/*
+ * LookUpAddString() - Lookup a string in the hash table. If it's not there, add it and
+ * initialize the atom value in the hash table to the next atom number.
+ * Return the atom value of string.
+ */
+
+int LookUpAddString(AtomTable *atable, const char *s)
+{
+ int hashindex, atom;
+
+ hashindex = LookUpAddStringHash(atable, s);
+ atom = atable->htable.entry[hashindex].value;
+ if (atom == 0) {
+ atom = AllocateAtom(atable);
+ SetAtomValue(atable, atom, hashindex);
+ }
+ return atom;
+} // LookUpAddString
+
+/*
+ * GetAtomString()
+ *
+ */
+
+const char *GetAtomString(AtomTable *atable, int atom)
+{
+ int soffset;
+
+ if (atom > 0 && atom < atable->nextFree) {
+ soffset = atable->amap[atom];
+ if (soffset > 0 && soffset < atable->stable.nextFree) {
+ return &atable->stable.strings[soffset];
+ } else {
+ return "<internal error: bad soffset>";
+ }
+ } else {
+ if (atom == 0) {
+ return "<null atom>";
+ } else {
+ if (atom == EOF) {
+ return "<EOF>";
+ } else {
+ return "<invalid atom>";
+ }
+ }
+ }
+} // GetAtomString
+
+/*
+ * GetReversedAtom()
+ *
+ */
+
+int GetReversedAtom(AtomTable *atable, int atom)
+{
+ if (atom > 0 && atom < atable->nextFree) {
+ return atable->arev[atom];
+ } else {
+ return 0;
+ }
+} // GetReversedAtom
+
+/*
+ * AddAtom() - Add a string to the atom, hash and string tables if it isn't already there.
+ * Return it's atom index.
+ */
+
+int AddAtom(AtomTable *atable, const char *s)
+{
+ int atom;
+
+ atom = LookUpAddString(atable, s);
+ return atom;
+} // AddAtom
+
+/*
+ * AddAtomFixed() - Add an atom to the hash and string tables if it isn't already there.
+ * Assign it the atom value of "atom".
+ */
+
+static int AddAtomFixed(AtomTable *atable, const char *s, int atom)
+{
+ int hashindex, lsize;
+
+ hashindex = LookUpAddStringHash(atable, s);
+ if (atable->nextFree >= atable->size || atom >= atable->size) {
+ lsize = atable->size*2;
+ if (lsize <= atom)
+ lsize = atom + 1;
+ GrowAtomTable(atable, lsize);
+ }
+ atable->amap[atom] = atable->htable.entry[hashindex].index;
+ atable->htable.entry[hashindex].value = atom;
+ //if (atom >= atable->nextFree)
+ // atable->nextFree = atom + 1;
+ while (atom >= atable->nextFree) {
+ atable->arev[atable->nextFree] = lReverse(atable->nextFree);
+ atable->nextFree++;
+ }
+ return atom;
+} // AddAtomFixed
+
+/*
+ * InitAtomTable() - Initialize the atom table.
+ *
+ */
+
+int InitAtomTable(AtomTable *atable, int htsize)
+{
+ unsigned int ii;
+
+ htsize = htsize <= 0 ? INIT_HASH_TABLE_SIZE : htsize;
+ if (!InitStringTable(&atable->stable))
+ return 0;
+ if (!InitHashTable(&atable->htable, htsize))
+ return 0;
+
+ atable->nextFree = 0;
+ atable->amap = NULL;
+ atable->size = 0;
+ GrowAtomTable(atable, INIT_ATOM_TABLE_SIZE);
+ if (!atable->amap)
+ return 0;
+
+ // Initialize lower part of atom table to "<undefined>" atom:
+
+ AddAtomFixed(atable, "<undefined>", 0);
+ for (ii = 0; ii < FIRST_USER_TOKEN_SY; ii++)
+ atable->amap[ii] = atable->amap[0];
+
+ // Add single character tokens to the atom table:
+
+ {
+ const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";
+ char t[2];
+
+ t[1] = '\0';
+ while (*s) {
+ t[0] = *s;
+ AddAtomFixed(atable, t, s[0]);
+ s++;
+ }
+ }
+
+ // Add multiple character scanner tokens :
+
+ for (ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++)
+ AddAtomFixed(atable, tokens[ii].str, tokens[ii].val);
+
+ // Add error symbol if running in error mode:
+
+ if (cpp->options.ErrorMode)
+ AddAtomFixed(atable, "error", ERROR_SY);
+
+ AddAtom(atable, "<*** end fixed atoms ***>");
+
+ return 1;
+} // InitAtomTable
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////// Debug Printing Functions: //////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+/*
+ * PrintAtomTable()
+ *
+ */
+
+void PrintAtomTable(AtomTable *atable)
+{
+ int ii;
+ char str[200];
+
+ for (ii = 0; ii < atable->nextFree; ii++) {
+ sprintf(str, "%d: \"%s\"", ii, &atable->stable.strings[atable->amap[ii]]);
+ CPPDebugLogMsg(str);
+ }
+ sprintf(str, "Hash table: size=%d, entries=%d, collisions=",
+ atable->htable.size, atable->htable.entries);
+ CPPDebugLogMsg(str);
+ for (ii = 0; ii < HASH_TABLE_MAX_COLLISIONS; ii++) {
+ sprintf(str, " %d", atable->htable.counts[ii]);
+ CPPDebugLogMsg(str);
+ }
+
+} // PrintAtomTable
+
+
+/*
+ * GetStringOfAtom()
+ *
+ */
+
+char* GetStringOfAtom(AtomTable *atable, int atom)
+{
+ char* chr_str;
+ chr_str=&atable->stable.strings[atable->amap[atom]];
+ return chr_str;
+} // GetStringOfAtom
+
+/*
+ * FreeAtomTable() - Free the atom table and associated memory
+ *
+ */
+
+void FreeAtomTable(AtomTable *atable)
+{
+ FreeStringTable(&atable->stable);
+ FreeHashTable(&atable->htable);
+ if (atable->amap)
+ free(atable->amap);
+ if (atable->arev)
+ free(atable->arev);
+ atable->amap = NULL;
+ atable->arev = NULL;
+ atable->nextFree = 0;
+ atable->size = 0;
+} // FreeAtomTable
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////// End of atom.c ///////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h
new file mode 100644
index 0000000..1d84c32
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h
@@ -0,0 +1,63 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// atom.h
+//
+
+#if !defined(__ATOM_H)
+#define __ATOM_H 1
+
+typedef struct AtomTable_Rec AtomTable;
+
+extern AtomTable *atable;
+
+int InitAtomTable(AtomTable *atable, int htsize);
+void FreeAtomTable(AtomTable *atable);
+int AddAtom(AtomTable *atable, const char *s);
+void PrintAtomTable(AtomTable *atable);
+int LookUpAddString(AtomTable *atable, const char *s);
+const char *GetAtomString(AtomTable *atable, int atom);
+int GetReversedAtom(AtomTable *atable, int atom);
+char* GetStringOfAtom(AtomTable *atable, int atom);
+#endif // !defined(__ATOM_H)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h
new file mode 100644
index 0000000..69e3425
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h
@@ -0,0 +1,99 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// compile.h
+//
+
+#if !defined(__COMPILE_H)
+#define __COMPILE_H 1
+
+int InitCPPStruct(void);
+
+typedef struct Options_Rec{
+ const char *profileString;
+ int ErrorMode;
+ int Quiet;
+
+ // Debug The Compiler options:
+ int DumpAtomTable;
+} Options;
+
+struct CPPStruct_Rec {
+ // Public members
+ SourceLoc *pLastSourceLoc; // Set at the start of each statement by the tree walkers
+ Options options; // Compile options and parameters
+
+ // Private members
+ SourceLoc lastSourceLoc;
+
+ // Scanner data:
+
+ SourceLoc *tokenLoc; // Source location of most recent token seen by the scanner
+ int mostRecentToken; // Most recent token seen by the scanner
+ InputSrc *currentInput;
+ int previous_token;
+ int pastFirstStatement; // used to make sure that #version is the first statement seen in the file, if present
+
+ void *pC; // storing the parseContext of the compile object in cpp.
+
+ // Private members:
+ SourceLoc ltokenLoc;
+ int ifdepth; //current #if-#else-#endif nesting in the cpp.c file (pre-processor)
+ int elsedepth[64]; //Keep a track of #if depth..Max allowed is 64.
+ int elsetracker; //#if-#else and #endif constructs...Counter.
+ const char *ErrMsg;
+ int CompileError; //Indicate compile error when #error, #else,#elif mismatch.
+
+ //
+ // Globals used to communicate between PaParseStrings() and yy_input()and
+ // also across the files.(gen_glslang.cpp and scanner.c)
+ //
+ int PaWhichStr; // which string we're parsing
+ const int* PaStrLen; // array of lengths of the PaArgv strings
+ int PaArgc; // count of strings in the array
+ const char* const* PaArgv; // our array of strings to parse
+ unsigned int tokensBeforeEOF : 1;
+};
+
+#endif // !defined(__COMPILE_H)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c
new file mode 100644
index 0000000..204a213
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c
@@ -0,0 +1,1061 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// cpp.c
+//
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "compiler/preprocessor/slglobals.h"
+
+static int CPPif(yystypepp * yylvalpp);
+
+/* Don't use memory.c's replacements, as we clean up properly here */
+#undef malloc
+#undef free
+
+static int bindAtom = 0;
+static int constAtom = 0;
+static int defaultAtom = 0;
+static int defineAtom = 0;
+static int definedAtom = 0;
+static int elseAtom = 0;
+static int elifAtom = 0;
+static int endifAtom = 0;
+static int ifAtom = 0;
+static int ifdefAtom = 0;
+static int ifndefAtom = 0;
+static int includeAtom = 0;
+static int lineAtom = 0;
+static int pragmaAtom = 0;
+static int texunitAtom = 0;
+static int undefAtom = 0;
+static int errorAtom = 0;
+static int __LINE__Atom = 0;
+static int __FILE__Atom = 0;
+static int __VERSION__Atom = 0;
+static int versionAtom = 0;
+static int extensionAtom = 0;
+
+static Scope *macros = 0;
+#define MAX_MACRO_ARGS 64
+#define MAX_IF_NESTING 64
+
+static SourceLoc ifloc; /* outermost #if */
+
+int InitCPP(void)
+{
+ char buffer[64], *t;
+ const char *f;
+
+ // Add various atoms needed by the CPP line scanner:
+ bindAtom = LookUpAddString(atable, "bind");
+ constAtom = LookUpAddString(atable, "const");
+ defaultAtom = LookUpAddString(atable, "default");
+ defineAtom = LookUpAddString(atable, "define");
+ definedAtom = LookUpAddString(atable, "defined");
+ elifAtom = LookUpAddString(atable, "elif");
+ elseAtom = LookUpAddString(atable, "else");
+ endifAtom = LookUpAddString(atable, "endif");
+ ifAtom = LookUpAddString(atable, "if");
+ ifdefAtom = LookUpAddString(atable, "ifdef");
+ ifndefAtom = LookUpAddString(atable, "ifndef");
+ includeAtom = LookUpAddString(atable, "include");
+ lineAtom = LookUpAddString(atable, "line");
+ pragmaAtom = LookUpAddString(atable, "pragma");
+ texunitAtom = LookUpAddString(atable, "texunit");
+ undefAtom = LookUpAddString(atable, "undef");
+ errorAtom = LookUpAddString(atable, "error");
+ __LINE__Atom = LookUpAddString(atable, "__LINE__");
+ __FILE__Atom = LookUpAddString(atable, "__FILE__");
+ __VERSION__Atom = LookUpAddString(atable, "__VERSION__");
+ versionAtom = LookUpAddString(atable, "version");
+ extensionAtom = LookUpAddString(atable, "extension");
+ macros = NewScopeInPool(mem_CreatePool(0, 0));
+ strcpy(buffer, "PROFILE_");
+ t = buffer + strlen(buffer);
+ f = cpp->options.profileString;
+ while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
+ *t++ = toupper(*f++);
+ *t = 0;
+
+ PredefineIntMacro("GL_ES", 1);
+ PredefineIntMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
+
+ return 1;
+} // InitCPP
+
+int FreeCPP(void)
+{
+ if (macros)
+ {
+ mem_FreePool(macros->pool);
+ macros = 0;
+ }
+
+ return 1;
+}
+
+int FinalCPP(void)
+{
+ if (cpp->ifdepth)
+ CPPErrorToInfoLog("#if mismatch");
+ return 1;
+}
+
+static int CPPdefine(yystypepp * yylvalpp)
+{
+ int token, name, args[MAX_MACRO_ARGS], argc;
+ const char *message;
+ MacroSymbol mac;
+ Symbol *symb;
+ SourceLoc dummyLoc;
+ memset(&mac, 0, sizeof(mac));
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != CPP_IDENTIFIER) {
+ CPPErrorToInfoLog("#define");
+ return token;
+ }
+ name = yylvalpp->sc_ident;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token == '(' && !yylvalpp->sc_int) {
+ // gather arguments
+ argc = 0;
+ do {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (argc == 0 && token == ')') break;
+ if (token != CPP_IDENTIFIER) {
+ CPPErrorToInfoLog("#define");
+ return token;
+ }
+ if (argc < MAX_MACRO_ARGS)
+ args[argc++] = yylvalpp->sc_ident;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ } while (token == ',');
+ if (token != ')') {
+ CPPErrorToInfoLog("#define");
+ return token;
+ }
+ mac.argc = argc;
+ mac.args = mem_Alloc(macros->pool, argc * sizeof(int));
+ memcpy(mac.args, args, argc * sizeof(int));
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+ mac.body = NewTokenStream(GetAtomString(atable, name), macros->pool);
+ while (token != '\n') {
+ if (token == '\\') {
+ CPPErrorToInfoLog("The line continuation character (\\) is not part of the OpenGL ES Shading Language");
+ return token;
+ } else if (token <= 0) { // EOF or error
+ CPPErrorToInfoLog("unexpected end of input in #define preprocessor directive - expected a newline");
+ return 0;
+ }
+ RecordToken(mac.body, token, yylvalpp);
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ };
+
+ symb = LookUpSymbol(macros, name);
+ if (symb) {
+ if (!symb->details.mac.undef) {
+ // already defined -- need to make sure they are identical
+ if (symb->details.mac.argc != mac.argc) goto error;
+ for (argc=0; argc < mac.argc; argc++)
+ if (symb->details.mac.args[argc] != mac.args[argc])
+ goto error;
+ RewindTokenStream(symb->details.mac.body);
+ RewindTokenStream(mac.body);
+ do {
+ int old_lval, old_token;
+ old_token = ReadToken(symb->details.mac.body, yylvalpp);
+ old_lval = yylvalpp->sc_int;
+ token = ReadToken(mac.body, yylvalpp);
+ if (token != old_token || yylvalpp->sc_int != old_lval) {
+ error:
+ StoreStr("Macro Redefined");
+ StoreStr(GetStringOfAtom(atable,name));
+ message=GetStrfromTStr();
+ DecLineNumber();
+ CPPShInfoLogMsg(message);
+ IncLineNumber();
+ ResetTString();
+ break; }
+ } while (token > 0);
+ }
+ //FreeMacro(&symb->details.mac);
+ } else {
+ dummyLoc.file = 0;
+ dummyLoc.line = 0;
+ symb = AddSymbol(&dummyLoc, macros, name, MACRO_S);
+ }
+ symb->details.mac = mac;
+ return '\n';
+} // CPPdefine
+
+static int CPPundef(yystypepp * yylvalpp)
+{
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ Symbol *symb;
+ if(token == '\n'){
+ CPPErrorToInfoLog("#undef");
+ return token;
+ }
+ if (token != CPP_IDENTIFIER)
+ goto error;
+ symb = LookUpSymbol(macros, yylvalpp->sc_ident);
+ if (symb) {
+ symb->details.mac.undef = 1;
+ }
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != '\n') {
+ error:
+ CPPErrorToInfoLog("#undef");
+ }
+ return token;
+} // CPPundef
+
+/* CPPelse -- skip forward to appropriate spot. This is actually used
+** to skip to and #endif after seeing an #else, AND to skip to a #else,
+** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false
+*/
+
+static int CPPelse(int matchelse, yystypepp * yylvalpp)
+{
+ int atom,depth=0;
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+
+ while (token > 0) {
+ if (token != '#') {
+ while (token != '\n') {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token <= 0) { // EOF or error
+ CPPErrorToInfoLog("unexpected end of input in #else preprocessor directive - expected a newline");
+ return 0;
+ }
+ }
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ continue;
+ }
+ if ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) != CPP_IDENTIFIER)
+ continue;
+ atom = yylvalpp->sc_ident;
+ if (atom == ifAtom || atom == ifdefAtom || atom == ifndefAtom){
+ depth++; cpp->ifdepth++; cpp->elsetracker++;
+ cpp->elsedepth[cpp->elsetracker] = 0;
+ }
+ else if (atom == endifAtom) {
+ if(--depth<0){
+ --cpp->elsetracker;
+ if (cpp->ifdepth)
+ --cpp->ifdepth;
+ break;
+ }
+ --cpp->elsetracker;
+ --cpp->ifdepth;
+ }
+ else if (((int)(matchelse) != 0)&& depth==0) {
+ if (atom == elseAtom ) {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != '\n') {
+ CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
+ while (token != '\n') {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token <= 0) { // EOF or error
+ CPPErrorToInfoLog("unexpected end of input following #else preprocessor directive - expected a newline");
+ return 0;
+ }
+ }
+ }
+ break;
+ }
+ else if (atom == elifAtom) {
+ /* we decrement cpp->ifdepth here, because CPPif will increment
+ * it and we really want to leave it alone */
+ if (cpp->ifdepth){
+ --cpp->ifdepth;
+ --cpp->elsetracker;
+ }
+ return CPPif(yylvalpp);
+ }
+ }
+ else if((atom==elseAtom) && (!ChkCorrectElseNesting())){
+ CPPErrorToInfoLog("#else after a #else");
+ cpp->CompileError=1;
+ }
+ };
+ return token;
+}
+
+enum eval_prec {
+ MIN_PREC,
+ COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY,
+ MAX_PREC
+};
+
+static int op_logor(int a, int b) { return a || b; }
+static int op_logand(int a, int b) { return a && b; }
+static int op_or(int a, int b) { return a | b; }
+static int op_xor(int a, int b) { return a ^ b; }
+static int op_and(int a, int b) { return a & b; }
+static int op_eq(int a, int b) { return a == b; }
+static int op_ne(int a, int b) { return a != b; }
+static int op_ge(int a, int b) { return a >= b; }
+static int op_le(int a, int b) { return a <= b; }
+static int op_gt(int a, int b) { return a > b; }
+static int op_lt(int a, int b) { return a < b; }
+static int op_shl(int a, int b) { return a << b; }
+static int op_shr(int a, int b) { return a >> b; }
+static int op_add(int a, int b) { return a + b; }
+static int op_sub(int a, int b) { return a - b; }
+static int op_mul(int a, int b) { return a * b; }
+static int op_div(int a, int b) { return a / b; }
+static int op_mod(int a, int b) { return a % b; }
+static int op_pos(int a) { return a; }
+static int op_neg(int a) { return -a; }
+static int op_cmpl(int a) { return ~a; }
+static int op_not(int a) { return !a; }
+
+struct {
+ int token, prec, (*op)(int, int);
+} binop[] = {
+ { CPP_OR_OP, LOGOR, op_logor },
+ { CPP_AND_OP, LOGAND, op_logand },
+ { '|', OR, op_or },
+ { '^', XOR, op_xor },
+ { '&', AND, op_and },
+ { CPP_EQ_OP, EQUAL, op_eq },
+ { CPP_NE_OP, EQUAL, op_ne },
+ { '>', RELATION, op_gt },
+ { CPP_GE_OP, RELATION, op_ge },
+ { '<', RELATION, op_lt },
+ { CPP_LE_OP, RELATION, op_le },
+ { CPP_LEFT_OP, SHIFT, op_shl },
+ { CPP_RIGHT_OP, SHIFT, op_shr },
+ { '+', ADD, op_add },
+ { '-', ADD, op_sub },
+ { '*', MUL, op_mul },
+ { '/', MUL, op_div },
+ { '%', MUL, op_mod },
+};
+
+struct {
+ int token, (*op)(int);
+} unop[] = {
+ { '+', op_pos },
+ { '-', op_neg },
+ { '~', op_cmpl },
+ { '!', op_not },
+};
+
+#define ALEN(A) (sizeof(A)/sizeof(A[0]))
+
+static int eval(int token, int prec, int *res, int *err, yystypepp * yylvalpp)
+{
+ int i, val;
+ Symbol *s;
+ if (token == CPP_IDENTIFIER) {
+ if (yylvalpp->sc_ident == definedAtom) {
+ int needclose = 0;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token == '(') {
+ needclose = 1;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+ if (token != CPP_IDENTIFIER)
+ goto error;
+ *res = (s = LookUpSymbol(macros, yylvalpp->sc_ident))
+ ? !s->details.mac.undef : 0;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (needclose) {
+ if (token != ')')
+ goto error;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+ } else if (MacroExpand(yylvalpp->sc_ident, yylvalpp)) {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ return eval(token, prec, res, err, yylvalpp);
+ } else {
+ goto error;
+ }
+ } else if (token == CPP_INTCONSTANT) {
+ *res = yylvalpp->sc_int;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ } else if (token == '(') {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ token = eval(token, MIN_PREC, res, err, yylvalpp);
+ if (!*err) {
+ if (token != ')')
+ goto error;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+ } else {
+ for (i = ALEN(unop) - 1; i >= 0; i--) {
+ if (unop[i].token == token)
+ break;
+ }
+ if (i >= 0) {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ token = eval(token, UNARY, res, err, yylvalpp);
+ *res = unop[i].op(*res);
+ } else {
+ goto error;
+ }
+ }
+ while (!*err) {
+ if (token == ')' || token == '\n') break;
+ for (i = ALEN(binop) - 1; i >= 0; i--) {
+ if (binop[i].token == token)
+ break;
+ }
+ if (i < 0 || binop[i].prec <= prec)
+ break;
+ val = *res;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ token = eval(token, binop[i].prec, res, err, yylvalpp);
+ *res = binop[i].op(val, *res);
+ }
+ return token;
+error:
+ CPPErrorToInfoLog("incorrect preprocessor directive");
+ *err = 1;
+ *res = 0;
+ return token;
+} // eval
+
+static int CPPif(yystypepp * yylvalpp) {
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ int res = 0, err = 0;
+ cpp->elsetracker++;
+ cpp->elsedepth[cpp->elsetracker] = 0;
+ if (!cpp->ifdepth++)
+ ifloc = *cpp->tokenLoc;
+ if(cpp->ifdepth >MAX_IF_NESTING){
+ CPPErrorToInfoLog("max #if nesting depth exceeded");
+ return 0;
+ }
+ token = eval(token, MIN_PREC, &res, &err, yylvalpp);
+ if (token != '\n') {
+ CPPWarningToInfoLog("unexpected tokens following #if preprocessor directive - expected a newline");
+ while (token != '\n') {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token <= 0) { // EOF or error
+ CPPErrorToInfoLog("unexpected end of input in #if preprocessor directive - expected a newline");
+ return 0;
+ }
+ }
+ }
+ if (!res && !err) {
+ token = CPPelse(1, yylvalpp);
+ }
+
+ return token;
+} // CPPif
+
+static int CPPifdef(int defined, yystypepp * yylvalpp)
+{
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ int name = yylvalpp->sc_ident;
+ if(++cpp->ifdepth >MAX_IF_NESTING){
+ CPPErrorToInfoLog("max #if nesting depth exceeded");
+ return 0;
+ }
+ cpp->elsetracker++;
+ cpp->elsedepth[cpp->elsetracker] = 0;
+ if (token != CPP_IDENTIFIER) {
+ defined ? CPPErrorToInfoLog("ifdef"):CPPErrorToInfoLog("ifndef");
+ } else {
+ Symbol *s = LookUpSymbol(macros, name);
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != '\n') {
+ CPPWarningToInfoLog("unexpected tokens following #ifdef preprocessor directive - expected a newline");
+ while (token != '\n') {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token <= 0) { // EOF or error
+ CPPErrorToInfoLog("unexpected end of input in #ifdef preprocessor directive - expected a newline");
+ return 0;
+ }
+ }
+ }
+ if (((s && !s->details.mac.undef) ? 1 : 0) != defined)
+ token = CPPelse(1, yylvalpp);
+ }
+ return token;
+} // CPPifdef
+
+static int CPPline(yystypepp * yylvalpp)
+{
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if(token=='\n'){
+ DecLineNumber();
+ CPPErrorToInfoLog("#line");
+ IncLineNumber();
+ return token;
+ }
+ else if (token == CPP_INTCONSTANT) {
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
+ SetLineNumber(yylvalpp->sc_int);
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+
+ if (token == CPP_INTCONSTANT) {
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
+ SetStringNumber(yylvalpp->sc_int);
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if(token!='\n')
+ CPPErrorToInfoLog("#line");
+ }
+ else if (token == '\n'){
+ return token;
+ }
+ else{
+ CPPErrorToInfoLog("#line");
+ }
+ }
+ else{
+ CPPErrorToInfoLog("#line");
+ }
+ return token;
+}
+
+static int CPPerror(yystypepp * yylvalpp) {
+
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ const char *message;
+
+ while (token != '\n') {
+ if (token <= 0){
+ CPPErrorToInfoLog("unexpected end of input in #error preprocessor directive - expected a newline");
+ return 0;
+ }else if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
+ StoreStr(yylvalpp->symbol_name);
+ }else if(token == CPP_IDENTIFIER || token == CPP_STRCONSTANT){
+ StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
+ }else {
+ StoreStr(GetStringOfAtom(atable,token));
+ }
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+ DecLineNumber();
+ //store this msg into the shader's information log..set the Compile Error flag!!!!
+ message=GetStrfromTStr();
+ CPPShInfoLogMsg(message);
+ ResetTString();
+ cpp->CompileError=1;
+ IncLineNumber();
+ return '\n';
+}//CPPerror
+
+static int CPPpragma(yystypepp * yylvalpp)
+{
+ char SrcStrName[2];
+ char** allTokens;
+ int tokenCount = 0;
+ int maxTokenCount = 10;
+ const char* SrcStr;
+ int i;
+
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+
+ if (token=='\n') {
+ DecLineNumber();
+ CPPErrorToInfoLog("#pragma");
+ IncLineNumber();
+ return token;
+ }
+
+ allTokens = (char**)malloc(sizeof(char*) * maxTokenCount);
+
+ while (token != '\n') {
+ if (tokenCount >= maxTokenCount) {
+ maxTokenCount *= 2;
+ allTokens = (char**)realloc((char**)allTokens, sizeof(char*) * maxTokenCount);
+ }
+ switch (token) {
+ case CPP_IDENTIFIER:
+ SrcStr = GetAtomString(atable, yylvalpp->sc_ident);
+ allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
+ strcpy(allTokens[tokenCount++], SrcStr);
+ break;
+ case CPP_INTCONSTANT:
+ SrcStr = yylvalpp->symbol_name;
+ allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
+ strcpy(allTokens[tokenCount++], SrcStr);
+ break;
+ case CPP_FLOATCONSTANT:
+ SrcStr = yylvalpp->symbol_name;
+ allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
+ strcpy(allTokens[tokenCount++], SrcStr);
+ break;
+ case -1:
+ // EOF
+ CPPShInfoLogMsg("#pragma directive must end with a newline");
+ return token;
+ default:
+ SrcStrName[0] = token;
+ SrcStrName[1] = '\0';
+ allTokens[tokenCount] = (char*)malloc(2);
+ strcpy(allTokens[tokenCount++], SrcStrName);
+ }
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+
+ cpp->currentInput->ungetch(cpp->currentInput, token, yylvalpp);
+ HandlePragma((const char**)allTokens, tokenCount);
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+
+ for (i = 0; i < tokenCount; ++i) {
+ free (allTokens[i]);
+ }
+ free (allTokens);
+
+ return token;
+} // CPPpragma
+
+#define ESSL_VERSION_NUMBER 100
+#define ESSL_VERSION_STRING "100"
+
+static int CPPversion(yystypepp * yylvalpp)
+{
+
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+
+ if (cpp->pastFirstStatement == 1)
+ CPPShInfoLogMsg("#version must occur before any other statement in the program");
+
+ if(token=='\n'){
+ DecLineNumber();
+ CPPErrorToInfoLog("#version");
+ IncLineNumber();
+ return token;
+ }
+ if (token != CPP_INTCONSTANT)
+ CPPErrorToInfoLog("#version");
+
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
+ //SetVersionNumber(yylvalpp->sc_int);
+
+ if (yylvalpp->sc_int != ESSL_VERSION_NUMBER)
+ CPPShInfoLogMsg("Version number not supported by ESSL");
+
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+
+ if (token == '\n'){
+ return token;
+ }
+ else{
+ CPPErrorToInfoLog("#version");
+ }
+ return token;
+} // CPPversion
+
+static int CPPextension(yystypepp * yylvalpp)
+{
+
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ char extensionName[MAX_SYMBOL_NAME_LEN + 1];
+
+ if(token=='\n'){
+ DecLineNumber();
+ CPPShInfoLogMsg("extension name not specified");
+ IncLineNumber();
+ return token;
+ }
+
+ if (token != CPP_IDENTIFIER)
+ CPPErrorToInfoLog("#extension");
+
+ strncpy(extensionName, GetAtomString(atable, yylvalpp->sc_ident), MAX_SYMBOL_NAME_LEN);
+ extensionName[MAX_SYMBOL_NAME_LEN] = '\0';
+
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != ':') {
+ CPPShInfoLogMsg("':' missing after extension name");
+ return token;
+ }
+
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != CPP_IDENTIFIER) {
+ CPPShInfoLogMsg("behavior for extension not specified");
+ return token;
+ }
+
+ updateExtensionBehavior(extensionName, GetAtomString(atable, yylvalpp->sc_ident));
+
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token == '\n'){
+ return token;
+ }
+ else{
+ CPPErrorToInfoLog("#extension");
+ }
+ return token;
+} // CPPextension
+
+int readCPPline(yystypepp * yylvalpp)
+{
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ const char *message;
+ int isVersion = 0;
+
+ if (token == CPP_IDENTIFIER) {
+ if (yylvalpp->sc_ident == defineAtom) {
+ token = CPPdefine(yylvalpp);
+ } else if (yylvalpp->sc_ident == elseAtom) {
+ if(ChkCorrectElseNesting()){
+ if (!cpp->ifdepth ){
+ CPPErrorToInfoLog("#else mismatch");
+ cpp->CompileError=1;
+ }
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != '\n') {
+ CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
+ while (token != '\n') {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token <= 0) { // EOF or error
+ CPPErrorToInfoLog("unexpected end of input in #ifdef preprocessor directive - expected a newline");
+ return 0;
+ }
+ }
+ }
+ token = CPPelse(0, yylvalpp);
+ }else{
+ CPPErrorToInfoLog("#else after a #else");
+ cpp->ifdepth=0;
+ cpp->pastFirstStatement = 1;
+ return 0;
+ }
+ } else if (yylvalpp->sc_ident == elifAtom) {
+ if (!cpp->ifdepth){
+ CPPErrorToInfoLog("#elif mismatch");
+ cpp->CompileError=1;
+ }
+ // this token is really a dont care, but we still need to eat the tokens
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ while (token != '\n') {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token <= 0) { // EOF or error
+ CPPErrorToInfoLog("unexpect tokens following #elif preprocessor directive - expected a newline");
+ cpp->CompileError = 1;
+ break;
+ }
+ }
+ token = CPPelse(0, yylvalpp);
+ } else if (yylvalpp->sc_ident == endifAtom) {
+ --cpp->elsetracker;
+ if (!cpp->ifdepth){
+ CPPErrorToInfoLog("#endif mismatch");
+ cpp->CompileError=1;
+ }
+ else
+ --cpp->ifdepth;
+ } else if (yylvalpp->sc_ident == ifAtom) {
+ token = CPPif(yylvalpp);
+ } else if (yylvalpp->sc_ident == ifdefAtom) {
+ token = CPPifdef(1, yylvalpp);
+ } else if (yylvalpp->sc_ident == ifndefAtom) {
+ token = CPPifdef(0, yylvalpp);
+ } else if (yylvalpp->sc_ident == lineAtom) {
+ token = CPPline(yylvalpp);
+ } else if (yylvalpp->sc_ident == pragmaAtom) {
+ token = CPPpragma(yylvalpp);
+ } else if (yylvalpp->sc_ident == undefAtom) {
+ token = CPPundef(yylvalpp);
+ } else if (yylvalpp->sc_ident == errorAtom) {
+ token = CPPerror(yylvalpp);
+ } else if (yylvalpp->sc_ident == versionAtom) {
+ token = CPPversion(yylvalpp);
+ isVersion = 1;
+ } else if (yylvalpp->sc_ident == extensionAtom) {
+ token = CPPextension(yylvalpp);
+ } else {
+ StoreStr("Invalid Directive");
+ StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
+ message=GetStrfromTStr();
+ CPPShInfoLogMsg(message);
+ ResetTString();
+ }
+ }
+ while (token != '\n' && token != 0 && token != EOF) {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+
+ cpp->pastFirstStatement = 1;
+
+ return token;
+} // readCPPline
+
+void FreeMacro(MacroSymbol *s) {
+ DeleteTokenStream(s->body);
+}
+
+void PredefineIntMacro(const char *name, int value) {
+ SourceLoc location = {0};
+ Symbol *symbol = NULL;
+ MacroSymbol macro = {0};
+ yystypepp val = {0};
+ int atom = 0;
+
+ macro.body = NewTokenStream(name, macros->pool);
+ val.sc_int = value;
+ sprintf(val.symbol_name, "%d", value);
+ RecordToken(macro.body, CPP_INTCONSTANT, &val);
+ atom = LookUpAddString(atable, name);
+ symbol = AddSymbol(&location, macros, atom, MACRO_S);
+ symbol->details.mac = macro;
+}
+
+static int eof_scan(InputSrc *in, yystypepp * yylvalpp) { return -1; }
+static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) { }
+
+static void PushEofSrc() {
+ InputSrc *in = malloc(sizeof(InputSrc));
+ memset(in, 0, sizeof(InputSrc));
+ in->scan = eof_scan;
+ in->getch = eof_scan;
+ in->ungetch = noop;
+ in->prev = cpp->currentInput;
+ cpp->currentInput = in;
+}
+
+static void PopEofSrc() {
+ if (cpp->currentInput->scan == eof_scan) {
+ InputSrc *in = cpp->currentInput;
+ cpp->currentInput = in->prev;
+ free(in);
+ }
+}
+
+static TokenStream *PrescanMacroArg(TokenStream *a, yystypepp * yylvalpp) {
+ int token;
+ TokenStream *n;
+ RewindTokenStream(a);
+ do {
+ token = ReadToken(a, yylvalpp);
+ if (token == CPP_IDENTIFIER && LookUpSymbol(macros, yylvalpp->sc_ident))
+ break;
+ } while (token > 0);
+ if (token <= 0) return a;
+ n = NewTokenStream("macro arg", 0);
+ PushEofSrc();
+ ReadFromTokenStream(a, 0, 0);
+ while ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) > 0) {
+ if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp->sc_ident, yylvalpp))
+ continue;
+ RecordToken(n, token, yylvalpp);
+ }
+ PopEofSrc();
+ DeleteTokenStream(a);
+ return n;
+} // PrescanMacroArg
+
+typedef struct MacroInputSrc {
+ InputSrc base;
+ MacroSymbol *mac;
+ TokenStream **args;
+} MacroInputSrc;
+
+/* macro_scan ---
+** return the next token for a macro expanion, handling macro args
+*/
+static int macro_scan(MacroInputSrc *in, yystypepp * yylvalpp) {
+ int i;
+ int token = ReadToken(in->mac->body, yylvalpp);
+ if (token == CPP_IDENTIFIER) {
+ for (i = in->mac->argc-1; i>=0; i--)
+ if (in->mac->args[i] == yylvalpp->sc_ident) break;
+ if (i >= 0) {
+ ReadFromTokenStream(in->args[i], yylvalpp->sc_ident, 0);
+ return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ }
+ }
+ if (token > 0) return token;
+ in->mac->busy = 0;
+ cpp->currentInput = in->base.prev;
+ if (in->args) {
+ for (i=in->mac->argc-1; i>=0; i--)
+ DeleteTokenStream(in->args[i]);
+ free(in->args);
+ }
+ free(in);
+ return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+} // macro_scan
+
+/* MacroExpand
+** check an identifier (atom) to see if it a macro that should be expanded.
+** If it is, push an InputSrc that will produce the appropriate expansion
+** and return TRUE. If not, return FALSE.
+*/
+
+int MacroExpand(int atom, yystypepp * yylvalpp)
+{
+ Symbol *sym = LookUpSymbol(macros, atom);
+ MacroInputSrc *in;
+ int i,j, token, depth=0;
+ const char *message;
+ if (atom == __LINE__Atom) {
+ yylvalpp->sc_int = GetLineNumber();
+ sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);
+ UngetToken(CPP_INTCONSTANT, yylvalpp);
+ return 1;
+ }
+ if (atom == __FILE__Atom) {
+ yylvalpp->sc_int = GetStringNumber();
+ sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);
+ UngetToken(CPP_INTCONSTANT, yylvalpp);
+ return 1;
+ }
+ if (atom == __VERSION__Atom) {
+ strcpy(yylvalpp->symbol_name,ESSL_VERSION_STRING);
+ yylvalpp->sc_int = atoi(yylvalpp->symbol_name);
+ UngetToken(CPP_INTCONSTANT, yylvalpp);
+ return 1;
+ }
+ if (!sym || sym->details.mac.undef) return 0;
+ if (sym->details.mac.busy) return 0; // no recursive expansions
+ in = malloc(sizeof(*in));
+ memset(in, 0, sizeof(*in));
+ in->base.scan = (void *)macro_scan;
+ in->base.line = cpp->currentInput->line;
+ in->base.name = cpp->currentInput->name;
+ in->mac = &sym->details.mac;
+ if (sym->details.mac.args) {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token != '(') {
+ UngetToken(token, yylvalpp);
+ yylvalpp->sc_ident = atom;
+ return 0;
+ }
+ in->args = malloc(in->mac->argc * sizeof(TokenStream *));
+ for (i=0; i<in->mac->argc; i++)
+ in->args[i] = NewTokenStream("macro arg", 0);
+ i=0;j=0;
+ do{
+ depth = 0;
+ while(1) {
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token <= 0) {
+ StoreStr("EOF in Macro ");
+ StoreStr(GetStringOfAtom(atable,atom));
+ message=GetStrfromTStr();
+ CPPShInfoLogMsg(message);
+ ResetTString();
+ return 1;
+ }
+ if((in->mac->argc==0) && (token!=')')) break;
+ if (depth == 0 && (token == ',' || token == ')')) break;
+ if (token == '(') depth++;
+ if (token == ')') depth--;
+ RecordToken(in->args[i], token, yylvalpp);
+ j=1;
+ }
+ if (token == ')') {
+ if((in->mac->argc==1) &&j==0)
+ break;
+ i++;
+ break;
+ }
+ i++;
+ }while(i < in->mac->argc);
+
+ if (i < in->mac->argc) {
+ StoreStr("Too few args in Macro ");
+ StoreStr(GetStringOfAtom(atable,atom));
+ message=GetStrfromTStr();
+ CPPShInfoLogMsg(message);
+ ResetTString();
+ } else if (token != ')') {
+ depth=0;
+ while (token >= 0 && (depth > 0 || token != ')')) {
+ if (token == ')') depth--;
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+ if (token == '(') depth++;
+ }
+
+ if (token <= 0) {
+ StoreStr("EOF in Macro ");
+ StoreStr(GetStringOfAtom(atable,atom));
+ message=GetStrfromTStr();
+ CPPShInfoLogMsg(message);
+ ResetTString();
+ return 1;
+ }
+ StoreStr("Too many args in Macro ");
+ StoreStr(GetStringOfAtom(atable,atom));
+ message=GetStrfromTStr();
+ CPPShInfoLogMsg(message);
+ ResetTString();
+ }
+ for (i=0; i<in->mac->argc; i++) {
+ in->args[i] = PrescanMacroArg(in->args[i], yylvalpp);
+ }
+ }
+#if 0
+ printf(" <%s:%d>found macro %s\n", GetAtomString(atable, loc.file),
+ loc.line, GetAtomString(atable, atom));
+ for (i=0; i<in->mac->argc; i++) {
+ printf("\targ %s = '", GetAtomString(atable, in->mac->args[i]));
+ DumpTokenStream(stdout, in->args[i]);
+ printf("'\n");
+ }
+#endif
+ /*retain the input source*/
+ in->base.prev = cpp->currentInput;
+ sym->details.mac.busy = 1;
+ RewindTokenStream(sym->details.mac.body);
+ cpp->currentInput = &in->base;
+ return 1;
+} // MacroExpand
+
+int ChkCorrectElseNesting(void)
+{
+ if(cpp->elsedepth[cpp->elsetracker]==0){
+ cpp->elsedepth[cpp->elsetracker]=1;
+ return 1;
+ }
+ return 0;
+}
+
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h
new file mode 100644
index 0000000..db4c184
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h
@@ -0,0 +1,86 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// cpp.h
+//
+
+#if !defined(__CPP_H)
+#define __CPP_H 1
+
+#include "compiler/preprocessor/parser.h"
+#include "compiler/preprocessor/tokens.h"
+
+int InitCPP(void);
+int FinalCPP(void);
+int readCPPline(yystypepp * yylvalpp);
+int MacroExpand(int atom, yystypepp * yylvalpp);
+int ChkCorrectElseNesting(void);
+
+typedef struct MacroSymbol {
+ int argc;
+ int *args;
+ TokenStream *body;
+ unsigned busy:1;
+ unsigned undef:1;
+} MacroSymbol;
+
+void FreeMacro(MacroSymbol *);
+void PredefineIntMacro(const char *name, int value);
+
+void CPPDebugLogMsg(const char *msg); // Prints information into debug log
+void CPPShInfoLogMsg(const char*); // Store cpp Err Msg into Sh.Info.Log
+void CPPWarningToInfoLog(const char *msg); // Prints warning messages into info log
+void HandlePragma(const char**, int numTokens); // #pragma directive container.
+void ResetTString(void); // #error Message as TString.
+void CPPErrorToInfoLog(char*); // Stick all cpp errors into Sh.Info.log .
+void StoreStr(char*); // Store the TString in Parse Context.
+void SetLineNumber(int); // Set line number.
+void SetStringNumber(int); // Set string number.
+int GetLineNumber(void); // Get the current String Number.
+int GetStringNumber(void); // Get the current String Number.
+const char* GetStrfromTStr(void); // Convert TString to String.
+void updateExtensionBehavior(const char* extName, const char* behavior);
+int FreeCPP(void);
+
+#endif // !(defined(__CPP_H)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c
new file mode 100644
index 0000000..8e142bc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c
@@ -0,0 +1,152 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// cppstruct.c
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "compiler/preprocessor/slglobals.h"
+
+CPPStruct *cpp = NULL;
+static int refCount = 0;
+
+int InitPreprocessor(void);
+int ResetPreprocessor(void);
+int FreeCPPStruct(void);
+int FinalizePreprocessor(void);
+
+/*
+ * InitCPPStruct() - Initilaize the CPP structure.
+ *
+ */
+
+int InitCPPStruct(void)
+{
+ int len;
+ char *p;
+
+ cpp = (CPPStruct *) malloc(sizeof(CPPStruct));
+ if (cpp == NULL)
+ return 0;
+
+ refCount++;
+
+ // Initialize public members:
+ cpp->pLastSourceLoc = &cpp->lastSourceLoc;
+
+ p = (char *) &cpp->options;
+ len = sizeof(cpp->options);
+ while (--len >= 0)
+ p[len] = 0;
+
+ ResetPreprocessor();
+ return 1;
+} // InitCPPStruct
+
+int ResetPreprocessor(void)
+{
+ // Initialize private members:
+
+ cpp->lastSourceLoc.file = 0;
+ cpp->lastSourceLoc.line = 0;
+ cpp->pC=0;
+ cpp->CompileError=0;
+ cpp->ifdepth=0;
+ for(cpp->elsetracker=0; cpp->elsetracker<64; cpp->elsetracker++)
+ cpp->elsedepth[cpp->elsetracker]=0;
+ cpp->elsetracker=0;
+ cpp->tokensBeforeEOF = 0;
+ return 1;
+}
+
+//Intializing the Preprocessor.
+
+int InitPreprocessor(void)
+{
+ # define CPP_STUFF true
+ # ifdef CPP_STUFF
+ FreeCPPStruct();
+ InitCPPStruct();
+ cpp->options.Quiet = 1;
+ cpp->options.profileString = "generic";
+ if (!InitAtomTable(atable, 0))
+ return 1;
+ if (!InitScanner(cpp))
+ return 1;
+ # endif
+ return 0;
+}
+
+//FreeCPPStruct() - Free the CPP structure.
+
+int FreeCPPStruct(void)
+{
+ if (refCount)
+ {
+ free(cpp);
+ refCount--;
+ }
+
+ return 1;
+}
+
+//Finalizing the Preprocessor.
+
+int FinalizePreprocessor(void)
+{
+ # define CPP_STUFF true
+ # ifdef CPP_STUFF
+ FreeAtomTable(atable);
+ FreeCPPStruct();
+ FreeScanner();
+ # endif
+ return 0;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////// End of cppstruct.c //////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c
new file mode 100644
index 0000000..e6fea7a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c
@@ -0,0 +1,154 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef _MSC_VER
+#include <stdint.h>
+#endif
+
+#include "compiler/preprocessor/memory.h"
+
+// default alignment and chunksize, if called with 0 arguments
+#define CHUNKSIZE (64*1024)
+#define ALIGN 8
+
+// we need to call the `real' malloc and free, not our replacements
+#undef malloc
+#undef free
+
+struct chunk {
+ struct chunk *next;
+};
+
+struct cleanup {
+ struct cleanup *next;
+ void (*fn)(void *);
+ void *arg;
+};
+
+struct MemoryPool_rec {
+ struct chunk *next;
+ uintptr_t free, end;
+ size_t chunksize;
+ uintptr_t alignmask;
+ struct cleanup *cleanup;
+};
+
+MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align)
+{
+ MemoryPool *pool;
+
+ if (align == 0) align = ALIGN;
+ if (chunksize == 0) chunksize = CHUNKSIZE;
+ if (align & (align-1)) return 0;
+ if (chunksize < sizeof(MemoryPool)) return 0;
+ if (chunksize & (align-1)) return 0;
+ if (!(pool = malloc(chunksize))) return 0;
+ pool->next = 0;
+ pool->chunksize = chunksize;
+ pool->alignmask = (uintptr_t)(align)-1;
+ pool->free = ((uintptr_t)(pool + 1) + pool->alignmask) & ~pool->alignmask;
+ pool->end = (uintptr_t)pool + chunksize;
+ pool->cleanup = 0;
+ return pool;
+}
+
+void mem_FreePool(MemoryPool *pool)
+{
+ struct cleanup *cleanup;
+ struct chunk *p, *next;
+
+ for (cleanup = pool->cleanup; cleanup; cleanup = cleanup->next) {
+ cleanup->fn(cleanup->arg);
+ }
+ for (p = (struct chunk *)pool; p; p = next) {
+ next = p->next;
+ free(p);
+ }
+}
+
+void *mem_Alloc(MemoryPool *pool, size_t size)
+{
+ struct chunk *ch;
+ void *rv = (void *)pool->free;
+ size = (size + pool->alignmask) & ~pool->alignmask;
+ if (size <= 0) size = pool->alignmask;
+ pool->free += size;
+ if (pool->free > pool->end || pool->free < (uintptr_t)rv) {
+ size_t minreq = (size + sizeof(struct chunk) + pool->alignmask)
+ & ~pool->alignmask;
+ pool->free = (uintptr_t)rv;
+ if (minreq >= pool->chunksize) {
+ // request size is too big for the chunksize, so allocate it as
+ // a single chunk of the right size
+ ch = malloc(minreq);
+ if (!ch) return 0;
+ } else {
+ ch = malloc(pool->chunksize);
+ if (!ch) return 0;
+ pool->free = (uintptr_t)ch + minreq;
+ pool->end = (uintptr_t)ch + pool->chunksize;
+ }
+ ch->next = pool->next;
+ pool->next = ch;
+ rv = (void *)(((uintptr_t)(ch+1) + pool->alignmask) & ~pool->alignmask);
+ }
+ return rv;
+}
+
+int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {
+ struct cleanup *cleanup;
+
+ pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);
+ cleanup = mem_Alloc(pool, sizeof(struct cleanup));
+ if (!cleanup) return -1;
+ cleanup->next = pool->cleanup;
+ cleanup->fn = fn;
+ cleanup->arg = arg;
+ pool->cleanup = cleanup;
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h
new file mode 100644
index 0000000..b3ae2f9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h
@@ -0,0 +1,56 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+#ifndef __MEMORY_H
+#define __MEMORY_H
+
+typedef struct MemoryPool_rec MemoryPool;
+
+extern MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align);
+extern void mem_FreePool(MemoryPool *);
+extern void *mem_Alloc(MemoryPool *p, size_t size);
+extern void *mem_Realloc(MemoryPool *p, void *old, size_t oldsize, size_t newsize);
+extern int mem_AddCleanup(MemoryPool *p, void (*fn)(void *), void *arg);
+
+#endif /* __MEMORY_H */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h
new file mode 100644
index 0000000..f67342b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h
@@ -0,0 +1,93 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+
+#ifndef BISON_PARSER_H
+# define BISON_PARSER_H
+
+#ifndef yystypepp
+typedef struct {
+ int sc_int;
+ float sc_fval;
+ int sc_ident;
+ char symbol_name[MAX_SYMBOL_NAME_LEN+1];
+} yystypepp;
+
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+# define CPP_AND_OP 257
+# define CPP_SUB_ASSIGN 259
+# define CPP_MOD_ASSIGN 260
+# define CPP_ADD_ASSIGN 261
+# define CPP_DIV_ASSIGN 262
+# define CPP_MUL_ASSIGN 263
+# define CPP_EQ_OP 264
+# define CPP_XOR_OP 265
+# define ERROR_SY 266
+# define CPP_FLOATCONSTANT 267
+# define CPP_GE_OP 268
+# define CPP_RIGHT_OP 269
+# define CPP_IDENTIFIER 270
+# define CPP_INTCONSTANT 271
+# define CPP_LE_OP 272
+# define CPP_LEFT_OP 273
+# define CPP_DEC_OP 274
+# define CPP_NE_OP 275
+# define CPP_OR_OP 276
+# define CPP_INC_OP 277
+# define CPP_STRCONSTANT 278
+# define CPP_TYPEIDENTIFIER 279
+
+# define FIRST_USER_TOKEN_SY 289
+
+# define CPP_RIGHT_ASSIGN 280
+# define CPP_LEFT_ASSIGN 281
+# define CPP_AND_ASSIGN 282
+# define CPP_OR_ASSIGN 283
+# define CPP_XOR_ASSIGN 284
+# define CPP_LEFT_BRACKET 285
+# define CPP_RIGHT_BRACKET 286
+# define CPP_LEFT_BRACE 287
+# define CPP_RIGHT_BRACE 288
+
+#endif /* not BISON_PARSER_H */
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h
new file mode 100644
index 0000000..88d196f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h
@@ -0,0 +1,51 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+
+#include "compiler/preprocessor/slglobals.h"
+extern CPPStruct *cpp;
+int InitCPPStruct(void);
+int InitScanner(CPPStruct *cpp);
+int InitAtomTable(AtomTable *atable, int htsize);
+int ScanFromString(const char *s);
+char* GetStringOfAtom(AtomTable *atable, int atom);
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c
new file mode 100644
index 0000000..7b399a0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c
@@ -0,0 +1,687 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// scanner.c
+//
+
+#include <assert.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if 0
+ #include <ieeefp.h>
+#else
+ #define isinff(x) (((*(int *)&(x) & 0x7f800000L)==0x7f800000L) && \
+ ((*(int *)&(x) & 0x007fffffL)==0000000000L))
+#endif
+
+#include "compiler/preprocessor/slglobals.h"
+#include "compiler/util.h"
+
+typedef struct StringInputSrc {
+ InputSrc base;
+ char *p;
+} StringInputSrc;
+
+static int eof_scan(InputSrc *is, yystypepp * yylvalpp)
+{
+ return EOF;
+} // eof_scan
+
+static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) {}
+
+static InputSrc eof_inputsrc = { 0, &eof_scan, &eof_scan, &noop };
+
+static int byte_scan(InputSrc *, yystypepp * yylvalpp);
+
+#define EOL_SY '\n'
+
+#if defined(_MSC_VER)
+ #define DBG_BREAKPOINT() __asm int 3
+#elif defined(_M_AMD64)
+ #define DBG_BREAKPOINT() assert(!"Dbg_Breakpoint");
+#else
+ #define DBG_BREAKPOINT()
+#endif
+
+#if defined(_MSC_VER) && !defined(_M_AMD64)
+ __int64 RDTSC ( void ) {
+
+ __int64 v;
+
+ __asm __emit 0x0f
+ __asm __emit 0x31
+ __asm mov dword ptr v, eax
+ __asm mov dword ptr v+4, edx
+
+ return v;
+ }
+#endif
+
+
+int InitScanner(CPPStruct *cpp)
+{
+ // Add various atoms needed by the CPP line scanner:
+ if (!InitCPP())
+ return 0;
+
+ cpp->mostRecentToken = 0;
+ cpp->tokenLoc = &cpp->ltokenLoc;
+
+ cpp->ltokenLoc.file = 0;
+ cpp->ltokenLoc.line = 0;
+
+ cpp->currentInput = &eof_inputsrc;
+ cpp->previous_token = '\n';
+ cpp->pastFirstStatement = 0;
+
+ return 1;
+} // InitScanner
+
+int FreeScanner(void)
+{
+ return (FreeCPP());
+}
+
+/*
+ * str_getch()
+ * takes care of reading from multiple strings.
+ * returns the next-char from the input stream.
+ * returns EOF when the complete shader is parsed.
+ */
+static int str_getch(StringInputSrc *in)
+{
+ for(;;){
+ if (*in->p){
+ if (*in->p == '\n') {
+ in->base.line++;
+ IncLineNumber();
+ }
+ return *in->p++;
+ }
+ if(++(cpp->PaWhichStr) < cpp->PaArgc){
+ free(in);
+ SetStringNumber(cpp->PaWhichStr);
+ SetLineNumber(1);
+ ScanFromString(cpp->PaArgv[cpp->PaWhichStr]);
+ in=(StringInputSrc*)cpp->currentInput;
+ continue;
+ }
+ else{
+ cpp->currentInput = in->base.prev;
+ cpp->PaWhichStr=0;
+ free(in);
+ return EOF;
+ }
+ }
+} // str_getch
+
+static void str_ungetch(StringInputSrc *in, int ch, yystypepp *type) {
+ if (in->p[-1] == ch)in->p--;
+ else {
+ *(in->p)='\0'; //this would take care of shifting to the previous string.
+ cpp->PaWhichStr--;
+ }
+ if (ch == '\n') {
+ in->base.line--;
+ DecLineNumber();
+ }
+} // str_ungetch
+
+int ScanFromString(const char *s)
+{
+
+ StringInputSrc *in = malloc(sizeof(StringInputSrc));
+ memset(in, 0, sizeof(StringInputSrc));
+ in->p = (char*) s;
+ in->base.line = 1;
+ in->base.scan = byte_scan;
+ in->base.getch = (int (*)(InputSrc *, yystypepp *))str_getch;
+ in->base.ungetch = (void (*)(InputSrc *, int, yystypepp *))str_ungetch;
+ in->base.prev = cpp->currentInput;
+ cpp->currentInput = &in->base;
+
+ return 1;
+} // ScanFromString;
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////// Floating point constants: /////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+#define APPEND_CHAR_S(ch, str, len, max_len) \
+ if (len < max_len) { \
+ str[len++] = ch; \
+ } else if (!alreadyComplained) { \
+ CPPErrorToInfoLog("BUFFER OVERFLOW"); \
+ alreadyComplained = 1; \
+ }
+
+/*
+ * lFloatConst() - Scan a floating point constant. Assumes that the scanner
+ * has seen at least one digit, followed by either a decimal '.' or the
+ * letter 'e'.
+ * ch - '.' or 'e'
+ * len - length of string already copied into yylvalpp->symbol_name.
+ */
+
+static int lFloatConst(int ch, int len, yystypepp * yylvalpp)
+{
+ int alreadyComplained = 0;
+ assert((ch == '.') || (ch == 'e') || (ch == 'E'));
+
+ if (ch == '.') {
+ do {
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ } while (ch >= '0' && ch <= '9');
+ }
+
+ // Exponent:
+ if (ch == 'e' || ch == 'E') {
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '+') {
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ } else if (ch == '-') {
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ }
+ if (ch >= '0' && ch <= '9') {
+ while (ch >= '0' && ch <= '9') {
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ }
+ } else {
+ CPPErrorToInfoLog("EXPONENT INVALID");
+ }
+ }
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+
+ assert(len <= MAX_SYMBOL_NAME_LEN);
+ yylvalpp->symbol_name[len] = '\0';
+ yylvalpp->sc_fval = (float) atof_dot(yylvalpp->symbol_name);
+ if (isinff(yylvalpp->sc_fval)) {
+ CPPErrorToInfoLog("FLOAT CONSTANT OVERFLOW");
+ }
+ return CPP_FLOATCONSTANT;
+} // lFloatConst
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////// Normal Scanner //////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+static int byte_scan(InputSrc *in, yystypepp * yylvalpp)
+{
+ char string_val[MAX_STRING_LEN + 1];
+ int alreadyComplained = 0;
+ int len, ch, ii, ival = 0;
+
+ for (;;) {
+ yylvalpp->sc_int = 0;
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+
+ while (ch == ' ' || ch == '\t' || ch == '\r') {
+ yylvalpp->sc_int = 1;
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ }
+
+ cpp->ltokenLoc.file = cpp->currentInput->name;
+ cpp->ltokenLoc.line = cpp->currentInput->line;
+ alreadyComplained = 0;
+ len = 0;
+ switch (ch) {
+ default:
+ return ch; // Single character token
+ case EOF:
+ return -1;
+ case 'A': case 'B': case 'C': case 'D': case 'E':
+ case 'F': case 'G': case 'H': case 'I': case 'J':
+ case 'K': case 'L': case 'M': case 'N': case 'O':
+ case 'P': case 'Q': case 'R': case 'S': case 'T':
+ case 'U': case 'V': case 'W': case 'X': case 'Y':
+ case 'Z': case '_':
+ case 'a': case 'b': case 'c': case 'd': case 'e':
+ case 'f': case 'g': case 'h': case 'i': case 'j':
+ case 'k': case 'l': case 'm': case 'n': case 'o':
+ case 'p': case 'q': case 'r': case 's': case 't':
+ case 'u': case 'v': case 'w': case 'x': case 'y':
+ case 'z':
+ do {
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ } while ((ch >= 'a' && ch <= 'z') ||
+ (ch >= 'A' && ch <= 'Z') ||
+ (ch >= '0' && ch <= '9') ||
+ ch == '_');
+ assert(len <= MAX_SYMBOL_NAME_LEN);
+ yylvalpp->symbol_name[len] = '\0';
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ yylvalpp->sc_ident = LookUpAddString(atable, yylvalpp->symbol_name);
+ return CPP_IDENTIFIER;
+ break;
+ case '0':
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == 'x' || ch == 'X') { // hexadecimal integer constants
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if ((ch >= '0' && ch <= '9') ||
+ (ch >= 'A' && ch <= 'F') ||
+ (ch >= 'a' && ch <= 'f'))
+ {
+ ival = 0;
+ do {
+ if ((ival <= 0x0fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
+ yylvalpp->symbol_name[len++] = ch;
+ if (ch >= '0' && ch <= '9') {
+ ii = ch - '0';
+ } else if (ch >= 'A' && ch <= 'F') {
+ ii = ch - 'A' + 10;
+ } else {
+ ii = ch - 'a' + 10;
+ }
+ ival = (ival << 4) | ii;
+ } else if (!alreadyComplained) {
+ CPPErrorToInfoLog("HEX CONSTANT OVERFLOW");
+ alreadyComplained = 1;
+ }
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ } while ((ch >= '0' && ch <= '9') ||
+ (ch >= 'A' && ch <= 'F') ||
+ (ch >= 'a' && ch <= 'f'));
+ } else {
+ CPPErrorToInfoLog("HEX CONSTANT INVALID");
+ }
+ assert(len <= MAX_SYMBOL_NAME_LEN);
+ yylvalpp->symbol_name[len] = '\0';
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ yylvalpp->sc_int = ival;
+ return CPP_INTCONSTANT;
+ } else if (ch >= '0' && ch <= '7') { // octal integer constants
+ ival = 0;
+ do {
+ if ((ival <= 0x1fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
+ yylvalpp->symbol_name[len++] = ch;
+ ii = ch - '0';
+ ival = (ival << 3) | ii;
+ } else if (!alreadyComplained) {
+ CPPErrorToInfoLog("OCT CONSTANT OVERFLOW");
+ alreadyComplained = 1;
+ }
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ } while (ch >= '0' && ch <= '7');
+ if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E')
+ return lFloatConst(ch, len, yylvalpp);
+ assert(len <= MAX_SYMBOL_NAME_LEN);
+ yylvalpp->symbol_name[len] = '\0';
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ yylvalpp->sc_int = ival;
+ return CPP_INTCONSTANT;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ ch = '0';
+ }
+ // Fall through...
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ do {
+ APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ } while (ch >= '0' && ch <= '9');
+ if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E') {
+ return lFloatConst(ch, len, yylvalpp);
+ } else {
+ assert(len <= MAX_SYMBOL_NAME_LEN);
+ yylvalpp->symbol_name[len] = '\0';
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ ival = 0;
+ for (ii = 0; ii < len; ii++) {
+ ch = yylvalpp->symbol_name[ii] - '0';
+ ival = ival*10 + ch;
+ if ((ival > 214748364) || (ival == 214748364 && ch >= 8)) {
+ CPPErrorToInfoLog("INTEGER CONSTANT OVERFLOW");
+ break;
+ }
+ }
+ yylvalpp->sc_int = ival;
+ if(ival==0)
+ strcpy(yylvalpp->symbol_name,"0");
+ return CPP_INTCONSTANT;
+ }
+ break;
+ case '-':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '-') {
+ return CPP_DEC_OP;
+ } else if (ch == '=') {
+ return CPP_SUB_ASSIGN;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '-';
+ }
+ case '+':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '+') {
+ return CPP_INC_OP;
+ } else if (ch == '=') {
+ return CPP_ADD_ASSIGN;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '+';
+ }
+ case '*':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '=') {
+ return CPP_MUL_ASSIGN;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '*';
+ }
+ case '%':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '=') {
+ return CPP_MOD_ASSIGN;
+ } else if (ch == '>'){
+ return CPP_RIGHT_BRACE;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '%';
+ }
+ case ':':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '>') {
+ return CPP_RIGHT_BRACKET;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return ':';
+ }
+ case '^':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '^') {
+ return CPP_XOR_OP;
+ } else {
+ if (ch == '=')
+ return CPP_XOR_ASSIGN;
+ else{
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '^';
+ }
+ }
+
+ case '=':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '=') {
+ return CPP_EQ_OP;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '=';
+ }
+ case '!':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '=') {
+ return CPP_NE_OP;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '!';
+ }
+ case '|':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '|') {
+ return CPP_OR_OP;
+ } else {
+ if (ch == '=')
+ return CPP_OR_ASSIGN;
+ else{
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '|';
+ }
+ }
+ case '&':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '&') {
+ return CPP_AND_OP;
+ } else {
+ if (ch == '=')
+ return CPP_AND_ASSIGN;
+ else{
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '&';
+ }
+ }
+ case '<':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '<') {
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if(ch == '=')
+ return CPP_LEFT_ASSIGN;
+ else{
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return CPP_LEFT_OP;
+ }
+ } else {
+ if (ch == '=') {
+ return CPP_LE_OP;
+ } else {
+ if (ch == '%')
+ return CPP_LEFT_BRACE;
+ else if (ch == ':')
+ return CPP_LEFT_BRACKET;
+ else{
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '<';
+ }
+ }
+ }
+ case '>':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '>') {
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if(ch == '=')
+ return CPP_RIGHT_ASSIGN;
+ else{
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return CPP_RIGHT_OP;
+ }
+ } else {
+ if (ch == '=') {
+ return CPP_GE_OP;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '>';
+ }
+ }
+ case '.':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch >= '0' && ch <= '9') {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return lFloatConst('.', 0, yylvalpp);
+ } else {
+ if (ch == '.') {
+ return -1; // Special EOF hack
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '.';
+ }
+ }
+ case '/':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == '/') {
+ do {
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ } while (ch != '\n' && ch != EOF);
+ if (ch == EOF)
+ return -1;
+ return '\n';
+ } else if (ch == '*') {
+ int nlcount = 0;
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ do {
+ while (ch != '*') {
+ if (ch == '\n') nlcount++;
+ if (ch == EOF) {
+ CPPErrorToInfoLog("EOF IN COMMENT");
+ return -1;
+ }
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ }
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ if (ch == EOF) {
+ CPPErrorToInfoLog("EOF IN COMMENT");
+ return -1;
+ }
+ } while (ch != '/');
+ if (nlcount) {
+ return '\n';
+ }
+ // Go try it again...
+ } else if (ch == '=') {
+ return CPP_DIV_ASSIGN;
+ } else {
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
+ return '/';
+ }
+ break;
+ case '"':
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ while (ch != '"' && ch != '\n' && ch != EOF) {
+ if (ch == '\\') {
+ CPPErrorToInfoLog("The line continuation character (\\) is not part of the OpenGL ES Shading Language");
+ return -1;
+ }
+ APPEND_CHAR_S(ch, string_val, len, MAX_STRING_LEN);
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
+ };
+ assert(len <= MAX_STRING_LEN);
+ string_val[len] = '\0';
+ if (ch == '"') {
+ yylvalpp->sc_ident = LookUpAddString(atable, string_val);
+ return CPP_STRCONSTANT;
+ } else {
+ CPPErrorToInfoLog("EOL IN STRING");
+ return ERROR_SY;
+ }
+ break;
+ }
+ }
+} // byte_scan
+
+int yylex_CPP(char* buf, int maxSize)
+{
+ yystypepp yylvalpp;
+ int token = '\n';
+
+ for(;;) {
+
+ char* tokenString = 0;
+ token = cpp->currentInput->scan(cpp->currentInput, &yylvalpp);
+ if(check_EOF(token))
+ return 0;
+ if (token == '#') {
+ if (cpp->previous_token == '\n'|| cpp->previous_token == 0) {
+ token = readCPPline(&yylvalpp);
+ if(check_EOF(token))
+ return 0;
+ continue;
+ } else {
+ CPPErrorToInfoLog("preprocessor command must not be preceded by any other statement in that line");
+ return 0;
+ }
+ }
+ cpp->previous_token = token;
+ // expand macros
+ if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp.sc_ident, &yylvalpp)) {
+ cpp->pastFirstStatement = 1;
+ continue;
+ }
+
+ if (token == '\n')
+ continue;
+ cpp->pastFirstStatement = 1;
+
+ if (token == CPP_IDENTIFIER) {
+ tokenString = GetStringOfAtom(atable,yylvalpp.sc_ident);
+ } else if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
+ tokenString = yylvalpp.symbol_name;
+ } else {
+ tokenString = GetStringOfAtom(atable,token);
+ }
+
+ if (tokenString) {
+ int len = strlen(tokenString);
+ cpp->tokensBeforeEOF = 1;
+ if (len >= maxSize) {
+ return maxSize;
+ } else if (len > 0) {
+ strcpy(buf, tokenString);
+ return len;
+ }
+
+ return 0;
+ }
+ }
+
+ return 0;
+} // yylex
+
+//Checks if the token just read is EOF or not.
+int check_EOF(int token)
+{
+ if(token==-1){
+ if(cpp->ifdepth >0){
+ CPPErrorToInfoLog("#endif missing!! Compilation stopped");
+ cpp->CompileError=1;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////// End of scanner.c //////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h
new file mode 100644
index 0000000..0fee20d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h
@@ -0,0 +1,84 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// scanner.h
+//
+
+#if !defined(__SCANNER_H)
+#define __SCANNER_H 1
+
+// These lengths do not include the NULL terminator.
+#define MAX_SYMBOL_NAME_LEN 127
+#define MAX_STRING_LEN 511
+
+#include "compiler/preprocessor/parser.h"
+
+// Not really atom table stuff but needed first...
+
+typedef struct SourceLoc_Rec {
+ unsigned short file, line;
+} SourceLoc;
+
+int yylex_CPP(char* buf, int maxSize);
+
+typedef struct InputSrc {
+ struct InputSrc *prev;
+ int (*scan)(struct InputSrc *, yystypepp *);
+ int (*getch)(struct InputSrc *, yystypepp *);
+ void (*ungetch)(struct InputSrc *, int, yystypepp *);
+ int name; /* atom */
+ int line;
+} InputSrc;
+
+int InitScanner(CPPStruct *cpp); // Intialise the cpp scanner.
+int ScanFromString(const char *); // Start scanning the input from the string mentioned.
+int check_EOF(int); // check if we hit a EOF abruptly
+void CPPErrorToInfoLog(char *); // sticking the msg,line into the Shader's.Info.log
+void SetLineNumber(int);
+void SetStringNumber(int);
+void IncLineNumber(void);
+void DecLineNumber(void);
+int FreeScanner(void); // Free the cpp scanner
+#endif // !(defined(__SCANNER_H)
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h
new file mode 100644
index 0000000..4634626
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h
@@ -0,0 +1,82 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// slglobals.h
+//
+
+#if !defined(__SLGLOBALS_H)
+#define __SLGLOBALS_H 1
+
+typedef struct CPPStruct_Rec CPPStruct;
+
+extern CPPStruct *cpp;
+
+#undef CPPC_DEBUG_THE_COMPILER
+#if defined(_DEBUG)
+#define CPPC_DEBUG_THE_COMPILER 1
+#endif
+
+#undef CPPC_ENABLE_TOOLS
+#define CPPC_ENABLE_TOOLS 1
+
+#include "compiler/preprocessor/memory.h"
+#include "compiler/preprocessor/atom.h"
+#include "compiler/preprocessor/scanner.h"
+#include "compiler/preprocessor/cpp.h"
+#include "compiler/preprocessor/tokens.h"
+#include "compiler/preprocessor/symbols.h"
+#include "compiler/preprocessor/compile.h"
+#if !defined(NO_PARSER)
+#include "compiler/preprocessor/parser.h"
+#endif
+
+#if !defined(NULL)
+#define NULL 0
+#endif
+
+#endif // !(defined(__SLGLOBALS_H)
+
+
+
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c
new file mode 100644
index 0000000..5baedf5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c
@@ -0,0 +1,284 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// symbols.c
+//
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "compiler/preprocessor/slglobals.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////// Symbol Table Variables: ///////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+Scope *ScopeList = NULL;
+Scope *CurrentScope = NULL;
+Scope *GlobalScope = NULL;
+
+static void unlinkScope(void *_scope) {
+ Scope *scope = _scope;
+
+ if (scope->next)
+ scope->next->prev = scope->prev;
+ if (scope->prev)
+ scope->prev->next = scope->next;
+ else
+ ScopeList = scope->next;
+}
+
+/*
+ * NewScope()
+ *
+ */
+Scope *NewScopeInPool(MemoryPool *pool)
+{
+ Scope *lScope;
+
+ lScope = mem_Alloc(pool, sizeof(Scope));
+ lScope->pool = pool;
+ lScope->parent = NULL;
+ lScope->funScope = NULL;
+ lScope->symbols = NULL;
+
+ lScope->level = 0;
+
+ lScope->programs = NULL;
+ if ((lScope->next = ScopeList))
+ ScopeList->prev = lScope;
+ lScope->prev = 0;
+ ScopeList = lScope;
+ mem_AddCleanup(pool, unlinkScope, lScope);
+ return lScope;
+} // NewScope
+
+/*
+ * PushScope()
+ *
+ */
+
+void PushScope(Scope *fScope)
+{
+ Scope *lScope;
+
+ if (CurrentScope) {
+ fScope->level = CurrentScope->level + 1;
+ if (fScope->level == 1) {
+ if (!GlobalScope) {
+ /* HACK - CTD -- if GlobalScope==NULL and level==1, we're
+ * defining a function in the superglobal scope. Things
+ * will break if we leave the level as 1, so we arbitrarily
+ * set it to 2 */
+ fScope->level = 2;
+ }
+ }
+ if (fScope->level >= 2) {
+ lScope = fScope;
+ while (lScope->level > 2)
+ lScope = lScope->next;
+ fScope->funScope = lScope;
+ }
+ } else {
+ fScope->level = 0;
+ }
+ fScope->parent = CurrentScope;
+ CurrentScope = fScope;
+} // PushScope
+
+/*
+ * PopScope()
+ *
+ */
+
+Scope *PopScope(void)
+{
+ Scope *lScope;
+
+ lScope = CurrentScope;
+ if (CurrentScope)
+ CurrentScope = CurrentScope->parent;
+ return lScope;
+} // PopScope
+
+/*
+ * NewSymbol() - Allocate a new symbol node;
+ *
+ */
+
+Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind)
+{
+ Symbol *lSymb;
+ char *pch;
+ unsigned int ii;
+
+ lSymb = (Symbol *) mem_Alloc(fScope->pool, sizeof(Symbol));
+ lSymb->left = NULL;
+ lSymb->right = NULL;
+ lSymb->next = NULL;
+ lSymb->name = name;
+ lSymb->loc = *loc;
+ lSymb->kind = kind;
+
+ // Clear union area:
+
+ pch = (char *) &lSymb->details;
+ for (ii = 0; ii < sizeof(lSymb->details); ii++)
+ *pch++ = 0;
+ return lSymb;
+} // NewSymbol
+
+/*
+ * lAddToTree() - Using a binary tree is not a good idea for basic atom values because they
+ * are generated in order. We'll fix this later (by reversing the bit pattern).
+ */
+
+static void lAddToTree(Symbol **fSymbols, Symbol *fSymb)
+{
+ Symbol *lSymb;
+ int lrev, frev;
+
+ lSymb = *fSymbols;
+ if (lSymb) {
+ frev = GetReversedAtom(atable, fSymb->name);
+ while (lSymb) {
+ lrev = GetReversedAtom(atable, lSymb->name);
+ if (lrev == frev) {
+ CPPErrorToInfoLog("GetAtomString(atable, fSymb->name)");
+ break;
+ } else {
+ if (lrev > frev) {
+ if (lSymb->left) {
+ lSymb = lSymb->left;
+ } else {
+ lSymb->left = fSymb;
+ break;
+ }
+ } else {
+ if (lSymb->right) {
+ lSymb = lSymb->right;
+ } else {
+ lSymb->right = fSymb;
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ *fSymbols = fSymb;
+ }
+} // lAddToTree
+
+
+/*
+ * AddSymbol() - Add a variable, type, or function name to a scope.
+ *
+ */
+
+Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind)
+{
+ Symbol *lSymb;
+
+ if (!fScope)
+ fScope = CurrentScope;
+ lSymb = NewSymbol(loc, fScope, atom, kind);
+ lAddToTree(&fScope->symbols, lSymb);
+ return lSymb;
+} // AddSymbol
+
+
+/*********************************************************************************************/
+/************************************ Symbol Semantic Functions ******************************/
+/*********************************************************************************************/
+
+/*
+ * LookUpLocalSymbol()
+ *
+ */
+
+Symbol *LookUpLocalSymbol(Scope *fScope, int atom)
+{
+ Symbol *lSymb;
+ int rname, ratom;
+
+ ratom = GetReversedAtom(atable, atom);
+ if (!fScope)
+ fScope = CurrentScope;
+ lSymb = fScope->symbols;
+ while (lSymb) {
+ rname = GetReversedAtom(atable, lSymb->name);
+ if (rname == ratom) {
+ return lSymb;
+ } else {
+ if (rname > ratom) {
+ lSymb = lSymb->left;
+ } else {
+ lSymb = lSymb->right;
+ }
+ }
+ }
+ return NULL;
+} // LookUpLocalSymbol
+
+/*
+ * LookUpSymbol()
+ *
+ */
+
+Symbol *LookUpSymbol(Scope *fScope, int atom)
+{
+ Symbol *lSymb;
+
+ if (!fScope)
+ fScope = CurrentScope;
+ while (fScope) {
+ lSymb = LookUpLocalSymbol(fScope, atom);
+ if (lSymb)
+ return lSymb;
+ fScope = fScope->parent;
+ }
+ return NULL;
+} // LookUpSymbol
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h
new file mode 100644
index 0000000..c19f79c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h
@@ -0,0 +1,112 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// symbols.h
+//
+
+#if !defined(__SYMBOLS_H)
+#define __SYMBOLS_H 1
+
+#include "compiler/preprocessor/memory.h"
+
+typedef enum symbolkind {
+ MACRO_S
+} symbolkind;
+
+// Typedefs for things defined here in "symbols.h":
+
+typedef struct Scope_Rec Scope;
+typedef struct Symbol_Rec Symbol;
+
+typedef struct SymbolList_Rec {
+ struct SymbolList_Rec *next;
+ Symbol *symb;
+} SymbolList;
+
+struct Scope_Rec {
+ Scope *next, *prev; // doubly-linked list of all scopes
+ Scope *parent;
+ Scope *funScope; // Points to base scope of enclosing function
+ MemoryPool *pool; // pool used for allocation in this scope
+ Symbol *symbols;
+
+ int level; // 0 = super globals, 1 = globals, etc.
+
+ // Only used at global scope (level 1):
+ SymbolList *programs; // List of programs for this compilation.
+};
+
+
+// Symbol table is a simple binary tree.
+
+#include "compiler/preprocessor/cpp.h" // to get MacroSymbol def
+
+struct Symbol_Rec {
+ Symbol *left, *right;
+ Symbol *next;
+ int name; // Name atom
+ SourceLoc loc;
+ symbolkind kind;
+ union {
+ MacroSymbol mac;
+ } details;
+};
+
+extern Scope *CurrentScope;
+extern Scope *GlobalScope;
+extern Scope *ScopeList;
+
+Scope *NewScopeInPool(MemoryPool *);
+#define NewScope() NewScopeInPool(CurrentScope->pool)
+void PushScope(Scope *fScope);
+Scope *PopScope(void);
+Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind);
+Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind);
+Symbol *LookUpLocalSymbol(Scope *fScope, int atom);
+Symbol *LookUpSymbol(Scope *fScope, int atom);
+void CPPErrorToInfoLog(char *);
+
+
+#endif // !defined(__SYMBOLS_H)
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c
new file mode 100644
index 0000000..aa83d2f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c
@@ -0,0 +1,436 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// tokens.c
+//
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "compiler/debug.h"
+#include "compiler/preprocessor/slglobals.h"
+#include "compiler/util.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////// Preprocessor and Token Recorder and Playback: ////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+/*
+ * idstr()
+ * Copy a string to a malloc'ed block and convert it into something suitable
+ * for an ID
+ *
+ */
+
+static char *idstr(const char *fstr, MemoryPool *pool)
+{
+ size_t len;
+ char *str, *t;
+ const char *f;
+
+ len = strlen(fstr);
+ if (!pool)
+ str = (char *) malloc(len + 1);
+ else
+ str = (char *) mem_Alloc(pool, len + 1);
+
+ for (f=fstr, t=str; *f; f++) {
+ if (isalnum(*f)) *t++ = *f;
+ else if (*f == '.' || *f == '/') *t++ = '_';
+ }
+ *t = 0;
+ return str;
+} // idstr
+
+
+/*
+ * lNewBlock()
+ *
+ */
+
+static TokenBlock *lNewBlock(TokenStream *fTok, MemoryPool *pool)
+{
+ TokenBlock *lBlock;
+
+ if (!pool)
+ lBlock = (TokenBlock *) malloc(sizeof(TokenBlock) + 256);
+ else
+ lBlock = (TokenBlock *) mem_Alloc(pool, sizeof(TokenBlock) + 256);
+ lBlock->count = 0;
+ lBlock->current = 0;
+ lBlock->data = (unsigned char *) lBlock + sizeof(TokenBlock);
+ lBlock->max = 256;
+ lBlock->next = NULL;
+ if (fTok->head) {
+ fTok->current->next = lBlock;
+ } else {
+ fTok->head = lBlock;
+ }
+ fTok->current = lBlock;
+ return lBlock;
+} // lNewBlock
+
+/*
+ * lAddByte()
+ *
+ */
+
+static void lAddByte(TokenStream *fTok, unsigned char fVal)
+{
+ TokenBlock *lBlock;
+ lBlock = fTok->current;
+ if (lBlock->count >= lBlock->max)
+ lBlock = lNewBlock(fTok, 0);
+ lBlock->data[lBlock->count++] = fVal;
+} // lAddByte
+
+
+
+/*
+ * lReadByte() - Get the next byte from a stream.
+ *
+ */
+
+static int lReadByte(TokenStream *pTok)
+{
+ TokenBlock *lBlock;
+ int lval = -1;
+
+ lBlock = pTok->current;
+ if (lBlock) {
+ if (lBlock->current >= lBlock->count) {
+ lBlock = lBlock->next;
+ if (lBlock)
+ lBlock->current = 0;
+ pTok->current = lBlock;
+ }
+ if (lBlock)
+ lval = lBlock->data[lBlock->current++];
+ }
+ return lval;
+} // lReadByte
+
+/////////////////////////////////////// Global Functions://////////////////////////////////////
+
+/*
+ * NewTokenStream()
+ *
+ */
+
+TokenStream *NewTokenStream(const char *name, MemoryPool *pool)
+{
+ TokenStream *pTok;
+
+ if (!pool)
+ pTok = (TokenStream *) malloc(sizeof(TokenStream));
+ else
+ pTok = (TokenStream*)mem_Alloc(pool, sizeof(TokenStream));
+ pTok->next = NULL;
+ pTok->name = idstr(name, pool);
+ pTok->head = NULL;
+ pTok->current = NULL;
+ lNewBlock(pTok, pool);
+ return pTok;
+} // NewTokenStream
+
+/*
+ * DeleteTokenStream()
+ *
+ */
+
+void DeleteTokenStream(TokenStream *pTok)
+{
+ TokenBlock *pBlock, *nBlock;
+
+ if (pTok) {
+ pBlock = pTok->head;
+ while (pBlock) {
+ nBlock = pBlock->next;
+ free(pBlock);
+ pBlock = nBlock;
+ }
+ if (pTok->name)
+ free(pTok->name);
+ free(pTok);
+ }
+} // DeleteTokenStream
+
+/*
+ * RecordToken() - Add a token to the end of a list for later playback or printout.
+ *
+ */
+
+void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)
+{
+ const char *s;
+ char *str=NULL;
+
+ if (token > 256)
+ lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
+ else
+ lAddByte(pTok, (unsigned char)(token & 0x7f));
+ switch (token) {
+ case CPP_IDENTIFIER:
+ case CPP_TYPEIDENTIFIER:
+ case CPP_STRCONSTANT:
+ s = GetAtomString(atable, yylvalpp->sc_ident);
+ while (*s)
+ lAddByte(pTok, (unsigned char) *s++);
+ lAddByte(pTok, 0);
+ break;
+ case CPP_FLOATCONSTANT:
+ case CPP_INTCONSTANT:
+ str=yylvalpp->symbol_name;
+ while (*str){
+ lAddByte(pTok, (unsigned char) *str++);
+ }
+ lAddByte(pTok, 0);
+ break;
+ case '(':
+ lAddByte(pTok, (unsigned char)(yylvalpp->sc_int ? 1 : 0));
+ default:
+ break;
+ }
+} // RecordToken
+
+/*
+ * RewindTokenStream() - Reset a token stream in preperation for reading.
+ *
+ */
+
+void RewindTokenStream(TokenStream *pTok)
+{
+ if (pTok->head) {
+ pTok->current = pTok->head;
+ pTok->current->current = 0;
+ }
+} // RewindTokenStream
+
+/*
+ * ReadToken() - Read the next token from a stream.
+ *
+ */
+
+int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)
+{
+ char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
+ char string_val[MAX_STRING_LEN + 1];
+ int ltoken, len;
+ char ch;
+
+ ltoken = lReadByte(pTok);
+ if (ltoken >= 0) {
+ if (ltoken > 127)
+ ltoken += 128;
+ switch (ltoken) {
+ case CPP_IDENTIFIER:
+ case CPP_TYPEIDENTIFIER:
+ len = 0;
+ ch = lReadByte(pTok);
+ while ((ch >= 'a' && ch <= 'z') ||
+ (ch >= 'A' && ch <= 'Z') ||
+ (ch >= '0' && ch <= '9') ||
+ ch == '_')
+ {
+ if (len < MAX_SYMBOL_NAME_LEN) {
+ symbol_name[len++] = ch;
+ ch = lReadByte(pTok);
+ }
+ }
+ symbol_name[len] = '\0';
+ assert(ch == '\0');
+ yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
+ return CPP_IDENTIFIER;
+ break;
+ case CPP_STRCONSTANT:
+ len = 0;
+ while ((ch = lReadByte(pTok)) != 0)
+ if (len < MAX_STRING_LEN)
+ string_val[len++] = ch;
+ string_val[len] = '\0';
+ yylvalpp->sc_ident = LookUpAddString(atable, string_val);
+ break;
+ case CPP_FLOATCONSTANT:
+ len = 0;
+ ch = lReadByte(pTok);
+ while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))
+ {
+ if (len < MAX_SYMBOL_NAME_LEN) {
+ symbol_name[len++] = ch;
+ ch = lReadByte(pTok);
+ }
+ }
+ symbol_name[len] = '\0';
+ assert(ch == '\0');
+ strcpy(yylvalpp->symbol_name,symbol_name);
+ yylvalpp->sc_fval=(float)atof_dot(yylvalpp->symbol_name);
+ break;
+ case CPP_INTCONSTANT:
+ len = 0;
+ ch = lReadByte(pTok);
+ while ((ch >= '0' && ch <= '9'))
+ {
+ if (len < MAX_SYMBOL_NAME_LEN) {
+ symbol_name[len++] = ch;
+ ch = lReadByte(pTok);
+ }
+ }
+ symbol_name[len] = '\0';
+ assert(ch == '\0');
+ strcpy(yylvalpp->symbol_name,symbol_name);
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
+ break;
+ case '(':
+ yylvalpp->sc_int = lReadByte(pTok);
+ break;
+ }
+ return ltoken;
+ }
+ return EOF_SY;
+} // ReadToken
+
+typedef struct TokenInputSrc {
+ InputSrc base;
+ TokenStream *tokens;
+ int (*final)(CPPStruct *);
+} TokenInputSrc;
+
+static int scan_token(TokenInputSrc *in, yystypepp * yylvalpp)
+{
+ int token = ReadToken(in->tokens, yylvalpp);
+ int (*final)(CPPStruct *);
+ cpp->tokenLoc->file = cpp->currentInput->name;
+ cpp->tokenLoc->line = cpp->currentInput->line;
+ if (token == '\n') {
+ in->base.line++;
+ return token;
+ }
+ if (token > 0) return token;
+ cpp->currentInput = in->base.prev;
+ final = in->final;
+ free(in);
+ if (final && !final(cpp)) return -1;
+ return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+}
+
+int ReadFromTokenStream(TokenStream *ts, int name, int (*final)(CPPStruct *))
+{
+ TokenInputSrc *in = malloc(sizeof(TokenInputSrc));
+ memset(in, 0, sizeof(TokenInputSrc));
+ in->base.name = name;
+ in->base.prev = cpp->currentInput;
+ in->base.scan = (int (*)(InputSrc *, yystypepp *))scan_token;
+ in->base.line = 1;
+ in->tokens = ts;
+ in->final = final;
+ RewindTokenStream(ts);
+ cpp->currentInput = &in->base;
+ return 1;
+}
+
+typedef struct UngotToken {
+ InputSrc base;
+ int token;
+ yystypepp lval;
+} UngotToken;
+
+static int reget_token(UngotToken *t, yystypepp * yylvalpp)
+{
+ int token = t->token;
+ *yylvalpp = t->lval;
+ cpp->currentInput = t->base.prev;
+ free(t);
+ return token;
+}
+
+void UngetToken(int token, yystypepp * yylvalpp) {
+ UngotToken *t = malloc(sizeof(UngotToken));
+ memset(t, 0, sizeof(UngotToken));
+ t->token = token;
+ t->lval = *yylvalpp;
+ t->base.scan = (void *)reget_token;
+ t->base.prev = cpp->currentInput;
+ t->base.name = cpp->currentInput->name;
+ t->base.line = cpp->currentInput->line;
+ cpp->currentInput = &t->base;
+}
+
+
+void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
+ int token;
+ char str[100];
+
+ if (fp == 0) fp = stdout;
+ RewindTokenStream(s);
+ while ((token = ReadToken(s, yylvalpp)) > 0) {
+ switch (token) {
+ case CPP_IDENTIFIER:
+ case CPP_TYPEIDENTIFIER:
+ sprintf(str, "%s ", GetAtomString(atable, yylvalpp->sc_ident));
+ break;
+ case CPP_STRCONSTANT:
+ sprintf(str, "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));
+ break;
+ case CPP_FLOATCONSTANT:
+ //printf("%g9.6 ", yylvalpp->sc_fval);
+ break;
+ case CPP_INTCONSTANT:
+ //printf("%d ", yylvalpp->sc_int);
+ break;
+ default:
+ if (token >= 127)
+ sprintf(str, "%s ", GetAtomString(atable, token));
+ else
+ sprintf(str, "%c", token);
+ break;
+ }
+ CPPDebugLogMsg(str);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////// End of tokens.c ///////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h
new file mode 100644
index 0000000..8766df9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h
@@ -0,0 +1,89 @@
+/****************************************************************************\
+Copyright (c) 2002, NVIDIA Corporation.
+
+NVIDIA Corporation("NVIDIA") supplies this software to you in
+consideration of your agreement to the following terms, and your use,
+installation, modification or redistribution of this NVIDIA software
+constitutes acceptance of these terms. If you do not agree with these
+terms, please do not use, install, modify or redistribute this NVIDIA
+software.
+
+In consideration of your agreement to abide by the following terms, and
+subject to these terms, NVIDIA grants you a personal, non-exclusive
+license, under NVIDIA's copyrights in this original NVIDIA software (the
+"NVIDIA Software"), to use, reproduce, modify and redistribute the
+NVIDIA Software, with or without modifications, in source and/or binary
+forms; provided that if you redistribute the NVIDIA Software, you must
+retain the copyright notice of NVIDIA, this notice and the following
+text and disclaimers in all such redistributions of the NVIDIA Software.
+Neither the name, trademarks, service marks nor logos of NVIDIA
+Corporation may be used to endorse or promote products derived from the
+NVIDIA Software without specific prior written permission from NVIDIA.
+Except as expressly stated in this notice, no other rights or licenses
+express or implied, are granted by NVIDIA herein, including but not
+limited to any patent rights that may be infringed by your derivative
+works or by other works in which the NVIDIA Software may be
+incorporated. No hardware is licensed hereunder.
+
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
+PRODUCTS.
+
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\****************************************************************************/
+//
+// tokens.h
+//
+
+#if !defined(__TOKENS_H)
+#define __TOKENS_H 1
+
+#include "compiler/preprocessor/parser.h"
+
+#define EOF_SY (-1)
+
+typedef struct TokenBlock_Rec TokenBlock;
+
+typedef struct TokenStream_Rec {
+ struct TokenStream_Rec *next;
+ char *name;
+ TokenBlock *head;
+ TokenBlock *current;
+} TokenStream;
+
+struct TokenBlock_Rec {
+ TokenBlock *next;
+ int current;
+ int count;
+ int max;
+ unsigned char *data;
+};
+
+extern TokenStream stdlib_cpp_stream;
+
+
+TokenStream *NewTokenStream(const char *name, MemoryPool *pool);
+void DeleteTokenStream(TokenStream *pTok);
+void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp);
+void RewindTokenStream(TokenStream *pTok);
+int ReadToken(TokenStream *pTok, yystypepp * yylvalpp);
+int ReadFromTokenStream(TokenStream *pTok, int name, int (*final)(CPPStruct *));
+void UngetToken(int, yystypepp * yylvalpp);
+
+#if defined(CPPC_ENABLE_TOOLS)
+
+void DumpTokenStream(FILE *, TokenStream *, yystypepp * yylvalpp);
+
+#endif // defined(CPPC_ENABLE_TOOLS)
+
+#endif // !defined(__TOKENS_H)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.cpp
new file mode 100644
index 0000000..b46e4d0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.cpp
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "util.h"
+
+#ifdef _MSC_VER
+ #include <locale.h>
+#else
+ #include <sstream>
+#endif
+
+double atof_dot(const char *str)
+{
+#ifdef _MSC_VER
+ _locale_t l = _create_locale(LC_NUMERIC, "C");
+ double result = _atof_l(str, l);
+ _free_locale(l);
+ return result;
+#else
+ double result;
+ std::istringstream s(str);
+ std::locale l("C");
+ s.imbue(l);
+ s >> result;
+ return result;
+#endif
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.h
new file mode 100644
index 0000000..35288b7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/compiler/util.h
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_UTIL_H
+#define COMPILER_UTIL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// atof_dot is like atof but forcing C locale, i.e. forcing '.' as decimal point.
+double atof_dot(const char *str);
+
+#ifdef __cplusplus
+} // end extern "C"
+#endif
+
+#endif // COMPILER_UTIL_H
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp
new file mode 100644
index 0000000..284f61d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp
@@ -0,0 +1,390 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Config.cpp: Implements the egl::Config class, describing the format, type
+// and size for an egl::Surface. Implements EGLConfig and related functionality.
+// [EGL 1.4] section 3.4 page 15.
+
+#include "libEGL/Config.h"
+
+#include <algorithm>
+#include <vector>
+
+#include "common/debug.h"
+
+using namespace std;
+
+namespace egl
+{
+Config::Config(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample)
+ : mDisplayMode(displayMode), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
+{
+ set(displayMode, minInterval, maxInterval, renderTargetFormat, depthStencilFormat, multiSample);
+}
+
+void Config::setDefaults()
+{
+ mBufferSize = 0;
+ mRedSize = 0;
+ mGreenSize = 0;
+ mBlueSize = 0;
+ mLuminanceSize = 0;
+ mAlphaSize = 0;
+ mAlphaMaskSize = 0;
+ mBindToTextureRGB = EGL_DONT_CARE;
+ mBindToTextureRGBA = EGL_DONT_CARE;
+ mColorBufferType = EGL_RGB_BUFFER;
+ mConfigCaveat = EGL_DONT_CARE;
+ mConfigID = EGL_DONT_CARE;
+ mConformant = 0;
+ mDepthSize = 0;
+ mLevel = 0;
+ mMatchNativePixmap = EGL_NONE;
+ mMaxPBufferWidth = 0;
+ mMaxPBufferHeight = 0;
+ mMaxPBufferPixels = 0;
+ mMaxSwapInterval = EGL_DONT_CARE;
+ mMinSwapInterval = EGL_DONT_CARE;
+ mNativeRenderable = EGL_DONT_CARE;
+ mNativeVisualID = 0;
+ mNativeVisualType = EGL_DONT_CARE;
+ mRenderableType = EGL_OPENGL_ES_BIT;
+ mSampleBuffers = 0;
+ mSamples = 0;
+ mStencilSize = 0;
+ mSurfaceType = EGL_WINDOW_BIT;
+ mTransparentType = EGL_NONE;
+ mTransparentRedValue = EGL_DONT_CARE;
+ mTransparentGreenValue = EGL_DONT_CARE;
+ mTransparentBlueValue = EGL_DONT_CARE;
+}
+
+void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample)
+{
+ switch (renderTargetFormat)
+ {
+ case D3DFMT_A1R5G5B5:
+ mBufferSize = 16;
+ mRedSize = 5;
+ mGreenSize = 5;
+ mBlueSize = 5;
+ mAlphaSize = 1;
+ break;
+ case D3DFMT_A2R10G10B10:
+ mBufferSize = 32;
+ mRedSize = 10;
+ mGreenSize = 10;
+ mBlueSize = 10;
+ mAlphaSize = 2;
+ break;
+ case D3DFMT_A8R8G8B8:
+ mBufferSize = 32;
+ mRedSize = 8;
+ mGreenSize = 8;
+ mBlueSize = 8;
+ mAlphaSize = 8;
+ break;
+ case D3DFMT_R5G6B5:
+ mBufferSize = 16;
+ mRedSize = 5;
+ mGreenSize = 6;
+ mBlueSize = 5;
+ mAlphaSize = 0;
+ break;
+ case D3DFMT_X8R8G8B8:
+ mBufferSize = 32;
+ mRedSize = 8;
+ mGreenSize = 8;
+ mBlueSize = 8;
+ mAlphaSize = 0;
+ break;
+ default:
+ UNREACHABLE(); // Other formats should not be valid
+ }
+
+ mLuminanceSize = 0;
+ mAlphaMaskSize = 0;
+ mBindToTextureRGB = EGL_FALSE;
+ mBindToTextureRGBA = EGL_FALSE;
+ mColorBufferType = EGL_RGB_BUFFER;
+ mConfigCaveat = (displayMode.Format == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
+ mConfigID = 0;
+ mConformant = EGL_OPENGL_ES2_BIT;
+
+ switch (depthStencilFormat)
+ {
+// case D3DFMT_D16_LOCKABLE:
+// mDepthSize = 16;
+// mStencilSize = 0;
+// break;
+ case D3DFMT_D32:
+ mDepthSize = 32;
+ mStencilSize = 0;
+ break;
+ case D3DFMT_D15S1:
+ mDepthSize = 15;
+ mStencilSize = 1;
+ break;
+ case D3DFMT_D24S8:
+ mDepthSize = 24;
+ mStencilSize = 8;
+ break;
+ case D3DFMT_D24X8:
+ mDepthSize = 24;
+ mStencilSize = 0;
+ break;
+ case D3DFMT_D24X4S4:
+ mDepthSize = 24;
+ mStencilSize = 4;
+ break;
+ case D3DFMT_D16:
+ mDepthSize = 16;
+ mStencilSize = 0;
+ break;
+// case D3DFMT_D32F_LOCKABLE:
+// mDepthSize = 32;
+// mStencilSize = 0;
+// break;
+// case D3DFMT_D24FS8:
+// mDepthSize = 24;
+// mStencilSize = 8;
+// break;
+ default:
+ UNREACHABLE();
+ }
+
+ mLevel = 0;
+ mMatchNativePixmap = EGL_NONE;
+ mMaxPBufferWidth = 0;
+ mMaxPBufferHeight = 0;
+ mMaxPBufferPixels = 0;
+ mMaxSwapInterval = maxInterval;
+ mMinSwapInterval = minInterval;
+ mNativeRenderable = EGL_FALSE;
+ mNativeVisualID = 0;
+ mNativeVisualType = 0;
+ mRenderableType = EGL_OPENGL_ES2_BIT;
+ mSampleBuffers = multiSample ? 1 : 0;
+ mSamples = multiSample;
+ mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+ mTransparentType = EGL_NONE;
+ mTransparentRedValue = 0;
+ mTransparentGreenValue = 0;
+ mTransparentBlueValue = 0;
+}
+
+EGLConfig Config::getHandle() const
+{
+ return (EGLConfig)(size_t)mConfigID;
+}
+
+SortConfig::SortConfig(const EGLint *attribList)
+ : mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false)
+{
+ scanForWantedComponents(attribList);
+}
+
+void SortConfig::scanForWantedComponents(const EGLint *attribList)
+{
+ // [EGL] section 3.4.1 page 24
+ // Sorting rule #3: by larger total number of color bits, not considering
+ // components that are 0 or don't-care.
+ for (const EGLint *attr = attribList; attr[0] != EGL_NONE; attr += 2)
+ {
+ if (attr[1] != 0 && attr[1] != EGL_DONT_CARE)
+ {
+ switch (attr[0])
+ {
+ case EGL_RED_SIZE: mWantRed = true; break;
+ case EGL_GREEN_SIZE: mWantGreen = true; break;
+ case EGL_BLUE_SIZE: mWantBlue = true; break;
+ case EGL_ALPHA_SIZE: mWantAlpha = true; break;
+ case EGL_LUMINANCE_SIZE: mWantLuminance = true; break;
+ }
+ }
+ }
+}
+
+EGLint SortConfig::wantedComponentsSize(const Config &config) const
+{
+ EGLint total = 0;
+
+ if (mWantRed) total += config.mRedSize;
+ if (mWantGreen) total += config.mGreenSize;
+ if (mWantBlue) total += config.mBlueSize;
+ if (mWantAlpha) total += config.mAlphaSize;
+ if (mWantLuminance) total += config.mLuminanceSize;
+
+ return total;
+}
+
+bool SortConfig::operator()(const Config *x, const Config *y) const
+{
+ return (*this)(*x, *y);
+}
+
+bool SortConfig::operator()(const Config &x, const Config &y) const
+{
+ #define SORT(attribute) \
+ if (x.attribute != y.attribute) \
+ { \
+ return x.attribute < y.attribute; \
+ }
+
+ META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
+ SORT(mConfigCaveat);
+
+ META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
+ SORT(mColorBufferType);
+
+ // By larger total number of color bits, only considering those that are requested to be > 0.
+ EGLint xComponentsSize = wantedComponentsSize(x);
+ EGLint yComponentsSize = wantedComponentsSize(y);
+ if (xComponentsSize != yComponentsSize)
+ {
+ return xComponentsSize > yComponentsSize;
+ }
+
+ SORT(mBufferSize);
+ SORT(mSampleBuffers);
+ SORT(mSamples);
+ SORT(mDepthSize);
+ SORT(mStencilSize);
+ SORT(mAlphaMaskSize);
+ SORT(mNativeVisualType);
+ SORT(mConfigID);
+
+ #undef SORT
+
+ return false;
+}
+
+// We'd like to use SortConfig to also eliminate duplicate configs.
+// This works as long as we never have two configs with different per-RGB-component layouts,
+// but the same total.
+// 5551 and 565 are different because R+G+B is different.
+// 5551 and 555 are different because bufferSize is different.
+const EGLint ConfigSet::mSortAttribs[] =
+{
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_LUMINANCE_SIZE, 1,
+ // BUT NOT ALPHA
+ EGL_NONE
+};
+
+ConfigSet::ConfigSet()
+ : mSet(SortConfig(mSortAttribs))
+{
+}
+
+void ConfigSet::add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample)
+{
+ Config config(displayMode, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample);
+
+ mSet.insert(config);
+}
+
+size_t ConfigSet::size() const
+{
+ return mSet.size();
+}
+
+bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
+{
+ vector<const Config*> passed;
+ passed.reserve(mSet.size());
+
+ for (Iterator config = mSet.begin(); config != mSet.end(); config++)
+ {
+ bool match = true;
+ const EGLint *attribute = attribList;
+
+ while (attribute[0] != EGL_NONE)
+ {
+ switch (attribute[0])
+ {
+ case EGL_BUFFER_SIZE: match = config->mBufferSize >= attribute[1]; break;
+ case EGL_ALPHA_SIZE: match = config->mAlphaSize >= attribute[1]; break;
+ case EGL_BLUE_SIZE: match = config->mBlueSize >= attribute[1]; break;
+ case EGL_GREEN_SIZE: match = config->mGreenSize >= attribute[1]; break;
+ case EGL_RED_SIZE: match = config->mRedSize >= attribute[1]; break;
+ case EGL_DEPTH_SIZE: match = config->mDepthSize >= attribute[1]; break;
+ case EGL_STENCIL_SIZE: match = config->mStencilSize >= attribute[1]; break;
+ case EGL_CONFIG_CAVEAT: match = config->mConfigCaveat == attribute[1]; break;
+ case EGL_CONFIG_ID: match = config->mConfigID == attribute[1]; break;
+ case EGL_LEVEL: match = config->mLevel >= attribute[1]; break;
+ case EGL_NATIVE_RENDERABLE: match = config->mNativeRenderable == attribute[1]; break;
+ case EGL_NATIVE_VISUAL_TYPE: match = config->mNativeVisualType == attribute[1]; break;
+ case EGL_SAMPLES: match = config->mSamples >= attribute[1]; break;
+ case EGL_SAMPLE_BUFFERS: match = config->mSampleBuffers >= attribute[1]; break;
+ case EGL_SURFACE_TYPE: match = (config->mSurfaceType & attribute[1]) == attribute[1]; break;
+ case EGL_TRANSPARENT_TYPE: match = config->mTransparentType == attribute[1]; break;
+ case EGL_TRANSPARENT_BLUE_VALUE: match = config->mTransparentBlueValue == attribute[1]; break;
+ case EGL_TRANSPARENT_GREEN_VALUE: match = config->mTransparentGreenValue == attribute[1]; break;
+ case EGL_TRANSPARENT_RED_VALUE: match = config->mTransparentRedValue == attribute[1]; break;
+ case EGL_BIND_TO_TEXTURE_RGB: match = config->mBindToTextureRGB == attribute[1]; break;
+ case EGL_BIND_TO_TEXTURE_RGBA: match = config->mBindToTextureRGBA == attribute[1]; break;
+ case EGL_MIN_SWAP_INTERVAL: match = config->mMinSwapInterval == attribute[1]; break;
+ case EGL_MAX_SWAP_INTERVAL: match = config->mMaxSwapInterval == attribute[1]; break;
+ case EGL_LUMINANCE_SIZE: match = config->mLuminanceSize >= attribute[1]; break;
+ case EGL_ALPHA_MASK_SIZE: match = config->mAlphaMaskSize >= attribute[1]; break;
+ case EGL_COLOR_BUFFER_TYPE: match = config->mColorBufferType == attribute[1]; break;
+ case EGL_RENDERABLE_TYPE: match = (config->mRenderableType & attribute[1]) == attribute[1]; break;
+ case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
+ case EGL_CONFORMANT: match = (config->mConformant & attribute[1]) == attribute[1]; break;
+ default:
+ return false;
+ }
+
+ if (!match)
+ {
+ break;
+ }
+
+ attribute += 2;
+ }
+
+ if (match)
+ {
+ passed.push_back(&*config);
+ }
+ }
+
+ if (configs)
+ {
+ sort(passed.begin(), passed.end(), SortConfig(attribList));
+
+ EGLint index;
+ for (index = 0; index < configSize && index < static_cast<EGLint>(passed.size()); index++)
+ {
+ configs[index] = passed[index]->getHandle();
+ }
+
+ *numConfig = index;
+ }
+ else
+ {
+ *numConfig = passed.size();
+ }
+
+ return true;
+}
+
+const egl::Config *ConfigSet::get(EGLConfig configHandle)
+{
+ for (Iterator config = mSet.begin(); config != mSet.end(); config++)
+ {
+ if (config->getHandle() == configHandle)
+ {
+ return &(*config);
+ }
+ }
+
+ return NULL;
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.h
new file mode 100644
index 0000000..b340f56
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Config.h
@@ -0,0 +1,118 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Config.h: Defines the egl::Config class, describing the format, type
+// and size for an egl::Surface. Implements EGLConfig and related functionality.
+// [EGL 1.4] section 3.4 page 15.
+
+#ifndef INCLUDE_CONFIG_H_
+#define INCLUDE_CONFIG_H_
+
+#define EGLAPI
+#include <EGL/egl.h>
+#include <d3d9.h>
+
+#include <set>
+
+#include "common/angleutils.h"
+
+namespace egl
+{
+class Display;
+
+class Config
+{
+ public:
+ Config(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample);
+
+ void setDefaults();
+ void set(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample);
+ EGLConfig getHandle() const;
+
+ const D3DDISPLAYMODE mDisplayMode;
+ const D3DFORMAT mRenderTargetFormat;
+ const D3DFORMAT mDepthStencilFormat;
+ const EGLint mMultiSample;
+
+ EGLint mBufferSize; // Depth of the color buffer
+ EGLint mRedSize; // Bits of Red in the color buffer
+ EGLint mGreenSize; // Bits of Green in the color buffer
+ EGLint mBlueSize; // Bits of Blue in the color buffer
+ EGLint mLuminanceSize; // Bits of Luminance in the color buffer
+ EGLint mAlphaSize; // Bits of Alpha in the color buffer
+ EGLint mAlphaMaskSize; // Bits of Alpha Mask in the mask buffer
+ EGLBoolean mBindToTextureRGB; // True if bindable to RGB textures.
+ EGLBoolean mBindToTextureRGBA; // True if bindable to RGBA textures.
+ EGLenum mColorBufferType; // Color buffer type
+ EGLenum mConfigCaveat; // Any caveats for the configuration
+ EGLint mConfigID; // Unique EGLConfig identifier
+ EGLint mConformant; // Whether contexts created with this config are conformant
+ EGLint mDepthSize; // Bits of Z in the depth buffer
+ EGLint mLevel; // Frame buffer level
+ EGLBoolean mMatchNativePixmap; // Match the native pixmap format
+ EGLint mMaxPBufferWidth; // Maximum width of pbuffer
+ EGLint mMaxPBufferHeight; // Maximum height of pbuffer
+ EGLint mMaxPBufferPixels; // Maximum size of pbuffer
+ EGLint mMaxSwapInterval; // Maximum swap interval
+ EGLint mMinSwapInterval; // Minimum swap interval
+ EGLBoolean mNativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
+ EGLint mNativeVisualID; // Handle of corresponding native visual
+ EGLint mNativeVisualType; // Native visual type of the associated visual
+ EGLint mRenderableType; // Which client rendering APIs are supported.
+ EGLint mSampleBuffers; // Number of multisample buffers
+ EGLint mSamples; // Number of samples per pixel
+ EGLint mStencilSize; // Bits of Stencil in the stencil buffer
+ EGLint mSurfaceType; // Which types of EGL surfaces are supported.
+ EGLenum mTransparentType; // Type of transparency supported
+ EGLint mTransparentRedValue; // Transparent red value
+ EGLint mTransparentGreenValue; // Transparent green value
+ EGLint mTransparentBlueValue; // Transparent blue value
+};
+
+// Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24.
+class SortConfig
+{
+ public:
+ explicit SortConfig(const EGLint *attribList);
+
+ bool operator()(const Config *x, const Config *y) const;
+ bool operator()(const Config &x, const Config &y) const;
+
+ private:
+ void scanForWantedComponents(const EGLint *attribList);
+ EGLint wantedComponentsSize(const Config &config) const;
+
+ bool mWantRed;
+ bool mWantGreen;
+ bool mWantBlue;
+ bool mWantAlpha;
+ bool mWantLuminance;
+};
+
+class ConfigSet
+{
+ friend Display;
+
+ public:
+ ConfigSet();
+
+ void add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample);
+ size_t size() const;
+ bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
+ const egl::Config *get(EGLConfig configHandle);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ConfigSet);
+
+ typedef std::set<Config, SortConfig> Set;
+ typedef Set::iterator Iterator;
+ Set mSet;
+
+ static const EGLint mSortAttribs[];
+};
+}
+
+#endif // INCLUDE_CONFIG_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp
new file mode 100644
index 0000000..6f1a335
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp
@@ -0,0 +1,659 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Display.cpp: Implements the egl::Display class, representing the abstract
+// display on which graphics are drawn. Implements EGLDisplay.
+// [EGL 1.4] section 2.1.2 page 3.
+
+#include "libEGL/Display.h"
+
+#include <algorithm>
+#include <vector>
+
+#include "common/debug.h"
+
+#include "libEGL/main.h"
+
+#define REF_RAST 0 // Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
+#define ENABLE_D3D9EX 1 // Enables use of the IDirect3D9Ex interface, when available
+
+namespace egl
+{
+Display::Display(HDC deviceContext) : mDc(deviceContext)
+{
+ mD3d9Module = NULL;
+
+ mD3d9 = NULL;
+ mD3d9ex = NULL;
+ mDevice = NULL;
+ mDeviceWindow = NULL;
+
+ mAdapter = D3DADAPTER_DEFAULT;
+
+ #if REF_RAST == 1 || defined(FORCE_REF_RAST)
+ mDeviceType = D3DDEVTYPE_REF;
+ #else
+ mDeviceType = D3DDEVTYPE_HAL;
+ #endif
+
+ mMinSwapInterval = 1;
+ mMaxSwapInterval = 1;
+}
+
+Display::~Display()
+{
+ terminate();
+}
+
+bool Display::initialize()
+{
+ if (isInitialized())
+ {
+ return true;
+ }
+
+ mD3d9Module = LoadLibrary(TEXT("d3d9.dll"));
+ if (mD3d9Module == NULL)
+ {
+ terminate();
+ return false;
+ }
+
+ typedef IDirect3D9* (WINAPI *Direct3DCreate9Func)(UINT);
+ Direct3DCreate9Func Direct3DCreate9Ptr = reinterpret_cast<Direct3DCreate9Func>(GetProcAddress(mD3d9Module, "Direct3DCreate9"));
+
+ if (Direct3DCreate9Ptr == NULL)
+ {
+ terminate();
+ return false;
+ }
+
+ typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
+ Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
+
+ // Use Direct3D9Ex if available. Among other things, this version is less
+ // inclined to report a lost context, for example when the user switches
+ // desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available.
+ if (ENABLE_D3D9EX && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9ex)))
+ {
+ ASSERT(mD3d9ex);
+ mD3d9ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
+ ASSERT(mD3d9);
+ }
+ else
+ {
+ mD3d9 = Direct3DCreate9Ptr(D3D_SDK_VERSION);
+ }
+
+ if (mD3d9)
+ {
+ if (mDc != NULL)
+ {
+ // UNIMPLEMENTED(); // FIXME: Determine which adapter index the device context corresponds to
+ }
+
+ HRESULT result;
+
+ // Give up on getting device caps after about one second.
+ for (int i = 0; i < 10; ++i)
+ {
+ result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps);
+
+ if (SUCCEEDED(result))
+ {
+ break;
+ }
+ else if (result == D3DERR_NOTAVAILABLE)
+ {
+ Sleep(100); // Give the driver some time to initialize/recover
+ }
+ else if (FAILED(result)) // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY, D3DERR_INVALIDDEVICE, or another error we can't recover from
+ {
+ terminate();
+ return error(EGL_BAD_ALLOC, false);
+ }
+ }
+
+ if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(2, 0))
+ {
+ terminate();
+ return error(EGL_NOT_INITIALIZED, false);
+ }
+
+ // When DirectX9 is running with an older DirectX8 driver, a StretchRect from a regular texture to a render target texture is not supported.
+ // This is required by Texture2D::convertToRenderTarget.
+ if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
+ {
+ terminate();
+ return error(EGL_NOT_INITIALIZED, false);
+ }
+
+ mMinSwapInterval = 4;
+ mMaxSwapInterval = 0;
+
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) {mMinSwapInterval = std::min(mMinSwapInterval, 0); mMaxSwapInterval = std::max(mMaxSwapInterval, 0);}
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_ONE) {mMinSwapInterval = std::min(mMinSwapInterval, 1); mMaxSwapInterval = std::max(mMaxSwapInterval, 1);}
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO) {mMinSwapInterval = std::min(mMinSwapInterval, 2); mMaxSwapInterval = std::max(mMaxSwapInterval, 2);}
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_THREE) {mMinSwapInterval = std::min(mMinSwapInterval, 3); mMaxSwapInterval = std::max(mMaxSwapInterval, 3);}
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_FOUR) {mMinSwapInterval = std::min(mMinSwapInterval, 4); mMaxSwapInterval = std::max(mMaxSwapInterval, 4);}
+
+ const D3DFORMAT renderTargetFormats[] =
+ {
+ D3DFMT_A1R5G5B5,
+ // D3DFMT_A2R10G10B10, // The color_ramp conformance test uses ReadPixels with UNSIGNED_BYTE causing it to think that rendering skipped a colour value.
+ D3DFMT_A8R8G8B8,
+ D3DFMT_R5G6B5,
+ // D3DFMT_X1R5G5B5, // Has no compatible OpenGL ES renderbuffer format
+ D3DFMT_X8R8G8B8
+ };
+
+ const D3DFORMAT depthStencilFormats[] =
+ {
+ // D3DFMT_D16_LOCKABLE,
+ D3DFMT_D32,
+ // D3DFMT_D15S1,
+ D3DFMT_D24S8,
+ D3DFMT_D24X8,
+ // D3DFMT_D24X4S4,
+ D3DFMT_D16,
+ // D3DFMT_D32F_LOCKABLE,
+ // D3DFMT_D24FS8
+ };
+
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ ConfigSet configSet;
+
+ for (int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(D3DFORMAT); formatIndex++)
+ {
+ D3DFORMAT renderTargetFormat = renderTargetFormats[formatIndex];
+
+ HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, renderTargetFormat);
+
+ if (SUCCEEDED(result))
+ {
+ for (int depthStencilIndex = 0; depthStencilIndex < sizeof(depthStencilFormats) / sizeof(D3DFORMAT); depthStencilIndex++)
+ {
+ D3DFORMAT depthStencilFormat = depthStencilFormats[depthStencilIndex];
+ HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthStencilFormat);
+
+ if (SUCCEEDED(result))
+ {
+ HRESULT result = mD3d9->CheckDepthStencilMatch(mAdapter, mDeviceType, currentDisplayMode.Format, renderTargetFormat, depthStencilFormat);
+
+ if (SUCCEEDED(result))
+ {
+ // FIXME: enumerate multi-sampling
+
+ configSet.add(currentDisplayMode, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, 0);
+ }
+ }
+ }
+ }
+ }
+
+ // Give the sorted configs a unique ID and store them internally
+ EGLint index = 1;
+ for (ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++)
+ {
+ Config configuration = *config;
+ configuration.mConfigID = index;
+ index++;
+
+ mConfigSet.mSet.insert(configuration);
+ }
+ }
+
+ if (!isInitialized())
+ {
+ terminate();
+
+ return false;
+ }
+
+ static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
+ static const TCHAR className[] = TEXT("STATIC");
+
+ mDeviceWindow = CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
+
+ return true;
+}
+
+void Display::terminate()
+{
+ while (!mSurfaceSet.empty())
+ {
+ destroySurface(*mSurfaceSet.begin());
+ }
+
+ while (!mContextSet.empty())
+ {
+ destroyContext(*mContextSet.begin());
+ }
+
+ if (mDevice)
+ {
+ // If the device is lost, reset it first to prevent leaving the driver in an unstable state
+ if (FAILED(mDevice->TestCooperativeLevel()))
+ {
+ resetDevice();
+ }
+
+ mDevice->Release();
+ mDevice = NULL;
+ }
+
+ if (mD3d9)
+ {
+ mD3d9->Release();
+ mD3d9 = NULL;
+ }
+
+ if (mDeviceWindow)
+ {
+ DestroyWindow(mDeviceWindow);
+ mDeviceWindow = NULL;
+ }
+
+ if (mD3d9ex)
+ {
+ mD3d9ex->Release();
+ mD3d9ex = NULL;
+ }
+
+ if (mD3d9Module)
+ {
+ FreeLibrary(mD3d9Module);
+ mD3d9Module = NULL;
+ }
+}
+
+void Display::startScene()
+{
+ if (!mSceneStarted)
+ {
+ long result = mDevice->BeginScene();
+ ASSERT(SUCCEEDED(result));
+ mSceneStarted = true;
+ }
+}
+
+void Display::endScene()
+{
+ if (mSceneStarted)
+ {
+ long result = mDevice->EndScene();
+ ASSERT(SUCCEEDED(result));
+ mSceneStarted = false;
+ }
+}
+
+bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
+{
+ return mConfigSet.getConfigs(configs, attribList, configSize, numConfig);
+}
+
+bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
+{
+ const egl::Config *configuration = mConfigSet.get(config);
+
+ switch (attribute)
+ {
+ case EGL_BUFFER_SIZE: *value = configuration->mBufferSize; break;
+ case EGL_ALPHA_SIZE: *value = configuration->mAlphaSize; break;
+ case EGL_BLUE_SIZE: *value = configuration->mBlueSize; break;
+ case EGL_GREEN_SIZE: *value = configuration->mGreenSize; break;
+ case EGL_RED_SIZE: *value = configuration->mRedSize; break;
+ case EGL_DEPTH_SIZE: *value = configuration->mDepthSize; break;
+ case EGL_STENCIL_SIZE: *value = configuration->mStencilSize; break;
+ case EGL_CONFIG_CAVEAT: *value = configuration->mConfigCaveat; break;
+ case EGL_CONFIG_ID: *value = configuration->mConfigID; break;
+ case EGL_LEVEL: *value = configuration->mLevel; break;
+ case EGL_NATIVE_RENDERABLE: *value = configuration->mNativeRenderable; break;
+ case EGL_NATIVE_VISUAL_TYPE: *value = configuration->mNativeVisualType; break;
+ case EGL_SAMPLES: *value = configuration->mSamples; break;
+ case EGL_SAMPLE_BUFFERS: *value = configuration->mSampleBuffers; break;
+ case EGL_SURFACE_TYPE: *value = configuration->mSurfaceType; break;
+ case EGL_TRANSPARENT_TYPE: *value = configuration->mTransparentType; break;
+ case EGL_TRANSPARENT_BLUE_VALUE: *value = configuration->mTransparentBlueValue; break;
+ case EGL_TRANSPARENT_GREEN_VALUE: *value = configuration->mTransparentGreenValue; break;
+ case EGL_TRANSPARENT_RED_VALUE: *value = configuration->mTransparentRedValue; break;
+ case EGL_BIND_TO_TEXTURE_RGB: *value = configuration->mBindToTextureRGB; break;
+ case EGL_BIND_TO_TEXTURE_RGBA: *value = configuration->mBindToTextureRGBA; break;
+ case EGL_MIN_SWAP_INTERVAL: *value = configuration->mMinSwapInterval; break;
+ case EGL_MAX_SWAP_INTERVAL: *value = configuration->mMaxSwapInterval; break;
+ case EGL_LUMINANCE_SIZE: *value = configuration->mLuminanceSize; break;
+ case EGL_ALPHA_MASK_SIZE: *value = configuration->mAlphaMaskSize; break;
+ case EGL_COLOR_BUFFER_TYPE: *value = configuration->mColorBufferType; break;
+ case EGL_RENDERABLE_TYPE: *value = configuration->mRenderableType; break;
+ case EGL_MATCH_NATIVE_PIXMAP: *value = false; UNIMPLEMENTED(); break;
+ case EGL_CONFORMANT: *value = configuration->mConformant; break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool Display::createDevice()
+{
+ D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
+ DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
+
+ HRESULT result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
+ {
+ return error(EGL_BAD_ALLOC, false);
+ }
+
+ if (FAILED(result))
+ {
+ result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParameters, &mDevice);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
+ return error(EGL_BAD_ALLOC, false);
+ }
+ }
+
+ // Permanent non-default states
+ mDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
+
+ mSceneStarted = false;
+
+ return true;
+}
+
+bool Display::resetDevice()
+{
+ D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
+ HRESULT result;
+
+ do
+ {
+ Sleep(0); // Give the graphics driver some CPU time
+
+ result = mDevice->Reset(&presentParameters);
+ }
+ while (result == D3DERR_DEVICELOST);
+
+ if (FAILED(result))
+ {
+ return error(EGL_BAD_ALLOC, false);
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ return true;
+}
+
+Surface *Display::createWindowSurface(HWND window, EGLConfig config)
+{
+ const Config *configuration = mConfigSet.get(config);
+
+ Surface *surface = new Surface(this, configuration, window);
+ mSurfaceSet.insert(surface);
+
+ return surface;
+}
+
+EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *shareContext)
+{
+ if (!mDevice)
+ {
+ if (!createDevice())
+ {
+ return NULL;
+ }
+ }
+ else if (FAILED(mDevice->TestCooperativeLevel())) // Lost device
+ {
+ if (!resetDevice())
+ {
+ return NULL;
+ }
+
+ // Restore any surfaces that may have been lost
+ for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
+ {
+ (*surface)->resetSwapChain();
+ }
+ }
+
+ const egl::Config *config = mConfigSet.get(configHandle);
+
+ gl::Context *context = glCreateContext(config, shareContext);
+ mContextSet.insert(context);
+
+ return context;
+}
+
+void Display::destroySurface(egl::Surface *surface)
+{
+ delete surface;
+ mSurfaceSet.erase(surface);
+}
+
+void Display::destroyContext(gl::Context *context)
+{
+ glDestroyContext(context);
+ mContextSet.erase(context);
+
+ if (mContextSet.empty() && mDevice && FAILED(mDevice->TestCooperativeLevel())) // Last context of a lost device
+ {
+ for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
+ {
+ (*surface)->release();
+ }
+ }
+}
+
+bool Display::isInitialized()
+{
+ return mD3d9 != NULL && mConfigSet.size() > 0;
+}
+
+bool Display::isValidConfig(EGLConfig config)
+{
+ return mConfigSet.get(config) != NULL;
+}
+
+bool Display::isValidContext(gl::Context *context)
+{
+ return mContextSet.find(context) != mContextSet.end();
+}
+
+bool Display::isValidSurface(egl::Surface *surface)
+{
+ return mSurfaceSet.find(surface) != mSurfaceSet.end();
+}
+
+bool Display::hasExistingWindowSurface(HWND window)
+{
+ for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
+ {
+ if ((*surface)->getWindowHandle() == window)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+EGLint Display::getMinSwapInterval()
+{
+ return mMinSwapInterval;
+}
+
+EGLint Display::getMaxSwapInterval()
+{
+ return mMaxSwapInterval;
+}
+
+IDirect3DDevice9 *Display::getDevice()
+{
+ if (!mDevice)
+ {
+ if (!createDevice())
+ {
+ return NULL;
+ }
+ }
+
+ return mDevice;
+}
+
+D3DCAPS9 Display::getDeviceCaps()
+{
+ return mDeviceCaps;
+}
+
+void Display::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
+{
+ for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
+ {
+ HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format,
+ TRUE, (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
+
+ multiSampleArray[multiSampleIndex] = SUCCEEDED(result);
+ }
+}
+
+bool Display::getCompressedTextureSupport()
+{
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
+}
+
+bool Display::getFloatTextureSupport(bool *filtering, bool *renderable)
+{
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
+ D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
+ D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
+
+ *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
+ D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F))&&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
+ D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
+
+ if (!filtering && !renderable)
+ {
+ return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
+ D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
+ D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
+ }
+ else
+ {
+ return true;
+ }
+}
+
+bool Display::getHalfFloatTextureSupport(bool *filtering, bool *renderable)
+{
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
+ D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
+ D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
+
+ *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
+ D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
+ D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
+
+ if (!filtering && !renderable)
+ {
+ return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
+ D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
+ D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
+ }
+ else
+ {
+ return true;
+ }
+}
+
+bool Display::getLuminanceTextureSupport()
+{
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_L8));
+}
+
+bool Display::getLuminanceAlphaTextureSupport()
+{
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_A8L8));
+}
+
+D3DPOOL Display::getBufferPool(DWORD usage) const
+{
+ if (mD3d9ex != NULL)
+ {
+ return D3DPOOL_DEFAULT;
+ }
+ else
+ {
+ if (!(usage & D3DUSAGE_DYNAMIC))
+ {
+ return D3DPOOL_MANAGED;
+ }
+ }
+
+ return D3DPOOL_DEFAULT;
+}
+
+bool Display::getEventQuerySupport()
+{
+ IDirect3DQuery9 *query;
+ HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
+ if (SUCCEEDED(result))
+ {
+ query->Release();
+ }
+
+ return result != D3DERR_NOTAVAILABLE;
+}
+
+D3DPRESENT_PARAMETERS Display::getDefaultPresentParameters()
+{
+ D3DPRESENT_PARAMETERS presentParameters = {0};
+
+ // The default swap chain is never actually used. Surface will create a new swap chain with the proper parameters.
+ presentParameters.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
+ presentParameters.BackBufferCount = 1;
+ presentParameters.BackBufferFormat = D3DFMT_UNKNOWN;
+ presentParameters.BackBufferWidth = 1;
+ presentParameters.BackBufferHeight = 1;
+ presentParameters.EnableAutoDepthStencil = FALSE;
+ presentParameters.Flags = 0;
+ presentParameters.hDeviceWindow = mDeviceWindow;
+ presentParameters.MultiSampleQuality = 0;
+ presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE;
+ presentParameters.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
+ presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ presentParameters.Windowed = TRUE;
+
+ return presentParameters;
+}
+} \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.h
new file mode 100644
index 0000000..4b74e1e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Display.h
@@ -0,0 +1,105 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Display.h: Defines the egl::Display class, representing the abstract
+// display on which graphics are drawn. Implements EGLDisplay.
+// [EGL 1.4] section 2.1.2 page 3.
+
+#ifndef INCLUDE_DISPLAY_H_
+#define INCLUDE_DISPLAY_H_
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <d3d9.h>
+
+#include <set>
+
+#include "libGLESv2/Context.h"
+
+#include "libEGL/Config.h"
+#include "libEGL/Surface.h"
+
+namespace egl
+{
+class Display
+{
+ public:
+ Display(HDC deviceContext);
+
+ ~Display();
+
+ bool initialize();
+ void terminate();
+
+ virtual void startScene();
+ virtual void endScene();
+
+ bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
+ bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
+
+ egl::Surface *createWindowSurface(HWND window, EGLConfig config);
+ EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext);
+
+ void destroySurface(egl::Surface *surface);
+ void destroyContext(gl::Context *context);
+
+ bool isInitialized();
+ bool isValidConfig(EGLConfig config);
+ bool isValidContext(gl::Context *context);
+ bool isValidSurface(egl::Surface *surface);
+ bool hasExistingWindowSurface(HWND window);
+
+ EGLint getMinSwapInterval();
+ EGLint getMaxSwapInterval();
+
+ virtual IDirect3DDevice9 *getDevice();
+ virtual D3DCAPS9 getDeviceCaps();
+ virtual void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
+ virtual bool getCompressedTextureSupport();
+ virtual bool getEventQuerySupport();
+ virtual bool getFloatTextureSupport(bool *filtering, bool *renderable);
+ virtual bool getHalfFloatTextureSupport(bool *filtering, bool *renderable);
+ virtual bool getLuminanceTextureSupport();
+ virtual bool getLuminanceAlphaTextureSupport();
+ virtual D3DPOOL getBufferPool(DWORD usage) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Display);
+
+ D3DPRESENT_PARAMETERS getDefaultPresentParameters();
+
+ const HDC mDc;
+
+ HMODULE mD3d9Module;
+
+ UINT mAdapter;
+ D3DDEVTYPE mDeviceType;
+ IDirect3D9 *mD3d9; // Always valid after successful initialization.
+ IDirect3D9Ex *mD3d9ex; // Might be null if D3D9Ex is not supported.
+ IDirect3DDevice9 *mDevice;
+ D3DCAPS9 mDeviceCaps;
+ HWND mDeviceWindow;
+
+ bool mSceneStarted;
+ EGLint mMaxSwapInterval;
+ EGLint mMinSwapInterval;
+
+ typedef std::set<Surface*> SurfaceSet;
+ SurfaceSet mSurfaceSet;
+
+ ConfigSet mConfigSet;
+
+ typedef std::set<gl::Context*> ContextSet;
+ ContextSet mContextSet;
+
+ bool createDevice();
+ bool resetDevice();
+};
+}
+
+#endif // INCLUDE_DISPLAY_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp
new file mode 100644
index 0000000..2736a7f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp
@@ -0,0 +1,497 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
+// such as the client area of a window, including any back buffers.
+// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
+
+#include <tchar.h>
+
+#include "libEGL/Surface.h"
+
+#include "common/debug.h"
+
+#include "libEGL/main.h"
+#include "libEGL/Display.h"
+
+namespace egl
+{
+Surface::Surface(Display *display, const Config *config, HWND window)
+ : mDisplay(display), mConfig(config), mWindow(window)
+{
+ mSwapChain = NULL;
+ mDepthStencil = NULL;
+ mBackBuffer = NULL;
+ mFlipTexture = NULL;
+ mFlipState = NULL;
+ mPreFlipState = NULL;
+
+ mPixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING); // FIXME: Determine actual pixel aspect ratio
+ mRenderBuffer = EGL_BACK_BUFFER;
+ mSwapBehavior = EGL_BUFFER_PRESERVED;
+ mSwapInterval = -1;
+ setSwapInterval(1);
+
+ subclassWindow();
+ resetSwapChain();
+}
+
+Surface::~Surface()
+{
+ unsubclassWindow();
+ release();
+}
+
+void Surface::release()
+{
+ if (mSwapChain)
+ {
+ mSwapChain->Release();
+ mSwapChain = NULL;
+ }
+
+ if (mBackBuffer)
+ {
+ mBackBuffer->Release();
+ mBackBuffer = NULL;
+ }
+
+ if (mDepthStencil)
+ {
+ mDepthStencil->Release();
+ mDepthStencil = NULL;
+ }
+
+ if (mFlipTexture)
+ {
+ mFlipTexture->Release();
+ mFlipTexture = NULL;
+ }
+
+ if (mFlipState)
+ {
+ mFlipState->Release();
+ mFlipState = NULL;
+ }
+
+ if (mPreFlipState)
+ {
+ mPreFlipState->Release();
+ mPreFlipState = NULL;
+ }
+}
+
+void Surface::resetSwapChain()
+{
+ RECT windowRect;
+ if (!GetClientRect(getWindowHandle(), &windowRect))
+ {
+ ASSERT(false);
+
+ ERR("Could not retrieve the window dimensions");
+ return;
+ }
+
+ resetSwapChain(windowRect.right - windowRect.left, windowRect.bottom - windowRect.top);
+}
+
+void Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
+{
+ IDirect3DDevice9 *device = mDisplay->getDevice();
+
+ if (device == NULL)
+ {
+ return;
+ }
+
+ // Evict all non-render target textures to system memory and release all resources
+ // before reallocating them to free up as much video memory as possible.
+ device->EvictManagedResources();
+ release();
+
+ D3DPRESENT_PARAMETERS presentParameters = {0};
+
+ presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
+ presentParameters.BackBufferCount = 1;
+ presentParameters.BackBufferFormat = mConfig->mRenderTargetFormat;
+ presentParameters.EnableAutoDepthStencil = FALSE;
+ presentParameters.Flags = 0;
+ presentParameters.hDeviceWindow = getWindowHandle();
+ presentParameters.MultiSampleQuality = 0; // FIXME: Unimplemented
+ presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE; // FIXME: Unimplemented
+ presentParameters.PresentationInterval = mPresentInterval;
+ presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ presentParameters.Windowed = TRUE;
+ presentParameters.BackBufferWidth = backbufferWidth;
+ presentParameters.BackBufferHeight = backbufferHeight;
+
+ HRESULT result = device->CreateAdditionalSwapChain(&presentParameters, &mSwapChain);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ ERR("Could not create additional swap chains: %08lX", result);
+ release();
+ return error(EGL_BAD_ALLOC);
+ }
+
+ result = device->CreateDepthStencilSurface(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight,
+ presentParameters.AutoDepthStencilFormat, presentParameters.MultiSampleType,
+ presentParameters.MultiSampleQuality, FALSE, &mDepthStencil, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ ERR("Could not create depthstencil surface for new swap chain: %08lX", result);
+ release();
+ return error(EGL_BAD_ALLOC);
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ result = device->CreateTexture(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight, 1, D3DUSAGE_RENDERTARGET,
+ presentParameters.BackBufferFormat, D3DPOOL_DEFAULT, &mFlipTexture, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ ERR("Could not create flip texture for new swap chain: %08lX", result);
+ release();
+ return error(EGL_BAD_ALLOC);
+ }
+
+ mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
+ mWidth = presentParameters.BackBufferWidth;
+ mHeight = presentParameters.BackBufferHeight;
+
+ mPresentIntervalDirty = false;
+
+ InvalidateRect(mWindow, NULL, FALSE);
+
+ // The flip state block recorded mFlipTexture so it is now invalid.
+ releaseRecordedState(device);
+}
+
+HWND Surface::getWindowHandle()
+{
+ return mWindow;
+}
+
+void Surface::writeRecordableFlipState(IDirect3DDevice9 *device)
+{
+ // Disable all pipeline operations
+ device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
+ device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+ device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
+ device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
+ device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ device->SetPixelShader(NULL);
+ device->SetVertexShader(NULL);
+
+ // Just sample the texture
+ device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
+ device->SetTexture(0, NULL); // The actual texture will change after resizing. But the pre-flip state block must save/restore the texture.
+ device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_SRGBTEXTURE, FALSE);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+ device->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
+
+ RECT scissorRect = {0}; // Scissoring is disabled for flipping, but we need this to capture and restore the old rectangle
+ device->SetScissorRect(&scissorRect);
+ D3DVIEWPORT9 viewport = {0, 0, mWidth, mHeight, 0.0f, 1.0f};
+ device->SetViewport(&viewport);
+}
+
+void Surface::applyFlipState(IDirect3DDevice9 *device)
+{
+ HRESULT hr;
+
+ if (mFlipState == NULL)
+ {
+ // Create two state blocks both recording the states that are changed when swapping.
+
+ // mPreFlipState will record the original state each entry.
+ hr = device->BeginStateBlock();
+ ASSERT(SUCCEEDED(hr));
+ writeRecordableFlipState(device);
+ hr = device->EndStateBlock(&mPreFlipState);
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+ if (SUCCEEDED(hr))
+ {
+ mPreFlipState->Capture();
+ }
+
+ // mFlipState will record the state for the swap operation.
+ hr = device->BeginStateBlock();
+ ASSERT(SUCCEEDED(hr));
+
+ writeRecordableFlipState(device);
+
+ hr = device->EndStateBlock(&mFlipState);
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+ if (FAILED(hr))
+ {
+ mFlipState = NULL;
+ mPreFlipState->Release();
+ mPreFlipState = NULL;
+ }
+ else
+ {
+ hr = mFlipState->Apply();
+ ASSERT(SUCCEEDED(hr));
+ }
+ }
+ else
+ {
+ hr = mPreFlipState->Capture();
+ ASSERT(SUCCEEDED(hr));
+ hr = mFlipState->Apply();
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ device->GetRenderTarget(0, &mPreFlipBackBuffer);
+ device->GetDepthStencilSurface(&mPreFlipDepthStencil);
+
+ device->SetRenderTarget(0, mBackBuffer);
+ device->SetDepthStencilSurface(NULL);
+}
+
+void Surface::restoreState(IDirect3DDevice9 *device)
+{
+ device->SetRenderTarget(0, mPreFlipBackBuffer);
+ device->SetDepthStencilSurface(mPreFlipDepthStencil);
+
+ if (mPreFlipBackBuffer)
+ {
+ mPreFlipBackBuffer->Release();
+ mPreFlipBackBuffer = NULL;
+ }
+
+ if (mPreFlipDepthStencil)
+ {
+ mPreFlipDepthStencil->Release();
+ mPreFlipDepthStencil = NULL;
+ }
+
+ mPreFlipState->Apply();
+}
+
+// On the next flip, this will cause the state to be recorded from scratch.
+// In particular we need to do this if the flip texture changes.
+void Surface::releaseRecordedState(IDirect3DDevice9 *device)
+{
+ if (mFlipState)
+ {
+ mFlipState->Release();
+ mFlipState = NULL;
+ }
+
+ if (mPreFlipState)
+ {
+ mPreFlipState->Release();
+ mPreFlipState = NULL;
+ }
+}
+#define kSurfaceProperty _TEXT("Egl::SurfaceOwner")
+#define kParentWndProc _TEXT("Egl::SurfaceParentWndProc")
+
+static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
+ if (message == WM_SIZE) {
+ Surface* surf = reinterpret_cast<Surface*>(GetProp(hwnd, kSurfaceProperty));
+ if(surf) {
+ surf->checkForOutOfDateSwapChain();
+ }
+ }
+ WNDPROC prevWndFunc = reinterpret_cast<WNDPROC >(GetProp(hwnd, kParentWndProc));
+ return CallWindowProc(prevWndFunc, hwnd, message, wparam, lparam);
+}
+
+void Surface::subclassWindow()
+{
+ SetLastError(0);
+ LONG oldWndProc = SetWindowLong(mWindow, GWL_WNDPROC, reinterpret_cast<LONG>(SurfaceWindowProc));
+ if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS) {
+ mWindowSubclassed = false;
+ return;
+ }
+
+ SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
+ SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
+ mWindowSubclassed = true;
+}
+
+void Surface::unsubclassWindow()
+{
+ if(!mWindowSubclassed)
+ return;
+
+ // un-subclass
+ LONG parentWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
+
+ // Check the windowproc is still SurfaceWindowProc.
+ // If this assert fails, then it is likely the application has subclassed the
+ // hwnd as well and did not unsubclass before destroying its EGL context. The
+ // application should be modified to either subclass before initializing the
+ // EGL context, or to unsubclass before destroying the EGL context.
+ if(parentWndFunc) {
+ LONG prevWndFunc = SetWindowLong(mWindow, GWL_WNDPROC, parentWndFunc);
+ ASSERT(prevWndFunc == reinterpret_cast<LONG>(SurfaceWindowProc));
+ }
+
+ RemoveProp(mWindow, kSurfaceProperty);
+ RemoveProp(mWindow, kParentWndProc);
+ mWindowSubclassed = false;
+}
+
+bool Surface::checkForOutOfDateSwapChain()
+{
+ RECT client;
+ if (!GetClientRect(getWindowHandle(), &client))
+ {
+ ASSERT(false);
+ return false;
+ }
+
+ // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
+ int clientWidth = client.right - client.left;
+ int clientHeight = client.bottom - client.top;
+ bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
+
+ if (sizeDirty || mPresentIntervalDirty)
+ {
+ resetSwapChain(clientWidth, clientHeight);
+ if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
+ {
+ glMakeCurrent(glGetCurrentContext(), static_cast<egl::Display*>(getCurrentDisplay()), this);
+ }
+
+ return true;
+ }
+ return false;
+}
+
+DWORD Surface::convertInterval(EGLint interval)
+{
+ switch(interval)
+ {
+ case 0: return D3DPRESENT_INTERVAL_IMMEDIATE;
+ case 1: return D3DPRESENT_INTERVAL_ONE;
+ case 2: return D3DPRESENT_INTERVAL_TWO;
+ case 3: return D3DPRESENT_INTERVAL_THREE;
+ case 4: return D3DPRESENT_INTERVAL_FOUR;
+ default: UNREACHABLE();
+ }
+
+ return D3DPRESENT_INTERVAL_DEFAULT;
+}
+
+
+bool Surface::swap()
+{
+ if (mSwapChain)
+ {
+ IDirect3DDevice9 *device = mDisplay->getDevice();
+
+ applyFlipState(device);
+ device->SetTexture(0, mFlipTexture);
+
+ // Render the texture upside down into the back buffer
+ // Texcoords are chosen to flip the renderTarget about its Y axis.
+ float w = static_cast<float>(getWidth());
+ float h = static_cast<float>(getHeight());
+ float quad[4][6] = {{0 - 0.5f, 0 - 0.5f, 0.0f, 1.0f, 0.0f, 1.0f},
+ {w - 0.5f, 0 - 0.5f, 0.0f, 1.0f, 1.0f, 1.0f},
+ {w - 0.5f, h - 0.5f, 0.0f, 1.0f, 1.0f, 0.0f},
+ {0 - 0.5f, h - 0.5f, 0.0f, 1.0f, 0.0f, 0.0f}}; // x, y, z, rhw, u, v
+
+ mDisplay->startScene();
+ device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, 6 * sizeof(float));
+
+ restoreState(device);
+
+ mDisplay->endScene();
+
+ HRESULT result = mSwapChain->Present(NULL, NULL, NULL, NULL, 0);
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
+ {
+ return error(EGL_BAD_ALLOC, false);
+ }
+
+ if (result == D3DERR_DEVICELOST)
+ {
+ return error(EGL_CONTEXT_LOST, false);
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ checkForOutOfDateSwapChain();
+ }
+
+ return true;
+}
+
+EGLint Surface::getWidth() const
+{
+ return mWidth;
+}
+
+EGLint Surface::getHeight() const
+{
+ return mHeight;
+}
+
+IDirect3DSurface9 *Surface::getRenderTarget()
+{
+ IDirect3DSurface9 *textureSurface = NULL;
+
+ if (mFlipTexture)
+ {
+ mFlipTexture->GetSurfaceLevel(0, &textureSurface);
+ }
+
+ return textureSurface;
+}
+
+IDirect3DSurface9 *Surface::getDepthStencil()
+{
+ if (mDepthStencil)
+ {
+ mDepthStencil->AddRef();
+ }
+
+ return mDepthStencil;
+}
+
+void Surface::setSwapInterval(EGLint interval)
+{
+ if (mSwapInterval == interval)
+ {
+ return;
+ }
+
+ mSwapInterval = interval;
+ mSwapInterval = std::max(mSwapInterval, mDisplay->getMinSwapInterval());
+ mSwapInterval = std::min(mSwapInterval, mDisplay->getMaxSwapInterval());
+
+ mPresentInterval = convertInterval(mSwapInterval);
+ mPresentIntervalDirty = true;
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.h
new file mode 100644
index 0000000..422d3d5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/Surface.h
@@ -0,0 +1,94 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Surface.h: Defines the egl::Surface class, representing a drawing surface
+// such as the client area of a window, including any back buffers.
+// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
+
+#ifndef INCLUDE_SURFACE_H_
+#define INCLUDE_SURFACE_H_
+
+#define EGLAPI
+#include <EGL/egl.h>
+#include <d3d9.h>
+
+#include "common/angleutils.h"
+
+namespace egl
+{
+class Display;
+class Config;
+
+class Surface
+{
+ public:
+ Surface(Display *display, const egl::Config *config, HWND window);
+
+ ~Surface();
+
+ void release();
+ void resetSwapChain();
+
+ HWND getWindowHandle();
+ bool swap();
+
+ virtual EGLint getWidth() const;
+ virtual EGLint getHeight() const;
+
+ virtual IDirect3DSurface9 *getRenderTarget();
+ virtual IDirect3DSurface9 *getDepthStencil();
+
+ void setSwapInterval(EGLint interval);
+ bool checkForOutOfDateSwapChain(); // Returns true if swapchain changed due to resize or interval update
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(Surface);
+
+ Display *const mDisplay;
+ IDirect3DSwapChain9 *mSwapChain;
+ IDirect3DSurface9 *mBackBuffer;
+ IDirect3DSurface9 *mDepthStencil;
+ IDirect3DTexture9 *mFlipTexture;
+
+ void subclassWindow();
+ void unsubclassWindow();
+ void resetSwapChain(int backbufferWidth, int backbufferHeight);
+ static DWORD convertInterval(EGLint interval);
+
+ void applyFlipState(IDirect3DDevice9 *device);
+ void restoreState(IDirect3DDevice9 *device);
+ void writeRecordableFlipState(IDirect3DDevice9 *device);
+ void releaseRecordedState(IDirect3DDevice9 *device);
+ IDirect3DStateBlock9 *mFlipState;
+ IDirect3DStateBlock9 *mPreFlipState;
+ IDirect3DSurface9 *mPreFlipBackBuffer;
+ IDirect3DSurface9 *mPreFlipDepthStencil;
+
+ const HWND mWindow; // Window that the surface is created for.
+ bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
+ const egl::Config *mConfig; // EGL config surface was created with
+ EGLint mHeight; // Height of surface
+ EGLint mWidth; // Width of surface
+// EGLint horizontalResolution; // Horizontal dot pitch
+// EGLint verticalResolution; // Vertical dot pitch
+// EGLBoolean largestPBuffer; // If true, create largest pbuffer possible
+// EGLBoolean mipmapTexture; // True if texture has mipmaps
+// EGLint mipmapLevel; // Mipmap level to render to
+// EGLenum multisampleResolve; // Multisample resolve behavior
+ EGLint mPixelAspectRatio; // Display aspect ratio
+ EGLenum mRenderBuffer; // Render buffer
+ EGLenum mSwapBehavior; // Buffer swap behavior
+// EGLenum textureFormat; // Format of texture: RGB, RGBA, or no texture
+// EGLenum textureTarget; // Type of texture: 2D or no texture
+// EGLenum vgAlphaFormat; // Alpha format for OpenVG
+// EGLenum vgColorSpace; // Color space for OpenVG
+ EGLint mSwapInterval;
+ DWORD mPresentInterval;
+ bool mPresentIntervalDirty;
+};
+}
+
+#endif // INCLUDE_SURFACE_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp
new file mode 100644
index 0000000..8dfe6e5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp
@@ -0,0 +1,1115 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// libEGL.cpp: Implements the exported EGL functions.
+
+#include <exception>
+
+#include "common/debug.h"
+#include "libGLESv2/Context.h"
+
+#include "libEGL/main.h"
+#include "libEGL/Display.h"
+
+
+bool validate(egl::Display *display)
+{
+ if (display == EGL_NO_DISPLAY)
+ {
+ return error(EGL_BAD_DISPLAY, false);
+ }
+
+ if (!display->isInitialized())
+ {
+ return error(EGL_NOT_INITIALIZED, false);
+ }
+
+ return true;
+}
+
+bool validate(egl::Display *display, EGLConfig config)
+{
+ if (!validate(display))
+ {
+ return false;
+ }
+
+ if (!display->isValidConfig(config))
+ {
+ return error(EGL_BAD_CONFIG, false);
+ }
+
+ return true;
+}
+
+bool validate(egl::Display *display, gl::Context *context)
+{
+ if (!validate(display))
+ {
+ return false;
+ }
+
+ if (!display->isValidContext(context))
+ {
+ return error(EGL_BAD_CONTEXT, false);
+ }
+
+ return true;
+}
+
+bool validate(egl::Display *display, egl::Surface *surface)
+{
+ if (!validate(display))
+ {
+ return false;
+ }
+
+ if (!display->isValidSurface(surface))
+ {
+ return error(EGL_BAD_SURFACE, false);
+ }
+
+ return true;
+}
+
+extern "C"
+{
+EGLint __stdcall eglGetError(void)
+{
+ TRACE("()");
+
+ EGLint error = egl::getCurrentError();
+
+ if (error != EGL_SUCCESS)
+ {
+ egl::setCurrentError(EGL_SUCCESS);
+ }
+
+ return error;
+}
+
+EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id)
+{
+ TRACE("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id);
+
+ try
+ {
+ // FIXME: Return the same EGLDisplay handle when display_id already created a display
+
+ if (display_id == EGL_DEFAULT_DISPLAY)
+ {
+ return new egl::Display((HDC)NULL);
+ }
+ else
+ {
+ // FIXME: Check if display_id is a valid display device context
+
+ return new egl::Display((HDC)display_id);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
+ }
+
+ return EGL_NO_DISPLAY;
+}
+
+EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)",
+ dpy, major, minor);
+
+ try
+ {
+ if (dpy == EGL_NO_DISPLAY)
+ {
+ return error(EGL_BAD_DISPLAY, EGL_FALSE);
+ }
+
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!display->initialize())
+ {
+ return error(EGL_NOT_INITIALIZED, EGL_FALSE);
+ }
+
+ if (major) *major = 1;
+ if (minor) *minor = 4;
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglTerminate(EGLDisplay dpy)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p)", dpy);
+
+ try
+ {
+ if (dpy == EGL_NO_DISPLAY)
+ {
+ return error(EGL_BAD_DISPLAY, EGL_FALSE);
+ }
+
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ display->terminate();
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLint name = %d)", dpy, name);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return NULL;
+ }
+
+ switch (name)
+ {
+ case EGL_CLIENT_APIS:
+ return success("OpenGL_ES");
+ case EGL_EXTENSIONS:
+ return success("");
+ case EGL_VENDOR:
+ return success("TransGaming Inc.");
+ case EGL_VERSION:
+ return success("1.4 (git-devel "__DATE__" " __TIME__")");
+ }
+
+ return error(EGL_BAD_PARAMETER, (const char*)NULL);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, (const char*)NULL);
+ }
+
+ return NULL;
+}
+
+EGLBoolean __stdcall eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, "
+ "EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
+ dpy, configs, config_size, num_config);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ if (!num_config)
+ {
+ return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ }
+
+ const EGLint attribList[] = {EGL_NONE};
+
+ if (!display->getConfigs(configs, attribList, config_size, num_config))
+ {
+ return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ }
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, "
+ "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
+ dpy, attrib_list, configs, config_size, num_config);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ if (!num_config)
+ {
+ return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ }
+
+ const EGLint attribList[] = {EGL_NONE};
+
+ if (!attrib_list)
+ {
+ attrib_list = attribList;
+ }
+
+ display->getConfigs(configs, attrib_list, config_size, num_config);
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
+ dpy, config, attribute, value);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display, config))
+ {
+ return EGL_FALSE;
+ }
+
+ if (!display->getConfigAttrib(config, attribute, value))
+ {
+ return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ }
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, "
+ "const EGLint *attrib_list = 0x%0.8p)", dpy, config, win, attrib_list);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display, config))
+ {
+ return EGL_NO_SURFACE;
+ }
+
+ HWND window = (HWND)win;
+
+ if (!IsWindow(window))
+ {
+ return error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+ }
+
+ if (attrib_list)
+ {
+ while (*attrib_list != EGL_NONE)
+ {
+ switch (attrib_list[0])
+ {
+ case EGL_RENDER_BUFFER:
+ switch (attrib_list[1])
+ {
+ case EGL_BACK_BUFFER:
+ break;
+ case EGL_SINGLE_BUFFER:
+ return error(EGL_BAD_MATCH, EGL_NO_SURFACE); // Rendering directly to front buffer not supported
+ default:
+ return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
+ }
+ break;
+ case EGL_VG_COLORSPACE:
+ return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
+ case EGL_VG_ALPHA_FORMAT:
+ return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
+ default:
+ return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
+ }
+
+ attrib_list += 2;
+ }
+ }
+
+ if (display->hasExistingWindowSurface(window))
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ }
+
+ EGLSurface surface = (EGLSurface)display->createWindowSurface(window, config);
+
+ return success(surface);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ }
+
+ return EGL_NO_SURFACE;
+}
+
+EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
+ dpy, config, attrib_list);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display, config))
+ {
+ return EGL_NO_SURFACE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(EGL_NO_DISPLAY);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ }
+
+ return EGL_NO_SURFACE;
+}
+
+EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativePixmapType pixmap = 0x%0.8p, "
+ "const EGLint *attrib_list = 0x%0.8p)", dpy, config, pixmap, attrib_list);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display, config))
+ {
+ return EGL_NO_SURFACE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(EGL_NO_DISPLAY);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ }
+
+ return EGL_NO_SURFACE;
+}
+
+EGLBoolean __stdcall eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ return error(EGL_BAD_SURFACE, EGL_FALSE);
+ }
+
+ display->destroySurface((egl::Surface*)surface);
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
+ dpy, surface, attribute, value);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ return error(EGL_BAD_SURFACE, EGL_FALSE);
+ }
+
+ egl::Surface *eglSurface = (egl::Surface*)surface;
+
+ switch (attribute)
+ {
+ case EGL_VG_ALPHA_FORMAT:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_VG_COLORSPACE:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_CONFIG_ID:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_HEIGHT:
+ *value = eglSurface->getHeight();
+ break;
+ case EGL_HORIZONTAL_RESOLUTION:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_LARGEST_PBUFFER:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_MIPMAP_TEXTURE:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_MIPMAP_LEVEL:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_MULTISAMPLE_RESOLVE:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_PIXEL_ASPECT_RATIO:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_RENDER_BUFFER:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_SWAP_BEHAVIOR:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_TEXTURE_FORMAT:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_TEXTURE_TARGET:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_VERTICAL_RESOLUTION:
+ UNIMPLEMENTED(); // FIXME
+ break;
+ case EGL_WIDTH:
+ *value = eglSurface->getWidth();
+ break;
+ default:
+ return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ }
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglBindAPI(EGLenum api)
+{
+ TRACE("(EGLenum api = 0x%X)", api);
+
+ try
+ {
+ switch (api)
+ {
+ case EGL_OPENGL_API:
+ case EGL_OPENVG_API:
+ return error(EGL_BAD_PARAMETER, EGL_FALSE); // Not supported by this implementation
+ case EGL_OPENGL_ES_API:
+ break;
+ default:
+ return error(EGL_BAD_PARAMETER, EGL_FALSE);
+ }
+
+ egl::setCurrentAPI(api);
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLenum __stdcall eglQueryAPI(void)
+{
+ TRACE("()");
+
+ try
+ {
+ EGLenum API = egl::getCurrentAPI();
+
+ return success(API);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglWaitClient(void)
+{
+ TRACE("()");
+
+ try
+ {
+ UNIMPLEMENTED(); // FIXME
+
+ return success(0);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglReleaseThread(void)
+{
+ TRACE("()");
+
+ try
+ {
+ eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLSurface __stdcall eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%0.8p, "
+ "EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
+ dpy, buftype, buffer, config, attrib_list);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display, config))
+ {
+ return EGL_NO_SURFACE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(EGL_NO_SURFACE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ }
+
+ return EGL_NO_SURFACE;
+}
+
+EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint value = %d)",
+ dpy, surface, attribute, value);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLint interval = %d)", dpy, interval);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ egl::Surface *draw_surface = static_cast<egl::Surface*>(egl::getCurrentDrawSurface());
+
+ if (draw_surface == NULL)
+ {
+ return error(EGL_BAD_SURFACE, EGL_FALSE);
+ }
+
+ draw_surface->setSwapInterval(interval);
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = 0x%0.8p, "
+ "const EGLint *attrib_list = 0x%0.8p)", dpy, config, share_context, attrib_list);
+
+ try
+ {
+ // Get the requested client version (default is 1) and check it is two.
+ EGLint client_version = 1;
+ if (attrib_list)
+ {
+ for (const EGLint* attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2)
+ {
+ if (attribute[0] == EGL_CONTEXT_CLIENT_VERSION)
+ {
+ client_version = attribute[1];
+ }
+ else
+ {
+ return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
+ }
+ }
+ }
+
+ if (client_version != 2)
+ {
+ return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
+ }
+
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display, config))
+ {
+ return EGL_NO_CONTEXT;
+ }
+
+ EGLContext context = display->createContext(config, static_cast<gl::Context*>(share_context));
+
+ return success(context);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
+ }
+
+ return EGL_NO_CONTEXT;
+}
+
+EGLBoolean __stdcall eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)", dpy, ctx);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ if (ctx == EGL_NO_CONTEXT)
+ {
+ return error(EGL_BAD_CONTEXT, EGL_FALSE);
+ }
+
+ display->destroyContext((gl::Context*)ctx);
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface draw = 0x%0.8p, EGLSurface read = 0x%0.8p, EGLContext ctx = 0x%0.8p)",
+ dpy, draw, read, ctx);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+ gl::Context *context = static_cast<gl::Context*>(ctx);
+ IDirect3DDevice9 *device = display->getDevice();
+
+ if (!device || FAILED(device->TestCooperativeLevel()))
+ {
+ return error(EGL_CONTEXT_LOST, EGL_FALSE);
+ }
+
+ if (ctx != EGL_NO_CONTEXT && !validate(display, context))
+ {
+ return EGL_FALSE;
+ }
+
+ if ((draw != EGL_NO_SURFACE && !validate(display, static_cast<egl::Surface*>(draw))) ||
+ (read != EGL_NO_SURFACE && !validate(display, static_cast<egl::Surface*>(read))))
+ {
+ return EGL_FALSE;
+ }
+
+ if (draw != read)
+ {
+ UNIMPLEMENTED(); // FIXME
+ }
+
+ egl::setCurrentDisplay(dpy);
+ egl::setCurrentDrawSurface(draw);
+ egl::setCurrentReadSurface(read);
+
+ glMakeCurrent(context, display, static_cast<egl::Surface*>(draw));
+
+ return success(EGL_TRUE);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLContext __stdcall eglGetCurrentContext(void)
+{
+ TRACE("()");
+
+ try
+ {
+ EGLContext context = glGetCurrentContext();
+
+ return success(context);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
+ }
+
+ return EGL_NO_CONTEXT;
+}
+
+EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw)
+{
+ TRACE("(EGLint readdraw = %d)", readdraw);
+
+ try
+ {
+ if (readdraw == EGL_READ)
+ {
+ EGLSurface read = egl::getCurrentReadSurface();
+ return success(read);
+ }
+ else if (readdraw == EGL_DRAW)
+ {
+ EGLSurface draw = egl::getCurrentDrawSurface();
+ return success(draw);
+ }
+ else
+ {
+ return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ }
+
+ return EGL_NO_SURFACE;
+}
+
+EGLDisplay __stdcall eglGetCurrentDisplay(void)
+{
+ TRACE("()");
+
+ try
+ {
+ EGLDisplay dpy = egl::getCurrentDisplay();
+
+ return success(dpy);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
+ }
+
+ return EGL_NO_DISPLAY;
+}
+
+EGLBoolean __stdcall eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
+ dpy, ctx, attribute, value);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(0);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglWaitGL(void)
+{
+ TRACE("()");
+
+ try
+ {
+ UNIMPLEMENTED(); // FIXME
+
+ return success(0);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglWaitNative(EGLint engine)
+{
+ TRACE("(EGLint engine = %d)", engine);
+
+ try
+ {
+ UNIMPLEMENTED(); // FIXME
+
+ return success(0);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ return error(EGL_BAD_SURFACE, EGL_FALSE);
+ }
+
+ egl::Surface *eglSurface = (egl::Surface*)surface;
+
+ if (eglSurface->swap())
+ {
+ return success(EGL_TRUE);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
+{
+ TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)", dpy, surface, target);
+
+ try
+ {
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+
+ if (!validate(display))
+ {
+ return EGL_FALSE;
+ }
+
+ UNIMPLEMENTED(); // FIXME
+
+ return success(0);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+
+ return EGL_FALSE;
+}
+
+__eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char *procname)
+{
+ TRACE("(const char *procname = \"%s\")", procname);
+
+ try
+ {
+ struct Extension
+ {
+ const char *name;
+ __eglMustCastToProperFunctionPointerType address;
+ };
+
+ static const Extension eglExtensions[] =
+ {
+ {"", NULL},
+ };
+
+ for (int ext = 0; ext < sizeof(eglExtensions) / sizeof(Extension); ext++)
+ {
+ if (strcmp(procname, eglExtensions[ext].name) == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglExtensions[ext].address;
+ }
+ }
+
+ return glGetProcAddress(procname);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
+ }
+
+ return NULL;
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def
new file mode 100644
index 0000000..71a5e67
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def
@@ -0,0 +1,36 @@
+LIBRARY libEGL
+EXPORTS
+ eglBindAPI @14
+ eglBindTexImage @20
+ eglChooseConfig @7
+ eglCopyBuffers @33
+ eglCreateContext @23
+ eglCreatePbufferFromClientBuffer @18
+ eglCreatePbufferSurface @10
+ eglCreatePixmapSurface @11
+ eglCreateWindowSurface @9
+ eglDestroyContext @24
+ eglDestroySurface @12
+ eglGetConfigAttrib @8
+ eglGetConfigs @6
+ eglGetCurrentContext @26
+ eglGetCurrentDisplay @28
+ eglGetCurrentSurface @27
+ eglGetDisplay @2
+ eglGetError @1
+ eglGetProcAddress @34
+ eglInitialize @3
+ eglMakeCurrent @25
+ eglQueryAPI @15
+ eglQueryContext @29
+ eglQueryString @5
+ eglQuerySurface @13
+ eglReleaseTexImage @21
+ eglReleaseThread @17
+ eglSurfaceAttrib @19
+ eglSwapBuffers @32
+ eglSwapInterval @22
+ eglTerminate @4
+ eglWaitClient @16
+ eglWaitGL @30
+ eglWaitNative @31 \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.cpp
new file mode 100644
index 0000000..d9902d2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.cpp
@@ -0,0 +1,161 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// main.cpp: DLL entry point and management of thread-local data.
+
+#include "libEGL/main.h"
+
+#include "common/debug.h"
+
+static DWORD currentTLS = TLS_OUT_OF_INDEXES;
+
+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+{
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ {
+ #ifndef NDEBUG
+ FILE *debug = fopen("debug.txt", "rt");
+
+ if (debug)
+ {
+ fclose(debug);
+ debug = fopen("debug.txt", "wt"); // Erase
+ fclose(debug);
+ }
+ #endif
+
+ currentTLS = TlsAlloc();
+
+ if (currentTLS == TLS_OUT_OF_INDEXES)
+ {
+ return FALSE;
+ }
+ }
+ // Fall throught to initialize index
+ case DLL_THREAD_ATTACH:
+ {
+ egl::Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
+
+ if (current)
+ {
+ TlsSetValue(currentTLS, current);
+
+ current->error = EGL_SUCCESS;
+ current->API = EGL_OPENGL_ES_API;
+ current->display = EGL_NO_DISPLAY;
+ current->drawSurface = EGL_NO_SURFACE;
+ current->readSurface = EGL_NO_SURFACE;
+ }
+ }
+ break;
+ case DLL_THREAD_DETACH:
+ {
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+ }
+ break;
+ case DLL_PROCESS_DETACH:
+ {
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+
+ TlsFree(currentTLS);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return TRUE;
+}
+
+namespace egl
+{
+void setCurrentError(EGLint error)
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ current->error = error;
+}
+
+EGLint getCurrentError()
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ return current->error;
+}
+
+void setCurrentAPI(EGLenum API)
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ current->API = API;
+}
+
+EGLenum getCurrentAPI()
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ return current->API;
+}
+
+void setCurrentDisplay(EGLDisplay dpy)
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ current->display = dpy;
+}
+
+EGLDisplay getCurrentDisplay()
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ return current->display;
+}
+
+void setCurrentDrawSurface(EGLSurface surface)
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ current->drawSurface = surface;
+}
+
+EGLSurface getCurrentDrawSurface()
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ return current->drawSurface;
+}
+
+void setCurrentReadSurface(EGLSurface surface)
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ current->readSurface = surface;
+}
+
+EGLSurface getCurrentReadSurface()
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ return current->readSurface;
+}
+}
+
+void error(EGLint errorCode)
+{
+ egl::setCurrentError(errorCode);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.h
new file mode 100644
index 0000000..d6dc759
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/main.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// main.h: Management of thread-local data.
+
+#ifndef LIBEGL_MAIN_H_
+#define LIBEGL_MAIN_H_
+
+#define EGLAPI
+#include <EGL/egl.h>
+
+namespace egl
+{
+struct Current
+{
+ EGLint error;
+ EGLenum API;
+ EGLDisplay display;
+ EGLSurface drawSurface;
+ EGLSurface readSurface;
+};
+
+void setCurrentError(EGLint error);
+EGLint getCurrentError();
+
+void setCurrentAPI(EGLenum API);
+EGLenum getCurrentAPI();
+
+void setCurrentDisplay(EGLDisplay dpy);
+EGLDisplay getCurrentDisplay();
+
+void setCurrentDrawSurface(EGLSurface surface);
+EGLSurface getCurrentDrawSurface();
+
+void setCurrentReadSurface(EGLSurface surface);
+EGLSurface getCurrentReadSurface();
+}
+
+void error(EGLint errorCode);
+
+template<class T>
+const T &error(EGLint errorCode, const T &returnValue)
+{
+ error(errorCode);
+
+ return returnValue;
+}
+
+template<class T>
+const T &success(const T &returnValue)
+{
+ egl::setCurrentError(EGL_SUCCESS);
+
+ return returnValue;
+}
+
+#endif // LIBEGL_MAIN_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp
new file mode 100644
index 0000000..43ed8a0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp
@@ -0,0 +1,563 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit.cpp: Surface copy utility class.
+
+#include "libGLESv2/Blit.h"
+
+#include <d3dx9.h>
+
+#include "common/debug.h"
+
+#include "libGLESv2/main.h"
+
+namespace
+{
+// Standard Vertex Shader
+// Input 0 is the homogenous position.
+// Outputs the homogenous position as-is.
+// Outputs a tex coord with (0,0) in the upper-left corner of the screen and (1,1) in the bottom right.
+// C0.X must be negative half-pixel width, C0.Y must be half-pixel height. C0.ZW must be 0.
+const char standardvs[] =
+"struct VS_OUTPUT\n"
+"{\n"
+" float4 position : POSITION;\n"
+" float4 texcoord : TEXCOORD0;\n"
+"};\n"
+"\n"
+"uniform float4 halfPixelSize : c0;\n"
+"\n"
+"VS_OUTPUT main(in float4 position : POSITION)\n"
+"{\n"
+" VS_OUTPUT Out;\n"
+"\n"
+" Out.position = position + halfPixelSize;\n"
+" Out.texcoord = position * float4(0.5, -0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);\n"
+"\n"
+" return Out;\n"
+"}\n";
+
+// Flip Y Vertex Shader
+// Input 0 is the homogenous position.
+// Outputs the homogenous position as-is.
+// Outputs a tex coord with (0,1) in the upper-left corner of the screen and (1,0) in the bottom right.
+// C0.XY must be the half-pixel width and height. C0.ZW must be 0.
+const char flipyvs[] =
+"struct VS_OUTPUT\n"
+"{\n"
+" float4 position : POSITION;\n"
+" float4 texcoord : TEXCOORD0;\n"
+"};\n"
+"\n"
+"uniform float4 halfPixelSize : c0;\n"
+"\n"
+"VS_OUTPUT main(in float4 position : POSITION)\n"
+"{\n"
+" VS_OUTPUT Out;\n"
+"\n"
+" Out.position = position + halfPixelSize;\n"
+" Out.texcoord = position * float4(0.5, 0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);\n"
+"\n"
+" return Out;\n"
+"}\n";
+
+// Passthrough Pixel Shader
+// Outputs texture 0 sampled at texcoord 0.
+const char passthroughps[] =
+"sampler2D tex : s0;\n"
+"\n"
+"float4 main(float4 texcoord : TEXCOORD0) : COLOR\n"
+"{\n"
+" return tex2D(tex, texcoord.xy);\n"
+"}\n";
+
+// Luminance Conversion Pixel Shader
+// Outputs sample(tex0, tc0).rrra.
+// For LA output (pass A) set C0.X = 1, C0.Y = 0.
+// For L output (A = 1) set C0.X = 0, C0.Y = 1.
+const char luminanceps[] =
+"sampler2D tex : s0;\n"
+"\n"
+"uniform float4 mode : c0;\n"
+"\n"
+"float4 main(float4 texcoord : TEXCOORD0) : COLOR\n"
+"{\n"
+" float4 tmp = tex2D(tex, texcoord.xy);\n"
+" tmp.w = tmp.w * mode.x + mode.y;\n"
+" return tmp.xxxw;\n"
+"}\n";
+
+// RGB/A Component Mask Pixel Shader
+// Outputs sample(tex0, tc0) with options to force RGB = 0 and/or A = 1.
+// To force RGB = 0, set C0.X = 0, otherwise C0.X = 1.
+// To force A = 1, set C0.Z = 0, C0.W = 1, otherwise C0.Z = 1, C0.W = 0.
+const char componentmaskps[] =
+"sampler2D tex : s0;\n"
+"\n"
+"uniform float4 mode : c0;\n"
+"\n"
+"float4 main(float4 texcoord : TEXCOORD0) : COLOR\n"
+"{\n"
+" float4 tmp = tex2D(tex, texcoord.xy);\n"
+" tmp.xyz = tmp.xyz * mode.x;\n"
+" tmp.w = tmp.w * mode.z + mode.w;\n"
+" return tmp;\n"
+"}\n";
+
+}
+
+namespace gl
+{
+
+const char * const Blit::mShaderSource[] =
+{
+ standardvs,
+ flipyvs,
+ passthroughps,
+ luminanceps,
+ componentmaskps
+};
+
+Blit::Blit(Context *context)
+ : mContext(context), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL), mSavedStateBlock(NULL)
+{
+ initGeometry();
+ memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
+}
+
+Blit::~Blit()
+{
+ if (mSavedStateBlock) mSavedStateBlock->Release();
+ if (mQuadVertexBuffer) mQuadVertexBuffer->Release();
+ if (mQuadVertexDeclaration) mQuadVertexDeclaration->Release();
+
+ for (int i = 0; i < SHADER_COUNT; i++)
+ {
+ if (mCompiledShaders[i])
+ {
+ mCompiledShaders[i]->Release();
+ }
+ }
+}
+
+void Blit::initGeometry()
+{
+ static const float quad[] =
+ {
+ -1, -1,
+ -1, 1,
+ 1, -1,
+ 1, 1
+ };
+
+ IDirect3DDevice9 *device = getDevice();
+
+ HRESULT hr = device->CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mQuadVertexBuffer, NULL);
+
+ if (FAILED(hr))
+ {
+ ASSERT(hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ void *lockPtr;
+ mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0);
+ memcpy(lockPtr, quad, sizeof(quad));
+ mQuadVertexBuffer->Unlock();
+
+ static const D3DVERTEXELEMENT9 elements[] =
+ {
+ { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
+ D3DDECL_END()
+ };
+
+ hr = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration);
+ if (FAILED(hr))
+ {
+ ASSERT(hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+template <class D3DShaderType>
+bool Blit::setShader(ShaderId source, const char *profile,
+ HRESULT (WINAPI IDirect3DDevice9::*createShader)(const DWORD *, D3DShaderType**),
+ HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ D3DShaderType *shader;
+
+ if (mCompiledShaders[source] != NULL)
+ {
+ shader = static_cast<D3DShaderType*>(mCompiledShaders[source]);
+ }
+ else
+ {
+ ID3DXBuffer *shaderCode;
+ HRESULT hr = D3DXCompileShader(mShaderSource[source], strlen(mShaderSource[source]), NULL, NULL, "main", profile, 0, &shaderCode, NULL, NULL);
+
+ if (FAILED(hr))
+ {
+ ERR("Failed to compile %s shader for blit operation %d, error 0x%08X.", profile, (int)source, hr);
+ return false;
+ }
+
+ hr = (device->*createShader)(static_cast<const DWORD*>(shaderCode->GetBufferPointer()), &shader);
+ if (FAILED(hr))
+ {
+ shaderCode->Release();
+ ERR("Failed to create %s shader for blit operation %d, error 0x%08X.", profile, (int)source, hr);
+ return false;
+ }
+
+ shaderCode->Release();
+
+ mCompiledShaders[source] = shader;
+ }
+
+ HRESULT hr = (device->*setShader)(shader);
+
+ if (FAILED(hr))
+ {
+ ERR("Failed to set %s shader for blit operation %d, error 0x%08X.", profile, (int)source, hr);
+ return false;
+ }
+
+ return true;
+}
+
+bool Blit::setVertexShader(ShaderId shader)
+{
+ return setShader<IDirect3DVertexShader9>(shader, mContext->supportsShaderModel3() ? "vs_3_0" : "vs_2_0", &IDirect3DDevice9::CreateVertexShader, &IDirect3DDevice9::SetVertexShader);
+}
+
+bool Blit::setPixelShader(ShaderId shader)
+{
+ return setShader<IDirect3DPixelShader9>(shader, mContext->supportsShaderModel3() ? "ps_3_0" : "ps_2_0", &IDirect3DDevice9::CreatePixelShader, &IDirect3DDevice9::SetPixelShader);
+}
+
+RECT Blit::getSurfaceRect(IDirect3DSurface9 *surface) const
+{
+ D3DSURFACE_DESC desc;
+ surface->GetDesc(&desc);
+
+ RECT rect;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = desc.Width;
+ rect.bottom = desc.Height;
+
+ return rect;
+}
+
+bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
+{
+ IDirect3DTexture9 *texture = copySurfaceToTexture(source, getSurfaceRect(source));
+ if (!texture)
+ {
+ return false;
+ }
+
+ IDirect3DDevice9 *device = getDevice();
+
+ saveState();
+
+ device->SetTexture(0, texture);
+ device->SetRenderTarget(0, dest);
+
+ setVertexShader(SHADER_VS_STANDARD);
+ setPixelShader(SHADER_PS_PASSTHROUGH);
+
+ setCommonBlitState();
+ device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
+ device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
+
+ setViewport(getSurfaceRect(dest), 0, 0);
+
+ render();
+
+ texture->Release();
+
+ restoreState();
+
+ return true;
+}
+
+bool Blit::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
+{
+ IDirect3DTexture9 *texture = copySurfaceToTexture(source, sourceRect);
+ if (!texture)
+ {
+ return false;
+ }
+
+ IDirect3DDevice9 *device = getDevice();
+
+ saveState();
+
+ device->SetTexture(0, texture);
+ device->SetRenderTarget(0, dest);
+
+ setViewport(sourceRect, xoffset, yoffset);
+
+ setCommonBlitState();
+ if (setFormatConvertShaders(destFormat))
+ {
+ render();
+ }
+
+ texture->Release();
+
+ restoreState();
+
+ return true;
+}
+
+bool Blit::setFormatConvertShaders(GLenum destFormat)
+{
+ bool okay = setVertexShader(SHADER_VS_STANDARD);
+
+ switch (destFormat)
+ {
+ default: UNREACHABLE();
+ case GL_RGBA:
+ case GL_BGRA_EXT:
+ case GL_RGB:
+ case GL_ALPHA:
+ okay = okay && setPixelShader(SHADER_PS_COMPONENTMASK);
+ break;
+
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ okay = okay && setPixelShader(SHADER_PS_LUMINANCE);
+ break;
+ }
+
+ if (!okay)
+ {
+ return false;
+ }
+
+ enum { X = 0, Y = 1, Z = 2, W = 3 };
+
+ // The meaning of this constant depends on the shader that was selected.
+ // See the shader assembly code above for details.
+ float psConst0[4] = { 0, 0, 0, 0 };
+
+ switch (destFormat)
+ {
+ default: UNREACHABLE();
+ case GL_RGBA:
+ case GL_BGRA_EXT:
+ psConst0[X] = 1;
+ psConst0[Z] = 1;
+ break;
+
+ case GL_RGB:
+ psConst0[X] = 1;
+ psConst0[W] = 1;
+ break;
+
+ case GL_ALPHA:
+ psConst0[Z] = 1;
+ break;
+
+ case GL_LUMINANCE:
+ psConst0[Y] = 1;
+ break;
+
+ case GL_LUMINANCE_ALPHA:
+ psConst0[X] = 1;
+ break;
+ }
+
+ getDevice()->SetPixelShaderConstantF(0, psConst0, 1);
+
+ return true;
+}
+
+IDirect3DTexture9 *Blit::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect)
+{
+ if (!surface)
+ {
+ return NULL;
+ }
+
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+
+ D3DSURFACE_DESC sourceDesc;
+ surface->GetDesc(&sourceDesc);
+
+ // Copy the render target into a texture
+ IDirect3DTexture9 *texture;
+ HRESULT result = device->CreateTexture(sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
+ }
+
+ IDirect3DSurface9 *textureSurface;
+ result = texture->GetSurfaceLevel(0, &textureSurface);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ texture->Release();
+ return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
+ }
+
+ display->endScene();
+ result = device->StretchRect(surface, &sourceRect, textureSurface, NULL, D3DTEXF_NONE);
+
+ textureSurface->Release();
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ texture->Release();
+ return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
+ }
+
+ return texture;
+}
+
+void Blit::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset)
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ D3DVIEWPORT9 vp;
+ vp.X = xoffset;
+ vp.Y = yoffset;
+ vp.Width = sourceRect.right - sourceRect.left;
+ vp.Height = sourceRect.bottom - sourceRect.top;
+ vp.MinZ = 0.0f;
+ vp.MaxZ = 1.0f;
+ device->SetViewport(&vp);
+
+ float halfPixelAdjust[4] = { -1.0f/vp.Width, 1.0f/vp.Height, 0, 0 };
+ device->SetVertexShaderConstantF(0, halfPixelAdjust, 1);
+}
+
+void Blit::setCommonBlitState()
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ device->SetDepthStencilSurface(NULL);
+
+ device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+ device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
+ device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
+ device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+
+ device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_SRGBTEXTURE, FALSE);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+
+ RECT scissorRect = {0}; // Scissoring is disabled for flipping, but we need this to capture and restore the old rectangle
+ device->SetScissorRect(&scissorRect);
+}
+
+void Blit::render()
+{
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+
+ HRESULT hr = device->SetStreamSource(0, mQuadVertexBuffer, 0, 2 * sizeof(float));
+ hr = device->SetVertexDeclaration(mQuadVertexDeclaration);
+
+ display->startScene();
+ hr = device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
+}
+
+void Blit::saveState()
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ HRESULT hr;
+
+ device->GetDepthStencilSurface(&mSavedDepthStencil);
+ device->GetRenderTarget(0, &mSavedRenderTarget);
+
+ if (mSavedStateBlock == NULL)
+ {
+ hr = device->BeginStateBlock();
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+ setCommonBlitState();
+
+ static const float dummyConst[4] = { 0, 0, 0, 0 };
+
+ device->SetVertexShader(NULL);
+ device->SetVertexShaderConstantF(0, dummyConst, 1);
+ device->SetPixelShader(NULL);
+ device->SetPixelShaderConstantF(0, dummyConst, 1);
+
+ D3DVIEWPORT9 dummyVp;
+ dummyVp.X = 0;
+ dummyVp.Y = 0;
+ dummyVp.Width = 1;
+ dummyVp.Height = 1;
+ dummyVp.MinZ = 0;
+ dummyVp.MaxZ = 1;
+
+ device->SetViewport(&dummyVp);
+
+ device->SetTexture(0, NULL);
+
+ device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);
+
+ device->SetVertexDeclaration(mQuadVertexDeclaration);
+
+ hr = device->EndStateBlock(&mSavedStateBlock);
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+ }
+
+ ASSERT(mSavedStateBlock != NULL);
+
+ if (mSavedStateBlock != NULL)
+ {
+ hr = mSavedStateBlock->Capture();
+ ASSERT(SUCCEEDED(hr));
+ }
+}
+
+void Blit::restoreState()
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ device->SetDepthStencilSurface(mSavedDepthStencil);
+ if (mSavedDepthStencil != NULL)
+ {
+ mSavedDepthStencil->Release();
+ mSavedDepthStencil = NULL;
+ }
+
+ device->SetRenderTarget(0, mSavedRenderTarget);
+ if (mSavedRenderTarget != NULL)
+ {
+ mSavedRenderTarget->Release();
+ mSavedRenderTarget = NULL;
+ }
+
+ ASSERT(mSavedStateBlock != NULL);
+
+ if (mSavedStateBlock != NULL)
+ {
+ mSavedStateBlock->Apply();
+ }
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h
new file mode 100644
index 0000000..a83aac3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h
@@ -0,0 +1,90 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit.cpp: Surface copy utility class.
+
+#ifndef LIBGLESV2_BLIT_H_
+#define LIBGLESV2_BLIT_H_
+
+#include <map>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include <d3d9.h>
+
+#include "common/angleutils.h"
+
+namespace gl
+{
+class Context;
+
+class Blit
+{
+ public:
+ explicit Blit(Context *context);
+ ~Blit();
+
+ // Copy from source surface to dest surface.
+ // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
+ // source is interpreted as RGBA and destFormat specifies the desired result format. For example, if destFormat = GL_RGB, the alpha channel will be forced to 0.
+ bool formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest);
+
+ // 2x2 box filter sample from source to dest.
+ // Requires that source is RGB(A) and dest has the same format as source.
+ bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
+
+ private:
+ Context *mContext;
+
+ IDirect3DVertexBuffer9 *mQuadVertexBuffer;
+ IDirect3DVertexDeclaration9 *mQuadVertexDeclaration;
+
+ void initGeometry();
+
+ bool setFormatConvertShaders(GLenum destFormat);
+
+ IDirect3DTexture9 *copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect);
+ void setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset);
+ void setCommonBlitState();
+ RECT getSurfaceRect(IDirect3DSurface9 *surface) const;
+
+ // This enum is used to index mCompiledShaders and mShaderSource.
+ enum ShaderId
+ {
+ SHADER_VS_STANDARD,
+ SHADER_VS_FLIPY,
+ SHADER_PS_PASSTHROUGH,
+ SHADER_PS_LUMINANCE,
+ SHADER_PS_COMPONENTMASK,
+ SHADER_COUNT
+ };
+
+ static const char * const mShaderSource[];
+
+ // This actually contains IDirect3DVertexShader9 or IDirect3DPixelShader9 casted to IUnknown.
+ IUnknown *mCompiledShaders[SHADER_COUNT];
+
+ template <class D3DShaderType>
+ bool setShader(ShaderId source, const char *profile,
+ HRESULT (WINAPI IDirect3DDevice9::*createShader)(const DWORD *, D3DShaderType **),
+ HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*));
+
+ bool setVertexShader(ShaderId shader);
+ bool setPixelShader(ShaderId shader);
+ void render();
+
+ void saveState();
+ void restoreState();
+ IDirect3DStateBlock9 *mSavedStateBlock;
+ IDirect3DSurface9 *mSavedRenderTarget;
+ IDirect3DSurface9 *mSavedDepthStencil;
+
+ DISALLOW_COPY_AND_ASSIGN(Blit);
+};
+}
+
+#endif // LIBGLESV2_BLIT_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp
new file mode 100644
index 0000000..17cea6c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp
@@ -0,0 +1,106 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer.cpp: Implements the gl::Buffer class, representing storage of vertex and/or
+// index data. Implements GL buffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 2.9 page 21.
+
+#include "libGLESv2/Buffer.h"
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/geometry/VertexDataManager.h"
+#include "libGLESv2/geometry/IndexDataManager.h"
+
+namespace gl
+{
+
+Buffer::Buffer(GLuint id) : RefCountObject(id)
+{
+ mContents = NULL;
+ mSize = 0;
+ mUsage = GL_DYNAMIC_DRAW;
+
+ mVertexBuffer = NULL;
+ mIndexBuffer = NULL;
+}
+
+Buffer::~Buffer()
+{
+ delete[] mContents;
+ delete mVertexBuffer;
+ delete mIndexBuffer;
+}
+
+void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
+{
+ if (size == 0)
+ {
+ delete[] mContents;
+ mContents = NULL;
+ }
+ else if (size != mSize)
+ {
+ delete[] mContents;
+ mContents = new GLubyte[size];
+ memset(mContents, 0, size);
+ }
+
+ if (data != NULL && size > 0)
+ {
+ memcpy(mContents, data, size);
+ }
+
+ mSize = size;
+ mUsage = usage;
+
+ invalidateStaticData();
+
+ if (usage == GL_STATIC_DRAW)
+ {
+ mVertexBuffer = new StaticVertexBuffer(getDevice());
+ mIndexBuffer = new StaticIndexBuffer(getDevice());
+ }
+}
+
+void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
+{
+ memcpy(mContents + offset, data, size);
+
+ if ((mVertexBuffer && mVertexBuffer->size() != 0) || (mIndexBuffer && mIndexBuffer->size() != 0))
+ {
+ invalidateStaticData();
+
+ if (mUsage == GL_STATIC_DRAW)
+ {
+ // If applications update the buffer data after it has already been used in a draw call,
+ // it most likely isn't used as a static buffer so we should fall back to streaming usage
+ // for best performance. So ignore the usage hint and don't create new static buffers.
+ // mVertexBuffer = new StaticVertexBuffer(getDevice());
+ // mIndexBuffer = new StaticIndexBuffer(getDevice());
+ }
+ }
+}
+
+StaticVertexBuffer *Buffer::getVertexBuffer()
+{
+ return mVertexBuffer;
+}
+
+StaticIndexBuffer *Buffer::getIndexBuffer()
+{
+ return mIndexBuffer;
+}
+
+void Buffer::invalidateStaticData()
+{
+ delete mVertexBuffer;
+ mVertexBuffer = NULL;
+
+ delete mIndexBuffer;
+ mIndexBuffer = NULL;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h
new file mode 100644
index 0000000..c2ed60f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer.h: Defines the gl::Buffer class, representing storage of vertex and/or
+// index data. Implements GL buffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 2.9 page 21.
+
+#ifndef LIBGLESV2_BUFFER_H_
+#define LIBGLESV2_BUFFER_H_
+
+#include <cstddef>
+#include <vector>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include "common/angleutils.h"
+#include "libGLESv2/RefCountObject.h"
+
+namespace gl
+{
+class StaticVertexBuffer;
+class StaticIndexBuffer;
+
+class Buffer : public RefCountObject
+{
+ public:
+ explicit Buffer(GLuint id);
+
+ virtual ~Buffer();
+
+ void bufferData(const void *data, GLsizeiptr size, GLenum usage);
+ void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
+
+ void *data() { return mContents; }
+ size_t size() const { return mSize; }
+ GLenum usage() const { return mUsage; }
+
+ StaticVertexBuffer *getVertexBuffer();
+ StaticIndexBuffer *getIndexBuffer();
+ void invalidateStaticData();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Buffer);
+
+ GLubyte *mContents;
+ size_t mSize;
+ GLenum mUsage;
+
+ StaticVertexBuffer *mVertexBuffer;
+ StaticIndexBuffer *mIndexBuffer;
+};
+
+}
+
+#endif // LIBGLESV2_BUFFER_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp
new file mode 100644
index 0000000..9be59c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp
@@ -0,0 +1,3582 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Context.cpp: Implements the gl::Context class, managing all GL state and performing
+// rendering operations. It is the GLES2 specific implementation of EGLContext.
+
+#include "libGLESv2/Context.h"
+
+#include <algorithm>
+
+#include "libEGL/Display.h"
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/mathutil.h"
+#include "libGLESv2/utilities.h"
+#include "libGLESv2/Blit.h"
+#include "libGLESv2/ResourceManager.h"
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/Fence.h"
+#include "libGLESv2/FrameBuffer.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/RenderBuffer.h"
+#include "libGLESv2/Shader.h"
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/geometry/VertexDataManager.h"
+#include "libGLESv2/geometry/IndexDataManager.h"
+
+#undef near
+#undef far
+
+namespace gl
+{
+Context::Context(const egl::Config *config, const gl::Context *shareContext)
+ : mConfig(config)
+{
+ setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ mState.depthClearValue = 1.0f;
+ mState.stencilClearValue = 0;
+
+ mState.cullFace = false;
+ mState.cullMode = GL_BACK;
+ mState.frontFace = GL_CCW;
+ mState.depthTest = false;
+ mState.depthFunc = GL_LESS;
+ mState.blend = false;
+ mState.sourceBlendRGB = GL_ONE;
+ mState.sourceBlendAlpha = GL_ONE;
+ mState.destBlendRGB = GL_ZERO;
+ mState.destBlendAlpha = GL_ZERO;
+ mState.blendEquationRGB = GL_FUNC_ADD;
+ mState.blendEquationAlpha = GL_FUNC_ADD;
+ mState.blendColor.red = 0;
+ mState.blendColor.green = 0;
+ mState.blendColor.blue = 0;
+ mState.blendColor.alpha = 0;
+ mState.stencilTest = false;
+ mState.stencilFunc = GL_ALWAYS;
+ mState.stencilRef = 0;
+ mState.stencilMask = -1;
+ mState.stencilWritemask = -1;
+ mState.stencilBackFunc = GL_ALWAYS;
+ mState.stencilBackRef = 0;
+ mState.stencilBackMask = - 1;
+ mState.stencilBackWritemask = -1;
+ mState.stencilFail = GL_KEEP;
+ mState.stencilPassDepthFail = GL_KEEP;
+ mState.stencilPassDepthPass = GL_KEEP;
+ mState.stencilBackFail = GL_KEEP;
+ mState.stencilBackPassDepthFail = GL_KEEP;
+ mState.stencilBackPassDepthPass = GL_KEEP;
+ mState.polygonOffsetFill = false;
+ mState.polygonOffsetFactor = 0.0f;
+ mState.polygonOffsetUnits = 0.0f;
+ mState.sampleAlphaToCoverage = false;
+ mState.sampleCoverage = false;
+ mState.sampleCoverageValue = 1.0f;
+ mState.sampleCoverageInvert = false;
+ mState.scissorTest = false;
+ mState.dither = true;
+ mState.generateMipmapHint = GL_DONT_CARE;
+ mState.fragmentShaderDerivativeHint = GL_DONT_CARE;
+
+ mState.lineWidth = 1.0f;
+
+ mState.viewportX = 0;
+ mState.viewportY = 0;
+ mState.viewportWidth = config->mDisplayMode.Width;
+ mState.viewportHeight = config->mDisplayMode.Height;
+ mState.zNear = 0.0f;
+ mState.zFar = 1.0f;
+
+ mState.scissorX = 0;
+ mState.scissorY = 0;
+ mState.scissorWidth = config->mDisplayMode.Width;
+ mState.scissorHeight = config->mDisplayMode.Height;
+
+ mState.colorMaskRed = true;
+ mState.colorMaskGreen = true;
+ mState.colorMaskBlue = true;
+ mState.colorMaskAlpha = true;
+ mState.depthMask = true;
+
+ if (shareContext != NULL)
+ {
+ mResourceManager = shareContext->mResourceManager;
+ mResourceManager->addRef();
+ }
+ else
+ {
+ mResourceManager = new ResourceManager();
+ }
+
+ // [OpenGL ES 2.0.24] section 3.7 page 83:
+ // In the initial state, TEXTURE_2D and TEXTURE_CUBE_MAP have twodimensional
+ // and cube map texture state vectors respectively associated with them.
+ // In order that access to these initial textures not be lost, they are treated as texture
+ // objects all of whose names are 0.
+
+ mTexture2DZero.set(new Texture2D(0));
+ mTextureCubeMapZero.set(new TextureCubeMap(0));
+
+ mState.activeSampler = 0;
+ bindArrayBuffer(0);
+ bindElementArrayBuffer(0);
+ bindTextureCubeMap(0);
+ bindTexture2D(0);
+ bindReadFramebuffer(0);
+ bindDrawFramebuffer(0);
+ bindRenderbuffer(0);
+
+ mState.currentProgram = 0;
+
+ mState.packAlignment = 4;
+ mState.unpackAlignment = 4;
+
+ mVertexDataManager = NULL;
+ mIndexDataManager = NULL;
+ mBlit = NULL;
+
+ mInvalidEnum = false;
+ mInvalidValue = false;
+ mInvalidOperation = false;
+ mOutOfMemory = false;
+ mInvalidFramebufferOperation = false;
+
+ mHasBeenCurrent = false;
+
+ mSupportsCompressedTextures = false;
+ mSupportsEventQueries = false;
+ mMaxSupportedSamples = 0;
+ mMaskedClearSavedState = NULL;
+ markAllStateDirty();
+}
+
+Context::~Context()
+{
+ if (mState.currentProgram != 0)
+ {
+ Program *programObject = mResourceManager->getProgram(mState.currentProgram);
+ if (programObject)
+ {
+ programObject->release();
+ }
+ mState.currentProgram = 0;
+ }
+
+ while (!mFramebufferMap.empty())
+ {
+ deleteFramebuffer(mFramebufferMap.begin()->first);
+ }
+
+ while (!mFenceMap.empty())
+ {
+ deleteFence(mFenceMap.begin()->first);
+ }
+
+ while (!mMultiSampleSupport.empty())
+ {
+ delete [] mMultiSampleSupport.begin()->second;
+ mMultiSampleSupport.erase(mMultiSampleSupport.begin());
+ }
+
+ for (int type = 0; type < SAMPLER_TYPE_COUNT; type++)
+ {
+ for (int sampler = 0; sampler < MAX_TEXTURE_IMAGE_UNITS; sampler++)
+ {
+ mState.samplerTexture[type][sampler].set(NULL);
+ }
+ }
+
+ for (int type = 0; type < SAMPLER_TYPE_COUNT; type++)
+ {
+ mIncompleteTextures[type].set(NULL);
+ }
+
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ mState.vertexAttribute[i].mBoundBuffer.set(NULL);
+ }
+
+ mState.arrayBuffer.set(NULL);
+ mState.elementArrayBuffer.set(NULL);
+ mState.renderbuffer.set(NULL);
+
+ mTexture2DZero.set(NULL);
+ mTextureCubeMapZero.set(NULL);
+
+ delete mVertexDataManager;
+ delete mIndexDataManager;
+ delete mBlit;
+
+ if (mMaskedClearSavedState)
+ {
+ mMaskedClearSavedState->Release();
+ }
+
+ mResourceManager->release();
+}
+
+void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
+{
+ IDirect3DDevice9 *device = display->getDevice();
+
+ if (!mHasBeenCurrent)
+ {
+ mDeviceCaps = display->getDeviceCaps();
+
+ mVertexDataManager = new VertexDataManager(this, device);
+ mIndexDataManager = new IndexDataManager(this, device);
+ mBlit = new Blit(this);
+
+ mSupportsShaderModel3 = mDeviceCaps.PixelShaderVersion == D3DPS_VERSION(3, 0);
+
+ mMaxTextureDimension = std::min(std::min((int)mDeviceCaps.MaxTextureWidth, (int)mDeviceCaps.MaxTextureHeight),
+ (int)gl::IMPLEMENTATION_MAX_TEXTURE_SIZE);
+ mMaxCubeTextureDimension = std::min(mMaxTextureDimension, (int)gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE);
+ mMaxRenderbufferDimension = mMaxTextureDimension;
+ mMaxTextureLevel = log2(mMaxTextureDimension) + 1;
+ TRACE("MaxTextureDimension=%d, MaxCubeTextureDimension=%d, MaxRenderbufferDimension=%d, MaxTextureLevel=%d",
+ mMaxTextureDimension, mMaxCubeTextureDimension, mMaxRenderbufferDimension, mMaxTextureLevel);
+
+ const D3DFORMAT renderBufferFormats[] =
+ {
+ D3DFMT_A8R8G8B8,
+ D3DFMT_X8R8G8B8,
+ D3DFMT_R5G6B5,
+ D3DFMT_D24S8
+ };
+
+ int max = 0;
+ for (int i = 0; i < sizeof(renderBufferFormats) / sizeof(D3DFORMAT); ++i)
+ {
+ bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1];
+ display->getMultiSampleSupport(renderBufferFormats[i], multisampleArray);
+ mMultiSampleSupport[renderBufferFormats[i]] = multisampleArray;
+
+ for (int j = D3DMULTISAMPLE_16_SAMPLES; j >= 0; --j)
+ {
+ if (multisampleArray[j] && j != D3DMULTISAMPLE_NONMASKABLE && j > max)
+ {
+ max = j;
+ }
+ }
+ }
+
+ mMaxSupportedSamples = max;
+
+ mSupportsEventQueries = display->getEventQuerySupport();
+ mSupportsCompressedTextures = display->getCompressedTextureSupport();
+ mSupportsFloatTextures = display->getFloatTextureSupport(&mSupportsFloatLinearFilter, &mSupportsFloatRenderableTextures);
+ mSupportsHalfFloatTextures = display->getHalfFloatTextureSupport(&mSupportsHalfFloatLinearFilter, &mSupportsHalfFloatRenderableTextures);
+ mSupportsLuminanceTextures = display->getLuminanceTextureSupport();
+ mSupportsLuminanceAlphaTextures = display->getLuminanceAlphaTextureSupport();
+
+ mSupports32bitIndices = mDeviceCaps.MaxVertexIndex >= (1 << 16);
+
+ initExtensionString();
+
+ mState.viewportX = 0;
+ mState.viewportY = 0;
+ mState.viewportWidth = surface->getWidth();
+ mState.viewportHeight = surface->getHeight();
+
+ mState.scissorX = 0;
+ mState.scissorY = 0;
+ mState.scissorWidth = surface->getWidth();
+ mState.scissorHeight = surface->getHeight();
+
+ mHasBeenCurrent = true;
+ }
+
+ // Wrap the existing Direct3D 9 resources into GL objects and assign them to the '0' names
+ IDirect3DSurface9 *defaultRenderTarget = surface->getRenderTarget();
+ IDirect3DSurface9 *depthStencil = surface->getDepthStencil();
+
+ Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget);
+ DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil);
+ Framebuffer *framebufferZero = new DefaultFramebuffer(colorbufferZero, depthStencilbufferZero);
+
+ setFramebufferZero(framebufferZero);
+
+ if (defaultRenderTarget)
+ {
+ defaultRenderTarget->Release();
+ }
+
+ if (depthStencil)
+ {
+ depthStencil->Release();
+ }
+
+ markAllStateDirty();
+}
+
+// This function will set all of the state-related dirty flags, so that all state is set during next pre-draw.
+void Context::markAllStateDirty()
+{
+ mAppliedRenderTargetSerial = 0;
+ mAppliedDepthbufferSerial = 0;
+ mAppliedStencilbufferSerial = 0;
+ mDepthStencilInitialized = false;
+ mAppliedProgram = 0;
+
+ mClearStateDirty = true;
+ mCullStateDirty = true;
+ mDepthStateDirty = true;
+ mMaskStateDirty = true;
+ mBlendStateDirty = true;
+ mStencilStateDirty = true;
+ mPolygonOffsetStateDirty = true;
+ mScissorStateDirty = true;
+ mSampleStateDirty = true;
+ mDitherStateDirty = true;
+ mFrontFaceDirty = true;
+}
+
+void Context::setClearColor(float red, float green, float blue, float alpha)
+{
+ mState.colorClearValue.red = red;
+ mState.colorClearValue.green = green;
+ mState.colorClearValue.blue = blue;
+ mState.colorClearValue.alpha = alpha;
+}
+
+void Context::setClearDepth(float depth)
+{
+ mState.depthClearValue = depth;
+}
+
+void Context::setClearStencil(int stencil)
+{
+ mState.stencilClearValue = stencil;
+}
+
+void Context::setCullFace(bool enabled)
+{
+ if (mState.cullFace != enabled)
+ {
+ mState.cullFace = enabled;
+ mCullStateDirty = true;
+ }
+}
+
+bool Context::isCullFaceEnabled() const
+{
+ return mState.cullFace;
+}
+
+void Context::setCullMode(GLenum mode)
+{
+ if (mState.cullMode != mode)
+ {
+ mState.cullMode = mode;
+ mCullStateDirty = true;
+ }
+}
+
+void Context::setFrontFace(GLenum front)
+{
+ if (mState.frontFace != front)
+ {
+ mState.frontFace = front;
+ mFrontFaceDirty = true;
+ }
+}
+
+void Context::setDepthTest(bool enabled)
+{
+ if (mState.depthTest != enabled)
+ {
+ mState.depthTest = enabled;
+ mDepthStateDirty = true;
+ }
+}
+
+bool Context::isDepthTestEnabled() const
+{
+ return mState.depthTest;
+}
+
+void Context::setDepthFunc(GLenum depthFunc)
+{
+ if (mState.depthFunc != depthFunc)
+ {
+ mState.depthFunc = depthFunc;
+ mDepthStateDirty = true;
+ }
+}
+
+void Context::setDepthRange(float zNear, float zFar)
+{
+ mState.zNear = zNear;
+ mState.zFar = zFar;
+}
+
+void Context::setBlend(bool enabled)
+{
+ if (mState.blend != enabled)
+ {
+ mState.blend = enabled;
+ mBlendStateDirty = true;
+ }
+}
+
+bool Context::isBlendEnabled() const
+{
+ return mState.blend;
+}
+
+void Context::setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha)
+{
+ if (mState.sourceBlendRGB != sourceRGB ||
+ mState.sourceBlendAlpha != sourceAlpha ||
+ mState.destBlendRGB != destRGB ||
+ mState.destBlendAlpha != destAlpha)
+ {
+ mState.sourceBlendRGB = sourceRGB;
+ mState.destBlendRGB = destRGB;
+ mState.sourceBlendAlpha = sourceAlpha;
+ mState.destBlendAlpha = destAlpha;
+ mBlendStateDirty = true;
+ }
+}
+
+void Context::setBlendColor(float red, float green, float blue, float alpha)
+{
+ if (mState.blendColor.red != red ||
+ mState.blendColor.green != green ||
+ mState.blendColor.blue != blue ||
+ mState.blendColor.alpha != alpha)
+ {
+ mState.blendColor.red = red;
+ mState.blendColor.green = green;
+ mState.blendColor.blue = blue;
+ mState.blendColor.alpha = alpha;
+ mBlendStateDirty = true;
+ }
+}
+
+void Context::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation)
+{
+ if (mState.blendEquationRGB != rgbEquation ||
+ mState.blendEquationAlpha != alphaEquation)
+ {
+ mState.blendEquationRGB = rgbEquation;
+ mState.blendEquationAlpha = alphaEquation;
+ mBlendStateDirty = true;
+ }
+}
+
+void Context::setStencilTest(bool enabled)
+{
+ if (mState.stencilTest != enabled)
+ {
+ mState.stencilTest = enabled;
+ mStencilStateDirty = true;
+ }
+}
+
+bool Context::isStencilTestEnabled() const
+{
+ return mState.stencilTest;
+}
+
+void Context::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask)
+{
+ if (mState.stencilFunc != stencilFunc ||
+ mState.stencilRef != stencilRef ||
+ mState.stencilMask != stencilMask)
+ {
+ mState.stencilFunc = stencilFunc;
+ mState.stencilRef = (stencilRef > 0) ? stencilRef : 0;
+ mState.stencilMask = stencilMask;
+ mStencilStateDirty = true;
+ }
+}
+
+void Context::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask)
+{
+ if (mState.stencilBackFunc != stencilBackFunc ||
+ mState.stencilBackRef != stencilBackRef ||
+ mState.stencilBackMask != stencilBackMask)
+ {
+ mState.stencilBackFunc = stencilBackFunc;
+ mState.stencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0;
+ mState.stencilBackMask = stencilBackMask;
+ mStencilStateDirty = true;
+ }
+}
+
+void Context::setStencilWritemask(GLuint stencilWritemask)
+{
+ if (mState.stencilWritemask != stencilWritemask)
+ {
+ mState.stencilWritemask = stencilWritemask;
+ mStencilStateDirty = true;
+ }
+}
+
+void Context::setStencilBackWritemask(GLuint stencilBackWritemask)
+{
+ if (mState.stencilBackWritemask != stencilBackWritemask)
+ {
+ mState.stencilBackWritemask = stencilBackWritemask;
+ mStencilStateDirty = true;
+ }
+}
+
+void Context::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass)
+{
+ if (mState.stencilFail != stencilFail ||
+ mState.stencilPassDepthFail != stencilPassDepthFail ||
+ mState.stencilPassDepthPass != stencilPassDepthPass)
+ {
+ mState.stencilFail = stencilFail;
+ mState.stencilPassDepthFail = stencilPassDepthFail;
+ mState.stencilPassDepthPass = stencilPassDepthPass;
+ mStencilStateDirty = true;
+ }
+}
+
+void Context::setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass)
+{
+ if (mState.stencilBackFail != stencilBackFail ||
+ mState.stencilBackPassDepthFail != stencilBackPassDepthFail ||
+ mState.stencilBackPassDepthPass != stencilBackPassDepthPass)
+ {
+ mState.stencilBackFail = stencilBackFail;
+ mState.stencilBackPassDepthFail = stencilBackPassDepthFail;
+ mState.stencilBackPassDepthPass = stencilBackPassDepthPass;
+ mStencilStateDirty = true;
+ }
+}
+
+void Context::setPolygonOffsetFill(bool enabled)
+{
+ if (mState.polygonOffsetFill != enabled)
+ {
+ mState.polygonOffsetFill = enabled;
+ mPolygonOffsetStateDirty = true;
+ }
+}
+
+bool Context::isPolygonOffsetFillEnabled() const
+{
+ return mState.polygonOffsetFill;
+
+}
+
+void Context::setPolygonOffsetParams(GLfloat factor, GLfloat units)
+{
+ if (mState.polygonOffsetFactor != factor ||
+ mState.polygonOffsetUnits != units)
+ {
+ mState.polygonOffsetFactor = factor;
+ mState.polygonOffsetUnits = units;
+ mPolygonOffsetStateDirty = true;
+ }
+}
+
+void Context::setSampleAlphaToCoverage(bool enabled)
+{
+ if (mState.sampleAlphaToCoverage != enabled)
+ {
+ mState.sampleAlphaToCoverage = enabled;
+ mSampleStateDirty = true;
+ }
+}
+
+bool Context::isSampleAlphaToCoverageEnabled() const
+{
+ return mState.sampleAlphaToCoverage;
+}
+
+void Context::setSampleCoverage(bool enabled)
+{
+ if (mState.sampleCoverage != enabled)
+ {
+ mState.sampleCoverage = enabled;
+ mSampleStateDirty = true;
+ }
+}
+
+bool Context::isSampleCoverageEnabled() const
+{
+ return mState.sampleCoverage;
+}
+
+void Context::setSampleCoverageParams(GLclampf value, bool invert)
+{
+ if (mState.sampleCoverageValue != value ||
+ mState.sampleCoverageInvert != invert)
+ {
+ mState.sampleCoverageValue = value;
+ mState.sampleCoverageInvert = invert;
+ mSampleStateDirty = true;
+ }
+}
+
+void Context::setScissorTest(bool enabled)
+{
+ if (mState.scissorTest != enabled)
+ {
+ mState.scissorTest = enabled;
+ mScissorStateDirty = true;
+ }
+}
+
+bool Context::isScissorTestEnabled() const
+{
+ return mState.scissorTest;
+}
+
+void Context::setDither(bool enabled)
+{
+ if (mState.dither != enabled)
+ {
+ mState.dither = enabled;
+ mDitherStateDirty = true;
+ }
+}
+
+bool Context::isDitherEnabled() const
+{
+ return mState.dither;
+}
+
+void Context::setLineWidth(GLfloat width)
+{
+ mState.lineWidth = width;
+}
+
+void Context::setGenerateMipmapHint(GLenum hint)
+{
+ mState.generateMipmapHint = hint;
+}
+
+void Context::setFragmentShaderDerivativeHint(GLenum hint)
+{
+ mState.fragmentShaderDerivativeHint = hint;
+ // TODO: Propagate the hint to shader translator so we can write
+ // ddx, ddx_coarse, or ddx_fine depending on the hint.
+ // Ignore for now. It is valid for implementations to ignore hint.
+}
+
+void Context::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ mState.viewportX = x;
+ mState.viewportY = y;
+ mState.viewportWidth = width;
+ mState.viewportHeight = height;
+}
+
+void Context::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ if (mState.scissorX != x || mState.scissorY != y ||
+ mState.scissorWidth != width || mState.scissorHeight != height)
+ {
+ mState.scissorX = x;
+ mState.scissorY = y;
+ mState.scissorWidth = width;
+ mState.scissorHeight = height;
+ mScissorStateDirty = true;
+ }
+}
+
+void Context::setColorMask(bool red, bool green, bool blue, bool alpha)
+{
+ if (mState.colorMaskRed != red || mState.colorMaskGreen != green ||
+ mState.colorMaskBlue != blue || mState.colorMaskAlpha != alpha)
+ {
+ mState.colorMaskRed = red;
+ mState.colorMaskGreen = green;
+ mState.colorMaskBlue = blue;
+ mState.colorMaskAlpha = alpha;
+ mMaskStateDirty = true;
+ }
+}
+
+void Context::setDepthMask(bool mask)
+{
+ if (mState.depthMask != mask)
+ {
+ mState.depthMask = mask;
+ mMaskStateDirty = true;
+ }
+}
+
+void Context::setActiveSampler(int active)
+{
+ mState.activeSampler = active;
+}
+
+GLuint Context::getReadFramebufferHandle() const
+{
+ return mState.readFramebuffer;
+}
+
+GLuint Context::getDrawFramebufferHandle() const
+{
+ return mState.drawFramebuffer;
+}
+
+GLuint Context::getRenderbufferHandle() const
+{
+ return mState.renderbuffer.id();
+}
+
+GLuint Context::getArrayBufferHandle() const
+{
+ return mState.arrayBuffer.id();
+}
+
+void Context::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
+{
+ mState.vertexAttribute[attribNum].mArrayEnabled = enabled;
+}
+
+const VertexAttribute &Context::getVertexAttribState(unsigned int attribNum)
+{
+ return mState.vertexAttribute[attribNum];
+}
+
+void Context::setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
+ GLsizei stride, const void *pointer)
+{
+ mState.vertexAttribute[attribNum].mBoundBuffer.set(boundBuffer);
+ mState.vertexAttribute[attribNum].mSize = size;
+ mState.vertexAttribute[attribNum].mType = type;
+ mState.vertexAttribute[attribNum].mNormalized = normalized;
+ mState.vertexAttribute[attribNum].mStride = stride;
+ mState.vertexAttribute[attribNum].mPointer = pointer;
+}
+
+const void *Context::getVertexAttribPointer(unsigned int attribNum) const
+{
+ return mState.vertexAttribute[attribNum].mPointer;
+}
+
+const VertexAttributeArray &Context::getVertexAttributes()
+{
+ return mState.vertexAttribute;
+}
+
+void Context::setPackAlignment(GLint alignment)
+{
+ mState.packAlignment = alignment;
+}
+
+GLint Context::getPackAlignment() const
+{
+ return mState.packAlignment;
+}
+
+void Context::setUnpackAlignment(GLint alignment)
+{
+ mState.unpackAlignment = alignment;
+}
+
+GLint Context::getUnpackAlignment() const
+{
+ return mState.unpackAlignment;
+}
+
+GLuint Context::createBuffer()
+{
+ return mResourceManager->createBuffer();
+}
+
+GLuint Context::createProgram()
+{
+ return mResourceManager->createProgram();
+}
+
+GLuint Context::createShader(GLenum type)
+{
+ return mResourceManager->createShader(type);
+}
+
+GLuint Context::createTexture()
+{
+ return mResourceManager->createTexture();
+}
+
+GLuint Context::createRenderbuffer()
+{
+ return mResourceManager->createRenderbuffer();
+}
+
+// Returns an unused framebuffer name
+GLuint Context::createFramebuffer()
+{
+ unsigned int handle = 1;
+
+ while (mFramebufferMap.find(handle) != mFramebufferMap.end())
+ {
+ handle++;
+ }
+
+ mFramebufferMap[handle] = NULL;
+
+ return handle;
+}
+
+GLuint Context::createFence()
+{
+ unsigned int handle = 0;
+
+ while (mFenceMap.find(handle) != mFenceMap.end())
+ {
+ handle++;
+ }
+
+ mFenceMap[handle] = new Fence;
+
+ return handle;
+}
+
+void Context::deleteBuffer(GLuint buffer)
+{
+ if (mResourceManager->getBuffer(buffer))
+ {
+ detachBuffer(buffer);
+ }
+
+ mResourceManager->deleteBuffer(buffer);
+}
+
+void Context::deleteShader(GLuint shader)
+{
+ mResourceManager->deleteShader(shader);
+}
+
+void Context::deleteProgram(GLuint program)
+{
+ mResourceManager->deleteProgram(program);
+}
+
+void Context::deleteTexture(GLuint texture)
+{
+ if (mResourceManager->getTexture(texture))
+ {
+ detachTexture(texture);
+ }
+
+ mResourceManager->deleteTexture(texture);
+}
+
+void Context::deleteRenderbuffer(GLuint renderbuffer)
+{
+ if (mResourceManager->getRenderbuffer(renderbuffer))
+ {
+ detachRenderbuffer(renderbuffer);
+ }
+
+ mResourceManager->deleteRenderbuffer(renderbuffer);
+}
+
+void Context::deleteFramebuffer(GLuint framebuffer)
+{
+ FramebufferMap::iterator framebufferObject = mFramebufferMap.find(framebuffer);
+
+ if (framebufferObject != mFramebufferMap.end())
+ {
+ detachFramebuffer(framebuffer);
+
+ delete framebufferObject->second;
+ mFramebufferMap.erase(framebufferObject);
+ }
+}
+
+void Context::deleteFence(GLuint fence)
+{
+ FenceMap::iterator fenceObject = mFenceMap.find(fence);
+
+ if (fenceObject != mFenceMap.end())
+ {
+ delete fenceObject->second;
+ mFenceMap.erase(fenceObject);
+ }
+}
+
+Buffer *Context::getBuffer(GLuint handle)
+{
+ return mResourceManager->getBuffer(handle);
+}
+
+Shader *Context::getShader(GLuint handle)
+{
+ return mResourceManager->getShader(handle);
+}
+
+Program *Context::getProgram(GLuint handle)
+{
+ return mResourceManager->getProgram(handle);
+}
+
+Texture *Context::getTexture(GLuint handle)
+{
+ return mResourceManager->getTexture(handle);
+}
+
+Renderbuffer *Context::getRenderbuffer(GLuint handle)
+{
+ return mResourceManager->getRenderbuffer(handle);
+}
+
+Framebuffer *Context::getReadFramebuffer()
+{
+ return getFramebuffer(mState.readFramebuffer);
+}
+
+Framebuffer *Context::getDrawFramebuffer()
+{
+ return getFramebuffer(mState.drawFramebuffer);
+}
+
+void Context::bindArrayBuffer(unsigned int buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.arrayBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindElementArrayBuffer(unsigned int buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.elementArrayBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindTexture2D(GLuint texture)
+{
+ mResourceManager->checkTextureAllocation(texture, SAMPLER_2D);
+
+ mState.samplerTexture[SAMPLER_2D][mState.activeSampler].set(getTexture(texture));
+}
+
+void Context::bindTextureCubeMap(GLuint texture)
+{
+ mResourceManager->checkTextureAllocation(texture, SAMPLER_CUBE);
+
+ mState.samplerTexture[SAMPLER_CUBE][mState.activeSampler].set(getTexture(texture));
+}
+
+void Context::bindReadFramebuffer(GLuint framebuffer)
+{
+ if (!getFramebuffer(framebuffer))
+ {
+ mFramebufferMap[framebuffer] = new Framebuffer();
+ }
+
+ mState.readFramebuffer = framebuffer;
+}
+
+void Context::bindDrawFramebuffer(GLuint framebuffer)
+{
+ if (!getFramebuffer(framebuffer))
+ {
+ mFramebufferMap[framebuffer] = new Framebuffer();
+ }
+
+ mState.drawFramebuffer = framebuffer;
+}
+
+void Context::bindRenderbuffer(GLuint renderbuffer)
+{
+ mResourceManager->checkRenderbufferAllocation(renderbuffer);
+
+ mState.renderbuffer.set(getRenderbuffer(renderbuffer));
+}
+
+void Context::useProgram(GLuint program)
+{
+ GLuint priorProgram = mState.currentProgram;
+ mState.currentProgram = program; // Must switch before trying to delete, otherwise it only gets flagged.
+
+ if (priorProgram != program)
+ {
+ Program *newProgram = mResourceManager->getProgram(program);
+ Program *oldProgram = mResourceManager->getProgram(priorProgram);
+
+ if (newProgram)
+ {
+ newProgram->addRef();
+ }
+
+ if (oldProgram)
+ {
+ oldProgram->release();
+ }
+ }
+}
+
+void Context::setFramebufferZero(Framebuffer *buffer)
+{
+ delete mFramebufferMap[0];
+ mFramebufferMap[0] = buffer;
+}
+
+void Context::setRenderbufferStorage(RenderbufferStorage *renderbuffer)
+{
+ Renderbuffer *renderbufferObject = mState.renderbuffer.get();
+ renderbufferObject->setStorage(renderbuffer);
+}
+
+Framebuffer *Context::getFramebuffer(unsigned int handle)
+{
+ FramebufferMap::iterator framebuffer = mFramebufferMap.find(handle);
+
+ if (framebuffer == mFramebufferMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return framebuffer->second;
+ }
+}
+
+Fence *Context::getFence(unsigned int handle)
+{
+ FenceMap::iterator fence = mFenceMap.find(handle);
+
+ if (fence == mFenceMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return fence->second;
+ }
+}
+
+Buffer *Context::getArrayBuffer()
+{
+ return mState.arrayBuffer.get();
+}
+
+Buffer *Context::getElementArrayBuffer()
+{
+ return mState.elementArrayBuffer.get();
+}
+
+Program *Context::getCurrentProgram()
+{
+ return mResourceManager->getProgram(mState.currentProgram);
+}
+
+Texture2D *Context::getTexture2D()
+{
+ return static_cast<Texture2D*>(getSamplerTexture(mState.activeSampler, SAMPLER_2D));
+}
+
+TextureCubeMap *Context::getTextureCubeMap()
+{
+ return static_cast<TextureCubeMap*>(getSamplerTexture(mState.activeSampler, SAMPLER_CUBE));
+}
+
+Texture *Context::getSamplerTexture(unsigned int sampler, SamplerType type)
+{
+ GLuint texid = mState.samplerTexture[type][sampler].id();
+
+ if (texid == 0) // Special case: 0 refers to different initial textures based on the target
+ {
+ switch (type)
+ {
+ default: UNREACHABLE();
+ case SAMPLER_2D: return mTexture2DZero.get();
+ case SAMPLER_CUBE: return mTextureCubeMapZero.get();
+ }
+ }
+
+ return mState.samplerTexture[type][sampler].get();
+}
+
+bool Context::getBooleanv(GLenum pname, GLboolean *params)
+{
+ switch (pname)
+ {
+ case GL_SHADER_COMPILER: *params = GL_TRUE; break;
+ case GL_SAMPLE_COVERAGE_INVERT: *params = mState.sampleCoverageInvert; break;
+ case GL_DEPTH_WRITEMASK: *params = mState.depthMask; break;
+ case GL_COLOR_WRITEMASK:
+ params[0] = mState.colorMaskRed;
+ params[1] = mState.colorMaskGreen;
+ params[2] = mState.colorMaskBlue;
+ params[3] = mState.colorMaskAlpha;
+ break;
+ case GL_CULL_FACE: *params = mState.cullFace; break;
+ case GL_POLYGON_OFFSET_FILL: *params = mState.polygonOffsetFill; break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: *params = mState.sampleAlphaToCoverage; break;
+ case GL_SAMPLE_COVERAGE: *params = mState.sampleCoverage; break;
+ case GL_SCISSOR_TEST: *params = mState.scissorTest; break;
+ case GL_STENCIL_TEST: *params = mState.stencilTest; break;
+ case GL_DEPTH_TEST: *params = mState.depthTest; break;
+ case GL_BLEND: *params = mState.blend; break;
+ case GL_DITHER: *params = mState.dither; break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool Context::getFloatv(GLenum pname, GLfloat *params)
+{
+ // Please note: DEPTH_CLEAR_VALUE is included in our internal getFloatv implementation
+ // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
+ // GetIntegerv as its native query function. As it would require conversion in any
+ // case, this should make no difference to the calling application.
+ switch (pname)
+ {
+ case GL_LINE_WIDTH: *params = mState.lineWidth; break;
+ case GL_SAMPLE_COVERAGE_VALUE: *params = mState.sampleCoverageValue; break;
+ case GL_DEPTH_CLEAR_VALUE: *params = mState.depthClearValue; break;
+ case GL_POLYGON_OFFSET_FACTOR: *params = mState.polygonOffsetFactor; break;
+ case GL_POLYGON_OFFSET_UNITS: *params = mState.polygonOffsetUnits; break;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ params[0] = gl::ALIASED_LINE_WIDTH_RANGE_MIN;
+ params[1] = gl::ALIASED_LINE_WIDTH_RANGE_MAX;
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ params[0] = gl::ALIASED_POINT_SIZE_RANGE_MIN;
+ params[1] = supportsShaderModel3() ? gl::ALIASED_POINT_SIZE_RANGE_MAX_SM3 : gl::ALIASED_POINT_SIZE_RANGE_MAX_SM2;
+ break;
+ case GL_DEPTH_RANGE:
+ params[0] = mState.zNear;
+ params[1] = mState.zFar;
+ break;
+ case GL_COLOR_CLEAR_VALUE:
+ params[0] = mState.colorClearValue.red;
+ params[1] = mState.colorClearValue.green;
+ params[2] = mState.colorClearValue.blue;
+ params[3] = mState.colorClearValue.alpha;
+ break;
+ case GL_BLEND_COLOR:
+ params[0] = mState.blendColor.red;
+ params[1] = mState.blendColor.green;
+ params[2] = mState.blendColor.blue;
+ params[3] = mState.blendColor.alpha;
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool Context::getIntegerv(GLenum pname, GLint *params)
+{
+ // Please note: DEPTH_CLEAR_VALUE is not included in our internal getIntegerv implementation
+ // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
+ // GetIntegerv as its native query function. As it would require conversion in any
+ // case, this should make no difference to the calling application. You may find it in
+ // Context::getFloatv.
+ switch (pname)
+ {
+ case GL_MAX_VERTEX_ATTRIBS: *params = gl::MAX_VERTEX_ATTRIBS; break;
+ case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = gl::MAX_VERTEX_UNIFORM_VECTORS; break;
+ case GL_MAX_VARYING_VECTORS: *params = getMaximumVaryingVectors(); break;
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = gl::MAX_COMBINED_TEXTURE_IMAGE_UNITS; break;
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = gl::MAX_VERTEX_TEXTURE_IMAGE_UNITS; break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS: *params = gl::MAX_TEXTURE_IMAGE_UNITS; break;
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = getMaximumFragmentUniformVectors(); break;
+ case GL_MAX_RENDERBUFFER_SIZE: *params = getMaximumRenderbufferDimension(); break;
+ case GL_NUM_SHADER_BINARY_FORMATS: *params = 0; break;
+ case GL_SHADER_BINARY_FORMATS: /* no shader binary formats are supported */ break;
+ case GL_ARRAY_BUFFER_BINDING: *params = mState.arrayBuffer.id(); break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING: *params = mState.elementArrayBuffer.id(); break;
+ //case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
+ case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: *params = mState.drawFramebuffer; break;
+ case GL_READ_FRAMEBUFFER_BINDING_ANGLE: *params = mState.readFramebuffer; break;
+ case GL_RENDERBUFFER_BINDING: *params = mState.renderbuffer.id(); break;
+ case GL_CURRENT_PROGRAM: *params = mState.currentProgram; break;
+ case GL_PACK_ALIGNMENT: *params = mState.packAlignment; break;
+ case GL_UNPACK_ALIGNMENT: *params = mState.unpackAlignment; break;
+ case GL_GENERATE_MIPMAP_HINT: *params = mState.generateMipmapHint; break;
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mState.fragmentShaderDerivativeHint; break;
+ case GL_ACTIVE_TEXTURE: *params = (mState.activeSampler + GL_TEXTURE0); break;
+ case GL_STENCIL_FUNC: *params = mState.stencilFunc; break;
+ case GL_STENCIL_REF: *params = mState.stencilRef; break;
+ case GL_STENCIL_VALUE_MASK: *params = mState.stencilMask; break;
+ case GL_STENCIL_BACK_FUNC: *params = mState.stencilBackFunc; break;
+ case GL_STENCIL_BACK_REF: *params = mState.stencilBackRef; break;
+ case GL_STENCIL_BACK_VALUE_MASK: *params = mState.stencilBackMask; break;
+ case GL_STENCIL_FAIL: *params = mState.stencilFail; break;
+ case GL_STENCIL_PASS_DEPTH_FAIL: *params = mState.stencilPassDepthFail; break;
+ case GL_STENCIL_PASS_DEPTH_PASS: *params = mState.stencilPassDepthPass; break;
+ case GL_STENCIL_BACK_FAIL: *params = mState.stencilBackFail; break;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *params = mState.stencilBackPassDepthFail; break;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS: *params = mState.stencilBackPassDepthPass; break;
+ case GL_DEPTH_FUNC: *params = mState.depthFunc; break;
+ case GL_BLEND_SRC_RGB: *params = mState.sourceBlendRGB; break;
+ case GL_BLEND_SRC_ALPHA: *params = mState.sourceBlendAlpha; break;
+ case GL_BLEND_DST_RGB: *params = mState.destBlendRGB; break;
+ case GL_BLEND_DST_ALPHA: *params = mState.destBlendAlpha; break;
+ case GL_BLEND_EQUATION_RGB: *params = mState.blendEquationRGB; break;
+ case GL_BLEND_EQUATION_ALPHA: *params = mState.blendEquationAlpha; break;
+ case GL_STENCIL_WRITEMASK: *params = mState.stencilWritemask; break;
+ case GL_STENCIL_BACK_WRITEMASK: *params = mState.stencilBackWritemask; break;
+ case GL_STENCIL_CLEAR_VALUE: *params = mState.stencilClearValue; break;
+ case GL_SUBPIXEL_BITS: *params = 4; break;
+ case GL_MAX_TEXTURE_SIZE: *params = getMaximumTextureDimension(); break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *params = getMaximumCubeTextureDimension(); break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+ {
+ if (supportsCompressedTextures())
+ {
+ // at current, only GL_COMPRESSED_RGB_S3TC_DXT1_EXT and
+ // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT are supported
+ *params = 2;
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_MAX_SAMPLES_ANGLE:
+ {
+ GLsizei maxSamples = getMaxSupportedSamples();
+ if (maxSamples != 0)
+ {
+ *params = maxSamples;
+ }
+ else
+ {
+ return false;
+ }
+
+ break;
+ }
+ case GL_SAMPLE_BUFFERS:
+ case GL_SAMPLES:
+ {
+ gl::Framebuffer *framebuffer = getDrawFramebuffer();
+ if (framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
+ {
+ switch (pname)
+ {
+ case GL_SAMPLE_BUFFERS:
+ if (framebuffer->getSamples() != 0)
+ {
+ *params = 1;
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_SAMPLES:
+ *params = framebuffer->getSamples();
+ break;
+ }
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE: *params = gl::IMPLEMENTATION_COLOR_READ_TYPE; break;
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT: *params = gl::IMPLEMENTATION_COLOR_READ_FORMAT; break;
+ case GL_MAX_VIEWPORT_DIMS:
+ {
+ int maxDimension = std::max(getMaximumRenderbufferDimension(), getMaximumTextureDimension());
+ params[0] = maxDimension;
+ params[1] = maxDimension;
+ }
+ break;
+ case GL_COMPRESSED_TEXTURE_FORMATS:
+ {
+ if (supportsCompressedTextures())
+ {
+ params[0] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+ params[1] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
+ }
+ }
+ break;
+ case GL_VIEWPORT:
+ params[0] = mState.viewportX;
+ params[1] = mState.viewportY;
+ params[2] = mState.viewportWidth;
+ params[3] = mState.viewportHeight;
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = mState.scissorX;
+ params[1] = mState.scissorY;
+ params[2] = mState.scissorWidth;
+ params[3] = mState.scissorHeight;
+ break;
+ case GL_CULL_FACE_MODE: *params = mState.cullMode; break;
+ case GL_FRONT_FACE: *params = mState.frontFace; break;
+ case GL_RED_BITS:
+ case GL_GREEN_BITS:
+ case GL_BLUE_BITS:
+ case GL_ALPHA_BITS:
+ {
+ gl::Framebuffer *framebuffer = getDrawFramebuffer();
+ gl::Colorbuffer *colorbuffer = framebuffer->getColorbuffer();
+
+ if (colorbuffer)
+ {
+ switch (pname)
+ {
+ case GL_RED_BITS: *params = colorbuffer->getRedSize(); break;
+ case GL_GREEN_BITS: *params = colorbuffer->getGreenSize(); break;
+ case GL_BLUE_BITS: *params = colorbuffer->getBlueSize(); break;
+ case GL_ALPHA_BITS: *params = colorbuffer->getAlphaSize(); break;
+ }
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_DEPTH_BITS:
+ {
+ gl::Framebuffer *framebuffer = getDrawFramebuffer();
+ gl::DepthStencilbuffer *depthbuffer = framebuffer->getDepthbuffer();
+
+ if (depthbuffer)
+ {
+ *params = depthbuffer->getDepthSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_STENCIL_BITS:
+ {
+ gl::Framebuffer *framebuffer = getDrawFramebuffer();
+ gl::DepthStencilbuffer *stencilbuffer = framebuffer->getStencilbuffer();
+
+ if (stencilbuffer)
+ {
+ *params = stencilbuffer->getStencilSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ {
+ if (mState.activeSampler < 0 || mState.activeSampler > gl::MAX_TEXTURE_IMAGE_UNITS - 1)
+ {
+ error(GL_INVALID_OPERATION);
+ return false;
+ }
+
+ *params = mState.samplerTexture[SAMPLER_2D][mState.activeSampler].id();
+ }
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP:
+ {
+ if (mState.activeSampler < 0 || mState.activeSampler > gl::MAX_TEXTURE_IMAGE_UNITS - 1)
+ {
+ error(GL_INVALID_OPERATION);
+ return false;
+ }
+
+ *params = mState.samplerTexture[SAMPLER_CUBE][mState.activeSampler].id();
+ }
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
+{
+ // Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
+ // is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due
+ // to the fact that it is stored internally as a float, and so would require conversion
+ // if returned from Context::getIntegerv. Since this conversion is already implemented
+ // in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we
+ // place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling
+ // application.
+ switch (pname)
+ {
+ case GL_COMPRESSED_TEXTURE_FORMATS: /* no compressed texture formats are supported */
+ case GL_SHADER_BINARY_FORMATS:
+ {
+ *type = GL_INT;
+ *numParams = 0;
+ }
+ break;
+ case GL_MAX_VERTEX_ATTRIBS:
+ case GL_MAX_VERTEX_UNIFORM_VECTORS:
+ case GL_MAX_VARYING_VECTORS:
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+ case GL_MAX_TEXTURE_IMAGE_UNITS:
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+ case GL_MAX_RENDERBUFFER_SIZE:
+ case GL_NUM_SHADER_BINARY_FORMATS:
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+ case GL_ARRAY_BUFFER_BINDING:
+ case GL_FRAMEBUFFER_BINDING:
+ case GL_RENDERBUFFER_BINDING:
+ case GL_CURRENT_PROGRAM:
+ case GL_PACK_ALIGNMENT:
+ case GL_UNPACK_ALIGNMENT:
+ case GL_GENERATE_MIPMAP_HINT:
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+ case GL_RED_BITS:
+ case GL_GREEN_BITS:
+ case GL_BLUE_BITS:
+ case GL_ALPHA_BITS:
+ case GL_DEPTH_BITS:
+ case GL_STENCIL_BITS:
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING:
+ case GL_CULL_FACE_MODE:
+ case GL_FRONT_FACE:
+ case GL_ACTIVE_TEXTURE:
+ case GL_STENCIL_FUNC:
+ case GL_STENCIL_VALUE_MASK:
+ case GL_STENCIL_REF:
+ case GL_STENCIL_FAIL:
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ case GL_STENCIL_BACK_FUNC:
+ case GL_STENCIL_BACK_VALUE_MASK:
+ case GL_STENCIL_BACK_REF:
+ case GL_STENCIL_BACK_FAIL:
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ case GL_DEPTH_FUNC:
+ case GL_BLEND_SRC_RGB:
+ case GL_BLEND_SRC_ALPHA:
+ case GL_BLEND_DST_RGB:
+ case GL_BLEND_DST_ALPHA:
+ case GL_BLEND_EQUATION_RGB:
+ case GL_BLEND_EQUATION_ALPHA:
+ case GL_STENCIL_WRITEMASK:
+ case GL_STENCIL_BACK_WRITEMASK:
+ case GL_STENCIL_CLEAR_VALUE:
+ case GL_SUBPIXEL_BITS:
+ case GL_MAX_TEXTURE_SIZE:
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
+ case GL_SAMPLE_BUFFERS:
+ case GL_SAMPLES:
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_CUBE_MAP:
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ }
+ break;
+ case GL_MAX_SAMPLES_ANGLE:
+ {
+ if (getMaxSupportedSamples() != 0)
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ {
+ *type = GL_INT;
+ *numParams = 2;
+ }
+ break;
+ case GL_VIEWPORT:
+ case GL_SCISSOR_BOX:
+ {
+ *type = GL_INT;
+ *numParams = 4;
+ }
+ break;
+ case GL_SHADER_COMPILER:
+ case GL_SAMPLE_COVERAGE_INVERT:
+ case GL_DEPTH_WRITEMASK:
+ case GL_CULL_FACE: // CULL_FACE through DITHER are natural to IsEnabled,
+ case GL_POLYGON_OFFSET_FILL: // but can be retrieved through the Get{Type}v queries.
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: // For this purpose, they are treated here as bool-natural
+ case GL_SAMPLE_COVERAGE:
+ case GL_SCISSOR_TEST:
+ case GL_STENCIL_TEST:
+ case GL_DEPTH_TEST:
+ case GL_BLEND:
+ case GL_DITHER:
+ {
+ *type = GL_BOOL;
+ *numParams = 1;
+ }
+ break;
+ case GL_COLOR_WRITEMASK:
+ {
+ *type = GL_BOOL;
+ *numParams = 4;
+ }
+ break;
+ case GL_POLYGON_OFFSET_FACTOR:
+ case GL_POLYGON_OFFSET_UNITS:
+ case GL_SAMPLE_COVERAGE_VALUE:
+ case GL_DEPTH_CLEAR_VALUE:
+ case GL_LINE_WIDTH:
+ {
+ *type = GL_FLOAT;
+ *numParams = 1;
+ }
+ break;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ case GL_DEPTH_RANGE:
+ {
+ *type = GL_FLOAT;
+ *numParams = 2;
+ }
+ break;
+ case GL_COLOR_CLEAR_VALUE:
+ case GL_BLEND_COLOR:
+ {
+ *type = GL_FLOAT;
+ *numParams = 4;
+ }
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+// Applies the render target surface, depth stencil surface, viewport rectangle and
+// scissor rectangle to the Direct3D 9 device
+bool Context::applyRenderTarget(bool ignoreViewport)
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ Framebuffer *framebufferObject = getDrawFramebuffer();
+
+ if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ error(GL_INVALID_FRAMEBUFFER_OPERATION);
+
+ return false;
+ }
+
+ IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
+
+ if (!renderTarget)
+ {
+ return false; // Context must be lost
+ }
+
+ IDirect3DSurface9 *depthStencil = NULL;
+
+ unsigned int renderTargetSerial = framebufferObject->getRenderTargetSerial();
+ if (renderTargetSerial != mAppliedRenderTargetSerial)
+ {
+ device->SetRenderTarget(0, renderTarget);
+ mAppliedRenderTargetSerial = renderTargetSerial;
+ mScissorStateDirty = true; // Scissor area must be clamped to render target's size-- this is different for different render targets.
+ }
+
+ unsigned int depthbufferSerial = 0;
+ unsigned int stencilbufferSerial = 0;
+ if (framebufferObject->getDepthbufferType() != GL_NONE)
+ {
+ depthStencil = framebufferObject->getDepthbuffer()->getDepthStencil();
+ if (!depthStencil)
+ {
+ ERR("Depth stencil pointer unexpectedly null.");
+ return false;
+ }
+
+ depthbufferSerial = framebufferObject->getDepthbuffer()->getSerial();
+ }
+ else if (framebufferObject->getStencilbufferType() != GL_NONE)
+ {
+ depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
+ if (!depthStencil)
+ {
+ ERR("Depth stencil pointer unexpectedly null.");
+ return false;
+ }
+
+ stencilbufferSerial = framebufferObject->getStencilbuffer()->getSerial();
+ }
+
+ if (depthbufferSerial != mAppliedDepthbufferSerial ||
+ stencilbufferSerial != mAppliedStencilbufferSerial ||
+ !mDepthStencilInitialized)
+ {
+ device->SetDepthStencilSurface(depthStencil);
+ mAppliedDepthbufferSerial = depthbufferSerial;
+ mAppliedStencilbufferSerial = stencilbufferSerial;
+ mDepthStencilInitialized = true;
+ }
+
+ D3DVIEWPORT9 viewport;
+ D3DSURFACE_DESC desc;
+ renderTarget->GetDesc(&desc);
+
+ float zNear = clamp01(mState.zNear);
+ float zFar = clamp01(mState.zFar);
+
+ if (ignoreViewport)
+ {
+ viewport.X = 0;
+ viewport.Y = 0;
+ viewport.Width = desc.Width;
+ viewport.Height = desc.Height;
+ viewport.MinZ = 0.0f;
+ viewport.MaxZ = 1.0f;
+ }
+ else
+ {
+ viewport.X = std::max(mState.viewportX, 0);
+ viewport.Y = std::max(mState.viewportY, 0);
+ viewport.Width = std::min(mState.viewportWidth, (int)desc.Width - (int)viewport.X);
+ viewport.Height = std::min(mState.viewportHeight, (int)desc.Height - (int)viewport.Y);
+ viewport.MinZ = zNear;
+ viewport.MaxZ = zFar;
+ }
+
+ if (viewport.Width <= 0 || viewport.Height <= 0)
+ {
+ return false; // Nothing to render
+ }
+
+ device->SetViewport(&viewport);
+
+ if (mScissorStateDirty)
+ {
+ if (mState.scissorTest)
+ {
+ RECT rect = {mState.scissorX,
+ mState.scissorY,
+ mState.scissorX + mState.scissorWidth,
+ mState.scissorY + mState.scissorHeight};
+ rect.right = std::min(static_cast<UINT>(rect.right), desc.Width);
+ rect.bottom = std::min(static_cast<UINT>(rect.bottom), desc.Height);
+ device->SetScissorRect(&rect);
+ device->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ }
+
+ mScissorStateDirty = false;
+ }
+
+ if (mState.currentProgram)
+ {
+ Program *programObject = getCurrentProgram();
+
+ GLint halfPixelSize = programObject->getDxHalfPixelSizeLocation();
+ GLfloat xy[2] = {1.0f / viewport.Width, 1.0f / viewport.Height};
+ programObject->setUniform2fv(halfPixelSize, 1, xy);
+
+ GLint viewport = programObject->getDxViewportLocation();
+ GLfloat whxy[4] = {mState.viewportWidth / 2.0f, mState.viewportHeight / 2.0f,
+ (float)mState.viewportX + mState.viewportWidth / 2.0f,
+ (float)mState.viewportY + mState.viewportHeight / 2.0f};
+ programObject->setUniform4fv(viewport, 1, whxy);
+
+ GLint depth = programObject->getDxDepthLocation();
+ GLfloat dz[2] = {(zFar - zNear) / 2.0f, (zNear + zFar) / 2.0f};
+ programObject->setUniform2fv(depth, 1, dz);
+
+ GLint depthRange = programObject->getDxDepthRangeLocation();
+ GLfloat nearFarDiff[3] = {zNear, zFar, zFar - zNear};
+ programObject->setUniform3fv(depthRange, 1, nearFarDiff);
+ }
+
+ return true;
+}
+
+// Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device
+void Context::applyState(GLenum drawMode)
+{
+ IDirect3DDevice9 *device = getDevice();
+ Program *programObject = getCurrentProgram();
+
+ GLint frontCCW = programObject->getDxFrontCCWLocation();
+ GLint ccw = (mState.frontFace == GL_CCW);
+ programObject->setUniform1iv(frontCCW, 1, &ccw);
+
+ GLint pointsOrLines = programObject->getDxPointsOrLinesLocation();
+ GLint alwaysFront = !isTriangleMode(drawMode);
+ programObject->setUniform1iv(pointsOrLines, 1, &alwaysFront);
+
+ Framebuffer *framebufferObject = getDrawFramebuffer();
+
+ if (mCullStateDirty || mFrontFaceDirty)
+ {
+ if (mState.cullFace)
+ {
+ device->SetRenderState(D3DRS_CULLMODE, es2dx::ConvertCullMode(mState.cullMode, mState.frontFace));
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ }
+
+ mCullStateDirty = false;
+ }
+
+ if (mDepthStateDirty)
+ {
+ if (mState.depthTest && framebufferObject->getDepthbufferType() != GL_NONE)
+ {
+ device->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
+ device->SetRenderState(D3DRS_ZFUNC, es2dx::ConvertComparison(mState.depthFunc));
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
+ }
+
+ mDepthStateDirty = false;
+ }
+
+ if (mBlendStateDirty)
+ {
+ if (mState.blend)
+ {
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+
+ if (mState.sourceBlendRGB != GL_CONSTANT_ALPHA && mState.sourceBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA &&
+ mState.destBlendRGB != GL_CONSTANT_ALPHA && mState.destBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA)
+ {
+ device->SetRenderState(D3DRS_BLENDFACTOR, es2dx::ConvertColor(mState.blendColor));
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_BLENDFACTOR, D3DCOLOR_RGBA(unorm<8>(mState.blendColor.alpha),
+ unorm<8>(mState.blendColor.alpha),
+ unorm<8>(mState.blendColor.alpha),
+ unorm<8>(mState.blendColor.alpha)));
+ }
+
+ device->SetRenderState(D3DRS_SRCBLEND, es2dx::ConvertBlendFunc(mState.sourceBlendRGB));
+ device->SetRenderState(D3DRS_DESTBLEND, es2dx::ConvertBlendFunc(mState.destBlendRGB));
+ device->SetRenderState(D3DRS_BLENDOP, es2dx::ConvertBlendOp(mState.blendEquationRGB));
+
+ if (mState.sourceBlendRGB != mState.sourceBlendAlpha ||
+ mState.destBlendRGB != mState.destBlendAlpha ||
+ mState.blendEquationRGB != mState.blendEquationAlpha)
+ {
+ device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+
+ device->SetRenderState(D3DRS_SRCBLENDALPHA, es2dx::ConvertBlendFunc(mState.sourceBlendAlpha));
+ device->SetRenderState(D3DRS_DESTBLENDALPHA, es2dx::ConvertBlendFunc(mState.destBlendAlpha));
+ device->SetRenderState(D3DRS_BLENDOPALPHA, es2dx::ConvertBlendOp(mState.blendEquationAlpha));
+
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
+ }
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ }
+
+ mBlendStateDirty = false;
+ }
+
+ if (mStencilStateDirty || mFrontFaceDirty)
+ {
+ if (mState.stencilTest && framebufferObject->hasStencil())
+ {
+ device->SetRenderState(D3DRS_STENCILENABLE, TRUE);
+ device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, TRUE);
+
+ // FIXME: Unsupported by D3D9
+ const D3DRENDERSTATETYPE D3DRS_CCW_STENCILREF = D3DRS_STENCILREF;
+ const D3DRENDERSTATETYPE D3DRS_CCW_STENCILMASK = D3DRS_STENCILMASK;
+ const D3DRENDERSTATETYPE D3DRS_CCW_STENCILWRITEMASK = D3DRS_STENCILWRITEMASK;
+ if (mState.stencilWritemask != mState.stencilBackWritemask ||
+ mState.stencilRef != mState.stencilBackRef ||
+ mState.stencilMask != mState.stencilBackMask)
+ {
+ ERR("Separate front/back stencil writemasks, reference values, or stencil mask values are invalid under WebGL.");
+ return error(GL_INVALID_OPERATION);
+ }
+
+ // get the maximum size of the stencil ref
+ gl::DepthStencilbuffer *stencilbuffer = framebufferObject->getStencilbuffer();
+ GLuint maxStencil = (1 << stencilbuffer->getStencilSize()) - 1;
+
+ device->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK, mState.stencilWritemask);
+ device->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC,
+ es2dx::ConvertComparison(mState.stencilFunc));
+
+ device->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF, (mState.stencilRef < (GLint)maxStencil) ? mState.stencilRef : maxStencil);
+ device->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK, mState.stencilMask);
+
+ device->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL,
+ es2dx::ConvertStencilOp(mState.stencilFail));
+ device->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL,
+ es2dx::ConvertStencilOp(mState.stencilPassDepthFail));
+ device->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS,
+ es2dx::ConvertStencilOp(mState.stencilPassDepthPass));
+
+ device->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK, mState.stencilBackWritemask);
+ device->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC,
+ es2dx::ConvertComparison(mState.stencilBackFunc));
+
+ device->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF, (mState.stencilBackRef < (GLint)maxStencil) ? mState.stencilBackRef : maxStencil);
+ device->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK, mState.stencilBackMask);
+
+ device->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL,
+ es2dx::ConvertStencilOp(mState.stencilBackFail));
+ device->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL,
+ es2dx::ConvertStencilOp(mState.stencilBackPassDepthFail));
+ device->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS,
+ es2dx::ConvertStencilOp(mState.stencilBackPassDepthPass));
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ }
+
+ mStencilStateDirty = false;
+ }
+
+ if (mMaskStateDirty)
+ {
+ device->SetRenderState(D3DRS_COLORWRITEENABLE, es2dx::ConvertColorMask(mState.colorMaskRed, mState.colorMaskGreen,
+ mState.colorMaskBlue, mState.colorMaskAlpha));
+ device->SetRenderState(D3DRS_ZWRITEENABLE, mState.depthMask ? TRUE : FALSE);
+
+ mMaskStateDirty = false;
+ }
+
+ if (mPolygonOffsetStateDirty)
+ {
+ if (mState.polygonOffsetFill)
+ {
+ gl::DepthStencilbuffer *depthbuffer = framebufferObject->getDepthbuffer();
+ if (depthbuffer)
+ {
+ device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *((DWORD*)&mState.polygonOffsetFactor));
+ float depthBias = ldexp(mState.polygonOffsetUnits, -(int)(depthbuffer->getDepthSize()));
+ device->SetRenderState(D3DRS_DEPTHBIAS, *((DWORD*)&depthBias));
+ }
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, 0);
+ device->SetRenderState(D3DRS_DEPTHBIAS, 0);
+ }
+
+ mPolygonOffsetStateDirty = false;
+ }
+
+ if (mSampleStateDirty)
+ {
+ if (framebufferObject->isMultisample())
+ {
+ if (mState.sampleAlphaToCoverage)
+ {
+ FIXME("Sample alpha to coverage is unimplemented.");
+ }
+
+ device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
+ if (mState.sampleCoverage)
+ {
+ unsigned int mask = 0;
+ if (mState.sampleCoverageValue != 0)
+ {
+ float threshold = 0.5f;
+
+ for (int i = 0; i < framebufferObject->getSamples(); ++i)
+ {
+ mask <<= 1;
+
+ if ((i + 1) * mState.sampleCoverageValue >= threshold)
+ {
+ threshold += 1.0f;
+ mask |= 1;
+ }
+ }
+ }
+
+ if (mState.sampleCoverageInvert)
+ {
+ mask = ~mask;
+ }
+
+ device->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
+ }
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, FALSE);
+ }
+
+ mSampleStateDirty = false;
+ }
+
+ if (mDitherStateDirty)
+ {
+ device->SetRenderState(D3DRS_DITHERENABLE, mState.dither ? TRUE : FALSE);
+
+ mDitherStateDirty = false;
+ }
+
+ mFrontFaceDirty = false;
+}
+
+// Fill in the semanticIndex field of the array of TranslatedAttributes based on the active GLSL program.
+void Context::lookupAttributeMapping(TranslatedAttribute *attributes)
+{
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ if (attributes[i].active)
+ {
+ attributes[i].semanticIndex = getCurrentProgram()->getSemanticIndex(i);
+ }
+ }
+}
+
+GLenum Context::applyVertexBuffer(GLint first, GLsizei count)
+{
+ TranslatedAttribute translated[MAX_VERTEX_ATTRIBS];
+
+ GLenum err = mVertexDataManager->prepareVertexData(first, count, translated);
+ if (err != GL_NO_ERROR)
+ {
+ return err;
+ }
+
+ lookupAttributeMapping(translated);
+
+ mVertexDataManager->setupAttributes(translated);
+
+ return GL_NO_ERROR;
+}
+
+// Applies the indices and element array bindings to the Direct3D 9 device
+GLenum Context::applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
+{
+ IDirect3DDevice9 *device = getDevice();
+ GLenum err = mIndexDataManager->prepareIndexData(type, count, mState.elementArrayBuffer.get(), indices, indexInfo);
+
+ if (err == GL_NO_ERROR)
+ {
+ device->SetIndices(indexInfo->indexBuffer);
+ }
+
+ return err;
+}
+
+// Applies the shaders and shader constants to the Direct3D 9 device
+void Context::applyShaders()
+{
+ IDirect3DDevice9 *device = getDevice();
+ Program *programObject = getCurrentProgram();
+ IDirect3DVertexShader9 *vertexShader = programObject->getVertexShader();
+ IDirect3DPixelShader9 *pixelShader = programObject->getPixelShader();
+
+ device->SetVertexShader(vertexShader);
+ device->SetPixelShader(pixelShader);
+
+ if (programObject->getSerial() != mAppliedProgram)
+ {
+ programObject->dirtyAllUniforms();
+ programObject->dirtyAllSamplers();
+ mAppliedProgram = programObject->getSerial();
+ }
+
+ programObject->applyUniforms();
+}
+
+// Applies the textures and sampler states to the Direct3D 9 device
+void Context::applyTextures()
+{
+ IDirect3DDevice9 *device = getDevice();
+ Program *programObject = getCurrentProgram();
+
+ for (int sampler = 0; sampler < MAX_TEXTURE_IMAGE_UNITS; sampler++)
+ {
+ int textureUnit = programObject->getSamplerMapping(sampler);
+ if (textureUnit != -1)
+ {
+ SamplerType textureType = programObject->getSamplerType(sampler);
+
+ Texture *texture = getSamplerTexture(textureUnit, textureType);
+
+ if (programObject->isSamplerDirty(sampler) || texture->isDirty())
+ {
+ if (texture->isComplete())
+ {
+ GLenum wrapS = texture->getWrapS();
+ GLenum wrapT = texture->getWrapT();
+ GLenum minFilter = texture->getMinFilter();
+ GLenum magFilter = texture->getMagFilter();
+
+ device->SetSamplerState(sampler, D3DSAMP_ADDRESSU, es2dx::ConvertTextureWrap(wrapS));
+ device->SetSamplerState(sampler, D3DSAMP_ADDRESSV, es2dx::ConvertTextureWrap(wrapT));
+
+ device->SetSamplerState(sampler, D3DSAMP_MAGFILTER, es2dx::ConvertMagFilter(magFilter));
+ D3DTEXTUREFILTERTYPE d3dMinFilter, d3dMipFilter;
+ es2dx::ConvertMinFilter(minFilter, &d3dMinFilter, &d3dMipFilter);
+ device->SetSamplerState(sampler, D3DSAMP_MINFILTER, d3dMinFilter);
+ device->SetSamplerState(sampler, D3DSAMP_MIPFILTER, d3dMipFilter);
+
+ device->SetTexture(sampler, texture->getTexture());
+ }
+ else
+ {
+ device->SetTexture(sampler, getIncompleteTexture(textureType)->getTexture());
+ }
+ }
+
+ programObject->setSamplerDirty(sampler, false);
+ }
+ else
+ {
+ if (programObject->isSamplerDirty(sampler))
+ {
+ device->SetTexture(sampler, NULL);
+ programObject->setSamplerDirty(sampler, false);
+ }
+ }
+ }
+}
+
+void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
+{
+ Framebuffer *framebuffer = getReadFramebuffer();
+
+ if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ }
+
+ if (getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ IDirect3DSurface9 *renderTarget = framebuffer->getRenderTarget();
+
+ if (!renderTarget)
+ {
+ return; // Context must be lost, return silently
+ }
+
+ IDirect3DDevice9 *device = getDevice();
+
+ D3DSURFACE_DESC desc;
+ renderTarget->GetDesc(&desc);
+
+ IDirect3DSurface9 *systemSurface;
+ HRESULT result = device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &systemSurface, NULL);
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
+ {
+ UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render target
+ }
+
+ result = device->GetRenderTargetData(renderTarget, systemSurface);
+
+ if (FAILED(result))
+ {
+ systemSurface->Release();
+
+ switch (result)
+ {
+ case D3DERR_DRIVERINTERNALERROR:
+ case D3DERR_DEVICELOST:
+ return error(GL_OUT_OF_MEMORY);
+ default:
+ UNREACHABLE();
+ return; // No sensible error to generate
+ }
+ }
+
+ D3DLOCKED_RECT lock;
+ RECT rect = {std::max(x, 0),
+ std::max(y, 0),
+ std::min(x + width, (int)desc.Width),
+ std::min(y + height, (int)desc.Height)};
+
+ result = systemSurface->LockRect(&lock, &rect, D3DLOCK_READONLY);
+
+ if (FAILED(result))
+ {
+ UNREACHABLE();
+ systemSurface->Release();
+
+ return; // No sensible error to generate
+ }
+
+ unsigned char *source = (unsigned char*)lock.pBits;
+ unsigned char *dest = (unsigned char*)pixels;
+ unsigned short *dest16 = (unsigned short*)pixels;
+
+ GLsizei outputPitch = ComputePitch(width, format, type, mState.packAlignment);
+
+ for (int j = 0; j < rect.bottom - rect.top; j++)
+ {
+ if (desc.Format == D3DFMT_A8R8G8B8 &&
+ format == GL_BGRA_EXT &&
+ type == GL_UNSIGNED_BYTE)
+ {
+ // Fast path for EXT_read_format_bgra, given
+ // an RGBA source buffer. Note that buffers with no
+ // alpha go through the slow path below.
+ memcpy(dest + j * outputPitch,
+ source + j * lock.Pitch,
+ (rect.right - rect.left) * 4);
+ continue;
+ }
+
+ for (int i = 0; i < rect.right - rect.left; i++)
+ {
+ float r;
+ float g;
+ float b;
+ float a;
+
+ switch (desc.Format)
+ {
+ case D3DFMT_R5G6B5:
+ {
+ unsigned short rgb = *(unsigned short*)(source + 2 * i + j * lock.Pitch);
+
+ a = 1.0f;
+ b = (rgb & 0x001F) * (1.0f / 0x001F);
+ g = (rgb & 0x07E0) * (1.0f / 0x07E0);
+ r = (rgb & 0xF800) * (1.0f / 0xF800);
+ }
+ break;
+ case D3DFMT_A1R5G5B5:
+ {
+ unsigned short argb = *(unsigned short*)(source + 2 * i + j * lock.Pitch);
+
+ a = (argb & 0x8000) ? 1.0f : 0.0f;
+ b = (argb & 0x001F) * (1.0f / 0x001F);
+ g = (argb & 0x03E0) * (1.0f / 0x03E0);
+ r = (argb & 0x7C00) * (1.0f / 0x7C00);
+ }
+ break;
+ case D3DFMT_A8R8G8B8:
+ {
+ unsigned int argb = *(unsigned int*)(source + 4 * i + j * lock.Pitch);
+
+ a = (argb & 0xFF000000) * (1.0f / 0xFF000000);
+ b = (argb & 0x000000FF) * (1.0f / 0x000000FF);
+ g = (argb & 0x0000FF00) * (1.0f / 0x0000FF00);
+ r = (argb & 0x00FF0000) * (1.0f / 0x00FF0000);
+ }
+ break;
+ case D3DFMT_X8R8G8B8:
+ {
+ unsigned int xrgb = *(unsigned int*)(source + 4 * i + j * lock.Pitch);
+
+ a = 1.0f;
+ b = (xrgb & 0x000000FF) * (1.0f / 0x000000FF);
+ g = (xrgb & 0x0000FF00) * (1.0f / 0x0000FF00);
+ r = (xrgb & 0x00FF0000) * (1.0f / 0x00FF0000);
+ }
+ break;
+ case D3DFMT_A2R10G10B10:
+ {
+ unsigned int argb = *(unsigned int*)(source + 4 * i + j * lock.Pitch);
+
+ a = (argb & 0xC0000000) * (1.0f / 0xC0000000);
+ b = (argb & 0x000003FF) * (1.0f / 0x000003FF);
+ g = (argb & 0x000FFC00) * (1.0f / 0x000FFC00);
+ r = (argb & 0x3FF00000) * (1.0f / 0x3FF00000);
+ }
+ break;
+ case D3DFMT_A32B32G32R32F:
+ {
+ // float formats in D3D are stored rgba, rather than the other way round
+ r = *((float*)(source + 16 * i + j * lock.Pitch) + 0);
+ g = *((float*)(source + 16 * i + j * lock.Pitch) + 1);
+ b = *((float*)(source + 16 * i + j * lock.Pitch) + 2);
+ a = *((float*)(source + 16 * i + j * lock.Pitch) + 3);
+ }
+ break;
+ case D3DFMT_A16B16G16R16F:
+ {
+ // float formats in D3D are stored rgba, rather than the other way round
+ float abgr[4];
+
+ D3DXFloat16To32Array(abgr, (D3DXFLOAT16*)(source + 8 * i + j * lock.Pitch), 4);
+
+ a = abgr[3];
+ b = abgr[2];
+ g = abgr[1];
+ r = abgr[0];
+ }
+ break;
+ default:
+ UNIMPLEMENTED(); // FIXME
+ UNREACHABLE();
+ }
+
+ switch (format)
+ {
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * r + 0.5f);
+ dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
+ dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * b + 0.5f);
+ dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * b + 0.5f);
+ dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
+ dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * r + 0.5f);
+ dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
+ // this type is packed as follows:
+ // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+ // --------------------------------------------------------------------------------
+ // | 4th | 3rd | 2nd | 1st component |
+ // --------------------------------------------------------------------------------
+ // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
+ dest16[i + j * outputPitch / sizeof(unsigned short)] =
+ ((unsigned short)(15 * a + 0.5f) << 12)|
+ ((unsigned short)(15 * r + 0.5f) << 8) |
+ ((unsigned short)(15 * g + 0.5f) << 4) |
+ ((unsigned short)(15 * b + 0.5f) << 0);
+ break;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
+ // this type is packed as follows:
+ // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+ // --------------------------------------------------------------------------------
+ // | 4th | 3rd | 2nd | 1st component |
+ // --------------------------------------------------------------------------------
+ // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
+ dest16[i + j * outputPitch / sizeof(unsigned short)] =
+ ((unsigned short)( a + 0.5f) << 15) |
+ ((unsigned short)(31 * r + 0.5f) << 10) |
+ ((unsigned short)(31 * g + 0.5f) << 5) |
+ ((unsigned short)(31 * b + 0.5f) << 0);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_RGB: // IMPLEMENTATION_COLOR_READ_FORMAT
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT_5_6_5: // IMPLEMENTATION_COLOR_READ_TYPE
+ dest16[i + j * outputPitch / sizeof(unsigned short)] =
+ ((unsigned short)(31 * b + 0.5f) << 0) |
+ ((unsigned short)(63 * g + 0.5f) << 5) |
+ ((unsigned short)(31 * r + 0.5f) << 11);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+
+ systemSurface->UnlockRect();
+
+ systemSurface->Release();
+}
+
+void Context::clear(GLbitfield mask)
+{
+ Framebuffer *framebufferObject = getDrawFramebuffer();
+
+ if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ error(GL_INVALID_FRAMEBUFFER_OPERATION);
+
+ return;
+ }
+
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+ DWORD flags = 0;
+
+ if (mask & GL_COLOR_BUFFER_BIT)
+ {
+ mask &= ~GL_COLOR_BUFFER_BIT;
+
+ if (framebufferObject->getColorbufferType() != GL_NONE)
+ {
+ flags |= D3DCLEAR_TARGET;
+ }
+ }
+
+ if (mask & GL_DEPTH_BUFFER_BIT)
+ {
+ mask &= ~GL_DEPTH_BUFFER_BIT;
+ if (mState.depthMask && framebufferObject->getDepthbufferType() != GL_NONE)
+ {
+ flags |= D3DCLEAR_ZBUFFER;
+ }
+ }
+
+ GLuint stencilUnmasked = 0x0;
+
+ if (mask & GL_STENCIL_BUFFER_BIT)
+ {
+ mask &= ~GL_STENCIL_BUFFER_BIT;
+ if (framebufferObject->getStencilbufferType() != GL_NONE)
+ {
+ IDirect3DSurface9 *depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
+ if (!depthStencil)
+ {
+ ERR("Depth stencil pointer unexpectedly null.");
+ return;
+ }
+
+ D3DSURFACE_DESC desc;
+ depthStencil->GetDesc(&desc);
+
+ unsigned int stencilSize = es2dx::GetStencilSize(desc.Format);
+ stencilUnmasked = (0x1 << stencilSize) - 1;
+
+ if (stencilUnmasked != 0x0)
+ {
+ flags |= D3DCLEAR_STENCIL;
+ }
+ }
+ }
+
+ if (mask != 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (!applyRenderTarget(true)) // Clips the clear to the scissor rectangle but not the viewport
+ {
+ return;
+ }
+
+ D3DCOLOR color = D3DCOLOR_ARGB(unorm<8>(mState.colorClearValue.alpha),
+ unorm<8>(mState.colorClearValue.red),
+ unorm<8>(mState.colorClearValue.green),
+ unorm<8>(mState.colorClearValue.blue));
+ float depth = clamp01(mState.depthClearValue);
+ int stencil = mState.stencilClearValue & 0x000000FF;
+
+ IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
+
+ if (!renderTarget)
+ {
+ return; // Context must be lost, return silently
+ }
+
+ D3DSURFACE_DESC desc;
+ renderTarget->GetDesc(&desc);
+
+ bool alphaUnmasked = (es2dx::GetAlphaSize(desc.Format) == 0) || mState.colorMaskAlpha;
+
+ const bool needMaskedStencilClear = (flags & D3DCLEAR_STENCIL) &&
+ (mState.stencilWritemask & stencilUnmasked) != stencilUnmasked;
+ const bool needMaskedColorClear = (flags & D3DCLEAR_TARGET) &&
+ !(mState.colorMaskRed && mState.colorMaskGreen &&
+ mState.colorMaskBlue && alphaUnmasked);
+
+ if (needMaskedColorClear || needMaskedStencilClear)
+ {
+ // State which is altered in all paths from this point to the clear call is saved.
+ // State which is altered in only some paths will be flagged dirty in the case that
+ // that path is taken.
+ HRESULT hr;
+ if (mMaskedClearSavedState == NULL)
+ {
+ hr = device->BeginStateBlock();
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+ device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
+ device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
+ device->SetRenderState(D3DRS_ZENABLE, FALSE);
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+ device->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
+ device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ device->SetPixelShader(NULL);
+ device->SetVertexShader(NULL);
+ device->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
+ device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
+
+ hr = device->EndStateBlock(&mMaskedClearSavedState);
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+ }
+
+ ASSERT(mMaskedClearSavedState != NULL);
+
+ if (mMaskedClearSavedState != NULL)
+ {
+ hr = mMaskedClearSavedState->Capture();
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
+ device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
+ device->SetRenderState(D3DRS_ZENABLE, FALSE);
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+
+ if (flags & D3DCLEAR_TARGET)
+ {
+ device->SetRenderState(D3DRS_COLORWRITEENABLE, (mState.colorMaskRed ? D3DCOLORWRITEENABLE_RED : 0) |
+ (mState.colorMaskGreen ? D3DCOLORWRITEENABLE_GREEN : 0) |
+ (mState.colorMaskBlue ? D3DCOLORWRITEENABLE_BLUE : 0) |
+ (mState.colorMaskAlpha ? D3DCOLORWRITEENABLE_ALPHA : 0));
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
+ }
+
+ if (stencilUnmasked != 0x0 && (flags & D3DCLEAR_STENCIL))
+ {
+ device->SetRenderState(D3DRS_STENCILENABLE, TRUE);
+ device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, FALSE);
+ device->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
+ device->SetRenderState(D3DRS_STENCILREF, stencil);
+ device->SetRenderState(D3DRS_STENCILWRITEMASK, mState.stencilWritemask);
+ device->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE);
+ device->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_REPLACE);
+ device->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE);
+ mStencilStateDirty = true;
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ }
+
+ device->SetPixelShader(NULL);
+ device->SetVertexShader(NULL);
+ device->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
+ device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
+
+ struct Vertex
+ {
+ float x, y, z, w;
+ D3DCOLOR diffuse;
+ };
+
+ Vertex quad[4];
+ quad[0].x = 0.0f;
+ quad[0].y = (float)desc.Height;
+ quad[0].z = 0.0f;
+ quad[0].w = 1.0f;
+ quad[0].diffuse = color;
+
+ quad[1].x = (float)desc.Width;
+ quad[1].y = (float)desc.Height;
+ quad[1].z = 0.0f;
+ quad[1].w = 1.0f;
+ quad[1].diffuse = color;
+
+ quad[2].x = 0.0f;
+ quad[2].y = 0.0f;
+ quad[2].z = 0.0f;
+ quad[2].w = 1.0f;
+ quad[2].diffuse = color;
+
+ quad[3].x = (float)desc.Width;
+ quad[3].y = 0.0f;
+ quad[3].z = 0.0f;
+ quad[3].w = 1.0f;
+ quad[3].diffuse = color;
+
+ display->startScene();
+ device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(Vertex));
+
+ if (flags & D3DCLEAR_ZBUFFER)
+ {
+ device->SetRenderState(D3DRS_ZENABLE, TRUE);
+ device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
+ device->Clear(0, NULL, D3DCLEAR_ZBUFFER, color, depth, stencil);
+ }
+
+ if (mMaskedClearSavedState != NULL)
+ {
+ mMaskedClearSavedState->Apply();
+ }
+ }
+ else if (flags)
+ {
+ device->Clear(0, NULL, flags, color, depth, stencil);
+ }
+}
+
+void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
+{
+ if (!mState.currentProgram)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+ D3DPRIMITIVETYPE primitiveType;
+ int primitiveCount;
+
+ if(!es2dx::ConvertPrimitiveType(mode, count, &primitiveType, &primitiveCount))
+ return error(GL_INVALID_ENUM);
+
+ if (primitiveCount <= 0)
+ {
+ return;
+ }
+
+ if (!applyRenderTarget(false))
+ {
+ return;
+ }
+
+ applyState(mode);
+
+ GLenum err = applyVertexBuffer(first, count);
+ if (err != GL_NO_ERROR)
+ {
+ return error(err);
+ }
+
+ applyShaders();
+ applyTextures();
+
+ if (!getCurrentProgram()->validateSamplers())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!cullSkipsDraw(mode))
+ {
+ display->startScene();
+
+ device->DrawPrimitive(primitiveType, 0, primitiveCount);
+
+ if (mode == GL_LINE_LOOP) // Draw the last segment separately
+ {
+ drawClosingLine(first, first + count - 1);
+ }
+ }
+}
+
+void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
+{
+ if (!mState.currentProgram)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!indices && !mState.elementArrayBuffer)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+ D3DPRIMITIVETYPE primitiveType;
+ int primitiveCount;
+
+ if(!es2dx::ConvertPrimitiveType(mode, count, &primitiveType, &primitiveCount))
+ return error(GL_INVALID_ENUM);
+
+ if (primitiveCount <= 0)
+ {
+ return;
+ }
+
+ if (!applyRenderTarget(false))
+ {
+ return;
+ }
+
+ applyState(mode);
+
+ TranslatedIndexData indexInfo;
+ GLenum err = applyIndexBuffer(indices, count, mode, type, &indexInfo);
+ if (err != GL_NO_ERROR)
+ {
+ return error(err);
+ }
+
+ GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
+ err = applyVertexBuffer(indexInfo.minIndex, vertexCount);
+ if (err != GL_NO_ERROR)
+ {
+ return error(err);
+ }
+
+ applyShaders();
+ applyTextures();
+
+ if (!getCurrentProgram()->validateSamplers())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!cullSkipsDraw(mode))
+ {
+ display->startScene();
+
+ device->DrawIndexedPrimitive(primitiveType, -(INT)indexInfo.minIndex, indexInfo.minIndex, vertexCount, indexInfo.startIndex, primitiveCount);
+
+ if (mode == GL_LINE_LOOP) // Draw the last segment separately
+ {
+ drawClosingLine(count, type, indices);
+ }
+ }
+}
+
+void Context::finish()
+{
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+ IDirect3DQuery9 *occlusionQuery = NULL;
+
+ HRESULT result = device->CreateQuery(D3DQUERYTYPE_OCCLUSION, &occlusionQuery);
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ if (occlusionQuery)
+ {
+ IDirect3DStateBlock9 *savedState = NULL;
+ device->CreateStateBlock(D3DSBT_ALL, &savedState);
+
+ HRESULT result = occlusionQuery->Issue(D3DISSUE_BEGIN);
+ ASSERT(SUCCEEDED(result));
+
+ // Render something outside the render target
+ device->SetPixelShader(NULL);
+ device->SetVertexShader(NULL);
+ device->SetFVF(D3DFVF_XYZRHW);
+ float data[4] = {-1.0f, -1.0f, -1.0f, 1.0f};
+ display->startScene();
+ device->DrawPrimitiveUP(D3DPT_POINTLIST, 1, data, sizeof(data));
+
+ result = occlusionQuery->Issue(D3DISSUE_END);
+ ASSERT(SUCCEEDED(result));
+
+ while (occlusionQuery->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE)
+ {
+ // Keep polling, but allow other threads to do something useful first
+ Sleep(0);
+ }
+
+ occlusionQuery->Release();
+
+ if (savedState)
+ {
+ savedState->Apply();
+ savedState->Release();
+ }
+ }
+}
+
+void Context::flush()
+{
+ IDirect3DDevice9 *device = getDevice();
+ IDirect3DQuery9 *eventQuery = NULL;
+
+ HRESULT result = device->CreateQuery(D3DQUERYTYPE_EVENT, &eventQuery);
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ if (eventQuery)
+ {
+ HRESULT result = eventQuery->Issue(D3DISSUE_END);
+ ASSERT(SUCCEEDED(result));
+
+ result = eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
+ eventQuery->Release();
+
+ if (result == D3DERR_DEVICELOST)
+ {
+ error(GL_OUT_OF_MEMORY);
+ }
+ }
+}
+
+void Context::drawClosingLine(unsigned int first, unsigned int last)
+{
+ IDirect3DDevice9 *device = getDevice();
+ IDirect3DIndexBuffer9 *indexBuffer = NULL;
+ HRESULT result = D3DERR_INVALIDCALL;
+
+ if (supports32bitIndices())
+ {
+ result = device->CreateIndexBuffer(8, D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &indexBuffer, 0);
+
+ if (SUCCEEDED(result))
+ {
+ unsigned int *data;
+ result = indexBuffer->Lock(0, 0, (void**)&data, 0);
+
+ if (SUCCEEDED(result))
+ {
+ data[0] = last;
+ data[1] = first;
+ }
+ }
+ }
+ else
+ {
+ result = device->CreateIndexBuffer(4, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &indexBuffer, 0);
+
+ if (SUCCEEDED(result))
+ {
+ unsigned short *data;
+ result = indexBuffer->Lock(0, 0, (void**)&data, 0);
+
+ if (SUCCEEDED(result))
+ {
+ data[0] = last;
+ data[1] = first;
+ }
+ }
+ }
+
+ if (SUCCEEDED(result))
+ {
+ indexBuffer->Unlock();
+ device->SetIndices(indexBuffer);
+
+ device->DrawIndexedPrimitive(D3DPT_LINELIST, 0, 0, 2, 0, 1);
+
+ indexBuffer->Release();
+ }
+ else
+ {
+ ERR("Could not create an index buffer for closing a line loop.");
+ error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void Context::drawClosingLine(GLsizei count, GLenum type, const void *indices)
+{
+ unsigned int first = 0;
+ unsigned int last = 0;
+
+ if (mState.elementArrayBuffer.get())
+ {
+ Buffer *indexBuffer = mState.elementArrayBuffer.get();
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
+ indices = static_cast<const GLubyte*>(indexBuffer->data()) + offset;
+ }
+
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ first = static_cast<const GLubyte*>(indices)[0];
+ last = static_cast<const GLubyte*>(indices)[count - 1];
+ break;
+ case GL_UNSIGNED_SHORT:
+ first = static_cast<const GLushort*>(indices)[0];
+ last = static_cast<const GLushort*>(indices)[count - 1];
+ break;
+ case GL_UNSIGNED_INT:
+ first = static_cast<const GLuint*>(indices)[0];
+ last = static_cast<const GLuint*>(indices)[count - 1];
+ break;
+ default: UNREACHABLE();
+ }
+
+ drawClosingLine(first, last);
+}
+
+void Context::recordInvalidEnum()
+{
+ mInvalidEnum = true;
+}
+
+void Context::recordInvalidValue()
+{
+ mInvalidValue = true;
+}
+
+void Context::recordInvalidOperation()
+{
+ mInvalidOperation = true;
+}
+
+void Context::recordOutOfMemory()
+{
+ mOutOfMemory = true;
+}
+
+void Context::recordInvalidFramebufferOperation()
+{
+ mInvalidFramebufferOperation = true;
+}
+
+// Get one of the recorded errors and clear its flag, if any.
+// [OpenGL ES 2.0.24] section 2.5 page 13.
+GLenum Context::getError()
+{
+ if (mInvalidEnum)
+ {
+ mInvalidEnum = false;
+
+ return GL_INVALID_ENUM;
+ }
+
+ if (mInvalidValue)
+ {
+ mInvalidValue = false;
+
+ return GL_INVALID_VALUE;
+ }
+
+ if (mInvalidOperation)
+ {
+ mInvalidOperation = false;
+
+ return GL_INVALID_OPERATION;
+ }
+
+ if (mOutOfMemory)
+ {
+ mOutOfMemory = false;
+
+ return GL_OUT_OF_MEMORY;
+ }
+
+ if (mInvalidFramebufferOperation)
+ {
+ mInvalidFramebufferOperation = false;
+
+ return GL_INVALID_FRAMEBUFFER_OPERATION;
+ }
+
+ return GL_NO_ERROR;
+}
+
+bool Context::supportsShaderModel3() const
+{
+ return mSupportsShaderModel3;
+}
+
+int Context::getMaximumVaryingVectors() const
+{
+ return mSupportsShaderModel3 ? MAX_VARYING_VECTORS_SM3 : MAX_VARYING_VECTORS_SM2;
+}
+
+int Context::getMaximumFragmentUniformVectors() const
+{
+ return mSupportsShaderModel3 ? MAX_FRAGMENT_UNIFORM_VECTORS_SM3 : MAX_FRAGMENT_UNIFORM_VECTORS_SM2;
+}
+
+int Context::getMaxSupportedSamples() const
+{
+ return mMaxSupportedSamples;
+}
+
+int Context::getNearestSupportedSamples(D3DFORMAT format, int requested) const
+{
+ if (requested == 0)
+ {
+ return requested;
+ }
+
+ std::map<D3DFORMAT, bool *>::const_iterator itr = mMultiSampleSupport.find(format);
+ if (itr == mMultiSampleSupport.end())
+ {
+ return -1;
+ }
+
+ for (int i = requested; i <= D3DMULTISAMPLE_16_SAMPLES; ++i)
+ {
+ if (itr->second[i] && i != D3DMULTISAMPLE_NONMASKABLE)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+bool Context::supportsEventQueries() const
+{
+ return mSupportsEventQueries;
+}
+
+bool Context::supportsCompressedTextures() const
+{
+ return mSupportsCompressedTextures;
+}
+
+bool Context::supportsFloatTextures() const
+{
+ return mSupportsFloatTextures;
+}
+
+bool Context::supportsFloatLinearFilter() const
+{
+ return mSupportsFloatLinearFilter;
+}
+
+bool Context::supportsFloatRenderableTextures() const
+{
+ return mSupportsFloatRenderableTextures;
+}
+
+bool Context::supportsHalfFloatTextures() const
+{
+ return mSupportsHalfFloatTextures;
+}
+
+bool Context::supportsHalfFloatLinearFilter() const
+{
+ return mSupportsHalfFloatLinearFilter;
+}
+
+bool Context::supportsHalfFloatRenderableTextures() const
+{
+ return mSupportsHalfFloatRenderableTextures;
+}
+
+int Context::getMaximumRenderbufferDimension() const
+{
+ return mMaxRenderbufferDimension;
+}
+
+int Context::getMaximumTextureDimension() const
+{
+ return mMaxTextureDimension;
+}
+
+int Context::getMaximumCubeTextureDimension() const
+{
+ return mMaxCubeTextureDimension;
+}
+
+int Context::getMaximumTextureLevel() const
+{
+ return mMaxTextureLevel;
+}
+
+bool Context::supportsLuminanceTextures() const
+{
+ return mSupportsLuminanceTextures;
+}
+
+bool Context::supportsLuminanceAlphaTextures() const
+{
+ return mSupportsLuminanceAlphaTextures;
+}
+
+bool Context::supports32bitIndices() const
+{
+ return mSupports32bitIndices;
+}
+
+void Context::detachBuffer(GLuint buffer)
+{
+ // [OpenGL ES 2.0.24] section 2.9 page 22:
+ // If a buffer object is deleted while it is bound, all bindings to that object in the current context
+ // (i.e. in the thread that called Delete-Buffers) are reset to zero.
+
+ if (mState.arrayBuffer.id() == buffer)
+ {
+ mState.arrayBuffer.set(NULL);
+ }
+
+ if (mState.elementArrayBuffer.id() == buffer)
+ {
+ mState.elementArrayBuffer.set(NULL);
+ }
+
+ for (int attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
+ {
+ if (mState.vertexAttribute[attribute].mBoundBuffer.id() == buffer)
+ {
+ mState.vertexAttribute[attribute].mBoundBuffer.set(NULL);
+ }
+ }
+}
+
+void Context::detachTexture(GLuint texture)
+{
+ // [OpenGL ES 2.0.24] section 3.8 page 84:
+ // If a texture object is deleted, it is as if all texture units which are bound to that texture object are
+ // rebound to texture object zero
+
+ for (int type = 0; type < SAMPLER_TYPE_COUNT; type++)
+ {
+ for (int sampler = 0; sampler < MAX_TEXTURE_IMAGE_UNITS; sampler++)
+ {
+ if (mState.samplerTexture[type][sampler].id() == texture)
+ {
+ mState.samplerTexture[type][sampler].set(NULL);
+ }
+ }
+ }
+
+ // [OpenGL ES 2.0.24] section 4.4 page 112:
+ // If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is
+ // as if FramebufferTexture2D had been called, with a texture of 0, for each attachment point to which this
+ // image was attached in the currently bound framebuffer.
+
+ Framebuffer *readFramebuffer = getReadFramebuffer();
+ Framebuffer *drawFramebuffer = getDrawFramebuffer();
+
+ if (readFramebuffer)
+ {
+ readFramebuffer->detachTexture(texture);
+ }
+
+ if (drawFramebuffer && drawFramebuffer != readFramebuffer)
+ {
+ drawFramebuffer->detachTexture(texture);
+ }
+}
+
+void Context::detachFramebuffer(GLuint framebuffer)
+{
+ // [OpenGL ES 2.0.24] section 4.4 page 107:
+ // If a framebuffer that is currently bound to the target FRAMEBUFFER is deleted, it is as though
+ // BindFramebuffer had been executed with the target of FRAMEBUFFER and framebuffer of zero.
+
+ if (mState.readFramebuffer == framebuffer)
+ {
+ bindReadFramebuffer(0);
+ }
+
+ if (mState.drawFramebuffer == framebuffer)
+ {
+ bindDrawFramebuffer(0);
+ }
+}
+
+void Context::detachRenderbuffer(GLuint renderbuffer)
+{
+ // [OpenGL ES 2.0.24] section 4.4 page 109:
+ // If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though BindRenderbuffer
+ // had been executed with the target RENDERBUFFER and name of zero.
+
+ if (mState.renderbuffer.id() == renderbuffer)
+ {
+ bindRenderbuffer(0);
+ }
+
+ // [OpenGL ES 2.0.24] section 4.4 page 111:
+ // If a renderbuffer object is deleted while its image is attached to the currently bound framebuffer,
+ // then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of 0, for each attachment
+ // point to which this image was attached in the currently bound framebuffer.
+
+ Framebuffer *readFramebuffer = getReadFramebuffer();
+ Framebuffer *drawFramebuffer = getDrawFramebuffer();
+
+ if (readFramebuffer)
+ {
+ readFramebuffer->detachRenderbuffer(renderbuffer);
+ }
+
+ if (drawFramebuffer && drawFramebuffer != readFramebuffer)
+ {
+ drawFramebuffer->detachRenderbuffer(renderbuffer);
+ }
+}
+
+Texture *Context::getIncompleteTexture(SamplerType type)
+{
+ Texture *t = mIncompleteTextures[type].get();
+
+ if (t == NULL)
+ {
+ static const GLubyte color[] = { 0, 0, 0, 255 };
+
+ switch (type)
+ {
+ default:
+ UNREACHABLE();
+ // default falls through to SAMPLER_2D
+
+ case SAMPLER_2D:
+ {
+ Texture2D *incomplete2d = new Texture2D(Texture::INCOMPLETE_TEXTURE_ID);
+ incomplete2d->setImage(0, GL_RGBA, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ t = incomplete2d;
+ }
+ break;
+
+ case SAMPLER_CUBE:
+ {
+ TextureCubeMap *incompleteCube = new TextureCubeMap(Texture::INCOMPLETE_TEXTURE_ID);
+
+ incompleteCube->setImagePosX(0, GL_RGBA, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ incompleteCube->setImageNegX(0, GL_RGBA, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ incompleteCube->setImagePosY(0, GL_RGBA, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ incompleteCube->setImageNegY(0, GL_RGBA, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ incompleteCube->setImagePosZ(0, GL_RGBA, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ incompleteCube->setImageNegZ(0, GL_RGBA, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+
+ t = incompleteCube;
+ }
+ break;
+ }
+
+ mIncompleteTextures[type].set(t);
+ }
+
+ return t;
+}
+
+bool Context::cullSkipsDraw(GLenum drawMode)
+{
+ return mState.cullFace && mState.cullMode == GL_FRONT_AND_BACK && isTriangleMode(drawMode);
+}
+
+bool Context::isTriangleMode(GLenum drawMode)
+{
+ switch (drawMode)
+ {
+ case GL_TRIANGLES:
+ case GL_TRIANGLE_FAN:
+ case GL_TRIANGLE_STRIP:
+ return true;
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_LINE_LOOP:
+ case GL_LINE_STRIP:
+ return false;
+ default: UNREACHABLE();
+ }
+
+ return false;
+}
+
+void Context::setVertexAttrib(GLuint index, const GLfloat *values)
+{
+ ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
+
+ mState.vertexAttribute[index].mCurrentValue[0] = values[0];
+ mState.vertexAttribute[index].mCurrentValue[1] = values[1];
+ mState.vertexAttribute[index].mCurrentValue[2] = values[2];
+ mState.vertexAttribute[index].mCurrentValue[3] = values[3];
+
+ mVertexDataManager->dirtyCurrentValue(index);
+}
+
+void Context::initExtensionString()
+{
+ mExtensionString += "GL_OES_packed_depth_stencil ";
+ mExtensionString += "GL_EXT_texture_format_BGRA8888 ";
+ mExtensionString += "GL_EXT_read_format_bgra ";
+ mExtensionString += "GL_ANGLE_framebuffer_blit ";
+ mExtensionString += "GL_OES_rgb8_rgba8 ";
+ mExtensionString += "GL_OES_standard_derivatives ";
+
+ if (supportsEventQueries())
+ {
+ mExtensionString += "GL_NV_fence ";
+ }
+
+ if (supportsCompressedTextures())
+ {
+ mExtensionString += "GL_EXT_texture_compression_dxt1 ";
+ }
+
+ if (supportsFloatTextures())
+ {
+ mExtensionString += "GL_OES_texture_float ";
+ }
+
+ if (supportsHalfFloatTextures())
+ {
+ mExtensionString += "GL_OES_texture_half_float ";
+ }
+
+ if (supportsFloatLinearFilter())
+ {
+ mExtensionString += "GL_OES_texture_float_linear ";
+ }
+
+ if (supportsHalfFloatLinearFilter())
+ {
+ mExtensionString += "GL_OES_texture_half_float_linear ";
+ }
+
+ if (getMaxSupportedSamples() != 0)
+ {
+ mExtensionString += "GL_ANGLE_framebuffer_multisample ";
+ }
+
+ if (supports32bitIndices())
+ {
+ mExtensionString += "GL_OES_element_index_uint ";
+ }
+
+ std::string::size_type end = mExtensionString.find_last_not_of(' ');
+ if (end != std::string::npos)
+ {
+ mExtensionString.resize(end+1);
+ }
+}
+
+const char *Context::getExtensionString() const
+{
+ return mExtensionString.c_str();
+}
+
+void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask)
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ Framebuffer *readFramebuffer = getReadFramebuffer();
+ Framebuffer *drawFramebuffer = getDrawFramebuffer();
+
+ if (!readFramebuffer || readFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE ||
+ !drawFramebuffer || drawFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ }
+
+ if (drawFramebuffer->getSamples() != 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ RECT sourceRect;
+ RECT destRect;
+
+ if (srcX0 < srcX1)
+ {
+ sourceRect.left = srcX0;
+ sourceRect.right = srcX1;
+ destRect.left = dstX0;
+ destRect.right = dstX1;
+ }
+ else
+ {
+ sourceRect.left = srcX1;
+ destRect.left = dstX1;
+ sourceRect.right = srcX0;
+ destRect.right = dstX0;
+ }
+
+ // Arguments to StretchRect must be in D3D-style (0-top) coordinates, so we must
+ // flip our Y-values here
+ if (srcY0 < srcY1)
+ {
+ sourceRect.bottom = srcY1;
+ destRect.bottom = dstY1;
+ sourceRect.top = srcY0;
+ destRect.top = dstY0;
+ }
+ else
+ {
+ sourceRect.bottom = srcY0;
+ destRect.bottom = dstY0;
+ sourceRect.top = srcY1;
+ destRect.top = dstY1;
+ }
+
+ RECT sourceScissoredRect = sourceRect;
+ RECT destScissoredRect = destRect;
+
+ if (mState.scissorTest)
+ {
+ // Only write to parts of the destination framebuffer which pass the scissor test
+ // Please note: the destRect is now in D3D-style coordinates, so the *top* of the
+ // rect will be checked against scissorY, rather than the bottom.
+ if (destRect.left < mState.scissorX)
+ {
+ int xDiff = mState.scissorX - destRect.left;
+ destScissoredRect.left = mState.scissorX;
+ sourceScissoredRect.left += xDiff;
+ }
+
+ if (destRect.right > mState.scissorX + mState.scissorWidth)
+ {
+ int xDiff = destRect.right - (mState.scissorX + mState.scissorWidth);
+ destScissoredRect.right = mState.scissorX + mState.scissorWidth;
+ sourceScissoredRect.right -= xDiff;
+ }
+
+ if (destRect.top < mState.scissorY)
+ {
+ int yDiff = mState.scissorY - destRect.top;
+ destScissoredRect.top = mState.scissorY;
+ sourceScissoredRect.top += yDiff;
+ }
+
+ if (destRect.bottom > mState.scissorY + mState.scissorHeight)
+ {
+ int yDiff = destRect.bottom - (mState.scissorY + mState.scissorHeight);
+ destScissoredRect.bottom = mState.scissorY + mState.scissorHeight;
+ sourceScissoredRect.bottom -= yDiff;
+ }
+ }
+
+ bool blitRenderTarget = false;
+ bool blitDepthStencil = false;
+
+ RECT sourceTrimmedRect = sourceScissoredRect;
+ RECT destTrimmedRect = destScissoredRect;
+
+ // The source & destination rectangles also may need to be trimmed if they fall out of the bounds of
+ // the actual draw and read surfaces.
+ if (sourceTrimmedRect.left < 0)
+ {
+ int xDiff = 0 - sourceTrimmedRect.left;
+ sourceTrimmedRect.left = 0;
+ destTrimmedRect.left += xDiff;
+ }
+
+ int readBufferWidth = readFramebuffer->getColorbuffer()->getWidth();
+ int readBufferHeight = readFramebuffer->getColorbuffer()->getHeight();
+ int drawBufferWidth = drawFramebuffer->getColorbuffer()->getWidth();
+ int drawBufferHeight = drawFramebuffer->getColorbuffer()->getHeight();
+
+ if (sourceTrimmedRect.right > readBufferWidth)
+ {
+ int xDiff = sourceTrimmedRect.right - readBufferWidth;
+ sourceTrimmedRect.right = readBufferWidth;
+ destTrimmedRect.right -= xDiff;
+ }
+
+ if (sourceTrimmedRect.top < 0)
+ {
+ int yDiff = 0 - sourceTrimmedRect.top;
+ sourceTrimmedRect.top = 0;
+ destTrimmedRect.top += yDiff;
+ }
+
+ if (sourceTrimmedRect.bottom > readBufferHeight)
+ {
+ int yDiff = sourceTrimmedRect.bottom - readBufferHeight;
+ sourceTrimmedRect.bottom = readBufferHeight;
+ destTrimmedRect.bottom -= yDiff;
+ }
+
+ if (destTrimmedRect.left < 0)
+ {
+ int xDiff = 0 - destTrimmedRect.left;
+ destTrimmedRect.left = 0;
+ sourceTrimmedRect.left += xDiff;
+ }
+
+ if (destTrimmedRect.right > drawBufferWidth)
+ {
+ int xDiff = destTrimmedRect.right - drawBufferWidth;
+ destTrimmedRect.right = drawBufferWidth;
+ sourceTrimmedRect.right -= xDiff;
+ }
+
+ if (destTrimmedRect.top < 0)
+ {
+ int yDiff = 0 - destTrimmedRect.top;
+ destTrimmedRect.top = 0;
+ sourceTrimmedRect.top += yDiff;
+ }
+
+ if (destTrimmedRect.bottom > drawBufferHeight)
+ {
+ int yDiff = destTrimmedRect.bottom - drawBufferHeight;
+ destTrimmedRect.bottom = drawBufferHeight;
+ sourceTrimmedRect.bottom -= yDiff;
+ }
+
+ bool partialBufferCopy = false;
+ if (sourceTrimmedRect.bottom - sourceTrimmedRect.top < readBufferHeight ||
+ sourceTrimmedRect.right - sourceTrimmedRect.left < readBufferWidth ||
+ destTrimmedRect.bottom - destTrimmedRect.top < drawBufferHeight ||
+ destTrimmedRect.right - destTrimmedRect.left < drawBufferWidth ||
+ sourceTrimmedRect.top != 0 || destTrimmedRect.top != 0 || sourceTrimmedRect.left != 0 || destTrimmedRect.left != 0)
+ {
+ partialBufferCopy = true;
+ }
+
+ if (mask & GL_COLOR_BUFFER_BIT)
+ {
+ const bool validReadType = readFramebuffer->getColorbufferType() == GL_TEXTURE_2D ||
+ readFramebuffer->getColorbufferType() == GL_RENDERBUFFER;
+ const bool validDrawType = drawFramebuffer->getColorbufferType() == GL_TEXTURE_2D ||
+ drawFramebuffer->getColorbufferType() == GL_RENDERBUFFER;
+ if (!validReadType || !validDrawType ||
+ readFramebuffer->getColorbuffer()->getD3DFormat() != drawFramebuffer->getColorbuffer()->getD3DFormat())
+ {
+ ERR("Color buffer format conversion in BlitFramebufferANGLE not supported by this implementation");
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (partialBufferCopy && readFramebuffer->getSamples() != 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ blitRenderTarget = true;
+
+ }
+
+ if (mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT))
+ {
+ DepthStencilbuffer *readDSBuffer = NULL;
+ DepthStencilbuffer *drawDSBuffer = NULL;
+
+ // We support OES_packed_depth_stencil, and do not support a separately attached depth and stencil buffer, so if we have
+ // both a depth and stencil buffer, it will be the same buffer.
+
+ if (mask & GL_DEPTH_BUFFER_BIT)
+ {
+ if (readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer())
+ {
+ if (readFramebuffer->getDepthbufferType() != drawFramebuffer->getDepthbufferType() ||
+ readFramebuffer->getDepthbuffer()->getD3DFormat() != drawFramebuffer->getDepthbuffer()->getD3DFormat())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ blitDepthStencil = true;
+ readDSBuffer = readFramebuffer->getDepthbuffer();
+ drawDSBuffer = drawFramebuffer->getDepthbuffer();
+ }
+ }
+
+ if (mask & GL_STENCIL_BUFFER_BIT)
+ {
+ if (readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer())
+ {
+ if (readFramebuffer->getStencilbufferType() != drawFramebuffer->getStencilbufferType() ||
+ readFramebuffer->getStencilbuffer()->getD3DFormat() != drawFramebuffer->getStencilbuffer()->getD3DFormat())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ blitDepthStencil = true;
+ readDSBuffer = readFramebuffer->getStencilbuffer();
+ drawDSBuffer = drawFramebuffer->getStencilbuffer();
+ }
+ }
+
+ if (partialBufferCopy)
+ {
+ ERR("Only whole-buffer depth and stencil blits are supported by this implementation.");
+ return error(GL_INVALID_OPERATION); // only whole-buffer copies are permitted
+ }
+
+ if ((drawDSBuffer && drawDSBuffer->getSamples() != 0) ||
+ (readDSBuffer && readDSBuffer->getSamples() != 0))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+
+ if (blitRenderTarget || blitDepthStencil)
+ {
+ egl::Display *display = getDisplay();
+ display->endScene();
+
+ if (blitRenderTarget)
+ {
+ HRESULT result = device->StretchRect(readFramebuffer->getRenderTarget(), &sourceTrimmedRect,
+ drawFramebuffer->getRenderTarget(), &destTrimmedRect, D3DTEXF_NONE);
+
+ if (FAILED(result))
+ {
+ ERR("BlitFramebufferANGLE failed: StretchRect returned %x.", result);
+ return;
+ }
+ }
+
+ if (blitDepthStencil)
+ {
+ HRESULT result = device->StretchRect(readFramebuffer->getDepthStencil(), NULL, drawFramebuffer->getDepthStencil(), NULL, D3DTEXF_NONE);
+
+ if (FAILED(result))
+ {
+ ERR("BlitFramebufferANGLE failed: StretchRect returned %x.", result);
+ return;
+ }
+ }
+ }
+}
+
+}
+
+extern "C"
+{
+gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext)
+{
+ return new gl::Context(config, shareContext);
+}
+
+void glDestroyContext(gl::Context *context)
+{
+ delete context;
+
+ if (context == gl::getContext())
+ {
+ gl::makeCurrent(NULL, NULL, NULL);
+ }
+}
+
+void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface)
+{
+ gl::makeCurrent(context, display, surface);
+}
+
+gl::Context *glGetCurrentContext()
+{
+ return gl::getContext();
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h
new file mode 100644
index 0000000..2906664
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h
@@ -0,0 +1,543 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Context.h: Defines the gl::Context class, managing all GL state and performing
+// rendering operations. It is the GLES2 specific implementation of EGLContext.
+
+#ifndef LIBGLESV2_CONTEXT_H_
+#define LIBGLESV2_CONTEXT_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#define EGLAPI
+#include <EGL/egl.h>
+#include <d3d9.h>
+
+#include <map>
+
+#include "common/angleutils.h"
+#include "libGLESv2/ResourceManager.h"
+#include "libGLESv2/RefCountObject.h"
+
+namespace egl
+{
+class Display;
+class Surface;
+class Config;
+}
+
+namespace gl
+{
+struct TranslatedAttribute;
+struct TranslatedIndexData;
+
+class Buffer;
+class Shader;
+class Program;
+class Texture;
+class Texture2D;
+class TextureCubeMap;
+class Framebuffer;
+class Renderbuffer;
+class RenderbufferStorage;
+class Colorbuffer;
+class Depthbuffer;
+class Stencilbuffer;
+class DepthStencilbuffer;
+class VertexDataManager;
+class IndexDataManager;
+class Blit;
+class Fence;
+
+enum
+{
+ MAX_VERTEX_ATTRIBS = 16,
+ MAX_VERTEX_UNIFORM_VECTORS = 256 - 2, // 256 is the minimum for SM2, and in practice the maximum for DX9. Reserve space for dx_HalfPixelSize and dx_DepthRange.
+ MAX_VARYING_VECTORS_SM2 = 8,
+ MAX_VARYING_VECTORS_SM3 = 10,
+ MAX_COMBINED_TEXTURE_IMAGE_UNITS = 16,
+ MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0,
+ MAX_TEXTURE_IMAGE_UNITS = 16,
+ MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3, // Reserve space for dx_Viewport, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
+ MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
+ MAX_DRAW_BUFFERS = 1,
+
+ IMPLEMENTATION_COLOR_READ_FORMAT = GL_RGB,
+ IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5
+};
+
+const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
+const float ALIASED_LINE_WIDTH_RANGE_MAX = 1.0f;
+const float ALIASED_POINT_SIZE_RANGE_MIN = 1.0f;
+const float ALIASED_POINT_SIZE_RANGE_MAX_SM2 = 1.0f;
+const float ALIASED_POINT_SIZE_RANGE_MAX_SM3 = 64.0f;
+
+struct Color
+{
+ float red;
+ float green;
+ float blue;
+ float alpha;
+};
+
+// Helper structure describing a single vertex attribute
+class VertexAttribute
+{
+ public:
+ VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false)
+ {
+ mCurrentValue[0] = 0.0f;
+ mCurrentValue[1] = 0.0f;
+ mCurrentValue[2] = 0.0f;
+ mCurrentValue[3] = 1.0f;
+ }
+
+ int typeSize() const
+ {
+ switch (mType)
+ {
+ case GL_BYTE: return mSize * sizeof(GLbyte);
+ case GL_UNSIGNED_BYTE: return mSize * sizeof(GLubyte);
+ case GL_SHORT: return mSize * sizeof(GLshort);
+ case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
+ case GL_FIXED: return mSize * sizeof(GLfixed);
+ case GL_FLOAT: return mSize * sizeof(GLfloat);
+ default: UNREACHABLE(); return mSize * sizeof(GLfloat);
+ }
+ }
+
+ GLsizei stride() const
+ {
+ return mStride ? mStride : typeSize();
+ }
+
+ // From glVertexAttribPointer
+ GLenum mType;
+ GLint mSize;
+ bool mNormalized;
+ GLsizei mStride; // 0 means natural stride
+
+ union
+ {
+ const void *mPointer;
+ intptr_t mOffset;
+ };
+
+ BindingPointer<Buffer> mBoundBuffer; // Captured when glVertexAttribPointer is called.
+
+ bool mArrayEnabled; // From glEnable/DisableVertexAttribArray
+ float mCurrentValue[4]; // From glVertexAttrib
+};
+
+typedef VertexAttribute VertexAttributeArray[MAX_VERTEX_ATTRIBS];
+
+// Helper structure to store all raw state
+struct State
+{
+ Color colorClearValue;
+ GLclampf depthClearValue;
+ int stencilClearValue;
+
+ bool cullFace;
+ GLenum cullMode;
+ GLenum frontFace;
+ bool depthTest;
+ GLenum depthFunc;
+ bool blend;
+ GLenum sourceBlendRGB;
+ GLenum destBlendRGB;
+ GLenum sourceBlendAlpha;
+ GLenum destBlendAlpha;
+ GLenum blendEquationRGB;
+ GLenum blendEquationAlpha;
+ Color blendColor;
+ bool stencilTest;
+ GLenum stencilFunc;
+ GLint stencilRef;
+ GLuint stencilMask;
+ GLenum stencilFail;
+ GLenum stencilPassDepthFail;
+ GLenum stencilPassDepthPass;
+ GLuint stencilWritemask;
+ GLenum stencilBackFunc;
+ GLint stencilBackRef;
+ GLuint stencilBackMask;
+ GLenum stencilBackFail;
+ GLenum stencilBackPassDepthFail;
+ GLenum stencilBackPassDepthPass;
+ GLuint stencilBackWritemask;
+ bool polygonOffsetFill;
+ GLfloat polygonOffsetFactor;
+ GLfloat polygonOffsetUnits;
+ bool sampleAlphaToCoverage;
+ bool sampleCoverage;
+ GLclampf sampleCoverageValue;
+ bool sampleCoverageInvert;
+ bool scissorTest;
+ bool dither;
+
+ GLfloat lineWidth;
+
+ GLenum generateMipmapHint;
+ GLenum fragmentShaderDerivativeHint;
+
+ GLint viewportX;
+ GLint viewportY;
+ GLsizei viewportWidth;
+ GLsizei viewportHeight;
+ float zNear;
+ float zFar;
+
+ GLint scissorX;
+ GLint scissorY;
+ GLsizei scissorWidth;
+ GLsizei scissorHeight;
+
+ bool colorMaskRed;
+ bool colorMaskGreen;
+ bool colorMaskBlue;
+ bool colorMaskAlpha;
+ bool depthMask;
+
+ int activeSampler; // Active texture unit selector - GL_TEXTURE0
+ BindingPointer<Buffer> arrayBuffer;
+ BindingPointer<Buffer> elementArrayBuffer;
+ GLuint readFramebuffer;
+ GLuint drawFramebuffer;
+ BindingPointer<Renderbuffer> renderbuffer;
+ GLuint currentProgram;
+
+ VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
+ BindingPointer<Texture> samplerTexture[SAMPLER_TYPE_COUNT][MAX_TEXTURE_IMAGE_UNITS];
+
+ GLint unpackAlignment;
+ GLint packAlignment;
+};
+
+class Context
+{
+ public:
+ Context(const egl::Config *config, const gl::Context *shareContext);
+
+ ~Context();
+
+ void makeCurrent(egl::Display *display, egl::Surface *surface);
+
+ void markAllStateDirty();
+
+ // State manipulation
+ void setClearColor(float red, float green, float blue, float alpha);
+
+ void setClearDepth(float depth);
+
+ void setClearStencil(int stencil);
+
+ void setCullFace(bool enabled);
+ bool isCullFaceEnabled() const;
+
+ void setCullMode(GLenum mode);
+
+ void setFrontFace(GLenum front);
+
+ void setDepthTest(bool enabled);
+ bool isDepthTestEnabled() const;
+
+ void setDepthFunc(GLenum depthFunc);
+
+ void setDepthRange(float zNear, float zFar);
+
+ void setBlend(bool enabled);
+ bool isBlendEnabled() const;
+
+ void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
+ void setBlendColor(float red, float green, float blue, float alpha);
+ void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
+
+ void setStencilTest(bool enabled);
+ bool isStencilTestEnabled() const;
+
+ void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
+ void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
+ void setStencilWritemask(GLuint stencilWritemask);
+ void setStencilBackWritemask(GLuint stencilBackWritemask);
+ void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
+ void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
+
+ void setPolygonOffsetFill(bool enabled);
+ bool isPolygonOffsetFillEnabled() const;
+
+ void setPolygonOffsetParams(GLfloat factor, GLfloat units);
+
+ void setSampleAlphaToCoverage(bool enabled);
+ bool isSampleAlphaToCoverageEnabled() const;
+
+ void setSampleCoverage(bool enabled);
+ bool isSampleCoverageEnabled() const;
+
+ void setSampleCoverageParams(GLclampf value, bool invert);
+
+ void setScissorTest(bool enabled);
+ bool isScissorTestEnabled() const;
+
+ void setDither(bool enabled);
+ bool isDitherEnabled() const;
+
+ void setLineWidth(GLfloat width);
+
+ void setGenerateMipmapHint(GLenum hint);
+ void setFragmentShaderDerivativeHint(GLenum hint);
+
+ void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
+
+ void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
+
+ void setColorMask(bool red, bool green, bool blue, bool alpha);
+ void setDepthMask(bool mask);
+
+ void setActiveSampler(int active);
+
+ GLuint getReadFramebufferHandle() const;
+ GLuint getDrawFramebufferHandle() const;
+ GLuint getRenderbufferHandle() const;
+
+ GLuint getArrayBufferHandle() const;
+
+ void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
+ const VertexAttribute &getVertexAttribState(unsigned int attribNum);
+ void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
+ bool normalized, GLsizei stride, const void *pointer);
+ const void *getVertexAttribPointer(unsigned int attribNum) const;
+
+ const VertexAttributeArray &getVertexAttributes();
+
+ void setUnpackAlignment(GLint alignment);
+ GLint getUnpackAlignment() const;
+
+ void setPackAlignment(GLint alignment);
+ GLint getPackAlignment() const;
+
+ // These create and destroy methods are merely pass-throughs to
+ // ResourceManager, which owns these object types
+ GLuint createBuffer();
+ GLuint createShader(GLenum type);
+ GLuint createProgram();
+ GLuint createTexture();
+ GLuint createRenderbuffer();
+
+ void deleteBuffer(GLuint buffer);
+ void deleteShader(GLuint shader);
+ void deleteProgram(GLuint program);
+ void deleteTexture(GLuint texture);
+ void deleteRenderbuffer(GLuint renderbuffer);
+
+ // Framebuffers are owned by the Context, so these methods do not pass through
+ GLuint createFramebuffer();
+ void deleteFramebuffer(GLuint framebuffer);
+
+ // Fences are owned by the Context.
+ GLuint createFence();
+ void deleteFence(GLuint fence);
+
+ void bindArrayBuffer(GLuint buffer);
+ void bindElementArrayBuffer(GLuint buffer);
+ void bindTexture2D(GLuint texture);
+ void bindTextureCubeMap(GLuint texture);
+ void bindReadFramebuffer(GLuint framebuffer);
+ void bindDrawFramebuffer(GLuint framebuffer);
+ void bindRenderbuffer(GLuint renderbuffer);
+ void useProgram(GLuint program);
+
+ void setFramebufferZero(Framebuffer *framebuffer);
+
+ void setRenderbufferStorage(RenderbufferStorage *renderbuffer);
+
+ void setVertexAttrib(GLuint index, const GLfloat *values);
+
+ Buffer *getBuffer(GLuint handle);
+ Fence *getFence(GLuint handle);
+ Shader *getShader(GLuint handle);
+ Program *getProgram(GLuint handle);
+ Texture *getTexture(GLuint handle);
+ Framebuffer *getFramebuffer(GLuint handle);
+ Renderbuffer *getRenderbuffer(GLuint handle);
+
+ Buffer *getArrayBuffer();
+ Buffer *getElementArrayBuffer();
+ Program *getCurrentProgram();
+ Texture2D *getTexture2D();
+ TextureCubeMap *getTextureCubeMap();
+ Texture *getSamplerTexture(unsigned int sampler, SamplerType type);
+ Framebuffer *getReadFramebuffer();
+ Framebuffer *getDrawFramebuffer();
+
+ bool getFloatv(GLenum pname, GLfloat *params);
+ bool getIntegerv(GLenum pname, GLint *params);
+ bool getBooleanv(GLenum pname, GLboolean *params);
+
+ bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
+
+ bool applyRenderTarget(bool ignoreViewport);
+ void applyState(GLenum drawMode);
+ GLenum applyVertexBuffer(GLint first, GLsizei count);
+ GLenum applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
+ void applyShaders();
+ void applyTextures();
+
+ void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
+ void clear(GLbitfield mask);
+ void drawArrays(GLenum mode, GLint first, GLsizei count);
+ void drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
+ void finish();
+ void flush();
+
+ // Draw the last segment of a line loop
+ void drawClosingLine(unsigned int first, unsigned int last);
+ void drawClosingLine(GLsizei count, GLenum type, const void *indices);
+
+ void recordInvalidEnum();
+ void recordInvalidValue();
+ void recordInvalidOperation();
+ void recordOutOfMemory();
+ void recordInvalidFramebufferOperation();
+
+ GLenum getError();
+
+ bool supportsShaderModel3() const;
+ int getMaximumVaryingVectors() const;
+ int getMaximumFragmentUniformVectors() const;
+ int getMaximumRenderbufferDimension() const;
+ int getMaximumTextureDimension() const;
+ int getMaximumCubeTextureDimension() const;
+ int getMaximumTextureLevel() const;
+ GLsizei getMaxSupportedSamples() const;
+ int getNearestSupportedSamples(D3DFORMAT format, int requested) const;
+ const char *getExtensionString() const;
+ bool supportsEventQueries() const;
+ bool supportsCompressedTextures() const;
+ bool supportsFloatTextures() const;
+ bool supportsFloatLinearFilter() const;
+ bool supportsFloatRenderableTextures() const;
+ bool supportsHalfFloatTextures() const;
+ bool supportsHalfFloatLinearFilter() const;
+ bool supportsHalfFloatRenderableTextures() const;
+ bool supportsLuminanceTextures() const;
+ bool supportsLuminanceAlphaTextures() const;
+ bool supports32bitIndices() const;
+
+ void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask);
+
+ Blit *getBlitter() { return mBlit; }
+
+ const D3DCAPS9 &getDeviceCaps() { return mDeviceCaps; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Context);
+
+ void lookupAttributeMapping(TranslatedAttribute *attributes);
+
+ void detachBuffer(GLuint buffer);
+ void detachTexture(GLuint texture);
+ void detachFramebuffer(GLuint framebuffer);
+ void detachRenderbuffer(GLuint renderbuffer);
+
+ Texture *getIncompleteTexture(SamplerType type);
+
+ bool cullSkipsDraw(GLenum drawMode);
+ bool isTriangleMode(GLenum drawMode);
+
+ const egl::Config *const mConfig;
+
+ State mState;
+
+ BindingPointer<Texture2D> mTexture2DZero;
+ BindingPointer<TextureCubeMap> mTextureCubeMapZero;
+
+ typedef std::map<GLuint, Framebuffer*> FramebufferMap;
+ FramebufferMap mFramebufferMap;
+
+ typedef std::map<GLuint, Fence*> FenceMap;
+ FenceMap mFenceMap;
+
+ void initExtensionString();
+ std::string mExtensionString;
+
+ VertexDataManager *mVertexDataManager;
+ IndexDataManager *mIndexDataManager;
+
+ Blit *mBlit;
+
+ BindingPointer<Texture> mIncompleteTextures[SAMPLER_TYPE_COUNT];
+
+ // Recorded errors
+ bool mInvalidEnum;
+ bool mInvalidValue;
+ bool mInvalidOperation;
+ bool mOutOfMemory;
+ bool mInvalidFramebufferOperation;
+
+ bool mHasBeenCurrent;
+
+ unsigned int mAppliedProgram;
+ unsigned int mAppliedRenderTargetSerial;
+ unsigned int mAppliedDepthbufferSerial;
+ unsigned int mAppliedStencilbufferSerial;
+ bool mDepthStencilInitialized;
+
+ bool mSupportsShaderModel3;
+ int mMaxRenderbufferDimension;
+ int mMaxTextureDimension;
+ int mMaxCubeTextureDimension;
+ int mMaxTextureLevel;
+ std::map<D3DFORMAT, bool *> mMultiSampleSupport;
+ GLsizei mMaxSupportedSamples;
+ bool mSupportsEventQueries;
+ bool mSupportsCompressedTextures;
+ bool mSupportsFloatTextures;
+ bool mSupportsFloatLinearFilter;
+ bool mSupportsFloatRenderableTextures;
+ bool mSupportsHalfFloatTextures;
+ bool mSupportsHalfFloatLinearFilter;
+ bool mSupportsHalfFloatRenderableTextures;
+ bool mSupportsLuminanceTextures;
+ bool mSupportsLuminanceAlphaTextures;
+ bool mSupports32bitIndices;
+
+ // state caching flags
+ bool mClearStateDirty;
+ bool mCullStateDirty;
+ bool mDepthStateDirty;
+ bool mMaskStateDirty;
+ bool mPixelPackingStateDirty;
+ bool mBlendStateDirty;
+ bool mStencilStateDirty;
+ bool mPolygonOffsetStateDirty;
+ bool mScissorStateDirty;
+ bool mSampleStateDirty;
+ bool mFrontFaceDirty;
+ bool mDitherStateDirty;
+
+ IDirect3DStateBlock9 *mMaskedClearSavedState;
+
+ D3DCAPS9 mDeviceCaps;
+
+ ResourceManager *mResourceManager;
+};
+}
+
+extern "C"
+{
+// Exported functions for use by EGL
+gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext);
+void glDestroyContext(gl::Context *context);
+void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
+gl::Context *glGetCurrentContext();
+__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
+}
+
+#endif // INCLUDE_CONTEXT_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp
new file mode 100644
index 0000000..7fbcb6a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp
@@ -0,0 +1,134 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence.cpp: Implements the gl::Fence class, which supports the GL_NV_fence extension.
+
+#include "libGLESv2/Fence.h"
+
+#include "libGLESv2/main.h"
+
+namespace gl
+{
+
+Fence::Fence()
+{
+ mQuery = NULL;
+ mCondition = GL_NONE;
+ mStatus = GL_FALSE;
+}
+
+Fence::~Fence()
+{
+ if (mQuery != NULL)
+ {
+ mQuery->Release();
+ mQuery = NULL;
+ }
+}
+
+GLboolean Fence::isFence()
+{
+ // GL_NV_fence spec:
+ // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
+ return mQuery != NULL;
+}
+
+void Fence::setFence(GLenum condition)
+{
+ if (mQuery != NULL)
+ {
+ mQuery->Release();
+ mQuery = NULL;
+ }
+
+ if (FAILED(getDevice()->CreateQuery(D3DQUERYTYPE_EVENT, &mQuery)))
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ HRESULT result = mQuery->Issue(D3DISSUE_END);
+ ASSERT(SUCCEEDED(result));
+
+ mCondition = condition;
+ mStatus = GL_FALSE;
+}
+
+GLboolean Fence::testFence()
+{
+ if (mQuery == NULL)
+ {
+ return error(GL_INVALID_OPERATION, GL_TRUE);
+ }
+
+ HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
+
+ if (result == D3DERR_DEVICELOST)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_TRUE);
+ }
+
+ ASSERT(result == S_OK || result == S_FALSE);
+ mStatus = result == S_OK;
+ return mStatus;
+}
+
+void Fence::finishFence()
+{
+ if (mQuery == NULL)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ while (!testFence())
+ {
+ Sleep(0);
+ }
+}
+
+void Fence::getFenceiv(GLenum pname, GLint *params)
+{
+ if (mQuery == NULL)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_FENCE_STATUS_NV:
+ {
+ // GL_NV_fence spec:
+ // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
+ // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
+ if (mStatus)
+ {
+ params[0] = GL_TRUE;
+ return;
+ }
+
+ HRESULT result = mQuery->GetData(NULL, 0, 0);
+
+ if (result == D3DERR_DEVICELOST)
+ {
+ params[0] = GL_TRUE;
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ ASSERT(result == S_OK || result == S_FALSE);
+ mStatus = result == S_OK;
+ params[0] = mStatus;
+
+ break;
+ }
+ case GL_FENCE_CONDITION_NV:
+ params[0] = mCondition;
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ break;
+ }
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h
new file mode 100644
index 0000000..17bad78
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h
@@ -0,0 +1,43 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence.h: Defines the gl::Fence class, which supports the GL_NV_fence extension.
+
+#ifndef LIBGLESV2_FENCE_H_
+#define LIBGLESV2_FENCE_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <d3d9.h>
+
+#include "common/angleutils.h"
+
+namespace gl
+{
+
+class Fence
+{
+ public:
+ Fence();
+ virtual ~Fence();
+
+ GLboolean isFence();
+ void setFence(GLenum condition);
+ GLboolean testFence();
+ void finishFence();
+ void getFenceiv(GLenum pname, GLint *params);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Fence);
+
+ IDirect3DQuery9* mQuery;
+ GLenum mCondition;
+ GLboolean mStatus;
+};
+
+}
+
+#endif // LIBGLESV2_FENCE_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp
new file mode 100644
index 0000000..5fe01e0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp
@@ -0,0 +1,471 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer.cpp: Implements the gl::Framebuffer class. Implements GL framebuffer
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
+
+#include "libGLESv2/Framebuffer.h"
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/utilities.h"
+
+namespace gl
+{
+
+Framebuffer::Framebuffer()
+{
+ mColorbufferType = GL_NONE;
+ mDepthbufferType = GL_NONE;
+ mStencilbufferType = GL_NONE;
+}
+
+Framebuffer::~Framebuffer()
+{
+ mColorbufferPointer.set(NULL);
+ mDepthbufferPointer.set(NULL);
+ mStencilbufferPointer.set(NULL);
+}
+
+Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const
+{
+ gl::Context *context = gl::getContext();
+ Renderbuffer *buffer = NULL;
+
+ if (type == GL_NONE)
+ {
+ buffer = NULL;
+ }
+ else if (type == GL_RENDERBUFFER)
+ {
+ buffer = context->getRenderbuffer(handle);
+ }
+ else if (IsTextureTarget(type))
+ {
+ buffer = context->getTexture(handle)->getColorbuffer(type);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ return buffer;
+}
+
+void Framebuffer::setColorbuffer(GLenum type, GLuint colorbuffer)
+{
+ mColorbufferType = type;
+ mColorbufferPointer.set(lookupRenderbuffer(type, colorbuffer));
+}
+
+void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer)
+{
+ mDepthbufferType = type;
+ mDepthbufferPointer.set(lookupRenderbuffer(type, depthbuffer));
+}
+
+void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer)
+{
+ mStencilbufferType = type;
+ mStencilbufferPointer.set(lookupRenderbuffer(type, stencilbuffer));
+}
+
+void Framebuffer::detachTexture(GLuint texture)
+{
+ if (mColorbufferPointer.id() == texture && IsTextureTarget(mColorbufferType))
+ {
+ mColorbufferType = GL_NONE;
+ mColorbufferPointer.set(NULL);
+ }
+
+ if (mDepthbufferPointer.id() == texture && IsTextureTarget(mDepthbufferType))
+ {
+ mDepthbufferType = GL_NONE;
+ mDepthbufferPointer.set(NULL);
+ }
+
+ if (mStencilbufferPointer.id() == texture && IsTextureTarget(mStencilbufferType))
+ {
+ mStencilbufferType = GL_NONE;
+ mStencilbufferPointer.set(NULL);
+ }
+}
+
+void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
+{
+ if (mColorbufferPointer.id() == renderbuffer && mColorbufferType == GL_RENDERBUFFER)
+ {
+ mColorbufferType = GL_NONE;
+ mColorbufferPointer.set(NULL);
+ }
+
+ if (mDepthbufferPointer.id() == renderbuffer && mDepthbufferType == GL_RENDERBUFFER)
+ {
+ mDepthbufferType = GL_NONE;
+ mDepthbufferPointer.set(NULL);
+ }
+
+ if (mStencilbufferPointer.id() == renderbuffer && mStencilbufferType == GL_RENDERBUFFER)
+ {
+ mStencilbufferType = GL_NONE;
+ mStencilbufferPointer.set(NULL);
+ }
+}
+
+unsigned int Framebuffer::getRenderTargetSerial()
+{
+ Renderbuffer *colorbuffer = mColorbufferPointer.get();
+
+ if (colorbuffer)
+ {
+ return colorbuffer->getSerial();
+ }
+
+ return 0;
+}
+
+IDirect3DSurface9 *Framebuffer::getRenderTarget()
+{
+ Renderbuffer *colorbuffer = mColorbufferPointer.get();
+
+ if (colorbuffer)
+ {
+ return colorbuffer->getRenderTarget();
+ }
+
+ return NULL;
+}
+
+IDirect3DSurface9 *Framebuffer::getDepthStencil()
+{
+ Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get();
+
+ if (!depthstencilbuffer)
+ {
+ depthstencilbuffer = mStencilbufferPointer.get();
+ }
+
+ if (depthstencilbuffer)
+ {
+ return depthstencilbuffer->getDepthStencil();
+ }
+
+ return NULL;
+}
+
+unsigned int Framebuffer::getDepthbufferSerial()
+{
+ Renderbuffer *depthbuffer = mDepthbufferPointer.get();
+
+ if (depthbuffer)
+ {
+ return depthbuffer->getSerial();
+ }
+
+ return 0;
+}
+
+unsigned int Framebuffer::getStencilbufferSerial()
+{
+ Renderbuffer *stencilbuffer = mStencilbufferPointer.get();
+
+ if (stencilbuffer)
+ {
+ return stencilbuffer->getSerial();
+ }
+
+ return 0;
+}
+
+Colorbuffer *Framebuffer::getColorbuffer()
+{
+ Renderbuffer *rb = mColorbufferPointer.get();
+
+ if (rb != NULL && rb->isColorbuffer())
+ {
+ return static_cast<Colorbuffer*>(rb->getStorage());
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+DepthStencilbuffer *Framebuffer::getDepthbuffer()
+{
+ Renderbuffer *rb = mDepthbufferPointer.get();
+
+ if (rb != NULL && rb->isDepthbuffer())
+ {
+ return static_cast<DepthStencilbuffer*>(rb->getStorage());
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+DepthStencilbuffer *Framebuffer::getStencilbuffer()
+{
+ Renderbuffer *rb = mStencilbufferPointer.get();
+
+ if (rb != NULL && rb->isStencilbuffer())
+ {
+ return static_cast<DepthStencilbuffer*>(rb->getStorage());
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+GLenum Framebuffer::getColorbufferType()
+{
+ return mColorbufferType;
+}
+
+GLenum Framebuffer::getDepthbufferType()
+{
+ return mDepthbufferType;
+}
+
+GLenum Framebuffer::getStencilbufferType()
+{
+ return mStencilbufferType;
+}
+
+GLuint Framebuffer::getColorbufferHandle()
+{
+ return mColorbufferPointer.id();
+}
+
+GLuint Framebuffer::getDepthbufferHandle()
+{
+ return mDepthbufferPointer.id();
+}
+
+GLuint Framebuffer::getStencilbufferHandle()
+{
+ return mStencilbufferPointer.id();
+}
+
+bool Framebuffer::hasStencil()
+{
+ if (mStencilbufferType != GL_NONE)
+ {
+ DepthStencilbuffer *stencilbufferObject = getStencilbuffer();
+
+ if (stencilbufferObject)
+ {
+ return stencilbufferObject->getStencilSize() > 0;
+ }
+ }
+
+ return false;
+}
+
+bool Framebuffer::isMultisample()
+{
+ // If the framebuffer is not complete, attachment samples may be mismatched, and it
+ // cannot be used as a multisample framebuffer. If it is complete, it is required to
+ // have a color attachment, and all its attachments must have the same number of samples,
+ // so the number of samples for the colorbuffer will indicate whether the framebuffer is
+ // multisampled.
+ if (completeness() == GL_FRAMEBUFFER_COMPLETE && getColorbuffer()->getSamples() > 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+GLenum Framebuffer::completeness()
+{
+ int width = 0;
+ int height = 0;
+ int samples = -1;
+
+ if (mColorbufferType != GL_NONE)
+ {
+ Colorbuffer *colorbuffer = getColorbuffer();
+
+ if (!colorbuffer)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (colorbuffer->getWidth() == 0 || colorbuffer->getHeight() == 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (mColorbufferType == GL_RENDERBUFFER)
+ {
+ if (!gl::IsColorRenderable(colorbuffer->getFormat()))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+ }
+ else if (IsTextureTarget(mColorbufferType))
+ {
+ if (IsCompressed(colorbuffer->getFormat()))
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+
+ if (colorbuffer->isFloatingPoint() && (!getContext()->supportsFloatRenderableTextures() ||
+ !getContext()->supportsHalfFloatRenderableTextures()))
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+
+ if (colorbuffer->getFormat() == GL_LUMINANCE || colorbuffer->getFormat() == GL_LUMINANCE_ALPHA)
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+ }
+ else UNREACHABLE();
+
+ width = colorbuffer->getWidth();
+ height = colorbuffer->getHeight();
+ samples = colorbuffer->getSamples();
+ }
+ else
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
+ }
+
+ DepthStencilbuffer *depthbuffer = NULL;
+ DepthStencilbuffer *stencilbuffer = NULL;
+
+ if (mDepthbufferType != GL_NONE)
+ {
+ if (mDepthbufferType != GL_RENDERBUFFER)
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED; // Requires GL_OES_depth_texture
+ }
+
+ depthbuffer = getDepthbuffer();
+
+ if (!depthbuffer)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (depthbuffer->getWidth() == 0 || depthbuffer->getHeight() == 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (width == 0)
+ {
+ width = depthbuffer->getWidth();
+ height = depthbuffer->getHeight();
+ }
+ else if (width != depthbuffer->getWidth() || height != depthbuffer->getHeight())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
+ }
+
+ if (samples == -1)
+ {
+ samples = depthbuffer->getSamples();
+ }
+ else if (samples != depthbuffer->getSamples())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
+ }
+ }
+
+ if (mStencilbufferType != GL_NONE)
+ {
+ if (mStencilbufferType != GL_RENDERBUFFER)
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+
+ stencilbuffer = getStencilbuffer();
+
+ if (!stencilbuffer)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (stencilbuffer->getWidth() == 0 || stencilbuffer->getHeight() == 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (width == 0)
+ {
+ width = stencilbuffer->getWidth();
+ height = stencilbuffer->getHeight();
+ }
+ else if (width != stencilbuffer->getWidth() || height != stencilbuffer->getHeight())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
+ }
+
+ if (samples == -1)
+ {
+ samples = stencilbuffer->getSamples();
+ }
+ else if (samples != stencilbuffer->getSamples())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
+ }
+ }
+
+ if (mDepthbufferType == GL_RENDERBUFFER && mStencilbufferType == GL_RENDERBUFFER)
+ {
+ if (depthbuffer->getFormat() != GL_DEPTH24_STENCIL8_OES ||
+ stencilbuffer->getFormat() != GL_DEPTH24_STENCIL8_OES ||
+ depthbuffer->getSerial() != stencilbuffer->getSerial())
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+ }
+
+ return GL_FRAMEBUFFER_COMPLETE;
+}
+
+DefaultFramebuffer::DefaultFramebuffer(Colorbuffer *color, DepthStencilbuffer *depthStencil)
+{
+ mColorbufferType = GL_RENDERBUFFER;
+ mDepthbufferType = (depthStencil->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
+ mStencilbufferType = (depthStencil->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
+
+ mColorbufferPointer.set(new Renderbuffer(0, color));
+
+ Renderbuffer *depthStencilRenderbuffer = new Renderbuffer(0, depthStencil);
+ mDepthbufferPointer.set(depthStencilRenderbuffer);
+ mStencilbufferPointer.set(depthStencilRenderbuffer);
+}
+
+int Framebuffer::getSamples()
+{
+ if (completeness() == GL_FRAMEBUFFER_COMPLETE)
+ {
+ return getColorbuffer()->getSamples();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLenum DefaultFramebuffer::completeness()
+{
+ // The default framebuffer should always be complete
+ ASSERT(Framebuffer::completeness() == GL_FRAMEBUFFER_COMPLETE);
+
+ return GL_FRAMEBUFFER_COMPLETE;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h
new file mode 100644
index 0000000..0995145
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h
@@ -0,0 +1,96 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer.h: Defines the gl::Framebuffer class. Implements GL framebuffer
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
+
+#ifndef LIBGLESV2_FRAMEBUFFER_H_
+#define LIBGLESV2_FRAMEBUFFER_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <d3d9.h>
+
+#include "common/angleutils.h"
+#include "libGLESv2/RefCountObject.h"
+
+namespace gl
+{
+class Renderbuffer;
+class Colorbuffer;
+class Depthbuffer;
+class Stencilbuffer;
+class DepthStencilbuffer;
+
+class Framebuffer
+{
+ public:
+ Framebuffer();
+
+ virtual ~Framebuffer();
+
+ void setColorbuffer(GLenum type, GLuint colorbuffer);
+ void setDepthbuffer(GLenum type, GLuint depthbuffer);
+ void setStencilbuffer(GLenum type, GLuint stencilbuffer);
+
+ void detachTexture(GLuint texture);
+ void detachRenderbuffer(GLuint renderbuffer);
+
+ IDirect3DSurface9 *getRenderTarget();
+ IDirect3DSurface9 *getDepthStencil();
+
+ unsigned int getRenderTargetSerial();
+ unsigned int getDepthbufferSerial();
+ unsigned int getStencilbufferSerial();
+
+ Colorbuffer *getColorbuffer();
+ DepthStencilbuffer *getDepthbuffer();
+ DepthStencilbuffer *getStencilbuffer();
+
+ GLenum getColorbufferType();
+ GLenum getDepthbufferType();
+ GLenum getStencilbufferType();
+
+ GLuint getColorbufferHandle();
+ GLuint getDepthbufferHandle();
+ GLuint getStencilbufferHandle();
+
+ bool hasStencil();
+ bool isMultisample();
+ int getSamples();
+
+ virtual GLenum completeness();
+
+ protected:
+ GLenum mColorbufferType;
+ BindingPointer<Renderbuffer> mColorbufferPointer;
+
+ GLenum mDepthbufferType;
+ BindingPointer<Renderbuffer> mDepthbufferPointer;
+
+ GLenum mStencilbufferType;
+ BindingPointer<Renderbuffer> mStencilbufferPointer;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Framebuffer);
+
+ Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const;
+};
+
+class DefaultFramebuffer : public Framebuffer
+{
+ public:
+ DefaultFramebuffer(Colorbuffer *color, DepthStencilbuffer *depthStencil);
+
+ virtual GLenum completeness();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DefaultFramebuffer);
+};
+
+}
+
+#endif // LIBGLESV2_FRAMEBUFFER_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp
new file mode 100644
index 0000000..780c3e3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp
@@ -0,0 +1,2830 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Program.cpp: Implements the gl::Program class. Implements GL program objects
+// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
+
+#include "libGLESv2/Program.h"
+
+#include "common/debug.h"
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/Shader.h"
+#include "libGLESv2/utilities.h"
+
+namespace gl
+{
+unsigned int Program::mCurrentSerial = 1;
+
+std::string str(int i)
+{
+ char buffer[20];
+ sprintf(buffer, "%d", i);
+ return buffer;
+}
+
+Uniform::Uniform(GLenum type, const std::string &name, unsigned int arraySize) : type(type), name(name), arraySize(arraySize)
+{
+ int bytes = UniformTypeSize(type) * arraySize;
+ data = new unsigned char[bytes];
+ memset(data, 0, bytes);
+ dirty = true;
+ handlesSet = false;
+}
+
+Uniform::~Uniform()
+{
+ delete[] data;
+}
+
+UniformLocation::UniformLocation(const std::string &name, unsigned int element, unsigned int index)
+ : name(name), element(element), index(index)
+{
+}
+
+Program::Program(ResourceManager *manager, GLuint handle) : mResourceManager(manager), mHandle(handle), mSerial(issueSerial())
+{
+ mFragmentShader = NULL;
+ mVertexShader = NULL;
+
+ mPixelExecutable = NULL;
+ mVertexExecutable = NULL;
+ mConstantTablePS = NULL;
+ mConstantTableVS = NULL;
+
+ mInfoLog = NULL;
+ mValidated = false;
+
+ unlink();
+
+ mDeleteStatus = false;
+
+ mRefCount = 0;
+}
+
+Program::~Program()
+{
+ unlink(true);
+
+ if (mVertexShader != NULL)
+ {
+ mVertexShader->release();
+ }
+
+ if (mFragmentShader != NULL)
+ {
+ mFragmentShader->release();
+ }
+}
+
+bool Program::attachShader(Shader *shader)
+{
+ if (shader->getType() == GL_VERTEX_SHADER)
+ {
+ if (mVertexShader)
+ {
+ return false;
+ }
+
+ mVertexShader = (VertexShader*)shader;
+ mVertexShader->addRef();
+ }
+ else if (shader->getType() == GL_FRAGMENT_SHADER)
+ {
+ if (mFragmentShader)
+ {
+ return false;
+ }
+
+ mFragmentShader = (FragmentShader*)shader;
+ mFragmentShader->addRef();
+ }
+ else UNREACHABLE();
+
+ return true;
+}
+
+bool Program::detachShader(Shader *shader)
+{
+ if (shader->getType() == GL_VERTEX_SHADER)
+ {
+ if (mVertexShader != shader)
+ {
+ return false;
+ }
+
+ mVertexShader->release();
+ mVertexShader = NULL;
+ }
+ else if (shader->getType() == GL_FRAGMENT_SHADER)
+ {
+ if (mFragmentShader != shader)
+ {
+ return false;
+ }
+
+ mFragmentShader->release();
+ mFragmentShader = NULL;
+ }
+ else UNREACHABLE();
+
+ unlink();
+
+ return true;
+}
+
+int Program::getAttachedShadersCount() const
+{
+ return (mVertexShader ? 1 : 0) + (mFragmentShader ? 1 : 0);
+}
+
+IDirect3DPixelShader9 *Program::getPixelShader()
+{
+ return mPixelExecutable;
+}
+
+IDirect3DVertexShader9 *Program::getVertexShader()
+{
+ return mVertexExecutable;
+}
+
+void Program::bindAttributeLocation(GLuint index, const char *name)
+{
+ if (index < MAX_VERTEX_ATTRIBS)
+ {
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ mAttributeBinding[i].erase(name);
+ }
+
+ mAttributeBinding[index].insert(name);
+ }
+}
+
+GLuint Program::getAttributeLocation(const char *name)
+{
+ if (name)
+ {
+ for (int index = 0; index < MAX_VERTEX_ATTRIBS; index++)
+ {
+ if (mLinkedAttribute[index].name == std::string(name))
+ {
+ return index;
+ }
+ }
+ }
+
+ return -1;
+}
+
+int Program::getSemanticIndex(int attributeIndex)
+{
+ if (attributeIndex >= 0 && attributeIndex < MAX_VERTEX_ATTRIBS)
+ {
+ return mSemanticIndex[attributeIndex];
+ }
+
+ return -1;
+}
+
+// Returns the index of the texture unit corresponding to a Direct3D 9 sampler
+// index referenced in the compiled HLSL shader
+GLint Program::getSamplerMapping(unsigned int samplerIndex)
+{
+ assert(samplerIndex < sizeof(mSamplers)/sizeof(mSamplers[0]));
+
+ GLint logicalTextureUnit = -1;
+
+ if (mSamplers[samplerIndex].active)
+ {
+ logicalTextureUnit = mSamplers[samplerIndex].logicalTextureUnit;
+ }
+
+ if (logicalTextureUnit >= 0 && logicalTextureUnit < MAX_TEXTURE_IMAGE_UNITS)
+ {
+ return logicalTextureUnit;
+ }
+
+ return -1;
+}
+
+SamplerType Program::getSamplerType(unsigned int samplerIndex)
+{
+ assert(samplerIndex < sizeof(mSamplers)/sizeof(mSamplers[0]));
+ assert(mSamplers[samplerIndex].active);
+
+ return mSamplers[samplerIndex].type;
+}
+
+bool Program::isSamplerDirty(unsigned int samplerIndex) const
+{
+ if (samplerIndex < sizeof(mSamplers)/sizeof(mSamplers[0]))
+ {
+ return mSamplers[samplerIndex].dirty;
+ }
+ else UNREACHABLE();
+
+ return false;
+}
+
+void Program::setSamplerDirty(unsigned int samplerIndex, bool dirty)
+{
+ if (samplerIndex < sizeof(mSamplers)/sizeof(mSamplers[0]))
+ {
+ mSamplers[samplerIndex].dirty = dirty;
+ }
+ else UNREACHABLE();
+}
+
+GLint Program::getUniformLocation(const char *name, bool decorated)
+{
+ std::string _name = decorated ? name : decorate(name);
+ int subscript = 0;
+
+ // Strip any trailing array operator and retrieve the subscript
+ size_t open = _name.find_last_of('[');
+ size_t close = _name.find_last_of(']');
+ if (open != std::string::npos && close == _name.length() - 1)
+ {
+ subscript = atoi(_name.substr(open + 1).c_str());
+ _name.erase(open);
+ }
+
+ unsigned int numUniforms = mUniformIndex.size();
+ for (unsigned int location = 0; location < numUniforms; location++)
+ {
+ if (mUniformIndex[location].name == _name &&
+ mUniformIndex[location].element == subscript)
+ {
+ return location;
+ }
+ }
+
+ return -1;
+}
+
+bool Program::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_FLOAT)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat),
+ v, sizeof(GLfloat) * count);
+ }
+ else if (targetUniform->type == GL_BOOL)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+ GLboolean *boolParams = new GLboolean[count];
+
+ for (int i = 0; i < count; ++i)
+ {
+ if (v[i] == 0.0f)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean),
+ boolParams, sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_FLOAT_VEC2)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 2,
+ v, 2 * sizeof(GLfloat) * count);
+ }
+ else if (targetUniform->type == GL_BOOL_VEC2)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ GLboolean *boolParams = new GLboolean[count * 2];
+
+ for (int i = 0; i < count * 2; ++i)
+ {
+ if (v[i] == 0.0f)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 2,
+ boolParams, 2 * sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_FLOAT_VEC3)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 3,
+ v, 3 * sizeof(GLfloat) * count);
+ }
+ else if (targetUniform->type == GL_BOOL_VEC3)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+ GLboolean *boolParams = new GLboolean[count * 3];
+
+ for (int i = 0; i < count * 3; ++i)
+ {
+ if (v[i] == 0.0f)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 3,
+ boolParams, 3 * sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_FLOAT_VEC4)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 4,
+ v, 4 * sizeof(GLfloat) * count);
+ }
+ else if (targetUniform->type == GL_BOOL_VEC4)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+ GLboolean *boolParams = new GLboolean[count * 4];
+
+ for (int i = 0; i < count * 4; ++i)
+ {
+ if (v[i] == 0.0f)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 4,
+ boolParams, 4 * sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type != GL_FLOAT_MAT2)
+ {
+ return false;
+ }
+
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 4,
+ value, 4 * sizeof(GLfloat) * count);
+
+ return true;
+}
+
+bool Program::setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type != GL_FLOAT_MAT3)
+ {
+ return false;
+ }
+
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 9,
+ value, 9 * sizeof(GLfloat) * count);
+
+ return true;
+}
+
+bool Program::setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type != GL_FLOAT_MAT4)
+ {
+ return false;
+ }
+
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 16,
+ value, 16 * sizeof(GLfloat) * count);
+
+ return true;
+}
+
+bool Program::setUniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_INT ||
+ targetUniform->type == GL_SAMPLER_2D ||
+ targetUniform->type == GL_SAMPLER_CUBE)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint),
+ v, sizeof(GLint) * count);
+ }
+ else if (targetUniform->type == GL_BOOL)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+ GLboolean *boolParams = new GLboolean[count];
+
+ for (int i = 0; i < count; ++i)
+ {
+ if (v[i] == 0)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean),
+ boolParams, sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::setUniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_INT_VEC2)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint) * 2,
+ v, 2 * sizeof(GLint) * count);
+ }
+ else if (targetUniform->type == GL_BOOL_VEC2)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+ GLboolean *boolParams = new GLboolean[count * 2];
+
+ for (int i = 0; i < count * 2; ++i)
+ {
+ if (v[i] == 0)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 2,
+ boolParams, 2 * sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::setUniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_INT_VEC3)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint) * 3,
+ v, 3 * sizeof(GLint) * count);
+ }
+ else if (targetUniform->type == GL_BOOL_VEC3)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+ GLboolean *boolParams = new GLboolean[count * 3];
+
+ for (int i = 0; i < count * 3; ++i)
+ {
+ if (v[i] == 0)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 3,
+ boolParams, 3 * sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::setUniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ targetUniform->dirty = true;
+
+ if (targetUniform->type == GL_INT_VEC4)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint) * 4,
+ v, 4 * sizeof(GLint) * count);
+ }
+ else if (targetUniform->type == GL_BOOL_VEC4)
+ {
+ int arraySize = targetUniform->arraySize;
+
+ if (arraySize == 1 && count > 1)
+ return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+
+ count = std::min(arraySize - (int)mUniformIndex[location].element, count);
+ GLboolean *boolParams = new GLboolean[count * 4];
+
+ for (int i = 0; i < count * 4; ++i)
+ {
+ if (v[i] == 0)
+ {
+ boolParams[i] = GL_FALSE;
+ }
+ else
+ {
+ boolParams[i] = GL_TRUE;
+ }
+ }
+
+ memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 4,
+ boolParams, 4 * sizeof(GLboolean) * count);
+
+ delete [] boolParams;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::getUniformfv(GLint location, GLfloat *params)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ unsigned int count = UniformComponentCount(targetUniform->type);
+
+ switch (UniformComponentType(targetUniform->type))
+ {
+ case GL_BOOL:
+ {
+ GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * count;
+
+ for (unsigned int i = 0; i < count; ++i)
+ {
+ params[i] = (boolParams[i] == GL_FALSE) ? 0.0f : 1.0f;
+ }
+ }
+ break;
+ case GL_FLOAT:
+ memcpy(params, targetUniform->data + mUniformIndex[location].element * count * sizeof(GLfloat),
+ count * sizeof(GLfloat));
+ break;
+ case GL_INT:
+ {
+ GLint *intParams = (GLint*)targetUniform->data + mUniformIndex[location].element * count;
+
+ for (unsigned int i = 0; i < count; ++i)
+ {
+ params[i] = (float)intParams[i];
+ }
+ }
+ break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool Program::getUniformiv(GLint location, GLint *params)
+{
+ if (location < 0 || location >= (int)mUniformIndex.size())
+ {
+ return false;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ unsigned int count = UniformComponentCount(targetUniform->type);
+
+ switch (UniformComponentType(targetUniform->type))
+ {
+ case GL_BOOL:
+ {
+ GLboolean *boolParams = targetUniform->data + mUniformIndex[location].element * count;
+
+ for (unsigned int i = 0; i < count; ++i)
+ {
+ params[i] = (GLint)boolParams[i];
+ }
+ }
+ break;
+ case GL_FLOAT:
+ {
+ GLfloat *floatParams = (GLfloat*)targetUniform->data + mUniformIndex[location].element * count;
+
+ for (unsigned int i = 0; i < count; ++i)
+ {
+ params[i] = (GLint)floatParams[i];
+ }
+ }
+ break;
+ case GL_INT:
+ memcpy(params, targetUniform->data + mUniformIndex[location].element * count * sizeof(GLint),
+ count * sizeof(GLint));
+ break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+void Program::dirtyAllUniforms()
+{
+ unsigned int numUniforms = mUniforms.size();
+ for (unsigned int index = 0; index < numUniforms; index++)
+ {
+ mUniforms[index]->dirty = true;
+ }
+}
+
+void Program::dirtyAllSamplers()
+{
+ for (unsigned int index = 0; index < MAX_TEXTURE_IMAGE_UNITS; ++index)
+ {
+ mSamplers[index].dirty = true;
+ }
+}
+
+// Applies all the uniforms set for this program object to the Direct3D 9 device
+void Program::applyUniforms()
+{
+ unsigned int numUniforms = mUniformIndex.size();
+ for (unsigned int location = 0; location < numUniforms; location++)
+ {
+ if (mUniformIndex[location].element != 0)
+ {
+ continue;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ if (targetUniform->dirty)
+ {
+ int arraySize = targetUniform->arraySize;
+ GLfloat *f = (GLfloat*)targetUniform->data;
+ GLint *i = (GLint*)targetUniform->data;
+ GLboolean *b = (GLboolean*)targetUniform->data;
+
+ switch (targetUniform->type)
+ {
+ case GL_BOOL: applyUniform1bv(location, arraySize, b); break;
+ case GL_BOOL_VEC2: applyUniform2bv(location, arraySize, b); break;
+ case GL_BOOL_VEC3: applyUniform3bv(location, arraySize, b); break;
+ case GL_BOOL_VEC4: applyUniform4bv(location, arraySize, b); break;
+ case GL_FLOAT: applyUniform1fv(location, arraySize, f); break;
+ case GL_FLOAT_VEC2: applyUniform2fv(location, arraySize, f); break;
+ case GL_FLOAT_VEC3: applyUniform3fv(location, arraySize, f); break;
+ case GL_FLOAT_VEC4: applyUniform4fv(location, arraySize, f); break;
+ case GL_FLOAT_MAT2: applyUniformMatrix2fv(location, arraySize, f); break;
+ case GL_FLOAT_MAT3: applyUniformMatrix3fv(location, arraySize, f); break;
+ case GL_FLOAT_MAT4: applyUniformMatrix4fv(location, arraySize, f); break;
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_INT: applyUniform1iv(location, arraySize, i); break;
+ case GL_INT_VEC2: applyUniform2iv(location, arraySize, i); break;
+ case GL_INT_VEC3: applyUniform3iv(location, arraySize, i); break;
+ case GL_INT_VEC4: applyUniform4iv(location, arraySize, i); break;
+ default:
+ UNREACHABLE();
+ }
+
+ targetUniform->dirty = false;
+ }
+ }
+}
+
+// Compiles the HLSL code of the attached shaders into executable binaries
+ID3DXBuffer *Program::compileToBinary(const char *hlsl, const char *profile, ID3DXConstantTable **constantTable)
+{
+ if (!hlsl)
+ {
+ return NULL;
+ }
+
+ ID3DXBuffer *binary = NULL;
+ ID3DXBuffer *errorMessage = NULL;
+
+ HRESULT result = D3DXCompileShader(hlsl, (UINT)strlen(hlsl), NULL, NULL, "main", profile, 0, &binary, &errorMessage, constantTable);
+
+ if (SUCCEEDED(result))
+ {
+ return binary;
+ }
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ return error(GL_OUT_OF_MEMORY, (ID3DXBuffer*)NULL);
+ }
+
+ if (errorMessage)
+ {
+ const char *message = (const char*)errorMessage->GetBufferPointer();
+
+ appendToInfoLog("%s\n", message);
+ TRACE("\n%s", hlsl);
+ TRACE("\n%s", message);
+ }
+
+ return NULL;
+}
+
+// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
+// Returns the number of used varying registers, or -1 if unsuccesful
+int Program::packVaryings(const Varying *packing[][4])
+{
+ Context *context = getContext();
+ const int maxVaryingVectors = context->getMaximumVaryingVectors();
+
+ for (VaryingList::iterator varying = mFragmentShader->varyings.begin(); varying != mFragmentShader->varyings.end(); varying++)
+ {
+ int n = VariableRowCount(varying->type) * varying->size;
+ int m = VariableColumnCount(varying->type);
+ bool success = false;
+
+ if (m == 2 || m == 3 || m == 4)
+ {
+ for (int r = 0; r <= maxVaryingVectors - n && !success; r++)
+ {
+ bool available = true;
+
+ for (int y = 0; y < n && available; y++)
+ {
+ for (int x = 0; x < m && available; x++)
+ {
+ if (packing[r + y][x])
+ {
+ available = false;
+ }
+ }
+ }
+
+ if (available)
+ {
+ varying->reg = r;
+ varying->col = 0;
+
+ for (int y = 0; y < n; y++)
+ {
+ for (int x = 0; x < m; x++)
+ {
+ packing[r + y][x] = &*varying;
+ }
+ }
+
+ success = true;
+ }
+ }
+
+ if (!success && m == 2)
+ {
+ for (int r = maxVaryingVectors - n; r >= 0 && !success; r--)
+ {
+ bool available = true;
+
+ for (int y = 0; y < n && available; y++)
+ {
+ for (int x = 2; x < 4 && available; x++)
+ {
+ if (packing[r + y][x])
+ {
+ available = false;
+ }
+ }
+ }
+
+ if (available)
+ {
+ varying->reg = r;
+ varying->col = 2;
+
+ for (int y = 0; y < n; y++)
+ {
+ for (int x = 2; x < 4; x++)
+ {
+ packing[r + y][x] = &*varying;
+ }
+ }
+
+ success = true;
+ }
+ }
+ }
+ }
+ else if (m == 1)
+ {
+ int space[4] = {0};
+
+ for (int y = 0; y < maxVaryingVectors; y++)
+ {
+ for (int x = 0; x < 4; x++)
+ {
+ space[x] += packing[y][x] ? 0 : 1;
+ }
+ }
+
+ int column = 0;
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (space[x] > n && space[x] < space[column])
+ {
+ column = x;
+ }
+ }
+
+ if (space[column] > n)
+ {
+ for (int r = 0; r < maxVaryingVectors; r++)
+ {
+ if (!packing[r][column])
+ {
+ varying->reg = r;
+
+ for (int y = r; y < r + n; y++)
+ {
+ packing[y][column] = &*varying;
+ }
+
+ break;
+ }
+ }
+
+ varying->col = column;
+
+ success = true;
+ }
+ }
+ else UNREACHABLE();
+
+ if (!success)
+ {
+ appendToInfoLog("Could not pack varying %s", varying->name.c_str());
+
+ return -1;
+ }
+ }
+
+ // Return the number of used registers
+ int registers = 0;
+
+ for (int r = 0; r < maxVaryingVectors; r++)
+ {
+ if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
+ {
+ registers++;
+ }
+ }
+
+ return registers;
+}
+
+bool Program::linkVaryings()
+{
+ if (mPixelHLSL.empty() || mVertexHLSL.empty())
+ {
+ return false;
+ }
+
+ const Varying *packing[MAX_VARYING_VECTORS_SM3][4] = {NULL};
+ int registers = packVaryings(packing);
+
+ if (registers < 0)
+ {
+ return false;
+ }
+
+ Context *context = getContext();
+ const bool sm3 = context->supportsShaderModel3();
+ const int maxVaryingVectors = context->getMaximumVaryingVectors();
+
+ if (registers == maxVaryingVectors && mFragmentShader->mUsesFragCoord)
+ {
+ appendToInfoLog("No varying registers left to support gl_FragCoord");
+
+ return false;
+ }
+
+ for (VaryingList::iterator input = mFragmentShader->varyings.begin(); input != mFragmentShader->varyings.end(); input++)
+ {
+ bool matched = false;
+
+ for (VaryingList::iterator output = mVertexShader->varyings.begin(); output != mVertexShader->varyings.end(); output++)
+ {
+ if (output->name == input->name)
+ {
+ if (output->type != input->type || output->size != input->size)
+ {
+ appendToInfoLog("Type of vertex varying %s does not match that of the fragment varying", output->name.c_str());
+
+ return false;
+ }
+
+ output->reg = input->reg;
+ output->col = input->col;
+
+ matched = true;
+ break;
+ }
+ }
+
+ if (!matched)
+ {
+ appendToInfoLog("Fragment varying varying %s does not match any vertex varying", input->name.c_str());
+
+ return false;
+ }
+ }
+
+ std::string varyingSemantic = (sm3 ? "COLOR" : "TEXCOORD");
+
+ mVertexHLSL += "struct VS_INPUT\n"
+ "{\n";
+
+ int semanticIndex = 0;
+ for (AttributeArray::iterator attribute = mVertexShader->mAttributes.begin(); attribute != mVertexShader->mAttributes.end(); attribute++)
+ {
+ switch (attribute->type)
+ {
+ case GL_FLOAT: mVertexHLSL += " float "; break;
+ case GL_FLOAT_VEC2: mVertexHLSL += " float2 "; break;
+ case GL_FLOAT_VEC3: mVertexHLSL += " float3 "; break;
+ case GL_FLOAT_VEC4: mVertexHLSL += " float4 "; break;
+ case GL_FLOAT_MAT2: mVertexHLSL += " float2x2 "; break;
+ case GL_FLOAT_MAT3: mVertexHLSL += " float3x3 "; break;
+ case GL_FLOAT_MAT4: mVertexHLSL += " float4x4 "; break;
+ default: UNREACHABLE();
+ }
+
+ mVertexHLSL += decorate(attribute->name) + " : TEXCOORD" + str(semanticIndex) + ";\n";
+
+ semanticIndex += VariableRowCount(attribute->type);
+ }
+
+ mVertexHLSL += "};\n"
+ "\n"
+ "struct VS_OUTPUT\n"
+ "{\n"
+ " float4 gl_Position : POSITION;\n";
+
+ for (int r = 0; r < registers; r++)
+ {
+ int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
+
+ mVertexHLSL += " float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
+ }
+
+ if (mFragmentShader->mUsesFragCoord)
+ {
+ mVertexHLSL += " float4 gl_FragCoord : " + varyingSemantic + str(registers) + ";\n";
+ }
+
+ if (mVertexShader->mUsesPointSize && sm3)
+ {
+ mVertexHLSL += " float gl_PointSize : PSIZE;\n";
+ }
+
+ mVertexHLSL += "};\n"
+ "\n"
+ "VS_OUTPUT main(VS_INPUT input)\n"
+ "{\n";
+
+ for (AttributeArray::iterator attribute = mVertexShader->mAttributes.begin(); attribute != mVertexShader->mAttributes.end(); attribute++)
+ {
+ mVertexHLSL += " " + decorate(attribute->name) + " = ";
+
+ if (VariableRowCount(attribute->type) > 1) // Matrix
+ {
+ mVertexHLSL += "transpose";
+ }
+
+ mVertexHLSL += "(input." + decorate(attribute->name) + ");\n";
+ }
+
+ mVertexHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " VS_OUTPUT output;\n"
+ " output.gl_Position.x = gl_Position.x - dx_HalfPixelSize.x * gl_Position.w;\n"
+ " output.gl_Position.y = -(gl_Position.y - dx_HalfPixelSize.y * gl_Position.w);\n"
+ " output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
+ " output.gl_Position.w = gl_Position.w;\n";
+
+ if (mVertexShader->mUsesPointSize && sm3)
+ {
+ mVertexHLSL += " output.gl_PointSize = clamp(gl_PointSize, 1.0, " + str((int)ALIASED_POINT_SIZE_RANGE_MAX_SM3) + ");\n";
+ }
+
+ if (mFragmentShader->mUsesFragCoord)
+ {
+ mVertexHLSL += " output.gl_FragCoord = gl_Position;\n";
+ }
+
+ for (VaryingList::iterator varying = mVertexShader->varyings.begin(); varying != mVertexShader->varyings.end(); varying++)
+ {
+ if (varying->reg >= 0)
+ {
+ for (int i = 0; i < varying->size; i++)
+ {
+ int rows = VariableRowCount(varying->type);
+
+ for (int j = 0; j < rows; j++)
+ {
+ int r = varying->reg + i * rows + j;
+ mVertexHLSL += " output.v" + str(r);
+
+ bool sharedRegister = false; // Register used by multiple varyings
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (packing[r][x] && packing[r][x] != packing[r][0])
+ {
+ sharedRegister = true;
+ break;
+ }
+ }
+
+ if(sharedRegister)
+ {
+ mVertexHLSL += ".";
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (packing[r][x] == &*varying)
+ {
+ switch(x)
+ {
+ case 0: mVertexHLSL += "x"; break;
+ case 1: mVertexHLSL += "y"; break;
+ case 2: mVertexHLSL += "z"; break;
+ case 3: mVertexHLSL += "w"; break;
+ }
+ }
+ }
+ }
+
+ mVertexHLSL += " = " + varying->name;
+
+ if (varying->array)
+ {
+ mVertexHLSL += "[" + str(i) + "]";
+ }
+
+ if (rows > 1)
+ {
+ mVertexHLSL += "[" + str(j) + "]";
+ }
+
+ mVertexHLSL += ";\n";
+ }
+ }
+ }
+ }
+
+ mVertexHLSL += "\n"
+ " return output;\n"
+ "}\n";
+
+ mPixelHLSL += "struct PS_INPUT\n"
+ "{\n";
+
+ for (VaryingList::iterator varying = mFragmentShader->varyings.begin(); varying != mFragmentShader->varyings.end(); varying++)
+ {
+ if (varying->reg >= 0)
+ {
+ for (int i = 0; i < varying->size; i++)
+ {
+ int rows = VariableRowCount(varying->type);
+ for (int j = 0; j < rows; j++)
+ {
+ std::string n = str(varying->reg + i * rows + j);
+ mPixelHLSL += " float4 v" + n + " : " + varyingSemantic + n + ";\n";
+ }
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ if (mFragmentShader->mUsesFragCoord)
+ {
+ mPixelHLSL += " float4 gl_FragCoord : " + varyingSemantic + str(registers) + ";\n";
+ if (sm3) {
+ mPixelHLSL += " float2 dx_VPos : VPOS;\n";
+ }
+ }
+
+ if (mFragmentShader->mUsesPointCoord && sm3)
+ {
+ mPixelHLSL += " float2 gl_PointCoord : TEXCOORD0;\n";
+ }
+
+ if (mFragmentShader->mUsesFrontFacing)
+ {
+ mPixelHLSL += " float vFace : VFACE;\n";
+ }
+
+ mPixelHLSL += "};\n"
+ "\n"
+ "struct PS_OUTPUT\n"
+ "{\n"
+ " float4 gl_Color[1] : COLOR;\n"
+ "};\n"
+ "\n"
+ "PS_OUTPUT main(PS_INPUT input)\n"
+ "{\n";
+
+ if (mFragmentShader->mUsesFragCoord)
+ {
+ mPixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
+ if (sm3) {
+ mPixelHLSL += " gl_FragCoord.x = input.dx_VPos.x;\n"
+ " gl_FragCoord.y = input.dx_VPos.y;\n";
+ } else {
+ mPixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Viewport.x + dx_Viewport.z;\n"
+ " gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_Viewport.y + dx_Viewport.w;\n";
+ }
+ mPixelHLSL += " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_Depth.x + dx_Depth.y;\n"
+ " gl_FragCoord.w = rhw;\n";
+ }
+
+ if (mFragmentShader->mUsesPointCoord && sm3)
+ {
+ mPixelHLSL += " gl_PointCoord = float2(input.gl_PointCoord.x, 1.0 - input.gl_PointCoord.y);\n";
+ }
+
+ if (mFragmentShader->mUsesFrontFacing)
+ {
+ mPixelHLSL += " gl_FrontFacing = dx_PointsOrLines || (dx_FrontCCW ? (input.vFace >= 0.0) : (input.vFace <= 0.0));\n";
+ }
+
+ for (VaryingList::iterator varying = mFragmentShader->varyings.begin(); varying != mFragmentShader->varyings.end(); varying++)
+ {
+ if (varying->reg >= 0)
+ {
+ for (int i = 0; i < varying->size; i++)
+ {
+ int rows = VariableRowCount(varying->type);
+ for (int j = 0; j < rows; j++)
+ {
+ std::string n = str(varying->reg + i * rows + j);
+ mPixelHLSL += " " + varying->name;
+
+ if (varying->array)
+ {
+ mPixelHLSL += "[" + str(i) + "]";
+ }
+
+ if (rows > 1)
+ {
+ mPixelHLSL += "[" + str(j) + "]";
+ }
+
+ mPixelHLSL += " = input.v" + n + ";\n";
+ }
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ mPixelHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " PS_OUTPUT output;\n"
+ " output.gl_Color[0] = gl_Color[0];\n"
+ "\n"
+ " return output;\n"
+ "}\n";
+
+ TRACE("\n%s", mPixelHLSL.c_str());
+ TRACE("\n%s", mVertexHLSL.c_str());
+
+ return true;
+}
+
+// Links the HLSL code of the vertex and pixel shader by matching up their varyings,
+// compiling them into binaries, determining the attribute mappings, and collecting
+// a list of uniforms
+void Program::link()
+{
+ unlink();
+
+ if (!mFragmentShader || !mFragmentShader->isCompiled())
+ {
+ return;
+ }
+
+ if (!mVertexShader || !mVertexShader->isCompiled())
+ {
+ return;
+ }
+
+ mPixelHLSL = mFragmentShader->getHLSL();
+ mVertexHLSL = mVertexShader->getHLSL();
+
+ if (!linkVaryings())
+ {
+ return;
+ }
+
+ Context *context = getContext();
+ const char *vertexProfile = context->supportsShaderModel3() ? "vs_3_0" : "vs_2_0";
+ const char *pixelProfile = context->supportsShaderModel3() ? "ps_3_0" : "ps_2_0";
+
+ ID3DXBuffer *vertexBinary = compileToBinary(mVertexHLSL.c_str(), vertexProfile, &mConstantTableVS);
+ ID3DXBuffer *pixelBinary = compileToBinary(mPixelHLSL.c_str(), pixelProfile, &mConstantTablePS);
+
+ if (vertexBinary && pixelBinary)
+ {
+ IDirect3DDevice9 *device = getDevice();
+ HRESULT vertexResult = device->CreateVertexShader((DWORD*)vertexBinary->GetBufferPointer(), &mVertexExecutable);
+ HRESULT pixelResult = device->CreatePixelShader((DWORD*)pixelBinary->GetBufferPointer(), &mPixelExecutable);
+
+ if (vertexResult == D3DERR_OUTOFVIDEOMEMORY || vertexResult == E_OUTOFMEMORY || pixelResult == D3DERR_OUTOFVIDEOMEMORY || pixelResult == E_OUTOFMEMORY)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ ASSERT(SUCCEEDED(vertexResult) && SUCCEEDED(pixelResult));
+
+ vertexBinary->Release();
+ pixelBinary->Release();
+ vertexBinary = NULL;
+ pixelBinary = NULL;
+
+ if (mVertexExecutable && mPixelExecutable)
+ {
+ if (!linkAttributes())
+ {
+ return;
+ }
+
+ if (!linkUniforms(mConstantTablePS))
+ {
+ return;
+ }
+
+ if (!linkUniforms(mConstantTableVS))
+ {
+ return;
+ }
+
+ // these uniforms are searched as already-decorated because gl_ and dx_
+ // are reserved prefixes, and do not receive additional decoration
+ mDxDepthRangeLocation = getUniformLocation("dx_DepthRange", true);
+ mDxDepthLocation = getUniformLocation("dx_Depth", true);
+ mDxViewportLocation = getUniformLocation("dx_Viewport", true);
+ mDxHalfPixelSizeLocation = getUniformLocation("dx_HalfPixelSize", true);
+ mDxFrontCCWLocation = getUniformLocation("dx_FrontCCW", true);
+ mDxPointsOrLinesLocation = getUniformLocation("dx_PointsOrLines", true);
+
+ mLinked = true; // Success
+ }
+ }
+}
+
+// Determines the mapping between GL attributes and Direct3D 9 vertex stream usage indices
+bool Program::linkAttributes()
+{
+ unsigned int usedLocations = 0;
+
+ // Link attributes that have a binding location
+ for (AttributeArray::iterator attribute = mVertexShader->mAttributes.begin(); attribute != mVertexShader->mAttributes.end(); attribute++)
+ {
+ int location = getAttributeBinding(attribute->name);
+
+ if (location != -1) // Set by glBindAttribLocation
+ {
+ if (!mLinkedAttribute[location].name.empty())
+ {
+ // Multiple active attributes bound to the same location; not an error
+ }
+
+ mLinkedAttribute[location] = *attribute;
+
+ int rows = VariableRowCount(attribute->type);
+
+ if (rows + location > MAX_VERTEX_ATTRIBS)
+ {
+ appendToInfoLog("Active attribute (%s) at location %d is too big to fit", attribute->name.c_str(), location);
+
+ return false;
+ }
+
+ for (int i = 0; i < rows; i++)
+ {
+ usedLocations |= 1 << (location + i);
+ }
+ }
+ }
+
+ // Link attributes that don't have a binding location
+ for (AttributeArray::iterator attribute = mVertexShader->mAttributes.begin(); attribute != mVertexShader->mAttributes.end(); attribute++)
+ {
+ int location = getAttributeBinding(attribute->name);
+
+ if (location == -1) // Not set by glBindAttribLocation
+ {
+ int rows = VariableRowCount(attribute->type);
+ int availableIndex = AllocateFirstFreeBits(&usedLocations, rows, MAX_VERTEX_ATTRIBS);
+
+ if (availableIndex == -1 || availableIndex + rows > MAX_VERTEX_ATTRIBS)
+ {
+ appendToInfoLog("Too many active attributes (%s)", attribute->name.c_str());
+
+ return false; // Fail to link
+ }
+
+ mLinkedAttribute[availableIndex] = *attribute;
+ }
+ }
+
+ for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; )
+ {
+ int index = mVertexShader->getSemanticIndex(mLinkedAttribute[attributeIndex].name);
+ int rows = std::max(VariableRowCount(mLinkedAttribute[attributeIndex].type), 1);
+
+ for (int r = 0; r < rows; r++)
+ {
+ mSemanticIndex[attributeIndex++] = index++;
+ }
+ }
+
+ return true;
+}
+
+int Program::getAttributeBinding(const std::string &name)
+{
+ for (int location = 0; location < MAX_VERTEX_ATTRIBS; location++)
+ {
+ if (mAttributeBinding[location].find(name) != mAttributeBinding[location].end())
+ {
+ return location;
+ }
+ }
+
+ return -1;
+}
+
+bool Program::linkUniforms(ID3DXConstantTable *constantTable)
+{
+ D3DXCONSTANTTABLE_DESC constantTableDescription;
+ D3DXCONSTANT_DESC constantDescription;
+ UINT descriptionCount = 1;
+
+ constantTable->GetDesc(&constantTableDescription);
+
+ for (unsigned int constantIndex = 0; constantIndex < constantTableDescription.Constants; constantIndex++)
+ {
+ D3DXHANDLE constantHandle = constantTable->GetConstant(0, constantIndex);
+ constantTable->GetConstantDesc(constantHandle, &constantDescription, &descriptionCount);
+
+ if (!defineUniform(constantHandle, constantDescription))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// Adds the description of a constant found in the binary shader to the list of uniforms
+// Returns true if succesful (uniform not already defined)
+bool Program::defineUniform(const D3DXHANDLE &constantHandle, const D3DXCONSTANT_DESC &constantDescription, std::string name)
+{
+ if (constantDescription.RegisterSet == D3DXRS_SAMPLER)
+ {
+ for (unsigned int samplerIndex = constantDescription.RegisterIndex; samplerIndex < constantDescription.RegisterIndex + constantDescription.RegisterCount; samplerIndex++)
+ {
+ ASSERT(samplerIndex < sizeof(mSamplers)/sizeof(mSamplers[0]));
+
+ mSamplers[samplerIndex].active = true;
+ mSamplers[samplerIndex].type = (constantDescription.Type == D3DXPT_SAMPLERCUBE) ? SAMPLER_CUBE : SAMPLER_2D;
+ mSamplers[samplerIndex].logicalTextureUnit = 0;
+ mSamplers[samplerIndex].dirty = true;
+ }
+ }
+
+ switch(constantDescription.Class)
+ {
+ case D3DXPC_STRUCT:
+ {
+ for (unsigned int arrayIndex = 0; arrayIndex < constantDescription.Elements; arrayIndex++)
+ {
+ for (unsigned int field = 0; field < constantDescription.StructMembers; field++)
+ {
+ D3DXHANDLE fieldHandle = mConstantTablePS->GetConstant(constantHandle, field);
+
+ D3DXCONSTANT_DESC fieldDescription;
+ UINT descriptionCount = 1;
+
+ mConstantTablePS->GetConstantDesc(fieldHandle, &fieldDescription, &descriptionCount);
+
+ std::string structIndex = (constantDescription.Elements > 1) ? ("[" + str(arrayIndex) + "]") : "";
+
+ if (!defineUniform(fieldHandle, fieldDescription, name + constantDescription.Name + structIndex + "."))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+ case D3DXPC_SCALAR:
+ case D3DXPC_VECTOR:
+ case D3DXPC_MATRIX_COLUMNS:
+ case D3DXPC_OBJECT:
+ return defineUniform(constantDescription, name + constantDescription.Name);
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool Program::defineUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &name)
+{
+ Uniform *uniform = createUniform(constantDescription, name);
+
+ if(!uniform)
+ {
+ return false;
+ }
+
+ // Check if already defined
+ GLint location = getUniformLocation(name.c_str(), true);
+ GLenum type = uniform->type;
+
+ if (location >= 0)
+ {
+ delete uniform;
+
+ if (mUniforms[mUniformIndex[location].index]->type != type)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ mUniforms.push_back(uniform);
+ unsigned int uniformIndex = mUniforms.size() - 1;
+
+ for (unsigned int i = 0; i < uniform->arraySize; ++i)
+ {
+ mUniformIndex.push_back(UniformLocation(name, i, uniformIndex));
+ }
+
+ return true;
+}
+
+Uniform *Program::createUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &name)
+{
+ if (constantDescription.Rows == 1) // Vectors and scalars
+ {
+ switch (constantDescription.Type)
+ {
+ case D3DXPT_SAMPLER2D:
+ switch (constantDescription.Columns)
+ {
+ case 1: return new Uniform(GL_SAMPLER_2D, name, constantDescription.Elements);
+ default: UNREACHABLE();
+ }
+ break;
+ case D3DXPT_SAMPLERCUBE:
+ switch (constantDescription.Columns)
+ {
+ case 1: return new Uniform(GL_SAMPLER_CUBE, name, constantDescription.Elements);
+ default: UNREACHABLE();
+ }
+ break;
+ case D3DXPT_BOOL:
+ switch (constantDescription.Columns)
+ {
+ case 1: return new Uniform(GL_BOOL, name, constantDescription.Elements);
+ case 2: return new Uniform(GL_BOOL_VEC2, name, constantDescription.Elements);
+ case 3: return new Uniform(GL_BOOL_VEC3, name, constantDescription.Elements);
+ case 4: return new Uniform(GL_BOOL_VEC4, name, constantDescription.Elements);
+ default: UNREACHABLE();
+ }
+ break;
+ case D3DXPT_INT:
+ switch (constantDescription.Columns)
+ {
+ case 1: return new Uniform(GL_INT, name, constantDescription.Elements);
+ case 2: return new Uniform(GL_INT_VEC2, name, constantDescription.Elements);
+ case 3: return new Uniform(GL_INT_VEC3, name, constantDescription.Elements);
+ case 4: return new Uniform(GL_INT_VEC4, name, constantDescription.Elements);
+ default: UNREACHABLE();
+ }
+ break;
+ case D3DXPT_FLOAT:
+ switch (constantDescription.Columns)
+ {
+ case 1: return new Uniform(GL_FLOAT, name, constantDescription.Elements);
+ case 2: return new Uniform(GL_FLOAT_VEC2, name, constantDescription.Elements);
+ case 3: return new Uniform(GL_FLOAT_VEC3, name, constantDescription.Elements);
+ case 4: return new Uniform(GL_FLOAT_VEC4, name, constantDescription.Elements);
+ default: UNREACHABLE();
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else if (constantDescription.Rows == constantDescription.Columns) // Square matrices
+ {
+ switch (constantDescription.Type)
+ {
+ case D3DXPT_FLOAT:
+ switch (constantDescription.Rows)
+ {
+ case 2: return new Uniform(GL_FLOAT_MAT2, name, constantDescription.Elements);
+ case 3: return new Uniform(GL_FLOAT_MAT3, name, constantDescription.Elements);
+ case 4: return new Uniform(GL_FLOAT_MAT4, name, constantDescription.Elements);
+ default: UNREACHABLE();
+ }
+ break;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+
+ return 0;
+}
+
+// This method needs to match OutputHLSL::decorate
+std::string Program::decorate(const std::string &string)
+{
+ if (string.substr(0, 3) != "gl_" && string.substr(0, 3) != "dx_")
+ {
+ return "_" + string;
+ }
+ else
+ {
+ return string;
+ }
+}
+
+std::string Program::undecorate(const std::string &string)
+{
+ if (string.substr(0, 1) == "_")
+ {
+ return string.substr(1);
+ }
+ else
+ {
+ return string;
+ }
+}
+
+bool Program::applyUniform1bv(GLint location, GLsizei count, const GLboolean *v)
+{
+ BOOL *vector = new BOOL[count];
+ for (int i = 0; i < count; i++)
+ {
+ if (v[i] == GL_FALSE)
+ vector[i] = 0;
+ else
+ vector[i] = 1;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetBoolArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetBoolArray(device, constantVS, vector, count);
+ }
+
+ delete [] vector;
+
+ return true;
+}
+
+bool Program::applyUniform2bv(GLint location, GLsizei count, const GLboolean *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4((v[0] == GL_FALSE ? 0.0f : 1.0f),
+ (v[1] == GL_FALSE ? 0.0f : 1.0f), 0, 0);
+
+ v += 2;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete[] vector;
+
+ return true;
+}
+
+bool Program::applyUniform3bv(GLint location, GLsizei count, const GLboolean *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4((v[0] == GL_FALSE ? 0.0f : 1.0f),
+ (v[1] == GL_FALSE ? 0.0f : 1.0f),
+ (v[2] == GL_FALSE ? 0.0f : 1.0f), 0);
+
+ v += 3;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete[] vector;
+
+ return true;
+}
+
+bool Program::applyUniform4bv(GLint location, GLsizei count, const GLboolean *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4((v[0] == GL_FALSE ? 0.0f : 1.0f),
+ (v[1] == GL_FALSE ? 0.0f : 1.0f),
+ (v[2] == GL_FALSE ? 0.0f : 1.0f),
+ (v[3] == GL_FALSE ? 0.0f : 1.0f));
+
+ v += 3;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete [] vector;
+
+ return true;
+}
+
+bool Program::applyUniform1fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetFloatArray(device, constantPS, v, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetFloatArray(device, constantVS, v, count);
+ }
+
+ return true;
+}
+
+bool Program::applyUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4(v[0], v[1], 0, 0);
+
+ v += 2;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete[] vector;
+
+ return true;
+}
+
+bool Program::applyUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4(v[0], v[1], v[2], 0);
+
+ v += 3;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete[] vector;
+
+ return true;
+}
+
+bool Program::applyUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, (D3DXVECTOR4*)v, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, (D3DXVECTOR4*)v, count);
+ }
+
+ return true;
+}
+
+bool Program::applyUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ D3DXMATRIX *matrix = new D3DXMATRIX[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ matrix[i] = D3DXMATRIX(value[0], value[2], 0, 0,
+ value[1], value[3], 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ value += 4;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetMatrixTransposeArray(device, constantPS, matrix, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetMatrixTransposeArray(device, constantVS, matrix, count);
+ }
+
+ delete[] matrix;
+
+ return true;
+}
+
+bool Program::applyUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ D3DXMATRIX *matrix = new D3DXMATRIX[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ matrix[i] = D3DXMATRIX(value[0], value[3], value[6], 0,
+ value[1], value[4], value[7], 0,
+ value[2], value[5], value[8], 0,
+ 0, 0, 0, 1);
+
+ value += 9;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetMatrixTransposeArray(device, constantPS, matrix, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetMatrixTransposeArray(device, constantVS, matrix, count);
+ }
+
+ delete[] matrix;
+
+ return true;
+}
+
+bool Program::applyUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ D3DXMATRIX *matrix = new D3DXMATRIX[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ matrix[i] = D3DXMATRIX(value[0], value[4], value[8], value[12],
+ value[1], value[5], value[9], value[13],
+ value[2], value[6], value[10], value[14],
+ value[3], value[7], value[11], value[15]);
+
+ value += 16;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetMatrixTransposeArray(device, constantPS, matrix, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetMatrixTransposeArray(device, constantVS, matrix, count);
+ }
+
+ delete[] matrix;
+
+ return true;
+}
+
+bool Program::applyUniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ D3DXCONSTANT_DESC constantDescription;
+ UINT descriptionCount = 1;
+ HRESULT result = mConstantTablePS->GetConstantDesc(constantPS, &constantDescription, &descriptionCount);
+
+ if (FAILED(result))
+ {
+ return false;
+ }
+
+ if (constantDescription.RegisterSet == D3DXRS_SAMPLER)
+ {
+ unsigned int firstIndex = mConstantTablePS->GetSamplerIndex(constantPS);
+
+ for (int i = 0; i < count; i++)
+ {
+ unsigned int samplerIndex = firstIndex + i;
+
+ if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
+ {
+ ASSERT(mSamplers[samplerIndex].active);
+ mSamplers[samplerIndex].logicalTextureUnit = v[i];
+ mSamplers[samplerIndex].dirty = true;
+ }
+ }
+
+ return true;
+ }
+ }
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetIntArray(device, constantPS, v, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetIntArray(device, constantVS, v, count);
+ }
+
+ return true;
+}
+
+bool Program::applyUniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4((float)v[0], (float)v[1], 0, 0);
+
+ v += 2;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete[] vector;
+
+ return true;
+}
+
+bool Program::applyUniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4((float)v[0], (float)v[1], (float)v[2], 0);
+
+ v += 3;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete[] vector;
+
+ return true;
+}
+
+bool Program::applyUniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+ D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ vector[i] = D3DXVECTOR4((float)v[0], (float)v[1], (float)v[2], (float)v[3]);
+
+ v += 4;
+ }
+
+ Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+ D3DXHANDLE constantPS;
+ D3DXHANDLE constantVS;
+ getConstantHandles(targetUniform, &constantPS, &constantVS);
+ IDirect3DDevice9 *device = getDevice();
+
+ if (constantPS)
+ {
+ mConstantTablePS->SetVectorArray(device, constantPS, vector, count);
+ }
+
+ if (constantVS)
+ {
+ mConstantTableVS->SetVectorArray(device, constantVS, vector, count);
+ }
+
+ delete [] vector;
+
+ return true;
+}
+
+void Program::appendToInfoLog(const char *format, ...)
+{
+ if (!format)
+ {
+ return;
+ }
+
+ char info[1024];
+
+ va_list vararg;
+ va_start(vararg, format);
+ vsnprintf(info, sizeof(info), format, vararg);
+ va_end(vararg);
+
+ size_t infoLength = strlen(info);
+
+ if (!mInfoLog)
+ {
+ mInfoLog = new char[infoLength + 1];
+ strcpy(mInfoLog, info);
+ }
+ else
+ {
+ size_t logLength = strlen(mInfoLog);
+ char *newLog = new char[logLength + infoLength + 1];
+ strcpy(newLog, mInfoLog);
+ strcpy(newLog + logLength, info);
+
+ delete[] mInfoLog;
+ mInfoLog = newLog;
+ }
+}
+
+void Program::resetInfoLog()
+{
+ if (mInfoLog)
+ {
+ delete [] mInfoLog;
+ mInfoLog = NULL;
+ }
+}
+
+// Returns the program object to an unlinked state, after detaching a shader, before re-linking, or at destruction
+void Program::unlink(bool destroy)
+{
+ if (destroy) // Object being destructed
+ {
+ if (mFragmentShader)
+ {
+ mFragmentShader->release();
+ mFragmentShader = NULL;
+ }
+
+ if (mVertexShader)
+ {
+ mVertexShader->release();
+ mVertexShader = NULL;
+ }
+ }
+
+ if (mPixelExecutable)
+ {
+ mPixelExecutable->Release();
+ mPixelExecutable = NULL;
+ }
+
+ if (mVertexExecutable)
+ {
+ mVertexExecutable->Release();
+ mVertexExecutable = NULL;
+ }
+
+ if (mConstantTablePS)
+ {
+ mConstantTablePS->Release();
+ mConstantTablePS = NULL;
+ }
+
+ if (mConstantTableVS)
+ {
+ mConstantTableVS->Release();
+ mConstantTableVS = NULL;
+ }
+
+ for (int index = 0; index < MAX_VERTEX_ATTRIBS; index++)
+ {
+ mLinkedAttribute[index].name.clear();
+ mSemanticIndex[index] = -1;
+ }
+
+ for (int index = 0; index < MAX_TEXTURE_IMAGE_UNITS; index++)
+ {
+ mSamplers[index].active = false;
+ mSamplers[index].dirty = true;
+ }
+
+ while (!mUniforms.empty())
+ {
+ delete mUniforms.back();
+ mUniforms.pop_back();
+ }
+
+ mDxDepthRangeLocation = -1;
+ mDxDepthLocation = -1;
+ mDxViewportLocation = -1;
+ mDxHalfPixelSizeLocation = -1;
+ mDxFrontCCWLocation = -1;
+ mDxPointsOrLinesLocation = -1;
+
+ mUniformIndex.clear();
+
+ mPixelHLSL.clear();
+ mVertexHLSL.clear();
+
+ delete[] mInfoLog;
+ mInfoLog = NULL;
+
+ mLinked = false;
+}
+
+bool Program::isLinked()
+{
+ return mLinked;
+}
+
+bool Program::isValidated() const
+{
+ return mValidated;
+}
+
+void Program::release()
+{
+ mRefCount--;
+
+ if (mRefCount == 0 && mDeleteStatus)
+ {
+ mResourceManager->deleteProgram(mHandle);
+ }
+}
+
+void Program::addRef()
+{
+ mRefCount++;
+}
+
+unsigned int Program::getRefCount() const
+{
+ return mRefCount;
+}
+
+unsigned int Program::getSerial() const
+{
+ return mSerial;
+}
+
+unsigned int Program::issueSerial()
+{
+ return mCurrentSerial++;
+}
+
+int Program::getInfoLogLength() const
+{
+ if (!mInfoLog)
+ {
+ return 0;
+ }
+ else
+ {
+ return strlen(mInfoLog) + 1;
+ }
+}
+
+void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
+{
+ int index = 0;
+
+ if (mInfoLog)
+ {
+ while (index < bufSize - 1 && index < (int)strlen(mInfoLog))
+ {
+ infoLog[index] = mInfoLog[index];
+ index++;
+ }
+ }
+
+ if (bufSize)
+ {
+ infoLog[index] = '\0';
+ }
+
+ if (length)
+ {
+ *length = index;
+ }
+}
+
+void Program::getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders)
+{
+ int total = 0;
+
+ if (mVertexShader)
+ {
+ if (total < maxCount)
+ {
+ shaders[total] = mVertexShader->getHandle();
+ }
+
+ total++;
+ }
+
+ if (mFragmentShader)
+ {
+ if (total < maxCount)
+ {
+ shaders[total] = mFragmentShader->getHandle();
+ }
+
+ total++;
+ }
+
+ if (count)
+ {
+ *count = total;
+ }
+}
+
+void Program::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+ // Skip over inactive attributes
+ unsigned int activeAttribute = 0;
+ unsigned int attribute;
+ for (attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
+ {
+ if (mLinkedAttribute[attribute].name.empty())
+ {
+ continue;
+ }
+
+ if (activeAttribute == index)
+ {
+ break;
+ }
+
+ activeAttribute++;
+ }
+
+ if (bufsize > 0)
+ {
+ const char *string = mLinkedAttribute[attribute].name.c_str();
+
+ strncpy(name, string, bufsize);
+ name[bufsize - 1] = '\0';
+
+ if (length)
+ {
+ *length = strlen(name);
+ }
+ }
+
+ *size = 1; // Always a single 'type' instance
+
+ *type = mLinkedAttribute[attribute].type;
+}
+
+GLint Program::getActiveAttributeCount()
+{
+ int count = 0;
+
+ for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ if (!mLinkedAttribute[attributeIndex].name.empty())
+ {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+GLint Program::getActiveAttributeMaxLength()
+{
+ int maxLength = 0;
+
+ for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ if (!mLinkedAttribute[attributeIndex].name.empty())
+ {
+ maxLength = std::max((int)(mLinkedAttribute[attributeIndex].name.length() + 1), maxLength);
+ }
+ }
+
+ return maxLength;
+}
+
+void Program::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+ // Skip over internal uniforms
+ unsigned int activeUniform = 0;
+ unsigned int uniform;
+ for (uniform = 0; uniform < mUniforms.size(); uniform++)
+ {
+ if (mUniforms[uniform]->name.substr(0, 3) == "dx_")
+ {
+ continue;
+ }
+
+ if (activeUniform == index)
+ {
+ break;
+ }
+
+ activeUniform++;
+ }
+
+ ASSERT(uniform < mUniforms.size()); // index must be smaller than getActiveUniformCount()
+
+ if (bufsize > 0)
+ {
+ std::string string = undecorate(mUniforms[uniform]->name);
+
+ if (mUniforms[uniform]->arraySize != 1)
+ {
+ string += "[0]";
+ }
+
+ strncpy(name, string.c_str(), bufsize);
+ name[bufsize - 1] = '\0';
+
+ if (length)
+ {
+ *length = strlen(name);
+ }
+ }
+
+ *size = mUniforms[uniform]->arraySize;
+
+ *type = mUniforms[uniform]->type;
+}
+
+GLint Program::getActiveUniformCount()
+{
+ int count = 0;
+
+ unsigned int numUniforms = mUniforms.size();
+ for (unsigned int uniformIndex = 0; uniformIndex < numUniforms; uniformIndex++)
+ {
+ if (mUniforms[uniformIndex]->name.substr(0, 3) != "dx_")
+ {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+GLint Program::getActiveUniformMaxLength()
+{
+ int maxLength = 0;
+
+ unsigned int numUniforms = mUniforms.size();
+ for (unsigned int uniformIndex = 0; uniformIndex < numUniforms; uniformIndex++)
+ {
+ if (!mUniforms[uniformIndex]->name.empty() && mUniforms[uniformIndex]->name.substr(0, 3) != "dx_")
+ {
+ maxLength = std::max((int)(undecorate(mUniforms[uniformIndex]->name).length() + 1), maxLength);
+ }
+ }
+
+ return maxLength;
+}
+
+void Program::flagForDeletion()
+{
+ mDeleteStatus = true;
+}
+
+bool Program::isFlaggedForDeletion() const
+{
+ return mDeleteStatus;
+}
+
+void Program::validate()
+{
+ resetInfoLog();
+
+ if (!isLinked())
+ {
+ appendToInfoLog("Program has not been successfully linked.");
+ mValidated = false;
+ }
+ else
+ {
+ applyUniforms();
+ if (!validateSamplers())
+ {
+ appendToInfoLog("Samplers of conflicting types refer to the same texture image unit.");
+ mValidated = false;
+ }
+ else
+ {
+ mValidated = true;
+ }
+ }
+}
+
+bool Program::validateSamplers() const
+{
+ // if any two active samplers in a program are of different types, but refer to the same
+ // texture image unit, and this is the current program, then ValidateProgram will fail, and
+ // DrawArrays and DrawElements will issue the INVALID_OPERATION error.
+ std::map<int, SamplerType> samplerMap;
+ for (unsigned int i = 0; i < MAX_TEXTURE_IMAGE_UNITS; ++i)
+ {
+ if (mSamplers[i].active)
+ {
+ if (samplerMap.find(mSamplers[i].logicalTextureUnit) != samplerMap.end())
+ {
+ if (mSamplers[i].type != samplerMap[mSamplers[i].logicalTextureUnit])
+ return false;
+ }
+ else
+ {
+ samplerMap[mSamplers[i].logicalTextureUnit] = mSamplers[i].type;
+ }
+ }
+ }
+
+ return true;
+}
+
+void Program::getConstantHandles(Uniform *targetUniform, D3DXHANDLE *constantPS, D3DXHANDLE *constantVS)
+{
+ if (!targetUniform->handlesSet)
+ {
+ targetUniform->psHandle = mConstantTablePS->GetConstantByName(0, targetUniform->name.c_str());
+ targetUniform->vsHandle = mConstantTableVS->GetConstantByName(0, targetUniform->name.c_str());
+ targetUniform->handlesSet = true;
+ }
+
+ *constantPS = targetUniform->psHandle;
+ *constantVS = targetUniform->vsHandle;
+}
+
+GLint Program::getDxDepthRangeLocation() const
+{
+ return mDxDepthRangeLocation;
+}
+
+GLint Program::getDxDepthLocation() const
+{
+ return mDxDepthLocation;
+}
+
+GLint Program::getDxViewportLocation() const
+{
+ return mDxViewportLocation;
+}
+
+GLint Program::getDxHalfPixelSizeLocation() const
+{
+ return mDxHalfPixelSizeLocation;
+}
+
+GLint Program::getDxFrontCCWLocation() const
+{
+ return mDxFrontCCWLocation;
+}
+
+GLint Program::getDxPointsOrLinesLocation() const
+{
+ return mDxPointsOrLinesLocation;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h
new file mode 100644
index 0000000..e9c149e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h
@@ -0,0 +1,228 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Program.h: Defines the gl::Program class. Implements GL program objects
+// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
+
+#ifndef LIBGLESV2_PROGRAM_H_
+#define LIBGLESV2_PROGRAM_H_
+
+#include <d3dx9.h>
+#include <string>
+#include <vector>
+#include <set>
+
+#include "libGLESv2/Shader.h"
+#include "libGLESv2/Context.h"
+
+namespace gl
+{
+class ResourceManager;
+class FragmentShader;
+class VertexShader;
+
+// Helper struct representing a single shader uniform
+struct Uniform
+{
+ Uniform(GLenum type, const std::string &name, unsigned int arraySize);
+
+ ~Uniform();
+
+ const GLenum type;
+ const std::string name;
+ const unsigned int arraySize;
+
+ unsigned char *data;
+ bool dirty;
+
+ D3DXHANDLE vsHandle;
+ D3DXHANDLE psHandle;
+ bool handlesSet;
+};
+
+// Struct used for correlating uniforms/elements of uniform arrays to handles
+struct UniformLocation
+{
+ UniformLocation(const std::string &name, unsigned int element, unsigned int index);
+
+ std::string name;
+ unsigned int element;
+ unsigned int index;
+};
+
+class Program
+{
+ public:
+ Program(ResourceManager *manager, GLuint handle);
+
+ ~Program();
+
+ bool attachShader(Shader *shader);
+ bool detachShader(Shader *shader);
+ int getAttachedShadersCount() const;
+
+ IDirect3DPixelShader9 *getPixelShader();
+ IDirect3DVertexShader9 *getVertexShader();
+
+ void bindAttributeLocation(GLuint index, const char *name);
+ GLuint getAttributeLocation(const char *name);
+ int getSemanticIndex(int attributeIndex);
+
+ void dirtyAllSamplers();
+
+ GLint getSamplerMapping(unsigned int samplerIndex);
+ SamplerType getSamplerType(unsigned int samplerIndex);
+ bool isSamplerDirty(unsigned int samplerIndex) const;
+ void setSamplerDirty(unsigned int samplerIndex, bool dirty);
+
+ GLint getUniformLocation(const char *name, bool decorated);
+ bool setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
+ bool setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
+ bool setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
+ bool setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
+ bool setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value);
+ bool setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value);
+ bool setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value);
+ bool setUniform1iv(GLint location, GLsizei count, const GLint *v);
+ bool setUniform2iv(GLint location, GLsizei count, const GLint *v);
+ bool setUniform3iv(GLint location, GLsizei count, const GLint *v);
+ bool setUniform4iv(GLint location, GLsizei count, const GLint *v);
+
+ bool getUniformfv(GLint location, GLfloat *params);
+ bool getUniformiv(GLint location, GLint *params);
+
+ GLint getDxDepthRangeLocation() const;
+ GLint getDxDepthLocation() const;
+ GLint getDxViewportLocation() const;
+ GLint getDxHalfPixelSizeLocation() const;
+ GLint getDxFrontCCWLocation() const;
+ GLint getDxPointsOrLinesLocation() const;
+
+ void dirtyAllUniforms();
+ void applyUniforms();
+
+ void link();
+ bool isLinked();
+ int getInfoLogLength() const;
+ void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
+ void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
+
+ void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+ GLint getActiveAttributeCount();
+ GLint getActiveAttributeMaxLength();
+
+ void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+ GLint getActiveUniformCount();
+ GLint getActiveUniformMaxLength();
+
+ void addRef();
+ void release();
+ unsigned int getRefCount() const;
+ void flagForDeletion();
+ bool isFlaggedForDeletion() const;
+
+ void validate();
+ bool validateSamplers() const;
+ bool isValidated() const;
+
+ unsigned int getSerial() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Program);
+
+ ID3DXBuffer *compileToBinary(const char *hlsl, const char *profile, ID3DXConstantTable **constantTable);
+ void unlink(bool destroy = false);
+
+ int packVaryings(const Varying *packing[][4]);
+ bool linkVaryings();
+
+ bool linkAttributes();
+ int getAttributeBinding(const std::string &name);
+
+ bool linkUniforms(ID3DXConstantTable *constantTable);
+ bool defineUniform(const D3DXHANDLE &constantHandle, const D3DXCONSTANT_DESC &constantDescription, std::string name = "");
+ bool defineUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &name);
+ Uniform *createUniform(const D3DXCONSTANT_DESC &constantDescription, std::string &name);
+ bool applyUniform1bv(GLint location, GLsizei count, const GLboolean *v);
+ bool applyUniform2bv(GLint location, GLsizei count, const GLboolean *v);
+ bool applyUniform3bv(GLint location, GLsizei count, const GLboolean *v);
+ bool applyUniform4bv(GLint location, GLsizei count, const GLboolean *v);
+ bool applyUniform1fv(GLint location, GLsizei count, const GLfloat *v);
+ bool applyUniform2fv(GLint location, GLsizei count, const GLfloat *v);
+ bool applyUniform3fv(GLint location, GLsizei count, const GLfloat *v);
+ bool applyUniform4fv(GLint location, GLsizei count, const GLfloat *v);
+ bool applyUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value);
+ bool applyUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value);
+ bool applyUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value);
+ bool applyUniform1iv(GLint location, GLsizei count, const GLint *v);
+ bool applyUniform2iv(GLint location, GLsizei count, const GLint *v);
+ bool applyUniform3iv(GLint location, GLsizei count, const GLint *v);
+ bool applyUniform4iv(GLint location, GLsizei count, const GLint *v);
+
+ void getConstantHandles(Uniform *targetUniform, D3DXHANDLE *constantPS, D3DXHANDLE *constantVS);
+
+ void appendToInfoLog(const char *info, ...);
+ void resetInfoLog();
+
+ static std::string decorate(const std::string &string); // Prepend an underscore
+ static std::string undecorate(const std::string &string); // Remove leading underscore
+
+ static unsigned int issueSerial();
+
+ FragmentShader *mFragmentShader;
+ VertexShader *mVertexShader;
+
+ std::string mPixelHLSL;
+ std::string mVertexHLSL;
+
+ IDirect3DPixelShader9 *mPixelExecutable;
+ IDirect3DVertexShader9 *mVertexExecutable;
+ ID3DXConstantTable *mConstantTablePS;
+ ID3DXConstantTable *mConstantTableVS;
+
+ std::set<std::string> mAttributeBinding[MAX_VERTEX_ATTRIBS];
+ Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
+ int mSemanticIndex[MAX_VERTEX_ATTRIBS];
+
+ struct Sampler
+ {
+ bool active;
+ GLint logicalTextureUnit;
+ SamplerType type;
+ bool dirty;
+ };
+
+ Sampler mSamplers[MAX_TEXTURE_IMAGE_UNITS];
+
+ typedef std::vector<Uniform*> UniformArray;
+ UniformArray mUniforms;
+ typedef std::vector<UniformLocation> UniformIndex;
+ UniformIndex mUniformIndex;
+
+ GLint mDxDepthRangeLocation;
+ GLint mDxDepthLocation;
+ GLint mDxViewportLocation;
+ GLint mDxHalfPixelSizeLocation;
+ GLint mDxFrontCCWLocation;
+ GLint mDxPointsOrLinesLocation;
+
+ bool mLinked;
+ bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use
+ char *mInfoLog;
+ bool mValidated;
+
+ unsigned int mRefCount;
+
+ const unsigned int mSerial;
+
+ static unsigned int mCurrentSerial;
+
+ ResourceManager *mResourceManager;
+ const GLuint mHandle;
+};
+}
+
+#endif // LIBGLESV2_PROGRAM_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.cpp
new file mode 100644
index 0000000..2de1e71
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.cpp
@@ -0,0 +1,52 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RefCountObject.cpp: Defines the gl::RefCountObject base class that provides
+// lifecycle support for GL objects using the traditional BindObject scheme, but
+// that need to be reference counted for correct cross-context deletion.
+// (Concretely, textures, buffers and renderbuffers.)
+
+#include "RefCountObject.h"
+
+namespace gl
+{
+
+RefCountObject::RefCountObject(GLuint id)
+{
+ mId = id;
+ mRefCount = 0;
+}
+
+RefCountObject::~RefCountObject()
+{
+ ASSERT(mRefCount == 0);
+}
+
+void RefCountObject::addRef() const
+{
+ mRefCount++;
+}
+
+void RefCountObject::release() const
+{
+ ASSERT(mRefCount > 0);
+
+ if (--mRefCount == 0)
+ {
+ delete this;
+ }
+}
+
+void RefCountObjectBindingPointer::set(RefCountObject *newObject)
+{
+ // addRef first in case newObject == mObject and this is the last reference to it.
+ if (newObject != NULL) newObject->addRef();
+ if (mObject != NULL) mObject->release();
+
+ mObject = newObject;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.h
new file mode 100644
index 0000000..a149350
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/RefCountObject.h
@@ -0,0 +1,70 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RefCountObject.h: Defines the gl::RefCountObject base class that provides
+// lifecycle support for GL objects using the traditional BindObject scheme, but
+// that need to be reference counted for correct cross-context deletion.
+// (Concretely, textures, buffers and renderbuffers.)
+
+#ifndef LIBGLESV2_REFCOUNTOBJECT_H_
+#define LIBGLESV2_REFCOUNTOBJECT_H_
+
+#include <cstddef>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include "common/debug.h"
+
+namespace gl
+{
+
+class RefCountObject
+{
+ public:
+ explicit RefCountObject(GLuint id);
+ virtual ~RefCountObject();
+
+ virtual void addRef() const;
+ virtual void release() const;
+
+ GLuint id() const { return mId; }
+
+ private:
+ GLuint mId;
+
+ mutable std::size_t mRefCount;
+};
+
+class RefCountObjectBindingPointer
+{
+ protected:
+ RefCountObjectBindingPointer() : mObject(NULL) { }
+ ~RefCountObjectBindingPointer() { ASSERT(mObject == NULL); } // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up.
+
+ void set(RefCountObject *newObject);
+ RefCountObject *get() const { return mObject; }
+
+ public:
+ GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; }
+ bool operator ! () const { return (get() == NULL); }
+
+ private:
+ RefCountObject *mObject;
+};
+
+template <class ObjectType>
+class BindingPointer : public RefCountObjectBindingPointer
+{
+ public:
+ void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
+ ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
+ ObjectType *operator -> () const { return get(); }
+};
+
+}
+
+#endif // LIBGLESV2_REFCOUNTOBJECT_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp
new file mode 100644
index 0000000..6e4494b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp
@@ -0,0 +1,478 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderbuffer.cpp: the gl::Renderbuffer class and its derived classes
+// Colorbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#include "libGLESv2/Renderbuffer.h"
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/utilities.h"
+
+namespace gl
+{
+unsigned int RenderbufferStorage::mCurrentSerial = 1;
+
+Renderbuffer::Renderbuffer(GLuint id, RenderbufferStorage *storage) : RefCountObject(id)
+{
+ ASSERT(storage != NULL);
+ mStorage = storage;
+}
+
+Renderbuffer::~Renderbuffer()
+{
+ delete mStorage;
+}
+
+bool Renderbuffer::isColorbuffer() const
+{
+ return mStorage->isColorbuffer();
+}
+
+bool Renderbuffer::isDepthbuffer() const
+{
+ return mStorage->isDepthbuffer();
+}
+
+bool Renderbuffer::isStencilbuffer() const
+{
+ return mStorage->isStencilbuffer();
+}
+
+IDirect3DSurface9 *Renderbuffer::getRenderTarget()
+{
+ return mStorage->getRenderTarget();
+}
+
+IDirect3DSurface9 *Renderbuffer::getDepthStencil()
+{
+ return mStorage->getDepthStencil();
+}
+
+int Renderbuffer::getWidth() const
+{
+ return mStorage->getWidth();
+}
+
+int Renderbuffer::getHeight() const
+{
+ return mStorage->getHeight();
+}
+
+GLenum Renderbuffer::getFormat() const
+{
+ return mStorage->getFormat();
+}
+
+D3DFORMAT Renderbuffer::getD3DFormat() const
+{
+ return mStorage->getD3DFormat();
+}
+
+unsigned int Renderbuffer::getSerial() const
+{
+ return mStorage->getSerial();
+}
+
+void Renderbuffer::setStorage(RenderbufferStorage *newStorage)
+{
+ ASSERT(newStorage != NULL);
+
+ delete mStorage;
+ mStorage = newStorage;
+}
+
+RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerial())
+{
+ mWidth = 0;
+ mHeight = 0;
+ mFormat = GL_RGBA4;
+ mD3DFormat = D3DFMT_A8R8G8B8;
+ mSamples = 0;
+}
+
+RenderbufferStorage::~RenderbufferStorage()
+{
+}
+
+bool RenderbufferStorage::isColorbuffer() const
+{
+ return false;
+}
+
+bool RenderbufferStorage::isDepthbuffer() const
+{
+ return false;
+}
+
+bool RenderbufferStorage::isStencilbuffer() const
+{
+ return false;
+}
+
+IDirect3DSurface9 *RenderbufferStorage::getRenderTarget()
+{
+ return NULL;
+}
+
+IDirect3DSurface9 *RenderbufferStorage::getDepthStencil()
+{
+ return NULL;
+}
+
+int RenderbufferStorage::getWidth() const
+{
+ return mWidth;
+}
+
+int RenderbufferStorage::getHeight() const
+{
+ return mHeight;
+}
+
+void RenderbufferStorage::setSize(int width, int height)
+{
+ mWidth = width;
+ mHeight = height;
+}
+
+GLenum RenderbufferStorage::getFormat() const
+{
+ return mFormat;
+}
+
+bool RenderbufferStorage::isFloatingPoint() const
+{
+ return false; // no floating point renderbuffers
+}
+
+D3DFORMAT RenderbufferStorage::getD3DFormat() const
+{
+ return mD3DFormat;
+}
+
+GLsizei RenderbufferStorage::getSamples() const
+{
+ return mSamples;
+}
+
+unsigned int RenderbufferStorage::getSerial() const
+{
+ return mSerial;
+}
+
+unsigned int RenderbufferStorage::issueSerial()
+{
+ return mCurrentSerial++;
+}
+
+Colorbuffer::Colorbuffer(IDirect3DSurface9 *renderTarget) : mRenderTarget(renderTarget)
+{
+ if (renderTarget)
+ {
+ renderTarget->AddRef();
+
+ D3DSURFACE_DESC description;
+ renderTarget->GetDesc(&description);
+
+ setSize(description.Width, description.Height);
+ mFormat = dx2es::ConvertBackBufferFormat(description.Format);
+ mD3DFormat = description.Format;
+ mSamples = es2dx::GetSamplesFromMultisampleType(description.MultiSampleType);
+ }
+}
+
+Colorbuffer::Colorbuffer(const Texture* texture) : mRenderTarget(NULL)
+{
+ setSize(texture->getWidth(), texture->getHeight());
+ mD3DFormat = texture->getD3DFormat();
+ mSamples = 0;
+}
+
+Colorbuffer::Colorbuffer(int width, int height, GLenum format, GLsizei samples)
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ mRenderTarget = NULL;
+ D3DFORMAT requestedFormat = es2dx::ConvertRenderbufferFormat(format);
+ int supportedSamples = getContext()->getNearestSupportedSamples(requestedFormat, samples);
+
+ if (supportedSamples == -1)
+ {
+ error(GL_OUT_OF_MEMORY);
+
+ return;
+ }
+
+ if (width > 0 && height > 0)
+ {
+ HRESULT result = device->CreateRenderTarget(width, height, requestedFormat,
+ es2dx::GetMultisampleTypeFromSamples(supportedSamples), 0, FALSE, &mRenderTarget, NULL);
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ error(GL_OUT_OF_MEMORY);
+
+ return;
+ }
+
+ ASSERT(SUCCEEDED(result));
+ }
+
+ if (mRenderTarget)
+ {
+ setSize(width, height);
+ mFormat = format;
+ mD3DFormat = requestedFormat;
+ mSamples = supportedSamples;
+ }
+}
+
+Colorbuffer::~Colorbuffer()
+{
+ if (mRenderTarget)
+ {
+ mRenderTarget->Release();
+ }
+}
+
+bool Colorbuffer::isColorbuffer() const
+{
+ return true;
+}
+
+GLuint Colorbuffer::getRedSize() const
+{
+ if (mRenderTarget)
+ {
+ D3DSURFACE_DESC description;
+ mRenderTarget->GetDesc(&description);
+
+ return es2dx::GetRedSize(description.Format);
+ }
+
+ return 0;
+}
+
+GLuint Colorbuffer::getGreenSize() const
+{
+ if (mRenderTarget)
+ {
+ D3DSURFACE_DESC description;
+ mRenderTarget->GetDesc(&description);
+
+ return es2dx::GetGreenSize(description.Format);
+ }
+
+ return 0;
+}
+
+GLuint Colorbuffer::getBlueSize() const
+{
+ if (mRenderTarget)
+ {
+ D3DSURFACE_DESC description;
+ mRenderTarget->GetDesc(&description);
+
+ return es2dx::GetBlueSize(description.Format);
+ }
+
+ return 0;
+}
+
+GLuint Colorbuffer::getAlphaSize() const
+{
+ if (mRenderTarget)
+ {
+ D3DSURFACE_DESC description;
+ mRenderTarget->GetDesc(&description);
+
+ return es2dx::GetAlphaSize(description.Format);
+ }
+
+ return 0;
+}
+
+IDirect3DSurface9 *Colorbuffer::getRenderTarget()
+{
+ return mRenderTarget;
+}
+
+DepthStencilbuffer::DepthStencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthStencil)
+{
+ if (depthStencil)
+ {
+ depthStencil->AddRef();
+
+ D3DSURFACE_DESC description;
+ depthStencil->GetDesc(&description);
+
+ setSize(description.Width, description.Height);
+ mFormat = dx2es::ConvertDepthStencilFormat(description.Format);
+ mSamples = es2dx::GetSamplesFromMultisampleType(description.MultiSampleType);
+ mD3DFormat = description.Format;
+ }
+}
+
+DepthStencilbuffer::DepthStencilbuffer(int width, int height, GLsizei samples)
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ mDepthStencil = NULL;
+
+ int supportedSamples = getContext()->getNearestSupportedSamples(D3DFMT_D24S8, samples);
+
+ if (supportedSamples == -1)
+ {
+ error(GL_OUT_OF_MEMORY);
+
+ return;
+ }
+
+ HRESULT result = device->CreateDepthStencilSurface(width, height, D3DFMT_D24S8, es2dx::GetMultisampleTypeFromSamples(supportedSamples),
+ 0, FALSE, &mDepthStencil, 0);
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ error(GL_OUT_OF_MEMORY);
+
+ return;
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ if (mDepthStencil)
+ {
+ setSize(width, height);
+ mFormat = GL_DEPTH24_STENCIL8_OES;
+ mD3DFormat = D3DFMT_D24S8;
+ mSamples = supportedSamples;
+ }
+}
+
+DepthStencilbuffer::~DepthStencilbuffer()
+{
+ if (mDepthStencil)
+ {
+ mDepthStencil->Release();
+ }
+}
+
+bool DepthStencilbuffer::isDepthbuffer() const
+{
+ return true;
+}
+
+bool DepthStencilbuffer::isStencilbuffer() const
+{
+ return true;
+}
+
+GLuint DepthStencilbuffer::getDepthSize() const
+{
+ if (mDepthStencil)
+ {
+ D3DSURFACE_DESC description;
+ mDepthStencil->GetDesc(&description);
+
+ return es2dx::GetDepthSize(description.Format);
+ }
+
+ return 0;
+}
+
+GLuint DepthStencilbuffer::getStencilSize() const
+{
+ if (mDepthStencil)
+ {
+ D3DSURFACE_DESC description;
+ mDepthStencil->GetDesc(&description);
+
+ return es2dx::GetStencilSize(description.Format);
+ }
+
+ return 0;
+}
+
+IDirect3DSurface9 *DepthStencilbuffer::getDepthStencil()
+{
+ return mDepthStencil;
+}
+
+Depthbuffer::Depthbuffer(IDirect3DSurface9 *depthStencil) : DepthStencilbuffer(depthStencil)
+{
+ if (depthStencil)
+ {
+ mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function
+ // will expect one of the valid renderbuffer formats for use in
+ // glRenderbufferStorage
+ }
+}
+
+Depthbuffer::Depthbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
+{
+ if (getDepthStencil())
+ {
+ mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function
+ // will expect one of the valid renderbuffer formats for use in
+ // glRenderbufferStorage
+ }
+}
+
+Depthbuffer::~Depthbuffer()
+{
+}
+
+bool Depthbuffer::isDepthbuffer() const
+{
+ return true;
+}
+
+bool Depthbuffer::isStencilbuffer() const
+{
+ return false;
+}
+
+Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : DepthStencilbuffer(depthStencil)
+{
+ if (depthStencil)
+ {
+ mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function
+ // will expect one of the valid renderbuffer formats for use in
+ // glRenderbufferStorage
+ }
+ else
+ {
+ mFormat = GL_RGBA4; //default format
+ }
+}
+
+Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
+{
+ if (getDepthStencil())
+ {
+ mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function
+ // will expect one of the valid renderbuffer formats for use in
+ // glRenderbufferStorage
+ }
+}
+
+Stencilbuffer::~Stencilbuffer()
+{
+}
+
+bool Stencilbuffer::isDepthbuffer() const
+{
+ return false;
+}
+
+bool Stencilbuffer::isStencilbuffer() const
+{
+ return true;
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h
new file mode 100644
index 0000000..98510c2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h
@@ -0,0 +1,178 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderbuffer.h: Defines the wrapper class gl::Renderbuffer, as well as the
+// class hierarchy used to store its contents: RenderbufferStorage, Colorbuffer,
+// DepthStencilbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#ifndef LIBGLESV2_RENDERBUFFER_H_
+#define LIBGLESV2_RENDERBUFFER_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <d3d9.h>
+
+#include "common/angleutils.h"
+#include "libGLESv2/RefCountObject.h"
+
+namespace gl
+{
+ class Texture;
+
+// A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
+// is called. The specific concrete type depends on whether the internal format is
+// colour depth, stencil or packed depth/stencil.
+class RenderbufferStorage
+{
+ public:
+ RenderbufferStorage();
+
+ virtual ~RenderbufferStorage() = 0;
+
+ virtual bool isColorbuffer() const;
+ virtual bool isDepthbuffer() const;
+ virtual bool isStencilbuffer() const;
+
+ virtual IDirect3DSurface9 *getRenderTarget();
+ virtual IDirect3DSurface9 *getDepthStencil();
+
+ virtual int getWidth() const;
+ virtual int getHeight() const;
+ virtual GLenum getFormat() const;
+ virtual bool isFloatingPoint() const;
+ D3DFORMAT getD3DFormat() const;
+ GLsizei getSamples() const;
+ unsigned int getSerial() const;
+
+ static unsigned int issueSerial();
+
+ protected:
+ void setSize(int width, int height);
+ GLenum mFormat;
+ D3DFORMAT mD3DFormat;
+ GLsizei mSamples;
+ const unsigned int mSerial;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RenderbufferStorage);
+
+ static unsigned int mCurrentSerial;
+
+ int mWidth;
+ int mHeight;
+};
+
+// Renderbuffer implements the GL renderbuffer object.
+// It's only a wrapper for a RenderbufferStorage, but the internal object
+// can change whenever glRenderbufferStorage is called.
+class Renderbuffer : public RefCountObject
+{
+ public:
+ Renderbuffer(GLuint id, RenderbufferStorage *storage);
+
+ ~Renderbuffer();
+
+ bool isColorbuffer() const;
+ bool isDepthbuffer() const;
+ bool isStencilbuffer() const;
+
+ IDirect3DSurface9 *getRenderTarget();
+ IDirect3DSurface9 *getDepthStencil();
+
+ int getWidth() const;
+ int getHeight() const;
+ GLenum getFormat() const;
+ D3DFORMAT getD3DFormat() const;
+ unsigned int getSerial() const;
+
+ void setStorage(RenderbufferStorage *newStorage);
+ RenderbufferStorage *getStorage() { return mStorage; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
+
+ RenderbufferStorage *mStorage;
+};
+
+class Colorbuffer : public RenderbufferStorage
+{
+ public:
+ explicit Colorbuffer(IDirect3DSurface9 *renderTarget);
+ explicit Colorbuffer(const Texture* texture);
+ Colorbuffer(int width, int height, GLenum format, GLsizei samples);
+
+ ~Colorbuffer();
+
+ bool isColorbuffer() const;
+
+ GLuint getRedSize() const;
+ GLuint getGreenSize() const;
+ GLuint getBlueSize() const;
+ GLuint getAlphaSize() const;
+
+ IDirect3DSurface9 *getRenderTarget();
+
+ protected:
+ IDirect3DSurface9 *mRenderTarget;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Colorbuffer);
+};
+
+class DepthStencilbuffer : public RenderbufferStorage
+{
+ public:
+ explicit DepthStencilbuffer(IDirect3DSurface9 *depthStencil);
+ DepthStencilbuffer(int width, int height, GLsizei samples);
+
+ ~DepthStencilbuffer();
+
+ virtual bool isDepthbuffer() const;
+ virtual bool isStencilbuffer() const;
+
+ GLuint getDepthSize() const;
+ GLuint getStencilSize() const;
+
+ IDirect3DSurface9 *getDepthStencil();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DepthStencilbuffer);
+ IDirect3DSurface9 *mDepthStencil;
+};
+
+class Depthbuffer : public DepthStencilbuffer
+{
+ public:
+ explicit Depthbuffer(IDirect3DSurface9 *depthStencil);
+ Depthbuffer(int width, int height, GLsizei samples);
+
+ ~Depthbuffer();
+
+ bool isDepthbuffer() const;
+ bool isStencilbuffer() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Depthbuffer);
+};
+
+class Stencilbuffer : public DepthStencilbuffer
+{
+ public:
+ explicit Stencilbuffer(IDirect3DSurface9 *depthStencil);
+ Stencilbuffer(int width, int height, GLsizei samples);
+
+ ~Stencilbuffer();
+
+ bool isDepthbuffer() const;
+ bool isStencilbuffer() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Stencilbuffer);
+};
+}
+
+#endif // LIBGLESV2_RENDERBUFFER_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp
new file mode 100644
index 0000000..12a86c1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp
@@ -0,0 +1,340 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ResourceManager.cpp: Implements the gl::ResourceManager class, which tracks and
+// retrieves objects which may be shared by multiple Contexts.
+
+#include "libGLESv2/ResourceManager.h"
+
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/RenderBuffer.h"
+#include "libGLESv2/Shader.h"
+#include "libGLESv2/Texture.h"
+
+namespace gl
+{
+ResourceManager::ResourceManager()
+{
+ mRefCount = 1;
+}
+
+ResourceManager::~ResourceManager()
+{
+ while (!mBufferMap.empty())
+ {
+ deleteBuffer(mBufferMap.begin()->first);
+ }
+
+ while (!mProgramMap.empty())
+ {
+ deleteProgram(mProgramMap.begin()->first);
+ }
+
+ while (!mShaderMap.empty())
+ {
+ deleteShader(mShaderMap.begin()->first);
+ }
+
+ while (!mRenderbufferMap.empty())
+ {
+ deleteRenderbuffer(mRenderbufferMap.begin()->first);
+ }
+
+ while (!mTextureMap.empty())
+ {
+ deleteTexture(mTextureMap.begin()->first);
+ }
+}
+
+void ResourceManager::addRef()
+{
+ mRefCount++;
+}
+
+void ResourceManager::release()
+{
+ if (--mRefCount == 0)
+ {
+ delete this;
+ }
+}
+
+// Returns an unused buffer name
+GLuint ResourceManager::createBuffer()
+{
+ unsigned int handle = 1;
+
+ while (mBufferMap.find(handle) != mBufferMap.end())
+ {
+ handle++;
+ }
+
+ mBufferMap[handle] = NULL;
+
+ return handle;
+}
+
+// Returns an unused shader/program name
+GLuint ResourceManager::createShader(GLenum type)
+{
+ unsigned int handle = 1;
+
+ while (mShaderMap.find(handle) != mShaderMap.end() || mProgramMap.find(handle) != mProgramMap.end()) // Shared name space
+ {
+ handle++;
+ }
+
+ if (type == GL_VERTEX_SHADER)
+ {
+ mShaderMap[handle] = new VertexShader(this, handle);
+ }
+ else if (type == GL_FRAGMENT_SHADER)
+ {
+ mShaderMap[handle] = new FragmentShader(this, handle);
+ }
+ else UNREACHABLE();
+
+ return handle;
+}
+
+// Returns an unused program/shader name
+GLuint ResourceManager::createProgram()
+{
+ unsigned int handle = 1;
+
+ while (mProgramMap.find(handle) != mProgramMap.end() || mShaderMap.find(handle) != mShaderMap.end()) // Shared name space
+ {
+ handle++;
+ }
+
+ mProgramMap[handle] = new Program(this, handle);
+
+ return handle;
+}
+
+// Returns an unused texture name
+GLuint ResourceManager::createTexture()
+{
+ unsigned int handle = 1;
+
+ while (mTextureMap.find(handle) != mTextureMap.end())
+ {
+ handle++;
+ }
+
+ mTextureMap[handle] = NULL;
+
+ return handle;
+}
+
+// Returns an unused renderbuffer name
+GLuint ResourceManager::createRenderbuffer()
+{
+ unsigned int handle = 1;
+
+ while (mRenderbufferMap.find(handle) != mRenderbufferMap.end())
+ {
+ handle++;
+ }
+
+ mRenderbufferMap[handle] = NULL;
+
+ return handle;
+}
+
+void ResourceManager::deleteBuffer(GLuint buffer)
+{
+ BufferMap::iterator bufferObject = mBufferMap.find(buffer);
+
+ if (bufferObject != mBufferMap.end())
+ {
+ if (bufferObject->second) bufferObject->second->release();
+ mBufferMap.erase(bufferObject);
+ }
+}
+
+void ResourceManager::deleteShader(GLuint shader)
+{
+ ShaderMap::iterator shaderObject = mShaderMap.find(shader);
+
+ if (shaderObject != mShaderMap.end())
+ {
+ if (shaderObject->second->getRefCount() == 0)
+ {
+ delete shaderObject->second;
+ mShaderMap.erase(shaderObject);
+ }
+ else
+ {
+ shaderObject->second->flagForDeletion();
+ }
+ }
+}
+
+void ResourceManager::deleteProgram(GLuint program)
+{
+ ProgramMap::iterator programObject = mProgramMap.find(program);
+
+ if (programObject != mProgramMap.end())
+ {
+ if (programObject->second->getRefCount() == 0)
+ {
+ delete programObject->second;
+ mProgramMap.erase(programObject);
+ }
+ else
+ {
+ programObject->second->flagForDeletion();
+ }
+ }
+}
+
+void ResourceManager::deleteTexture(GLuint texture)
+{
+ TextureMap::iterator textureObject = mTextureMap.find(texture);
+
+ if (textureObject != mTextureMap.end())
+ {
+ if (textureObject->second) textureObject->second->release();
+ mTextureMap.erase(textureObject);
+ }
+}
+
+void ResourceManager::deleteRenderbuffer(GLuint renderbuffer)
+{
+ RenderbufferMap::iterator renderbufferObject = mRenderbufferMap.find(renderbuffer);
+
+ if (renderbufferObject != mRenderbufferMap.end())
+ {
+ if (renderbufferObject->second) renderbufferObject->second->release();
+ mRenderbufferMap.erase(renderbufferObject);
+ }
+}
+
+Buffer *ResourceManager::getBuffer(unsigned int handle)
+{
+ BufferMap::iterator buffer = mBufferMap.find(handle);
+
+ if (buffer == mBufferMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return buffer->second;
+ }
+}
+
+Shader *ResourceManager::getShader(unsigned int handle)
+{
+ ShaderMap::iterator shader = mShaderMap.find(handle);
+
+ if (shader == mShaderMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return shader->second;
+ }
+}
+
+Texture *ResourceManager::getTexture(unsigned int handle)
+{
+ if (handle == 0) return NULL;
+
+ TextureMap::iterator texture = mTextureMap.find(handle);
+
+ if (texture == mTextureMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return texture->second;
+ }
+}
+
+Program *ResourceManager::getProgram(unsigned int handle)
+{
+ ProgramMap::iterator program = mProgramMap.find(handle);
+
+ if (program == mProgramMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return program->second;
+ }
+}
+
+Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
+{
+ RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle);
+
+ if (renderbuffer == mRenderbufferMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return renderbuffer->second;
+ }
+}
+
+void ResourceManager::setRenderbuffer(GLuint handle, Renderbuffer *buffer)
+{
+ mRenderbufferMap[handle] = buffer;
+}
+
+void ResourceManager::checkBufferAllocation(unsigned int buffer)
+{
+ if (buffer != 0 && !getBuffer(buffer))
+ {
+ Buffer *bufferObject = new Buffer(buffer);
+ mBufferMap[buffer] = bufferObject;
+ bufferObject->addRef();
+ }
+}
+
+void ResourceManager::checkTextureAllocation(GLuint texture, SamplerType type)
+{
+ if (!getTexture(texture) && texture != 0)
+ {
+ Texture *textureObject;
+
+ if (type == SAMPLER_2D)
+ {
+ textureObject = new Texture2D(texture);
+ }
+ else if (type == SAMPLER_CUBE)
+ {
+ textureObject = new TextureCubeMap(texture);
+ }
+ else
+ {
+ UNREACHABLE();
+ return;
+ }
+
+ mTextureMap[texture] = textureObject;
+ textureObject->addRef();
+ }
+}
+
+void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer)
+{
+ if (renderbuffer != 0 && !getRenderbuffer(renderbuffer))
+ {
+ Renderbuffer *renderbufferObject = new Renderbuffer(renderbuffer, new Colorbuffer(0, 0, GL_RGBA4, 0));
+ mRenderbufferMap[renderbuffer] = renderbufferObject;
+ renderbufferObject->addRef();
+ }
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h
new file mode 100644
index 0000000..346e51f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h
@@ -0,0 +1,92 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ResourceManager.h : Defines the ResourceManager class, which tracks objects
+// shared by multiple GL contexts.
+
+#ifndef LIBGLESV2_RESOURCEMANAGER_H_
+#define LIBGLESV2_RESOURCEMANAGER_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include <map>
+
+#include "common/angleutils.h"
+
+namespace gl
+{
+class Buffer;
+class Shader;
+class Program;
+class Texture;
+class Renderbuffer;
+
+enum SamplerType
+{
+ SAMPLER_2D,
+ SAMPLER_CUBE,
+
+ SAMPLER_TYPE_COUNT
+};
+
+class ResourceManager
+{
+ public:
+ ResourceManager();
+ ~ResourceManager();
+
+ void addRef();
+ void release();
+
+ GLuint createBuffer();
+ GLuint createShader(GLenum type);
+ GLuint createProgram();
+ GLuint createTexture();
+ GLuint createRenderbuffer();
+
+ void deleteBuffer(GLuint buffer);
+ void deleteShader(GLuint shader);
+ void deleteProgram(GLuint program);
+ void deleteTexture(GLuint texture);
+ void deleteRenderbuffer(GLuint renderbuffer);
+
+ Buffer *getBuffer(GLuint handle);
+ Shader *getShader(GLuint handle);
+ Program *getProgram(GLuint handle);
+ Texture *getTexture(GLuint handle);
+ Renderbuffer *getRenderbuffer(GLuint handle);
+
+ void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
+
+ void checkBufferAllocation(unsigned int buffer);
+ void checkTextureAllocation(GLuint texture, SamplerType type);
+ void checkRenderbufferAllocation(GLuint renderbuffer);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ResourceManager);
+
+ std::size_t mRefCount;
+
+ typedef std::map<GLuint, Buffer*> BufferMap;
+ BufferMap mBufferMap;
+
+ typedef std::map<GLuint, Shader*> ShaderMap;
+ ShaderMap mShaderMap;
+
+ typedef std::map<GLuint, Program*> ProgramMap;
+ ProgramMap mProgramMap;
+
+ typedef std::map<GLuint, Texture*> TextureMap;
+ TextureMap mTextureMap;
+
+ typedef std::map<GLuint, Renderbuffer*> RenderbufferMap;
+ RenderbufferMap mRenderbufferMap;
+};
+
+}
+
+#endif // LIBGLESV2_RESOURCEMANAGER_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp
new file mode 100644
index 0000000..4c969d6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp
@@ -0,0 +1,509 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Shader.cpp: Implements the gl::Shader class and its derived classes
+// VertexShader and FragmentShader. Implements GL shader objects and related
+// functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section 3.8 page 84.
+
+#include "libGLESv2/Shader.h"
+
+#include <string>
+
+#include "GLSLANG/Shaderlang.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/utilities.h"
+
+namespace gl
+{
+void *Shader::mFragmentCompiler = NULL;
+void *Shader::mVertexCompiler = NULL;
+
+Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager)
+{
+ mSource = NULL;
+ mHlsl = NULL;
+ mInfoLog = NULL;
+
+ // Perform a one-time initialization of the shader compiler (or after being destructed by releaseCompiler)
+ if (!mFragmentCompiler)
+ {
+ int result = ShInitialize();
+
+ if (result)
+ {
+ ShBuiltInResources resources;
+ ShInitBuiltInResources(&resources);
+ Context *context = getContext();
+
+ resources.MaxVertexAttribs = MAX_VERTEX_ATTRIBS;
+ resources.MaxVertexUniformVectors = MAX_VERTEX_UNIFORM_VECTORS;
+ resources.MaxVaryingVectors = context->getMaximumVaryingVectors();
+ resources.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
+ resources.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
+ resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ resources.MaxFragmentUniformVectors = context->getMaximumFragmentUniformVectors();
+ resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
+ resources.OES_standard_derivatives = 1;
+
+ mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, &resources);
+ mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources);
+ }
+ }
+
+ mRefCount = 0;
+ mDeleteStatus = false;
+}
+
+Shader::~Shader()
+{
+ delete[] mSource;
+ delete[] mHlsl;
+ delete[] mInfoLog;
+}
+
+GLuint Shader::getHandle() const
+{
+ return mHandle;
+}
+
+void Shader::setSource(GLsizei count, const char **string, const GLint *length)
+{
+ delete[] mSource;
+ int totalLength = 0;
+
+ for (int i = 0; i < count; i++)
+ {
+ if (length && length[i] >= 0)
+ {
+ totalLength += length[i];
+ }
+ else
+ {
+ totalLength += (int)strlen(string[i]);
+ }
+ }
+
+ mSource = new char[totalLength + 1];
+ char *code = mSource;
+
+ for (int i = 0; i < count; i++)
+ {
+ int stringLength;
+
+ if (length && length[i] >= 0)
+ {
+ stringLength = length[i];
+ }
+ else
+ {
+ stringLength = (int)strlen(string[i]);
+ }
+
+ strncpy(code, string[i], stringLength);
+ code += stringLength;
+ }
+
+ mSource[totalLength] = '\0';
+}
+
+int Shader::getInfoLogLength() const
+{
+ if (!mInfoLog)
+ {
+ return 0;
+ }
+ else
+ {
+ return strlen(mInfoLog) + 1;
+ }
+}
+
+void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
+{
+ int index = 0;
+
+ if (mInfoLog)
+ {
+ while (index < bufSize - 1 && index < (int)strlen(mInfoLog))
+ {
+ infoLog[index] = mInfoLog[index];
+ index++;
+ }
+ }
+
+ if (bufSize)
+ {
+ infoLog[index] = '\0';
+ }
+
+ if (length)
+ {
+ *length = index;
+ }
+}
+
+int Shader::getSourceLength() const
+{
+ if (!mSource)
+ {
+ return 0;
+ }
+ else
+ {
+ return strlen(mSource) + 1;
+ }
+}
+
+void Shader::getSource(GLsizei bufSize, GLsizei *length, char *source)
+{
+ int index = 0;
+
+ if (mSource)
+ {
+ while (index < bufSize - 1 && index < (int)strlen(mSource))
+ {
+ source[index] = mSource[index];
+ index++;
+ }
+ }
+
+ if (bufSize)
+ {
+ source[index] = '\0';
+ }
+
+ if (length)
+ {
+ *length = index;
+ }
+}
+
+bool Shader::isCompiled()
+{
+ return mHlsl != NULL;
+}
+
+const char *Shader::getHLSL()
+{
+ return mHlsl;
+}
+
+void Shader::addRef()
+{
+ mRefCount++;
+}
+
+void Shader::release()
+{
+ mRefCount--;
+
+ if (mRefCount == 0 && mDeleteStatus)
+ {
+ mResourceManager->deleteShader(mHandle);
+ }
+}
+
+unsigned int Shader::getRefCount() const
+{
+ return mRefCount;
+}
+
+bool Shader::isFlaggedForDeletion() const
+{
+ return mDeleteStatus;
+}
+
+void Shader::flagForDeletion()
+{
+ mDeleteStatus = true;
+}
+
+void Shader::releaseCompiler()
+{
+ ShDestruct(mFragmentCompiler);
+ ShDestruct(mVertexCompiler);
+
+ mFragmentCompiler = NULL;
+ mVertexCompiler = NULL;
+
+ ShFinalize();
+}
+
+void Shader::parseVaryings()
+{
+ if (mHlsl)
+ {
+ const char *input = strstr(mHlsl, "// Varyings") + 12;
+
+ while(true)
+ {
+ char varyingType[256];
+ char varyingName[256];
+
+ int matches = sscanf(input, "static %255s %255s", varyingType, varyingName);
+
+ if (matches != 2)
+ {
+ break;
+ }
+
+ char *array = strstr(varyingName, "[");
+ int size = 1;
+
+ if (array)
+ {
+ size = atoi(array + 1);
+ *array = '\0';
+ }
+
+ varyings.push_back(Varying(parseType(varyingType), varyingName, size, array != NULL));
+
+ input = strstr(input, ";") + 2;
+ }
+
+ mUsesFragCoord = strstr(mHlsl, "GL_USES_FRAG_COORD") != NULL;
+ mUsesFrontFacing = strstr(mHlsl, "GL_USES_FRONT_FACING") != NULL;
+ mUsesPointSize = strstr(mHlsl, "GL_USES_POINT_SIZE") != NULL;
+ mUsesPointCoord = strstr(mHlsl, "GL_USES_POINT_COORD") != NULL;
+ }
+}
+
+void Shader::compileToHLSL(void *compiler)
+{
+ if (isCompiled() || !mSource)
+ {
+ return;
+ }
+
+ TRACE("\n%s", mSource);
+
+ delete[] mInfoLog;
+ mInfoLog = NULL;
+
+ int result = ShCompile(compiler, &mSource, 1, SH_OBJECT_CODE);
+
+ if (result)
+ {
+ int objCodeLen = 0;
+ ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen);
+ mHlsl = new char[objCodeLen];
+ ShGetObjectCode(compiler, mHlsl);
+
+ TRACE("\n%s", mHlsl);
+ }
+ else
+ {
+ int infoLogLen = 0;
+ ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen);
+ mInfoLog = new char[infoLogLen];
+ ShGetInfoLog(compiler, mInfoLog);
+
+ TRACE("\n%s", mInfoLog);
+ }
+}
+
+GLenum Shader::parseType(const std::string &type)
+{
+ if (type == "float")
+ {
+ return GL_FLOAT;
+ }
+ else if (type == "float2")
+ {
+ return GL_FLOAT_VEC2;
+ }
+ else if (type == "float3")
+ {
+ return GL_FLOAT_VEC3;
+ }
+ else if (type == "float4")
+ {
+ return GL_FLOAT_VEC4;
+ }
+ else if (type == "float2x2")
+ {
+ return GL_FLOAT_MAT2;
+ }
+ else if (type == "float3x3")
+ {
+ return GL_FLOAT_MAT3;
+ }
+ else if (type == "float4x4")
+ {
+ return GL_FLOAT_MAT4;
+ }
+ else UNREACHABLE();
+
+ return GL_NONE;
+}
+
+// true if varying x has a higher priority in packing than y
+bool Shader::compareVarying(const Varying &x, const Varying &y)
+{
+ if(x.type == y.type)
+ {
+ return x.size > y.size;
+ }
+
+ switch (x.type)
+ {
+ case GL_FLOAT_MAT4: return true;
+ case GL_FLOAT_MAT2:
+ switch(y.type)
+ {
+ case GL_FLOAT_MAT4: return false;
+ case GL_FLOAT_MAT2: return true;
+ case GL_FLOAT_VEC4: return true;
+ case GL_FLOAT_MAT3: return true;
+ case GL_FLOAT_VEC3: return true;
+ case GL_FLOAT_VEC2: return true;
+ case GL_FLOAT: return true;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_FLOAT_VEC4:
+ switch(y.type)
+ {
+ case GL_FLOAT_MAT4: return false;
+ case GL_FLOAT_MAT2: return false;
+ case GL_FLOAT_VEC4: return true;
+ case GL_FLOAT_MAT3: return true;
+ case GL_FLOAT_VEC3: return true;
+ case GL_FLOAT_VEC2: return true;
+ case GL_FLOAT: return true;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_FLOAT_MAT3:
+ switch(y.type)
+ {
+ case GL_FLOAT_MAT4: return false;
+ case GL_FLOAT_MAT2: return false;
+ case GL_FLOAT_VEC4: return false;
+ case GL_FLOAT_MAT3: return true;
+ case GL_FLOAT_VEC3: return true;
+ case GL_FLOAT_VEC2: return true;
+ case GL_FLOAT: return true;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_FLOAT_VEC3:
+ switch(y.type)
+ {
+ case GL_FLOAT_MAT4: return false;
+ case GL_FLOAT_MAT2: return false;
+ case GL_FLOAT_VEC4: return false;
+ case GL_FLOAT_MAT3: return false;
+ case GL_FLOAT_VEC3: return true;
+ case GL_FLOAT_VEC2: return true;
+ case GL_FLOAT: return true;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_FLOAT_VEC2:
+ switch(y.type)
+ {
+ case GL_FLOAT_MAT4: return false;
+ case GL_FLOAT_MAT2: return false;
+ case GL_FLOAT_VEC4: return false;
+ case GL_FLOAT_MAT3: return false;
+ case GL_FLOAT_VEC3: return false;
+ case GL_FLOAT_VEC2: return true;
+ case GL_FLOAT: return true;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_FLOAT: return false;
+ default: UNREACHABLE();
+ }
+
+ return false;
+}
+
+VertexShader::VertexShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
+{
+}
+
+VertexShader::~VertexShader()
+{
+}
+
+GLenum VertexShader::getType()
+{
+ return GL_VERTEX_SHADER;
+}
+
+void VertexShader::compile()
+{
+ compileToHLSL(mVertexCompiler);
+ parseAttributes();
+ parseVaryings();
+}
+
+int VertexShader::getSemanticIndex(const std::string &attributeName)
+{
+ if (!attributeName.empty())
+ {
+ int semanticIndex = 0;
+ for (AttributeArray::iterator attribute = mAttributes.begin(); attribute != mAttributes.end(); attribute++)
+ {
+ if (attribute->name == attributeName)
+ {
+ return semanticIndex;
+ }
+
+ semanticIndex += VariableRowCount(attribute->type);
+ }
+ }
+
+ return -1;
+}
+
+void VertexShader::parseAttributes()
+{
+ if (mHlsl)
+ {
+ const char *input = strstr(mHlsl, "// Attributes") + 14;
+
+ while(true)
+ {
+ char attributeType[256];
+ char attributeName[256];
+
+ int matches = sscanf(input, "static %255s _%255s", attributeType, attributeName);
+
+ if (matches != 2)
+ {
+ break;
+ }
+
+ mAttributes.push_back(Attribute(parseType(attributeType), attributeName));
+
+ input = strstr(input, ";") + 2;
+ }
+ }
+}
+
+FragmentShader::FragmentShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
+{
+}
+
+FragmentShader::~FragmentShader()
+{
+}
+
+GLenum FragmentShader::getType()
+{
+ return GL_FRAGMENT_SHADER;
+}
+
+void FragmentShader::compile()
+{
+ compileToHLSL(mFragmentCompiler);
+ parseVaryings();
+ varyings.sort(compareVarying);
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h
new file mode 100644
index 0000000..5eaa053
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h
@@ -0,0 +1,157 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Shader.h: Defines the abstract gl::Shader class and its concrete derived
+// classes VertexShader and FragmentShader. Implements GL shader objects and
+// related functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section
+// 3.8 page 84.
+
+#ifndef LIBGLESV2_SHADER_H_
+#define LIBGLESV2_SHADER_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <d3dx9.h>
+#include <list>
+#include <vector>
+
+#include "libGLESv2/ResourceManager.h"
+
+namespace gl
+{
+struct Varying
+{
+ Varying(GLenum type, const std::string &name, int size, bool array)
+ : type(type), name(name), size(size), array(array), reg(-1), col(-1)
+ {
+ }
+
+ GLenum type;
+ std::string name;
+ int size; // Number of 'type' elements
+ bool array;
+
+ int reg; // First varying register, assigned during link
+ int col; // First register element, assigned during link
+};
+
+typedef std::list<Varying> VaryingList;
+
+class Shader
+{
+ friend Program;
+
+ public:
+ Shader(ResourceManager *manager, GLuint handle);
+
+ virtual ~Shader();
+
+ virtual GLenum getType() = 0;
+ GLuint getHandle() const;
+
+ void deleteSource();
+ void setSource(GLsizei count, const char **string, const GLint *length);
+ int getInfoLogLength() const;
+ void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
+ int getSourceLength() const;
+ void getSource(GLsizei bufSize, GLsizei *length, char *source);
+
+ virtual void compile() = 0;
+ bool isCompiled();
+ const char *getHLSL();
+
+ void addRef();
+ void release();
+ unsigned int getRefCount() const;
+ bool isFlaggedForDeletion() const;
+ void flagForDeletion();
+
+ static void releaseCompiler();
+
+ protected:
+ DISALLOW_COPY_AND_ASSIGN(Shader);
+
+ void parseVaryings();
+
+ void compileToHLSL(void *compiler);
+
+ static GLenum parseType(const std::string &type);
+ static bool compareVarying(const Varying &x, const Varying &y);
+
+ const GLuint mHandle;
+ unsigned int mRefCount; // Number of program objects this shader is attached to
+ bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use
+
+ char *mSource;
+ char *mHlsl;
+ char *mInfoLog;
+
+ VaryingList varyings;
+
+ bool mUsesFragCoord;
+ bool mUsesFrontFacing;
+ bool mUsesPointSize;
+ bool mUsesPointCoord;
+
+ ResourceManager *mResourceManager;
+
+ static void *mFragmentCompiler;
+ static void *mVertexCompiler;
+};
+
+struct Attribute
+{
+ Attribute() : type(GL_NONE), name("")
+ {
+ }
+
+ Attribute(GLenum type, const std::string &name) : type(type), name(name)
+ {
+ }
+
+ GLenum type;
+ std::string name;
+};
+
+typedef std::vector<Attribute> AttributeArray;
+
+class VertexShader : public Shader
+{
+ friend Program;
+
+ public:
+ VertexShader(ResourceManager *manager, GLuint handle);
+
+ ~VertexShader();
+
+ GLenum getType();
+ void compile();
+ int getSemanticIndex(const std::string &attributeName);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VertexShader);
+
+ void parseAttributes();
+
+ AttributeArray mAttributes;
+};
+
+class FragmentShader : public Shader
+{
+ public:
+ FragmentShader(ResourceManager *manager, GLuint handle);
+
+ ~FragmentShader();
+
+ GLenum getType();
+ void compile();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FragmentShader);
+};
+}
+
+#endif // LIBGLESV2_SHADER_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp
new file mode 100644
index 0000000..7c040f8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp
@@ -0,0 +1,2467 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Texture.cpp: Implements the gl::Texture class and its derived classes
+// Texture2D and TextureCubeMap. Implements GL texture objects and related
+// functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
+
+#include "libGLESv2/Texture.h"
+
+#include <d3dx9tex.h>
+
+#include <algorithm>
+
+#include "common/debug.h"
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/mathutil.h"
+#include "libGLESv2/utilities.h"
+#include "libGLESv2/Blit.h"
+
+namespace gl
+{
+
+Texture::Image::Image()
+ : width(0), height(0), dirty(false), surface(NULL), format(GL_NONE)
+{
+}
+
+Texture::Image::~Image()
+{
+ if (surface) surface->Release();
+}
+
+Texture::Texture(GLuint id) : RefCountObject(id)
+{
+ mMinFilter = GL_NEAREST_MIPMAP_LINEAR;
+ mMagFilter = GL_LINEAR;
+ mWrapS = GL_REPEAT;
+ mWrapT = GL_REPEAT;
+
+ mWidth = 0;
+ mHeight = 0;
+
+ mDirtyMetaData = true;
+ mDirty = true;
+ mIsRenderable = false;
+ mType = GL_UNSIGNED_BYTE;
+ mBaseTexture = NULL;
+}
+
+Texture::~Texture()
+{
+}
+
+Blit *Texture::getBlitter()
+{
+ Context *context = getContext();
+ return context->getBlitter();
+}
+
+// Returns true on successful filter state update (valid enum parameter)
+bool Texture::setMinFilter(GLenum filter)
+{
+ switch (filter)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ case GL_NEAREST_MIPMAP_NEAREST:
+ case GL_LINEAR_MIPMAP_NEAREST:
+ case GL_NEAREST_MIPMAP_LINEAR:
+ case GL_LINEAR_MIPMAP_LINEAR:
+ {
+ if (mMinFilter != filter)
+ {
+ mMinFilter = filter;
+ mDirty = true;
+ }
+ return true;
+ }
+ default:
+ return false;
+ }
+}
+
+// Returns true on successful filter state update (valid enum parameter)
+bool Texture::setMagFilter(GLenum filter)
+{
+ switch (filter)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ {
+ if (mMagFilter != filter)
+ {
+ mMagFilter = filter;
+ mDirty = true;
+ }
+ return true;
+ }
+ default:
+ return false;
+ }
+}
+
+// Returns true on successful wrap state update (valid enum parameter)
+bool Texture::setWrapS(GLenum wrap)
+{
+ switch (wrap)
+ {
+ case GL_REPEAT:
+ case GL_CLAMP_TO_EDGE:
+ case GL_MIRRORED_REPEAT:
+ {
+ if (mWrapS != wrap)
+ {
+ mWrapS = wrap;
+ mDirty = true;
+ }
+ return true;
+ }
+ default:
+ return false;
+ }
+}
+
+// Returns true on successful wrap state update (valid enum parameter)
+bool Texture::setWrapT(GLenum wrap)
+{
+ switch (wrap)
+ {
+ case GL_REPEAT:
+ case GL_CLAMP_TO_EDGE:
+ case GL_MIRRORED_REPEAT:
+ {
+ if (mWrapT != wrap)
+ {
+ mWrapT = wrap;
+ mDirty = true;
+ }
+ return true;
+ }
+ default:
+ return false;
+ }
+}
+
+GLenum Texture::getMinFilter() const
+{
+ return mMinFilter;
+}
+
+GLenum Texture::getMagFilter() const
+{
+ return mMagFilter;
+}
+
+GLenum Texture::getWrapS() const
+{
+ return mWrapS;
+}
+
+GLenum Texture::getWrapT() const
+{
+ return mWrapT;
+}
+
+GLuint Texture::getWidth() const
+{
+ return mWidth;
+}
+
+GLuint Texture::getHeight() const
+{
+ return mHeight;
+}
+
+bool Texture::isFloatingPoint() const
+{
+ return (mType == GL_FLOAT || mType == GL_HALF_FLOAT_OES);
+}
+
+bool Texture::isRenderableFormat() const
+{
+ D3DFORMAT format = getD3DFormat();
+
+ switch(format)
+ {
+ case D3DFMT_L8:
+ case D3DFMT_A8L8:
+ case D3DFMT_DXT1:
+ return false;
+ case D3DFMT_A8R8G8B8:
+ case D3DFMT_X8R8G8B8:
+ case D3DFMT_A16B16G16R16F:
+ case D3DFMT_A32B32G32R32F:
+ return true;
+ default:
+ UNREACHABLE();
+ }
+
+ return false;
+}
+
+// Selects an internal Direct3D 9 format for storing an Image
+D3DFORMAT Texture::selectFormat(GLenum format, GLenum type)
+{
+ if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
+ format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
+ {
+ return D3DFMT_DXT1;
+ }
+ else if (type == GL_FLOAT)
+ {
+ return D3DFMT_A32B32G32R32F;
+ }
+ else if (type == GL_HALF_FLOAT_OES)
+ {
+ return D3DFMT_A16B16G16R16F;
+ }
+ else if (type == GL_UNSIGNED_BYTE)
+ {
+ if (format == GL_LUMINANCE && getContext()->supportsLuminanceTextures())
+ {
+ return D3DFMT_L8;
+ }
+ else if (format == GL_LUMINANCE_ALPHA && getContext()->supportsLuminanceAlphaTextures())
+ {
+ return D3DFMT_A8L8;
+ }
+ else if (format == GL_RGB)
+ {
+ return D3DFMT_X8R8G8B8;
+ }
+
+ return D3DFMT_A8R8G8B8;
+ }
+
+ return D3DFMT_A8R8G8B8;
+}
+
+// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
+// into the target pixel rectangle at output with outputPitch bytes in between each line.
+void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
+ GLint unpackAlignment, const void *input, size_t outputPitch, void *output, D3DSURFACE_DESC *description) const
+{
+ GLsizei inputPitch = ComputePitch(width, format, type, unpackAlignment);
+
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ switch (format)
+ {
+ case GL_ALPHA:
+ loadAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_LUMINANCE:
+ loadLuminanceImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_L8);
+ break;
+ case GL_LUMINANCE_ALPHA:
+ loadLuminanceAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_A8L8);
+ break;
+ case GL_RGB:
+ loadRGBUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_RGBA:
+ loadRGBAUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_BGRA_EXT:
+ loadBGRAImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ switch (format)
+ {
+ case GL_RGB:
+ loadRGB565ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ switch (format)
+ {
+ case GL_RGBA:
+ loadRGBA4444ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ switch (format)
+ {
+ case GL_RGBA:
+ loadRGBA5551ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_FLOAT:
+ switch (format)
+ {
+ // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
+ case GL_ALPHA:
+ loadAlphaFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_LUMINANCE:
+ loadLuminanceFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_LUMINANCE_ALPHA:
+ loadLuminanceAlphaFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_RGB:
+ loadRGBFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_RGBA:
+ loadRGBAFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_HALF_FLOAT_OES:
+ switch (format)
+ {
+ // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
+ case GL_ALPHA:
+ loadAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_LUMINANCE:
+ loadLuminanceHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_LUMINANCE_ALPHA:
+ loadLuminanceAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_RGB:
+ loadRGBHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ case GL_RGBA:
+ loadRGBAHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
+ break;
+ default: UNREACHABLE();
+ }
+ break;
+ default: UNREACHABLE();
+ }
+}
+
+void Texture::loadAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4;
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0;
+ dest[4 * x + 1] = 0;
+ dest[4 * x + 2] = 0;
+ dest[4 * x + 3] = source[x];
+ }
+ }
+}
+
+void Texture::loadAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 16);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0;
+ dest[4 * x + 1] = 0;
+ dest[4 * x + 2] = 0;
+ dest[4 * x + 3] = source[x];
+ }
+ }
+}
+
+void Texture::loadAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 8);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0;
+ dest[4 * x + 1] = 0;
+ dest[4 * x + 2] = 0;
+ dest[4 * x + 3] = source[x];
+ }
+ }
+}
+
+void Texture::loadLuminanceImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const
+{
+ const int destBytesPerPixel = native? 1: 4;
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * destBytesPerPixel;
+
+ if (!native) // BGRA8 destination format
+ {
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x];
+ dest[4 * x + 1] = source[x];
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ else // L8 destination format
+ {
+ memcpy(dest, source, width);
+ }
+ }
+}
+
+void Texture::loadLuminanceFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 16);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x];
+ dest[4 * x + 1] = source[x];
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = 1.0f;
+ }
+ }
+}
+
+void Texture::loadLuminanceHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 8);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x];
+ dest[4 * x + 1] = source[x];
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
+ }
+ }
+}
+
+void Texture::loadLuminanceAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const
+{
+ const int destBytesPerPixel = native? 2: 4;
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * destBytesPerPixel;
+
+ if (!native) // BGRA8 destination format
+ {
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[2*x+0];
+ dest[4 * x + 1] = source[2*x+0];
+ dest[4 * x + 2] = source[2*x+0];
+ dest[4 * x + 3] = source[2*x+1];
+ }
+ }
+ else
+ {
+ memcpy(dest, source, width * 2);
+ }
+ }
+}
+
+void Texture::loadLuminanceAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 16);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[2*x+0];
+ dest[4 * x + 1] = source[2*x+0];
+ dest[4 * x + 2] = source[2*x+0];
+ dest[4 * x + 3] = source[2*x+1];
+ }
+ }
+}
+
+void Texture::loadLuminanceAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 8);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[2*x+0];
+ dest[4 * x + 1] = source[2*x+0];
+ dest[4 * x + 2] = source[2*x+0];
+ dest[4 * x + 3] = source[2*x+1];
+ }
+ }
+}
+
+void Texture::loadRGBUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4;
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 2];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 0];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+}
+
+void Texture::loadRGB565ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4;
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
+ dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
+ dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+}
+
+void Texture::loadRGBFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 16);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 0];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 2];
+ dest[4 * x + 3] = 1.0f;
+ }
+ }
+}
+
+void Texture::loadRGBHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 8);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 0];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 2];
+ dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
+ }
+ }
+}
+
+void Texture::loadRGBAUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4;
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 4 + 2];
+ dest[4 * x + 1] = source[x * 4 + 1];
+ dest[4 * x + 2] = source[x * 4 + 0];
+ dest[4 * x + 3] = source[x * 4 + 3];
+ }
+ }
+}
+
+void Texture::loadRGBA4444ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4;
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
+ dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
+ dest[4 * x + 2] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
+ dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
+ }
+ }
+}
+
+void Texture::loadRGBA5551ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4;
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
+ dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
+ dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
+ dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
+ }
+ }
+}
+
+void Texture::loadRGBAFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
+ dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 16);
+ memcpy(dest, source, width * 16);
+ }
+}
+
+void Texture::loadRGBAHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 8;
+ memcpy(dest, source, width * 8);
+ }
+}
+
+void Texture::loadBGRAImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputPitch;
+ dest = static_cast<unsigned char*>(output) + (y + yoffset) * outputPitch + xoffset * 4;
+ memcpy(dest, source, width*4);
+ }
+}
+
+void Texture::createSurface(GLsizei width, GLsizei height, GLenum format, GLenum type, Image *img)
+{
+ IDirect3DTexture9 *newTexture = NULL;
+ IDirect3DSurface9 *newSurface = NULL;
+
+ if (width != 0 && height != 0)
+ {
+ int levelToFetch = 0;
+ GLsizei requestWidth = width;
+ GLsizei requestHeight = height;
+ if (IsCompressed(format) && (width % 4 != 0 || height % 4 != 0))
+ {
+ bool isMult4 = false;
+ int upsampleCount = 0;
+ while (!isMult4)
+ {
+ requestWidth <<= 1;
+ requestHeight <<= 1;
+ upsampleCount++;
+ if (requestWidth % 4 == 0 && requestHeight % 4 == 0)
+ {
+ isMult4 = true;
+ }
+ }
+ levelToFetch = upsampleCount;
+ }
+
+ HRESULT result = getDevice()->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, NULL, selectFormat(format, type),
+ D3DPOOL_SYSTEMMEM, &newTexture, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ newTexture->GetSurfaceLevel(levelToFetch, &newSurface);
+ newTexture->Release();
+ }
+
+ if (img->surface) img->surface->Release();
+ img->surface = newSurface;
+
+ img->width = width;
+ img->height = height;
+ img->format = format;
+}
+
+void Texture::setImage(GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *img)
+{
+ createSurface(width, height, format, type, img);
+
+ if (pixels != NULL && img->surface != NULL)
+ {
+ D3DSURFACE_DESC description;
+ img->surface->GetDesc(&description);
+
+ D3DLOCKED_RECT locked;
+ HRESULT result = img->surface->LockRect(&locked, NULL, 0);
+
+ ASSERT(SUCCEEDED(result));
+
+ if (SUCCEEDED(result))
+ {
+ loadImageData(0, 0, width, height, format, type, unpackAlignment, pixels, locked.Pitch, locked.pBits, &description);
+ img->surface->UnlockRect();
+ }
+
+ img->dirty = true;
+ }
+
+ mDirtyMetaData = true;
+}
+
+void Texture::setCompressedImage(GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *img)
+{
+ createSurface(width, height, format, GL_UNSIGNED_BYTE, img);
+
+ if (pixels != NULL && img->surface != NULL)
+ {
+ D3DLOCKED_RECT locked;
+ HRESULT result = img->surface->LockRect(&locked, NULL, 0);
+
+ ASSERT(SUCCEEDED(result));
+
+ if (SUCCEEDED(result))
+ {
+ memcpy(locked.pBits, pixels, imageSize);
+ img->surface->UnlockRect();
+ }
+
+ img->dirty = true;
+ }
+
+ mDirtyMetaData = true;
+}
+
+bool Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *img)
+{
+ if (width + xoffset > img->width || height + yoffset > img->height)
+ {
+ error(GL_INVALID_VALUE);
+ return false;
+ }
+
+ if (!img->surface)
+ {
+ createSurface(img->width, img->height, format, type, img);
+ }
+
+ if (pixels != NULL && img->surface != NULL)
+ {
+ D3DSURFACE_DESC description;
+ img->surface->GetDesc(&description);
+
+ D3DLOCKED_RECT locked;
+ HRESULT result = img->surface->LockRect(&locked, NULL, 0);
+
+ ASSERT(SUCCEEDED(result));
+
+ if (SUCCEEDED(result))
+ {
+ loadImageData(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, locked.Pitch, locked.pBits, &description);
+ img->surface->UnlockRect();
+ }
+
+ img->dirty = true;
+ }
+
+ return true;
+}
+
+bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *img)
+{
+ if (width + xoffset > img->width || height + yoffset > img->height)
+ {
+ error(GL_INVALID_VALUE);
+ return false;
+ }
+
+ if (format != getFormat())
+ {
+ error(GL_INVALID_OPERATION);
+ return false;
+ }
+
+ if (!img->surface)
+ {
+ createSurface(img->width, img->height, format, GL_UNSIGNED_BYTE, img);
+ }
+
+ if (pixels != NULL && img->surface != NULL)
+ {
+ RECT updateRegion;
+ updateRegion.left = xoffset;
+ updateRegion.right = xoffset + width;
+ updateRegion.bottom = yoffset + height;
+ updateRegion.top = yoffset;
+
+ D3DLOCKED_RECT locked;
+ HRESULT result = img->surface->LockRect(&locked, &updateRegion, 0);
+
+ ASSERT(SUCCEEDED(result));
+
+ if (SUCCEEDED(result))
+ {
+ GLsizei inputPitch = ComputeCompressedPitch(width, format);
+ int rows = imageSize / inputPitch;
+ for (int i = 0; i < rows; ++i)
+ {
+ memcpy((void*)((BYTE*)locked.pBits + i * locked.Pitch), (void*)((BYTE*)pixels + i * inputPitch), inputPitch);
+ }
+ img->surface->UnlockRect();
+ }
+
+ img->dirty = true;
+ }
+
+ return true;
+}
+
+// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats
+void Texture::copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, IDirect3DSurface9 *renderTarget)
+{
+ IDirect3DDevice9 *device = getDevice();
+ IDirect3DSurface9 *surface = NULL;
+ D3DSURFACE_DESC description;
+ renderTarget->GetDesc(&description);
+
+ HRESULT result = device->CreateOffscreenPlainSurface(description.Width, description.Height, description.Format, D3DPOOL_SYSTEMMEM, &surface, NULL);
+
+ if (!SUCCEEDED(result))
+ {
+ ERR("Could not create matching destination surface.");
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ result = device->GetRenderTargetData(renderTarget, surface);
+
+ if (!SUCCEEDED(result))
+ {
+ ERR("GetRenderTargetData unexpectedly failed.");
+ surface->Release();
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ D3DLOCKED_RECT sourceLock = {0};
+ RECT sourceRect = {x, y, x + width, y + height};
+ result = surface->LockRect(&sourceLock, &sourceRect, 0);
+
+ if (FAILED(result))
+ {
+ ERR("Failed to lock the source surface (rectangle might be invalid).");
+ surface->UnlockRect();
+ surface->Release();
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ if (!image->surface)
+ {
+ createSurface(width, height, internalFormat, mType, image);
+ }
+
+ if (image->surface == NULL)
+ {
+ ERR("Failed to create an image surface.");
+ surface->UnlockRect();
+ surface->Release();
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ D3DLOCKED_RECT destLock = {0};
+ RECT destRect = {xoffset, yoffset, xoffset + width, yoffset + height};
+ result = image->surface->LockRect(&destLock, &destRect, 0);
+
+ if (FAILED(result))
+ {
+ ERR("Failed to lock the destination surface (rectangle might be invalid).");
+ surface->UnlockRect();
+ surface->Release();
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ if (destLock.pBits && sourceLock.pBits)
+ {
+ unsigned char *source = (unsigned char*)sourceLock.pBits;
+ unsigned char *dest = (unsigned char*)destLock.pBits;
+
+ switch (description.Format)
+ {
+ case D3DFMT_X8R8G8B8:
+ case D3DFMT_A8R8G8B8:
+ switch(getD3DFormat())
+ {
+ case D3DFMT_L8:
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ dest[x] = source[x * 4 + 2];
+ }
+
+ source += sourceLock.Pitch;
+ dest += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_A8L8:
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ dest[x * 2 + 0] = source[x * 4 + 2];
+ dest[x * 2 + 1] = source[x * 4 + 3];
+ }
+
+ source += sourceLock.Pitch;
+ dest += destLock.Pitch;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ case D3DFMT_R5G6B5:
+ switch(getD3DFormat())
+ {
+ case D3DFMT_L8:
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ unsigned char red = source[x * 2 + 1] & 0xF8;
+ dest[x] = red | (red >> 5);
+ }
+
+ source += sourceLock.Pitch;
+ dest += destLock.Pitch;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ case D3DFMT_A1R5G5B5:
+ switch(getD3DFormat())
+ {
+ case D3DFMT_L8:
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ unsigned char red = source[x * 2 + 1] & 0x7C;
+ dest[x] = (red << 1) | (red >> 4);
+ }
+
+ source += sourceLock.Pitch;
+ dest += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_A8L8:
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ unsigned char red = source[x * 2 + 1] & 0x7C;
+ dest[x * 2 + 0] = (red << 1) | (red >> 4);
+ dest[x * 2 + 1] = (signed char)source[x * 2 + 1] >> 7;
+ }
+
+ source += sourceLock.Pitch;
+ dest += destLock.Pitch;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ image->dirty = true;
+ mDirtyMetaData = true;
+ }
+
+ image->surface->UnlockRect();
+ surface->UnlockRect();
+ surface->Release();
+}
+
+D3DFORMAT Texture::getD3DFormat() const
+{
+ return selectFormat(getFormat(), mType);
+}
+
+IDirect3DBaseTexture9 *Texture::getTexture()
+{
+ if (!isComplete())
+ {
+ return NULL;
+ }
+
+ if (mDirtyMetaData)
+ {
+ mBaseTexture = createTexture();
+ mIsRenderable = false;
+ }
+
+ if (mDirtyMetaData || dirtyImageData())
+ {
+ updateTexture();
+ }
+
+ mDirtyMetaData = false;
+ ASSERT(!dirtyImageData());
+
+ return mBaseTexture;
+}
+
+bool Texture::isDirty() const
+{
+ return (mDirty || mDirtyMetaData || dirtyImageData());
+}
+
+// Returns the top-level texture surface as a render target
+void Texture::needRenderTarget()
+{
+ if (!mIsRenderable)
+ {
+ mBaseTexture = convertToRenderTarget();
+ mIsRenderable = true;
+ }
+
+ if (dirtyImageData())
+ {
+ updateTexture();
+ }
+
+ mDirtyMetaData = false;
+}
+
+void Texture::dropTexture()
+{
+ if (mBaseTexture)
+ {
+ mBaseTexture = NULL;
+ }
+
+ mIsRenderable = false;
+}
+
+void Texture::pushTexture(IDirect3DBaseTexture9 *newTexture, bool renderable)
+{
+ mBaseTexture = newTexture;
+ mDirtyMetaData = false;
+ mIsRenderable = renderable;
+ mDirty = true;
+}
+
+
+GLint Texture::creationLevels(GLsizei width, GLsizei height, GLint maxlevel) const
+{
+ if (isPow2(width) && isPow2(height))
+ {
+ return maxlevel;
+ }
+ else
+ {
+ // OpenGL ES 2.0 without GL_OES_texture_npot does not permit NPOT mipmaps.
+ return 1;
+ }
+}
+
+GLint Texture::creationLevels(GLsizei size, GLint maxlevel) const
+{
+ return creationLevels(size, size, maxlevel);
+}
+
+int Texture::levelCount() const
+{
+ return mBaseTexture ? mBaseTexture->GetLevelCount() : 0;
+}
+
+bool Texture::isRenderable() const
+{
+ return mIsRenderable;
+}
+
+Texture2D::Texture2D(GLuint id) : Texture(id)
+{
+ mTexture = NULL;
+}
+
+Texture2D::~Texture2D()
+{
+ mColorbufferProxy.set(NULL);
+
+ if (mTexture)
+ {
+ mTexture->Release();
+ mTexture = NULL;
+ }
+}
+
+GLenum Texture2D::getTarget() const
+{
+ return GL_TEXTURE_2D;
+}
+
+GLenum Texture2D::getFormat() const
+{
+ return mImageArray[0].format;
+}
+
+// While OpenGL doesn't check texture consistency until draw-time, D3D9 requires a complete texture
+// for render-to-texture (such as CopyTexImage). We have no way of keeping individual inconsistent levels.
+// Call this when a particular level of the texture must be defined with a specific format, width and height.
+//
+// Returns true if the existing texture was unsuitable and had to be destroyed. If so, it will also set
+// a new height and width for the texture by working backwards from the given width and height.
+bool Texture2D::redefineTexture(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum type)
+{
+ bool widthOkay = (mWidth >> level == width);
+ bool heightOkay = (mHeight >> level == height);
+
+ bool sizeOkay = ((widthOkay && heightOkay)
+ || (widthOkay && mHeight >> level == 0 && height == 1)
+ || (heightOkay && mWidth >> level == 0 && width == 1));
+
+ bool typeOkay = (type == mType);
+
+ bool textureOkay = (sizeOkay && typeOkay && internalFormat == mImageArray[0].format);
+
+ if (!textureOkay)
+ {
+ TRACE("Redefining 2D texture (%d, 0x%04X, %d, %d => 0x%04X, %d, %d).", level,
+ mImageArray[0].format, mWidth, mHeight,
+ internalFormat, width, height);
+
+ // Purge all the levels and the texture.
+
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ if (mImageArray[i].surface != NULL)
+ {
+ mImageArray[i].dirty = false;
+
+ mImageArray[i].surface->Release();
+ mImageArray[i].surface = NULL;
+ }
+ }
+
+ if (mTexture != NULL)
+ {
+ mTexture->Release();
+ mTexture = NULL;
+ dropTexture();
+ }
+
+ mWidth = width << level;
+ mHeight = height << level;
+ mImageArray[0].format = internalFormat;
+ mType = type;
+ }
+
+ return !textureOkay;
+}
+
+void Texture2D::setImage(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ redefineTexture(level, internalFormat, width, height, type);
+
+ Texture::setImage(width, height, format, type, unpackAlignment, pixels, &mImageArray[level]);
+}
+
+void Texture2D::setCompressedImage(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
+{
+ redefineTexture(level, internalFormat, width, height, GL_UNSIGNED_BYTE);
+
+ Texture::setCompressedImage(width, height, internalFormat, imageSize, pixels, &mImageArray[level]);
+}
+
+void Texture2D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+{
+ ASSERT(mImageArray[level].surface != NULL);
+
+ if (level < levelCount())
+ {
+ IDirect3DSurface9 *destLevel = NULL;
+ HRESULT result = mTexture->GetSurfaceLevel(level, &destLevel);
+
+ ASSERT(SUCCEEDED(result));
+
+ if (SUCCEEDED(result))
+ {
+ Image *img = &mImageArray[level];
+
+ RECT sourceRect;
+ sourceRect.left = xoffset;
+ sourceRect.top = yoffset;
+ sourceRect.right = xoffset + width;
+ sourceRect.bottom = yoffset + height;
+
+ POINT destPoint;
+ destPoint.x = xoffset;
+ destPoint.y = yoffset;
+
+ result = getDevice()->UpdateSurface(img->surface, &sourceRect, destLevel, &destPoint);
+ ASSERT(SUCCEEDED(result));
+
+ destLevel->Release();
+
+ img->dirty = false;
+ }
+ }
+}
+
+void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, &mImageArray[level]))
+ {
+ commitRect(level, xoffset, yoffset, width, height);
+ }
+}
+
+void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
+{
+ if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, &mImageArray[level]))
+ {
+ commitRect(level, xoffset, yoffset, width, height);
+ }
+}
+
+void Texture2D::copyImage(GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source)
+{
+ IDirect3DSurface9 *renderTarget = source->getRenderTarget();
+
+ if (!renderTarget)
+ {
+ ERR("Failed to retrieve the render target.");
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ bool redefined = redefineTexture(level, internalFormat, width, height, mType);
+
+ if (!isRenderableFormat())
+ {
+ copyNonRenderable(&mImageArray[level], internalFormat, 0, 0, x, y, width, height, renderTarget);
+ }
+ else
+ {
+ if (redefined)
+ {
+ convertToRenderTarget();
+ pushTexture(mTexture, true);
+ }
+ else
+ {
+ needRenderTarget();
+ }
+
+ if (width != 0 && height != 0 && level < levelCount())
+ {
+ RECT sourceRect;
+ sourceRect.left = x;
+ sourceRect.right = x + width;
+ sourceRect.top = y;
+ sourceRect.bottom = y + height;
+
+ IDirect3DSurface9 *dest;
+ HRESULT hr = mTexture->GetSurfaceLevel(level, &dest);
+
+ getBlitter()->formatConvert(source->getRenderTarget(), sourceRect, internalFormat, 0, 0, dest);
+ dest->Release();
+ }
+ }
+
+ mImageArray[level].width = width;
+ mImageArray[level].height = height;
+ mImageArray[level].format = internalFormat;
+}
+
+void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source)
+{
+ if (xoffset + width > mImageArray[level].width || yoffset + height > mImageArray[level].height)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ IDirect3DSurface9 *renderTarget = source->getRenderTarget();
+
+ if (!renderTarget)
+ {
+ ERR("Failed to retrieve the render target.");
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ bool redefined = redefineTexture(0, mImageArray[0].format, mImageArray[0].width, mImageArray[0].height, mType);
+
+ if (!isRenderableFormat())
+ {
+ copyNonRenderable(&mImageArray[level], getFormat(), xoffset, yoffset, x, y, width, height, renderTarget);
+ }
+ else
+ {
+ if (redefined)
+ {
+ convertToRenderTarget();
+ pushTexture(mTexture, true);
+ }
+ else
+ {
+ needRenderTarget();
+ }
+
+ if (level < levelCount())
+ {
+ RECT sourceRect;
+ sourceRect.left = x;
+ sourceRect.right = x + width;
+ sourceRect.top = y;
+ sourceRect.bottom = y + height;
+
+ IDirect3DSurface9 *dest;
+ HRESULT hr = mTexture->GetSurfaceLevel(level, &dest);
+
+ getBlitter()->formatConvert(source->getRenderTarget(), sourceRect, mImageArray[0].format, xoffset, yoffset, dest);
+ dest->Release();
+ }
+ }
+}
+
+// Tests for GL texture object completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
+bool Texture2D::isComplete() const
+{
+ GLsizei width = mImageArray[0].width;
+ GLsizei height = mImageArray[0].height;
+
+ if (width <= 0 || height <= 0)
+ {
+ return false;
+ }
+
+ bool mipmapping = false;
+
+ switch (mMinFilter)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ mipmapping = false;
+ break;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ case GL_LINEAR_MIPMAP_NEAREST:
+ case GL_NEAREST_MIPMAP_LINEAR:
+ case GL_LINEAR_MIPMAP_LINEAR:
+ mipmapping = true;
+ break;
+ default: UNREACHABLE();
+ }
+
+ if ((getFormat() == GL_FLOAT && !getContext()->supportsFloatLinearFilter()) ||
+ (getFormat() == GL_HALF_FLOAT_OES && !getContext()->supportsHalfFloatLinearFilter()))
+ {
+ if (mMagFilter != GL_NEAREST || (mMinFilter != GL_NEAREST && mMinFilter != GL_NEAREST_MIPMAP_NEAREST))
+ {
+ return false;
+ }
+ }
+
+
+ if ((getWrapS() != GL_CLAMP_TO_EDGE && !isPow2(width))
+ || (getWrapT() != GL_CLAMP_TO_EDGE && !isPow2(height)))
+ {
+ return false;
+ }
+
+ if (mipmapping)
+ {
+ if (!isPow2(width) || !isPow2(height))
+ {
+ return false;
+ }
+
+ int q = log2(std::max(width, height));
+
+ for (int level = 1; level <= q; level++)
+ {
+ if (mImageArray[level].format != mImageArray[0].format)
+ {
+ return false;
+ }
+
+ if (mImageArray[level].width != std::max(1, width >> level))
+ {
+ return false;
+ }
+
+ if (mImageArray[level].height != std::max(1, height >> level))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool Texture2D::isCompressed() const
+{
+ return IsCompressed(getFormat());
+}
+
+// Constructs a Direct3D 9 texture resource from the texture images, or returns an existing one
+IDirect3DBaseTexture9 *Texture2D::createTexture()
+{
+ IDirect3DTexture9 *texture;
+
+ IDirect3DDevice9 *device = getDevice();
+ D3DFORMAT format = selectFormat(mImageArray[0].format, mType);
+
+ HRESULT result = device->CreateTexture(mWidth, mHeight, creationLevels(mWidth, mHeight, 0), 0, format, D3DPOOL_DEFAULT, &texture, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ if (mTexture) mTexture->Release();
+ mTexture = texture;
+ return texture;
+}
+
+void Texture2D::updateTexture()
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ int levels = levelCount();
+
+ for (int level = 0; level < levels; level++)
+ {
+ if (mImageArray[level].dirty)
+ {
+ IDirect3DSurface9 *levelSurface = NULL;
+ HRESULT result = mTexture->GetSurfaceLevel(level, &levelSurface);
+
+ ASSERT(SUCCEEDED(result));
+
+ if (SUCCEEDED(result))
+ {
+ result = device->UpdateSurface(mImageArray[level].surface, NULL, levelSurface, NULL);
+ ASSERT(SUCCEEDED(result));
+
+ levelSurface->Release();
+
+ mImageArray[level].dirty = false;
+ }
+ }
+ }
+}
+
+IDirect3DBaseTexture9 *Texture2D::convertToRenderTarget()
+{
+ IDirect3DTexture9 *texture = NULL;
+
+ if (mWidth != 0 && mHeight != 0)
+ {
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+ D3DFORMAT format = selectFormat(mImageArray[0].format, mType);
+
+ HRESULT result = device->CreateTexture(mWidth, mHeight, creationLevels(mWidth, mHeight, 0), D3DUSAGE_RENDERTARGET, format, D3DPOOL_DEFAULT, &texture, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ if (mTexture != NULL)
+ {
+ int levels = levelCount();
+ for (int i = 0; i < levels; i++)
+ {
+ IDirect3DSurface9 *source;
+ result = mTexture->GetSurfaceLevel(i, &source);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ texture->Release();
+
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ IDirect3DSurface9 *dest;
+ result = texture->GetSurfaceLevel(i, &dest);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ texture->Release();
+ source->Release();
+
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ display->endScene();
+ result = device->StretchRect(source, NULL, dest, NULL, D3DTEXF_NONE);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ texture->Release();
+ source->Release();
+ dest->Release();
+
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ source->Release();
+ dest->Release();
+ }
+ }
+ }
+
+ if (mTexture != NULL)
+ {
+ mTexture->Release();
+ }
+
+ mTexture = texture;
+ return mTexture;
+}
+
+bool Texture2D::dirtyImageData() const
+{
+ int q = log2(std::max(mWidth, mHeight));
+
+ for (int i = 0; i <= q; i++)
+ {
+ if (mImageArray[i].dirty) return true;
+ }
+
+ return false;
+}
+
+void Texture2D::generateMipmaps()
+{
+ if (!isPow2(mImageArray[0].width) || !isPow2(mImageArray[0].height))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+ unsigned int q = log2(std::max(mWidth, mHeight));
+ for (unsigned int i = 1; i <= q; i++)
+ {
+ if (mImageArray[i].surface != NULL)
+ {
+ mImageArray[i].surface->Release();
+ mImageArray[i].surface = NULL;
+ }
+
+ mImageArray[i].dirty = false;
+
+ mImageArray[i].format = mImageArray[0].format;
+ mImageArray[i].width = std::max(mImageArray[0].width >> i, 1);
+ mImageArray[i].height = std::max(mImageArray[0].height >> i, 1);
+ }
+
+ if (isRenderable())
+ {
+ if (mTexture == NULL)
+ {
+ ERR(" failed because mTexture was null.");
+ return;
+ }
+
+ for (unsigned int i = 1; i <= q; i++)
+ {
+ IDirect3DSurface9 *upper = NULL;
+ IDirect3DSurface9 *lower = NULL;
+
+ mTexture->GetSurfaceLevel(i-1, &upper);
+ mTexture->GetSurfaceLevel(i, &lower);
+
+ if (upper != NULL && lower != NULL)
+ {
+ getBlitter()->boxFilter(upper, lower);
+ }
+
+ if (upper != NULL) upper->Release();
+ if (lower != NULL) lower->Release();
+ }
+ }
+ else
+ {
+ for (unsigned int i = 1; i <= q; i++)
+ {
+ createSurface(mImageArray[i].width, mImageArray[i].height, mImageArray[i].format, mType, &mImageArray[i]);
+ if (mImageArray[i].surface == NULL)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ if (FAILED(D3DXLoadSurfaceFromSurface(mImageArray[i].surface, NULL, NULL, mImageArray[i - 1].surface, NULL, NULL, D3DX_FILTER_BOX, 0)))
+ {
+ ERR(" failed to load filter %d to %d.", i - 1, i);
+ }
+
+ mImageArray[i].dirty = true;
+ }
+
+ mDirtyMetaData = true;
+ }
+}
+
+Renderbuffer *Texture2D::getColorbuffer(GLenum target)
+{
+ if (target != GL_TEXTURE_2D)
+ {
+ return error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
+ }
+
+ if (mColorbufferProxy.get() == NULL)
+ {
+ mColorbufferProxy.set(new Renderbuffer(id(), new TextureColorbufferProxy(this, target)));
+ }
+
+ return mColorbufferProxy.get();
+}
+
+IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
+{
+ ASSERT(target == GL_TEXTURE_2D);
+
+ needRenderTarget();
+
+ if (mTexture == NULL)
+ {
+ return NULL;
+ }
+
+ IDirect3DSurface9 *renderTarget = NULL;
+ mTexture->GetSurfaceLevel(0, &renderTarget);
+
+ return renderTarget;
+}
+
+TextureCubeMap::TextureCubeMap(GLuint id) : Texture(id)
+{
+ mTexture = NULL;
+}
+
+TextureCubeMap::~TextureCubeMap()
+{
+ for (int i = 0; i < 6; i++)
+ {
+ mFaceProxies[i].set(NULL);
+ }
+
+ if (mTexture)
+ {
+ mTexture->Release();
+ mTexture = NULL;
+ }
+}
+
+GLenum TextureCubeMap::getTarget() const
+{
+ return GL_TEXTURE_CUBE_MAP;
+}
+
+GLenum TextureCubeMap::getFormat() const
+{
+ return mImageArray[0][0].format;
+}
+
+void TextureCubeMap::setImagePosX(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ setImage(0, level, internalFormat, width, height, format, type, unpackAlignment, pixels);
+}
+
+void TextureCubeMap::setImageNegX(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ setImage(1, level, internalFormat, width, height, format, type, unpackAlignment, pixels);
+}
+
+void TextureCubeMap::setImagePosY(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ setImage(2, level, internalFormat, width, height, format, type, unpackAlignment, pixels);
+}
+
+void TextureCubeMap::setImageNegY(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ setImage(3, level, internalFormat, width, height, format, type, unpackAlignment, pixels);
+}
+
+void TextureCubeMap::setImagePosZ(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ setImage(4, level, internalFormat, width, height, format, type, unpackAlignment, pixels);
+}
+
+void TextureCubeMap::setImageNegZ(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ setImage(5, level, internalFormat, width, height, format, type, unpackAlignment, pixels);
+}
+
+void TextureCubeMap::setCompressedImage(GLenum face, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
+{
+ redefineTexture(level, internalFormat, width);
+
+ Texture::setCompressedImage(width, height, internalFormat, imageSize, pixels, &mImageArray[faceIndex(face)][level]);
+}
+
+void TextureCubeMap::commitRect(GLenum faceTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+{
+ int face = faceIndex(faceTarget);
+
+ ASSERT(mImageArray[face][level].surface != NULL);
+
+ if (level < levelCount())
+ {
+ IDirect3DSurface9 *destLevel = getCubeMapSurface(face, level);
+ ASSERT(destLevel != NULL);
+
+ if (destLevel != NULL)
+ {
+ Image *img = &mImageArray[face][level];
+
+ RECT sourceRect;
+ sourceRect.left = xoffset;
+ sourceRect.top = yoffset;
+ sourceRect.right = xoffset + width;
+ sourceRect.bottom = yoffset + height;
+
+ POINT destPoint;
+ destPoint.x = xoffset;
+ destPoint.y = yoffset;
+
+ HRESULT result = getDevice()->UpdateSurface(img->surface, &sourceRect, destLevel, &destPoint);
+ ASSERT(SUCCEEDED(result));
+
+ destLevel->Release();
+
+ img->dirty = false;
+ }
+ }
+}
+
+void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, &mImageArray[faceIndex(target)][level]))
+ {
+ commitRect(target, level, xoffset, yoffset, width, height);
+ }
+}
+
+void TextureCubeMap::subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
+{
+ if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, &mImageArray[faceIndex(target)][level]))
+ {
+ commitRect(target, level, xoffset, yoffset, width, height);
+ }
+}
+
+// Tests for GL texture object completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
+bool TextureCubeMap::isComplete() const
+{
+ int size = mImageArray[0][0].width;
+
+ if (size <= 0)
+ {
+ return false;
+ }
+
+ bool mipmapping;
+
+ switch (mMinFilter)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ mipmapping = false;
+ break;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ case GL_LINEAR_MIPMAP_NEAREST:
+ case GL_NEAREST_MIPMAP_LINEAR:
+ case GL_LINEAR_MIPMAP_LINEAR:
+ mipmapping = true;
+ break;
+ default: UNREACHABLE();
+ }
+
+ for (int face = 0; face < 6; face++)
+ {
+ if (mImageArray[face][0].width != size || mImageArray[face][0].height != size)
+ {
+ return false;
+ }
+ }
+
+ if ((getFormat() == GL_FLOAT && !getContext()->supportsFloatLinearFilter()) ||
+ (getFormat() == GL_HALF_FLOAT_OES && !getContext()->supportsHalfFloatLinearFilter()))
+ {
+ if (mMagFilter != GL_NEAREST || (mMinFilter != GL_NEAREST && mMinFilter != GL_NEAREST_MIPMAP_NEAREST))
+ {
+ return false;
+ }
+ }
+
+ if (mipmapping)
+ {
+ if (!isPow2(size) && (getWrapS() != GL_CLAMP_TO_EDGE || getWrapT() != GL_CLAMP_TO_EDGE))
+ {
+ return false;
+ }
+
+ int q = log2(size);
+
+ for (int face = 0; face < 6; face++)
+ {
+ for (int level = 1; level <= q; level++)
+ {
+ if (mImageArray[face][level].format != mImageArray[0][0].format)
+ {
+ return false;
+ }
+
+ if (mImageArray[face][level].width != std::max(1, size >> level))
+ {
+ return false;
+ }
+
+ ASSERT(mImageArray[face][level].height == mImageArray[face][level].width);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool TextureCubeMap::isCompressed() const
+{
+ return IsCompressed(getFormat());
+}
+
+// Constructs a Direct3D 9 texture resource from the texture images, or returns an existing one
+IDirect3DBaseTexture9 *TextureCubeMap::createTexture()
+{
+ IDirect3DDevice9 *device = getDevice();
+ D3DFORMAT format = selectFormat(mImageArray[0][0].format, mType);
+
+ IDirect3DCubeTexture9 *texture;
+
+ HRESULT result = device->CreateCubeTexture(mWidth, creationLevels(mWidth, 0), 0, format, D3DPOOL_DEFAULT, &texture, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ if (mTexture) mTexture->Release();
+
+ mTexture = texture;
+ return mTexture;
+}
+
+void TextureCubeMap::updateTexture()
+{
+ IDirect3DDevice9 *device = getDevice();
+
+ for (int face = 0; face < 6; face++)
+ {
+ int levels = levelCount();
+ for (int level = 0; level < levels; level++)
+ {
+ Image *img = &mImageArray[face][level];
+
+ if (img->dirty)
+ {
+ IDirect3DSurface9 *levelSurface = getCubeMapSurface(face, level);
+ ASSERT(levelSurface != NULL);
+
+ if (levelSurface != NULL)
+ {
+ HRESULT result = device->UpdateSurface(img->surface, NULL, levelSurface, NULL);
+ ASSERT(SUCCEEDED(result));
+
+ levelSurface->Release();
+
+ img->dirty = false;
+ }
+ }
+ }
+ }
+}
+
+IDirect3DBaseTexture9 *TextureCubeMap::convertToRenderTarget()
+{
+ IDirect3DCubeTexture9 *texture = NULL;
+
+ if (mWidth != 0)
+ {
+ egl::Display *display = getDisplay();
+ IDirect3DDevice9 *device = getDevice();
+ D3DFORMAT format = selectFormat(mImageArray[0][0].format, mType);
+
+ HRESULT result = device->CreateCubeTexture(mWidth, creationLevels(mWidth, 0), D3DUSAGE_RENDERTARGET, format, D3DPOOL_DEFAULT, &texture, NULL);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ if (mTexture != NULL)
+ {
+ int levels = levelCount();
+ for (int f = 0; f < 6; f++)
+ {
+ for (int i = 0; i < levels; i++)
+ {
+ IDirect3DSurface9 *source;
+ result = mTexture->GetCubeMapSurface(static_cast<D3DCUBEMAP_FACES>(f), i, &source);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ texture->Release();
+
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ IDirect3DSurface9 *dest;
+ result = texture->GetCubeMapSurface(static_cast<D3DCUBEMAP_FACES>(f), i, &dest);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ texture->Release();
+ source->Release();
+
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+
+ display->endScene();
+ result = device->StretchRect(source, NULL, dest, NULL, D3DTEXF_NONE);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+
+ texture->Release();
+ source->Release();
+ dest->Release();
+
+ return error(GL_OUT_OF_MEMORY, (IDirect3DBaseTexture9*)NULL);
+ }
+ }
+ }
+ }
+ }
+
+ if (mTexture != NULL)
+ {
+ mTexture->Release();
+ }
+
+ mTexture = texture;
+ return mTexture;
+}
+
+void TextureCubeMap::setImage(int face, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+{
+ redefineTexture(level, internalFormat, width);
+
+ Texture::setImage(width, height, format, type, unpackAlignment, pixels, &mImageArray[face][level]);
+}
+
+unsigned int TextureCubeMap::faceIndex(GLenum face)
+{
+ META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1);
+ META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2);
+ META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 3);
+ META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4);
+ META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5);
+
+ return face - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+}
+
+bool TextureCubeMap::dirtyImageData() const
+{
+ int q = log2(mWidth);
+
+ for (int f = 0; f < 6; f++)
+ {
+ for (int i = 0; i <= q; i++)
+ {
+ if (mImageArray[f][i].dirty) return true;
+ }
+ }
+
+ return false;
+}
+
+// While OpenGL doesn't check texture consistency until draw-time, D3D9 requires a complete texture
+// for render-to-texture (such as CopyTexImage). We have no way of keeping individual inconsistent levels & faces.
+// Call this when a particular level of the texture must be defined with a specific format, width and height.
+//
+// Returns true if the existing texture was unsuitable had to be destroyed. If so, it will also set
+// a new size for the texture by working backwards from the given size.
+bool TextureCubeMap::redefineTexture(GLint level, GLenum internalFormat, GLsizei width)
+{
+ // Are these settings compatible with level 0?
+ bool sizeOkay = (mImageArray[0][0].width >> level == width);
+
+ bool textureOkay = (sizeOkay && internalFormat == mImageArray[0][0].format);
+
+ if (!textureOkay)
+ {
+ TRACE("Redefining cube texture (%d, 0x%04X, %d => 0x%04X, %d).", level,
+ mImageArray[0][0].format, mImageArray[0][0].width,
+ internalFormat, width);
+
+ // Purge all the levels and the texture.
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ for (int f = 0; f < 6; f++)
+ {
+ if (mImageArray[f][i].surface != NULL)
+ {
+ mImageArray[f][i].dirty = false;
+
+ mImageArray[f][i].surface->Release();
+ mImageArray[f][i].surface = NULL;
+ }
+ }
+ }
+
+ if (mTexture != NULL)
+ {
+ mTexture->Release();
+ mTexture = NULL;
+ dropTexture();
+ }
+
+ mWidth = width << level;
+ mImageArray[0][0].width = width << level;
+ mHeight = width << level;
+ mImageArray[0][0].height = width << level;
+
+ mImageArray[0][0].format = internalFormat;
+ }
+
+ return !textureOkay;
+}
+
+void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source)
+{
+ IDirect3DSurface9 *renderTarget = source->getRenderTarget();
+
+ if (!renderTarget)
+ {
+ ERR("Failed to retrieve the render target.");
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ unsigned int faceindex = faceIndex(target);
+ bool redefined = redefineTexture(level, internalFormat, width);
+
+ if (!isRenderableFormat())
+ {
+ copyNonRenderable(&mImageArray[faceindex][level], internalFormat, 0, 0, x, y, width, height, renderTarget);
+ }
+ else
+ {
+ if (redefined)
+ {
+ convertToRenderTarget();
+ pushTexture(mTexture, true);
+ }
+ else
+ {
+ needRenderTarget();
+ }
+
+ ASSERT(width == height);
+
+ if (width > 0 && level < levelCount())
+ {
+ RECT sourceRect;
+ sourceRect.left = x;
+ sourceRect.right = x + width;
+ sourceRect.top = y;
+ sourceRect.bottom = y + height;
+
+ IDirect3DSurface9 *dest = getCubeMapSurface(target, level);
+
+ getBlitter()->formatConvert(source->getRenderTarget(), sourceRect, internalFormat, 0, 0, dest);
+ dest->Release();
+ }
+ }
+
+ mImageArray[faceindex][level].width = width;
+ mImageArray[faceindex][level].height = height;
+ mImageArray[faceindex][level].format = internalFormat;
+}
+
+IDirect3DSurface9 *TextureCubeMap::getCubeMapSurface(unsigned int faceIdentifier, unsigned int level)
+{
+ unsigned int faceIndex;
+
+ if (faceIdentifier < 6)
+ {
+ faceIndex = faceIdentifier;
+ }
+ else if (faceIdentifier >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && faceIdentifier <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)
+ {
+ faceIndex = faceIdentifier - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ }
+ else
+ {
+ UNREACHABLE();
+ faceIndex = 0;
+ }
+
+ if (mTexture == NULL)
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+
+ IDirect3DSurface9 *surface = NULL;
+
+ HRESULT hr = mTexture->GetCubeMapSurface(static_cast<D3DCUBEMAP_FACES>(faceIndex), level, &surface);
+
+ return (SUCCEEDED(hr)) ? surface : NULL;
+}
+
+void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source)
+{
+ GLsizei size = mImageArray[faceIndex(target)][level].width;
+
+ if (xoffset + width > size || yoffset + height > size)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ IDirect3DSurface9 *renderTarget = source->getRenderTarget();
+
+ if (!renderTarget)
+ {
+ ERR("Failed to retrieve the render target.");
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ unsigned int faceindex = faceIndex(target);
+ bool redefined = redefineTexture(0, mImageArray[0][0].format, mImageArray[0][0].width);
+
+ if (!isRenderableFormat())
+ {
+ copyNonRenderable(&mImageArray[faceindex][level], getFormat(), 0, 0, x, y, width, height, renderTarget);
+ }
+ else
+ {
+ if (redefined)
+ {
+ convertToRenderTarget();
+ pushTexture(mTexture, true);
+ }
+ else
+ {
+ needRenderTarget();
+ }
+
+ if (level < levelCount())
+ {
+ RECT sourceRect;
+ sourceRect.left = x;
+ sourceRect.right = x + width;
+ sourceRect.top = y;
+ sourceRect.bottom = y + height;
+
+ IDirect3DSurface9 *dest = getCubeMapSurface(target, level);
+
+ getBlitter()->formatConvert(source->getRenderTarget(), sourceRect, mImageArray[0][0].format, xoffset, yoffset, dest);
+ dest->Release();
+ }
+ }
+}
+
+bool TextureCubeMap::isCubeComplete() const
+{
+ if (mImageArray[0][0].width == 0)
+ {
+ return false;
+ }
+
+ for (unsigned int f = 1; f < 6; f++)
+ {
+ if (mImageArray[f][0].width != mImageArray[0][0].width
+ || mImageArray[f][0].format != mImageArray[0][0].format)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void TextureCubeMap::generateMipmaps()
+{
+ if (!isPow2(mImageArray[0][0].width) || !isCubeComplete())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+ unsigned int q = log2(mImageArray[0][0].width);
+ for (unsigned int f = 0; f < 6; f++)
+ {
+ for (unsigned int i = 1; i <= q; i++)
+ {
+ if (mImageArray[f][i].surface != NULL)
+ {
+ mImageArray[f][i].surface->Release();
+ mImageArray[f][i].surface = NULL;
+ }
+
+ mImageArray[f][i].dirty = false;
+
+ mImageArray[f][i].format = mImageArray[f][0].format;
+ mImageArray[f][i].width = std::max(mImageArray[f][0].width >> i, 1);
+ mImageArray[f][i].height = mImageArray[f][i].width;
+ }
+ }
+
+ if (isRenderable())
+ {
+ if (mTexture == NULL)
+ {
+ return;
+ }
+
+ for (unsigned int f = 0; f < 6; f++)
+ {
+ for (unsigned int i = 1; i <= q; i++)
+ {
+ IDirect3DSurface9 *upper = getCubeMapSurface(f, i-1);
+ IDirect3DSurface9 *lower = getCubeMapSurface(f, i);
+
+ if (upper != NULL && lower != NULL)
+ {
+ getBlitter()->boxFilter(upper, lower);
+ }
+
+ if (upper != NULL) upper->Release();
+ if (lower != NULL) lower->Release();
+ }
+ }
+ }
+ else
+ {
+ for (unsigned int f = 0; f < 6; f++)
+ {
+ for (unsigned int i = 1; i <= q; i++)
+ {
+ createSurface(mImageArray[f][i].width, mImageArray[f][i].height, mImageArray[f][i].format, mType, &mImageArray[f][i]);
+ if (mImageArray[f][i].surface == NULL)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+
+ if (FAILED(D3DXLoadSurfaceFromSurface(mImageArray[f][i].surface, NULL, NULL, mImageArray[f][i - 1].surface, NULL, NULL, D3DX_FILTER_BOX, 0)))
+ {
+ ERR(" failed to load filter %d to %d.", i - 1, i);
+ }
+
+ mImageArray[f][i].dirty = true;
+ }
+ }
+
+ mDirtyMetaData = true;
+ }
+}
+
+Renderbuffer *TextureCubeMap::getColorbuffer(GLenum target)
+{
+ if (!IsCubemapTextureTarget(target))
+ {
+ return error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
+ }
+
+ unsigned int face = faceIndex(target);
+
+ if (mFaceProxies[face].get() == NULL)
+ {
+ mFaceProxies[face].set(new Renderbuffer(id(), new TextureColorbufferProxy(this, target)));
+ }
+
+ return mFaceProxies[face].get();
+}
+
+IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
+{
+ ASSERT(IsCubemapTextureTarget(target));
+
+ needRenderTarget();
+
+ if (mTexture == NULL)
+ {
+ return NULL;
+ }
+
+ IDirect3DSurface9 *renderTarget = NULL;
+ mTexture->GetCubeMapSurface(static_cast<D3DCUBEMAP_FACES>(faceIndex(target)), 0, &renderTarget);
+
+ return renderTarget;
+}
+
+Texture::TextureColorbufferProxy::TextureColorbufferProxy(Texture *texture, GLenum target)
+ : Colorbuffer(texture), mTexture(texture), mTarget(target)
+{
+ ASSERT(IsTextureTarget(target));
+}
+
+void Texture::TextureColorbufferProxy::addRef() const
+{
+ mTexture->addRef();
+}
+
+void Texture::TextureColorbufferProxy::release() const
+{
+ mTexture->release();
+}
+
+IDirect3DSurface9 *Texture::TextureColorbufferProxy::getRenderTarget()
+{
+ if (mRenderTarget) mRenderTarget->Release();
+
+ mRenderTarget = mTexture->getRenderTarget(mTarget);
+
+ return mRenderTarget;
+}
+
+int Texture::TextureColorbufferProxy::getWidth() const
+{
+ return mTexture->getWidth();
+}
+
+int Texture::TextureColorbufferProxy::getHeight() const
+{
+ return mTexture->getHeight();
+}
+
+GLenum Texture::TextureColorbufferProxy::getFormat() const
+{
+ return mTexture->getFormat();
+}
+
+bool Texture::TextureColorbufferProxy::isFloatingPoint() const
+{
+ return mTexture->isFloatingPoint();
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h
new file mode 100644
index 0000000..ca7aec7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h
@@ -0,0 +1,315 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Texture.h: Defines the abstract gl::Texture class and its concrete derived
+// classes Texture2D and TextureCubeMap. Implements GL texture objects and
+// related functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
+
+#ifndef LIBGLESV2_TEXTURE_H_
+#define LIBGLESV2_TEXTURE_H_
+
+#include <vector>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <d3d9.h>
+
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/RefCountObject.h"
+#include "libGLESv2/utilities.h"
+#include "common/debug.h"
+
+namespace gl
+{
+class Blit;
+
+enum
+{
+ // These are the maximums the implementation can support
+ // The actual GL caps are limited by the device caps
+ // and should be queried from the Context
+ IMPLEMENTATION_MAX_TEXTURE_SIZE = 16384,
+ IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
+
+ IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15 // 1+log2 of MAX_TEXTURE_SIZE
+};
+
+class Texture : public RefCountObject
+{
+ public:
+ explicit Texture(GLuint id);
+
+ virtual ~Texture();
+
+ virtual GLenum getTarget() const = 0;
+
+ bool setMinFilter(GLenum filter);
+ bool setMagFilter(GLenum filter);
+ bool setWrapS(GLenum wrap);
+ bool setWrapT(GLenum wrap);
+
+ GLenum getMinFilter() const;
+ GLenum getMagFilter() const;
+ GLenum getWrapS() const;
+ GLenum getWrapT() const;
+
+ GLuint getWidth() const;
+ GLuint getHeight() const;
+
+ virtual GLenum getFormat() const = 0;
+ virtual bool isComplete() const = 0;
+ virtual bool isCompressed() const = 0;
+ bool isFloatingPoint() const;
+ bool isRenderableFormat() const;
+
+ D3DFORMAT getD3DFormat() const;
+ IDirect3DBaseTexture9 *getTexture();
+ virtual Renderbuffer *getColorbuffer(GLenum target) = 0;
+
+ virtual void generateMipmaps() = 0;
+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source) = 0;
+
+ bool isDirty() const;
+
+ static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
+
+ protected:
+ class TextureColorbufferProxy;
+ friend class TextureColorbufferProxy;
+ class TextureColorbufferProxy : public Colorbuffer
+ {
+ public:
+ TextureColorbufferProxy(Texture *texture, GLenum target);
+ // target is a 2D-like texture target (GL_TEXTURE_2D or one of the cube face targets)
+
+ virtual void addRef() const;
+ virtual void release() const;
+
+ virtual IDirect3DSurface9 *getRenderTarget();
+
+ virtual int getWidth() const;
+ virtual int getHeight() const;
+ virtual GLenum getFormat() const;
+ virtual bool isFloatingPoint() const;
+
+ private:
+ Texture *mTexture;
+ GLenum mTarget;
+ };
+
+ // Helper structure representing a single image layer
+ struct Image
+ {
+ Image();
+ ~Image();
+
+ GLsizei width;
+ GLsizei height;
+ GLenum format;
+
+ bool dirty;
+
+ IDirect3DSurface9 *surface;
+ };
+
+ static D3DFORMAT selectFormat(GLenum format, GLenum type);
+
+ void setImage(GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *img);
+ bool subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *img);
+ void setCompressedImage(GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *img);
+ bool subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *img);
+ void copyNonRenderable(Image *image, GLenum internalFormat, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, IDirect3DSurface9 *renderTarget);
+
+ void needRenderTarget();
+
+ GLint creationLevels(GLsizei width, GLsizei height, GLint maxlevel) const;
+ GLint creationLevels(GLsizei size, GLint maxlevel) const;
+
+ // The pointer returned is weak and it is assumed the derived class will keep a strong pointer until the next createTexture() call.
+ virtual IDirect3DBaseTexture9 *createTexture() = 0;
+ virtual void updateTexture() = 0;
+ virtual IDirect3DBaseTexture9 *convertToRenderTarget() = 0;
+ virtual IDirect3DSurface9 *getRenderTarget(GLenum target) = 0;
+
+ virtual bool dirtyImageData() const = 0;
+
+ void dropTexture();
+ void pushTexture(IDirect3DBaseTexture9 *newTexture, bool renderable);
+ void createSurface(GLsizei width, GLsizei height, GLenum format, GLenum type, Image *img);
+
+ Blit *getBlitter();
+
+ int levelCount() const;
+
+ bool isRenderable() const;
+
+ unsigned int mWidth;
+ unsigned int mHeight;
+ GLenum mMinFilter;
+ GLenum mMagFilter;
+ GLenum mWrapS;
+ GLenum mWrapT;
+ GLenum mType;
+
+ bool mDirtyMetaData;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Texture);
+
+ void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
+ GLint unpackAlignment, const void *input, std::size_t outputPitch, void *output, D3DSURFACE_DESC *description) const;
+
+ void loadAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadLuminanceImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const;
+ void loadLuminanceFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadLuminanceHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadLuminanceAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output, bool native) const;
+ void loadLuminanceAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadLuminanceAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGB565ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBAUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBA4444ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBA5551ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBAFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadRGBAHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+ void loadBGRAImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ size_t inputPitch, const void *input, size_t outputPitch, void *output) const;
+
+ IDirect3DBaseTexture9 *mBaseTexture; // This is a weak pointer. The derived class is assumed to own a strong pointer.
+
+ bool mDirty;
+ bool mIsRenderable;
+};
+
+class Texture2D : public Texture
+{
+ public:
+ explicit Texture2D(GLuint id);
+
+ ~Texture2D();
+
+ GLenum getTarget() const;
+ GLenum getFormat() const;
+
+ void setImage(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setCompressedImage(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
+ void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
+ void copyImage(GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source);
+ void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source);
+
+ bool isComplete() const;
+ bool isCompressed() const;
+
+ virtual void generateMipmaps();
+
+ virtual Renderbuffer *getColorbuffer(GLenum target);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Texture2D);
+
+ virtual IDirect3DBaseTexture9 *createTexture();
+ virtual void updateTexture();
+ virtual IDirect3DBaseTexture9 *convertToRenderTarget();
+ virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
+
+ virtual bool dirtyImageData() const;
+
+ bool redefineTexture(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum type);
+ void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+
+ Image mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ IDirect3DTexture9 *mTexture;
+
+ BindingPointer<Renderbuffer> mColorbufferProxy;
+};
+
+class TextureCubeMap : public Texture
+{
+ public:
+ explicit TextureCubeMap(GLuint id);
+
+ ~TextureCubeMap();
+
+ GLenum getTarget() const;
+ GLenum getFormat() const;
+
+ void setImagePosX(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImageNegX(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImagePosY(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImageNegY(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImagePosZ(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImageNegZ(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+
+ void setCompressedImage(GLenum face, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
+
+ void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
+ void copyImage(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source);
+ void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, RenderbufferStorage *source);
+
+ bool isComplete() const;
+ bool isCompressed() const;
+
+ virtual void generateMipmaps();
+
+ virtual Renderbuffer *getColorbuffer(GLenum target);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
+
+ virtual IDirect3DBaseTexture9 *createTexture();
+ virtual void updateTexture();
+ virtual IDirect3DBaseTexture9 *convertToRenderTarget();
+ virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
+
+ virtual bool dirtyImageData() const;
+
+ // faceIdentifier is 0-5 or one of the GL_TEXTURE_CUBE_MAP_* enumerants.
+ // Returns NULL if the call underlying Direct3D call fails.
+ IDirect3DSurface9 *getCubeMapSurface(unsigned int faceIdentifier, unsigned int level);
+
+ static unsigned int faceIndex(GLenum face);
+
+ bool isCubeComplete() const;
+
+ void setImage(int face, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void commitRect(GLenum faceTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ bool redefineTexture(GLint level, GLenum internalFormat, GLsizei width);
+
+ Image mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ IDirect3DCubeTexture9 *mTexture;
+
+ BindingPointer<Renderbuffer> mFaceProxies[6];
+};
+}
+
+#endif // LIBGLESV2_TEXTURE_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.cpp
new file mode 100644
index 0000000..f79d606
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.cpp
@@ -0,0 +1,382 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// geometry/IndexDataManager.cpp: Defines the IndexDataManager, a class that
+// runs the Buffer translation process for index buffers.
+
+#include "libGLESv2/geometry/IndexDataManager.h"
+
+#include "common/debug.h"
+
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/mathutil.h"
+#include "libGLESv2/main.h"
+
+namespace
+{
+ enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
+}
+
+namespace gl
+{
+
+IndexDataManager::IndexDataManager(Context *context, IDirect3DDevice9 *device) : mDevice(device)
+{
+ mStreamingBufferShort = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
+
+ if (context->supports32bitIndices())
+ {
+ mStreamingBufferInt = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
+ }
+ else
+ {
+ mStreamingBufferInt = NULL;
+ }
+}
+
+IndexDataManager::~IndexDataManager()
+{
+ delete mStreamingBufferShort;
+ delete mStreamingBufferInt;
+}
+
+void convertIndices(GLenum type, const void *input, GLsizei count, void *output)
+{
+ if (type == GL_UNSIGNED_BYTE)
+ {
+ const GLubyte *in = static_cast<const GLubyte*>(input);
+ GLushort *out = static_cast<GLushort*>(output);
+
+ for (GLsizei i = 0; i < count; i++)
+ {
+ out[i] = in[i];
+ }
+ }
+ else if (type == GL_UNSIGNED_INT)
+ {
+ memcpy(output, input, count * sizeof(GLuint));
+ }
+ else if (type == GL_UNSIGNED_SHORT)
+ {
+ memcpy(output, input, count * sizeof(GLushort));
+ }
+ else UNREACHABLE();
+}
+
+template <class IndexType>
+void computeRange(const IndexType *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex)
+{
+ *minIndex = indices[0];
+ *maxIndex = indices[0];
+
+ for (GLsizei i = 0; i < count; i++)
+ {
+ if (*minIndex > indices[i]) *minIndex = indices[i];
+ if (*maxIndex < indices[i]) *maxIndex = indices[i];
+ }
+}
+
+void computeRange(GLenum type, const void *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex)
+{
+ if (type == GL_UNSIGNED_BYTE)
+ {
+ computeRange(static_cast<const GLubyte*>(indices), count, minIndex, maxIndex);
+ }
+ else if (type == GL_UNSIGNED_INT)
+ {
+ computeRange(static_cast<const GLuint*>(indices), count, minIndex, maxIndex);
+ }
+ else if (type == GL_UNSIGNED_SHORT)
+ {
+ computeRange(static_cast<const GLushort*>(indices), count, minIndex, maxIndex);
+ }
+ else UNREACHABLE();
+}
+
+GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *buffer, const void *indices, TranslatedIndexData *translated)
+{
+ D3DFORMAT format = (type == GL_UNSIGNED_INT) ? D3DFMT_INDEX32 : D3DFMT_INDEX16;
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
+ bool alignedOffset = false;
+
+ if (buffer != NULL)
+ {
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE: alignedOffset = (offset % sizeof(GLubyte) == 0); break;
+ case GL_UNSIGNED_SHORT: alignedOffset = (offset % sizeof(GLushort) == 0); break;
+ case GL_UNSIGNED_INT: alignedOffset = (offset % sizeof(GLuint) == 0); break;
+ default: UNREACHABLE(); alignedOffset = false;
+ }
+
+ if (typeSize(type) * count + offset > static_cast<std::size_t>(buffer->size()))
+ {
+ return GL_INVALID_OPERATION;
+ }
+
+ indices = static_cast<const GLubyte*>(buffer->data()) + offset;
+ }
+
+ StreamingIndexBuffer *streamingBuffer = (type == GL_UNSIGNED_INT) ? mStreamingBufferInt : mStreamingBufferShort;
+
+ StaticIndexBuffer *staticBuffer = buffer ? buffer->getIndexBuffer() : NULL;
+ IndexBuffer *indexBuffer = streamingBuffer;
+ UINT streamOffset = 0;
+
+ if (staticBuffer && staticBuffer->lookupType(type) && alignedOffset)
+ {
+ indexBuffer = staticBuffer;
+ streamOffset = staticBuffer->lookupRange(offset, count, &translated->minIndex, &translated->maxIndex);
+
+ if (streamOffset == -1)
+ {
+ streamOffset = (offset / typeSize(type)) * indexSize(format);
+ computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex);
+ staticBuffer->addRange(offset, count, translated->minIndex, translated->maxIndex, streamOffset);
+ }
+ }
+ else
+ {
+ int convertCount = count;
+
+ if (staticBuffer)
+ {
+ if (staticBuffer->size() == 0 && alignedOffset)
+ {
+ indexBuffer = staticBuffer;
+ convertCount = buffer->size() / typeSize(type);
+ }
+ else
+ {
+ buffer->invalidateStaticData();
+ staticBuffer = NULL;
+ }
+ }
+
+ void *output = NULL;
+
+ if (indexBuffer)
+ {
+ indexBuffer->reserveSpace(convertCount * indexSize(format), type);
+ output = indexBuffer->map(indexSize(format) * convertCount, &streamOffset);
+ }
+
+ if (output == NULL)
+ {
+ ERR("Failed to map index buffer.");
+ return GL_OUT_OF_MEMORY;
+ }
+
+ convertIndices(type, staticBuffer ? buffer->data() : indices, convertCount, output);
+ indexBuffer->unmap();
+
+ computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex);
+
+ if (staticBuffer)
+ {
+ streamOffset = (offset / typeSize(type)) * indexSize(format);
+ staticBuffer->addRange(offset, count, translated->minIndex, translated->maxIndex, streamOffset);
+ }
+ }
+
+ translated->indexBuffer = indexBuffer->getBuffer();
+ translated->startIndex = streamOffset / indexSize(format);
+
+ return GL_NO_ERROR;
+}
+
+std::size_t IndexDataManager::indexSize(D3DFORMAT format) const
+{
+ return (format == D3DFMT_INDEX32) ? sizeof(unsigned int) : sizeof(unsigned short);
+}
+
+std::size_t IndexDataManager::typeSize(GLenum type) const
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT: return sizeof(GLuint);
+ case GL_UNSIGNED_SHORT: return sizeof(GLushort);
+ case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
+ default: UNREACHABLE(); return sizeof(GLushort);
+ }
+}
+
+IndexBuffer::IndexBuffer(IDirect3DDevice9 *device, UINT size, D3DFORMAT format) : mDevice(device), mBufferSize(size), mIndexBuffer(NULL)
+{
+ if (size > 0)
+ {
+ D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY);
+ HRESULT result = device->CreateIndexBuffer(size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, format, pool, &mIndexBuffer, NULL);
+
+ if (FAILED(result))
+ {
+ ERR("Out of memory allocating an index buffer of size %lu.", size);
+ }
+ }
+}
+
+IndexBuffer::~IndexBuffer()
+{
+ if (mIndexBuffer)
+ {
+ mIndexBuffer->Release();
+ }
+}
+
+IDirect3DIndexBuffer9 *IndexBuffer::getBuffer() const
+{
+ return mIndexBuffer;
+}
+
+void IndexBuffer::unmap()
+{
+ if (mIndexBuffer)
+ {
+ mIndexBuffer->Unlock();
+ }
+}
+
+StreamingIndexBuffer::StreamingIndexBuffer(IDirect3DDevice9 *device, UINT initialSize, D3DFORMAT format) : IndexBuffer(device, initialSize, format)
+{
+ mWritePosition = 0;
+}
+
+StreamingIndexBuffer::~StreamingIndexBuffer()
+{
+}
+
+void *StreamingIndexBuffer::map(UINT requiredSpace, UINT *offset)
+{
+ void *mapPtr = NULL;
+
+ if (mIndexBuffer)
+ {
+ HRESULT result = mIndexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, D3DLOCK_NOOVERWRITE);
+
+ if (FAILED(result))
+ {
+ ERR(" Lock failed with error 0x%08x", result);
+ return NULL;
+ }
+
+ *offset = mWritePosition;
+ mWritePosition += requiredSpace;
+ }
+
+ return mapPtr;
+}
+
+void StreamingIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type)
+{
+ if (requiredSpace > mBufferSize)
+ {
+ if (mIndexBuffer)
+ {
+ mIndexBuffer->Release();
+ mIndexBuffer = NULL;
+ }
+
+ mBufferSize = std::max(requiredSpace, 2 * mBufferSize);
+
+ D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY);
+ HRESULT result = mDevice->CreateIndexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, pool, &mIndexBuffer, NULL);
+
+ if (FAILED(result))
+ {
+ ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
+ }
+
+ mWritePosition = 0;
+ }
+ else if (mWritePosition + requiredSpace > mBufferSize) // Recycle
+ {
+ void *dummy;
+ mIndexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
+ mIndexBuffer->Unlock();
+
+ mWritePosition = 0;
+ }
+}
+
+StaticIndexBuffer::StaticIndexBuffer(IDirect3DDevice9 *device) : IndexBuffer(device, 0, D3DFMT_UNKNOWN)
+{
+ mCacheType = GL_NONE;
+}
+
+StaticIndexBuffer::~StaticIndexBuffer()
+{
+}
+
+void *StaticIndexBuffer::map(UINT requiredSpace, UINT *offset)
+{
+ void *mapPtr = NULL;
+
+ if (mIndexBuffer)
+ {
+ HRESULT result = mIndexBuffer->Lock(0, requiredSpace, &mapPtr, 0);
+
+ if (FAILED(result))
+ {
+ ERR(" Lock failed with error 0x%08x", result);
+ return NULL;
+ }
+
+ *offset = 0;
+ }
+
+ return mapPtr;
+}
+
+void StaticIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type)
+{
+ if (!mIndexBuffer && mBufferSize == 0)
+ {
+ D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_WRITEONLY);
+ HRESULT result = mDevice->CreateIndexBuffer(requiredSpace, D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, pool, &mIndexBuffer, NULL);
+
+ if (FAILED(result))
+ {
+ ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
+ }
+
+ mBufferSize = requiredSpace;
+ mCacheType = type;
+ }
+ else if (mIndexBuffer && mBufferSize >= requiredSpace && mCacheType == type)
+ {
+ // Already allocated
+ }
+ else UNREACHABLE(); // Static index buffers can't be resized
+}
+
+bool StaticIndexBuffer::lookupType(GLenum type)
+{
+ return mCacheType == type;
+}
+
+UINT StaticIndexBuffer::lookupRange(intptr_t offset, GLsizei count, UINT *minIndex, UINT *maxIndex)
+{
+ for (unsigned int range = 0; range < mCache.size(); range++)
+ {
+ if (mCache[range].offset == offset && mCache[range].count == count)
+ {
+ *minIndex = mCache[range].minIndex;
+ *maxIndex = mCache[range].maxIndex;
+
+ return mCache[range].streamOffset;
+ }
+ }
+
+ return -1;
+}
+
+void StaticIndexBuffer::addRange(intptr_t offset, GLsizei count, UINT minIndex, UINT maxIndex, UINT streamOffset)
+{
+ IndexRange indexRange = {offset, count, minIndex, maxIndex, streamOffset};
+ mCache.push_back(indexRange);
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.h
new file mode 100644
index 0000000..d48249c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/IndexDataManager.h
@@ -0,0 +1,120 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// geometry/IndexDataManager.h: Defines the IndexDataManager, a class that
+// runs the Buffer translation process for index buffers.
+
+#ifndef LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_
+#define LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_
+
+#include <vector>
+#include <cstddef>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include "libGLESv2/Context.h"
+
+namespace gl
+{
+
+struct TranslatedIndexData
+{
+ UINT minIndex;
+ UINT maxIndex;
+ UINT startIndex;
+
+ IDirect3DIndexBuffer9 *indexBuffer;
+};
+
+class IndexBuffer
+{
+ public:
+ IndexBuffer(IDirect3DDevice9 *device, UINT size, D3DFORMAT format);
+ virtual ~IndexBuffer();
+
+ UINT size() const { return mBufferSize; }
+ virtual void *map(UINT requiredSpace, UINT *offset) = 0;
+ void unmap();
+ virtual void reserveSpace(UINT requiredSpace, GLenum type) = 0;
+
+ IDirect3DIndexBuffer9 *getBuffer() const;
+
+ protected:
+ IDirect3DDevice9 *const mDevice;
+
+ IDirect3DIndexBuffer9 *mIndexBuffer;
+ UINT mBufferSize;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(IndexBuffer);
+};
+
+class StreamingIndexBuffer : public IndexBuffer
+{
+ public:
+ StreamingIndexBuffer(IDirect3DDevice9 *device, UINT initialSize, D3DFORMAT format);
+ ~StreamingIndexBuffer();
+
+ void *map(UINT requiredSpace, UINT *offset);
+ void reserveSpace(UINT requiredSpace, GLenum type);
+
+ private:
+ UINT mWritePosition;
+};
+
+class StaticIndexBuffer : public IndexBuffer
+{
+ public:
+ explicit StaticIndexBuffer(IDirect3DDevice9 *device);
+ ~StaticIndexBuffer();
+
+ void *map(UINT requiredSpace, UINT *offset);
+ void reserveSpace(UINT requiredSpace, GLenum type);
+
+ bool lookupType(GLenum type);
+ UINT lookupRange(intptr_t offset, GLsizei count, UINT *minIndex, UINT *maxIndex); // Returns the offset into the index buffer, or -1 if not found
+ void addRange(intptr_t offset, GLsizei count, UINT minIndex, UINT maxIndex, UINT streamOffset);
+
+ private:
+ GLenum mCacheType;
+
+ struct IndexRange
+ {
+ intptr_t offset;
+ GLsizei count;
+
+ UINT minIndex;
+ UINT maxIndex;
+ UINT streamOffset;
+ };
+
+ std::vector<IndexRange> mCache;
+};
+
+class IndexDataManager
+{
+ public:
+ IndexDataManager(Context *context, IDirect3DDevice9 *evice);
+ virtual ~IndexDataManager();
+
+ GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const void *indices, TranslatedIndexData *translated);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(IndexDataManager);
+
+ std::size_t typeSize(GLenum type) const;
+ std::size_t indexSize(D3DFORMAT format) const;
+
+ IDirect3DDevice9 *const mDevice;
+
+ StreamingIndexBuffer *mStreamingBufferShort;
+ StreamingIndexBuffer *mStreamingBufferInt;
+};
+
+}
+
+#endif // LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.cpp
new file mode 100644
index 0000000..99ece17
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.cpp
@@ -0,0 +1,769 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// geometry/VertexDataManager.h: Defines the VertexDataManager, a class that
+// runs the Buffer translation process.
+
+#include "libGLESv2/geometry/VertexDataManager.h"
+
+#include "common/debug.h"
+
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/main.h"
+
+#include "libGLESv2/geometry/vertexconversion.h"
+#include "libGLESv2/geometry/IndexDataManager.h"
+
+namespace
+{
+ enum { INITIAL_STREAM_BUFFER_SIZE = 1024*1024 };
+}
+
+namespace gl
+{
+
+VertexDataManager::VertexDataManager(Context *context, IDirect3DDevice9 *device) : mContext(context), mDevice(device)
+{
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ mDirtyCurrentValue[i] = true;
+ mCurrentValueBuffer[i] = NULL;
+ }
+
+ const D3DCAPS9 &caps = context->getDeviceCaps();
+ checkVertexCaps(caps.DeclTypes);
+
+ mStreamingBuffer = new StreamingVertexBuffer(mDevice, INITIAL_STREAM_BUFFER_SIZE);
+}
+
+VertexDataManager::~VertexDataManager()
+{
+ delete mStreamingBuffer;
+
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ delete mCurrentValueBuffer[i];
+ }
+}
+
+UINT VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
+{
+ Buffer *buffer = attribute.mBoundBuffer.get();
+
+ int inputStride = attribute.stride();
+ int elementSize = attribute.typeSize();
+ const FormatConverter &converter = formatConverter(attribute);
+ UINT streamOffset = 0;
+
+ void *output = NULL;
+
+ if (vertexBuffer)
+ {
+ output = vertexBuffer->map(attribute, spaceRequired(attribute, count), &streamOffset);
+ }
+
+ if (output == NULL)
+ {
+ ERR("Failed to map vertex buffer.");
+ return -1;
+ }
+
+ const char *input = NULL;
+
+ if (buffer)
+ {
+ int offset = attribute.mOffset;
+
+ input = static_cast<const char*>(buffer->data()) + offset;
+ }
+ else
+ {
+ input = static_cast<const char*>(attribute.mPointer);
+ }
+
+ input += inputStride * start;
+
+ if (converter.identity && inputStride == elementSize)
+ {
+ memcpy(output, input, count * inputStride);
+ }
+ else
+ {
+ converter.convertArray(input, inputStride, count, output);
+ }
+
+ vertexBuffer->unmap();
+
+ return streamOffset;
+}
+
+GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *translated)
+{
+ GLenum error = GL_NO_ERROR;
+ const VertexAttributeArray &attribs = mContext->getVertexAttributes();
+ Program *program = mContext->getCurrentProgram();
+
+ for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ translated[attributeIndex].active = (program->getSemanticIndex(attributeIndex) != -1);
+ }
+
+ // Determine the required storage size per used buffer
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ Buffer *buffer = attribs[i].mBoundBuffer.get();
+
+ if (translated[i].active && attribs[i].mArrayEnabled && (buffer || attribs[i].mPointer))
+ {
+ StaticVertexBuffer *staticBuffer = buffer ? buffer->getVertexBuffer() : NULL;
+
+ if (staticBuffer && staticBuffer->size() == 0)
+ {
+ int totalCount = buffer->size() / attribs[i].stride();
+ staticBuffer->addRequiredSpace(spaceRequired(attribs[i], totalCount));
+ }
+ else if (!staticBuffer || staticBuffer->lookupAttribute(attribs[i]) == -1)
+ {
+ if (mStreamingBuffer)
+ {
+ mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
+ }
+ }
+ }
+ }
+
+ // Invalidate static buffers if the attribute formats no longer match
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ Buffer *buffer = attribs[i].mBoundBuffer.get();
+
+ if (translated[i].active && attribs[i].mArrayEnabled && buffer)
+ {
+ StaticVertexBuffer *staticBuffer = buffer->getVertexBuffer();
+
+ if (staticBuffer && staticBuffer->size() != 0)
+ {
+ bool matchingAttributes = true;
+
+ for (int j = 0; j < MAX_VERTEX_ATTRIBS; j++)
+ {
+ if (translated[j].active && attribs[j].mArrayEnabled && attribs[j].mBoundBuffer.get() == buffer)
+ {
+ if (staticBuffer->lookupAttribute(attribs[j]) == -1)
+ {
+ matchingAttributes = false;
+ break;
+ }
+ }
+ }
+
+ if (!matchingAttributes && mStreamingBuffer)
+ {
+ mStreamingBuffer->addRequiredSpaceFor(staticBuffer);
+ buffer->invalidateStaticData();
+ }
+ }
+ }
+ }
+
+ // Reserve the required space per used buffer
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ Buffer *buffer = attribs[i].mBoundBuffer.get();
+
+ if (translated[i].active && attribs[i].mArrayEnabled && (buffer || attribs[i].mPointer))
+ {
+ ArrayVertexBuffer *staticBuffer = buffer ? buffer->getVertexBuffer() : NULL;
+ ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : mStreamingBuffer;
+
+ if (vertexBuffer)
+ {
+ vertexBuffer->reserveRequiredSpace();
+ }
+ }
+ }
+
+ // Perform the vertex data translations
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ if (translated[i].active)
+ {
+ Buffer *buffer = attribs[i].mBoundBuffer.get();
+
+ if (attribs[i].mArrayEnabled)
+ {
+ if (!buffer && attribs[i].mPointer == NULL)
+ {
+ // This is an application error that would normally result in a crash, but we catch it and return an error
+ ERR("An enabled vertex array has no buffer and no pointer.");
+ return GL_INVALID_OPERATION;
+ }
+
+ const FormatConverter &converter = formatConverter(attribs[i]);
+
+ StaticVertexBuffer *staticBuffer = buffer ? buffer->getVertexBuffer() : NULL;
+ ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : static_cast<ArrayVertexBuffer*>(mStreamingBuffer);
+
+ UINT streamOffset = -1;
+
+ if (staticBuffer)
+ {
+ streamOffset = staticBuffer->lookupAttribute(attribs[i]);
+
+ if (streamOffset == -1)
+ {
+ // Convert the entire buffer
+ int totalCount = buffer->size() / attribs[i].stride();
+ int startIndex = attribs[i].mOffset / attribs[i].stride();
+
+ streamOffset = writeAttributeData(staticBuffer, -startIndex, totalCount, attribs[i]);
+ }
+
+ if (streamOffset != -1)
+ {
+ streamOffset += (start + attribs[i].mOffset / attribs[i].stride()) * converter.outputElementSize;
+ }
+ }
+ else
+ {
+ streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]);
+ }
+
+ if (streamOffset == -1)
+ {
+ return GL_OUT_OF_MEMORY;
+ }
+
+ translated[i].vertexBuffer = vertexBuffer->getBuffer();
+ translated[i].type = converter.d3dDeclType;
+ translated[i].stride = converter.outputElementSize;
+ translated[i].offset = streamOffset;
+ }
+ else
+ {
+ if (mDirtyCurrentValue[i])
+ {
+ delete mCurrentValueBuffer[i];
+ mCurrentValueBuffer[i] = new ConstantVertexBuffer(mDevice, attribs[i].mCurrentValue[0], attribs[i].mCurrentValue[1], attribs[i].mCurrentValue[2], attribs[i].mCurrentValue[3]);
+ mDirtyCurrentValue[i] = false;
+ }
+
+ translated[i].vertexBuffer = mCurrentValueBuffer[i]->getBuffer();
+
+ translated[i].type = D3DDECLTYPE_FLOAT4;
+ translated[i].stride = 0;
+ translated[i].offset = 0;
+ }
+ }
+ }
+
+ return GL_NO_ERROR;
+}
+
+std::size_t VertexDataManager::spaceRequired(const VertexAttribute &attrib, std::size_t count) const
+{
+ return formatConverter(attrib).outputElementSize * count;
+}
+
+// Mapping from OpenGL-ES vertex attrib type to D3D decl type:
+//
+// BYTE SHORT (Cast)
+// BYTE-norm FLOAT (Normalize) (can't be exactly represented as SHORT-norm)
+// UNSIGNED_BYTE UBYTE4 (Identity) or SHORT (Cast)
+// UNSIGNED_BYTE-norm UBYTE4N (Identity) or FLOAT (Normalize)
+// SHORT SHORT (Identity)
+// SHORT-norm SHORT-norm (Identity) or FLOAT (Normalize)
+// UNSIGNED_SHORT FLOAT (Cast)
+// UNSIGNED_SHORT-norm USHORT-norm (Identity) or FLOAT (Normalize)
+// FIXED (not in WebGL) FLOAT (FixedToFloat)
+// FLOAT FLOAT (Identity)
+
+// GLToCType maps from GL type (as GLenum) to the C typedef.
+template <GLenum GLType> struct GLToCType { };
+
+template <> struct GLToCType<GL_BYTE> { typedef GLbyte type; };
+template <> struct GLToCType<GL_UNSIGNED_BYTE> { typedef GLubyte type; };
+template <> struct GLToCType<GL_SHORT> { typedef GLshort type; };
+template <> struct GLToCType<GL_UNSIGNED_SHORT> { typedef GLushort type; };
+template <> struct GLToCType<GL_FIXED> { typedef GLuint type; };
+template <> struct GLToCType<GL_FLOAT> { typedef GLfloat type; };
+
+// This differs from D3DDECLTYPE in that it is unsized. (Size expansion is applied last.)
+enum D3DVertexType
+{
+ D3DVT_FLOAT,
+ D3DVT_SHORT,
+ D3DVT_SHORT_NORM,
+ D3DVT_UBYTE,
+ D3DVT_UBYTE_NORM,
+ D3DVT_USHORT_NORM
+};
+
+// D3DToCType maps from D3D vertex type (as enum D3DVertexType) to the corresponding C type.
+template <unsigned int D3DType> struct D3DToCType { };
+
+template <> struct D3DToCType<D3DVT_FLOAT> { typedef float type; };
+template <> struct D3DToCType<D3DVT_SHORT> { typedef short type; };
+template <> struct D3DToCType<D3DVT_SHORT_NORM> { typedef short type; };
+template <> struct D3DToCType<D3DVT_UBYTE> { typedef unsigned char type; };
+template <> struct D3DToCType<D3DVT_UBYTE_NORM> { typedef unsigned char type; };
+template <> struct D3DToCType<D3DVT_USHORT_NORM> { typedef unsigned short type; };
+
+// Encode the type/size combinations that D3D permits. For each type/size it expands to a widener that will provide the appropriate final size.
+template <unsigned int type, int size>
+struct WidenRule
+{
+};
+
+template <int size> struct WidenRule<D3DVT_FLOAT, size> : gl::NoWiden<size> { };
+template <int size> struct WidenRule<D3DVT_SHORT, size> : gl::WidenToEven<size> { };
+template <int size> struct WidenRule<D3DVT_SHORT_NORM, size> : gl::WidenToEven<size> { };
+template <int size> struct WidenRule<D3DVT_UBYTE, size> : gl::WidenToFour<size> { };
+template <int size> struct WidenRule<D3DVT_UBYTE_NORM, size> : gl::WidenToFour<size> { };
+template <int size> struct WidenRule<D3DVT_USHORT_NORM, size> : gl::WidenToEven<size> { };
+
+// VertexTypeFlags encodes the D3DCAPS9::DeclType flag and vertex declaration flag for each D3D vertex type & size combination.
+template <unsigned int d3dtype, int size>
+struct VertexTypeFlags
+{
+};
+
+template <unsigned int capflag, unsigned int declflag>
+struct VertexTypeFlagsHelper
+{
+ enum { capflag = capflag };
+ enum { declflag = declflag };
+};
+
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 1> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT1> { };
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT2> { };
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 3> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT3> { };
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT4> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT2> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT4> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT2N, D3DDECLTYPE_SHORT2N> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT4N, D3DDECLTYPE_SHORT4N> { };
+template <> struct VertexTypeFlags<D3DVT_UBYTE, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4, D3DDECLTYPE_UBYTE4> { };
+template <> struct VertexTypeFlags<D3DVT_UBYTE_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4N, D3DDECLTYPE_UBYTE4N> { };
+template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT2N, D3DDECLTYPE_USHORT2N> { };
+template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT4N, D3DDECLTYPE_USHORT4N> { };
+
+
+// VertexTypeMapping maps GL type & normalized flag to preferred and fallback D3D vertex types (as D3DVertexType enums).
+template <GLenum GLtype, bool normalized>
+struct VertexTypeMapping
+{
+};
+
+template <D3DVertexType Preferred, D3DVertexType Fallback = Preferred>
+struct VertexTypeMappingBase
+{
+ enum { preferred = Preferred };
+ enum { fallback = Fallback };
+};
+
+template <> struct VertexTypeMapping<GL_BYTE, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Cast
+template <> struct VertexTypeMapping<GL_BYTE, true> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Normalize
+template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, false> : VertexTypeMappingBase<D3DVT_UBYTE, D3DVT_FLOAT> { }; // Identity, Cast
+template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, true> : VertexTypeMappingBase<D3DVT_UBYTE_NORM, D3DVT_FLOAT> { }; // Identity, Normalize
+template <> struct VertexTypeMapping<GL_SHORT, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Identity
+template <> struct VertexTypeMapping<GL_SHORT, true> : VertexTypeMappingBase<D3DVT_SHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
+template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, false> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Cast
+template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, true> : VertexTypeMappingBase<D3DVT_USHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
+template <bool normalized> struct VertexTypeMapping<GL_FIXED, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // FixedToFloat
+template <bool normalized> struct VertexTypeMapping<GL_FLOAT, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Identity
+
+
+// Given a GL type & norm flag and a D3D type, ConversionRule provides the type conversion rule (Cast, Normalize, Identity, FixedToFloat).
+// The conversion rules themselves are defined in vertexconversion.h.
+
+// Almost all cases are covered by Cast (including those that are actually Identity since Cast<T,T> knows it's an identity mapping).
+template <GLenum fromType, bool normalized, unsigned int toType>
+struct ConversionRule : gl::Cast<typename GLToCType<fromType>::type, typename D3DToCType<toType>::type>
+{
+};
+
+// All conversions from normalized types to float use the Normalize operator.
+template <GLenum fromType> struct ConversionRule<fromType, true, D3DVT_FLOAT> : gl::Normalize<typename GLToCType<fromType>::type> { };
+
+// Use a full specialisation for this so that it preferentially matches ahead of the generic normalize-to-float rules.
+template <> struct ConversionRule<GL_FIXED, true, D3DVT_FLOAT> : gl::FixedToFloat<GLuint, 16> { };
+template <> struct ConversionRule<GL_FIXED, false, D3DVT_FLOAT> : gl::FixedToFloat<GLuint, 16> { };
+
+// A 2-stage construction is used for DefaultVertexValues because float must use SimpleDefaultValues (i.e. 0/1)
+// whether it is normalized or not.
+template <class T, bool normalized>
+struct DefaultVertexValuesStage2
+{
+};
+
+template <class T> struct DefaultVertexValuesStage2<T, true> : gl::NormalizedDefaultValues<T> { };
+template <class T> struct DefaultVertexValuesStage2<T, false> : gl::SimpleDefaultValues<T> { };
+
+// Work out the default value rule for a D3D type (expressed as the C type) and
+template <class T, bool normalized>
+struct DefaultVertexValues : DefaultVertexValuesStage2<T, normalized>
+{
+};
+
+template <bool normalized> struct DefaultVertexValues<float, normalized> : gl::SimpleDefaultValues<float> { };
+
+// Policy rules for use with Converter, to choose whether to use the preferred or fallback conversion.
+// The fallback conversion produces an output that all D3D9 devices must support.
+template <class T> struct UsePreferred { enum { type = T::preferred }; };
+template <class T> struct UseFallback { enum { type = T::fallback }; };
+
+// Converter ties it all together. Given an OpenGL type/norm/size and choice of preferred/fallback conversion,
+// it provides all the members of the appropriate VertexDataConverter, the D3DCAPS9::DeclTypes flag in cap flag
+// and the D3DDECLTYPE member needed for the vertex declaration in declflag.
+template <GLenum fromType, bool normalized, int size, template <class T> class PreferenceRule>
+struct Converter
+ : gl::VertexDataConverter<typename GLToCType<fromType>::type,
+ WidenRule<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type, size>,
+ ConversionRule<fromType,
+ normalized,
+ PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>,
+ DefaultVertexValues<typename D3DToCType<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>::type, normalized > >
+{
+private:
+ enum { d3dtype = PreferenceRule< VertexTypeMapping<fromType, normalized> >::type };
+ enum { d3dsize = WidenRule<d3dtype, size>::finalWidth };
+
+public:
+ enum { capflag = VertexTypeFlags<d3dtype, d3dsize>::capflag };
+ enum { declflag = VertexTypeFlags<d3dtype, d3dsize>::declflag };
+};
+
+// Initialise a TranslationInfo
+#define TRANSLATION(type, norm, size, preferred) \
+ { \
+ Converter<type, norm, size, preferred>::identity, \
+ Converter<type, norm, size, preferred>::finalSize, \
+ Converter<type, norm, size, preferred>::convertArray, \
+ static_cast<D3DDECLTYPE>(Converter<type, norm, size, preferred>::declflag) \
+ }
+
+#define TRANSLATION_FOR_TYPE_NORM_SIZE(type, norm, size) \
+ { \
+ Converter<type, norm, size, UsePreferred>::capflag, \
+ TRANSLATION(type, norm, size, UsePreferred), \
+ TRANSLATION(type, norm, size, UseFallback) \
+ }
+
+#define TRANSLATIONS_FOR_TYPE(type) \
+ { \
+ { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
+ { TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 4) }, \
+ }
+
+const VertexDataManager::TranslationDescription VertexDataManager::mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] = // [GL types as enumerated by typeIndex()][normalized][size-1]
+{
+ TRANSLATIONS_FOR_TYPE(GL_BYTE),
+ TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_BYTE),
+ TRANSLATIONS_FOR_TYPE(GL_SHORT),
+ TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_SHORT),
+ TRANSLATIONS_FOR_TYPE(GL_FIXED),
+ TRANSLATIONS_FOR_TYPE(GL_FLOAT)
+};
+
+void VertexDataManager::checkVertexCaps(DWORD declTypes)
+{
+ for (unsigned int i = 0; i < NUM_GL_VERTEX_ATTRIB_TYPES; i++)
+ {
+ for (unsigned int j = 0; j < 2; j++)
+ {
+ for (unsigned int k = 0; k < 4; k++)
+ {
+ if (mPossibleTranslations[i][j][k].capsFlag == 0 || (declTypes & mPossibleTranslations[i][j][k].capsFlag) != 0)
+ {
+ mAttributeTypes[i][j][k] = mPossibleTranslations[i][j][k].preferredConversion;
+ }
+ else
+ {
+ mAttributeTypes[i][j][k] = mPossibleTranslations[i][j][k].fallbackConversion;
+ }
+ }
+ }
+ }
+}
+
+// This is used to index mAttributeTypes and mPossibleTranslations.
+unsigned int VertexDataManager::typeIndex(GLenum type) const
+{
+ switch (type)
+ {
+ case GL_BYTE: return 0;
+ case GL_UNSIGNED_BYTE: return 1;
+ case GL_SHORT: return 2;
+ case GL_UNSIGNED_SHORT: return 3;
+ case GL_FIXED: return 4;
+ case GL_FLOAT: return 5;
+
+ default: UNREACHABLE(); return 5;
+ }
+}
+
+void VertexDataManager::setupAttributes(const TranslatedAttribute *attributes)
+{
+ D3DVERTEXELEMENT9 elements[MAX_VERTEX_ATTRIBS];
+ D3DVERTEXELEMENT9 *element = &elements[0];
+
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ if (attributes[i].active)
+ {
+ mDevice->SetStreamSource(i, attributes[i].vertexBuffer, attributes[i].offset, attributes[i].stride);
+
+ element->Stream = i;
+ element->Offset = 0;
+ element->Type = attributes[i].type;
+ element->Method = D3DDECLMETHOD_DEFAULT;
+ element->Usage = D3DDECLUSAGE_TEXCOORD;
+ element->UsageIndex = attributes[i].semanticIndex;
+ element++;
+ }
+ }
+
+ static const D3DVERTEXELEMENT9 end = D3DDECL_END();
+ *element = end;
+
+ IDirect3DVertexDeclaration9 *vertexDeclaration;
+ mDevice->CreateVertexDeclaration(elements, &vertexDeclaration);
+ mDevice->SetVertexDeclaration(vertexDeclaration);
+ vertexDeclaration->Release();
+}
+
+VertexBuffer::VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags) : mDevice(device), mVertexBuffer(NULL)
+{
+ if (size > 0)
+ {
+ D3DPOOL pool = getDisplay()->getBufferPool(usageFlags);
+ HRESULT result = device->CreateVertexBuffer(size, usageFlags, 0, pool, &mVertexBuffer, NULL);
+
+ if (FAILED(result))
+ {
+ ERR("Out of memory allocating a vertex buffer of size %lu.", size);
+ }
+ }
+}
+
+VertexBuffer::~VertexBuffer()
+{
+ if (mVertexBuffer)
+ {
+ mVertexBuffer->Release();
+ }
+}
+
+void VertexBuffer::unmap()
+{
+ if (mVertexBuffer)
+ {
+ mVertexBuffer->Unlock();
+ }
+}
+
+IDirect3DVertexBuffer9 *VertexBuffer::getBuffer() const
+{
+ return mVertexBuffer;
+}
+
+ConstantVertexBuffer::ConstantVertexBuffer(IDirect3DDevice9 *device, float x, float y, float z, float w) : VertexBuffer(device, 4 * sizeof(float), D3DUSAGE_WRITEONLY)
+{
+ void *buffer = NULL;
+
+ if (mVertexBuffer)
+ {
+ HRESULT result = mVertexBuffer->Lock(0, 0, &buffer, 0);
+
+ if (FAILED(result))
+ {
+ ERR("Lock failed with error 0x%08x", result);
+ }
+ }
+
+ if (buffer)
+ {
+ float *vector = (float*)buffer;
+
+ vector[0] = x;
+ vector[1] = y;
+ vector[2] = z;
+ vector[3] = w;
+
+ mVertexBuffer->Unlock();
+ }
+}
+
+ConstantVertexBuffer::~ConstantVertexBuffer()
+{
+}
+
+ArrayVertexBuffer::ArrayVertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags) : VertexBuffer(device, size, usageFlags)
+{
+ mBufferSize = size;
+ mWritePosition = 0;
+ mRequiredSpace = 0;
+}
+
+ArrayVertexBuffer::~ArrayVertexBuffer()
+{
+}
+
+void ArrayVertexBuffer::addRequiredSpace(UINT requiredSpace)
+{
+ mRequiredSpace += requiredSpace;
+}
+
+void ArrayVertexBuffer::addRequiredSpaceFor(ArrayVertexBuffer *buffer)
+{
+ mRequiredSpace += buffer->mRequiredSpace;
+}
+
+StreamingVertexBuffer::StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize) : ArrayVertexBuffer(device, initialSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)
+{
+}
+
+StreamingVertexBuffer::~StreamingVertexBuffer()
+{
+}
+
+void *StreamingVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *offset)
+{
+ void *mapPtr = NULL;
+
+ if (mVertexBuffer)
+ {
+ HRESULT result = mVertexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, D3DLOCK_NOOVERWRITE);
+
+ if (FAILED(result))
+ {
+ ERR("Lock failed with error 0x%08x", result);
+ return NULL;
+ }
+
+ *offset = mWritePosition;
+ mWritePosition += requiredSpace;
+ }
+
+ return mapPtr;
+}
+
+void StreamingVertexBuffer::reserveRequiredSpace()
+{
+ if (mRequiredSpace > mBufferSize)
+ {
+ if (mVertexBuffer)
+ {
+ mVertexBuffer->Release();
+ mVertexBuffer = NULL;
+ }
+
+ mBufferSize = std::max(mRequiredSpace, 3 * mBufferSize / 2); // 1.5 x mBufferSize is arbitrary and should be checked to see we don't have too many reallocations.
+
+ D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY);
+ HRESULT result = mDevice->CreateVertexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, pool, &mVertexBuffer, NULL);
+
+ if (FAILED(result))
+ {
+ ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
+ }
+
+ mWritePosition = 0;
+ }
+ else if (mWritePosition + mRequiredSpace > mBufferSize) // Recycle
+ {
+ if (mVertexBuffer)
+ {
+ void *dummy;
+ mVertexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
+ mVertexBuffer->Unlock();
+ }
+
+ mWritePosition = 0;
+ }
+
+ mRequiredSpace = 0;
+}
+
+StaticVertexBuffer::StaticVertexBuffer(IDirect3DDevice9 *device) : ArrayVertexBuffer(device, 0, D3DUSAGE_WRITEONLY)
+{
+}
+
+StaticVertexBuffer::~StaticVertexBuffer()
+{
+}
+
+void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, UINT *streamOffset)
+{
+ void *mapPtr = NULL;
+
+ if (mVertexBuffer)
+ {
+ HRESULT result = mVertexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, 0);
+
+ if (FAILED(result))
+ {
+ ERR("Lock failed with error 0x%08x", result);
+ return NULL;
+ }
+
+ int attributeOffset = attribute.mOffset % attribute.stride();
+ VertexElement element = {attribute.mType, attribute.mSize, attribute.mNormalized, attributeOffset, mWritePosition};
+ mCache.push_back(element);
+
+ *streamOffset = mWritePosition;
+ mWritePosition += requiredSpace;
+ }
+
+ return mapPtr;
+}
+
+void StaticVertexBuffer::reserveRequiredSpace()
+{
+ if (!mVertexBuffer && mBufferSize == 0)
+ {
+ D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_WRITEONLY);
+ HRESULT result = mDevice->CreateVertexBuffer(mRequiredSpace, D3DUSAGE_WRITEONLY, 0, pool, &mVertexBuffer, NULL);
+
+ if (FAILED(result))
+ {
+ ERR("Out of memory allocating a vertex buffer of size %lu.", mRequiredSpace);
+ }
+
+ mBufferSize = mRequiredSpace;
+ }
+ else if (mVertexBuffer && mBufferSize >= mRequiredSpace)
+ {
+ // Already allocated
+ }
+ else UNREACHABLE(); // Static vertex buffers can't be resized
+
+ mRequiredSpace = 0;
+}
+
+UINT StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
+{
+ for (unsigned int element = 0; element < mCache.size(); element++)
+ {
+ if (mCache[element].type == attribute.mType && mCache[element].size == attribute.mSize && mCache[element].normalized == attribute.mNormalized)
+ {
+ if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
+ {
+ return mCache[element].streamOffset;
+ }
+ }
+ }
+
+ return -1;
+}
+
+const VertexDataManager::FormatConverter &VertexDataManager::formatConverter(const VertexAttribute &attribute) const
+{
+ return mAttributeTypes[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1];
+}
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.h
new file mode 100644
index 0000000..257f2c3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/VertexDataManager.h
@@ -0,0 +1,170 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// geometry/VertexDataManager.h: Defines the VertexDataManager, a class that
+// runs the Buffer translation process.
+
+#ifndef LIBGLESV2_GEOMETRY_VERTEXDATAMANAGER_H_
+#define LIBGLESV2_GEOMETRY_VERTEXDATAMANAGER_H_
+
+#include <vector>
+#include <cstddef>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include "libGLESv2/Context.h"
+
+namespace gl
+{
+
+struct TranslatedAttribute
+{
+ bool active;
+
+ D3DDECLTYPE type;
+ UINT offset;
+ UINT stride; // 0 means not to advance the read pointer at all
+ UINT semanticIndex;
+
+ IDirect3DVertexBuffer9 *vertexBuffer;
+};
+
+class VertexBuffer
+{
+ public:
+ VertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
+ virtual ~VertexBuffer();
+
+ void unmap();
+
+ IDirect3DVertexBuffer9 *getBuffer() const;
+
+ protected:
+ IDirect3DDevice9 *const mDevice;
+ IDirect3DVertexBuffer9 *mVertexBuffer;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VertexBuffer);
+};
+
+class ConstantVertexBuffer : public VertexBuffer
+{
+ public:
+ ConstantVertexBuffer(IDirect3DDevice9 *device, float x, float y, float z, float w);
+ ~ConstantVertexBuffer();
+};
+
+class ArrayVertexBuffer : public VertexBuffer
+{
+ public:
+ ArrayVertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
+ ~ArrayVertexBuffer();
+
+ UINT size() const { return mBufferSize; }
+ virtual void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset) = 0;
+ virtual void reserveRequiredSpace() = 0;
+ void addRequiredSpace(UINT requiredSpace);
+ void addRequiredSpaceFor(ArrayVertexBuffer *buffer);
+
+ protected:
+ UINT mBufferSize;
+ UINT mWritePosition;
+ UINT mRequiredSpace;
+};
+
+class StreamingVertexBuffer : public ArrayVertexBuffer
+{
+ public:
+ StreamingVertexBuffer(IDirect3DDevice9 *device, UINT initialSize);
+ ~StreamingVertexBuffer();
+
+ void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
+ void reserveRequiredSpace();
+};
+
+class StaticVertexBuffer : public ArrayVertexBuffer
+{
+ public:
+ explicit StaticVertexBuffer(IDirect3DDevice9 *device);
+ ~StaticVertexBuffer();
+
+ void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
+ void reserveRequiredSpace();
+
+ UINT lookupAttribute(const VertexAttribute &attribute); // Returns the offset into the vertex buffer, or -1 if not found
+
+ private:
+ struct VertexElement
+ {
+ GLenum type;
+ GLint size;
+ bool normalized;
+ int attributeOffset;
+
+ UINT streamOffset;
+ };
+
+ std::vector<VertexElement> mCache;
+};
+
+class VertexDataManager
+{
+ public:
+ VertexDataManager(Context *context, IDirect3DDevice9 *backend);
+ virtual ~VertexDataManager();
+
+ void dirtyCurrentValue(int index) { mDirtyCurrentValue[index] = true; }
+
+ void setupAttributes(const TranslatedAttribute *attributes);
+ GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
+
+ UINT spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
+ UINT writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
+
+ Context *const mContext;
+ IDirect3DDevice9 *const mDevice;
+
+ StreamingVertexBuffer *mStreamingBuffer;
+
+ bool mDirtyCurrentValue[MAX_VERTEX_ATTRIBS];
+ ConstantVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];
+
+ // Attribute format conversion
+ struct FormatConverter
+ {
+ bool identity;
+ std::size_t outputElementSize;
+ void (*convertArray)(const void *in, std::size_t stride, std::size_t n, void *out);
+ D3DDECLTYPE d3dDeclType;
+ };
+
+ enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
+
+ FormatConverter mAttributeTypes[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
+
+ struct TranslationDescription
+ {
+ DWORD capsFlag;
+ FormatConverter preferredConversion;
+ FormatConverter fallbackConversion;
+ };
+
+ // This table is used to generate mAttributeTypes.
+ static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
+
+ void checkVertexCaps(DWORD declTypes);
+
+ unsigned int typeIndex(GLenum type) const;
+ const FormatConverter &formatConverter(const VertexAttribute &attribute) const;
+};
+
+}
+
+#endif // LIBGLESV2_GEOMETRY_VERTEXDATAMANAGER_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/vertexconversion.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/vertexconversion.h
new file mode 100644
index 0000000..e55dc72
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/geometry/vertexconversion.h
@@ -0,0 +1,208 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// geometry/vertexconversion.h: A library of vertex conversion classes that can be used to build
+// the FormatConverter objects used by the buffer conversion system.
+
+#ifndef LIBGLESV2_GEOMETRY_VERTEXCONVERSION_H_
+#define LIBGLESV2_GEOMETRY_VERTEXCONVERSION_H_
+
+#include <cstddef>
+#include <limits>
+
+#include "libGLESv2/Context.h" // Defines Index
+
+namespace gl
+{
+
+// Conversion types:
+// static const bool identity: true if this is an identity transform, false otherwise
+// static U convert(T): convert a single element from the input type to the output type
+// typedef ... OutputType: the type produced by this conversion
+
+template <class T>
+struct Identity
+{
+ static const bool identity = true;
+
+ typedef T OutputType;
+
+ static T convert(T x)
+ {
+ return x;
+ }
+};
+
+template <class FromT, class ToT>
+struct Cast
+{
+ static const bool identity = false;
+
+ typedef ToT OutputType;
+
+ static ToT convert(FromT x)
+ {
+ return static_cast<ToT>(x);
+ }
+};
+
+template <class T>
+struct Cast<T, T>
+{
+ static const bool identity = true;
+
+ typedef T OutputType;
+
+ static T convert(T x)
+ {
+ return static_cast<T>(x);
+ }
+};
+
+template <class T>
+struct Normalize
+{
+ static const bool identity = false;
+
+ typedef float OutputType;
+
+ static float convert(T x)
+ {
+ typedef std::numeric_limits<T> NL;
+ float f = static_cast<float>(x);
+
+ if (NL::is_signed)
+ {
+ // const float => VC2008 computes it at compile time
+ // static const float => VC2008 computes it the first time we get here, stores it to memory with static guard and all that.
+ const float divisor = 1.0f/(2*static_cast<float>(NL::max())+1);
+ return (2*f+1)*divisor;
+ }
+ else
+ {
+ return f/NL::max();
+ }
+ }
+};
+
+template <class FromType, std::size_t ScaleBits>
+struct FixedToFloat
+{
+ static const bool identity = false;
+
+ typedef float OutputType;
+
+ static float convert(FromType x)
+ {
+ const float divisor = 1.0f / static_cast<float>(static_cast<FromType>(1) << ScaleBits);
+ return static_cast<float>(x) * divisor;
+ }
+};
+
+// Widen types:
+// static const unsigned int initialWidth: number of components before conversion
+// static const unsigned int finalWidth: number of components after conversion
+
+// Float is supported at any size.
+template <std::size_t N>
+struct NoWiden
+{
+ static const std::size_t initialWidth = N;
+ static const std::size_t finalWidth = N;
+};
+
+// SHORT, norm-SHORT, norm-UNSIGNED_SHORT are supported but only with 2 or 4 components
+template <std::size_t N>
+struct WidenToEven
+{
+ static const std::size_t initialWidth = N;
+ static const std::size_t finalWidth = N+(N&1);
+};
+
+template <std::size_t N>
+struct WidenToFour
+{
+ static const std::size_t initialWidth = N;
+ static const std::size_t finalWidth = 4;
+};
+
+// Most types have 0 and 1 that are just that.
+template <class T>
+struct SimpleDefaultValues
+{
+ static T zero() { return static_cast<T>(0); }
+ static T one() { return static_cast<T>(1); }
+};
+
+// But normalised types only store [0,1] or [-1,1] so 1.0 is represented by the max value.
+template <class T>
+struct NormalizedDefaultValues
+{
+ static T zero() { return static_cast<T>(0); }
+ static T one() { return std::numeric_limits<T>::max(); }
+};
+
+// Converter:
+// static const bool identity: true if this is an identity transform (with no widening)
+// static const std::size_t finalSize: number of bytes per output vertex
+// static void convertArray(const void *in, std::size_t stride, std::size_t n, void *out): convert an array of vertices. Input may be strided, but output will be unstrided.
+
+template <class InT, class WidenRule, class Converter, class DefaultValueRule = SimpleDefaultValues<InT> >
+struct VertexDataConverter
+{
+ typedef typename Converter::OutputType OutputType;
+ typedef InT InputType;
+
+ static const bool identity = (WidenRule::initialWidth == WidenRule::finalWidth) && Converter::identity;
+ static const std::size_t finalSize = WidenRule::finalWidth * sizeof(OutputType);
+
+ static void convertArray(const InputType *in, std::size_t stride, std::size_t n, OutputType *out)
+ {
+ for (std::size_t i = 0; i < n; i++)
+ {
+ const InputType *ein = pointerAddBytes(in, i * stride);
+
+ copyComponent(out, ein, 0, static_cast<OutputType>(DefaultValueRule::zero()));
+ copyComponent(out, ein, 1, static_cast<OutputType>(DefaultValueRule::zero()));
+ copyComponent(out, ein, 2, static_cast<OutputType>(DefaultValueRule::zero()));
+ copyComponent(out, ein, 3, static_cast<OutputType>(DefaultValueRule::one()));
+
+ out += WidenRule::finalWidth;
+ }
+ }
+
+ static void convertArray(const void *in, std::size_t stride, std::size_t n, void *out)
+ {
+ return convertArray(static_cast<const InputType*>(in), stride, n, static_cast<OutputType*>(out));
+ }
+
+ private:
+ // Advance the given pointer by a number of bytes (not pointed-to elements).
+ template <class T>
+ static T *pointerAddBytes(T *basePtr, std::size_t numBytes)
+ {
+ return reinterpret_cast<T *>(reinterpret_cast<uintptr_t>(basePtr) + numBytes);
+ }
+
+ static void copyComponent(OutputType *out, const InputType *in, std::size_t elementindex, OutputType defaultvalue)
+ {
+ if (WidenRule::finalWidth > elementindex)
+ {
+ if (WidenRule::initialWidth > elementindex)
+ {
+ out[elementindex] = Converter::convert(in[elementindex]);
+ }
+ else
+ {
+ out[elementindex] = defaultvalue;
+ }
+ }
+ }
+};
+
+}
+
+#endif // LIBGLESV2_GEOMETRY_VERTEXCONVERSION_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp
new file mode 100644
index 0000000..543c0d2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp
@@ -0,0 +1,5765 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions.
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <exception>
+#include <limits>
+
+#include "common/debug.h"
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/mathutil.h"
+#include "libGLESv2/utilities.h"
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/Fence.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/Shader.h"
+#include "libGLESv2/Texture.h"
+
+extern "C"
+{
+
+void __stdcall glActiveTexture(GLenum texture)
+{
+ TRACE("(GLenum texture = 0x%X)", texture);
+
+ try
+ {
+ if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + gl::MAX_TEXTURE_IMAGE_UNITS - 1)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setActiveSampler(texture - GL_TEXTURE0);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glAttachShader(GLuint program, GLuint shader)
+{
+ TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (!shaderObject)
+ {
+ if (context->getProgram(shader))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (!programObject->attachShader(shaderObject))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
+{
+ TRACE("(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)", program, index, name);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (strncmp(name, "gl_", 3) == 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ programObject->bindAttributeLocation(index, name);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindBuffer(GLenum target, GLuint buffer)
+{
+ TRACE("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (target)
+ {
+ case GL_ARRAY_BUFFER:
+ context->bindArrayBuffer(buffer);
+ return;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ context->bindElementArrayBuffer(buffer);
+ return;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+ TRACE("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer);
+
+ try
+ {
+ if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
+ {
+ context->bindReadFramebuffer(framebuffer);
+ }
+
+ if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
+ {
+ context->bindDrawFramebuffer(framebuffer);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+ TRACE("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer);
+
+ try
+ {
+ if (target != GL_RENDERBUFFER)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->bindRenderbuffer(renderbuffer);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindTexture(GLenum target, GLuint texture)
+{
+ TRACE("(GLenum target = 0x%X, GLuint texture = %d)", target, texture);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Texture *textureObject = context->getTexture(texture);
+
+ if (textureObject && textureObject->getTarget() != target && texture != 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ context->bindTexture2D(texture);
+ return;
+ case GL_TEXTURE_CUBE_MAP:
+ context->bindTextureCubeMap(texture);
+ return;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
+ red, green, blue, alpha);
+
+ try
+ {
+ gl::Context* context = gl::getContext();
+
+ if (context)
+ {
+ context->setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBlendEquation(GLenum mode)
+{
+ glBlendEquationSeparate(mode, mode);
+}
+
+void __stdcall glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+ TRACE("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha);
+
+ try
+ {
+ switch (modeRGB)
+ {
+ case GL_FUNC_ADD:
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (modeAlpha)
+ {
+ case GL_FUNC_ADD:
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setBlendEquation(modeRGB, modeAlpha);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+ glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
+}
+
+void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+ TRACE("(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)",
+ srcRGB, dstRGB, srcAlpha, dstAlpha);
+
+ try
+ {
+ switch (srcRGB)
+ {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (dstRGB)
+ {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (srcAlpha)
+ {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (dstAlpha)
+ {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR ||
+ dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR);
+
+ bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA ||
+ dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA);
+
+ if (constantColorUsed && constantAlphaUsed)
+ {
+ ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL");
+ return error(GL_INVALID_OPERATION);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
+{
+ TRACE("(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p, GLenum usage = %d)",
+ target, size, data, usage);
+
+ try
+ {
+ if (size < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (usage)
+ {
+ case GL_STREAM_DRAW:
+ case GL_STATIC_DRAW:
+ case GL_DYNAMIC_DRAW:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Buffer *buffer;
+
+ switch (target)
+ {
+ case GL_ARRAY_BUFFER:
+ buffer = context->getArrayBuffer();
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ buffer = context->getElementArrayBuffer();
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (!buffer)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ buffer->bufferData(data, size, usage);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
+{
+ TRACE("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p)",
+ target, offset, size, data);
+
+ try
+ {
+ if (size < 0 || offset < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (data == NULL)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Buffer *buffer;
+
+ switch (target)
+ {
+ case GL_ARRAY_BUFFER:
+ buffer = context->getArrayBuffer();
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ buffer = context->getElementArrayBuffer();
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (!buffer)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if ((size_t)size + offset > buffer->size())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ buffer->bufferSubData(data, size, offset);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLenum __stdcall glCheckFramebufferStatus(GLenum target)
+{
+ TRACE("(GLenum target = 0x%X)", target);
+
+ try
+ {
+ if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ return error(GL_INVALID_ENUM, 0);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Framebuffer *framebuffer = NULL;
+ if (target == GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ framebuffer = context->getReadFramebuffer();
+ }
+ else
+ {
+ framebuffer = context->getDrawFramebuffer();
+ }
+
+ return framebuffer->completeness();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, 0);
+ }
+
+ return 0;
+}
+
+void __stdcall glClear(GLbitfield mask)
+{
+ TRACE("(GLbitfield mask = %X)", mask);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->clear(mask);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
+ red, green, blue, alpha);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setClearColor(red, green, blue, alpha);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearDepthf(GLclampf depth)
+{
+ TRACE("(GLclampf depth = %f)", depth);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setClearDepth(depth);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearStencil(GLint s)
+{
+ TRACE("(GLint s = %d)", s);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setClearStencil(s);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ TRACE("(GLboolean red = %d, GLboolean green = %d, GLboolean blue = %d, GLboolean alpha = %d)",
+ red, green, blue, alpha);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCompileShader(GLuint shader)
+{
+ TRACE("(GLuint shader = %d)", shader);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ if (context->getProgram(shader))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ shaderObject->compile();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
+ GLint border, GLsizei imageSize, const GLvoid* data)
+{
+ TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
+ target, level, internalformat, width, height, border, imageSize, data);
+
+ try
+ {
+ if (level < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (width < 0 || height < 0 || (level > 0 && !gl::isPow2(width)) || (level > 0 && !gl::isPow2(height)) || border != 0 || imageSize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (internalformat)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (border != 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (level > context->getMaximumTextureLevel())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ if (width > (context->getMaximumTextureDimension() >> level) ||
+ height > (context->getMaximumTextureDimension() >> level))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ if (width != height)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (width > (context->getMaximumCubeTextureDimension() >> level) ||
+ height > (context->getMaximumCubeTextureDimension() >> level))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (!context->supportsCompressedTextures())
+ {
+ return error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
+ }
+
+ if (imageSize != gl::ComputeCompressedSize(width, height, internalformat))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (target == GL_TEXTURE_2D)
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
+ }
+ else
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
+ break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ GLenum format, GLsizei imageSize, const GLvoid* data)
+{
+ TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, "
+ "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
+ target, level, xoffset, yoffset, width, height, format, imageSize, data);
+
+ try
+ {
+ if (!gl::IsTextureTarget(target))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (level < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (xoffset < 0 || yoffset < 0 || width < 0 || height < 0 ||
+ (level > 0 && !gl::isPow2(width)) || (level > 0 && !gl::isPow2(height)) || imageSize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (format)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (width == 0 || height == 0 || data == NULL)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (level > context->getMaximumTextureLevel())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (!context->supportsCompressedTextures())
+ {
+ return error(GL_INVALID_ENUM); // in this case, it's as though the format switch has failed.
+ }
+
+ if (imageSize != gl::ComputeCompressedSize(width, height, format))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (xoffset % 4 != 0 || yoffset % 4 != 0)
+ {
+ return error(GL_INVALID_OPERATION); // we wait to check the offsets until this point, because the multiple-of-four restriction
+ // does not exist unless DXT1 textures are supported.
+ }
+
+ if (target == GL_TEXTURE_2D)
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!texture->isCompressed())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if ((width % 4 != 0 && width != texture->getWidth()) ||
+ (height % 4 != 0 && height != texture->getHeight()))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
+ }
+ else if (gl::IsCubemapTextureTarget(target))
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!texture->isCompressed())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if ((width % 4 != 0 && width != texture->getWidth()) ||
+ (height % 4 != 0 && height != texture->getHeight()))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+ TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, "
+ "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)",
+ target, level, internalformat, x, y, width, height, border);
+
+ try
+ {
+ if (level < 0 || width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (level > 0 && (!gl::isPow2(width) || !gl::isPow2(height)))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (border != 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ if (width > (context->getMaximumTextureDimension() >> level) ||
+ height > (context->getMaximumTextureDimension() >> level))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ if (width != height)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (width > (context->getMaximumCubeTextureDimension() >> level) ||
+ height > (context->getMaximumCubeTextureDimension() >> level))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+
+ if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ }
+
+ if (context->getReadFramebufferHandle() != 0 && framebuffer->getColorbuffer()->getSamples() != 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ gl::Colorbuffer *source = framebuffer->getColorbuffer();
+ GLenum colorbufferFormat = source->getFormat();
+
+ // [OpenGL ES 2.0.24] table 3.9
+ switch (internalformat)
+ {
+ case GL_ALPHA:
+ if (colorbufferFormat != GL_ALPHA &&
+ colorbufferFormat != GL_RGBA &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case GL_LUMINANCE:
+ case GL_RGB:
+ if (colorbufferFormat != GL_RGB &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGBA:
+ if (colorbufferFormat != GL_RGBA &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (context->supportsCompressedTextures())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (target == GL_TEXTURE_2D)
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->copyImage(level, internalformat, x, y, width, height, source);
+ }
+ else if (gl::IsCubemapTextureTarget(target))
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->copyImage(target, level, internalformat, x, y, width, height, source);
+ }
+ else UNREACHABLE();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, level, xoffset, yoffset, x, y, width, height);
+
+ try
+ {
+ if (!gl::IsTextureTarget(target))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (level > context->getMaximumTextureLevel())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+
+ if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ }
+
+ if (context->getReadFramebufferHandle() != 0 && framebuffer->getColorbuffer()->getSamples() != 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ gl::Colorbuffer *source = framebuffer->getColorbuffer();
+ GLenum colorbufferFormat = source->getFormat();
+ gl::Texture *texture = NULL;
+
+ if (target == GL_TEXTURE_2D)
+ {
+ texture = context->getTexture2D();
+ }
+ else if (gl::IsCubemapTextureTarget(target))
+ {
+ texture = context->getTextureCubeMap();
+ }
+ else UNREACHABLE();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ GLenum textureFormat = texture->getFormat();
+
+ // [OpenGL ES 2.0.24] table 3.9
+ switch (textureFormat)
+ {
+ case GL_ALPHA:
+ if (colorbufferFormat != GL_ALPHA &&
+ colorbufferFormat != GL_RGBA &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case GL_LUMINANCE:
+ case GL_RGB:
+ if (colorbufferFormat != GL_RGB &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGBA:
+ if (colorbufferFormat != GL_RGBA &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return error(GL_INVALID_OPERATION);
+ default:
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->copySubImage(target, level, xoffset, yoffset, x, y, width, height, source);
+ }
+ }
+
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLuint __stdcall glCreateProgram(void)
+{
+ TRACE("()");
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ return context->createProgram();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, 0);
+ }
+
+ return 0;
+}
+
+GLuint __stdcall glCreateShader(GLenum type)
+{
+ TRACE("(GLenum type = 0x%X)", type);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (type)
+ {
+ case GL_FRAGMENT_SHADER:
+ case GL_VERTEX_SHADER:
+ return context->createShader(type);
+ default:
+ return error(GL_INVALID_ENUM, 0);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, 0);
+ }
+
+ return 0;
+}
+
+void __stdcall glCullFace(GLenum mode)
+{
+ TRACE("(GLenum mode = 0x%X)", mode);
+
+ try
+ {
+ switch (mode)
+ {
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setCullMode(mode);
+ }
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+ TRACE("(GLsizei n = %d, const GLuint* buffers = 0x%0.8p)", n, buffers);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteBuffer(buffers[i]);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteFencesNV(GLsizei n, const GLuint* fences)
+{
+ TRACE("(GLsizei n = %d, const GLuint* fences = 0x%0.8p)", n, fences);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteFence(fences[i]);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+ TRACE("(GLsizei n = %d, const GLuint* framebuffers = 0x%0.8p)", n, framebuffers);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ if (framebuffers[i] != 0)
+ {
+ context->deleteFramebuffer(framebuffers[i]);
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteProgram(GLuint program)
+{
+ TRACE("(GLuint program = %d)", program);
+
+ try
+ {
+ if (program == 0)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (!context->getProgram(program))
+ {
+ if(context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ context->deleteProgram(program);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+ TRACE("(GLsizei n = %d, const GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteRenderbuffer(renderbuffers[i]);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteShader(GLuint shader)
+{
+ TRACE("(GLuint shader = %d)", shader);
+
+ try
+ {
+ if (shader == 0)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (!context->getShader(shader))
+ {
+ if(context->getProgram(shader))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ context->deleteShader(shader);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteTextures(GLsizei n, const GLuint* textures)
+{
+ TRACE("(GLsizei n = %d, const GLuint* textures = 0x%0.8p)", n, textures);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ if (textures[i] != 0)
+ {
+ context->deleteTexture(textures[i]);
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDepthFunc(GLenum func)
+{
+ TRACE("(GLenum func = 0x%X)", func);
+
+ try
+ {
+ switch (func)
+ {
+ case GL_NEVER:
+ case GL_ALWAYS:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_EQUAL:
+ case GL_GREATER:
+ case GL_GEQUAL:
+ case GL_NOTEQUAL:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setDepthFunc(func);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDepthMask(GLboolean flag)
+{
+ TRACE("(GLboolean flag = %d)", flag);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setDepthMask(flag != GL_FALSE);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+ TRACE("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setDepthRange(zNear, zFar);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDetachShader(GLuint program, GLuint shader)
+{
+ TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+
+ gl::Program *programObject = context->getProgram(program);
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!programObject)
+ {
+ gl::Shader *shaderByProgramHandle;
+ shaderByProgramHandle = context->getShader(program);
+ if (!shaderByProgramHandle)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ else
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+
+ if (!shaderObject)
+ {
+ gl::Program *programByShaderHandle = context->getProgram(shader);
+ if (!programByShaderHandle)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ else
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+
+ if (!programObject->detachShader(shaderObject))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDisable(GLenum cap)
+{
+ TRACE("(GLenum cap = 0x%X)", cap);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (cap)
+ {
+ case GL_CULL_FACE: context->setCullFace(false); break;
+ case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFill(false); break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(false); break;
+ case GL_SAMPLE_COVERAGE: context->setSampleCoverage(false); break;
+ case GL_SCISSOR_TEST: context->setScissorTest(false); break;
+ case GL_STENCIL_TEST: context->setStencilTest(false); break;
+ case GL_DEPTH_TEST: context->setDepthTest(false); break;
+ case GL_BLEND: context->setBlend(false); break;
+ case GL_DITHER: context->setDither(false); break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDisableVertexAttribArray(GLuint index)
+{
+ TRACE("(GLuint index = %d)", index);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setEnableVertexAttribArray(index, false);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+ TRACE("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count);
+
+ try
+ {
+ if (count < 0 || first < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->drawArrays(mode, first, count);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
+{
+ TRACE("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p)",
+ mode, count, type, indices);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT:
+ break;
+ case GL_UNSIGNED_INT:
+ if (!context->supports32bitIndices())
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ context->drawElements(mode, count, type, indices);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glEnable(GLenum cap)
+{
+ TRACE("(GLenum cap = 0x%X)", cap);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (cap)
+ {
+ case GL_CULL_FACE: context->setCullFace(true); break;
+ case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFill(true); break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(true); break;
+ case GL_SAMPLE_COVERAGE: context->setSampleCoverage(true); break;
+ case GL_SCISSOR_TEST: context->setScissorTest(true); break;
+ case GL_STENCIL_TEST: context->setStencilTest(true); break;
+ case GL_DEPTH_TEST: context->setDepthTest(true); break;
+ case GL_BLEND: context->setBlend(true); break;
+ case GL_DITHER: context->setDither(true); break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glEnableVertexAttribArray(GLuint index)
+{
+ TRACE("(GLuint index = %d)", index);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setEnableVertexAttribArray(index, true);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glFinishFenceNV(GLuint fence)
+{
+ TRACE("(GLuint fence = %d)", fence);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Fence* fenceObject = context->getFence(fence);
+
+ if (fenceObject == NULL)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ fenceObject->finishFence();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glFinish(void)
+{
+ TRACE("()");
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->finish();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glFlush(void)
+{
+ TRACE("()");
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->flush();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+ TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, "
+ "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer);
+
+ try
+ {
+ if ((target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ || renderbuffertarget != GL_RENDERBUFFER)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Framebuffer *framebuffer = NULL;
+ GLuint framebufferHandle = 0;
+ if (target == GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ framebuffer = context->getReadFramebuffer();
+ framebufferHandle = context->getReadFramebufferHandle();
+ }
+ else
+ {
+ framebuffer = context->getDrawFramebuffer();
+ framebufferHandle = context->getDrawFramebufferHandle();
+ }
+
+ if (framebufferHandle == 0 || !framebuffer)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (attachment)
+ {
+ case GL_COLOR_ATTACHMENT0:
+ framebuffer->setColorbuffer(GL_RENDERBUFFER, renderbuffer);
+ break;
+ case GL_DEPTH_ATTACHMENT:
+ framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer);
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer);
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+ TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, "
+ "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level);
+
+ try
+ {
+ if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (attachment)
+ {
+ case GL_COLOR_ATTACHMENT0:
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (texture == 0)
+ {
+ textarget = GL_NONE;
+ }
+ else
+ {
+ gl::Texture *tex = context->getTexture(texture);
+
+ if (tex == NULL)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (tex->isCompressed())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (textarget)
+ {
+ case GL_TEXTURE_2D:
+ if (tex->getTarget() != GL_TEXTURE_2D)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (level != 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ gl::Framebuffer *framebuffer = NULL;
+ GLuint framebufferHandle = 0;
+ if (target == GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ framebuffer = context->getReadFramebuffer();
+ framebufferHandle = context->getReadFramebufferHandle();
+ }
+ else
+ {
+ framebuffer = context->getDrawFramebuffer();
+ framebufferHandle = context->getDrawFramebufferHandle();
+ }
+
+ if (framebufferHandle == 0 || !framebuffer)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (attachment)
+ {
+ case GL_COLOR_ATTACHMENT0: framebuffer->setColorbuffer(textarget, texture); break;
+ case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture); break;
+ case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture); break;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glFrontFace(GLenum mode)
+{
+ TRACE("(GLenum mode = 0x%X)", mode);
+
+ try
+ {
+ switch (mode)
+ {
+ case GL_CW:
+ case GL_CCW:
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setFrontFace(mode);
+ }
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenBuffers(GLsizei n, GLuint* buffers)
+{
+ TRACE("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ buffers[i] = context->createBuffer();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenerateMipmap(GLenum target)
+{
+ TRACE("(GLenum target = 0x%X)", target);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Texture *texture;
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ texture = context->getTexture2D();
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ texture = context->getTextureCubeMap();
+ break;
+
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (texture->isCompressed())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->generateMipmaps();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenFencesNV(GLsizei n, GLuint* fences)
+{
+ TRACE("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ fences[i] = context->createFence();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+ TRACE("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ framebuffers[i] = context->createFramebuffer();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+ TRACE("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ renderbuffers[i] = context->createRenderbuffer();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenTextures(GLsizei n, GLuint* textures)
+{
+ TRACE("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures);
+
+ try
+ {
+ if (n < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ textures[i] = context->createTexture();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+ TRACE("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, GLsizei *length = 0x%0.8p, "
+ "GLint *size = 0x%0.8p, GLenum *type = %0.8p, GLchar *name = %0.8p)",
+ program, index, bufsize, length, size, type, name);
+
+ try
+ {
+ if (bufsize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (index >= (GLuint)programObject->getActiveAttributeCount())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ programObject->getActiveAttribute(index, bufsize, length, size, type, name);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
+{
+ TRACE("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, "
+ "GLsizei* length = 0x%0.8p, GLint* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)",
+ program, index, bufsize, length, size, type, name);
+
+ try
+ {
+ if (bufsize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (index >= (GLuint)programObject->getActiveUniformCount())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ programObject->getActiveUniform(index, bufsize, length, size, type, name);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+ TRACE("(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = 0x%0.8p, GLuint* shaders = 0x%0.8p)",
+ program, maxcount, count, shaders);
+
+ try
+ {
+ if (maxcount < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ return programObject->getAttachedShaders(maxcount, count, shaders);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+int __stdcall glGetAttribLocation(GLuint program, const GLchar* name)
+{
+ TRACE("(GLuint program = %d, const GLchar* name = %s)", program, name);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION, -1);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE, -1);
+ }
+ }
+
+ if (!programObject->isLinked())
+ {
+ return error(GL_INVALID_OPERATION, -1);
+ }
+
+ return programObject->getAttributeLocation(name);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, -1);
+ }
+
+ return -1;
+}
+
+void __stdcall glGetBooleanv(GLenum pname, GLboolean* params)
+{
+ TRACE("(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)", pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (!(context->getBooleanv(pname, params)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
+ return error(GL_INVALID_ENUM);
+
+ if (numParams == 0)
+ return; // it is known that the pname is valid, but there are no parameters to return
+
+ if (nativeType == GL_FLOAT)
+ {
+ GLfloat *floatParams = NULL;
+ floatParams = new GLfloat[numParams];
+
+ context->getFloatv(pname, floatParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ if (floatParams[i] == 0.0f)
+ params[i] = GL_FALSE;
+ else
+ params[i] = GL_TRUE;
+ }
+
+ delete [] floatParams;
+ }
+ else if (nativeType == GL_INT)
+ {
+ GLint *intParams = NULL;
+ intParams = new GLint[numParams];
+
+ context->getIntegerv(pname, intParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ if (intParams[i] == 0)
+ params[i] = GL_FALSE;
+ else
+ params[i] = GL_TRUE;
+ }
+
+ delete [] intParams;
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+ TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Buffer *buffer;
+
+ switch (target)
+ {
+ case GL_ARRAY_BUFFER:
+ buffer = context->getArrayBuffer();
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ buffer = context->getElementArrayBuffer();
+ break;
+ default: return error(GL_INVALID_ENUM);
+ }
+
+ if (!buffer)
+ {
+ // A null buffer means that "0" is bound to the requested buffer target
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ *params = buffer->usage();
+ break;
+ case GL_BUFFER_SIZE:
+ *params = buffer->size();
+ break;
+ default: return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLenum __stdcall glGetError(void)
+{
+ TRACE("()");
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ return context->getError();
+ }
+
+ return GL_NO_ERROR;
+}
+
+void __stdcall glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
+{
+ TRACE("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", fence, pname, params);
+
+ try
+ {
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Fence *fenceObject = context->getFence(fence);
+
+ if (fenceObject == NULL)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ fenceObject->getFenceiv(pname, params);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetFloatv(GLenum pname, GLfloat* params)
+{
+ TRACE("(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (!(context->getFloatv(pname, params)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
+ return error(GL_INVALID_ENUM);
+
+ if (numParams == 0)
+ return; // it is known that the pname is valid, but that there are no parameters to return.
+
+ if (nativeType == GL_BOOL)
+ {
+ GLboolean *boolParams = NULL;
+ boolParams = new GLboolean[numParams];
+
+ context->getBooleanv(pname, boolParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ if (boolParams[i] == GL_FALSE)
+ params[i] = 0.0f;
+ else
+ params[i] = 1.0f;
+ }
+
+ delete [] boolParams;
+ }
+ else if (nativeType == GL_INT)
+ {
+ GLint *intParams = NULL;
+ intParams = new GLint[numParams];
+
+ context->getIntegerv(pname, intParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ params[i] = (GLfloat)intParams[i];
+ }
+
+ delete [] intParams;
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+ TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
+ target, attachment, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Framebuffer *framebuffer = NULL;
+ if (target == GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ if(context->getReadFramebufferHandle() == 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ framebuffer = context->getReadFramebuffer();
+ }
+ else
+ {
+ if (context->getDrawFramebufferHandle() == 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ framebuffer = context->getDrawFramebuffer();
+ }
+
+ GLenum attachmentType;
+ GLuint attachmentHandle;
+ switch (attachment)
+ {
+ case GL_COLOR_ATTACHMENT0:
+ attachmentType = framebuffer->getColorbufferType();
+ attachmentHandle = framebuffer->getColorbufferHandle();
+ break;
+ case GL_DEPTH_ATTACHMENT:
+ attachmentType = framebuffer->getDepthbufferType();
+ attachmentHandle = framebuffer->getDepthbufferHandle();
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ attachmentType = framebuffer->getStencilbufferType();
+ attachmentHandle = framebuffer->getStencilbufferHandle();
+ break;
+ default: return error(GL_INVALID_ENUM);
+ }
+
+ GLenum attachmentObjectType; // Type category
+ if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
+ {
+ attachmentObjectType = attachmentType;
+ }
+ else if (gl::IsTextureTarget(attachmentType))
+ {
+ attachmentObjectType = GL_TEXTURE;
+ }
+ else UNREACHABLE();
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObjectType;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE)
+ {
+ *params = attachmentHandle;
+ }
+ else
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ if (attachmentObjectType == GL_TEXTURE)
+ {
+ *params = 0; // FramebufferTexture2D will not allow level to be set to anything else in GL ES 2.0
+ }
+ else
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ if (attachmentObjectType == GL_TEXTURE)
+ {
+ if (gl::IsCubemapTextureTarget(attachmentType))
+ {
+ *params = attachmentType;
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ else
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetIntegerv(GLenum pname, GLint* params)
+{
+ TRACE("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (!(context->getIntegerv(pname, params)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
+ return error(GL_INVALID_ENUM);
+
+ if (numParams == 0)
+ return; // it is known that pname is valid, but there are no parameters to return
+
+ if (nativeType == GL_BOOL)
+ {
+ GLboolean *boolParams = NULL;
+ boolParams = new GLboolean[numParams];
+
+ context->getBooleanv(pname, boolParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ if (boolParams[i] == GL_FALSE)
+ params[i] = 0;
+ else
+ params[i] = 1;
+ }
+
+ delete [] boolParams;
+ }
+ else if (nativeType == GL_FLOAT)
+ {
+ GLfloat *floatParams = NULL;
+ floatParams = new GLfloat[numParams];
+
+ context->getFloatv(pname, floatParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
+ {
+ params[i] = (GLint)(((GLfloat)(0xFFFFFFFF) * floatParams[i] - 1.0f) / 2.0f);
+ }
+ else
+ params[i] = (GLint)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
+ }
+
+ delete [] floatParams;
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+ TRACE("(GLuint program = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", program, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_DELETE_STATUS:
+ *params = programObject->isFlaggedForDeletion();
+ return;
+ case GL_LINK_STATUS:
+ *params = programObject->isLinked();
+ return;
+ case GL_VALIDATE_STATUS:
+ *params = programObject->isValidated();
+ return;
+ case GL_INFO_LOG_LENGTH:
+ *params = programObject->getInfoLogLength();
+ return;
+ case GL_ATTACHED_SHADERS:
+ *params = programObject->getAttachedShadersCount();
+ return;
+ case GL_ACTIVE_ATTRIBUTES:
+ *params = programObject->getActiveAttributeCount();
+ return;
+ case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ *params = programObject->getActiveAttributeMaxLength();
+ return;
+ case GL_ACTIVE_UNIFORMS:
+ *params = programObject->getActiveUniformCount();
+ return;
+ case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+ *params = programObject->getActiveUniformMaxLength();
+ return;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
+{
+ TRACE("(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)",
+ program, bufsize, length, infolog);
+
+ try
+ {
+ if (bufsize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ programObject->getInfoLog(bufsize, length, infolog);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+ TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (target != GL_RENDERBUFFER)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (context->getRenderbufferHandle() == 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());
+
+ switch (pname)
+ {
+ case GL_RENDERBUFFER_WIDTH:
+ *params = renderbuffer->getWidth();
+ break;
+ case GL_RENDERBUFFER_HEIGHT:
+ *params = renderbuffer->getHeight();
+ break;
+ case GL_RENDERBUFFER_INTERNAL_FORMAT:
+ *params = renderbuffer->getFormat();
+ break;
+ case GL_RENDERBUFFER_RED_SIZE:
+ if (renderbuffer->isColorbuffer())
+ {
+ *params = static_cast<gl::Colorbuffer*>(renderbuffer->getStorage())->getRedSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_GREEN_SIZE:
+ if (renderbuffer->isColorbuffer())
+ {
+ *params = static_cast<gl::Colorbuffer*>(renderbuffer->getStorage())->getGreenSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_BLUE_SIZE:
+ if (renderbuffer->isColorbuffer())
+ {
+ *params = static_cast<gl::Colorbuffer*>(renderbuffer->getStorage())->getBlueSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_ALPHA_SIZE:
+ if (renderbuffer->isColorbuffer())
+ {
+ *params = static_cast<gl::Colorbuffer*>(renderbuffer->getStorage())->getAlphaSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_DEPTH_SIZE:
+ if (renderbuffer->isDepthbuffer())
+ {
+ *params = static_cast<gl::Depthbuffer*>(renderbuffer->getStorage())->getDepthSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_STENCIL_SIZE:
+ if (renderbuffer->isStencilbuffer())
+ {
+ *params = static_cast<gl::Stencilbuffer*>(renderbuffer->getStorage())->getStencilSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_RENDERBUFFER_SAMPLES_ANGLE:
+ {
+ if (context->getMaxSupportedSamples() != 0)
+ {
+ *params = renderbuffer->getStorage()->getSamples();
+ }
+ else
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+ TRACE("(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", shader, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_SHADER_TYPE:
+ *params = shaderObject->getType();
+ return;
+ case GL_DELETE_STATUS:
+ *params = shaderObject->isFlaggedForDeletion();
+ return;
+ case GL_COMPILE_STATUS:
+ *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE;
+ return;
+ case GL_INFO_LOG_LENGTH:
+ *params = shaderObject->getInfoLogLength();
+ return;
+ case GL_SHADER_SOURCE_LENGTH:
+ *params = shaderObject->getSourceLength();
+ return;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
+{
+ TRACE("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)",
+ shader, bufsize, length, infolog);
+
+ try
+ {
+ if (bufsize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ shaderObject->getInfoLog(bufsize, length, infolog);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+ TRACE("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = 0x%0.8p, GLint* precision = 0x%0.8p)",
+ shadertype, precisiontype, range, precision);
+
+ try
+ {
+ switch (shadertype)
+ {
+ case GL_VERTEX_SHADER:
+ case GL_FRAGMENT_SHADER:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (precisiontype)
+ {
+ case GL_LOW_FLOAT:
+ case GL_MEDIUM_FLOAT:
+ case GL_HIGH_FLOAT:
+ // Assume IEEE 754 precision
+ range[0] = 127;
+ range[1] = 127;
+ *precision = 23;
+ break;
+ case GL_LOW_INT:
+ case GL_MEDIUM_INT:
+ case GL_HIGH_INT:
+ // Some (most) hardware only supports single-precision floating-point numbers,
+ // which can accurately represent integers up to +/-16777216
+ range[0] = 24;
+ range[1] = 24;
+ *precision = 0;
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
+{
+ TRACE("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)",
+ shader, bufsize, length, source);
+
+ try
+ {
+ if (bufsize < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ shaderObject->getSource(bufsize, length, source);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+const GLubyte* __stdcall glGetString(GLenum name)
+{
+ TRACE("(GLenum name = 0x%X)", name);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ switch (name)
+ {
+ case GL_VENDOR:
+ return (GLubyte*)"TransGaming Inc.";
+ case GL_RENDERER:
+ return (GLubyte*)"ANGLE";
+ case GL_VERSION:
+ return (GLubyte*)"OpenGL ES 2.0 (git-devel "__DATE__ " " __TIME__")";
+ case GL_SHADING_LANGUAGE_VERSION:
+ return (GLubyte*)"OpenGL ES GLSL ES 1.00 (git-devel "__DATE__ " " __TIME__")";
+ case GL_EXTENSIONS:
+ return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
+ default:
+ return error(GL_INVALID_ENUM, (GLubyte*)NULL);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, (GLubyte*)NULL);
+ }
+
+ return NULL;
+}
+
+void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+{
+ TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Texture *texture;
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ texture = context->getTexture2D();
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ texture = context->getTextureCubeMap();
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = (GLfloat)texture->getMagFilter();
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = (GLfloat)texture->getMinFilter();
+ break;
+ case GL_TEXTURE_WRAP_S:
+ *params = (GLfloat)texture->getWrapS();
+ break;
+ case GL_TEXTURE_WRAP_T:
+ *params = (GLfloat)texture->getWrapT();
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+ TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Texture *texture;
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ texture = context->getTexture2D();
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ texture = context->getTextureCubeMap();
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = texture->getMagFilter();
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = texture->getMinFilter();
+ break;
+ case GL_TEXTURE_WRAP_S:
+ *params = texture->getWrapS();
+ break;
+ case GL_TEXTURE_WRAP_T:
+ *params = texture->getWrapT();
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+ TRACE("(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)", program, location, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (program == 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!programObject->getUniformfv(location, params))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params)
+{
+ TRACE("(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)", program, location, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (program == 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!programObject)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!programObject->getUniformiv(location, params))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+int __stdcall glGetUniformLocation(GLuint program, const GLchar* name)
+{
+ TRACE("(GLuint program = %d, const GLchar* name = 0x%0.8p)", program, name);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (strstr(name, "gl_") == name)
+ {
+ return -1;
+ }
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION, -1);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE, -1);
+ }
+ }
+
+ if (!programObject->isLinked())
+ {
+ return error(GL_INVALID_OPERATION, -1);
+ }
+
+ return programObject->getUniformLocation(name, false);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, -1);
+ }
+
+ return -1;
+}
+
+void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+{
+ TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", index, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
+
+ switch (pname)
+ {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ *params = (GLfloat)(attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ *params = (GLfloat)attribState.mSize;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ *params = (GLfloat)attribState.mStride;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ *params = (GLfloat)attribState.mType;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ *params = (GLfloat)(attribState.mNormalized ? GL_TRUE : GL_FALSE);
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ *params = (GLfloat)attribState.mBoundBuffer.id();
+ break;
+ case GL_CURRENT_VERTEX_ATTRIB:
+ for (int i = 0; i < 4; ++i)
+ {
+ params[i] = attribState.mCurrentValue[i];
+ }
+ break;
+ default: return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+{
+ TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", index, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
+
+ switch (pname)
+ {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ *params = (attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ *params = attribState.mSize;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ *params = attribState.mStride;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ *params = attribState.mType;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ *params = (attribState.mNormalized ? GL_TRUE : GL_FALSE);
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ *params = attribState.mBoundBuffer.id();
+ break;
+ case GL_CURRENT_VERTEX_ATTRIB:
+ for (int i = 0; i < 4; ++i)
+ {
+ float currentValue = attribState.mCurrentValue[i];
+ params[i] = (GLint)(currentValue > 0.0f ? floor(currentValue + 0.5f) : ceil(currentValue - 0.5f));
+ }
+ break;
+ default: return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
+{
+ TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)", index, pname, pointer);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ *pointer = const_cast<GLvoid*>(context->getVertexAttribPointer(index));
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glHint(GLenum target, GLenum mode)
+{
+ TRACE("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode);
+
+ try
+ {
+ switch (mode)
+ {
+ case GL_FASTEST:
+ case GL_NICEST:
+ case GL_DONT_CARE:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+ switch (target)
+ {
+ case GL_GENERATE_MIPMAP_HINT:
+ if (context) context->setGenerateMipmapHint(mode);
+ break;
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+ if (context) context->setFragmentShaderDerivativeHint(mode);
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glIsBuffer(GLuint buffer)
+{
+ TRACE("(GLuint buffer = %d)", buffer);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context && buffer)
+ {
+ gl::Buffer *bufferObject = context->getBuffer(buffer);
+
+ if (bufferObject)
+ {
+ return GL_TRUE;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+GLboolean __stdcall glIsEnabled(GLenum cap)
+{
+ TRACE("(GLenum cap = 0x%X)", cap);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (cap)
+ {
+ case GL_CULL_FACE: return context->isCullFaceEnabled();
+ case GL_POLYGON_OFFSET_FILL: return context->isPolygonOffsetFillEnabled();
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: return context->isSampleAlphaToCoverageEnabled();
+ case GL_SAMPLE_COVERAGE: return context->isSampleCoverageEnabled();
+ case GL_SCISSOR_TEST: return context->isScissorTestEnabled();
+ case GL_STENCIL_TEST: return context->isStencilTestEnabled();
+ case GL_DEPTH_TEST: return context->isDepthTestEnabled();
+ case GL_BLEND: return context->isBlendEnabled();
+ case GL_DITHER: return context->isDitherEnabled();
+ default:
+ return error(GL_INVALID_ENUM, false);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, false);
+ }
+
+ return false;
+}
+
+GLboolean __stdcall glIsFenceNV(GLuint fence)
+{
+ TRACE("(GLuint fence = %d)", fence);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Fence *fenceObject = context->getFence(fence);
+
+ if (fenceObject == NULL)
+ {
+ return GL_FALSE;
+ }
+
+ return fenceObject->isFence();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+GLboolean __stdcall glIsFramebuffer(GLuint framebuffer)
+{
+ TRACE("(GLuint framebuffer = %d)", framebuffer);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context && framebuffer)
+ {
+ gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);
+
+ if (framebufferObject)
+ {
+ return GL_TRUE;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+GLboolean __stdcall glIsProgram(GLuint program)
+{
+ TRACE("(GLuint program = %d)", program);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context && program)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (programObject)
+ {
+ return GL_TRUE;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer)
+{
+ TRACE("(GLuint renderbuffer = %d)", renderbuffer);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context && renderbuffer)
+ {
+ gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
+
+ if (renderbufferObject)
+ {
+ return GL_TRUE;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+GLboolean __stdcall glIsShader(GLuint shader)
+{
+ TRACE("(GLuint shader = %d)", shader);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context && shader)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (shaderObject)
+ {
+ return GL_TRUE;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+GLboolean __stdcall glIsTexture(GLuint texture)
+{
+ TRACE("(GLuint texture = %d)", texture);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context && texture)
+ {
+ gl::Texture *textureObject = context->getTexture(texture);
+
+ if (textureObject)
+ {
+ return GL_TRUE;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glLineWidth(GLfloat width)
+{
+ TRACE("(GLfloat width = %f)", width);
+
+ try
+ {
+ if (width <= 0.0f)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setLineWidth(width);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glLinkProgram(GLuint program)
+{
+ TRACE("(GLuint program = %d)", program);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ programObject->link();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glPixelStorei(GLenum pname, GLint param)
+{
+ TRACE("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (pname)
+ {
+ case GL_UNPACK_ALIGNMENT:
+ if (param != 1 && param != 2 && param != 4 && param != 8)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ context->setUnpackAlignment(param);
+ break;
+
+ case GL_PACK_ALIGNMENT:
+ if (param != 1 && param != 2 && param != 4 && param != 8)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ context->setPackAlignment(param);
+ break;
+
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glPolygonOffset(GLfloat factor, GLfloat units)
+{
+ TRACE("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setPolygonOffsetParams(factor, units);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
+{
+ TRACE("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, "
+ "GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = 0x%0.8p)",
+ x, y, width, height, format, type, pixels);
+
+ try
+ {
+ if (width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (format)
+ {
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ break;
+ default:
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ case gl::IMPLEMENTATION_COLOR_READ_FORMAT:
+ switch (type)
+ {
+ case gl::IMPLEMENTATION_COLOR_READ_TYPE:
+ break;
+ default:
+ return error(GL_INVALID_OPERATION);
+ }
+ break;
+ default:
+ return error(GL_INVALID_OPERATION);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->readPixels(x, y, width, height, format, type, pixels);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glReleaseShaderCompiler(void)
+{
+ TRACE("()");
+
+ try
+ {
+ gl::Shader::releaseCompiler();
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ TRACE("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
+ target, samples, internalformat, width, height);
+
+ try
+ {
+ switch (target)
+ {
+ case GL_RENDERBUFFER:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (!gl::IsColorRenderable(internalformat) && !gl::IsDepthRenderable(internalformat) && !gl::IsStencilRenderable(internalformat))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (width < 0 || height < 0 || samples < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (width > context->getMaximumRenderbufferDimension() ||
+ height > context->getMaximumRenderbufferDimension() ||
+ samples > context->getMaxSupportedSamples())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ GLuint handle = context->getRenderbufferHandle();
+ if (handle == 0)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (internalformat)
+ {
+ case GL_DEPTH_COMPONENT16:
+ context->setRenderbufferStorage(new gl::Depthbuffer(width, height, samples));
+ break;
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGB565:
+ case GL_RGB8_OES:
+ case GL_RGBA8_OES:
+ context->setRenderbufferStorage(new gl::Colorbuffer(width, height, internalformat, samples));
+ break;
+ case GL_STENCIL_INDEX8:
+ context->setRenderbufferStorage(new gl::Stencilbuffer(width, height, samples));
+ break;
+ case GL_DEPTH24_STENCIL8_OES:
+ context->setRenderbufferStorage(new gl::DepthStencilbuffer(width, height, samples));
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height);
+}
+
+void __stdcall glSampleCoverage(GLclampf value, GLboolean invert)
+{
+ TRACE("(GLclampf value = %f, GLboolean invert = %d)", value, invert);
+
+ try
+ {
+ gl::Context* context = gl::getContext();
+
+ if (context)
+ {
+ context->setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glSetFenceNV(GLuint fence, GLenum condition)
+{
+ TRACE("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition);
+
+ try
+ {
+ if (condition != GL_ALL_COMPLETED_NV)
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Fence *fenceObject = context->getFence(fence);
+
+ if (fenceObject == NULL)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ fenceObject->setFence(condition);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ TRACE("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
+
+ try
+ {
+ if (width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context* context = gl::getContext();
+
+ if (context)
+ {
+ context->setScissorParams(x, y, width, height);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
+{
+ TRACE("(GLsizei n = %d, const GLuint* shaders = 0x%0.8p, GLenum binaryformat = 0x%X, "
+ "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)",
+ n, shaders, binaryformat, binary, length);
+
+ try
+ {
+ // No binary shader formats are supported.
+ return error(GL_INVALID_ENUM);
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
+{
+ TRACE("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)",
+ shader, count, string, length);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ if (context->getProgram(shader))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ shaderObject->setSource(count, string, length);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask);
+}
+
+void __stdcall glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ TRACE("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)", face, func, ref, mask);
+
+ try
+ {
+ switch (face)
+ {
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (func)
+ {
+ case GL_NEVER:
+ case GL_ALWAYS:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_EQUAL:
+ case GL_GEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ context->setStencilParams(func, ref, mask);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ context->setStencilBackParams(func, ref, mask);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glStencilMask(GLuint mask)
+{
+ glStencilMaskSeparate(GL_FRONT_AND_BACK, mask);
+}
+
+void __stdcall glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+ TRACE("(GLenum face = 0x%X, GLuint mask = %d)", face, mask);
+
+ try
+ {
+ switch (face)
+ {
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ context->setStencilWritemask(mask);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ context->setStencilBackWritemask(mask);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass);
+}
+
+void __stdcall glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ TRACE("(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)",
+ face, fail, zfail, zpass);
+
+ try
+ {
+ switch (face)
+ {
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (fail)
+ {
+ case GL_ZERO:
+ case GL_KEEP:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ case GL_INCR_WRAP:
+ case GL_DECR_WRAP:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (zfail)
+ {
+ case GL_ZERO:
+ case GL_KEEP:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ case GL_INCR_WRAP:
+ case GL_DECR_WRAP:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (zpass)
+ {
+ case GL_ZERO:
+ case GL_KEEP:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ case GL_INCR_WRAP:
+ case GL_DECR_WRAP:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ context->setStencilOperations(fail, zfail, zpass);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ context->setStencilBackOperations(fail, zfail, zpass);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glTestFenceNV(GLuint fence)
+{
+ TRACE("(GLuint fence = %d)", fence);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Fence *fenceObject = context->getFence(fence);
+
+ if (fenceObject == NULL)
+ {
+ return error(GL_INVALID_OPERATION, GL_TRUE);
+ }
+
+ return fenceObject->testFence();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ error(GL_OUT_OF_MEMORY);
+ }
+
+ return GL_TRUE;
+}
+
+void __stdcall glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ TRACE("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, "
+ "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
+ target, level, internalformat, width, height, border, format, type, pixels);
+
+ try
+ {
+ if (level < 0 || width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (level > 0 && (!gl::isPow2(width) || !gl::isPow2(height)))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (internalformat != format)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (internalformat)
+ {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_RGB:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // error cases for compressed textures are handled below
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ break;
+ default:
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (border != 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ if (width > (context->getMaximumTextureDimension() >> level) ||
+ height > (context->getMaximumTextureDimension() >> level))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ if (width != height)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (width > (context->getMaximumCubeTextureDimension() >> level) ||
+ height > (context->getMaximumCubeTextureDimension() >> level))
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (internalformat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
+ internalformat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
+ {
+ if (context->supportsCompressedTextures())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ }
+
+ if (type == GL_FLOAT)
+ {
+ if (!context->supportsFloatTextures())
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ else if (type == GL_HALF_FLOAT_OES)
+ {
+ if (!context->supportsHalfFloatTextures())
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ }
+
+ if (target == GL_TEXTURE_2D)
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->setImage(level, internalformat, width, height, format, type, context->getUnpackAlignment(), pixels);
+ }
+ else
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ texture->setImagePosX(level, internalformat, width, height, format, type, context->getUnpackAlignment(), pixels);
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ texture->setImageNegX(level, internalformat, width, height, format, type, context->getUnpackAlignment(), pixels);
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ texture->setImagePosY(level, internalformat, width, height, format, type, context->getUnpackAlignment(), pixels);
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ texture->setImageNegY(level, internalformat, width, height, format, type, context->getUnpackAlignment(), pixels);
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ texture->setImagePosZ(level, internalformat, width, height, format, type, context->getUnpackAlignment(), pixels);
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ texture->setImageNegZ(level, internalformat, width, height, format, type, context->getUnpackAlignment(), pixels);
+ break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ glTexParameteri(target, pname, (GLint)param);
+}
+
+void __stdcall glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+ glTexParameteri(target, pname, (GLint)*params);
+}
+
+void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Texture *texture;
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ texture = context->getTexture2D();
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ texture = context->getTextureCubeMap();
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S:
+ if (!texture->setWrapS((GLenum)param))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_TEXTURE_WRAP_T:
+ if (!texture->setWrapT((GLenum)param))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ if (!texture->setMinFilter((GLenum)param))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ if (!texture->setMagFilter((GLenum)param))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+ glTexParameteri(target, pname, *params);
+}
+
+void __stdcall glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, const GLvoid* pixels)
+{
+ TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, "
+ "const GLvoid* pixels = 0x%0.8p)",
+ target, level, xoffset, yoffset, width, height, format, type, pixels);
+
+ try
+ {
+ if (!gl::IsTextureTarget(target))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (!gl::CheckTextureFormatType(format, type))
+ {
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (width == 0 || height == 0 || pixels == NULL)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (level > context->getMaximumTextureLevel())
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (format == GL_FLOAT)
+ {
+ if (!context->supportsFloatTextures())
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ }
+ else if (format == GL_HALF_FLOAT_OES)
+ {
+ if (!context->supportsHalfFloatTextures())
+ {
+ return error(GL_INVALID_ENUM);
+ }
+ }
+
+ if (target == GL_TEXTURE_2D)
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (texture->isCompressed())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (format != texture->getFormat())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
+ }
+ else if (gl::IsCubemapTextureTarget(target))
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+
+ if (!texture)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (texture->isCompressed())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (format != texture->getFormat())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform1f(GLint location, GLfloat x)
+{
+ glUniform1fv(location, 1, &x);
+}
+
+void __stdcall glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform1fv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform1i(GLint location, GLint x)
+{
+ glUniform1iv(location, 1, &x);
+}
+
+void __stdcall glUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform1iv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+ GLfloat xy[2] = {x, y};
+
+ glUniform2fv(location, 1, (GLfloat*)&xy);
+}
+
+void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform2fv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform2i(GLint location, GLint x, GLint y)
+{
+ GLint xy[4] = {x, y};
+
+ glUniform2iv(location, 1, (GLint*)&xy);
+}
+
+void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform2iv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+ GLfloat xyz[3] = {x, y, z};
+
+ glUniform3fv(location, 1, (GLfloat*)&xyz);
+}
+
+void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform3fv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+ GLint xyz[3] = {x, y, z};
+
+ glUniform3iv(location, 1, (GLint*)&xyz);
+}
+
+void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform3iv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GLfloat xyzw[4] = {x, y, z, w};
+
+ glUniform4fv(location, 1, (GLfloat*)&xyzw);
+}
+
+void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform4fv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+ GLint xyzw[4] = {x, y, z, w};
+
+ glUniform4iv(location, 1, (GLint*)&xyzw);
+}
+
+void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ if (count < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniform4iv(location, count, v))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0 || transpose != GL_FALSE)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniformMatrix2fv(location, count, value))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0 || transpose != GL_FALSE)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniformMatrix3fv(location, count, value))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0 || transpose != GL_FALSE)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *program = context->getCurrentProgram();
+
+ if (!program)
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ if (!program->setUniformMatrix4fv(location, count, value))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUseProgram(GLuint program)
+{
+ TRACE("(GLuint program = %d)", program);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject && program != 0)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (program != 0 && !programObject->isLinked())
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+
+ context->useProgram(program);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glValidateProgram(GLuint program)
+{
+ TRACE("(GLuint program = %d)", program);
+
+ try
+ {
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return error(GL_INVALID_VALUE);
+ }
+ }
+
+ programObject->validate();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib1f(GLuint index, GLfloat x)
+{
+ TRACE("(GLuint index = %d, GLfloat x = %f)", index, x);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { x, 0, 0, 1 };
+ context->setVertexAttrib(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib1fv(GLuint index, const GLfloat* values)
+{
+ TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { values[0], 0, 0, 1 };
+ context->setVertexAttrib(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+ TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { x, y, 0, 1 };
+ context->setVertexAttrib(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib2fv(GLuint index, const GLfloat* values)
+{
+ TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { values[0], values[1], 0, 1 };
+ context->setVertexAttrib(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { x, y, z, 1 };
+ context->setVertexAttrib(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib3fv(GLuint index, const GLfloat* values)
+{
+ TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { values[0], values[1], values[2], 1 };
+ context->setVertexAttrib(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { x, y, z, w };
+ context->setVertexAttrib(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib4fv(GLuint index, const GLfloat* values)
+{
+ TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setVertexAttrib(index, values);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
+{
+ TRACE("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, "
+ "GLboolean normalized = %d, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
+ index, size, type, normalized, stride, ptr);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (size < 1 || size > 4)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ switch (type)
+ {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_FIXED:
+ case GL_FLOAT:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if (stride < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setVertexAttribState(index, context->getArrayBuffer(), size, type, (normalized == GL_TRUE), stride, ptr);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ TRACE("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
+
+ try
+ {
+ if (width < 0 || height < 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ context->setViewportParams(x, y, width, height);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter)
+{
+ TRACE("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
+ "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
+ "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
+ srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+ try
+ {
+ switch (filter)
+ {
+ case GL_NEAREST:
+ break;
+ default:
+ return error(GL_INVALID_ENUM);
+ }
+
+ if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
+ {
+ return error(GL_INVALID_VALUE);
+ }
+
+ if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
+ {
+ ERR("Scaling and flipping in BlitFramebufferANGLE not supported by this implementation");
+ return error(GL_INVALID_OPERATION);
+ }
+
+ gl::Context *context = gl::getContext();
+
+ if (context)
+ {
+ if (context->getReadFramebufferHandle() == context->getDrawFramebufferHandle())
+ {
+ ERR("Blits with the same source and destination framebuffer are not supported by this implementation.");
+ return error(GL_INVALID_OPERATION);
+ }
+
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, "
+ "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, "
+ "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* pixels = 0x%0.8p)",
+ target, level, internalformat, width, height, depth, border, format, type, pixels);
+
+ try
+ {
+ UNIMPLEMENTED(); // FIXME
+ }
+ catch(std::bad_alloc&)
+ {
+ return error(GL_OUT_OF_MEMORY);
+ }
+}
+
+__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname)
+{
+ struct Extension
+ {
+ const char *name;
+ __eglMustCastToProperFunctionPointerType address;
+ };
+
+ static const Extension glExtensions[] =
+ {
+ {"glTexImage3DOES", (__eglMustCastToProperFunctionPointerType)glTexImage3DOES},
+ {"glBlitFramebufferANGLE", (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE},
+ {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE},
+ {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV},
+ {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV},
+ {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV},
+ {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV},
+ {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV},
+ {"glFinishFenceNV", (__eglMustCastToProperFunctionPointerType)glFinishFenceNV},
+ {"glSetFenceNV", (__eglMustCastToProperFunctionPointerType)glSetFenceNV},
+ };
+
+ for (int ext = 0; ext < sizeof(glExtensions) / sizeof(Extension); ext++)
+ {
+ if (strcmp(procname, glExtensions[ext].name) == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address;
+ }
+ }
+
+ return NULL;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def
new file mode 100644
index 0000000..b2dc23c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def
@@ -0,0 +1,163 @@
+LIBRARY libGLESv2
+EXPORTS
+ glActiveTexture @1
+ glAttachShader @2
+ glBindAttribLocation @3
+ glBindBuffer @4
+ glBindFramebuffer @5
+ glBindRenderbuffer @6
+ glBindTexture @7
+ glBlendColor @8
+ glBlendEquation @9
+ glBlendEquationSeparate @10
+ glBlendFunc @11
+ glBlendFuncSeparate @12
+ glBufferData @13
+ glBufferSubData @14
+ glCheckFramebufferStatus @15
+ glClear @16
+ glClearColor @17
+ glClearDepthf @18
+ glClearStencil @19
+ glColorMask @20
+ glCompileShader @21
+ glCompressedTexImage2D @22
+ glCompressedTexSubImage2D @23
+ glCopyTexImage2D @24
+ glCopyTexSubImage2D @25
+ glCreateProgram @26
+ glCreateShader @27
+ glCullFace @28
+ glDeleteBuffers @29
+ glDeleteFramebuffers @30
+ glDeleteProgram @32
+ glDeleteRenderbuffers @33
+ glDeleteShader @34
+ glDeleteTextures @31
+ glDepthFunc @36
+ glDepthMask @37
+ glDepthRangef @38
+ glDetachShader @35
+ glDisable @39
+ glDisableVertexAttribArray @40
+ glDrawArrays @41
+ glDrawElements @42
+ glEnable @43
+ glEnableVertexAttribArray @44
+ glFinish @45
+ glFlush @46
+ glFramebufferRenderbuffer @47
+ glFramebufferTexture2D @48
+ glFrontFace @49
+ glGenBuffers @50
+ glGenFramebuffers @52
+ glGenRenderbuffers @53
+ glGenTextures @54
+ glGenerateMipmap @51
+ glGetActiveAttrib @55
+ glGetActiveUniform @56
+ glGetAttachedShaders @57
+ glGetAttribLocation @58
+ glGetBooleanv @59
+ glGetBufferParameteriv @60
+ glGetError @61
+ glGetFloatv @62
+ glGetFramebufferAttachmentParameteriv @63
+ glGetIntegerv @64
+ glGetProgramInfoLog @66
+ glGetProgramiv @65
+ glGetRenderbufferParameteriv @67
+ glGetShaderInfoLog @69
+ glGetShaderPrecisionFormat @70
+ glGetShaderSource @71
+ glGetShaderiv @68
+ glGetString @72
+ glGetTexParameterfv @73
+ glGetTexParameteriv @74
+ glGetUniformLocation @77
+ glGetUniformfv @75
+ glGetUniformiv @76
+ glGetVertexAttribPointerv @80
+ glGetVertexAttribfv @78
+ glGetVertexAttribiv @79
+ glHint @81
+ glIsBuffer @82
+ glIsEnabled @83
+ glIsFramebuffer @84
+ glIsProgram @85
+ glIsRenderbuffer @86
+ glIsShader @87
+ glIsTexture @88
+ glLineWidth @89
+ glLinkProgram @90
+ glPixelStorei @91
+ glPolygonOffset @92
+ glReadPixels @93
+ glReleaseShaderCompiler @94
+ glRenderbufferStorage @95
+ glSampleCoverage @96
+ glScissor @97
+ glShaderBinary @98
+ glShaderSource @99
+ glStencilFunc @100
+ glStencilFuncSeparate @101
+ glStencilMask @102
+ glStencilMaskSeparate @103
+ glStencilOp @104
+ glStencilOpSeparate @105
+ glTexImage2D @106
+ glTexParameterf @107
+ glTexParameterfv @108
+ glTexParameteri @109
+ glTexParameteriv @110
+ glTexSubImage2D @111
+ glUniform1f @112
+ glUniform1fv @113
+ glUniform1i @114
+ glUniform1iv @115
+ glUniform2f @116
+ glUniform2fv @117
+ glUniform2i @118
+ glUniform2iv @119
+ glUniform3f @120
+ glUniform3fv @121
+ glUniform3i @122
+ glUniform3iv @123
+ glUniform4f @124
+ glUniform4fv @125
+ glUniform4i @126
+ glUniform4iv @127
+ glUniformMatrix2fv @128
+ glUniformMatrix3fv @129
+ glUniformMatrix4fv @130
+ glUseProgram @131
+ glValidateProgram @132
+ glVertexAttrib1f @133
+ glVertexAttrib1fv @134
+ glVertexAttrib2f @135
+ glVertexAttrib2fv @136
+ glVertexAttrib3f @137
+ glVertexAttrib3fv @138
+ glVertexAttrib4f @139
+ glVertexAttrib4fv @140
+ glVertexAttribPointer @141
+ glViewport @142
+
+ ; Extensions
+ glTexImage3DOES @143
+ glBlitFramebufferANGLE @149
+ glRenderbufferStorageMultisampleANGLE @150
+ glDeleteFencesNV @151
+ glFinishFenceNV @152
+ glGenFencesNV @153
+ glGetFenceivNV @154
+ glIsFenceNV @155
+ glSetFenceNV @156
+ glTestFenceNV @157
+
+ ; EGL dependencies
+ glCreateContext @144 NONAME
+ glDestroyContext @145 NONAME
+ glMakeCurrent @146 NONAME
+ glGetCurrentContext @147 NONAME
+ glGetProcAddress @148 NONAME \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp
new file mode 100644
index 0000000..a99ec44
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp
@@ -0,0 +1,143 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// main.cpp: DLL entry point and management of thread-local data.
+
+#include "libGLESv2/main.h"
+
+#include "common/debug.h"
+#include "libEGL/Surface.h"
+
+#include "libGLESv2/Framebuffer.h"
+
+static DWORD currentTLS = TLS_OUT_OF_INDEXES;
+
+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+{
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ {
+ currentTLS = TlsAlloc();
+
+ if (currentTLS == TLS_OUT_OF_INDEXES)
+ {
+ return FALSE;
+ }
+ }
+ // Fall throught to initialize index
+ case DLL_THREAD_ATTACH:
+ {
+ gl::Current *current = (gl::Current*)LocalAlloc(LPTR, sizeof(gl::Current));
+
+ if (current)
+ {
+ TlsSetValue(currentTLS, current);
+
+ current->context = NULL;
+ current->display = NULL;
+ }
+ }
+ break;
+ case DLL_THREAD_DETACH:
+ {
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+ }
+ break;
+ case DLL_PROCESS_DETACH:
+ {
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+
+ TlsFree(currentTLS);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return TRUE;
+}
+
+namespace gl
+{
+void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ current->context = context;
+ current->display = display;
+
+ if (context && display && surface)
+ {
+ context->makeCurrent(display, surface);
+ }
+}
+
+Context *getContext()
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ return current->context;
+}
+
+egl::Display *getDisplay()
+{
+ Current *current = (Current*)TlsGetValue(currentTLS);
+
+ return current->display;
+}
+
+IDirect3DDevice9 *getDevice()
+{
+ egl::Display *display = getDisplay();
+
+ return display->getDevice();
+}
+}
+
+// Records an error code
+void error(GLenum errorCode)
+{
+ gl::Context *context = glGetCurrentContext();
+
+ if (context)
+ {
+ switch (errorCode)
+ {
+ case GL_INVALID_ENUM:
+ context->recordInvalidEnum();
+ gl::trace("\t! Error generated: invalid enum\n");
+ break;
+ case GL_INVALID_VALUE:
+ context->recordInvalidValue();
+ gl::trace("\t! Error generated: invalid value\n");
+ break;
+ case GL_INVALID_OPERATION:
+ context->recordInvalidOperation();
+ gl::trace("\t! Error generated: invalid operation\n");
+ break;
+ case GL_OUT_OF_MEMORY:
+ context->recordOutOfMemory();
+ gl::trace("\t! Error generated: out of memory\n");
+ break;
+ case GL_INVALID_FRAMEBUFFER_OPERATION:
+ context->recordInvalidFramebufferOperation();
+ gl::trace("\t! Error generated: invalid framebuffer operation\n");
+ break;
+ default: UNREACHABLE();
+ }
+ }
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.h
new file mode 100644
index 0000000..7f9c880
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/main.h
@@ -0,0 +1,47 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// main.h: Management of thread-local data.
+
+#ifndef LIBGLESV2_MAIN_H_
+#define LIBGLESV2_MAIN_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include "common/debug.h"
+#include "libEGL/Display.h"
+
+#include "libGLESv2/Context.h"
+
+namespace gl
+{
+struct Current
+{
+ Context *context;
+ egl::Display *display;
+};
+
+void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface);
+
+Context *getContext();
+egl::Display *getDisplay();
+
+IDirect3DDevice9 *getDevice();
+}
+
+void error(GLenum errorCode);
+
+template<class T>
+const T &error(GLenum errorCode, const T &returnValue)
+{
+ error(errorCode);
+
+ return returnValue;
+}
+
+#endif // LIBGLESV2_MAIN_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h
new file mode 100644
index 0000000..31fa16f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h
@@ -0,0 +1,66 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// mathutil.h: Math and bit manipulation functions.
+
+#ifndef LIBGLESV2_MATHUTIL_H_
+#define LIBGLESV2_MATHUTIL_H_
+
+#include <math.h>
+
+namespace gl
+{
+inline bool isPow2(int x)
+{
+ return (x & (x - 1)) == 0 && (x != 0);
+}
+
+inline int log2(int x)
+{
+ int r = 0;
+ while ((x >> r) > 1) r++;
+ return r;
+}
+
+inline unsigned int ceilPow2(unsigned int x)
+{
+ if (x != 0) x--;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ x++;
+
+ return x;
+}
+
+inline float clamp01(float x)
+{
+ return x < 0 ? 0 : (x > 1 ? 1 : x);
+}
+
+template<const int n>
+inline unsigned int unorm(float x)
+{
+ const unsigned int max = 0xFFFFFFFF >> (32 - n);
+
+ if (x > 1)
+ {
+ return max;
+ }
+ else if (x < 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return (unsigned int)(max * x + 0.5f);
+ }
+}
+}
+
+#endif // LIBGLESV2_MATHUTIL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp
new file mode 100644
index 0000000..a3f5243
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp
@@ -0,0 +1,827 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// utilities.cpp: Conversion functions and other utility routines.
+
+#include "libGLESv2/utilities.h"
+
+#include <limits>
+
+#include "common/debug.h"
+
+#include "libGLESv2/mathutil.h"
+#include "libGLESv2/Context.h"
+
+namespace gl
+{
+
+int UniformComponentCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ return 1;
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ return 2;
+ case GL_INT_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_BOOL_VEC3:
+ return 3;
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_FLOAT_MAT2:
+ return 4;
+ case GL_FLOAT_MAT3:
+ return 9;
+ case GL_FLOAT_MAT4:
+ return 16;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+GLenum UniformComponentType(GLenum type)
+{
+ switch(type)
+ {
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ return GL_BOOL;
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ return GL_FLOAT;
+ case GL_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ return GL_INT;
+ default:
+ UNREACHABLE();
+ }
+
+ return GL_NONE;
+}
+
+size_t UniformTypeSize(GLenum type)
+{
+ switch(type)
+ {
+ case GL_BOOL: return sizeof(GLboolean);
+ case GL_FLOAT: return sizeof(GLfloat);
+ case GL_INT: return sizeof(GLint);
+ }
+
+ return UniformTypeSize(UniformComponentType(type)) * UniformComponentCount(type);
+}
+
+int VariableRowCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_NONE:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ return 1;
+ case GL_FLOAT_MAT2:
+ return 2;
+ case GL_FLOAT_MAT3:
+ return 3;
+ case GL_FLOAT_MAT4:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+int VariableColumnCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_NONE:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ return 1;
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_FLOAT_MAT2:
+ return 2;
+ case GL_INT_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_MAT3:
+ return 3;
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_FLOAT_MAT4:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)
+{
+ ASSERT(allocationSize <= bitsSize);
+
+ unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
+
+ for (unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
+ {
+ if ((*bits & mask) == 0)
+ {
+ *bits |= mask;
+ return i;
+ }
+
+ mask <<= 1;
+ }
+
+ return -1;
+}
+
+GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment)
+{
+ ASSERT(alignment > 0 && isPow2(alignment));
+
+ GLsizei rawPitch = ComputePixelSize(format, type) * width;
+ return (rawPitch + alignment - 1) & ~(alignment - 1);
+}
+
+GLsizei ComputeCompressedPitch(GLsizei width, GLenum format)
+{
+ switch (format)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ break;
+ default:
+ return 0;
+ }
+
+ ASSERT(width % 4 == 0);
+
+ return 8 * width / 4;
+}
+
+GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format)
+{
+ switch (format)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ break;
+ default:
+ return 0;
+ }
+
+ return 8 * (GLsizei)ceil((float)width / 4.0f) * (GLsizei)ceil((float)height / 4.0f);
+}
+
+bool IsCompressed(GLenum format)
+{
+ if(format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
+ format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// Returns the size, in bytes, of a single texel in an Image
+int ComputePixelSize(GLenum format, GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ switch (format)
+ {
+ case GL_ALPHA: return sizeof(unsigned char);
+ case GL_LUMINANCE: return sizeof(unsigned char);
+ case GL_LUMINANCE_ALPHA: return sizeof(unsigned char) * 2;
+ case GL_RGB: return sizeof(unsigned char) * 3;
+ case GL_RGBA: return sizeof(unsigned char) * 4;
+ case GL_BGRA_EXT: return sizeof(unsigned char) * 4;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return sizeof(unsigned short);
+ case GL_FLOAT:
+ switch (format)
+ {
+ case GL_ALPHA: return sizeof(float);
+ case GL_LUMINANCE: return sizeof(float);
+ case GL_LUMINANCE_ALPHA: return sizeof(float) * 2;
+ case GL_RGB: return sizeof(float) * 3;
+ case GL_RGBA: return sizeof(float) * 4;
+ default: UNREACHABLE();
+ }
+ break;
+ case GL_HALF_FLOAT_OES:
+ switch (format)
+ {
+ case GL_ALPHA: return sizeof(unsigned short);
+ case GL_LUMINANCE: return sizeof(unsigned short);
+ case GL_LUMINANCE_ALPHA: return sizeof(unsigned short) * 2;
+ case GL_RGB: return sizeof(unsigned short) * 3;
+ case GL_RGBA: return sizeof(unsigned short) * 4;
+ default: UNREACHABLE();
+ }
+ break;
+ default: UNREACHABLE();
+ }
+
+ return 0;
+}
+
+bool IsCubemapTextureTarget(GLenum target)
+{
+ return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
+}
+
+bool IsTextureTarget(GLenum target)
+{
+ return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
+}
+
+// Verify that format/type are one of the combinations from table 3.4.
+bool CheckTextureFormatType(GLenum format, GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ switch (format)
+ {
+ case GL_RGBA:
+ case GL_BGRA_EXT:
+ case GL_RGB:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ return true;
+
+ default:
+ return false;
+ }
+
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ switch (format)
+ {
+ case GL_RGBA:
+ case GL_RGB:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ return true;
+
+ default:
+ return false;
+ }
+
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return (format == GL_RGBA);
+
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return (format == GL_RGB);
+
+ default:
+ return false;
+ }
+}
+
+bool IsColorRenderable(GLenum internalformat)
+{
+ switch (internalformat)
+ {
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGB565:
+ case GL_RGB8_OES:
+ case GL_RGBA8_OES:
+ return true;
+ case GL_DEPTH_COMPONENT16:
+ case GL_STENCIL_INDEX8:
+ case GL_DEPTH24_STENCIL8_OES:
+ return false;
+ default:
+ UNIMPLEMENTED();
+ }
+
+ return false;
+}
+
+bool IsDepthRenderable(GLenum internalformat)
+{
+ switch (internalformat)
+ {
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH24_STENCIL8_OES:
+ return true;
+ case GL_STENCIL_INDEX8:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGB565:
+ case GL_RGB8_OES:
+ case GL_RGBA8_OES:
+ return false;
+ default:
+ UNIMPLEMENTED();
+ }
+
+ return false;
+}
+
+bool IsStencilRenderable(GLenum internalformat)
+{
+ switch (internalformat)
+ {
+ case GL_STENCIL_INDEX8:
+ case GL_DEPTH24_STENCIL8_OES:
+ return true;
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGB565:
+ case GL_RGB8_OES:
+ case GL_RGBA8_OES:
+ case GL_DEPTH_COMPONENT16:
+ return false;
+ default:
+ UNIMPLEMENTED();
+ }
+
+ return false;
+}
+
+}
+
+namespace es2dx
+{
+
+D3DCMPFUNC ConvertComparison(GLenum comparison)
+{
+ D3DCMPFUNC d3dComp = D3DCMP_ALWAYS;
+ switch (comparison)
+ {
+ case GL_NEVER: d3dComp = D3DCMP_NEVER; break;
+ case GL_ALWAYS: d3dComp = D3DCMP_ALWAYS; break;
+ case GL_LESS: d3dComp = D3DCMP_LESS; break;
+ case GL_LEQUAL: d3dComp = D3DCMP_LESSEQUAL; break;
+ case GL_EQUAL: d3dComp = D3DCMP_EQUAL; break;
+ case GL_GREATER: d3dComp = D3DCMP_GREATER; break;
+ case GL_GEQUAL: d3dComp = D3DCMP_GREATEREQUAL; break;
+ case GL_NOTEQUAL: d3dComp = D3DCMP_NOTEQUAL; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dComp;
+}
+
+D3DCOLOR ConvertColor(gl::Color color)
+{
+ return D3DCOLOR_RGBA(gl::unorm<8>(color.red),
+ gl::unorm<8>(color.green),
+ gl::unorm<8>(color.blue),
+ gl::unorm<8>(color.alpha));
+}
+
+D3DBLEND ConvertBlendFunc(GLenum blend)
+{
+ D3DBLEND d3dBlend = D3DBLEND_ZERO;
+
+ switch (blend)
+ {
+ case GL_ZERO: d3dBlend = D3DBLEND_ZERO; break;
+ case GL_ONE: d3dBlend = D3DBLEND_ONE; break;
+ case GL_SRC_COLOR: d3dBlend = D3DBLEND_SRCCOLOR; break;
+ case GL_ONE_MINUS_SRC_COLOR: d3dBlend = D3DBLEND_INVSRCCOLOR; break;
+ case GL_DST_COLOR: d3dBlend = D3DBLEND_DESTCOLOR; break;
+ case GL_ONE_MINUS_DST_COLOR: d3dBlend = D3DBLEND_INVDESTCOLOR; break;
+ case GL_SRC_ALPHA: d3dBlend = D3DBLEND_SRCALPHA; break;
+ case GL_ONE_MINUS_SRC_ALPHA: d3dBlend = D3DBLEND_INVSRCALPHA; break;
+ case GL_DST_ALPHA: d3dBlend = D3DBLEND_DESTALPHA; break;
+ case GL_ONE_MINUS_DST_ALPHA: d3dBlend = D3DBLEND_INVDESTALPHA; break;
+ case GL_CONSTANT_COLOR: d3dBlend = D3DBLEND_BLENDFACTOR; break;
+ case GL_ONE_MINUS_CONSTANT_COLOR: d3dBlend = D3DBLEND_INVBLENDFACTOR; break;
+ case GL_CONSTANT_ALPHA: d3dBlend = D3DBLEND_BLENDFACTOR; break;
+ case GL_ONE_MINUS_CONSTANT_ALPHA: d3dBlend = D3DBLEND_INVBLENDFACTOR; break;
+ case GL_SRC_ALPHA_SATURATE: d3dBlend = D3DBLEND_SRCALPHASAT; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dBlend;
+}
+
+D3DBLENDOP ConvertBlendOp(GLenum blendOp)
+{
+ D3DBLENDOP d3dBlendOp = D3DBLENDOP_ADD;
+
+ switch (blendOp)
+ {
+ case GL_FUNC_ADD: d3dBlendOp = D3DBLENDOP_ADD; break;
+ case GL_FUNC_SUBTRACT: d3dBlendOp = D3DBLENDOP_SUBTRACT; break;
+ case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3DBLENDOP_REVSUBTRACT; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dBlendOp;
+}
+
+D3DSTENCILOP ConvertStencilOp(GLenum stencilOp)
+{
+ D3DSTENCILOP d3dStencilOp = D3DSTENCILOP_KEEP;
+
+ switch (stencilOp)
+ {
+ case GL_ZERO: d3dStencilOp = D3DSTENCILOP_ZERO; break;
+ case GL_KEEP: d3dStencilOp = D3DSTENCILOP_KEEP; break;
+ case GL_REPLACE: d3dStencilOp = D3DSTENCILOP_REPLACE; break;
+ case GL_INCR: d3dStencilOp = D3DSTENCILOP_INCRSAT; break;
+ case GL_DECR: d3dStencilOp = D3DSTENCILOP_DECRSAT; break;
+ case GL_INVERT: d3dStencilOp = D3DSTENCILOP_INVERT; break;
+ case GL_INCR_WRAP: d3dStencilOp = D3DSTENCILOP_INCR; break;
+ case GL_DECR_WRAP: d3dStencilOp = D3DSTENCILOP_DECR; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dStencilOp;
+}
+
+D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap)
+{
+ D3DTEXTUREADDRESS d3dWrap = D3DTADDRESS_WRAP;
+
+ switch (wrap)
+ {
+ case GL_REPEAT: d3dWrap = D3DTADDRESS_WRAP; break;
+ case GL_CLAMP_TO_EDGE: d3dWrap = D3DTADDRESS_CLAMP; break;
+ case GL_MIRRORED_REPEAT: d3dWrap = D3DTADDRESS_MIRROR; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dWrap;
+}
+
+D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace)
+{
+ D3DCULL cull = D3DCULL_CCW;
+ switch (cullFace)
+ {
+ case GL_FRONT:
+ cull = (frontFace == GL_CCW ? D3DCULL_CW : D3DCULL_CCW);
+ break;
+ case GL_BACK:
+ cull = (frontFace == GL_CCW ? D3DCULL_CCW : D3DCULL_CW);
+ break;
+ case GL_FRONT_AND_BACK:
+ cull = D3DCULL_NONE; // culling will be handled during draw
+ break;
+ default: UNREACHABLE();
+ }
+
+ return cull;
+}
+
+DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha)
+{
+ return (red ? D3DCOLORWRITEENABLE_RED : 0) |
+ (green ? D3DCOLORWRITEENABLE_GREEN : 0) |
+ (blue ? D3DCOLORWRITEENABLE_BLUE : 0) |
+ (alpha ? D3DCOLORWRITEENABLE_ALPHA : 0);
+}
+
+D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter)
+{
+ D3DTEXTUREFILTERTYPE d3dMagFilter = D3DTEXF_POINT;
+ switch (magFilter)
+ {
+ case GL_NEAREST: d3dMagFilter = D3DTEXF_POINT; break;
+ case GL_LINEAR: d3dMagFilter = D3DTEXF_LINEAR; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dMagFilter;
+}
+
+void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter)
+{
+ switch (minFilter)
+ {
+ case GL_NEAREST:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_NONE;
+ break;
+ case GL_LINEAR:
+ *d3dMinFilter = D3DTEXF_LINEAR;
+ *d3dMipFilter = D3DTEXF_NONE;
+ break;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_POINT;
+ break;
+ case GL_LINEAR_MIPMAP_NEAREST:
+ *d3dMinFilter = D3DTEXF_LINEAR;
+ *d3dMipFilter = D3DTEXF_POINT;
+ break;
+ case GL_NEAREST_MIPMAP_LINEAR:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_LINEAR;
+ break;
+ case GL_LINEAR_MIPMAP_LINEAR:
+ *d3dMinFilter = D3DTEXF_LINEAR;
+ *d3dMipFilter = D3DTEXF_LINEAR;
+ break;
+ default:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_NONE;
+ UNREACHABLE();
+ }
+}
+
+unsigned int GetStencilSize(D3DFORMAT stencilFormat)
+{
+ switch(stencilFormat)
+ {
+ case D3DFMT_D24FS8:
+ case D3DFMT_D24S8:
+ return 8;
+ case D3DFMT_D24X4S4:
+ return 4;
+ case D3DFMT_D15S1:
+ return 1;
+ case D3DFMT_D16_LOCKABLE:
+ case D3DFMT_D32:
+ case D3DFMT_D24X8:
+ case D3DFMT_D32F_LOCKABLE:
+ case D3DFMT_D16:
+ return 0;
+// case D3DFMT_D32_LOCKABLE: return 0; // DirectX 9Ex only
+// case D3DFMT_S8_LOCKABLE: return 8; // DirectX 9Ex only
+ default: UNREACHABLE();
+ }
+ return 0;
+}
+
+unsigned int GetAlphaSize(D3DFORMAT colorFormat)
+{
+ switch (colorFormat)
+ {
+ case D3DFMT_A16B16G16R16F:
+ return 16;
+ case D3DFMT_A32B32G32R32F:
+ return 32;
+ case D3DFMT_A2R10G10B10:
+ return 2;
+ case D3DFMT_A8R8G8B8:
+ return 8;
+ case D3DFMT_A1R5G5B5:
+ return 1;
+ case D3DFMT_X8R8G8B8:
+ case D3DFMT_R5G6B5:
+ return 0;
+ default: UNREACHABLE();
+ }
+ return 0;
+}
+
+unsigned int GetRedSize(D3DFORMAT colorFormat)
+{
+ switch (colorFormat)
+ {
+ case D3DFMT_A16B16G16R16F:
+ return 16;
+ case D3DFMT_A32B32G32R32F:
+ return 32;
+ case D3DFMT_A2R10G10B10:
+ return 10;
+ case D3DFMT_A8R8G8B8:
+ case D3DFMT_X8R8G8B8:
+ return 8;
+ case D3DFMT_A1R5G5B5:
+ case D3DFMT_R5G6B5:
+ return 5;
+ default: UNREACHABLE();
+ }
+ return 0;
+}
+
+unsigned int GetGreenSize(D3DFORMAT colorFormat)
+{
+ switch (colorFormat)
+ {
+ case D3DFMT_A16B16G16R16F:
+ return 16;
+ case D3DFMT_A32B32G32R32F:
+ return 32;
+ case D3DFMT_A2R10G10B10:
+ return 10;
+ case D3DFMT_A8R8G8B8:
+ case D3DFMT_X8R8G8B8:
+ return 8;
+ case D3DFMT_A1R5G5B5:
+ return 5;
+ case D3DFMT_R5G6B5:
+ return 6;
+ default: UNREACHABLE();
+ }
+ return 0;
+}
+
+unsigned int GetBlueSize(D3DFORMAT colorFormat)
+{
+ switch (colorFormat)
+ {
+ case D3DFMT_A16B16G16R16F:
+ return 16;
+ case D3DFMT_A32B32G32R32F:
+ return 32;
+ case D3DFMT_A2R10G10B10:
+ return 10;
+ case D3DFMT_A8R8G8B8:
+ case D3DFMT_X8R8G8B8:
+ return 8;
+ case D3DFMT_A1R5G5B5:
+ case D3DFMT_R5G6B5:
+ return 5;
+ default: UNREACHABLE();
+ }
+ return 0;
+}
+
+unsigned int GetDepthSize(D3DFORMAT depthFormat)
+{
+ switch (depthFormat)
+ {
+ case D3DFMT_D16_LOCKABLE: return 16;
+ case D3DFMT_D32: return 32;
+ case D3DFMT_D15S1: return 15;
+ case D3DFMT_D24S8: return 24;
+ case D3DFMT_D24X8: return 24;
+ case D3DFMT_D24X4S4: return 24;
+ case D3DFMT_D16: return 16;
+ case D3DFMT_D32F_LOCKABLE: return 32;
+ case D3DFMT_D24FS8: return 24;
+ //case D3DFMT_D32_LOCKABLE: return 32; // D3D9Ex only
+ //case D3DFMT_S8_LOCKABLE: return 0; // D3D9Ex only
+ default:
+ UNREACHABLE();
+ }
+ return 0;
+}
+
+bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,
+ D3DPRIMITIVETYPE *d3dPrimitiveType, int *d3dPrimitiveCount)
+{
+ switch (primitiveType)
+ {
+ case GL_POINTS:
+ *d3dPrimitiveType = D3DPT_POINTLIST;
+ *d3dPrimitiveCount = elementCount;
+ break;
+ case GL_LINES:
+ *d3dPrimitiveType = D3DPT_LINELIST;
+ *d3dPrimitiveCount = elementCount / 2;
+ break;
+ case GL_LINE_LOOP:
+ *d3dPrimitiveType = D3DPT_LINESTRIP;
+ *d3dPrimitiveCount = elementCount - 1; // D3D doesn't support line loops, so we draw the last line separately
+ break;
+ case GL_LINE_STRIP:
+ *d3dPrimitiveType = D3DPT_LINESTRIP;
+ *d3dPrimitiveCount = elementCount - 1;
+ break;
+ case GL_TRIANGLES:
+ *d3dPrimitiveType = D3DPT_TRIANGLELIST;
+ *d3dPrimitiveCount = elementCount / 3;
+ break;
+ case GL_TRIANGLE_STRIP:
+ *d3dPrimitiveType = D3DPT_TRIANGLESTRIP;
+ *d3dPrimitiveCount = elementCount - 2;
+ break;
+ case GL_TRIANGLE_FAN:
+ *d3dPrimitiveType = D3DPT_TRIANGLEFAN;
+ *d3dPrimitiveCount = elementCount - 2;
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+D3DFORMAT ConvertRenderbufferFormat(GLenum format)
+{
+ switch (format)
+ {
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8_OES: return D3DFMT_A8R8G8B8;
+ case GL_RGB565: return D3DFMT_R5G6B5;
+ case GL_RGB8_OES: return D3DFMT_X8R8G8B8;
+ case GL_DEPTH_COMPONENT16:
+ case GL_STENCIL_INDEX8:
+ case GL_DEPTH24_STENCIL8_OES: return D3DFMT_D24S8;
+ default: UNREACHABLE(); return D3DFMT_A8R8G8B8;
+ }
+}
+
+GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type)
+{
+ if (type == D3DMULTISAMPLE_NONMASKABLE)
+ return 0;
+ else
+ return type;
+}
+
+D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples)
+{
+ if (samples <= 1)
+ return D3DMULTISAMPLE_NONE;
+ else
+ return (D3DMULTISAMPLE_TYPE)samples;
+}
+
+}
+
+namespace dx2es
+{
+
+GLenum ConvertBackBufferFormat(D3DFORMAT format)
+{
+ switch (format)
+ {
+ case D3DFMT_A4R4G4B4: return GL_RGBA4;
+ case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
+ case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
+ case D3DFMT_R5G6B5: return GL_RGB565;
+ case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
+ default:
+ UNREACHABLE();
+ }
+
+ return GL_RGBA4;
+}
+
+GLenum ConvertDepthStencilFormat(D3DFORMAT format)
+{
+ switch (format)
+ {
+ case D3DFMT_D16:
+ case D3DFMT_D24X8:
+ return GL_DEPTH_COMPONENT16;
+ case D3DFMT_D24S8:
+ return GL_DEPTH24_STENCIL8_OES;
+ default:
+ UNREACHABLE();
+ }
+
+ return GL_DEPTH24_STENCIL8_OES;
+}
+
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h
new file mode 100644
index 0000000..85e8f26
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// utilities.h: Conversion functions and other utility routines.
+
+#ifndef LIBGLESV2_UTILITIES_H
+#define LIBGLESV2_UTILITIES_H
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <d3d9.h>
+
+namespace gl
+{
+
+struct Color;
+
+int UniformComponentCount(GLenum type);
+GLenum UniformComponentType(GLenum type);
+size_t UniformTypeSize(GLenum type);
+int VariableRowCount(GLenum type);
+int VariableColumnCount(GLenum type);
+
+int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
+
+int ComputePixelSize(GLenum format, GLenum type);
+GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment);
+GLsizei ComputeCompressedPitch(GLsizei width, GLenum format);
+GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format);
+bool IsCompressed(GLenum format);
+bool IsCubemapTextureTarget(GLenum target);
+bool IsTextureTarget(GLenum target);
+bool CheckTextureFormatType(GLenum format, GLenum type);
+
+bool IsColorRenderable(GLenum internalformat);
+bool IsDepthRenderable(GLenum internalformat);
+bool IsStencilRenderable(GLenum internalformat);
+
+}
+
+namespace es2dx
+{
+
+D3DCMPFUNC ConvertComparison(GLenum comparison);
+D3DCOLOR ConvertColor(gl::Color color);
+D3DBLEND ConvertBlendFunc(GLenum blend);
+D3DBLENDOP ConvertBlendOp(GLenum blendOp);
+D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
+D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap);
+D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace);
+DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
+D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter);
+void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter);
+unsigned int GetAlphaSize(D3DFORMAT colorFormat);
+unsigned int GetRedSize(D3DFORMAT colorFormat);
+unsigned int GetGreenSize(D3DFORMAT colorFormat);
+unsigned int GetBlueSize(D3DFORMAT colorFormat);
+unsigned int GetDepthSize(D3DFORMAT depthFormat);
+unsigned int GetStencilSize(D3DFORMAT stencilFormat);
+bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,
+ D3DPRIMITIVETYPE *d3dPrimitiveType, int *d3dPrimitiveCount);
+D3DFORMAT ConvertRenderbufferFormat(GLenum format);
+D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples);
+GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type);
+
+}
+
+namespace dx2es
+{
+
+GLenum ConvertBackBufferFormat(D3DFORMAT format);
+GLenum ConvertDepthStencilFormat(D3DFORMAT format);
+
+}
+
+#endif // LIBGLESV2_UTILITIES_H
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/LICENSE.txt b/src/3rdparty/webkit/Source/ThirdParty/glu/LICENSE.txt
new file mode 100644
index 0000000..e58ae38
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/LICENSE.txt
@@ -0,0 +1,31 @@
+SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+
+Copyright (C) [dates of first publication] Silicon Graphics, Inc. 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, 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 including the dates of first publication
+and either this permission notice or a reference to HYPERLINK
+"http://oss.sgi.com/projects/FreeB/"http://oss.sgi.com/projects/FreeB/
+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 SILICON GRAPHICS, INC. 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.
+
+Except as contained in this notice, the name of Silicon Graphics,
+Inc. shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from Silicon Graphics, Inc.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/README.webkit b/src/3rdparty/webkit/Source/ThirdParty/glu/README.webkit
new file mode 100644
index 0000000..5941f4b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/README.webkit
@@ -0,0 +1,42 @@
+This is a nearly verbatim copy of the GLU tessellator source code from
+SGI's OpenGL Sample Implementation at
+http://oss.sgi.com/projects/ogl-sample/ . Per
+http://oss.sgi.com/projects/FreeB/ , the code is covered under the SGI
+Free Software License B, version 2.0, a copy of which is in
+LICENSE.txt in this directory.
+
+The following changes were made in order to incorporate this code:
+
+ - The addition of a simplified gluos.h to eliminate operating system
+ dependencies.
+
+ - The removal of inclusion of GL/glu.h and replacement with an
+ include of internal_glu.h.
+
+ - Includes were modified to be scoped within ThirdParty/glu/ and
+ ThirdParty/glu/libtess/.
+
+ - The entry points to the tessellator were prefixed with internal_
+ to avoid symbol collisions with any host OS version of GLU.
+
+ - In tess.c, the obsolete entry points gluBeginPolygon,
+ gluNextContour and gluEndPolygon in tess.c were #if 0'd out.
+ Default branches were added to the switch statements in GotoState.
+
+ - In memalloc.h, the include of malloc.h was changed to an include
+ of stdlib.h.
+
+ - In normal.c, an unused variable "w" was removed from
+ __gl_projectPolygon. #if guards were placed around the definition
+ of the unused Normalize function.
+
+ - In priorityq-heap.c, an #include of <limits.h> was added.
+
+ - In sweep.c, IsWindingInside() was given a return value to silence a
+ warning-as-error in release builds.
+
+ - In sweep.c, DoneEdgeDict()'s fixedEdges was wrapped in #indef NDEBUG, to
+ silence a warning-as-error in release builds.
+
+ - In priorityq.c, render.c, and others: the construct "if(1)...else" was
+ replaced with "do{...}while(1)" to silence a warning-as-error in Mac builds.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/glu.gyp b/src/3rdparty/webkit/Source/ThirdParty/glu/glu.gyp
new file mode 100644
index 0000000..c9ddb77
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/glu.gyp
@@ -0,0 +1,36 @@
+{
+ 'targets': [{
+ 'target_name': 'libtess',
+ 'type': '<(library)',
+ 'include_dirs': [
+ '../..',
+ ],
+ 'sources': [
+ 'gluos.h',
+ 'internal_glu.h',
+ 'libtess/dict-list.h',
+ 'libtess/dict.c',
+ 'libtess/dict.h',
+ 'libtess/geom.c',
+ 'libtess/geom.h',
+ 'libtess/memalloc.c',
+ 'libtess/memalloc.h',
+ 'libtess/mesh.c',
+ 'libtess/mesh.h',
+ 'libtess/normal.c',
+ 'libtess/normal.h',
+ 'libtess/priorityq-heap.h',
+ 'libtess/priorityq-sort.h',
+ 'libtess/priorityq.c',
+ 'libtess/priorityq.h',
+ 'libtess/render.c',
+ 'libtess/render.h',
+ 'libtess/sweep.c',
+ 'libtess/sweep.h',
+ 'libtess/tess.c',
+ 'libtess/tess.h',
+ 'libtess/tessmono.c',
+ 'libtess/tessmono.h',
+ ],
+ }],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/gluos.h b/src/3rdparty/webkit/Source/ThirdParty/glu/gluos.h
new file mode 100644
index 0000000..6380cb2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/gluos.h
@@ -0,0 +1,48 @@
+/*
+ * 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 GLUOS_H_
+#define GLUOS_H_
+
+// This header provides the minimal definitions needed to compile the
+// GLU tessellator sources.
+#define GLAPIENTRY
+
+typedef unsigned char GLboolean;
+typedef double GLdouble;
+typedef unsigned int GLenum;
+typedef float GLfloat;
+typedef void GLvoid;
+
+#undef MIN
+#undef MAX
+
+#endif // GLUOS_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/internal_glu.h b/src/3rdparty/webkit/Source/ThirdParty/glu/internal_glu.h
new file mode 100644
index 0000000..4c0e863
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/internal_glu.h
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+// This header is a skeleton substitute for GL/glu.h which contains
+// only the definitions, constants and function declarations necessary
+// to compile the GLU tessellator.
+
+#ifndef INTERNAL_GLU_H_
+#define INTERNAL_GLU_H_
+
+#include "ThirdParty/glu/gluos.h"
+
+/* Primitives */
+#define GL_LINE_LOOP 0x0002
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* ErrorCode */
+#define GLU_INVALID_ENUM 100900
+#define GLU_INVALID_VALUE 100901
+#define GLU_OUT_OF_MEMORY 100902
+
+/* TessCallback */
+#define GLU_TESS_BEGIN 100100
+#define GLU_BEGIN 100100
+#define GLU_TESS_VERTEX 100101
+#define GLU_VERTEX 100101
+#define GLU_TESS_END 100102
+#define GLU_END 100102
+#define GLU_TESS_ERROR 100103
+#define GLU_TESS_EDGE_FLAG 100104
+#define GLU_EDGE_FLAG 100104
+#define GLU_TESS_COMBINE 100105
+#define GLU_TESS_BEGIN_DATA 100106
+#define GLU_TESS_VERTEX_DATA 100107
+#define GLU_TESS_END_DATA 100108
+#define GLU_TESS_ERROR_DATA 100109
+#define GLU_TESS_EDGE_FLAG_DATA 100110
+#define GLU_TESS_COMBINE_DATA 100111
+
+/* TessContour */
+#define GLU_CW 100120
+#define GLU_CCW 100121
+#define GLU_INTERIOR 100122
+#define GLU_EXTERIOR 100123
+#define GLU_UNKNOWN 100124
+
+/* TessProperty */
+#define GLU_TESS_WINDING_RULE 100140
+#define GLU_TESS_BOUNDARY_ONLY 100141
+#define GLU_TESS_TOLERANCE 100142
+
+/* TessError */
+#define GLU_TESS_ERROR1 100151
+#define GLU_TESS_ERROR2 100152
+#define GLU_TESS_ERROR3 100153
+#define GLU_TESS_ERROR4 100154
+#define GLU_TESS_ERROR5 100155
+#define GLU_TESS_ERROR6 100156
+#define GLU_TESS_ERROR7 100157
+#define GLU_TESS_ERROR8 100158
+#define GLU_TESS_MISSING_BEGIN_POLYGON 100151
+#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
+#define GLU_TESS_MISSING_END_POLYGON 100153
+#define GLU_TESS_MISSING_END_CONTOUR 100154
+#define GLU_TESS_COORD_TOO_LARGE 100155
+#define GLU_TESS_NEED_COMBINE_CALLBACK 100156
+
+/* TessWinding */
+#define GLU_TESS_WINDING_ODD 100130
+#define GLU_TESS_WINDING_NONZERO 100131
+#define GLU_TESS_WINDING_POSITIVE 100132
+#define GLU_TESS_WINDING_NEGATIVE 100133
+#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
+
+#define GLU_TESS_MAX_COORD 1.0e150
+
+typedef struct GLUtesselator GLUtesselator;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern GLUtesselator * GLAPIENTRY internal_gluNewTess(void);
+extern void GLAPIENTRY internal_gluDeleteTess(GLUtesselator *tess);
+extern void GLAPIENTRY internal_gluTessProperty(GLUtesselator *tess,
+ GLenum which,
+ GLdouble value);
+extern void GLAPIENTRY internal_gluGetTessProperty(GLUtesselator *tess,
+ GLenum which,
+ GLdouble *value);
+extern void GLAPIENTRY internal_gluTessNormal(GLUtesselator *tess,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z);
+extern void GLAPIENTRY internal_gluTessCallback(GLUtesselator *tess,
+ GLenum which,
+ void (GLAPIENTRY *fn)());
+extern void GLAPIENTRY internal_gluTessVertex(GLUtesselator *tess,
+ GLdouble coords[3],
+ void *data);
+extern void GLAPIENTRY internal_gluTessBeginPolygon(GLUtesselator *tess,
+ void *data);
+extern void GLAPIENTRY internal_gluTessBeginContour(GLUtesselator *tess);
+extern void GLAPIENTRY internal_gluTessEndContour(GLUtesselator *tess);
+extern void GLAPIENTRY internal_gluTessEndPolygon(GLUtesselator *tess);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INTERNAL_GLU_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/GNUmakefile b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/GNUmakefile
new file mode 100644
index 0000000..0ae859f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/GNUmakefile
@@ -0,0 +1,110 @@
+#!gmake
+#
+# License Applicability. Except to the extent portions of this file are
+# made subject to an alternative license as permitted in the SGI Free
+# Software License B, Version 1.1 (the "License"), the contents of this
+# file are subject only to the provisions of the License. You may not use
+# this file except in compliance with the License. You may obtain a copy
+# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+#
+# http://oss.sgi.com/projects/FreeB
+#
+# Note that, as provided in the License, the Software is distributed on an
+# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+#
+# Original Code. The Original Code is: OpenGL Sample Implementation,
+# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+# Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+# Copyright in any portions created by third parties is as indicated
+# elsewhere herein. All Rights Reserved.
+#
+# Additional Notice Provisions: The application programming interfaces
+# established by SGI in conjunction with the Original Code are The
+# OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+# April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+# 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+# Window System(R) (Version 1.3), released October 19, 1998. This software
+# was created using the OpenGL(R) version 1.2.1 Sample Implementation
+# published by SGI, but has not been independently verified as being
+# compliant with the OpenGL(R) version 1.2.1 Specification.
+#
+# $Date$ $Revision$
+# $Header: //depot/main/gfx/lib/glu/libtess/GNUmakefile#9 $
+
+OBJECT_STYLE = N32
+
+include $(ROOT)/usr/include/make/commondefs
+
+TARGET = libtess.a
+
+TARGETS = $(TARGET)
+
+LCINCS = -I../include
+
+# Compilation flags:
+#
+# -DNDEBUG is for the production code; it removes all assertion checks
+# (note that <assert.h> looks at this symbol).
+#
+# -DNO_MALLOPT uses regular malloc instead of the mallopt() version.
+# ***** Unless you use this flag, you must use "-lmalloc" to link
+# ***** your application!
+#
+# -DMEMORY_DEBUG turns on the M_DEBUG option of mallopt; this can
+# increase the running time a LOT.
+#
+# -DGLU_TESS_API_FLOAT compiles a single-precision version of the library.
+#
+# -float prevents automatic promotion to double precision; this will produce
+# faster code when compiled with -DGLU_TESS_API_FLOAT.
+#
+# -DNO_BRANCH_CONDITIONS uses & and | instead of && and || on a couple
+# of heavily-used tests (VertEq and VertLeq); some compilers can generate
+# better code with these (use special instructions to avoid branching).
+#
+# -DFOR_TRITE_TEST_PROGRAM is *only* for use with the test program called
+# "trite". It uses some variables which are defined by the test program,
+# so you won't be able to link it with anything else.
+
+HFILES = \
+ dict.h \
+ dict-list.h \
+ geom.h \
+ memalloc.h \
+ mesh.h \
+ normal.h \
+ priorityq-heap.h \
+ priorityq-heap.c \
+ priorityq-sort.h \
+ priorityq.h \
+ render.h \
+ sweep.h \
+ tess.h \
+ tessmono.h \
+ $(NULL)
+
+CFILES = \
+ dict.c \
+ geom.c \
+ memalloc.c \
+ mesh.c \
+ normal.c \
+ priorityq.c \
+ render.c \
+ sweep.c \
+ tess.c \
+ tessmono.c \
+ $(NULL)
+
+default libs libs_install install: $(TARGET)
+
+headers headers_install apps:
+
+$(TARGET): $(OBJECTS)
+ $(AR) crl $@ $(OBJECTS);
+
+include $(COMMONRULES)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/Imakefile b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/Imakefile
new file mode 100644
index 0000000..fb99ce2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/Imakefile
@@ -0,0 +1,61 @@
+XCOMM License Applicability. Except to the extent portions of this file are
+XCOMM made subject to an alternative license as permitted in the SGI Free
+XCOMM Software License B, Version 1.1 (the "License"), the contents of this
+XCOMM file are subject only to the provisions of the License. You may not use
+XCOMM this file except in compliance with the License. You may obtain a copy
+XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+XCOMM
+XCOMM http://oss.sgi.com/projects/FreeB
+XCOMM
+XCOMM Note that, as provided in the License, the Software is distributed on an
+XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+XCOMM
+XCOMM Original Code. The Original Code is: OpenGL Sample Implementation,
+XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+XCOMM Copyright in any portions created by third parties is as indicated
+XCOMM elsewhere herein. All Rights Reserved.
+XCOMM
+XCOMM Additional Notice Provisions: The application programming interfaces
+XCOMM established by SGI in conjunction with the Original Code are The
+XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software
+XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation
+XCOMM published by SGI, but has not been independently verified as being
+XCOMM compliant with the OpenGL(R) version 1.2.1 Specification.
+XCOMM
+
+#include <Library.tmpl>
+
+OBJS = \
+ dict.o \
+ geom.o \
+ memalloc.o \
+ mesh.o \
+ normal.o \
+ priorityq.o \
+ render.o \
+ sweep.o \
+ tess.o \
+ tessmono.o
+
+INCLUDES = \
+ -I../include \
+ -I$(TOP)/include \
+ -I$(TOP)/include/GL
+
+DEFINES = \
+ -DNDEBUG
+
+NormalLibraryObjectRule()
+
+NormalLibraryTarget(tess, $(OBJS))
+
+DependTarget()
+CleanTarget()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/README b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/README
new file mode 100644
index 0000000..59f4ff2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/README
@@ -0,0 +1,447 @@
+/*
+** $Header: /cvs/projects/ogl-sample/main/gfx/lib/glu/libtess/README,v 1.1 2000/04/26 05:53:59 ljp Exp $
+*/
+
+General Polygon Tesselation
+---------------------------
+
+ This note describes a tesselator for polygons consisting of one or
+ more closed contours. It is backward-compatible with the current
+ OpenGL Utilities tesselator, and is intended to replace it. Here is
+ a summary of the major differences:
+
+ - input contours can be intersecting, self-intersecting, or degenerate.
+
+ - supports a choice of several winding rules for determining which parts
+ of the polygon are on the "interior". This makes it possible to do
+ CSG operations on polygons.
+
+ - boundary extraction: instead of tesselating the polygon, returns a
+ set of closed contours which separate the interior from the exterior.
+
+ - returns the output as a small number of triangle fans and strips,
+ rather than a list of independent triangles (when possible).
+
+ - output is available as an explicit mesh (a quad-edge structure),
+ in addition to the normal callback interface.
+
+ - the algorithm used is extremely robust.
+
+
+The interface
+-------------
+
+ The tesselator state is maintained in a "tesselator object".
+ These are allocated and destroyed using
+
+ GLUtesselator *gluNewTess( void );
+ void gluDeleteTess( GLUtesselator *tess );
+
+ Several tesselator objects may be used simultaneously.
+
+ Inputs
+ ------
+
+ The input contours are specified with the following routines:
+
+ void gluTessBeginPolygon( GLUtesselator *tess );
+ void gluTessBeginContour( GLUtesselator *tess );
+ void gluTessVertex( GLUtesselator *tess, GLUcoord coords[3], void *data );
+ void gluTessEndContour( GLUtesselator *tess );
+ void gluTessEndPolygon( GLUtesselator *tess );
+
+ Within each BeginPolygon/EndPolygon pair, there can be zero or more
+ calls to BeginContour/EndContour. Within each contour, there are zero
+ or more calls to gluTessVertex(). The vertices specify a closed
+ contour (the last vertex of each contour is automatically linked to
+ the first).
+
+ "coords" give the coordinates of the vertex in 3-space. For useful
+ results, all vertices should lie in some plane, since the vertices
+ are projected onto a plane before tesselation. "data" is a pointer
+ to a user-defined vertex structure, which typically contains other
+ information such as color, texture coordinates, normal, etc. It is
+ used to refer to the vertex during rendering.
+
+ The library can be compiled in single- or double-precision; the type
+ GLUcoord represents either "float" or "double" accordingly. The GLU
+ version will be available in double-precision only. Compile with
+ GLU_TESS_API_FLOAT defined to get the single-precision version.
+
+ When EndPolygon is called, the tesselation algorithm determines
+ which regions are interior to the given contours, according to one
+ of several "winding rules" described below. The interior regions
+ are then tesselated, and the output is provided as callbacks.
+
+
+ Rendering Callbacks
+ -------------------
+
+ Callbacks are specified by the client using
+
+ void gluTessCallback( GLUtesselator *tess, GLenum which, void (*fn)());
+
+ If "fn" is NULL, any previously defined callback is discarded.
+
+ The callbacks used to provide output are: /* which == */
+
+ void begin( GLenum type ); /* GLU_TESS_BEGIN */
+ void edgeFlag( GLboolean flag ); /* GLU_TESS_EDGE_FLAG */
+ void vertex( void *data ); /* GLU_TESS_VERTEX */
+ void end( void ); /* GLU_TESS_END */
+
+ Any of the callbacks may be left undefined; if so, the corresponding
+ information will not be supplied during rendering.
+
+ The "begin" callback indicates the start of a primitive; type is one
+ of GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, or GL_TRIANGLES (but see the
+ notes on "boundary extraction" below).
+
+ It is followed by any number of "vertex" callbacks, which supply the
+ vertices in the same order as expected by the corresponding glBegin()
+ call. After the last vertex of a given primitive, there is a callback
+ to "end".
+
+ If the "edgeFlag" callback is provided, no triangle fans or strips
+ will be used. When edgeFlag is called, if "flag" is GL_TRUE then each
+ vertex which follows begins an edge which lies on the polygon boundary
+ (ie. an edge which separates an interior region from an exterior one).
+ If "flag" is GL_FALSE, each vertex which follows begins an edge which lies
+ in the polygon interior. "edgeFlag" will be called before the first
+ call to "vertex".
+
+ Other Callbacks
+ ---------------
+
+ void mesh( GLUmesh *mesh ); /* GLU_TESS_MESH */
+
+ - Returns an explicit mesh, represented using the quad-edge structure
+ (Guibas/Stolfi '85). Other implementations of this interface might
+ use a different mesh structure, so this is available only only as an
+ SGI extension. When the mesh is no longer needed, it should be freed
+ using
+
+ void gluDeleteMesh( GLUmesh *mesh );
+
+ There is a brief description of this data structure in the include
+ file "mesh.h". For the full details, see L. Guibas and J. Stolfi,
+ Primitives for the manipulation of general subdivisions and the
+ computation of Voronoi diagrams, ACM Transactions on Graphics,
+ 4(2):74-123, April 1985. For an introduction, see the course notes
+ for CS348a, "Mathematical Foundations of Computer Graphics",
+ available at the Stanford bookstore (and taught during the fall
+ quarter).
+
+ void error( GLenum errno ); /* GLU_TESS_ERROR */
+
+ - errno is one of GLU_TESS_MISSING_BEGIN_POLYGON,
+ GLU_TESS_MISSING_END_POLYGON,
+ GLU_TESS_MISSING_BEGIN_CONTOUR,
+ GLU_TESS_MISSING_END_CONTOUR,
+ GLU_TESS_COORD_TOO_LARGE,
+ GLU_TESS_NEED_COMBINE_CALLBACK
+
+ The first four are obvious. The interface recovers from these
+ errors by inserting the missing call(s).
+
+ GLU_TESS_COORD_TOO_LARGE says that some vertex coordinate exceeded
+ the predefined constant GLU_TESS_MAX_COORD in absolute value, and
+ that the value has been clamped. (Coordinate values must be small
+ enough so that two can be multiplied together without overflow.)
+
+ GLU_TESS_NEED_COMBINE_CALLBACK says that the algorithm detected an
+ intersection between two edges in the input data, and the "combine"
+ callback (below) was not provided. No output will be generated.
+
+
+ void combine( GLUcoord coords[3], void *data[4], /* GLU_TESS_COMBINE */
+ GLUcoord weight[4], void **outData );
+
+ - When the algorithm detects an intersection, or wishes to merge
+ features, it needs to create a new vertex. The vertex is defined
+ as a linear combination of up to 4 existing vertices, referenced
+ by data[0..3]. The coefficients of the linear combination are
+ given by weight[0..3]; these weights always sum to 1.0. All vertex
+ pointers are valid even when some of the weights are zero.
+ "coords" gives the location of the new vertex.
+
+ The user must allocate another vertex, interpolate parameters
+ using "data" and "weights", and return the new vertex pointer in
+ "outData". This handle is supplied during rendering callbacks.
+ For example, if the polygon lies in an arbitrary plane in 3-space,
+ and we associate a color with each vertex, the combine callback might
+ look like this:
+
+ void myCombine( GLUcoord coords[3], VERTEX *d[4],
+ GLUcoord w[4], VERTEX **dataOut )
+ {
+ VERTEX *new = new_vertex();
+
+ new->x = coords[0];
+ new->y = coords[1];
+ new->z = coords[2];
+ new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r;
+ new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g;
+ new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b;
+ new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a;
+ *dataOut = new;
+ }
+
+ If the algorithm detects an intersection, then the "combine" callback
+ must be defined, and must write a non-NULL pointer into "dataOut".
+ Otherwise the GLU_TESS_NEED_COMBINE_CALLBACK error occurs, and no
+ output is generated. This is the only error that can occur during
+ tesselation and rendering.
+
+
+ Control over Tesselation
+ ------------------------
+
+ void gluTessProperty( GLUtesselator *tess, GLenum which, GLUcoord value );
+
+ Properties defined:
+
+ - GLU_TESS_WINDING_RULE. Possible values:
+
+ GLU_TESS_WINDING_ODD
+ GLU_TESS_WINDING_NONZERO
+ GLU_TESS_WINDING_POSITIVE
+ GLU_TESS_WINDING_NEGATIVE
+ GLU_TESS_WINDING_ABS_GEQ_TWO
+
+ The input contours parition the plane into regions. A winding
+ rule determines which of these regions are inside the polygon.
+
+ For a single contour C, the winding number of a point x is simply
+ the signed number of revolutions we make around x as we travel
+ once around C (where CCW is positive). When there are several
+ contours, the individual winding numbers are summed. This
+ procedure associates a signed integer value with each point x in
+ the plane. Note that the winding number is the same for all
+ points in a single region.
+
+ The winding rule classifies a region as "inside" if its winding
+ number belongs to the chosen category (odd, nonzero, positive,
+ negative, or absolute value of at least two). The current GLU
+ tesselator implements the "odd" rule. The "nonzero" rule is another
+ common way to define the interior. The other three rules are
+ useful for polygon CSG operations (see below).
+
+ - GLU_TESS_BOUNDARY_ONLY. Values: TRUE (non-zero) or FALSE (zero).
+
+ If TRUE, returns a set of closed contours which separate the
+ polygon interior and exterior (rather than a tesselation).
+ Exterior contours are oriented CCW with respect to the normal,
+ interior contours are oriented CW. The GLU_TESS_BEGIN callback
+ uses the type GL_LINE_LOOP for each contour.
+
+ - GLU_TESS_TOLERANCE. Value: a real number between 0.0 and 1.0.
+
+ This specifies a tolerance for merging features to reduce the size
+ of the output. For example, two vertices which are very close to
+ each other might be replaced by a single vertex. The tolerance
+ is multiplied by the largest coordinate magnitude of any input vertex;
+ this specifies the maximum distance that any feature can move as the
+ result of a single merge operation. If a single feature takes part
+ in several merge operations, the total distance moved could be larger.
+
+ Feature merging is completely optional; the tolerance is only a hint.
+ The implementation is free to merge in some cases and not in others,
+ or to never merge features at all. The default tolerance is zero.
+
+ The current implementation merges vertices only if they are exactly
+ coincident, regardless of the current tolerance. A vertex is
+ spliced into an edge only if the implementation is unable to
+ distinguish which side of the edge the vertex lies on.
+ Two edges are merged only when both endpoints are identical.
+
+
+ void gluTessNormal( GLUtesselator *tess,
+ GLUcoord x, GLUcoord y, GLUcoord z )
+
+ - Lets the user supply the polygon normal, if known. All input data
+ is projected into a plane perpendicular to the normal before
+ tesselation. All output triangles are oriented CCW with
+ respect to the normal (CW orientation can be obtained by
+ reversing the sign of the supplied normal). For example, if
+ you know that all polygons lie in the x-y plane, call
+ "gluTessNormal(tess, 0.0, 0.0, 1.0)" before rendering any polygons.
+
+ - If the supplied normal is (0,0,0) (the default value), the
+ normal is determined as follows. The direction of the normal,
+ up to its sign, is found by fitting a plane to the vertices,
+ without regard to how the vertices are connected. It is
+ expected that the input data lies approximately in plane;
+ otherwise projection perpendicular to the computed normal may
+ substantially change the geometry. The sign of the normal is
+ chosen so that the sum of the signed areas of all input contours
+ is non-negative (where a CCW contour has positive area).
+
+ - The supplied normal persists until it is changed by another
+ call to gluTessNormal.
+
+
+ Backward compatibility with the GLU tesselator
+ ----------------------------------------------
+
+ The preferred interface is the one described above. The following
+ routines are obsolete, and are provided only for backward compatibility:
+
+ typedef GLUtesselator GLUtriangulatorObj; /* obsolete name */
+
+ void gluBeginPolygon( GLUtesselator *tess );
+ void gluNextContour( GLUtesselator *tess, GLenum type );
+ void gluEndPolygon( GLUtesselator *tess );
+
+ "type" is one of GLU_EXTERIOR, GLU_INTERIOR, GLU_CCW, GLU_CW, or
+ GLU_UNKNOWN. It is ignored by the current GLU tesselator.
+
+ GLU_BEGIN, GLU_VERTEX, GLU_END, GLU_ERROR, and GLU_EDGE_FLAG are defined
+ as synonyms for GLU_TESS_BEGIN, GLU_TESS_VERTEX, GLU_TESS_END,
+ GLU_TESS_ERROR, and GLU_TESS_EDGE_FLAG.
+
+
+Polygon CSG operations
+----------------------
+
+ The features of the tesselator make it easy to find the union, difference,
+ or intersection of several polygons.
+
+ First, assume that each polygon is defined so that the winding number
+ is 0 for each exterior region, and 1 for each interior region. Under
+ this model, CCW contours define the outer boundary of the polygon, and
+ CW contours define holes. Contours may be nested, but a nested
+ contour must be oriented oppositely from the contour that contains it.
+
+ If the original polygons do not satisfy this description, they can be
+ converted to this form by first running the tesselator with the
+ GLU_TESS_BOUNDARY_ONLY property turned on. This returns a list of
+ contours satisfying the restriction above. By allocating two
+ tesselator objects, the callbacks from one tesselator can be fed
+ directly to the input of another.
+
+ Given two or more polygons of the form above, CSG operations can be
+ implemented as follows:
+
+ Union
+ Draw all the input contours as a single polygon. The winding number
+ of each resulting region is the number of original polygons
+ which cover it. The union can be extracted using the
+ GLU_TESS_WINDING_NONZERO or GLU_TESS_WINDING_POSITIVE winding rules.
+ Note that with the nonzero rule, we would get the same result if
+ all contour orientations were reversed.
+
+ Intersection (two polygons at a time only)
+ Draw a single polygon using the contours from both input polygons.
+ Extract the result using GLU_TESS_WINDING_ABS_GEQ_TWO. (Since this
+ winding rule looks at the absolute value, reversing all contour
+ orientations does not change the result.)
+
+ Difference
+
+ Suppose we want to compute A \ (B union C union D). Draw a single
+ polygon consisting of the unmodified contours from A, followed by
+ the contours of B,C,D with the vertex order reversed (this changes
+ the winding number of the interior regions to -1). To extract the
+ result, use the GLU_TESS_WINDING_POSITIVE rule.
+
+ If B,C,D are the result of a GLU_TESS_BOUNDARY_ONLY call, an
+ alternative to reversing the vertex order is to reverse the sign of
+ the supplied normal. For example in the x-y plane, call
+ gluTessNormal( tess, 0.0, 0.0, -1.0 ).
+
+
+Performance
+-----------
+
+ The tesselator is not intended for immediate-mode rendering; when
+ possible the output should be cached in a user structure or display
+ list. General polygon tesselation is an inherently difficult problem,
+ especially given the goal of extreme robustness.
+
+ The implementation makes an effort to output a small number of fans
+ and strips; this should improve the rendering performance when the
+ output is used in a display list.
+
+ Single-contour input polygons are first tested to see whether they can
+ be rendered as a triangle fan with respect to the first vertex (to
+ avoid running the full decomposition algorithm on convex polygons).
+ Non-convex polygons may be rendered by this "fast path" as well, if
+ the algorithm gets lucky in its choice of a starting vertex.
+
+ For best performance follow these guidelines:
+
+ - supply the polygon normal, if available, using gluTessNormal().
+ This represents about 10% of the computation time. For example,
+ if all polygons lie in the x-y plane, use gluTessNormal(tess,0,0,1).
+
+ - render many polygons using the same tesselator object, rather than
+ allocating a new tesselator for each one. (In a multi-threaded,
+ multi-processor environment you may get better performance using
+ several tesselators.)
+
+
+Comparison with the GLU tesselator
+----------------------------------
+
+ On polygons which make it through the "fast path", the tesselator is
+ 3 to 5 times faster than the GLU tesselator.
+
+ On polygons which don't make it through the fast path (but which don't
+ have self-intersections or degeneracies), it is about 2 times slower.
+
+ On polygons with self-intersections or degeneraces, there is nothing
+ to compare against.
+
+ The new tesselator generates many more fans and strips, reducing the
+ number of vertices that need to be sent to the hardware.
+
+ Key to the statistics:
+
+ vert number of input vertices on all contours
+ cntr number of input contours
+ tri number of triangles in all output primitives
+ strip number of triangle strips
+ fan number of triangle fans
+ ind number of independent triangles
+ ms number of milliseconds for tesselation
+ (on a 150MHz R4400 Indy)
+
+ Convex polygon examples:
+
+New: 3 vert, 1 cntr, 1 tri, 0 strip, 0 fan, 1 ind, 0.0459 ms
+Old: 3 vert, 1 cntr, 1 tri, 0 strip, 0 fan, 1 ind, 0.149 ms
+New: 4 vert, 1 cntr, 2 tri, 0 strip, 1 fan, 0 ind, 0.0459 ms
+Old: 4 vert, 1 cntr, 2 tri, 0 strip, 0 fan, 2 ind, 0.161 ms
+New: 36 vert, 1 cntr, 34 tri, 0 strip, 1 fan, 0 ind, 0.153 ms
+Old: 36 vert, 1 cntr, 34 tri, 0 strip, 0 fan, 34 ind, 0.621 ms
+
+ Concave single-contour polygons:
+
+New: 5 vert, 1 cntr, 3 tri, 0 strip, 1 fan, 0 ind, 0.052 ms
+Old: 5 vert, 1 cntr, 3 tri, 0 strip, 0 fan, 3 ind, 0.252 ms
+New: 19 vert, 1 cntr, 17 tri, 2 strip, 2 fan, 1 ind, 0.911 ms
+Old: 19 vert, 1 cntr, 17 tri, 0 strip, 0 fan, 17 ind, 0.529 ms
+New: 151 vert, 1 cntr, 149 tri, 13 strip, 18 fan, 3 ind, 6.82 ms
+Old: 151 vert, 1 cntr, 149 tri, 0 strip, 3 fan, 143 ind, 2.7 ms
+New: 574 vert, 1 cntr, 572 tri, 59 strip, 54 fan, 11 ind, 26.6 ms
+Old: 574 vert, 1 cntr, 572 tri, 0 strip, 31 fan, 499 ind, 12.4 ms
+
+ Multiple contours, but no intersections:
+
+New: 7 vert, 2 cntr, 7 tri, 1 strip, 0 fan, 0 ind, 0.527 ms
+Old: 7 vert, 2 cntr, 7 tri, 0 strip, 0 fan, 7 ind, 0.274 ms
+New: 81 vert, 6 cntr, 89 tri, 9 strip, 7 fan, 6 ind, 3.88 ms
+Old: 81 vert, 6 cntr, 89 tri, 0 strip, 13 fan, 61 ind, 2.2 ms
+New: 391 vert, 19 cntr, 413 tri, 37 strip, 32 fan, 26 ind, 20.2 ms
+Old: 391 vert, 19 cntr, 413 tri, 0 strip, 25 fan, 363 ind, 8.68 ms
+
+ Self-intersecting and degenerate examples:
+
+Bowtie: 4 vert, 1 cntr, 2 tri, 0 strip, 0 fan, 2 ind, 0.483 ms
+Star: 5 vert, 1 cntr, 5 tri, 0 strip, 0 fan, 5 ind, 0.91 ms
+Random: 24 vert, 7 cntr, 46 tri, 2 strip, 12 fan, 7 ind, 5.32 ms
+Font: 333 vert, 2 cntr, 331 tri, 32 strip, 16 fan, 3 ind, 14.1 ms
+: 167 vert, 35 cntr, 254 tri, 8 strip, 56 fan, 52 ind, 46.3 ms
+: 78 vert, 1 cntr, 2675 tri, 148 strip, 207 fan, 180 ind, 243 ms
+: 12480 vert, 2 cntr, 12478 tri, 736 strip,1275 fan, 5 ind, 1010 ms
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/alg-outline b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/alg-outline
new file mode 100644
index 0000000..91ed7f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/alg-outline
@@ -0,0 +1,229 @@
+/*
+** $Header: /cvs/projects/ogl-sample/main/gfx/lib/glu/libtess/alg-outline,v 1.1 2000/04/26 05:53:59 ljp Exp $
+*/
+
+This is only a very brief overview. There is quite a bit of
+additional documentation in the source code itself.
+
+
+Goals of robust tesselation
+---------------------------
+
+The tesselation algorithm is fundamentally a 2D algorithm. We
+initially project all data into a plane; our goal is to robustly
+tesselate the projected data. The same topological tesselation is
+then applied to the input data.
+
+Topologically, the output should always be a tesselation. If the
+input is even slightly non-planar, then some triangles will
+necessarily be back-facing when viewed from some angles, but the goal
+is to minimize this effect.
+
+The algorithm needs some capability of cleaning up the input data as
+well as the numerical errors in its own calculations. One way to do
+this is to specify a tolerance as defined above, and clean up the
+input and output during the line sweep process. At the very least,
+the algorithm must handle coincident vertices, vertices incident to an
+edge, and coincident edges.
+
+
+Phases of the algorithm
+-----------------------
+
+1. Find the polygon normal N.
+2. Project the vertex data onto a plane. It does not need to be
+ perpendicular to the normal, eg. we can project onto the plane
+ perpendicular to the coordinate axis whose dot product with N
+ is largest.
+3. Using a line-sweep algorithm, partition the plane into x-monotone
+ regions. Any vertical line intersects an x-monotone region in
+ at most one interval.
+4. Triangulate the x-monotone regions.
+5. Group the triangles into strips and fans.
+
+
+Finding the normal vector
+-------------------------
+
+A common way to find a polygon normal is to compute the signed area
+when the polygon is projected along the three coordinate axes. We
+can't do this, since contours can have zero area without being
+degenerate (eg. a bowtie).
+
+We fit a plane to the vertex data, ignoring how they are connected
+into contours. Ideally this would be a least-squares fit; however for
+our purpose the accuracy of the normal is not important. Instead we
+find three vertices which are widely separated, and compute the normal
+to the triangle they form. The vertices are chosen so that the
+triangle has an area at least 1/sqrt(3) times the largest area of any
+triangle formed using the input vertices.
+
+The contours do affect the orientation of the normal; after computing
+the normal, we check that the sum of the signed contour areas is
+non-negative, and reverse the normal if necessary.
+
+
+Projecting the vertices
+-----------------------
+
+We project the vertices onto a plane perpendicular to one of the three
+coordinate axes. This helps numerical accuracy by removing a
+transformation step between the original input data and the data
+processed by the algorithm. The projection also compresses the input
+data; the 2D distance between vertices after projection may be smaller
+than the original 2D distance. However by choosing the coordinate
+axis whose dot product with the normal is greatest, the compression
+factor is at most 1/sqrt(3).
+
+Even though the *accuracy* of the normal is not that important (since
+we are projecting perpendicular to a coordinate axis anyway), the
+*robustness* of the computation is important. For example, if there
+are many vertices which lie almost along a line, and one vertex V
+which is well-separated from the line, then our normal computation
+should involve V otherwise the results will be garbage.
+
+The advantage of projecting perpendicular to the polygon normal is
+that computed intersection points will be as close as possible to
+their ideal locations. To get this behavior, define TRUE_PROJECT.
+
+
+The Line Sweep
+--------------
+
+There are three data structures: the mesh, the event queue, and the
+edge dictionary.
+
+The mesh is a "quad-edge" data structure which records the topology of
+the current decomposition; for details see the include file "mesh.h".
+
+The event queue simply holds all vertices (both original and computed
+ones), organized so that we can quickly extract the vertex with the
+minimum x-coord (and among those, the one with the minimum y-coord).
+
+The edge dictionary describes the current intersection of the sweep
+line with the regions of the polygon. This is just an ordering of the
+edges which intersect the sweep line, sorted by their current order of
+intersection. For each pair of edges, we store some information about
+the monotone region between them -- these are call "active regions"
+(since they are crossed by the current sweep line).
+
+The basic algorithm is to sweep from left to right, processing each
+vertex. The processed portion of the mesh (left of the sweep line) is
+a planar decomposition. As we cross each vertex, we update the mesh
+and the edge dictionary, then we check any newly adjacent pairs of
+edges to see if they intersect.
+
+A vertex can have any number of edges. Vertices with many edges can
+be created as vertices are merged and intersection points are
+computed. For unprocessed vertices (right of the sweep line), these
+edges are in no particular order around the vertex; for processed
+vertices, the topological ordering should match the geometric ordering.
+
+The vertex processing happens in two phases: first we process are the
+left-going edges (all these edges are currently in the edge
+dictionary). This involves:
+
+ - deleting the left-going edges from the dictionary;
+ - relinking the mesh if necessary, so that the order of these edges around
+ the event vertex matches the order in the dictionary;
+ - marking any terminated regions (regions which lie between two left-going
+ edges) as either "inside" or "outside" according to their winding number.
+
+When there are no left-going edges, and the event vertex is in an
+"interior" region, we need to add an edge (to split the region into
+monotone pieces). To do this we simply join the event vertex to the
+rightmost left endpoint of the upper or lower edge of the containing
+region.
+
+Then we process the right-going edges. This involves:
+
+ - inserting the edges in the edge dictionary;
+ - computing the winding number of any newly created active regions.
+ We can compute this incrementally using the winding of each edge
+ that we cross as we walk through the dictionary.
+ - relinking the mesh if necessary, so that the order of these edges around
+ the event vertex matches the order in the dictionary;
+ - checking any newly adjacent edges for intersection and/or merging.
+
+If there are no right-going edges, again we need to add one to split
+the containing region into monotone pieces. In our case it is most
+convenient to add an edge to the leftmost right endpoint of either
+containing edge; however we may need to change this later (see the
+code for details).
+
+
+Invariants
+----------
+
+These are the most important invariants maintained during the sweep.
+We define a function VertLeq(v1,v2) which defines the order in which
+vertices cross the sweep line, and a function EdgeLeq(e1,e2; loc)
+which says whether e1 is below e2 at the sweep event location "loc".
+This function is defined only at sweep event locations which lie
+between the rightmost left endpoint of {e1,e2}, and the leftmost right
+endpoint of {e1,e2}.
+
+Invariants for the Edge Dictionary.
+
+ - Each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2)
+ at any valid location of the sweep event.
+ - If EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2
+ share a common endpoint.
+ - For each e in the dictionary, e->Dst has been processed but not e->Org.
+ - Each edge e satisfies VertLeq(e->Dst,event) && VertLeq(event,e->Org)
+ where "event" is the current sweep line event.
+ - No edge e has zero length.
+ - No two edges have identical left and right endpoints.
+
+Invariants for the Mesh (the processed portion).
+
+ - The portion of the mesh left of the sweep line is a planar graph,
+ ie. there is *some* way to embed it in the plane.
+ - No processed edge has zero length.
+ - No two processed vertices have identical coordinates.
+ - Each "inside" region is monotone, ie. can be broken into two chains
+ of monotonically increasing vertices according to VertLeq(v1,v2)
+ - a non-invariant: these chains may intersect (slightly) due to
+ numerical errors, but this does not affect the algorithm's operation.
+
+Invariants for the Sweep.
+
+ - If a vertex has any left-going edges, then these must be in the edge
+ dictionary at the time the vertex is processed.
+ - If an edge is marked "fixUpperEdge" (it is a temporary edge introduced
+ by ConnectRightVertex), then it is the only right-going edge from
+ its associated vertex. (This says that these edges exist only
+ when it is necessary.)
+
+
+Robustness
+----------
+
+The key to the robustness of the algorithm is maintaining the
+invariants above, especially the correct ordering of the edge
+dictionary. We achieve this by:
+
+ 1. Writing the numerical computations for maximum precision rather
+ than maximum speed.
+
+ 2. Making no assumptions at all about the results of the edge
+ intersection calculations -- for sufficiently degenerate inputs,
+ the computed location is not much better than a random number.
+
+ 3. When numerical errors violate the invariants, restore them
+ by making *topological* changes when necessary (ie. relinking
+ the mesh structure).
+
+
+Triangulation and Grouping
+--------------------------
+
+We finish the line sweep before doing any triangulation. This is
+because even after a monotone region is complete, there can be further
+changes to its vertex data because of further vertex merging.
+
+After triangulating all monotone regions, we want to group the
+triangles into fans and strips. We do this using a greedy approach.
+The triangulation itself is not optimized to reduce the number of
+primitives; we just try to get a reasonable decomposition of the
+computed triangulation.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict-list.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict-list.h
new file mode 100644
index 0000000..9c67c49
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict-list.h
@@ -0,0 +1,107 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/dict-list.h#5 $
+*/
+
+#ifndef __dict_list_h_
+#define __dict_list_h_
+
+/* Use #define's so that another heap implementation can use this one */
+
+#define DictKey DictListKey
+#define Dict DictList
+#define DictNode DictListNode
+
+#define dictNewDict(frame,leq) __gl_dictListNewDict(frame,leq)
+#define dictDeleteDict(dict) __gl_dictListDeleteDict(dict)
+
+#define dictSearch(dict,key) __gl_dictListSearch(dict,key)
+#define dictInsert(dict,key) __gl_dictListInsert(dict,key)
+#define dictInsertBefore(dict,node,key) __gl_dictListInsertBefore(dict,node,key)
+#define dictDelete(dict,node) __gl_dictListDelete(dict,node)
+
+#define dictKey(n) __gl_dictListKey(n)
+#define dictSucc(n) __gl_dictListSucc(n)
+#define dictPred(n) __gl_dictListPred(n)
+#define dictMin(d) __gl_dictListMin(d)
+#define dictMax(d) __gl_dictListMax(d)
+
+
+
+typedef void *DictKey;
+typedef struct Dict Dict;
+typedef struct DictNode DictNode;
+
+Dict *dictNewDict(
+ void *frame,
+ int (*leq)(void *frame, DictKey key1, DictKey key2) );
+
+void dictDeleteDict( Dict *dict );
+
+/* Search returns the node with the smallest key greater than or equal
+ * to the given key. If there is no such key, returns a node whose
+ * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc.
+ */
+DictNode *dictSearch( Dict *dict, DictKey key );
+DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key );
+void dictDelete( Dict *dict, DictNode *node );
+
+#define __gl_dictListKey(n) ((n)->key)
+#define __gl_dictListSucc(n) ((n)->next)
+#define __gl_dictListPred(n) ((n)->prev)
+#define __gl_dictListMin(d) ((d)->head.next)
+#define __gl_dictListMax(d) ((d)->head.prev)
+#define __gl_dictListInsert(d,k) (dictInsertBefore((d),&(d)->head,(k)))
+
+
+/*** Private data structures ***/
+
+struct DictNode {
+ DictKey key;
+ DictNode *next;
+ DictNode *prev;
+};
+
+struct Dict {
+ DictNode head;
+ void *frame;
+ int (*leq)(void *frame, DictKey key1, DictKey key2);
+};
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.c
new file mode 100644
index 0000000..bbae1f2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.c
@@ -0,0 +1,117 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/dict.c#5 $
+*/
+
+#include <stddef.h>
+#include "ThirdParty/glu/libtess/dict-list.h"
+#include "ThirdParty/glu/libtess/memalloc.h"
+
+/* really __gl_dictListNewDict */
+Dict *dictNewDict( void *frame,
+ int (*leq)(void *frame, DictKey key1, DictKey key2) )
+{
+ Dict *dict = (Dict *) memAlloc( sizeof( Dict ));
+ DictNode *head;
+
+ if (dict == NULL) return NULL;
+
+ head = &dict->head;
+
+ head->key = NULL;
+ head->next = head;
+ head->prev = head;
+
+ dict->frame = frame;
+ dict->leq = leq;
+
+ return dict;
+}
+
+/* really __gl_dictListDeleteDict */
+void dictDeleteDict( Dict *dict )
+{
+ DictNode *node;
+
+ for( node = dict->head.next; node != &dict->head; node = node->next ) {
+ memFree( node );
+ }
+ memFree( dict );
+}
+
+/* really __gl_dictListInsertBefore */
+DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key )
+{
+ DictNode *newNode;
+
+ do {
+ node = node->prev;
+ } while( node->key != NULL && ! (*dict->leq)(dict->frame, node->key, key));
+
+ newNode = (DictNode *) memAlloc( sizeof( DictNode ));
+ if (newNode == NULL) return NULL;
+
+ newNode->key = key;
+ newNode->next = node->next;
+ node->next->prev = newNode;
+ newNode->prev = node;
+ node->next = newNode;
+
+ return newNode;
+}
+
+/* really __gl_dictListDelete */
+void dictDelete( Dict *dict, DictNode *node ) /*ARGSUSED*/
+{
+ node->next->prev = node->prev;
+ node->prev->next = node->next;
+ memFree( node );
+}
+
+/* really __gl_dictListSearch */
+DictNode *dictSearch( Dict *dict, DictKey key )
+{
+ DictNode *node = &dict->head;
+
+ do {
+ node = node->next;
+ } while( node->key != NULL && ! (*dict->leq)(dict->frame, key, node->key));
+
+ return node;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.h
new file mode 100644
index 0000000..7851bac
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/dict.h
@@ -0,0 +1,107 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/dict.h#5 $
+*/
+
+#ifndef __dict_list_h_
+#define __dict_list_h_
+
+/* Use #define's so that another heap implementation can use this one */
+
+#define DictKey DictListKey
+#define Dict DictList
+#define DictNode DictListNode
+
+#define dictNewDict(frame,leq) __gl_dictListNewDict(frame,leq)
+#define dictDeleteDict(dict) __gl_dictListDeleteDict(dict)
+
+#define dictSearch(dict,key) __gl_dictListSearch(dict,key)
+#define dictInsert(dict,key) __gl_dictListInsert(dict,key)
+#define dictInsertBefore(dict,node,key) __gl_dictListInsertBefore(dict,node,key)
+#define dictDelete(dict,node) __gl_dictListDelete(dict,node)
+
+#define dictKey(n) __gl_dictListKey(n)
+#define dictSucc(n) __gl_dictListSucc(n)
+#define dictPred(n) __gl_dictListPred(n)
+#define dictMin(d) __gl_dictListMin(d)
+#define dictMax(d) __gl_dictListMax(d)
+
+
+
+typedef void *DictKey;
+typedef struct Dict Dict;
+typedef struct DictNode DictNode;
+
+Dict *dictNewDict(
+ void *frame,
+ int (*leq)(void *frame, DictKey key1, DictKey key2) );
+
+void dictDeleteDict( Dict *dict );
+
+/* Search returns the node with the smallest key greater than or equal
+ * to the given key. If there is no such key, returns a node whose
+ * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc.
+ */
+DictNode *dictSearch( Dict *dict, DictKey key );
+DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key );
+void dictDelete( Dict *dict, DictNode *node );
+
+#define __gl_dictListKey(n) ((n)->key)
+#define __gl_dictListSucc(n) ((n)->next)
+#define __gl_dictListPred(n) ((n)->prev)
+#define __gl_dictListMin(d) ((d)->head.next)
+#define __gl_dictListMax(d) ((d)->head.prev)
+#define __gl_dictListInsert(d,k) (dictInsertBefore((d),&(d)->head,(k)))
+
+
+/*** Private data structures ***/
+
+struct DictNode {
+ DictKey key;
+ DictNode *next;
+ DictNode *prev;
+};
+
+struct Dict {
+ DictNode head;
+ void *frame;
+ int (*leq)(void *frame, DictKey key1, DictKey key2);
+};
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.c
new file mode 100644
index 0000000..c404202
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.c
@@ -0,0 +1,271 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/geom.c#5 $
+*/
+
+#include <assert.h>
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+#include "ThirdParty/glu/libtess/geom.h"
+
+int __gl_vertLeq( GLUvertex *u, GLUvertex *v )
+{
+ /* Returns TRUE if u is lexicographically <= v. */
+
+ return VertLeq( u, v );
+}
+
+GLdouble __gl_edgeEval( GLUvertex *u, GLUvertex *v, GLUvertex *w )
+{
+ /* Given three vertices u,v,w such that VertLeq(u,v) && VertLeq(v,w),
+ * evaluates the t-coord of the edge uw at the s-coord of the vertex v.
+ * Returns v->t - (uw)(v->s), ie. the signed distance from uw to v.
+ * If uw is vertical (and thus passes thru v), the result is zero.
+ *
+ * The calculation is extremely accurate and stable, even when v
+ * is very close to u or w. In particular if we set v->t = 0 and
+ * let r be the negated result (this evaluates (uw)(v->s)), then
+ * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t).
+ */
+ GLdouble gapL, gapR;
+
+ assert( VertLeq( u, v ) && VertLeq( v, w ));
+
+ gapL = v->s - u->s;
+ gapR = w->s - v->s;
+
+ if( gapL + gapR > 0 ) {
+ if( gapL < gapR ) {
+ return (v->t - u->t) + (u->t - w->t) * (gapL / (gapL + gapR));
+ } else {
+ return (v->t - w->t) + (w->t - u->t) * (gapR / (gapL + gapR));
+ }
+ }
+ /* vertical line */
+ return 0;
+}
+
+GLdouble __gl_edgeSign( GLUvertex *u, GLUvertex *v, GLUvertex *w )
+{
+ /* Returns a number whose sign matches EdgeEval(u,v,w) but which
+ * is cheaper to evaluate. Returns > 0, == 0 , or < 0
+ * as v is above, on, or below the edge uw.
+ */
+ GLdouble gapL, gapR;
+
+ assert( VertLeq( u, v ) && VertLeq( v, w ));
+
+ gapL = v->s - u->s;
+ gapR = w->s - v->s;
+
+ if( gapL + gapR > 0 ) {
+ return (v->t - w->t) * gapL + (v->t - u->t) * gapR;
+ }
+ /* vertical line */
+ return 0;
+}
+
+
+/***********************************************************************
+ * Define versions of EdgeSign, EdgeEval with s and t transposed.
+ */
+
+GLdouble __gl_transEval( GLUvertex *u, GLUvertex *v, GLUvertex *w )
+{
+ /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w),
+ * evaluates the t-coord of the edge uw at the s-coord of the vertex v.
+ * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v.
+ * If uw is vertical (and thus passes thru v), the result is zero.
+ *
+ * The calculation is extremely accurate and stable, even when v
+ * is very close to u or w. In particular if we set v->s = 0 and
+ * let r be the negated result (this evaluates (uw)(v->t)), then
+ * r is guaranteed to satisfy MIN(u->s,w->s) <= r <= MAX(u->s,w->s).
+ */
+ GLdouble gapL, gapR;
+
+ assert( TransLeq( u, v ) && TransLeq( v, w ));
+
+ gapL = v->t - u->t;
+ gapR = w->t - v->t;
+
+ if( gapL + gapR > 0 ) {
+ if( gapL < gapR ) {
+ return (v->s - u->s) + (u->s - w->s) * (gapL / (gapL + gapR));
+ } else {
+ return (v->s - w->s) + (w->s - u->s) * (gapR / (gapL + gapR));
+ }
+ }
+ /* vertical line */
+ return 0;
+}
+
+GLdouble __gl_transSign( GLUvertex *u, GLUvertex *v, GLUvertex *w )
+{
+ /* Returns a number whose sign matches TransEval(u,v,w) but which
+ * is cheaper to evaluate. Returns > 0, == 0 , or < 0
+ * as v is above, on, or below the edge uw.
+ */
+ GLdouble gapL, gapR;
+
+ assert( TransLeq( u, v ) && TransLeq( v, w ));
+
+ gapL = v->t - u->t;
+ gapR = w->t - v->t;
+
+ if( gapL + gapR > 0 ) {
+ return (v->s - w->s) * gapL + (v->s - u->s) * gapR;
+ }
+ /* vertical line */
+ return 0;
+}
+
+
+int __gl_vertCCW( GLUvertex *u, GLUvertex *v, GLUvertex *w )
+{
+ /* For almost-degenerate situations, the results are not reliable.
+ * Unless the floating-point arithmetic can be performed without
+ * rounding errors, *any* implementation will give incorrect results
+ * on some degenerate inputs, so the client must have some way to
+ * handle this situation.
+ */
+ return (u->s*(v->t - w->t) + v->s*(w->t - u->t) + w->s*(u->t - v->t)) >= 0;
+}
+
+/* Given parameters a,x,b,y returns the value (b*x+a*y)/(a+b),
+ * or (x+y)/2 if a==b==0. It requires that a,b >= 0, and enforces
+ * this in the rare case that one argument is slightly negative.
+ * The implementation is extremely stable numerically.
+ * In particular it guarantees that the result r satisfies
+ * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate
+ * even when a and b differ greatly in magnitude.
+ */
+#define RealInterpolate(a,x,b,y) \
+ (a = (a < 0) ? 0 : a, b = (b < 0) ? 0 : b, \
+ ((a <= b) ? ((b == 0) ? ((x+y) / 2) \
+ : (x + (y-x) * (a/(a+b)))) \
+ : (y + (x-y) * (b/(a+b)))))
+
+#ifndef FOR_TRITE_TEST_PROGRAM
+#define Interpolate(a,x,b,y) RealInterpolate(a,x,b,y)
+#else
+
+/* Claim: the ONLY property the sweep algorithm relies on is that
+ * MIN(x,y) <= r <= MAX(x,y). This is a nasty way to test that.
+ */
+#include <stdlib.h>
+extern int RandomInterpolate;
+
+GLdouble Interpolate( GLdouble a, GLdouble x, GLdouble b, GLdouble y)
+{
+printf("*********************%d\n",RandomInterpolate);
+ if( RandomInterpolate ) {
+ a = 1.2 * drand48() - 0.1;
+ a = (a < 0) ? 0 : ((a > 1) ? 1 : a);
+ b = 1.0 - a;
+ }
+ return RealInterpolate(a,x,b,y);
+}
+
+#endif
+
+#define Swap(a,b) do { GLUvertex *t = a; a = b; b = t; } while(0)
+
+void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1,
+ GLUvertex *o2, GLUvertex *d2,
+ GLUvertex *v )
+/* Given edges (o1,d1) and (o2,d2), compute their point of intersection.
+ * The computed point is guaranteed to lie in the intersection of the
+ * bounding rectangles defined by each edge.
+ */
+{
+ GLdouble z1, z2;
+
+ /* This is certainly not the most efficient way to find the intersection
+ * of two line segments, but it is very numerically stable.
+ *
+ * Strategy: find the two middle vertices in the VertLeq ordering,
+ * and interpolate the intersection s-value from these. Then repeat
+ * using the TransLeq ordering to find the intersection t-value.
+ */
+
+ if( ! VertLeq( o1, d1 )) { Swap( o1, d1 ); }
+ if( ! VertLeq( o2, d2 )) { Swap( o2, d2 ); }
+ if( ! VertLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); }
+
+ if( ! VertLeq( o2, d1 )) {
+ /* Technically, no intersection -- do our best */
+ v->s = (o2->s + d1->s) / 2;
+ } else if( VertLeq( d1, d2 )) {
+ /* Interpolate between o2 and d1 */
+ z1 = EdgeEval( o1, o2, d1 );
+ z2 = EdgeEval( o2, d1, d2 );
+ if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; }
+ v->s = Interpolate( z1, o2->s, z2, d1->s );
+ } else {
+ /* Interpolate between o2 and d2 */
+ z1 = EdgeSign( o1, o2, d1 );
+ z2 = -EdgeSign( o1, d2, d1 );
+ if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; }
+ v->s = Interpolate( z1, o2->s, z2, d2->s );
+ }
+
+ /* Now repeat the process for t */
+
+ if( ! TransLeq( o1, d1 )) { Swap( o1, d1 ); }
+ if( ! TransLeq( o2, d2 )) { Swap( o2, d2 ); }
+ if( ! TransLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); }
+
+ if( ! TransLeq( o2, d1 )) {
+ /* Technically, no intersection -- do our best */
+ v->t = (o2->t + d1->t) / 2;
+ } else if( TransLeq( d1, d2 )) {
+ /* Interpolate between o2 and d1 */
+ z1 = TransEval( o1, o2, d1 );
+ z2 = TransEval( o2, d1, d2 );
+ if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; }
+ v->t = Interpolate( z1, o2->t, z2, d1->t );
+ } else {
+ /* Interpolate between o2 and d2 */
+ z1 = TransSign( o1, o2, d1 );
+ z2 = -TransSign( o1, d2, d1 );
+ if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; }
+ v->t = Interpolate( z1, o2->t, z2, d2->t );
+ }
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.h
new file mode 100644
index 0000000..d6c8497
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/geom.h
@@ -0,0 +1,90 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/geom.h#5 $
+*/
+
+#ifndef __geom_h_
+#define __geom_h_
+
+#include "ThirdParty/glu/libtess/mesh.h"
+
+#ifdef NO_BRANCH_CONDITIONS
+/* MIPS architecture has special instructions to evaluate boolean
+ * conditions -- more efficient than branching, IF you can get the
+ * compiler to generate the right instructions (SGI compiler doesn't)
+ */
+#define VertEq(u,v) (((u)->s == (v)->s) & ((u)->t == (v)->t))
+#define VertLeq(u,v) (((u)->s < (v)->s) | \
+ ((u)->s == (v)->s & (u)->t <= (v)->t))
+#else
+#define VertEq(u,v) ((u)->s == (v)->s && (u)->t == (v)->t)
+#define VertLeq(u,v) (((u)->s < (v)->s) || \
+ ((u)->s == (v)->s && (u)->t <= (v)->t))
+#endif
+
+#define EdgeEval(u,v,w) __gl_edgeEval(u,v,w)
+#define EdgeSign(u,v,w) __gl_edgeSign(u,v,w)
+
+/* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */
+
+#define TransLeq(u,v) (((u)->t < (v)->t) || \
+ ((u)->t == (v)->t && (u)->s <= (v)->s))
+#define TransEval(u,v,w) __gl_transEval(u,v,w)
+#define TransSign(u,v,w) __gl_transSign(u,v,w)
+
+
+#define EdgeGoesLeft(e) VertLeq( (e)->Dst, (e)->Org )
+#define EdgeGoesRight(e) VertLeq( (e)->Org, (e)->Dst )
+
+#define ABS(x) ((x) < 0 ? -(x) : (x))
+#define VertL1dist(u,v) (ABS(u->s - v->s) + ABS(u->t - v->t))
+
+#define VertCCW(u,v,w) __gl_vertCCW(u,v,w)
+
+int __gl_vertLeq( GLUvertex *u, GLUvertex *v );
+GLdouble __gl_edgeEval( GLUvertex *u, GLUvertex *v, GLUvertex *w );
+GLdouble __gl_edgeSign( GLUvertex *u, GLUvertex *v, GLUvertex *w );
+GLdouble __gl_transEval( GLUvertex *u, GLUvertex *v, GLUvertex *w );
+GLdouble __gl_transSign( GLUvertex *u, GLUvertex *v, GLUvertex *w );
+int __gl_vertCCW( GLUvertex *u, GLUvertex *v, GLUvertex *w );
+void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1,
+ GLUvertex *o2, GLUvertex *d2,
+ GLUvertex *v );
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.c
new file mode 100644
index 0000000..530646f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.c
@@ -0,0 +1,62 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/memalloc.c#5 $
+*/
+
+#include "string.h"
+#include "ThirdParty/glu/libtess/memalloc.h"
+
+int __gl_memInit( size_t maxFast )
+{
+#ifndef NO_MALLOPT
+/* mallopt( M_MXFAST, maxFast );*/
+#ifdef MEMORY_DEBUG
+ mallopt( M_DEBUG, 1 );
+#endif
+#endif
+ return 1;
+}
+
+#ifdef MEMORY_DEBUG
+void *__gl_memAlloc( size_t n )
+{
+ return memset( malloc( n ), 0xa5, n );
+}
+#endif
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.h
new file mode 100644
index 0000000..1e37f7a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/memalloc.h
@@ -0,0 +1,61 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/memalloc.h#5 $
+*/
+
+#ifndef __memalloc_simple_h_
+#define __memalloc_simple_h_
+
+#include <stdlib.h>
+
+#define memRealloc realloc
+#define memFree free
+
+#define memInit __gl_memInit
+/*extern void __gl_memInit( size_t );*/
+extern int __gl_memInit( size_t );
+
+#ifndef MEMORY_DEBUG
+#define memAlloc malloc
+#else
+#define memAlloc __gl_memAlloc
+extern void * __gl_memAlloc( size_t );
+#endif
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.c
new file mode 100644
index 0000000..096f898
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.c
@@ -0,0 +1,796 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/mesh.c#6 $
+*/
+
+#include <assert.h>
+#include <stddef.h>
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/memalloc.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+
+#define TRUE 1
+#define FALSE 0
+
+static GLUvertex *allocVertex()
+{
+ return (GLUvertex *)memAlloc( sizeof( GLUvertex ));
+}
+
+static GLUface *allocFace()
+{
+ return (GLUface *)memAlloc( sizeof( GLUface ));
+}
+
+/************************ Utility Routines ************************/
+
+/* Allocate and free half-edges in pairs for efficiency.
+ * The *only* place that should use this fact is allocation/free.
+ */
+typedef struct { GLUhalfEdge e, eSym; } EdgePair;
+
+/* MakeEdge creates a new pair of half-edges which form their own loop.
+ * No vertex or face structures are allocated, but these must be assigned
+ * before the current edge operation is completed.
+ */
+static GLUhalfEdge *MakeEdge( GLUhalfEdge *eNext )
+{
+ GLUhalfEdge *e;
+ GLUhalfEdge *eSym;
+ GLUhalfEdge *ePrev;
+ EdgePair *pair = (EdgePair *)memAlloc( sizeof( EdgePair ));
+ if (pair == NULL) return NULL;
+
+ e = &pair->e;
+ eSym = &pair->eSym;
+
+ /* Make sure eNext points to the first edge of the edge pair */
+ if( eNext->Sym < eNext ) { eNext = eNext->Sym; }
+
+ /* Insert in circular doubly-linked list before eNext.
+ * Note that the prev pointer is stored in Sym->next.
+ */
+ ePrev = eNext->Sym->next;
+ eSym->next = ePrev;
+ ePrev->Sym->next = e;
+ e->next = eNext;
+ eNext->Sym->next = eSym;
+
+ e->Sym = eSym;
+ e->Onext = e;
+ e->Lnext = eSym;
+ e->Org = NULL;
+ e->Lface = NULL;
+ e->winding = 0;
+ e->activeRegion = NULL;
+
+ eSym->Sym = e;
+ eSym->Onext = eSym;
+ eSym->Lnext = e;
+ eSym->Org = NULL;
+ eSym->Lface = NULL;
+ eSym->winding = 0;
+ eSym->activeRegion = NULL;
+
+ return e;
+}
+
+/* Splice( a, b ) is best described by the Guibas/Stolfi paper or the
+ * CS348a notes (see mesh.h). Basically it modifies the mesh so that
+ * a->Onext and b->Onext are exchanged. This can have various effects
+ * depending on whether a and b belong to different face or vertex rings.
+ * For more explanation see __gl_meshSplice() below.
+ */
+static void Splice( GLUhalfEdge *a, GLUhalfEdge *b )
+{
+ GLUhalfEdge *aOnext = a->Onext;
+ GLUhalfEdge *bOnext = b->Onext;
+
+ aOnext->Sym->Lnext = b;
+ bOnext->Sym->Lnext = a;
+ a->Onext = bOnext;
+ b->Onext = aOnext;
+}
+
+/* MakeVertex( newVertex, eOrig, vNext ) attaches a new vertex and makes it the
+ * origin of all edges in the vertex loop to which eOrig belongs. "vNext" gives
+ * a place to insert the new vertex in the global vertex list. We insert
+ * the new vertex *before* vNext so that algorithms which walk the vertex
+ * list will not see the newly created vertices.
+ */
+static void MakeVertex( GLUvertex *newVertex,
+ GLUhalfEdge *eOrig, GLUvertex *vNext )
+{
+ GLUhalfEdge *e;
+ GLUvertex *vPrev;
+ GLUvertex *vNew = newVertex;
+
+ assert(vNew != NULL);
+
+ /* insert in circular doubly-linked list before vNext */
+ vPrev = vNext->prev;
+ vNew->prev = vPrev;
+ vPrev->next = vNew;
+ vNew->next = vNext;
+ vNext->prev = vNew;
+
+ vNew->anEdge = eOrig;
+ vNew->data = NULL;
+ /* leave coords, s, t undefined */
+
+ /* fix other edges on this vertex loop */
+ e = eOrig;
+ do {
+ e->Org = vNew;
+ e = e->Onext;
+ } while( e != eOrig );
+}
+
+/* MakeFace( newFace, eOrig, fNext ) attaches a new face and makes it the left
+ * face of all edges in the face loop to which eOrig belongs. "fNext" gives
+ * a place to insert the new face in the global face list. We insert
+ * the new face *before* fNext so that algorithms which walk the face
+ * list will not see the newly created faces.
+ */
+static void MakeFace( GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext )
+{
+ GLUhalfEdge *e;
+ GLUface *fPrev;
+ GLUface *fNew = newFace;
+
+ assert(fNew != NULL);
+
+ /* insert in circular doubly-linked list before fNext */
+ fPrev = fNext->prev;
+ fNew->prev = fPrev;
+ fPrev->next = fNew;
+ fNew->next = fNext;
+ fNext->prev = fNew;
+
+ fNew->anEdge = eOrig;
+ fNew->data = NULL;
+ fNew->trail = NULL;
+ fNew->marked = FALSE;
+
+ /* The new face is marked "inside" if the old one was. This is a
+ * convenience for the common case where a face has been split in two.
+ */
+ fNew->inside = fNext->inside;
+
+ /* fix other edges on this face loop */
+ e = eOrig;
+ do {
+ e->Lface = fNew;
+ e = e->Lnext;
+ } while( e != eOrig );
+}
+
+/* KillEdge( eDel ) destroys an edge (the half-edges eDel and eDel->Sym),
+ * and removes from the global edge list.
+ */
+static void KillEdge( GLUhalfEdge *eDel )
+{
+ GLUhalfEdge *ePrev, *eNext;
+
+ /* Half-edges are allocated in pairs, see EdgePair above */
+ if( eDel->Sym < eDel ) { eDel = eDel->Sym; }
+
+ /* delete from circular doubly-linked list */
+ eNext = eDel->next;
+ ePrev = eDel->Sym->next;
+ eNext->Sym->next = ePrev;
+ ePrev->Sym->next = eNext;
+
+ memFree( eDel );
+}
+
+
+/* KillVertex( vDel ) destroys a vertex and removes it from the global
+ * vertex list. It updates the vertex loop to point to a given new vertex.
+ */
+static void KillVertex( GLUvertex *vDel, GLUvertex *newOrg )
+{
+ GLUhalfEdge *e, *eStart = vDel->anEdge;
+ GLUvertex *vPrev, *vNext;
+
+ /* change the origin of all affected edges */
+ e = eStart;
+ do {
+ e->Org = newOrg;
+ e = e->Onext;
+ } while( e != eStart );
+
+ /* delete from circular doubly-linked list */
+ vPrev = vDel->prev;
+ vNext = vDel->next;
+ vNext->prev = vPrev;
+ vPrev->next = vNext;
+
+ memFree( vDel );
+}
+
+/* KillFace( fDel ) destroys a face and removes it from the global face
+ * list. It updates the face loop to point to a given new face.
+ */
+static void KillFace( GLUface *fDel, GLUface *newLface )
+{
+ GLUhalfEdge *e, *eStart = fDel->anEdge;
+ GLUface *fPrev, *fNext;
+
+ /* change the left face of all affected edges */
+ e = eStart;
+ do {
+ e->Lface = newLface;
+ e = e->Lnext;
+ } while( e != eStart );
+
+ /* delete from circular doubly-linked list */
+ fPrev = fDel->prev;
+ fNext = fDel->next;
+ fNext->prev = fPrev;
+ fPrev->next = fNext;
+
+ memFree( fDel );
+}
+
+
+/****************** Basic Edge Operations **********************/
+
+/* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face).
+ * The loop consists of the two new half-edges.
+ */
+GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh )
+{
+ GLUvertex *newVertex1= allocVertex();
+ GLUvertex *newVertex2= allocVertex();
+ GLUface *newFace= allocFace();
+ GLUhalfEdge *e;
+
+ /* if any one is null then all get freed */
+ if (newVertex1 == NULL || newVertex2 == NULL || newFace == NULL) {
+ if (newVertex1 != NULL) memFree(newVertex1);
+ if (newVertex2 != NULL) memFree(newVertex2);
+ if (newFace != NULL) memFree(newFace);
+ return NULL;
+ }
+
+ e = MakeEdge( &mesh->eHead );
+ if (e == NULL) return NULL;
+
+ MakeVertex( newVertex1, e, &mesh->vHead );
+ MakeVertex( newVertex2, e->Sym, &mesh->vHead );
+ MakeFace( newFace, e, &mesh->fHead );
+ return e;
+}
+
+
+/* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the
+ * mesh connectivity and topology. It changes the mesh so that
+ * eOrg->Onext <- OLD( eDst->Onext )
+ * eDst->Onext <- OLD( eOrg->Onext )
+ * where OLD(...) means the value before the meshSplice operation.
+ *
+ * This can have two effects on the vertex structure:
+ * - if eOrg->Org != eDst->Org, the two vertices are merged together
+ * - if eOrg->Org == eDst->Org, the origin is split into two vertices
+ * In both cases, eDst->Org is changed and eOrg->Org is untouched.
+ *
+ * Similarly (and independently) for the face structure,
+ * - if eOrg->Lface == eDst->Lface, one loop is split into two
+ * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one
+ * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected.
+ *
+ * Some special cases:
+ * If eDst == eOrg, the operation has no effect.
+ * If eDst == eOrg->Lnext, the new face will have a single edge.
+ * If eDst == eOrg->Lprev, the old face will have a single edge.
+ * If eDst == eOrg->Onext, the new vertex will have a single edge.
+ * If eDst == eOrg->Oprev, the old vertex will have a single edge.
+ */
+int __gl_meshSplice( GLUhalfEdge *eOrg, GLUhalfEdge *eDst )
+{
+ int joiningLoops = FALSE;
+ int joiningVertices = FALSE;
+
+ if( eOrg == eDst ) return 1;
+
+ if( eDst->Org != eOrg->Org ) {
+ /* We are merging two disjoint vertices -- destroy eDst->Org */
+ joiningVertices = TRUE;
+ KillVertex( eDst->Org, eOrg->Org );
+ }
+ if( eDst->Lface != eOrg->Lface ) {
+ /* We are connecting two disjoint loops -- destroy eDst->Lface */
+ joiningLoops = TRUE;
+ KillFace( eDst->Lface, eOrg->Lface );
+ }
+
+ /* Change the edge structure */
+ Splice( eDst, eOrg );
+
+ if( ! joiningVertices ) {
+ GLUvertex *newVertex= allocVertex();
+ if (newVertex == NULL) return 0;
+
+ /* We split one vertex into two -- the new vertex is eDst->Org.
+ * Make sure the old vertex points to a valid half-edge.
+ */
+ MakeVertex( newVertex, eDst, eOrg->Org );
+ eOrg->Org->anEdge = eOrg;
+ }
+ if( ! joiningLoops ) {
+ GLUface *newFace= allocFace();
+ if (newFace == NULL) return 0;
+
+ /* We split one loop into two -- the new loop is eDst->Lface.
+ * Make sure the old face points to a valid half-edge.
+ */
+ MakeFace( newFace, eDst, eOrg->Lface );
+ eOrg->Lface->anEdge = eOrg;
+ }
+
+ return 1;
+}
+
+
+/* __gl_meshDelete( eDel ) removes the edge eDel. There are several cases:
+ * if (eDel->Lface != eDel->Rface), we join two loops into one; the loop
+ * eDel->Lface is deleted. Otherwise, we are splitting one loop into two;
+ * the newly created loop will contain eDel->Dst. If the deletion of eDel
+ * would create isolated vertices, those are deleted as well.
+ *
+ * This function could be implemented as two calls to __gl_meshSplice
+ * plus a few calls to memFree, but this would allocate and delete
+ * unnecessary vertices and faces.
+ */
+int __gl_meshDelete( GLUhalfEdge *eDel )
+{
+ GLUhalfEdge *eDelSym = eDel->Sym;
+ int joiningLoops = FALSE;
+
+ /* First step: disconnect the origin vertex eDel->Org. We make all
+ * changes to get a consistent mesh in this "intermediate" state.
+ */
+ if( eDel->Lface != eDel->Rface ) {
+ /* We are joining two loops into one -- remove the left face */
+ joiningLoops = TRUE;
+ KillFace( eDel->Lface, eDel->Rface );
+ }
+
+ if( eDel->Onext == eDel ) {
+ KillVertex( eDel->Org, NULL );
+ } else {
+ /* Make sure that eDel->Org and eDel->Rface point to valid half-edges */
+ eDel->Rface->anEdge = eDel->Oprev;
+ eDel->Org->anEdge = eDel->Onext;
+
+ Splice( eDel, eDel->Oprev );
+ if( ! joiningLoops ) {
+ GLUface *newFace= allocFace();
+ if (newFace == NULL) return 0;
+
+ /* We are splitting one loop into two -- create a new loop for eDel. */
+ MakeFace( newFace, eDel, eDel->Lface );
+ }
+ }
+
+ /* Claim: the mesh is now in a consistent state, except that eDel->Org
+ * may have been deleted. Now we disconnect eDel->Dst.
+ */
+ if( eDelSym->Onext == eDelSym ) {
+ KillVertex( eDelSym->Org, NULL );
+ KillFace( eDelSym->Lface, NULL );
+ } else {
+ /* Make sure that eDel->Dst and eDel->Lface point to valid half-edges */
+ eDel->Lface->anEdge = eDelSym->Oprev;
+ eDelSym->Org->anEdge = eDelSym->Onext;
+ Splice( eDelSym, eDelSym->Oprev );
+ }
+
+ /* Any isolated vertices or faces have already been freed. */
+ KillEdge( eDel );
+
+ return 1;
+}
+
+
+/******************** Other Edge Operations **********************/
+
+/* All these routines can be implemented with the basic edge
+ * operations above. They are provided for convenience and efficiency.
+ */
+
+
+/* __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that
+ * eNew == eOrg->Lnext, and eNew->Dst is a newly created vertex.
+ * eOrg and eNew will have the same left face.
+ */
+GLUhalfEdge *__gl_meshAddEdgeVertex( GLUhalfEdge *eOrg )
+{
+ GLUhalfEdge *eNewSym;
+ GLUhalfEdge *eNew = MakeEdge( eOrg );
+ if (eNew == NULL) return NULL;
+
+ eNewSym = eNew->Sym;
+
+ /* Connect the new edge appropriately */
+ Splice( eNew, eOrg->Lnext );
+
+ /* Set the vertex and face information */
+ eNew->Org = eOrg->Dst;
+ {
+ GLUvertex *newVertex= allocVertex();
+ if (newVertex == NULL) return NULL;
+
+ MakeVertex( newVertex, eNewSym, eNew->Org );
+ }
+ eNew->Lface = eNewSym->Lface = eOrg->Lface;
+
+ return eNew;
+}
+
+
+/* __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew,
+ * such that eNew == eOrg->Lnext. The new vertex is eOrg->Dst == eNew->Org.
+ * eOrg and eNew will have the same left face.
+ */
+GLUhalfEdge *__gl_meshSplitEdge( GLUhalfEdge *eOrg )
+{
+ GLUhalfEdge *eNew;
+ GLUhalfEdge *tempHalfEdge= __gl_meshAddEdgeVertex( eOrg );
+ if (tempHalfEdge == NULL) return NULL;
+
+ eNew = tempHalfEdge->Sym;
+
+ /* Disconnect eOrg from eOrg->Dst and connect it to eNew->Org */
+ Splice( eOrg->Sym, eOrg->Sym->Oprev );
+ Splice( eOrg->Sym, eNew );
+
+ /* Set the vertex and face information */
+ eOrg->Dst = eNew->Org;
+ eNew->Dst->anEdge = eNew->Sym; /* may have pointed to eOrg->Sym */
+ eNew->Rface = eOrg->Rface;
+ eNew->winding = eOrg->winding; /* copy old winding information */
+ eNew->Sym->winding = eOrg->Sym->winding;
+
+ return eNew;
+}
+
+
+/* __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg->Dst
+ * to eDst->Org, and returns the corresponding half-edge eNew.
+ * If eOrg->Lface == eDst->Lface, this splits one loop into two,
+ * and the newly created loop is eNew->Lface. Otherwise, two disjoint
+ * loops are merged into one, and the loop eDst->Lface is destroyed.
+ *
+ * If (eOrg == eDst), the new face will have only two edges.
+ * If (eOrg->Lnext == eDst), the old face is reduced to a single edge.
+ * If (eOrg->Lnext->Lnext == eDst), the old face is reduced to two edges.
+ */
+GLUhalfEdge *__gl_meshConnect( GLUhalfEdge *eOrg, GLUhalfEdge *eDst )
+{
+ GLUhalfEdge *eNewSym;
+ int joiningLoops = FALSE;
+ GLUhalfEdge *eNew = MakeEdge( eOrg );
+ if (eNew == NULL) return NULL;
+
+ eNewSym = eNew->Sym;
+
+ if( eDst->Lface != eOrg->Lface ) {
+ /* We are connecting two disjoint loops -- destroy eDst->Lface */
+ joiningLoops = TRUE;
+ KillFace( eDst->Lface, eOrg->Lface );
+ }
+
+ /* Connect the new edge appropriately */
+ Splice( eNew, eOrg->Lnext );
+ Splice( eNewSym, eDst );
+
+ /* Set the vertex and face information */
+ eNew->Org = eOrg->Dst;
+ eNewSym->Org = eDst->Org;
+ eNew->Lface = eNewSym->Lface = eOrg->Lface;
+
+ /* Make sure the old face points to a valid half-edge */
+ eOrg->Lface->anEdge = eNewSym;
+
+ if( ! joiningLoops ) {
+ GLUface *newFace= allocFace();
+ if (newFace == NULL) return NULL;
+
+ /* We split one loop into two -- the new loop is eNew->Lface */
+ MakeFace( newFace, eNew, eOrg->Lface );
+ }
+ return eNew;
+}
+
+
+/******************** Other Operations **********************/
+
+/* __gl_meshZapFace( fZap ) destroys a face and removes it from the
+ * global face list. All edges of fZap will have a NULL pointer as their
+ * left face. Any edges which also have a NULL pointer as their right face
+ * are deleted entirely (along with any isolated vertices this produces).
+ * An entire mesh can be deleted by zapping its faces, one at a time,
+ * in any order. Zapped faces cannot be used in further mesh operations!
+ */
+void __gl_meshZapFace( GLUface *fZap )
+{
+ GLUhalfEdge *eStart = fZap->anEdge;
+ GLUhalfEdge *e, *eNext, *eSym;
+ GLUface *fPrev, *fNext;
+
+ /* walk around face, deleting edges whose right face is also NULL */
+ eNext = eStart->Lnext;
+ do {
+ e = eNext;
+ eNext = e->Lnext;
+
+ e->Lface = NULL;
+ if( e->Rface == NULL ) {
+ /* delete the edge -- see __gl_MeshDelete above */
+
+ if( e->Onext == e ) {
+ KillVertex( e->Org, NULL );
+ } else {
+ /* Make sure that e->Org points to a valid half-edge */
+ e->Org->anEdge = e->Onext;
+ Splice( e, e->Oprev );
+ }
+ eSym = e->Sym;
+ if( eSym->Onext == eSym ) {
+ KillVertex( eSym->Org, NULL );
+ } else {
+ /* Make sure that eSym->Org points to a valid half-edge */
+ eSym->Org->anEdge = eSym->Onext;
+ Splice( eSym, eSym->Oprev );
+ }
+ KillEdge( e );
+ }
+ } while( e != eStart );
+
+ /* delete from circular doubly-linked list */
+ fPrev = fZap->prev;
+ fNext = fZap->next;
+ fNext->prev = fPrev;
+ fPrev->next = fNext;
+
+ memFree( fZap );
+}
+
+
+/* __gl_meshNewMesh() creates a new mesh with no edges, no vertices,
+ * and no loops (what we usually call a "face").
+ */
+GLUmesh *__gl_meshNewMesh( void )
+{
+ GLUvertex *v;
+ GLUface *f;
+ GLUhalfEdge *e;
+ GLUhalfEdge *eSym;
+ GLUmesh *mesh = (GLUmesh *)memAlloc( sizeof( GLUmesh ));
+ if (mesh == NULL) {
+ return NULL;
+ }
+
+ v = &mesh->vHead;
+ f = &mesh->fHead;
+ e = &mesh->eHead;
+ eSym = &mesh->eHeadSym;
+
+ v->next = v->prev = v;
+ v->anEdge = NULL;
+ v->data = NULL;
+
+ f->next = f->prev = f;
+ f->anEdge = NULL;
+ f->data = NULL;
+ f->trail = NULL;
+ f->marked = FALSE;
+ f->inside = FALSE;
+
+ e->next = e;
+ e->Sym = eSym;
+ e->Onext = NULL;
+ e->Lnext = NULL;
+ e->Org = NULL;
+ e->Lface = NULL;
+ e->winding = 0;
+ e->activeRegion = NULL;
+
+ eSym->next = eSym;
+ eSym->Sym = e;
+ eSym->Onext = NULL;
+ eSym->Lnext = NULL;
+ eSym->Org = NULL;
+ eSym->Lface = NULL;
+ eSym->winding = 0;
+ eSym->activeRegion = NULL;
+
+ return mesh;
+}
+
+
+/* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in
+ * both meshes, and returns the new mesh (the old meshes are destroyed).
+ */
+GLUmesh *__gl_meshUnion( GLUmesh *mesh1, GLUmesh *mesh2 )
+{
+ GLUface *f1 = &mesh1->fHead;
+ GLUvertex *v1 = &mesh1->vHead;
+ GLUhalfEdge *e1 = &mesh1->eHead;
+ GLUface *f2 = &mesh2->fHead;
+ GLUvertex *v2 = &mesh2->vHead;
+ GLUhalfEdge *e2 = &mesh2->eHead;
+
+ /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */
+ if( f2->next != f2 ) {
+ f1->prev->next = f2->next;
+ f2->next->prev = f1->prev;
+ f2->prev->next = f1;
+ f1->prev = f2->prev;
+ }
+
+ if( v2->next != v2 ) {
+ v1->prev->next = v2->next;
+ v2->next->prev = v1->prev;
+ v2->prev->next = v1;
+ v1->prev = v2->prev;
+ }
+
+ if( e2->next != e2 ) {
+ e1->Sym->next->Sym->next = e2->next;
+ e2->next->Sym->next = e1->Sym->next;
+ e2->Sym->next->Sym->next = e1;
+ e1->Sym->next = e2->Sym->next;
+ }
+
+ memFree( mesh2 );
+ return mesh1;
+}
+
+
+#ifdef DELETE_BY_ZAPPING
+
+/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh.
+ */
+void __gl_meshDeleteMesh( GLUmesh *mesh )
+{
+ GLUface *fHead = &mesh->fHead;
+
+ while( fHead->next != fHead ) {
+ __gl_meshZapFace( fHead->next );
+ }
+ assert( mesh->vHead.next == &mesh->vHead );
+
+ memFree( mesh );
+}
+
+#else
+
+/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh.
+ */
+void __gl_meshDeleteMesh( GLUmesh *mesh )
+{
+ GLUface *f, *fNext;
+ GLUvertex *v, *vNext;
+ GLUhalfEdge *e, *eNext;
+
+ for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) {
+ fNext = f->next;
+ memFree( f );
+ }
+
+ for( v = mesh->vHead.next; v != &mesh->vHead; v = vNext ) {
+ vNext = v->next;
+ memFree( v );
+ }
+
+ for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) {
+ /* One call frees both e and e->Sym (see EdgePair above) */
+ eNext = e->next;
+ memFree( e );
+ }
+
+ memFree( mesh );
+}
+
+#endif
+
+#ifndef NDEBUG
+
+/* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency.
+ */
+void __gl_meshCheckMesh( GLUmesh *mesh )
+{
+ GLUface *fHead = &mesh->fHead;
+ GLUvertex *vHead = &mesh->vHead;
+ GLUhalfEdge *eHead = &mesh->eHead;
+ GLUface *f, *fPrev;
+ GLUvertex *v, *vPrev;
+ GLUhalfEdge *e, *ePrev;
+
+ fPrev = fHead;
+ for( fPrev = fHead ; (f = fPrev->next) != fHead; fPrev = f) {
+ assert( f->prev == fPrev );
+ e = f->anEdge;
+ do {
+ assert( e->Sym != e );
+ assert( e->Sym->Sym == e );
+ assert( e->Lnext->Onext->Sym == e );
+ assert( e->Onext->Sym->Lnext == e );
+ assert( e->Lface == f );
+ e = e->Lnext;
+ } while( e != f->anEdge );
+ }
+ assert( f->prev == fPrev && f->anEdge == NULL && f->data == NULL );
+
+ vPrev = vHead;
+ for( vPrev = vHead ; (v = vPrev->next) != vHead; vPrev = v) {
+ assert( v->prev == vPrev );
+ e = v->anEdge;
+ do {
+ assert( e->Sym != e );
+ assert( e->Sym->Sym == e );
+ assert( e->Lnext->Onext->Sym == e );
+ assert( e->Onext->Sym->Lnext == e );
+ assert( e->Org == v );
+ e = e->Onext;
+ } while( e != v->anEdge );
+ }
+ assert( v->prev == vPrev && v->anEdge == NULL && v->data == NULL );
+
+ ePrev = eHead;
+ for( ePrev = eHead ; (e = ePrev->next) != eHead; ePrev = e) {
+ assert( e->Sym->next == ePrev->Sym );
+ assert( e->Sym != e );
+ assert( e->Sym->Sym == e );
+ assert( e->Org != NULL );
+ assert( e->Dst != NULL );
+ assert( e->Lnext->Onext->Sym == e );
+ assert( e->Onext->Sym->Lnext == e );
+ }
+ assert( e->Sym->next == ePrev->Sym
+ && e->Sym == &mesh->eHeadSym
+ && e->Sym->Sym == e
+ && e->Org == NULL && e->Dst == NULL
+ && e->Lface == NULL && e->Rface == NULL );
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.h
new file mode 100644
index 0000000..b836411
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/mesh.h
@@ -0,0 +1,273 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/mesh.h#5 $
+*/
+
+#ifndef __mesh_h_
+#define __mesh_h_
+
+#include "ThirdParty/glu/internal_glu.h"
+
+typedef struct GLUmesh GLUmesh;
+
+typedef struct GLUvertex GLUvertex;
+typedef struct GLUface GLUface;
+typedef struct GLUhalfEdge GLUhalfEdge;
+
+typedef struct ActiveRegion ActiveRegion; /* Internal data */
+
+/* The mesh structure is similar in spirit, notation, and operations
+ * to the "quad-edge" structure (see L. Guibas and J. Stolfi, Primitives
+ * for the manipulation of general subdivisions and the computation of
+ * Voronoi diagrams, ACM Transactions on Graphics, 4(2):74-123, April 1985).
+ * For a simplified description, see the course notes for CS348a,
+ * "Mathematical Foundations of Computer Graphics", available at the
+ * Stanford bookstore (and taught during the fall quarter).
+ * The implementation also borrows a tiny subset of the graph-based approach
+ * use in Mantyla's Geometric Work Bench (see M. Mantyla, An Introduction
+ * to Sold Modeling, Computer Science Press, Rockville, Maryland, 1988).
+ *
+ * The fundamental data structure is the "half-edge". Two half-edges
+ * go together to make an edge, but they point in opposite directions.
+ * Each half-edge has a pointer to its mate (the "symmetric" half-edge Sym),
+ * its origin vertex (Org), the face on its left side (Lface), and the
+ * adjacent half-edges in the CCW direction around the origin vertex
+ * (Onext) and around the left face (Lnext). There is also a "next"
+ * pointer for the global edge list (see below).
+ *
+ * The notation used for mesh navigation:
+ * Sym = the mate of a half-edge (same edge, but opposite direction)
+ * Onext = edge CCW around origin vertex (keep same origin)
+ * Dnext = edge CCW around destination vertex (keep same dest)
+ * Lnext = edge CCW around left face (dest becomes new origin)
+ * Rnext = edge CCW around right face (origin becomes new dest)
+ *
+ * "prev" means to substitute CW for CCW in the definitions above.
+ *
+ * The mesh keeps global lists of all vertices, faces, and edges,
+ * stored as doubly-linked circular lists with a dummy header node.
+ * The mesh stores pointers to these dummy headers (vHead, fHead, eHead).
+ *
+ * The circular edge list is special; since half-edges always occur
+ * in pairs (e and e->Sym), each half-edge stores a pointer in only
+ * one direction. Starting at eHead and following the e->next pointers
+ * will visit each *edge* once (ie. e or e->Sym, but not both).
+ * e->Sym stores a pointer in the opposite direction, thus it is
+ * always true that e->Sym->next->Sym->next == e.
+ *
+ * Each vertex has a pointer to next and previous vertices in the
+ * circular list, and a pointer to a half-edge with this vertex as
+ * the origin (NULL if this is the dummy header). There is also a
+ * field "data" for client data.
+ *
+ * Each face has a pointer to the next and previous faces in the
+ * circular list, and a pointer to a half-edge with this face as
+ * the left face (NULL if this is the dummy header). There is also
+ * a field "data" for client data.
+ *
+ * Note that what we call a "face" is really a loop; faces may consist
+ * of more than one loop (ie. not simply connected), but there is no
+ * record of this in the data structure. The mesh may consist of
+ * several disconnected regions, so it may not be possible to visit
+ * the entire mesh by starting at a half-edge and traversing the edge
+ * structure.
+ *
+ * The mesh does NOT support isolated vertices; a vertex is deleted along
+ * with its last edge. Similarly when two faces are merged, one of the
+ * faces is deleted (see __gl_meshDelete below). For mesh operations,
+ * all face (loop) and vertex pointers must not be NULL. However, once
+ * mesh manipulation is finished, __gl_MeshZapFace can be used to delete
+ * faces of the mesh, one at a time. All external faces can be "zapped"
+ * before the mesh is returned to the client; then a NULL face indicates
+ * a region which is not part of the output polygon.
+ */
+
+struct GLUvertex {
+ GLUvertex *next; /* next vertex (never NULL) */
+ GLUvertex *prev; /* previous vertex (never NULL) */
+ GLUhalfEdge *anEdge; /* a half-edge with this origin */
+ void *data; /* client's data */
+
+ /* Internal data (keep hidden) */
+ GLdouble coords[3]; /* vertex location in 3D */
+ GLdouble s, t; /* projection onto the sweep plane */
+ long pqHandle; /* to allow deletion from priority queue */
+};
+
+struct GLUface {
+ GLUface *next; /* next face (never NULL) */
+ GLUface *prev; /* previous face (never NULL) */
+ GLUhalfEdge *anEdge; /* a half edge with this left face */
+ void *data; /* room for client's data */
+
+ /* Internal data (keep hidden) */
+ GLUface *trail; /* "stack" for conversion to strips */
+ GLboolean marked; /* flag for conversion to strips */
+ GLboolean inside; /* this face is in the polygon interior */
+};
+
+struct GLUhalfEdge {
+ GLUhalfEdge *next; /* doubly-linked list (prev==Sym->next) */
+ GLUhalfEdge *Sym; /* same edge, opposite direction */
+ GLUhalfEdge *Onext; /* next edge CCW around origin */
+ GLUhalfEdge *Lnext; /* next edge CCW around left face */
+ GLUvertex *Org; /* origin vertex (Overtex too long) */
+ GLUface *Lface; /* left face */
+
+ /* Internal data (keep hidden) */
+ ActiveRegion *activeRegion; /* a region with this upper edge (sweep.c) */
+ int winding; /* change in winding number when crossing
+ from the right face to the left face */
+};
+
+#define Rface Sym->Lface
+#define Dst Sym->Org
+
+#define Oprev Sym->Lnext
+#define Lprev Onext->Sym
+#define Dprev Lnext->Sym
+#define Rprev Sym->Onext
+#define Dnext Rprev->Sym /* 3 pointers */
+#define Rnext Oprev->Sym /* 3 pointers */
+
+
+struct GLUmesh {
+ GLUvertex vHead; /* dummy header for vertex list */
+ GLUface fHead; /* dummy header for face list */
+ GLUhalfEdge eHead; /* dummy header for edge list */
+ GLUhalfEdge eHeadSym; /* and its symmetric counterpart */
+};
+
+/* The mesh operations below have three motivations: completeness,
+ * convenience, and efficiency. The basic mesh operations are MakeEdge,
+ * Splice, and Delete. All the other edge operations can be implemented
+ * in terms of these. The other operations are provided for convenience
+ * and/or efficiency.
+ *
+ * When a face is split or a vertex is added, they are inserted into the
+ * global list *before* the existing vertex or face (ie. e->Org or e->Lface).
+ * This makes it easier to process all vertices or faces in the global lists
+ * without worrying about processing the same data twice. As a convenience,
+ * when a face is split, the "inside" flag is copied from the old face.
+ * Other internal data (v->data, v->activeRegion, f->data, f->marked,
+ * f->trail, e->winding) is set to zero.
+ *
+ * ********************** Basic Edge Operations **************************
+ *
+ * __gl_meshMakeEdge( mesh ) creates one edge, two vertices, and a loop.
+ * The loop (face) consists of the two new half-edges.
+ *
+ * __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the
+ * mesh connectivity and topology. It changes the mesh so that
+ * eOrg->Onext <- OLD( eDst->Onext )
+ * eDst->Onext <- OLD( eOrg->Onext )
+ * where OLD(...) means the value before the meshSplice operation.
+ *
+ * This can have two effects on the vertex structure:
+ * - if eOrg->Org != eDst->Org, the two vertices are merged together
+ * - if eOrg->Org == eDst->Org, the origin is split into two vertices
+ * In both cases, eDst->Org is changed and eOrg->Org is untouched.
+ *
+ * Similarly (and independently) for the face structure,
+ * - if eOrg->Lface == eDst->Lface, one loop is split into two
+ * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one
+ * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected.
+ *
+ * __gl_meshDelete( eDel ) removes the edge eDel. There are several cases:
+ * if (eDel->Lface != eDel->Rface), we join two loops into one; the loop
+ * eDel->Lface is deleted. Otherwise, we are splitting one loop into two;
+ * the newly created loop will contain eDel->Dst. If the deletion of eDel
+ * would create isolated vertices, those are deleted as well.
+ *
+ * ********************** Other Edge Operations **************************
+ *
+ * __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that
+ * eNew == eOrg->Lnext, and eNew->Dst is a newly created vertex.
+ * eOrg and eNew will have the same left face.
+ *
+ * __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew,
+ * such that eNew == eOrg->Lnext. The new vertex is eOrg->Dst == eNew->Org.
+ * eOrg and eNew will have the same left face.
+ *
+ * __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg->Dst
+ * to eDst->Org, and returns the corresponding half-edge eNew.
+ * If eOrg->Lface == eDst->Lface, this splits one loop into two,
+ * and the newly created loop is eNew->Lface. Otherwise, two disjoint
+ * loops are merged into one, and the loop eDst->Lface is destroyed.
+ *
+ * ************************ Other Operations *****************************
+ *
+ * __gl_meshNewMesh() creates a new mesh with no edges, no vertices,
+ * and no loops (what we usually call a "face").
+ *
+ * __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in
+ * both meshes, and returns the new mesh (the old meshes are destroyed).
+ *
+ * __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh.
+ *
+ * __gl_meshZapFace( fZap ) destroys a face and removes it from the
+ * global face list. All edges of fZap will have a NULL pointer as their
+ * left face. Any edges which also have a NULL pointer as their right face
+ * are deleted entirely (along with any isolated vertices this produces).
+ * An entire mesh can be deleted by zapping its faces, one at a time,
+ * in any order. Zapped faces cannot be used in further mesh operations!
+ *
+ * __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency.
+ */
+
+GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh );
+int __gl_meshSplice( GLUhalfEdge *eOrg, GLUhalfEdge *eDst );
+int __gl_meshDelete( GLUhalfEdge *eDel );
+
+GLUhalfEdge *__gl_meshAddEdgeVertex( GLUhalfEdge *eOrg );
+GLUhalfEdge *__gl_meshSplitEdge( GLUhalfEdge *eOrg );
+GLUhalfEdge *__gl_meshConnect( GLUhalfEdge *eOrg, GLUhalfEdge *eDst );
+
+GLUmesh *__gl_meshNewMesh( void );
+GLUmesh *__gl_meshUnion( GLUmesh *mesh1, GLUmesh *mesh2 );
+void __gl_meshDeleteMesh( GLUmesh *mesh );
+void __gl_meshZapFace( GLUface *fZap );
+
+#ifdef NDEBUG
+#define __gl_meshCheckMesh( mesh )
+#else
+void __gl_meshCheckMesh( GLUmesh *mesh );
+#endif
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.c
new file mode 100644
index 0000000..bbe57fd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.c
@@ -0,0 +1,259 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/normal.c#5 $
+*/
+
+#include <assert.h>
+#include <math.h>
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+#include "ThirdParty/glu/libtess/normal.h"
+#include "ThirdParty/glu/libtess/tess.h"
+
+#define TRUE 1
+#define FALSE 0
+
+#define Dot(u,v) (u[0]*v[0] + u[1]*v[1] + u[2]*v[2])
+
+#if defined(FOR_TRITE_TEST_PROGRAM) || defined(TRUE_PROJECT)
+static void Normalize( GLdouble v[3] )
+{
+ GLdouble len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
+
+ assert( len > 0 );
+ len = sqrt( len );
+ v[0] /= len;
+ v[1] /= len;
+ v[2] /= len;
+}
+#endif
+
+#define ABS(x) ((x) < 0 ? -(x) : (x))
+
+static int LongAxis( GLdouble v[3] )
+{
+ int i = 0;
+
+ if( ABS(v[1]) > ABS(v[0]) ) { i = 1; }
+ if( ABS(v[2]) > ABS(v[i]) ) { i = 2; }
+ return i;
+}
+
+static void ComputeNormal( GLUtesselator *tess, GLdouble norm[3] )
+{
+ GLUvertex *v, *v1, *v2;
+ GLdouble c, tLen2, maxLen2;
+ GLdouble maxVal[3], minVal[3], d1[3], d2[3], tNorm[3];
+ GLUvertex *maxVert[3], *minVert[3];
+ GLUvertex *vHead = &tess->mesh->vHead;
+ int i;
+
+ maxVal[0] = maxVal[1] = maxVal[2] = -2 * GLU_TESS_MAX_COORD;
+ minVal[0] = minVal[1] = minVal[2] = 2 * GLU_TESS_MAX_COORD;
+
+ for( v = vHead->next; v != vHead; v = v->next ) {
+ for( i = 0; i < 3; ++i ) {
+ c = v->coords[i];
+ if( c < minVal[i] ) { minVal[i] = c; minVert[i] = v; }
+ if( c > maxVal[i] ) { maxVal[i] = c; maxVert[i] = v; }
+ }
+ }
+
+ /* Find two vertices separated by at least 1/sqrt(3) of the maximum
+ * distance between any two vertices
+ */
+ i = 0;
+ if( maxVal[1] - minVal[1] > maxVal[0] - minVal[0] ) { i = 1; }
+ if( maxVal[2] - minVal[2] > maxVal[i] - minVal[i] ) { i = 2; }
+ if( minVal[i] >= maxVal[i] ) {
+ /* All vertices are the same -- normal doesn't matter */
+ norm[0] = 0; norm[1] = 0; norm[2] = 1;
+ return;
+ }
+
+ /* Look for a third vertex which forms the triangle with maximum area
+ * (Length of normal == twice the triangle area)
+ */
+ maxLen2 = 0;
+ v1 = minVert[i];
+ v2 = maxVert[i];
+ d1[0] = v1->coords[0] - v2->coords[0];
+ d1[1] = v1->coords[1] - v2->coords[1];
+ d1[2] = v1->coords[2] - v2->coords[2];
+ for( v = vHead->next; v != vHead; v = v->next ) {
+ d2[0] = v->coords[0] - v2->coords[0];
+ d2[1] = v->coords[1] - v2->coords[1];
+ d2[2] = v->coords[2] - v2->coords[2];
+ tNorm[0] = d1[1]*d2[2] - d1[2]*d2[1];
+ tNorm[1] = d1[2]*d2[0] - d1[0]*d2[2];
+ tNorm[2] = d1[0]*d2[1] - d1[1]*d2[0];
+ tLen2 = tNorm[0]*tNorm[0] + tNorm[1]*tNorm[1] + tNorm[2]*tNorm[2];
+ if( tLen2 > maxLen2 ) {
+ maxLen2 = tLen2;
+ norm[0] = tNorm[0];
+ norm[1] = tNorm[1];
+ norm[2] = tNorm[2];
+ }
+ }
+
+ if( maxLen2 <= 0 ) {
+ /* All points lie on a single line -- any decent normal will do */
+ norm[0] = norm[1] = norm[2] = 0;
+ norm[LongAxis(d1)] = 1;
+ }
+}
+
+
+static void CheckOrientation( GLUtesselator *tess )
+{
+ GLdouble area;
+ GLUface *f, *fHead = &tess->mesh->fHead;
+ GLUvertex *v, *vHead = &tess->mesh->vHead;
+ GLUhalfEdge *e;
+
+ /* When we compute the normal automatically, we choose the orientation
+ * so that the the sum of the signed areas of all contours is non-negative.
+ */
+ area = 0;
+ for( f = fHead->next; f != fHead; f = f->next ) {
+ e = f->anEdge;
+ if( e->winding <= 0 ) continue;
+ do {
+ area += (e->Org->s - e->Dst->s) * (e->Org->t + e->Dst->t);
+ e = e->Lnext;
+ } while( e != f->anEdge );
+ }
+ if( area < 0 ) {
+ /* Reverse the orientation by flipping all the t-coordinates */
+ for( v = vHead->next; v != vHead; v = v->next ) {
+ v->t = - v->t;
+ }
+ tess->tUnit[0] = - tess->tUnit[0];
+ tess->tUnit[1] = - tess->tUnit[1];
+ tess->tUnit[2] = - tess->tUnit[2];
+ }
+}
+
+#ifdef FOR_TRITE_TEST_PROGRAM
+#include <stdlib.h>
+extern int RandomSweep;
+#define S_UNIT_X (RandomSweep ? (2*drand48()-1) : 1.0)
+#define S_UNIT_Y (RandomSweep ? (2*drand48()-1) : 0.0)
+#else
+#if defined(SLANTED_SWEEP)
+/* The "feature merging" is not intended to be complete. There are
+ * special cases where edges are nearly parallel to the sweep line
+ * which are not implemented. The algorithm should still behave
+ * robustly (ie. produce a reasonable tesselation) in the presence
+ * of such edges, however it may miss features which could have been
+ * merged. We could minimize this effect by choosing the sweep line
+ * direction to be something unusual (ie. not parallel to one of the
+ * coordinate axes).
+ */
+#define S_UNIT_X 0.50941539564955385 /* Pre-normalized */
+#define S_UNIT_Y 0.86052074622010633
+#else
+#define S_UNIT_X 1.0
+#define S_UNIT_Y 0.0
+#endif
+#endif
+
+/* Determine the polygon normal and project vertices onto the plane
+ * of the polygon.
+ */
+void __gl_projectPolygon( GLUtesselator *tess )
+{
+ GLUvertex *v, *vHead = &tess->mesh->vHead;
+ GLdouble norm[3];
+ GLdouble *sUnit, *tUnit;
+ int i, computedNormal = FALSE;
+
+ norm[0] = tess->normal[0];
+ norm[1] = tess->normal[1];
+ norm[2] = tess->normal[2];
+ if( norm[0] == 0 && norm[1] == 0 && norm[2] == 0 ) {
+ ComputeNormal( tess, norm );
+ computedNormal = TRUE;
+ }
+ sUnit = tess->sUnit;
+ tUnit = tess->tUnit;
+ i = LongAxis( norm );
+
+#if defined(FOR_TRITE_TEST_PROGRAM) || defined(TRUE_PROJECT)
+ /* Choose the initial sUnit vector to be approximately perpendicular
+ * to the normal.
+ */
+ Normalize( norm );
+
+ sUnit[i] = 0;
+ sUnit[(i+1)%3] = S_UNIT_X;
+ sUnit[(i+2)%3] = S_UNIT_Y;
+
+ /* Now make it exactly perpendicular */
+ w = Dot( sUnit, norm );
+ sUnit[0] -= w * norm[0];
+ sUnit[1] -= w * norm[1];
+ sUnit[2] -= w * norm[2];
+ Normalize( sUnit );
+
+ /* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */
+ tUnit[0] = norm[1]*sUnit[2] - norm[2]*sUnit[1];
+ tUnit[1] = norm[2]*sUnit[0] - norm[0]*sUnit[2];
+ tUnit[2] = norm[0]*sUnit[1] - norm[1]*sUnit[0];
+ Normalize( tUnit );
+#else
+ /* Project perpendicular to a coordinate axis -- better numerically */
+ sUnit[i] = 0;
+ sUnit[(i+1)%3] = S_UNIT_X;
+ sUnit[(i+2)%3] = S_UNIT_Y;
+
+ tUnit[i] = 0;
+ tUnit[(i+1)%3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y;
+ tUnit[(i+2)%3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X;
+#endif
+
+ /* Project the vertices onto the sweep plane */
+ for( v = vHead->next; v != vHead; v = v->next ) {
+ v->s = Dot( v->coords, sUnit );
+ v->t = Dot( v->coords, tUnit );
+ }
+ if( computedNormal ) {
+ CheckOrientation( tess );
+ }
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.h
new file mode 100644
index 0000000..f52bd09
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/normal.h
@@ -0,0 +1,52 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/normal.h#5 $
+*/
+
+#ifndef __normal_h_
+#define __normal_h_
+
+#include "ThirdParty/glu/libtess/tess.h"
+
+/* __gl_projectPolygon( tess ) determines the polygon normal
+ * and project vertices onto the plane of the polygon.
+ */
+void __gl_projectPolygon( GLUtesselator *tess );
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.c
new file mode 100644
index 0000000..43af727
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.c
@@ -0,0 +1,260 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/priorityq-heap.c#5 $
+*/
+
+#include <assert.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ThirdParty/glu/libtess/memalloc.h"
+#include "ThirdParty/glu/libtess/priorityq-heap.h"
+
+#define INIT_SIZE 32
+
+#define TRUE 1
+#define FALSE 0
+
+#ifdef FOR_TRITE_TEST_PROGRAM
+#define LEQ(x,y) (*pq->leq)(x,y)
+#else
+/* Violates modularity, but a little faster */
+#include "geom.h"
+#define LEQ(x,y) VertLeq((GLUvertex *)x, (GLUvertex *)y)
+#endif
+
+/* really __gl_pqHeapNewPriorityQ */
+PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) )
+{
+ PriorityQ *pq = (PriorityQ *)memAlloc( sizeof( PriorityQ ));
+ if (pq == NULL) return NULL;
+
+ pq->size = 0;
+ pq->max = INIT_SIZE;
+ pq->nodes = (PQnode *)memAlloc( (INIT_SIZE + 1) * sizeof(pq->nodes[0]) );
+ if (pq->nodes == NULL) {
+ memFree(pq);
+ return NULL;
+ }
+
+ pq->handles = (PQhandleElem *)memAlloc( (INIT_SIZE + 1) * sizeof(pq->handles[0]) );
+ if (pq->handles == NULL) {
+ memFree(pq->nodes);
+ memFree(pq);
+ return NULL;
+ }
+
+ pq->initialized = FALSE;
+ pq->freeList = 0;
+ pq->leq = leq;
+
+ pq->nodes[1].handle = 1; /* so that Minimum() returns NULL */
+ pq->handles[1].key = NULL;
+ return pq;
+}
+
+/* really __gl_pqHeapDeletePriorityQ */
+void pqDeletePriorityQ( PriorityQ *pq )
+{
+ memFree( pq->handles );
+ memFree( pq->nodes );
+ memFree( pq );
+}
+
+
+static void FloatDown( PriorityQ *pq, long curr )
+{
+ PQnode *n = pq->nodes;
+ PQhandleElem *h = pq->handles;
+ PQhandle hCurr, hChild;
+ long child;
+
+ hCurr = n[curr].handle;
+ for( ;; ) {
+ child = curr << 1;
+ if( child < pq->size && LEQ( h[n[child+1].handle].key,
+ h[n[child].handle].key )) {
+ ++child;
+ }
+
+ assert(child <= pq->max);
+
+ hChild = n[child].handle;
+ if( child > pq->size || LEQ( h[hCurr].key, h[hChild].key )) {
+ n[curr].handle = hCurr;
+ h[hCurr].node = curr;
+ break;
+ }
+ n[curr].handle = hChild;
+ h[hChild].node = curr;
+ curr = child;
+ }
+}
+
+
+static void FloatUp( PriorityQ *pq, long curr )
+{
+ PQnode *n = pq->nodes;
+ PQhandleElem *h = pq->handles;
+ PQhandle hCurr, hParent;
+ long parent;
+
+ hCurr = n[curr].handle;
+ for( ;; ) {
+ parent = curr >> 1;
+ hParent = n[parent].handle;
+ if( parent == 0 || LEQ( h[hParent].key, h[hCurr].key )) {
+ n[curr].handle = hCurr;
+ h[hCurr].node = curr;
+ break;
+ }
+ n[curr].handle = hParent;
+ h[hParent].node = curr;
+ curr = parent;
+ }
+}
+
+/* really __gl_pqHeapInit */
+void pqInit( PriorityQ *pq )
+{
+ long i;
+
+ /* This method of building a heap is O(n), rather than O(n lg n). */
+
+ for( i = pq->size; i >= 1; --i ) {
+ FloatDown( pq, i );
+ }
+ pq->initialized = TRUE;
+}
+
+/* really __gl_pqHeapInsert */
+/* returns LONG_MAX iff out of memory */
+PQhandle pqInsert( PriorityQ *pq, PQkey keyNew )
+{
+ long curr;
+ PQhandle free;
+
+ curr = ++ pq->size;
+ if( (curr*2) > pq->max ) {
+ PQnode *saveNodes= pq->nodes;
+ PQhandleElem *saveHandles= pq->handles;
+
+ /* If the heap overflows, double its size. */
+ pq->max <<= 1;
+ pq->nodes = (PQnode *)memRealloc( pq->nodes,
+ (size_t)
+ ((pq->max + 1) * sizeof( pq->nodes[0] )));
+ if (pq->nodes == NULL) {
+ pq->nodes = saveNodes; /* restore ptr to free upon return */
+ return LONG_MAX;
+ }
+ pq->handles = (PQhandleElem *)memRealloc( pq->handles,
+ (size_t)
+ ((pq->max + 1) *
+ sizeof( pq->handles[0] )));
+ if (pq->handles == NULL) {
+ pq->handles = saveHandles; /* restore ptr to free upon return */
+ return LONG_MAX;
+ }
+ }
+
+ if( pq->freeList == 0 ) {
+ free = curr;
+ } else {
+ free = pq->freeList;
+ pq->freeList = pq->handles[free].node;
+ }
+
+ pq->nodes[curr].handle = free;
+ pq->handles[free].node = curr;
+ pq->handles[free].key = keyNew;
+
+ if( pq->initialized ) {
+ FloatUp( pq, curr );
+ }
+ assert(free != LONG_MAX);
+ return free;
+}
+
+/* really __gl_pqHeapExtractMin */
+PQkey pqExtractMin( PriorityQ *pq )
+{
+ PQnode *n = pq->nodes;
+ PQhandleElem *h = pq->handles;
+ PQhandle hMin = n[1].handle;
+ PQkey min = h[hMin].key;
+
+ if( pq->size > 0 ) {
+ n[1].handle = n[pq->size].handle;
+ h[n[1].handle].node = 1;
+
+ h[hMin].key = NULL;
+ h[hMin].node = pq->freeList;
+ pq->freeList = hMin;
+
+ if( -- pq->size > 0 ) {
+ FloatDown( pq, 1 );
+ }
+ }
+ return min;
+}
+
+/* really __gl_pqHeapDelete */
+void pqDelete( PriorityQ *pq, PQhandle hCurr )
+{
+ PQnode *n = pq->nodes;
+ PQhandleElem *h = pq->handles;
+ long curr;
+
+ assert( hCurr >= 1 && hCurr <= pq->max && h[hCurr].key != NULL );
+
+ curr = h[hCurr].node;
+ n[curr].handle = n[pq->size].handle;
+ h[n[curr].handle].node = curr;
+
+ if( curr <= -- pq->size ) {
+ if( curr <= 1 || LEQ( h[n[curr>>1].handle].key, h[n[curr].handle].key )) {
+ FloatDown( pq, curr );
+ } else {
+ FloatUp( pq, curr );
+ }
+ }
+ h[hCurr].key = NULL;
+ h[hCurr].node = pq->freeList;
+ pq->freeList = hCurr;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.h
new file mode 100644
index 0000000..02e4434
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-heap.h
@@ -0,0 +1,114 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/priorityq-heap.h#5 $
+*/
+
+#ifndef __priorityq_heap_h_
+#define __priorityq_heap_h_
+
+/* Use #define's so that another heap implementation can use this one */
+
+#define PQkey PQHeapKey
+#define PQhandle PQHeapHandle
+#define PriorityQ PriorityQHeap
+
+#define pqNewPriorityQ(leq) __gl_pqHeapNewPriorityQ(leq)
+#define pqDeletePriorityQ(pq) __gl_pqHeapDeletePriorityQ(pq)
+
+/* The basic operations are insertion of a new key (pqInsert),
+ * and examination/extraction of a key whose value is minimum
+ * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete);
+ * for this purpose pqInsert returns a "handle" which is supplied
+ * as the argument.
+ *
+ * An initial heap may be created efficiently by calling pqInsert
+ * repeatedly, then calling pqInit. In any case pqInit must be called
+ * before any operations other than pqInsert are used.
+ *
+ * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key.
+ * This may also be tested with pqIsEmpty.
+ */
+#define pqInit(pq) __gl_pqHeapInit(pq)
+#define pqInsert(pq,key) __gl_pqHeapInsert(pq,key)
+#define pqMinimum(pq) __gl_pqHeapMinimum(pq)
+#define pqExtractMin(pq) __gl_pqHeapExtractMin(pq)
+#define pqDelete(pq,handle) __gl_pqHeapDelete(pq,handle)
+#define pqIsEmpty(pq) __gl_pqHeapIsEmpty(pq)
+
+
+/* Since we support deletion the data structure is a little more
+ * complicated than an ordinary heap. "nodes" is the heap itself;
+ * active nodes are stored in the range 1..pq->size. When the
+ * heap exceeds its allocated size (pq->max), its size doubles.
+ * The children of node i are nodes 2i and 2i+1.
+ *
+ * Each node stores an index into an array "handles". Each handle
+ * stores a key, plus a pointer back to the node which currently
+ * represents that key (ie. nodes[handles[i].node].handle == i).
+ */
+
+typedef void *PQkey;
+typedef long PQhandle;
+typedef struct PriorityQ PriorityQ;
+
+typedef struct { PQhandle handle; } PQnode;
+typedef struct { PQkey key; PQhandle node; } PQhandleElem;
+
+struct PriorityQ {
+ PQnode *nodes;
+ PQhandleElem *handles;
+ long size, max;
+ PQhandle freeList;
+ int initialized;
+ int (*leq)(PQkey key1, PQkey key2);
+};
+
+PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) );
+void pqDeletePriorityQ( PriorityQ *pq );
+
+void pqInit( PriorityQ *pq );
+PQhandle pqInsert( PriorityQ *pq, PQkey key );
+PQkey pqExtractMin( PriorityQ *pq );
+void pqDelete( PriorityQ *pq, PQhandle handle );
+
+
+#define __gl_pqHeapMinimum(pq) ((pq)->handles[(pq)->nodes[1].handle].key)
+#define __gl_pqHeapIsEmpty(pq) ((pq)->size == 0)
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-sort.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-sort.h
new file mode 100644
index 0000000..2a5e71c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq-sort.h
@@ -0,0 +1,124 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/priorityq-sort.h#5 $
+*/
+
+#ifndef __priorityq_sort_h_
+#define __priorityq_sort_h_
+
+#include "ThirdParty/glu/libtess/priorityq-heap.h"
+
+#undef PQkey
+#undef PQhandle
+#undef PriorityQ
+#undef pqNewPriorityQ
+#undef pqDeletePriorityQ
+#undef pqInit
+#undef pqInsert
+#undef pqMinimum
+#undef pqExtractMin
+#undef pqDelete
+#undef pqIsEmpty
+
+/* Use #define's so that another heap implementation can use this one */
+
+#define PQkey PQSortKey
+#define PQhandle PQSortHandle
+#define PriorityQ PriorityQSort
+
+#define pqNewPriorityQ(leq) __gl_pqSortNewPriorityQ(leq)
+#define pqDeletePriorityQ(pq) __gl_pqSortDeletePriorityQ(pq)
+
+/* The basic operations are insertion of a new key (pqInsert),
+ * and examination/extraction of a key whose value is minimum
+ * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete);
+ * for this purpose pqInsert returns a "handle" which is supplied
+ * as the argument.
+ *
+ * An initial heap may be created efficiently by calling pqInsert
+ * repeatedly, then calling pqInit. In any case pqInit must be called
+ * before any operations other than pqInsert are used.
+ *
+ * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key.
+ * This may also be tested with pqIsEmpty.
+ */
+#define pqInit(pq) __gl_pqSortInit(pq)
+#define pqInsert(pq,key) __gl_pqSortInsert(pq,key)
+#define pqMinimum(pq) __gl_pqSortMinimum(pq)
+#define pqExtractMin(pq) __gl_pqSortExtractMin(pq)
+#define pqDelete(pq,handle) __gl_pqSortDelete(pq,handle)
+#define pqIsEmpty(pq) __gl_pqSortIsEmpty(pq)
+
+
+/* Since we support deletion the data structure is a little more
+ * complicated than an ordinary heap. "nodes" is the heap itself;
+ * active nodes are stored in the range 1..pq->size. When the
+ * heap exceeds its allocated size (pq->max), its size doubles.
+ * The children of node i are nodes 2i and 2i+1.
+ *
+ * Each node stores an index into an array "handles". Each handle
+ * stores a key, plus a pointer back to the node which currently
+ * represents that key (ie. nodes[handles[i].node].handle == i).
+ */
+
+typedef PQHeapKey PQkey;
+typedef PQHeapHandle PQhandle;
+typedef struct PriorityQ PriorityQ;
+
+struct PriorityQ {
+ PriorityQHeap *heap;
+ PQkey *keys;
+ PQkey **order;
+ PQhandle size, max;
+ int initialized;
+ int (*leq)(PQkey key1, PQkey key2);
+};
+
+PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) );
+void pqDeletePriorityQ( PriorityQ *pq );
+
+int pqInit( PriorityQ *pq );
+PQhandle pqInsert( PriorityQ *pq, PQkey key );
+PQkey pqExtractMin( PriorityQ *pq );
+void pqDelete( PriorityQ *pq, PQhandle handle );
+
+PQkey pqMinimum( PriorityQ *pq );
+int pqIsEmpty( PriorityQ *pq );
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.c
new file mode 100644
index 0000000..93f4179
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.c
@@ -0,0 +1,267 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/priorityq.c#5 $
+*/
+
+#include <assert.h>
+#include <limits.h> /* LONG_MAX */
+#include <stddef.h>
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/memalloc.h"
+
+/* Include all the code for the regular heap-based queue here. */
+
+#include "ThirdParty/glu/libtess/priorityq-heap.c"
+
+/* Now redefine all the function names to map to their "Sort" versions. */
+
+#include "ThirdParty/glu/libtess/priorityq-sort.h"
+
+/* really __gl_pqSortNewPriorityQ */
+PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) )
+{
+ PriorityQ *pq = (PriorityQ *)memAlloc( sizeof( PriorityQ ));
+ if (pq == NULL) return NULL;
+
+ pq->heap = __gl_pqHeapNewPriorityQ( leq );
+ if (pq->heap == NULL) {
+ memFree(pq);
+ return NULL;
+ }
+
+ pq->keys = (PQHeapKey *)memAlloc( INIT_SIZE * sizeof(pq->keys[0]) );
+ if (pq->keys == NULL) {
+ __gl_pqHeapDeletePriorityQ(pq->heap);
+ memFree(pq);
+ return NULL;
+ }
+
+ pq->size = 0;
+ pq->max = INIT_SIZE;
+ pq->initialized = FALSE;
+ pq->leq = leq;
+ return pq;
+}
+
+/* really __gl_pqSortDeletePriorityQ */
+void pqDeletePriorityQ( PriorityQ *pq )
+{
+ assert(pq != NULL);
+ if (pq->heap != NULL) __gl_pqHeapDeletePriorityQ( pq->heap );
+ if (pq->order != NULL) memFree( pq->order );
+ if (pq->keys != NULL) memFree( pq->keys );
+ memFree( pq );
+}
+
+
+#define LT(x,y) (! LEQ(y,x))
+#define GT(x,y) (! LEQ(x,y))
+#define Swap(a,b) do{PQkey *tmp = *a; *a = *b; *b = tmp;}while(0)
+
+/* really __gl_pqSortInit */
+int pqInit( PriorityQ *pq )
+{
+ PQkey **p, **r, **i, **j, *piv;
+ struct { PQkey **p, **r; } Stack[50], *top = Stack;
+ unsigned long seed = 2016473283;
+
+ /* Create an array of indirect pointers to the keys, so that we
+ * the handles we have returned are still valid.
+ */
+/*
+ pq->order = (PQHeapKey **)memAlloc( (size_t)
+ (pq->size * sizeof(pq->order[0])) );
+*/
+ pq->order = (PQHeapKey **)memAlloc( (size_t)
+ ((pq->size+1) * sizeof(pq->order[0])) );
+/* the previous line is a patch to compensate for the fact that IBM */
+/* machines return a null on a malloc of zero bytes (unlike SGI), */
+/* so we have to put in this defense to guard against a memory */
+/* fault four lines down. from fossum@austin.ibm.com. */
+ if (pq->order == NULL) return 0;
+
+ p = pq->order;
+ r = p + pq->size - 1;
+ for( piv = pq->keys, i = p; i <= r; ++piv, ++i ) {
+ *i = piv;
+ }
+
+ /* Sort the indirect pointers in descending order,
+ * using randomized Quicksort
+ */
+ top->p = p; top->r = r; ++top;
+ while( --top >= Stack ) {
+ p = top->p;
+ r = top->r;
+ while( r > p + 10 ) {
+ seed = seed * 1539415821 + 1;
+ i = p + seed % (r - p + 1);
+ piv = *i;
+ *i = *p;
+ *p = piv;
+ i = p - 1;
+ j = r + 1;
+ do {
+ do { ++i; } while( GT( **i, *piv ));
+ do { --j; } while( LT( **j, *piv ));
+ Swap( i, j );
+ } while( i < j );
+ Swap( i, j ); /* Undo last swap */
+ if( i - p < r - j ) {
+ top->p = j+1; top->r = r; ++top;
+ r = i-1;
+ } else {
+ top->p = p; top->r = i-1; ++top;
+ p = j+1;
+ }
+ }
+ /* Insertion sort small lists */
+ for( i = p+1; i <= r; ++i ) {
+ piv = *i;
+ for( j = i; j > p && LT( **(j-1), *piv ); --j ) {
+ *j = *(j-1);
+ }
+ *j = piv;
+ }
+ }
+ pq->max = pq->size;
+ pq->initialized = TRUE;
+ __gl_pqHeapInit( pq->heap ); /* always succeeds */
+
+#ifndef NDEBUG
+ p = pq->order;
+ r = p + pq->size - 1;
+ for( i = p; i < r; ++i ) {
+ assert( LEQ( **(i+1), **i ));
+ }
+#endif
+
+ return 1;
+}
+
+/* really __gl_pqSortInsert */
+/* returns LONG_MAX iff out of memory */
+PQhandle pqInsert( PriorityQ *pq, PQkey keyNew )
+{
+ long curr;
+
+ if( pq->initialized ) {
+ return __gl_pqHeapInsert( pq->heap, keyNew );
+ }
+ curr = pq->size;
+ if( ++ pq->size >= pq->max ) {
+ PQkey *saveKey= pq->keys;
+
+ /* If the heap overflows, double its size. */
+ pq->max <<= 1;
+ pq->keys = (PQHeapKey *)memRealloc( pq->keys,
+ (size_t)
+ (pq->max * sizeof( pq->keys[0] )));
+ if (pq->keys == NULL) {
+ pq->keys = saveKey; /* restore ptr to free upon return */
+ return LONG_MAX;
+ }
+ }
+ assert(curr != LONG_MAX);
+ pq->keys[curr] = keyNew;
+
+ /* Negative handles index the sorted array. */
+ return -(curr+1);
+}
+
+/* really __gl_pqSortExtractMin */
+PQkey pqExtractMin( PriorityQ *pq )
+{
+ PQkey sortMin, heapMin;
+
+ if( pq->size == 0 ) {
+ return __gl_pqHeapExtractMin( pq->heap );
+ }
+ sortMin = *(pq->order[pq->size-1]);
+ if( ! __gl_pqHeapIsEmpty( pq->heap )) {
+ heapMin = __gl_pqHeapMinimum( pq->heap );
+ if( LEQ( heapMin, sortMin )) {
+ return __gl_pqHeapExtractMin( pq->heap );
+ }
+ }
+ do {
+ -- pq->size;
+ } while( pq->size > 0 && *(pq->order[pq->size-1]) == NULL );
+ return sortMin;
+}
+
+/* really __gl_pqSortMinimum */
+PQkey pqMinimum( PriorityQ *pq )
+{
+ PQkey sortMin, heapMin;
+
+ if( pq->size == 0 ) {
+ return __gl_pqHeapMinimum( pq->heap );
+ }
+ sortMin = *(pq->order[pq->size-1]);
+ if( ! __gl_pqHeapIsEmpty( pq->heap )) {
+ heapMin = __gl_pqHeapMinimum( pq->heap );
+ if( LEQ( heapMin, sortMin )) {
+ return heapMin;
+ }
+ }
+ return sortMin;
+}
+
+/* really __gl_pqSortIsEmpty */
+int pqIsEmpty( PriorityQ *pq )
+{
+ return (pq->size == 0) && __gl_pqHeapIsEmpty( pq->heap );
+}
+
+/* really __gl_pqSortDelete */
+void pqDelete( PriorityQ *pq, PQhandle curr )
+{
+ if( curr >= 0 ) {
+ __gl_pqHeapDelete( pq->heap, curr );
+ return;
+ }
+ curr = -(curr+1);
+ assert( curr < pq->max && pq->keys[curr] != NULL );
+
+ pq->keys[curr] = NULL;
+ while( pq->size > 0 && *(pq->order[pq->size-1]) == NULL ) {
+ -- pq->size;
+ }
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.h
new file mode 100644
index 0000000..69af188
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/priorityq.h
@@ -0,0 +1,124 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/priorityq.h#5 $
+*/
+
+#ifndef __priorityq_sort_h_
+#define __priorityq_sort_h_
+
+#include "ThirdParty/glu/libtess/priorityq-heap.h"
+
+#undef PQkey
+#undef PQhandle
+#undef PriorityQ
+#undef pqNewPriorityQ
+#undef pqDeletePriorityQ
+#undef pqInit
+#undef pqInsert
+#undef pqMinimum
+#undef pqExtractMin
+#undef pqDelete
+#undef pqIsEmpty
+
+/* Use #define's so that another heap implementation can use this one */
+
+#define PQkey PQSortKey
+#define PQhandle PQSortHandle
+#define PriorityQ PriorityQSort
+
+#define pqNewPriorityQ(leq) __gl_pqSortNewPriorityQ(leq)
+#define pqDeletePriorityQ(pq) __gl_pqSortDeletePriorityQ(pq)
+
+/* The basic operations are insertion of a new key (pqInsert),
+ * and examination/extraction of a key whose value is minimum
+ * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete);
+ * for this purpose pqInsert returns a "handle" which is supplied
+ * as the argument.
+ *
+ * An initial heap may be created efficiently by calling pqInsert
+ * repeatedly, then calling pqInit. In any case pqInit must be called
+ * before any operations other than pqInsert are used.
+ *
+ * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key.
+ * This may also be tested with pqIsEmpty.
+ */
+#define pqInit(pq) __gl_pqSortInit(pq)
+#define pqInsert(pq,key) __gl_pqSortInsert(pq,key)
+#define pqMinimum(pq) __gl_pqSortMinimum(pq)
+#define pqExtractMin(pq) __gl_pqSortExtractMin(pq)
+#define pqDelete(pq,handle) __gl_pqSortDelete(pq,handle)
+#define pqIsEmpty(pq) __gl_pqSortIsEmpty(pq)
+
+
+/* Since we support deletion the data structure is a little more
+ * complicated than an ordinary heap. "nodes" is the heap itself;
+ * active nodes are stored in the range 1..pq->size. When the
+ * heap exceeds its allocated size (pq->max), its size doubles.
+ * The children of node i are nodes 2i and 2i+1.
+ *
+ * Each node stores an index into an array "handles". Each handle
+ * stores a key, plus a pointer back to the node which currently
+ * represents that key (ie. nodes[handles[i].node].handle == i).
+ */
+
+typedef PQHeapKey PQkey;
+typedef PQHeapHandle PQhandle;
+typedef struct PriorityQ PriorityQ;
+
+struct PriorityQ {
+ PriorityQHeap *heap;
+ PQkey *keys;
+ PQkey **order;
+ PQhandle size, max;
+ int initialized;
+ int (*leq)(PQkey key1, PQkey key2);
+};
+
+PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) );
+void pqDeletePriorityQ( PriorityQ *pq );
+
+int pqInit( PriorityQ *pq );
+PQhandle pqInsert( PriorityQ *pq, PQkey key );
+PQkey pqExtractMin( PriorityQ *pq );
+void pqDelete( PriorityQ *pq, PQhandle handle );
+
+PQkey pqMinimum( PriorityQ *pq );
+int pqIsEmpty( PriorityQ *pq );
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.c
new file mode 100644
index 0000000..e7534f5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.c
@@ -0,0 +1,505 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/render.c#5 $
+*/
+
+#include <assert.h>
+#include <stddef.h>
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+#include "ThirdParty/glu/libtess/render.h"
+#include "ThirdParty/glu/libtess/tess.h"
+
+#define TRUE 1
+#define FALSE 0
+
+/* This structure remembers the information we need about a primitive
+ * to be able to render it later, once we have determined which
+ * primitive is able to use the most triangles.
+ */
+struct FaceCount {
+ long size; /* number of triangles used */
+ GLUhalfEdge *eStart; /* edge where this primitive starts */
+ void (*render)(GLUtesselator *, GLUhalfEdge *, long);
+ /* routine to render this primitive */
+};
+
+static struct FaceCount MaximumFan( GLUhalfEdge *eOrig );
+static struct FaceCount MaximumStrip( GLUhalfEdge *eOrig );
+
+static void RenderFan( GLUtesselator *tess, GLUhalfEdge *eStart, long size );
+static void RenderStrip( GLUtesselator *tess, GLUhalfEdge *eStart, long size );
+static void RenderTriangle( GLUtesselator *tess, GLUhalfEdge *eStart,
+ long size );
+
+static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig );
+static void RenderLonelyTriangles( GLUtesselator *tess, GLUface *head );
+
+
+
+/************************ Strips and Fans decomposition ******************/
+
+/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle
+ * fans, strips, and separate triangles. A substantial effort is made
+ * to use as few rendering primitives as possible (ie. to make the fans
+ * and strips as large as possible).
+ *
+ * The rendering output is provided as callbacks (see the api).
+ */
+void __gl_renderMesh( GLUtesselator *tess, GLUmesh *mesh )
+{
+ GLUface *f;
+
+ /* Make a list of separate triangles so we can render them all at once */
+ tess->lonelyTriList = NULL;
+
+ for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) {
+ f->marked = FALSE;
+ }
+ for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) {
+
+ /* We examine all faces in an arbitrary order. Whenever we find
+ * an unprocessed face F, we output a group of faces including F
+ * whose size is maximum.
+ */
+ if( f->inside && ! f->marked ) {
+ RenderMaximumFaceGroup( tess, f );
+ assert( f->marked );
+ }
+ }
+ if( tess->lonelyTriList != NULL ) {
+ RenderLonelyTriangles( tess, tess->lonelyTriList );
+ tess->lonelyTriList = NULL;
+ }
+}
+
+
+static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig )
+{
+ /* We want to find the largest triangle fan or strip of unmarked faces
+ * which includes the given face fOrig. There are 3 possible fans
+ * passing through fOrig (one centered at each vertex), and 3 possible
+ * strips (one for each CCW permutation of the vertices). Our strategy
+ * is to try all of these, and take the primitive which uses the most
+ * triangles (a greedy approach).
+ */
+ GLUhalfEdge *e = fOrig->anEdge;
+ struct FaceCount max, newFace;
+
+ max.size = 1;
+ max.eStart = e;
+ max.render = &RenderTriangle;
+
+ if( ! tess->flagBoundary ) {
+ newFace = MaximumFan( e ); if( newFace.size > max.size ) { max = newFace; }
+ newFace = MaximumFan( e->Lnext ); if( newFace.size > max.size ) { max = newFace; }
+ newFace = MaximumFan( e->Lprev ); if( newFace.size > max.size ) { max = newFace; }
+
+ newFace = MaximumStrip( e ); if( newFace.size > max.size ) { max = newFace; }
+ newFace = MaximumStrip( e->Lnext ); if( newFace.size > max.size ) { max = newFace; }
+ newFace = MaximumStrip( e->Lprev ); if( newFace.size > max.size ) { max = newFace; }
+ }
+ (*(max.render))( tess, max.eStart, max.size );
+}
+
+
+/* Macros which keep track of faces we have marked temporarily, and allow
+ * us to backtrack when necessary. With triangle fans, this is not
+ * really necessary, since the only awkward case is a loop of triangles
+ * around a single origin vertex. However with strips the situation is
+ * more complicated, and we need a general tracking method like the
+ * one here.
+ */
+#define Marked(f) (! (f)->inside || (f)->marked)
+
+#define AddToTrail(f,t) ((f)->trail = (t), (t) = (f), (f)->marked = TRUE)
+
+#define FreeTrail(t) do { \
+ while( (t) != NULL ) { \
+ (t)->marked = FALSE; t = (t)->trail; \
+ } \
+ } while(0) /* absorb trailing semicolon */
+
+
+
+static struct FaceCount MaximumFan( GLUhalfEdge *eOrig )
+{
+ /* eOrig->Lface is the face we want to render. We want to find the size
+ * of a maximal fan around eOrig->Org. To do this we just walk around
+ * the origin vertex as far as possible in both directions.
+ */
+ struct FaceCount newFace = { 0, NULL, &RenderFan };
+ GLUface *trail = NULL;
+ GLUhalfEdge *e;
+
+ for( e = eOrig; ! Marked( e->Lface ); e = e->Onext ) {
+ AddToTrail( e->Lface, trail );
+ ++newFace.size;
+ }
+ for( e = eOrig; ! Marked( e->Rface ); e = e->Oprev ) {
+ AddToTrail( e->Rface, trail );
+ ++newFace.size;
+ }
+ newFace.eStart = e;
+ /*LINTED*/
+ FreeTrail( trail );
+ return newFace;
+}
+
+
+#define IsEven(n) (((n) & 1) == 0)
+
+static struct FaceCount MaximumStrip( GLUhalfEdge *eOrig )
+{
+ /* Here we are looking for a maximal strip that contains the vertices
+ * eOrig->Org, eOrig->Dst, eOrig->Lnext->Dst (in that order or the
+ * reverse, such that all triangles are oriented CCW).
+ *
+ * Again we walk forward and backward as far as possible. However for
+ * strips there is a twist: to get CCW orientations, there must be
+ * an *even* number of triangles in the strip on one side of eOrig.
+ * We walk the strip starting on a side with an even number of triangles;
+ * if both side have an odd number, we are forced to shorten one side.
+ */
+ struct FaceCount newFace = { 0, NULL, &RenderStrip };
+ long headSize = 0, tailSize = 0;
+ GLUface *trail = NULL;
+ GLUhalfEdge *e, *eTail, *eHead;
+
+ for( e = eOrig; ! Marked( e->Lface ); ++tailSize, e = e->Onext ) {
+ AddToTrail( e->Lface, trail );
+ ++tailSize;
+ e = e->Dprev;
+ if( Marked( e->Lface )) break;
+ AddToTrail( e->Lface, trail );
+ }
+ eTail = e;
+
+ for( e = eOrig; ! Marked( e->Rface ); ++headSize, e = e->Dnext ) {
+ AddToTrail( e->Rface, trail );
+ ++headSize;
+ e = e->Oprev;
+ if( Marked( e->Rface )) break;
+ AddToTrail( e->Rface, trail );
+ }
+ eHead = e;
+
+ newFace.size = tailSize + headSize;
+ if( IsEven( tailSize )) {
+ newFace.eStart = eTail->Sym;
+ } else if( IsEven( headSize )) {
+ newFace.eStart = eHead;
+ } else {
+ /* Both sides have odd length, we must shorten one of them. In fact,
+ * we must start from eHead to guarantee inclusion of eOrig->Lface.
+ */
+ --newFace.size;
+ newFace.eStart = eHead->Onext;
+ }
+ /*LINTED*/
+ FreeTrail( trail );
+ return newFace;
+}
+
+
+static void RenderTriangle( GLUtesselator *tess, GLUhalfEdge *e, long size )
+{
+ /* Just add the triangle to a triangle list, so we can render all
+ * the separate triangles at once.
+ */
+ assert( size == 1 );
+ AddToTrail( e->Lface, tess->lonelyTriList );
+}
+
+
+static void RenderLonelyTriangles( GLUtesselator *tess, GLUface *f )
+{
+ /* Now we render all the separate triangles which could not be
+ * grouped into a triangle fan or strip.
+ */
+ GLUhalfEdge *e;
+ int newState;
+ int edgeState = -1; /* force edge state output for first vertex */
+
+ CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLES );
+
+ for( ; f != NULL; f = f->trail ) {
+ /* Loop once for each edge (there will always be 3 edges) */
+
+ e = f->anEdge;
+ do {
+ if( tess->flagBoundary ) {
+ /* Set the "edge state" to TRUE just before we output the
+ * first vertex of each edge on the polygon boundary.
+ */
+ newState = ! e->Rface->inside;
+ if( edgeState != newState ) {
+ edgeState = newState;
+ CALL_EDGE_FLAG_OR_EDGE_FLAG_DATA( edgeState );
+ }
+ }
+ CALL_VERTEX_OR_VERTEX_DATA( e->Org->data );
+
+ e = e->Lnext;
+ } while( e != f->anEdge );
+ }
+ CALL_END_OR_END_DATA();
+}
+
+
+static void RenderFan( GLUtesselator *tess, GLUhalfEdge *e, long size )
+{
+ /* Render as many CCW triangles as possible in a fan starting from
+ * edge "e". The fan *should* contain exactly "size" triangles
+ * (otherwise we've goofed up somewhere).
+ */
+ CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLE_FAN );
+ CALL_VERTEX_OR_VERTEX_DATA( e->Org->data );
+ CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data );
+
+ while( ! Marked( e->Lface )) {
+ e->Lface->marked = TRUE;
+ --size;
+ e = e->Onext;
+ CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data );
+ }
+
+ assert( size == 0 );
+ CALL_END_OR_END_DATA();
+}
+
+
+static void RenderStrip( GLUtesselator *tess, GLUhalfEdge *e, long size )
+{
+ /* Render as many CCW triangles as possible in a strip starting from
+ * edge "e". The strip *should* contain exactly "size" triangles
+ * (otherwise we've goofed up somewhere).
+ */
+ CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLE_STRIP );
+ CALL_VERTEX_OR_VERTEX_DATA( e->Org->data );
+ CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data );
+
+ while( ! Marked( e->Lface )) {
+ e->Lface->marked = TRUE;
+ --size;
+ e = e->Dprev;
+ CALL_VERTEX_OR_VERTEX_DATA( e->Org->data );
+ if( Marked( e->Lface )) break;
+
+ e->Lface->marked = TRUE;
+ --size;
+ e = e->Onext;
+ CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data );
+ }
+
+ assert( size == 0 );
+ CALL_END_OR_END_DATA();
+}
+
+
+/************************ Boundary contour decomposition ******************/
+
+/* __gl_renderBoundary( tess, mesh ) takes a mesh, and outputs one
+ * contour for each face marked "inside". The rendering output is
+ * provided as callbacks (see the api).
+ */
+void __gl_renderBoundary( GLUtesselator *tess, GLUmesh *mesh )
+{
+ GLUface *f;
+ GLUhalfEdge *e;
+
+ for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) {
+ if( f->inside ) {
+ CALL_BEGIN_OR_BEGIN_DATA( GL_LINE_LOOP );
+ e = f->anEdge;
+ do {
+ CALL_VERTEX_OR_VERTEX_DATA( e->Org->data );
+ e = e->Lnext;
+ } while( e != f->anEdge );
+ CALL_END_OR_END_DATA();
+ }
+ }
+}
+
+
+/************************ Quick-and-dirty decomposition ******************/
+
+#define SIGN_INCONSISTENT 2
+
+static int ComputeNormal( GLUtesselator *tess, GLdouble norm[3], int check )
+/*
+ * If check==FALSE, we compute the polygon normal and place it in norm[].
+ * If check==TRUE, we check that each triangle in the fan from v0 has a
+ * consistent orientation with respect to norm[]. If triangles are
+ * consistently oriented CCW, return 1; if CW, return -1; if all triangles
+ * are degenerate return 0; otherwise (no consistent orientation) return
+ * SIGN_INCONSISTENT.
+ */
+{
+ CachedVertex *v0 = tess->cache;
+ CachedVertex *vn = v0 + tess->cacheCount;
+ CachedVertex *vc;
+ GLdouble dot, xc, yc, zc, xp, yp, zp, n[3];
+ int sign = 0;
+
+ /* Find the polygon normal. It is important to get a reasonable
+ * normal even when the polygon is self-intersecting (eg. a bowtie).
+ * Otherwise, the computed normal could be very tiny, but perpendicular
+ * to the true plane of the polygon due to numerical noise. Then all
+ * the triangles would appear to be degenerate and we would incorrectly
+ * decompose the polygon as a fan (or simply not render it at all).
+ *
+ * We use a sum-of-triangles normal algorithm rather than the more
+ * efficient sum-of-trapezoids method (used in CheckOrientation()
+ * in normal.c). This lets us explicitly reverse the signed area
+ * of some triangles to get a reasonable normal in the self-intersecting
+ * case.
+ */
+ if( ! check ) {
+ norm[0] = norm[1] = norm[2] = 0.0;
+ }
+
+ vc = v0 + 1;
+ xc = vc->coords[0] - v0->coords[0];
+ yc = vc->coords[1] - v0->coords[1];
+ zc = vc->coords[2] - v0->coords[2];
+ while( ++vc < vn ) {
+ xp = xc; yp = yc; zp = zc;
+ xc = vc->coords[0] - v0->coords[0];
+ yc = vc->coords[1] - v0->coords[1];
+ zc = vc->coords[2] - v0->coords[2];
+
+ /* Compute (vp - v0) cross (vc - v0) */
+ n[0] = yp*zc - zp*yc;
+ n[1] = zp*xc - xp*zc;
+ n[2] = xp*yc - yp*xc;
+
+ dot = n[0]*norm[0] + n[1]*norm[1] + n[2]*norm[2];
+ if( ! check ) {
+ /* Reverse the contribution of back-facing triangles to get
+ * a reasonable normal for self-intersecting polygons (see above)
+ */
+ if( dot >= 0 ) {
+ norm[0] += n[0]; norm[1] += n[1]; norm[2] += n[2];
+ } else {
+ norm[0] -= n[0]; norm[1] -= n[1]; norm[2] -= n[2];
+ }
+ } else if( dot != 0 ) {
+ /* Check the new orientation for consistency with previous triangles */
+ if( dot > 0 ) {
+ if( sign < 0 ) return SIGN_INCONSISTENT;
+ sign = 1;
+ } else {
+ if( sign > 0 ) return SIGN_INCONSISTENT;
+ sign = -1;
+ }
+ }
+ }
+ return sign;
+}
+
+/* __gl_renderCache( tess ) takes a single contour and tries to render it
+ * as a triangle fan. This handles convex polygons, as well as some
+ * non-convex polygons if we get lucky.
+ *
+ * Returns TRUE if the polygon was successfully rendered. The rendering
+ * output is provided as callbacks (see the api).
+ */
+GLboolean __gl_renderCache( GLUtesselator *tess )
+{
+ CachedVertex *v0 = tess->cache;
+ CachedVertex *vn = v0 + tess->cacheCount;
+ CachedVertex *vc;
+ GLdouble norm[3];
+ int sign;
+
+ if( tess->cacheCount < 3 ) {
+ /* Degenerate contour -- no output */
+ return TRUE;
+ }
+
+ norm[0] = tess->normal[0];
+ norm[1] = tess->normal[1];
+ norm[2] = tess->normal[2];
+ if( norm[0] == 0 && norm[1] == 0 && norm[2] == 0 ) {
+ ComputeNormal( tess, norm, FALSE );
+ }
+
+ sign = ComputeNormal( tess, norm, TRUE );
+ if( sign == SIGN_INCONSISTENT ) {
+ /* Fan triangles did not have a consistent orientation */
+ return FALSE;
+ }
+ if( sign == 0 ) {
+ /* All triangles were degenerate */
+ return TRUE;
+ }
+
+ /* Make sure we do the right thing for each winding rule */
+ switch( tess->windingRule ) {
+ case GLU_TESS_WINDING_ODD:
+ case GLU_TESS_WINDING_NONZERO:
+ break;
+ case GLU_TESS_WINDING_POSITIVE:
+ if( sign < 0 ) return TRUE;
+ break;
+ case GLU_TESS_WINDING_NEGATIVE:
+ if( sign > 0 ) return TRUE;
+ break;
+ case GLU_TESS_WINDING_ABS_GEQ_TWO:
+ return TRUE;
+ }
+
+ CALL_BEGIN_OR_BEGIN_DATA( tess->boundaryOnly ? GL_LINE_LOOP
+ : (tess->cacheCount > 3) ? GL_TRIANGLE_FAN
+ : GL_TRIANGLES );
+
+ CALL_VERTEX_OR_VERTEX_DATA( v0->data );
+ if( sign > 0 ) {
+ for( vc = v0+1; vc < vn; ++vc ) {
+ CALL_VERTEX_OR_VERTEX_DATA( vc->data );
+ }
+ } else {
+ for( vc = vn-1; vc > v0; --vc ) {
+ CALL_VERTEX_OR_VERTEX_DATA( vc->data );
+ }
+ }
+ CALL_END_OR_END_DATA();
+ return TRUE;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.h
new file mode 100644
index 0000000..5f3e06c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/render.h
@@ -0,0 +1,59 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/render.h#5 $
+*/
+
+#ifndef __render_h_
+#define __render_h_
+
+#include "ThirdParty/glu/libtess/mesh.h"
+
+/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle
+ * fans, strips, and separate triangles. A substantial effort is made
+ * to use as few rendering primitives as possible (ie. to make the fans
+ * and strips as large as possible).
+ *
+ * The rendering output is provided as callbacks (see the api).
+ */
+void __gl_renderMesh( GLUtesselator *tess, GLUmesh *mesh );
+void __gl_renderBoundary( GLUtesselator *tess, GLUmesh *mesh );
+
+GLboolean __gl_renderCache( GLUtesselator *tess );
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.c
new file mode 100644
index 0000000..415f592
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.c
@@ -0,0 +1,1362 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/sweep.c#5 $
+*/
+
+#include <assert.h>
+#include <setjmp.h> /* longjmp */
+#include <limits.h> /* LONG_MAX */
+#include <stddef.h>
+
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/dict.h"
+#include "ThirdParty/glu/libtess/geom.h"
+#include "ThirdParty/glu/libtess/memalloc.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+#include "ThirdParty/glu/libtess/priorityq.h"
+#include "ThirdParty/glu/libtess/sweep.h"
+#include "ThirdParty/glu/libtess/tess.h"
+
+#define TRUE 1
+#define FALSE 0
+
+#ifdef FOR_TRITE_TEST_PROGRAM
+extern void DebugEvent( GLUtesselator *tess );
+#else
+#define DebugEvent( tess )
+#endif
+
+/*
+ * Invariants for the Edge Dictionary.
+ * - each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2)
+ * at any valid location of the sweep event
+ * - if EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2
+ * share a common endpoint
+ * - for each e, e->Dst has been processed, but not e->Org
+ * - each edge e satisfies VertLeq(e->Dst,event) && VertLeq(event,e->Org)
+ * where "event" is the current sweep line event.
+ * - no edge e has zero length
+ *
+ * Invariants for the Mesh (the processed portion).
+ * - the portion of the mesh left of the sweep line is a planar graph,
+ * ie. there is *some* way to embed it in the plane
+ * - no processed edge has zero length
+ * - no two processed vertices have identical coordinates
+ * - each "inside" region is monotone, ie. can be broken into two chains
+ * of monotonically increasing vertices according to VertLeq(v1,v2)
+ * - a non-invariant: these chains may intersect (very slightly)
+ *
+ * Invariants for the Sweep.
+ * - if none of the edges incident to the event vertex have an activeRegion
+ * (ie. none of these edges are in the edge dictionary), then the vertex
+ * has only right-going edges.
+ * - if an edge is marked "fixUpperEdge" (it is a temporary edge introduced
+ * by ConnectRightVertex), then it is the only right-going edge from
+ * its associated vertex. (This says that these edges exist only
+ * when it is necessary.)
+ */
+
+#define MAX(x,y) ((x) >= (y) ? (x) : (y))
+#define MIN(x,y) ((x) <= (y) ? (x) : (y))
+
+/* When we merge two edges into one, we need to compute the combined
+ * winding of the new edge.
+ */
+#define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \
+ eDst->Sym->winding += eSrc->Sym->winding)
+
+static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent );
+static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp );
+static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp );
+
+static int EdgeLeq( GLUtesselator *tess, ActiveRegion *reg1,
+ ActiveRegion *reg2 )
+/*
+ * Both edges must be directed from right to left (this is the canonical
+ * direction for the upper edge of each region).
+ *
+ * The strategy is to evaluate a "t" value for each edge at the
+ * current sweep line position, given by tess->event. The calculations
+ * are designed to be very stable, but of course they are not perfect.
+ *
+ * Special case: if both edge destinations are at the sweep event,
+ * we sort the edges by slope (they would otherwise compare equally).
+ */
+{
+ GLUvertex *event = tess->event;
+ GLUhalfEdge *e1, *e2;
+ GLdouble t1, t2;
+
+ e1 = reg1->eUp;
+ e2 = reg2->eUp;
+
+ if( e1->Dst == event ) {
+ if( e2->Dst == event ) {
+ /* Two edges right of the sweep line which meet at the sweep event.
+ * Sort them by slope.
+ */
+ if( VertLeq( e1->Org, e2->Org )) {
+ return EdgeSign( e2->Dst, e1->Org, e2->Org ) <= 0;
+ }
+ return EdgeSign( e1->Dst, e2->Org, e1->Org ) >= 0;
+ }
+ return EdgeSign( e2->Dst, event, e2->Org ) <= 0;
+ }
+ if( e2->Dst == event ) {
+ return EdgeSign( e1->Dst, event, e1->Org ) >= 0;
+ }
+
+ /* General case - compute signed distance *from* e1, e2 to event */
+ t1 = EdgeEval( e1->Dst, event, e1->Org );
+ t2 = EdgeEval( e2->Dst, event, e2->Org );
+ return (t1 >= t2);
+}
+
+
+static void DeleteRegion( GLUtesselator *tess, ActiveRegion *reg )
+{
+ if( reg->fixUpperEdge ) {
+ /* It was created with zero winding number, so it better be
+ * deleted with zero winding number (ie. it better not get merged
+ * with a real edge).
+ */
+ assert( reg->eUp->winding == 0 );
+ }
+ reg->eUp->activeRegion = NULL;
+ dictDelete( tess->dict, reg->nodeUp ); /* __gl_dictListDelete */
+ memFree( reg );
+}
+
+
+static int FixUpperEdge( ActiveRegion *reg, GLUhalfEdge *newEdge )
+/*
+ * Replace an upper edge which needs fixing (see ConnectRightVertex).
+ */
+{
+ assert( reg->fixUpperEdge );
+ if ( !__gl_meshDelete( reg->eUp ) ) return 0;
+ reg->fixUpperEdge = FALSE;
+ reg->eUp = newEdge;
+ newEdge->activeRegion = reg;
+
+ return 1;
+}
+
+static ActiveRegion *TopLeftRegion( ActiveRegion *reg )
+{
+ GLUvertex *org = reg->eUp->Org;
+ GLUhalfEdge *e;
+
+ /* Find the region above the uppermost edge with the same origin */
+ do {
+ reg = RegionAbove( reg );
+ } while( reg->eUp->Org == org );
+
+ /* If the edge above was a temporary edge introduced by ConnectRightVertex,
+ * now is the time to fix it.
+ */
+ if( reg->fixUpperEdge ) {
+ e = __gl_meshConnect( RegionBelow(reg)->eUp->Sym, reg->eUp->Lnext );
+ if (e == NULL) return NULL;
+ if ( !FixUpperEdge( reg, e ) ) return NULL;
+ reg = RegionAbove( reg );
+ }
+ return reg;
+}
+
+static ActiveRegion *TopRightRegion( ActiveRegion *reg )
+{
+ GLUvertex *dst = reg->eUp->Dst;
+
+ /* Find the region above the uppermost edge with the same destination */
+ do {
+ reg = RegionAbove( reg );
+ } while( reg->eUp->Dst == dst );
+ return reg;
+}
+
+static ActiveRegion *AddRegionBelow( GLUtesselator *tess,
+ ActiveRegion *regAbove,
+ GLUhalfEdge *eNewUp )
+/*
+ * Add a new active region to the sweep line, *somewhere* below "regAbove"
+ * (according to where the new edge belongs in the sweep-line dictionary).
+ * The upper edge of the new region will be "eNewUp".
+ * Winding number and "inside" flag are not updated.
+ */
+{
+ ActiveRegion *regNew = (ActiveRegion *)memAlloc( sizeof( ActiveRegion ));
+ if (regNew == NULL) longjmp(tess->env,1);
+
+ regNew->eUp = eNewUp;
+ /* __gl_dictListInsertBefore */
+ regNew->nodeUp = dictInsertBefore( tess->dict, regAbove->nodeUp, regNew );
+ if (regNew->nodeUp == NULL) longjmp(tess->env,1);
+ regNew->fixUpperEdge = FALSE;
+ regNew->sentinel = FALSE;
+ regNew->dirty = FALSE;
+
+ eNewUp->activeRegion = regNew;
+ return regNew;
+}
+
+static GLboolean IsWindingInside( GLUtesselator *tess, int n )
+{
+ switch( tess->windingRule ) {
+ case GLU_TESS_WINDING_ODD:
+ return (n & 1);
+ case GLU_TESS_WINDING_NONZERO:
+ return (n != 0);
+ case GLU_TESS_WINDING_POSITIVE:
+ return (n > 0);
+ case GLU_TESS_WINDING_NEGATIVE:
+ return (n < 0);
+ case GLU_TESS_WINDING_ABS_GEQ_TWO:
+ return (n >= 2) || (n <= -2);
+ }
+ /*LINTED*/
+ assert( FALSE );
+ /*NOTREACHED*/
+ return 0;
+}
+
+
+static void ComputeWinding( GLUtesselator *tess, ActiveRegion *reg )
+{
+ reg->windingNumber = RegionAbove(reg)->windingNumber + reg->eUp->winding;
+ reg->inside = IsWindingInside( tess, reg->windingNumber );
+}
+
+
+static void FinishRegion( GLUtesselator *tess, ActiveRegion *reg )
+/*
+ * Delete a region from the sweep line. This happens when the upper
+ * and lower chains of a region meet (at a vertex on the sweep line).
+ * The "inside" flag is copied to the appropriate mesh face (we could
+ * not do this before -- since the structure of the mesh is always
+ * changing, this face may not have even existed until now).
+ */
+{
+ GLUhalfEdge *e = reg->eUp;
+ GLUface *f = e->Lface;
+
+ f->inside = reg->inside;
+ f->anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */
+ DeleteRegion( tess, reg );
+}
+
+
+static GLUhalfEdge *FinishLeftRegions( GLUtesselator *tess,
+ ActiveRegion *regFirst, ActiveRegion *regLast )
+/*
+ * We are given a vertex with one or more left-going edges. All affected
+ * edges should be in the edge dictionary. Starting at regFirst->eUp,
+ * we walk down deleting all regions where both edges have the same
+ * origin vOrg. At the same time we copy the "inside" flag from the
+ * active region to the face, since at this point each face will belong
+ * to at most one region (this was not necessarily true until this point
+ * in the sweep). The walk stops at the region above regLast; if regLast
+ * is NULL we walk as far as possible. At the same time we relink the
+ * mesh if necessary, so that the ordering of edges around vOrg is the
+ * same as in the dictionary.
+ */
+{
+ ActiveRegion *reg, *regPrev;
+ GLUhalfEdge *e, *ePrev;
+
+ regPrev = regFirst;
+ ePrev = regFirst->eUp;
+ while( regPrev != regLast ) {
+ regPrev->fixUpperEdge = FALSE; /* placement was OK */
+ reg = RegionBelow( regPrev );
+ e = reg->eUp;
+ if( e->Org != ePrev->Org ) {
+ if( ! reg->fixUpperEdge ) {
+ /* Remove the last left-going edge. Even though there are no further
+ * edges in the dictionary with this origin, there may be further
+ * such edges in the mesh (if we are adding left edges to a vertex
+ * that has already been processed). Thus it is important to call
+ * FinishRegion rather than just DeleteRegion.
+ */
+ FinishRegion( tess, regPrev );
+ break;
+ }
+ /* If the edge below was a temporary edge introduced by
+ * ConnectRightVertex, now is the time to fix it.
+ */
+ e = __gl_meshConnect( ePrev->Lprev, e->Sym );
+ if (e == NULL) longjmp(tess->env,1);
+ if ( !FixUpperEdge( reg, e ) ) longjmp(tess->env,1);
+ }
+
+ /* Relink edges so that ePrev->Onext == e */
+ if( ePrev->Onext != e ) {
+ if ( !__gl_meshSplice( e->Oprev, e ) ) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( ePrev, e ) ) longjmp(tess->env,1);
+ }
+ FinishRegion( tess, regPrev ); /* may change reg->eUp */
+ ePrev = reg->eUp;
+ regPrev = reg;
+ }
+ return ePrev;
+}
+
+
+static void AddRightEdges( GLUtesselator *tess, ActiveRegion *regUp,
+ GLUhalfEdge *eFirst, GLUhalfEdge *eLast, GLUhalfEdge *eTopLeft,
+ GLboolean cleanUp )
+/*
+ * Purpose: insert right-going edges into the edge dictionary, and update
+ * winding numbers and mesh connectivity appropriately. All right-going
+ * edges share a common origin vOrg. Edges are inserted CCW starting at
+ * eFirst; the last edge inserted is eLast->Oprev. If vOrg has any
+ * left-going edges already processed, then eTopLeft must be the edge
+ * such that an imaginary upward vertical segment from vOrg would be
+ * contained between eTopLeft->Oprev and eTopLeft; otherwise eTopLeft
+ * should be NULL.
+ */
+{
+ ActiveRegion *reg, *regPrev;
+ GLUhalfEdge *e, *ePrev;
+ int firstTime = TRUE;
+
+ /* Insert the new right-going edges in the dictionary */
+ e = eFirst;
+ do {
+ assert( VertLeq( e->Org, e->Dst ));
+ AddRegionBelow( tess, regUp, e->Sym );
+ e = e->Onext;
+ } while ( e != eLast );
+
+ /* Walk *all* right-going edges from e->Org, in the dictionary order,
+ * updating the winding numbers of each region, and re-linking the mesh
+ * edges to match the dictionary ordering (if necessary).
+ */
+ if( eTopLeft == NULL ) {
+ eTopLeft = RegionBelow( regUp )->eUp->Rprev;
+ }
+ regPrev = regUp;
+ ePrev = eTopLeft;
+ for( ;; ) {
+ reg = RegionBelow( regPrev );
+ e = reg->eUp->Sym;
+ if( e->Org != ePrev->Org ) break;
+
+ if( e->Onext != ePrev ) {
+ /* Unlink e from its current position, and relink below ePrev */
+ if ( !__gl_meshSplice( e->Oprev, e ) ) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( ePrev->Oprev, e ) ) longjmp(tess->env,1);
+ }
+ /* Compute the winding number and "inside" flag for the new regions */
+ reg->windingNumber = regPrev->windingNumber - e->winding;
+ reg->inside = IsWindingInside( tess, reg->windingNumber );
+
+ /* Check for two outgoing edges with same slope -- process these
+ * before any intersection tests (see example in __gl_computeInterior).
+ */
+ regPrev->dirty = TRUE;
+ if( ! firstTime && CheckForRightSplice( tess, regPrev )) {
+ AddWinding( e, ePrev );
+ DeleteRegion( tess, regPrev );
+ if ( !__gl_meshDelete( ePrev ) ) longjmp(tess->env,1);
+ }
+ firstTime = FALSE;
+ regPrev = reg;
+ ePrev = e;
+ }
+ regPrev->dirty = TRUE;
+ assert( regPrev->windingNumber - e->winding == reg->windingNumber );
+
+ if( cleanUp ) {
+ /* Check for intersections between newly adjacent edges. */
+ WalkDirtyRegions( tess, regPrev );
+ }
+}
+
+
+static void CallCombine( GLUtesselator *tess, GLUvertex *isect,
+ void *data[4], GLfloat weights[4], int needed )
+{
+ GLdouble coords[3];
+
+ /* Copy coord data in case the callback changes it. */
+ coords[0] = isect->coords[0];
+ coords[1] = isect->coords[1];
+ coords[2] = isect->coords[2];
+
+ isect->data = NULL;
+ CALL_COMBINE_OR_COMBINE_DATA( coords, data, weights, &isect->data );
+ if( isect->data == NULL ) {
+ if( ! needed ) {
+ isect->data = data[0];
+ } else if( ! tess->fatalError ) {
+ /* The only way fatal error is when two edges are found to intersect,
+ * but the user has not provided the callback necessary to handle
+ * generated intersection points.
+ */
+ CALL_ERROR_OR_ERROR_DATA( GLU_TESS_NEED_COMBINE_CALLBACK );
+ tess->fatalError = TRUE;
+ }
+ }
+}
+
+static void SpliceMergeVertices( GLUtesselator *tess, GLUhalfEdge *e1,
+ GLUhalfEdge *e2 )
+/*
+ * Two vertices with idential coordinates are combined into one.
+ * e1->Org is kept, while e2->Org is discarded.
+ */
+{
+ void *data[4] = { NULL, NULL, NULL, NULL };
+ GLfloat weights[4] = { 0.5, 0.5, 0.0, 0.0 };
+
+ data[0] = e1->Org->data;
+ data[1] = e2->Org->data;
+ CallCombine( tess, e1->Org, data, weights, FALSE );
+ if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1);
+}
+
+static void VertexWeights( GLUvertex *isect, GLUvertex *org, GLUvertex *dst,
+ GLfloat *weights )
+/*
+ * Find some weights which describe how the intersection vertex is
+ * a linear combination of "org" and "dest". Each of the two edges
+ * which generated "isect" is allocated 50% of the weight; each edge
+ * splits the weight between its org and dst according to the
+ * relative distance to "isect".
+ */
+{
+ GLdouble t1 = VertL1dist( org, isect );
+ GLdouble t2 = VertL1dist( dst, isect );
+
+ weights[0] = 0.5 * t2 / (t1 + t2);
+ weights[1] = 0.5 * t1 / (t1 + t2);
+ isect->coords[0] += weights[0]*org->coords[0] + weights[1]*dst->coords[0];
+ isect->coords[1] += weights[0]*org->coords[1] + weights[1]*dst->coords[1];
+ isect->coords[2] += weights[0]*org->coords[2] + weights[1]*dst->coords[2];
+}
+
+
+static void GetIntersectData( GLUtesselator *tess, GLUvertex *isect,
+ GLUvertex *orgUp, GLUvertex *dstUp,
+ GLUvertex *orgLo, GLUvertex *dstLo )
+/*
+ * We've computed a new intersection point, now we need a "data" pointer
+ * from the user so that we can refer to this new vertex in the
+ * rendering callbacks.
+ */
+{
+ void *data[4];
+ GLfloat weights[4];
+
+ data[0] = orgUp->data;
+ data[1] = dstUp->data;
+ data[2] = orgLo->data;
+ data[3] = dstLo->data;
+
+ isect->coords[0] = isect->coords[1] = isect->coords[2] = 0;
+ VertexWeights( isect, orgUp, dstUp, &weights[0] );
+ VertexWeights( isect, orgLo, dstLo, &weights[2] );
+
+ CallCombine( tess, isect, data, weights, TRUE );
+}
+
+static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp )
+/*
+ * Check the upper and lower edge of "regUp", to make sure that the
+ * eUp->Org is above eLo, or eLo->Org is below eUp (depending on which
+ * origin is leftmost).
+ *
+ * The main purpose is to splice right-going edges with the same
+ * dest vertex and nearly identical slopes (ie. we can't distinguish
+ * the slopes numerically). However the splicing can also help us
+ * to recover from numerical errors. For example, suppose at one
+ * point we checked eUp and eLo, and decided that eUp->Org is barely
+ * above eLo. Then later, we split eLo into two edges (eg. from
+ * a splice operation like this one). This can change the result of
+ * our test so that now eUp->Org is incident to eLo, or barely below it.
+ * We must correct this condition to maintain the dictionary invariants.
+ *
+ * One possibility is to check these edges for intersection again
+ * (ie. CheckForIntersect). This is what we do if possible. However
+ * CheckForIntersect requires that tess->event lies between eUp and eLo,
+ * so that it has something to fall back on when the intersection
+ * calculation gives us an unusable answer. So, for those cases where
+ * we can't check for intersection, this routine fixes the problem
+ * by just splicing the offending vertex into the other edge.
+ * This is a guaranteed solution, no matter how degenerate things get.
+ * Basically this is a combinatorial solution to a numerical problem.
+ */
+{
+ ActiveRegion *regLo = RegionBelow(regUp);
+ GLUhalfEdge *eUp = regUp->eUp;
+ GLUhalfEdge *eLo = regLo->eUp;
+
+ if( VertLeq( eUp->Org, eLo->Org )) {
+ if( EdgeSign( eLo->Dst, eUp->Org, eLo->Org ) > 0 ) return FALSE;
+
+ /* eUp->Org appears to be below eLo */
+ if( ! VertEq( eUp->Org, eLo->Org )) {
+ /* Splice eUp->Org into eLo */
+ if ( __gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( eUp, eLo->Oprev ) ) longjmp(tess->env,1);
+ regUp->dirty = regLo->dirty = TRUE;
+
+ } else if( eUp->Org != eLo->Org ) {
+ /* merge the two vertices, discarding eUp->Org */
+ pqDelete( tess->pq, eUp->Org->pqHandle ); /* __gl_pqSortDelete */
+ SpliceMergeVertices( tess, eLo->Oprev, eUp );
+ }
+ } else {
+ if( EdgeSign( eUp->Dst, eLo->Org, eUp->Org ) < 0 ) return FALSE;
+
+ /* eLo->Org appears to be above eUp, so splice eLo->Org into eUp */
+ RegionAbove(regUp)->dirty = regUp->dirty = TRUE;
+ if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1);
+ }
+ return TRUE;
+}
+
+static int CheckForLeftSplice( GLUtesselator *tess, ActiveRegion *regUp )
+/*
+ * Check the upper and lower edge of "regUp", to make sure that the
+ * eUp->Dst is above eLo, or eLo->Dst is below eUp (depending on which
+ * destination is rightmost).
+ *
+ * Theoretically, this should always be true. However, splitting an edge
+ * into two pieces can change the results of previous tests. For example,
+ * suppose at one point we checked eUp and eLo, and decided that eUp->Dst
+ * is barely above eLo. Then later, we split eLo into two edges (eg. from
+ * a splice operation like this one). This can change the result of
+ * the test so that now eUp->Dst is incident to eLo, or barely below it.
+ * We must correct this condition to maintain the dictionary invariants
+ * (otherwise new edges might get inserted in the wrong place in the
+ * dictionary, and bad stuff will happen).
+ *
+ * We fix the problem by just splicing the offending vertex into the
+ * other edge.
+ */
+{
+ ActiveRegion *regLo = RegionBelow(regUp);
+ GLUhalfEdge *eUp = regUp->eUp;
+ GLUhalfEdge *eLo = regLo->eUp;
+ GLUhalfEdge *e;
+
+ assert( ! VertEq( eUp->Dst, eLo->Dst ));
+
+ if( VertLeq( eUp->Dst, eLo->Dst )) {
+ if( EdgeSign( eUp->Dst, eLo->Dst, eUp->Org ) < 0 ) return FALSE;
+
+ /* eLo->Dst is above eUp, so splice eLo->Dst into eUp */
+ RegionAbove(regUp)->dirty = regUp->dirty = TRUE;
+ e = __gl_meshSplitEdge( eUp );
+ if (e == NULL) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( eLo->Sym, e ) ) longjmp(tess->env,1);
+ e->Lface->inside = regUp->inside;
+ } else {
+ if( EdgeSign( eLo->Dst, eUp->Dst, eLo->Org ) > 0 ) return FALSE;
+
+ /* eUp->Dst is below eLo, so splice eUp->Dst into eLo */
+ regUp->dirty = regLo->dirty = TRUE;
+ e = __gl_meshSplitEdge( eLo );
+ if (e == NULL) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( eUp->Lnext, eLo->Sym ) ) longjmp(tess->env,1);
+ e->Rface->inside = regUp->inside;
+ }
+ return TRUE;
+}
+
+
+static int CheckForIntersect( GLUtesselator *tess, ActiveRegion *regUp )
+/*
+ * Check the upper and lower edges of the given region to see if
+ * they intersect. If so, create the intersection and add it
+ * to the data structures.
+ *
+ * Returns TRUE if adding the new intersection resulted in a recursive
+ * call to AddRightEdges(); in this case all "dirty" regions have been
+ * checked for intersections, and possibly regUp has been deleted.
+ */
+{
+ ActiveRegion *regLo = RegionBelow(regUp);
+ GLUhalfEdge *eUp = regUp->eUp;
+ GLUhalfEdge *eLo = regLo->eUp;
+ GLUvertex *orgUp = eUp->Org;
+ GLUvertex *orgLo = eLo->Org;
+ GLUvertex *dstUp = eUp->Dst;
+ GLUvertex *dstLo = eLo->Dst;
+ GLdouble tMinUp, tMaxLo;
+ GLUvertex isect, *orgMin;
+ GLUhalfEdge *e;
+
+ assert( ! VertEq( dstLo, dstUp ));
+ assert( EdgeSign( dstUp, tess->event, orgUp ) <= 0 );
+ assert( EdgeSign( dstLo, tess->event, orgLo ) >= 0 );
+ assert( orgUp != tess->event && orgLo != tess->event );
+ assert( ! regUp->fixUpperEdge && ! regLo->fixUpperEdge );
+
+ if( orgUp == orgLo ) return FALSE; /* right endpoints are the same */
+
+ tMinUp = MIN( orgUp->t, dstUp->t );
+ tMaxLo = MAX( orgLo->t, dstLo->t );
+ if( tMinUp > tMaxLo ) return FALSE; /* t ranges do not overlap */
+
+ if( VertLeq( orgUp, orgLo )) {
+ if( EdgeSign( dstLo, orgUp, orgLo ) > 0 ) return FALSE;
+ } else {
+ if( EdgeSign( dstUp, orgLo, orgUp ) < 0 ) return FALSE;
+ }
+
+ /* At this point the edges intersect, at least marginally */
+ DebugEvent( tess );
+
+ __gl_edgeIntersect( dstUp, orgUp, dstLo, orgLo, &isect );
+ /* The following properties are guaranteed: */
+ assert( MIN( orgUp->t, dstUp->t ) <= isect.t );
+ assert( isect.t <= MAX( orgLo->t, dstLo->t ));
+ assert( MIN( dstLo->s, dstUp->s ) <= isect.s );
+ assert( isect.s <= MAX( orgLo->s, orgUp->s ));
+
+ if( VertLeq( &isect, tess->event )) {
+ /* The intersection point lies slightly to the left of the sweep line,
+ * so move it until it''s slightly to the right of the sweep line.
+ * (If we had perfect numerical precision, this would never happen
+ * in the first place). The easiest and safest thing to do is
+ * replace the intersection by tess->event.
+ */
+ isect.s = tess->event->s;
+ isect.t = tess->event->t;
+ }
+ /* Similarly, if the computed intersection lies to the right of the
+ * rightmost origin (which should rarely happen), it can cause
+ * unbelievable inefficiency on sufficiently degenerate inputs.
+ * (If you have the test program, try running test54.d with the
+ * "X zoom" option turned on).
+ */
+ orgMin = VertLeq( orgUp, orgLo ) ? orgUp : orgLo;
+ if( VertLeq( orgMin, &isect )) {
+ isect.s = orgMin->s;
+ isect.t = orgMin->t;
+ }
+
+ if( VertEq( &isect, orgUp ) || VertEq( &isect, orgLo )) {
+ /* Easy case -- intersection at one of the right endpoints */
+ (void) CheckForRightSplice( tess, regUp );
+ return FALSE;
+ }
+
+ if( (! VertEq( dstUp, tess->event )
+ && EdgeSign( dstUp, tess->event, &isect ) >= 0)
+ || (! VertEq( dstLo, tess->event )
+ && EdgeSign( dstLo, tess->event, &isect ) <= 0 ))
+ {
+ /* Very unusual -- the new upper or lower edge would pass on the
+ * wrong side of the sweep event, or through it. This can happen
+ * due to very small numerical errors in the intersection calculation.
+ */
+ if( dstLo == tess->event ) {
+ /* Splice dstLo into eUp, and process the new region(s) */
+ if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( eLo->Sym, eUp ) ) longjmp(tess->env,1);
+ regUp = TopLeftRegion( regUp );
+ if (regUp == NULL) longjmp(tess->env,1);
+ eUp = RegionBelow(regUp)->eUp;
+ FinishLeftRegions( tess, RegionBelow(regUp), regLo );
+ AddRightEdges( tess, regUp, eUp->Oprev, eUp, eUp, TRUE );
+ return TRUE;
+ }
+ if( dstUp == tess->event ) {
+ /* Splice dstUp into eLo, and process the new region(s) */
+ if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( eUp->Lnext, eLo->Oprev ) ) longjmp(tess->env,1);
+ regLo = regUp;
+ regUp = TopRightRegion( regUp );
+ e = RegionBelow(regUp)->eUp->Rprev;
+ regLo->eUp = eLo->Oprev;
+ eLo = FinishLeftRegions( tess, regLo, NULL );
+ AddRightEdges( tess, regUp, eLo->Onext, eUp->Rprev, e, TRUE );
+ return TRUE;
+ }
+ /* Special case: called from ConnectRightVertex. If either
+ * edge passes on the wrong side of tess->event, split it
+ * (and wait for ConnectRightVertex to splice it appropriately).
+ */
+ if( EdgeSign( dstUp, tess->event, &isect ) >= 0 ) {
+ RegionAbove(regUp)->dirty = regUp->dirty = TRUE;
+ if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1);
+ eUp->Org->s = tess->event->s;
+ eUp->Org->t = tess->event->t;
+ }
+ if( EdgeSign( dstLo, tess->event, &isect ) <= 0 ) {
+ regUp->dirty = regLo->dirty = TRUE;
+ if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1);
+ eLo->Org->s = tess->event->s;
+ eLo->Org->t = tess->event->t;
+ }
+ /* leave the rest for ConnectRightVertex */
+ return FALSE;
+ }
+
+ /* General case -- split both edges, splice into new vertex.
+ * When we do the splice operation, the order of the arguments is
+ * arbitrary as far as correctness goes. However, when the operation
+ * creates a new face, the work done is proportional to the size of
+ * the new face. We expect the faces in the processed part of
+ * the mesh (ie. eUp->Lface) to be smaller than the faces in the
+ * unprocessed original contours (which will be eLo->Oprev->Lface).
+ */
+ if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1);
+ if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1);
+ if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1);
+ eUp->Org->s = isect.s;
+ eUp->Org->t = isect.t;
+ eUp->Org->pqHandle = pqInsert( tess->pq, eUp->Org ); /* __gl_pqSortInsert */
+ if (eUp->Org->pqHandle == LONG_MAX) {
+ pqDeletePriorityQ(tess->pq); /* __gl_pqSortDeletePriorityQ */
+ tess->pq = NULL;
+ longjmp(tess->env,1);
+ }
+ GetIntersectData( tess, eUp->Org, orgUp, dstUp, orgLo, dstLo );
+ RegionAbove(regUp)->dirty = regUp->dirty = regLo->dirty = TRUE;
+ return FALSE;
+}
+
+static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp )
+/*
+ * When the upper or lower edge of any region changes, the region is
+ * marked "dirty". This routine walks through all the dirty regions
+ * and makes sure that the dictionary invariants are satisfied
+ * (see the comments at the beginning of this file). Of course
+ * new dirty regions can be created as we make changes to restore
+ * the invariants.
+ */
+{
+ ActiveRegion *regLo = RegionBelow(regUp);
+ GLUhalfEdge *eUp, *eLo;
+
+ for( ;; ) {
+ /* Find the lowest dirty region (we walk from the bottom up). */
+ while( regLo->dirty ) {
+ regUp = regLo;
+ regLo = RegionBelow(regLo);
+ }
+ if( ! regUp->dirty ) {
+ regLo = regUp;
+ regUp = RegionAbove( regUp );
+ if( regUp == NULL || ! regUp->dirty ) {
+ /* We've walked all the dirty regions */
+ return;
+ }
+ }
+ regUp->dirty = FALSE;
+ eUp = regUp->eUp;
+ eLo = regLo->eUp;
+
+ if( eUp->Dst != eLo->Dst ) {
+ /* Check that the edge ordering is obeyed at the Dst vertices. */
+ if( CheckForLeftSplice( tess, regUp )) {
+
+ /* If the upper or lower edge was marked fixUpperEdge, then
+ * we no longer need it (since these edges are needed only for
+ * vertices which otherwise have no right-going edges).
+ */
+ if( regLo->fixUpperEdge ) {
+ DeleteRegion( tess, regLo );
+ if ( !__gl_meshDelete( eLo ) ) longjmp(tess->env,1);
+ regLo = RegionBelow( regUp );
+ eLo = regLo->eUp;
+ } else if( regUp->fixUpperEdge ) {
+ DeleteRegion( tess, regUp );
+ if ( !__gl_meshDelete( eUp ) ) longjmp(tess->env,1);
+ regUp = RegionAbove( regLo );
+ eUp = regUp->eUp;
+ }
+ }
+ }
+ if( eUp->Org != eLo->Org ) {
+ if( eUp->Dst != eLo->Dst
+ && ! regUp->fixUpperEdge && ! regLo->fixUpperEdge
+ && (eUp->Dst == tess->event || eLo->Dst == tess->event) )
+ {
+ /* When all else fails in CheckForIntersect(), it uses tess->event
+ * as the intersection location. To make this possible, it requires
+ * that tess->event lie between the upper and lower edges, and also
+ * that neither of these is marked fixUpperEdge (since in the worst
+ * case it might splice one of these edges into tess->event, and
+ * violate the invariant that fixable edges are the only right-going
+ * edge from their associated vertex).
+ */
+ if( CheckForIntersect( tess, regUp )) {
+ /* WalkDirtyRegions() was called recursively; we're done */
+ return;
+ }
+ } else {
+ /* Even though we can't use CheckForIntersect(), the Org vertices
+ * may violate the dictionary edge ordering. Check and correct this.
+ */
+ (void) CheckForRightSplice( tess, regUp );
+ }
+ }
+ if( eUp->Org == eLo->Org && eUp->Dst == eLo->Dst ) {
+ /* A degenerate loop consisting of only two edges -- delete it. */
+ AddWinding( eLo, eUp );
+ DeleteRegion( tess, regUp );
+ if ( !__gl_meshDelete( eUp ) ) longjmp(tess->env,1);
+ regUp = RegionAbove( regLo );
+ }
+ }
+}
+
+
+static void ConnectRightVertex( GLUtesselator *tess, ActiveRegion *regUp,
+ GLUhalfEdge *eBottomLeft )
+/*
+ * Purpose: connect a "right" vertex vEvent (one where all edges go left)
+ * to the unprocessed portion of the mesh. Since there are no right-going
+ * edges, two regions (one above vEvent and one below) are being merged
+ * into one. "regUp" is the upper of these two regions.
+ *
+ * There are two reasons for doing this (adding a right-going edge):
+ * - if the two regions being merged are "inside", we must add an edge
+ * to keep them separated (the combined region would not be monotone).
+ * - in any case, we must leave some record of vEvent in the dictionary,
+ * so that we can merge vEvent with features that we have not seen yet.
+ * For example, maybe there is a vertical edge which passes just to
+ * the right of vEvent; we would like to splice vEvent into this edge.
+ *
+ * However, we don't want to connect vEvent to just any vertex. We don''t
+ * want the new edge to cross any other edges; otherwise we will create
+ * intersection vertices even when the input data had no self-intersections.
+ * (This is a bad thing; if the user's input data has no intersections,
+ * we don't want to generate any false intersections ourselves.)
+ *
+ * Our eventual goal is to connect vEvent to the leftmost unprocessed
+ * vertex of the combined region (the union of regUp and regLo).
+ * But because of unseen vertices with all right-going edges, and also
+ * new vertices which may be created by edge intersections, we don''t
+ * know where that leftmost unprocessed vertex is. In the meantime, we
+ * connect vEvent to the closest vertex of either chain, and mark the region
+ * as "fixUpperEdge". This flag says to delete and reconnect this edge
+ * to the next processed vertex on the boundary of the combined region.
+ * Quite possibly the vertex we connected to will turn out to be the
+ * closest one, in which case we won''t need to make any changes.
+ */
+{
+ GLUhalfEdge *eNew;
+ GLUhalfEdge *eTopLeft = eBottomLeft->Onext;
+ ActiveRegion *regLo = RegionBelow(regUp);
+ GLUhalfEdge *eUp = regUp->eUp;
+ GLUhalfEdge *eLo = regLo->eUp;
+ int degenerate = FALSE;
+
+ if( eUp->Dst != eLo->Dst ) {
+ (void) CheckForIntersect( tess, regUp );
+ }
+
+ /* Possible new degeneracies: upper or lower edge of regUp may pass
+ * through vEvent, or may coincide with new intersection vertex
+ */
+ if( VertEq( eUp->Org, tess->event )) {
+ if ( !__gl_meshSplice( eTopLeft->Oprev, eUp ) ) longjmp(tess->env,1);
+ regUp = TopLeftRegion( regUp );
+ if (regUp == NULL) longjmp(tess->env,1);
+ eTopLeft = RegionBelow( regUp )->eUp;
+ FinishLeftRegions( tess, RegionBelow(regUp), regLo );
+ degenerate = TRUE;
+ }
+ if( VertEq( eLo->Org, tess->event )) {
+ if ( !__gl_meshSplice( eBottomLeft, eLo->Oprev ) ) longjmp(tess->env,1);
+ eBottomLeft = FinishLeftRegions( tess, regLo, NULL );
+ degenerate = TRUE;
+ }
+ if( degenerate ) {
+ AddRightEdges( tess, regUp, eBottomLeft->Onext, eTopLeft, eTopLeft, TRUE );
+ return;
+ }
+
+ /* Non-degenerate situation -- need to add a temporary, fixable edge.
+ * Connect to the closer of eLo->Org, eUp->Org.
+ */
+ if( VertLeq( eLo->Org, eUp->Org )) {
+ eNew = eLo->Oprev;
+ } else {
+ eNew = eUp;
+ }
+ eNew = __gl_meshConnect( eBottomLeft->Lprev, eNew );
+ if (eNew == NULL) longjmp(tess->env,1);
+
+ /* Prevent cleanup, otherwise eNew might disappear before we've even
+ * had a chance to mark it as a temporary edge.
+ */
+ AddRightEdges( tess, regUp, eNew, eNew->Onext, eNew->Onext, FALSE );
+ eNew->Sym->activeRegion->fixUpperEdge = TRUE;
+ WalkDirtyRegions( tess, regUp );
+}
+
+/* Because vertices at exactly the same location are merged together
+ * before we process the sweep event, some degenerate cases can't occur.
+ * However if someone eventually makes the modifications required to
+ * merge features which are close together, the cases below marked
+ * TOLERANCE_NONZERO will be useful. They were debugged before the
+ * code to merge identical vertices in the main loop was added.
+ */
+#define TOLERANCE_NONZERO FALSE
+
+static void ConnectLeftDegenerate( GLUtesselator *tess,
+ ActiveRegion *regUp, GLUvertex *vEvent )
+/*
+ * The event vertex lies exacty on an already-processed edge or vertex.
+ * Adding the new vertex involves splicing it into the already-processed
+ * part of the mesh.
+ */
+{
+ GLUhalfEdge *e, *eTopLeft, *eTopRight, *eLast;
+ ActiveRegion *reg;
+
+ e = regUp->eUp;
+ if( VertEq( e->Org, vEvent )) {
+ /* e->Org is an unprocessed vertex - just combine them, and wait
+ * for e->Org to be pulled from the queue
+ */
+ assert( TOLERANCE_NONZERO );
+ SpliceMergeVertices( tess, e, vEvent->anEdge );
+ return;
+ }
+
+ if( ! VertEq( e->Dst, vEvent )) {
+ /* General case -- splice vEvent into edge e which passes through it */
+ if (__gl_meshSplitEdge( e->Sym ) == NULL) longjmp(tess->env,1);
+ if( regUp->fixUpperEdge ) {
+ /* This edge was fixable -- delete unused portion of original edge */
+ if ( !__gl_meshDelete( e->Onext ) ) longjmp(tess->env,1);
+ regUp->fixUpperEdge = FALSE;
+ }
+ if ( !__gl_meshSplice( vEvent->anEdge, e ) ) longjmp(tess->env,1);
+ SweepEvent( tess, vEvent ); /* recurse */
+ return;
+ }
+
+ /* vEvent coincides with e->Dst, which has already been processed.
+ * Splice in the additional right-going edges.
+ */
+ assert( TOLERANCE_NONZERO );
+ regUp = TopRightRegion( regUp );
+ reg = RegionBelow( regUp );
+ eTopRight = reg->eUp->Sym;
+ eTopLeft = eLast = eTopRight->Onext;
+ if( reg->fixUpperEdge ) {
+ /* Here e->Dst has only a single fixable edge going right.
+ * We can delete it since now we have some real right-going edges.
+ */
+ assert( eTopLeft != eTopRight ); /* there are some left edges too */
+ DeleteRegion( tess, reg );
+ if ( !__gl_meshDelete( eTopRight ) ) longjmp(tess->env,1);
+ eTopRight = eTopLeft->Oprev;
+ }
+ if ( !__gl_meshSplice( vEvent->anEdge, eTopRight ) ) longjmp(tess->env,1);
+ if( ! EdgeGoesLeft( eTopLeft )) {
+ /* e->Dst had no left-going edges -- indicate this to AddRightEdges() */
+ eTopLeft = NULL;
+ }
+ AddRightEdges( tess, regUp, eTopRight->Onext, eLast, eTopLeft, TRUE );
+}
+
+
+static void ConnectLeftVertex( GLUtesselator *tess, GLUvertex *vEvent )
+/*
+ * Purpose: connect a "left" vertex (one where both edges go right)
+ * to the processed portion of the mesh. Let R be the active region
+ * containing vEvent, and let U and L be the upper and lower edge
+ * chains of R. There are two possibilities:
+ *
+ * - the normal case: split R into two regions, by connecting vEvent to
+ * the rightmost vertex of U or L lying to the left of the sweep line
+ *
+ * - the degenerate case: if vEvent is close enough to U or L, we
+ * merge vEvent into that edge chain. The subcases are:
+ * - merging with the rightmost vertex of U or L
+ * - merging with the active edge of U or L
+ * - merging with an already-processed portion of U or L
+ */
+{
+ ActiveRegion *regUp, *regLo, *reg;
+ GLUhalfEdge *eUp, *eLo, *eNew;
+ ActiveRegion tmp;
+
+ /* assert( vEvent->anEdge->Onext->Onext == vEvent->anEdge ); */
+
+ /* Get a pointer to the active region containing vEvent */
+ tmp.eUp = vEvent->anEdge->Sym;
+ /* __GL_DICTLISTKEY */ /* __gl_dictListSearch */
+ regUp = (ActiveRegion *)dictKey( dictSearch( tess->dict, &tmp ));
+ regLo = RegionBelow( regUp );
+ eUp = regUp->eUp;
+ eLo = regLo->eUp;
+
+ /* Try merging with U or L first */
+ if( EdgeSign( eUp->Dst, vEvent, eUp->Org ) == 0 ) {
+ ConnectLeftDegenerate( tess, regUp, vEvent );
+ return;
+ }
+
+ /* Connect vEvent to rightmost processed vertex of either chain.
+ * e->Dst is the vertex that we will connect to vEvent.
+ */
+ reg = VertLeq( eLo->Dst, eUp->Dst ) ? regUp : regLo;
+
+ if( regUp->inside || reg->fixUpperEdge) {
+ if( reg == regUp ) {
+ eNew = __gl_meshConnect( vEvent->anEdge->Sym, eUp->Lnext );
+ if (eNew == NULL) longjmp(tess->env,1);
+ } else {
+ GLUhalfEdge *tempHalfEdge= __gl_meshConnect( eLo->Dnext, vEvent->anEdge);
+ if (tempHalfEdge == NULL) longjmp(tess->env,1);
+
+ eNew = tempHalfEdge->Sym;
+ }
+ if( reg->fixUpperEdge ) {
+ if ( !FixUpperEdge( reg, eNew ) ) longjmp(tess->env,1);
+ } else {
+ ComputeWinding( tess, AddRegionBelow( tess, regUp, eNew ));
+ }
+ SweepEvent( tess, vEvent );
+ } else {
+ /* The new vertex is in a region which does not belong to the polygon.
+ * We don''t need to connect this vertex to the rest of the mesh.
+ */
+ AddRightEdges( tess, regUp, vEvent->anEdge, vEvent->anEdge, NULL, TRUE );
+ }
+}
+
+
+static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent )
+/*
+ * Does everything necessary when the sweep line crosses a vertex.
+ * Updates the mesh and the edge dictionary.
+ */
+{
+ ActiveRegion *regUp, *reg;
+ GLUhalfEdge *e, *eTopLeft, *eBottomLeft;
+
+ tess->event = vEvent; /* for access in EdgeLeq() */
+ DebugEvent( tess );
+
+ /* Check if this vertex is the right endpoint of an edge that is
+ * already in the dictionary. In this case we don't need to waste
+ * time searching for the location to insert new edges.
+ */
+ e = vEvent->anEdge;
+ while( e->activeRegion == NULL ) {
+ e = e->Onext;
+ if( e == vEvent->anEdge ) {
+ /* All edges go right -- not incident to any processed edges */
+ ConnectLeftVertex( tess, vEvent );
+ return;
+ }
+ }
+
+ /* Processing consists of two phases: first we "finish" all the
+ * active regions where both the upper and lower edges terminate
+ * at vEvent (ie. vEvent is closing off these regions).
+ * We mark these faces "inside" or "outside" the polygon according
+ * to their winding number, and delete the edges from the dictionary.
+ * This takes care of all the left-going edges from vEvent.
+ */
+ regUp = TopLeftRegion( e->activeRegion );
+ if (regUp == NULL) longjmp(tess->env,1);
+ reg = RegionBelow( regUp );
+ eTopLeft = reg->eUp;
+ eBottomLeft = FinishLeftRegions( tess, reg, NULL );
+
+ /* Next we process all the right-going edges from vEvent. This
+ * involves adding the edges to the dictionary, and creating the
+ * associated "active regions" which record information about the
+ * regions between adjacent dictionary edges.
+ */
+ if( eBottomLeft->Onext == eTopLeft ) {
+ /* No right-going edges -- add a temporary "fixable" edge */
+ ConnectRightVertex( tess, regUp, eBottomLeft );
+ } else {
+ AddRightEdges( tess, regUp, eBottomLeft->Onext, eTopLeft, eTopLeft, TRUE );
+ }
+}
+
+
+/* Make the sentinel coordinates big enough that they will never be
+ * merged with real input features. (Even with the largest possible
+ * input contour and the maximum tolerance of 1.0, no merging will be
+ * done with coordinates larger than 3 * GLU_TESS_MAX_COORD).
+ */
+#define SENTINEL_COORD (4 * GLU_TESS_MAX_COORD)
+
+static void AddSentinel( GLUtesselator *tess, GLdouble t )
+/*
+ * We add two sentinel edges above and below all other edges,
+ * to avoid special cases at the top and bottom.
+ */
+{
+ GLUhalfEdge *e;
+ ActiveRegion *reg = (ActiveRegion *)memAlloc( sizeof( ActiveRegion ));
+ if (reg == NULL) longjmp(tess->env,1);
+
+ e = __gl_meshMakeEdge( tess->mesh );
+ if (e == NULL) longjmp(tess->env,1);
+
+ e->Org->s = SENTINEL_COORD;
+ e->Org->t = t;
+ e->Dst->s = -SENTINEL_COORD;
+ e->Dst->t = t;
+ tess->event = e->Dst; /* initialize it */
+
+ reg->eUp = e;
+ reg->windingNumber = 0;
+ reg->inside = FALSE;
+ reg->fixUpperEdge = FALSE;
+ reg->sentinel = TRUE;
+ reg->dirty = FALSE;
+ reg->nodeUp = dictInsert( tess->dict, reg ); /* __gl_dictListInsertBefore */
+ if (reg->nodeUp == NULL) longjmp(tess->env,1);
+}
+
+
+static void InitEdgeDict( GLUtesselator *tess )
+/*
+ * We maintain an ordering of edge intersections with the sweep line.
+ * This order is maintained in a dynamic dictionary.
+ */
+{
+ /* __gl_dictListNewDict */
+ tess->dict = dictNewDict( tess, (int (*)(void *, DictKey, DictKey)) EdgeLeq );
+ if (tess->dict == NULL) longjmp(tess->env,1);
+
+ AddSentinel( tess, -SENTINEL_COORD );
+ AddSentinel( tess, SENTINEL_COORD );
+}
+
+
+static void DoneEdgeDict( GLUtesselator *tess )
+{
+ ActiveRegion *reg;
+#ifndef NDEBUG
+ int fixedEdges = 0;
+#endif
+
+ /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */
+ while( (reg = (ActiveRegion *)dictKey( dictMin( tess->dict ))) != NULL ) {
+ /*
+ * At the end of all processing, the dictionary should contain
+ * only the two sentinel edges, plus at most one "fixable" edge
+ * created by ConnectRightVertex().
+ */
+ if( ! reg->sentinel ) {
+ assert( reg->fixUpperEdge );
+ assert( ++fixedEdges == 1 );
+ }
+ assert( reg->windingNumber == 0 );
+ DeleteRegion( tess, reg );
+/* __gl_meshDelete( reg->eUp );*/
+ }
+ dictDeleteDict( tess->dict ); /* __gl_dictListDeleteDict */
+}
+
+
+static void RemoveDegenerateEdges( GLUtesselator *tess )
+/*
+ * Remove zero-length edges, and contours with fewer than 3 vertices.
+ */
+{
+ GLUhalfEdge *e, *eNext, *eLnext;
+ GLUhalfEdge *eHead = &tess->mesh->eHead;
+
+ /*LINTED*/
+ for( e = eHead->next; e != eHead; e = eNext ) {
+ eNext = e->next;
+ eLnext = e->Lnext;
+
+ if( VertEq( e->Org, e->Dst ) && e->Lnext->Lnext != e ) {
+ /* Zero-length edge, contour has at least 3 edges */
+
+ SpliceMergeVertices( tess, eLnext, e ); /* deletes e->Org */
+ if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1); /* e is a self-loop */
+ e = eLnext;
+ eLnext = e->Lnext;
+ }
+ if( eLnext->Lnext == e ) {
+ /* Degenerate contour (one or two edges) */
+
+ if( eLnext != e ) {
+ if( eLnext == eNext || eLnext == eNext->Sym ) { eNext = eNext->next; }
+ if ( !__gl_meshDelete( eLnext ) ) longjmp(tess->env,1);
+ }
+ if( e == eNext || e == eNext->Sym ) { eNext = eNext->next; }
+ if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1);
+ }
+ }
+}
+
+static int InitPriorityQ( GLUtesselator *tess )
+/*
+ * Insert all vertices into the priority queue which determines the
+ * order in which vertices cross the sweep line.
+ */
+{
+ PriorityQ *pq;
+ GLUvertex *v, *vHead;
+
+ /* __gl_pqSortNewPriorityQ */
+ pq = tess->pq = pqNewPriorityQ( (int (*)(PQkey, PQkey)) __gl_vertLeq );
+ if (pq == NULL) return 0;
+
+ vHead = &tess->mesh->vHead;
+ for( v = vHead->next; v != vHead; v = v->next ) {
+ v->pqHandle = pqInsert( pq, v ); /* __gl_pqSortInsert */
+ if (v->pqHandle == LONG_MAX) break;
+ }
+ if (v != vHead || !pqInit( pq ) ) { /* __gl_pqSortInit */
+ pqDeletePriorityQ(tess->pq); /* __gl_pqSortDeletePriorityQ */
+ tess->pq = NULL;
+ return 0;
+ }
+
+ return 1;
+}
+
+
+static void DonePriorityQ( GLUtesselator *tess )
+{
+ pqDeletePriorityQ( tess->pq ); /* __gl_pqSortDeletePriorityQ */
+}
+
+
+static int RemoveDegenerateFaces( GLUmesh *mesh )
+/*
+ * Delete any degenerate faces with only two edges. WalkDirtyRegions()
+ * will catch almost all of these, but it won't catch degenerate faces
+ * produced by splice operations on already-processed edges.
+ * The two places this can happen are in FinishLeftRegions(), when
+ * we splice in a "temporary" edge produced by ConnectRightVertex(),
+ * and in CheckForLeftSplice(), where we splice already-processed
+ * edges to ensure that our dictionary invariants are not violated
+ * by numerical errors.
+ *
+ * In both these cases it is *very* dangerous to delete the offending
+ * edge at the time, since one of the routines further up the stack
+ * will sometimes be keeping a pointer to that edge.
+ */
+{
+ GLUface *f, *fNext;
+ GLUhalfEdge *e;
+
+ /*LINTED*/
+ for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) {
+ fNext = f->next;
+ e = f->anEdge;
+ assert( e->Lnext != e );
+
+ if( e->Lnext->Lnext == e ) {
+ /* A face with only two edges */
+ AddWinding( e->Onext, e );
+ if ( !__gl_meshDelete( e ) ) return 0;
+ }
+ }
+ return 1;
+}
+
+int __gl_computeInterior( GLUtesselator *tess )
+/*
+ * __gl_computeInterior( tess ) computes the planar arrangement specified
+ * by the given contours, and further subdivides this arrangement
+ * into regions. Each region is marked "inside" if it belongs
+ * to the polygon, according to the rule given by tess->windingRule.
+ * Each interior region is guaranteed be monotone.
+ */
+{
+ GLUvertex *v, *vNext;
+
+ tess->fatalError = FALSE;
+
+ /* Each vertex defines an event for our sweep line. Start by inserting
+ * all the vertices in a priority queue. Events are processed in
+ * lexicographic order, ie.
+ *
+ * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y)
+ */
+ RemoveDegenerateEdges( tess );
+ if ( !InitPriorityQ( tess ) ) return 0; /* if error */
+ InitEdgeDict( tess );
+
+ /* __gl_pqSortExtractMin */
+ while( (v = (GLUvertex *)pqExtractMin( tess->pq )) != NULL ) {
+ for( ;; ) {
+ vNext = (GLUvertex *)pqMinimum( tess->pq ); /* __gl_pqSortMinimum */
+ if( vNext == NULL || ! VertEq( vNext, v )) break;
+
+ /* Merge together all vertices at exactly the same location.
+ * This is more efficient than processing them one at a time,
+ * simplifies the code (see ConnectLeftDegenerate), and is also
+ * important for correct handling of certain degenerate cases.
+ * For example, suppose there are two identical edges A and B
+ * that belong to different contours (so without this code they would
+ * be processed by separate sweep events). Suppose another edge C
+ * crosses A and B from above. When A is processed, we split it
+ * at its intersection point with C. However this also splits C,
+ * so when we insert B we may compute a slightly different
+ * intersection point. This might leave two edges with a small
+ * gap between them. This kind of error is especially obvious
+ * when using boundary extraction (GLU_TESS_BOUNDARY_ONLY).
+ */
+ vNext = (GLUvertex *)pqExtractMin( tess->pq ); /* __gl_pqSortExtractMin*/
+ SpliceMergeVertices( tess, v->anEdge, vNext->anEdge );
+ }
+ SweepEvent( tess, v );
+ }
+
+ /* Set tess->event for debugging purposes */
+ /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */
+ tess->event = ((ActiveRegion *) dictKey( dictMin( tess->dict )))->eUp->Org;
+ DebugEvent( tess );
+ DoneEdgeDict( tess );
+ DonePriorityQ( tess );
+
+ if ( !RemoveDegenerateFaces( tess->mesh ) ) return 0;
+ __gl_meshCheckMesh( tess->mesh );
+
+ return 1;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.h
new file mode 100644
index 0000000..931a59a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/sweep.h
@@ -0,0 +1,84 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/sweep.h#5 $
+*/
+
+#ifndef __sweep_h_
+#define __sweep_h_
+
+#include "ThirdParty/glu/libtess/mesh.h"
+
+/* __gl_computeInterior( tess ) computes the planar arrangement specified
+ * by the given contours, and further subdivides this arrangement
+ * into regions. Each region is marked "inside" if it belongs
+ * to the polygon, according to the rule given by tess->windingRule.
+ * Each interior region is guaranteed be monotone.
+ */
+int __gl_computeInterior( GLUtesselator *tess );
+
+
+/* The following is here *only* for access by debugging routines */
+
+#include "dict.h"
+
+/* For each pair of adjacent edges crossing the sweep line, there is
+ * an ActiveRegion to represent the region between them. The active
+ * regions are kept in sorted order in a dynamic dictionary. As the
+ * sweep line crosses each vertex, we update the affected regions.
+ */
+
+struct ActiveRegion {
+ GLUhalfEdge *eUp; /* upper edge, directed right to left */
+ DictNode *nodeUp; /* dictionary node corresponding to eUp */
+ int windingNumber; /* used to determine which regions are
+ * inside the polygon */
+ GLboolean inside; /* is this region inside the polygon? */
+ GLboolean sentinel; /* marks fake edges at t = +/-infinity */
+ GLboolean dirty; /* marks regions where the upper or lower
+ * edge has changed, but we haven't checked
+ * whether they intersect yet */
+ GLboolean fixUpperEdge; /* marks temporary edges introduced when
+ * we process a "right vertex" (one without
+ * any edges leaving to the right) */
+};
+
+#define RegionBelow(r) ((ActiveRegion *) dictKey(dictPred((r)->nodeUp)))
+#define RegionAbove(r) ((ActiveRegion *) dictKey(dictSucc((r)->nodeUp)))
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.c
new file mode 100644
index 0000000..0a63953
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.c
@@ -0,0 +1,639 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/tess.c#7 $
+*/
+
+#include <assert.h>
+#include <setjmp.h>
+#include <stddef.h>
+
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/memalloc.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+#include "ThirdParty/glu/libtess/normal.h"
+#include "ThirdParty/glu/libtess/render.h"
+#include "ThirdParty/glu/libtess/sweep.h"
+#include "ThirdParty/glu/libtess/tess.h"
+#include "ThirdParty/glu/libtess/tessmono.h"
+
+#define GLU_TESS_DEFAULT_TOLERANCE 0.0
+#define GLU_TESS_MESH 100112 /* void (*)(GLUmesh *mesh) */
+
+#define TRUE 1
+#define FALSE 0
+
+/*ARGSUSED*/ static void GLAPIENTRY noBegin( GLenum type ) {}
+/*ARGSUSED*/ static void GLAPIENTRY noEdgeFlag( GLboolean boundaryEdge ) {}
+/*ARGSUSED*/ static void GLAPIENTRY noVertex( void *data ) {}
+/*ARGSUSED*/ static void GLAPIENTRY noEnd( void ) {}
+/*ARGSUSED*/ static void GLAPIENTRY noError( GLenum errnum ) {}
+/*ARGSUSED*/ static void GLAPIENTRY noCombine( GLdouble coords[3], void *data[4],
+ GLfloat weight[4], void **dataOut ) {}
+/*ARGSUSED*/ static void GLAPIENTRY noMesh( GLUmesh *mesh ) {}
+
+
+/*ARGSUSED*/ void GLAPIENTRY __gl_noBeginData( GLenum type,
+ void *polygonData ) {}
+/*ARGSUSED*/ void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge,
+ void *polygonData ) {}
+/*ARGSUSED*/ void GLAPIENTRY __gl_noVertexData( void *data,
+ void *polygonData ) {}
+/*ARGSUSED*/ void GLAPIENTRY __gl_noEndData( void *polygonData ) {}
+/*ARGSUSED*/ void GLAPIENTRY __gl_noErrorData( GLenum errnum,
+ void *polygonData ) {}
+/*ARGSUSED*/ void GLAPIENTRY __gl_noCombineData( GLdouble coords[3],
+ void *data[4],
+ GLfloat weight[4],
+ void **outData,
+ void *polygonData ) {}
+
+/* Half-edges are allocated in pairs (see mesh.c) */
+typedef struct { GLUhalfEdge e, eSym; } EdgePair;
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \
+ MAX(sizeof(GLUvertex),sizeof(GLUface))))
+
+
+GLUtesselator * GLAPIENTRY
+internal_gluNewTess( void )
+{
+ GLUtesselator *tess;
+
+ /* Only initialize fields which can be changed by the api. Other fields
+ * are initialized where they are used.
+ */
+
+ if (memInit( MAX_FAST_ALLOC ) == 0) {
+ return 0; /* out of memory */
+ }
+ tess = (GLUtesselator *)memAlloc( sizeof( GLUtesselator ));
+ if (tess == NULL) {
+ return 0; /* out of memory */
+ }
+
+ tess->state = T_DORMANT;
+
+ tess->normal[0] = 0;
+ tess->normal[1] = 0;
+ tess->normal[2] = 0;
+
+ tess->relTolerance = GLU_TESS_DEFAULT_TOLERANCE;
+ tess->windingRule = GLU_TESS_WINDING_ODD;
+ tess->flagBoundary = FALSE;
+ tess->boundaryOnly = FALSE;
+
+ tess->callBegin = &noBegin;
+ tess->callEdgeFlag = &noEdgeFlag;
+ tess->callVertex = &noVertex;
+ tess->callEnd = &noEnd;
+
+ tess->callError = &noError;
+ tess->callCombine = &noCombine;
+ tess->callMesh = &noMesh;
+
+ tess->callBeginData= &__gl_noBeginData;
+ tess->callEdgeFlagData= &__gl_noEdgeFlagData;
+ tess->callVertexData= &__gl_noVertexData;
+ tess->callEndData= &__gl_noEndData;
+ tess->callErrorData= &__gl_noErrorData;
+ tess->callCombineData= &__gl_noCombineData;
+
+ tess->polygonData= NULL;
+
+ return tess;
+}
+
+static void MakeDormant( GLUtesselator *tess )
+{
+ /* Return the tessellator to its original dormant state. */
+
+ if( tess->mesh != NULL ) {
+ __gl_meshDeleteMesh( tess->mesh );
+ }
+ tess->state = T_DORMANT;
+ tess->lastEdge = NULL;
+ tess->mesh = NULL;
+}
+
+#define RequireState( tess, s ) if( tess->state != s ) GotoState(tess,s)
+
+static void GotoState( GLUtesselator *tess, enum TessState newState )
+{
+ while( tess->state != newState ) {
+ /* We change the current state one level at a time, to get to
+ * the desired state.
+ */
+ if( tess->state < newState ) {
+ switch( tess->state ) {
+ case T_DORMANT:
+ CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_POLYGON );
+ internal_gluTessBeginPolygon( tess, NULL );
+ break;
+ case T_IN_POLYGON:
+ CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_CONTOUR );
+ internal_gluTessBeginContour( tess );
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ } else {
+ switch( tess->state ) {
+ case T_IN_CONTOUR:
+ CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_CONTOUR );
+ internal_gluTessEndContour( tess );
+ break;
+ case T_IN_POLYGON:
+ CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_POLYGON );
+ /* gluTessEndPolygon( tess ) is too much work! */
+ MakeDormant( tess );
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ }
+ }
+}
+
+
+void GLAPIENTRY
+internal_gluDeleteTess( GLUtesselator *tess )
+{
+ RequireState( tess, T_DORMANT );
+ memFree( tess );
+}
+
+
+void GLAPIENTRY
+internal_gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value )
+{
+ GLenum windingRule;
+
+ switch( which ) {
+ case GLU_TESS_TOLERANCE:
+ if( value < 0.0 || value > 1.0 ) break;
+ tess->relTolerance = value;
+ return;
+
+ case GLU_TESS_WINDING_RULE:
+ windingRule = (GLenum) value;
+ if( windingRule != value ) break; /* not an integer */
+
+ switch( windingRule ) {
+ case GLU_TESS_WINDING_ODD:
+ case GLU_TESS_WINDING_NONZERO:
+ case GLU_TESS_WINDING_POSITIVE:
+ case GLU_TESS_WINDING_NEGATIVE:
+ case GLU_TESS_WINDING_ABS_GEQ_TWO:
+ tess->windingRule = windingRule;
+ return;
+ default:
+ break;
+ }
+
+ case GLU_TESS_BOUNDARY_ONLY:
+ tess->boundaryOnly = (value != 0);
+ return;
+
+ default:
+ CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM );
+ return;
+ }
+ CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_VALUE );
+}
+
+/* Returns tessellator property */
+void GLAPIENTRY
+internal_gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value )
+{
+ switch (which) {
+ case GLU_TESS_TOLERANCE:
+ /* tolerance should be in range [0..1] */
+ assert(0.0 <= tess->relTolerance && tess->relTolerance <= 1.0);
+ *value= tess->relTolerance;
+ break;
+ case GLU_TESS_WINDING_RULE:
+ assert(tess->windingRule == GLU_TESS_WINDING_ODD ||
+ tess->windingRule == GLU_TESS_WINDING_NONZERO ||
+ tess->windingRule == GLU_TESS_WINDING_POSITIVE ||
+ tess->windingRule == GLU_TESS_WINDING_NEGATIVE ||
+ tess->windingRule == GLU_TESS_WINDING_ABS_GEQ_TWO);
+ *value= tess->windingRule;
+ break;
+ case GLU_TESS_BOUNDARY_ONLY:
+ assert(tess->boundaryOnly == TRUE || tess->boundaryOnly == FALSE);
+ *value= tess->boundaryOnly;
+ break;
+ default:
+ *value= 0.0;
+ CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM );
+ break;
+ }
+} /* gluGetTessProperty() */
+
+void GLAPIENTRY
+internal_gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z )
+{
+ tess->normal[0] = x;
+ tess->normal[1] = y;
+ tess->normal[2] = z;
+}
+
+void GLAPIENTRY
+internal_gluTessCallback( GLUtesselator *tess, GLenum which, void (GLAPIENTRY *fn)())
+{
+ switch( which ) {
+ case GLU_TESS_BEGIN:
+ tess->callBegin = (fn == NULL) ? &noBegin : (void (GLAPIENTRY *)(GLenum)) fn;
+ return;
+ case GLU_TESS_BEGIN_DATA:
+ tess->callBeginData = (fn == NULL) ?
+ &__gl_noBeginData : (void (GLAPIENTRY *)(GLenum, void *)) fn;
+ return;
+ case GLU_TESS_EDGE_FLAG:
+ tess->callEdgeFlag = (fn == NULL) ? &noEdgeFlag :
+ (void (GLAPIENTRY *)(GLboolean)) fn;
+ /* If the client wants boundary edges to be flagged,
+ * we render everything as separate triangles (no strips or fans).
+ */
+ tess->flagBoundary = (fn != NULL);
+ return;
+ case GLU_TESS_EDGE_FLAG_DATA:
+ tess->callEdgeFlagData= (fn == NULL) ?
+ &__gl_noEdgeFlagData : (void (GLAPIENTRY *)(GLboolean, void *)) fn;
+ /* If the client wants boundary edges to be flagged,
+ * we render everything as separate triangles (no strips or fans).
+ */
+ tess->flagBoundary = (fn != NULL);
+ return;
+ case GLU_TESS_VERTEX:
+ tess->callVertex = (fn == NULL) ? &noVertex :
+ (void (GLAPIENTRY *)(void *)) fn;
+ return;
+ case GLU_TESS_VERTEX_DATA:
+ tess->callVertexData = (fn == NULL) ?
+ &__gl_noVertexData : (void (GLAPIENTRY *)(void *, void *)) fn;
+ return;
+ case GLU_TESS_END:
+ tess->callEnd = (fn == NULL) ? &noEnd : (void (GLAPIENTRY *)(void)) fn;
+ return;
+ case GLU_TESS_END_DATA:
+ tess->callEndData = (fn == NULL) ? &__gl_noEndData :
+ (void (GLAPIENTRY *)(void *)) fn;
+ return;
+ case GLU_TESS_ERROR:
+ tess->callError = (fn == NULL) ? &noError : (void (GLAPIENTRY *)(GLenum)) fn;
+ return;
+ case GLU_TESS_ERROR_DATA:
+ tess->callErrorData = (fn == NULL) ?
+ &__gl_noErrorData : (void (GLAPIENTRY *)(GLenum, void *)) fn;
+ return;
+ case GLU_TESS_COMBINE:
+ tess->callCombine = (fn == NULL) ? &noCombine :
+ (void (GLAPIENTRY *)(GLdouble [3],void *[4], GLfloat [4], void ** )) fn;
+ return;
+ case GLU_TESS_COMBINE_DATA:
+ tess->callCombineData = (fn == NULL) ? &__gl_noCombineData :
+ (void (GLAPIENTRY *)(GLdouble [3],
+ void *[4],
+ GLfloat [4],
+ void **,
+ void *)) fn;
+ return;
+ case GLU_TESS_MESH:
+ tess->callMesh = (fn == NULL) ? &noMesh : (void (GLAPIENTRY *)(GLUmesh *)) fn;
+ return;
+ default:
+ CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM );
+ return;
+ }
+}
+
+static int AddVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
+{
+ GLUhalfEdge *e;
+
+ e = tess->lastEdge;
+ if( e == NULL ) {
+ /* Make a self-loop (one vertex, one edge). */
+
+ e = __gl_meshMakeEdge( tess->mesh );
+ if (e == NULL) return 0;
+ if ( !__gl_meshSplice( e, e->Sym ) ) return 0;
+ } else {
+ /* Create a new vertex and edge which immediately follow e
+ * in the ordering around the left face.
+ */
+ if (__gl_meshSplitEdge( e ) == NULL) return 0;
+ e = e->Lnext;
+ }
+
+ /* The new vertex is now e->Org. */
+ e->Org->data = data;
+ e->Org->coords[0] = coords[0];
+ e->Org->coords[1] = coords[1];
+ e->Org->coords[2] = coords[2];
+
+ /* The winding of an edge says how the winding number changes as we
+ * cross from the edge''s right face to its left face. We add the
+ * vertices in such an order that a CCW contour will add +1 to
+ * the winding number of the region inside the contour.
+ */
+ e->winding = 1;
+ e->Sym->winding = -1;
+
+ tess->lastEdge = e;
+
+ return 1;
+}
+
+
+static void CacheVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
+{
+ CachedVertex *v = &tess->cache[tess->cacheCount];
+
+ v->data = data;
+ v->coords[0] = coords[0];
+ v->coords[1] = coords[1];
+ v->coords[2] = coords[2];
+ ++tess->cacheCount;
+}
+
+
+static int EmptyCache( GLUtesselator *tess )
+{
+ CachedVertex *v = tess->cache;
+ CachedVertex *vLast;
+
+ tess->mesh = __gl_meshNewMesh();
+ if (tess->mesh == NULL) return 0;
+
+ for( vLast = v + tess->cacheCount; v < vLast; ++v ) {
+ if ( !AddVertex( tess, v->coords, v->data ) ) return 0;
+ }
+ tess->cacheCount = 0;
+ tess->emptyCache = FALSE;
+
+ return 1;
+}
+
+
+void GLAPIENTRY
+internal_gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
+{
+ int i, tooLarge = FALSE;
+ GLdouble x, clamped[3];
+
+ RequireState( tess, T_IN_CONTOUR );
+
+ if( tess->emptyCache ) {
+ if ( !EmptyCache( tess ) ) {
+ CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
+ return;
+ }
+ tess->lastEdge = NULL;
+ }
+ for( i = 0; i < 3; ++i ) {
+ x = coords[i];
+ if( x < - GLU_TESS_MAX_COORD ) {
+ x = - GLU_TESS_MAX_COORD;
+ tooLarge = TRUE;
+ }
+ if( x > GLU_TESS_MAX_COORD ) {
+ x = GLU_TESS_MAX_COORD;
+ tooLarge = TRUE;
+ }
+ clamped[i] = x;
+ }
+ if( tooLarge ) {
+ CALL_ERROR_OR_ERROR_DATA( GLU_TESS_COORD_TOO_LARGE );
+ }
+
+ if( tess->mesh == NULL ) {
+ if( tess->cacheCount < TESS_MAX_CACHE ) {
+ CacheVertex( tess, clamped, data );
+ return;
+ }
+ if ( !EmptyCache( tess ) ) {
+ CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
+ return;
+ }
+ }
+ if ( !AddVertex( tess, clamped, data ) ) {
+ CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
+ }
+}
+
+
+void GLAPIENTRY
+internal_gluTessBeginPolygon( GLUtesselator *tess, void *data )
+{
+ RequireState( tess, T_DORMANT );
+
+ tess->state = T_IN_POLYGON;
+ tess->cacheCount = 0;
+ tess->emptyCache = FALSE;
+ tess->mesh = NULL;
+
+ tess->polygonData= data;
+}
+
+
+void GLAPIENTRY
+internal_gluTessBeginContour( GLUtesselator *tess )
+{
+ RequireState( tess, T_IN_POLYGON );
+
+ tess->state = T_IN_CONTOUR;
+ tess->lastEdge = NULL;
+ if( tess->cacheCount > 0 ) {
+ /* Just set a flag so we don't get confused by empty contours
+ * -- these can be generated accidentally with the obsolete
+ * NextContour() interface.
+ */
+ tess->emptyCache = TRUE;
+ }
+}
+
+
+void GLAPIENTRY
+internal_gluTessEndContour( GLUtesselator *tess )
+{
+ RequireState( tess, T_IN_CONTOUR );
+ tess->state = T_IN_POLYGON;
+}
+
+void GLAPIENTRY
+internal_gluTessEndPolygon( GLUtesselator *tess )
+{
+ GLUmesh *mesh;
+
+ if (setjmp(tess->env) != 0) {
+ /* come back here if out of memory */
+ CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
+ return;
+ }
+
+ RequireState( tess, T_IN_POLYGON );
+ tess->state = T_DORMANT;
+
+ if( tess->mesh == NULL ) {
+ if( ! tess->flagBoundary && tess->callMesh == &noMesh ) {
+
+ /* Try some special code to make the easy cases go quickly
+ * (eg. convex polygons). This code does NOT handle multiple contours,
+ * intersections, edge flags, and of course it does not generate
+ * an explicit mesh either.
+ */
+ if( __gl_renderCache( tess )) {
+ tess->polygonData= NULL;
+ return;
+ }
+ }
+ if ( !EmptyCache( tess ) ) longjmp(tess->env,1); /* could've used a label*/
+ }
+
+ /* Determine the polygon normal and project vertices onto the plane
+ * of the polygon.
+ */
+ __gl_projectPolygon( tess );
+
+ /* __gl_computeInterior( tess ) computes the planar arrangement specified
+ * by the given contours, and further subdivides this arrangement
+ * into regions. Each region is marked "inside" if it belongs
+ * to the polygon, according to the rule given by tess->windingRule.
+ * Each interior region is guaranteed be monotone.
+ */
+ if ( !__gl_computeInterior( tess ) ) {
+ longjmp(tess->env,1); /* could've used a label */
+ }
+
+ mesh = tess->mesh;
+ if( ! tess->fatalError ) {
+ int rc = 1;
+
+ /* If the user wants only the boundary contours, we throw away all edges
+ * except those which separate the interior from the exterior.
+ * Otherwise we tessellate all the regions marked "inside".
+ */
+ if( tess->boundaryOnly ) {
+ rc = __gl_meshSetWindingNumber( mesh, 1, TRUE );
+ } else {
+ rc = __gl_meshTessellateInterior( mesh );
+ }
+ if (rc == 0) longjmp(tess->env,1); /* could've used a label */
+
+ __gl_meshCheckMesh( mesh );
+
+ if( tess->callBegin != &noBegin || tess->callEnd != &noEnd
+ || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag
+ || tess->callBeginData != &__gl_noBeginData
+ || tess->callEndData != &__gl_noEndData
+ || tess->callVertexData != &__gl_noVertexData
+ || tess->callEdgeFlagData != &__gl_noEdgeFlagData )
+ {
+ if( tess->boundaryOnly ) {
+ __gl_renderBoundary( tess, mesh ); /* output boundary contours */
+ } else {
+ __gl_renderMesh( tess, mesh ); /* output strips and fans */
+ }
+ }
+ if( tess->callMesh != &noMesh ) {
+
+ /* Throw away the exterior faces, so that all faces are interior.
+ * This way the user doesn't have to check the "inside" flag,
+ * and we don't need to even reveal its existence. It also leaves
+ * the freedom for an implementation to not generate the exterior
+ * faces in the first place.
+ */
+ __gl_meshDiscardExterior( mesh );
+ (*tess->callMesh)( mesh ); /* user wants the mesh itself */
+ tess->mesh = NULL;
+ tess->polygonData= NULL;
+ return;
+ }
+ }
+ __gl_meshDeleteMesh( mesh );
+ tess->polygonData= NULL;
+ tess->mesh = NULL;
+}
+
+
+/*XXXblythe unused function*/
+#if 0
+void GLAPIENTRY
+gluDeleteMesh( GLUmesh *mesh )
+{
+ __gl_meshDeleteMesh( mesh );
+}
+#endif
+
+
+
+/*******************************************************/
+
+/* Obsolete calls -- for backward compatibility */
+
+#if 0
+void GLAPIENTRY
+gluBeginPolygon( GLUtesselator *tess )
+{
+ gluTessBeginPolygon( tess, NULL );
+ gluTessBeginContour( tess );
+}
+
+
+/*ARGSUSED*/
+void GLAPIENTRY
+gluNextContour( GLUtesselator *tess, GLenum type )
+{
+ gluTessEndContour( tess );
+ gluTessBeginContour( tess );
+}
+
+
+void GLAPIENTRY
+gluEndPolygon( GLUtesselator *tess )
+{
+ gluTessEndContour( tess );
+ gluTessEndPolygon( tess );
+}
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.h
new file mode 100644
index 0000000..f837b90
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tess.h
@@ -0,0 +1,173 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/tess.h#6 $
+*/
+
+#ifndef __tess_h_
+#define __tess_h_
+
+#include <setjmp.h>
+
+#include "ThirdParty/glu/internal_glu.h"
+#include "ThirdParty/glu/libtess/dict.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+#include "ThirdParty/glu/libtess/priorityq.h"
+
+/* The begin/end calls must be properly nested. We keep track of
+ * the current state to enforce the ordering.
+ */
+enum TessState { T_DORMANT, T_IN_POLYGON, T_IN_CONTOUR };
+
+/* We cache vertex data for single-contour polygons so that we can
+ * try a quick-and-dirty decomposition first.
+ */
+#define TESS_MAX_CACHE 100
+
+typedef struct CachedVertex {
+ GLdouble coords[3];
+ void *data;
+} CachedVertex;
+
+struct GLUtesselator {
+
+ /*** state needed for collecting the input data ***/
+
+ enum TessState state; /* what begin/end calls have we seen? */
+
+ GLUhalfEdge *lastEdge; /* lastEdge->Org is the most recent vertex */
+ GLUmesh *mesh; /* stores the input contours, and eventually
+ the tessellation itself */
+
+ void (GLAPIENTRY *callError)( GLenum errnum );
+
+ /*** state needed for projecting onto the sweep plane ***/
+
+ GLdouble normal[3]; /* user-specified normal (if provided) */
+ GLdouble sUnit[3]; /* unit vector in s-direction (debugging) */
+ GLdouble tUnit[3]; /* unit vector in t-direction (debugging) */
+
+ /*** state needed for the line sweep ***/
+
+ GLdouble relTolerance; /* tolerance for merging features */
+ GLenum windingRule; /* rule for determining polygon interior */
+ GLboolean fatalError; /* fatal error: needed combine callback */
+
+ Dict *dict; /* edge dictionary for sweep line */
+ PriorityQ *pq; /* priority queue of vertex events */
+ GLUvertex *event; /* current sweep event being processed */
+
+ void (GLAPIENTRY *callCombine)( GLdouble coords[3], void *data[4],
+ GLfloat weight[4], void **outData );
+
+ /*** state needed for rendering callbacks (see render.c) ***/
+
+ GLboolean flagBoundary; /* mark boundary edges (use EdgeFlag) */
+ GLboolean boundaryOnly; /* Extract contours, not triangles */
+ GLUface *lonelyTriList;
+ /* list of triangles which could not be rendered as strips or fans */
+
+ void (GLAPIENTRY *callBegin)( GLenum type );
+ void (GLAPIENTRY *callEdgeFlag)( GLboolean boundaryEdge );
+ void (GLAPIENTRY *callVertex)( void *data );
+ void (GLAPIENTRY *callEnd)( void );
+ void (GLAPIENTRY *callMesh)( GLUmesh *mesh );
+
+
+ /*** state needed to cache single-contour polygons for renderCache() */
+
+ GLboolean emptyCache; /* empty cache on next vertex() call */
+ int cacheCount; /* number of cached vertices */
+ CachedVertex cache[TESS_MAX_CACHE]; /* the vertex data */
+
+ /*** rendering callbacks that also pass polygon data ***/
+ void (GLAPIENTRY *callBeginData)( GLenum type, void *polygonData );
+ void (GLAPIENTRY *callEdgeFlagData)( GLboolean boundaryEdge,
+ void *polygonData );
+ void (GLAPIENTRY *callVertexData)( void *data, void *polygonData );
+ void (GLAPIENTRY *callEndData)( void *polygonData );
+ void (GLAPIENTRY *callErrorData)( GLenum errnum, void *polygonData );
+ void (GLAPIENTRY *callCombineData)( GLdouble coords[3], void *data[4],
+ GLfloat weight[4], void **outData,
+ void *polygonData );
+
+ jmp_buf env; /* place to jump to when memAllocs fail */
+
+ void *polygonData; /* client data for current polygon */
+};
+
+void GLAPIENTRY __gl_noBeginData( GLenum type, void *polygonData );
+void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData );
+void GLAPIENTRY __gl_noVertexData( void *data, void *polygonData );
+void GLAPIENTRY __gl_noEndData( void *polygonData );
+void GLAPIENTRY __gl_noErrorData( GLenum errnum, void *polygonData );
+void GLAPIENTRY __gl_noCombineData( GLdouble coords[3], void *data[4],
+ GLfloat weight[4], void **outData,
+ void *polygonData );
+
+#define CALL_BEGIN_OR_BEGIN_DATA(a) \
+ if (tess->callBeginData != &__gl_noBeginData) \
+ (*tess->callBeginData)((a),tess->polygonData); \
+ else (*tess->callBegin)((a));
+
+#define CALL_VERTEX_OR_VERTEX_DATA(a) \
+ if (tess->callVertexData != &__gl_noVertexData) \
+ (*tess->callVertexData)((a),tess->polygonData); \
+ else (*tess->callVertex)((a));
+
+#define CALL_EDGE_FLAG_OR_EDGE_FLAG_DATA(a) \
+ if (tess->callEdgeFlagData != &__gl_noEdgeFlagData) \
+ (*tess->callEdgeFlagData)((a),tess->polygonData); \
+ else (*tess->callEdgeFlag)((a));
+
+#define CALL_END_OR_END_DATA() \
+ if (tess->callEndData != &__gl_noEndData) \
+ (*tess->callEndData)(tess->polygonData); \
+ else (*tess->callEnd)();
+
+#define CALL_COMBINE_OR_COMBINE_DATA(a,b,c,d) \
+ if (tess->callCombineData != &__gl_noCombineData) \
+ (*tess->callCombineData)((a),(b),(c),(d),tess->polygonData); \
+ else (*tess->callCombine)((a),(b),(c),(d));
+
+#define CALL_ERROR_OR_ERROR_DATA(a) \
+ if (tess->callErrorData != &__gl_noErrorData) \
+ (*tess->callErrorData)((a),tess->polygonData); \
+ else (*tess->callError)((a));
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.c b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.c
new file mode 100644
index 0000000..68fbe68
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.c
@@ -0,0 +1,209 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/tessmono.c#5 $
+*/
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include "ThirdParty/glu/gluos.h"
+#include "ThirdParty/glu/libtess/geom.h"
+#include "ThirdParty/glu/libtess/mesh.h"
+#include "ThirdParty/glu/libtess/tessmono.h"
+
+#define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \
+ eDst->Sym->winding += eSrc->Sym->winding)
+
+/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region
+ * (what else would it do??) The region must consist of a single
+ * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this
+ * case means that any vertical line intersects the interior of the
+ * region in a single interval.
+ *
+ * Tessellation consists of adding interior edges (actually pairs of
+ * half-edges), to split the region into non-overlapping triangles.
+ *
+ * The basic idea is explained in Preparata and Shamos (which I don''t
+ * have handy right now), although their implementation is more
+ * complicated than this one. The are two edge chains, an upper chain
+ * and a lower chain. We process all vertices from both chains in order,
+ * from right to left.
+ *
+ * The algorithm ensures that the following invariant holds after each
+ * vertex is processed: the untessellated region consists of two
+ * chains, where one chain (say the upper) is a single edge, and
+ * the other chain is concave. The left vertex of the single edge
+ * is always to the left of all vertices in the concave chain.
+ *
+ * Each step consists of adding the rightmost unprocessed vertex to one
+ * of the two chains, and forming a fan of triangles from the rightmost
+ * of two chain endpoints. Determining whether we can add each triangle
+ * to the fan is a simple orientation test. By making the fan as large
+ * as possible, we restore the invariant (check it yourself).
+ */
+int __gl_meshTessellateMonoRegion( GLUface *face )
+{
+ GLUhalfEdge *up, *lo;
+
+ /* All edges are oriented CCW around the boundary of the region.
+ * First, find the half-edge whose origin vertex is rightmost.
+ * Since the sweep goes from left to right, face->anEdge should
+ * be close to the edge we want.
+ */
+ up = face->anEdge;
+ assert( up->Lnext != up && up->Lnext->Lnext != up );
+
+ for( ; VertLeq( up->Dst, up->Org ); up = up->Lprev )
+ ;
+ for( ; VertLeq( up->Org, up->Dst ); up = up->Lnext )
+ ;
+ lo = up->Lprev;
+
+ while( up->Lnext != lo ) {
+ if( VertLeq( up->Dst, lo->Org )) {
+ /* up->Dst is on the left. It is safe to form triangles from lo->Org.
+ * The EdgeGoesLeft test guarantees progress even when some triangles
+ * are CW, given that the upper and lower chains are truly monotone.
+ */
+ while( lo->Lnext != up && (EdgeGoesLeft( lo->Lnext )
+ || EdgeSign( lo->Org, lo->Dst, lo->Lnext->Dst ) <= 0 )) {
+ GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo );
+ if (tempHalfEdge == NULL) return 0;
+ lo = tempHalfEdge->Sym;
+ }
+ lo = lo->Lprev;
+ } else {
+ /* lo->Org is on the left. We can make CCW triangles from up->Dst. */
+ while( lo->Lnext != up && (EdgeGoesRight( up->Lprev )
+ || EdgeSign( up->Dst, up->Org, up->Lprev->Org ) >= 0 )) {
+ GLUhalfEdge *tempHalfEdge= __gl_meshConnect( up, up->Lprev );
+ if (tempHalfEdge == NULL) return 0;
+ up = tempHalfEdge->Sym;
+ }
+ up = up->Lnext;
+ }
+ }
+
+ /* Now lo->Org == up->Dst == the leftmost vertex. The remaining region
+ * can be tessellated in a fan from this leftmost vertex.
+ */
+ assert( lo->Lnext != up );
+ while( lo->Lnext->Lnext != up ) {
+ GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo );
+ if (tempHalfEdge == NULL) return 0;
+ lo = tempHalfEdge->Sym;
+ }
+
+ return 1;
+}
+
+
+/* __gl_meshTessellateInterior( mesh ) tessellates each region of
+ * the mesh which is marked "inside" the polygon. Each such region
+ * must be monotone.
+ */
+int __gl_meshTessellateInterior( GLUmesh *mesh )
+{
+ GLUface *f, *next;
+
+ /*LINTED*/
+ for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) {
+ /* Make sure we don''t try to tessellate the new triangles. */
+ next = f->next;
+ if( f->inside ) {
+ if ( !__gl_meshTessellateMonoRegion( f ) ) return 0;
+ }
+ }
+
+ return 1;
+}
+
+
+/* __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces
+ * which are not marked "inside" the polygon. Since further mesh operations
+ * on NULL faces are not allowed, the main purpose is to clean up the
+ * mesh so that exterior loops are not represented in the data structure.
+ */
+void __gl_meshDiscardExterior( GLUmesh *mesh )
+{
+ GLUface *f, *next;
+
+ /*LINTED*/
+ for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) {
+ /* Since f will be destroyed, save its next pointer. */
+ next = f->next;
+ if( ! f->inside ) {
+ __gl_meshZapFace( f );
+ }
+ }
+}
+
+#define MARKED_FOR_DELETION 0x7fffffff
+
+/* __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the
+ * winding numbers on all edges so that regions marked "inside" the
+ * polygon have a winding number of "value", and regions outside
+ * have a winding number of 0.
+ *
+ * If keepOnlyBoundary is TRUE, it also deletes all edges which do not
+ * separate an interior region from an exterior one.
+ */
+int __gl_meshSetWindingNumber( GLUmesh *mesh, int value,
+ GLboolean keepOnlyBoundary )
+{
+ GLUhalfEdge *e, *eNext;
+
+ for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) {
+ eNext = e->next;
+ if( e->Rface->inside != e->Lface->inside ) {
+
+ /* This is a boundary edge (one side is interior, one is exterior). */
+ e->winding = (e->Lface->inside) ? value : -value;
+ } else {
+
+ /* Both regions are interior, or both are exterior. */
+ if( ! keepOnlyBoundary ) {
+ e->winding = 0;
+ } else {
+ if ( !__gl_meshDelete( e ) ) return 0;
+ }
+ }
+ }
+ return 1;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.h b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.h
new file mode 100644
index 0000000..6a71ee8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/glu/libtess/tessmono.h
@@ -0,0 +1,78 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/*
+** Author: Eric Veach, July 1994.
+**
+** $Date$ $Revision$
+** $Header: //depot/main/gfx/lib/glu/libtess/tessmono.h#5 $
+*/
+
+#ifndef __tessmono_h_
+#define __tessmono_h_
+
+/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region
+ * (what else would it do??) The region must consist of a single
+ * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this
+ * case means that any vertical line intersects the interior of the
+ * region in a single interval.
+ *
+ * Tessellation consists of adding interior edges (actually pairs of
+ * half-edges), to split the region into non-overlapping triangles.
+ *
+ * __gl_meshTessellateInterior( mesh ) tessellates each region of
+ * the mesh which is marked "inside" the polygon. Each such region
+ * must be monotone.
+ *
+ * __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces
+ * which are not marked "inside" the polygon. Since further mesh operations
+ * on NULL faces are not allowed, the main purpose is to clean up the
+ * mesh so that exterior loops are not represented in the data structure.
+ *
+ * __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the
+ * winding numbers on all edges so that regions marked "inside" the
+ * polygon have a winding number of "value", and regions outside
+ * have a winding number of 0.
+ *
+ * If keepOnlyBoundary is TRUE, it also deletes all edges which do not
+ * separate an interior region from an exterior one.
+ */
+
+int __gl_meshTessellateMonoRegion( GLUface *face );
+int __gl_meshTessellateInterior( GLUmesh *mesh );
+void __gl_meshDiscardExterior( GLUmesh *mesh );
+int __gl_meshSetWindingNumber( GLUmesh *mesh, int value,
+ GLboolean keepOnlyBoundary );
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/CHANGES b/src/3rdparty/webkit/Source/ThirdParty/gtest/CHANGES
new file mode 100644
index 0000000..e574415
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/CHANGES
@@ -0,0 +1,98 @@
+Changes for 1.5.0:
+
+ * New feature: assertions can be safely called in multiple threads
+ where the pthreads library is available.
+ * New feature: predicates used inside EXPECT_TRUE() and friends
+ can now generate custom failure messages.
+ * New feature: Google Test can now be compiled as a DLL.
+ * New feature: fused source files are included.
+ * New feature: prints help when encountering unrecognized Google Test flags.
+ * Experimental feature: CMake build script (requires CMake 2.6.4+).
+ * Experimental feature: the Pump script for meta programming.
+ * double values streamed to an assertion are printed with enough precision
+ to differentiate any two different values.
+ * Google Test now works on Solaris and AIX.
+ * Build and test script improvements.
+ * Bug fixes and implementation clean-ups.
+
+ Potentially breaking changes:
+
+ * Stopped supporting VC++ 7.1 with exceptions disabled.
+ * Dropped support for 'make install'.
+
+Changes for 1.4.0:
+
+ * New feature: the event listener API
+ * New feature: test shuffling
+ * New feature: the XML report format is closer to junitreport and can
+ be parsed by Hudson now.
+ * New feature: when a test runs under Visual Studio, its failures are
+ integrated in the IDE.
+ * New feature: /MD(d) versions of VC++ projects.
+ * New feature: elapsed time for the tests is printed by default.
+ * New feature: comes with a TR1 tuple implementation such that Boost
+ is no longer needed for Combine().
+ * New feature: EXPECT_DEATH_IF_SUPPORTED macro and friends.
+ * New feature: the Xcode project can now produce static gtest
+ libraries in addition to a framework.
+ * Compatibility fixes for Solaris, Cygwin, minGW, Windows Mobile,
+ Symbian, gcc, and C++Builder.
+ * Bug fixes and implementation clean-ups.
+
+Changes for 1.3.0:
+
+ * New feature: death tests on Windows, Cygwin, and Mac.
+ * New feature: ability to use Google Test assertions in other testing
+ frameworks.
+ * New feature: ability to run disabled test via
+ --gtest_also_run_disabled_tests.
+ * New feature: the --help flag for printing the usage.
+ * New feature: access to Google Test flag values in user code.
+ * New feature: a script that packs Google Test into one .h and one
+ .cc file for easy deployment.
+ * New feature: support for distributing test functions to multiple
+ machines (requires support from the test runner).
+ * Bug fixes and implementation clean-ups.
+
+Changes for 1.2.1:
+
+ * Compatibility fixes for Linux IA-64 and IBM z/OS.
+ * Added support for using Boost and other TR1 implementations.
+ * Changes to the build scripts to support upcoming release of Google C++
+ Mocking Framework.
+ * Added Makefile to the distribution package.
+ * Improved build instructions in README.
+
+Changes for 1.2.0:
+
+ * New feature: value-parameterized tests.
+ * New feature: the ASSERT/EXPECT_(NON)FATAL_FAILURE(_ON_ALL_THREADS)
+ macros.
+ * Changed the XML report format to match JUnit/Ant's.
+ * Added tests to the Xcode project.
+ * Added scons/SConscript for building with SCons.
+ * Added src/gtest-all.cc for building Google Test from a single file.
+ * Fixed compatibility with Solaris and z/OS.
+ * Enabled running Python tests on systems with python 2.3 installed,
+ e.g. Mac OS X 10.4.
+ * Bug fixes.
+
+Changes for 1.1.0:
+
+ * New feature: type-parameterized tests.
+ * New feature: exception assertions.
+ * New feature: printing elapsed time of tests.
+ * Improved the robustness of death tests.
+ * Added an Xcode project and samples.
+ * Adjusted the output format on Windows to be understandable by Visual Studio.
+ * Minor bug fixes.
+
+Changes for 1.0.1:
+
+ * Added project files for Visual Studio 7.1.
+ * Fixed issues with compiling on Mac OS X.
+ * Fixed issues with compiling on Cygwin.
+
+Changes for 1.0.0:
+
+ * Initial Open Source release of Google Test
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/CMakeLists.txt b/src/3rdparty/webkit/Source/ThirdParty/gtest/CMakeLists.txt
new file mode 100644
index 0000000..7910b5d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/CMakeLists.txt
@@ -0,0 +1,384 @@
+########################################################################
+# Experimental CMake build script for Google Test.
+#
+# Consider this a prototype. It will change drastically. For now,
+# this is only for people on the cutting edge.
+#
+# To run the tests for Google Test itself on Linux, use 'make test' or
+# ctest. You can select which tests to run using 'ctest -R regex'.
+# For more options, run 'ctest --help'.
+
+# For hermetic builds, we may need to tell CMake to use compiler in a
+# specific location.
+if (gtest_compiler)
+ include(CMakeForceCompiler)
+ cmake_force_c_compiler("${gtest_compiler}" "")
+ cmake_force_cxx_compiler("${gtest_compiler}" "")
+endif()
+
+########################################################################
+#
+# Project-wide settings
+
+# Name of the project.
+#
+# CMake files in this project can refer to the root source directory
+# as ${gtest_SOURCE_DIR} and to the root binary directory as
+# ${gtest_BINARY_DIR}.
+# Language "C" is required for find_package(Threads).
+project(gtest CXX C)
+cmake_minimum_required(VERSION 2.6.4)
+
+if (MSVC)
+ # For MSVC, CMake sets certain flags to defaults we want to override.
+ # This replacement code is taken from sample in the CMake Wiki at
+ # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace.
+ foreach (flag_var
+ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ # In hermetic build environments, tests may not have access to MS runtime
+ # DLLs, so this replaces /MD (CRT libraries in DLLs) with /MT (static CRT
+ # libraries).
+ string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
+ # We prefer more strict warning checking for building Google Test.
+ # Replaces /W3 with /W4 in defaults.
+ string(REPLACE "/W3" "-W4" ${flag_var} "${${flag_var}}")
+ endforeach()
+endif()
+
+# Where gtest's .h files can be found.
+include_directories(
+ ${gtest_SOURCE_DIR}/include
+ ${gtest_SOURCE_DIR})
+
+# Where the gtest libraries can be found.
+link_directories(
+ ${gtest_BINARY_DIR}/src)
+
+# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
+find_package(Threads)
+
+# Defines the compiler/linker flags used to build gtest. You can
+# tweak these definitions to suit your need. A variable's value is
+# empty before it's explicitly assigned to.
+
+if (MSVC)
+ # Newlines inside flags variables break CMake's NMake generator.
+ set(cxx_base_flags "-GS -W4 -WX -wd4275 -nologo -J -Zi")
+ set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
+ set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
+ set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
+ set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0")
+ set(cxx_no_rtti_flags "-GR-")
+elseif (CMAKE_COMPILER_IS_GNUCXX)
+ set(cxx_base_flags "-Wall -Wshadow")
+ set(cxx_exception_flags "-fexceptions")
+ set(cxx_no_exception_flags "-fno-exceptions")
+ # Until version 4.3.2, GCC doesn't define a macro to indicate
+ # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
+ # explicitly.
+ set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
+ set(cxx_strict_flags "-Wextra")
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+ set(cxx_exception_flags "-features=except")
+ # Sun Pro doesn't provide macros to indicate whether exceptions and
+ # RTTI are enabled, so we define GTEST_HAS_* explicitly.
+ set(cxx_no_exception_flags "-features=no%except -DGTEST_HAS_EXCEPTIONS=0")
+ set(cxx_no_rtti_flags "-features=no%rtti -DGTEST_HAS_RTTI=0")
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "VisualAge" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "XL")
+ # CMake 2.8 changes Visual Age's compiler ID to "XL".
+ set(cxx_exception_flags "-qeh")
+ set(cxx_no_exception_flags "-qnoeh")
+ # Until version 9.0, Visual Age doesn't define a macro to indicate
+ # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
+ # explicitly.
+ set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0")
+endif()
+
+if (CMAKE_USE_PTHREADS_INIT) # The pthreads library is available.
+ set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=1")
+endif()
+
+# For building gtest's own tests and samples.
+set(cxx_exception "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_exception_flags}")
+set(cxx_no_exception
+ "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}")
+set(cxx_default "${cxx_exception}")
+set(cxx_no_rtti "${cxx_default} ${cxx_no_rtti_flags}")
+set(cxx_use_own_tuple "${cxx_default} -DGTEST_USE_OWN_TR1_TUPLE=1")
+
+# For building the gtest libraries.
+set(cxx_strict "${cxx_default} ${cxx_strict_flags}")
+
+########################################################################
+#
+# Defines the gtest & gtest_main libraries. User tests should link
+# with one of them.
+function(cxx_library_with_type name type cxx_flags)
+ # type can be either STATIC or SHARED to denote a static or shared library.
+ # ARGN refers to additional arguments after 'cxx_flags'.
+ add_library(${name} ${type} ${ARGN})
+ set_target_properties(${name}
+ PROPERTIES
+ COMPILE_FLAGS "${cxx_flags}")
+ if (CMAKE_USE_PTHREADS_INIT)
+ target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
+ endif()
+endfunction()
+
+function(cxx_static_library name cxx_flags)
+ cxx_library_with_type(${name} STATIC "${cxx_flags}" ${ARGN})
+endfunction()
+
+function(cxx_shared_library name cxx_flags)
+ cxx_library_with_type(${name} SHARED "${cxx_flags}" ${ARGN})
+endfunction()
+
+function(cxx_library name cxx_flags)
+ # TODO(vladl@google.com): Make static/shared a user option.
+ cxx_static_library(${name} "${cxx_flags}" ${ARGN})
+endfunction()
+
+# Static versions of Google Test libraries. We build them using more
+# strict warnings than what are used for other targets, to ensure that
+# gtest can be compiled by a user aggressive about warnings.
+cxx_static_library(gtest "${cxx_strict}" src/gtest-all.cc)
+cxx_static_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
+target_link_libraries(gtest_main gtest)
+
+########################################################################
+#
+# Samples on how to link user tests with gtest or gtest_main.
+#
+# They are not built by default. To build them, set the
+# build_gtest_samples option to ON. You can do it by running ccmake
+# or specifying the -Dbuild_gtest_samples=ON flag when running cmake.
+
+option(build_gtest_samples "Build gtest's sample programs." OFF)
+
+# cxx_executable_with_flags(name cxx_flags lib srcs...)
+#
+# creates a named C++ executable that depends on the given library and
+# is built from the given source files with the given compiler flags.
+function(cxx_executable_with_flags name cxx_flags lib)
+ add_executable(${name} ${ARGN})
+ if (cxx_flags)
+ set_target_properties(${name}
+ PROPERTIES
+ COMPILE_FLAGS "${cxx_flags}")
+ endif()
+ target_link_libraries(${name} ${lib})
+endfunction()
+
+# cxx_executable(name dir lib srcs...)
+#
+# creates a named target that depends on the given lib and is built
+# from the given source files. dir/name.cc is implicitly included in
+# the source file list.
+function(cxx_executable name dir lib)
+ cxx_executable_with_flags(
+ ${name} "${cxx_default}" ${lib} "${dir}/${name}.cc" ${ARGN})
+endfunction()
+
+if (build_gtest_samples)
+ cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc)
+ cxx_executable(sample2_unittest samples gtest_main samples/sample2.cc)
+ cxx_executable(sample3_unittest samples gtest_main)
+ cxx_executable(sample4_unittest samples gtest_main samples/sample4.cc)
+ cxx_executable(sample5_unittest samples gtest_main samples/sample1.cc)
+ cxx_executable(sample6_unittest samples gtest_main)
+ cxx_executable(sample7_unittest samples gtest_main)
+ cxx_executable(sample8_unittest samples gtest_main)
+ cxx_executable(sample9_unittest samples gtest)
+ cxx_executable(sample10_unittest samples gtest)
+endif()
+
+########################################################################
+#
+# Google Test's own tests.
+#
+# You can skip this section if you aren't interested in testing
+# Google Test itself.
+#
+# Most of the tests are not built by default. To build them, set the
+# build_all_gtest_tests option to ON. You can do it by running ccmake
+# or specifying the -Dbuild_all_gtest_tests=ON flag when running cmake.
+
+option(build_all_gtest_tests "Build all of gtest's own tests." OFF)
+
+# This must be set in the root directory for the tests to be run by
+# 'make test' or ctest.
+enable_testing()
+
+# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
+find_package(PythonInterp)
+
+############################################################
+# C++ tests built with standard compiler flags.
+
+# cxx_test_with_flags(name cxx_flags libs srcs...)
+#
+# creates a named C++ test that depends on the given libs and is built
+# from the given source files with the given compiler flags.
+function(cxx_test_with_flags name cxx_flags libs)
+ add_executable(${name} ${ARGN})
+ set_target_properties(${name}
+ PROPERTIES
+ COMPILE_FLAGS "${cxx_flags}")
+ # To support mixing linking in static and dynamic libraries, link each
+ # library in with an extra call to target_link_libraries.
+ foreach (lib "${libs}")
+ target_link_libraries(${name} ${lib})
+ endforeach()
+ add_test(${name} ${name})
+endfunction()
+
+# cxx_test(name libs srcs...)
+#
+# creates a named test target that depends on the given libs and is
+# built from the given source files. Unlike cxx_test_with_flags,
+# test/name.cc is already implicitly included in the source file list.
+function(cxx_test name libs)
+ cxx_test_with_flags("${name}" "${cxx_default}" "${libs}"
+ "test/${name}.cc" ${ARGN})
+endfunction()
+
+cxx_test(gtest_unittest gtest_main)
+
+if (build_all_gtest_tests)
+ cxx_test(gtest-death-test_test gtest_main)
+ cxx_test(gtest_environment_test gtest)
+ cxx_test(gtest-filepath_test gtest_main)
+ cxx_test(gtest-linked_ptr_test gtest_main)
+ cxx_test(gtest-listener_test gtest_main)
+ cxx_test(gtest_main_unittest gtest_main)
+ cxx_test(gtest-message_test gtest_main)
+ cxx_test(gtest_no_test_unittest gtest)
+ cxx_test(gtest-options_test gtest_main)
+ cxx_test(gtest-param-test_test gtest
+ test/gtest-param-test2_test.cc)
+ cxx_test(gtest-port_test gtest_main)
+ cxx_test(gtest_pred_impl_unittest gtest_main)
+ cxx_test(gtest_prod_test gtest_main
+ test/production.cc)
+ cxx_test(gtest_repeat_test gtest)
+ cxx_test(gtest_sole_header_test gtest_main)
+ cxx_test(gtest_stress_test gtest)
+ cxx_test(gtest-test-part_test gtest_main)
+ cxx_test(gtest_throw_on_failure_ex_test gtest)
+ cxx_test(gtest-typed-test_test gtest_main
+ test/gtest-typed-test2_test.cc)
+ cxx_test(gtest-unittest-api_test gtest)
+endif()
+
+############################################################
+# C++ tests built with non-standard compiler flags.
+
+if (build_all_gtest_tests)
+ cxx_library(gtest_no_exception "${cxx_no_exception}"
+ src/gtest-all.cc)
+ cxx_library(gtest_main_no_rtti "${cxx_no_rtti}"
+ src/gtest-all.cc src/gtest_main.cc)
+
+ cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}"
+ gtest_main_no_rtti test/gtest_unittest.cc)
+
+ set(cxx_use_shared_gtest "${cxx_default} -DGTEST_LINKED_AS_SHARED_LIBRARY=1")
+ set(cxx_build_shared_gtest "${cxx_default} -DGTEST_CREATE_SHARED_LIBRARY=1")
+ if (MSVC)
+ # Disables the "class 'X' needs to have dll-interface to be used
+ # by clients of class 'Y'" warning. This particularly concerns generic
+ # classes like vector that MS doesn't mark as exported.
+ set(cxx_use_shared_gtest "${cxx_use_shared_gtest} -wd4251")
+ set(cxx_build_shared_gtest "${cxx_build_shared_gtest} -wd4251")
+ endif()
+
+ cxx_shared_library(gtest_dll "${cxx_build_shared_gtest}"
+ src/gtest-all.cc)
+
+ # TODO(vladl): This and the next tests may not run in the hermetic
+ # environment on Windows. Re-evaluate and possibly make them
+ # platform-conditional after implementing hermetic builds.
+ cxx_executable_with_flags(gtest_dll_test_ "${cxx_use_shared_gtest}"
+ gtest_dll test/gtest_all_test.cc)
+
+ if (NOT(MSVC AND (MSVC_VERSION EQUAL 1600)))
+ # The C++ Standard specifies tuple_element<int, class>.
+ # Yet MSVC 10's <utility> declares tuple_element<size_t, class>.
+ # That declaration conflicts with our own standard-conforming
+ # tuple implementation. Therefore using our own tuple with
+ # MSVC 10 doesn't compile.
+ cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}"
+ src/gtest-all.cc src/gtest_main.cc)
+
+ cxx_test_with_flags(gtest-tuple_test "${cxx_use_own_tuple}"
+ gtest_main_use_own_tuple test/gtest-tuple_test.cc)
+
+ cxx_test_with_flags(gtest_use_own_tuple_test "${cxx_use_own_tuple}"
+ gtest_main_use_own_tuple
+ test/gtest-param-test_test.cc test/gtest-param-test2_test.cc)
+ endif()
+
+endif()
+
+############################################################
+# Python tests.
+
+# py_test(name)
+#
+# creates a Python test with the given name whose main module is in
+# test/name.py. It does nothing if Python is not installed.
+function(py_test name)
+ if (PYTHONINTERP_FOUND)
+ # ${gtest_BINARY_DIR} is known at configuration time, so we can
+ # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
+ # only at ctest runtime (by calling ctest -c <Configuration>), so
+ # we have to escape $ to delay variable substitution here.
+ add_test(${name}
+ ${PYTHON_EXECUTABLE} ${gtest_SOURCE_DIR}/test/${name}.py
+ --gtest_build_dir=${gtest_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE})
+ endif()
+endfunction()
+
+if (build_all_gtest_tests)
+ cxx_executable(gtest_break_on_failure_unittest_ test gtest)
+ py_test(gtest_break_on_failure_unittest)
+
+ cxx_executable(gtest_color_test_ test gtest)
+ py_test(gtest_color_test)
+
+ cxx_executable(gtest_env_var_test_ test gtest)
+ py_test(gtest_env_var_test)
+
+ cxx_executable(gtest_filter_unittest_ test gtest)
+ py_test(gtest_filter_unittest)
+
+ cxx_executable(gtest_help_test_ test gtest_main)
+ py_test(gtest_help_test)
+
+ cxx_executable(gtest_list_tests_unittest_ test gtest)
+ py_test(gtest_list_tests_unittest)
+
+ cxx_executable(gtest_output_test_ test gtest)
+ py_test(gtest_output_test)
+
+ cxx_executable(gtest_shuffle_test_ test gtest)
+ py_test(gtest_shuffle_test)
+
+ cxx_executable(gtest_throw_on_failure_test_ test gtest_no_exception)
+ set_target_properties(gtest_throw_on_failure_test_
+ PROPERTIES
+ COMPILE_FLAGS "${cxx_no_exception}")
+ py_test(gtest_throw_on_failure_test)
+
+ cxx_executable(gtest_uninitialized_test_ test gtest)
+ py_test(gtest_uninitialized_test)
+
+ cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
+ cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
+ py_test(gtest_xml_outfiles_test)
+
+ cxx_executable(gtest_xml_output_unittest_ test gtest)
+ py_test(gtest_xml_output_unittest)
+endif()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/CONTRIBUTORS b/src/3rdparty/webkit/Source/ThirdParty/gtest/CONTRIBUTORS
new file mode 100644
index 0000000..0934ae1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/CONTRIBUTORS
@@ -0,0 +1,36 @@
+# This file contains a list of people who've made non-trivial
+# contribution to the Google C++ Testing Framework project. People
+# who commit code to the project are encouraged to add their names
+# here. Please keep the list sorted by first names.
+
+Ajay Joshi <jaj@google.com>
+Balázs Dán <balazs.dan@gmail.com>
+Bharat Mediratta <bharat@menalto.com>
+Chandler Carruth <chandlerc@google.com>
+Chris Prince <cprince@google.com>
+Chris Taylor <taylorc@google.com>
+Dan Egnor <egnor@google.com>
+Eric Roman <eroman@chromium.org>
+Hady Zalek <hady.zalek@gmail.com>
+Jeffrey Yasskin <jyasskin@google.com>
+Jói Sigurðsson <joi@google.com>
+Keir Mierle <mierle@gmail.com>
+Keith Ray <keith.ray@gmail.com>
+Kenton Varda <kenton@google.com>
+Manuel Klimek <klimek@google.com>
+Markus Heule <markus.heule@gmail.com>
+Mika Raento <mikie@iki.fi>
+Miklós Fazekas <mfazekas@szemafor.com>
+Patrick Hanna <phanna@google.com>
+Patrick Riley <pfr@google.com>
+Peter Kaminski <piotrk@google.com>
+Preston Jackson <preston.a.jackson@gmail.com>
+Rainer Klaffenboeck <rainer.klaffenboeck@dynatrace.com>
+Russ Cox <rsc@google.com>
+Russ Rufer <russ@pentad.com>
+Sean Mcafee <eefacm@gmail.com>
+Sigurður Ásgeirsson <siggi@google.com>
+Tracy Bialik <tracy@pentad.com>
+Vadim Berman <vadimb@google.com>
+Vlad Losev <vladl@google.com>
+Zhanyong Wan <wan@google.com>
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/COPYING b/src/3rdparty/webkit/Source/ThirdParty/gtest/COPYING
new file mode 100644
index 0000000..1941a11
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/COPYING
@@ -0,0 +1,28 @@
+Copyright 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.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/README b/src/3rdparty/webkit/Source/ThirdParty/gtest/README
new file mode 100644
index 0000000..ec61190
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/README
@@ -0,0 +1,417 @@
+Google C++ Testing Framework
+============================
+
+http://code.google.com/p/googletest/
+
+Overview
+--------
+
+Google's framework for writing C++ tests on a variety of platforms
+(Linux, Mac OS X, Windows, Windows CE, Symbian, etc). Based on the
+xUnit architecture. Supports automatic test discovery, a rich set of
+assertions, user-defined assertions, death tests, fatal and non-fatal
+failures, various options for running the tests, and XML test report
+generation.
+
+Please see the project page above for more information as well as the
+mailing list for questions, discussions, and development. There is
+also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
+join us!
+
+Requirements for End Users
+--------------------------
+
+Google Test is designed to have fairly minimal requirements to build
+and use with your projects, but there are some. Currently, we support
+Linux, Windows, Mac OS X, and Cygwin. We will also make our best
+effort to support other platforms (e.g. Solaris, AIX, and z/OS).
+However, since core members of the Google Test project have no access
+to these platforms, Google Test may have outstanding issues there. If
+you notice any problems on your platform, please notify
+googletestframework@googlegroups.com. Patches for fixing them are
+even more welcome!
+
+### Linux Requirements ###
+
+These are the base requirements to build and use Google Test from a source
+package (as described below):
+ * GNU-compatible Make or gmake
+ * POSIX-standard shell
+ * POSIX(-2) Regular Expressions (regex.h)
+ * A C++98-standard-compliant compiler
+
+### Windows Requirements ###
+
+ * Microsoft Visual C++ 7.1 or newer
+
+### Cygwin Requirements ###
+
+ * Cygwin 1.5.25-14 or newer
+
+### Mac OS X Requirements ###
+
+ * Mac OS X 10.4 Tiger or newer
+ * Developer Tools Installed
+
+Also, you'll need CMake 2.6.4 or higher if you want to build the
+samples using the provided CMake script, regardless of the platform.
+
+Requirements for Contributors
+-----------------------------
+
+We welcome patches. If you plan to contribute a patch, you need to
+build Google Test and its own tests from an SVN checkout (described
+below), which has further requirements:
+
+ * Python version 2.3 or newer (for running some of the tests and
+ re-generating certain source files from templates)
+ * CMake 2.6.4 or newer
+
+Getting the Source
+------------------
+
+There are two primary ways of getting Google Test's source code: you
+can download a stable source release in your preferred archive format,
+or directly check out the source from our Subversion (SVN) repositary.
+The SVN checkout requires a few extra steps and some extra software
+packages on your system, but lets you track the latest development and
+make patches much more easily, so we highly encourage it.
+
+### Source Package ###
+
+Google Test is released in versioned source packages which can be
+downloaded from the download page [1]. Several different archive
+formats are provided, but the only difference is the tools used to
+manipulate them, and the size of the resulting file. Download
+whichever you are most comfortable with.
+
+ [1] http://code.google.com/p/googletest/downloads/list
+
+Once the package is downloaded, expand it using whichever tools you
+prefer for that type. This will result in a new directory with the
+name "gtest-X.Y.Z" which contains all of the source code. Here are
+some examples on Linux:
+
+ tar -xvzf gtest-X.Y.Z.tar.gz
+ tar -xvjf gtest-X.Y.Z.tar.bz2
+ unzip gtest-X.Y.Z.zip
+
+### SVN Checkout ###
+
+To check out the main branch (also known as the "trunk") of Google
+Test, run the following Subversion command:
+
+ svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn
+
+Setting up the Build
+--------------------
+
+To build Google Test and your tests that use it, you need to tell your
+build system where to find its headers and source files. The exact
+way to do it depends on which build system you use, and is usually
+straightforward.
+
+### Generic Build Instructions ###
+
+Suppose you put Google Test in directory ${GTEST_DIR}. To build it,
+create a library build target (or a project as called by Visual Studio
+and Xcode) to compile
+
+ ${GTEST_DIR}/src/gtest-all.cc
+
+with
+
+ ${GTEST_DIR}/include and ${GTEST_DIR}
+
+in the header search path. Assuming a Linux-like system and gcc,
+something like the following will do:
+
+ g++ -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest-all.cc
+ ar -rv libgtest.a gtest-all.o
+
+Next, you should compile your test source file with
+${GTEST_DIR}/include in the header search path, and link it with gtest
+and any other necessary libraries:
+
+ g++ -I${GTEST_DIR}/include path/to/your_test.cc libgtest.a -o your_test
+
+As an example, the make/ directory contains a Makefile that you can
+use to build Google Test on systems where GNU make is available
+(e.g. Linux, Mac OS X, and Cygwin). It doesn't try to build Google
+Test's own tests. Instead, it just builds the Google Test library and
+a sample test. You can use it as a starting point for your own build
+script.
+
+If the default settings are correct for your environment, the
+following commands should succeed:
+
+ cd ${GTEST_DIR}/make
+ make
+ ./sample1_unittest
+
+If you see errors, try to tweak the contents of make/Makefile to make
+them go away. There are instructions in make/Makefile on how to do
+it.
+
+### Using CMake ###
+
+Google Test comes with a CMake build script (CMakeLists.txt) that can
+be used on a wide range of platforms ("C" stands for cross-platofrm.).
+If you don't have CMake installed already, you can download it for
+free from http://www.cmake.org/.
+
+CMake works by generating native makefiles or build projects that can
+be used in the compiler environment of your choice. The typical
+workflow starts with:
+
+ mkdir mybuild # Create a directory to hold the build output.
+ cd mybuild
+ cmake ${GTEST_DIR} # Generate native build scripts.
+
+If you want to build Google Test's samples, you should replace the
+last command with
+
+ cmake -Dbuild_gtest_samples=ON ${GTEST_DIR}
+
+If you are on a *nix system, you should now see a Makefile in the
+current directory. Just type 'make' to build gtest.
+
+If you use Windows and have Vistual Studio installed, a gtest.sln file
+and several .vcproj files will be created. You can then build them
+using Visual Studio.
+
+On Mac OS X with Xcode installed, a .xcodeproj file will be generated.
+
+### Legacy Build Scripts ###
+
+Before settling on CMake, we have been providing hand-maintained build
+projects/scripts for Visual Studio, Xcode, and Autotools. While we
+continue to provide them for convenience, they are not actively
+maintained any more. We highly recommend that you follow the
+instructions in the previous two sections to integrate Google Test
+with your existing build system.
+
+If you still need to use the legacy build scripts, here's how:
+
+The msvc\ folder contains two solutions with Visual C++ projects.
+Open the gtest.sln or gtest-md.sln file using Visual Studio, and you
+are ready to build Google Test the same way you build any Visual
+Studio project. Files that have names ending with -md use DLL
+versions of Microsoft runtime libraries (the /MD or the /MDd compiler
+option). Files without that suffix use static versions of the runtime
+libraries (the /MT or the /MTd option). Please note that one must use
+the same option to compile both gtest and the test code. If you use
+Visual Studio 2005 or above, we recommend the -md version as /MD is
+the default for new projects in these versions of Visual Studio.
+
+On Mac OS X, open the gtest.xcodeproj in the xcode/ folder using
+Xcode. Build the "gtest" target. The universal binary framework will
+end up in your selected build directory (selected in the Xcode
+"Preferences..." -> "Building" pane and defaults to xcode/build).
+Alternatively, at the command line, enter:
+
+ xcodebuild
+
+This will build the "Release" configuration of gtest.framework in your
+default build location. See the "xcodebuild" man page for more
+information about building different configurations and building in
+different locations.
+
+Tweaking Google Test
+--------------------
+
+Google Test can be used in diverse environments. The default
+configuration may not work (or may not work well) out of the box in
+some environments. However, you can easily tweak Google Test by
+defining control macros on the compiler command line. Generally,
+these macros are named like GTEST_XYZ and you define them to either 1
+or 0 to enable or disable a certain feature.
+
+We list the most frequently used macros below. For a complete list,
+see file include/gtest/internal/gtest-port.h.
+
+### Choosing a TR1 Tuple Library ###
+
+Some Google Test features require the C++ Technical Report 1 (TR1)
+tuple library, which is not yet available with all compilers. The
+good news is that Google Test implements a subset of TR1 tuple that's
+enough for its own need, and will automatically use this when the
+compiler doesn't provide TR1 tuple.
+
+Usually you don't need to care about which tuple library Google Test
+uses. However, if your project already uses TR1 tuple, you need to
+tell Google Test to use the same TR1 tuple library the rest of your
+project uses, or the two tuple implementations will clash. To do
+that, add
+
+ -DGTEST_USE_OWN_TR1_TUPLE=0
+
+to the compiler flags while compiling Google Test and your tests. If
+you want to force Google Test to use its own tuple library, just add
+
+ -DGTEST_USE_OWN_TR1_TUPLE=1
+
+to the compiler flags instead.
+
+If you don't want Google Test to use tuple at all, add
+
+ -DGTEST_HAS_TR1_TUPLE=0
+
+and all features using tuple will be disabled.
+
+### Multi-threaded Tests ###
+
+Google Test is thread-safe where the pthread library is available.
+After #include <gtest/gtest.h>, you can check the GTEST_IS_THREADSAFE
+macro to see whether this is the case (yes if the macro is #defined to
+1, no if it's undefined.).
+
+If Google Test doesn't correctly detect whether pthread is available
+in your environment, you can force it with
+
+ -DGTEST_HAS_PTHREAD=1
+
+or
+
+ -DGTEST_HAS_PTHREAD=0
+
+When Google Test uses pthread, you may need to add flags to your
+compiler and/or linker to select the pthread library, or you'll get
+link errors. If you use the CMake script or the deprecated Autotools
+script, this is taken care of for you. If you use your own build
+script, you'll need to read your compiler and linker's manual to
+figure out what flags to add.
+
+### As a Shared Library (DLL) ###
+
+Google Test is compact, so most users can build and link it as a
+static library for the simplicity. You can choose to use Google Test
+as a shared library (known as a DLL on Windows) if you prefer.
+
+To compile gtest as a shared library, add
+
+ -DGTEST_CREATE_SHARED_LIBRARY=1
+
+to the compiler flags. You'll also need to tell the linker to produce
+a shared library instead - consult your linker's manual for how to do
+it.
+
+To compile your tests that use the gtest shared library, add
+
+ -DGTEST_LINKED_AS_SHARED_LIBRARY=1
+
+to the compiler flags.
+
+### Avoiding Macro Name Clashes ###
+
+In C++, macros don't obey namespaces. Therefore two libraries that
+both define a macro of the same name will clash if you #include both
+definitions. In case a Google Test macro clashes with another
+library, you can force Google Test to rename its macro to avoid the
+conflict.
+
+Specifically, if both Google Test and some other code define macro
+FOO, you can add
+
+ -DGTEST_DONT_DEFINE_FOO=1
+
+to the compiler flags to tell Google Test to change the macro's name
+from FOO to GTEST_FOO. Currently FOO can be FAIL, SUCCEED, or TEST.
+For example, with -DGTEST_DONT_DEFINE_TEST=1, you'll need to write
+
+ GTEST_TEST(SomeTest, DoesThis) { ... }
+
+instead of
+
+ TEST(SomeTest, DoesThis) { ... }
+
+in order to define a test.
+
+Upgrating from an Earlier Version
+---------------------------------
+
+We strive to keep Google Test releases backward compatible.
+Sometimes, though, we have to make some breaking changes for the
+users' long-term benefits. This section describes what you'll need to
+do if you are upgrading from an earlier version of Google Test.
+
+### Upgrading from 1.3.0 or Earlier ###
+
+You may need to explicitly enable or disable Google Test's own TR1
+tuple library. See the instructions in section "Choosing a TR1 Tuple
+Library".
+
+### Upgrading from 1.4.0 or Earlier ###
+
+The Autotools build script (configure + make) is no longer officially
+supportted. You are encouraged to migrate to your own build system or
+use CMake. If you still need to use Autotools, you can find
+instructions in the README file from Google Test 1.4.0.
+
+On platforms where the pthread library is available, Google Test uses
+it in order to be thread-safe. See the "Multi-threaded Tests" section
+for what this means to your build script.
+
+If you use Microsoft Visual C++ 7.1 with exceptions disabled, Google
+Test will no longer compile. This should affect very few people, as a
+large portion of STL (including <string>) doesn't compile in this mode
+anyway. We decided to stop supporting it in order to greatly simplify
+Google Test's implementation.
+
+Developing Google Test
+----------------------
+
+This section discusses how to make your own changes to Google Test.
+
+### Testing Google Test Itself ###
+
+To make sure your changes work as intended and don't break existing
+functionality, you'll want to compile and run Google Test's own tests.
+For that you can use CMake:
+
+ mkdir mybuild
+ cd mybuild
+ cmake -Dbuild_all_gtest_tests=ON ${GTEST_DIR}
+
+Make sure you have Python installed, as some of Google Test's tests
+are written in Python. If the cmake command complains about not being
+able to find Python ("Could NOT find PythonInterp (missing:
+PYTHON_EXECUTABLE)"), try telling it explicitly where your Python
+executable can be found:
+
+ cmake -DPYTHON_EXECUTABLE=path/to/python -Dbuild_all_gtest_tests=ON \
+ ${GTEST_DIR}
+
+Next, you can build Google Test and all of its own tests. On *nix,
+this is usually done by 'make'. To run the tests, do
+
+ make test
+
+All tests should pass.
+
+### Regenerating Source Files ###
+
+Some of Google Test's source files are generated from templates (not
+in the C++ sense) using a script. A template file is named FOO.pump,
+where FOO is the name of the file it will generate. For example, the
+file include/gtest/internal/gtest-type-util.h.pump is used to generate
+gtest-type-util.h in the same directory.
+
+Normally you don't need to worry about regenerating the source files,
+unless you need to modify them. In that case, you should modify the
+corresponding .pump files instead and run the pump.py Python script to
+regenerate them. You can find pump.py in the scripts/ directory.
+Read the Pump manual [2] for how to use it.
+
+ [2] http://code.google.com/p/googletest/wiki/PumpManual
+
+### Contributing a Patch ###
+
+We welcome patches. Please read the Google Test developer's guide [3]
+for how you can contribute. In particular, make sure you have signed
+the Contributor License Agreement, or we won't be able to accept the
+patch.
+
+ [3] http://code.google.com/p/googletest/wiki/GoogleTestDevGuide
+
+Happy testing!
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/README.WebKit b/src/3rdparty/webkit/Source/ThirdParty/gtest/README.WebKit
new file mode 100644
index 0000000..1be2969
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/README.WebKit
@@ -0,0 +1,3 @@
+GTest v.1.5.0
+
+http://googletest.googlecode.com/svn/tags/release-1.5.0/
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.cbproj b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.cbproj
new file mode 100644
index 0000000..285bb2a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.cbproj
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>
+ <Config Condition="'$(Config)'==''">Release</Config>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+ <Base>true</Base>
+ <Cfg_1>true</Cfg_1>
+ <CfgParent>Base</CfgParent>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+ <Base>true</Base>
+ <Cfg_2>true</Cfg_2>
+ <CfgParent>Base</CfgParent>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Base)'!=''">
+ <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+ <OutputExt>lib</OutputExt>
+ <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
+ <Defines>NO_STRICT</Defines>
+ <DynamicRTL>true</DynamicRTL>
+ <UsePackages>true</UsePackages>
+ <ProjectType>CppStaticLibrary</ProjectType>
+ <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>
+ <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>
+ <BCC_wpar>false</BCC_wpar>
+ <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</IncludePath>
+ <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
+ <TLIB_PageSize>32</TLIB_PageSize>
+ <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</ILINK_LibraryPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_1)'!=''">
+ <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
+ <DCC_Optimize>false</DCC_Optimize>
+ <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
+ <Defines>_DEBUG;$(Defines)</Defines>
+ <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
+ <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
+ <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
+ <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
+ <DCC_Define>DEBUG</DCC_Define>
+ <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
+ <IntermediateOutputDir>Debug</IntermediateOutputDir>
+ <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
+ <BCC_StackFrames>true</BCC_StackFrames>
+ <BCC_DisableOptimizations>true</BCC_DisableOptimizations>
+ <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+ <TASM_Debugging>Full</TASM_Debugging>
+ <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_2)'!=''">
+ <Defines>NDEBUG;$(Defines)</Defines>
+ <IntermediateOutputDir>Release</IntermediateOutputDir>
+ <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+ <TASM_Debugging>None</TASM_Debugging>
+ </PropertyGroup>
+ <ProjectExtensions>
+ <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
+ <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>
+ <BorlandProject>
+<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>
+
+
+ <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>
+ <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>
+ </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\src;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Count">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item0">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item1">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>
+ </ProjectExtensions>
+ <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
+ <ItemGroup>
+ <None Include="..\include\gtest\gtest-death-test.h">
+ <BuildOrder>3</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest-message.h">
+ <BuildOrder>4</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest-param-test.h">
+ <BuildOrder>5</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest-spi.h">
+ <BuildOrder>6</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest-test-part.h">
+ <BuildOrder>7</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest-typed-test.h">
+ <BuildOrder>8</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest.h">
+ <BuildOrder>0</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest_pred_impl.h">
+ <BuildOrder>1</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\gtest_prod.h">
+ <BuildOrder>2</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-death-test-internal.h">
+ <BuildOrder>9</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-filepath.h">
+ <BuildOrder>10</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-internal.h">
+ <BuildOrder>11</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-linked_ptr.h">
+ <BuildOrder>12</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-param-util-generated.h">
+ <BuildOrder>14</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-param-util.h">
+ <BuildOrder>13</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-port.h">
+ <BuildOrder>15</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-string.h">
+ <BuildOrder>16</BuildOrder>
+ </None>
+ <None Include="..\include\gtest\internal\gtest-type-util.h">
+ <BuildOrder>17</BuildOrder>
+ </None>
+ <CppCompile Include="gtest_all.cc">
+ <BuildOrder>18</BuildOrder>
+ </CppCompile>
+ <BuildConfiguration Include="Debug">
+ <Key>Cfg_1</Key>
+ </BuildConfiguration>
+ <BuildConfiguration Include="Release">
+ <Key>Cfg_2</Key>
+ </BuildConfiguration>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.groupproj b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.groupproj
new file mode 100644
index 0000000..849f4c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest.groupproj
@@ -0,0 +1,54 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{c1d923e0-6cba-4332-9b6f-3420acbf5091}</ProjectGuid>
+ </PropertyGroup>
+ <ItemGroup />
+ <ItemGroup>
+ <Projects Include="gtest.cbproj" />
+ <Projects Include="gtest_main.cbproj" />
+ <Projects Include="gtest_unittest.cbproj" />
+ </ItemGroup>
+ <ProjectExtensions>
+ <Borland.Personality>Default.Personality</Borland.Personality>
+ <Borland.ProjectType />
+ <BorlandProject>
+<BorlandProject xmlns=""><Default.Personality></Default.Personality></BorlandProject></BorlandProject>
+ </ProjectExtensions>
+ <Target Name="gtest">
+ <MSBuild Projects="gtest.cbproj" Targets="" />
+ </Target>
+ <Target Name="gtest:Clean">
+ <MSBuild Projects="gtest.cbproj" Targets="Clean" />
+ </Target>
+ <Target Name="gtest:Make">
+ <MSBuild Projects="gtest.cbproj" Targets="Make" />
+ </Target>
+ <Target Name="gtest_main">
+ <MSBuild Projects="gtest_main.cbproj" Targets="" />
+ </Target>
+ <Target Name="gtest_main:Clean">
+ <MSBuild Projects="gtest_main.cbproj" Targets="Clean" />
+ </Target>
+ <Target Name="gtest_main:Make">
+ <MSBuild Projects="gtest_main.cbproj" Targets="Make" />
+ </Target>
+ <Target Name="gtest_unittest">
+ <MSBuild Projects="gtest_unittest.cbproj" Targets="" />
+ </Target>
+ <Target Name="gtest_unittest:Clean">
+ <MSBuild Projects="gtest_unittest.cbproj" Targets="Clean" />
+ </Target>
+ <Target Name="gtest_unittest:Make">
+ <MSBuild Projects="gtest_unittest.cbproj" Targets="Make" />
+ </Target>
+ <Target Name="Build">
+ <CallTarget Targets="gtest;gtest_main;gtest_unittest" />
+ </Target>
+ <Target Name="Clean">
+ <CallTarget Targets="gtest:Clean;gtest_main:Clean;gtest_unittest:Clean" />
+ </Target>
+ <Target Name="Make">
+ <CallTarget Targets="gtest:Make;gtest_main:Make;gtest_unittest:Make" />
+ </Target>
+ <Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" />
+</Project> \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_all.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_all.cc
new file mode 100644
index 0000000..ba7ad68
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_all.cc
@@ -0,0 +1,38 @@
+// Copyright 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.
+//
+// Author: Josh Kelley (joshkel@gmail.com)
+//
+// Google C++ Testing Framework (Google Test)
+//
+// C++Builder's IDE cannot build a static library from files with hyphens
+// in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 .
+// This file serves as a workaround.
+
+#include "src/gtest-all.cc"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_link.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_link.cc
new file mode 100644
index 0000000..b955ebf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_link.cc
@@ -0,0 +1,40 @@
+// Copyright 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.
+//
+// Author: Josh Kelley (joshkel@gmail.com)
+//
+// Google C++ Testing Framework (Google Test)
+//
+// Links gtest.lib and gtest_main.lib into the current project in C++Builder.
+// This means that these libraries can't be renamed, but it's the only way to
+// ensure that Debug versus Release test builds are linked against the
+// appropriate Debug or Release build of the libraries.
+
+#pragma link "gtest.lib"
+#pragma link "gtest_main.lib"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_main.cbproj b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_main.cbproj
new file mode 100644
index 0000000..fae32cb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_main.cbproj
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>
+ <Config Condition="'$(Config)'==''">Release</Config>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+ <Base>true</Base>
+ <Cfg_1>true</Cfg_1>
+ <CfgParent>Base</CfgParent>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+ <Base>true</Base>
+ <Cfg_2>true</Cfg_2>
+ <CfgParent>Base</CfgParent>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Base)'!=''">
+ <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+ <OutputExt>lib</OutputExt>
+ <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
+ <Defines>NO_STRICT</Defines>
+ <DynamicRTL>true</DynamicRTL>
+ <UsePackages>true</UsePackages>
+ <ProjectType>CppStaticLibrary</ProjectType>
+ <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>
+ <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>
+ <BCC_wpar>false</BCC_wpar>
+ <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</IncludePath>
+ <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
+ <TLIB_PageSize>32</TLIB_PageSize>
+ <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</ILINK_LibraryPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_1)'!=''">
+ <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
+ <DCC_Optimize>false</DCC_Optimize>
+ <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
+ <Defines>_DEBUG;$(Defines)</Defines>
+ <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
+ <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
+ <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
+ <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
+ <DCC_Define>DEBUG</DCC_Define>
+ <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
+ <IntermediateOutputDir>Debug</IntermediateOutputDir>
+ <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
+ <BCC_StackFrames>true</BCC_StackFrames>
+ <BCC_DisableOptimizations>true</BCC_DisableOptimizations>
+ <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+ <TASM_Debugging>Full</TASM_Debugging>
+ <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_2)'!=''">
+ <Defines>NDEBUG;$(Defines)</Defines>
+ <IntermediateOutputDir>Release</IntermediateOutputDir>
+ <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+ <TASM_Debugging>None</TASM_Debugging>
+ </PropertyGroup>
+ <ProjectExtensions>
+ <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
+ <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>
+ <BorlandProject>
+<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>
+ <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>
+ <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>
+ </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\src;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Count">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item0">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item1">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>
+ </ProjectExtensions>
+ <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
+ <ItemGroup>
+ <CppCompile Include="..\src\gtest_main.cc">
+ <BuildOrder>0</BuildOrder>
+ </CppCompile>
+ <BuildConfiguration Include="Debug">
+ <Key>Cfg_1</Key>
+ </BuildConfiguration>
+ <BuildConfiguration Include="Release">
+ <Key>Cfg_2</Key>
+ </BuildConfiguration>
+ </ItemGroup>
+</Project>
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_unittest.cbproj b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_unittest.cbproj
new file mode 100644
index 0000000..33f7056
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/codegear/gtest_unittest.cbproj
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{eea63393-5ac5-4b9c-8909-d75fef2daa41}</ProjectGuid>
+ <Config Condition="'$(Config)'==''">Release</Config>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+ <Base>true</Base>
+ <Cfg_1>true</Cfg_1>
+ <CfgParent>Base</CfgParent>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+ <Base>true</Base>
+ <Cfg_2>true</Cfg_2>
+ <CfgParent>Base</CfgParent>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Base)'!=''">
+ <OutputExt>exe</OutputExt>
+ <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+ <Defines>NO_STRICT</Defines>
+ <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
+ <DynamicRTL>true</DynamicRTL>
+ <ILINK_ObjectSearchPath>..\test</ILINK_ObjectSearchPath>
+ <UsePackages>true</UsePackages>
+ <ProjectType>CppConsoleApplication</ProjectType>
+ <NoVCL>true</NoVCL>
+ <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>
+ <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi</PackageImports>
+ <BCC_wpar>false</BCC_wpar>
+ <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test;..</IncludePath>
+ <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</ILINK_LibraryPath>
+ <Multithreaded>true</Multithreaded>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_1)'!=''">
+ <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
+ <DCC_Optimize>false</DCC_Optimize>
+ <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
+ <Defines>_DEBUG;$(Defines)</Defines>
+ <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
+ <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
+ <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
+ <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
+ <DCC_Define>DEBUG</DCC_Define>
+ <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
+ <IntermediateOutputDir>Debug</IntermediateOutputDir>
+ <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
+ <BCC_StackFrames>true</BCC_StackFrames>
+ <BCC_DisableOptimizations>true</BCC_DisableOptimizations>
+ <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+ <TASM_Debugging>Full</TASM_Debugging>
+ <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_2)'!=''">
+ <Defines>NDEBUG;$(Defines)</Defines>
+ <IntermediateOutputDir>Release</IntermediateOutputDir>
+ <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+ <TASM_Debugging>None</TASM_Debugging>
+ </PropertyGroup>
+ <ProjectExtensions>
+ <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
+ <Borland.ProjectType>CppConsoleApplication</Borland.ProjectType>
+ <BorlandProject>
+<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>
+
+
+ <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>
+ <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>
+ </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item1">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item2">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;$(OUTPUTDIR);..\test</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">2</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item1">STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>
+ </ProjectExtensions>
+ <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
+ <ItemGroup>
+ <CppCompile Include="..\test\gtest_unittest.cc">
+ <BuildOrder>0</BuildOrder>
+ </CppCompile>
+ <CppCompile Include="gtest_link.cc">
+ <BuildOrder>1</BuildOrder>
+ </CppCompile>
+ <BuildConfiguration Include="Debug">
+ <Key>Cfg_1</Key>
+ </BuildConfiguration>
+ <BuildConfiguration Include="Release">
+ <Key>Cfg_2</Key>
+ </BuildConfiguration>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/configure.ac b/src/3rdparty/webkit/Source/ThirdParty/gtest/configure.ac
new file mode 100644
index 0000000..1b91237
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/configure.ac
@@ -0,0 +1,67 @@
+m4_include(m4/acx_pthread.m4)
+
+# At this point, the Xcode project assumes the version string will be three
+# integers separated by periods and surrounded by square brackets (e.g.
+# "[1.0.1]"). It also asumes that there won't be any closing parenthesis
+# between "AC_INIT(" and the closing ")" including comments and strings.
+AC_INIT([Google C++ Testing Framework],
+ [1.5.0],
+ [googletestframework@googlegroups.com],
+ [gtest])
+
+# Provide various options to initialize the Autoconf and configure processes.
+AC_PREREQ([2.59])
+AC_CONFIG_SRCDIR([./COPYING])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_HEADERS([build-aux/config.h])
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([scripts/gtest-config], [chmod +x scripts/gtest-config])
+
+# Initialize Automake with various options. We require at least v1.9, prevent
+# pedantic complaints about package files, and enable various distribution
+# targets.
+AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects])
+
+# Check for programs used in building Google Test.
+AC_PROG_CC
+AC_PROG_CXX
+AC_LANG([C++])
+AC_PROG_LIBTOOL
+
+# TODO(chandlerc@google.com): Currently we aren't running the Python tests
+# against the interpreter detected by AM_PATH_PYTHON, and so we condition
+# HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's
+# version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env"
+# hashbang.
+PYTHON= # We *do not* allow the user to specify a python interpreter
+AC_PATH_PROG([PYTHON],[python],[:])
+AS_IF([test "$PYTHON" != ":"],
+ [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])])
+AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"])
+
+# Configure pthreads.
+AC_ARG_WITH([pthreads],
+ [AS_HELP_STRING([--with-pthreads],
+ [use pthreads (default is yes)])],
+ [with_pthreads=$withval],
+ [with_pthreads=check])
+
+have_pthreads=no
+AS_IF([test "x$with_pthreads" != "xno"],
+ [ACX_PTHREAD(
+ [],
+ [AS_IF([test "x$with_pthreads" != "xcheck"],
+ [AC_MSG_FAILURE(
+ [--with-pthreads was specified, but unable to be used])])])
+ have_pthreads="$acx_pthread_ok"])
+AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"])
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_LIBS)
+
+# TODO(chandlerc@google.com) Check for the necessary system headers.
+
+# TODO(chandlerc@google.com) Check the types, structures, and other compiler
+# and architecture characteristics.
+
+# Output the generated files. No further autoconf macros may be used.
+AC_OUTPUT
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-death-test.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-death-test.h
new file mode 100644
index 0000000..121dc1f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-death-test.h
@@ -0,0 +1,283 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file defines the public API for death tests. It is
+// #included by gtest.h so a user doesn't need to include this
+// directly.
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
+#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
+
+#include <gtest/internal/gtest-death-test-internal.h>
+
+namespace testing {
+
+// This flag controls the style of death tests. Valid values are "threadsafe",
+// meaning that the death test child process will re-execute the test binary
+// from the start, running only a single death test, or "fast",
+// meaning that the child process will execute the test logic immediately
+// after forking.
+GTEST_DECLARE_string_(death_test_style);
+
+#if GTEST_HAS_DEATH_TEST
+
+// The following macros are useful for writing death tests.
+
+// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
+// executed:
+//
+// 1. It generates a warning if there is more than one active
+// thread. This is because it's safe to fork() or clone() only
+// when there is a single thread.
+//
+// 2. The parent process clone()s a sub-process and runs the death
+// test in it; the sub-process exits with code 0 at the end of the
+// death test, if it hasn't exited already.
+//
+// 3. The parent process waits for the sub-process to terminate.
+//
+// 4. The parent process checks the exit code and error message of
+// the sub-process.
+//
+// Examples:
+//
+// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
+// for (int i = 0; i < 5; i++) {
+// EXPECT_DEATH(server.ProcessRequest(i),
+// "Invalid request .* in ProcessRequest()")
+// << "Failed to die on request " << i);
+// }
+//
+// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
+//
+// bool KilledBySIGHUP(int exit_code) {
+// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
+// }
+//
+// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
+//
+// On the regular expressions used in death tests:
+//
+// On POSIX-compliant systems (*nix), we use the <regex.h> library,
+// which uses the POSIX extended regex syntax.
+//
+// On other platforms (e.g. Windows), we only support a simple regex
+// syntax implemented as part of Google Test. This limited
+// implementation should be enough most of the time when writing
+// death tests; though it lacks many features you can find in PCRE
+// or POSIX extended regex syntax. For example, we don't support
+// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
+// repetition count ("x{5,7}"), among others.
+//
+// Below is the syntax that we do support. We chose it to be a
+// subset of both PCRE and POSIX extended regex, so it's easy to
+// learn wherever you come from. In the following: 'A' denotes a
+// literal character, period (.), or a single \\ escape sequence;
+// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
+// natural numbers.
+//
+// c matches any literal character c
+// \\d matches any decimal digit
+// \\D matches any character that's not a decimal digit
+// \\f matches \f
+// \\n matches \n
+// \\r matches \r
+// \\s matches any ASCII whitespace, including \n
+// \\S matches any character that's not a whitespace
+// \\t matches \t
+// \\v matches \v
+// \\w matches any letter, _, or decimal digit
+// \\W matches any character that \\w doesn't match
+// \\c matches any literal character c, which must be a punctuation
+// . matches any single character except \n
+// A? matches 0 or 1 occurrences of A
+// A* matches 0 or many occurrences of A
+// A+ matches 1 or many occurrences of A
+// ^ matches the beginning of a string (not that of each line)
+// $ matches the end of a string (not that of each line)
+// xy matches x followed by y
+//
+// If you accidentally use PCRE or POSIX extended regex features
+// not implemented by us, you will get a run-time failure. In that
+// case, please try to rewrite your regular expression within the
+// above syntax.
+//
+// This implementation is *not* meant to be as highly tuned or robust
+// as a compiled regex library, but should perform well enough for a
+// death test, which already incurs significant overhead by launching
+// a child process.
+//
+// Known caveats:
+//
+// A "threadsafe" style death test obtains the path to the test
+// program from argv[0] and re-executes it in the sub-process. For
+// simplicity, the current implementation doesn't search the PATH
+// when launching the sub-process. This means that the user must
+// invoke the test program via a path that contains at least one
+// path separator (e.g. path/to/foo_test and
+// /absolute/path/to/bar_test are fine, but foo_test is not). This
+// is rarely a problem as people usually don't put the test binary
+// directory in PATH.
+//
+// TODO(wan@google.com): make thread-safe death tests search the PATH.
+
+// Asserts that a given statement causes the program to exit, with an
+// integer exit status that satisfies predicate, and emitting error output
+// that matches regex.
+#define ASSERT_EXIT(statement, predicate, regex) \
+ GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
+
+// Like ASSERT_EXIT, but continues on to successive tests in the
+// test case, if any:
+#define EXPECT_EXIT(statement, predicate, regex) \
+ GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
+
+// Asserts that a given statement causes the program to exit, either by
+// explicitly exiting with a nonzero exit code or being killed by a
+// signal, and emitting error output that matches regex.
+#define ASSERT_DEATH(statement, regex) \
+ ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
+
+// Like ASSERT_DEATH, but continues on to successive tests in the
+// test case, if any:
+#define EXPECT_DEATH(statement, regex) \
+ EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
+
+// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
+
+// Tests that an exit code describes a normal exit with a given exit code.
+class GTEST_API_ ExitedWithCode {
+ public:
+ explicit ExitedWithCode(int exit_code);
+ bool operator()(int exit_status) const;
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ExitedWithCode& other);
+
+ const int exit_code_;
+};
+
+#if !GTEST_OS_WINDOWS
+// Tests that an exit code describes an exit due to termination by a
+// given signal.
+class GTEST_API_ KilledBySignal {
+ public:
+ explicit KilledBySignal(int signum);
+ bool operator()(int exit_status) const;
+ private:
+ const int signum_;
+};
+#endif // !GTEST_OS_WINDOWS
+
+// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
+// The death testing framework causes this to have interesting semantics,
+// since the sideeffects of the call are only visible in opt mode, and not
+// in debug mode.
+//
+// In practice, this can be used to test functions that utilize the
+// LOG(DFATAL) macro using the following style:
+//
+// int DieInDebugOr12(int* sideeffect) {
+// if (sideeffect) {
+// *sideeffect = 12;
+// }
+// LOG(DFATAL) << "death";
+// return 12;
+// }
+//
+// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
+// int sideeffect = 0;
+// // Only asserts in dbg.
+// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
+//
+// #ifdef NDEBUG
+// // opt-mode has sideeffect visible.
+// EXPECT_EQ(12, sideeffect);
+// #else
+// // dbg-mode no visible sideeffect.
+// EXPECT_EQ(0, sideeffect);
+// #endif
+// }
+//
+// This will assert that DieInDebugReturn12InOpt() crashes in debug
+// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
+// appropriate fallback value (12 in this case) in opt mode. If you
+// need to test that a function has appropriate side-effects in opt
+// mode, include assertions against the side-effects. A general
+// pattern for this is:
+//
+// EXPECT_DEBUG_DEATH({
+// // Side-effects here will have an effect after this statement in
+// // opt mode, but none in debug mode.
+// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
+// }, "death");
+//
+#ifdef NDEBUG
+
+#define EXPECT_DEBUG_DEATH(statement, regex) \
+ do { statement; } while (::testing::internal::AlwaysFalse())
+
+#define ASSERT_DEBUG_DEATH(statement, regex) \
+ do { statement; } while (::testing::internal::AlwaysFalse())
+
+#else
+
+#define EXPECT_DEBUG_DEATH(statement, regex) \
+ EXPECT_DEATH(statement, regex)
+
+#define ASSERT_DEBUG_DEATH(statement, regex) \
+ ASSERT_DEATH(statement, regex)
+
+#endif // NDEBUG for EXPECT_DEBUG_DEATH
+#endif // GTEST_HAS_DEATH_TEST
+
+// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
+// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
+// death tests are supported; otherwise they just issue a warning. This is
+// useful when you are combining death test assertions with normal test
+// assertions in one test.
+#if GTEST_HAS_DEATH_TEST
+#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
+ EXPECT_DEATH(statement, regex)
+#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
+ ASSERT_DEATH(statement, regex)
+#else
+#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
+ GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
+#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
+ GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
+#endif
+
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-message.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-message.h
new file mode 100644
index 0000000..f135b69
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-message.h
@@ -0,0 +1,230 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file defines the Message class.
+//
+// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
+// leave some internal implementation details in this header file.
+// They are clearly marked by comments like this:
+//
+// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+//
+// Such code is NOT meant to be used by a user directly, and is subject
+// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
+// program!
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
+#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
+
+#include <limits>
+
+#include <gtest/internal/gtest-string.h>
+#include <gtest/internal/gtest-internal.h>
+
+namespace testing {
+
+// The Message class works like an ostream repeater.
+//
+// Typical usage:
+//
+// 1. You stream a bunch of values to a Message object.
+// It will remember the text in a StrStream.
+// 2. Then you stream the Message object to an ostream.
+// This causes the text in the Message to be streamed
+// to the ostream.
+//
+// For example;
+//
+// testing::Message foo;
+// foo << 1 << " != " << 2;
+// std::cout << foo;
+//
+// will print "1 != 2".
+//
+// Message is not intended to be inherited from. In particular, its
+// destructor is not virtual.
+//
+// Note that StrStream behaves differently in gcc and in MSVC. You
+// can stream a NULL char pointer to it in the former, but not in the
+// latter (it causes an access violation if you do). The Message
+// class hides this difference by treating a NULL char pointer as
+// "(null)".
+class GTEST_API_ Message {
+ private:
+ // The type of basic IO manipulators (endl, ends, and flush) for
+ // narrow streams.
+ typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
+
+ public:
+ // Constructs an empty Message.
+ // We allocate the StrStream separately because it otherwise each use of
+ // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
+ // stack frame leading to huge stack frames in some cases; gcc does not reuse
+ // the stack space.
+ Message() : ss_(new internal::StrStream) {
+ // By default, we want there to be enough precision when printing
+ // a double to a Message.
+ *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
+ }
+
+ // Copy constructor.
+ Message(const Message& msg) : ss_(new internal::StrStream) { // NOLINT
+ *ss_ << msg.GetString();
+ }
+
+ // Constructs a Message from a C-string.
+ explicit Message(const char* str) : ss_(new internal::StrStream) {
+ *ss_ << str;
+ }
+
+ ~Message() { delete ss_; }
+#if GTEST_OS_SYMBIAN
+ // Streams a value (either a pointer or not) to this object.
+ template <typename T>
+ inline Message& operator <<(const T& value) {
+ StreamHelper(typename internal::is_pointer<T>::type(), value);
+ return *this;
+ }
+#else
+ // Streams a non-pointer value to this object.
+ template <typename T>
+ inline Message& operator <<(const T& val) {
+ ::GTestStreamToHelper(ss_, val);
+ return *this;
+ }
+
+ // Streams a pointer value to this object.
+ //
+ // This function is an overload of the previous one. When you
+ // stream a pointer to a Message, this definition will be used as it
+ // is more specialized. (The C++ Standard, section
+ // [temp.func.order].) If you stream a non-pointer, then the
+ // previous definition will be used.
+ //
+ // The reason for this overload is that streaming a NULL pointer to
+ // ostream is undefined behavior. Depending on the compiler, you
+ // may get "0", "(nil)", "(null)", or an access violation. To
+ // ensure consistent result across compilers, we always treat NULL
+ // as "(null)".
+ template <typename T>
+ inline Message& operator <<(T* const& pointer) { // NOLINT
+ if (pointer == NULL) {
+ *ss_ << "(null)";
+ } else {
+ ::GTestStreamToHelper(ss_, pointer);
+ }
+ return *this;
+ }
+#endif // GTEST_OS_SYMBIAN
+
+ // Since the basic IO manipulators are overloaded for both narrow
+ // and wide streams, we have to provide this specialized definition
+ // of operator <<, even though its body is the same as the
+ // templatized version above. Without this definition, streaming
+ // endl or other basic IO manipulators to Message will confuse the
+ // compiler.
+ Message& operator <<(BasicNarrowIoManip val) {
+ *ss_ << val;
+ return *this;
+ }
+
+ // Instead of 1/0, we want to see true/false for bool values.
+ Message& operator <<(bool b) {
+ return *this << (b ? "true" : "false");
+ }
+
+ // These two overloads allow streaming a wide C string to a Message
+ // using the UTF-8 encoding.
+ Message& operator <<(const wchar_t* wide_c_str) {
+ return *this << internal::String::ShowWideCString(wide_c_str);
+ }
+ Message& operator <<(wchar_t* wide_c_str) {
+ return *this << internal::String::ShowWideCString(wide_c_str);
+ }
+
+#if GTEST_HAS_STD_WSTRING
+ // Converts the given wide string to a narrow string using the UTF-8
+ // encoding, and streams the result to this Message object.
+ Message& operator <<(const ::std::wstring& wstr);
+#endif // GTEST_HAS_STD_WSTRING
+
+#if GTEST_HAS_GLOBAL_WSTRING
+ // Converts the given wide string to a narrow string using the UTF-8
+ // encoding, and streams the result to this Message object.
+ Message& operator <<(const ::wstring& wstr);
+#endif // GTEST_HAS_GLOBAL_WSTRING
+
+ // Gets the text streamed to this object so far as a String.
+ // Each '\0' character in the buffer is replaced with "\\0".
+ //
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+ internal::String GetString() const {
+ return internal::StrStreamToString(ss_);
+ }
+
+ private:
+#if GTEST_OS_SYMBIAN
+ // These are needed as the Nokia Symbian Compiler cannot decide between
+ // const T& and const T* in a function template. The Nokia compiler _can_
+ // decide between class template specializations for T and T*, so a
+ // tr1::type_traits-like is_pointer works, and we can overload on that.
+ template <typename T>
+ inline void StreamHelper(internal::true_type /*dummy*/, T* pointer) {
+ if (pointer == NULL) {
+ *ss_ << "(null)";
+ } else {
+ ::GTestStreamToHelper(ss_, pointer);
+ }
+ }
+ template <typename T>
+ inline void StreamHelper(internal::false_type /*dummy*/, const T& value) {
+ ::GTestStreamToHelper(ss_, value);
+ }
+#endif // GTEST_OS_SYMBIAN
+
+ // We'll hold the text streamed to this object here.
+ internal::StrStream* const ss_;
+
+ // We declare (but don't implement) this to prevent the compiler
+ // from implementing the assignment operator.
+ void operator=(const Message&);
+};
+
+// Streams a Message to an ostream.
+inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
+ return os << sb.GetString();
+}
+
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h
new file mode 100644
index 0000000..8100696
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h
@@ -0,0 +1,1392 @@
+// This file was GENERATED by a script. DO NOT EDIT BY HAND!!!
+
+// Copyright 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.
+//
+// Authors: vladl@google.com (Vlad Losev)
+//
+// Macros and functions for implementing parameterized tests
+// in Google C++ Testing Framework (Google Test)
+//
+// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
+//
+#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
+#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
+
+
+// Value-parameterized tests allow you to test your code with different
+// parameters without writing multiple copies of the same test.
+//
+// Here is how you use value-parameterized tests:
+
+#if 0
+
+// To write value-parameterized tests, first you should define a fixture
+// class. It must be derived from testing::TestWithParam<T>, where T is
+// the type of your parameter values. TestWithParam<T> is itself derived
+// from testing::Test. T can be any copyable type. If it's a raw pointer,
+// you are responsible for managing the lifespan of the pointed values.
+
+class FooTest : public ::testing::TestWithParam<const char*> {
+ // You can implement all the usual class fixture members here.
+};
+
+// Then, use the TEST_P macro to define as many parameterized tests
+// for this fixture as you want. The _P suffix is for "parameterized"
+// or "pattern", whichever you prefer to think.
+
+TEST_P(FooTest, DoesBlah) {
+ // Inside a test, access the test parameter with the GetParam() method
+ // of the TestWithParam<T> class:
+ EXPECT_TRUE(foo.Blah(GetParam()));
+ ...
+}
+
+TEST_P(FooTest, HasBlahBlah) {
+ ...
+}
+
+// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
+// case with any set of parameters you want. Google Test defines a number
+// of functions for generating test parameters. They return what we call
+// (surprise!) parameter generators. Here is a summary of them, which
+// are all in the testing namespace:
+//
+//
+// Range(begin, end [, step]) - Yields values {begin, begin+step,
+// begin+step+step, ...}. The values do not
+// include end. step defaults to 1.
+// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
+// ValuesIn(container) - Yields values from a C-style array, an STL
+// ValuesIn(begin,end) container, or an iterator range [begin, end).
+// Bool() - Yields sequence {false, true}.
+// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
+// for the math savvy) of the values generated
+// by the N generators.
+//
+// For more details, see comments at the definitions of these functions below
+// in this file.
+//
+// The following statement will instantiate tests from the FooTest test case
+// each with parameter values "meeny", "miny", and "moe".
+
+INSTANTIATE_TEST_CASE_P(InstantiationName,
+ FooTest,
+ Values("meeny", "miny", "moe"));
+
+// To distinguish different instances of the pattern, (yes, you
+// can instantiate it more then once) the first argument to the
+// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
+// actual test case name. Remember to pick unique prefixes for different
+// instantiations. The tests from the instantiation above will have
+// these names:
+//
+// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
+// * InstantiationName/FooTest.DoesBlah/1 for "miny"
+// * InstantiationName/FooTest.DoesBlah/2 for "moe"
+// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
+// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
+// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
+//
+// You can use these names in --gtest_filter.
+//
+// This statement will instantiate all tests from FooTest again, each
+// with parameter values "cat" and "dog":
+
+const char* pets[] = {"cat", "dog"};
+INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
+
+// The tests from the instantiation above will have these names:
+//
+// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
+// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
+// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
+// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
+//
+// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
+// in the given test case, whether their definitions come before or
+// AFTER the INSTANTIATE_TEST_CASE_P statement.
+//
+// Please also note that generator expressions (including parameters to the
+// generators) are evaluated in InitGoogleTest(), after main() has started.
+// This allows the user on one hand, to adjust generator parameters in order
+// to dynamically determine a set of tests to run and on the other hand,
+// give the user a chance to inspect the generated tests with Google Test
+// reflection API before RUN_ALL_TESTS() is executed.
+//
+// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
+// for more examples.
+//
+// In the future, we plan to publish the API for defining new parameter
+// generators. But for now this interface remains part of the internal
+// implementation and is subject to change.
+
+#endif // 0
+
+#include <gtest/internal/gtest-port.h>
+
+#if !GTEST_OS_SYMBIAN
+#include <utility>
+#endif
+
+// scripts/fuse_gtest.py depends on gtest's own header being #included
+// *unconditionally*. Therefore these #includes cannot be moved
+// inside #if GTEST_HAS_PARAM_TEST.
+#include <gtest/internal/gtest-internal.h>
+#include <gtest/internal/gtest-param-util.h>
+#include <gtest/internal/gtest-param-util-generated.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+namespace testing {
+
+// Functions producing parameter generators.
+//
+// Google Test uses these generators to produce parameters for value-
+// parameterized tests. When a parameterized test case is instantiated
+// with a particular generator, Google Test creates and runs tests
+// for each element in the sequence produced by the generator.
+//
+// In the following sample, tests from test case FooTest are instantiated
+// each three times with parameter values 3, 5, and 8:
+//
+// class FooTest : public TestWithParam<int> { ... };
+//
+// TEST_P(FooTest, TestThis) {
+// }
+// TEST_P(FooTest, TestThat) {
+// }
+// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
+//
+
+// Range() returns generators providing sequences of values in a range.
+//
+// Synopsis:
+// Range(start, end)
+// - returns a generator producing a sequence of values {start, start+1,
+// start+2, ..., }.
+// Range(start, end, step)
+// - returns a generator producing a sequence of values {start, start+step,
+// start+step+step, ..., }.
+// Notes:
+// * The generated sequences never include end. For example, Range(1, 5)
+// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
+// returns a generator producing {1, 3, 5, 7}.
+// * start and end must have the same type. That type may be any integral or
+// floating-point type or a user defined type satisfying these conditions:
+// * It must be assignable (have operator=() defined).
+// * It must have operator+() (operator+(int-compatible type) for
+// two-operand version).
+// * It must have operator<() defined.
+// Elements in the resulting sequences will also have that type.
+// * Condition start < end must be satisfied in order for resulting sequences
+// to contain any elements.
+//
+template <typename T, typename IncrementT>
+internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
+ return internal::ParamGenerator<T>(
+ new internal::RangeGenerator<T, IncrementT>(start, end, step));
+}
+
+template <typename T>
+internal::ParamGenerator<T> Range(T start, T end) {
+ return Range(start, end, 1);
+}
+
+// ValuesIn() function allows generation of tests with parameters coming from
+// a container.
+//
+// Synopsis:
+// ValuesIn(const T (&array)[N])
+// - returns a generator producing sequences with elements from
+// a C-style array.
+// ValuesIn(const Container& container)
+// - returns a generator producing sequences with elements from
+// an STL-style container.
+// ValuesIn(Iterator begin, Iterator end)
+// - returns a generator producing sequences with elements from
+// a range [begin, end) defined by a pair of STL-style iterators. These
+// iterators can also be plain C pointers.
+//
+// Please note that ValuesIn copies the values from the containers
+// passed in and keeps them to generate tests in RUN_ALL_TESTS().
+//
+// Examples:
+//
+// This instantiates tests from test case StringTest
+// each with C-string values of "foo", "bar", and "baz":
+//
+// const char* strings[] = {"foo", "bar", "baz"};
+// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
+//
+// This instantiates tests from test case StlStringTest
+// each with STL strings with values "a" and "b":
+//
+// ::std::vector< ::std::string> GetParameterStrings() {
+// ::std::vector< ::std::string> v;
+// v.push_back("a");
+// v.push_back("b");
+// return v;
+// }
+//
+// INSTANTIATE_TEST_CASE_P(CharSequence,
+// StlStringTest,
+// ValuesIn(GetParameterStrings()));
+//
+//
+// This will also instantiate tests from CharTest
+// each with parameter values 'a' and 'b':
+//
+// ::std::list<char> GetParameterChars() {
+// ::std::list<char> list;
+// list.push_back('a');
+// list.push_back('b');
+// return list;
+// }
+// ::std::list<char> l = GetParameterChars();
+// INSTANTIATE_TEST_CASE_P(CharSequence2,
+// CharTest,
+// ValuesIn(l.begin(), l.end()));
+//
+template <typename ForwardIterator>
+internal::ParamGenerator<
+ typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn(
+ ForwardIterator begin,
+ ForwardIterator end) {
+ typedef typename ::std::iterator_traits<ForwardIterator>::value_type
+ ParamType;
+ return internal::ParamGenerator<ParamType>(
+ new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
+}
+
+template <typename T, size_t N>
+internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
+ return ValuesIn(array, array + N);
+}
+
+template <class Container>
+internal::ParamGenerator<typename Container::value_type> ValuesIn(
+ const Container& container) {
+ return ValuesIn(container.begin(), container.end());
+}
+
+// Values() allows generating tests from explicitly specified list of
+// parameters.
+//
+// Synopsis:
+// Values(T v1, T v2, ..., T vN)
+// - returns a generator producing sequences with elements v1, v2, ..., vN.
+//
+// For example, this instantiates tests from test case BarTest each
+// with values "one", "two", and "three":
+//
+// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
+//
+// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
+// The exact type of values will depend on the type of parameter in BazTest.
+//
+// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
+//
+// Currently, Values() supports from 1 to 50 parameters.
+//
+template <typename T1>
+internal::ValueArray1<T1> Values(T1 v1) {
+ return internal::ValueArray1<T1>(v1);
+}
+
+template <typename T1, typename T2>
+internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
+ return internal::ValueArray2<T1, T2>(v1, v2);
+}
+
+template <typename T1, typename T2, typename T3>
+internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
+ return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
+}
+
+template <typename T1, typename T2, typename T3, typename T4>
+internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
+ return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
+ T5 v5) {
+ return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6>
+internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
+ T4 v4, T5 v5, T6 v6) {
+ return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7>
+internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
+ T4 v4, T5 v5, T6 v6, T7 v7) {
+ return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
+ v6, v7);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8>
+internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
+ T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
+ return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
+ v5, v6, v7, v8);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9>
+internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
+ T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
+ return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
+ v4, v5, v6, v7, v8, v9);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
+ T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
+ return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
+ v2, v3, v4, v5, v6, v7, v8, v9, v10);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11>
+internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
+ T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11) {
+ return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
+ T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12>
+internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12) {
+ return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13>
+internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13) {
+ return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14>
+internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
+ return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
+ v14);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15>
+internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
+ T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
+ return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
+ v13, v14, v15);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16>
+internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
+ T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16) {
+ return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
+ v12, v13, v14, v15, v16);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17>
+internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
+ T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17) {
+ return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
+ v11, v12, v13, v14, v15, v16, v17);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18>
+internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
+ T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17, T18 v18) {
+ return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
+ v10, v11, v12, v13, v14, v15, v16, v17, v18);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19>
+internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
+ T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
+ T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
+ return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
+ v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20>
+internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
+ T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
+ T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
+ return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
+ v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21>
+internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
+ T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
+ T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
+ return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
+ v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22>
+internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
+ T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
+ T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
+ T21 v21, T22 v22) {
+ return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
+ v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
+ v20, v21, v22);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23>
+internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
+ T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
+ T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
+ T21 v21, T22 v22, T23 v23) {
+ return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
+ v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
+ v20, v21, v22, v23);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24>
+internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
+ T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
+ T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
+ T21 v21, T22 v22, T23 v23, T24 v24) {
+ return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
+ v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
+ v19, v20, v21, v22, v23, v24);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25>
+internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
+ T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
+ T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
+ T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
+ return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
+ v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
+ v18, v19, v20, v21, v22, v23, v24, v25);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26>
+internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26) {
+ return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
+ v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27>
+internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27) {
+ return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
+ v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28>
+internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28) {
+ return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
+ v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
+ v28);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29>
+internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29) {
+ return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
+ v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
+ v27, v28, v29);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30>
+internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
+ T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
+ T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
+ T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
+ return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
+ v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
+ v26, v27, v28, v29, v30);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31>
+internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
+ T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
+ T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
+ return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
+ v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
+ v25, v26, v27, v28, v29, v30, v31);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32>
+internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
+ T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
+ T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
+ T32 v32) {
+ return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
+ v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
+ v24, v25, v26, v27, v28, v29, v30, v31, v32);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33>
+internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
+ T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
+ T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
+ T32 v32, T33 v33) {
+ return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
+ v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
+ v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34>
+internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
+ T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
+ T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
+ T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
+ T31 v31, T32 v32, T33 v33, T34 v34) {
+ return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
+ v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
+ v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35>
+internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
+ T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
+ T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
+ T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
+ T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
+ return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
+ v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
+ v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36>
+internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
+ T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
+ T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
+ T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
+ T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
+ return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
+ v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
+ v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
+ v34, v35, v36);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37>
+internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
+ T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
+ T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
+ T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
+ T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
+ T37 v37) {
+ return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
+ v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
+ v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
+ v34, v35, v36, v37);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38>
+internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
+ T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
+ T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
+ T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
+ T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
+ T37 v37, T38 v38) {
+ return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
+ v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
+ v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
+ v33, v34, v35, v36, v37, v38);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39>
+internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
+ T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
+ T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
+ T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
+ T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
+ T37 v37, T38 v38, T39 v39) {
+ return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
+ v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
+ v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
+ v32, v33, v34, v35, v36, v37, v38, v39);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40>
+internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
+ T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
+ T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
+ T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
+ T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
+ T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
+ return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
+ v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
+ v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41>
+internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
+ return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
+ v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
+ v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42>
+internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42) {
+ return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
+ v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
+ v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
+ v42);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43>
+internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43) {
+ return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
+ v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
+ v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
+ v41, v42, v43);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44>
+internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44) {
+ return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
+ v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
+ v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
+ v40, v41, v42, v43, v44);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45>
+internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
+ T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
+ T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
+ T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
+ T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
+ T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
+ return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
+ v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
+ v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
+ v39, v40, v41, v42, v43, v44, v45);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46>
+internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
+ T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
+ T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
+ T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
+ T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
+ return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
+ v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
+ v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
+ v38, v39, v40, v41, v42, v43, v44, v45, v46);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47>
+internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
+ T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
+ T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
+ T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
+ T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
+ return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
+ v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
+ v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
+ v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48>
+internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
+ T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
+ T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
+ T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
+ T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
+ T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
+ T48 v48) {
+ return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
+ v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
+ v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
+ v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49>
+internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
+ T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
+ T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
+ T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
+ T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
+ T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
+ T47 v47, T48 v48, T49 v49) {
+ return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
+ v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
+ v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
+ v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49, typename T50>
+internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
+ T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
+ T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
+ T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
+ T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
+ T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
+ T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
+ return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
+ v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
+ v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
+ v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
+ v48, v49, v50);
+}
+
+// Bool() allows generating tests with parameters in a set of (false, true).
+//
+// Synopsis:
+// Bool()
+// - returns a generator producing sequences with elements {false, true}.
+//
+// It is useful when testing code that depends on Boolean flags. Combinations
+// of multiple flags can be tested when several Bool()'s are combined using
+// Combine() function.
+//
+// In the following example all tests in the test case FlagDependentTest
+// will be instantiated twice with parameters false and true.
+//
+// class FlagDependentTest : public testing::TestWithParam<bool> {
+// virtual void SetUp() {
+// external_flag = GetParam();
+// }
+// }
+// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
+//
+inline internal::ParamGenerator<bool> Bool() {
+ return Values(false, true);
+}
+
+#if GTEST_HAS_COMBINE
+// Combine() allows the user to combine two or more sequences to produce
+// values of a Cartesian product of those sequences' elements.
+//
+// Synopsis:
+// Combine(gen1, gen2, ..., genN)
+// - returns a generator producing sequences with elements coming from
+// the Cartesian product of elements from the sequences generated by
+// gen1, gen2, ..., genN. The sequence elements will have a type of
+// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
+// of elements from sequences produces by gen1, gen2, ..., genN.
+//
+// Combine can have up to 10 arguments. This number is currently limited
+// by the maximum number of elements in the tuple implementation used by Google
+// Test.
+//
+// Example:
+//
+// This will instantiate tests in test case AnimalTest each one with
+// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
+// tuple("dog", BLACK), and tuple("dog", WHITE):
+//
+// enum Color { BLACK, GRAY, WHITE };
+// class AnimalTest
+// : public testing::TestWithParam<tuple<const char*, Color> > {...};
+//
+// TEST_P(AnimalTest, AnimalLooksNice) {...}
+//
+// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
+// Combine(Values("cat", "dog"),
+// Values(BLACK, WHITE)));
+//
+// This will instantiate tests in FlagDependentTest with all variations of two
+// Boolean flags:
+//
+// class FlagDependentTest
+// : public testing::TestWithParam<tuple(bool, bool)> > {
+// virtual void SetUp() {
+// // Assigns external_flag_1 and external_flag_2 values from the tuple.
+// tie(external_flag_1, external_flag_2) = GetParam();
+// }
+// };
+//
+// TEST_P(FlagDependentTest, TestFeature1) {
+// // Test your code using external_flag_1 and external_flag_2 here.
+// }
+// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
+// Combine(Bool(), Bool()));
+//
+template <typename Generator1, typename Generator2>
+internal::CartesianProductHolder2<Generator1, Generator2> Combine(
+ const Generator1& g1, const Generator2& g2) {
+ return internal::CartesianProductHolder2<Generator1, Generator2>(
+ g1, g2);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3>
+internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3) {
+ return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
+ g1, g2, g3);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3,
+ typename Generator4>
+internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
+ Generator4> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3,
+ const Generator4& g4) {
+ return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
+ Generator4>(
+ g1, g2, g3, g4);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3,
+ typename Generator4, typename Generator5>
+internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
+ Generator4, Generator5> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3,
+ const Generator4& g4, const Generator5& g5) {
+ return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
+ Generator4, Generator5>(
+ g1, g2, g3, g4, g5);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3,
+ typename Generator4, typename Generator5, typename Generator6>
+internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3,
+ const Generator4& g4, const Generator5& g5, const Generator6& g6) {
+ return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6>(
+ g1, g2, g3, g4, g5, g6);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3,
+ typename Generator4, typename Generator5, typename Generator6,
+ typename Generator7>
+internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3,
+ const Generator4& g4, const Generator5& g5, const Generator6& g6,
+ const Generator7& g7) {
+ return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7>(
+ g1, g2, g3, g4, g5, g6, g7);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3,
+ typename Generator4, typename Generator5, typename Generator6,
+ typename Generator7, typename Generator8>
+internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3,
+ const Generator4& g4, const Generator5& g5, const Generator6& g6,
+ const Generator7& g7, const Generator8& g8) {
+ return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7, Generator8>(
+ g1, g2, g3, g4, g5, g6, g7, g8);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3,
+ typename Generator4, typename Generator5, typename Generator6,
+ typename Generator7, typename Generator8, typename Generator9>
+internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7, Generator8,
+ Generator9> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3,
+ const Generator4& g4, const Generator5& g5, const Generator6& g6,
+ const Generator7& g7, const Generator8& g8, const Generator9& g9) {
+ return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
+ g1, g2, g3, g4, g5, g6, g7, g8, g9);
+}
+
+template <typename Generator1, typename Generator2, typename Generator3,
+ typename Generator4, typename Generator5, typename Generator6,
+ typename Generator7, typename Generator8, typename Generator9,
+ typename Generator10>
+internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
+ Generator10> Combine(
+ const Generator1& g1, const Generator2& g2, const Generator3& g3,
+ const Generator4& g4, const Generator5& g5, const Generator6& g6,
+ const Generator7& g7, const Generator8& g8, const Generator9& g9,
+ const Generator10& g10) {
+ return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
+ Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
+ Generator10>(
+ g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
+}
+#endif // GTEST_HAS_COMBINE
+
+
+
+#define TEST_P(test_case_name, test_name) \
+ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
+ : public test_case_name { \
+ public: \
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
+ virtual void TestBody(); \
+ private: \
+ static int AddToRegistry() { \
+ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
+ GetTestCasePatternHolder<test_case_name>(\
+ #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
+ #test_case_name, \
+ #test_name, \
+ new ::testing::internal::TestMetaFactory< \
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
+ return 0; \
+ } \
+ static int gtest_registering_dummy_; \
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(\
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
+ }; \
+ int GTEST_TEST_CLASS_NAME_(test_case_name, \
+ test_name)::gtest_registering_dummy_ = \
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
+ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
+
+#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
+ ::testing::internal::ParamGenerator<test_case_name::ParamType> \
+ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
+ int gtest_##prefix##test_case_name##_dummy_ = \
+ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
+ GetTestCasePatternHolder<test_case_name>(\
+ #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
+ #prefix, \
+ &gtest_##prefix##test_case_name##_EvalGenerator_, \
+ __FILE__, __LINE__)
+
+} // namespace testing
+
+#endif // GTEST_HAS_PARAM_TEST
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h.pump b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h.pump
new file mode 100644
index 0000000..a231188
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-param-test.h.pump
@@ -0,0 +1,457 @@
+$$ -*- mode: c++; -*-
+$var n = 50 $$ Maximum length of Values arguments we want to support.
+$var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
+// Copyright 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.
+//
+// Authors: vladl@google.com (Vlad Losev)
+//
+// Macros and functions for implementing parameterized tests
+// in Google C++ Testing Framework (Google Test)
+//
+// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
+//
+#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
+#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
+
+
+// Value-parameterized tests allow you to test your code with different
+// parameters without writing multiple copies of the same test.
+//
+// Here is how you use value-parameterized tests:
+
+#if 0
+
+// To write value-parameterized tests, first you should define a fixture
+// class. It must be derived from testing::TestWithParam<T>, where T is
+// the type of your parameter values. TestWithParam<T> is itself derived
+// from testing::Test. T can be any copyable type. If it's a raw pointer,
+// you are responsible for managing the lifespan of the pointed values.
+
+class FooTest : public ::testing::TestWithParam<const char*> {
+ // You can implement all the usual class fixture members here.
+};
+
+// Then, use the TEST_P macro to define as many parameterized tests
+// for this fixture as you want. The _P suffix is for "parameterized"
+// or "pattern", whichever you prefer to think.
+
+TEST_P(FooTest, DoesBlah) {
+ // Inside a test, access the test parameter with the GetParam() method
+ // of the TestWithParam<T> class:
+ EXPECT_TRUE(foo.Blah(GetParam()));
+ ...
+}
+
+TEST_P(FooTest, HasBlahBlah) {
+ ...
+}
+
+// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
+// case with any set of parameters you want. Google Test defines a number
+// of functions for generating test parameters. They return what we call
+// (surprise!) parameter generators. Here is a summary of them, which
+// are all in the testing namespace:
+//
+//
+// Range(begin, end [, step]) - Yields values {begin, begin+step,
+// begin+step+step, ...}. The values do not
+// include end. step defaults to 1.
+// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
+// ValuesIn(container) - Yields values from a C-style array, an STL
+// ValuesIn(begin,end) container, or an iterator range [begin, end).
+// Bool() - Yields sequence {false, true}.
+// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
+// for the math savvy) of the values generated
+// by the N generators.
+//
+// For more details, see comments at the definitions of these functions below
+// in this file.
+//
+// The following statement will instantiate tests from the FooTest test case
+// each with parameter values "meeny", "miny", and "moe".
+
+INSTANTIATE_TEST_CASE_P(InstantiationName,
+ FooTest,
+ Values("meeny", "miny", "moe"));
+
+// To distinguish different instances of the pattern, (yes, you
+// can instantiate it more then once) the first argument to the
+// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
+// actual test case name. Remember to pick unique prefixes for different
+// instantiations. The tests from the instantiation above will have
+// these names:
+//
+// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
+// * InstantiationName/FooTest.DoesBlah/1 for "miny"
+// * InstantiationName/FooTest.DoesBlah/2 for "moe"
+// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
+// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
+// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
+//
+// You can use these names in --gtest_filter.
+//
+// This statement will instantiate all tests from FooTest again, each
+// with parameter values "cat" and "dog":
+
+const char* pets[] = {"cat", "dog"};
+INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
+
+// The tests from the instantiation above will have these names:
+//
+// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
+// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
+// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
+// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
+//
+// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
+// in the given test case, whether their definitions come before or
+// AFTER the INSTANTIATE_TEST_CASE_P statement.
+//
+// Please also note that generator expressions are evaluated in
+// RUN_ALL_TESTS(), after main() has started. This allows evaluation of
+// parameter list based on command line parameters.
+//
+// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
+// for more examples.
+//
+// In the future, we plan to publish the API for defining new parameter
+// generators. But for now this interface remains part of the internal
+// implementation and is subject to change.
+
+#endif // 0
+
+#include <gtest/internal/gtest-port.h>
+
+#if !GTEST_OS_SYMBIAN
+#include <utility>
+#endif
+
+// scripts/fuse_gtest.py depends on gtest's own header being #included
+// *unconditionally*. Therefore these #includes cannot be moved
+// inside #if GTEST_HAS_PARAM_TEST.
+#include <gtest/internal/gtest-internal.h>
+#include <gtest/internal/gtest-param-util.h>
+#include <gtest/internal/gtest-param-util-generated.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+namespace testing {
+
+// Functions producing parameter generators.
+//
+// Google Test uses these generators to produce parameters for value-
+// parameterized tests. When a parameterized test case is instantiated
+// with a particular generator, Google Test creates and runs tests
+// for each element in the sequence produced by the generator.
+//
+// In the following sample, tests from test case FooTest are instantiated
+// each three times with parameter values 3, 5, and 8:
+//
+// class FooTest : public TestWithParam<int> { ... };
+//
+// TEST_P(FooTest, TestThis) {
+// }
+// TEST_P(FooTest, TestThat) {
+// }
+// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
+//
+
+// Range() returns generators providing sequences of values in a range.
+//
+// Synopsis:
+// Range(start, end)
+// - returns a generator producing a sequence of values {start, start+1,
+// start+2, ..., }.
+// Range(start, end, step)
+// - returns a generator producing a sequence of values {start, start+step,
+// start+step+step, ..., }.
+// Notes:
+// * The generated sequences never include end. For example, Range(1, 5)
+// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
+// returns a generator producing {1, 3, 5, 7}.
+// * start and end must have the same type. That type may be any integral or
+// floating-point type or a user defined type satisfying these conditions:
+// * It must be assignable (have operator=() defined).
+// * It must have operator+() (operator+(int-compatible type) for
+// two-operand version).
+// * It must have operator<() defined.
+// Elements in the resulting sequences will also have that type.
+// * Condition start < end must be satisfied in order for resulting sequences
+// to contain any elements.
+//
+template <typename T, typename IncrementT>
+internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
+ return internal::ParamGenerator<T>(
+ new internal::RangeGenerator<T, IncrementT>(start, end, step));
+}
+
+template <typename T>
+internal::ParamGenerator<T> Range(T start, T end) {
+ return Range(start, end, 1);
+}
+
+// ValuesIn() function allows generation of tests with parameters coming from
+// a container.
+//
+// Synopsis:
+// ValuesIn(const T (&array)[N])
+// - returns a generator producing sequences with elements from
+// a C-style array.
+// ValuesIn(const Container& container)
+// - returns a generator producing sequences with elements from
+// an STL-style container.
+// ValuesIn(Iterator begin, Iterator end)
+// - returns a generator producing sequences with elements from
+// a range [begin, end) defined by a pair of STL-style iterators. These
+// iterators can also be plain C pointers.
+//
+// Please note that ValuesIn copies the values from the containers
+// passed in and keeps them to generate tests in RUN_ALL_TESTS().
+//
+// Examples:
+//
+// This instantiates tests from test case StringTest
+// each with C-string values of "foo", "bar", and "baz":
+//
+// const char* strings[] = {"foo", "bar", "baz"};
+// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
+//
+// This instantiates tests from test case StlStringTest
+// each with STL strings with values "a" and "b":
+//
+// ::std::vector< ::std::string> GetParameterStrings() {
+// ::std::vector< ::std::string> v;
+// v.push_back("a");
+// v.push_back("b");
+// return v;
+// }
+//
+// INSTANTIATE_TEST_CASE_P(CharSequence,
+// StlStringTest,
+// ValuesIn(GetParameterStrings()));
+//
+//
+// This will also instantiate tests from CharTest
+// each with parameter values 'a' and 'b':
+//
+// ::std::list<char> GetParameterChars() {
+// ::std::list<char> list;
+// list.push_back('a');
+// list.push_back('b');
+// return list;
+// }
+// ::std::list<char> l = GetParameterChars();
+// INSTANTIATE_TEST_CASE_P(CharSequence2,
+// CharTest,
+// ValuesIn(l.begin(), l.end()));
+//
+template <typename ForwardIterator>
+internal::ParamGenerator<
+ typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn(
+ ForwardIterator begin,
+ ForwardIterator end) {
+ typedef typename ::std::iterator_traits<ForwardIterator>::value_type
+ ParamType;
+ return internal::ParamGenerator<ParamType>(
+ new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
+}
+
+template <typename T, size_t N>
+internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
+ return ValuesIn(array, array + N);
+}
+
+template <class Container>
+internal::ParamGenerator<typename Container::value_type> ValuesIn(
+ const Container& container) {
+ return ValuesIn(container.begin(), container.end());
+}
+
+// Values() allows generating tests from explicitly specified list of
+// parameters.
+//
+// Synopsis:
+// Values(T v1, T v2, ..., T vN)
+// - returns a generator producing sequences with elements v1, v2, ..., vN.
+//
+// For example, this instantiates tests from test case BarTest each
+// with values "one", "two", and "three":
+//
+// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
+//
+// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
+// The exact type of values will depend on the type of parameter in BazTest.
+//
+// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
+//
+// Currently, Values() supports from 1 to $n parameters.
+//
+$range i 1..n
+$for i [[
+$range j 1..i
+
+template <$for j, [[typename T$j]]>
+internal::ValueArray$i<$for j, [[T$j]]> Values($for j, [[T$j v$j]]) {
+ return internal::ValueArray$i<$for j, [[T$j]]>($for j, [[v$j]]);
+}
+
+]]
+
+// Bool() allows generating tests with parameters in a set of (false, true).
+//
+// Synopsis:
+// Bool()
+// - returns a generator producing sequences with elements {false, true}.
+//
+// It is useful when testing code that depends on Boolean flags. Combinations
+// of multiple flags can be tested when several Bool()'s are combined using
+// Combine() function.
+//
+// In the following example all tests in the test case FlagDependentTest
+// will be instantiated twice with parameters false and true.
+//
+// class FlagDependentTest : public testing::TestWithParam<bool> {
+// virtual void SetUp() {
+// external_flag = GetParam();
+// }
+// }
+// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
+//
+inline internal::ParamGenerator<bool> Bool() {
+ return Values(false, true);
+}
+
+#if GTEST_HAS_COMBINE
+// Combine() allows the user to combine two or more sequences to produce
+// values of a Cartesian product of those sequences' elements.
+//
+// Synopsis:
+// Combine(gen1, gen2, ..., genN)
+// - returns a generator producing sequences with elements coming from
+// the Cartesian product of elements from the sequences generated by
+// gen1, gen2, ..., genN. The sequence elements will have a type of
+// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
+// of elements from sequences produces by gen1, gen2, ..., genN.
+//
+// Combine can have up to $maxtuple arguments. This number is currently limited
+// by the maximum number of elements in the tuple implementation used by Google
+// Test.
+//
+// Example:
+//
+// This will instantiate tests in test case AnimalTest each one with
+// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
+// tuple("dog", BLACK), and tuple("dog", WHITE):
+//
+// enum Color { BLACK, GRAY, WHITE };
+// class AnimalTest
+// : public testing::TestWithParam<tuple<const char*, Color> > {...};
+//
+// TEST_P(AnimalTest, AnimalLooksNice) {...}
+//
+// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
+// Combine(Values("cat", "dog"),
+// Values(BLACK, WHITE)));
+//
+// This will instantiate tests in FlagDependentTest with all variations of two
+// Boolean flags:
+//
+// class FlagDependentTest
+// : public testing::TestWithParam<tuple(bool, bool)> > {
+// virtual void SetUp() {
+// // Assigns external_flag_1 and external_flag_2 values from the tuple.
+// tie(external_flag_1, external_flag_2) = GetParam();
+// }
+// };
+//
+// TEST_P(FlagDependentTest, TestFeature1) {
+// // Test your code using external_flag_1 and external_flag_2 here.
+// }
+// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
+// Combine(Bool(), Bool()));
+//
+$range i 2..maxtuple
+$for i [[
+$range j 1..i
+
+template <$for j, [[typename Generator$j]]>
+internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
+ $for j, [[const Generator$j& g$j]]) {
+ return internal::CartesianProductHolder$i<$for j, [[Generator$j]]>(
+ $for j, [[g$j]]);
+}
+
+]]
+#endif // GTEST_HAS_COMBINE
+
+
+
+#define TEST_P(test_case_name, test_name) \
+ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
+ : public test_case_name { \
+ public: \
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
+ virtual void TestBody(); \
+ private: \
+ static int AddToRegistry() { \
+ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
+ GetTestCasePatternHolder<test_case_name>(\
+ #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
+ #test_case_name, \
+ #test_name, \
+ new ::testing::internal::TestMetaFactory< \
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
+ return 0; \
+ } \
+ static int gtest_registering_dummy_; \
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(\
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
+ }; \
+ int GTEST_TEST_CLASS_NAME_(test_case_name, \
+ test_name)::gtest_registering_dummy_ = \
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
+ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
+
+#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
+ ::testing::internal::ParamGenerator<test_case_name::ParamType> \
+ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
+ int gtest_##prefix##test_case_name##_dummy_ = \
+ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
+ GetTestCasePatternHolder<test_case_name>(\
+ #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
+ #prefix, \
+ &gtest_##prefix##test_case_name##_EvalGenerator_, \
+ __FILE__, __LINE__)
+
+} // namespace testing
+
+#endif // GTEST_HAS_PARAM_TEST
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-spi.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-spi.h
new file mode 100644
index 0000000..c41da48
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-spi.h
@@ -0,0 +1,232 @@
+// 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// Utilities for testing Google Test itself and code that uses Google Test
+// (e.g. frameworks built on top of Google Test).
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
+#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
+
+#include <gtest/gtest.h>
+
+namespace testing {
+
+// This helper class can be used to mock out Google Test failure reporting
+// so that we can test Google Test or code that builds on Google Test.
+//
+// An object of this class appends a TestPartResult object to the
+// TestPartResultArray object given in the constructor whenever a Google Test
+// failure is reported. It can either intercept only failures that are
+// generated in the same thread that created this object or it can intercept
+// all generated failures. The scope of this mock object can be controlled with
+// the second argument to the two arguments constructor.
+class GTEST_API_ ScopedFakeTestPartResultReporter
+ : public TestPartResultReporterInterface {
+ public:
+ // The two possible mocking modes of this object.
+ enum InterceptMode {
+ INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
+ INTERCEPT_ALL_THREADS // Intercepts all failures.
+ };
+
+ // The c'tor sets this object as the test part result reporter used
+ // by Google Test. The 'result' parameter specifies where to report the
+ // results. This reporter will only catch failures generated in the current
+ // thread. DEPRECATED
+ explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
+
+ // Same as above, but you can choose the interception scope of this object.
+ ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
+ TestPartResultArray* result);
+
+ // The d'tor restores the previous test part result reporter.
+ virtual ~ScopedFakeTestPartResultReporter();
+
+ // Appends the TestPartResult object to the TestPartResultArray
+ // received in the constructor.
+ //
+ // This method is from the TestPartResultReporterInterface
+ // interface.
+ virtual void ReportTestPartResult(const TestPartResult& result);
+ private:
+ void Init();
+
+ const InterceptMode intercept_mode_;
+ TestPartResultReporterInterface* old_reporter_;
+ TestPartResultArray* const result_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
+};
+
+namespace internal {
+
+// A helper class for implementing EXPECT_FATAL_FAILURE() and
+// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
+// TestPartResultArray contains exactly one failure that has the given
+// type and contains the given substring. If that's not the case, a
+// non-fatal failure will be generated.
+class GTEST_API_ SingleFailureChecker {
+ public:
+ // The constructor remembers the arguments.
+ SingleFailureChecker(const TestPartResultArray* results,
+ TestPartResult::Type type,
+ const char* substr);
+ ~SingleFailureChecker();
+ private:
+ const TestPartResultArray* const results_;
+ const TestPartResult::Type type_;
+ const String substr_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
+};
+
+} // namespace internal
+
+} // namespace testing
+
+// A set of macros for testing Google Test assertions or code that's expected
+// to generate Google Test fatal failures. It verifies that the given
+// statement will cause exactly one fatal Google Test failure with 'substr'
+// being part of the failure message.
+//
+// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
+// affects and considers failures generated in the current thread and
+// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
+//
+// The verification of the assertion is done correctly even when the statement
+// throws an exception or aborts the current function.
+//
+// Known restrictions:
+// - 'statement' cannot reference local non-static variables or
+// non-static members of the current object.
+// - 'statement' cannot return a value.
+// - You cannot stream a failure message to this macro.
+//
+// Note that even though the implementations of the following two
+// macros are much alike, we cannot refactor them to use a common
+// helper macro, due to some peculiarity in how the preprocessor
+// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
+// gtest_unittest.cc will fail to compile if we do that.
+#define EXPECT_FATAL_FAILURE(statement, substr) \
+ do { \
+ class GTestExpectFatalFailureHelper {\
+ public:\
+ static void Execute() { statement; }\
+ };\
+ ::testing::TestPartResultArray gtest_failures;\
+ ::testing::internal::SingleFailureChecker gtest_checker(\
+ &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
+ {\
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+ ::testing::ScopedFakeTestPartResultReporter:: \
+ INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
+ GTestExpectFatalFailureHelper::Execute();\
+ }\
+ } while (::testing::internal::AlwaysFalse())
+
+#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
+ do { \
+ class GTestExpectFatalFailureHelper {\
+ public:\
+ static void Execute() { statement; }\
+ };\
+ ::testing::TestPartResultArray gtest_failures;\
+ ::testing::internal::SingleFailureChecker gtest_checker(\
+ &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
+ {\
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+ ::testing::ScopedFakeTestPartResultReporter:: \
+ INTERCEPT_ALL_THREADS, &gtest_failures);\
+ GTestExpectFatalFailureHelper::Execute();\
+ }\
+ } while (::testing::internal::AlwaysFalse())
+
+// A macro for testing Google Test assertions or code that's expected to
+// generate Google Test non-fatal failures. It asserts that the given
+// statement will cause exactly one non-fatal Google Test failure with 'substr'
+// being part of the failure message.
+//
+// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
+// affects and considers failures generated in the current thread and
+// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
+//
+// 'statement' is allowed to reference local variables and members of
+// the current object.
+//
+// The verification of the assertion is done correctly even when the statement
+// throws an exception or aborts the current function.
+//
+// Known restrictions:
+// - You cannot stream a failure message to this macro.
+//
+// Note that even though the implementations of the following two
+// macros are much alike, we cannot refactor them to use a common
+// helper macro, due to some peculiarity in how the preprocessor
+// works. If we do that, the code won't compile when the user gives
+// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
+// expands to code containing an unprotected comma. The
+// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
+// catches that.
+//
+// For the same reason, we have to write
+// if (::testing::internal::AlwaysTrue()) { statement; }
+// instead of
+// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
+// to avoid an MSVC warning on unreachable code.
+#define EXPECT_NONFATAL_FAILURE(statement, substr) \
+ do {\
+ ::testing::TestPartResultArray gtest_failures;\
+ ::testing::internal::SingleFailureChecker gtest_checker(\
+ &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
+ (substr));\
+ {\
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+ ::testing::ScopedFakeTestPartResultReporter:: \
+ INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
+ if (::testing::internal::AlwaysTrue()) { statement; }\
+ }\
+ } while (::testing::internal::AlwaysFalse())
+
+#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
+ do {\
+ ::testing::TestPartResultArray gtest_failures;\
+ ::testing::internal::SingleFailureChecker gtest_checker(\
+ &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
+ (substr));\
+ {\
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+ ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
+ &gtest_failures);\
+ if (::testing::internal::AlwaysTrue()) { statement; }\
+ }\
+ } while (::testing::internal::AlwaysFalse())
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-test-part.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-test-part.h
new file mode 100644
index 0000000..f714759
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-test-part.h
@@ -0,0 +1,176 @@
+// Copyright 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.
+//
+// Author: mheule@google.com (Markus Heule)
+//
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
+#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
+
+#include <iosfwd>
+#include <vector>
+#include <gtest/internal/gtest-internal.h>
+#include <gtest/internal/gtest-string.h>
+
+namespace testing {
+
+// A copyable object representing the result of a test part (i.e. an
+// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
+//
+// Don't inherit from TestPartResult as its destructor is not virtual.
+class GTEST_API_ TestPartResult {
+ public:
+ // The possible outcomes of a test part (i.e. an assertion or an
+ // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
+ enum Type {
+ kSuccess, // Succeeded.
+ kNonFatalFailure, // Failed but the test can continue.
+ kFatalFailure // Failed and the test should be terminated.
+ };
+
+ // C'tor. TestPartResult does NOT have a default constructor.
+ // Always use this constructor (with parameters) to create a
+ // TestPartResult object.
+ TestPartResult(Type a_type,
+ const char* a_file_name,
+ int a_line_number,
+ const char* a_message)
+ : type_(a_type),
+ file_name_(a_file_name),
+ line_number_(a_line_number),
+ summary_(ExtractSummary(a_message)),
+ message_(a_message) {
+ }
+
+ // Gets the outcome of the test part.
+ Type type() const { return type_; }
+
+ // Gets the name of the source file where the test part took place, or
+ // NULL if it's unknown.
+ const char* file_name() const { return file_name_.c_str(); }
+
+ // Gets the line in the source file where the test part took place,
+ // or -1 if it's unknown.
+ int line_number() const { return line_number_; }
+
+ // Gets the summary of the failure message.
+ const char* summary() const { return summary_.c_str(); }
+
+ // Gets the message associated with the test part.
+ const char* message() const { return message_.c_str(); }
+
+ // Returns true iff the test part passed.
+ bool passed() const { return type_ == kSuccess; }
+
+ // Returns true iff the test part failed.
+ bool failed() const { return type_ != kSuccess; }
+
+ // Returns true iff the test part non-fatally failed.
+ bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
+
+ // Returns true iff the test part fatally failed.
+ bool fatally_failed() const { return type_ == kFatalFailure; }
+ private:
+ Type type_;
+
+ // Gets the summary of the failure message by omitting the stack
+ // trace in it.
+ static internal::String ExtractSummary(const char* message);
+
+ // The name of the source file where the test part took place, or
+ // NULL if the source file is unknown.
+ internal::String file_name_;
+ // The line in the source file where the test part took place, or -1
+ // if the line number is unknown.
+ int line_number_;
+ internal::String summary_; // The test failure summary.
+ internal::String message_; // The test failure message.
+};
+
+// Prints a TestPartResult object.
+std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
+
+// An array of TestPartResult objects.
+//
+// Don't inherit from TestPartResultArray as its destructor is not
+// virtual.
+class GTEST_API_ TestPartResultArray {
+ public:
+ TestPartResultArray() {}
+
+ // Appends the given TestPartResult to the array.
+ void Append(const TestPartResult& result);
+
+ // Returns the TestPartResult at the given index (0-based).
+ const TestPartResult& GetTestPartResult(int index) const;
+
+ // Returns the number of TestPartResult objects in the array.
+ int size() const;
+
+ private:
+ std::vector<TestPartResult> array_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
+};
+
+// This interface knows how to report a test part result.
+class TestPartResultReporterInterface {
+ public:
+ virtual ~TestPartResultReporterInterface() {}
+
+ virtual void ReportTestPartResult(const TestPartResult& result) = 0;
+};
+
+namespace internal {
+
+// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
+// statement generates new fatal failures. To do so it registers itself as the
+// current test part result reporter. Besides checking if fatal failures were
+// reported, it only delegates the reporting to the former result reporter.
+// The original result reporter is restored in the destructor.
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+class GTEST_API_ HasNewFatalFailureHelper
+ : public TestPartResultReporterInterface {
+ public:
+ HasNewFatalFailureHelper();
+ virtual ~HasNewFatalFailureHelper();
+ virtual void ReportTestPartResult(const TestPartResult& result);
+ bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
+ private:
+ bool has_new_fatal_failure_;
+ TestPartResultReporterInterface* original_reporter_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
+};
+
+} // namespace internal
+
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-typed-test.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-typed-test.h
new file mode 100644
index 0000000..1ec8eb8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest-typed-test.h
@@ -0,0 +1,259 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
+#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
+
+// This header implements typed tests and type-parameterized tests.
+
+// Typed (aka type-driven) tests repeat the same test for types in a
+// list. You must know which types you want to test with when writing
+// typed tests. Here's how you do it:
+
+#if 0
+
+// First, define a fixture class template. It should be parameterized
+// by a type. Remember to derive it from testing::Test.
+template <typename T>
+class FooTest : public testing::Test {
+ public:
+ ...
+ typedef std::list<T> List;
+ static T shared_;
+ T value_;
+};
+
+// Next, associate a list of types with the test case, which will be
+// repeated for each type in the list. The typedef is necessary for
+// the macro to parse correctly.
+typedef testing::Types<char, int, unsigned int> MyTypes;
+TYPED_TEST_CASE(FooTest, MyTypes);
+
+// If the type list contains only one type, you can write that type
+// directly without Types<...>:
+// TYPED_TEST_CASE(FooTest, int);
+
+// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
+// tests for this test case as you want.
+TYPED_TEST(FooTest, DoesBlah) {
+ // Inside a test, refer to TypeParam to get the type parameter.
+ // Since we are inside a derived class template, C++ requires use to
+ // visit the members of FooTest via 'this'.
+ TypeParam n = this->value_;
+
+ // To visit static members of the fixture, add the TestFixture::
+ // prefix.
+ n += TestFixture::shared_;
+
+ // To refer to typedefs in the fixture, add the "typename
+ // TestFixture::" prefix.
+ typename TestFixture::List values;
+ values.push_back(n);
+ ...
+}
+
+TYPED_TEST(FooTest, HasPropertyA) { ... }
+
+#endif // 0
+
+// Type-parameterized tests are abstract test patterns parameterized
+// by a type. Compared with typed tests, type-parameterized tests
+// allow you to define the test pattern without knowing what the type
+// parameters are. The defined pattern can be instantiated with
+// different types any number of times, in any number of translation
+// units.
+//
+// If you are designing an interface or concept, you can define a
+// suite of type-parameterized tests to verify properties that any
+// valid implementation of the interface/concept should have. Then,
+// each implementation can easily instantiate the test suite to verify
+// that it conforms to the requirements, without having to write
+// similar tests repeatedly. Here's an example:
+
+#if 0
+
+// First, define a fixture class template. It should be parameterized
+// by a type. Remember to derive it from testing::Test.
+template <typename T>
+class FooTest : public testing::Test {
+ ...
+};
+
+// Next, declare that you will define a type-parameterized test case
+// (the _P suffix is for "parameterized" or "pattern", whichever you
+// prefer):
+TYPED_TEST_CASE_P(FooTest);
+
+// Then, use TYPED_TEST_P() to define as many type-parameterized tests
+// for this type-parameterized test case as you want.
+TYPED_TEST_P(FooTest, DoesBlah) {
+ // Inside a test, refer to TypeParam to get the type parameter.
+ TypeParam n = 0;
+ ...
+}
+
+TYPED_TEST_P(FooTest, HasPropertyA) { ... }
+
+// Now the tricky part: you need to register all test patterns before
+// you can instantiate them. The first argument of the macro is the
+// test case name; the rest are the names of the tests in this test
+// case.
+REGISTER_TYPED_TEST_CASE_P(FooTest,
+ DoesBlah, HasPropertyA);
+
+// Finally, you are free to instantiate the pattern with the types you
+// want. If you put the above code in a header file, you can #include
+// it in multiple C++ source files and instantiate it multiple times.
+//
+// To distinguish different instances of the pattern, the first
+// argument to the INSTANTIATE_* macro is a prefix that will be added
+// to the actual test case name. Remember to pick unique prefixes for
+// different instances.
+typedef testing::Types<char, int, unsigned int> MyTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
+
+// If the type list contains only one type, you can write that type
+// directly without Types<...>:
+// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
+
+#endif // 0
+
+#include <gtest/internal/gtest-port.h>
+#include <gtest/internal/gtest-type-util.h>
+
+// Implements typed tests.
+
+#if GTEST_HAS_TYPED_TEST
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Expands to the name of the typedef for the type parameters of the
+// given test case.
+#define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
+
+// The 'Types' template argument below must have spaces around it
+// since some compilers may choke on '>>' when passing a template
+// instance (e.g. Types<int>)
+#define TYPED_TEST_CASE(CaseName, Types) \
+ typedef ::testing::internal::TypeList< Types >::type \
+ GTEST_TYPE_PARAMS_(CaseName)
+
+#define TYPED_TEST(CaseName, TestName) \
+ template <typename gtest_TypeParam_> \
+ class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
+ : public CaseName<gtest_TypeParam_> { \
+ private: \
+ typedef CaseName<gtest_TypeParam_> TestFixture; \
+ typedef gtest_TypeParam_ TypeParam; \
+ virtual void TestBody(); \
+ }; \
+ bool gtest_##CaseName##_##TestName##_registered_ = \
+ ::testing::internal::TypeParameterizedTest< \
+ CaseName, \
+ ::testing::internal::TemplateSel< \
+ GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
+ GTEST_TYPE_PARAMS_(CaseName)>::Register(\
+ "", #CaseName, #TestName, 0); \
+ template <typename gtest_TypeParam_> \
+ void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
+
+#endif // GTEST_HAS_TYPED_TEST
+
+// Implements type-parameterized tests.
+
+#if GTEST_HAS_TYPED_TEST_P
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Expands to the namespace name that the type-parameterized tests for
+// the given type-parameterized test case are defined in. The exact
+// name of the namespace is subject to change without notice.
+#define GTEST_CASE_NAMESPACE_(TestCaseName) \
+ gtest_case_##TestCaseName##_
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Expands to the name of the variable used to remember the names of
+// the defined tests in the given test case.
+#define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
+ gtest_typed_test_case_p_state_##TestCaseName##_
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
+//
+// Expands to the name of the variable used to remember the names of
+// the registered tests in the given test case.
+#define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
+ gtest_registered_test_names_##TestCaseName##_
+
+// The variables defined in the type-parameterized test macros are
+// static as typically these macros are used in a .h file that can be
+// #included in multiple translation units linked together.
+#define TYPED_TEST_CASE_P(CaseName) \
+ static ::testing::internal::TypedTestCasePState \
+ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
+
+#define TYPED_TEST_P(CaseName, TestName) \
+ namespace GTEST_CASE_NAMESPACE_(CaseName) { \
+ template <typename gtest_TypeParam_> \
+ class TestName : public CaseName<gtest_TypeParam_> { \
+ private: \
+ typedef CaseName<gtest_TypeParam_> TestFixture; \
+ typedef gtest_TypeParam_ TypeParam; \
+ virtual void TestBody(); \
+ }; \
+ static bool gtest_##TestName##_defined_ = \
+ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
+ __FILE__, __LINE__, #CaseName, #TestName); \
+ } \
+ template <typename gtest_TypeParam_> \
+ void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
+
+#define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
+ namespace GTEST_CASE_NAMESPACE_(CaseName) { \
+ typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
+ } \
+ static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
+ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
+ __FILE__, __LINE__, #__VA_ARGS__)
+
+// The 'Types' template argument below must have spaces around it
+// since some compilers may choke on '>>' when passing a template
+// instance (e.g. Types<int>)
+#define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
+ bool gtest_##Prefix##_##CaseName = \
+ ::testing::internal::TypeParameterizedTestCase<CaseName, \
+ GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
+ ::testing::internal::TypeList< Types >::type>::Register(\
+ #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
+
+#endif // GTEST_HAS_TYPED_TEST_P
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest.h
new file mode 100644
index 0000000..921fad1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest.h
@@ -0,0 +1,2052 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file defines the public API for Google Test. It should be
+// included by any test program that uses Google Test.
+//
+// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
+// leave some internal implementation details in this header file.
+// They are clearly marked by comments like this:
+//
+// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+//
+// Such code is NOT meant to be used by a user directly, and is subject
+// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
+// program!
+//
+// Acknowledgment: Google Test borrowed the idea of automatic test
+// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
+// easyUnit framework.
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
+#define GTEST_INCLUDE_GTEST_GTEST_H_
+
+#include <limits>
+#include <vector>
+
+#include <gtest/internal/gtest-internal.h>
+#include <gtest/internal/gtest-string.h>
+#include <gtest/gtest-death-test.h>
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-param-test.h>
+#include <gtest/gtest_prod.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest-typed-test.h>
+
+// Depending on the platform, different string classes are available.
+// On Linux, in addition to ::std::string, Google also makes use of
+// class ::string, which has the same interface as ::std::string, but
+// has a different implementation.
+//
+// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
+// ::string is available AND is a distinct type to ::std::string, or
+// define it to 0 to indicate otherwise.
+//
+// If the user's ::std::string and ::string are the same class due to
+// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
+//
+// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
+// heuristically.
+
+namespace testing {
+
+// Declares the flags.
+
+// This flag temporary enables the disabled tests.
+GTEST_DECLARE_bool_(also_run_disabled_tests);
+
+// This flag brings the debugger on an assertion failure.
+GTEST_DECLARE_bool_(break_on_failure);
+
+// This flag controls whether Google Test catches all test-thrown exceptions
+// and logs them as failures.
+GTEST_DECLARE_bool_(catch_exceptions);
+
+// This flag enables using colors in terminal output. Available values are
+// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
+// to let Google Test decide.
+GTEST_DECLARE_string_(color);
+
+// This flag sets up the filter to select by name using a glob pattern
+// the tests to run. If the filter is not given all tests are executed.
+GTEST_DECLARE_string_(filter);
+
+// This flag causes the Google Test to list tests. None of the tests listed
+// are actually run if the flag is provided.
+GTEST_DECLARE_bool_(list_tests);
+
+// This flag controls whether Google Test emits a detailed XML report to a file
+// in addition to its normal textual output.
+GTEST_DECLARE_string_(output);
+
+// This flags control whether Google Test prints the elapsed time for each
+// test.
+GTEST_DECLARE_bool_(print_time);
+
+// This flag specifies the random number seed.
+GTEST_DECLARE_int32_(random_seed);
+
+// This flag sets how many times the tests are repeated. The default value
+// is 1. If the value is -1 the tests are repeating forever.
+GTEST_DECLARE_int32_(repeat);
+
+// This flag controls whether Google Test includes Google Test internal
+// stack frames in failure stack traces.
+GTEST_DECLARE_bool_(show_internal_stack_frames);
+
+// When this flag is specified, tests' order is randomized on every iteration.
+GTEST_DECLARE_bool_(shuffle);
+
+// This flag specifies the maximum number of stack frames to be
+// printed in a failure message.
+GTEST_DECLARE_int32_(stack_trace_depth);
+
+// When this flag is specified, a failed assertion will throw an
+// exception if exceptions are enabled, or exit the program with a
+// non-zero code otherwise.
+GTEST_DECLARE_bool_(throw_on_failure);
+
+// The upper limit for valid stack trace depths.
+const int kMaxStackTraceDepth = 100;
+
+namespace internal {
+
+class AssertHelper;
+class DefaultGlobalTestPartResultReporter;
+class ExecDeathTest;
+class NoExecDeathTest;
+class FinalSuccessChecker;
+class GTestFlagSaver;
+class TestInfoImpl;
+class TestResultAccessor;
+class TestEventListenersAccessor;
+class TestEventRepeater;
+class WindowsDeathTest;
+class UnitTestImpl* GetUnitTestImpl();
+void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
+ const String& message);
+class PrettyUnitTestResultPrinter;
+class XmlUnitTestResultPrinter;
+
+// Converts a streamable value to a String. A NULL pointer is
+// converted to "(null)". When the input value is a ::string,
+// ::std::string, ::wstring, or ::std::wstring object, each NUL
+// character in it is replaced with "\\0".
+// Declared in gtest-internal.h but defined here, so that it has access
+// to the definition of the Message class, required by the ARM
+// compiler.
+template <typename T>
+String StreamableToString(const T& streamable) {
+ return (Message() << streamable).GetString();
+}
+
+} // namespace internal
+
+// A class for indicating whether an assertion was successful. When
+// the assertion wasn't successful, the AssertionResult object
+// remembers a non-empty message that describes how it failed.
+//
+// To create an instance of this class, use one of the factory functions
+// (AssertionSuccess() and AssertionFailure()).
+//
+// This class is useful for two purposes:
+// 1. Defining predicate functions to be used with Boolean test assertions
+// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
+// 2. Defining predicate-format functions to be
+// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
+//
+// For example, if you define IsEven predicate:
+//
+// testing::AssertionResult IsEven(int n) {
+// if ((n % 2) == 0)
+// return testing::AssertionSuccess();
+// else
+// return testing::AssertionFailure() << n << " is odd";
+// }
+//
+// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
+// will print the message
+//
+// Value of: IsEven(Fib(5))
+// Actual: false (5 is odd)
+// Expected: true
+//
+// instead of a more opaque
+//
+// Value of: IsEven(Fib(5))
+// Actual: false
+// Expected: true
+//
+// in case IsEven is a simple Boolean predicate.
+//
+// If you expect your predicate to be reused and want to support informative
+// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
+// about half as often as positive ones in our tests), supply messages for
+// both success and failure cases:
+//
+// testing::AssertionResult IsEven(int n) {
+// if ((n % 2) == 0)
+// return testing::AssertionSuccess() << n << " is even";
+// else
+// return testing::AssertionFailure() << n << " is odd";
+// }
+//
+// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
+//
+// Value of: IsEven(Fib(6))
+// Actual: true (8 is even)
+// Expected: false
+//
+// NB: Predicates that support negative Boolean assertions have reduced
+// performance in positive ones so be careful not to use them in tests
+// that have lots (tens of thousands) of positive Boolean assertions.
+//
+// To use this class with EXPECT_PRED_FORMAT assertions such as:
+//
+// // Verifies that Foo() returns an even number.
+// EXPECT_PRED_FORMAT1(IsEven, Foo());
+//
+// you need to define:
+//
+// testing::AssertionResult IsEven(const char* expr, int n) {
+// if ((n % 2) == 0)
+// return testing::AssertionSuccess();
+// else
+// return testing::AssertionFailure()
+// << "Expected: " << expr << " is even\n Actual: it's " << n;
+// }
+//
+// If Foo() returns 5, you will see the following message:
+//
+// Expected: Foo() is even
+// Actual: it's 5
+//
+class GTEST_API_ AssertionResult {
+ public:
+ // Copy constructor.
+ // Used in EXPECT_TRUE/FALSE(assertion_result).
+ AssertionResult(const AssertionResult& other);
+ // Used in the EXPECT_TRUE/FALSE(bool_expression).
+ explicit AssertionResult(bool success) : success_(success) {}
+
+ // Returns true iff the assertion succeeded.
+ operator bool() const { return success_; } // NOLINT
+
+ // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
+ AssertionResult operator!() const;
+
+ // Returns the text streamed into this AssertionResult. Test assertions
+ // use it when they fail (i.e., the predicate's outcome doesn't match the
+ // assertion's expectation). When nothing has been streamed into the
+ // object, returns an empty string.
+ const char* message() const {
+ return message_.get() != NULL && message_->c_str() != NULL ?
+ message_->c_str() : "";
+ }
+ // TODO(vladl@google.com): Remove this after making sure no clients use it.
+ // Deprecated; please use message() instead.
+ const char* failure_message() const { return message(); }
+
+ // Streams a custom failure message into this object.
+ template <typename T> AssertionResult& operator<<(const T& value);
+
+ private:
+ // No implementation - we want AssertionResult to be
+ // copy-constructible but not assignable.
+ void operator=(const AssertionResult& other);
+
+ // Stores result of the assertion predicate.
+ bool success_;
+ // Stores the message describing the condition in case the expectation
+ // construct is not satisfied with the predicate's outcome.
+ // Referenced via a pointer to avoid taking too much stack frame space
+ // with test assertions.
+ internal::scoped_ptr<internal::String> message_;
+}; // class AssertionResult
+
+// Streams a custom failure message into this object.
+template <typename T>
+AssertionResult& AssertionResult::operator<<(const T& value) {
+ Message msg;
+ if (message_.get() != NULL)
+ msg << *message_;
+ msg << value;
+ message_.reset(new internal::String(msg.GetString()));
+ return *this;
+}
+
+// Makes a successful assertion result.
+GTEST_API_ AssertionResult AssertionSuccess();
+
+// Makes a failed assertion result.
+GTEST_API_ AssertionResult AssertionFailure();
+
+// Makes a failed assertion result with the given failure message.
+// Deprecated; use AssertionFailure() << msg.
+GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
+
+// The abstract class that all tests inherit from.
+//
+// In Google Test, a unit test program contains one or many TestCases, and
+// each TestCase contains one or many Tests.
+//
+// When you define a test using the TEST macro, you don't need to
+// explicitly derive from Test - the TEST macro automatically does
+// this for you.
+//
+// The only time you derive from Test is when defining a test fixture
+// to be used a TEST_F. For example:
+//
+// class FooTest : public testing::Test {
+// protected:
+// virtual void SetUp() { ... }
+// virtual void TearDown() { ... }
+// ...
+// };
+//
+// TEST_F(FooTest, Bar) { ... }
+// TEST_F(FooTest, Baz) { ... }
+//
+// Test is not copyable.
+class GTEST_API_ Test {
+ public:
+ friend class internal::TestInfoImpl;
+
+ // Defines types for pointers to functions that set up and tear down
+ // a test case.
+ typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
+ typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
+
+ // The d'tor is virtual as we intend to inherit from Test.
+ virtual ~Test();
+
+ // Sets up the stuff shared by all tests in this test case.
+ //
+ // Google Test will call Foo::SetUpTestCase() before running the first
+ // test in test case Foo. Hence a sub-class can define its own
+ // SetUpTestCase() method to shadow the one defined in the super
+ // class.
+ static void SetUpTestCase() {}
+
+ // Tears down the stuff shared by all tests in this test case.
+ //
+ // Google Test will call Foo::TearDownTestCase() after running the last
+ // test in test case Foo. Hence a sub-class can define its own
+ // TearDownTestCase() method to shadow the one defined in the super
+ // class.
+ static void TearDownTestCase() {}
+
+ // Returns true iff the current test has a fatal failure.
+ static bool HasFatalFailure();
+
+ // Returns true iff the current test has a non-fatal failure.
+ static bool HasNonfatalFailure();
+
+ // Returns true iff the current test has a (either fatal or
+ // non-fatal) failure.
+ static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
+
+ // Logs a property for the current test. Only the last value for a given
+ // key is remembered.
+ // These are public static so they can be called from utility functions
+ // that are not members of the test fixture.
+ // The arguments are const char* instead strings, as Google Test is used
+ // on platforms where string doesn't compile.
+ //
+ // Note that a driving consideration for these RecordProperty methods
+ // was to produce xml output suited to the Greenspan charting utility,
+ // which at present will only chart values that fit in a 32-bit int. It
+ // is the user's responsibility to restrict their values to 32-bit ints
+ // if they intend them to be used with Greenspan.
+ static void RecordProperty(const char* key, const char* value);
+ static void RecordProperty(const char* key, int value);
+
+ protected:
+ // Creates a Test object.
+ Test();
+
+ // Sets up the test fixture.
+ virtual void SetUp();
+
+ // Tears down the test fixture.
+ virtual void TearDown();
+
+ private:
+ // Returns true iff the current test has the same fixture class as
+ // the first test in the current test case.
+ static bool HasSameFixtureClass();
+
+ // Runs the test after the test fixture has been set up.
+ //
+ // A sub-class must implement this to define the test logic.
+ //
+ // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
+ // Instead, use the TEST or TEST_F macro.
+ virtual void TestBody() = 0;
+
+ // Sets up, executes, and tears down the test.
+ void Run();
+
+ // Uses a GTestFlagSaver to save and restore all Google Test flags.
+ const internal::GTestFlagSaver* const gtest_flag_saver_;
+
+ // Often a user mis-spells SetUp() as Setup() and spends a long time
+ // wondering why it is never called by Google Test. The declaration of
+ // the following method is solely for catching such an error at
+ // compile time:
+ //
+ // - The return type is deliberately chosen to be not void, so it
+ // will be a conflict if a user declares void Setup() in his test
+ // fixture.
+ //
+ // - This method is private, so it will be another compiler error
+ // if a user calls it from his test fixture.
+ //
+ // DO NOT OVERRIDE THIS FUNCTION.
+ //
+ // If you see an error about overriding the following function or
+ // about it being private, you have mis-spelled SetUp() as Setup().
+ struct Setup_should_be_spelled_SetUp {};
+ virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
+
+ // We disallow copying Tests.
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
+};
+
+typedef internal::TimeInMillis TimeInMillis;
+
+// A copyable object representing a user specified test property which can be
+// output as a key/value string pair.
+//
+// Don't inherit from TestProperty as its destructor is not virtual.
+class TestProperty {
+ public:
+ // C'tor. TestProperty does NOT have a default constructor.
+ // Always use this constructor (with parameters) to create a
+ // TestProperty object.
+ TestProperty(const char* a_key, const char* a_value) :
+ key_(a_key), value_(a_value) {
+ }
+
+ // Gets the user supplied key.
+ const char* key() const {
+ return key_.c_str();
+ }
+
+ // Gets the user supplied value.
+ const char* value() const {
+ return value_.c_str();
+ }
+
+ // Sets a new value, overriding the one supplied in the constructor.
+ void SetValue(const char* new_value) {
+ value_ = new_value;
+ }
+
+ private:
+ // The key supplied by the user.
+ internal::String key_;
+ // The value supplied by the user.
+ internal::String value_;
+};
+
+// The result of a single Test. This includes a list of
+// TestPartResults, a list of TestProperties, a count of how many
+// death tests there are in the Test, and how much time it took to run
+// the Test.
+//
+// TestResult is not copyable.
+class GTEST_API_ TestResult {
+ public:
+ // Creates an empty TestResult.
+ TestResult();
+
+ // D'tor. Do not inherit from TestResult.
+ ~TestResult();
+
+ // Gets the number of all test parts. This is the sum of the number
+ // of successful test parts and the number of failed test parts.
+ int total_part_count() const;
+
+ // Returns the number of the test properties.
+ int test_property_count() const;
+
+ // Returns true iff the test passed (i.e. no test part failed).
+ bool Passed() const { return !Failed(); }
+
+ // Returns true iff the test failed.
+ bool Failed() const;
+
+ // Returns true iff the test fatally failed.
+ bool HasFatalFailure() const;
+
+ // Returns true iff the test has a non-fatal failure.
+ bool HasNonfatalFailure() const;
+
+ // Returns the elapsed time, in milliseconds.
+ TimeInMillis elapsed_time() const { return elapsed_time_; }
+
+ // Returns the i-th test part result among all the results. i can range
+ // from 0 to test_property_count() - 1. If i is not in that range, aborts
+ // the program.
+ const TestPartResult& GetTestPartResult(int i) const;
+
+ // Returns the i-th test property. i can range from 0 to
+ // test_property_count() - 1. If i is not in that range, aborts the
+ // program.
+ const TestProperty& GetTestProperty(int i) const;
+
+ private:
+ friend class TestInfo;
+ friend class UnitTest;
+ friend class internal::DefaultGlobalTestPartResultReporter;
+ friend class internal::ExecDeathTest;
+ friend class internal::TestInfoImpl;
+ friend class internal::TestResultAccessor;
+ friend class internal::UnitTestImpl;
+ friend class internal::WindowsDeathTest;
+
+ // Gets the vector of TestPartResults.
+ const std::vector<TestPartResult>& test_part_results() const {
+ return test_part_results_;
+ }
+
+ // Gets the vector of TestProperties.
+ const std::vector<TestProperty>& test_properties() const {
+ return test_properties_;
+ }
+
+ // Sets the elapsed time.
+ void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
+
+ // Adds a test property to the list. The property is validated and may add
+ // a non-fatal failure if invalid (e.g., if it conflicts with reserved
+ // key names). If a property is already recorded for the same key, the
+ // value will be updated, rather than storing multiple values for the same
+ // key.
+ void RecordProperty(const TestProperty& test_property);
+
+ // Adds a failure if the key is a reserved attribute of Google Test
+ // testcase tags. Returns true if the property is valid.
+ // TODO(russr): Validate attribute names are legal and human readable.
+ static bool ValidateTestProperty(const TestProperty& test_property);
+
+ // Adds a test part result to the list.
+ void AddTestPartResult(const TestPartResult& test_part_result);
+
+ // Returns the death test count.
+ int death_test_count() const { return death_test_count_; }
+
+ // Increments the death test count, returning the new count.
+ int increment_death_test_count() { return ++death_test_count_; }
+
+ // Clears the test part results.
+ void ClearTestPartResults();
+
+ // Clears the object.
+ void Clear();
+
+ // Protects mutable state of the property vector and of owned
+ // properties, whose values may be updated.
+ internal::Mutex test_properites_mutex_;
+
+ // The vector of TestPartResults
+ std::vector<TestPartResult> test_part_results_;
+ // The vector of TestProperties
+ std::vector<TestProperty> test_properties_;
+ // Running count of death tests.
+ int death_test_count_;
+ // The elapsed time, in milliseconds.
+ TimeInMillis elapsed_time_;
+
+ // We disallow copying TestResult.
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
+}; // class TestResult
+
+// A TestInfo object stores the following information about a test:
+//
+// Test case name
+// Test name
+// Whether the test should be run
+// A function pointer that creates the test object when invoked
+// Test result
+//
+// The constructor of TestInfo registers itself with the UnitTest
+// singleton such that the RUN_ALL_TESTS() macro knows which tests to
+// run.
+class GTEST_API_ TestInfo {
+ public:
+ // Destructs a TestInfo object. This function is not virtual, so
+ // don't inherit from TestInfo.
+ ~TestInfo();
+
+ // Returns the test case name.
+ const char* test_case_name() const;
+
+ // Returns the test name.
+ const char* name() const;
+
+ // Returns the test case comment.
+ const char* test_case_comment() const;
+
+ // Returns the test comment.
+ const char* comment() const;
+
+ // Returns true if this test should run, that is if the test is not disabled
+ // (or it is disabled but the also_run_disabled_tests flag has been specified)
+ // and its full name matches the user-specified filter.
+ //
+ // Google Test allows the user to filter the tests by their full names.
+ // The full name of a test Bar in test case Foo is defined as
+ // "Foo.Bar". Only the tests that match the filter will run.
+ //
+ // A filter is a colon-separated list of glob (not regex) patterns,
+ // optionally followed by a '-' and a colon-separated list of
+ // negative patterns (tests to exclude). A test is run if it
+ // matches one of the positive patterns and does not match any of
+ // the negative patterns.
+ //
+ // For example, *A*:Foo.* is a filter that matches any string that
+ // contains the character 'A' or starts with "Foo.".
+ bool should_run() const;
+
+ // Returns the result of the test.
+ const TestResult* result() const;
+
+ private:
+#if GTEST_HAS_DEATH_TEST
+ friend class internal::DefaultDeathTestFactory;
+#endif // GTEST_HAS_DEATH_TEST
+ friend class Test;
+ friend class TestCase;
+ friend class internal::TestInfoImpl;
+ friend class internal::UnitTestImpl;
+ friend TestInfo* internal::MakeAndRegisterTestInfo(
+ const char* test_case_name, const char* name,
+ const char* test_case_comment, const char* comment,
+ internal::TypeId fixture_class_id,
+ Test::SetUpTestCaseFunc set_up_tc,
+ Test::TearDownTestCaseFunc tear_down_tc,
+ internal::TestFactoryBase* factory);
+
+ // Returns true if this test matches the user-specified filter.
+ bool matches_filter() const;
+
+ // Increments the number of death tests encountered in this test so
+ // far.
+ int increment_death_test_count();
+
+ // Accessors for the implementation object.
+ internal::TestInfoImpl* impl() { return impl_; }
+ const internal::TestInfoImpl* impl() const { return impl_; }
+
+ // Constructs a TestInfo object. The newly constructed instance assumes
+ // ownership of the factory object.
+ TestInfo(const char* test_case_name, const char* name,
+ const char* test_case_comment, const char* comment,
+ internal::TypeId fixture_class_id,
+ internal::TestFactoryBase* factory);
+
+ // An opaque implementation object.
+ internal::TestInfoImpl* impl_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
+};
+
+// A test case, which consists of a vector of TestInfos.
+//
+// TestCase is not copyable.
+class GTEST_API_ TestCase {
+ public:
+ // Creates a TestCase with the given name.
+ //
+ // TestCase does NOT have a default constructor. Always use this
+ // constructor to create a TestCase object.
+ //
+ // Arguments:
+ //
+ // name: name of the test case
+ // set_up_tc: pointer to the function that sets up the test case
+ // tear_down_tc: pointer to the function that tears down the test case
+ TestCase(const char* name, const char* comment,
+ Test::SetUpTestCaseFunc set_up_tc,
+ Test::TearDownTestCaseFunc tear_down_tc);
+
+ // Destructor of TestCase.
+ virtual ~TestCase();
+
+ // Gets the name of the TestCase.
+ const char* name() const { return name_.c_str(); }
+
+ // Returns the test case comment.
+ const char* comment() const { return comment_.c_str(); }
+
+ // Returns true if any test in this test case should run.
+ bool should_run() const { return should_run_; }
+
+ // Gets the number of successful tests in this test case.
+ int successful_test_count() const;
+
+ // Gets the number of failed tests in this test case.
+ int failed_test_count() const;
+
+ // Gets the number of disabled tests in this test case.
+ int disabled_test_count() const;
+
+ // Get the number of tests in this test case that should run.
+ int test_to_run_count() const;
+
+ // Gets the number of all tests in this test case.
+ int total_test_count() const;
+
+ // Returns true iff the test case passed.
+ bool Passed() const { return !Failed(); }
+
+ // Returns true iff the test case failed.
+ bool Failed() const { return failed_test_count() > 0; }
+
+ // Returns the elapsed time, in milliseconds.
+ TimeInMillis elapsed_time() const { return elapsed_time_; }
+
+ // Returns the i-th test among all the tests. i can range from 0 to
+ // total_test_count() - 1. If i is not in that range, returns NULL.
+ const TestInfo* GetTestInfo(int i) const;
+
+ private:
+ friend class Test;
+ friend class internal::UnitTestImpl;
+
+ // Gets the (mutable) vector of TestInfos in this TestCase.
+ std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
+
+ // Gets the (immutable) vector of TestInfos in this TestCase.
+ const std::vector<TestInfo*>& test_info_list() const {
+ return test_info_list_;
+ }
+
+ // Returns the i-th test among all the tests. i can range from 0 to
+ // total_test_count() - 1. If i is not in that range, returns NULL.
+ TestInfo* GetMutableTestInfo(int i);
+
+ // Sets the should_run member.
+ void set_should_run(bool should) { should_run_ = should; }
+
+ // Adds a TestInfo to this test case. Will delete the TestInfo upon
+ // destruction of the TestCase object.
+ void AddTestInfo(TestInfo * test_info);
+
+ // Clears the results of all tests in this test case.
+ void ClearResult();
+
+ // Clears the results of all tests in the given test case.
+ static void ClearTestCaseResult(TestCase* test_case) {
+ test_case->ClearResult();
+ }
+
+ // Runs every test in this TestCase.
+ void Run();
+
+ // Returns true iff test passed.
+ static bool TestPassed(const TestInfo * test_info);
+
+ // Returns true iff test failed.
+ static bool TestFailed(const TestInfo * test_info);
+
+ // Returns true iff test is disabled.
+ static bool TestDisabled(const TestInfo * test_info);
+
+ // Returns true if the given test should run.
+ static bool ShouldRunTest(const TestInfo *test_info);
+
+ // Shuffles the tests in this test case.
+ void ShuffleTests(internal::Random* random);
+
+ // Restores the test order to before the first shuffle.
+ void UnshuffleTests();
+
+ // Name of the test case.
+ internal::String name_;
+ // Comment on the test case.
+ internal::String comment_;
+ // The vector of TestInfos in their original order. It owns the
+ // elements in the vector.
+ std::vector<TestInfo*> test_info_list_;
+ // Provides a level of indirection for the test list to allow easy
+ // shuffling and restoring the test order. The i-th element in this
+ // vector is the index of the i-th test in the shuffled test list.
+ std::vector<int> test_indices_;
+ // Pointer to the function that sets up the test case.
+ Test::SetUpTestCaseFunc set_up_tc_;
+ // Pointer to the function that tears down the test case.
+ Test::TearDownTestCaseFunc tear_down_tc_;
+ // True iff any test in this test case should run.
+ bool should_run_;
+ // Elapsed time, in milliseconds.
+ TimeInMillis elapsed_time_;
+
+ // We disallow copying TestCases.
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
+};
+
+// An Environment object is capable of setting up and tearing down an
+// environment. The user should subclass this to define his own
+// environment(s).
+//
+// An Environment object does the set-up and tear-down in virtual
+// methods SetUp() and TearDown() instead of the constructor and the
+// destructor, as:
+//
+// 1. You cannot safely throw from a destructor. This is a problem
+// as in some cases Google Test is used where exceptions are enabled, and
+// we may want to implement ASSERT_* using exceptions where they are
+// available.
+// 2. You cannot use ASSERT_* directly in a constructor or
+// destructor.
+class Environment {
+ public:
+ // The d'tor is virtual as we need to subclass Environment.
+ virtual ~Environment() {}
+
+ // Override this to define how to set up the environment.
+ virtual void SetUp() {}
+
+ // Override this to define how to tear down the environment.
+ virtual void TearDown() {}
+ private:
+ // If you see an error about overriding the following function or
+ // about it being private, you have mis-spelled SetUp() as Setup().
+ struct Setup_should_be_spelled_SetUp {};
+ virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
+};
+
+// The interface for tracing execution of tests. The methods are organized in
+// the order the corresponding events are fired.
+class TestEventListener {
+ public:
+ virtual ~TestEventListener() {}
+
+ // Fired before any test activity starts.
+ virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
+
+ // Fired before each iteration of tests starts. There may be more than
+ // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
+ // index, starting from 0.
+ virtual void OnTestIterationStart(const UnitTest& unit_test,
+ int iteration) = 0;
+
+ // Fired before environment set-up for each iteration of tests starts.
+ virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
+
+ // Fired after environment set-up for each iteration of tests ends.
+ virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
+
+ // Fired before the test case starts.
+ virtual void OnTestCaseStart(const TestCase& test_case) = 0;
+
+ // Fired before the test starts.
+ virtual void OnTestStart(const TestInfo& test_info) = 0;
+
+ // Fired after a failed assertion or a SUCCESS().
+ virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
+
+ // Fired after the test ends.
+ virtual void OnTestEnd(const TestInfo& test_info) = 0;
+
+ // Fired after the test case ends.
+ virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
+
+ // Fired before environment tear-down for each iteration of tests starts.
+ virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
+
+ // Fired after environment tear-down for each iteration of tests ends.
+ virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
+
+ // Fired after each iteration of tests finishes.
+ virtual void OnTestIterationEnd(const UnitTest& unit_test,
+ int iteration) = 0;
+
+ // Fired after all test activities have ended.
+ virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
+};
+
+// The convenience class for users who need to override just one or two
+// methods and are not concerned that a possible change to a signature of
+// the methods they override will not be caught during the build. For
+// comments about each method please see the definition of TestEventListener
+// above.
+class EmptyTestEventListener : public TestEventListener {
+ public:
+ virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
+ virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
+ int /*iteration*/) {}
+ virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
+ virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
+ virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
+ virtual void OnTestStart(const TestInfo& /*test_info*/) {}
+ virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
+ virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
+ virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
+ virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
+ virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
+ virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
+ int /*iteration*/) {}
+ virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
+};
+
+// TestEventListeners lets users add listeners to track events in Google Test.
+class GTEST_API_ TestEventListeners {
+ public:
+ TestEventListeners();
+ ~TestEventListeners();
+
+ // Appends an event listener to the end of the list. Google Test assumes
+ // the ownership of the listener (i.e. it will delete the listener when
+ // the test program finishes).
+ void Append(TestEventListener* listener);
+
+ // Removes the given event listener from the list and returns it. It then
+ // becomes the caller's responsibility to delete the listener. Returns
+ // NULL if the listener is not found in the list.
+ TestEventListener* Release(TestEventListener* listener);
+
+ // Returns the standard listener responsible for the default console
+ // output. Can be removed from the listeners list to shut down default
+ // console output. Note that removing this object from the listener list
+ // with Release transfers its ownership to the caller and makes this
+ // function return NULL the next time.
+ TestEventListener* default_result_printer() const {
+ return default_result_printer_;
+ }
+
+ // Returns the standard listener responsible for the default XML output
+ // controlled by the --gtest_output=xml flag. Can be removed from the
+ // listeners list by users who want to shut down the default XML output
+ // controlled by this flag and substitute it with custom one. Note that
+ // removing this object from the listener list with Release transfers its
+ // ownership to the caller and makes this function return NULL the next
+ // time.
+ TestEventListener* default_xml_generator() const {
+ return default_xml_generator_;
+ }
+
+ private:
+ friend class TestCase;
+ friend class internal::DefaultGlobalTestPartResultReporter;
+ friend class internal::NoExecDeathTest;
+ friend class internal::TestEventListenersAccessor;
+ friend class internal::TestInfoImpl;
+ friend class internal::UnitTestImpl;
+
+ // Returns repeater that broadcasts the TestEventListener events to all
+ // subscribers.
+ TestEventListener* repeater();
+
+ // Sets the default_result_printer attribute to the provided listener.
+ // The listener is also added to the listener list and previous
+ // default_result_printer is removed from it and deleted. The listener can
+ // also be NULL in which case it will not be added to the list. Does
+ // nothing if the previous and the current listener objects are the same.
+ void SetDefaultResultPrinter(TestEventListener* listener);
+
+ // Sets the default_xml_generator attribute to the provided listener. The
+ // listener is also added to the listener list and previous
+ // default_xml_generator is removed from it and deleted. The listener can
+ // also be NULL in which case it will not be added to the list. Does
+ // nothing if the previous and the current listener objects are the same.
+ void SetDefaultXmlGenerator(TestEventListener* listener);
+
+ // Controls whether events will be forwarded by the repeater to the
+ // listeners in the list.
+ bool EventForwardingEnabled() const;
+ void SuppressEventForwarding();
+
+ // The actual list of listeners.
+ internal::TestEventRepeater* repeater_;
+ // Listener responsible for the standard result output.
+ TestEventListener* default_result_printer_;
+ // Listener responsible for the creation of the XML output file.
+ TestEventListener* default_xml_generator_;
+
+ // We disallow copying TestEventListeners.
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
+};
+
+// A UnitTest consists of a vector of TestCases.
+//
+// This is a singleton class. The only instance of UnitTest is
+// created when UnitTest::GetInstance() is first called. This
+// instance is never deleted.
+//
+// UnitTest is not copyable.
+//
+// This class is thread-safe as long as the methods are called
+// according to their specification.
+class GTEST_API_ UnitTest {
+ public:
+ // Gets the singleton UnitTest object. The first time this method
+ // is called, a UnitTest object is constructed and returned.
+ // Consecutive calls will return the same object.
+ static UnitTest* GetInstance();
+
+ // Runs all tests in this UnitTest object and prints the result.
+ // Returns 0 if successful, or 1 otherwise.
+ //
+ // This method can only be called from the main thread.
+ //
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+ int Run() GTEST_MUST_USE_RESULT_;
+
+ // Returns the working directory when the first TEST() or TEST_F()
+ // was executed. The UnitTest object owns the string.
+ const char* original_working_dir() const;
+
+ // Returns the TestCase object for the test that's currently running,
+ // or NULL if no test is running.
+ const TestCase* current_test_case() const;
+
+ // Returns the TestInfo object for the test that's currently running,
+ // or NULL if no test is running.
+ const TestInfo* current_test_info() const;
+
+ // Returns the random seed used at the start of the current test run.
+ int random_seed() const;
+
+#if GTEST_HAS_PARAM_TEST
+ // Returns the ParameterizedTestCaseRegistry object used to keep track of
+ // value-parameterized tests and instantiate and register them.
+ //
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+ internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
+#endif // GTEST_HAS_PARAM_TEST
+
+ // Gets the number of successful test cases.
+ int successful_test_case_count() const;
+
+ // Gets the number of failed test cases.
+ int failed_test_case_count() const;
+
+ // Gets the number of all test cases.
+ int total_test_case_count() const;
+
+ // Gets the number of all test cases that contain at least one test
+ // that should run.
+ int test_case_to_run_count() const;
+
+ // Gets the number of successful tests.
+ int successful_test_count() const;
+
+ // Gets the number of failed tests.
+ int failed_test_count() const;
+
+ // Gets the number of disabled tests.
+ int disabled_test_count() const;
+
+ // Gets the number of all tests.
+ int total_test_count() const;
+
+ // Gets the number of tests that should run.
+ int test_to_run_count() const;
+
+ // Gets the elapsed time, in milliseconds.
+ TimeInMillis elapsed_time() const;
+
+ // Returns true iff the unit test passed (i.e. all test cases passed).
+ bool Passed() const;
+
+ // Returns true iff the unit test failed (i.e. some test case failed
+ // or something outside of all tests failed).
+ bool Failed() const;
+
+ // Gets the i-th test case among all the test cases. i can range from 0 to
+ // total_test_case_count() - 1. If i is not in that range, returns NULL.
+ const TestCase* GetTestCase(int i) const;
+
+ // Returns the list of event listeners that can be used to track events
+ // inside Google Test.
+ TestEventListeners& listeners();
+
+ private:
+ // Registers and returns a global test environment. When a test
+ // program is run, all global test environments will be set-up in
+ // the order they were registered. After all tests in the program
+ // have finished, all global test environments will be torn-down in
+ // the *reverse* order they were registered.
+ //
+ // The UnitTest object takes ownership of the given environment.
+ //
+ // This method can only be called from the main thread.
+ Environment* AddEnvironment(Environment* env);
+
+ // Adds a TestPartResult to the current TestResult object. All
+ // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
+ // eventually call this to report their results. The user code
+ // should use the assertion macros instead of calling this directly.
+ void AddTestPartResult(TestPartResult::Type result_type,
+ const char* file_name,
+ int line_number,
+ const internal::String& message,
+ const internal::String& os_stack_trace);
+
+ // Adds a TestProperty to the current TestResult object. If the result already
+ // contains a property with the same key, the value will be updated.
+ void RecordPropertyForCurrentTest(const char* key, const char* value);
+
+ // Gets the i-th test case among all the test cases. i can range from 0 to
+ // total_test_case_count() - 1. If i is not in that range, returns NULL.
+ TestCase* GetMutableTestCase(int i);
+
+ // Accessors for the implementation object.
+ internal::UnitTestImpl* impl() { return impl_; }
+ const internal::UnitTestImpl* impl() const { return impl_; }
+
+ // These classes and funcions are friends as they need to access private
+ // members of UnitTest.
+ friend class Test;
+ friend class internal::AssertHelper;
+ friend class internal::ScopedTrace;
+ friend Environment* AddGlobalTestEnvironment(Environment* env);
+ friend internal::UnitTestImpl* internal::GetUnitTestImpl();
+ friend void internal::ReportFailureInUnknownLocation(
+ TestPartResult::Type result_type,
+ const internal::String& message);
+
+ // Creates an empty UnitTest.
+ UnitTest();
+
+ // D'tor
+ virtual ~UnitTest();
+
+ // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
+ // Google Test trace stack.
+ void PushGTestTrace(const internal::TraceInfo& trace);
+
+ // Pops a trace from the per-thread Google Test trace stack.
+ void PopGTestTrace();
+
+ // Protects mutable state in *impl_. This is mutable as some const
+ // methods need to lock it too.
+ mutable internal::Mutex mutex_;
+
+ // Opaque implementation object. This field is never changed once
+ // the object is constructed. We don't mark it as const here, as
+ // doing so will cause a warning in the constructor of UnitTest.
+ // Mutable state in *impl_ is protected by mutex_.
+ internal::UnitTestImpl* impl_;
+
+ // We disallow copying UnitTest.
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
+};
+
+// A convenient wrapper for adding an environment for the test
+// program.
+//
+// You should call this before RUN_ALL_TESTS() is called, probably in
+// main(). If you use gtest_main, you need to call this before main()
+// starts for it to take effect. For example, you can define a global
+// variable like this:
+//
+// testing::Environment* const foo_env =
+// testing::AddGlobalTestEnvironment(new FooEnvironment);
+//
+// However, we strongly recommend you to write your own main() and
+// call AddGlobalTestEnvironment() there, as relying on initialization
+// of global variables makes the code harder to read and may cause
+// problems when you register multiple environments from different
+// translation units and the environments have dependencies among them
+// (remember that the compiler doesn't guarantee the order in which
+// global variables from different translation units are initialized).
+inline Environment* AddGlobalTestEnvironment(Environment* env) {
+ return UnitTest::GetInstance()->AddEnvironment(env);
+}
+
+// Initializes Google Test. This must be called before calling
+// RUN_ALL_TESTS(). In particular, it parses a command line for the
+// flags that Google Test recognizes. Whenever a Google Test flag is
+// seen, it is removed from argv, and *argc is decremented.
+//
+// No value is returned. Instead, the Google Test flag variables are
+// updated.
+//
+// Calling the function for the second time has no user-visible effect.
+GTEST_API_ void InitGoogleTest(int* argc, char** argv);
+
+// This overloaded version can be used in Windows programs compiled in
+// UNICODE mode.
+GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
+
+namespace internal {
+
+// These overloaded versions handle ::std::string and ::std::wstring.
+GTEST_API_ inline String FormatForFailureMessage(const ::std::string& str) {
+ return (Message() << '"' << str << '"').GetString();
+}
+
+#if GTEST_HAS_STD_WSTRING
+GTEST_API_ inline String FormatForFailureMessage(const ::std::wstring& wstr) {
+ return (Message() << "L\"" << wstr << '"').GetString();
+}
+#endif // GTEST_HAS_STD_WSTRING
+
+// These overloaded versions handle ::string and ::wstring.
+#if GTEST_HAS_GLOBAL_STRING
+GTEST_API_ inline String FormatForFailureMessage(const ::string& str) {
+ return (Message() << '"' << str << '"').GetString();
+}
+#endif // GTEST_HAS_GLOBAL_STRING
+
+#if GTEST_HAS_GLOBAL_WSTRING
+GTEST_API_ inline String FormatForFailureMessage(const ::wstring& wstr) {
+ return (Message() << "L\"" << wstr << '"').GetString();
+}
+#endif // GTEST_HAS_GLOBAL_WSTRING
+
+// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
+// operand to be used in a failure message. The type (but not value)
+// of the other operand may affect the format. This allows us to
+// print a char* as a raw pointer when it is compared against another
+// char*, and print it as a C string when it is compared against an
+// std::string object, for example.
+//
+// The default implementation ignores the type of the other operand.
+// Some specialized versions are used to handle formatting wide or
+// narrow C strings.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+template <typename T1, typename T2>
+String FormatForComparisonFailureMessage(const T1& value,
+ const T2& /* other_operand */) {
+ return FormatForFailureMessage(value);
+}
+
+// The helper function for {ASSERT|EXPECT}_EQ.
+template <typename T1, typename T2>
+AssertionResult CmpHelperEQ(const char* expected_expression,
+ const char* actual_expression,
+ const T1& expected,
+ const T2& actual) {
+#ifdef _MSC_VER
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4389) // Temporarily disables warning on
+ // signed/unsigned mismatch.
+#endif
+
+ if (expected == actual) {
+ return AssertionSuccess();
+ }
+
+#ifdef _MSC_VER
+#pragma warning(pop) // Restores the warning state.
+#endif
+
+ return EqFailure(expected_expression,
+ actual_expression,
+ FormatForComparisonFailureMessage(expected, actual),
+ FormatForComparisonFailureMessage(actual, expected),
+ false);
+}
+
+// With this overloaded version, we allow anonymous enums to be used
+// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
+// can be implicitly cast to BiggestInt.
+GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
+ const char* actual_expression,
+ BiggestInt expected,
+ BiggestInt actual);
+
+// The helper class for {ASSERT|EXPECT}_EQ. The template argument
+// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
+// is a null pointer literal. The following default implementation is
+// for lhs_is_null_literal being false.
+template <bool lhs_is_null_literal>
+class EqHelper {
+ public:
+ // This templatized version is for the general case.
+ template <typename T1, typename T2>
+ static AssertionResult Compare(const char* expected_expression,
+ const char* actual_expression,
+ const T1& expected,
+ const T2& actual) {
+ return CmpHelperEQ(expected_expression, actual_expression, expected,
+ actual);
+ }
+
+ // With this overloaded version, we allow anonymous enums to be used
+ // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
+ // enums can be implicitly cast to BiggestInt.
+ //
+ // Even though its body looks the same as the above version, we
+ // cannot merge the two, as it will make anonymous enums unhappy.
+ static AssertionResult Compare(const char* expected_expression,
+ const char* actual_expression,
+ BiggestInt expected,
+ BiggestInt actual) {
+ return CmpHelperEQ(expected_expression, actual_expression, expected,
+ actual);
+ }
+};
+
+// This specialization is used when the first argument to ASSERT_EQ()
+// is a null pointer literal.
+template <>
+class EqHelper<true> {
+ public:
+ // We define two overloaded versions of Compare(). The first
+ // version will be picked when the second argument to ASSERT_EQ() is
+ // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
+ // EXPECT_EQ(false, a_bool).
+ template <typename T1, typename T2>
+ static AssertionResult Compare(const char* expected_expression,
+ const char* actual_expression,
+ const T1& expected,
+ const T2& actual) {
+ return CmpHelperEQ(expected_expression, actual_expression, expected,
+ actual);
+ }
+
+ // This version will be picked when the second argument to
+ // ASSERT_EQ() is a pointer, e.g. ASSERT_EQ(NULL, a_pointer).
+ template <typename T1, typename T2>
+ static AssertionResult Compare(const char* expected_expression,
+ const char* actual_expression,
+ const T1& /* expected */,
+ T2* actual) {
+ // We already know that 'expected' is a null pointer.
+ return CmpHelperEQ(expected_expression, actual_expression,
+ static_cast<T2*>(NULL), actual);
+ }
+};
+
+// A macro for implementing the helper functions needed to implement
+// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
+// of similar code.
+//
+// For each templatized helper function, we also define an overloaded
+// version for BiggestInt in order to reduce code bloat and allow
+// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
+// with gcc 4.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
+template <typename T1, typename T2>\
+AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
+ const T1& val1, const T2& val2) {\
+ if (val1 op val2) {\
+ return AssertionSuccess();\
+ } else {\
+ Message msg;\
+ msg << "Expected: (" << expr1 << ") " #op " (" << expr2\
+ << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
+ << " vs " << FormatForComparisonFailureMessage(val2, val1);\
+ return AssertionFailure(msg);\
+ }\
+}\
+GTEST_API_ AssertionResult CmpHelper##op_name(\
+ const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+
+// Implements the helper function for {ASSERT|EXPECT}_NE
+GTEST_IMPL_CMP_HELPER_(NE, !=);
+// Implements the helper function for {ASSERT|EXPECT}_LE
+GTEST_IMPL_CMP_HELPER_(LE, <=);
+// Implements the helper function for {ASSERT|EXPECT}_LT
+GTEST_IMPL_CMP_HELPER_(LT, < );
+// Implements the helper function for {ASSERT|EXPECT}_GE
+GTEST_IMPL_CMP_HELPER_(GE, >=);
+// Implements the helper function for {ASSERT|EXPECT}_GT
+GTEST_IMPL_CMP_HELPER_(GT, > );
+
+#undef GTEST_IMPL_CMP_HELPER_
+
+// The helper function for {ASSERT|EXPECT}_STREQ.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
+ const char* actual_expression,
+ const char* expected,
+ const char* actual);
+
+// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
+ const char* actual_expression,
+ const char* expected,
+ const char* actual);
+
+// The helper function for {ASSERT|EXPECT}_STRNE.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2);
+
+// The helper function for {ASSERT|EXPECT}_STRCASENE.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2);
+
+
+// Helper function for *_STREQ on wide strings.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
+ const char* actual_expression,
+ const wchar_t* expected,
+ const wchar_t* actual);
+
+// Helper function for *_STRNE on wide strings.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
+ const char* s2_expression,
+ const wchar_t* s1,
+ const wchar_t* s2);
+
+} // namespace internal
+
+// IsSubstring() and IsNotSubstring() are intended to be used as the
+// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
+// themselves. They check whether needle is a substring of haystack
+// (NULL is considered a substring of itself only), and return an
+// appropriate error message when they fail.
+//
+// The {needle,haystack}_expr arguments are the stringified
+// expressions that generated the two real arguments.
+GTEST_API_ AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const char* needle, const char* haystack);
+GTEST_API_ AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const wchar_t* needle, const wchar_t* haystack);
+GTEST_API_ AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const char* needle, const char* haystack);
+GTEST_API_ AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const wchar_t* needle, const wchar_t* haystack);
+GTEST_API_ AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::string& needle, const ::std::string& haystack);
+GTEST_API_ AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::string& needle, const ::std::string& haystack);
+
+#if GTEST_HAS_STD_WSTRING
+GTEST_API_ AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::wstring& needle, const ::std::wstring& haystack);
+GTEST_API_ AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::wstring& needle, const ::std::wstring& haystack);
+#endif // GTEST_HAS_STD_WSTRING
+
+namespace internal {
+
+// Helper template function for comparing floating-points.
+//
+// Template parameter:
+//
+// RawType: the raw floating-point type (either float or double)
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+template <typename RawType>
+AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
+ const char* actual_expression,
+ RawType expected,
+ RawType actual) {
+ const FloatingPoint<RawType> lhs(expected), rhs(actual);
+
+ if (lhs.AlmostEquals(rhs)) {
+ return AssertionSuccess();
+ }
+
+ StrStream expected_ss;
+ expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+ << expected;
+
+ StrStream actual_ss;
+ actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+ << actual;
+
+ return EqFailure(expected_expression,
+ actual_expression,
+ StrStreamToString(&expected_ss),
+ StrStreamToString(&actual_ss),
+ false);
+}
+
+// Helper function for implementing ASSERT_NEAR.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
+ const char* expr2,
+ const char* abs_error_expr,
+ double val1,
+ double val2,
+ double abs_error);
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+// A class that enables one to stream messages to assertion macros
+class GTEST_API_ AssertHelper {
+ public:
+ // Constructor.
+ AssertHelper(TestPartResult::Type type,
+ const char* file,
+ int line,
+ const char* message);
+ ~AssertHelper();
+
+ // Message assignment is a semantic trick to enable assertion
+ // streaming; see the GTEST_MESSAGE_ macro below.
+ void operator=(const Message& message) const;
+
+ private:
+ // We put our data in a struct so that the size of the AssertHelper class can
+ // be as small as possible. This is important because gcc is incapable of
+ // re-using stack space even for temporary variables, so every EXPECT_EQ
+ // reserves stack space for another AssertHelper.
+ struct AssertHelperData {
+ AssertHelperData(TestPartResult::Type t,
+ const char* srcfile,
+ int line_num,
+ const char* msg)
+ : type(t), file(srcfile), line(line_num), message(msg) { }
+
+ TestPartResult::Type const type;
+ const char* const file;
+ int const line;
+ String const message;
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
+ };
+
+ AssertHelperData* const data_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
+};
+
+} // namespace internal
+
+#if GTEST_HAS_PARAM_TEST
+// The abstract base class that all value-parameterized tests inherit from.
+//
+// This class adds support for accessing the test parameter value via
+// the GetParam() method.
+//
+// Use it with one of the parameter generator defining functions, like Range(),
+// Values(), ValuesIn(), Bool(), and Combine().
+//
+// class FooTest : public ::testing::TestWithParam<int> {
+// protected:
+// FooTest() {
+// // Can use GetParam() here.
+// }
+// virtual ~FooTest() {
+// // Can use GetParam() here.
+// }
+// virtual void SetUp() {
+// // Can use GetParam() here.
+// }
+// virtual void TearDown {
+// // Can use GetParam() here.
+// }
+// };
+// TEST_P(FooTest, DoesBar) {
+// // Can use GetParam() method here.
+// Foo foo;
+// ASSERT_TRUE(foo.DoesBar(GetParam()));
+// }
+// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
+
+template <typename T>
+class TestWithParam : public Test {
+ public:
+ typedef T ParamType;
+
+ // The current parameter value. Is also available in the test fixture's
+ // constructor.
+ const ParamType& GetParam() const { return *parameter_; }
+
+ private:
+ // Sets parameter value. The caller is responsible for making sure the value
+ // remains alive and unchanged throughout the current test.
+ static void SetParam(const ParamType* parameter) {
+ parameter_ = parameter;
+ }
+
+ // Static value used for accessing parameter during a test lifetime.
+ static const ParamType* parameter_;
+
+ // TestClass must be a subclass of TestWithParam<T>.
+ template <class TestClass> friend class internal::ParameterizedTestFactory;
+};
+
+template <typename T>
+const T* TestWithParam<T>::parameter_ = NULL;
+
+#endif // GTEST_HAS_PARAM_TEST
+
+// Macros for indicating success/failure in test code.
+
+// ADD_FAILURE unconditionally adds a failure to the current test.
+// SUCCEED generates a success - it doesn't automatically make the
+// current test successful, as a test is only successful when it has
+// no failure.
+//
+// EXPECT_* verifies that a certain condition is satisfied. If not,
+// it behaves like ADD_FAILURE. In particular:
+//
+// EXPECT_TRUE verifies that a Boolean condition is true.
+// EXPECT_FALSE verifies that a Boolean condition is false.
+//
+// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
+// that they will also abort the current function on failure. People
+// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
+// writing data-driven tests often find themselves using ADD_FAILURE
+// and EXPECT_* more.
+//
+// Examples:
+//
+// EXPECT_TRUE(server.StatusIsOK());
+// ASSERT_FALSE(server.HasPendingRequest(port))
+// << "There are still pending requests " << "on port " << port;
+
+// Generates a nonfatal failure with a generic message.
+#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
+
+// Generates a fatal failure with a generic message.
+#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
+
+// Define this macro to 1 to omit the definition of FAIL(), which is a
+// generic name and clashes with some other libraries.
+#if !GTEST_DONT_DEFINE_FAIL
+#define FAIL() GTEST_FAIL()
+#endif
+
+// Generates a success with a generic message.
+#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
+
+// Define this macro to 1 to omit the definition of SUCCEED(), which
+// is a generic name and clashes with some other libraries.
+#if !GTEST_DONT_DEFINE_SUCCEED
+#define SUCCEED() GTEST_SUCCEED()
+#endif
+
+// Macros for testing exceptions.
+//
+// * {ASSERT|EXPECT}_THROW(statement, expected_exception):
+// Tests that the statement throws the expected exception.
+// * {ASSERT|EXPECT}_NO_THROW(statement):
+// Tests that the statement doesn't throw any exception.
+// * {ASSERT|EXPECT}_ANY_THROW(statement):
+// Tests that the statement throws an exception.
+
+#define EXPECT_THROW(statement, expected_exception) \
+ GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_NO_THROW(statement) \
+ GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_ANY_THROW(statement) \
+ GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
+#define ASSERT_THROW(statement, expected_exception) \
+ GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
+#define ASSERT_NO_THROW(statement) \
+ GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
+#define ASSERT_ANY_THROW(statement) \
+ GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
+
+// Boolean assertions. Condition can be either a Boolean expression or an
+// AssertionResult. For more information on how to use AssertionResult with
+// these macros see comments on that class.
+#define EXPECT_TRUE(condition) \
+ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
+ GTEST_NONFATAL_FAILURE_)
+#define EXPECT_FALSE(condition) \
+ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
+ GTEST_NONFATAL_FAILURE_)
+#define ASSERT_TRUE(condition) \
+ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
+ GTEST_FATAL_FAILURE_)
+#define ASSERT_FALSE(condition) \
+ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
+ GTEST_FATAL_FAILURE_)
+
+// Includes the auto-generated header that implements a family of
+// generic predicate assertion macros.
+#include <gtest/gtest_pred_impl.h>
+
+// Macros for testing equalities and inequalities.
+//
+// * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
+// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
+// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
+// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
+// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
+// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
+//
+// When they are not, Google Test prints both the tested expressions and
+// their actual values. The values must be compatible built-in types,
+// or you will get a compiler error. By "compatible" we mean that the
+// values can be compared by the respective operator.
+//
+// Note:
+//
+// 1. It is possible to make a user-defined type work with
+// {ASSERT|EXPECT}_??(), but that requires overloading the
+// comparison operators and is thus discouraged by the Google C++
+// Usage Guide. Therefore, you are advised to use the
+// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
+// equal.
+//
+// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
+// pointers (in particular, C strings). Therefore, if you use it
+// with two C strings, you are testing how their locations in memory
+// are related, not how their content is related. To compare two C
+// strings by content, use {ASSERT|EXPECT}_STR*().
+//
+// 3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
+// {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
+// what the actual value is when it fails, and similarly for the
+// other comparisons.
+//
+// 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
+// evaluate their arguments, which is undefined.
+//
+// 5. These macros evaluate their arguments exactly once.
+//
+// Examples:
+//
+// EXPECT_NE(5, Foo());
+// EXPECT_EQ(NULL, a_pointer);
+// ASSERT_LT(i, array_size);
+// ASSERT_GT(records.size(), 0) << "There is no record left.";
+
+#define EXPECT_EQ(expected, actual) \
+ EXPECT_PRED_FORMAT2(::testing::internal:: \
+ EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
+ expected, actual)
+#define EXPECT_NE(expected, actual) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
+#define EXPECT_LE(val1, val2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
+#define EXPECT_LT(val1, val2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
+#define EXPECT_GE(val1, val2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
+#define EXPECT_GT(val1, val2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
+
+#define ASSERT_EQ(expected, actual) \
+ ASSERT_PRED_FORMAT2(::testing::internal:: \
+ EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
+ expected, actual)
+#define ASSERT_NE(val1, val2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
+#define ASSERT_LE(val1, val2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
+#define ASSERT_LT(val1, val2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
+#define ASSERT_GE(val1, val2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
+#define ASSERT_GT(val1, val2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
+
+// C String Comparisons. All tests treat NULL and any non-NULL string
+// as different. Two NULLs are equal.
+//
+// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
+// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
+// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
+// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
+//
+// For wide or narrow string objects, you can use the
+// {ASSERT|EXPECT}_??() macros.
+//
+// Don't depend on the order in which the arguments are evaluated,
+// which is undefined.
+//
+// These macros evaluate their arguments exactly once.
+
+#define EXPECT_STREQ(expected, actual) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
+#define EXPECT_STRNE(s1, s2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
+#define EXPECT_STRCASEEQ(expected, actual) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
+#define EXPECT_STRCASENE(s1, s2)\
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
+
+#define ASSERT_STREQ(expected, actual) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
+#define ASSERT_STRNE(s1, s2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
+#define ASSERT_STRCASEEQ(expected, actual) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
+#define ASSERT_STRCASENE(s1, s2)\
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
+
+// Macros for comparing floating-point numbers.
+//
+// * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
+// Tests that two float values are almost equal.
+// * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
+// Tests that two double values are almost equal.
+// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
+// Tests that v1 and v2 are within the given distance to each other.
+//
+// Google Test uses ULP-based comparison to automatically pick a default
+// error bound that is appropriate for the operands. See the
+// FloatingPoint template class in gtest-internal.h if you are
+// interested in the implementation details.
+
+#define EXPECT_FLOAT_EQ(expected, actual)\
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
+ expected, actual)
+
+#define EXPECT_DOUBLE_EQ(expected, actual)\
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
+ expected, actual)
+
+#define ASSERT_FLOAT_EQ(expected, actual)\
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
+ expected, actual)
+
+#define ASSERT_DOUBLE_EQ(expected, actual)\
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
+ expected, actual)
+
+#define EXPECT_NEAR(val1, val2, abs_error)\
+ EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
+ val1, val2, abs_error)
+
+#define ASSERT_NEAR(val1, val2, abs_error)\
+ ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
+ val1, val2, abs_error)
+
+// These predicate format functions work on floating-point values, and
+// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
+//
+// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
+
+// Asserts that val1 is less than, or almost equal to, val2. Fails
+// otherwise. In particular, it fails if either val1 or val2 is NaN.
+GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
+ float val1, float val2);
+GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
+ double val1, double val2);
+
+
+#if GTEST_OS_WINDOWS
+
+// Macros that test for HRESULT failure and success, these are only useful
+// on Windows, and rely on Windows SDK macros and APIs to compile.
+//
+// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
+//
+// When expr unexpectedly fails or succeeds, Google Test prints the
+// expected result and the actual result with both a human-readable
+// string representation of the error, if available, as well as the
+// hex result code.
+#define EXPECT_HRESULT_SUCCEEDED(expr) \
+ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
+
+#define ASSERT_HRESULT_SUCCEEDED(expr) \
+ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
+
+#define EXPECT_HRESULT_FAILED(expr) \
+ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
+
+#define ASSERT_HRESULT_FAILED(expr) \
+ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
+
+#endif // GTEST_OS_WINDOWS
+
+// Macros that execute statement and check that it doesn't generate new fatal
+// failures in the current thread.
+//
+// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
+//
+// Examples:
+//
+// EXPECT_NO_FATAL_FAILURE(Process());
+// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
+//
+#define ASSERT_NO_FATAL_FAILURE(statement) \
+ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
+#define EXPECT_NO_FATAL_FAILURE(statement) \
+ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
+
+// Causes a trace (including the source file path, the current line
+// number, and the given message) to be included in every test failure
+// message generated by code in the current scope. The effect is
+// undone when the control leaves the current scope.
+//
+// The message argument can be anything streamable to std::ostream.
+//
+// In the implementation, we include the current line number as part
+// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
+// to appear in the same block - as long as they are on different
+// lines.
+#define SCOPED_TRACE(message) \
+ ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
+ __FILE__, __LINE__, ::testing::Message() << (message))
+
+namespace internal {
+
+// This template is declared, but intentionally undefined.
+template <typename T1, typename T2>
+struct StaticAssertTypeEqHelper;
+
+template <typename T>
+struct StaticAssertTypeEqHelper<T, T> {};
+
+} // namespace internal
+
+// Compile-time assertion for type equality.
+// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
+// the same type. The value it returns is not interesting.
+//
+// Instead of making StaticAssertTypeEq a class template, we make it a
+// function template that invokes a helper class template. This
+// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
+// defining objects of that type.
+//
+// CAVEAT:
+//
+// When used inside a method of a class template,
+// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
+// instantiated. For example, given:
+//
+// template <typename T> class Foo {
+// public:
+// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
+// };
+//
+// the code:
+//
+// void Test1() { Foo<bool> foo; }
+//
+// will NOT generate a compiler error, as Foo<bool>::Bar() is never
+// actually instantiated. Instead, you need:
+//
+// void Test2() { Foo<bool> foo; foo.Bar(); }
+//
+// to cause a compiler error.
+template <typename T1, typename T2>
+bool StaticAssertTypeEq() {
+ internal::StaticAssertTypeEqHelper<T1, T2>();
+ return true;
+}
+
+// Defines a test.
+//
+// The first parameter is the name of the test case, and the second
+// parameter is the name of the test within the test case.
+//
+// The convention is to end the test case name with "Test". For
+// example, a test case for the Foo class can be named FooTest.
+//
+// The user should put his test code between braces after using this
+// macro. Example:
+//
+// TEST(FooTest, InitializesCorrectly) {
+// Foo foo;
+// EXPECT_TRUE(foo.StatusIsOK());
+// }
+
+// Note that we call GetTestTypeId() instead of GetTypeId<
+// ::testing::Test>() here to get the type ID of testing::Test. This
+// is to work around a suspected linker bug when using Google Test as
+// a framework on Mac OS X. The bug causes GetTypeId<
+// ::testing::Test>() to return different values depending on whether
+// the call is from the Google Test framework itself or from user test
+// code. GetTestTypeId() is guaranteed to always return the same
+// value, as it always calls GetTypeId<>() from the Google Test
+// framework.
+#define GTEST_TEST(test_case_name, test_name)\
+ GTEST_TEST_(test_case_name, test_name, \
+ ::testing::Test, ::testing::internal::GetTestTypeId())
+
+// Define this macro to 1 to omit the definition of TEST(), which
+// is a generic name and clashes with some other libraries.
+#if !GTEST_DONT_DEFINE_TEST
+#define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
+#endif
+
+// Defines a test that uses a test fixture.
+//
+// The first parameter is the name of the test fixture class, which
+// also doubles as the test case name. The second parameter is the
+// name of the test within the test case.
+//
+// A test fixture class must be declared earlier. The user should put
+// his test code between braces after using this macro. Example:
+//
+// class FooTest : public testing::Test {
+// protected:
+// virtual void SetUp() { b_.AddElement(3); }
+//
+// Foo a_;
+// Foo b_;
+// };
+//
+// TEST_F(FooTest, InitializesCorrectly) {
+// EXPECT_TRUE(a_.StatusIsOK());
+// }
+//
+// TEST_F(FooTest, ReturnsElementCountCorrectly) {
+// EXPECT_EQ(0, a_.size());
+// EXPECT_EQ(1, b_.size());
+// }
+
+#define TEST_F(test_fixture, test_name)\
+ GTEST_TEST_(test_fixture, test_name, test_fixture, \
+ ::testing::internal::GetTypeId<test_fixture>())
+
+// Use this macro in main() to run all tests. It returns 0 if all
+// tests are successful, or 1 otherwise.
+//
+// RUN_ALL_TESTS() should be invoked after the command line has been
+// parsed by InitGoogleTest().
+
+#define RUN_ALL_TESTS()\
+ (::testing::UnitTest::GetInstance()->Run())
+
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_pred_impl.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_pred_impl.h
new file mode 100644
index 0000000..e1e2f8c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_pred_impl.h
@@ -0,0 +1,368 @@
+// Copyright 2006, 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 file is AUTOMATICALLY GENERATED on 10/02/2008 by command
+// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
+//
+// Implements a family of generic predicate assertion macros.
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
+#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
+
+// Makes sure this header is not included before gtest.h.
+#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
+#error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
+#endif // GTEST_INCLUDE_GTEST_GTEST_H_
+
+// This header implements a family of generic predicate assertion
+// macros:
+//
+// ASSERT_PRED_FORMAT1(pred_format, v1)
+// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
+// ...
+//
+// where pred_format is a function or functor that takes n (in the
+// case of ASSERT_PRED_FORMATn) values and their source expression
+// text, and returns a testing::AssertionResult. See the definition
+// of ASSERT_EQ in gtest.h for an example.
+//
+// If you don't care about formatting, you can use the more
+// restrictive version:
+//
+// ASSERT_PRED1(pred, v1)
+// ASSERT_PRED2(pred, v1, v2)
+// ...
+//
+// where pred is an n-ary function or functor that returns bool,
+// and the values v1, v2, ..., must support the << operator for
+// streaming to std::ostream.
+//
+// We also define the EXPECT_* variations.
+//
+// For now we only support predicates whose arity is at most 5.
+// Please email googletestframework@googlegroups.com if you need
+// support for higher arities.
+
+// GTEST_ASSERT_ is the basic statement to which all of the assertions
+// in this file reduce. Don't use this in your code.
+
+#define GTEST_ASSERT_(expression, on_failure) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (const ::testing::AssertionResult gtest_ar = (expression)) \
+ ; \
+ else \
+ on_failure(gtest_ar.failure_message())
+
+
+// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
+// this in your code.
+template <typename Pred,
+ typename T1>
+AssertionResult AssertPred1Helper(const char* pred_text,
+ const char* e1,
+ Pred pred,
+ const T1& v1) {
+ if (pred(v1)) return AssertionSuccess();
+
+ Message msg;
+ msg << pred_text << "("
+ << e1 << ") evaluates to false, where"
+ << "\n" << e1 << " evaluates to " << v1;
+ return AssertionFailure(msg);
+}
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
+// Don't use this in your code.
+#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
+ GTEST_ASSERT_(pred_format(#v1, v1),\
+ on_failure)
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
+// this in your code.
+#define GTEST_PRED1_(pred, v1, on_failure)\
+ GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
+ #v1, \
+ pred, \
+ v1), on_failure)
+
+// Unary predicate assertion macros.
+#define EXPECT_PRED_FORMAT1(pred_format, v1) \
+ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_PRED1(pred, v1) \
+ GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
+#define ASSERT_PRED_FORMAT1(pred_format, v1) \
+ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
+#define ASSERT_PRED1(pred, v1) \
+ GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
+
+
+
+// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
+// this in your code.
+template <typename Pred,
+ typename T1,
+ typename T2>
+AssertionResult AssertPred2Helper(const char* pred_text,
+ const char* e1,
+ const char* e2,
+ Pred pred,
+ const T1& v1,
+ const T2& v2) {
+ if (pred(v1, v2)) return AssertionSuccess();
+
+ Message msg;
+ msg << pred_text << "("
+ << e1 << ", "
+ << e2 << ") evaluates to false, where"
+ << "\n" << e1 << " evaluates to " << v1
+ << "\n" << e2 << " evaluates to " << v2;
+ return AssertionFailure(msg);
+}
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
+// Don't use this in your code.
+#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
+ GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
+ on_failure)
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
+// this in your code.
+#define GTEST_PRED2_(pred, v1, v2, on_failure)\
+ GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
+ #v1, \
+ #v2, \
+ pred, \
+ v1, \
+ v2), on_failure)
+
+// Binary predicate assertion macros.
+#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
+ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_PRED2(pred, v1, v2) \
+ GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
+#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
+ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
+#define ASSERT_PRED2(pred, v1, v2) \
+ GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
+
+
+
+// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
+// this in your code.
+template <typename Pred,
+ typename T1,
+ typename T2,
+ typename T3>
+AssertionResult AssertPred3Helper(const char* pred_text,
+ const char* e1,
+ const char* e2,
+ const char* e3,
+ Pred pred,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3) {
+ if (pred(v1, v2, v3)) return AssertionSuccess();
+
+ Message msg;
+ msg << pred_text << "("
+ << e1 << ", "
+ << e2 << ", "
+ << e3 << ") evaluates to false, where"
+ << "\n" << e1 << " evaluates to " << v1
+ << "\n" << e2 << " evaluates to " << v2
+ << "\n" << e3 << " evaluates to " << v3;
+ return AssertionFailure(msg);
+}
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
+// Don't use this in your code.
+#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
+ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\
+ on_failure)
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
+// this in your code.
+#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
+ GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
+ #v1, \
+ #v2, \
+ #v3, \
+ pred, \
+ v1, \
+ v2, \
+ v3), on_failure)
+
+// Ternary predicate assertion macros.
+#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
+ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_PRED3(pred, v1, v2, v3) \
+ GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
+#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
+ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
+#define ASSERT_PRED3(pred, v1, v2, v3) \
+ GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
+
+
+
+// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
+// this in your code.
+template <typename Pred,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4>
+AssertionResult AssertPred4Helper(const char* pred_text,
+ const char* e1,
+ const char* e2,
+ const char* e3,
+ const char* e4,
+ Pred pred,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4) {
+ if (pred(v1, v2, v3, v4)) return AssertionSuccess();
+
+ Message msg;
+ msg << pred_text << "("
+ << e1 << ", "
+ << e2 << ", "
+ << e3 << ", "
+ << e4 << ") evaluates to false, where"
+ << "\n" << e1 << " evaluates to " << v1
+ << "\n" << e2 << " evaluates to " << v2
+ << "\n" << e3 << " evaluates to " << v3
+ << "\n" << e4 << " evaluates to " << v4;
+ return AssertionFailure(msg);
+}
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
+// Don't use this in your code.
+#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
+ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
+ on_failure)
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
+// this in your code.
+#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
+ GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
+ #v1, \
+ #v2, \
+ #v3, \
+ #v4, \
+ pred, \
+ v1, \
+ v2, \
+ v3, \
+ v4), on_failure)
+
+// 4-ary predicate assertion macros.
+#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
+ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
+ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
+#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
+ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
+#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
+ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
+
+
+
+// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
+// this in your code.
+template <typename Pred,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5>
+AssertionResult AssertPred5Helper(const char* pred_text,
+ const char* e1,
+ const char* e2,
+ const char* e3,
+ const char* e4,
+ const char* e5,
+ Pred pred,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4,
+ const T5& v5) {
+ if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
+
+ Message msg;
+ msg << pred_text << "("
+ << e1 << ", "
+ << e2 << ", "
+ << e3 << ", "
+ << e4 << ", "
+ << e5 << ") evaluates to false, where"
+ << "\n" << e1 << " evaluates to " << v1
+ << "\n" << e2 << " evaluates to " << v2
+ << "\n" << e3 << " evaluates to " << v3
+ << "\n" << e4 << " evaluates to " << v4
+ << "\n" << e5 << " evaluates to " << v5;
+ return AssertionFailure(msg);
+}
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
+// Don't use this in your code.
+#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
+ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
+ on_failure)
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
+// this in your code.
+#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
+ GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
+ #v1, \
+ #v2, \
+ #v3, \
+ #v4, \
+ #v5, \
+ pred, \
+ v1, \
+ v2, \
+ v3, \
+ v4, \
+ v5), on_failure)
+
+// 5-ary predicate assertion macros.
+#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
+ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
+ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
+#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
+ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
+#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
+ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
+
+
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_prod.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_prod.h
new file mode 100644
index 0000000..da80ddc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/gtest_prod.h
@@ -0,0 +1,58 @@
+// Copyright 2006, 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: wan@google.com (Zhanyong Wan)
+//
+// Google C++ Testing Framework definitions useful in production code.
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
+#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
+
+// When you need to test the private or protected members of a class,
+// use the FRIEND_TEST macro to declare your tests as friends of the
+// class. For example:
+//
+// class MyClass {
+// private:
+// void MyMethod();
+// FRIEND_TEST(MyClassTest, MyMethod);
+// };
+//
+// class MyClassTest : public testing::Test {
+// // ...
+// };
+//
+// TEST_F(MyClassTest, MyMethod) {
+// // Can call MyClass::MyMethod() here.
+// }
+
+#define FRIEND_TEST(test_case_name, test_name)\
+friend class test_case_name##_##test_name##_Test
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-death-test-internal.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-death-test-internal.h
new file mode 100644
index 0000000..e433084
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-death-test-internal.h
@@ -0,0 +1,275 @@
+// Copyright 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.
+//
+// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file defines internal utilities needed for implementing
+// death tests. They are subject to change without notice.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
+
+#include <gtest/internal/gtest-internal.h>
+
+namespace testing {
+namespace internal {
+
+GTEST_DECLARE_string_(internal_run_death_test);
+
+// Names of the flags (needed for parsing Google Test flags).
+const char kDeathTestStyleFlag[] = "death_test_style";
+const char kDeathTestUseFork[] = "death_test_use_fork";
+const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
+
+#if GTEST_HAS_DEATH_TEST
+
+// DeathTest is a class that hides much of the complexity of the
+// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
+// returns a concrete class that depends on the prevailing death test
+// style, as defined by the --gtest_death_test_style and/or
+// --gtest_internal_run_death_test flags.
+
+// In describing the results of death tests, these terms are used with
+// the corresponding definitions:
+//
+// exit status: The integer exit information in the format specified
+// by wait(2)
+// exit code: The integer code passed to exit(3), _exit(2), or
+// returned from main()
+class GTEST_API_ DeathTest {
+ public:
+ // Create returns false if there was an error determining the
+ // appropriate action to take for the current death test; for example,
+ // if the gtest_death_test_style flag is set to an invalid value.
+ // The LastMessage method will return a more detailed message in that
+ // case. Otherwise, the DeathTest pointer pointed to by the "test"
+ // argument is set. If the death test should be skipped, the pointer
+ // is set to NULL; otherwise, it is set to the address of a new concrete
+ // DeathTest object that controls the execution of the current test.
+ static bool Create(const char* statement, const RE* regex,
+ const char* file, int line, DeathTest** test);
+ DeathTest();
+ virtual ~DeathTest() { }
+
+ // A helper class that aborts a death test when it's deleted.
+ class ReturnSentinel {
+ public:
+ explicit ReturnSentinel(DeathTest* test) : test_(test) { }
+ ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
+ private:
+ DeathTest* const test_;
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
+ } GTEST_ATTRIBUTE_UNUSED_;
+
+ // An enumeration of possible roles that may be taken when a death
+ // test is encountered. EXECUTE means that the death test logic should
+ // be executed immediately. OVERSEE means that the program should prepare
+ // the appropriate environment for a child process to execute the death
+ // test, then wait for it to complete.
+ enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
+
+ // An enumeration of the two reasons that a test might be aborted.
+ enum AbortReason { TEST_ENCOUNTERED_RETURN_STATEMENT, TEST_DID_NOT_DIE };
+
+ // Assumes one of the above roles.
+ virtual TestRole AssumeRole() = 0;
+
+ // Waits for the death test to finish and returns its status.
+ virtual int Wait() = 0;
+
+ // Returns true if the death test passed; that is, the test process
+ // exited during the test, its exit status matches a user-supplied
+ // predicate, and its stderr output matches a user-supplied regular
+ // expression.
+ // The user-supplied predicate may be a macro expression rather
+ // than a function pointer or functor, or else Wait and Passed could
+ // be combined.
+ virtual bool Passed(bool exit_status_ok) = 0;
+
+ // Signals that the death test did not die as expected.
+ virtual void Abort(AbortReason reason) = 0;
+
+ // Returns a human-readable outcome message regarding the outcome of
+ // the last death test.
+ static const char* LastMessage();
+
+ static void set_last_death_test_message(const String& message);
+
+ private:
+ // A string containing a description of the outcome of the last death test.
+ static String last_death_test_message_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
+};
+
+// Factory interface for death tests. May be mocked out for testing.
+class DeathTestFactory {
+ public:
+ virtual ~DeathTestFactory() { }
+ virtual bool Create(const char* statement, const RE* regex,
+ const char* file, int line, DeathTest** test) = 0;
+};
+
+// A concrete DeathTestFactory implementation for normal use.
+class DefaultDeathTestFactory : public DeathTestFactory {
+ public:
+ virtual bool Create(const char* statement, const RE* regex,
+ const char* file, int line, DeathTest** test);
+};
+
+// Returns true if exit_status describes a process that was terminated
+// by a signal, or exited normally with a nonzero exit code.
+GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
+
+// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
+// ASSERT_EXIT*, and EXPECT_EXIT*.
+#define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (::testing::internal::AlwaysTrue()) { \
+ const ::testing::internal::RE& gtest_regex = (regex); \
+ ::testing::internal::DeathTest* gtest_dt; \
+ if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
+ __FILE__, __LINE__, &gtest_dt)) { \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
+ } \
+ if (gtest_dt != NULL) { \
+ ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
+ gtest_dt_ptr(gtest_dt); \
+ switch (gtest_dt->AssumeRole()) { \
+ case ::testing::internal::DeathTest::OVERSEE_TEST: \
+ if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
+ } \
+ break; \
+ case ::testing::internal::DeathTest::EXECUTE_TEST: { \
+ ::testing::internal::DeathTest::ReturnSentinel \
+ gtest_sentinel(gtest_dt); \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
+ break; \
+ } \
+ } \
+ } \
+ } else \
+ GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
+ fail(::testing::internal::DeathTest::LastMessage())
+// The symbol "fail" here expands to something into which a message
+// can be streamed.
+
+// A class representing the parsed contents of the
+// --gtest_internal_run_death_test flag, as it existed when
+// RUN_ALL_TESTS was called.
+class InternalRunDeathTestFlag {
+ public:
+ InternalRunDeathTestFlag(const String& a_file,
+ int a_line,
+ int an_index,
+ int a_write_fd)
+ : file_(a_file), line_(a_line), index_(an_index),
+ write_fd_(a_write_fd) {}
+
+ ~InternalRunDeathTestFlag() {
+ if (write_fd_ >= 0)
+ posix::Close(write_fd_);
+ }
+
+ String file() const { return file_; }
+ int line() const { return line_; }
+ int index() const { return index_; }
+ int write_fd() const { return write_fd_; }
+
+ private:
+ String file_;
+ int line_;
+ int index_;
+ int write_fd_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
+};
+
+// Returns a newly created InternalRunDeathTestFlag object with fields
+// initialized from the GTEST_FLAG(internal_run_death_test) flag if
+// the flag is specified; otherwise returns NULL.
+InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
+
+#else // GTEST_HAS_DEATH_TEST
+
+// This macro is used for implementing macros such as
+// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
+// death tests are not supported. Those macros must compile on such systems
+// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
+// systems that support death tests. This allows one to write such a macro
+// on a system that does not support death tests and be sure that it will
+// compile on a death-test supporting system.
+//
+// Parameters:
+// statement - A statement that a macro such as EXPECT_DEATH would test
+// for program termination. This macro has to make sure this
+// statement is compiled but not executed, to ensure that
+// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
+// parameter iff EXPECT_DEATH compiles with it.
+// regex - A regex that a macro such as EXPECT_DEATH would use to test
+// the output of statement. This parameter has to be
+// compiled but not evaluated by this macro, to ensure that
+// this macro only accepts expressions that a macro such as
+// EXPECT_DEATH would accept.
+// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
+// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
+// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
+// compile inside functions where ASSERT_DEATH doesn't
+// compile.
+//
+// The branch that has an always false condition is used to ensure that
+// statement and regex are compiled (and thus syntactically correct) but
+// never executed. The unreachable code macro protects the terminator
+// statement from generating an 'unreachable code' warning in case
+// statement unconditionally returns or throws. The Message constructor at
+// the end allows the syntax of streaming additional messages into the
+// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
+#define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (::testing::internal::AlwaysTrue()) { \
+ GTEST_LOG_(WARNING) \
+ << "Death tests are not supported on this platform.\n" \
+ << "Statement '" #statement "' cannot be verified."; \
+ } else if (::testing::internal::AlwaysFalse()) { \
+ ::testing::internal::RE::PartialMatch(".*", (regex)); \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ terminator; \
+ } else \
+ ::testing::Message()
+
+#endif // GTEST_HAS_DEATH_TEST
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-filepath.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-filepath.h
new file mode 100644
index 0000000..4b76d79
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-filepath.h
@@ -0,0 +1,210 @@
+// Copyright 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.
+//
+// Author: keith.ray@gmail.com (Keith Ray)
+//
+// Google Test filepath utilities
+//
+// This header file declares classes and functions used internally by
+// Google Test. They are subject to change without notice.
+//
+// This file is #included in <gtest/internal/gtest-internal.h>.
+// Do not include this header file separately!
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
+
+#include <gtest/internal/gtest-string.h>
+
+namespace testing {
+namespace internal {
+
+// FilePath - a class for file and directory pathname manipulation which
+// handles platform-specific conventions (like the pathname separator).
+// Used for helper functions for naming files in a directory for xml output.
+// Except for Set methods, all methods are const or static, which provides an
+// "immutable value object" -- useful for peace of mind.
+// A FilePath with a value ending in a path separator ("like/this/") represents
+// a directory, otherwise it is assumed to represent a file. In either case,
+// it may or may not represent an actual file or directory in the file system.
+// Names are NOT checked for syntax correctness -- no checking for illegal
+// characters, malformed paths, etc.
+
+class GTEST_API_ FilePath {
+ public:
+ FilePath() : pathname_("") { }
+ FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
+
+ explicit FilePath(const char* pathname) : pathname_(pathname) {
+ Normalize();
+ }
+
+ explicit FilePath(const String& pathname) : pathname_(pathname) {
+ Normalize();
+ }
+
+ FilePath& operator=(const FilePath& rhs) {
+ Set(rhs);
+ return *this;
+ }
+
+ void Set(const FilePath& rhs) {
+ pathname_ = rhs.pathname_;
+ }
+
+ String ToString() const { return pathname_; }
+ const char* c_str() const { return pathname_.c_str(); }
+
+ // Returns the current working directory, or "" if unsuccessful.
+ static FilePath GetCurrentDir();
+
+ // Given directory = "dir", base_name = "test", number = 0,
+ // extension = "xml", returns "dir/test.xml". If number is greater
+ // than zero (e.g., 12), returns "dir/test_12.xml".
+ // On Windows platform, uses \ as the separator rather than /.
+ static FilePath MakeFileName(const FilePath& directory,
+ const FilePath& base_name,
+ int number,
+ const char* extension);
+
+ // Given directory = "dir", relative_path = "test.xml",
+ // returns "dir/test.xml".
+ // On Windows, uses \ as the separator rather than /.
+ static FilePath ConcatPaths(const FilePath& directory,
+ const FilePath& relative_path);
+
+ // Returns a pathname for a file that does not currently exist. The pathname
+ // will be directory/base_name.extension or
+ // directory/base_name_<number>.extension if directory/base_name.extension
+ // already exists. The number will be incremented until a pathname is found
+ // that does not already exist.
+ // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
+ // There could be a race condition if two or more processes are calling this
+ // function at the same time -- they could both pick the same filename.
+ static FilePath GenerateUniqueFileName(const FilePath& directory,
+ const FilePath& base_name,
+ const char* extension);
+
+ // Returns true iff the path is NULL or "".
+ bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; }
+
+ // If input name has a trailing separator character, removes it and returns
+ // the name, otherwise return the name string unmodified.
+ // On Windows platform, uses \ as the separator, other platforms use /.
+ FilePath RemoveTrailingPathSeparator() const;
+
+ // Returns a copy of the FilePath with the directory part removed.
+ // Example: FilePath("path/to/file").RemoveDirectoryName() returns
+ // FilePath("file"). If there is no directory part ("just_a_file"), it returns
+ // the FilePath unmodified. If there is no file part ("just_a_dir/") it
+ // returns an empty FilePath ("").
+ // On Windows platform, '\' is the path separator, otherwise it is '/'.
+ FilePath RemoveDirectoryName() const;
+
+ // RemoveFileName returns the directory path with the filename removed.
+ // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
+ // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
+ // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
+ // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
+ // On Windows platform, '\' is the path separator, otherwise it is '/'.
+ FilePath RemoveFileName() const;
+
+ // Returns a copy of the FilePath with the case-insensitive extension removed.
+ // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
+ // FilePath("dir/file"). If a case-insensitive extension is not
+ // found, returns a copy of the original FilePath.
+ FilePath RemoveExtension(const char* extension) const;
+
+ // Creates directories so that path exists. Returns true if successful or if
+ // the directories already exist; returns false if unable to create
+ // directories for any reason. Will also return false if the FilePath does
+ // not represent a directory (that is, it doesn't end with a path separator).
+ bool CreateDirectoriesRecursively() const;
+
+ // Create the directory so that path exists. Returns true if successful or
+ // if the directory already exists; returns false if unable to create the
+ // directory for any reason, including if the parent directory does not
+ // exist. Not named "CreateDirectory" because that's a macro on Windows.
+ bool CreateFolder() const;
+
+ // Returns true if FilePath describes something in the file-system,
+ // either a file, directory, or whatever, and that something exists.
+ bool FileOrDirectoryExists() const;
+
+ // Returns true if pathname describes a directory in the file-system
+ // that exists.
+ bool DirectoryExists() const;
+
+ // Returns true if FilePath ends with a path separator, which indicates that
+ // it is intended to represent a directory. Returns false otherwise.
+ // This does NOT check that a directory (or file) actually exists.
+ bool IsDirectory() const;
+
+ // Returns true if pathname describes a root directory. (Windows has one
+ // root directory per disk drive.)
+ bool IsRootDirectory() const;
+
+ // Returns true if pathname describes an absolute path.
+ bool IsAbsolutePath() const;
+
+ private:
+ // Replaces multiple consecutive separators with a single separator.
+ // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
+ // redundancies that might be in a pathname involving "." or "..".
+ //
+ // A pathname with multiple consecutive separators may occur either through
+ // user error or as a result of some scripts or APIs that generate a pathname
+ // with a trailing separator. On other platforms the same API or script
+ // may NOT generate a pathname with a trailing "/". Then elsewhere that
+ // pathname may have another "/" and pathname components added to it,
+ // without checking for the separator already being there.
+ // The script language and operating system may allow paths like "foo//bar"
+ // but some of the functions in FilePath will not handle that correctly. In
+ // particular, RemoveTrailingPathSeparator() only removes one separator, and
+ // it is called in CreateDirectoriesRecursively() assuming that it will change
+ // a pathname from directory syntax (trailing separator) to filename syntax.
+ //
+ // On Windows this method also replaces the alternate path separator '/' with
+ // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
+ // "bar\\foo".
+
+ void Normalize();
+
+ // Returns a pointer to the last occurence of a valid path separator in
+ // the FilePath. On Windows, for example, both '/' and '\' are valid path
+ // separators. Returns NULL if no path separator was found.
+ const char* FindLastPathSeparator() const;
+
+ String pathname_;
+}; // class FilePath
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-internal.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-internal.h
new file mode 100644
index 0000000..31a66e9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-internal.h
@@ -0,0 +1,923 @@
+// Copyright 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.
+//
+// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file declares functions and macros used internally by
+// Google Test. They are subject to change without notice.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
+
+#include <gtest/internal/gtest-port.h>
+
+#if GTEST_OS_LINUX
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#endif // GTEST_OS_LINUX
+
+#include <ctype.h>
+#include <string.h>
+#include <iomanip>
+#include <limits>
+#include <set>
+
+#include <gtest/internal/gtest-string.h>
+#include <gtest/internal/gtest-filepath.h>
+#include <gtest/internal/gtest-type-util.h>
+
+// Due to C++ preprocessor weirdness, we need double indirection to
+// concatenate two tokens when one of them is __LINE__. Writing
+//
+// foo ## __LINE__
+//
+// will result in the token foo__LINE__, instead of foo followed by
+// the current line number. For more details, see
+// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
+#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
+#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
+
+// Google Test defines the testing::Message class to allow construction of
+// test messages via the << operator. The idea is that anything
+// streamable to std::ostream can be streamed to a testing::Message.
+// This allows a user to use his own types in Google Test assertions by
+// overloading the << operator.
+//
+// util/gtl/stl_logging-inl.h overloads << for STL containers. These
+// overloads cannot be defined in the std namespace, as that will be
+// undefined behavior. Therefore, they are defined in the global
+// namespace instead.
+//
+// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
+// overloads are visible in either the std namespace or the global
+// namespace, but not other namespaces, including the testing
+// namespace which Google Test's Message class is in.
+//
+// To allow STL containers (and other types that has a << operator
+// defined in the global namespace) to be used in Google Test assertions,
+// testing::Message must access the custom << operator from the global
+// namespace. Hence this helper function.
+//
+// Note: Jeffrey Yasskin suggested an alternative fix by "using
+// ::operator<<;" in the definition of Message's operator<<. That fix
+// doesn't require a helper function, but unfortunately doesn't
+// compile with MSVC.
+template <typename T>
+inline void GTestStreamToHelper(std::ostream* os, const T& val) {
+ *os << val;
+}
+
+namespace testing {
+
+// Forward declaration of classes.
+
+class AssertionResult; // Result of an assertion.
+class Message; // Represents a failure message.
+class Test; // Represents a test.
+class TestInfo; // Information about a test.
+class TestPartResult; // Result of a test part.
+class UnitTest; // A collection of test cases.
+
+namespace internal {
+
+struct TraceInfo; // Information about a trace point.
+class ScopedTrace; // Implements scoped trace.
+class TestInfoImpl; // Opaque implementation of TestInfo
+class UnitTestImpl; // Opaque implementation of UnitTest
+
+// How many times InitGoogleTest() has been called.
+extern int g_init_gtest_count;
+
+// The text used in failure messages to indicate the start of the
+// stack trace.
+GTEST_API_ extern const char kStackTraceMarker[];
+
+// A secret type that Google Test users don't know about. It has no
+// definition on purpose. Therefore it's impossible to create a
+// Secret object, which is what we want.
+class Secret;
+
+// Two overloaded helpers for checking at compile time whether an
+// expression is a null pointer literal (i.e. NULL or any 0-valued
+// compile-time integral constant). Their return values have
+// different sizes, so we can use sizeof() to test which version is
+// picked by the compiler. These helpers have no implementations, as
+// we only need their signatures.
+//
+// Given IsNullLiteralHelper(x), the compiler will pick the first
+// version if x can be implicitly converted to Secret*, and pick the
+// second version otherwise. Since Secret is a secret and incomplete
+// type, the only expression a user can write that has type Secret* is
+// a null pointer literal. Therefore, we know that x is a null
+// pointer literal if and only if the first version is picked by the
+// compiler.
+char IsNullLiteralHelper(Secret* p);
+char (&IsNullLiteralHelper(...))[2]; // NOLINT
+
+// A compile-time bool constant that is true if and only if x is a
+// null pointer literal (i.e. NULL or any 0-valued compile-time
+// integral constant).
+#ifdef GTEST_ELLIPSIS_NEEDS_POD_
+// We lose support for NULL detection where the compiler doesn't like
+// passing non-POD classes through ellipsis (...).
+#define GTEST_IS_NULL_LITERAL_(x) false
+#else
+#define GTEST_IS_NULL_LITERAL_(x) \
+ (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
+#endif // GTEST_ELLIPSIS_NEEDS_POD_
+
+// Appends the user-supplied message to the Google-Test-generated message.
+GTEST_API_ String AppendUserMessage(const String& gtest_msg,
+ const Message& user_msg);
+
+// A helper class for creating scoped traces in user programs.
+class GTEST_API_ ScopedTrace {
+ public:
+ // The c'tor pushes the given source file location and message onto
+ // a trace stack maintained by Google Test.
+ ScopedTrace(const char* file, int line, const Message& message);
+
+ // The d'tor pops the info pushed by the c'tor.
+ //
+ // Note that the d'tor is not virtual in order to be efficient.
+ // Don't inherit from ScopedTrace!
+ ~ScopedTrace();
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
+} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
+ // c'tor and d'tor. Therefore it doesn't
+ // need to be used otherwise.
+
+// Converts a streamable value to a String. A NULL pointer is
+// converted to "(null)". When the input value is a ::string,
+// ::std::string, ::wstring, or ::std::wstring object, each NUL
+// character in it is replaced with "\\0".
+// Declared here but defined in gtest.h, so that it has access
+// to the definition of the Message class, required by the ARM
+// compiler.
+template <typename T>
+String StreamableToString(const T& streamable);
+
+// Formats a value to be used in a failure message.
+
+#ifdef GTEST_NEEDS_IS_POINTER_
+
+// These are needed as the Nokia Symbian and IBM XL C/C++ compilers
+// cannot decide between const T& and const T* in a function template.
+// These compilers _can_ decide between class template specializations
+// for T and T*, so a tr1::type_traits-like is_pointer works, and we
+// can overload on that.
+
+// This overload makes sure that all pointers (including
+// those to char or wchar_t) are printed as raw pointers.
+template <typename T>
+inline String FormatValueForFailureMessage(internal::true_type /*dummy*/,
+ T* pointer) {
+ return StreamableToString(static_cast<const void*>(pointer));
+}
+
+template <typename T>
+inline String FormatValueForFailureMessage(internal::false_type /*dummy*/,
+ const T& value) {
+ return StreamableToString(value);
+}
+
+template <typename T>
+inline String FormatForFailureMessage(const T& value) {
+ return FormatValueForFailureMessage(
+ typename internal::is_pointer<T>::type(), value);
+}
+
+#else
+
+// These are needed as the above solution using is_pointer has the
+// limitation that T cannot be a type without external linkage, when
+// compiled using MSVC.
+
+template <typename T>
+inline String FormatForFailureMessage(const T& value) {
+ return StreamableToString(value);
+}
+
+// This overload makes sure that all pointers (including
+// those to char or wchar_t) are printed as raw pointers.
+template <typename T>
+inline String FormatForFailureMessage(T* pointer) {
+ return StreamableToString(static_cast<const void*>(pointer));
+}
+
+#endif // GTEST_NEEDS_IS_POINTER_
+
+// These overloaded versions handle narrow and wide characters.
+GTEST_API_ String FormatForFailureMessage(char ch);
+GTEST_API_ String FormatForFailureMessage(wchar_t wchar);
+
+// When this operand is a const char* or char*, and the other operand
+// is a ::std::string or ::string, we print this operand as a C string
+// rather than a pointer. We do the same for wide strings.
+
+// This internal macro is used to avoid duplicated code.
+#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\
+inline String FormatForComparisonFailureMessage(\
+ operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
+ return operand1_printer(str);\
+}\
+inline String FormatForComparisonFailureMessage(\
+ const operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
+ return operand1_printer(str);\
+}
+
+GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
+#if GTEST_HAS_STD_WSTRING
+GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
+#endif // GTEST_HAS_STD_WSTRING
+
+#if GTEST_HAS_GLOBAL_STRING
+GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
+#endif // GTEST_HAS_GLOBAL_STRING
+#if GTEST_HAS_GLOBAL_WSTRING
+GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
+#endif // GTEST_HAS_GLOBAL_WSTRING
+
+#undef GTEST_FORMAT_IMPL_
+
+// Constructs and returns the message for an equality assertion
+// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
+//
+// The first four parameters are the expressions used in the assertion
+// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
+// where foo is 5 and bar is 6, we have:
+//
+// expected_expression: "foo"
+// actual_expression: "bar"
+// expected_value: "5"
+// actual_value: "6"
+//
+// The ignoring_case parameter is true iff the assertion is a
+// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
+// be inserted into the message.
+GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
+ const char* actual_expression,
+ const String& expected_value,
+ const String& actual_value,
+ bool ignoring_case);
+
+// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
+GTEST_API_ String GetBoolAssertionFailureMessage(
+ const AssertionResult& assertion_result,
+ const char* expression_text,
+ const char* actual_predicate_value,
+ const char* expected_predicate_value);
+
+// This template class represents an IEEE floating-point number
+// (either single-precision or double-precision, depending on the
+// template parameters).
+//
+// The purpose of this class is to do more sophisticated number
+// comparison. (Due to round-off error, etc, it's very unlikely that
+// two floating-points will be equal exactly. Hence a naive
+// comparison by the == operation often doesn't work.)
+//
+// Format of IEEE floating-point:
+//
+// The most-significant bit being the leftmost, an IEEE
+// floating-point looks like
+//
+// sign_bit exponent_bits fraction_bits
+//
+// Here, sign_bit is a single bit that designates the sign of the
+// number.
+//
+// For float, there are 8 exponent bits and 23 fraction bits.
+//
+// For double, there are 11 exponent bits and 52 fraction bits.
+//
+// More details can be found at
+// http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
+//
+// Template parameter:
+//
+// RawType: the raw floating-point type (either float or double)
+template <typename RawType>
+class FloatingPoint {
+ public:
+ // Defines the unsigned integer type that has the same size as the
+ // floating point number.
+ typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
+
+ // Constants.
+
+ // # of bits in a number.
+ static const size_t kBitCount = 8*sizeof(RawType);
+
+ // # of fraction bits in a number.
+ static const size_t kFractionBitCount =
+ std::numeric_limits<RawType>::digits - 1;
+
+ // # of exponent bits in a number.
+ static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
+
+ // The mask for the sign bit.
+ static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
+
+ // The mask for the fraction bits.
+ static const Bits kFractionBitMask =
+ ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
+
+ // The mask for the exponent bits.
+ static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
+
+ // How many ULP's (Units in the Last Place) we want to tolerate when
+ // comparing two numbers. The larger the value, the more error we
+ // allow. A 0 value means that two numbers must be exactly the same
+ // to be considered equal.
+ //
+ // The maximum error of a single floating-point operation is 0.5
+ // units in the last place. On Intel CPU's, all floating-point
+ // calculations are done with 80-bit precision, while double has 64
+ // bits. Therefore, 4 should be enough for ordinary use.
+ //
+ // See the following article for more details on ULP:
+ // http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm.
+ static const size_t kMaxUlps = 4;
+
+ // Constructs a FloatingPoint from a raw floating-point number.
+ //
+ // On an Intel CPU, passing a non-normalized NAN (Not a Number)
+ // around may change its bits, although the new value is guaranteed
+ // to be also a NAN. Therefore, don't expect this constructor to
+ // preserve the bits in x when x is a NAN.
+ explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
+
+ // Static methods
+
+ // Reinterprets a bit pattern as a floating-point number.
+ //
+ // This function is needed to test the AlmostEquals() method.
+ static RawType ReinterpretBits(const Bits bits) {
+ FloatingPoint fp(0);
+ fp.u_.bits_ = bits;
+ return fp.u_.value_;
+ }
+
+ // Returns the floating-point number that represent positive infinity.
+ static RawType Infinity() {
+ return ReinterpretBits(kExponentBitMask);
+ }
+
+ // Non-static methods
+
+ // Returns the bits that represents this number.
+ const Bits &bits() const { return u_.bits_; }
+
+ // Returns the exponent bits of this number.
+ Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
+
+ // Returns the fraction bits of this number.
+ Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
+
+ // Returns the sign bit of this number.
+ Bits sign_bit() const { return kSignBitMask & u_.bits_; }
+
+ // Returns true iff this is NAN (not a number).
+ bool is_nan() const {
+ // It's a NAN if the exponent bits are all ones and the fraction
+ // bits are not entirely zeros.
+ return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
+ }
+
+ // Returns true iff this number is at most kMaxUlps ULP's away from
+ // rhs. In particular, this function:
+ //
+ // - returns false if either number is (or both are) NAN.
+ // - treats really large numbers as almost equal to infinity.
+ // - thinks +0.0 and -0.0 are 0 DLP's apart.
+ bool AlmostEquals(const FloatingPoint& rhs) const {
+ // The IEEE standard says that any comparison operation involving
+ // a NAN must return false.
+ if (is_nan() || rhs.is_nan()) return false;
+
+ return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
+ <= kMaxUlps;
+ }
+
+ private:
+ // The data type used to store the actual floating-point number.
+ union FloatingPointUnion {
+ RawType value_; // The raw floating-point number.
+ Bits bits_; // The bits that represent the number.
+ };
+
+ // Converts an integer from the sign-and-magnitude representation to
+ // the biased representation. More precisely, let N be 2 to the
+ // power of (kBitCount - 1), an integer x is represented by the
+ // unsigned number x + N.
+ //
+ // For instance,
+ //
+ // -N + 1 (the most negative number representable using
+ // sign-and-magnitude) is represented by 1;
+ // 0 is represented by N; and
+ // N - 1 (the biggest number representable using
+ // sign-and-magnitude) is represented by 2N - 1.
+ //
+ // Read http://en.wikipedia.org/wiki/Signed_number_representations
+ // for more details on signed number representations.
+ static Bits SignAndMagnitudeToBiased(const Bits &sam) {
+ if (kSignBitMask & sam) {
+ // sam represents a negative number.
+ return ~sam + 1;
+ } else {
+ // sam represents a positive number.
+ return kSignBitMask | sam;
+ }
+ }
+
+ // Given two numbers in the sign-and-magnitude representation,
+ // returns the distance between them as an unsigned number.
+ static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
+ const Bits &sam2) {
+ const Bits biased1 = SignAndMagnitudeToBiased(sam1);
+ const Bits biased2 = SignAndMagnitudeToBiased(sam2);
+ return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
+ }
+
+ FloatingPointUnion u_;
+};
+
+// Typedefs the instances of the FloatingPoint template class that we
+// care to use.
+typedef FloatingPoint<float> Float;
+typedef FloatingPoint<double> Double;
+
+// In order to catch the mistake of putting tests that use different
+// test fixture classes in the same test case, we need to assign
+// unique IDs to fixture classes and compare them. The TypeId type is
+// used to hold such IDs. The user should treat TypeId as an opaque
+// type: the only operation allowed on TypeId values is to compare
+// them for equality using the == operator.
+typedef const void* TypeId;
+
+template <typename T>
+class TypeIdHelper {
+ public:
+ // dummy_ must not have a const type. Otherwise an overly eager
+ // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
+ // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
+ static bool dummy_;
+};
+
+template <typename T>
+bool TypeIdHelper<T>::dummy_ = false;
+
+// GetTypeId<T>() returns the ID of type T. Different values will be
+// returned for different types. Calling the function twice with the
+// same type argument is guaranteed to return the same ID.
+template <typename T>
+TypeId GetTypeId() {
+ // The compiler is required to allocate a different
+ // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
+ // the template. Therefore, the address of dummy_ is guaranteed to
+ // be unique.
+ return &(TypeIdHelper<T>::dummy_);
+}
+
+// Returns the type ID of ::testing::Test. Always call this instead
+// of GetTypeId< ::testing::Test>() to get the type ID of
+// ::testing::Test, as the latter may give the wrong result due to a
+// suspected linker bug when compiling Google Test as a Mac OS X
+// framework.
+GTEST_API_ TypeId GetTestTypeId();
+
+// Defines the abstract factory interface that creates instances
+// of a Test object.
+class TestFactoryBase {
+ public:
+ virtual ~TestFactoryBase() {}
+
+ // Creates a test instance to run. The instance is both created and destroyed
+ // within TestInfoImpl::Run()
+ virtual Test* CreateTest() = 0;
+
+ protected:
+ TestFactoryBase() {}
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
+};
+
+// This class provides implementation of TeastFactoryBase interface.
+// It is used in TEST and TEST_F macros.
+template <class TestClass>
+class TestFactoryImpl : public TestFactoryBase {
+ public:
+ virtual Test* CreateTest() { return new TestClass; }
+};
+
+#if GTEST_OS_WINDOWS
+
+// Predicate-formatters for implementing the HRESULT checking macros
+// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
+// We pass a long instead of HRESULT to avoid causing an
+// include dependency for the HRESULT type.
+GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
+ long hr); // NOLINT
+GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
+ long hr); // NOLINT
+
+#endif // GTEST_OS_WINDOWS
+
+// Formats a source file path and a line number as they would appear
+// in a compiler error message.
+inline String FormatFileLocation(const char* file, int line) {
+ const char* const file_name = file == NULL ? "unknown file" : file;
+ if (line < 0) {
+ return String::Format("%s:", file_name);
+ }
+#ifdef _MSC_VER
+ return String::Format("%s(%d):", file_name, line);
+#else
+ return String::Format("%s:%d:", file_name, line);
+#endif // _MSC_VER
+}
+
+// Types of SetUpTestCase() and TearDownTestCase() functions.
+typedef void (*SetUpTestCaseFunc)();
+typedef void (*TearDownTestCaseFunc)();
+
+// Creates a new TestInfo object and registers it with Google Test;
+// returns the created object.
+//
+// Arguments:
+//
+// test_case_name: name of the test case
+// name: name of the test
+// test_case_comment: a comment on the test case that will be included in
+// the test output
+// comment: a comment on the test that will be included in the
+// test output
+// fixture_class_id: ID of the test fixture class
+// set_up_tc: pointer to the function that sets up the test case
+// tear_down_tc: pointer to the function that tears down the test case
+// factory: pointer to the factory that creates a test object.
+// The newly created TestInfo instance will assume
+// ownership of the factory object.
+GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
+ const char* test_case_name, const char* name,
+ const char* test_case_comment, const char* comment,
+ TypeId fixture_class_id,
+ SetUpTestCaseFunc set_up_tc,
+ TearDownTestCaseFunc tear_down_tc,
+ TestFactoryBase* factory);
+
+// If *pstr starts with the given prefix, modifies *pstr to be right
+// past the prefix and returns true; otherwise leaves *pstr unchanged
+// and returns false. None of pstr, *pstr, and prefix can be NULL.
+bool SkipPrefix(const char* prefix, const char** pstr);
+
+#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
+
+// State of the definition of a type-parameterized test case.
+class GTEST_API_ TypedTestCasePState {
+ public:
+ TypedTestCasePState() : registered_(false) {}
+
+ // Adds the given test name to defined_test_names_ and return true
+ // if the test case hasn't been registered; otherwise aborts the
+ // program.
+ bool AddTestName(const char* file, int line, const char* case_name,
+ const char* test_name) {
+ if (registered_) {
+ fprintf(stderr, "%s Test %s must be defined before "
+ "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
+ FormatFileLocation(file, line).c_str(), test_name, case_name);
+ fflush(stderr);
+ posix::Abort();
+ }
+ defined_test_names_.insert(test_name);
+ return true;
+ }
+
+ // Verifies that registered_tests match the test names in
+ // defined_test_names_; returns registered_tests if successful, or
+ // aborts the program otherwise.
+ const char* VerifyRegisteredTestNames(
+ const char* file, int line, const char* registered_tests);
+
+ private:
+ bool registered_;
+ ::std::set<const char*> defined_test_names_;
+};
+
+// Skips to the first non-space char after the first comma in 'str';
+// returns NULL if no comma is found in 'str'.
+inline const char* SkipComma(const char* str) {
+ const char* comma = strchr(str, ',');
+ if (comma == NULL) {
+ return NULL;
+ }
+ while (isspace(*(++comma))) {}
+ return comma;
+}
+
+// Returns the prefix of 'str' before the first comma in it; returns
+// the entire string if it contains no comma.
+inline String GetPrefixUntilComma(const char* str) {
+ const char* comma = strchr(str, ',');
+ return comma == NULL ? String(str) : String(str, comma - str);
+}
+
+// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
+// registers a list of type-parameterized tests with Google Test. The
+// return value is insignificant - we just need to return something
+// such that we can call this function in a namespace scope.
+//
+// Implementation note: The GTEST_TEMPLATE_ macro declares a template
+// template parameter. It's defined in gtest-type-util.h.
+template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
+class TypeParameterizedTest {
+ public:
+ // 'index' is the index of the test in the type list 'Types'
+ // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
+ // Types). Valid values for 'index' are [0, N - 1] where N is the
+ // length of Types.
+ static bool Register(const char* prefix, const char* case_name,
+ const char* test_names, int index) {
+ typedef typename Types::Head Type;
+ typedef Fixture<Type> FixtureClass;
+ typedef typename GTEST_BIND_(TestSel, Type) TestClass;
+
+ // First, registers the first type-parameterized test in the type
+ // list.
+ MakeAndRegisterTestInfo(
+ String::Format("%s%s%s/%d", prefix, prefix[0] == '\0' ? "" : "/",
+ case_name, index).c_str(),
+ GetPrefixUntilComma(test_names).c_str(),
+ String::Format("TypeParam = %s", GetTypeName<Type>().c_str()).c_str(),
+ "",
+ GetTypeId<FixtureClass>(),
+ TestClass::SetUpTestCase,
+ TestClass::TearDownTestCase,
+ new TestFactoryImpl<TestClass>);
+
+ // Next, recurses (at compile time) with the tail of the type list.
+ return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
+ ::Register(prefix, case_name, test_names, index + 1);
+ }
+};
+
+// The base case for the compile time recursion.
+template <GTEST_TEMPLATE_ Fixture, class TestSel>
+class TypeParameterizedTest<Fixture, TestSel, Types0> {
+ public:
+ static bool Register(const char* /*prefix*/, const char* /*case_name*/,
+ const char* /*test_names*/, int /*index*/) {
+ return true;
+ }
+};
+
+// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
+// registers *all combinations* of 'Tests' and 'Types' with Google
+// Test. The return value is insignificant - we just need to return
+// something such that we can call this function in a namespace scope.
+template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
+class TypeParameterizedTestCase {
+ public:
+ static bool Register(const char* prefix, const char* case_name,
+ const char* test_names) {
+ typedef typename Tests::Head Head;
+
+ // First, register the first test in 'Test' for each type in 'Types'.
+ TypeParameterizedTest<Fixture, Head, Types>::Register(
+ prefix, case_name, test_names, 0);
+
+ // Next, recurses (at compile time) with the tail of the test list.
+ return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
+ ::Register(prefix, case_name, SkipComma(test_names));
+ }
+};
+
+// The base case for the compile time recursion.
+template <GTEST_TEMPLATE_ Fixture, typename Types>
+class TypeParameterizedTestCase<Fixture, Templates0, Types> {
+ public:
+ static bool Register(const char* /*prefix*/, const char* /*case_name*/,
+ const char* /*test_names*/) {
+ return true;
+ }
+};
+
+#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
+
+// Returns the current OS stack trace as a String.
+//
+// The maximum number of stack frames to be included is specified by
+// the gtest_stack_trace_depth flag. The skip_count parameter
+// specifies the number of top frames to be skipped, which doesn't
+// count against the number of frames to be included.
+//
+// For example, if Foo() calls Bar(), which in turn calls
+// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
+// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
+GTEST_API_ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
+ int skip_count);
+
+// Helpers for suppressing warnings on unreachable code or constant
+// condition.
+
+// Always returns true.
+GTEST_API_ bool AlwaysTrue();
+
+// Always returns false.
+inline bool AlwaysFalse() { return !AlwaysTrue(); }
+
+// A simple Linear Congruential Generator for generating random
+// numbers with a uniform distribution. Unlike rand() and srand(), it
+// doesn't use global state (and therefore can't interfere with user
+// code). Unlike rand_r(), it's portable. An LCG isn't very random,
+// but it's good enough for our purposes.
+class GTEST_API_ Random {
+ public:
+ static const UInt32 kMaxRange = 1u << 31;
+
+ explicit Random(UInt32 seed) : state_(seed) {}
+
+ void Reseed(UInt32 seed) { state_ = seed; }
+
+ // Generates a random number from [0, range). Crashes if 'range' is
+ // 0 or greater than kMaxRange.
+ UInt32 Generate(UInt32 range);
+
+ private:
+ UInt32 state_;
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
+};
+
+} // namespace internal
+} // namespace testing
+
+#define GTEST_MESSAGE_(message, result_type) \
+ ::testing::internal::AssertHelper(result_type, __FILE__, __LINE__, message) \
+ = ::testing::Message()
+
+#define GTEST_FATAL_FAILURE_(message) \
+ return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
+
+#define GTEST_NONFATAL_FAILURE_(message) \
+ GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
+
+#define GTEST_SUCCESS_(message) \
+ GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
+
+// Suppresses MSVC warnings 4072 (unreachable code) for the code following
+// statement if it returns or throws (or doesn't return or throw in some
+// situations).
+#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
+ if (::testing::internal::AlwaysTrue()) { statement; }
+
+#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (const char* gtest_msg = "") { \
+ bool gtest_caught_expected = false; \
+ try { \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ } \
+ catch (expected_exception const&) { \
+ gtest_caught_expected = true; \
+ } \
+ catch (...) { \
+ gtest_msg = "Expected: " #statement " throws an exception of type " \
+ #expected_exception ".\n Actual: it throws a different " \
+ "type."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
+ } \
+ if (!gtest_caught_expected) { \
+ gtest_msg = "Expected: " #statement " throws an exception of type " \
+ #expected_exception ".\n Actual: it throws nothing."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
+ } \
+ } else \
+ GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
+ fail(gtest_msg)
+
+#define GTEST_TEST_NO_THROW_(statement, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (const char* gtest_msg = "") { \
+ try { \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ } \
+ catch (...) { \
+ gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \
+ " Actual: it throws."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
+ } \
+ } else \
+ GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
+ fail(gtest_msg)
+
+#define GTEST_TEST_ANY_THROW_(statement, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (const char* gtest_msg = "") { \
+ bool gtest_caught_any = false; \
+ try { \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ } \
+ catch (...) { \
+ gtest_caught_any = true; \
+ } \
+ if (!gtest_caught_any) { \
+ gtest_msg = "Expected: " #statement " throws an exception.\n" \
+ " Actual: it doesn't."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
+ } \
+ } else \
+ GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
+ fail(gtest_msg)
+
+
+// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
+// either a boolean expression or an AssertionResult. text is a textual
+// represenation of expression as it was passed into the EXPECT_TRUE.
+#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (const ::testing::AssertionResult gtest_ar_ = \
+ ::testing::AssertionResult(expression)) \
+ ; \
+ else \
+ fail(::testing::internal::GetBoolAssertionFailureMessage(\
+ gtest_ar_, text, #actual, #expected).c_str())
+
+#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (const char* gtest_msg = "") { \
+ ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
+ gtest_msg = "Expected: " #statement " doesn't generate new fatal " \
+ "failures in the current thread.\n" \
+ " Actual: it does."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
+ } \
+ } else \
+ GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
+ fail(gtest_msg)
+
+// Expands to the name of the class that implements the given test.
+#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
+ test_case_name##_##test_name##_Test
+
+// Helper macro for defining tests.
+#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
+class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
+ public:\
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
+ private:\
+ virtual void TestBody();\
+ static ::testing::TestInfo* const test_info_;\
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(\
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
+};\
+\
+::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
+ ::test_info_ =\
+ ::testing::internal::MakeAndRegisterTestInfo(\
+ #test_case_name, #test_name, "", "", \
+ (parent_id), \
+ parent_class::SetUpTestCase, \
+ parent_class::TearDownTestCase, \
+ new ::testing::internal::TestFactoryImpl<\
+ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
+void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-linked_ptr.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-linked_ptr.h
new file mode 100644
index 0000000..540ef4c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-linked_ptr.h
@@ -0,0 +1,242 @@
+// Copyright 2003 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.
+//
+// Authors: Dan Egnor (egnor@google.com)
+//
+// A "smart" pointer type with reference tracking. Every pointer to a
+// particular object is kept on a circular linked list. When the last pointer
+// to an object is destroyed or reassigned, the object is deleted.
+//
+// Used properly, this deletes the object when the last reference goes away.
+// There are several caveats:
+// - Like all reference counting schemes, cycles lead to leaks.
+// - Each smart pointer is actually two pointers (8 bytes instead of 4).
+// - Every time a pointer is assigned, the entire list of pointers to that
+// object is traversed. This class is therefore NOT SUITABLE when there
+// will often be more than two or three pointers to a particular object.
+// - References are only tracked as long as linked_ptr<> objects are copied.
+// If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
+// will happen (double deletion).
+//
+// A good use of this class is storing object references in STL containers.
+// You can safely put linked_ptr<> in a vector<>.
+// Other uses may not be as good.
+//
+// Note: If you use an incomplete type with linked_ptr<>, the class
+// *containing* linked_ptr<> must have a constructor and destructor (even
+// if they do nothing!).
+//
+// Bill Gibbons suggested we use something like this.
+//
+// Thread Safety:
+// Unlike other linked_ptr implementations, in this implementation
+// a linked_ptr object is thread-safe in the sense that:
+// - it's safe to copy linked_ptr objects concurrently,
+// - it's safe to copy *from* a linked_ptr and read its underlying
+// raw pointer (e.g. via get()) concurrently, and
+// - it's safe to write to two linked_ptrs that point to the same
+// shared object concurrently.
+// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
+// confusion with normal linked_ptr.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
+
+#include <stdlib.h>
+#include <assert.h>
+
+#include <gtest/internal/gtest-port.h>
+
+namespace testing {
+namespace internal {
+
+// Protects copying of all linked_ptr objects.
+GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
+
+// This is used internally by all instances of linked_ptr<>. It needs to be
+// a non-template class because different types of linked_ptr<> can refer to
+// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
+// So, it needs to be possible for different types of linked_ptr to participate
+// in the same circular linked list, so we need a single class type here.
+//
+// DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr<T>.
+class linked_ptr_internal {
+ public:
+ // Create a new circle that includes only this instance.
+ void join_new() {
+ next_ = this;
+ }
+
+ // Many linked_ptr operations may change p.link_ for some linked_ptr
+ // variable p in the same circle as this object. Therefore we need
+ // to prevent two such operations from occurring concurrently.
+ //
+ // Note that different types of linked_ptr objects can coexist in a
+ // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
+ // linked_ptr<Derived2>). Therefore we must use a single mutex to
+ // protect all linked_ptr objects. This can create serious
+ // contention in production code, but is acceptable in a testing
+ // framework.
+
+ // Join an existing circle.
+ // L < g_linked_ptr_mutex
+ void join(linked_ptr_internal const* ptr) {
+ MutexLock lock(&g_linked_ptr_mutex);
+
+ linked_ptr_internal const* p = ptr;
+ while (p->next_ != ptr) p = p->next_;
+ p->next_ = this;
+ next_ = ptr;
+ }
+
+ // Leave whatever circle we're part of. Returns true if we were the
+ // last member of the circle. Once this is done, you can join() another.
+ // L < g_linked_ptr_mutex
+ bool depart() {
+ MutexLock lock(&g_linked_ptr_mutex);
+
+ if (next_ == this) return true;
+ linked_ptr_internal const* p = next_;
+ while (p->next_ != this) p = p->next_;
+ p->next_ = next_;
+ return false;
+ }
+
+ private:
+ mutable linked_ptr_internal const* next_;
+};
+
+template <typename T>
+class linked_ptr {
+ public:
+ typedef T element_type;
+
+ // Take over ownership of a raw pointer. This should happen as soon as
+ // possible after the object is created.
+ explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
+ ~linked_ptr() { depart(); }
+
+ // Copy an existing linked_ptr<>, adding ourselves to the list of references.
+ template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
+ linked_ptr(linked_ptr const& ptr) { // NOLINT
+ assert(&ptr != this);
+ copy(&ptr);
+ }
+
+ // Assignment releases the old value and acquires the new.
+ template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
+ depart();
+ copy(&ptr);
+ return *this;
+ }
+
+ linked_ptr& operator=(linked_ptr const& ptr) {
+ if (&ptr != this) {
+ depart();
+ copy(&ptr);
+ }
+ return *this;
+ }
+
+ // Smart pointer members.
+ void reset(T* ptr = NULL) {
+ depart();
+ capture(ptr);
+ }
+ T* get() const { return value_; }
+ T* operator->() const { return value_; }
+ T& operator*() const { return *value_; }
+ // Release ownership of the pointed object and returns it.
+ // Sole ownership by this linked_ptr object is required.
+ T* release() {
+ bool last = link_.depart();
+ assert(last);
+ T* v = value_;
+ value_ = NULL;
+ return v;
+ }
+
+ bool operator==(T* p) const { return value_ == p; }
+ bool operator!=(T* p) const { return value_ != p; }
+ template <typename U>
+ bool operator==(linked_ptr<U> const& ptr) const {
+ return value_ == ptr.get();
+ }
+ template <typename U>
+ bool operator!=(linked_ptr<U> const& ptr) const {
+ return value_ != ptr.get();
+ }
+
+ private:
+ template <typename U>
+ friend class linked_ptr;
+
+ T* value_;
+ linked_ptr_internal link_;
+
+ void depart() {
+ if (link_.depart()) delete value_;
+ }
+
+ void capture(T* ptr) {
+ value_ = ptr;
+ link_.join_new();
+ }
+
+ template <typename U> void copy(linked_ptr<U> const* ptr) {
+ value_ = ptr->get();
+ if (value_)
+ link_.join(&ptr->link_);
+ else
+ link_.join_new();
+ }
+};
+
+template<typename T> inline
+bool operator==(T* ptr, const linked_ptr<T>& x) {
+ return ptr == x.get();
+}
+
+template<typename T> inline
+bool operator!=(T* ptr, const linked_ptr<T>& x) {
+ return ptr != x.get();
+}
+
+// A function to convert T* into linked_ptr<T>
+// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
+// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
+template <typename T>
+linked_ptr<T> make_linked_ptr(T* ptr) {
+ return linked_ptr<T>(ptr);
+}
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h
new file mode 100644
index 0000000..ab4ab56
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h
@@ -0,0 +1,4820 @@
+// This file was GENERATED by a script. DO NOT EDIT BY HAND!!!
+
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+
+// Type and function utilities for implementing parameterized tests.
+// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
+//
+// Currently Google Test supports at most 50 arguments in Values,
+// and at most 10 arguments in Combine. Please contact
+// googletestframework@googlegroups.com if you need more.
+// Please note that the number of arguments to Combine is limited
+// by the maximum arity of the implementation of tr1::tuple which is
+// currently set at 10.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
+
+// scripts/fuse_gtest.py depends on gtest's own header being #included
+// *unconditionally*. Therefore these #includes cannot be moved
+// inside #if GTEST_HAS_PARAM_TEST.
+#include <gtest/internal/gtest-param-util.h>
+#include <gtest/internal/gtest-port.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+namespace testing {
+
+// Forward declarations of ValuesIn(), which is implemented in
+// include/gtest/gtest-param-test.h.
+template <typename ForwardIterator>
+internal::ParamGenerator<
+ typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn(
+ ForwardIterator begin, ForwardIterator end);
+
+template <typename T, size_t N>
+internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
+
+template <class Container>
+internal::ParamGenerator<typename Container::value_type> ValuesIn(
+ const Container& container);
+
+namespace internal {
+
+// Used in the Values() function to provide polymorphic capabilities.
+template <typename T1>
+class ValueArray1 {
+ public:
+ explicit ValueArray1(T1 v1) : v1_(v1) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray1& other);
+
+ const T1 v1_;
+};
+
+template <typename T1, typename T2>
+class ValueArray2 {
+ public:
+ ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray2& other);
+
+ const T1 v1_;
+ const T2 v2_;
+};
+
+template <typename T1, typename T2, typename T3>
+class ValueArray3 {
+ public:
+ ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray3& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4>
+class ValueArray4 {
+ public:
+ ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
+ v4_(v4) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray4& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+class ValueArray5 {
+ public:
+ ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
+ v4_(v4), v5_(v5) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray5& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6>
+class ValueArray6 {
+ public:
+ ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
+ v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray6& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7>
+class ValueArray7 {
+ public:
+ ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
+ v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray7& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8>
+class ValueArray8 {
+ public:
+ ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
+ T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray8& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9>
+class ValueArray9 {
+ public:
+ ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
+ T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray9& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+class ValueArray10 {
+ public:
+ ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray10& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11>
+class ValueArray11 {
+ public:
+ ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
+ v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray11& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12>
+class ValueArray12 {
+ public:
+ ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
+ v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray12& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13>
+class ValueArray13 {
+ public:
+ ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
+ v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
+ v12_(v12), v13_(v13) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray13& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14>
+class ValueArray14 {
+ public:
+ ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
+ v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray14& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15>
+class ValueArray15 {
+ public:
+ ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
+ v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray15& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16>
+class ValueArray16 {
+ public:
+ ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
+ v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
+ v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
+ v16_(v16) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray16& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17>
+class ValueArray17 {
+ public:
+ ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
+ T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray17& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18>
+class ValueArray18 {
+ public:
+ ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray18& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19>
+class ValueArray19 {
+ public:
+ ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
+ v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
+ v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray19& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20>
+class ValueArray20 {
+ public:
+ ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
+ v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
+ v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
+ v19_(v19), v20_(v20) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray20& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21>
+class ValueArray21 {
+ public:
+ ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
+ v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
+ v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
+ v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray21& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22>
+class ValueArray22 {
+ public:
+ ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
+ v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray22& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23>
+class ValueArray23 {
+ public:
+ ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
+ v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
+ v23_(v23) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_,
+ v23_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray23& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24>
+class ValueArray24 {
+ public:
+ ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
+ v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
+ v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
+ v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
+ v22_(v22), v23_(v23), v24_(v24) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray24& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25>
+class ValueArray25 {
+ public:
+ ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
+ T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray25& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26>
+class ValueArray26 {
+ public:
+ ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray26& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27>
+class ValueArray27 {
+ public:
+ ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
+ v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
+ v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
+ v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
+ v26_(v26), v27_(v27) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray27& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28>
+class ValueArray28 {
+ public:
+ ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
+ v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
+ v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
+ v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
+ v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray28& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29>
+class ValueArray29 {
+ public:
+ ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
+ v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
+ v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
+ v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
+ v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray29& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30>
+class ValueArray30 {
+ public:
+ ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
+ v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
+ v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
+ v29_(v29), v30_(v30) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray30& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31>
+class ValueArray31 {
+ public:
+ ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
+ v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
+ v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
+ v29_(v29), v30_(v30), v31_(v31) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray31& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32>
+class ValueArray32 {
+ public:
+ ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
+ v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
+ v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
+ v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
+ v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
+ v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray32& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33>
+class ValueArray33 {
+ public:
+ ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
+ T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
+ v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
+ v33_(v33) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray33& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34>
+class ValueArray34 {
+ public:
+ ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
+ v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
+ v33_(v33), v34_(v34) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray34& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35>
+class ValueArray35 {
+ public:
+ ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
+ v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
+ v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
+ v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
+ v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
+ v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_,
+ v35_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray35& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36>
+class ValueArray36 {
+ public:
+ ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
+ v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
+ v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
+ v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
+ v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
+ v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray36& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37>
+class ValueArray37 {
+ public:
+ ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
+ v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
+ v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
+ v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
+ v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
+ v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
+ v36_(v36), v37_(v37) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray37& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38>
+class ValueArray38 {
+ public:
+ ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
+ v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
+ v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
+ v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
+ v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray38& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39>
+class ValueArray39 {
+ public:
+ ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
+ v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
+ v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
+ v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
+ v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray39& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40>
+class ValueArray40 {
+ public:
+ ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
+ v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
+ v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
+ v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
+ v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
+ v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
+ v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
+ v40_(v40) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray40& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41>
+class ValueArray41 {
+ public:
+ ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
+ T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
+ v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
+ v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
+ v39_(v39), v40_(v40), v41_(v41) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray41& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42>
+class ValueArray42 {
+ public:
+ ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
+ v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
+ v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
+ v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray42& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43>
+class ValueArray43 {
+ public:
+ ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
+ v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
+ v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
+ v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
+ v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
+ v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
+ v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray43& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44>
+class ValueArray44 {
+ public:
+ ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
+ v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
+ v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
+ v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
+ v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
+ v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
+ v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
+ v43_(v43), v44_(v44) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray44& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+ const T44 v44_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45>
+class ValueArray45 {
+ public:
+ ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
+ v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
+ v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
+ v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
+ v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
+ v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
+ v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
+ v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray45& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+ const T44 v44_;
+ const T45 v45_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46>
+class ValueArray46 {
+ public:
+ ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
+ v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
+ v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
+ v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
+ v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
+ v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray46& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+ const T44 v44_;
+ const T45 v45_;
+ const T46 v46_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47>
+class ValueArray47 {
+ public:
+ ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
+ v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
+ v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
+ v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
+ v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
+ v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
+ v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
+ v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
+ v47_(v47) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_,
+ v47_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray47& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+ const T44 v44_;
+ const T45 v45_;
+ const T46 v46_;
+ const T47 v47_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48>
+class ValueArray48 {
+ public:
+ ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
+ v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
+ v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
+ v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
+ v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
+ v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
+ v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
+ v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
+ v46_(v46), v47_(v47), v48_(v48) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
+ v48_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray48& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+ const T44 v44_;
+ const T45 v45_;
+ const T46 v46_;
+ const T47 v47_;
+ const T48 v48_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49>
+class ValueArray49 {
+ public:
+ ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
+ T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
+ v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
+ v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
+ v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
+ v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
+ v48_, v49_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray49& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+ const T44 v44_;
+ const T45 v45_;
+ const T46 v46_;
+ const T47 v47_;
+ const T48 v48_;
+ const T49 v49_;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49, typename T50>
+class ValueArray50 {
+ public:
+ ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
+ T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
+ T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
+ T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
+ T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
+ T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
+ T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
+ v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
+ v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
+ v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
+ v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
+ v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
+ v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
+ v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
+ v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
+ v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
+ v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
+ v48_, v49_, v50_};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray50& other);
+
+ const T1 v1_;
+ const T2 v2_;
+ const T3 v3_;
+ const T4 v4_;
+ const T5 v5_;
+ const T6 v6_;
+ const T7 v7_;
+ const T8 v8_;
+ const T9 v9_;
+ const T10 v10_;
+ const T11 v11_;
+ const T12 v12_;
+ const T13 v13_;
+ const T14 v14_;
+ const T15 v15_;
+ const T16 v16_;
+ const T17 v17_;
+ const T18 v18_;
+ const T19 v19_;
+ const T20 v20_;
+ const T21 v21_;
+ const T22 v22_;
+ const T23 v23_;
+ const T24 v24_;
+ const T25 v25_;
+ const T26 v26_;
+ const T27 v27_;
+ const T28 v28_;
+ const T29 v29_;
+ const T30 v30_;
+ const T31 v31_;
+ const T32 v32_;
+ const T33 v33_;
+ const T34 v34_;
+ const T35 v35_;
+ const T36 v36_;
+ const T37 v37_;
+ const T38 v38_;
+ const T39 v39_;
+ const T40 v40_;
+ const T41 v41_;
+ const T42 v42_;
+ const T43 v43_;
+ const T44 v44_;
+ const T45 v45_;
+ const T46 v46_;
+ const T47 v47_;
+ const T48 v48_;
+ const T49 v49_;
+ const T50 v50_;
+};
+
+#if GTEST_HAS_COMBINE
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Generates values from the Cartesian product of values produced
+// by the argument generators.
+//
+template <typename T1, typename T2>
+class CartesianProductGenerator2
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2> ParamType;
+
+ CartesianProductGenerator2(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2)
+ : g1_(g1), g2_(g2) {}
+ virtual ~CartesianProductGenerator2() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current2_;
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator2::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator2& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+}; // class CartesianProductGenerator2
+
+
+template <typename T1, typename T2, typename T3>
+class CartesianProductGenerator3
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3> ParamType;
+
+ CartesianProductGenerator3(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
+ : g1_(g1), g2_(g2), g3_(g3) {}
+ virtual ~CartesianProductGenerator3() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current3_;
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator3::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator3& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+}; // class CartesianProductGenerator3
+
+
+template <typename T1, typename T2, typename T3, typename T4>
+class CartesianProductGenerator4
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;
+
+ CartesianProductGenerator4(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
+ const ParamGenerator<T4>& g4)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
+ virtual ~CartesianProductGenerator4() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin(), g4_, g4_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
+ g4_, g4_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3,
+ const ParamGenerator<T4>& g4,
+ const typename ParamGenerator<T4>::iterator& current4)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
+ begin4_(g4.begin()), end4_(g4.end()), current4_(current4) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current4_;
+ if (current4_ == end4_) {
+ current4_ = begin4_;
+ ++current3_;
+ }
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_ &&
+ current4_ == typed_other->current4_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_),
+ begin4_(other.begin4_),
+ end4_(other.end4_),
+ current4_(other.current4_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_,
+ *current4_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_ ||
+ current4_ == end4_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ const typename ParamGenerator<T4>::iterator begin4_;
+ const typename ParamGenerator<T4>::iterator end4_;
+ typename ParamGenerator<T4>::iterator current4_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator4::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator4& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+ const ParamGenerator<T4> g4_;
+}; // class CartesianProductGenerator4
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+class CartesianProductGenerator5
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;
+
+ CartesianProductGenerator5(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
+ const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
+ virtual ~CartesianProductGenerator5() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
+ g4_, g4_.end(), g5_, g5_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3,
+ const ParamGenerator<T4>& g4,
+ const typename ParamGenerator<T4>::iterator& current4,
+ const ParamGenerator<T5>& g5,
+ const typename ParamGenerator<T5>::iterator& current5)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
+ begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
+ begin5_(g5.begin()), end5_(g5.end()), current5_(current5) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current5_;
+ if (current5_ == end5_) {
+ current5_ = begin5_;
+ ++current4_;
+ }
+ if (current4_ == end4_) {
+ current4_ = begin4_;
+ ++current3_;
+ }
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_ &&
+ current4_ == typed_other->current4_ &&
+ current5_ == typed_other->current5_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_),
+ begin4_(other.begin4_),
+ end4_(other.end4_),
+ current4_(other.current4_),
+ begin5_(other.begin5_),
+ end5_(other.end5_),
+ current5_(other.current5_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_,
+ *current4_, *current5_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_ ||
+ current4_ == end4_ ||
+ current5_ == end5_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ const typename ParamGenerator<T4>::iterator begin4_;
+ const typename ParamGenerator<T4>::iterator end4_;
+ typename ParamGenerator<T4>::iterator current4_;
+ const typename ParamGenerator<T5>::iterator begin5_;
+ const typename ParamGenerator<T5>::iterator end5_;
+ typename ParamGenerator<T5>::iterator current5_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator5::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator5& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+ const ParamGenerator<T4> g4_;
+ const ParamGenerator<T5> g5_;
+}; // class CartesianProductGenerator5
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6>
+class CartesianProductGenerator6
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
+ T6> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;
+
+ CartesianProductGenerator6(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
+ const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
+ const ParamGenerator<T6>& g6)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
+ virtual ~CartesianProductGenerator6() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
+ g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3,
+ const ParamGenerator<T4>& g4,
+ const typename ParamGenerator<T4>::iterator& current4,
+ const ParamGenerator<T5>& g5,
+ const typename ParamGenerator<T5>::iterator& current5,
+ const ParamGenerator<T6>& g6,
+ const typename ParamGenerator<T6>::iterator& current6)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
+ begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
+ begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
+ begin6_(g6.begin()), end6_(g6.end()), current6_(current6) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current6_;
+ if (current6_ == end6_) {
+ current6_ = begin6_;
+ ++current5_;
+ }
+ if (current5_ == end5_) {
+ current5_ = begin5_;
+ ++current4_;
+ }
+ if (current4_ == end4_) {
+ current4_ = begin4_;
+ ++current3_;
+ }
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_ &&
+ current4_ == typed_other->current4_ &&
+ current5_ == typed_other->current5_ &&
+ current6_ == typed_other->current6_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_),
+ begin4_(other.begin4_),
+ end4_(other.end4_),
+ current4_(other.current4_),
+ begin5_(other.begin5_),
+ end5_(other.end5_),
+ current5_(other.current5_),
+ begin6_(other.begin6_),
+ end6_(other.end6_),
+ current6_(other.current6_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_,
+ *current4_, *current5_, *current6_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_ ||
+ current4_ == end4_ ||
+ current5_ == end5_ ||
+ current6_ == end6_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ const typename ParamGenerator<T4>::iterator begin4_;
+ const typename ParamGenerator<T4>::iterator end4_;
+ typename ParamGenerator<T4>::iterator current4_;
+ const typename ParamGenerator<T5>::iterator begin5_;
+ const typename ParamGenerator<T5>::iterator end5_;
+ typename ParamGenerator<T5>::iterator current5_;
+ const typename ParamGenerator<T6>::iterator begin6_;
+ const typename ParamGenerator<T6>::iterator end6_;
+ typename ParamGenerator<T6>::iterator current6_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator6::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator6& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+ const ParamGenerator<T4> g4_;
+ const ParamGenerator<T5> g5_;
+ const ParamGenerator<T6> g6_;
+}; // class CartesianProductGenerator6
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7>
+class CartesianProductGenerator7
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+ T7> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
+
+ CartesianProductGenerator7(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
+ const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
+ const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
+ virtual ~CartesianProductGenerator7() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
+ g7_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
+ g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3,
+ const ParamGenerator<T4>& g4,
+ const typename ParamGenerator<T4>::iterator& current4,
+ const ParamGenerator<T5>& g5,
+ const typename ParamGenerator<T5>::iterator& current5,
+ const ParamGenerator<T6>& g6,
+ const typename ParamGenerator<T6>::iterator& current6,
+ const ParamGenerator<T7>& g7,
+ const typename ParamGenerator<T7>::iterator& current7)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
+ begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
+ begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
+ begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
+ begin7_(g7.begin()), end7_(g7.end()), current7_(current7) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current7_;
+ if (current7_ == end7_) {
+ current7_ = begin7_;
+ ++current6_;
+ }
+ if (current6_ == end6_) {
+ current6_ = begin6_;
+ ++current5_;
+ }
+ if (current5_ == end5_) {
+ current5_ = begin5_;
+ ++current4_;
+ }
+ if (current4_ == end4_) {
+ current4_ = begin4_;
+ ++current3_;
+ }
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_ &&
+ current4_ == typed_other->current4_ &&
+ current5_ == typed_other->current5_ &&
+ current6_ == typed_other->current6_ &&
+ current7_ == typed_other->current7_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_),
+ begin4_(other.begin4_),
+ end4_(other.end4_),
+ current4_(other.current4_),
+ begin5_(other.begin5_),
+ end5_(other.end5_),
+ current5_(other.current5_),
+ begin6_(other.begin6_),
+ end6_(other.end6_),
+ current6_(other.current6_),
+ begin7_(other.begin7_),
+ end7_(other.end7_),
+ current7_(other.current7_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_,
+ *current4_, *current5_, *current6_, *current7_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_ ||
+ current4_ == end4_ ||
+ current5_ == end5_ ||
+ current6_ == end6_ ||
+ current7_ == end7_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ const typename ParamGenerator<T4>::iterator begin4_;
+ const typename ParamGenerator<T4>::iterator end4_;
+ typename ParamGenerator<T4>::iterator current4_;
+ const typename ParamGenerator<T5>::iterator begin5_;
+ const typename ParamGenerator<T5>::iterator end5_;
+ typename ParamGenerator<T5>::iterator current5_;
+ const typename ParamGenerator<T6>::iterator begin6_;
+ const typename ParamGenerator<T6>::iterator end6_;
+ typename ParamGenerator<T6>::iterator current6_;
+ const typename ParamGenerator<T7>::iterator begin7_;
+ const typename ParamGenerator<T7>::iterator end7_;
+ typename ParamGenerator<T7>::iterator current7_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator7::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator7& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+ const ParamGenerator<T4> g4_;
+ const ParamGenerator<T5> g5_;
+ const ParamGenerator<T6> g6_;
+ const ParamGenerator<T7> g7_;
+}; // class CartesianProductGenerator7
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8>
+class CartesianProductGenerator8
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+ T7, T8> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
+
+ CartesianProductGenerator8(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
+ const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
+ const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
+ const ParamGenerator<T8>& g8)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
+ g8_(g8) {}
+ virtual ~CartesianProductGenerator8() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
+ g7_.begin(), g8_, g8_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
+ g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
+ g8_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3,
+ const ParamGenerator<T4>& g4,
+ const typename ParamGenerator<T4>::iterator& current4,
+ const ParamGenerator<T5>& g5,
+ const typename ParamGenerator<T5>::iterator& current5,
+ const ParamGenerator<T6>& g6,
+ const typename ParamGenerator<T6>::iterator& current6,
+ const ParamGenerator<T7>& g7,
+ const typename ParamGenerator<T7>::iterator& current7,
+ const ParamGenerator<T8>& g8,
+ const typename ParamGenerator<T8>::iterator& current8)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
+ begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
+ begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
+ begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
+ begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
+ begin8_(g8.begin()), end8_(g8.end()), current8_(current8) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current8_;
+ if (current8_ == end8_) {
+ current8_ = begin8_;
+ ++current7_;
+ }
+ if (current7_ == end7_) {
+ current7_ = begin7_;
+ ++current6_;
+ }
+ if (current6_ == end6_) {
+ current6_ = begin6_;
+ ++current5_;
+ }
+ if (current5_ == end5_) {
+ current5_ = begin5_;
+ ++current4_;
+ }
+ if (current4_ == end4_) {
+ current4_ = begin4_;
+ ++current3_;
+ }
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_ &&
+ current4_ == typed_other->current4_ &&
+ current5_ == typed_other->current5_ &&
+ current6_ == typed_other->current6_ &&
+ current7_ == typed_other->current7_ &&
+ current8_ == typed_other->current8_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_),
+ begin4_(other.begin4_),
+ end4_(other.end4_),
+ current4_(other.current4_),
+ begin5_(other.begin5_),
+ end5_(other.end5_),
+ current5_(other.current5_),
+ begin6_(other.begin6_),
+ end6_(other.end6_),
+ current6_(other.current6_),
+ begin7_(other.begin7_),
+ end7_(other.end7_),
+ current7_(other.current7_),
+ begin8_(other.begin8_),
+ end8_(other.end8_),
+ current8_(other.current8_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_,
+ *current4_, *current5_, *current6_, *current7_, *current8_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_ ||
+ current4_ == end4_ ||
+ current5_ == end5_ ||
+ current6_ == end6_ ||
+ current7_ == end7_ ||
+ current8_ == end8_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ const typename ParamGenerator<T4>::iterator begin4_;
+ const typename ParamGenerator<T4>::iterator end4_;
+ typename ParamGenerator<T4>::iterator current4_;
+ const typename ParamGenerator<T5>::iterator begin5_;
+ const typename ParamGenerator<T5>::iterator end5_;
+ typename ParamGenerator<T5>::iterator current5_;
+ const typename ParamGenerator<T6>::iterator begin6_;
+ const typename ParamGenerator<T6>::iterator end6_;
+ typename ParamGenerator<T6>::iterator current6_;
+ const typename ParamGenerator<T7>::iterator begin7_;
+ const typename ParamGenerator<T7>::iterator end7_;
+ typename ParamGenerator<T7>::iterator current7_;
+ const typename ParamGenerator<T8>::iterator begin8_;
+ const typename ParamGenerator<T8>::iterator end8_;
+ typename ParamGenerator<T8>::iterator current8_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator8::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator8& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+ const ParamGenerator<T4> g4_;
+ const ParamGenerator<T5> g5_;
+ const ParamGenerator<T6> g6_;
+ const ParamGenerator<T7> g7_;
+ const ParamGenerator<T8> g8_;
+}; // class CartesianProductGenerator8
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9>
+class CartesianProductGenerator9
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+ T7, T8, T9> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
+
+ CartesianProductGenerator9(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
+ const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
+ const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
+ const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
+ g9_(g9) {}
+ virtual ~CartesianProductGenerator9() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
+ g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
+ g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
+ g8_.end(), g9_, g9_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3,
+ const ParamGenerator<T4>& g4,
+ const typename ParamGenerator<T4>::iterator& current4,
+ const ParamGenerator<T5>& g5,
+ const typename ParamGenerator<T5>::iterator& current5,
+ const ParamGenerator<T6>& g6,
+ const typename ParamGenerator<T6>::iterator& current6,
+ const ParamGenerator<T7>& g7,
+ const typename ParamGenerator<T7>::iterator& current7,
+ const ParamGenerator<T8>& g8,
+ const typename ParamGenerator<T8>::iterator& current8,
+ const ParamGenerator<T9>& g9,
+ const typename ParamGenerator<T9>::iterator& current9)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
+ begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
+ begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
+ begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
+ begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
+ begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
+ begin9_(g9.begin()), end9_(g9.end()), current9_(current9) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current9_;
+ if (current9_ == end9_) {
+ current9_ = begin9_;
+ ++current8_;
+ }
+ if (current8_ == end8_) {
+ current8_ = begin8_;
+ ++current7_;
+ }
+ if (current7_ == end7_) {
+ current7_ = begin7_;
+ ++current6_;
+ }
+ if (current6_ == end6_) {
+ current6_ = begin6_;
+ ++current5_;
+ }
+ if (current5_ == end5_) {
+ current5_ = begin5_;
+ ++current4_;
+ }
+ if (current4_ == end4_) {
+ current4_ = begin4_;
+ ++current3_;
+ }
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_ &&
+ current4_ == typed_other->current4_ &&
+ current5_ == typed_other->current5_ &&
+ current6_ == typed_other->current6_ &&
+ current7_ == typed_other->current7_ &&
+ current8_ == typed_other->current8_ &&
+ current9_ == typed_other->current9_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_),
+ begin4_(other.begin4_),
+ end4_(other.end4_),
+ current4_(other.current4_),
+ begin5_(other.begin5_),
+ end5_(other.end5_),
+ current5_(other.current5_),
+ begin6_(other.begin6_),
+ end6_(other.end6_),
+ current6_(other.current6_),
+ begin7_(other.begin7_),
+ end7_(other.end7_),
+ current7_(other.current7_),
+ begin8_(other.begin8_),
+ end8_(other.end8_),
+ current8_(other.current8_),
+ begin9_(other.begin9_),
+ end9_(other.end9_),
+ current9_(other.current9_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_,
+ *current4_, *current5_, *current6_, *current7_, *current8_,
+ *current9_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_ ||
+ current4_ == end4_ ||
+ current5_ == end5_ ||
+ current6_ == end6_ ||
+ current7_ == end7_ ||
+ current8_ == end8_ ||
+ current9_ == end9_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ const typename ParamGenerator<T4>::iterator begin4_;
+ const typename ParamGenerator<T4>::iterator end4_;
+ typename ParamGenerator<T4>::iterator current4_;
+ const typename ParamGenerator<T5>::iterator begin5_;
+ const typename ParamGenerator<T5>::iterator end5_;
+ typename ParamGenerator<T5>::iterator current5_;
+ const typename ParamGenerator<T6>::iterator begin6_;
+ const typename ParamGenerator<T6>::iterator end6_;
+ typename ParamGenerator<T6>::iterator current6_;
+ const typename ParamGenerator<T7>::iterator begin7_;
+ const typename ParamGenerator<T7>::iterator end7_;
+ typename ParamGenerator<T7>::iterator current7_;
+ const typename ParamGenerator<T8>::iterator begin8_;
+ const typename ParamGenerator<T8>::iterator end8_;
+ typename ParamGenerator<T8>::iterator current8_;
+ const typename ParamGenerator<T9>::iterator begin9_;
+ const typename ParamGenerator<T9>::iterator end9_;
+ typename ParamGenerator<T9>::iterator current9_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator9::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator9& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+ const ParamGenerator<T4> g4_;
+ const ParamGenerator<T5> g5_;
+ const ParamGenerator<T6> g6_;
+ const ParamGenerator<T7> g7_;
+ const ParamGenerator<T8> g8_;
+ const ParamGenerator<T9> g9_;
+}; // class CartesianProductGenerator9
+
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+class CartesianProductGenerator10
+ : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+ T7, T8, T9, T10> > {
+ public:
+ typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
+
+ CartesianProductGenerator10(const ParamGenerator<T1>& g1,
+ const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
+ const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
+ const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
+ const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
+ const ParamGenerator<T10>& g10)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
+ g9_(g9), g10_(g10) {}
+ virtual ~CartesianProductGenerator10() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
+ g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
+ g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
+ g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
+ g8_.end(), g9_, g9_.end(), g10_, g10_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base,
+ const ParamGenerator<T1>& g1,
+ const typename ParamGenerator<T1>::iterator& current1,
+ const ParamGenerator<T2>& g2,
+ const typename ParamGenerator<T2>::iterator& current2,
+ const ParamGenerator<T3>& g3,
+ const typename ParamGenerator<T3>::iterator& current3,
+ const ParamGenerator<T4>& g4,
+ const typename ParamGenerator<T4>::iterator& current4,
+ const ParamGenerator<T5>& g5,
+ const typename ParamGenerator<T5>::iterator& current5,
+ const ParamGenerator<T6>& g6,
+ const typename ParamGenerator<T6>::iterator& current6,
+ const ParamGenerator<T7>& g7,
+ const typename ParamGenerator<T7>::iterator& current7,
+ const ParamGenerator<T8>& g8,
+ const typename ParamGenerator<T8>::iterator& current8,
+ const ParamGenerator<T9>& g9,
+ const typename ParamGenerator<T9>::iterator& current9,
+ const ParamGenerator<T10>& g10,
+ const typename ParamGenerator<T10>::iterator& current10)
+ : base_(base),
+ begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
+ begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
+ begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
+ begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
+ begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
+ begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
+ begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
+ begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
+ begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
+ begin10_(g10.begin()), end10_(g10.end()), current10_(current10) {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current10_;
+ if (current10_ == end10_) {
+ current10_ = begin10_;
+ ++current9_;
+ }
+ if (current9_ == end9_) {
+ current9_ = begin9_;
+ ++current8_;
+ }
+ if (current8_ == end8_) {
+ current8_ = begin8_;
+ ++current7_;
+ }
+ if (current7_ == end7_) {
+ current7_ = begin7_;
+ ++current6_;
+ }
+ if (current6_ == end6_) {
+ current6_ = begin6_;
+ ++current5_;
+ }
+ if (current5_ == end5_) {
+ current5_ = begin5_;
+ ++current4_;
+ }
+ if (current4_ == end4_) {
+ current4_ = begin4_;
+ ++current3_;
+ }
+ if (current3_ == end3_) {
+ current3_ = begin3_;
+ ++current2_;
+ }
+ if (current2_ == end2_) {
+ current2_ = begin2_;
+ ++current1_;
+ }
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ (
+ current1_ == typed_other->current1_ &&
+ current2_ == typed_other->current2_ &&
+ current3_ == typed_other->current3_ &&
+ current4_ == typed_other->current4_ &&
+ current5_ == typed_other->current5_ &&
+ current6_ == typed_other->current6_ &&
+ current7_ == typed_other->current7_ &&
+ current8_ == typed_other->current8_ &&
+ current9_ == typed_other->current9_ &&
+ current10_ == typed_other->current10_);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_),
+ begin1_(other.begin1_),
+ end1_(other.end1_),
+ current1_(other.current1_),
+ begin2_(other.begin2_),
+ end2_(other.end2_),
+ current2_(other.current2_),
+ begin3_(other.begin3_),
+ end3_(other.end3_),
+ current3_(other.current3_),
+ begin4_(other.begin4_),
+ end4_(other.end4_),
+ current4_(other.current4_),
+ begin5_(other.begin5_),
+ end5_(other.end5_),
+ current5_(other.current5_),
+ begin6_(other.begin6_),
+ end6_(other.end6_),
+ current6_(other.current6_),
+ begin7_(other.begin7_),
+ end7_(other.end7_),
+ current7_(other.current7_),
+ begin8_(other.begin8_),
+ end8_(other.end8_),
+ current8_(other.current8_),
+ begin9_(other.begin9_),
+ end9_(other.end9_),
+ current9_(other.current9_),
+ begin10_(other.begin10_),
+ end10_(other.end10_),
+ current10_(other.current10_) {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType(*current1_, *current2_, *current3_,
+ *current4_, *current5_, *current6_, *current7_, *current8_,
+ *current9_, *current10_);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+ current1_ == end1_ ||
+ current2_ == end2_ ||
+ current3_ == end3_ ||
+ current4_ == end4_ ||
+ current5_ == end5_ ||
+ current6_ == end6_ ||
+ current7_ == end7_ ||
+ current8_ == end8_ ||
+ current9_ == end9_ ||
+ current10_ == end10_;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+ const typename ParamGenerator<T1>::iterator begin1_;
+ const typename ParamGenerator<T1>::iterator end1_;
+ typename ParamGenerator<T1>::iterator current1_;
+ const typename ParamGenerator<T2>::iterator begin2_;
+ const typename ParamGenerator<T2>::iterator end2_;
+ typename ParamGenerator<T2>::iterator current2_;
+ const typename ParamGenerator<T3>::iterator begin3_;
+ const typename ParamGenerator<T3>::iterator end3_;
+ typename ParamGenerator<T3>::iterator current3_;
+ const typename ParamGenerator<T4>::iterator begin4_;
+ const typename ParamGenerator<T4>::iterator end4_;
+ typename ParamGenerator<T4>::iterator current4_;
+ const typename ParamGenerator<T5>::iterator begin5_;
+ const typename ParamGenerator<T5>::iterator end5_;
+ typename ParamGenerator<T5>::iterator current5_;
+ const typename ParamGenerator<T6>::iterator begin6_;
+ const typename ParamGenerator<T6>::iterator end6_;
+ typename ParamGenerator<T6>::iterator current6_;
+ const typename ParamGenerator<T7>::iterator begin7_;
+ const typename ParamGenerator<T7>::iterator end7_;
+ typename ParamGenerator<T7>::iterator current7_;
+ const typename ParamGenerator<T8>::iterator begin8_;
+ const typename ParamGenerator<T8>::iterator end8_;
+ typename ParamGenerator<T8>::iterator current8_;
+ const typename ParamGenerator<T9>::iterator begin9_;
+ const typename ParamGenerator<T9>::iterator end9_;
+ typename ParamGenerator<T9>::iterator current9_;
+ const typename ParamGenerator<T10>::iterator begin10_;
+ const typename ParamGenerator<T10>::iterator end10_;
+ typename ParamGenerator<T10>::iterator current10_;
+ ParamType current_value_;
+ }; // class CartesianProductGenerator10::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator10& other);
+
+ const ParamGenerator<T1> g1_;
+ const ParamGenerator<T2> g2_;
+ const ParamGenerator<T3> g3_;
+ const ParamGenerator<T4> g4_;
+ const ParamGenerator<T5> g5_;
+ const ParamGenerator<T6> g6_;
+ const ParamGenerator<T7> g7_;
+ const ParamGenerator<T8> g8_;
+ const ParamGenerator<T9> g9_;
+ const ParamGenerator<T10> g10_;
+}; // class CartesianProductGenerator10
+
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Helper classes providing Combine() with polymorphic features. They allow
+// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
+// convertible to U.
+//
+template <class Generator1, class Generator2>
+class CartesianProductHolder2 {
+ public:
+CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
+ : g1_(g1), g2_(g2) {}
+ template <typename T1, typename T2>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2> >(
+ new CartesianProductGenerator2<T1, T2>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder2& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+}; // class CartesianProductHolder2
+
+template <class Generator1, class Generator2, class Generator3>
+class CartesianProductHolder3 {
+ public:
+CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3)
+ : g1_(g1), g2_(g2), g3_(g3) {}
+ template <typename T1, typename T2, typename T3>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(
+ new CartesianProductGenerator3<T1, T2, T3>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder3& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+}; // class CartesianProductHolder3
+
+template <class Generator1, class Generator2, class Generator3,
+ class Generator4>
+class CartesianProductHolder4 {
+ public:
+CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3, const Generator4& g4)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
+ template <typename T1, typename T2, typename T3, typename T4>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(
+ new CartesianProductGenerator4<T1, T2, T3, T4>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_),
+ static_cast<ParamGenerator<T4> >(g4_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder4& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+ const Generator4 g4_;
+}; // class CartesianProductHolder4
+
+template <class Generator1, class Generator2, class Generator3,
+ class Generator4, class Generator5>
+class CartesianProductHolder5 {
+ public:
+CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3, const Generator4& g4, const Generator5& g5)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
+ template <typename T1, typename T2, typename T3, typename T4, typename T5>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(
+ new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_),
+ static_cast<ParamGenerator<T4> >(g4_),
+ static_cast<ParamGenerator<T5> >(g5_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder5& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+ const Generator4 g4_;
+ const Generator5 g5_;
+}; // class CartesianProductHolder5
+
+template <class Generator1, class Generator2, class Generator3,
+ class Generator4, class Generator5, class Generator6>
+class CartesianProductHolder6 {
+ public:
+CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3, const Generator4& g4, const Generator5& g5,
+ const Generator6& g6)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(
+ new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_),
+ static_cast<ParamGenerator<T4> >(g4_),
+ static_cast<ParamGenerator<T5> >(g5_),
+ static_cast<ParamGenerator<T6> >(g6_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder6& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+ const Generator4 g4_;
+ const Generator5 g5_;
+ const Generator6 g6_;
+}; // class CartesianProductHolder6
+
+template <class Generator1, class Generator2, class Generator3,
+ class Generator4, class Generator5, class Generator6, class Generator7>
+class CartesianProductHolder7 {
+ public:
+CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3, const Generator4& g4, const Generator5& g5,
+ const Generator6& g6, const Generator7& g7)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+ T7> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(
+ new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_),
+ static_cast<ParamGenerator<T4> >(g4_),
+ static_cast<ParamGenerator<T5> >(g5_),
+ static_cast<ParamGenerator<T6> >(g6_),
+ static_cast<ParamGenerator<T7> >(g7_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder7& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+ const Generator4 g4_;
+ const Generator5 g5_;
+ const Generator6 g6_;
+ const Generator7 g7_;
+}; // class CartesianProductHolder7
+
+template <class Generator1, class Generator2, class Generator3,
+ class Generator4, class Generator5, class Generator6, class Generator7,
+ class Generator8>
+class CartesianProductHolder8 {
+ public:
+CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3, const Generator4& g4, const Generator5& g5,
+ const Generator6& g6, const Generator7& g7, const Generator8& g8)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
+ g8_(g8) {}
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,
+ T8> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
+ new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_),
+ static_cast<ParamGenerator<T4> >(g4_),
+ static_cast<ParamGenerator<T5> >(g5_),
+ static_cast<ParamGenerator<T6> >(g6_),
+ static_cast<ParamGenerator<T7> >(g7_),
+ static_cast<ParamGenerator<T8> >(g8_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder8& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+ const Generator4 g4_;
+ const Generator5 g5_;
+ const Generator6 g6_;
+ const Generator7 g7_;
+ const Generator8 g8_;
+}; // class CartesianProductHolder8
+
+template <class Generator1, class Generator2, class Generator3,
+ class Generator4, class Generator5, class Generator6, class Generator7,
+ class Generator8, class Generator9>
+class CartesianProductHolder9 {
+ public:
+CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3, const Generator4& g4, const Generator5& g5,
+ const Generator6& g6, const Generator7& g7, const Generator8& g8,
+ const Generator9& g9)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
+ g9_(g9) {}
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
+ T9> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
+ T9> >(
+ new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_),
+ static_cast<ParamGenerator<T4> >(g4_),
+ static_cast<ParamGenerator<T5> >(g5_),
+ static_cast<ParamGenerator<T6> >(g6_),
+ static_cast<ParamGenerator<T7> >(g7_),
+ static_cast<ParamGenerator<T8> >(g8_),
+ static_cast<ParamGenerator<T9> >(g9_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder9& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+ const Generator4 g4_;
+ const Generator5 g5_;
+ const Generator6 g6_;
+ const Generator7 g7_;
+ const Generator8 g8_;
+ const Generator9 g9_;
+}; // class CartesianProductHolder9
+
+template <class Generator1, class Generator2, class Generator3,
+ class Generator4, class Generator5, class Generator6, class Generator7,
+ class Generator8, class Generator9, class Generator10>
+class CartesianProductHolder10 {
+ public:
+CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
+ const Generator3& g3, const Generator4& g4, const Generator5& g5,
+ const Generator6& g6, const Generator7& g7, const Generator8& g8,
+ const Generator9& g9, const Generator10& g10)
+ : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
+ g9_(g9), g10_(g10) {}
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+ operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
+ T9, T10> >() const {
+ return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
+ T9, T10> >(
+ new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
+ T10>(
+ static_cast<ParamGenerator<T1> >(g1_),
+ static_cast<ParamGenerator<T2> >(g2_),
+ static_cast<ParamGenerator<T3> >(g3_),
+ static_cast<ParamGenerator<T4> >(g4_),
+ static_cast<ParamGenerator<T5> >(g5_),
+ static_cast<ParamGenerator<T6> >(g6_),
+ static_cast<ParamGenerator<T7> >(g7_),
+ static_cast<ParamGenerator<T8> >(g8_),
+ static_cast<ParamGenerator<T9> >(g9_),
+ static_cast<ParamGenerator<T10> >(g10_)));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder10& other);
+
+ const Generator1 g1_;
+ const Generator2 g2_;
+ const Generator3 g3_;
+ const Generator4 g4_;
+ const Generator5 g5_;
+ const Generator6 g6_;
+ const Generator7 g7_;
+ const Generator8 g8_;
+ const Generator9 g9_;
+ const Generator10 g10_;
+}; // class CartesianProductHolder10
+
+#endif // GTEST_HAS_COMBINE
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_HAS_PARAM_TEST
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h.pump b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h.pump
new file mode 100644
index 0000000..baedfbc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util-generated.h.pump
@@ -0,0 +1,301 @@
+$$ -*- mode: c++; -*-
+$var n = 50 $$ Maximum length of Values arguments we want to support.
+$var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+
+// Type and function utilities for implementing parameterized tests.
+// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
+//
+// Currently Google Test supports at most $n arguments in Values,
+// and at most $maxtuple arguments in Combine. Please contact
+// googletestframework@googlegroups.com if you need more.
+// Please note that the number of arguments to Combine is limited
+// by the maximum arity of the implementation of tr1::tuple which is
+// currently set at $maxtuple.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
+
+// scripts/fuse_gtest.py depends on gtest's own header being #included
+// *unconditionally*. Therefore these #includes cannot be moved
+// inside #if GTEST_HAS_PARAM_TEST.
+#include <gtest/internal/gtest-param-util.h>
+#include <gtest/internal/gtest-port.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+namespace testing {
+
+// Forward declarations of ValuesIn(), which is implemented in
+// include/gtest/gtest-param-test.h.
+template <typename ForwardIterator>
+internal::ParamGenerator<
+ typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn(
+ ForwardIterator begin, ForwardIterator end);
+
+template <typename T, size_t N>
+internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
+
+template <class Container>
+internal::ParamGenerator<typename Container::value_type> ValuesIn(
+ const Container& container);
+
+namespace internal {
+
+// Used in the Values() function to provide polymorphic capabilities.
+template <typename T1>
+class ValueArray1 {
+ public:
+ explicit ValueArray1(T1 v1) : v1_(v1) {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray1& other);
+
+ const T1 v1_;
+};
+
+$range i 2..n
+$for i [[
+$range j 1..i
+
+template <$for j, [[typename T$j]]>
+class ValueArray$i {
+ public:
+ ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
+
+ template <typename T>
+ operator ParamGenerator<T>() const {
+ const T array[] = {$for j, [[v$(j)_]]};
+ return ValuesIn(array);
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const ValueArray$i& other);
+
+$for j [[
+
+ const T$j v$(j)_;
+]]
+
+};
+
+]]
+
+#if GTEST_HAS_COMBINE
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Generates values from the Cartesian product of values produced
+// by the argument generators.
+//
+$range i 2..maxtuple
+$for i [[
+$range j 1..i
+$range k 2..i
+
+template <$for j, [[typename T$j]]>
+class CartesianProductGenerator$i
+ : public ParamGeneratorInterface< ::std::tr1::tuple<$for j, [[T$j]]> > {
+ public:
+ typedef ::std::tr1::tuple<$for j, [[T$j]]> ParamType;
+
+ CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]])
+ : $for j, [[g$(j)_(g$j)]] {}
+ virtual ~CartesianProductGenerator$i() {}
+
+ virtual ParamIteratorInterface<ParamType>* Begin() const {
+ return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]);
+ }
+ virtual ParamIteratorInterface<ParamType>* End() const {
+ return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]);
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<ParamType> {
+ public:
+ Iterator(const ParamGeneratorInterface<ParamType>* base, $for j, [[
+
+ const ParamGenerator<T$j>& g$j,
+ const typename ParamGenerator<T$j>::iterator& current$(j)]])
+ : base_(base),
+$for j, [[
+
+ begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j)
+]] {
+ ComputeCurrentValue();
+ }
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
+ return base_;
+ }
+ // Advance should not be called on beyond-of-range iterators
+ // so no component iterators must be beyond end of range, either.
+ virtual void Advance() {
+ assert(!AtEnd());
+ ++current$(i)_;
+
+$for k [[
+ if (current$(i+2-k)_ == end$(i+2-k)_) {
+ current$(i+2-k)_ = begin$(i+2-k)_;
+ ++current$(i+2-k-1)_;
+ }
+
+]]
+ ComputeCurrentValue();
+ }
+ virtual ParamIteratorInterface<ParamType>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const ParamType* Current() const { return &current_value_; }
+ virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const Iterator* typed_other =
+ CheckedDowncastToActualType<const Iterator>(&other);
+ // We must report iterators equal if they both point beyond their
+ // respective ranges. That can happen in a variety of fashions,
+ // so we have to consult AtEnd().
+ return (AtEnd() && typed_other->AtEnd()) ||
+ ($for j && [[
+
+ current$(j)_ == typed_other->current$(j)_
+]]);
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : base_(other.base_), $for j, [[
+
+ begin$(j)_(other.begin$(j)_),
+ end$(j)_(other.end$(j)_),
+ current$(j)_(other.current$(j)_)
+]] {
+ ComputeCurrentValue();
+ }
+
+ void ComputeCurrentValue() {
+ if (!AtEnd())
+ current_value_ = ParamType($for j, [[*current$(j)_]]);
+ }
+ bool AtEnd() const {
+ // We must report iterator past the end of the range when either of the
+ // component iterators has reached the end of its range.
+ return
+$for j || [[
+
+ current$(j)_ == end$(j)_
+]];
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<ParamType>* const base_;
+ // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
+ // current[i]_ is the actual traversing iterator.
+$for j [[
+
+ const typename ParamGenerator<T$j>::iterator begin$(j)_;
+ const typename ParamGenerator<T$j>::iterator end$(j)_;
+ typename ParamGenerator<T$j>::iterator current$(j)_;
+]]
+
+ ParamType current_value_;
+ }; // class CartesianProductGenerator$i::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductGenerator$i& other);
+
+
+$for j [[
+ const ParamGenerator<T$j> g$(j)_;
+
+]]
+}; // class CartesianProductGenerator$i
+
+
+]]
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Helper classes providing Combine() with polymorphic features. They allow
+// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
+// convertible to U.
+//
+$range i 2..maxtuple
+$for i [[
+$range j 1..i
+
+template <$for j, [[class Generator$j]]>
+class CartesianProductHolder$i {
+ public:
+CartesianProductHolder$i($for j, [[const Generator$j& g$j]])
+ : $for j, [[g$(j)_(g$j)]] {}
+ template <$for j, [[typename T$j]]>
+ operator ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >() const {
+ return ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >(
+ new CartesianProductGenerator$i<$for j, [[T$j]]>(
+$for j,[[
+
+ static_cast<ParamGenerator<T$j> >(g$(j)_)
+]]));
+ }
+
+ private:
+ // No implementation - assignment is unsupported.
+ void operator=(const CartesianProductHolder$i& other);
+
+
+$for j [[
+ const Generator$j g$(j)_;
+
+]]
+}; // class CartesianProductHolder$i
+
+]]
+
+#endif // GTEST_HAS_COMBINE
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_HAS_PARAM_TEST
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util.h
new file mode 100644
index 0000000..0cbb58c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-param-util.h
@@ -0,0 +1,619 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+
+// Type and function utilities for implementing parameterized tests.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
+
+#include <iterator>
+#include <utility>
+#include <vector>
+
+// scripts/fuse_gtest.py depends on gtest's own header being #included
+// *unconditionally*. Therefore these #includes cannot be moved
+// inside #if GTEST_HAS_PARAM_TEST.
+#include <gtest/internal/gtest-internal.h>
+#include <gtest/internal/gtest-linked_ptr.h>
+#include <gtest/internal/gtest-port.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+namespace testing {
+namespace internal {
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Outputs a message explaining invalid registration of different
+// fixture class for the same test case. This may happen when
+// TEST_P macro is used to define two tests with the same name
+// but in different namespaces.
+GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
+ const char* file, int line);
+
+template <typename> class ParamGeneratorInterface;
+template <typename> class ParamGenerator;
+
+// Interface for iterating over elements provided by an implementation
+// of ParamGeneratorInterface<T>.
+template <typename T>
+class ParamIteratorInterface {
+ public:
+ virtual ~ParamIteratorInterface() {}
+ // A pointer to the base generator instance.
+ // Used only for the purposes of iterator comparison
+ // to make sure that two iterators belong to the same generator.
+ virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
+ // Advances iterator to point to the next element
+ // provided by the generator. The caller is responsible
+ // for not calling Advance() on an iterator equal to
+ // BaseGenerator()->End().
+ virtual void Advance() = 0;
+ // Clones the iterator object. Used for implementing copy semantics
+ // of ParamIterator<T>.
+ virtual ParamIteratorInterface* Clone() const = 0;
+ // Dereferences the current iterator and provides (read-only) access
+ // to the pointed value. It is the caller's responsibility not to call
+ // Current() on an iterator equal to BaseGenerator()->End().
+ // Used for implementing ParamGenerator<T>::operator*().
+ virtual const T* Current() const = 0;
+ // Determines whether the given iterator and other point to the same
+ // element in the sequence generated by the generator.
+ // Used for implementing ParamGenerator<T>::operator==().
+ virtual bool Equals(const ParamIteratorInterface& other) const = 0;
+};
+
+// Class iterating over elements provided by an implementation of
+// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
+// and implements the const forward iterator concept.
+template <typename T>
+class ParamIterator {
+ public:
+ typedef T value_type;
+ typedef const T& reference;
+ typedef ptrdiff_t difference_type;
+
+ // ParamIterator assumes ownership of the impl_ pointer.
+ ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
+ ParamIterator& operator=(const ParamIterator& other) {
+ if (this != &other)
+ impl_.reset(other.impl_->Clone());
+ return *this;
+ }
+
+ const T& operator*() const { return *impl_->Current(); }
+ const T* operator->() const { return impl_->Current(); }
+ // Prefix version of operator++.
+ ParamIterator& operator++() {
+ impl_->Advance();
+ return *this;
+ }
+ // Postfix version of operator++.
+ ParamIterator operator++(int /*unused*/) {
+ ParamIteratorInterface<T>* clone = impl_->Clone();
+ impl_->Advance();
+ return ParamIterator(clone);
+ }
+ bool operator==(const ParamIterator& other) const {
+ return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
+ }
+ bool operator!=(const ParamIterator& other) const {
+ return !(*this == other);
+ }
+
+ private:
+ friend class ParamGenerator<T>;
+ explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
+ scoped_ptr<ParamIteratorInterface<T> > impl_;
+};
+
+// ParamGeneratorInterface<T> is the binary interface to access generators
+// defined in other translation units.
+template <typename T>
+class ParamGeneratorInterface {
+ public:
+ typedef T ParamType;
+
+ virtual ~ParamGeneratorInterface() {}
+
+ // Generator interface definition
+ virtual ParamIteratorInterface<T>* Begin() const = 0;
+ virtual ParamIteratorInterface<T>* End() const = 0;
+};
+
+// Wraps ParamGeneratorInterface<T> and provides general generator syntax
+// compatible with the STL Container concept.
+// This class implements copy initialization semantics and the contained
+// ParamGeneratorInterface<T> instance is shared among all copies
+// of the original object. This is possible because that instance is immutable.
+template<typename T>
+class ParamGenerator {
+ public:
+ typedef ParamIterator<T> iterator;
+
+ explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
+ ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
+
+ ParamGenerator& operator=(const ParamGenerator& other) {
+ impl_ = other.impl_;
+ return *this;
+ }
+
+ iterator begin() const { return iterator(impl_->Begin()); }
+ iterator end() const { return iterator(impl_->End()); }
+
+ private:
+ ::testing::internal::linked_ptr<const ParamGeneratorInterface<T> > impl_;
+};
+
+// Generates values from a range of two comparable values. Can be used to
+// generate sequences of user-defined types that implement operator+() and
+// operator<().
+// This class is used in the Range() function.
+template <typename T, typename IncrementT>
+class RangeGenerator : public ParamGeneratorInterface<T> {
+ public:
+ RangeGenerator(T begin, T end, IncrementT step)
+ : begin_(begin), end_(end),
+ step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
+ virtual ~RangeGenerator() {}
+
+ virtual ParamIteratorInterface<T>* Begin() const {
+ return new Iterator(this, begin_, 0, step_);
+ }
+ virtual ParamIteratorInterface<T>* End() const {
+ return new Iterator(this, end_, end_index_, step_);
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface<T> {
+ public:
+ Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
+ IncrementT step)
+ : base_(base), value_(value), index_(index), step_(step) {}
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
+ return base_;
+ }
+ virtual void Advance() {
+ value_ = value_ + step_;
+ index_++;
+ }
+ virtual ParamIteratorInterface<T>* Clone() const {
+ return new Iterator(*this);
+ }
+ virtual const T* Current() const { return &value_; }
+ virtual bool Equals(const ParamIteratorInterface<T>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const int other_index =
+ CheckedDowncastToActualType<const Iterator>(&other)->index_;
+ return index_ == other_index;
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ : ParamIteratorInterface<T>(),
+ base_(other.base_), value_(other.value_), index_(other.index_),
+ step_(other.step_) {}
+
+ // No implementation - assignment is unsupported.
+ void operator=(const Iterator& other);
+
+ const ParamGeneratorInterface<T>* const base_;
+ T value_;
+ int index_;
+ const IncrementT step_;
+ }; // class RangeGenerator::Iterator
+
+ static int CalculateEndIndex(const T& begin,
+ const T& end,
+ const IncrementT& step) {
+ int end_index = 0;
+ for (T i = begin; i < end; i = i + step)
+ end_index++;
+ return end_index;
+ }
+
+ // No implementation - assignment is unsupported.
+ void operator=(const RangeGenerator& other);
+
+ const T begin_;
+ const T end_;
+ const IncrementT step_;
+ // The index for the end() iterator. All the elements in the generated
+ // sequence are indexed (0-based) to aid iterator comparison.
+ const int end_index_;
+}; // class RangeGenerator
+
+
+// Generates values from a pair of STL-style iterators. Used in the
+// ValuesIn() function. The elements are copied from the source range
+// since the source can be located on the stack, and the generator
+// is likely to persist beyond that stack frame.
+template <typename T>
+class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
+ public:
+ template <typename ForwardIterator>
+ ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
+ : container_(begin, end) {}
+ virtual ~ValuesInIteratorRangeGenerator() {}
+
+ virtual ParamIteratorInterface<T>* Begin() const {
+ return new Iterator(this, container_.begin());
+ }
+ virtual ParamIteratorInterface<T>* End() const {
+ return new Iterator(this, container_.end());
+ }
+
+ private:
+ typedef typename ::std::vector<T> ContainerType;
+
+ class Iterator : public ParamIteratorInterface<T> {
+ public:
+ Iterator(const ParamGeneratorInterface<T>* base,
+ typename ContainerType::const_iterator iterator)
+ : base_(base), iterator_(iterator) {}
+ virtual ~Iterator() {}
+
+ virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
+ return base_;
+ }
+ virtual void Advance() {
+ ++iterator_;
+ value_.reset();
+ }
+ virtual ParamIteratorInterface<T>* Clone() const {
+ return new Iterator(*this);
+ }
+ // We need to use cached value referenced by iterator_ because *iterator_
+ // can return a temporary object (and of type other then T), so just
+ // having "return &*iterator_;" doesn't work.
+ // value_ is updated here and not in Advance() because Advance()
+ // can advance iterator_ beyond the end of the range, and we cannot
+ // detect that fact. The client code, on the other hand, is
+ // responsible for not calling Current() on an out-of-range iterator.
+ virtual const T* Current() const {
+ if (value_.get() == NULL)
+ value_.reset(new T(*iterator_));
+ return value_.get();
+ }
+ virtual bool Equals(const ParamIteratorInterface<T>& other) const {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ return iterator_ ==
+ CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
+ }
+
+ private:
+ Iterator(const Iterator& other)
+ // The explicit constructor call suppresses a false warning
+ // emitted by gcc when supplied with the -Wextra option.
+ : ParamIteratorInterface<T>(),
+ base_(other.base_),
+ iterator_(other.iterator_) {}
+
+ const ParamGeneratorInterface<T>* const base_;
+ typename ContainerType::const_iterator iterator_;
+ // A cached value of *iterator_. We keep it here to allow access by
+ // pointer in the wrapping iterator's operator->().
+ // value_ needs to be mutable to be accessed in Current().
+ // Use of scoped_ptr helps manage cached value's lifetime,
+ // which is bound by the lifespan of the iterator itself.
+ mutable scoped_ptr<const T> value_;
+ }; // class ValuesInIteratorRangeGenerator::Iterator
+
+ // No implementation - assignment is unsupported.
+ void operator=(const ValuesInIteratorRangeGenerator& other);
+
+ const ContainerType container_;
+}; // class ValuesInIteratorRangeGenerator
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Stores a parameter value and later creates tests parameterized with that
+// value.
+template <class TestClass>
+class ParameterizedTestFactory : public TestFactoryBase {
+ public:
+ typedef typename TestClass::ParamType ParamType;
+ explicit ParameterizedTestFactory(ParamType parameter) :
+ parameter_(parameter) {}
+ virtual Test* CreateTest() {
+ TestClass::SetParam(&parameter_);
+ return new TestClass();
+ }
+
+ private:
+ const ParamType parameter_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
+};
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// TestMetaFactoryBase is a base class for meta-factories that create
+// test factories for passing into MakeAndRegisterTestInfo function.
+template <class ParamType>
+class TestMetaFactoryBase {
+ public:
+ virtual ~TestMetaFactoryBase() {}
+
+ virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
+};
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// TestMetaFactory creates test factories for passing into
+// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
+// ownership of test factory pointer, same factory object cannot be passed
+// into that method twice. But ParameterizedTestCaseInfo is going to call
+// it for each Test/Parameter value combination. Thus it needs meta factory
+// creator class.
+template <class TestCase>
+class TestMetaFactory
+ : public TestMetaFactoryBase<typename TestCase::ParamType> {
+ public:
+ typedef typename TestCase::ParamType ParamType;
+
+ TestMetaFactory() {}
+
+ virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
+ return new ParameterizedTestFactory<TestCase>(parameter);
+ }
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
+};
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// ParameterizedTestCaseInfoBase is a generic interface
+// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
+// accumulates test information provided by TEST_P macro invocations
+// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
+// and uses that information to register all resulting test instances
+// in RegisterTests method. The ParameterizeTestCaseRegistry class holds
+// a collection of pointers to the ParameterizedTestCaseInfo objects
+// and calls RegisterTests() on each of them when asked.
+class ParameterizedTestCaseInfoBase {
+ public:
+ virtual ~ParameterizedTestCaseInfoBase() {}
+
+ // Base part of test case name for display purposes.
+ virtual const String& GetTestCaseName() const = 0;
+ // Test case id to verify identity.
+ virtual TypeId GetTestCaseTypeId() const = 0;
+ // UnitTest class invokes this method to register tests in this
+ // test case right before running them in RUN_ALL_TESTS macro.
+ // This method should not be called more then once on any single
+ // instance of a ParameterizedTestCaseInfoBase derived class.
+ virtual void RegisterTests() = 0;
+
+ protected:
+ ParameterizedTestCaseInfoBase() {}
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
+};
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
+// macro invocations for a particular test case and generators
+// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
+// test case. It registers tests with all values generated by all
+// generators when asked.
+template <class TestCase>
+class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
+ public:
+ // ParamType and GeneratorCreationFunc are private types but are required
+ // for declarations of public methods AddTestPattern() and
+ // AddTestCaseInstantiation().
+ typedef typename TestCase::ParamType ParamType;
+ // A function that returns an instance of appropriate generator type.
+ typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
+
+ explicit ParameterizedTestCaseInfo(const char* name)
+ : test_case_name_(name) {}
+
+ // Test case base name for display purposes.
+ virtual const String& GetTestCaseName() const { return test_case_name_; }
+ // Test case id to verify identity.
+ virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
+ // TEST_P macro uses AddTestPattern() to record information
+ // about a single test in a LocalTestInfo structure.
+ // test_case_name is the base name of the test case (without invocation
+ // prefix). test_base_name is the name of an individual test without
+ // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
+ // test case base name and DoBar is test base name.
+ void AddTestPattern(const char* test_case_name,
+ const char* test_base_name,
+ TestMetaFactoryBase<ParamType>* meta_factory) {
+ tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
+ test_base_name,
+ meta_factory)));
+ }
+ // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
+ // about a generator.
+ int AddTestCaseInstantiation(const char* instantiation_name,
+ GeneratorCreationFunc* func,
+ const char* /* file */,
+ int /* line */) {
+ instantiations_.push_back(::std::make_pair(instantiation_name, func));
+ return 0; // Return value used only to run this method in namespace scope.
+ }
+ // UnitTest class invokes this method to register tests in this test case
+ // test cases right before running tests in RUN_ALL_TESTS macro.
+ // This method should not be called more then once on any single
+ // instance of a ParameterizedTestCaseInfoBase derived class.
+ // UnitTest has a guard to prevent from calling this method more then once.
+ virtual void RegisterTests() {
+ for (typename TestInfoContainer::iterator test_it = tests_.begin();
+ test_it != tests_.end(); ++test_it) {
+ linked_ptr<TestInfo> test_info = *test_it;
+ for (typename InstantiationContainer::iterator gen_it =
+ instantiations_.begin(); gen_it != instantiations_.end();
+ ++gen_it) {
+ const String& instantiation_name = gen_it->first;
+ ParamGenerator<ParamType> generator((*gen_it->second)());
+
+ Message test_case_name_stream;
+ if ( !instantiation_name.empty() )
+ test_case_name_stream << instantiation_name.c_str() << "/";
+ test_case_name_stream << test_info->test_case_base_name.c_str();
+
+ int i = 0;
+ for (typename ParamGenerator<ParamType>::iterator param_it =
+ generator.begin();
+ param_it != generator.end(); ++param_it, ++i) {
+ Message test_name_stream;
+ test_name_stream << test_info->test_base_name.c_str() << "/" << i;
+ ::testing::internal::MakeAndRegisterTestInfo(
+ test_case_name_stream.GetString().c_str(),
+ test_name_stream.GetString().c_str(),
+ "", // test_case_comment
+ "", // comment; TODO(vladl@google.com): provide parameter value
+ // representation.
+ GetTestCaseTypeId(),
+ TestCase::SetUpTestCase,
+ TestCase::TearDownTestCase,
+ test_info->test_meta_factory->CreateTestFactory(*param_it));
+ } // for param_it
+ } // for gen_it
+ } // for test_it
+ } // RegisterTests
+
+ private:
+ // LocalTestInfo structure keeps information about a single test registered
+ // with TEST_P macro.
+ struct TestInfo {
+ TestInfo(const char* a_test_case_base_name,
+ const char* a_test_base_name,
+ TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
+ test_case_base_name(a_test_case_base_name),
+ test_base_name(a_test_base_name),
+ test_meta_factory(a_test_meta_factory) {}
+
+ const String test_case_base_name;
+ const String test_base_name;
+ const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
+ };
+ typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
+ // Keeps pairs of <Instantiation name, Sequence generator creation function>
+ // received from INSTANTIATE_TEST_CASE_P macros.
+ typedef ::std::vector<std::pair<String, GeneratorCreationFunc*> >
+ InstantiationContainer;
+
+ const String test_case_name_;
+ TestInfoContainer tests_;
+ InstantiationContainer instantiations_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
+}; // class ParameterizedTestCaseInfo
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
+// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
+// macros use it to locate their corresponding ParameterizedTestCaseInfo
+// descriptors.
+class ParameterizedTestCaseRegistry {
+ public:
+ ParameterizedTestCaseRegistry() {}
+ ~ParameterizedTestCaseRegistry() {
+ for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
+ it != test_case_infos_.end(); ++it) {
+ delete *it;
+ }
+ }
+
+ // Looks up or creates and returns a structure containing information about
+ // tests and instantiations of a particular test case.
+ template <class TestCase>
+ ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
+ const char* test_case_name,
+ const char* file,
+ int line) {
+ ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
+ for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
+ it != test_case_infos_.end(); ++it) {
+ if ((*it)->GetTestCaseName() == test_case_name) {
+ if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
+ // Complain about incorrect usage of Google Test facilities
+ // and terminate the program since we cannot guaranty correct
+ // test case setup and tear-down in this case.
+ ReportInvalidTestCaseType(test_case_name, file, line);
+ abort();
+ } else {
+ // At this point we are sure that the object we found is of the same
+ // type we are looking for, so we downcast it to that type
+ // without further checks.
+ typed_test_info = CheckedDowncastToActualType<
+ ParameterizedTestCaseInfo<TestCase> >(*it);
+ }
+ break;
+ }
+ }
+ if (typed_test_info == NULL) {
+ typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
+ test_case_infos_.push_back(typed_test_info);
+ }
+ return typed_test_info;
+ }
+ void RegisterTests() {
+ for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
+ it != test_case_infos_.end(); ++it) {
+ (*it)->RegisterTests();
+ }
+ }
+
+ private:
+ typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
+
+ TestCaseInfoContainer test_case_infos_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
+};
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_HAS_PARAM_TEST
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-port.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-port.h
new file mode 100644
index 0000000..a2a62be
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-port.h
@@ -0,0 +1,1497 @@
+// Copyright 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.
+//
+// Authors: wan@google.com (Zhanyong Wan)
+//
+// Low-level types and utilities for porting Google Test to various
+// platforms. They are subject to change without notice. DO NOT USE
+// THEM IN USER CODE.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
+
+// The user can define the following macros in the build script to
+// control Google Test's behavior. If the user doesn't define a macro
+// in this list, Google Test will define it.
+//
+// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
+// is/isn't available.
+// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
+// are enabled.
+// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
+// is/isn't available (some systems define
+// ::string, which is different to std::string).
+// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
+// is/isn't available (some systems define
+// ::wstring, which is different to std::wstring).
+// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
+// is/isn't available.
+// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
+// enabled.
+// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
+// std::wstring does/doesn't work (Google Test can
+// be used where std::wstring is unavailable).
+// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple
+// is/isn't available.
+// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
+// compiler supports Microsoft's "Structured
+// Exception Handling".
+// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google
+// Test's own tr1 tuple implementation should be
+// used. Unused when the user sets
+// GTEST_HAS_TR1_TUPLE to 0.
+// GTEST_LINKED_AS_SHARED_LIBRARY
+// - Define to 1 when compiling tests that use
+// Google Test as a shared library (known as
+// DLL on Windows).
+// GTEST_CREATE_SHARED_LIBRARY
+// - Define to 1 when compiling Google Test itself
+// as a shared library.
+
+// This header defines the following utilities:
+//
+// Macros indicating the current platform (defined to 1 if compiled on
+// the given platform; otherwise undefined):
+// GTEST_OS_AIX - IBM AIX
+// GTEST_OS_CYGWIN - Cygwin
+// GTEST_OS_LINUX - Linux
+// GTEST_OS_MAC - Mac OS X
+// GTEST_OS_SOLARIS - Sun Solaris
+// GTEST_OS_SYMBIAN - Symbian
+// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
+// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
+// GTEST_OS_WINDOWS_MINGW - MinGW
+// GTEST_OS_WINDOWS_MOBILE - Windows Mobile
+// GTEST_OS_ZOS - z/OS
+//
+// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
+// most stable support. Since core members of the Google Test project
+// don't have access to other platforms, support for them may be less
+// stable. If you notice any problems on your platform, please notify
+// googletestframework@googlegroups.com (patches for fixing them are
+// even more welcome!).
+//
+// Note that it is possible that none of the GTEST_OS_* macros are defined.
+//
+// Macros indicating available Google Test features (defined to 1 if
+// the corresponding feature is supported; otherwise undefined):
+// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
+// tests)
+// GTEST_HAS_DEATH_TEST - death tests
+// GTEST_HAS_PARAM_TEST - value-parameterized tests
+// GTEST_HAS_TYPED_TEST - typed tests
+// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
+// GTEST_USES_POSIX_RE - enhanced POSIX regex is used.
+// GTEST_USES_SIMPLE_RE - our own simple regex is used;
+// the above two are mutually exclusive.
+// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
+//
+// Macros for basic C++ coding:
+// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
+// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
+// variable don't have to be used.
+// GTEST_DISALLOW_ASSIGN_ - disables operator=.
+// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
+// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
+//
+// Synchronization:
+// Mutex, MutexLock, ThreadLocal, GetThreadCount()
+// - synchronization primitives.
+// GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
+// synchronization primitives have real implementations
+// and Google Test is thread-safe; or 0 otherwise.
+//
+// Template meta programming:
+// is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only.
+//
+// Smart pointers:
+// scoped_ptr - as in TR2.
+//
+// Regular expressions:
+// RE - a simple regular expression class using the POSIX
+// Extended Regular Expression syntax. Not available on
+// Windows.
+//
+// Logging:
+// GTEST_LOG_() - logs messages at the specified severity level.
+// LogToStderr() - directs all log messages to stderr.
+// FlushInfoLog() - flushes informational log messages.
+//
+// Stdout and stderr capturing:
+// CaptureStdout() - starts capturing stdout.
+// GetCapturedStdout() - stops capturing stdout and returns the captured
+// string.
+// CaptureStderr() - starts capturing stderr.
+// GetCapturedStderr() - stops capturing stderr and returns the captured
+// string.
+//
+// Integer types:
+// TypeWithSize - maps an integer to a int type.
+// Int32, UInt32, Int64, UInt64, TimeInMillis
+// - integers of known sizes.
+// BiggestInt - the biggest signed integer type.
+//
+// Command-line utilities:
+// GTEST_FLAG() - references a flag.
+// GTEST_DECLARE_*() - declares a flag.
+// GTEST_DEFINE_*() - defines a flag.
+// GetArgvs() - returns the command line as a vector of strings.
+//
+// Environment variable utilities:
+// GetEnv() - gets the value of an environment variable.
+// BoolFromGTestEnv() - parses a bool environment variable.
+// Int32FromGTestEnv() - parses an Int32 environment variable.
+// StringFromGTestEnv() - parses a string environment variable.
+
+#include <stddef.h> // For ptrdiff_t
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#ifndef _WIN32_WCE
+#include <sys/stat.h>
+#endif // !_WIN32_WCE
+
+#include <iostream> // NOLINT
+#include <sstream> // NOLINT
+#include <string> // NOLINT
+
+#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
+#define GTEST_FLAG_PREFIX_ "gtest_"
+#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
+#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
+#define GTEST_NAME_ "Google Test"
+#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
+
+// Determines the version of gcc that is used to compile this.
+#ifdef __GNUC__
+// 40302 means version 4.3.2.
+#define GTEST_GCC_VER_ \
+ (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
+#endif // __GNUC__
+
+// Determines the platform on which Google Test is compiled.
+#ifdef __CYGWIN__
+#define GTEST_OS_CYGWIN 1
+#elif defined __SYMBIAN32__
+#define GTEST_OS_SYMBIAN 1
+#elif defined _WIN32
+#define GTEST_OS_WINDOWS 1
+#ifdef _WIN32_WCE
+#define GTEST_OS_WINDOWS_MOBILE 1
+#elif defined(__MINGW__) || defined(__MINGW32__)
+#define GTEST_OS_WINDOWS_MINGW 1
+#else
+#define GTEST_OS_WINDOWS_DESKTOP 1
+#endif // _WIN32_WCE
+#elif defined __APPLE__
+#define GTEST_OS_MAC 1
+#elif defined __linux__
+#define GTEST_OS_LINUX 1
+#elif defined __MVS__
+#define GTEST_OS_ZOS 1
+#elif defined(__sun) && defined(__SVR4)
+#define GTEST_OS_SOLARIS 1
+#elif defined(_AIX)
+#define GTEST_OS_AIX 1
+#endif // __CYGWIN__
+
+#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_SYMBIAN || \
+ GTEST_OS_SOLARIS || GTEST_OS_AIX
+
+// On some platforms, <regex.h> needs someone to define size_t, and
+// won't compile otherwise. We can #include it here as we already
+// included <stdlib.h>, which is guaranteed to define size_t through
+// <stddef.h>.
+#include <regex.h> // NOLINT
+#include <strings.h> // NOLINT
+#include <sys/types.h> // NOLINT
+#include <time.h> // NOLINT
+#include <unistd.h> // NOLINT
+
+#define GTEST_USES_POSIX_RE 1
+
+#elif GTEST_OS_WINDOWS
+
+#if !GTEST_OS_WINDOWS_MOBILE
+#include <direct.h> // NOLINT
+#include <io.h> // NOLINT
+#endif
+
+// <regex.h> is not available on Windows. Use our own simple regex
+// implementation instead.
+#define GTEST_USES_SIMPLE_RE 1
+
+#else
+
+// <regex.h> may not be available on this platform. Use our own
+// simple regex implementation instead.
+#define GTEST_USES_SIMPLE_RE 1
+
+#endif // GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC ||
+ // GTEST_OS_SYMBIAN || GTEST_OS_SOLARIS || GTEST_OS_AIX
+
+#ifndef GTEST_HAS_EXCEPTIONS
+// The user didn't tell us whether exceptions are enabled, so we need
+// to figure it out.
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
+// macro to enable exceptions, so we'll do the same.
+// Assumes that exceptions are enabled by default.
+#ifndef _HAS_EXCEPTIONS
+#define _HAS_EXCEPTIONS 1
+#endif // _HAS_EXCEPTIONS
+#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
+#elif defined(__GNUC__) && __EXCEPTIONS
+// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
+#define GTEST_HAS_EXCEPTIONS 1
+#elif defined(__SUNPRO_CC)
+// Sun Pro CC supports exceptions. However, there is no compile-time way of
+// detecting whether they are enabled or not. Therefore, we assume that
+// they are enabled unless the user tells us otherwise.
+#define GTEST_HAS_EXCEPTIONS 1
+#elif defined(__IBMCPP__) && __EXCEPTIONS
+// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
+#define GTEST_HAS_EXCEPTIONS 1
+#else
+// For other compilers, we assume exceptions are disabled to be
+// conservative.
+#define GTEST_HAS_EXCEPTIONS 0
+#endif // defined(_MSC_VER) || defined(__BORLANDC__)
+#endif // GTEST_HAS_EXCEPTIONS
+
+#if !defined(GTEST_HAS_STD_STRING)
+// Even though we don't use this macro any longer, we keep it in case
+// some clients still depend on it.
+#define GTEST_HAS_STD_STRING 1
+#elif !GTEST_HAS_STD_STRING
+// The user told us that ::std::string isn't available.
+#error "Google Test cannot be used where ::std::string isn't available."
+#endif // !defined(GTEST_HAS_STD_STRING)
+
+#ifndef GTEST_HAS_GLOBAL_STRING
+// The user didn't tell us whether ::string is available, so we need
+// to figure it out.
+
+#define GTEST_HAS_GLOBAL_STRING 0
+
+#endif // GTEST_HAS_GLOBAL_STRING
+
+#ifndef GTEST_HAS_STD_WSTRING
+// The user didn't tell us whether ::std::wstring is available, so we need
+// to figure it out.
+// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
+// is available.
+
+// Cygwin 1.5 and below doesn't support ::std::wstring.
+// Cygwin 1.7 might add wstring support; this should be updated when clear.
+// Solaris' libc++ doesn't support it either.
+#define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
+
+#endif // GTEST_HAS_STD_WSTRING
+
+#ifndef GTEST_HAS_GLOBAL_WSTRING
+// The user didn't tell us whether ::wstring is available, so we need
+// to figure it out.
+#define GTEST_HAS_GLOBAL_WSTRING \
+ (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
+#endif // GTEST_HAS_GLOBAL_WSTRING
+
+// Determines whether RTTI is available.
+#ifndef GTEST_HAS_RTTI
+// The user didn't tell us whether RTTI is enabled, so we need to
+// figure it out.
+
+#ifdef _MSC_VER
+
+#ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
+#define GTEST_HAS_RTTI 1
+#else
+#define GTEST_HAS_RTTI 0
+#endif
+
+// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
+#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
+
+#ifdef __GXX_RTTI
+#define GTEST_HAS_RTTI 1
+#else
+#define GTEST_HAS_RTTI 0
+#endif // __GXX_RTTI
+
+// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
+// both the typeid and dynamic_cast features are present.
+#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
+
+#ifdef __RTTI_ALL__
+#define GTEST_HAS_RTTI 1
+#else
+#define GTEST_HAS_RTTI 0
+#endif
+
+#else
+
+// For all other compilers, we assume RTTI is enabled.
+#define GTEST_HAS_RTTI 1
+
+#endif // _MSC_VER
+
+#endif // GTEST_HAS_RTTI
+
+// It's this header's responsibility to #include <typeinfo> when RTTI
+// is enabled.
+#if GTEST_HAS_RTTI
+#include <typeinfo>
+#endif
+
+// Determines whether Google Test can use the pthreads library.
+#ifndef GTEST_HAS_PTHREAD
+// The user didn't tell us explicitly, so we assume pthreads support is
+// available on Linux and Mac.
+//
+// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
+// to your compiler flags.
+#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
+#endif // GTEST_HAS_PTHREAD
+
+// Determines whether Google Test can use tr1/tuple. You can define
+// this macro to 0 to prevent Google Test from using tuple (any
+// feature depending on tuple with be disabled in this mode).
+#ifndef GTEST_HAS_TR1_TUPLE
+// The user didn't tell us not to do it, so we assume it's OK.
+#define GTEST_HAS_TR1_TUPLE 1
+#endif // GTEST_HAS_TR1_TUPLE
+
+// Determines whether Google Test's own tr1 tuple implementation
+// should be used.
+#ifndef GTEST_USE_OWN_TR1_TUPLE
+// The user didn't tell us, so we need to figure it out.
+
+// We use our own TR1 tuple if we aren't sure the user has an
+// implementation of it already. At this time, GCC 4.0.0+ and MSVC
+// 2010 are the only mainstream compilers that come with a TR1 tuple
+// implementation. NVIDIA's CUDA NVCC compiler pretends to be GCC by
+// defining __GNUC__ and friends, but cannot compile GCC's tuple
+// implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
+// Feature Pack download, which we cannot assume the user has.
+#if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
+ || _MSC_VER >= 1600
+#define GTEST_USE_OWN_TR1_TUPLE 0
+#else
+#define GTEST_USE_OWN_TR1_TUPLE 1
+#endif
+
+#endif // GTEST_USE_OWN_TR1_TUPLE
+
+// To avoid conditional compilation everywhere, we make it
+// gtest-port.h's responsibility to #include the header implementing
+// tr1/tuple.
+#if GTEST_HAS_TR1_TUPLE
+
+#if GTEST_USE_OWN_TR1_TUPLE
+#include <gtest/internal/gtest-tuple.h>
+#elif GTEST_OS_SYMBIAN
+
+// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
+// use STLport's tuple implementation, which unfortunately doesn't
+// work as the copy of STLport distributed with Symbian is incomplete.
+// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
+// use its own tuple implementation.
+#ifdef BOOST_HAS_TR1_TUPLE
+#undef BOOST_HAS_TR1_TUPLE
+#endif // BOOST_HAS_TR1_TUPLE
+
+// This prevents <boost/tr1/detail/config.hpp>, which defines
+// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
+#define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
+#include <tuple>
+
+#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
+// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
+// not conform to the TR1 spec, which requires the header to be <tuple>.
+
+#if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
+// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
+// which is #included by <tr1/tuple>, to not compile when RTTI is
+// disabled. _TR1_FUNCTIONAL is the header guard for
+// <tr1/functional>. Hence the following #define is a hack to prevent
+// <tr1/functional> from being included.
+#define _TR1_FUNCTIONAL 1
+#include <tr1/tuple>
+#undef _TR1_FUNCTIONAL // Allows the user to #include
+ // <tr1/functional> if he chooses to.
+#else
+#include <tr1/tuple> // NOLINT
+#endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
+
+#else
+// If the compiler is not GCC 4.0+, we assume the user is using a
+// spec-conforming TR1 implementation.
+#include <tuple> // NOLINT
+#endif // GTEST_USE_OWN_TR1_TUPLE
+
+#endif // GTEST_HAS_TR1_TUPLE
+
+// Determines whether clone(2) is supported.
+// Usually it will only be available on Linux, excluding
+// Linux on the Itanium architecture.
+// Also see http://linux.die.net/man/2/clone.
+#ifndef GTEST_HAS_CLONE
+// The user didn't tell us, so we need to figure it out.
+
+#if GTEST_OS_LINUX && !defined(__ia64__)
+#define GTEST_HAS_CLONE 1
+#else
+#define GTEST_HAS_CLONE 0
+#endif // GTEST_OS_LINUX && !defined(__ia64__)
+
+#endif // GTEST_HAS_CLONE
+
+// Determines whether to support stream redirection. This is used to test
+// output correctness and to implement death tests.
+#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
+#define GTEST_HAS_STREAM_REDIRECTION_ 1
+#endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
+
+// Determines whether to support death tests.
+// Google Test does not support death tests for VC 7.1 and earlier as
+// abort() in a VC 7.1 application compiled as GUI in debug config
+// pops up a dialog window that cannot be suppressed programmatically.
+#if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
+ (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
+ GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX)
+#define GTEST_HAS_DEATH_TEST 1
+#include <vector> // NOLINT
+#endif
+
+// We don't support MSVC 7.1 with exceptions disabled now. Therefore
+// all the compilers we care about are adequate for supporting
+// value-parameterized tests.
+#define GTEST_HAS_PARAM_TEST 1
+
+// Determines whether to support type-driven tests.
+
+// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
+// Sun Pro CC, and IBM Visual Age support.
+#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
+ defined(__IBMCPP__)
+#define GTEST_HAS_TYPED_TEST 1
+#define GTEST_HAS_TYPED_TEST_P 1
+#endif
+
+// Determines whether to support Combine(). This only makes sense when
+// value-parameterized tests are enabled. The implementation doesn't
+// work on Sun Studio since it doesn't understand templated conversion
+// operators.
+#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
+#define GTEST_HAS_COMBINE 1
+#endif
+
+// Determines whether the system compiler uses UTF-16 for encoding wide strings.
+#define GTEST_WIDE_STRING_USES_UTF16_ \
+ (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
+
+// Defines some utility macros.
+
+// The GNU compiler emits a warning if nested "if" statements are followed by
+// an "else" statement and braces are not used to explicitly disambiguate the
+// "else" binding. This leads to problems with code like:
+//
+// if (gate)
+// ASSERT_*(condition) << "Some message";
+//
+// The "switch (0) case 0:" idiom is used to suppress this.
+#ifdef __INTEL_COMPILER
+#define GTEST_AMBIGUOUS_ELSE_BLOCKER_
+#else
+#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: // NOLINT
+#endif
+
+// Use this annotation at the end of a struct/class definition to
+// prevent the compiler from optimizing away instances that are never
+// used. This is useful when all interesting logic happens inside the
+// c'tor and / or d'tor. Example:
+//
+// struct Foo {
+// Foo() { ... }
+// } GTEST_ATTRIBUTE_UNUSED_;
+//
+// Also use it after a variable or parameter declaration to tell the
+// compiler the variable/parameter does not have to be used.
+#if defined(__GNUC__) && !defined(COMPILER_ICC)
+#define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
+#else
+#define GTEST_ATTRIBUTE_UNUSED_
+#endif
+
+// A macro to disallow operator=
+// This should be used in the private: declarations for a class.
+#define GTEST_DISALLOW_ASSIGN_(type)\
+ void operator=(type const &)
+
+// A macro to disallow copy constructor and operator=
+// This should be used in the private: declarations for a class.
+#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
+ type(type const &);\
+ GTEST_DISALLOW_ASSIGN_(type)
+
+// Tell the compiler to warn about unused return values for functions declared
+// with this macro. The macro should be used on function declarations
+// following the argument list:
+//
+// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
+#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
+#define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
+#else
+#define GTEST_MUST_USE_RESULT_
+#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
+
+// Determine whether the compiler supports Microsoft's Structured Exception
+// Handling. This is supported by several Windows compilers but generally
+// does not exist on any other system.
+#ifndef GTEST_HAS_SEH
+// The user didn't tell us, so we need to figure it out.
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+// These two compilers are known to support SEH.
+#define GTEST_HAS_SEH 1
+#else
+// Assume no SEH.
+#define GTEST_HAS_SEH 0
+#endif
+
+#endif // GTEST_HAS_SEH
+
+#ifdef _MSC_VER
+
+#if GTEST_LINKED_AS_SHARED_LIBRARY
+#define GTEST_API_ __declspec(dllimport)
+#elif GTEST_CREATE_SHARED_LIBRARY
+#define GTEST_API_ __declspec(dllexport)
+#endif
+
+#endif // _MSC_VER
+
+#ifndef GTEST_API_
+#define GTEST_API_
+#endif
+
+namespace testing {
+
+class Message;
+
+namespace internal {
+
+class String;
+
+typedef ::std::stringstream StrStream;
+
+// A helper for suppressing warnings on constant condition. It just
+// returns 'condition'.
+GTEST_API_ bool IsTrue(bool condition);
+
+// Defines scoped_ptr.
+
+// This implementation of scoped_ptr is PARTIAL - it only contains
+// enough stuff to satisfy Google Test's need.
+template <typename T>
+class scoped_ptr {
+ public:
+ typedef T element_type;
+
+ explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
+ ~scoped_ptr() { reset(); }
+
+ T& operator*() const { return *ptr_; }
+ T* operator->() const { return ptr_; }
+ T* get() const { return ptr_; }
+
+ T* release() {
+ T* const ptr = ptr_;
+ ptr_ = NULL;
+ return ptr;
+ }
+
+ void reset(T* p = NULL) {
+ if (p != ptr_) {
+ if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
+ delete ptr_;
+ }
+ ptr_ = p;
+ }
+ }
+ private:
+ T* ptr_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
+};
+
+// Defines RE.
+
+// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
+// Regular Expression syntax.
+class GTEST_API_ RE {
+ public:
+ // A copy constructor is required by the Standard to initialize object
+ // references from r-values.
+ RE(const RE& other) { Init(other.pattern()); }
+
+ // Constructs an RE from a string.
+ RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
+
+#if GTEST_HAS_GLOBAL_STRING
+ RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
+#endif // GTEST_HAS_GLOBAL_STRING
+
+ RE(const char* regex) { Init(regex); } // NOLINT
+ ~RE();
+
+ // Returns the string representation of the regex.
+ const char* pattern() const { return pattern_; }
+
+ // FullMatch(str, re) returns true iff regular expression re matches
+ // the entire str.
+ // PartialMatch(str, re) returns true iff regular expression re
+ // matches a substring of str (including str itself).
+ //
+ // TODO(wan@google.com): make FullMatch() and PartialMatch() work
+ // when str contains NUL characters.
+ static bool FullMatch(const ::std::string& str, const RE& re) {
+ return FullMatch(str.c_str(), re);
+ }
+ static bool PartialMatch(const ::std::string& str, const RE& re) {
+ return PartialMatch(str.c_str(), re);
+ }
+
+#if GTEST_HAS_GLOBAL_STRING
+ static bool FullMatch(const ::string& str, const RE& re) {
+ return FullMatch(str.c_str(), re);
+ }
+ static bool PartialMatch(const ::string& str, const RE& re) {
+ return PartialMatch(str.c_str(), re);
+ }
+#endif // GTEST_HAS_GLOBAL_STRING
+
+ static bool FullMatch(const char* str, const RE& re);
+ static bool PartialMatch(const char* str, const RE& re);
+
+ private:
+ void Init(const char* regex);
+
+ // We use a const char* instead of a string, as Google Test may be used
+ // where string is not available. We also do not use Google Test's own
+ // String type here, in order to simplify dependencies between the
+ // files.
+ const char* pattern_;
+ bool is_valid_;
+#if GTEST_USES_POSIX_RE
+ regex_t full_regex_; // For FullMatch().
+ regex_t partial_regex_; // For PartialMatch().
+#else // GTEST_USES_SIMPLE_RE
+ const char* full_pattern_; // For FullMatch();
+#endif
+
+ GTEST_DISALLOW_ASSIGN_(RE);
+};
+
+// Defines logging utilities:
+// GTEST_LOG_(severity) - logs messages at the specified severity level. The
+// message itself is streamed into the macro.
+// LogToStderr() - directs all log messages to stderr.
+// FlushInfoLog() - flushes informational log messages.
+
+enum GTestLogSeverity {
+ GTEST_INFO,
+ GTEST_WARNING,
+ GTEST_ERROR,
+ GTEST_FATAL
+};
+
+// Formats log entry severity, provides a stream object for streaming the
+// log message, and terminates the message with a newline when going out of
+// scope.
+class GTEST_API_ GTestLog {
+ public:
+ GTestLog(GTestLogSeverity severity, const char* file, int line);
+
+ // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
+ ~GTestLog();
+
+ ::std::ostream& GetStream() { return ::std::cerr; }
+
+ private:
+ const GTestLogSeverity severity_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
+};
+
+#define GTEST_LOG_(severity) \
+ ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
+ __FILE__, __LINE__).GetStream()
+
+inline void LogToStderr() {}
+inline void FlushInfoLog() { fflush(NULL); }
+
+// INTERNAL IMPLEMENTATION - DO NOT USE.
+//
+// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
+// is not satisfied.
+// Synopsys:
+// GTEST_CHECK_(boolean_condition);
+// or
+// GTEST_CHECK_(boolean_condition) << "Additional message";
+//
+// This checks the condition and if the condition is not satisfied
+// it prints message about the condition violation, including the
+// condition itself, plus additional message streamed into it, if any,
+// and then it aborts the program. It aborts the program irrespective of
+// whether it is built in the debug mode or not.
+#define GTEST_CHECK_(condition) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (::testing::internal::IsTrue(condition)) \
+ ; \
+ else \
+ GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
+
+// An all-mode assert to verify that the given POSIX-style function
+// call returns 0 (indicating success). Known limitation: this
+// doesn't expand to a balanced 'if' statement, so enclose the macro
+// in {} if you need to use it as the only statement in an 'if'
+// branch.
+#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
+ if (const int gtest_error = (posix_call)) \
+ GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
+ << gtest_error
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Downcasts the pointer of type Base to Derived.
+// Derived must be a subclass of Base. The parameter MUST
+// point to a class of type Derived, not any subclass of it.
+// When RTTI is available, the function performs a runtime
+// check to enforce this.
+template <class Derived, class Base>
+Derived* CheckedDowncastToActualType(Base* base) {
+#if GTEST_HAS_RTTI
+ GTEST_CHECK_(typeid(*base) == typeid(Derived));
+ return dynamic_cast<Derived*>(base); // NOLINT
+#else
+ return static_cast<Derived*>(base); // Poor man's downcast.
+#endif
+}
+
+#if GTEST_HAS_STREAM_REDIRECTION_
+
+// Defines the stderr capturer:
+// CaptureStdout - starts capturing stdout.
+// GetCapturedStdout - stops capturing stdout and returns the captured string.
+// CaptureStderr - starts capturing stderr.
+// GetCapturedStderr - stops capturing stderr and returns the captured string.
+//
+GTEST_API_ void CaptureStdout();
+GTEST_API_ String GetCapturedStdout();
+GTEST_API_ void CaptureStderr();
+GTEST_API_ String GetCapturedStderr();
+
+#endif // GTEST_HAS_STREAM_REDIRECTION_
+
+
+#if GTEST_HAS_DEATH_TEST
+
+// A copy of all command line arguments. Set by InitGoogleTest().
+extern ::std::vector<String> g_argvs;
+
+// GTEST_HAS_DEATH_TEST implies we have ::std::string.
+const ::std::vector<String>& GetArgvs();
+
+#endif // GTEST_HAS_DEATH_TEST
+
+// Defines synchronization primitives.
+
+#if GTEST_HAS_PTHREAD
+
+// Sleeps for (roughly) n milli-seconds. This function is only for
+// testing Google Test's own constructs. Don't use it in user tests,
+// either directly or indirectly.
+inline void SleepMilliseconds(int n) {
+ const timespec time = {
+ 0, // 0 seconds.
+ n * 1000L * 1000L, // And n ms.
+ };
+ nanosleep(&time, NULL);
+}
+
+// Allows a controller thread to pause execution of newly created
+// threads until notified. Instances of this class must be created
+// and destroyed in the controller thread.
+//
+// This class is only for testing Google Test's own constructs. Do not
+// use it in user tests, either directly or indirectly.
+class Notification {
+ public:
+ Notification() : notified_(false) {}
+
+ // Notifies all threads created with this notification to start. Must
+ // be called from the controller thread.
+ void Notify() { notified_ = true; }
+
+ // Blocks until the controller thread notifies. Must be called from a test
+ // thread.
+ void WaitForNotification() {
+ while(!notified_) {
+ SleepMilliseconds(10);
+ }
+ }
+
+ private:
+ volatile bool notified_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
+};
+
+// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
+// Consequently, it cannot select a correct instantiation of ThreadWithParam
+// in order to call its Run(). Introducing ThreadWithParamBase as a
+// non-templated base class for ThreadWithParam allows us to bypass this
+// problem.
+class ThreadWithParamBase {
+ public:
+ virtual ~ThreadWithParamBase() {}
+ virtual void Run() = 0;
+};
+
+// pthread_create() accepts a pointer to a function type with the C linkage.
+// According to the Standard (7.5/1), function types with different linkages
+// are different even if they are otherwise identical. Some compilers (for
+// example, SunStudio) treat them as different types. Since class methods
+// cannot be defined with C-linkage we need to define a free C-function to
+// pass into pthread_create().
+extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
+ static_cast<ThreadWithParamBase*>(thread)->Run();
+ return NULL;
+}
+
+// Helper class for testing Google Test's multi-threading constructs.
+// To use it, write:
+//
+// void ThreadFunc(int param) { /* Do things with param */ }
+// Notification thread_can_start;
+// ...
+// // The thread_can_start parameter is optional; you can supply NULL.
+// ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
+// thread_can_start.Notify();
+//
+// These classes are only for testing Google Test's own constructs. Do
+// not use them in user tests, either directly or indirectly.
+template <typename T>
+class ThreadWithParam : public ThreadWithParamBase {
+ public:
+ typedef void (*UserThreadFunc)(T);
+
+ ThreadWithParam(
+ UserThreadFunc func, T param, Notification* thread_can_start)
+ : func_(func),
+ param_(param),
+ thread_can_start_(thread_can_start),
+ finished_(false) {
+ ThreadWithParamBase* const base = this;
+ // The thread can be created only after all fields except thread_
+ // have been initialized.
+ GTEST_CHECK_POSIX_SUCCESS_(
+ pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
+ }
+ ~ThreadWithParam() { Join(); }
+
+ void Join() {
+ if (!finished_) {
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
+ finished_ = true;
+ }
+ }
+
+ virtual void Run() {
+ if (thread_can_start_ != NULL)
+ thread_can_start_->WaitForNotification();
+ func_(param_);
+ }
+
+ private:
+ const UserThreadFunc func_; // User-supplied thread function.
+ const T param_; // User-supplied parameter to the thread function.
+ // When non-NULL, used to block execution until the controller thread
+ // notifies.
+ Notification* const thread_can_start_;
+ bool finished_; // true iff we know that the thread function has finished.
+ pthread_t thread_; // The native thread object.
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
+};
+
+// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
+// true.
+#include <pthread.h>
+
+// MutexBase and Mutex implement mutex on pthreads-based platforms. They
+// are used in conjunction with class MutexLock:
+//
+// Mutex mutex;
+// ...
+// MutexLock lock(&mutex); // Acquires the mutex and releases it at the end
+// // of the current scope.
+//
+// MutexBase implements behavior for both statically and dynamically
+// allocated mutexes. Do not use MutexBase directly. Instead, write
+// the following to define a static mutex:
+//
+// GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
+//
+// You can forward declare a static mutex like this:
+//
+// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
+//
+// To create a dynamic mutex, just define an object of type Mutex.
+class MutexBase {
+ public:
+ // Acquires this mutex.
+ void Lock() {
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
+ owner_ = pthread_self();
+ }
+
+ // Releases this mutex.
+ void Unlock() {
+ // We don't protect writing to owner_ here, as it's the caller's
+ // responsibility to ensure that the current thread holds the
+ // mutex when this is called.
+ owner_ = 0;
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
+ }
+
+ // Does nothing if the current thread holds the mutex. Otherwise, crashes
+ // with high probability.
+ void AssertHeld() const {
+ GTEST_CHECK_(owner_ == pthread_self())
+ << "The current thread is not holding the mutex @" << this;
+ }
+
+ // A static mutex may be used before main() is entered. It may even
+ // be used before the dynamic initialization stage. Therefore we
+ // must be able to initialize a static mutex object at link time.
+ // This means MutexBase has to be a POD and its member variables
+ // have to be public.
+ public:
+ pthread_mutex_t mutex_; // The underlying pthread mutex.
+ pthread_t owner_; // The thread holding the mutex; 0 means no one holds it.
+};
+
+// Forward-declares a static mutex.
+#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
+ extern ::testing::internal::MutexBase mutex
+
+// Defines and statically (i.e. at link time) initializes a static mutex.
+#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
+ ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 }
+
+// The Mutex class can only be used for mutexes created at runtime. It
+// shares its API with MutexBase otherwise.
+class Mutex : public MutexBase {
+ public:
+ Mutex() {
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
+ owner_ = 0;
+ }
+ ~Mutex() {
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
+ }
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
+};
+
+// We cannot name this class MutexLock as the ctor declaration would
+// conflict with a macro named MutexLock, which is defined on some
+// platforms. Hence the typedef trick below.
+class GTestMutexLock {
+ public:
+ explicit GTestMutexLock(MutexBase* mutex)
+ : mutex_(mutex) { mutex_->Lock(); }
+
+ ~GTestMutexLock() { mutex_->Unlock(); }
+
+ private:
+ MutexBase* const mutex_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
+};
+
+typedef GTestMutexLock MutexLock;
+
+// Helpers for ThreadLocal.
+
+// pthread_key_create() requires DeleteThreadLocalValue() to have
+// C-linkage. Therefore it cannot be templatized to access
+// ThreadLocal<T>. Hence the need for class
+// ThreadLocalValueHolderBase.
+class ThreadLocalValueHolderBase {
+ public:
+ virtual ~ThreadLocalValueHolderBase() {}
+};
+
+// Called by pthread to delete thread-local data stored by
+// pthread_setspecific().
+extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
+ delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
+}
+
+// Implements thread-local storage on pthreads-based systems.
+//
+// // Thread 1
+// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
+//
+// // Thread 2
+// tl.set(150); // Changes the value for thread 2 only.
+// EXPECT_EQ(150, tl.get());
+//
+// // Thread 1
+// EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
+// tl.set(200);
+// EXPECT_EQ(200, tl.get());
+//
+// The template type argument T must have a public copy constructor.
+// In addition, the default ThreadLocal constructor requires T to have
+// a public default constructor.
+//
+// An object managed for a thread by a ThreadLocal instance is deleted
+// when the thread exits. Or, if the ThreadLocal instance dies in
+// that thread, when the ThreadLocal dies. It's the user's
+// responsibility to ensure that all other threads using a ThreadLocal
+// have exited when it dies, or the per-thread objects for those
+// threads will not be deleted.
+//
+// Google Test only uses global ThreadLocal objects. That means they
+// will die after main() has returned. Therefore, no per-thread
+// object managed by Google Test will be leaked as long as all threads
+// using Google Test have exited when main() returns.
+template <typename T>
+class ThreadLocal {
+ public:
+ ThreadLocal() : key_(CreateKey()),
+ default_() {}
+ explicit ThreadLocal(const T& value) : key_(CreateKey()),
+ default_(value) {}
+
+ ~ThreadLocal() {
+ // Destroys the managed object for the current thread, if any.
+ DeleteThreadLocalValue(pthread_getspecific(key_));
+
+ // Releases resources associated with the key. This will *not*
+ // delete managed objects for other threads.
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
+ }
+
+ T* pointer() { return GetOrCreateValue(); }
+ const T* pointer() const { return GetOrCreateValue(); }
+ const T& get() const { return *pointer(); }
+ void set(const T& value) { *pointer() = value; }
+
+ private:
+ // Holds a value of type T.
+ class ValueHolder : public ThreadLocalValueHolderBase {
+ public:
+ explicit ValueHolder(const T& value) : value_(value) {}
+
+ T* pointer() { return &value_; }
+
+ private:
+ T value_;
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
+ };
+
+ static pthread_key_t CreateKey() {
+ pthread_key_t key;
+ // When a thread exits, DeleteThreadLocalValue() will be called on
+ // the object managed for that thread.
+ GTEST_CHECK_POSIX_SUCCESS_(
+ pthread_key_create(&key, &DeleteThreadLocalValue));
+ return key;
+ }
+
+ T* GetOrCreateValue() const {
+ ThreadLocalValueHolderBase* const holder =
+ static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
+ if (holder != NULL) {
+ return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
+ }
+
+ ValueHolder* const new_holder = new ValueHolder(default_);
+ ThreadLocalValueHolderBase* const holder_base = new_holder;
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
+ return new_holder->pointer();
+ }
+
+ // A key pthreads uses for looking up per-thread values.
+ const pthread_key_t key_;
+ const T default_; // The default value for each thread.
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
+};
+
+#define GTEST_IS_THREADSAFE 1
+
+#else // GTEST_HAS_PTHREAD
+
+// A dummy implementation of synchronization primitives (mutex, lock,
+// and thread-local variable). Necessary for compiling Google Test where
+// mutex is not supported - using Google Test in multiple threads is not
+// supported on such platforms.
+
+class Mutex {
+ public:
+ Mutex() {}
+ void AssertHeld() const {}
+};
+
+#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
+ extern ::testing::internal::Mutex mutex
+
+#define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
+
+class GTestMutexLock {
+ public:
+ explicit GTestMutexLock(Mutex*) {} // NOLINT
+};
+
+typedef GTestMutexLock MutexLock;
+
+template <typename T>
+class ThreadLocal {
+ public:
+ ThreadLocal() : value_() {}
+ explicit ThreadLocal(const T& value) : value_(value) {}
+ T* pointer() { return &value_; }
+ const T* pointer() const { return &value_; }
+ const T& get() const { return value_; }
+ void set(const T& value) { value_ = value; }
+ private:
+ T value_;
+};
+
+// The above synchronization primitives have dummy implementations.
+// Therefore Google Test is not thread-safe.
+#define GTEST_IS_THREADSAFE 0
+
+#endif // GTEST_HAS_PTHREAD
+
+// Returns the number of threads running in the process, or 0 to indicate that
+// we cannot detect it.
+GTEST_API_ size_t GetThreadCount();
+
+// Passing non-POD classes through ellipsis (...) crashes the ARM
+// compiler and generates a warning in Sun Studio. The Nokia Symbian
+// and the IBM XL C/C++ compiler try to instantiate a copy constructor
+// for objects passed through ellipsis (...), failing for uncopyable
+// objects. We define this to ensure that only POD is passed through
+// ellipsis on these systems.
+#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
+// We lose support for NULL detection where the compiler doesn't like
+// passing non-POD classes through ellipsis (...).
+#define GTEST_ELLIPSIS_NEEDS_POD_ 1
+#else
+#define GTEST_CAN_COMPARE_NULL 1
+#endif
+
+// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
+// const T& and const T* in a function template. These compilers
+// _can_ decide between class template specializations for T and T*,
+// so a tr1::type_traits-like is_pointer works.
+#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
+#define GTEST_NEEDS_IS_POINTER_ 1
+#endif
+
+template <bool bool_value>
+struct bool_constant {
+ typedef bool_constant<bool_value> type;
+ static const bool value = bool_value;
+};
+template <bool bool_value> const bool bool_constant<bool_value>::value;
+
+typedef bool_constant<false> false_type;
+typedef bool_constant<true> true_type;
+
+template <typename T>
+struct is_pointer : public false_type {};
+
+template <typename T>
+struct is_pointer<T*> : public true_type {};
+
+#if GTEST_OS_WINDOWS
+#define GTEST_PATH_SEP_ "\\"
+#define GTEST_HAS_ALT_PATH_SEP_ 1
+// The biggest signed integer type the compiler supports.
+typedef __int64 BiggestInt;
+#else
+#define GTEST_PATH_SEP_ "/"
+#define GTEST_HAS_ALT_PATH_SEP_ 0
+typedef long long BiggestInt; // NOLINT
+#endif // GTEST_OS_WINDOWS
+
+// The testing::internal::posix namespace holds wrappers for common
+// POSIX functions. These wrappers hide the differences between
+// Windows/MSVC and POSIX systems. Since some compilers define these
+// standard functions as macros, the wrapper cannot have the same name
+// as the wrapped function.
+
+namespace posix {
+
+// Functions with a different name on Windows.
+
+#if GTEST_OS_WINDOWS
+
+typedef struct _stat StatStruct;
+
+#ifdef __BORLANDC__
+inline int IsATTY(int fd) { return isatty(fd); }
+inline int StrCaseCmp(const char* s1, const char* s2) {
+ return stricmp(s1, s2);
+}
+inline char* StrDup(const char* src) { return strdup(src); }
+#else // !__BORLANDC__
+#if GTEST_OS_WINDOWS_MOBILE
+inline int IsATTY(int /* fd */) { return 0; }
+#else
+inline int IsATTY(int fd) { return _isatty(fd); }
+#endif // GTEST_OS_WINDOWS_MOBILE
+inline int StrCaseCmp(const char* s1, const char* s2) {
+ return _stricmp(s1, s2);
+}
+inline char* StrDup(const char* src) { return _strdup(src); }
+#endif // __BORLANDC__
+
+#if GTEST_OS_WINDOWS_MOBILE
+inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
+// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
+// time and thus not defined there.
+#else
+inline int FileNo(FILE* file) { return _fileno(file); }
+inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
+inline int RmDir(const char* dir) { return _rmdir(dir); }
+inline bool IsDir(const StatStruct& st) {
+ return (_S_IFDIR & st.st_mode) != 0;
+}
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+#else
+
+typedef struct stat StatStruct;
+
+inline int FileNo(FILE* file) { return fileno(file); }
+inline int IsATTY(int fd) { return isatty(fd); }
+inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
+inline int StrCaseCmp(const char* s1, const char* s2) {
+ return strcasecmp(s1, s2);
+}
+inline char* StrDup(const char* src) { return strdup(src); }
+inline int RmDir(const char* dir) { return rmdir(dir); }
+inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
+
+#endif // GTEST_OS_WINDOWS
+
+// Functions deprecated by MSVC 8.0.
+
+#ifdef _MSC_VER
+// Temporarily disable warning 4996 (deprecated function).
+#pragma warning(push)
+#pragma warning(disable:4996)
+#endif
+
+inline const char* StrNCpy(char* dest, const char* src, size_t n) {
+ return strncpy(dest, src, n);
+}
+
+// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
+// StrError() aren't needed on Windows CE at this time and thus not
+// defined there.
+
+#if !GTEST_OS_WINDOWS_MOBILE
+inline int ChDir(const char* dir) { return chdir(dir); }
+#endif
+inline FILE* FOpen(const char* path, const char* mode) {
+ return fopen(path, mode);
+}
+#if !GTEST_OS_WINDOWS_MOBILE
+inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
+ return freopen(path, mode, stream);
+}
+inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
+#endif
+inline int FClose(FILE* fp) { return fclose(fp); }
+#if !GTEST_OS_WINDOWS_MOBILE
+inline int Read(int fd, void* buf, unsigned int count) {
+ return static_cast<int>(read(fd, buf, count));
+}
+inline int Write(int fd, const void* buf, unsigned int count) {
+ return static_cast<int>(write(fd, buf, count));
+}
+inline int Close(int fd) { return close(fd); }
+inline const char* StrError(int errnum) { return strerror(errnum); }
+#endif
+inline const char* GetEnv(const char* name) {
+#if GTEST_OS_WINDOWS_MOBILE
+ // We are on Windows CE, which has no environment variables.
+ return NULL;
+#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
+ // Environment variables which we programmatically clear will be set to the
+ // empty string rather than unset (NULL). Handle that case.
+ const char* const env = getenv(name);
+ return (env != NULL && env[0] != '\0') ? env : NULL;
+#else
+ return getenv(name);
+#endif
+}
+
+#ifdef _MSC_VER
+#pragma warning(pop) // Restores the warning state.
+#endif
+
+#if GTEST_OS_WINDOWS_MOBILE
+// Windows CE has no C library. The abort() function is used in
+// several places in Google Test. This implementation provides a reasonable
+// imitation of standard behaviour.
+void Abort();
+#else
+inline void Abort() { abort(); }
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+} // namespace posix
+
+// The maximum number a BiggestInt can represent. This definition
+// works no matter BiggestInt is represented in one's complement or
+// two's complement.
+//
+// We cannot rely on numeric_limits in STL, as __int64 and long long
+// are not part of standard C++ and numeric_limits doesn't need to be
+// defined for them.
+const BiggestInt kMaxBiggestInt =
+ ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
+
+// This template class serves as a compile-time function from size to
+// type. It maps a size in bytes to a primitive type with that
+// size. e.g.
+//
+// TypeWithSize<4>::UInt
+//
+// is typedef-ed to be unsigned int (unsigned integer made up of 4
+// bytes).
+//
+// Such functionality should belong to STL, but I cannot find it
+// there.
+//
+// Google Test uses this class in the implementation of floating-point
+// comparison.
+//
+// For now it only handles UInt (unsigned int) as that's all Google Test
+// needs. Other types can be easily added in the future if need
+// arises.
+template <size_t size>
+class TypeWithSize {
+ public:
+ // This prevents the user from using TypeWithSize<N> with incorrect
+ // values of N.
+ typedef void UInt;
+};
+
+// The specialization for size 4.
+template <>
+class TypeWithSize<4> {
+ public:
+ // unsigned int has size 4 in both gcc and MSVC.
+ //
+ // As base/basictypes.h doesn't compile on Windows, we cannot use
+ // uint32, uint64, and etc here.
+ typedef int Int;
+ typedef unsigned int UInt;
+};
+
+// The specialization for size 8.
+template <>
+class TypeWithSize<8> {
+ public:
+#if GTEST_OS_WINDOWS
+ typedef __int64 Int;
+ typedef unsigned __int64 UInt;
+#else
+ typedef long long Int; // NOLINT
+ typedef unsigned long long UInt; // NOLINT
+#endif // GTEST_OS_WINDOWS
+};
+
+// Integer types of known sizes.
+typedef TypeWithSize<4>::Int Int32;
+typedef TypeWithSize<4>::UInt UInt32;
+typedef TypeWithSize<8>::Int Int64;
+typedef TypeWithSize<8>::UInt UInt64;
+typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
+
+// Utilities for command line flags and environment variables.
+
+// Macro for referencing flags.
+#define GTEST_FLAG(name) FLAGS_gtest_##name
+
+// Macros for declaring flags.
+#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
+#define GTEST_DECLARE_int32_(name) \
+ GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
+#define GTEST_DECLARE_string_(name) \
+ GTEST_API_ extern ::testing::internal::String GTEST_FLAG(name)
+
+// Macros for defining flags.
+#define GTEST_DEFINE_bool_(name, default_val, doc) \
+ GTEST_API_ bool GTEST_FLAG(name) = (default_val)
+#define GTEST_DEFINE_int32_(name, default_val, doc) \
+ GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
+#define GTEST_DEFINE_string_(name, default_val, doc) \
+ GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val)
+
+// Parses 'str' for a 32-bit signed integer. If successful, writes the result
+// to *value and returns true; otherwise leaves *value unchanged and returns
+// false.
+// TODO(chandlerc): Find a better way to refactor flag and environment parsing
+// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
+// function.
+bool ParseInt32(const Message& src_text, const char* str, Int32* value);
+
+// Parses a bool/Int32/string from the environment variable
+// corresponding to the given Google Test flag.
+bool BoolFromGTestEnv(const char* flag, bool default_val);
+GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
+const char* StringFromGTestEnv(const char* flag, const char* default_val);
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-string.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-string.h
new file mode 100644
index 0000000..aff093d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-string.h
@@ -0,0 +1,350 @@
+// Copyright 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.
+//
+// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file declares the String class and functions used internally by
+// Google Test. They are subject to change without notice. They should not used
+// by code external to Google Test.
+//
+// This header file is #included by <gtest/internal/gtest-internal.h>.
+// It should not be #included by other files.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
+
+#ifdef __BORLANDC__
+// string.h is not guaranteed to provide strcpy on C++ Builder.
+#include <mem.h>
+#endif
+
+#include <string.h>
+#include <gtest/internal/gtest-port.h>
+
+#include <string>
+
+namespace testing {
+namespace internal {
+
+// String - a UTF-8 string class.
+//
+// For historic reasons, we don't use std::string.
+//
+// TODO(wan@google.com): replace this class with std::string or
+// implement it in terms of the latter.
+//
+// Note that String can represent both NULL and the empty string,
+// while std::string cannot represent NULL.
+//
+// NULL and the empty string are considered different. NULL is less
+// than anything (including the empty string) except itself.
+//
+// This class only provides minimum functionality necessary for
+// implementing Google Test. We do not intend to implement a full-fledged
+// string class here.
+//
+// Since the purpose of this class is to provide a substitute for
+// std::string on platforms where it cannot be used, we define a copy
+// constructor and assignment operators such that we don't need
+// conditional compilation in a lot of places.
+//
+// In order to make the representation efficient, the d'tor of String
+// is not virtual. Therefore DO NOT INHERIT FROM String.
+class GTEST_API_ String {
+ public:
+ // Static utility methods
+
+ // Returns the input enclosed in double quotes if it's not NULL;
+ // otherwise returns "(null)". For example, "\"Hello\"" is returned
+ // for input "Hello".
+ //
+ // This is useful for printing a C string in the syntax of a literal.
+ //
+ // Known issue: escape sequences are not handled yet.
+ static String ShowCStringQuoted(const char* c_str);
+
+ // Clones a 0-terminated C string, allocating memory using new. The
+ // caller is responsible for deleting the return value using
+ // delete[]. Returns the cloned string, or NULL if the input is
+ // NULL.
+ //
+ // This is different from strdup() in string.h, which allocates
+ // memory using malloc().
+ static const char* CloneCString(const char* c_str);
+
+#if GTEST_OS_WINDOWS_MOBILE
+ // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
+ // able to pass strings to Win32 APIs on CE we need to convert them
+ // to 'Unicode', UTF-16.
+
+ // Creates a UTF-16 wide string from the given ANSI string, allocating
+ // memory using new. The caller is responsible for deleting the return
+ // value using delete[]. Returns the wide string, or NULL if the
+ // input is NULL.
+ //
+ // The wide string is created using the ANSI codepage (CP_ACP) to
+ // match the behaviour of the ANSI versions of Win32 calls and the
+ // C runtime.
+ static LPCWSTR AnsiToUtf16(const char* c_str);
+
+ // Creates an ANSI string from the given wide string, allocating
+ // memory using new. The caller is responsible for deleting the return
+ // value using delete[]. Returns the ANSI string, or NULL if the
+ // input is NULL.
+ //
+ // The returned string is created using the ANSI codepage (CP_ACP) to
+ // match the behaviour of the ANSI versions of Win32 calls and the
+ // C runtime.
+ static const char* Utf16ToAnsi(LPCWSTR utf16_str);
+#endif
+
+ // Compares two C strings. Returns true iff they have the same content.
+ //
+ // Unlike strcmp(), this function can handle NULL argument(s). A
+ // NULL C string is considered different to any non-NULL C string,
+ // including the empty string.
+ static bool CStringEquals(const char* lhs, const char* rhs);
+
+ // Converts a wide C string to a String using the UTF-8 encoding.
+ // NULL will be converted to "(null)". If an error occurred during
+ // the conversion, "(failed to convert from wide string)" is
+ // returned.
+ static String ShowWideCString(const wchar_t* wide_c_str);
+
+ // Similar to ShowWideCString(), except that this function encloses
+ // the converted string in double quotes.
+ static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
+
+ // Compares two wide C strings. Returns true iff they have the same
+ // content.
+ //
+ // Unlike wcscmp(), this function can handle NULL argument(s). A
+ // NULL C string is considered different to any non-NULL C string,
+ // including the empty string.
+ static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
+
+ // Compares two C strings, ignoring case. Returns true iff they
+ // have the same content.
+ //
+ // Unlike strcasecmp(), this function can handle NULL argument(s).
+ // A NULL C string is considered different to any non-NULL C string,
+ // including the empty string.
+ static bool CaseInsensitiveCStringEquals(const char* lhs,
+ const char* rhs);
+
+ // Compares two wide C strings, ignoring case. Returns true iff they
+ // have the same content.
+ //
+ // Unlike wcscasecmp(), this function can handle NULL argument(s).
+ // A NULL C string is considered different to any non-NULL wide C string,
+ // including the empty string.
+ // NB: The implementations on different platforms slightly differ.
+ // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
+ // environment variable. On GNU platform this method uses wcscasecmp
+ // which compares according to LC_CTYPE category of the current locale.
+ // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
+ // current locale.
+ static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
+ const wchar_t* rhs);
+
+ // Formats a list of arguments to a String, using the same format
+ // spec string as for printf.
+ //
+ // We do not use the StringPrintf class as it is not universally
+ // available.
+ //
+ // The result is limited to 4096 characters (including the tailing
+ // 0). If 4096 characters are not enough to format the input,
+ // "<buffer exceeded>" is returned.
+ static String Format(const char* format, ...);
+
+ // C'tors
+
+ // The default c'tor constructs a NULL string.
+ String() : c_str_(NULL), length_(0) {}
+
+ // Constructs a String by cloning a 0-terminated C string.
+ String(const char* a_c_str) { // NOLINT
+ if (a_c_str == NULL) {
+ c_str_ = NULL;
+ length_ = 0;
+ } else {
+ ConstructNonNull(a_c_str, strlen(a_c_str));
+ }
+ }
+
+ // Constructs a String by copying a given number of chars from a
+ // buffer. E.g. String("hello", 3) creates the string "hel",
+ // String("a\0bcd", 4) creates "a\0bc", String(NULL, 0) creates "",
+ // and String(NULL, 1) results in access violation.
+ String(const char* buffer, size_t a_length) {
+ ConstructNonNull(buffer, a_length);
+ }
+
+ // The copy c'tor creates a new copy of the string. The two
+ // String objects do not share content.
+ String(const String& str) : c_str_(NULL), length_(0) { *this = str; }
+
+ // D'tor. String is intended to be a final class, so the d'tor
+ // doesn't need to be virtual.
+ ~String() { delete[] c_str_; }
+
+ // Allows a String to be implicitly converted to an ::std::string or
+ // ::string, and vice versa. Converting a String containing a NULL
+ // pointer to ::std::string or ::string is undefined behavior.
+ // Converting a ::std::string or ::string containing an embedded NUL
+ // character to a String will result in the prefix up to the first
+ // NUL character.
+ String(const ::std::string& str) {
+ ConstructNonNull(str.c_str(), str.length());
+ }
+
+ operator ::std::string() const { return ::std::string(c_str(), length()); }
+
+#if GTEST_HAS_GLOBAL_STRING
+ String(const ::string& str) {
+ ConstructNonNull(str.c_str(), str.length());
+ }
+
+ operator ::string() const { return ::string(c_str(), length()); }
+#endif // GTEST_HAS_GLOBAL_STRING
+
+ // Returns true iff this is an empty string (i.e. "").
+ bool empty() const { return (c_str() != NULL) && (length() == 0); }
+
+ // Compares this with another String.
+ // Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
+ // if this is greater than rhs.
+ int Compare(const String& rhs) const;
+
+ // Returns true iff this String equals the given C string. A NULL
+ // string and a non-NULL string are considered not equal.
+ bool operator==(const char* a_c_str) const { return Compare(a_c_str) == 0; }
+
+ // Returns true iff this String is less than the given String. A
+ // NULL string is considered less than "".
+ bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
+
+ // Returns true iff this String doesn't equal the given C string. A NULL
+ // string and a non-NULL string are considered not equal.
+ bool operator!=(const char* a_c_str) const { return !(*this == a_c_str); }
+
+ // Returns true iff this String ends with the given suffix. *Any*
+ // String is considered to end with a NULL or empty suffix.
+ bool EndsWith(const char* suffix) const;
+
+ // Returns true iff this String ends with the given suffix, not considering
+ // case. Any String is considered to end with a NULL or empty suffix.
+ bool EndsWithCaseInsensitive(const char* suffix) const;
+
+ // Returns the length of the encapsulated string, or 0 if the
+ // string is NULL.
+ size_t length() const { return length_; }
+
+ // Gets the 0-terminated C string this String object represents.
+ // The String object still owns the string. Therefore the caller
+ // should NOT delete the return value.
+ const char* c_str() const { return c_str_; }
+
+ // Assigns a C string to this object. Self-assignment works.
+ const String& operator=(const char* a_c_str) {
+ return *this = String(a_c_str);
+ }
+
+ // Assigns a String object to this object. Self-assignment works.
+ const String& operator=(const String& rhs) {
+ if (this != &rhs) {
+ delete[] c_str_;
+ if (rhs.c_str() == NULL) {
+ c_str_ = NULL;
+ length_ = 0;
+ } else {
+ ConstructNonNull(rhs.c_str(), rhs.length());
+ }
+ }
+
+ return *this;
+ }
+
+ private:
+ // Constructs a non-NULL String from the given content. This
+ // function can only be called when data_ has not been allocated.
+ // ConstructNonNull(NULL, 0) results in an empty string ("").
+ // ConstructNonNull(NULL, non_zero) is undefined behavior.
+ void ConstructNonNull(const char* buffer, size_t a_length) {
+ char* const str = new char[a_length + 1];
+ memcpy(str, buffer, a_length);
+ str[a_length] = '\0';
+ c_str_ = str;
+ length_ = a_length;
+ }
+
+ const char* c_str_;
+ size_t length_;
+}; // class String
+
+// Streams a String to an ostream. Each '\0' character in the String
+// is replaced with "\\0".
+inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
+ if (str.c_str() == NULL) {
+ os << "(null)";
+ } else {
+ const char* const c_str = str.c_str();
+ for (size_t i = 0; i != str.length(); i++) {
+ if (c_str[i] == '\0') {
+ os << "\\0";
+ } else {
+ os << c_str[i];
+ }
+ }
+ }
+ return os;
+}
+
+// Gets the content of the StrStream's buffer as a String. Each '\0'
+// character in the buffer is replaced with "\\0".
+GTEST_API_ String StrStreamToString(StrStream* stream);
+
+// Converts a streamable value to a String. A NULL pointer is
+// converted to "(null)". When the input value is a ::string,
+// ::std::string, ::wstring, or ::std::wstring object, each NUL
+// character in it is replaced with "\\0".
+
+// Declared here but defined in gtest.h, so that it has access
+// to the definition of the Message class, required by the ARM
+// compiler.
+template <typename T>
+String StreamableToString(const T& streamable);
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h
new file mode 100644
index 0000000..16178fc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h
@@ -0,0 +1,968 @@
+// This file was GENERATED by a script. DO NOT EDIT BY HAND!!!
+
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
+
+#include <utility> // For ::std::pair.
+
+// The compiler used in Symbian has a bug that prevents us from declaring the
+// tuple template as a friend (it complains that tuple is redefined). This
+// hack bypasses the bug by declaring the members that should otherwise be
+// private as public.
+// Sun Studio versions < 12 also have the above bug.
+#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
+#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
+#else
+#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
+ template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
+ private:
+#endif
+
+// GTEST_n_TUPLE_(T) is the type of an n-tuple.
+#define GTEST_0_TUPLE_(T) tuple<>
+#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
+ void, void, void>
+#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
+ void, void, void>
+#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
+ void, void, void>
+#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
+ void, void, void>
+#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
+ void, void, void>
+#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
+ void, void, void>
+#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
+ void, void, void>
+#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
+ T##7, void, void>
+#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
+ T##7, T##8, void>
+#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
+ T##7, T##8, T##9>
+
+// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
+#define GTEST_0_TYPENAMES_(T)
+#define GTEST_1_TYPENAMES_(T) typename T##0
+#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
+#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
+#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
+ typename T##3
+#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
+ typename T##3, typename T##4
+#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
+ typename T##3, typename T##4, typename T##5
+#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
+ typename T##3, typename T##4, typename T##5, typename T##6
+#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
+ typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
+#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
+ typename T##3, typename T##4, typename T##5, typename T##6, \
+ typename T##7, typename T##8
+#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
+ typename T##3, typename T##4, typename T##5, typename T##6, \
+ typename T##7, typename T##8, typename T##9
+
+// In theory, defining stuff in the ::std namespace is undefined
+// behavior. We can do this as we are playing the role of a standard
+// library vendor.
+namespace std {
+namespace tr1 {
+
+template <typename T0 = void, typename T1 = void, typename T2 = void,
+ typename T3 = void, typename T4 = void, typename T5 = void,
+ typename T6 = void, typename T7 = void, typename T8 = void,
+ typename T9 = void>
+class tuple;
+
+// Anything in namespace gtest_internal is Google Test's INTERNAL
+// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
+namespace gtest_internal {
+
+// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
+template <typename T>
+struct ByRef { typedef const T& type; }; // NOLINT
+template <typename T>
+struct ByRef<T&> { typedef T& type; }; // NOLINT
+
+// A handy wrapper for ByRef.
+#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
+
+// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
+// is the same as tr1::add_reference<T>::type.
+template <typename T>
+struct AddRef { typedef T& type; }; // NOLINT
+template <typename T>
+struct AddRef<T&> { typedef T& type; }; // NOLINT
+
+// A handy wrapper for AddRef.
+#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
+
+// A helper for implementing get<k>().
+template <int k> class Get;
+
+// A helper for implementing tuple_element<k, T>. kIndexValid is true
+// iff k < the number of fields in tuple type T.
+template <bool kIndexValid, int kIndex, class Tuple>
+struct TupleElement;
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
+
+} // namespace gtest_internal
+
+template <>
+class tuple<> {
+ public:
+ tuple() {}
+ tuple(const tuple& /* t */) {}
+ tuple& operator=(const tuple& /* t */) { return *this; }
+};
+
+template <GTEST_1_TYPENAMES_(T)>
+class GTEST_1_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
+
+ tuple(const tuple& t) : f0_(t.f0_) {}
+
+ template <GTEST_1_TYPENAMES_(U)>
+ tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_1_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_1_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ return *this;
+ }
+
+ T0 f0_;
+};
+
+template <GTEST_2_TYPENAMES_(T)>
+class GTEST_2_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
+ f1_(f1) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
+
+ template <GTEST_2_TYPENAMES_(U)>
+ tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
+ template <typename U0, typename U1>
+ tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_2_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+ template <typename U0, typename U1>
+ tuple& operator=(const ::std::pair<U0, U1>& p) {
+ f0_ = p.first;
+ f1_ = p.second;
+ return *this;
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_2_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+};
+
+template <GTEST_3_TYPENAMES_(T)>
+class GTEST_3_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
+
+ template <GTEST_3_TYPENAMES_(U)>
+ tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_3_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_3_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+};
+
+template <GTEST_4_TYPENAMES_(T)>
+class GTEST_4_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_(), f3_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
+ f3_(f3) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
+
+ template <GTEST_4_TYPENAMES_(U)>
+ tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
+ f3_(t.f3_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_4_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_4_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ f3_ = t.f3_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+ T3 f3_;
+};
+
+template <GTEST_5_TYPENAMES_(T)>
+class GTEST_5_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
+ GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
+ f4_(t.f4_) {}
+
+ template <GTEST_5_TYPENAMES_(U)>
+ tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
+ f3_(t.f3_), f4_(t.f4_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_5_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_5_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ f3_ = t.f3_;
+ f4_ = t.f4_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+ T3 f3_;
+ T4 f4_;
+};
+
+template <GTEST_6_TYPENAMES_(T)>
+class GTEST_6_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
+ GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
+ f5_(f5) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
+ f4_(t.f4_), f5_(t.f5_) {}
+
+ template <GTEST_6_TYPENAMES_(U)>
+ tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
+ f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_6_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_6_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ f3_ = t.f3_;
+ f4_ = t.f4_;
+ f5_ = t.f5_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+ T3 f3_;
+ T4 f4_;
+ T5 f5_;
+};
+
+template <GTEST_7_TYPENAMES_(T)>
+class GTEST_7_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
+ GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
+ f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
+ f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
+
+ template <GTEST_7_TYPENAMES_(U)>
+ tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
+ f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_7_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_7_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ f3_ = t.f3_;
+ f4_ = t.f4_;
+ f5_ = t.f5_;
+ f6_ = t.f6_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+ T3 f3_;
+ T4 f4_;
+ T5 f5_;
+ T6 f6_;
+};
+
+template <GTEST_8_TYPENAMES_(T)>
+class GTEST_8_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
+ GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
+ GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
+ f5_(f5), f6_(f6), f7_(f7) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
+ f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
+
+ template <GTEST_8_TYPENAMES_(U)>
+ tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
+ f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_8_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_8_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ f3_ = t.f3_;
+ f4_ = t.f4_;
+ f5_ = t.f5_;
+ f6_ = t.f6_;
+ f7_ = t.f7_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+ T3 f3_;
+ T4 f4_;
+ T5 f5_;
+ T6 f6_;
+ T7 f7_;
+};
+
+template <GTEST_9_TYPENAMES_(T)>
+class GTEST_9_TUPLE_(T) {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
+ GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
+ GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
+ f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
+ f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
+
+ template <GTEST_9_TYPENAMES_(U)>
+ tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
+ f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_9_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_9_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ f3_ = t.f3_;
+ f4_ = t.f4_;
+ f5_ = t.f5_;
+ f6_ = t.f6_;
+ f7_ = t.f7_;
+ f8_ = t.f8_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+ T3 f3_;
+ T4 f4_;
+ T5 f5_;
+ T6 f6_;
+ T7 f7_;
+ T8 f8_;
+};
+
+template <GTEST_10_TYPENAMES_(T)>
+class tuple {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
+ f9_() {}
+
+ explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
+ GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
+ GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
+ GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
+ f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
+
+ tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
+ f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
+
+ template <GTEST_10_TYPENAMES_(U)>
+ tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
+ f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
+ f9_(t.f9_) {}
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_10_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_10_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
+ f0_ = t.f0_;
+ f1_ = t.f1_;
+ f2_ = t.f2_;
+ f3_ = t.f3_;
+ f4_ = t.f4_;
+ f5_ = t.f5_;
+ f6_ = t.f6_;
+ f7_ = t.f7_;
+ f8_ = t.f8_;
+ f9_ = t.f9_;
+ return *this;
+ }
+
+ T0 f0_;
+ T1 f1_;
+ T2 f2_;
+ T3 f3_;
+ T4 f4_;
+ T5 f5_;
+ T6 f6_;
+ T7 f7_;
+ T8 f8_;
+ T9 f9_;
+};
+
+// 6.1.3.2 Tuple creation functions.
+
+// Known limitations: we don't support passing an
+// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
+// implement tie().
+
+inline tuple<> make_tuple() { return tuple<>(); }
+
+template <GTEST_1_TYPENAMES_(T)>
+inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
+ return GTEST_1_TUPLE_(T)(f0);
+}
+
+template <GTEST_2_TYPENAMES_(T)>
+inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
+ return GTEST_2_TUPLE_(T)(f0, f1);
+}
+
+template <GTEST_3_TYPENAMES_(T)>
+inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
+ return GTEST_3_TUPLE_(T)(f0, f1, f2);
+}
+
+template <GTEST_4_TYPENAMES_(T)>
+inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
+ const T3& f3) {
+ return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
+}
+
+template <GTEST_5_TYPENAMES_(T)>
+inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
+ const T3& f3, const T4& f4) {
+ return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
+}
+
+template <GTEST_6_TYPENAMES_(T)>
+inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
+ const T3& f3, const T4& f4, const T5& f5) {
+ return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
+}
+
+template <GTEST_7_TYPENAMES_(T)>
+inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
+ const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
+ return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
+}
+
+template <GTEST_8_TYPENAMES_(T)>
+inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
+ const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
+ return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
+}
+
+template <GTEST_9_TYPENAMES_(T)>
+inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
+ const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
+ const T8& f8) {
+ return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
+}
+
+template <GTEST_10_TYPENAMES_(T)>
+inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
+ const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
+ const T8& f8, const T9& f9) {
+ return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
+}
+
+// 6.1.3.3 Tuple helper classes.
+
+template <typename Tuple> struct tuple_size;
+
+template <GTEST_0_TYPENAMES_(T)>
+struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
+
+template <GTEST_1_TYPENAMES_(T)>
+struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
+
+template <GTEST_2_TYPENAMES_(T)>
+struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
+
+template <GTEST_3_TYPENAMES_(T)>
+struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
+
+template <GTEST_4_TYPENAMES_(T)>
+struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
+
+template <GTEST_5_TYPENAMES_(T)>
+struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
+
+template <GTEST_6_TYPENAMES_(T)>
+struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
+
+template <GTEST_7_TYPENAMES_(T)>
+struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
+
+template <GTEST_8_TYPENAMES_(T)>
+struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
+
+template <GTEST_9_TYPENAMES_(T)>
+struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
+
+template <GTEST_10_TYPENAMES_(T)>
+struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
+
+template <int k, class Tuple>
+struct tuple_element {
+ typedef typename gtest_internal::TupleElement<
+ k < (tuple_size<Tuple>::value), k, Tuple>::type type;
+};
+
+#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
+
+// 6.1.3.4 Element access.
+
+namespace gtest_internal {
+
+template <>
+class Get<0> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
+ Field(Tuple& t) { return t.f0_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
+ ConstField(const Tuple& t) { return t.f0_; }
+};
+
+template <>
+class Get<1> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
+ Field(Tuple& t) { return t.f1_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
+ ConstField(const Tuple& t) { return t.f1_; }
+};
+
+template <>
+class Get<2> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
+ Field(Tuple& t) { return t.f2_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
+ ConstField(const Tuple& t) { return t.f2_; }
+};
+
+template <>
+class Get<3> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
+ Field(Tuple& t) { return t.f3_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
+ ConstField(const Tuple& t) { return t.f3_; }
+};
+
+template <>
+class Get<4> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
+ Field(Tuple& t) { return t.f4_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
+ ConstField(const Tuple& t) { return t.f4_; }
+};
+
+template <>
+class Get<5> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
+ Field(Tuple& t) { return t.f5_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
+ ConstField(const Tuple& t) { return t.f5_; }
+};
+
+template <>
+class Get<6> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
+ Field(Tuple& t) { return t.f6_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
+ ConstField(const Tuple& t) { return t.f6_; }
+};
+
+template <>
+class Get<7> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
+ Field(Tuple& t) { return t.f7_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
+ ConstField(const Tuple& t) { return t.f7_; }
+};
+
+template <>
+class Get<8> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
+ Field(Tuple& t) { return t.f8_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
+ ConstField(const Tuple& t) { return t.f8_; }
+};
+
+template <>
+class Get<9> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
+ Field(Tuple& t) { return t.f9_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
+ ConstField(const Tuple& t) { return t.f9_; }
+};
+
+} // namespace gtest_internal
+
+template <int k, GTEST_10_TYPENAMES_(T)>
+GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
+get(GTEST_10_TUPLE_(T)& t) {
+ return gtest_internal::Get<k>::Field(t);
+}
+
+template <int k, GTEST_10_TYPENAMES_(T)>
+GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
+get(const GTEST_10_TUPLE_(T)& t) {
+ return gtest_internal::Get<k>::ConstField(t);
+}
+
+// 6.1.3.5 Relational operators
+
+// We only implement == and !=, as we don't have a need for the rest yet.
+
+namespace gtest_internal {
+
+// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
+// first k fields of t1 equals the first k fields of t2.
+// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
+// k1 != k2.
+template <int kSize1, int kSize2>
+struct SameSizeTuplePrefixComparator;
+
+template <>
+struct SameSizeTuplePrefixComparator<0, 0> {
+ template <class Tuple1, class Tuple2>
+ static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
+ return true;
+ }
+};
+
+template <int k>
+struct SameSizeTuplePrefixComparator<k, k> {
+ template <class Tuple1, class Tuple2>
+ static bool Eq(const Tuple1& t1, const Tuple2& t2) {
+ return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
+ ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
+ }
+};
+
+} // namespace gtest_internal
+
+template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
+inline bool operator==(const GTEST_10_TUPLE_(T)& t,
+ const GTEST_10_TUPLE_(U)& u) {
+ return gtest_internal::SameSizeTuplePrefixComparator<
+ tuple_size<GTEST_10_TUPLE_(T)>::value,
+ tuple_size<GTEST_10_TUPLE_(U)>::value>::Eq(t, u);
+}
+
+template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
+inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
+ const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
+
+// 6.1.4 Pairs.
+// Unimplemented.
+
+} // namespace tr1
+} // namespace std
+
+#undef GTEST_0_TUPLE_
+#undef GTEST_1_TUPLE_
+#undef GTEST_2_TUPLE_
+#undef GTEST_3_TUPLE_
+#undef GTEST_4_TUPLE_
+#undef GTEST_5_TUPLE_
+#undef GTEST_6_TUPLE_
+#undef GTEST_7_TUPLE_
+#undef GTEST_8_TUPLE_
+#undef GTEST_9_TUPLE_
+#undef GTEST_10_TUPLE_
+
+#undef GTEST_0_TYPENAMES_
+#undef GTEST_1_TYPENAMES_
+#undef GTEST_2_TYPENAMES_
+#undef GTEST_3_TYPENAMES_
+#undef GTEST_4_TYPENAMES_
+#undef GTEST_5_TYPENAMES_
+#undef GTEST_6_TYPENAMES_
+#undef GTEST_7_TYPENAMES_
+#undef GTEST_8_TYPENAMES_
+#undef GTEST_9_TYPENAMES_
+#undef GTEST_10_TYPENAMES_
+
+#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
+#undef GTEST_BY_REF_
+#undef GTEST_ADD_REF_
+#undef GTEST_TUPLE_ELEMENT_
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h.pump b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h.pump
new file mode 100644
index 0000000..85ebc80
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-tuple.h.pump
@@ -0,0 +1,336 @@
+$$ -*- mode: c++; -*-
+$var n = 10 $$ Maximum number of tuple fields we want to support.
+$$ This meta comment fixes auto-indentation in Emacs. }}
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
+
+#include <utility> // For ::std::pair.
+
+// The compiler used in Symbian has a bug that prevents us from declaring the
+// tuple template as a friend (it complains that tuple is redefined). This
+// hack bypasses the bug by declaring the members that should otherwise be
+// private as public.
+// Sun Studio versions < 12 also have the above bug.
+#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
+#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
+#else
+#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
+ template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
+ private:
+#endif
+
+
+$range i 0..n-1
+$range j 0..n
+$range k 1..n
+// GTEST_n_TUPLE_(T) is the type of an n-tuple.
+#define GTEST_0_TUPLE_(T) tuple<>
+
+$for k [[
+$range m 0..k-1
+$range m2 k..n-1
+#define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]>
+
+]]
+
+// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
+
+$for j [[
+$range m 0..j-1
+#define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]]
+
+
+]]
+
+// In theory, defining stuff in the ::std namespace is undefined
+// behavior. We can do this as we are playing the role of a standard
+// library vendor.
+namespace std {
+namespace tr1 {
+
+template <$for i, [[typename T$i = void]]>
+class tuple;
+
+// Anything in namespace gtest_internal is Google Test's INTERNAL
+// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
+namespace gtest_internal {
+
+// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
+template <typename T>
+struct ByRef { typedef const T& type; }; // NOLINT
+template <typename T>
+struct ByRef<T&> { typedef T& type; }; // NOLINT
+
+// A handy wrapper for ByRef.
+#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
+
+// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
+// is the same as tr1::add_reference<T>::type.
+template <typename T>
+struct AddRef { typedef T& type; }; // NOLINT
+template <typename T>
+struct AddRef<T&> { typedef T& type; }; // NOLINT
+
+// A handy wrapper for AddRef.
+#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
+
+// A helper for implementing get<k>().
+template <int k> class Get;
+
+// A helper for implementing tuple_element<k, T>. kIndexValid is true
+// iff k < the number of fields in tuple type T.
+template <bool kIndexValid, int kIndex, class Tuple>
+struct TupleElement;
+
+
+$for i [[
+template <GTEST_$(n)_TYPENAMES_(T)>
+struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> [[]]
+{ typedef T$i type; };
+
+
+]]
+} // namespace gtest_internal
+
+template <>
+class tuple<> {
+ public:
+ tuple() {}
+ tuple(const tuple& /* t */) {}
+ tuple& operator=(const tuple& /* t */) { return *this; }
+};
+
+
+$for k [[
+$range m 0..k-1
+template <GTEST_$(k)_TYPENAMES_(T)>
+class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] {
+ public:
+ template <int k> friend class gtest_internal::Get;
+
+ tuple() : $for m, [[f$(m)_()]] {}
+
+ explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]]
+$for m, [[f$(m)_(f$m)]] {}
+
+ tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
+
+ template <GTEST_$(k)_TYPENAMES_(U)>
+ tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
+
+$if k == 2 [[
+ template <typename U0, typename U1>
+ tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
+
+]]
+
+ tuple& operator=(const tuple& t) { return CopyFrom(t); }
+
+ template <GTEST_$(k)_TYPENAMES_(U)>
+ tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) {
+ return CopyFrom(t);
+ }
+
+$if k == 2 [[
+ template <typename U0, typename U1>
+ tuple& operator=(const ::std::pair<U0, U1>& p) {
+ f0_ = p.first;
+ f1_ = p.second;
+ return *this;
+ }
+
+]]
+
+ GTEST_DECLARE_TUPLE_AS_FRIEND_
+
+ template <GTEST_$(k)_TYPENAMES_(U)>
+ tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) {
+
+$for m [[
+ f$(m)_ = t.f$(m)_;
+
+]]
+ return *this;
+ }
+
+
+$for m [[
+ T$m f$(m)_;
+
+]]
+};
+
+
+]]
+// 6.1.3.2 Tuple creation functions.
+
+// Known limitations: we don't support passing an
+// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
+// implement tie().
+
+inline tuple<> make_tuple() { return tuple<>(); }
+
+$for k [[
+$range m 0..k-1
+
+template <GTEST_$(k)_TYPENAMES_(T)>
+inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) {
+ return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]);
+}
+
+]]
+
+// 6.1.3.3 Tuple helper classes.
+
+template <typename Tuple> struct tuple_size;
+
+
+$for j [[
+template <GTEST_$(j)_TYPENAMES_(T)>
+struct tuple_size<GTEST_$(j)_TUPLE_(T)> { static const int value = $j; };
+
+
+]]
+template <int k, class Tuple>
+struct tuple_element {
+ typedef typename gtest_internal::TupleElement<
+ k < (tuple_size<Tuple>::value), k, Tuple>::type type;
+};
+
+#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
+
+// 6.1.3.4 Element access.
+
+namespace gtest_internal {
+
+
+$for i [[
+template <>
+class Get<$i> {
+ public:
+ template <class Tuple>
+ static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
+ Field(Tuple& t) { return t.f$(i)_; } // NOLINT
+
+ template <class Tuple>
+ static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
+ ConstField(const Tuple& t) { return t.f$(i)_; }
+};
+
+
+]]
+} // namespace gtest_internal
+
+template <int k, GTEST_$(n)_TYPENAMES_(T)>
+GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
+get(GTEST_$(n)_TUPLE_(T)& t) {
+ return gtest_internal::Get<k>::Field(t);
+}
+
+template <int k, GTEST_$(n)_TYPENAMES_(T)>
+GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
+get(const GTEST_$(n)_TUPLE_(T)& t) {
+ return gtest_internal::Get<k>::ConstField(t);
+}
+
+// 6.1.3.5 Relational operators
+
+// We only implement == and !=, as we don't have a need for the rest yet.
+
+namespace gtest_internal {
+
+// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
+// first k fields of t1 equals the first k fields of t2.
+// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
+// k1 != k2.
+template <int kSize1, int kSize2>
+struct SameSizeTuplePrefixComparator;
+
+template <>
+struct SameSizeTuplePrefixComparator<0, 0> {
+ template <class Tuple1, class Tuple2>
+ static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
+ return true;
+ }
+};
+
+template <int k>
+struct SameSizeTuplePrefixComparator<k, k> {
+ template <class Tuple1, class Tuple2>
+ static bool Eq(const Tuple1& t1, const Tuple2& t2) {
+ return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
+ ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
+ }
+};
+
+} // namespace gtest_internal
+
+template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
+inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,
+ const GTEST_$(n)_TUPLE_(U)& u) {
+ return gtest_internal::SameSizeTuplePrefixComparator<
+ tuple_size<GTEST_$(n)_TUPLE_(T)>::value,
+ tuple_size<GTEST_$(n)_TUPLE_(U)>::value>::Eq(t, u);
+}
+
+template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
+inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t,
+ const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); }
+
+// 6.1.4 Pairs.
+// Unimplemented.
+
+} // namespace tr1
+} // namespace std
+
+
+$for j [[
+#undef GTEST_$(j)_TUPLE_
+
+]]
+
+
+$for j [[
+#undef GTEST_$(j)_TYPENAMES_
+
+]]
+
+#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
+#undef GTEST_BY_REF_
+#undef GTEST_ADD_REF_
+#undef GTEST_TUPLE_ELEMENT_
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h
new file mode 100644
index 0000000..093eee6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h
@@ -0,0 +1,3321 @@
+// This file was GENERATED by command:
+// pump.py gtest-type-util.h.pump
+// DO NOT EDIT BY HAND!!!
+
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Type utilities needed for implementing typed and type-parameterized
+// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
+//
+// Currently we support at most 50 types in a list, and at most 50
+// type-parameterized tests in one type-parameterized test case.
+// Please contact googletestframework@googlegroups.com if you need
+// more.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
+
+#include <gtest/internal/gtest-port.h>
+#include <gtest/internal/gtest-string.h>
+
+#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
+
+// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
+// libstdc++ (which is where cxxabi.h comes from).
+#ifdef __GLIBCXX__
+#include <cxxabi.h>
+#endif // __GLIBCXX__
+
+namespace testing {
+namespace internal {
+
+// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
+// type. This can be used as a compile-time assertion to ensure that
+// two types are equal.
+
+template <typename T1, typename T2>
+struct AssertTypeEq;
+
+template <typename T>
+struct AssertTypeEq<T, T> {
+ typedef bool type;
+};
+
+// GetTypeName<T>() returns a human-readable name of type T.
+template <typename T>
+String GetTypeName() {
+#if GTEST_HAS_RTTI
+
+ const char* const name = typeid(T).name();
+#ifdef __GLIBCXX__
+ int status = 0;
+ // gcc's implementation of typeid(T).name() mangles the type name,
+ // so we have to demangle it.
+ char* const readable_name = abi::__cxa_demangle(name, 0, 0, &status);
+ const String name_str(status == 0 ? readable_name : name);
+ free(readable_name);
+ return name_str;
+#else
+ return name;
+#endif // __GLIBCXX__
+
+#else
+ return "<type>";
+#endif // GTEST_HAS_RTTI
+}
+
+// A unique type used as the default value for the arguments of class
+// template Types. This allows us to simulate variadic templates
+// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
+// support directly.
+struct None {};
+
+// The following family of struct and struct templates are used to
+// represent type lists. In particular, TypesN<T1, T2, ..., TN>
+// represents a type list with N types (T1, T2, ..., and TN) in it.
+// Except for Types0, every struct in the family has two member types:
+// Head for the first type in the list, and Tail for the rest of the
+// list.
+
+// The empty type list.
+struct Types0 {};
+
+// Type lists of length 1, 2, 3, and so on.
+
+template <typename T1>
+struct Types1 {
+ typedef T1 Head;
+ typedef Types0 Tail;
+};
+template <typename T1, typename T2>
+struct Types2 {
+ typedef T1 Head;
+ typedef Types1<T2> Tail;
+};
+
+template <typename T1, typename T2, typename T3>
+struct Types3 {
+ typedef T1 Head;
+ typedef Types2<T2, T3> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4>
+struct Types4 {
+ typedef T1 Head;
+ typedef Types3<T2, T3, T4> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+struct Types5 {
+ typedef T1 Head;
+ typedef Types4<T2, T3, T4, T5> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6>
+struct Types6 {
+ typedef T1 Head;
+ typedef Types5<T2, T3, T4, T5, T6> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7>
+struct Types7 {
+ typedef T1 Head;
+ typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8>
+struct Types8 {
+ typedef T1 Head;
+ typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9>
+struct Types9 {
+ typedef T1 Head;
+ typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+struct Types10 {
+ typedef T1 Head;
+ typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11>
+struct Types11 {
+ typedef T1 Head;
+ typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12>
+struct Types12 {
+ typedef T1 Head;
+ typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13>
+struct Types13 {
+ typedef T1 Head;
+ typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14>
+struct Types14 {
+ typedef T1 Head;
+ typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15>
+struct Types15 {
+ typedef T1 Head;
+ typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16>
+struct Types16 {
+ typedef T1 Head;
+ typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17>
+struct Types17 {
+ typedef T1 Head;
+ typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18>
+struct Types18 {
+ typedef T1 Head;
+ typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19>
+struct Types19 {
+ typedef T1 Head;
+ typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20>
+struct Types20 {
+ typedef T1 Head;
+ typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21>
+struct Types21 {
+ typedef T1 Head;
+ typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22>
+struct Types22 {
+ typedef T1 Head;
+ typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23>
+struct Types23 {
+ typedef T1 Head;
+ typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24>
+struct Types24 {
+ typedef T1 Head;
+ typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25>
+struct Types25 {
+ typedef T1 Head;
+ typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26>
+struct Types26 {
+ typedef T1 Head;
+ typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27>
+struct Types27 {
+ typedef T1 Head;
+ typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28>
+struct Types28 {
+ typedef T1 Head;
+ typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29>
+struct Types29 {
+ typedef T1 Head;
+ typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30>
+struct Types30 {
+ typedef T1 Head;
+ typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31>
+struct Types31 {
+ typedef T1 Head;
+ typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32>
+struct Types32 {
+ typedef T1 Head;
+ typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33>
+struct Types33 {
+ typedef T1 Head;
+ typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34>
+struct Types34 {
+ typedef T1 Head;
+ typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35>
+struct Types35 {
+ typedef T1 Head;
+ typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36>
+struct Types36 {
+ typedef T1 Head;
+ typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37>
+struct Types37 {
+ typedef T1 Head;
+ typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38>
+struct Types38 {
+ typedef T1 Head;
+ typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39>
+struct Types39 {
+ typedef T1 Head;
+ typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40>
+struct Types40 {
+ typedef T1 Head;
+ typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41>
+struct Types41 {
+ typedef T1 Head;
+ typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42>
+struct Types42 {
+ typedef T1 Head;
+ typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43>
+struct Types43 {
+ typedef T1 Head;
+ typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44>
+struct Types44 {
+ typedef T1 Head;
+ typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45>
+struct Types45 {
+ typedef T1 Head;
+ typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46>
+struct Types46 {
+ typedef T1 Head;
+ typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47>
+struct Types47 {
+ typedef T1 Head;
+ typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48>
+struct Types48 {
+ typedef T1 Head;
+ typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47, T48> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49>
+struct Types49 {
+ typedef T1 Head;
+ typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47, T48, T49> Tail;
+};
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49, typename T50>
+struct Types50 {
+ typedef T1 Head;
+ typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47, T48, T49, T50> Tail;
+};
+
+
+} // namespace internal
+
+// We don't want to require the users to write TypesN<...> directly,
+// as that would require them to count the length. Types<...> is much
+// easier to write, but generates horrible messages when there is a
+// compiler error, as gcc insists on printing out each template
+// argument, even if it has the default value (this means Types<int>
+// will appear as Types<int, None, None, ..., None> in the compiler
+// errors).
+//
+// Our solution is to combine the best part of the two approaches: a
+// user would write Types<T1, ..., TN>, and Google Test will translate
+// that to TypesN<T1, ..., TN> internally to make error messages
+// readable. The translation is done by the 'type' member of the
+// Types template.
+template <typename T1 = internal::None, typename T2 = internal::None,
+ typename T3 = internal::None, typename T4 = internal::None,
+ typename T5 = internal::None, typename T6 = internal::None,
+ typename T7 = internal::None, typename T8 = internal::None,
+ typename T9 = internal::None, typename T10 = internal::None,
+ typename T11 = internal::None, typename T12 = internal::None,
+ typename T13 = internal::None, typename T14 = internal::None,
+ typename T15 = internal::None, typename T16 = internal::None,
+ typename T17 = internal::None, typename T18 = internal::None,
+ typename T19 = internal::None, typename T20 = internal::None,
+ typename T21 = internal::None, typename T22 = internal::None,
+ typename T23 = internal::None, typename T24 = internal::None,
+ typename T25 = internal::None, typename T26 = internal::None,
+ typename T27 = internal::None, typename T28 = internal::None,
+ typename T29 = internal::None, typename T30 = internal::None,
+ typename T31 = internal::None, typename T32 = internal::None,
+ typename T33 = internal::None, typename T34 = internal::None,
+ typename T35 = internal::None, typename T36 = internal::None,
+ typename T37 = internal::None, typename T38 = internal::None,
+ typename T39 = internal::None, typename T40 = internal::None,
+ typename T41 = internal::None, typename T42 = internal::None,
+ typename T43 = internal::None, typename T44 = internal::None,
+ typename T45 = internal::None, typename T46 = internal::None,
+ typename T47 = internal::None, typename T48 = internal::None,
+ typename T49 = internal::None, typename T50 = internal::None>
+struct Types {
+ typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
+};
+
+template <>
+struct Types<internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types0 type;
+};
+template <typename T1>
+struct Types<T1, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types1<T1> type;
+};
+template <typename T1, typename T2>
+struct Types<T1, T2, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types2<T1, T2> type;
+};
+template <typename T1, typename T2, typename T3>
+struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types3<T1, T2, T3> type;
+};
+template <typename T1, typename T2, typename T3, typename T4>
+struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types4<T1, T2, T3, T4> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types5<T1, T2, T3, T4, T5> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6>
+struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7>
+struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
+ T12> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
+ T26> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
+ T40> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None, internal::None> {
+ typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None, internal::None> {
+ typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
+ internal::None, internal::None, internal::None, internal::None,
+ internal::None> {
+ typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44, T45> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
+ T46, internal::None, internal::None, internal::None, internal::None> {
+ typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44, T45, T46> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
+ T46, T47, internal::None, internal::None, internal::None> {
+ typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44, T45, T46, T47> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
+ T46, T47, T48, internal::None, internal::None> {
+ typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44, T45, T46, T47, T48> type;
+};
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49>
+struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
+ T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
+ T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
+ T46, T47, T48, T49, internal::None> {
+ typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
+};
+
+namespace internal {
+
+#define GTEST_TEMPLATE_ template <typename T> class
+
+// The template "selector" struct TemplateSel<Tmpl> is used to
+// represent Tmpl, which must be a class template with one type
+// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
+// as the type Tmpl<T>. This allows us to actually instantiate the
+// template "selected" by TemplateSel<Tmpl>.
+//
+// This trick is necessary for simulating typedef for class templates,
+// which C++ doesn't support directly.
+template <GTEST_TEMPLATE_ Tmpl>
+struct TemplateSel {
+ template <typename T>
+ struct Bind {
+ typedef Tmpl<T> type;
+ };
+};
+
+#define GTEST_BIND_(TmplSel, T) \
+ TmplSel::template Bind<T>::type
+
+// A unique struct template used as the default value for the
+// arguments of class template Templates. This allows us to simulate
+// variadic templates (e.g. Templates<int>, Templates<int, double>,
+// and etc), which C++ doesn't support directly.
+template <typename T>
+struct NoneT {};
+
+// The following family of struct and struct templates are used to
+// represent template lists. In particular, TemplatesN<T1, T2, ...,
+// TN> represents a list of N templates (T1, T2, ..., and TN). Except
+// for Templates0, every struct in the family has two member types:
+// Head for the selector of the first template in the list, and Tail
+// for the rest of the list.
+
+// The empty template list.
+struct Templates0 {};
+
+// Template lists of length 1, 2, 3, and so on.
+
+template <GTEST_TEMPLATE_ T1>
+struct Templates1 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates0 Tail;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
+struct Templates2 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates1<T2> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
+struct Templates3 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates2<T2, T3> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4>
+struct Templates4 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates3<T2, T3, T4> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
+struct Templates5 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates4<T2, T3, T4, T5> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
+struct Templates6 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates5<T2, T3, T4, T5, T6> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7>
+struct Templates7 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
+struct Templates8 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
+struct Templates9 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10>
+struct Templates10 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
+struct Templates11 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
+struct Templates12 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13>
+struct Templates13 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
+struct Templates14 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
+struct Templates15 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16>
+struct Templates16 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
+struct Templates17 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
+struct Templates18 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19>
+struct Templates19 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
+struct Templates20 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
+struct Templates21 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22>
+struct Templates22 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
+struct Templates23 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
+struct Templates24 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25>
+struct Templates25 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
+struct Templates26 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
+struct Templates27 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28>
+struct Templates28 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
+struct Templates29 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
+struct Templates30 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31>
+struct Templates31 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
+struct Templates32 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
+struct Templates33 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34>
+struct Templates34 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
+struct Templates35 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
+struct Templates36 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37>
+struct Templates37 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
+struct Templates38 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
+struct Templates39 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40>
+struct Templates40 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
+struct Templates41 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
+struct Templates42 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43>
+struct Templates43 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
+struct Templates44 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43, T44> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
+struct Templates45 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43, T44, T45> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46>
+struct Templates46 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43, T44, T45, T46> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
+struct Templates47 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43, T44, T45, T46, T47> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
+struct Templates48 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43, T44, T45, T46, T47, T48> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
+ GTEST_TEMPLATE_ T49>
+struct Templates49 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43, T44, T45, T46, T47, T48, T49> Tail;
+};
+
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
+ GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
+struct Templates50 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
+ T43, T44, T45, T46, T47, T48, T49, T50> Tail;
+};
+
+
+// We don't want to require the users to write TemplatesN<...> directly,
+// as that would require them to count the length. Templates<...> is much
+// easier to write, but generates horrible messages when there is a
+// compiler error, as gcc insists on printing out each template
+// argument, even if it has the default value (this means Templates<list>
+// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
+// errors).
+//
+// Our solution is to combine the best part of the two approaches: a
+// user would write Templates<T1, ..., TN>, and Google Test will translate
+// that to TemplatesN<T1, ..., TN> internally to make error messages
+// readable. The translation is done by the 'type' member of the
+// Templates template.
+template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
+ GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
+ GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
+ GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
+ GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
+ GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
+ GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
+ GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
+ GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
+ GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
+ GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
+ GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
+ GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
+ GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
+ GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
+ GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
+ GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
+ GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
+ GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
+ GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
+ GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
+ GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
+ GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
+ GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
+ GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
+struct Templates {
+ typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
+};
+
+template <>
+struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT> {
+ typedef Templates0 type;
+};
+template <GTEST_TEMPLATE_ T1>
+struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT> {
+ typedef Templates1<T1> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
+struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT> {
+ typedef Templates2<T1, T2> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
+struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates3<T1, T2, T3> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4>
+struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates4<T1, T2, T3, T4> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
+struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates5<T1, T2, T3, T4, T5> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
+struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates6<T1, T2, T3, T4, T5, T6> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT> {
+ typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT> {
+ typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT> {
+ typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT> {
+ typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT> {
+ typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT> {
+ typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT> {
+ typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT> {
+ typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
+ NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43, T44> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
+ T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43, T44, T45> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
+ T45, T46, NoneT, NoneT, NoneT, NoneT> {
+ typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43, T44, T45, T46> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
+ T45, T46, T47, NoneT, NoneT, NoneT> {
+ typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43, T44, T45, T46, T47> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
+ T45, T46, T47, T48, NoneT, NoneT> {
+ typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43, T44, T45, T46, T47, T48> type;
+};
+template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
+ GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
+ GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
+ GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
+ GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
+ GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
+ GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
+ GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
+ GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
+ GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
+ GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
+ GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
+ GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
+ GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
+ GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
+ GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
+ GTEST_TEMPLATE_ T49>
+struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
+ T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
+ T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
+ T45, T46, T47, T48, T49, NoneT> {
+ typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
+ T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
+ T42, T43, T44, T45, T46, T47, T48, T49> type;
+};
+
+// The TypeList template makes it possible to use either a single type
+// or a Types<...> list in TYPED_TEST_CASE() and
+// INSTANTIATE_TYPED_TEST_CASE_P().
+
+template <typename T>
+struct TypeList { typedef Types1<T> type; };
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10,
+ typename T11, typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19, typename T20,
+ typename T21, typename T22, typename T23, typename T24, typename T25,
+ typename T26, typename T27, typename T28, typename T29, typename T30,
+ typename T31, typename T32, typename T33, typename T34, typename T35,
+ typename T36, typename T37, typename T38, typename T39, typename T40,
+ typename T41, typename T42, typename T43, typename T44, typename T45,
+ typename T46, typename T47, typename T48, typename T49, typename T50>
+struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
+ T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
+ T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
+ T44, T45, T46, T47, T48, T49, T50> > {
+ typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
+ T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
+ T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
+ T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
+};
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h.pump b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h.pump
new file mode 100644
index 0000000..5aed1e5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/include/gtest/internal/gtest-type-util.h.pump
@@ -0,0 +1,287 @@
+$$ -*- mode: c++; -*-
+$var n = 50 $$ Maximum length of type lists we want to support.
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Type utilities needed for implementing typed and type-parameterized
+// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
+//
+// Currently we support at most $n types in a list, and at most $n
+// type-parameterized tests in one type-parameterized test case.
+// Please contact googletestframework@googlegroups.com if you need
+// more.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
+
+#include <gtest/internal/gtest-port.h>
+#include <gtest/internal/gtest-string.h>
+
+#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
+
+// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
+// libstdc++ (which is where cxxabi.h comes from).
+#ifdef __GLIBCXX__
+#include <cxxabi.h>
+#endif // __GLIBCXX__
+
+namespace testing {
+namespace internal {
+
+// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
+// type. This can be used as a compile-time assertion to ensure that
+// two types are equal.
+
+template <typename T1, typename T2>
+struct AssertTypeEq;
+
+template <typename T>
+struct AssertTypeEq<T, T> {
+ typedef bool type;
+};
+
+// GetTypeName<T>() returns a human-readable name of type T.
+template <typename T>
+String GetTypeName() {
+#if GTEST_HAS_RTTI
+
+ const char* const name = typeid(T).name();
+#ifdef __GLIBCXX__
+ int status = 0;
+ // gcc's implementation of typeid(T).name() mangles the type name,
+ // so we have to demangle it.
+ char* const readable_name = abi::__cxa_demangle(name, 0, 0, &status);
+ const String name_str(status == 0 ? readable_name : name);
+ free(readable_name);
+ return name_str;
+#else
+ return name;
+#endif // __GLIBCXX__
+
+#else
+ return "<type>";
+#endif // GTEST_HAS_RTTI
+}
+
+// A unique type used as the default value for the arguments of class
+// template Types. This allows us to simulate variadic templates
+// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
+// support directly.
+struct None {};
+
+// The following family of struct and struct templates are used to
+// represent type lists. In particular, TypesN<T1, T2, ..., TN>
+// represents a type list with N types (T1, T2, ..., and TN) in it.
+// Except for Types0, every struct in the family has two member types:
+// Head for the first type in the list, and Tail for the rest of the
+// list.
+
+// The empty type list.
+struct Types0 {};
+
+// Type lists of length 1, 2, 3, and so on.
+
+template <typename T1>
+struct Types1 {
+ typedef T1 Head;
+ typedef Types0 Tail;
+};
+
+$range i 2..n
+
+$for i [[
+$range j 1..i
+$range k 2..i
+template <$for j, [[typename T$j]]>
+struct Types$i {
+ typedef T1 Head;
+ typedef Types$(i-1)<$for k, [[T$k]]> Tail;
+};
+
+
+]]
+
+} // namespace internal
+
+// We don't want to require the users to write TypesN<...> directly,
+// as that would require them to count the length. Types<...> is much
+// easier to write, but generates horrible messages when there is a
+// compiler error, as gcc insists on printing out each template
+// argument, even if it has the default value (this means Types<int>
+// will appear as Types<int, None, None, ..., None> in the compiler
+// errors).
+//
+// Our solution is to combine the best part of the two approaches: a
+// user would write Types<T1, ..., TN>, and Google Test will translate
+// that to TypesN<T1, ..., TN> internally to make error messages
+// readable. The translation is done by the 'type' member of the
+// Types template.
+
+$range i 1..n
+template <$for i, [[typename T$i = internal::None]]>
+struct Types {
+ typedef internal::Types$n<$for i, [[T$i]]> type;
+};
+
+template <>
+struct Types<$for i, [[internal::None]]> {
+ typedef internal::Types0 type;
+};
+
+$range i 1..n-1
+$for i [[
+$range j 1..i
+$range k i+1..n
+template <$for j, [[typename T$j]]>
+struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
+ typedef internal::Types$i<$for j, [[T$j]]> type;
+};
+
+]]
+
+namespace internal {
+
+#define GTEST_TEMPLATE_ template <typename T> class
+
+// The template "selector" struct TemplateSel<Tmpl> is used to
+// represent Tmpl, which must be a class template with one type
+// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
+// as the type Tmpl<T>. This allows us to actually instantiate the
+// template "selected" by TemplateSel<Tmpl>.
+//
+// This trick is necessary for simulating typedef for class templates,
+// which C++ doesn't support directly.
+template <GTEST_TEMPLATE_ Tmpl>
+struct TemplateSel {
+ template <typename T>
+ struct Bind {
+ typedef Tmpl<T> type;
+ };
+};
+
+#define GTEST_BIND_(TmplSel, T) \
+ TmplSel::template Bind<T>::type
+
+// A unique struct template used as the default value for the
+// arguments of class template Templates. This allows us to simulate
+// variadic templates (e.g. Templates<int>, Templates<int, double>,
+// and etc), which C++ doesn't support directly.
+template <typename T>
+struct NoneT {};
+
+// The following family of struct and struct templates are used to
+// represent template lists. In particular, TemplatesN<T1, T2, ...,
+// TN> represents a list of N templates (T1, T2, ..., and TN). Except
+// for Templates0, every struct in the family has two member types:
+// Head for the selector of the first template in the list, and Tail
+// for the rest of the list.
+
+// The empty template list.
+struct Templates0 {};
+
+// Template lists of length 1, 2, 3, and so on.
+
+template <GTEST_TEMPLATE_ T1>
+struct Templates1 {
+ typedef TemplateSel<T1> Head;
+ typedef Templates0 Tail;
+};
+
+$range i 2..n
+
+$for i [[
+$range j 1..i
+$range k 2..i
+template <$for j, [[GTEST_TEMPLATE_ T$j]]>
+struct Templates$i {
+ typedef TemplateSel<T1> Head;
+ typedef Templates$(i-1)<$for k, [[T$k]]> Tail;
+};
+
+
+]]
+
+// We don't want to require the users to write TemplatesN<...> directly,
+// as that would require them to count the length. Templates<...> is much
+// easier to write, but generates horrible messages when there is a
+// compiler error, as gcc insists on printing out each template
+// argument, even if it has the default value (this means Templates<list>
+// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
+// errors).
+//
+// Our solution is to combine the best part of the two approaches: a
+// user would write Templates<T1, ..., TN>, and Google Test will translate
+// that to TemplatesN<T1, ..., TN> internally to make error messages
+// readable. The translation is done by the 'type' member of the
+// Templates template.
+
+$range i 1..n
+template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>
+struct Templates {
+ typedef Templates$n<$for i, [[T$i]]> type;
+};
+
+template <>
+struct Templates<$for i, [[NoneT]]> {
+ typedef Templates0 type;
+};
+
+$range i 1..n-1
+$for i [[
+$range j 1..i
+$range k i+1..n
+template <$for j, [[GTEST_TEMPLATE_ T$j]]>
+struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
+ typedef Templates$i<$for j, [[T$j]]> type;
+};
+
+]]
+
+// The TypeList template makes it possible to use either a single type
+// or a Types<...> list in TYPED_TEST_CASE() and
+// INSTANTIATE_TYPED_TEST_CASE_P().
+
+template <typename T>
+struct TypeList { typedef Types1<T> type; };
+
+
+$range i 1..n
+template <$for i, [[typename T$i]]>
+struct TypeList<Types<$for i, [[T$i]]> > {
+ typedef typename Types<$for i, [[T$i]]>::type type;
+};
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
+
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/m4/acx_pthread.m4 b/src/3rdparty/webkit/Source/ThirdParty/gtest/m4/acx_pthread.m4
new file mode 100644
index 0000000..2cf20de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/m4/acx_pthread.m4
@@ -0,0 +1,363 @@
+# This was retrieved from
+# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi
+# See also (perhaps for new versions?)
+# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi
+#
+# We've rewritten the inconsistency check code (from avahi), to work
+# more broadly. In particular, it no longer assumes ld accepts -zdefs.
+# This caused a restructing of the code, but the functionality has only
+# changed a little.
+
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl @summary figure out how to build C programs using POSIX threads
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl LIBS="$PTHREAD_LIBS $LIBS"
+dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
+dnl @version 2006-05-29
+dnl @license GPLWithACException
+dnl
+dnl Checks for GCC shared/pthread inconsistency based on work by
+dnl Marcin Owsiany <marcin@owsiany.pl>
+
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test x"$acx_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+ *solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+ ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+ if test x"$acx_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [acx_pthread_ok=yes])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test "x$acx_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+ [attr_name=$attr; break])
+ done
+ AC_MSG_RESULT($attr_name)
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case "${host_cpu}-${host_os}" in
+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
+
+ # The next part tries to detect GCC inconsistency with -shared on some
+ # architectures and systems. The problem is that in certain
+ # configurations, when -shared is specified, GCC "forgets" to
+ # internally use various flags which are still necessary.
+
+ #
+ # Prepare the flags
+ #
+ save_CFLAGS="$CFLAGS"
+ save_LIBS="$LIBS"
+ save_CC="$CC"
+
+ # Try with the flags determined by the earlier checks.
+ #
+ # -Wl,-z,defs forces link-time symbol resolution, so that the
+ # linking checks with -shared actually have any value
+ #
+ # FIXME: -fPIC is required for -shared on many architectures,
+ # so we specify it here, but the right way would probably be to
+ # properly detect whether it is actually required.
+ CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CC="$PTHREAD_CC"
+
+ # In order not to create several levels of indentation, we test
+ # the value of "$done" until we find the cure or run out of ideas.
+ done="no"
+
+ # First, make sure the CFLAGS we added are actually accepted by our
+ # compiler. If not (and OS X's ld, for instance, does not accept -z),
+ # then we can't do this test.
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
+ AC_TRY_LINK(,, , [done=yes])
+
+ if test "x$done" = xyes ; then
+ AC_MSG_RESULT([no])
+ else
+ AC_MSG_RESULT([yes])
+ fi
+ fi
+
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+
+ #
+ # Linux gcc on some architectures such as mips/mipsel forgets
+ # about -lpthread
+ #
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether -lpthread fixes that])
+ LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+ #
+ # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
+ #
+ if test x"$done" = xno; then
+ AC_MSG_CHECKING([whether -lc_r fixes that])
+ LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [done=yes])
+
+ if test "x$done" = xyes; then
+ AC_MSG_RESULT([yes])
+ PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+ if test x"$done" = xno; then
+ # OK, we have run out of ideas
+ AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
+
+ # so it's not safe to assume that we may use pthreads
+ acx_pthread_ok=no
+ fi
+
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
+ CC="$save_CC"
+else
+ PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+ :
+else
+ acx_pthread_ok=no
+ $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/m4/gtest.m4 b/src/3rdparty/webkit/Source/ThirdParty/gtest/m4/gtest.m4
new file mode 100644
index 0000000..6598ba7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/m4/gtest.m4
@@ -0,0 +1,74 @@
+dnl GTEST_LIB_CHECK([minimum version [,
+dnl action if found [,action if not found]]])
+dnl
+dnl Check for the presence of the Google Test library, optionally at a minimum
+dnl version, and indicate a viable version with the HAVE_GTEST flag. It defines
+dnl standard variables for substitution including GTEST_CPPFLAGS,
+dnl GTEST_CXXFLAGS, GTEST_LDFLAGS, and GTEST_LIBS. It also defines
+dnl GTEST_VERSION as the version of Google Test found. Finally, it provides
+dnl optional custom action slots in the event GTEST is found or not.
+AC_DEFUN([GTEST_LIB_CHECK],
+[
+dnl Provide a flag to enable or disable Google Test usage.
+AC_ARG_ENABLE([gtest],
+ [AS_HELP_STRING([--enable-gtest],
+ [Enable tests using the Google C++ Testing Framework.
+ (Default is enabled.)])],
+ [],
+ [enable_gtest=])
+AC_ARG_VAR([GTEST_CONFIG],
+ [The exact path of Google Test's 'gtest-config' script.])
+AC_ARG_VAR([GTEST_CPPFLAGS],
+ [C-like preprocessor flags for Google Test.])
+AC_ARG_VAR([GTEST_CXXFLAGS],
+ [C++ compile flags for Google Test.])
+AC_ARG_VAR([GTEST_LDFLAGS],
+ [Linker path and option flags for Google Test.])
+AC_ARG_VAR([GTEST_LIBS],
+ [Library linking flags for Google Test.])
+AC_ARG_VAR([GTEST_VERSION],
+ [The version of Google Test available.])
+HAVE_GTEST="no"
+AS_IF([test "x${enable_gtest}" != "xno"],
+ [AC_MSG_CHECKING([for 'gtest-config'])
+ AS_IF([test "x${enable_gtest}" != "xyes"],
+ [AS_IF([test -x "${enable_gtest}/scripts/gtest-config"],
+ [GTEST_CONFIG="${enable_gtest}/scripts/gtest-config"],
+ [GTEST_CONFIG="${enable_gtest}/bin/gtest-config"])
+ AS_IF([test -x "${GTEST_CONFIG}"], [],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([dnl
+Unable to locate either a built or installed Google Test.
+The specific location '${enable_gtest}' was provided for a built or installed
+Google Test, but no 'gtest-config' script could be found at this location.])
+ ])],
+ [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])])
+ AS_IF([test -x "${GTEST_CONFIG}"],
+ [AC_MSG_RESULT([${GTEST_CONFIG}])
+ m4_ifval([$1],
+ [_gtest_min_version="--min-version=$1"
+ AC_MSG_CHECKING([for Google Test at least version >= $1])],
+ [_gtest_min_version="--min-version=0"
+ AC_MSG_CHECKING([for Google Test])])
+ AS_IF([${GTEST_CONFIG} ${_gtest_min_version}],
+ [AC_MSG_RESULT([yes])
+ HAVE_GTEST='yes'],
+ [AC_MSG_RESULT([no])])],
+ [AC_MSG_RESULT([no])])
+ AS_IF([test "x${HAVE_GTEST}" = "xyes"],
+ [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`
+ GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`
+ GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
+ GTEST_LIBS=`${GTEST_CONFIG} --libs`
+ GTEST_VERSION=`${GTEST_CONFIG} --version`
+ AC_DEFINE([HAVE_GTEST],[1],[Defined when Google Test is available.])],
+ [AS_IF([test "x${enable_gtest}" = "xyes"],
+ [AC_MSG_ERROR([dnl
+Google Test was enabled, but no viable version could be found.])
+ ])])])
+AC_SUBST([HAVE_GTEST])
+AM_CONDITIONAL([HAVE_GTEST],[test "x$HAVE_GTEST" = "xyes"])
+AS_IF([test "x$HAVE_GTEST" = "xyes"],
+ [m4_ifval([$2], [$2])],
+ [m4_ifval([$3], [$3])])
+])
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/run_tests.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/run_tests.py
new file mode 100755
index 0000000..e108405
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/run_tests.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Runs the specified tests for Google Test.
+
+This script requires Python 2.3 or higher. To learn the usage, run it
+with -h.
+"""
+
+import os
+import sys
+
+SCRIPT_DIR = os.path.dirname(__file__) or '.'
+
+sys.path.append(os.path.join(SCRIPT_DIR, 'test'))
+import run_tests_util
+
+
+def _Main():
+ """Runs all tests for Google Test."""
+
+ options, args = run_tests_util.ParseArgs('gtest')
+ test_runner = run_tests_util.TestRunner(script_dir=SCRIPT_DIR)
+ tests = test_runner.GetTestsToRun(args,
+ options.configurations,
+ options.built_configurations)
+ if not tests:
+ sys.exit(1) # Incorrect parameters given, abort execution.
+
+ sys.exit(test_runner.RunTests(tests[0], tests[1]))
+
+if __name__ == '__main__':
+ _Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/prime_tables.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/prime_tables.h
new file mode 100644
index 0000000..92ce16a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/prime_tables.h
@@ -0,0 +1,123 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+// Author: vladl@google.com (Vlad Losev)
+
+// This provides interface PrimeTable that determines whether a number is a
+// prime and determines a next prime number. This interface is used
+// in Google Test samples demonstrating use of parameterized tests.
+
+#ifndef GTEST_SAMPLES_PRIME_TABLES_H_
+#define GTEST_SAMPLES_PRIME_TABLES_H_
+
+#include <algorithm>
+
+// The prime table interface.
+class PrimeTable {
+ public:
+ virtual ~PrimeTable() {}
+
+ // Returns true iff n is a prime number.
+ virtual bool IsPrime(int n) const = 0;
+
+ // Returns the smallest prime number greater than p; or returns -1
+ // if the next prime is beyond the capacity of the table.
+ virtual int GetNextPrime(int p) const = 0;
+};
+
+// Implementation #1 calculates the primes on-the-fly.
+class OnTheFlyPrimeTable : public PrimeTable {
+ public:
+ virtual bool IsPrime(int n) const {
+ if (n <= 1) return false;
+
+ for (int i = 2; i*i <= n; i++) {
+ // n is divisible by an integer other than 1 and itself.
+ if ((n % i) == 0) return false;
+ }
+
+ return true;
+ }
+
+ virtual int GetNextPrime(int p) const {
+ for (int n = p + 1; n > 0; n++) {
+ if (IsPrime(n)) return n;
+ }
+
+ return -1;
+ }
+};
+
+// Implementation #2 pre-calculates the primes and stores the result
+// in an array.
+class PreCalculatedPrimeTable : public PrimeTable {
+ public:
+ // 'max' specifies the maximum number the prime table holds.
+ explicit PreCalculatedPrimeTable(int max)
+ : is_prime_size_(max + 1), is_prime_(new bool[max + 1]) {
+ CalculatePrimesUpTo(max);
+ }
+ virtual ~PreCalculatedPrimeTable() { delete[] is_prime_; }
+
+ virtual bool IsPrime(int n) const {
+ return 0 <= n && n < is_prime_size_ && is_prime_[n];
+ }
+
+ virtual int GetNextPrime(int p) const {
+ for (int n = p + 1; n < is_prime_size_; n++) {
+ if (is_prime_[n]) return n;
+ }
+
+ return -1;
+ }
+
+ private:
+ void CalculatePrimesUpTo(int max) {
+ ::std::fill(is_prime_, is_prime_ + is_prime_size_, true);
+ is_prime_[0] = is_prime_[1] = false;
+
+ for (int i = 2; i <= max; i++) {
+ if (!is_prime_[i]) continue;
+
+ // Marks all multiples of i (except i itself) as non-prime.
+ for (int j = 2*i; j <= max; j += i) {
+ is_prime_[j] = false;
+ }
+ }
+ }
+
+ const int is_prime_size_;
+ bool* const is_prime_;
+
+ // Disables compiler warning "assignment operator could not be generated."
+ void operator=(const PreCalculatedPrimeTable& rhs);
+};
+
+#endif // GTEST_SAMPLES_PRIME_TABLES_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.cc
new file mode 100644
index 0000000..f171e26
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.cc
@@ -0,0 +1,68 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include "sample1.h"
+
+// Returns n! (the factorial of n). For negative n, n! is defined to be 1.
+int Factorial(int n) {
+ int result = 1;
+ for (int i = 1; i <= n; i++) {
+ result *= i;
+ }
+
+ return result;
+}
+
+// Returns true iff n is a prime number.
+bool IsPrime(int n) {
+ // Trivial case 1: small numbers
+ if (n <= 1) return false;
+
+ // Trivial case 2: even numbers
+ if (n % 2 == 0) return n == 2;
+
+ // Now, we have that n is odd and n >= 3.
+
+ // Try to divide n by every odd number i, starting from 3
+ for (int i = 3; ; i += 2) {
+ // We only have to try i up to the squre root of n
+ if (i > n/i) break;
+
+ // Now, we have i <= n/i < n.
+ // If n is divisible by i, n is not prime.
+ if (n % i == 0) return false;
+ }
+
+ // n has no integer factor in the range (1, n), and thus is prime.
+ return true;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.h
new file mode 100644
index 0000000..3dfeb98
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1.h
@@ -0,0 +1,43 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#ifndef GTEST_SAMPLES_SAMPLE1_H_
+#define GTEST_SAMPLES_SAMPLE1_H_
+
+// Returns n! (the factorial of n). For negative n, n! is defined to be 1.
+int Factorial(int n);
+
+// Returns true iff n is a prime number.
+bool IsPrime(int n);
+
+#endif // GTEST_SAMPLES_SAMPLE1_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample10_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample10_unittest.cc
new file mode 100644
index 0000000..3ad6fd6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample10_unittest.cc
@@ -0,0 +1,145 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+
+// This sample shows how to use Google Test listener API to implement
+// a primitive leak checker.
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <gtest/gtest.h>
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+namespace {
+
+// We will track memory used by this class.
+class Water {
+ public:
+ // Normal Water declarations go here.
+
+ // operator new and operator delete help us control water allocation.
+ void* operator new(size_t allocation_size) {
+ allocated_++;
+ return malloc(allocation_size);
+ }
+
+ void operator delete(void* block, size_t /* allocation_size */) {
+ allocated_--;
+ free(block);
+ }
+
+ static int allocated() { return allocated_; }
+
+ private:
+ static int allocated_;
+};
+
+int Water::allocated_ = 0;
+
+// This event listener monitors how many Water objects are created and
+// destroyed by each test, and reports a failure if a test leaks some Water
+// objects. It does this by comparing the number of live Water objects at
+// the beginning of a test and at the end of a test.
+class LeakChecker : public EmptyTestEventListener {
+ private:
+ // Called before a test starts.
+ virtual void OnTestStart(const TestInfo& /* test_info */) {
+ initially_allocated_ = Water::allocated();
+ }
+
+ // Called after a test ends.
+ virtual void OnTestEnd(const TestInfo& /* test_info */) {
+ int difference = Water::allocated() - initially_allocated_;
+
+ // You can generate a failure in any event handler except
+ // OnTestPartResult. Just use an appropriate Google Test assertion to do
+ // it.
+ EXPECT_TRUE(difference <= 0)
+ << "Leaked " << difference << " unit(s) of Water!";
+ }
+
+ int initially_allocated_;
+};
+
+TEST(ListenersTest, DoesNotLeak) {
+ Water* water = new Water;
+ delete water;
+}
+
+// This should fail when the --check_for_leaks command line flag is
+// specified.
+TEST(ListenersTest, LeaksWater) {
+ Water* water = new Water;
+ EXPECT_TRUE(water != NULL);
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+
+ bool check_for_leaks = false;
+ if (argc > 1 && strcmp(argv[1], "--check_for_leaks") == 0 )
+ check_for_leaks = true;
+ else
+ printf("%s\n", "Run this program with --check_for_leaks to enable "
+ "custom leak checking in the tests.");
+
+ // If we are given the --check_for_leaks command line flag, installs the
+ // leak checker.
+ if (check_for_leaks) {
+ TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
+
+ // Adds the leak checker to the end of the test event listener list,
+ // after the default text output printer and the default XML report
+ // generator.
+ //
+ // The order is important - it ensures that failures generated in the
+ // leak checker's OnTestEnd() method are processed by the text and XML
+ // printers *before* their OnTestEnd() methods are called, such that
+ // they are attributed to the right test. Remember that a listener
+ // receives an OnXyzStart event *after* listeners preceding it in the
+ // list received that event, and receives an OnXyzEnd event *before*
+ // listeners preceding it.
+ //
+ // We don't need to worry about deleting the new listener later, as
+ // Google Test will do it.
+ listeners.Append(new LeakChecker);
+ }
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1_unittest.cc
new file mode 100644
index 0000000..01eb546
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample1_unittest.cc
@@ -0,0 +1,153 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+
+// This sample shows how to write a simple unit test for a function,
+// using Google C++ testing framework.
+//
+// Writing a unit test using Google C++ testing framework is easy as 1-2-3:
+
+
+// Step 1. Include necessary header files such that the stuff your
+// test logic needs is declared.
+//
+// Don't forget gtest.h, which declares the testing framework.
+
+#include <limits.h>
+#include "sample1.h"
+#include <gtest/gtest.h>
+
+
+// Step 2. Use the TEST macro to define your tests.
+//
+// TEST has two parameters: the test case name and the test name.
+// After using the macro, you should define your test logic between a
+// pair of braces. You can use a bunch of macros to indicate the
+// success or failure of a test. EXPECT_TRUE and EXPECT_EQ are
+// examples of such macros. For a complete list, see gtest.h.
+//
+// <TechnicalDetails>
+//
+// In Google Test, tests are grouped into test cases. This is how we
+// keep test code organized. You should put logically related tests
+// into the same test case.
+//
+// The test case name and the test name should both be valid C++
+// identifiers. And you should not use underscore (_) in the names.
+//
+// Google Test guarantees that each test you define is run exactly
+// once, but it makes no guarantee on the order the tests are
+// executed. Therefore, you should write your tests in such a way
+// that their results don't depend on their order.
+//
+// </TechnicalDetails>
+
+
+// Tests Factorial().
+
+// Tests factorial of negative numbers.
+TEST(FactorialTest, Negative) {
+ // This test is named "Negative", and belongs to the "FactorialTest"
+ // test case.
+ EXPECT_EQ(1, Factorial(-5));
+ EXPECT_EQ(1, Factorial(-1));
+ EXPECT_TRUE(Factorial(-10) > 0);
+
+ // <TechnicalDetails>
+ //
+ // EXPECT_EQ(expected, actual) is the same as
+ //
+ // EXPECT_TRUE((expected) == (actual))
+ //
+ // except that it will print both the expected value and the actual
+ // value when the assertion fails. This is very helpful for
+ // debugging. Therefore in this case EXPECT_EQ is preferred.
+ //
+ // On the other hand, EXPECT_TRUE accepts any Boolean expression,
+ // and is thus more general.
+ //
+ // </TechnicalDetails>
+}
+
+// Tests factorial of 0.
+TEST(FactorialTest, Zero) {
+ EXPECT_EQ(1, Factorial(0));
+}
+
+// Tests factorial of positive numbers.
+TEST(FactorialTest, Positive) {
+ EXPECT_EQ(1, Factorial(1));
+ EXPECT_EQ(2, Factorial(2));
+ EXPECT_EQ(6, Factorial(3));
+ EXPECT_EQ(40320, Factorial(8));
+}
+
+
+// Tests IsPrime()
+
+// Tests negative input.
+TEST(IsPrimeTest, Negative) {
+ // This test belongs to the IsPrimeTest test case.
+
+ EXPECT_FALSE(IsPrime(-1));
+ EXPECT_FALSE(IsPrime(-2));
+ EXPECT_FALSE(IsPrime(INT_MIN));
+}
+
+// Tests some trivial cases.
+TEST(IsPrimeTest, Trivial) {
+ EXPECT_FALSE(IsPrime(0));
+ EXPECT_FALSE(IsPrime(1));
+ EXPECT_TRUE(IsPrime(2));
+ EXPECT_TRUE(IsPrime(3));
+}
+
+// Tests positive input.
+TEST(IsPrimeTest, Positive) {
+ EXPECT_FALSE(IsPrime(4));
+ EXPECT_TRUE(IsPrime(5));
+ EXPECT_FALSE(IsPrime(6));
+ EXPECT_TRUE(IsPrime(23));
+}
+
+// Step 3. Call RUN_ALL_TESTS() in main().
+//
+// We do this by linking in src/gtest_main.cc file, which consists of
+// a main() function which calls RUN_ALL_TESTS() for us.
+//
+// This runs all the tests you've defined, prints the result, and
+// returns 0 if successful, or 1 otherwise.
+//
+// Did you notice that we didn't register the tests? The
+// RUN_ALL_TESTS() macro magically knows about all the tests we
+// defined. Isn't this convenient?
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.cc
new file mode 100644
index 0000000..5f763b9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.cc
@@ -0,0 +1,56 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include "sample2.h"
+
+#include <string.h>
+
+// Clones a 0-terminated C string, allocating memory using new.
+const char* MyString::CloneCString(const char* a_c_string) {
+ if (a_c_string == NULL) return NULL;
+
+ const size_t len = strlen(a_c_string);
+ char* const clone = new char[ len + 1 ];
+ memcpy(clone, a_c_string, len + 1);
+
+ return clone;
+}
+
+// Sets the 0-terminated C string this MyString object
+// represents.
+void MyString::Set(const char* a_c_string) {
+ // Makes sure this works when c_string == c_string_
+ const char* const temp = MyString::CloneCString(a_c_string);
+ delete[] c_string_;
+ c_string_ = temp;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.h
new file mode 100644
index 0000000..5b57e60
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2.h
@@ -0,0 +1,86 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#ifndef GTEST_SAMPLES_SAMPLE2_H_
+#define GTEST_SAMPLES_SAMPLE2_H_
+
+#include <string.h>
+
+
+// A simple string class.
+class MyString {
+ private:
+ const char* c_string_;
+ const MyString& operator=(const MyString& rhs);
+
+ public:
+
+ // Clones a 0-terminated C string, allocating memory using new.
+ static const char* CloneCString(const char* a_c_string);
+
+ ////////////////////////////////////////////////////////////
+ //
+ // C'tors
+
+ // The default c'tor constructs a NULL string.
+ MyString() : c_string_(NULL) {}
+
+ // Constructs a MyString by cloning a 0-terminated C string.
+ explicit MyString(const char* a_c_string) : c_string_(NULL) {
+ Set(a_c_string);
+ }
+
+ // Copy c'tor
+ MyString(const MyString& string) : c_string_(NULL) {
+ Set(string.c_string_);
+ }
+
+ ////////////////////////////////////////////////////////////
+ //
+ // D'tor. MyString is intended to be a final class, so the d'tor
+ // doesn't need to be virtual.
+ ~MyString() { delete[] c_string_; }
+
+ // Gets the 0-terminated C string this MyString object represents.
+ const char* c_string() const { return c_string_; }
+
+ size_t Length() const {
+ return c_string_ == NULL ? 0 : strlen(c_string_);
+ }
+
+ // Sets the 0-terminated C string this MyString object represents.
+ void Set(const char* c_string);
+};
+
+
+#endif // GTEST_SAMPLES_SAMPLE2_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2_unittest.cc
new file mode 100644
index 0000000..32232d9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample2_unittest.cc
@@ -0,0 +1,109 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+
+// This sample shows how to write a more complex unit test for a class
+// that has multiple member functions.
+//
+// Usually, it's a good idea to have one test for each method in your
+// class. You don't have to do that exactly, but it helps to keep
+// your tests organized. You may also throw in additional tests as
+// needed.
+
+#include "sample2.h"
+#include <gtest/gtest.h>
+
+// In this example, we test the MyString class (a simple string).
+
+// Tests the default c'tor.
+TEST(MyString, DefaultConstructor) {
+ const MyString s;
+
+ // Asserts that s.c_string() returns NULL.
+ //
+ // <TechnicalDetails>
+ //
+ // If we write NULL instead of
+ //
+ // static_cast<const char *>(NULL)
+ //
+ // in this assertion, it will generate a warning on gcc 3.4. The
+ // reason is that EXPECT_EQ needs to know the types of its
+ // arguments in order to print them when it fails. Since NULL is
+ // #defined as 0, the compiler will use the formatter function for
+ // int to print it. However, gcc thinks that NULL should be used as
+ // a pointer, not an int, and therefore complains.
+ //
+ // The root of the problem is C++'s lack of distinction between the
+ // integer number 0 and the null pointer constant. Unfortunately,
+ // we have to live with this fact.
+ //
+ // </TechnicalDetails>
+ EXPECT_STREQ(NULL, s.c_string());
+
+ EXPECT_EQ(0u, s.Length());
+}
+
+const char kHelloString[] = "Hello, world!";
+
+// Tests the c'tor that accepts a C string.
+TEST(MyString, ConstructorFromCString) {
+ const MyString s(kHelloString);
+ EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+ EXPECT_EQ(sizeof(kHelloString)/sizeof(kHelloString[0]) - 1,
+ s.Length());
+}
+
+// Tests the copy c'tor.
+TEST(MyString, CopyConstructor) {
+ const MyString s1(kHelloString);
+ const MyString s2 = s1;
+ EXPECT_TRUE(strcmp(s2.c_string(), kHelloString) == 0);
+}
+
+// Tests the Set method.
+TEST(MyString, Set) {
+ MyString s;
+
+ s.Set(kHelloString);
+ EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+
+ // Set should work when the input pointer is the same as the one
+ // already in the MyString object.
+ s.Set(s.c_string());
+ EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+
+ // Can we set the MyString to NULL?
+ s.Set(NULL);
+ EXPECT_STREQ(NULL, s.c_string());
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3-inl.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3-inl.h
new file mode 100644
index 0000000..46369a0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3-inl.h
@@ -0,0 +1,173 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_
+#define GTEST_SAMPLES_SAMPLE3_INL_H_
+
+#include <stddef.h>
+
+
+// Queue is a simple queue implemented as a singled-linked list.
+//
+// The element type must support copy constructor.
+template <typename E> // E is the element type
+class Queue;
+
+// QueueNode is a node in a Queue, which consists of an element of
+// type E and a pointer to the next node.
+template <typename E> // E is the element type
+class QueueNode {
+ friend class Queue<E>;
+
+ public:
+ // Gets the element in this node.
+ const E& element() const { return element_; }
+
+ // Gets the next node in the queue.
+ QueueNode* next() { return next_; }
+ const QueueNode* next() const { return next_; }
+
+ private:
+ // Creates a node with a given element value. The next pointer is
+ // set to NULL.
+ QueueNode(const E& an_element) : element_(an_element), next_(NULL) {}
+
+ // We disable the default assignment operator and copy c'tor.
+ const QueueNode& operator = (const QueueNode&);
+ QueueNode(const QueueNode&);
+
+ E element_;
+ QueueNode* next_;
+};
+
+template <typename E> // E is the element type.
+class Queue {
+public:
+
+ // Creates an empty queue.
+ Queue() : head_(NULL), last_(NULL), size_(0) {}
+
+ // D'tor. Clears the queue.
+ ~Queue() { Clear(); }
+
+ // Clears the queue.
+ void Clear() {
+ if (size_ > 0) {
+ // 1. Deletes every node.
+ QueueNode<E>* node = head_;
+ QueueNode<E>* next = node->next();
+ for (; ;) {
+ delete node;
+ node = next;
+ if (node == NULL) break;
+ next = node->next();
+ }
+
+ // 2. Resets the member variables.
+ head_ = last_ = NULL;
+ size_ = 0;
+ }
+ }
+
+ // Gets the number of elements.
+ size_t Size() const { return size_; }
+
+ // Gets the first element of the queue, or NULL if the queue is empty.
+ QueueNode<E>* Head() { return head_; }
+ const QueueNode<E>* Head() const { return head_; }
+
+ // Gets the last element of the queue, or NULL if the queue is empty.
+ QueueNode<E>* Last() { return last_; }
+ const QueueNode<E>* Last() const { return last_; }
+
+ // Adds an element to the end of the queue. A copy of the element is
+ // created using the copy constructor, and then stored in the queue.
+ // Changes made to the element in the queue doesn't affect the source
+ // object, and vice versa.
+ void Enqueue(const E& element) {
+ QueueNode<E>* new_node = new QueueNode<E>(element);
+
+ if (size_ == 0) {
+ head_ = last_ = new_node;
+ size_ = 1;
+ } else {
+ last_->next_ = new_node;
+ last_ = new_node;
+ size_++;
+ }
+ }
+
+ // Removes the head of the queue and returns it. Returns NULL if
+ // the queue is empty.
+ E* Dequeue() {
+ if (size_ == 0) {
+ return NULL;
+ }
+
+ const QueueNode<E>* const old_head = head_;
+ head_ = head_->next_;
+ size_--;
+ if (size_ == 0) {
+ last_ = NULL;
+ }
+
+ E* element = new E(old_head->element());
+ delete old_head;
+
+ return element;
+ }
+
+ // Applies a function/functor on each element of the queue, and
+ // returns the result in a new queue. The original queue is not
+ // affected.
+ template <typename F>
+ Queue* Map(F function) const {
+ Queue* new_queue = new Queue();
+ for (const QueueNode<E>* node = head_; node != NULL; node = node->next_) {
+ new_queue->Enqueue(function(node->element()));
+ }
+
+ return new_queue;
+ }
+
+ private:
+ QueueNode<E>* head_; // The first node of the queue.
+ QueueNode<E>* last_; // The last node of the queue.
+ size_t size_; // The number of elements in the queue.
+
+ // We disallow copying a queue.
+ Queue(const Queue&);
+ const Queue& operator = (const Queue&);
+ };
+
+#endif // GTEST_SAMPLES_SAMPLE3_INL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3_unittest.cc
new file mode 100644
index 0000000..34c1ca8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample3_unittest.cc
@@ -0,0 +1,151 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+
+// In this example, we use a more advanced feature of Google Test called
+// test fixture.
+//
+// A test fixture is a place to hold objects and functions shared by
+// all tests in a test case. Using a test fixture avoids duplicating
+// the test code necessary to initialize and cleanup those common
+// objects for each test. It is also useful for defining sub-routines
+// that your tests need to invoke a lot.
+//
+// <TechnicalDetails>
+//
+// The tests share the test fixture in the sense of code sharing, not
+// data sharing. Each test is given its own fresh copy of the
+// fixture. You cannot expect the data modified by one test to be
+// passed on to another test, which is a bad idea.
+//
+// The reason for this design is that tests should be independent and
+// repeatable. In particular, a test should not fail as the result of
+// another test's failure. If one test depends on info produced by
+// another test, then the two tests should really be one big test.
+//
+// The macros for indicating the success/failure of a test
+// (EXPECT_TRUE, FAIL, etc) need to know what the current test is
+// (when Google Test prints the test result, it tells you which test
+// each failure belongs to). Technically, these macros invoke a
+// member function of the Test class. Therefore, you cannot use them
+// in a global function. That's why you should put test sub-routines
+// in a test fixture.
+//
+// </TechnicalDetails>
+
+#include "sample3-inl.h"
+#include <gtest/gtest.h>
+
+// To use a test fixture, derive a class from testing::Test.
+class QueueTest : public testing::Test {
+ protected: // You should make the members protected s.t. they can be
+ // accessed from sub-classes.
+
+ // virtual void SetUp() will be called before each test is run. You
+ // should define it if you need to initialize the varaibles.
+ // Otherwise, this can be skipped.
+ virtual void SetUp() {
+ q1_.Enqueue(1);
+ q2_.Enqueue(2);
+ q2_.Enqueue(3);
+ }
+
+ // virtual void TearDown() will be called after each test is run.
+ // You should define it if there is cleanup work to do. Otherwise,
+ // you don't have to provide it.
+ //
+ // virtual void TearDown() {
+ // }
+
+ // A helper function that some test uses.
+ static int Double(int n) {
+ return 2*n;
+ }
+
+ // A helper function for testing Queue::Map().
+ void MapTester(const Queue<int> * q) {
+ // Creates a new queue, where each element is twice as big as the
+ // corresponding one in q.
+ const Queue<int> * const new_q = q->Map(Double);
+
+ // Verifies that the new queue has the same size as q.
+ ASSERT_EQ(q->Size(), new_q->Size());
+
+ // Verifies the relationship between the elements of the two queues.
+ for ( const QueueNode<int> * n1 = q->Head(), * n2 = new_q->Head();
+ n1 != NULL; n1 = n1->next(), n2 = n2->next() ) {
+ EXPECT_EQ(2 * n1->element(), n2->element());
+ }
+
+ delete new_q;
+ }
+
+ // Declares the variables your tests want to use.
+ Queue<int> q0_;
+ Queue<int> q1_;
+ Queue<int> q2_;
+};
+
+// When you have a test fixture, you define a test using TEST_F
+// instead of TEST.
+
+// Tests the default c'tor.
+TEST_F(QueueTest, DefaultConstructor) {
+ // You can access data in the test fixture here.
+ EXPECT_EQ(0u, q0_.Size());
+}
+
+// Tests Dequeue().
+TEST_F(QueueTest, Dequeue) {
+ int * n = q0_.Dequeue();
+ EXPECT_TRUE(n == NULL);
+
+ n = q1_.Dequeue();
+ ASSERT_TRUE(n != NULL);
+ EXPECT_EQ(1, *n);
+ EXPECT_EQ(0u, q1_.Size());
+ delete n;
+
+ n = q2_.Dequeue();
+ ASSERT_TRUE(n != NULL);
+ EXPECT_EQ(2, *n);
+ EXPECT_EQ(1u, q2_.Size());
+ delete n;
+}
+
+// Tests the Queue::Map() function.
+TEST_F(QueueTest, Map) {
+ MapTester(&q0_);
+ MapTester(&q1_);
+ MapTester(&q2_);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.cc
new file mode 100644
index 0000000..ae44bda
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.cc
@@ -0,0 +1,46 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <stdio.h>
+
+#include "sample4.h"
+
+// Returns the current counter value, and increments it.
+int Counter::Increment() {
+ return counter_++;
+}
+
+// Prints the current counter value to STDOUT.
+void Counter::Print() const {
+ printf("%d", counter_);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.h
new file mode 100644
index 0000000..cd60f0d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4.h
@@ -0,0 +1,53 @@
+// Copyright 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.
+
+// A sample program demonstrating using Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#ifndef GTEST_SAMPLES_SAMPLE4_H_
+#define GTEST_SAMPLES_SAMPLE4_H_
+
+// A simple monotonic counter.
+class Counter {
+ private:
+ int counter_;
+
+ public:
+ // Creates a counter that starts at 0.
+ Counter() : counter_(0) {}
+
+ // Returns the current counter value, and increments it.
+ int Increment();
+
+ // Prints the current counter value to STDOUT.
+ void Print() const;
+};
+
+#endif // GTEST_SAMPLES_SAMPLE4_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4_unittest.cc
new file mode 100644
index 0000000..b4fb373
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample4_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+
+#include <gtest/gtest.h>
+#include "sample4.h"
+
+// Tests the Increment() method.
+TEST(Counter, Increment) {
+ Counter c;
+
+ // EXPECT_EQ() evaluates its arguments exactly once, so they
+ // can have side effects.
+
+ EXPECT_EQ(0, c.Increment());
+ EXPECT_EQ(1, c.Increment());
+ EXPECT_EQ(2, c.Increment());
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample5_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample5_unittest.cc
new file mode 100644
index 0000000..49dae7c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample5_unittest.cc
@@ -0,0 +1,199 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+
+// This sample teaches how to reuse a test fixture in multiple test
+// cases by deriving sub-fixtures from it.
+//
+// When you define a test fixture, you specify the name of the test
+// case that will use this fixture. Therefore, a test fixture can
+// be used by only one test case.
+//
+// Sometimes, more than one test cases may want to use the same or
+// slightly different test fixtures. For example, you may want to
+// make sure that all tests for a GUI library don't leak important
+// system resources like fonts and brushes. In Google Test, you do
+// this by putting the shared logic in a super (as in "super class")
+// test fixture, and then have each test case use a fixture derived
+// from this super fixture.
+
+#include <limits.h>
+#include <time.h>
+#include "sample3-inl.h"
+#include <gtest/gtest.h>
+#include "sample1.h"
+
+// In this sample, we want to ensure that every test finishes within
+// ~5 seconds. If a test takes longer to run, we consider it a
+// failure.
+//
+// We put the code for timing a test in a test fixture called
+// "QuickTest". QuickTest is intended to be the super fixture that
+// other fixtures derive from, therefore there is no test case with
+// the name "QuickTest". This is OK.
+//
+// Later, we will derive multiple test fixtures from QuickTest.
+class QuickTest : public testing::Test {
+ protected:
+ // Remember that SetUp() is run immediately before a test starts.
+ // This is a good place to record the start time.
+ virtual void SetUp() {
+ start_time_ = time(NULL);
+ }
+
+ // TearDown() is invoked immediately after a test finishes. Here we
+ // check if the test was too slow.
+ virtual void TearDown() {
+ // Gets the time when the test finishes
+ const time_t end_time = time(NULL);
+
+ // Asserts that the test took no more than ~5 seconds. Did you
+ // know that you can use assertions in SetUp() and TearDown() as
+ // well?
+ EXPECT_TRUE(end_time - start_time_ <= 5) << "The test took too long.";
+ }
+
+ // The UTC time (in seconds) when the test starts
+ time_t start_time_;
+};
+
+
+// We derive a fixture named IntegerFunctionTest from the QuickTest
+// fixture. All tests using this fixture will be automatically
+// required to be quick.
+class IntegerFunctionTest : public QuickTest {
+ // We don't need any more logic than already in the QuickTest fixture.
+ // Therefore the body is empty.
+};
+
+
+// Now we can write tests in the IntegerFunctionTest test case.
+
+// Tests Factorial()
+TEST_F(IntegerFunctionTest, Factorial) {
+ // Tests factorial of negative numbers.
+ EXPECT_EQ(1, Factorial(-5));
+ EXPECT_EQ(1, Factorial(-1));
+ EXPECT_TRUE(Factorial(-10) > 0);
+
+ // Tests factorial of 0.
+ EXPECT_EQ(1, Factorial(0));
+
+ // Tests factorial of positive numbers.
+ EXPECT_EQ(1, Factorial(1));
+ EXPECT_EQ(2, Factorial(2));
+ EXPECT_EQ(6, Factorial(3));
+ EXPECT_EQ(40320, Factorial(8));
+}
+
+
+// Tests IsPrime()
+TEST_F(IntegerFunctionTest, IsPrime) {
+ // Tests negative input.
+ EXPECT_TRUE(!IsPrime(-1));
+ EXPECT_TRUE(!IsPrime(-2));
+ EXPECT_TRUE(!IsPrime(INT_MIN));
+
+ // Tests some trivial cases.
+ EXPECT_TRUE(!IsPrime(0));
+ EXPECT_TRUE(!IsPrime(1));
+ EXPECT_TRUE(IsPrime(2));
+ EXPECT_TRUE(IsPrime(3));
+
+ // Tests positive input.
+ EXPECT_TRUE(!IsPrime(4));
+ EXPECT_TRUE(IsPrime(5));
+ EXPECT_TRUE(!IsPrime(6));
+ EXPECT_TRUE(IsPrime(23));
+}
+
+
+// The next test case (named "QueueTest") also needs to be quick, so
+// we derive another fixture from QuickTest.
+//
+// The QueueTest test fixture has some logic and shared objects in
+// addition to what's in QuickTest already. We define the additional
+// stuff inside the body of the test fixture, as usual.
+class QueueTest : public QuickTest {
+ protected:
+ virtual void SetUp() {
+ // First, we need to set up the super fixture (QuickTest).
+ QuickTest::SetUp();
+
+ // Second, some additional setup for this fixture.
+ q1_.Enqueue(1);
+ q2_.Enqueue(2);
+ q2_.Enqueue(3);
+ }
+
+ // By default, TearDown() inherits the behavior of
+ // QuickTest::TearDown(). As we have no additional cleaning work
+ // for QueueTest, we omit it here.
+ //
+ // virtual void TearDown() {
+ // QuickTest::TearDown();
+ // }
+
+ Queue<int> q0_;
+ Queue<int> q1_;
+ Queue<int> q2_;
+};
+
+
+// Now, let's write tests using the QueueTest fixture.
+
+// Tests the default constructor.
+TEST_F(QueueTest, DefaultConstructor) {
+ EXPECT_EQ(0u, q0_.Size());
+}
+
+// Tests Dequeue().
+TEST_F(QueueTest, Dequeue) {
+ int* n = q0_.Dequeue();
+ EXPECT_TRUE(n == NULL);
+
+ n = q1_.Dequeue();
+ EXPECT_TRUE(n != NULL);
+ EXPECT_EQ(1, *n);
+ EXPECT_EQ(0u, q1_.Size());
+ delete n;
+
+ n = q2_.Dequeue();
+ EXPECT_TRUE(n != NULL);
+ EXPECT_EQ(2, *n);
+ EXPECT_EQ(1u, q2_.Size());
+ delete n;
+}
+
+// If necessary, you can derive further test fixtures from a derived
+// fixture itself. For example, you can derive another fixture from
+// QueueTest. Google Test imposes no limit on how deep the hierarchy
+// can be. In practice, however, you probably don't want it to be too
+// deep as to be confusing.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample6_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample6_unittest.cc
new file mode 100644
index 0000000..dd0df31
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample6_unittest.cc
@@ -0,0 +1,224 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// This sample shows how to test common properties of multiple
+// implementations of the same interface (aka interface tests).
+
+// The interface and its implementations are in this header.
+#include "prime_tables.h"
+
+#include <gtest/gtest.h>
+
+// First, we define some factory functions for creating instances of
+// the implementations. You may be able to skip this step if all your
+// implementations can be constructed the same way.
+
+template <class T>
+PrimeTable* CreatePrimeTable();
+
+template <>
+PrimeTable* CreatePrimeTable<OnTheFlyPrimeTable>() {
+ return new OnTheFlyPrimeTable;
+}
+
+template <>
+PrimeTable* CreatePrimeTable<PreCalculatedPrimeTable>() {
+ return new PreCalculatedPrimeTable(10000);
+}
+
+// Then we define a test fixture class template.
+template <class T>
+class PrimeTableTest : public testing::Test {
+ protected:
+ // The ctor calls the factory function to create a prime table
+ // implemented by T.
+ PrimeTableTest() : table_(CreatePrimeTable<T>()) {}
+
+ virtual ~PrimeTableTest() { delete table_; }
+
+ // Note that we test an implementation via the base interface
+ // instead of the actual implementation class. This is important
+ // for keeping the tests close to the real world scenario, where the
+ // implementation is invoked via the base interface. It avoids
+ // got-yas where the implementation class has a method that shadows
+ // a method with the same name (but slightly different argument
+ // types) in the base interface, for example.
+ PrimeTable* const table_;
+};
+
+#if GTEST_HAS_TYPED_TEST
+
+using testing::Types;
+
+// Google Test offers two ways for reusing tests for different types.
+// The first is called "typed tests". You should use it if you
+// already know *all* the types you are gonna exercise when you write
+// the tests.
+
+// To write a typed test case, first use
+//
+// TYPED_TEST_CASE(TestCaseName, TypeList);
+//
+// to declare it and specify the type parameters. As with TEST_F,
+// TestCaseName must match the test fixture name.
+
+// The list of types we want to test.
+typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable> Implementations;
+
+TYPED_TEST_CASE(PrimeTableTest, Implementations);
+
+// Then use TYPED_TEST(TestCaseName, TestName) to define a typed test,
+// similar to TEST_F.
+TYPED_TEST(PrimeTableTest, ReturnsFalseForNonPrimes) {
+ // Inside the test body, you can refer to the type parameter by
+ // TypeParam, and refer to the fixture class by TestFixture. We
+ // don't need them in this example.
+
+ // Since we are in the template world, C++ requires explicitly
+ // writing 'this->' when referring to members of the fixture class.
+ // This is something you have to learn to live with.
+ EXPECT_FALSE(this->table_->IsPrime(-5));
+ EXPECT_FALSE(this->table_->IsPrime(0));
+ EXPECT_FALSE(this->table_->IsPrime(1));
+ EXPECT_FALSE(this->table_->IsPrime(4));
+ EXPECT_FALSE(this->table_->IsPrime(6));
+ EXPECT_FALSE(this->table_->IsPrime(100));
+}
+
+TYPED_TEST(PrimeTableTest, ReturnsTrueForPrimes) {
+ EXPECT_TRUE(this->table_->IsPrime(2));
+ EXPECT_TRUE(this->table_->IsPrime(3));
+ EXPECT_TRUE(this->table_->IsPrime(5));
+ EXPECT_TRUE(this->table_->IsPrime(7));
+ EXPECT_TRUE(this->table_->IsPrime(11));
+ EXPECT_TRUE(this->table_->IsPrime(131));
+}
+
+TYPED_TEST(PrimeTableTest, CanGetNextPrime) {
+ EXPECT_EQ(2, this->table_->GetNextPrime(0));
+ EXPECT_EQ(3, this->table_->GetNextPrime(2));
+ EXPECT_EQ(5, this->table_->GetNextPrime(3));
+ EXPECT_EQ(7, this->table_->GetNextPrime(5));
+ EXPECT_EQ(11, this->table_->GetNextPrime(7));
+ EXPECT_EQ(131, this->table_->GetNextPrime(128));
+}
+
+// That's it! Google Test will repeat each TYPED_TEST for each type
+// in the type list specified in TYPED_TEST_CASE. Sit back and be
+// happy that you don't have to define them multiple times.
+
+#endif // GTEST_HAS_TYPED_TEST
+
+#if GTEST_HAS_TYPED_TEST_P
+
+using testing::Types;
+
+// Sometimes, however, you don't yet know all the types that you want
+// to test when you write the tests. For example, if you are the
+// author of an interface and expect other people to implement it, you
+// might want to write a set of tests to make sure each implementation
+// conforms to some basic requirements, but you don't know what
+// implementations will be written in the future.
+//
+// How can you write the tests without committing to the type
+// parameters? That's what "type-parameterized tests" can do for you.
+// It is a bit more involved than typed tests, but in return you get a
+// test pattern that can be reused in many contexts, which is a big
+// win. Here's how you do it:
+
+// First, define a test fixture class template. Here we just reuse
+// the PrimeTableTest fixture defined earlier:
+
+template <class T>
+class PrimeTableTest2 : public PrimeTableTest<T> {
+};
+
+// Then, declare the test case. The argument is the name of the test
+// fixture, and also the name of the test case (as usual). The _P
+// suffix is for "parameterized" or "pattern".
+TYPED_TEST_CASE_P(PrimeTableTest2);
+
+// Next, use TYPED_TEST_P(TestCaseName, TestName) to define a test,
+// similar to what you do with TEST_F.
+TYPED_TEST_P(PrimeTableTest2, ReturnsFalseForNonPrimes) {
+ EXPECT_FALSE(this->table_->IsPrime(-5));
+ EXPECT_FALSE(this->table_->IsPrime(0));
+ EXPECT_FALSE(this->table_->IsPrime(1));
+ EXPECT_FALSE(this->table_->IsPrime(4));
+ EXPECT_FALSE(this->table_->IsPrime(6));
+ EXPECT_FALSE(this->table_->IsPrime(100));
+}
+
+TYPED_TEST_P(PrimeTableTest2, ReturnsTrueForPrimes) {
+ EXPECT_TRUE(this->table_->IsPrime(2));
+ EXPECT_TRUE(this->table_->IsPrime(3));
+ EXPECT_TRUE(this->table_->IsPrime(5));
+ EXPECT_TRUE(this->table_->IsPrime(7));
+ EXPECT_TRUE(this->table_->IsPrime(11));
+ EXPECT_TRUE(this->table_->IsPrime(131));
+}
+
+TYPED_TEST_P(PrimeTableTest2, CanGetNextPrime) {
+ EXPECT_EQ(2, this->table_->GetNextPrime(0));
+ EXPECT_EQ(3, this->table_->GetNextPrime(2));
+ EXPECT_EQ(5, this->table_->GetNextPrime(3));
+ EXPECT_EQ(7, this->table_->GetNextPrime(5));
+ EXPECT_EQ(11, this->table_->GetNextPrime(7));
+ EXPECT_EQ(131, this->table_->GetNextPrime(128));
+}
+
+// Type-parameterized tests involve one extra step: you have to
+// enumerate the tests you defined:
+REGISTER_TYPED_TEST_CASE_P(
+ PrimeTableTest2, // The first argument is the test case name.
+ // The rest of the arguments are the test names.
+ ReturnsFalseForNonPrimes, ReturnsTrueForPrimes, CanGetNextPrime);
+
+// At this point the test pattern is done. However, you don't have
+// any real test yet as you haven't said which types you want to run
+// the tests with.
+
+// To turn the abstract test pattern into real tests, you instantiate
+// it with a list of types. Usually the test pattern will be defined
+// in a .h file, and anyone can #include and instantiate it. You can
+// even instantiate it more than once in the same program. To tell
+// different instances apart, you give each of them a name, which will
+// become part of the test case name and can be used in test filters.
+
+// The list of types we want to test. Note that it doesn't have to be
+// defined at the time we write the TYPED_TEST_P()s.
+typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable>
+ PrimeTableImplementations;
+INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name
+ PrimeTableTest2, // Test case name
+ PrimeTableImplementations); // Type list
+
+#endif // GTEST_HAS_TYPED_TEST_P
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample7_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample7_unittest.cc
new file mode 100644
index 0000000..f455282
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample7_unittest.cc
@@ -0,0 +1,132 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+
+// This sample shows how to test common properties of multiple
+// implementations of an interface (aka interface tests) using
+// value-parameterized tests. Each test in the test case has
+// a parameter that is an interface pointer to an implementation
+// tested.
+
+// The interface and its implementations are in this header.
+#include "prime_tables.h"
+
+#include <gtest/gtest.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+using ::testing::TestWithParam;
+using ::testing::Values;
+
+// As a general rule, tested objects should not be reused between tests.
+// Also, their constructors and destructors of tested objects can have
+// side effects. Thus you should create and destroy them for each test.
+// In this sample we will define a simple factory function for PrimeTable
+// objects. We will instantiate objects in test's SetUp() method and
+// delete them in TearDown() method.
+typedef PrimeTable* CreatePrimeTableFunc();
+
+PrimeTable* CreateOnTheFlyPrimeTable() {
+ return new OnTheFlyPrimeTable();
+}
+
+template <size_t max_precalculated>
+PrimeTable* CreatePreCalculatedPrimeTable() {
+ return new PreCalculatedPrimeTable(max_precalculated);
+}
+
+// Inside the test body, fixture constructor, SetUp(), and TearDown()
+// you can refer to the test parameter by GetParam().
+// In this case, the test parameter is a PrimeTableFactory interface pointer
+// which we use in fixture's SetUp() to create and store an instance of
+// PrimeTable.
+class PrimeTableTest : public TestWithParam<CreatePrimeTableFunc*> {
+ public:
+ virtual ~PrimeTableTest() { delete table_; }
+ virtual void SetUp() { table_ = (*GetParam())(); }
+ virtual void TearDown() {
+ delete table_;
+ table_ = NULL;
+ }
+
+ protected:
+ PrimeTable* table_;
+};
+
+TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) {
+ EXPECT_FALSE(table_->IsPrime(-5));
+ EXPECT_FALSE(table_->IsPrime(0));
+ EXPECT_FALSE(table_->IsPrime(1));
+ EXPECT_FALSE(table_->IsPrime(4));
+ EXPECT_FALSE(table_->IsPrime(6));
+ EXPECT_FALSE(table_->IsPrime(100));
+}
+
+TEST_P(PrimeTableTest, ReturnsTrueForPrimes) {
+ EXPECT_TRUE(table_->IsPrime(2));
+ EXPECT_TRUE(table_->IsPrime(3));
+ EXPECT_TRUE(table_->IsPrime(5));
+ EXPECT_TRUE(table_->IsPrime(7));
+ EXPECT_TRUE(table_->IsPrime(11));
+ EXPECT_TRUE(table_->IsPrime(131));
+}
+
+TEST_P(PrimeTableTest, CanGetNextPrime) {
+ EXPECT_EQ(2, table_->GetNextPrime(0));
+ EXPECT_EQ(3, table_->GetNextPrime(2));
+ EXPECT_EQ(5, table_->GetNextPrime(3));
+ EXPECT_EQ(7, table_->GetNextPrime(5));
+ EXPECT_EQ(11, table_->GetNextPrime(7));
+ EXPECT_EQ(131, table_->GetNextPrime(128));
+}
+
+// In order to run value-parameterized tests, you need to instantiate them,
+// or bind them to a list of values which will be used as test parameters.
+// You can instantiate them in a different translation module, or even
+// instantiate them several times.
+//
+// Here, we instantiate our tests with a list of two PrimeTable object
+// factory functions:
+INSTANTIATE_TEST_CASE_P(
+ OnTheFlyAndPreCalculated,
+ PrimeTableTest,
+ Values(&CreateOnTheFlyPrimeTable, &CreatePreCalculatedPrimeTable<1000>));
+
+#else
+
+// Google Test may not support value-parameterized tests with some
+// compilers. If we use conditional compilation to compile out all
+// code referring to the gtest_main library, MSVC linker will not link
+// that library at all and consequently complain about missing entry
+// point defined in that library (fatal error LNK1561: entry point
+// must be defined). This dummy test keeps gtest_main linked in.
+TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
+
+#endif // GTEST_HAS_PARAM_TEST
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample8_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample8_unittest.cc
new file mode 100644
index 0000000..ccf61d9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample8_unittest.cc
@@ -0,0 +1,173 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+
+// This sample shows how to test code relying on some global flag variables.
+// Combine() helps with generating all possible combinations of such flags,
+// and each test is given one combination as a parameter.
+
+// Use class definitions to test from this header.
+#include "prime_tables.h"
+
+#include <gtest/gtest.h>
+
+#if GTEST_HAS_COMBINE
+
+// Suppose we want to introduce a new, improved implementation of PrimeTable
+// which combines speed of PrecalcPrimeTable and versatility of
+// OnTheFlyPrimeTable (see prime_tables.h). Inside it instantiates both
+// PrecalcPrimeTable and OnTheFlyPrimeTable and uses the one that is more
+// appropriate under the circumstances. But in low memory conditions, it can be
+// told to instantiate without PrecalcPrimeTable instance at all and use only
+// OnTheFlyPrimeTable.
+class HybridPrimeTable : public PrimeTable {
+ public:
+ HybridPrimeTable(bool force_on_the_fly, int max_precalculated)
+ : on_the_fly_impl_(new OnTheFlyPrimeTable),
+ precalc_impl_(force_on_the_fly ? NULL :
+ new PreCalculatedPrimeTable(max_precalculated)),
+ max_precalculated_(max_precalculated) {}
+ virtual ~HybridPrimeTable() {
+ delete on_the_fly_impl_;
+ delete precalc_impl_;
+ }
+
+ virtual bool IsPrime(int n) const {
+ if (precalc_impl_ != NULL && n < max_precalculated_)
+ return precalc_impl_->IsPrime(n);
+ else
+ return on_the_fly_impl_->IsPrime(n);
+ }
+
+ virtual int GetNextPrime(int p) const {
+ int next_prime = -1;
+ if (precalc_impl_ != NULL && p < max_precalculated_)
+ next_prime = precalc_impl_->GetNextPrime(p);
+
+ return next_prime != -1 ? next_prime : on_the_fly_impl_->GetNextPrime(p);
+ }
+
+ private:
+ OnTheFlyPrimeTable* on_the_fly_impl_;
+ PreCalculatedPrimeTable* precalc_impl_;
+ int max_precalculated_;
+};
+
+using ::testing::TestWithParam;
+using ::testing::Bool;
+using ::testing::Values;
+using ::testing::Combine;
+
+// To test all code paths for HybridPrimeTable we must test it with numbers
+// both within and outside PreCalculatedPrimeTable's capacity and also with
+// PreCalculatedPrimeTable disabled. We do this by defining fixture which will
+// accept different combinations of parameters for instantiating a
+// HybridPrimeTable instance.
+class PrimeTableTest : public TestWithParam< ::std::tr1::tuple<bool, int> > {
+ protected:
+ virtual void SetUp() {
+ // This can be written as
+ //
+ // bool force_on_the_fly;
+ // int max_precalculated;
+ // tie(force_on_the_fly, max_precalculated) = GetParam();
+ //
+ // once the Google C++ Style Guide allows use of ::std::tr1::tie.
+ //
+ bool force_on_the_fly = ::std::tr1::get<0>(GetParam());
+ int max_precalculated = ::std::tr1::get<1>(GetParam());
+ table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated);
+ }
+ virtual void TearDown() {
+ delete table_;
+ table_ = NULL;
+ }
+ HybridPrimeTable* table_;
+};
+
+TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) {
+ // Inside the test body, you can refer to the test parameter by GetParam().
+ // In this case, the test parameter is a PrimeTable interface pointer which
+ // we can use directly.
+ // Please note that you can also save it in the fixture's SetUp() method
+ // or constructor and use saved copy in the tests.
+
+ EXPECT_FALSE(table_->IsPrime(-5));
+ EXPECT_FALSE(table_->IsPrime(0));
+ EXPECT_FALSE(table_->IsPrime(1));
+ EXPECT_FALSE(table_->IsPrime(4));
+ EXPECT_FALSE(table_->IsPrime(6));
+ EXPECT_FALSE(table_->IsPrime(100));
+}
+
+TEST_P(PrimeTableTest, ReturnsTrueForPrimes) {
+ EXPECT_TRUE(table_->IsPrime(2));
+ EXPECT_TRUE(table_->IsPrime(3));
+ EXPECT_TRUE(table_->IsPrime(5));
+ EXPECT_TRUE(table_->IsPrime(7));
+ EXPECT_TRUE(table_->IsPrime(11));
+ EXPECT_TRUE(table_->IsPrime(131));
+}
+
+TEST_P(PrimeTableTest, CanGetNextPrime) {
+ EXPECT_EQ(2, table_->GetNextPrime(0));
+ EXPECT_EQ(3, table_->GetNextPrime(2));
+ EXPECT_EQ(5, table_->GetNextPrime(3));
+ EXPECT_EQ(7, table_->GetNextPrime(5));
+ EXPECT_EQ(11, table_->GetNextPrime(7));
+ EXPECT_EQ(131, table_->GetNextPrime(128));
+}
+
+// In order to run value-parameterized tests, you need to instantiate them,
+// or bind them to a list of values which will be used as test parameters.
+// You can instantiate them in a different translation module, or even
+// instantiate them several times.
+//
+// Here, we instantiate our tests with a list of parameters. We must combine
+// all variations of the boolean flag suppressing PrecalcPrimeTable and some
+// meaningful values for tests. We choose a small value (1), and a value that
+// will put some of the tested numbers beyond the capability of the
+// PrecalcPrimeTable instance and some inside it (10). Combine will produce all
+// possible combinations.
+INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
+ PrimeTableTest,
+ Combine(Bool(), Values(1, 10)));
+
+#else
+
+// Google Test may not support Combine() with some compilers. If we
+// use conditional compilation to compile out all code referring to
+// the gtest_main library, MSVC linker will not link that library at
+// all and consequently complain about missing entry point defined in
+// that library (fatal error LNK1561: entry point must be
+// defined). This dummy test keeps gtest_main linked in.
+TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {}
+
+#endif // GTEST_HAS_COMBINE
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample9_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample9_unittest.cc
new file mode 100644
index 0000000..d828ef4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/samples/sample9_unittest.cc
@@ -0,0 +1,160 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+
+// This sample shows how to use Google Test listener API to implement
+// an alternative console output and how to use the UnitTest reflection API
+// to enumerate test cases and tests and to inspect their results.
+
+#include <stdio.h>
+
+#include <gtest/gtest.h>
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+namespace {
+
+// Provides alternative output mode which produces minimal amount of
+// information about tests.
+class TersePrinter : public EmptyTestEventListener {
+ private:
+ // Called before any test activity starts.
+ virtual void OnTestProgramStart(const UnitTest& /* unit_test */) {}
+
+ // Called after all test activities have ended.
+ virtual void OnTestProgramEnd(const UnitTest& unit_test) {
+ fprintf(stdout, "TEST %s\n", unit_test.Passed() ? "PASSED" : "FAILED");
+ fflush(stdout);
+ }
+
+ // Called before a test starts.
+ virtual void OnTestStart(const TestInfo& test_info) {
+ fprintf(stdout,
+ "*** Test %s.%s starting.\n",
+ test_info.test_case_name(),
+ test_info.name());
+ fflush(stdout);
+ }
+
+ // Called after a failed assertion or a SUCCESS().
+ virtual void OnTestPartResult(const TestPartResult& test_part_result) {
+ fprintf(stdout,
+ "%s in %s:%d\n%s\n",
+ test_part_result.failed() ? "*** Failure" : "Success",
+ test_part_result.file_name(),
+ test_part_result.line_number(),
+ test_part_result.summary());
+ fflush(stdout);
+ }
+
+ // Called after a test ends.
+ virtual void OnTestEnd(const TestInfo& test_info) {
+ fprintf(stdout,
+ "*** Test %s.%s ending.\n",
+ test_info.test_case_name(),
+ test_info.name());
+ fflush(stdout);
+ }
+}; // class TersePrinter
+
+TEST(CustomOutputTest, PrintsMessage) {
+ printf("Printing something from the test body...\n");
+}
+
+TEST(CustomOutputTest, Succeeds) {
+ SUCCEED() << "SUCCEED() has been invoked from here";
+}
+
+TEST(CustomOutputTest, Fails) {
+ EXPECT_EQ(1, 2)
+ << "This test fails in order to demonstrate alternative failure messages";
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+
+ bool terse_output = false;
+ if (argc > 1 && strcmp(argv[1], "--terse_output") == 0 )
+ terse_output = true;
+ else
+ printf("%s\n", "Run this program with --terse_output to change the way "
+ "it prints its output.");
+
+ UnitTest& unit_test = *UnitTest::GetInstance();
+
+ // If we are given the --terse_output command line flag, suppresses the
+ // standard output and attaches own result printer.
+ if (terse_output) {
+ TestEventListeners& listeners = unit_test.listeners();
+
+ // Removes the default console output listener from the list so it will
+ // not receive events from Google Test and won't print any output. Since
+ // this operation transfers ownership of the listener to the caller we
+ // have to delete it as well.
+ delete listeners.Release(listeners.default_result_printer());
+
+ // Adds the custom output listener to the list. It will now receive
+ // events from Google Test and print the alternative output. We don't
+ // have to worry about deleting it since Google Test assumes ownership
+ // over it after adding it to the list.
+ listeners.Append(new TersePrinter);
+ }
+ int ret_val = RUN_ALL_TESTS();
+
+ // This is an example of using the UnitTest reflection API to inspect test
+ // results. Here we discount failures from the tests we expected to fail.
+ int unexpectedly_failed_tests = 0;
+ for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
+ const TestCase& test_case = *unit_test.GetTestCase(i);
+ for (int j = 0; j < test_case.total_test_count(); ++j) {
+ const TestInfo& test_info = *test_case.GetTestInfo(j);
+ // Counts failed tests that were not meant to fail (those without
+ // 'Fails' in the name).
+ if (test_info.result()->Failed() &&
+ strcmp(test_info.name(), "Fails") != 0) {
+ unexpectedly_failed_tests++;
+ }
+ }
+ }
+
+ // Test that were meant to fail should not affect the test program outcome.
+ if (unexpectedly_failed_tests == 0)
+ ret_val = 0;
+
+ return ret_val;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/fuse_gtest_files.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/fuse_gtest_files.py
new file mode 100755
index 0000000..148444c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/fuse_gtest_files.py
@@ -0,0 +1,250 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""fuse_gtest_files.py v0.2.0
+Fuses Google Test source code into a .h file and a .cc file.
+
+SYNOPSIS
+ fuse_gtest_files.py [GTEST_ROOT_DIR] OUTPUT_DIR
+
+ Scans GTEST_ROOT_DIR for Google Test source code, and generates
+ two files: OUTPUT_DIR/gtest/gtest.h and OUTPUT_DIR/gtest/gtest-all.cc.
+ Then you can build your tests by adding OUTPUT_DIR to the include
+ search path and linking with OUTPUT_DIR/gtest/gtest-all.cc. These
+ two files contain everything you need to use Google Test. Hence
+ you can "install" Google Test by copying them to wherever you want.
+
+ GTEST_ROOT_DIR can be omitted and defaults to the parent
+ directory of the directory holding this script.
+
+EXAMPLES
+ ./fuse_gtest_files.py fused_gtest
+ ./fuse_gtest_files.py path/to/unpacked/gtest fused_gtest
+
+This tool is experimental. In particular, it assumes that there is no
+conditional inclusion of Google Test headers. Please report any
+problems to googletestframework@googlegroups.com. You can read
+http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide for
+more information.
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import re
+import sets
+import sys
+
+# We assume that this file is in the scripts/ directory in the Google
+# Test root directory.
+DEFAULT_GTEST_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
+
+# Regex for matching '#include <gtest/...>'.
+INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*<(gtest/.+)>')
+
+# Regex for matching '#include "src/..."'.
+INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"')
+
+# Where to find the source seed files.
+GTEST_H_SEED = 'include/gtest/gtest.h'
+GTEST_SPI_H_SEED = 'include/gtest/gtest-spi.h'
+GTEST_ALL_CC_SEED = 'src/gtest-all.cc'
+
+# Where to put the generated files.
+GTEST_H_OUTPUT = 'gtest/gtest.h'
+GTEST_ALL_CC_OUTPUT = 'gtest/gtest-all.cc'
+
+
+def VerifyFileExists(directory, relative_path):
+ """Verifies that the given file exists; aborts on failure.
+
+ relative_path is the file path relative to the given directory.
+ """
+
+ if not os.path.isfile(os.path.join(directory, relative_path)):
+ print 'ERROR: Cannot find %s in directory %s.' % (relative_path,
+ directory)
+ print ('Please either specify a valid project root directory '
+ 'or omit it on the command line.')
+ sys.exit(1)
+
+
+def ValidateGTestRootDir(gtest_root):
+ """Makes sure gtest_root points to a valid gtest root directory.
+
+ The function aborts the program on failure.
+ """
+
+ VerifyFileExists(gtest_root, GTEST_H_SEED)
+ VerifyFileExists(gtest_root, GTEST_ALL_CC_SEED)
+
+
+def VerifyOutputFile(output_dir, relative_path):
+ """Verifies that the given output file path is valid.
+
+ relative_path is relative to the output_dir directory.
+ """
+
+ # Makes sure the output file either doesn't exist or can be overwritten.
+ output_file = os.path.join(output_dir, relative_path)
+ if os.path.exists(output_file):
+ # TODO(wan@google.com): The following user-interaction doesn't
+ # work with automated processes. We should provide a way for the
+ # Makefile to force overwriting the files.
+ print ('%s already exists in directory %s - overwrite it? (y/N) ' %
+ (relative_path, output_dir))
+ answer = sys.stdin.readline().strip()
+ if answer not in ['y', 'Y']:
+ print 'ABORTED.'
+ sys.exit(1)
+
+ # Makes sure the directory holding the output file exists; creates
+ # it and all its ancestors if necessary.
+ parent_directory = os.path.dirname(output_file)
+ if not os.path.isdir(parent_directory):
+ os.makedirs(parent_directory)
+
+
+def ValidateOutputDir(output_dir):
+ """Makes sure output_dir points to a valid output directory.
+
+ The function aborts the program on failure.
+ """
+
+ VerifyOutputFile(output_dir, GTEST_H_OUTPUT)
+ VerifyOutputFile(output_dir, GTEST_ALL_CC_OUTPUT)
+
+
+def FuseGTestH(gtest_root, output_dir):
+ """Scans folder gtest_root to generate gtest/gtest.h in output_dir."""
+
+ output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
+ processed_files = sets.Set() # Holds all gtest headers we've processed.
+
+ def ProcessFile(gtest_header_path):
+ """Processes the given gtest header file."""
+
+ # We don't process the same header twice.
+ if gtest_header_path in processed_files:
+ return
+
+ processed_files.add(gtest_header_path)
+
+ # Reads each line in the given gtest header.
+ for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
+ m = INCLUDE_GTEST_FILE_REGEX.match(line)
+ if m:
+ # It's '#include <gtest/...>' - let's process it recursively.
+ ProcessFile('include/' + m.group(1))
+ else:
+ # Otherwise we copy the line unchanged to the output file.
+ output_file.write(line)
+
+ ProcessFile(GTEST_H_SEED)
+ output_file.close()
+
+
+def FuseGTestAllCcToFile(gtest_root, output_file):
+ """Scans folder gtest_root to generate gtest/gtest-all.cc in output_file."""
+
+ processed_files = sets.Set()
+
+ def ProcessFile(gtest_source_file):
+ """Processes the given gtest source file."""
+
+ # We don't process the same #included file twice.
+ if gtest_source_file in processed_files:
+ return
+
+ processed_files.add(gtest_source_file)
+
+ # Reads each line in the given gtest source file.
+ for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):
+ m = INCLUDE_GTEST_FILE_REGEX.match(line)
+ if m:
+ if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
+ # It's '#include <gtest/gtest-spi.h>'. This file is not
+ # #included by <gtest/gtest.h>, so we need to process it.
+ ProcessFile(GTEST_SPI_H_SEED)
+ else:
+ # It's '#include <gtest/foo.h>' where foo is not gtest-spi.
+ # We treat it as '#include <gtest/gtest.h>', as all other
+ # gtest headers are being fused into gtest.h and cannot be
+ # #included directly.
+
+ # There is no need to #include <gtest/gtest.h> more than once.
+ if not GTEST_H_SEED in processed_files:
+ processed_files.add(GTEST_H_SEED)
+ output_file.write('#include <%s>\n' % (GTEST_H_OUTPUT,))
+ else:
+ m = INCLUDE_SRC_FILE_REGEX.match(line)
+ if m:
+ # It's '#include "src/foo"' - let's process it recursively.
+ ProcessFile(m.group(1))
+ else:
+ output_file.write(line)
+
+ ProcessFile(GTEST_ALL_CC_SEED)
+
+
+def FuseGTestAllCc(gtest_root, output_dir):
+ """Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""
+
+ output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
+ FuseGTestAllCcToFile(gtest_root, output_file)
+ output_file.close()
+
+
+def FuseGTest(gtest_root, output_dir):
+ """Fuses gtest.h and gtest-all.cc."""
+
+ ValidateGTestRootDir(gtest_root)
+ ValidateOutputDir(output_dir)
+
+ FuseGTestH(gtest_root, output_dir)
+ FuseGTestAllCc(gtest_root, output_dir)
+
+
+def main():
+ argc = len(sys.argv)
+ if argc == 2:
+ # fuse_gtest_files.py OUTPUT_DIR
+ FuseGTest(DEFAULT_GTEST_ROOT_DIR, sys.argv[1])
+ elif argc == 3:
+ # fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR
+ FuseGTest(sys.argv[1], sys.argv[2])
+ else:
+ print __doc__
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gen_gtest_pred_impl.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gen_gtest_pred_impl.py
new file mode 100755
index 0000000..8307134
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gen_gtest_pred_impl.py
@@ -0,0 +1,733 @@
+#!/usr/bin/env python
+#
+# Copyright 2006, 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.
+
+"""gen_gtest_pred_impl.py v0.1
+
+Generates the implementation of Google Test predicate assertions and
+accompanying tests.
+
+Usage:
+
+ gen_gtest_pred_impl.py MAX_ARITY
+
+where MAX_ARITY is a positive integer.
+
+The command generates the implementation of up-to MAX_ARITY-ary
+predicate assertions, and writes it to file gtest_pred_impl.h in the
+directory where the script is. It also generates the accompanying
+unit test in file gtest_pred_impl_unittest.cc.
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import sys
+import time
+
+# Where this script is.
+SCRIPT_DIR = os.path.dirname(sys.argv[0])
+
+# Where to store the generated header.
+HEADER = os.path.join(SCRIPT_DIR, '../include/gtest/gtest_pred_impl.h')
+
+# Where to store the generated unit test.
+UNIT_TEST = os.path.join(SCRIPT_DIR, '../test/gtest_pred_impl_unittest.cc')
+
+
+def HeaderPreamble(n):
+ """Returns the preamble for the header file.
+
+ Args:
+ n: the maximum arity of the predicate macros to be generated.
+ """
+
+ # A map that defines the values used in the preamble template.
+ DEFS = {
+ 'today' : time.strftime('%m/%d/%Y'),
+ 'year' : time.strftime('%Y'),
+ 'command' : '%s %s' % (os.path.basename(sys.argv[0]), n),
+ 'n' : n
+ }
+
+ return (
+"""// Copyright 2006, 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 file is AUTOMATICALLY GENERATED on %(today)s by command
+// '%(command)s'. DO NOT EDIT BY HAND!
+//
+// Implements a family of generic predicate assertion macros.
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
+#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
+
+// Makes sure this header is not included before gtest.h.
+#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
+#error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
+#endif // GTEST_INCLUDE_GTEST_GTEST_H_
+
+// This header implements a family of generic predicate assertion
+// macros:
+//
+// ASSERT_PRED_FORMAT1(pred_format, v1)
+// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
+// ...
+//
+// where pred_format is a function or functor that takes n (in the
+// case of ASSERT_PRED_FORMATn) values and their source expression
+// text, and returns a testing::AssertionResult. See the definition
+// of ASSERT_EQ in gtest.h for an example.
+//
+// If you don't care about formatting, you can use the more
+// restrictive version:
+//
+// ASSERT_PRED1(pred, v1)
+// ASSERT_PRED2(pred, v1, v2)
+// ...
+//
+// where pred is an n-ary function or functor that returns bool,
+// and the values v1, v2, ..., must support the << operator for
+// streaming to std::ostream.
+//
+// We also define the EXPECT_* variations.
+//
+// For now we only support predicates whose arity is at most %(n)s.
+// Please email googletestframework@googlegroups.com if you need
+// support for higher arities.
+
+// GTEST_ASSERT_ is the basic statement to which all of the assertions
+// in this file reduce. Don't use this in your code.
+
+#define GTEST_ASSERT_(expression, on_failure) \\
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\
+ if (const ::testing::AssertionResult gtest_ar = (expression)) \\
+ ; \\
+ else \\
+ on_failure(gtest_ar.failure_message())
+""" % DEFS)
+
+
+def Arity(n):
+ """Returns the English name of the given arity."""
+
+ if n < 0:
+ return None
+ elif n <= 3:
+ return ['nullary', 'unary', 'binary', 'ternary'][n]
+ else:
+ return '%s-ary' % n
+
+
+def Title(word):
+ """Returns the given word in title case. The difference between
+ this and string's title() method is that Title('4-ary') is '4-ary'
+ while '4-ary'.title() is '4-Ary'."""
+
+ return word[0].upper() + word[1:]
+
+
+def OneTo(n):
+ """Returns the list [1, 2, 3, ..., n]."""
+
+ return range(1, n + 1)
+
+
+def Iter(n, format, sep=''):
+ """Given a positive integer n, a format string that contains 0 or
+ more '%s' format specs, and optionally a separator string, returns
+ the join of n strings, each formatted with the format string on an
+ iterator ranged from 1 to n.
+
+ Example:
+
+ Iter(3, 'v%s', sep=', ') returns 'v1, v2, v3'.
+ """
+
+ # How many '%s' specs are in format?
+ spec_count = len(format.split('%s')) - 1
+ return sep.join([format % (spec_count * (i,)) for i in OneTo(n)])
+
+
+def ImplementationForArity(n):
+ """Returns the implementation of n-ary predicate assertions."""
+
+ # A map the defines the values used in the implementation template.
+ DEFS = {
+ 'n' : str(n),
+ 'vs' : Iter(n, 'v%s', sep=', '),
+ 'vts' : Iter(n, '#v%s', sep=', '),
+ 'arity' : Arity(n),
+ 'Arity' : Title(Arity(n))
+ }
+
+ impl = """
+
+// Helper function for implementing {EXPECT|ASSERT}_PRED%(n)s. Don't use
+// this in your code.
+template <typename Pred""" % DEFS
+
+ impl += Iter(n, """,
+ typename T%s""")
+
+ impl += """>
+AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS
+
+ impl += Iter(n, """,
+ const char* e%s""")
+
+ impl += """,
+ Pred pred"""
+
+ impl += Iter(n, """,
+ const T%s& v%s""")
+
+ impl += """) {
+ if (pred(%(vs)s)) return AssertionSuccess();
+
+ Message msg;
+""" % DEFS
+
+ impl += ' msg << pred_text << "("'
+
+ impl += Iter(n, """
+ << e%s""", sep=' << ", "')
+
+ impl += ' << ") evaluates to false, where"'
+
+ impl += Iter(n, """
+ << "\\n" << e%s << " evaluates to " << v%s""")
+
+ impl += """;
+ return AssertionFailure(msg);
+}
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT%(n)s.
+// Don't use this in your code.
+#define GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, on_failure)\\
+ GTEST_ASSERT_(pred_format(%(vts)s, %(vs)s),\\
+ on_failure)
+
+// Internal macro for implementing {EXPECT|ASSERT}_PRED%(n)s. Don't use
+// this in your code.
+#define GTEST_PRED%(n)s_(pred, %(vs)s, on_failure)\\
+ GTEST_ASSERT_(::testing::AssertPred%(n)sHelper(#pred""" % DEFS
+
+ impl += Iter(n, """, \\
+ #v%s""")
+
+ impl += """, \\
+ pred"""
+
+ impl += Iter(n, """, \\
+ v%s""")
+
+ impl += """), on_failure)
+
+// %(Arity)s predicate assertion macros.
+#define EXPECT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\
+ GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, GTEST_NONFATAL_FAILURE_)
+#define EXPECT_PRED%(n)s(pred, %(vs)s) \\
+ GTEST_PRED%(n)s_(pred, %(vs)s, GTEST_NONFATAL_FAILURE_)
+#define ASSERT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\
+ GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, GTEST_FATAL_FAILURE_)
+#define ASSERT_PRED%(n)s(pred, %(vs)s) \\
+ GTEST_PRED%(n)s_(pred, %(vs)s, GTEST_FATAL_FAILURE_)
+
+""" % DEFS
+
+ return impl
+
+
+def HeaderPostamble():
+ """Returns the postamble for the header file."""
+
+ return """
+
+#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
+"""
+
+
+def GenerateFile(path, content):
+ """Given a file path and a content string, overwrites it with the
+ given content."""
+
+ print 'Updating file %s . . .' % path
+
+ f = file(path, 'w+')
+ print >>f, content,
+ f.close()
+
+ print 'File %s has been updated.' % path
+
+
+def GenerateHeader(n):
+ """Given the maximum arity n, updates the header file that implements
+ the predicate assertions."""
+
+ GenerateFile(HEADER,
+ HeaderPreamble(n)
+ + ''.join([ImplementationForArity(i) for i in OneTo(n)])
+ + HeaderPostamble())
+
+
+def UnitTestPreamble():
+ """Returns the preamble for the unit test file."""
+
+ # A map that defines the values used in the preamble template.
+ DEFS = {
+ 'today' : time.strftime('%m/%d/%Y'),
+ 'year' : time.strftime('%Y'),
+ 'command' : '%s %s' % (os.path.basename(sys.argv[0]), sys.argv[1]),
+ }
+
+ return (
+"""// Copyright 2006, 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 file is AUTOMATICALLY GENERATED on %(today)s by command
+// '%(command)s'. DO NOT EDIT BY HAND!
+
+// Regression test for gtest_pred_impl.h
+//
+// This file is generated by a script and quite long. If you intend to
+// learn how Google Test works by reading its unit tests, read
+// gtest_unittest.cc instead.
+//
+// This is intended as a regression test for the Google Test predicate
+// assertions. We compile it as part of the gtest_unittest target
+// only to keep the implementation tidy and compact, as it is quite
+// involved to set up the stage for testing Google Test using Google
+// Test itself.
+//
+// Currently, gtest_unittest takes ~11 seconds to run in the testing
+// daemon. In the future, if it grows too large and needs much more
+// time to finish, we should consider separating this file into a
+// stand-alone regression test.
+
+#include <iostream>
+
+#include <gtest/gtest.h>
+#include <gtest/gtest-spi.h>
+
+// A user-defined data type.
+struct Bool {
+ explicit Bool(int val) : value(val != 0) {}
+
+ bool operator>(int n) const { return value > Bool(n).value; }
+
+ Bool operator+(const Bool& rhs) const { return Bool(value + rhs.value); }
+
+ bool operator==(const Bool& rhs) const { return value == rhs.value; }
+
+ bool value;
+};
+
+// Enables Bool to be used in assertions.
+std::ostream& operator<<(std::ostream& os, const Bool& x) {
+ return os << (x.value ? "true" : "false");
+}
+
+""" % DEFS)
+
+
+def TestsForArity(n):
+ """Returns the tests for n-ary predicate assertions."""
+
+ # A map that defines the values used in the template for the tests.
+ DEFS = {
+ 'n' : n,
+ 'es' : Iter(n, 'e%s', sep=', '),
+ 'vs' : Iter(n, 'v%s', sep=', '),
+ 'vts' : Iter(n, '#v%s', sep=', '),
+ 'tvs' : Iter(n, 'T%s v%s', sep=', '),
+ 'int_vs' : Iter(n, 'int v%s', sep=', '),
+ 'Bool_vs' : Iter(n, 'Bool v%s', sep=', '),
+ 'types' : Iter(n, 'typename T%s', sep=', '),
+ 'v_sum' : Iter(n, 'v%s', sep=' + '),
+ 'arity' : Arity(n),
+ 'Arity' : Title(Arity(n)),
+ }
+
+ tests = (
+"""// Sample functions/functors for testing %(arity)s predicate assertions.
+
+// A %(arity)s predicate function.
+template <%(types)s>
+bool PredFunction%(n)s(%(tvs)s) {
+ return %(v_sum)s > 0;
+}
+
+// The following two functions are needed to circumvent a bug in
+// gcc 2.95.3, which sometimes has problem with the above template
+// function.
+bool PredFunction%(n)sInt(%(int_vs)s) {
+ return %(v_sum)s > 0;
+}
+bool PredFunction%(n)sBool(%(Bool_vs)s) {
+ return %(v_sum)s > 0;
+}
+""" % DEFS)
+
+ tests += """
+// A %(arity)s predicate functor.
+struct PredFunctor%(n)s {
+ template <%(types)s>
+ bool operator()(""" % DEFS
+
+ tests += Iter(n, 'const T%s& v%s', sep=""",
+ """)
+
+ tests += """) {
+ return %(v_sum)s > 0;
+ }
+};
+""" % DEFS
+
+ tests += """
+// A %(arity)s predicate-formatter function.
+template <%(types)s>
+testing::AssertionResult PredFormatFunction%(n)s(""" % DEFS
+
+ tests += Iter(n, 'const char* e%s', sep=""",
+ """)
+
+ tests += Iter(n, """,
+ const T%s& v%s""")
+
+ tests += """) {
+ if (PredFunction%(n)s(%(vs)s))
+ return testing::AssertionSuccess();
+
+ testing::Message msg;
+ msg << """ % DEFS
+
+ tests += Iter(n, 'e%s', sep=' << " + " << ')
+
+ tests += """
+ << " is expected to be positive, but evaluates to "
+ << %(v_sum)s << ".";
+ return testing::AssertionFailure(msg);
+}
+""" % DEFS
+
+ tests += """
+// A %(arity)s predicate-formatter functor.
+struct PredFormatFunctor%(n)s {
+ template <%(types)s>
+ testing::AssertionResult operator()(""" % DEFS
+
+ tests += Iter(n, 'const char* e%s', sep=""",
+ """)
+
+ tests += Iter(n, """,
+ const T%s& v%s""")
+
+ tests += """) const {
+ return PredFormatFunction%(n)s(%(es)s, %(vs)s);
+ }
+};
+""" % DEFS
+
+ tests += """
+// Tests for {EXPECT|ASSERT}_PRED_FORMAT%(n)s.
+
+class Predicate%(n)sTest : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ expected_to_finish_ = true;
+ finished_ = false;""" % DEFS
+
+ tests += """
+ """ + Iter(n, 'n%s_ = ') + """0;
+ }
+"""
+
+ tests += """
+ virtual void TearDown() {
+ // Verifies that each of the predicate's arguments was evaluated
+ // exactly once."""
+
+ tests += ''.join(["""
+ EXPECT_EQ(1, n%s_) <<
+ "The predicate assertion didn't evaluate argument %s "
+ "exactly once.";""" % (i, i + 1) for i in OneTo(n)])
+
+ tests += """
+
+ // Verifies that the control flow in the test function is expected.
+ if (expected_to_finish_ && !finished_) {
+ FAIL() << "The predicate assertion unexpactedly aborted the test.";
+ } else if (!expected_to_finish_ && finished_) {
+ FAIL() << "The failed predicate assertion didn't abort the test "
+ "as expected.";
+ }
+ }
+
+ // true iff the test function is expected to run to finish.
+ static bool expected_to_finish_;
+
+ // true iff the test function did run to finish.
+ static bool finished_;
+""" % DEFS
+
+ tests += Iter(n, """
+ static int n%s_;""")
+
+ tests += """
+};
+
+bool Predicate%(n)sTest::expected_to_finish_;
+bool Predicate%(n)sTest::finished_;
+""" % DEFS
+
+ tests += Iter(n, """int Predicate%%(n)sTest::n%s_;
+""") % DEFS
+
+ tests += """
+typedef Predicate%(n)sTest EXPECT_PRED_FORMAT%(n)sTest;
+typedef Predicate%(n)sTest ASSERT_PRED_FORMAT%(n)sTest;
+typedef Predicate%(n)sTest EXPECT_PRED%(n)sTest;
+typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest;
+""" % DEFS
+
+ def GenTest(use_format, use_assert, expect_failure,
+ use_functor, use_user_type):
+ """Returns the test for a predicate assertion macro.
+
+ Args:
+ use_format: true iff the assertion is a *_PRED_FORMAT*.
+ use_assert: true iff the assertion is a ASSERT_*.
+ expect_failure: true iff the assertion is expected to fail.
+ use_functor: true iff the first argument of the assertion is
+ a functor (as opposed to a function)
+ use_user_type: true iff the predicate functor/function takes
+ argument(s) of a user-defined type.
+
+ Example:
+
+ GenTest(1, 0, 0, 1, 0) returns a test that tests the behavior
+ of a successful EXPECT_PRED_FORMATn() that takes a functor
+ whose arguments have built-in types."""
+
+ if use_assert:
+ assrt = 'ASSERT' # 'assert' is reserved, so we cannot use
+ # that identifier here.
+ else:
+ assrt = 'EXPECT'
+
+ assertion = assrt + '_PRED'
+
+ if use_format:
+ pred_format = 'PredFormat'
+ assertion += '_FORMAT'
+ else:
+ pred_format = 'Pred'
+
+ assertion += '%(n)s' % DEFS
+
+ if use_functor:
+ pred_format_type = 'functor'
+ pred_format += 'Functor%(n)s()'
+ else:
+ pred_format_type = 'function'
+ pred_format += 'Function%(n)s'
+ if not use_format:
+ if use_user_type:
+ pred_format += 'Bool'
+ else:
+ pred_format += 'Int'
+
+ test_name = pred_format_type.title()
+
+ if use_user_type:
+ arg_type = 'user-defined type (Bool)'
+ test_name += 'OnUserType'
+ if expect_failure:
+ arg = 'Bool(n%s_++)'
+ else:
+ arg = 'Bool(++n%s_)'
+ else:
+ arg_type = 'built-in type (int)'
+ test_name += 'OnBuiltInType'
+ if expect_failure:
+ arg = 'n%s_++'
+ else:
+ arg = '++n%s_'
+
+ if expect_failure:
+ successful_or_failed = 'failed'
+ expected_or_not = 'expected.'
+ test_name += 'Failure'
+ else:
+ successful_or_failed = 'successful'
+ expected_or_not = 'UNEXPECTED!'
+ test_name += 'Success'
+
+ # A map that defines the values used in the test template.
+ defs = DEFS.copy()
+ defs.update({
+ 'assert' : assrt,
+ 'assertion' : assertion,
+ 'test_name' : test_name,
+ 'pf_type' : pred_format_type,
+ 'pf' : pred_format,
+ 'arg_type' : arg_type,
+ 'arg' : arg,
+ 'successful' : successful_or_failed,
+ 'expected' : expected_or_not,
+ })
+
+ test = """
+// Tests a %(successful)s %(assertion)s where the
+// predicate-formatter is a %(pf_type)s on a %(arg_type)s.
+TEST_F(%(assertion)sTest, %(test_name)s) {""" % defs
+
+ indent = (len(assertion) + 3)*' '
+ extra_indent = ''
+
+ if expect_failure:
+ extra_indent = ' '
+ if use_assert:
+ test += """
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT"""
+ else:
+ test += """
+ EXPECT_NONFATAL_FAILURE({ // NOLINT"""
+
+ test += '\n' + extra_indent + """ %(assertion)s(%(pf)s""" % defs
+
+ test = test % defs
+ test += Iter(n, ',\n' + indent + extra_indent + '%(arg)s' % defs)
+ test += ');\n' + extra_indent + ' finished_ = true;\n'
+
+ if expect_failure:
+ test += ' }, "");\n'
+
+ test += '}\n'
+ return test
+
+ # Generates tests for all 2**6 = 64 combinations.
+ tests += ''.join([GenTest(use_format, use_assert, expect_failure,
+ use_functor, use_user_type)
+ for use_format in [0, 1]
+ for use_assert in [0, 1]
+ for expect_failure in [0, 1]
+ for use_functor in [0, 1]
+ for use_user_type in [0, 1]
+ ])
+
+ return tests
+
+
+def UnitTestPostamble():
+ """Returns the postamble for the tests."""
+
+ return ''
+
+
+def GenerateUnitTest(n):
+ """Returns the tests for up-to n-ary predicate assertions."""
+
+ GenerateFile(UNIT_TEST,
+ UnitTestPreamble()
+ + ''.join([TestsForArity(i) for i in OneTo(n)])
+ + UnitTestPostamble())
+
+
+def _Main():
+ """The entry point of the script. Generates the header file and its
+ unit test."""
+
+ if len(sys.argv) != 2:
+ print __doc__
+ print 'Author: ' + __author__
+ sys.exit(1)
+
+ n = int(sys.argv[1])
+ GenerateHeader(n)
+ GenerateUnitTest(n)
+
+
+if __name__ == '__main__':
+ _Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gtest-config.in b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gtest-config.in
new file mode 100755
index 0000000..9c72638
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/gtest-config.in
@@ -0,0 +1,274 @@
+#!/bin/sh
+
+# These variables are automatically filled in by the configure script.
+name="@PACKAGE_TARNAME@"
+version="@PACKAGE_VERSION@"
+
+show_usage()
+{
+ echo "Usage: gtest-config [OPTIONS...]"
+}
+
+show_help()
+{
+ show_usage
+ cat <<\EOF
+
+The `gtest-config' script provides access to the necessary compile and linking
+flags to connect with Google C++ Testing Framework, both in a build prior to
+installation, and on the system proper after installation. The installation
+overrides may be issued in combination with any other queries, but will only
+affect installation queries if called on a built but not installed gtest. The
+installation queries may not be issued with any other types of queries, and
+only one installation query may be made at a time. The version queries and
+compiler flag queries may be combined as desired but not mixed. Different
+version queries are always combined with logical "and" semantics, and only the
+last of any particular query is used while all previous ones ignored. All
+versions must be specified as a sequence of numbers separated by periods.
+Compiler flag queries output the union of the sets of flags when combined.
+
+ Examples:
+ gtest-config --min-version=1.0 || echo "Insufficient Google Test version."
+
+ g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
+ g++ $(gtest-config --ldflags --libs) -o foo foo.o
+
+ # When using a built but not installed Google Test:
+ g++ $(../../my_gtest_build/scripts/gtest-config ...) ...
+
+ # When using an installed Google Test, but with installation overrides:
+ export GTEST_PREFIX="/opt"
+ g++ $(gtest-config --libdir="/opt/lib64" ...) ...
+
+ Help:
+ --usage brief usage information
+ --help display this help message
+
+ Installation Overrides:
+ --prefix=<dir> overrides the installation prefix
+ --exec-prefix=<dir> overrides the executable installation prefix
+ --libdir=<dir> overrides the library installation prefix
+ --includedir=<dir> overrides the header file installation prefix
+
+ Installation Queries:
+ --prefix installation prefix
+ --exec-prefix executable installation prefix
+ --libdir library installation directory
+ --includedir header file installation directory
+ --version the version of the Google Test installation
+
+ Version Queries:
+ --min-version=VERSION return 0 if the version is at least VERSION
+ --exact-version=VERSION return 0 if the version is exactly VERSION
+ --max-version=VERSION return 0 if the version is at most VERSION
+
+ Compilation Flag Queries:
+ --cppflags compile flags specific to the C-like preprocessors
+ --cxxflags compile flags appropriate for C++ programs
+ --ldflags linker flags
+ --libs libraries for linking
+
+EOF
+}
+
+# This function bounds our version with a min and a max. It uses some clever
+# POSIX-compliant variable expansion to portably do all the work in the shell
+# and avoid any dependency on a particular "sed" or "awk" implementation.
+# Notable is that it will only ever compare the first 3 components of versions.
+# Further components will be cleanly stripped off. All versions must be
+# unadorned, so "v1.0" will *not* work. The minimum version must be in $1, and
+# the max in $2. TODO(chandlerc@google.com): If this ever breaks, we should
+# investigate expanding this via autom4te from AS_VERSION_COMPARE rather than
+# continuing to maintain our own shell version.
+check_versions()
+{
+ major_version=${version%%.*}
+ minor_version="0"
+ point_version="0"
+ if test "${version#*.}" != "${version}"; then
+ minor_version=${version#*.}
+ minor_version=${minor_version%%.*}
+ fi
+ if test "${version#*.*.}" != "${version}"; then
+ point_version=${version#*.*.}
+ point_version=${point_version%%.*}
+ fi
+
+ min_version="$1"
+ min_major_version=${min_version%%.*}
+ min_minor_version="0"
+ min_point_version="0"
+ if test "${min_version#*.}" != "${min_version}"; then
+ min_minor_version=${min_version#*.}
+ min_minor_version=${min_minor_version%%.*}
+ fi
+ if test "${min_version#*.*.}" != "${min_version}"; then
+ min_point_version=${min_version#*.*.}
+ min_point_version=${min_point_version%%.*}
+ fi
+
+ max_version="$2"
+ max_major_version=${max_version%%.*}
+ max_minor_version="0"
+ max_point_version="0"
+ if test "${max_version#*.}" != "${max_version}"; then
+ max_minor_version=${max_version#*.}
+ max_minor_version=${max_minor_version%%.*}
+ fi
+ if test "${max_version#*.*.}" != "${max_version}"; then
+ max_point_version=${max_version#*.*.}
+ max_point_version=${max_point_version%%.*}
+ fi
+
+ test $(($major_version)) -lt $(($min_major_version)) && exit 1
+ if test $(($major_version)) -eq $(($min_major_version)); then
+ test $(($minor_version)) -lt $(($min_minor_version)) && exit 1
+ if test $(($minor_version)) -eq $(($min_minor_version)); then
+ test $(($point_version)) -lt $(($min_point_version)) && exit 1
+ fi
+ fi
+
+ test $(($major_version)) -gt $(($max_major_version)) && exit 1
+ if test $(($major_version)) -eq $(($max_major_version)); then
+ test $(($minor_version)) -gt $(($max_minor_version)) && exit 1
+ if test $(($minor_version)) -eq $(($max_minor_version)); then
+ test $(($point_version)) -gt $(($max_point_version)) && exit 1
+ fi
+ fi
+
+ exit 0
+}
+
+# Show the usage line when no arguments are specified.
+if test $# -eq 0; then
+ show_usage
+ exit 1
+fi
+
+while test $# -gt 0; do
+ case $1 in
+ --usage) show_usage; exit 0;;
+ --help) show_help; exit 0;;
+
+ # Installation overrides
+ --prefix=*) GTEST_PREFIX=${1#--prefix=};;
+ --exec-prefix=*) GTEST_EXEC_PREFIX=${1#--exec-prefix=};;
+ --libdir=*) GTEST_LIBDIR=${1#--libdir=};;
+ --includedir=*) GTEST_INCLUDEDIR=${1#--includedir=};;
+
+ # Installation queries
+ --prefix|--exec-prefix|--libdir|--includedir|--version)
+ if test -n "${do_query}"; then
+ show_usage
+ exit 1
+ fi
+ do_query=${1#--}
+ ;;
+
+ # Version checking
+ --min-version=*)
+ do_check_versions=yes
+ min_version=${1#--min-version=}
+ ;;
+ --max-version=*)
+ do_check_versions=yes
+ max_version=${1#--max-version=}
+ ;;
+ --exact-version=*)
+ do_check_versions=yes
+ exact_version=${1#--exact-version=}
+ ;;
+
+ # Compiler flag output
+ --cppflags) echo_cppflags=yes;;
+ --cxxflags) echo_cxxflags=yes;;
+ --ldflags) echo_ldflags=yes;;
+ --libs) echo_libs=yes;;
+
+ # Everything else is an error
+ *) show_usage; exit 1;;
+ esac
+ shift
+done
+
+# These have defaults filled in by the configure script but can also be
+# overridden by environment variables or command line parameters.
+prefix="${GTEST_PREFIX:-@prefix@}"
+exec_prefix="${GTEST_EXEC_PREFIX:-@exec_prefix@}"
+libdir="${GTEST_LIBDIR:-@libdir@}"
+includedir="${GTEST_INCLUDEDIR:-@includedir@}"
+
+# We try and detect if our binary is not located at its installed location. If
+# it's not, we provide variables pointing to the source and build tree rather
+# than to the install tree. This allows building against a just-built gtest
+# rather than an installed gtest.
+bindir="@bindir@"
+this_relative_bindir=`dirname $0`
+this_bindir=`cd ${this_relative_bindir}; pwd -P`
+if test "${this_bindir}" = "${this_bindir%${bindir}}"; then
+ # The path to the script doesn't end in the bindir sequence from Autoconf,
+ # assume that we are in a build tree.
+ build_dir=`dirname ${this_bindir}`
+ src_dir=`cd ${this_bindir}/@top_srcdir@; pwd -P`
+
+ # TODO(chandlerc@google.com): This is a dangerous dependency on libtool, we
+ # should work to remove it, and/or remove libtool altogether, replacing it
+ # with direct references to the library and a link path.
+ gtest_libs="${build_dir}/lib/libgtest.la @PTHREAD_CFLAGS@ @PTHREAD_LIBS@"
+ gtest_ldflags=""
+
+ # We provide hooks to include from either the source or build dir, where the
+ # build dir is always preferred. This will potentially allow us to write
+ # build rules for generated headers and have them automatically be preferred
+ # over provided versions.
+ gtest_cppflags="-I${build_dir}/include -I${src_dir}/include"
+ gtest_cxxflags="@PTHREAD_CFLAGS@"
+else
+ # We're using an installed gtest, although it may be staged under some
+ # prefix. Assume (as our own libraries do) that we can resolve the prefix,
+ # and are present in the dynamic link paths.
+ gtest_ldflags="-L${libdir}"
+ gtest_libs="-l${name} @PTHREAD_CFLAGS@ @PTHREAD_LIBS@"
+ gtest_cppflags="-I${includedir}"
+ gtest_cxxflags="@PTHREAD_CFLAGS@"
+fi
+
+# Do an installation query if requested.
+if test -n "$do_query"; then
+ case $do_query in
+ prefix) echo $prefix; exit 0;;
+ exec-prefix) echo $exec_prefix; exit 0;;
+ libdir) echo $libdir; exit 0;;
+ includedir) echo $includedir; exit 0;;
+ version) echo $version; exit 0;;
+ *) show_usage; exit 1;;
+ esac
+fi
+
+# Do a version check if requested.
+if test "$do_check_versions" = "yes"; then
+ # Make sure we didn't receive a bad combination of parameters.
+ test "$echo_cppflags" = "yes" && show_usage && exit 1
+ test "$echo_cxxflags" = "yes" && show_usage && exit 1
+ test "$echo_ldflags" = "yes" && show_usage && exit 1
+ test "$echo_libs" = "yes" && show_usage && exit 1
+
+ if test "$exact_version" != ""; then
+ check_versions $exact_version $exact_version
+ # unreachable
+ else
+ check_versions ${min_version:-0.0.0} ${max_version:-9999.9999.9999}
+ # unreachable
+ fi
+fi
+
+# Do the output in the correct order so that these can be used in-line of
+# a compiler invocation.
+output=""
+test "$echo_cppflags" = "yes" && output="$output $gtest_cppflags"
+test "$echo_cxxflags" = "yes" && output="$output $gtest_cxxflags"
+test "$echo_ldflags" = "yes" && output="$output $gtest_ldflags"
+test "$echo_libs" = "yes" && output="$output $gtest_libs"
+echo $output
+
+exit 0
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/pump.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/pump.py
new file mode 100755
index 0000000..f15c1b6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/pump.py
@@ -0,0 +1,835 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""pump v0.1 - Pretty Useful for Meta Programming.
+
+A tool for preprocessor meta programming. Useful for generating
+repetitive boilerplate code. Especially useful for writing C++
+classes, functions, macros, and templates that need to work with
+various number of arguments.
+
+USAGE:
+ pump.py SOURCE_FILE
+
+EXAMPLES:
+ pump.py foo.cc.pump
+ Converts foo.cc.pump to foo.cc.
+
+GRAMMAR:
+ CODE ::= ATOMIC_CODE*
+ ATOMIC_CODE ::= $var ID = EXPRESSION
+ | $var ID = [[ CODE ]]
+ | $range ID EXPRESSION..EXPRESSION
+ | $for ID SEPARATOR [[ CODE ]]
+ | $($)
+ | $ID
+ | $(EXPRESSION)
+ | $if EXPRESSION [[ CODE ]] ELSE_BRANCH
+ | [[ CODE ]]
+ | RAW_CODE
+ SEPARATOR ::= RAW_CODE | EMPTY
+ ELSE_BRANCH ::= $else [[ CODE ]]
+ | $elif EXPRESSION [[ CODE ]] ELSE_BRANCH
+ | EMPTY
+ EXPRESSION has Python syntax.
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import re
+import sys
+
+
+TOKEN_TABLE = [
+ (re.compile(r'\$var\s+'), '$var'),
+ (re.compile(r'\$elif\s+'), '$elif'),
+ (re.compile(r'\$else\s+'), '$else'),
+ (re.compile(r'\$for\s+'), '$for'),
+ (re.compile(r'\$if\s+'), '$if'),
+ (re.compile(r'\$range\s+'), '$range'),
+ (re.compile(r'\$[_A-Za-z]\w*'), '$id'),
+ (re.compile(r'\$\(\$\)'), '$($)'),
+ (re.compile(r'\$\$.*'), '$$'),
+ (re.compile(r'\$'), '$'),
+ (re.compile(r'\[\[\n?'), '[['),
+ (re.compile(r'\]\]\n?'), ']]'),
+ ]
+
+
+class Cursor:
+ """Represents a position (line and column) in a text file."""
+
+ def __init__(self, line=-1, column=-1):
+ self.line = line
+ self.column = column
+
+ def __eq__(self, rhs):
+ return self.line == rhs.line and self.column == rhs.column
+
+ def __ne__(self, rhs):
+ return not self == rhs
+
+ def __lt__(self, rhs):
+ return self.line < rhs.line or (
+ self.line == rhs.line and self.column < rhs.column)
+
+ def __le__(self, rhs):
+ return self < rhs or self == rhs
+
+ def __gt__(self, rhs):
+ return rhs < self
+
+ def __ge__(self, rhs):
+ return rhs <= self
+
+ def __str__(self):
+ if self == Eof():
+ return 'EOF'
+ else:
+ return '%s(%s)' % (self.line + 1, self.column)
+
+ def __add__(self, offset):
+ return Cursor(self.line, self.column + offset)
+
+ def __sub__(self, offset):
+ return Cursor(self.line, self.column - offset)
+
+ def Clone(self):
+ """Returns a copy of self."""
+
+ return Cursor(self.line, self.column)
+
+
+# Special cursor to indicate the end-of-file.
+def Eof():
+ """Returns the special cursor to denote the end-of-file."""
+ return Cursor(-1, -1)
+
+
+class Token:
+ """Represents a token in a Pump source file."""
+
+ def __init__(self, start=None, end=None, value=None, token_type=None):
+ if start is None:
+ self.start = Eof()
+ else:
+ self.start = start
+ if end is None:
+ self.end = Eof()
+ else:
+ self.end = end
+ self.value = value
+ self.token_type = token_type
+
+ def __str__(self):
+ return 'Token @%s: \'%s\' type=%s' % (
+ self.start, self.value, self.token_type)
+
+ def Clone(self):
+ """Returns a copy of self."""
+
+ return Token(self.start.Clone(), self.end.Clone(), self.value,
+ self.token_type)
+
+
+def StartsWith(lines, pos, string):
+ """Returns True iff the given position in lines starts with 'string'."""
+
+ return lines[pos.line][pos.column:].startswith(string)
+
+
+def FindFirstInLine(line, token_table):
+ best_match_start = -1
+ for (regex, token_type) in token_table:
+ m = regex.search(line)
+ if m:
+ # We found regex in lines
+ if best_match_start < 0 or m.start() < best_match_start:
+ best_match_start = m.start()
+ best_match_length = m.end() - m.start()
+ best_match_token_type = token_type
+
+ if best_match_start < 0:
+ return None
+
+ return (best_match_start, best_match_length, best_match_token_type)
+
+
+def FindFirst(lines, token_table, cursor):
+ """Finds the first occurrence of any string in strings in lines."""
+
+ start = cursor.Clone()
+ cur_line_number = cursor.line
+ for line in lines[start.line:]:
+ if cur_line_number == start.line:
+ line = line[start.column:]
+ m = FindFirstInLine(line, token_table)
+ if m:
+ # We found a regex in line.
+ (start_column, length, token_type) = m
+ if cur_line_number == start.line:
+ start_column += start.column
+ found_start = Cursor(cur_line_number, start_column)
+ found_end = found_start + length
+ return MakeToken(lines, found_start, found_end, token_type)
+ cur_line_number += 1
+ # We failed to find str in lines
+ return None
+
+
+def SubString(lines, start, end):
+ """Returns a substring in lines."""
+
+ if end == Eof():
+ end = Cursor(len(lines) - 1, len(lines[-1]))
+
+ if start >= end:
+ return ''
+
+ if start.line == end.line:
+ return lines[start.line][start.column:end.column]
+
+ result_lines = ([lines[start.line][start.column:]] +
+ lines[start.line + 1:end.line] +
+ [lines[end.line][:end.column]])
+ return ''.join(result_lines)
+
+
+def MakeToken(lines, start, end, token_type):
+ """Creates a new instance of Token."""
+
+ return Token(start, end, SubString(lines, start, end), token_type)
+
+
+def ParseToken(lines, pos, regex, token_type):
+ line = lines[pos.line][pos.column:]
+ m = regex.search(line)
+ if m and not m.start():
+ return MakeToken(lines, pos, pos + m.end(), token_type)
+ else:
+ print 'ERROR: %s expected at %s.' % (token_type, pos)
+ sys.exit(1)
+
+
+ID_REGEX = re.compile(r'[_A-Za-z]\w*')
+EQ_REGEX = re.compile(r'=')
+REST_OF_LINE_REGEX = re.compile(r'.*?(?=$|\$\$)')
+OPTIONAL_WHITE_SPACES_REGEX = re.compile(r'\s*')
+WHITE_SPACE_REGEX = re.compile(r'\s')
+DOT_DOT_REGEX = re.compile(r'\.\.')
+
+
+def Skip(lines, pos, regex):
+ line = lines[pos.line][pos.column:]
+ m = re.search(regex, line)
+ if m and not m.start():
+ return pos + m.end()
+ else:
+ return pos
+
+
+def SkipUntil(lines, pos, regex, token_type):
+ line = lines[pos.line][pos.column:]
+ m = re.search(regex, line)
+ if m:
+ return pos + m.start()
+ else:
+ print ('ERROR: %s expected on line %s after column %s.' %
+ (token_type, pos.line + 1, pos.column))
+ sys.exit(1)
+
+
+def ParseExpTokenInParens(lines, pos):
+ def ParseInParens(pos):
+ pos = Skip(lines, pos, OPTIONAL_WHITE_SPACES_REGEX)
+ pos = Skip(lines, pos, r'\(')
+ pos = Parse(pos)
+ pos = Skip(lines, pos, r'\)')
+ return pos
+
+ def Parse(pos):
+ pos = SkipUntil(lines, pos, r'\(|\)', ')')
+ if SubString(lines, pos, pos + 1) == '(':
+ pos = Parse(pos + 1)
+ pos = Skip(lines, pos, r'\)')
+ return Parse(pos)
+ else:
+ return pos
+
+ start = pos.Clone()
+ pos = ParseInParens(pos)
+ return MakeToken(lines, start, pos, 'exp')
+
+
+def RStripNewLineFromToken(token):
+ if token.value.endswith('\n'):
+ return Token(token.start, token.end, token.value[:-1], token.token_type)
+ else:
+ return token
+
+
+def TokenizeLines(lines, pos):
+ while True:
+ found = FindFirst(lines, TOKEN_TABLE, pos)
+ if not found:
+ yield MakeToken(lines, pos, Eof(), 'code')
+ return
+
+ if found.start == pos:
+ prev_token = None
+ prev_token_rstripped = None
+ else:
+ prev_token = MakeToken(lines, pos, found.start, 'code')
+ prev_token_rstripped = RStripNewLineFromToken(prev_token)
+
+ if found.token_type == '$$': # A meta comment.
+ if prev_token_rstripped:
+ yield prev_token_rstripped
+ pos = Cursor(found.end.line + 1, 0)
+ elif found.token_type == '$var':
+ if prev_token_rstripped:
+ yield prev_token_rstripped
+ yield found
+ id_token = ParseToken(lines, found.end, ID_REGEX, 'id')
+ yield id_token
+ pos = Skip(lines, id_token.end, OPTIONAL_WHITE_SPACES_REGEX)
+
+ eq_token = ParseToken(lines, pos, EQ_REGEX, '=')
+ yield eq_token
+ pos = Skip(lines, eq_token.end, r'\s*')
+
+ if SubString(lines, pos, pos + 2) != '[[':
+ exp_token = ParseToken(lines, pos, REST_OF_LINE_REGEX, 'exp')
+ yield exp_token
+ pos = Cursor(exp_token.end.line + 1, 0)
+ elif found.token_type == '$for':
+ if prev_token_rstripped:
+ yield prev_token_rstripped
+ yield found
+ id_token = ParseToken(lines, found.end, ID_REGEX, 'id')
+ yield id_token
+ pos = Skip(lines, id_token.end, WHITE_SPACE_REGEX)
+ elif found.token_type == '$range':
+ if prev_token_rstripped:
+ yield prev_token_rstripped
+ yield found
+ id_token = ParseToken(lines, found.end, ID_REGEX, 'id')
+ yield id_token
+ pos = Skip(lines, id_token.end, OPTIONAL_WHITE_SPACES_REGEX)
+
+ dots_pos = SkipUntil(lines, pos, DOT_DOT_REGEX, '..')
+ yield MakeToken(lines, pos, dots_pos, 'exp')
+ yield MakeToken(lines, dots_pos, dots_pos + 2, '..')
+ pos = dots_pos + 2
+ new_pos = Cursor(pos.line + 1, 0)
+ yield MakeToken(lines, pos, new_pos, 'exp')
+ pos = new_pos
+ elif found.token_type == '$':
+ if prev_token:
+ yield prev_token
+ yield found
+ exp_token = ParseExpTokenInParens(lines, found.end)
+ yield exp_token
+ pos = exp_token.end
+ elif (found.token_type == ']]' or found.token_type == '$if' or
+ found.token_type == '$elif' or found.token_type == '$else'):
+ if prev_token_rstripped:
+ yield prev_token_rstripped
+ yield found
+ pos = found.end
+ else:
+ if prev_token:
+ yield prev_token
+ yield found
+ pos = found.end
+
+
+def Tokenize(s):
+ lines = s.splitlines(True)
+ return TokenizeLines(lines, Cursor(0, 0))
+
+
+class CodeNode:
+ def __init__(self, atomic_code_list=None):
+ self.atomic_code = atomic_code_list
+
+
+class VarNode:
+ def __init__(self, identifier=None, atomic_code=None):
+ self.identifier = identifier
+ self.atomic_code = atomic_code
+
+
+class RangeNode:
+ def __init__(self, identifier=None, exp1=None, exp2=None):
+ self.identifier = identifier
+ self.exp1 = exp1
+ self.exp2 = exp2
+
+
+class ForNode:
+ def __init__(self, identifier=None, sep=None, code=None):
+ self.identifier = identifier
+ self.sep = sep
+ self.code = code
+
+
+class ElseNode:
+ def __init__(self, else_branch=None):
+ self.else_branch = else_branch
+
+
+class IfNode:
+ def __init__(self, exp=None, then_branch=None, else_branch=None):
+ self.exp = exp
+ self.then_branch = then_branch
+ self.else_branch = else_branch
+
+
+class RawCodeNode:
+ def __init__(self, token=None):
+ self.raw_code = token
+
+
+class LiteralDollarNode:
+ def __init__(self, token):
+ self.token = token
+
+
+class ExpNode:
+ def __init__(self, token, python_exp):
+ self.token = token
+ self.python_exp = python_exp
+
+
+def PopFront(a_list):
+ head = a_list[0]
+ a_list[:1] = []
+ return head
+
+
+def PushFront(a_list, elem):
+ a_list[:0] = [elem]
+
+
+def PopToken(a_list, token_type=None):
+ token = PopFront(a_list)
+ if token_type is not None and token.token_type != token_type:
+ print 'ERROR: %s expected at %s' % (token_type, token.start)
+ print 'ERROR: %s found instead' % (token,)
+ sys.exit(1)
+
+ return token
+
+
+def PeekToken(a_list):
+ if not a_list:
+ return None
+
+ return a_list[0]
+
+
+def ParseExpNode(token):
+ python_exp = re.sub(r'([_A-Za-z]\w*)', r'self.GetValue("\1")', token.value)
+ return ExpNode(token, python_exp)
+
+
+def ParseElseNode(tokens):
+ def Pop(token_type=None):
+ return PopToken(tokens, token_type)
+
+ next = PeekToken(tokens)
+ if not next:
+ return None
+ if next.token_type == '$else':
+ Pop('$else')
+ Pop('[[')
+ code_node = ParseCodeNode(tokens)
+ Pop(']]')
+ return code_node
+ elif next.token_type == '$elif':
+ Pop('$elif')
+ exp = Pop('code')
+ Pop('[[')
+ code_node = ParseCodeNode(tokens)
+ Pop(']]')
+ inner_else_node = ParseElseNode(tokens)
+ return CodeNode([IfNode(ParseExpNode(exp), code_node, inner_else_node)])
+ elif not next.value.strip():
+ Pop('code')
+ return ParseElseNode(tokens)
+ else:
+ return None
+
+
+def ParseAtomicCodeNode(tokens):
+ def Pop(token_type=None):
+ return PopToken(tokens, token_type)
+
+ head = PopFront(tokens)
+ t = head.token_type
+ if t == 'code':
+ return RawCodeNode(head)
+ elif t == '$var':
+ id_token = Pop('id')
+ Pop('=')
+ next = PeekToken(tokens)
+ if next.token_type == 'exp':
+ exp_token = Pop()
+ return VarNode(id_token, ParseExpNode(exp_token))
+ Pop('[[')
+ code_node = ParseCodeNode(tokens)
+ Pop(']]')
+ return VarNode(id_token, code_node)
+ elif t == '$for':
+ id_token = Pop('id')
+ next_token = PeekToken(tokens)
+ if next_token.token_type == 'code':
+ sep_token = next_token
+ Pop('code')
+ else:
+ sep_token = None
+ Pop('[[')
+ code_node = ParseCodeNode(tokens)
+ Pop(']]')
+ return ForNode(id_token, sep_token, code_node)
+ elif t == '$if':
+ exp_token = Pop('code')
+ Pop('[[')
+ code_node = ParseCodeNode(tokens)
+ Pop(']]')
+ else_node = ParseElseNode(tokens)
+ return IfNode(ParseExpNode(exp_token), code_node, else_node)
+ elif t == '$range':
+ id_token = Pop('id')
+ exp1_token = Pop('exp')
+ Pop('..')
+ exp2_token = Pop('exp')
+ return RangeNode(id_token, ParseExpNode(exp1_token),
+ ParseExpNode(exp2_token))
+ elif t == '$id':
+ return ParseExpNode(Token(head.start + 1, head.end, head.value[1:], 'id'))
+ elif t == '$($)':
+ return LiteralDollarNode(head)
+ elif t == '$':
+ exp_token = Pop('exp')
+ return ParseExpNode(exp_token)
+ elif t == '[[':
+ code_node = ParseCodeNode(tokens)
+ Pop(']]')
+ return code_node
+ else:
+ PushFront(tokens, head)
+ return None
+
+
+def ParseCodeNode(tokens):
+ atomic_code_list = []
+ while True:
+ if not tokens:
+ break
+ atomic_code_node = ParseAtomicCodeNode(tokens)
+ if atomic_code_node:
+ atomic_code_list.append(atomic_code_node)
+ else:
+ break
+ return CodeNode(atomic_code_list)
+
+
+def Convert(file_path):
+ s = file(file_path, 'r').read()
+ tokens = []
+ for token in Tokenize(s):
+ tokens.append(token)
+ code_node = ParseCodeNode(tokens)
+ return code_node
+
+
+class Env:
+ def __init__(self):
+ self.variables = []
+ self.ranges = []
+
+ def Clone(self):
+ clone = Env()
+ clone.variables = self.variables[:]
+ clone.ranges = self.ranges[:]
+ return clone
+
+ def PushVariable(self, var, value):
+ # If value looks like an int, store it as an int.
+ try:
+ int_value = int(value)
+ if ('%s' % int_value) == value:
+ value = int_value
+ except Exception:
+ pass
+ self.variables[:0] = [(var, value)]
+
+ def PopVariable(self):
+ self.variables[:1] = []
+
+ def PushRange(self, var, lower, upper):
+ self.ranges[:0] = [(var, lower, upper)]
+
+ def PopRange(self):
+ self.ranges[:1] = []
+
+ def GetValue(self, identifier):
+ for (var, value) in self.variables:
+ if identifier == var:
+ return value
+
+ print 'ERROR: meta variable %s is undefined.' % (identifier,)
+ sys.exit(1)
+
+ def EvalExp(self, exp):
+ try:
+ result = eval(exp.python_exp)
+ except Exception, e:
+ print 'ERROR: caught exception %s: %s' % (e.__class__.__name__, e)
+ print ('ERROR: failed to evaluate meta expression %s at %s' %
+ (exp.python_exp, exp.token.start))
+ sys.exit(1)
+ return result
+
+ def GetRange(self, identifier):
+ for (var, lower, upper) in self.ranges:
+ if identifier == var:
+ return (lower, upper)
+
+ print 'ERROR: range %s is undefined.' % (identifier,)
+ sys.exit(1)
+
+
+class Output:
+ def __init__(self):
+ self.string = ''
+
+ def GetLastLine(self):
+ index = self.string.rfind('\n')
+ if index < 0:
+ return ''
+
+ return self.string[index + 1:]
+
+ def Append(self, s):
+ self.string += s
+
+
+def RunAtomicCode(env, node, output):
+ if isinstance(node, VarNode):
+ identifier = node.identifier.value.strip()
+ result = Output()
+ RunAtomicCode(env.Clone(), node.atomic_code, result)
+ value = result.string
+ env.PushVariable(identifier, value)
+ elif isinstance(node, RangeNode):
+ identifier = node.identifier.value.strip()
+ lower = int(env.EvalExp(node.exp1))
+ upper = int(env.EvalExp(node.exp2))
+ env.PushRange(identifier, lower, upper)
+ elif isinstance(node, ForNode):
+ identifier = node.identifier.value.strip()
+ if node.sep is None:
+ sep = ''
+ else:
+ sep = node.sep.value
+ (lower, upper) = env.GetRange(identifier)
+ for i in range(lower, upper + 1):
+ new_env = env.Clone()
+ new_env.PushVariable(identifier, i)
+ RunCode(new_env, node.code, output)
+ if i != upper:
+ output.Append(sep)
+ elif isinstance(node, RawCodeNode):
+ output.Append(node.raw_code.value)
+ elif isinstance(node, IfNode):
+ cond = env.EvalExp(node.exp)
+ if cond:
+ RunCode(env.Clone(), node.then_branch, output)
+ elif node.else_branch is not None:
+ RunCode(env.Clone(), node.else_branch, output)
+ elif isinstance(node, ExpNode):
+ value = env.EvalExp(node)
+ output.Append('%s' % (value,))
+ elif isinstance(node, LiteralDollarNode):
+ output.Append('$')
+ elif isinstance(node, CodeNode):
+ RunCode(env.Clone(), node, output)
+ else:
+ print 'BAD'
+ print node
+ sys.exit(1)
+
+
+def RunCode(env, code_node, output):
+ for atomic_code in code_node.atomic_code:
+ RunAtomicCode(env, atomic_code, output)
+
+
+def IsComment(cur_line):
+ return '//' in cur_line
+
+
+def IsInPreprocessorDirevative(prev_lines, cur_line):
+ if cur_line.lstrip().startswith('#'):
+ return True
+ return prev_lines != [] and prev_lines[-1].endswith('\\')
+
+
+def WrapComment(line, output):
+ loc = line.find('//')
+ before_comment = line[:loc].rstrip()
+ if before_comment == '':
+ indent = loc
+ else:
+ output.append(before_comment)
+ indent = len(before_comment) - len(before_comment.lstrip())
+ prefix = indent*' ' + '// '
+ max_len = 80 - len(prefix)
+ comment = line[loc + 2:].strip()
+ segs = [seg for seg in re.split(r'(\w+\W*)', comment) if seg != '']
+ cur_line = ''
+ for seg in segs:
+ if len((cur_line + seg).rstrip()) < max_len:
+ cur_line += seg
+ else:
+ if cur_line.strip() != '':
+ output.append(prefix + cur_line.rstrip())
+ cur_line = seg.lstrip()
+ if cur_line.strip() != '':
+ output.append(prefix + cur_line.strip())
+
+
+def WrapCode(line, line_concat, output):
+ indent = len(line) - len(line.lstrip())
+ prefix = indent*' ' # Prefix of the current line
+ max_len = 80 - indent - len(line_concat) # Maximum length of the current line
+ new_prefix = prefix + 4*' ' # Prefix of a continuation line
+ new_max_len = max_len - 4 # Maximum length of a continuation line
+ # Prefers to wrap a line after a ',' or ';'.
+ segs = [seg for seg in re.split(r'([^,;]+[,;]?)', line.strip()) if seg != '']
+ cur_line = '' # The current line without leading spaces.
+ for seg in segs:
+ # If the line is still too long, wrap at a space.
+ while cur_line == '' and len(seg.strip()) > max_len:
+ seg = seg.lstrip()
+ split_at = seg.rfind(' ', 0, max_len)
+ output.append(prefix + seg[:split_at].strip() + line_concat)
+ seg = seg[split_at + 1:]
+ prefix = new_prefix
+ max_len = new_max_len
+
+ if len((cur_line + seg).rstrip()) < max_len:
+ cur_line = (cur_line + seg).lstrip()
+ else:
+ output.append(prefix + cur_line.rstrip() + line_concat)
+ prefix = new_prefix
+ max_len = new_max_len
+ cur_line = seg.lstrip()
+ if cur_line.strip() != '':
+ output.append(prefix + cur_line.strip())
+
+
+def WrapPreprocessorDirevative(line, output):
+ WrapCode(line, ' \\', output)
+
+
+def WrapPlainCode(line, output):
+ WrapCode(line, '', output)
+
+
+def IsHeaderGuardOrInclude(line):
+ return (re.match(r'^#(ifndef|define|endif\s*//)\s*[\w_]+\s*$', line) or
+ re.match(r'^#include\s', line))
+
+
+def WrapLongLine(line, output):
+ line = line.rstrip()
+ if len(line) <= 80:
+ output.append(line)
+ elif IsComment(line):
+ if IsHeaderGuardOrInclude(line):
+ # The style guide made an exception to allow long header guard lines
+ # and includes.
+ output.append(line)
+ else:
+ WrapComment(line, output)
+ elif IsInPreprocessorDirevative(output, line):
+ if IsHeaderGuardOrInclude(line):
+ # The style guide made an exception to allow long header guard lines
+ # and includes.
+ output.append(line)
+ else:
+ WrapPreprocessorDirevative(line, output)
+ else:
+ WrapPlainCode(line, output)
+
+
+def BeautifyCode(string):
+ lines = string.splitlines()
+ output = []
+ for line in lines:
+ WrapLongLine(line, output)
+ output2 = [line.rstrip() for line in output]
+ return '\n'.join(output2) + '\n'
+
+
+def main(argv):
+ if len(argv) == 1:
+ print __doc__
+ sys.exit(1)
+
+ file_path = argv[-1]
+ ast = Convert(file_path)
+ output = Output()
+ RunCode(Env(), ast, output)
+ output_str = BeautifyCode(output.string)
+ if file_path.endswith('.pump'):
+ output_file_path = file_path[:-5]
+ else:
+ output_file_path = '-'
+ if output_file_path == '-':
+ print output_str,
+ else:
+ output_file = file(output_file_path, 'w')
+ output_file.write('// This file was GENERATED by command:\n')
+ output_file.write('// %s %s\n' %
+ (os.path.basename(__file__), os.path.basename(file_path)))
+ output_file.write('// DO NOT EDIT BY HAND!!!\n\n')
+ output_file.write(output_str)
+ output_file.close()
+
+
+if __name__ == '__main__':
+ main(sys.argv)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload.py
new file mode 100755
index 0000000..6e6f9a1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload.py
@@ -0,0 +1,1387 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Tool for uploading diffs from a version control system to the codereview app.
+
+Usage summary: upload.py [options] [-- diff_options]
+
+Diff options are passed to the diff command of the underlying system.
+
+Supported version control systems:
+ Git
+ Mercurial
+ Subversion
+
+It is important for Git/Mercurial users to specify a tree/node/branch to diff
+against by using the '--rev' option.
+"""
+# This code is derived from appcfg.py in the App Engine SDK (open source),
+# and from ASPN recipe #146306.
+
+import cookielib
+import getpass
+import logging
+import md5
+import mimetypes
+import optparse
+import os
+import re
+import socket
+import subprocess
+import sys
+import urllib
+import urllib2
+import urlparse
+
+try:
+ import readline
+except ImportError:
+ pass
+
+# The logging verbosity:
+# 0: Errors only.
+# 1: Status messages.
+# 2: Info logs.
+# 3: Debug logs.
+verbosity = 1
+
+# Max size of patch or base file.
+MAX_UPLOAD_SIZE = 900 * 1024
+
+
+def GetEmail(prompt):
+ """Prompts the user for their email address and returns it.
+
+ The last used email address is saved to a file and offered up as a suggestion
+ to the user. If the user presses enter without typing in anything the last
+ used email address is used. If the user enters a new address, it is saved
+ for next time we prompt.
+
+ """
+ last_email_file_name = os.path.expanduser("~/.last_codereview_email_address")
+ last_email = ""
+ if os.path.exists(last_email_file_name):
+ try:
+ last_email_file = open(last_email_file_name, "r")
+ last_email = last_email_file.readline().strip("\n")
+ last_email_file.close()
+ prompt += " [%s]" % last_email
+ except IOError, e:
+ pass
+ email = raw_input(prompt + ": ").strip()
+ if email:
+ try:
+ last_email_file = open(last_email_file_name, "w")
+ last_email_file.write(email)
+ last_email_file.close()
+ except IOError, e:
+ pass
+ else:
+ email = last_email
+ return email
+
+
+def StatusUpdate(msg):
+ """Print a status message to stdout.
+
+ If 'verbosity' is greater than 0, print the message.
+
+ Args:
+ msg: The string to print.
+ """
+ if verbosity > 0:
+ print msg
+
+
+def ErrorExit(msg):
+ """Print an error message to stderr and exit."""
+ print >>sys.stderr, msg
+ sys.exit(1)
+
+
+class ClientLoginError(urllib2.HTTPError):
+ """Raised to indicate there was an error authenticating with ClientLogin."""
+
+ def __init__(self, url, code, msg, headers, args):
+ urllib2.HTTPError.__init__(self, url, code, msg, headers, None)
+ self.args = args
+ self.reason = args["Error"]
+
+
+class AbstractRpcServer(object):
+ """Provides a common interface for a simple RPC server."""
+
+ def __init__(self, host, auth_function, host_override=None, extra_headers={},
+ save_cookies=False):
+ """Creates a new HttpRpcServer.
+
+ Args:
+ host: The host to send requests to.
+ auth_function: A function that takes no arguments and returns an
+ (email, password) tuple when called. Will be called if authentication
+ is required.
+ host_override: The host header to send to the server (defaults to host).
+ extra_headers: A dict of extra headers to append to every request.
+ save_cookies: If True, save the authentication cookies to local disk.
+ If False, use an in-memory cookiejar instead. Subclasses must
+ implement this functionality. Defaults to False.
+ """
+ self.host = host
+ self.host_override = host_override
+ self.auth_function = auth_function
+ self.authenticated = False
+ self.extra_headers = extra_headers
+ self.save_cookies = save_cookies
+ self.opener = self._GetOpener()
+ if self.host_override:
+ logging.info("Server: %s; Host: %s", self.host, self.host_override)
+ else:
+ logging.info("Server: %s", self.host)
+
+ def _GetOpener(self):
+ """Returns an OpenerDirector for making HTTP requests.
+
+ Returns:
+ A urllib2.OpenerDirector object.
+ """
+ raise NotImplementedError()
+
+ def _CreateRequest(self, url, data=None):
+ """Creates a new urllib request."""
+ logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
+ req = urllib2.Request(url, data=data)
+ if self.host_override:
+ req.add_header("Host", self.host_override)
+ for key, value in self.extra_headers.iteritems():
+ req.add_header(key, value)
+ return req
+
+ def _GetAuthToken(self, email, password):
+ """Uses ClientLogin to authenticate the user, returning an auth token.
+
+ Args:
+ email: The user's email address
+ password: The user's password
+
+ Raises:
+ ClientLoginError: If there was an error authenticating with ClientLogin.
+ HTTPError: If there was some other form of HTTP error.
+
+ Returns:
+ The authentication token returned by ClientLogin.
+ """
+ account_type = "GOOGLE"
+ if self.host.endswith(".google.com"):
+ # Needed for use inside Google.
+ account_type = "HOSTED"
+ req = self._CreateRequest(
+ url="https://www.google.com/accounts/ClientLogin",
+ data=urllib.urlencode({
+ "Email": email,
+ "Passwd": password,
+ "service": "ah",
+ "source": "rietveld-codereview-upload",
+ "accountType": account_type,
+ }),
+ )
+ try:
+ response = self.opener.open(req)
+ response_body = response.read()
+ response_dict = dict(x.split("=")
+ for x in response_body.split("\n") if x)
+ return response_dict["Auth"]
+ except urllib2.HTTPError, e:
+ if e.code == 403:
+ body = e.read()
+ response_dict = dict(x.split("=", 1) for x in body.split("\n") if x)
+ raise ClientLoginError(req.get_full_url(), e.code, e.msg,
+ e.headers, response_dict)
+ else:
+ raise
+
+ def _GetAuthCookie(self, auth_token):
+ """Fetches authentication cookies for an authentication token.
+
+ Args:
+ auth_token: The authentication token returned by ClientLogin.
+
+ Raises:
+ HTTPError: If there was an error fetching the authentication cookies.
+ """
+ # This is a dummy value to allow us to identify when we're successful.
+ continue_location = "http://localhost/"
+ args = {"continue": continue_location, "auth": auth_token}
+ req = self._CreateRequest("http://%s/_ah/login?%s" %
+ (self.host, urllib.urlencode(args)))
+ try:
+ response = self.opener.open(req)
+ except urllib2.HTTPError, e:
+ response = e
+ if (response.code != 302 or
+ response.info()["location"] != continue_location):
+ raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg,
+ response.headers, response.fp)
+ self.authenticated = True
+
+ def _Authenticate(self):
+ """Authenticates the user.
+
+ The authentication process works as follows:
+ 1) We get a username and password from the user
+ 2) We use ClientLogin to obtain an AUTH token for the user
+ (see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
+ 3) We pass the auth token to /_ah/login on the server to obtain an
+ authentication cookie. If login was successful, it tries to redirect
+ us to the URL we provided.
+
+ If we attempt to access the upload API without first obtaining an
+ authentication cookie, it returns a 401 response and directs us to
+ authenticate ourselves with ClientLogin.
+ """
+ for i in range(3):
+ credentials = self.auth_function()
+ try:
+ auth_token = self._GetAuthToken(credentials[0], credentials[1])
+ except ClientLoginError, e:
+ if e.reason == "BadAuthentication":
+ print >>sys.stderr, "Invalid username or password."
+ continue
+ if e.reason == "CaptchaRequired":
+ print >>sys.stderr, (
+ "Please go to\n"
+ "https://www.google.com/accounts/DisplayUnlockCaptcha\n"
+ "and verify you are a human. Then try again.")
+ break
+ if e.reason == "NotVerified":
+ print >>sys.stderr, "Account not verified."
+ break
+ if e.reason == "TermsNotAgreed":
+ print >>sys.stderr, "User has not agreed to TOS."
+ break
+ if e.reason == "AccountDeleted":
+ print >>sys.stderr, "The user account has been deleted."
+ break
+ if e.reason == "AccountDisabled":
+ print >>sys.stderr, "The user account has been disabled."
+ break
+ if e.reason == "ServiceDisabled":
+ print >>sys.stderr, ("The user's access to the service has been "
+ "disabled.")
+ break
+ if e.reason == "ServiceUnavailable":
+ print >>sys.stderr, "The service is not available; try again later."
+ break
+ raise
+ self._GetAuthCookie(auth_token)
+ return
+
+ def Send(self, request_path, payload=None,
+ content_type="application/octet-stream",
+ timeout=None,
+ **kwargs):
+ """Sends an RPC and returns the response.
+
+ Args:
+ request_path: The path to send the request to, eg /api/appversion/create.
+ payload: The body of the request, or None to send an empty request.
+ content_type: The Content-Type header to use.
+ timeout: timeout in seconds; default None i.e. no timeout.
+ (Note: for large requests on OS X, the timeout doesn't work right.)
+ kwargs: Any keyword arguments are converted into query string parameters.
+
+ Returns:
+ The response body, as a string.
+ """
+ # TODO: Don't require authentication. Let the server say
+ # whether it is necessary.
+ if not self.authenticated:
+ self._Authenticate()
+
+ old_timeout = socket.getdefaulttimeout()
+ socket.setdefaulttimeout(timeout)
+ try:
+ tries = 0
+ while True:
+ tries += 1
+ args = dict(kwargs)
+ url = "http://%s%s" % (self.host, request_path)
+ if args:
+ url += "?" + urllib.urlencode(args)
+ req = self._CreateRequest(url=url, data=payload)
+ req.add_header("Content-Type", content_type)
+ try:
+ f = self.opener.open(req)
+ response = f.read()
+ f.close()
+ return response
+ except urllib2.HTTPError, e:
+ if tries > 3:
+ raise
+ elif e.code == 401:
+ self._Authenticate()
+## elif e.code >= 500 and e.code < 600:
+## # Server Error - try again.
+## continue
+ else:
+ raise
+ finally:
+ socket.setdefaulttimeout(old_timeout)
+
+
+class HttpRpcServer(AbstractRpcServer):
+ """Provides a simplified RPC-style interface for HTTP requests."""
+
+ def _Authenticate(self):
+ """Save the cookie jar after authentication."""
+ super(HttpRpcServer, self)._Authenticate()
+ if self.save_cookies:
+ StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
+ self.cookie_jar.save()
+
+ def _GetOpener(self):
+ """Returns an OpenerDirector that supports cookies and ignores redirects.
+
+ Returns:
+ A urllib2.OpenerDirector object.
+ """
+ opener = urllib2.OpenerDirector()
+ opener.add_handler(urllib2.ProxyHandler())
+ opener.add_handler(urllib2.UnknownHandler())
+ opener.add_handler(urllib2.HTTPHandler())
+ opener.add_handler(urllib2.HTTPDefaultErrorHandler())
+ opener.add_handler(urllib2.HTTPSHandler())
+ opener.add_handler(urllib2.HTTPErrorProcessor())
+ if self.save_cookies:
+ self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
+ self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
+ if os.path.exists(self.cookie_file):
+ try:
+ self.cookie_jar.load()
+ self.authenticated = True
+ StatusUpdate("Loaded authentication cookies from %s" %
+ self.cookie_file)
+ except (cookielib.LoadError, IOError):
+ # Failed to load cookies - just ignore them.
+ pass
+ else:
+ # Create an empty cookie file with mode 600
+ fd = os.open(self.cookie_file, os.O_CREAT, 0600)
+ os.close(fd)
+ # Always chmod the cookie file
+ os.chmod(self.cookie_file, 0600)
+ else:
+ # Don't save cookies across runs of update.py.
+ self.cookie_jar = cookielib.CookieJar()
+ opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
+ return opener
+
+
+parser = optparse.OptionParser(usage="%prog [options] [-- diff_options]")
+parser.add_option("-y", "--assume_yes", action="store_true",
+ dest="assume_yes", default=False,
+ help="Assume that the answer to yes/no questions is 'yes'.")
+# Logging
+group = parser.add_option_group("Logging options")
+group.add_option("-q", "--quiet", action="store_const", const=0,
+ dest="verbose", help="Print errors only.")
+group.add_option("-v", "--verbose", action="store_const", const=2,
+ dest="verbose", default=1,
+ help="Print info level logs (default).")
+group.add_option("--noisy", action="store_const", const=3,
+ dest="verbose", help="Print all logs.")
+# Review server
+group = parser.add_option_group("Review server options")
+group.add_option("-s", "--server", action="store", dest="server",
+ default="codereview.appspot.com",
+ metavar="SERVER",
+ help=("The server to upload to. The format is host[:port]. "
+ "Defaults to 'codereview.appspot.com'."))
+group.add_option("-e", "--email", action="store", dest="email",
+ metavar="EMAIL", default=None,
+ help="The username to use. Will prompt if omitted.")
+group.add_option("-H", "--host", action="store", dest="host",
+ metavar="HOST", default=None,
+ help="Overrides the Host header sent with all RPCs.")
+group.add_option("--no_cookies", action="store_false",
+ dest="save_cookies", default=True,
+ help="Do not save authentication cookies to local disk.")
+# Issue
+group = parser.add_option_group("Issue options")
+group.add_option("-d", "--description", action="store", dest="description",
+ metavar="DESCRIPTION", default=None,
+ help="Optional description when creating an issue.")
+group.add_option("-f", "--description_file", action="store",
+ dest="description_file", metavar="DESCRIPTION_FILE",
+ default=None,
+ help="Optional path of a file that contains "
+ "the description when creating an issue.")
+group.add_option("-r", "--reviewers", action="store", dest="reviewers",
+ metavar="REVIEWERS", default=None,
+ help="Add reviewers (comma separated email addresses).")
+group.add_option("--cc", action="store", dest="cc",
+ metavar="CC", default=None,
+ help="Add CC (comma separated email addresses).")
+# Upload options
+group = parser.add_option_group("Patch options")
+group.add_option("-m", "--message", action="store", dest="message",
+ metavar="MESSAGE", default=None,
+ help="A message to identify the patch. "
+ "Will prompt if omitted.")
+group.add_option("-i", "--issue", type="int", action="store",
+ metavar="ISSUE", default=None,
+ help="Issue number to which to add. Defaults to new issue.")
+group.add_option("--download_base", action="store_true",
+ dest="download_base", default=False,
+ help="Base files will be downloaded by the server "
+ "(side-by-side diffs may not work on files with CRs).")
+group.add_option("--rev", action="store", dest="revision",
+ metavar="REV", default=None,
+ help="Branch/tree/revision to diff against (used by DVCS).")
+group.add_option("--send_mail", action="store_true",
+ dest="send_mail", default=False,
+ help="Send notification email to reviewers.")
+
+
+def GetRpcServer(options):
+ """Returns an instance of an AbstractRpcServer.
+
+ Returns:
+ A new AbstractRpcServer, on which RPC calls can be made.
+ """
+
+ rpc_server_class = HttpRpcServer
+
+ def GetUserCredentials():
+ """Prompts the user for a username and password."""
+ email = options.email
+ if email is None:
+ email = GetEmail("Email (login for uploading to %s)" % options.server)
+ password = getpass.getpass("Password for %s: " % email)
+ return (email, password)
+
+ # If this is the dev_appserver, use fake authentication.
+ host = (options.host or options.server).lower()
+ if host == "localhost" or host.startswith("localhost:"):
+ email = options.email
+ if email is None:
+ email = "test@example.com"
+ logging.info("Using debug user %s. Override with --email" % email)
+ server = rpc_server_class(
+ options.server,
+ lambda: (email, "password"),
+ host_override=options.host,
+ extra_headers={"Cookie":
+ 'dev_appserver_login="%s:False"' % email},
+ save_cookies=options.save_cookies)
+ # Don't try to talk to ClientLogin.
+ server.authenticated = True
+ return server
+
+ return rpc_server_class(options.server, GetUserCredentials,
+ host_override=options.host,
+ save_cookies=options.save_cookies)
+
+
+def EncodeMultipartFormData(fields, files):
+ """Encode form fields for multipart/form-data.
+
+ Args:
+ fields: A sequence of (name, value) elements for regular form fields.
+ files: A sequence of (name, filename, value) elements for data to be
+ uploaded as files.
+ Returns:
+ (content_type, body) ready for httplib.HTTP instance.
+
+ Source:
+ http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306
+ """
+ BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
+ CRLF = '\r\n'
+ lines = []
+ for (key, value) in fields:
+ lines.append('--' + BOUNDARY)
+ lines.append('Content-Disposition: form-data; name="%s"' % key)
+ lines.append('')
+ lines.append(value)
+ for (key, filename, value) in files:
+ lines.append('--' + BOUNDARY)
+ lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' %
+ (key, filename))
+ lines.append('Content-Type: %s' % GetContentType(filename))
+ lines.append('')
+ lines.append(value)
+ lines.append('--' + BOUNDARY + '--')
+ lines.append('')
+ body = CRLF.join(lines)
+ content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
+ return content_type, body
+
+
+def GetContentType(filename):
+ """Helper to guess the content-type from the filename."""
+ return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
+
+
+# Use a shell for subcommands on Windows to get a PATH search.
+use_shell = sys.platform.startswith("win")
+
+def RunShellWithReturnCode(command, print_output=False,
+ universal_newlines=True):
+ """Executes a command and returns the output from stdout and the return code.
+
+ Args:
+ command: Command to execute.
+ print_output: If True, the output is printed to stdout.
+ If False, both stdout and stderr are ignored.
+ universal_newlines: Use universal_newlines flag (default: True).
+
+ Returns:
+ Tuple (output, return code)
+ """
+ logging.info("Running %s", command)
+ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ shell=use_shell, universal_newlines=universal_newlines)
+ if print_output:
+ output_array = []
+ while True:
+ line = p.stdout.readline()
+ if not line:
+ break
+ print line.strip("\n")
+ output_array.append(line)
+ output = "".join(output_array)
+ else:
+ output = p.stdout.read()
+ p.wait()
+ errout = p.stderr.read()
+ if print_output and errout:
+ print >>sys.stderr, errout
+ p.stdout.close()
+ p.stderr.close()
+ return output, p.returncode
+
+
+def RunShell(command, silent_ok=False, universal_newlines=True,
+ print_output=False):
+ data, retcode = RunShellWithReturnCode(command, print_output,
+ universal_newlines)
+ if retcode:
+ ErrorExit("Got error status from %s:\n%s" % (command, data))
+ if not silent_ok and not data:
+ ErrorExit("No output from %s" % command)
+ return data
+
+
+class VersionControlSystem(object):
+ """Abstract base class providing an interface to the VCS."""
+
+ def __init__(self, options):
+ """Constructor.
+
+ Args:
+ options: Command line options.
+ """
+ self.options = options
+
+ def GenerateDiff(self, args):
+ """Return the current diff as a string.
+
+ Args:
+ args: Extra arguments to pass to the diff command.
+ """
+ raise NotImplementedError(
+ "abstract method -- subclass %s must override" % self.__class__)
+
+ def GetUnknownFiles(self):
+ """Return a list of files unknown to the VCS."""
+ raise NotImplementedError(
+ "abstract method -- subclass %s must override" % self.__class__)
+
+ def CheckForUnknownFiles(self):
+ """Show an "are you sure?" prompt if there are unknown files."""
+ unknown_files = self.GetUnknownFiles()
+ if unknown_files:
+ print "The following files are not added to version control:"
+ for line in unknown_files:
+ print line
+ prompt = "Are you sure to continue?(y/N) "
+ answer = raw_input(prompt).strip()
+ if answer != "y":
+ ErrorExit("User aborted")
+
+ def GetBaseFile(self, filename):
+ """Get the content of the upstream version of a file.
+
+ Returns:
+ A tuple (base_content, new_content, is_binary, status)
+ base_content: The contents of the base file.
+ new_content: For text files, this is empty. For binary files, this is
+ the contents of the new file, since the diff output won't contain
+ information to reconstruct the current file.
+ is_binary: True iff the file is binary.
+ status: The status of the file.
+ """
+
+ raise NotImplementedError(
+ "abstract method -- subclass %s must override" % self.__class__)
+
+
+ def GetBaseFiles(self, diff):
+ """Helper that calls GetBase file for each file in the patch.
+
+ Returns:
+ A dictionary that maps from filename to GetBaseFile's tuple. Filenames
+ are retrieved based on lines that start with "Index:" or
+ "Property changes on:".
+ """
+ files = {}
+ for line in diff.splitlines(True):
+ if line.startswith('Index:') or line.startswith('Property changes on:'):
+ unused, filename = line.split(':', 1)
+ # On Windows if a file has property changes its filename uses '\'
+ # instead of '/'.
+ filename = filename.strip().replace('\\', '/')
+ files[filename] = self.GetBaseFile(filename)
+ return files
+
+
+ def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options,
+ files):
+ """Uploads the base files (and if necessary, the current ones as well)."""
+
+ def UploadFile(filename, file_id, content, is_binary, status, is_base):
+ """Uploads a file to the server."""
+ file_too_large = False
+ if is_base:
+ type = "base"
+ else:
+ type = "current"
+ if len(content) > MAX_UPLOAD_SIZE:
+ print ("Not uploading the %s file for %s because it's too large." %
+ (type, filename))
+ file_too_large = True
+ content = ""
+ checksum = md5.new(content).hexdigest()
+ if options.verbose > 0 and not file_too_large:
+ print "Uploading %s file for %s" % (type, filename)
+ url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id)
+ form_fields = [("filename", filename),
+ ("status", status),
+ ("checksum", checksum),
+ ("is_binary", str(is_binary)),
+ ("is_current", str(not is_base)),
+ ]
+ if file_too_large:
+ form_fields.append(("file_too_large", "1"))
+ if options.email:
+ form_fields.append(("user", options.email))
+ ctype, body = EncodeMultipartFormData(form_fields,
+ [("data", filename, content)])
+ response_body = rpc_server.Send(url, body,
+ content_type=ctype)
+ if not response_body.startswith("OK"):
+ StatusUpdate(" --> %s" % response_body)
+ sys.exit(1)
+
+ patches = dict()
+ [patches.setdefault(v, k) for k, v in patch_list]
+ for filename in patches.keys():
+ base_content, new_content, is_binary, status = files[filename]
+ file_id_str = patches.get(filename)
+ if file_id_str.find("nobase") != -1:
+ base_content = None
+ file_id_str = file_id_str[file_id_str.rfind("_") + 1:]
+ file_id = int(file_id_str)
+ if base_content != None:
+ UploadFile(filename, file_id, base_content, is_binary, status, True)
+ if new_content != None:
+ UploadFile(filename, file_id, new_content, is_binary, status, False)
+
+ def IsImage(self, filename):
+ """Returns true if the filename has an image extension."""
+ mimetype = mimetypes.guess_type(filename)[0]
+ if not mimetype:
+ return False
+ return mimetype.startswith("image/")
+
+
+class SubversionVCS(VersionControlSystem):
+ """Implementation of the VersionControlSystem interface for Subversion."""
+
+ def __init__(self, options):
+ super(SubversionVCS, self).__init__(options)
+ if self.options.revision:
+ match = re.match(r"(\d+)(:(\d+))?", self.options.revision)
+ if not match:
+ ErrorExit("Invalid Subversion revision %s." % self.options.revision)
+ self.rev_start = match.group(1)
+ self.rev_end = match.group(3)
+ else:
+ self.rev_start = self.rev_end = None
+ # Cache output from "svn list -r REVNO dirname".
+ # Keys: dirname, Values: 2-tuple (ouput for start rev and end rev).
+ self.svnls_cache = {}
+ # SVN base URL is required to fetch files deleted in an older revision.
+ # Result is cached to not guess it over and over again in GetBaseFile().
+ required = self.options.download_base or self.options.revision is not None
+ self.svn_base = self._GuessBase(required)
+
+ def GuessBase(self, required):
+ """Wrapper for _GuessBase."""
+ return self.svn_base
+
+ def _GuessBase(self, required):
+ """Returns the SVN base URL.
+
+ Args:
+ required: If true, exits if the url can't be guessed, otherwise None is
+ returned.
+ """
+ info = RunShell(["svn", "info"])
+ for line in info.splitlines():
+ words = line.split()
+ if len(words) == 2 and words[0] == "URL:":
+ url = words[1]
+ scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
+ username, netloc = urllib.splituser(netloc)
+ if username:
+ logging.info("Removed username from base URL")
+ if netloc.endswith("svn.python.org"):
+ if netloc == "svn.python.org":
+ if path.startswith("/projects/"):
+ path = path[9:]
+ elif netloc != "pythondev@svn.python.org":
+ ErrorExit("Unrecognized Python URL: %s" % url)
+ base = "http://svn.python.org/view/*checkout*%s/" % path
+ logging.info("Guessed Python base = %s", base)
+ elif netloc.endswith("svn.collab.net"):
+ if path.startswith("/repos/"):
+ path = path[6:]
+ base = "http://svn.collab.net/viewvc/*checkout*%s/" % path
+ logging.info("Guessed CollabNet base = %s", base)
+ elif netloc.endswith(".googlecode.com"):
+ path = path + "/"
+ base = urlparse.urlunparse(("http", netloc, path, params,
+ query, fragment))
+ logging.info("Guessed Google Code base = %s", base)
+ else:
+ path = path + "/"
+ base = urlparse.urlunparse((scheme, netloc, path, params,
+ query, fragment))
+ logging.info("Guessed base = %s", base)
+ return base
+ if required:
+ ErrorExit("Can't find URL in output from svn info")
+ return None
+
+ def GenerateDiff(self, args):
+ cmd = ["svn", "diff"]
+ if self.options.revision:
+ cmd += ["-r", self.options.revision]
+ cmd.extend(args)
+ data = RunShell(cmd)
+ count = 0
+ for line in data.splitlines():
+ if line.startswith("Index:") or line.startswith("Property changes on:"):
+ count += 1
+ logging.info(line)
+ if not count:
+ ErrorExit("No valid patches found in output from svn diff")
+ return data
+
+ def _CollapseKeywords(self, content, keyword_str):
+ """Collapses SVN keywords."""
+ # svn cat translates keywords but svn diff doesn't. As a result of this
+ # behavior patching.PatchChunks() fails with a chunk mismatch error.
+ # This part was originally written by the Review Board development team
+ # who had the same problem (http://reviews.review-board.org/r/276/).
+ # Mapping of keywords to known aliases
+ svn_keywords = {
+ # Standard keywords
+ 'Date': ['Date', 'LastChangedDate'],
+ 'Revision': ['Revision', 'LastChangedRevision', 'Rev'],
+ 'Author': ['Author', 'LastChangedBy'],
+ 'HeadURL': ['HeadURL', 'URL'],
+ 'Id': ['Id'],
+
+ # Aliases
+ 'LastChangedDate': ['LastChangedDate', 'Date'],
+ 'LastChangedRevision': ['LastChangedRevision', 'Rev', 'Revision'],
+ 'LastChangedBy': ['LastChangedBy', 'Author'],
+ 'URL': ['URL', 'HeadURL'],
+ }
+
+ def repl(m):
+ if m.group(2):
+ return "$%s::%s$" % (m.group(1), " " * len(m.group(3)))
+ return "$%s$" % m.group(1)
+ keywords = [keyword
+ for name in keyword_str.split(" ")
+ for keyword in svn_keywords.get(name, [])]
+ return re.sub(r"\$(%s):(:?)([^\$]+)\$" % '|'.join(keywords), repl, content)
+
+ def GetUnknownFiles(self):
+ status = RunShell(["svn", "status", "--ignore-externals"], silent_ok=True)
+ unknown_files = []
+ for line in status.split("\n"):
+ if line and line[0] == "?":
+ unknown_files.append(line)
+ return unknown_files
+
+ def ReadFile(self, filename):
+ """Returns the contents of a file."""
+ file = open(filename, 'rb')
+ result = ""
+ try:
+ result = file.read()
+ finally:
+ file.close()
+ return result
+
+ def GetStatus(self, filename):
+ """Returns the status of a file."""
+ if not self.options.revision:
+ status = RunShell(["svn", "status", "--ignore-externals", filename])
+ if not status:
+ ErrorExit("svn status returned no output for %s" % filename)
+ status_lines = status.splitlines()
+ # If file is in a cl, the output will begin with
+ # "\n--- Changelist 'cl_name':\n". See
+ # http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
+ if (len(status_lines) == 3 and
+ not status_lines[0] and
+ status_lines[1].startswith("--- Changelist")):
+ status = status_lines[2]
+ else:
+ status = status_lines[0]
+ # If we have a revision to diff against we need to run "svn list"
+ # for the old and the new revision and compare the results to get
+ # the correct status for a file.
+ else:
+ dirname, relfilename = os.path.split(filename)
+ if dirname not in self.svnls_cache:
+ cmd = ["svn", "list", "-r", self.rev_start, dirname or "."]
+ out, returncode = RunShellWithReturnCode(cmd)
+ if returncode:
+ ErrorExit("Failed to get status for %s." % filename)
+ old_files = out.splitlines()
+ args = ["svn", "list"]
+ if self.rev_end:
+ args += ["-r", self.rev_end]
+ cmd = args + [dirname or "."]
+ out, returncode = RunShellWithReturnCode(cmd)
+ if returncode:
+ ErrorExit("Failed to run command %s" % cmd)
+ self.svnls_cache[dirname] = (old_files, out.splitlines())
+ old_files, new_files = self.svnls_cache[dirname]
+ if relfilename in old_files and relfilename not in new_files:
+ status = "D "
+ elif relfilename in old_files and relfilename in new_files:
+ status = "M "
+ else:
+ status = "A "
+ return status
+
+ def GetBaseFile(self, filename):
+ status = self.GetStatus(filename)
+ base_content = None
+ new_content = None
+
+ # If a file is copied its status will be "A +", which signifies
+ # "addition-with-history". See "svn st" for more information. We need to
+ # upload the original file or else diff parsing will fail if the file was
+ # edited.
+ if status[0] == "A" and status[3] != "+":
+ # We'll need to upload the new content if we're adding a binary file
+ # since diff's output won't contain it.
+ mimetype = RunShell(["svn", "propget", "svn:mime-type", filename],
+ silent_ok=True)
+ base_content = ""
+ is_binary = mimetype and not mimetype.startswith("text/")
+ if is_binary and self.IsImage(filename):
+ new_content = self.ReadFile(filename)
+ elif (status[0] in ("M", "D", "R") or
+ (status[0] == "A" and status[3] == "+") or # Copied file.
+ (status[0] == " " and status[1] == "M")): # Property change.
+ args = []
+ if self.options.revision:
+ url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
+ else:
+ # Don't change filename, it's needed later.
+ url = filename
+ args += ["-r", "BASE"]
+ cmd = ["svn"] + args + ["propget", "svn:mime-type", url]
+ mimetype, returncode = RunShellWithReturnCode(cmd)
+ if returncode:
+ # File does not exist in the requested revision.
+ # Reset mimetype, it contains an error message.
+ mimetype = ""
+ get_base = False
+ is_binary = mimetype and not mimetype.startswith("text/")
+ if status[0] == " ":
+ # Empty base content just to force an upload.
+ base_content = ""
+ elif is_binary:
+ if self.IsImage(filename):
+ get_base = True
+ if status[0] == "M":
+ if not self.rev_end:
+ new_content = self.ReadFile(filename)
+ else:
+ url = "%s/%s@%s" % (self.svn_base, filename, self.rev_end)
+ new_content = RunShell(["svn", "cat", url],
+ universal_newlines=True, silent_ok=True)
+ else:
+ base_content = ""
+ else:
+ get_base = True
+
+ if get_base:
+ if is_binary:
+ universal_newlines = False
+ else:
+ universal_newlines = True
+ if self.rev_start:
+ # "svn cat -r REV delete_file.txt" doesn't work. cat requires
+ # the full URL with "@REV" appended instead of using "-r" option.
+ url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
+ base_content = RunShell(["svn", "cat", url],
+ universal_newlines=universal_newlines,
+ silent_ok=True)
+ else:
+ base_content = RunShell(["svn", "cat", filename],
+ universal_newlines=universal_newlines,
+ silent_ok=True)
+ if not is_binary:
+ args = []
+ if self.rev_start:
+ url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
+ else:
+ url = filename
+ args += ["-r", "BASE"]
+ cmd = ["svn"] + args + ["propget", "svn:keywords", url]
+ keywords, returncode = RunShellWithReturnCode(cmd)
+ if keywords and not returncode:
+ base_content = self._CollapseKeywords(base_content, keywords)
+ else:
+ StatusUpdate("svn status returned unexpected output: %s" % status)
+ sys.exit(1)
+ return base_content, new_content, is_binary, status[0:5]
+
+
+class GitVCS(VersionControlSystem):
+ """Implementation of the VersionControlSystem interface for Git."""
+
+ def __init__(self, options):
+ super(GitVCS, self).__init__(options)
+ # Map of filename -> hash of base file.
+ self.base_hashes = {}
+
+ def GenerateDiff(self, extra_args):
+ # This is more complicated than svn's GenerateDiff because we must convert
+ # the diff output to include an svn-style "Index:" line as well as record
+ # the hashes of the base files, so we can upload them along with our diff.
+ if self.options.revision:
+ extra_args = [self.options.revision] + extra_args
+ gitdiff = RunShell(["git", "diff", "--full-index"] + extra_args)
+ svndiff = []
+ filecount = 0
+ filename = None
+ for line in gitdiff.splitlines():
+ match = re.match(r"diff --git a/(.*) b/.*$", line)
+ if match:
+ filecount += 1
+ filename = match.group(1)
+ svndiff.append("Index: %s\n" % filename)
+ else:
+ # The "index" line in a git diff looks like this (long hashes elided):
+ # index 82c0d44..b2cee3f 100755
+ # We want to save the left hash, as that identifies the base file.
+ match = re.match(r"index (\w+)\.\.", line)
+ if match:
+ self.base_hashes[filename] = match.group(1)
+ svndiff.append(line + "\n")
+ if not filecount:
+ ErrorExit("No valid patches found in output from git diff")
+ return "".join(svndiff)
+
+ def GetUnknownFiles(self):
+ status = RunShell(["git", "ls-files", "--exclude-standard", "--others"],
+ silent_ok=True)
+ return status.splitlines()
+
+ def GetBaseFile(self, filename):
+ hash = self.base_hashes[filename]
+ base_content = None
+ new_content = None
+ is_binary = False
+ if hash == "0" * 40: # All-zero hash indicates no base file.
+ status = "A"
+ base_content = ""
+ else:
+ status = "M"
+ base_content, returncode = RunShellWithReturnCode(["git", "show", hash])
+ if returncode:
+ ErrorExit("Got error status from 'git show %s'" % hash)
+ return (base_content, new_content, is_binary, status)
+
+
+class MercurialVCS(VersionControlSystem):
+ """Implementation of the VersionControlSystem interface for Mercurial."""
+
+ def __init__(self, options, repo_dir):
+ super(MercurialVCS, self).__init__(options)
+ # Absolute path to repository (we can be in a subdir)
+ self.repo_dir = os.path.normpath(repo_dir)
+ # Compute the subdir
+ cwd = os.path.normpath(os.getcwd())
+ assert cwd.startswith(self.repo_dir)
+ self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
+ if self.options.revision:
+ self.base_rev = self.options.revision
+ else:
+ self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
+
+ def _GetRelPath(self, filename):
+ """Get relative path of a file according to the current directory,
+ given its logical path in the repo."""
+ assert filename.startswith(self.subdir), filename
+ return filename[len(self.subdir):].lstrip(r"\/")
+
+ def GenerateDiff(self, extra_args):
+ # If no file specified, restrict to the current subdir
+ extra_args = extra_args or ["."]
+ cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
+ data = RunShell(cmd, silent_ok=True)
+ svndiff = []
+ filecount = 0
+ for line in data.splitlines():
+ m = re.match("diff --git a/(\S+) b/(\S+)", line)
+ if m:
+ # Modify line to make it look like as it comes from svn diff.
+ # With this modification no changes on the server side are required
+ # to make upload.py work with Mercurial repos.
+ # NOTE: for proper handling of moved/copied files, we have to use
+ # the second filename.
+ filename = m.group(2)
+ svndiff.append("Index: %s" % filename)
+ svndiff.append("=" * 67)
+ filecount += 1
+ logging.info(line)
+ else:
+ svndiff.append(line)
+ if not filecount:
+ ErrorExit("No valid patches found in output from hg diff")
+ return "\n".join(svndiff) + "\n"
+
+ def GetUnknownFiles(self):
+ """Return a list of files unknown to the VCS."""
+ args = []
+ status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
+ silent_ok=True)
+ unknown_files = []
+ for line in status.splitlines():
+ st, fn = line.split(" ", 1)
+ if st == "?":
+ unknown_files.append(fn)
+ return unknown_files
+
+ def GetBaseFile(self, filename):
+ # "hg status" and "hg cat" both take a path relative to the current subdir
+ # rather than to the repo root, but "hg diff" has given us the full path
+ # to the repo root.
+ base_content = ""
+ new_content = None
+ is_binary = False
+ oldrelpath = relpath = self._GetRelPath(filename)
+ # "hg status -C" returns two lines for moved/copied files, one otherwise
+ out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
+ out = out.splitlines()
+ # HACK: strip error message about missing file/directory if it isn't in
+ # the working copy
+ if out[0].startswith('%s: ' % relpath):
+ out = out[1:]
+ if len(out) > 1:
+ # Moved/copied => considered as modified, use old filename to
+ # retrieve base contents
+ oldrelpath = out[1].strip()
+ status = "M"
+ else:
+ status, _ = out[0].split(' ', 1)
+ if status != "A":
+ base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
+ silent_ok=True)
+ is_binary = "\0" in base_content # Mercurial's heuristic
+ if status != "R":
+ new_content = open(relpath, "rb").read()
+ is_binary = is_binary or "\0" in new_content
+ if is_binary and base_content:
+ # Fetch again without converting newlines
+ base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
+ silent_ok=True, universal_newlines=False)
+ if not is_binary or not self.IsImage(relpath):
+ new_content = None
+ return base_content, new_content, is_binary, status
+
+
+# NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
+def SplitPatch(data):
+ """Splits a patch into separate pieces for each file.
+
+ Args:
+ data: A string containing the output of svn diff.
+
+ Returns:
+ A list of 2-tuple (filename, text) where text is the svn diff output
+ pertaining to filename.
+ """
+ patches = []
+ filename = None
+ diff = []
+ for line in data.splitlines(True):
+ new_filename = None
+ if line.startswith('Index:'):
+ unused, new_filename = line.split(':', 1)
+ new_filename = new_filename.strip()
+ elif line.startswith('Property changes on:'):
+ unused, temp_filename = line.split(':', 1)
+ # When a file is modified, paths use '/' between directories, however
+ # when a property is modified '\' is used on Windows. Make them the same
+ # otherwise the file shows up twice.
+ temp_filename = temp_filename.strip().replace('\\', '/')
+ if temp_filename != filename:
+ # File has property changes but no modifications, create a new diff.
+ new_filename = temp_filename
+ if new_filename:
+ if filename and diff:
+ patches.append((filename, ''.join(diff)))
+ filename = new_filename
+ diff = [line]
+ continue
+ if diff is not None:
+ diff.append(line)
+ if filename and diff:
+ patches.append((filename, ''.join(diff)))
+ return patches
+
+
+def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
+ """Uploads a separate patch for each file in the diff output.
+
+ Returns a list of [patch_key, filename] for each file.
+ """
+ patches = SplitPatch(data)
+ rv = []
+ for patch in patches:
+ if len(patch[1]) > MAX_UPLOAD_SIZE:
+ print ("Not uploading the patch for " + patch[0] +
+ " because the file is too large.")
+ continue
+ form_fields = [("filename", patch[0])]
+ if not options.download_base:
+ form_fields.append(("content_upload", "1"))
+ files = [("data", "data.diff", patch[1])]
+ ctype, body = EncodeMultipartFormData(form_fields, files)
+ url = "/%d/upload_patch/%d" % (int(issue), int(patchset))
+ print "Uploading patch for " + patch[0]
+ response_body = rpc_server.Send(url, body, content_type=ctype)
+ lines = response_body.splitlines()
+ if not lines or lines[0] != "OK":
+ StatusUpdate(" --> %s" % response_body)
+ sys.exit(1)
+ rv.append([lines[1], patch[0]])
+ return rv
+
+
+def GuessVCS(options):
+ """Helper to guess the version control system.
+
+ This examines the current directory, guesses which VersionControlSystem
+ we're using, and returns an instance of the appropriate class. Exit with an
+ error if we can't figure it out.
+
+ Returns:
+ A VersionControlSystem instance. Exits if the VCS can't be guessed.
+ """
+ # Mercurial has a command to get the base directory of a repository
+ # Try running it, but don't die if we don't have hg installed.
+ # NOTE: we try Mercurial first as it can sit on top of an SVN working copy.
+ try:
+ out, returncode = RunShellWithReturnCode(["hg", "root"])
+ if returncode == 0:
+ return MercurialVCS(options, out.strip())
+ except OSError, (errno, message):
+ if errno != 2: # ENOENT -- they don't have hg installed.
+ raise
+
+ # Subversion has a .svn in all working directories.
+ if os.path.isdir('.svn'):
+ logging.info("Guessed VCS = Subversion")
+ return SubversionVCS(options)
+
+ # Git has a command to test if you're in a git tree.
+ # Try running it, but don't die if we don't have git installed.
+ try:
+ out, returncode = RunShellWithReturnCode(["git", "rev-parse",
+ "--is-inside-work-tree"])
+ if returncode == 0:
+ return GitVCS(options)
+ except OSError, (errno, message):
+ if errno != 2: # ENOENT -- they don't have git installed.
+ raise
+
+ ErrorExit(("Could not guess version control system. "
+ "Are you in a working copy directory?"))
+
+
+def RealMain(argv, data=None):
+ """The real main function.
+
+ Args:
+ argv: Command line arguments.
+ data: Diff contents. If None (default) the diff is generated by
+ the VersionControlSystem implementation returned by GuessVCS().
+
+ Returns:
+ A 2-tuple (issue id, patchset id).
+ The patchset id is None if the base files are not uploaded by this
+ script (applies only to SVN checkouts).
+ """
+ logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:"
+ "%(lineno)s %(message)s "))
+ os.environ['LC_ALL'] = 'C'
+ options, args = parser.parse_args(argv[1:])
+ global verbosity
+ verbosity = options.verbose
+ if verbosity >= 3:
+ logging.getLogger().setLevel(logging.DEBUG)
+ elif verbosity >= 2:
+ logging.getLogger().setLevel(logging.INFO)
+ vcs = GuessVCS(options)
+ if isinstance(vcs, SubversionVCS):
+ # base field is only allowed for Subversion.
+ # Note: Fetching base files may become deprecated in future releases.
+ base = vcs.GuessBase(options.download_base)
+ else:
+ base = None
+ if not base and options.download_base:
+ options.download_base = True
+ logging.info("Enabled upload of base file")
+ if not options.assume_yes:
+ vcs.CheckForUnknownFiles()
+ if data is None:
+ data = vcs.GenerateDiff(args)
+ files = vcs.GetBaseFiles(data)
+ if verbosity >= 1:
+ print "Upload server:", options.server, "(change with -s/--server)"
+ if options.issue:
+ prompt = "Message describing this patch set: "
+ else:
+ prompt = "New issue subject: "
+ message = options.message or raw_input(prompt).strip()
+ if not message:
+ ErrorExit("A non-empty message is required")
+ rpc_server = GetRpcServer(options)
+ form_fields = [("subject", message)]
+ if base:
+ form_fields.append(("base", base))
+ if options.issue:
+ form_fields.append(("issue", str(options.issue)))
+ if options.email:
+ form_fields.append(("user", options.email))
+ if options.reviewers:
+ for reviewer in options.reviewers.split(','):
+ if "@" in reviewer and not reviewer.split("@")[1].count(".") == 1:
+ ErrorExit("Invalid email address: %s" % reviewer)
+ form_fields.append(("reviewers", options.reviewers))
+ if options.cc:
+ for cc in options.cc.split(','):
+ if "@" in cc and not cc.split("@")[1].count(".") == 1:
+ ErrorExit("Invalid email address: %s" % cc)
+ form_fields.append(("cc", options.cc))
+ description = options.description
+ if options.description_file:
+ if options.description:
+ ErrorExit("Can't specify description and description_file")
+ file = open(options.description_file, 'r')
+ description = file.read()
+ file.close()
+ if description:
+ form_fields.append(("description", description))
+ # Send a hash of all the base file so the server can determine if a copy
+ # already exists in an earlier patchset.
+ base_hashes = ""
+ for file, info in files.iteritems():
+ if not info[0] is None:
+ checksum = md5.new(info[0]).hexdigest()
+ if base_hashes:
+ base_hashes += "|"
+ base_hashes += checksum + ":" + file
+ form_fields.append(("base_hashes", base_hashes))
+ # If we're uploading base files, don't send the email before the uploads, so
+ # that it contains the file status.
+ if options.send_mail and options.download_base:
+ form_fields.append(("send_mail", "1"))
+ if not options.download_base:
+ form_fields.append(("content_upload", "1"))
+ if len(data) > MAX_UPLOAD_SIZE:
+ print "Patch is large, so uploading file patches separately."
+ uploaded_diff_file = []
+ form_fields.append(("separate_patches", "1"))
+ else:
+ uploaded_diff_file = [("data", "data.diff", data)]
+ ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file)
+ response_body = rpc_server.Send("/upload", body, content_type=ctype)
+ patchset = None
+ if not options.download_base or not uploaded_diff_file:
+ lines = response_body.splitlines()
+ if len(lines) >= 2:
+ msg = lines[0]
+ patchset = lines[1].strip()
+ patches = [x.split(" ", 1) for x in lines[2:]]
+ else:
+ msg = response_body
+ else:
+ msg = response_body
+ StatusUpdate(msg)
+ if not response_body.startswith("Issue created.") and \
+ not response_body.startswith("Issue updated."):
+ sys.exit(0)
+ issue = msg[msg.rfind("/")+1:]
+
+ if not uploaded_diff_file:
+ result = UploadSeparatePatches(issue, rpc_server, patchset, data, options)
+ if not options.download_base:
+ patches = result
+
+ if not options.download_base:
+ vcs.UploadBaseFiles(issue, rpc_server, patches, patchset, options, files)
+ if options.send_mail:
+ rpc_server.Send("/" + issue + "/mail", payload="")
+ return issue, patchset
+
+
+def main():
+ try:
+ RealMain(sys.argv)
+ except KeyboardInterrupt:
+ print
+ StatusUpdate("Interrupted.")
+ sys.exit(1)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload_gtest.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload_gtest.py
new file mode 100755
index 0000000..be19ae8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/scripts/upload_gtest.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""upload_gtest.py v0.1.0 -- uploads a Google Test patch for review.
+
+This simple wrapper passes all command line flags and
+--cc=googletestframework@googlegroups.com to upload.py.
+
+USAGE: upload_gtest.py [options for upload.py]
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import sys
+
+CC_FLAG = '--cc='
+GTEST_GROUP = 'googletestframework@googlegroups.com'
+
+
+def main():
+ # Finds the path to upload.py, assuming it is in the same directory
+ # as this file.
+ my_dir = os.path.dirname(os.path.abspath(__file__))
+ upload_py_path = os.path.join(my_dir, 'upload.py')
+
+ # Adds Google Test discussion group to the cc line if it's not there
+ # already.
+ upload_py_argv = [upload_py_path]
+ found_cc_flag = False
+ for arg in sys.argv[1:]:
+ if arg.startswith(CC_FLAG):
+ found_cc_flag = True
+ cc_line = arg[len(CC_FLAG):]
+ cc_list = [addr for addr in cc_line.split(',') if addr]
+ if GTEST_GROUP not in cc_list:
+ cc_list.append(GTEST_GROUP)
+ upload_py_argv.append(CC_FLAG + ','.join(cc_list))
+ else:
+ upload_py_argv.append(arg)
+
+ if not found_cc_flag:
+ upload_py_argv.append(CC_FLAG + GTEST_GROUP)
+
+ # Invokes upload.py with the modified command line flags.
+ os.execv(upload_py_path, upload_py_argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-all.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-all.cc
new file mode 100644
index 0000000..fe34765
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-all.cc
@@ -0,0 +1,47 @@
+// Copyright 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.
+//
+// Author: mheule@google.com (Markus Heule)
+//
+// Google C++ Testing Framework (Google Test)
+//
+// Sometimes it's desirable to build Google Test by compiling a single file.
+// This file serves this purpose.
+
+// This line ensures that gtest.h can be compiled on its own, even
+// when it's fused.
+#include <gtest/gtest.h>
+
+// The following lines pull in the real gtest *.cc files.
+#include "src/gtest.cc"
+#include "src/gtest-death-test.cc"
+#include "src/gtest-filepath.cc"
+#include "src/gtest-port.cc"
+#include "src/gtest-test-part.cc"
+#include "src/gtest-typed-test.cc"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-death-test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-death-test.cc
new file mode 100644
index 0000000..3b73b01
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-death-test.cc
@@ -0,0 +1,1172 @@
+// Copyright 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: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
+//
+// This file implements death tests.
+
+#include <gtest/gtest-death-test.h>
+#include <gtest/internal/gtest-port.h>
+
+#if GTEST_HAS_DEATH_TEST
+
+#if GTEST_OS_MAC
+#include <crt_externs.h>
+#endif // GTEST_OS_MAC
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdarg.h>
+
+#if GTEST_OS_WINDOWS
+#include <windows.h>
+#else
+#include <sys/mman.h>
+#include <sys/wait.h>
+#endif // GTEST_OS_WINDOWS
+
+#endif // GTEST_HAS_DEATH_TEST
+
+#include <gtest/gtest-message.h>
+#include <gtest/internal/gtest-string.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+namespace testing {
+
+// Constants.
+
+// The default death test style.
+static const char kDefaultDeathTestStyle[] = "fast";
+
+GTEST_DEFINE_string_(
+ death_test_style,
+ internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
+ "Indicates how to run a death test in a forked child process: "
+ "\"threadsafe\" (child process re-executes the test binary "
+ "from the beginning, running only the specific death test) or "
+ "\"fast\" (child process runs the death test immediately "
+ "after forking).");
+
+GTEST_DEFINE_bool_(
+ death_test_use_fork,
+ internal::BoolFromGTestEnv("death_test_use_fork", false),
+ "Instructs to use fork()/_exit() instead of clone() in death tests. "
+ "Ignored and always uses fork() on POSIX systems where clone() is not "
+ "implemented. Useful when running under valgrind or similar tools if "
+ "those do not support clone(). Valgrind 3.3.1 will just fail if "
+ "it sees an unsupported combination of clone() flags. "
+ "It is not recommended to use this flag w/o valgrind though it will "
+ "work in 99% of the cases. Once valgrind is fixed, this flag will "
+ "most likely be removed.");
+
+namespace internal {
+GTEST_DEFINE_string_(
+ internal_run_death_test, "",
+ "Indicates the file, line number, temporal index of "
+ "the single death test to run, and a file descriptor to "
+ "which a success code may be sent, all separated by "
+ "colons. This flag is specified if and only if the current "
+ "process is a sub-process launched for running a thread-safe "
+ "death test. FOR INTERNAL USE ONLY.");
+} // namespace internal
+
+#if GTEST_HAS_DEATH_TEST
+
+// ExitedWithCode constructor.
+ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
+}
+
+// ExitedWithCode function-call operator.
+bool ExitedWithCode::operator()(int exit_status) const {
+#if GTEST_OS_WINDOWS
+ return exit_status == exit_code_;
+#else
+ return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
+#endif // GTEST_OS_WINDOWS
+}
+
+#if !GTEST_OS_WINDOWS
+// KilledBySignal constructor.
+KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
+}
+
+// KilledBySignal function-call operator.
+bool KilledBySignal::operator()(int exit_status) const {
+ return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
+}
+#endif // !GTEST_OS_WINDOWS
+
+namespace internal {
+
+// Utilities needed for death tests.
+
+// Generates a textual description of a given exit code, in the format
+// specified by wait(2).
+static String ExitSummary(int exit_code) {
+ Message m;
+#if GTEST_OS_WINDOWS
+ m << "Exited with exit status " << exit_code;
+#else
+ if (WIFEXITED(exit_code)) {
+ m << "Exited with exit status " << WEXITSTATUS(exit_code);
+ } else if (WIFSIGNALED(exit_code)) {
+ m << "Terminated by signal " << WTERMSIG(exit_code);
+ }
+#ifdef WCOREDUMP
+ if (WCOREDUMP(exit_code)) {
+ m << " (core dumped)";
+ }
+#endif
+#endif // GTEST_OS_WINDOWS
+ return m.GetString();
+}
+
+// Returns true if exit_status describes a process that was terminated
+// by a signal, or exited normally with a nonzero exit code.
+bool ExitedUnsuccessfully(int exit_status) {
+ return !ExitedWithCode(0)(exit_status);
+}
+
+#if !GTEST_OS_WINDOWS
+// Generates a textual failure message when a death test finds more than
+// one thread running, or cannot determine the number of threads, prior
+// to executing the given statement. It is the responsibility of the
+// caller not to pass a thread_count of 1.
+static String DeathTestThreadWarning(size_t thread_count) {
+ Message msg;
+ msg << "Death tests use fork(), which is unsafe particularly"
+ << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
+ if (thread_count == 0)
+ msg << "couldn't detect the number of threads.";
+ else
+ msg << "detected " << thread_count << " threads.";
+ return msg.GetString();
+}
+#endif // !GTEST_OS_WINDOWS
+
+// Flag characters for reporting a death test that did not die.
+static const char kDeathTestLived = 'L';
+static const char kDeathTestReturned = 'R';
+static const char kDeathTestInternalError = 'I';
+
+// An enumeration describing all of the possible ways that a death test
+// can conclude. DIED means that the process died while executing the
+// test code; LIVED means that process lived beyond the end of the test
+// code; and RETURNED means that the test statement attempted a "return,"
+// which is not allowed. IN_PROGRESS means the test has not yet
+// concluded.
+enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED };
+
+// Routine for aborting the program which is safe to call from an
+// exec-style death test child process, in which case the error
+// message is propagated back to the parent process. Otherwise, the
+// message is simply printed to stderr. In either case, the program
+// then exits with status 1.
+void DeathTestAbort(const String& message) {
+ // On a POSIX system, this function may be called from a threadsafe-style
+ // death test child process, which operates on a very small stack. Use
+ // the heap for any additional non-minuscule memory requirements.
+ const InternalRunDeathTestFlag* const flag =
+ GetUnitTestImpl()->internal_run_death_test_flag();
+ if (flag != NULL) {
+ FILE* parent = posix::FDOpen(flag->write_fd(), "w");
+ fputc(kDeathTestInternalError, parent);
+ fprintf(parent, "%s", message.c_str());
+ fflush(parent);
+ _exit(1);
+ } else {
+ fprintf(stderr, "%s", message.c_str());
+ fflush(stderr);
+ abort();
+ }
+}
+
+// A replacement for CHECK that calls DeathTestAbort if the assertion
+// fails.
+#define GTEST_DEATH_TEST_CHECK_(expression) \
+ do { \
+ if (!::testing::internal::IsTrue(expression)) { \
+ DeathTestAbort(::testing::internal::String::Format( \
+ "CHECK failed: File %s, line %d: %s", \
+ __FILE__, __LINE__, #expression)); \
+ } \
+ } while (::testing::internal::AlwaysFalse())
+
+// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for
+// evaluating any system call that fulfills two conditions: it must return
+// -1 on failure, and set errno to EINTR when it is interrupted and
+// should be tried again. The macro expands to a loop that repeatedly
+// evaluates the expression as long as it evaluates to -1 and sets
+// errno to EINTR. If the expression evaluates to -1 but errno is
+// something other than EINTR, DeathTestAbort is called.
+#define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
+ do { \
+ int gtest_retval; \
+ do { \
+ gtest_retval = (expression); \
+ } while (gtest_retval == -1 && errno == EINTR); \
+ if (gtest_retval == -1) { \
+ DeathTestAbort(::testing::internal::String::Format( \
+ "CHECK failed: File %s, line %d: %s != -1", \
+ __FILE__, __LINE__, #expression)); \
+ } \
+ } while (::testing::internal::AlwaysFalse())
+
+// Returns the message describing the last system error in errno.
+String GetLastErrnoDescription() {
+ return String(errno == 0 ? "" : posix::StrError(errno));
+}
+
+// This is called from a death test parent process to read a failure
+// message from the death test child process and log it with the FATAL
+// severity. On Windows, the message is read from a pipe handle. On other
+// platforms, it is read from a file descriptor.
+static void FailFromInternalError(int fd) {
+ Message error;
+ char buffer[256];
+ int num_read;
+
+ do {
+ while ((num_read = posix::Read(fd, buffer, 255)) > 0) {
+ buffer[num_read] = '\0';
+ error << buffer;
+ }
+ } while (num_read == -1 && errno == EINTR);
+
+ if (num_read == 0) {
+ GTEST_LOG_(FATAL) << error.GetString();
+ } else {
+ const int last_error = errno;
+ GTEST_LOG_(FATAL) << "Error while reading death test internal: "
+ << GetLastErrnoDescription() << " [" << last_error << "]";
+ }
+}
+
+// Death test constructor. Increments the running death test count
+// for the current test.
+DeathTest::DeathTest() {
+ TestInfo* const info = GetUnitTestImpl()->current_test_info();
+ if (info == NULL) {
+ DeathTestAbort("Cannot run a death test outside of a TEST or "
+ "TEST_F construct");
+ }
+}
+
+// Creates and returns a death test by dispatching to the current
+// death test factory.
+bool DeathTest::Create(const char* statement, const RE* regex,
+ const char* file, int line, DeathTest** test) {
+ return GetUnitTestImpl()->death_test_factory()->Create(
+ statement, regex, file, line, test);
+}
+
+const char* DeathTest::LastMessage() {
+ return last_death_test_message_.c_str();
+}
+
+void DeathTest::set_last_death_test_message(const String& message) {
+ last_death_test_message_ = message;
+}
+
+String DeathTest::last_death_test_message_;
+
+// Provides cross platform implementation for some death functionality.
+class DeathTestImpl : public DeathTest {
+ protected:
+ DeathTestImpl(const char* a_statement, const RE* a_regex)
+ : statement_(a_statement),
+ regex_(a_regex),
+ spawned_(false),
+ status_(-1),
+ outcome_(IN_PROGRESS),
+ read_fd_(-1),
+ write_fd_(-1) {}
+
+ // read_fd_ is expected to be closed and cleared by a derived class.
+ ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
+
+ void Abort(AbortReason reason);
+ virtual bool Passed(bool status_ok);
+
+ const char* statement() const { return statement_; }
+ const RE* regex() const { return regex_; }
+ bool spawned() const { return spawned_; }
+ void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
+ int status() const { return status_; }
+ void set_status(int a_status) { status_ = a_status; }
+ DeathTestOutcome outcome() const { return outcome_; }
+ void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; }
+ int read_fd() const { return read_fd_; }
+ void set_read_fd(int fd) { read_fd_ = fd; }
+ int write_fd() const { return write_fd_; }
+ void set_write_fd(int fd) { write_fd_ = fd; }
+
+ // Called in the parent process only. Reads the result code of the death
+ // test child process via a pipe, interprets it to set the outcome_
+ // member, and closes read_fd_. Outputs diagnostics and terminates in
+ // case of unexpected codes.
+ void ReadAndInterpretStatusByte();
+
+ private:
+ // The textual content of the code this object is testing. This class
+ // doesn't own this string and should not attempt to delete it.
+ const char* const statement_;
+ // The regular expression which test output must match. DeathTestImpl
+ // doesn't own this object and should not attempt to delete it.
+ const RE* const regex_;
+ // True if the death test child process has been successfully spawned.
+ bool spawned_;
+ // The exit status of the child process.
+ int status_;
+ // How the death test concluded.
+ DeathTestOutcome outcome_;
+ // Descriptor to the read end of the pipe to the child process. It is
+ // always -1 in the child process. The child keeps its write end of the
+ // pipe in write_fd_.
+ int read_fd_;
+ // Descriptor to the child's write end of the pipe to the parent process.
+ // It is always -1 in the parent process. The parent keeps its end of the
+ // pipe in read_fd_.
+ int write_fd_;
+};
+
+// Called in the parent process only. Reads the result code of the death
+// test child process via a pipe, interprets it to set the outcome_
+// member, and closes read_fd_. Outputs diagnostics and terminates in
+// case of unexpected codes.
+void DeathTestImpl::ReadAndInterpretStatusByte() {
+ char flag;
+ int bytes_read;
+
+ // The read() here blocks until data is available (signifying the
+ // failure of the death test) or until the pipe is closed (signifying
+ // its success), so it's okay to call this in the parent before
+ // the child process has exited.
+ do {
+ bytes_read = posix::Read(read_fd(), &flag, 1);
+ } while (bytes_read == -1 && errno == EINTR);
+
+ if (bytes_read == 0) {
+ set_outcome(DIED);
+ } else if (bytes_read == 1) {
+ switch (flag) {
+ case kDeathTestReturned:
+ set_outcome(RETURNED);
+ break;
+ case kDeathTestLived:
+ set_outcome(LIVED);
+ break;
+ case kDeathTestInternalError:
+ FailFromInternalError(read_fd()); // Does not return.
+ break;
+ default:
+ GTEST_LOG_(FATAL) << "Death test child process reported "
+ << "unexpected status byte ("
+ << static_cast<unsigned int>(flag) << ")";
+ }
+ } else {
+ GTEST_LOG_(FATAL) << "Read from death test child process failed: "
+ << GetLastErrnoDescription();
+ }
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));
+ set_read_fd(-1);
+}
+
+// Signals that the death test code which should have exited, didn't.
+// Should be called only in a death test child process.
+// Writes a status byte to the child's status file descriptor, then
+// calls _exit(1).
+void DeathTestImpl::Abort(AbortReason reason) {
+ // The parent process considers the death test to be a failure if
+ // it finds any data in our pipe. So, here we write a single flag byte
+ // to the pipe, then exit.
+ const char status_ch =
+ reason == TEST_DID_NOT_DIE ? kDeathTestLived : kDeathTestReturned;
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(write_fd()));
+ _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
+}
+
+// Assesses the success or failure of a death test, using both private
+// members which have previously been set, and one argument:
+//
+// Private data members:
+// outcome: An enumeration describing how the death test
+// concluded: DIED, LIVED, or RETURNED. The death test fails
+// in the latter two cases.
+// status: The exit status of the child process. On *nix, it is in the
+// in the format specified by wait(2). On Windows, this is the
+// value supplied to the ExitProcess() API or a numeric code
+// of the exception that terminated the program.
+// regex: A regular expression object to be applied to
+// the test's captured standard error output; the death test
+// fails if it does not match.
+//
+// Argument:
+// status_ok: true if exit_status is acceptable in the context of
+// this particular death test, which fails if it is false
+//
+// Returns true iff all of the above conditions are met. Otherwise, the
+// first failing condition, in the order given above, is the one that is
+// reported. Also sets the last death test message string.
+bool DeathTestImpl::Passed(bool status_ok) {
+ if (!spawned())
+ return false;
+
+ const String error_message = GetCapturedStderr();
+
+ bool success = false;
+ Message buffer;
+
+ buffer << "Death test: " << statement() << "\n";
+ switch (outcome()) {
+ case LIVED:
+ buffer << " Result: failed to die.\n"
+ << " Error msg: " << error_message;
+ break;
+ case RETURNED:
+ buffer << " Result: illegal return in test statement.\n"
+ << " Error msg: " << error_message;
+ break;
+ case DIED:
+ if (status_ok) {
+ const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
+ if (matched) {
+ success = true;
+ } else {
+ buffer << " Result: died but not with expected error.\n"
+ << " Expected: " << regex()->pattern() << "\n"
+ << "Actual msg: " << error_message;
+ }
+ } else {
+ buffer << " Result: died but not with expected exit code:\n"
+ << " " << ExitSummary(status()) << "\n";
+ }
+ break;
+ case IN_PROGRESS:
+ default:
+ GTEST_LOG_(FATAL)
+ << "DeathTest::Passed somehow called before conclusion of test";
+ }
+
+ DeathTest::set_last_death_test_message(buffer.GetString());
+ return success;
+}
+
+#if GTEST_OS_WINDOWS
+// WindowsDeathTest implements death tests on Windows. Due to the
+// specifics of starting new processes on Windows, death tests there are
+// always threadsafe, and Google Test considers the
+// --gtest_death_test_style=fast setting to be equivalent to
+// --gtest_death_test_style=threadsafe there.
+//
+// A few implementation notes: Like the Linux version, the Windows
+// implementation uses pipes for child-to-parent communication. But due to
+// the specifics of pipes on Windows, some extra steps are required:
+//
+// 1. The parent creates a communication pipe and stores handles to both
+// ends of it.
+// 2. The parent starts the child and provides it with the information
+// necessary to acquire the handle to the write end of the pipe.
+// 3. The child acquires the write end of the pipe and signals the parent
+// using a Windows event.
+// 4. Now the parent can release the write end of the pipe on its side. If
+// this is done before step 3, the object's reference count goes down to
+// 0 and it is destroyed, preventing the child from acquiring it. The
+// parent now has to release it, or read operations on the read end of
+// the pipe will not return when the child terminates.
+// 5. The parent reads child's output through the pipe (outcome code and
+// any possible error messages) from the pipe, and its stderr and then
+// determines whether to fail the test.
+//
+// Note: to distinguish Win32 API calls from the local method and function
+// calls, the former are explicitly resolved in the global namespace.
+//
+class WindowsDeathTest : public DeathTestImpl {
+ public:
+ WindowsDeathTest(const char* statement,
+ const RE* regex,
+ const char* file,
+ int line)
+ : DeathTestImpl(statement, regex), file_(file), line_(line) {}
+
+ // All of these virtual functions are inherited from DeathTest.
+ virtual int Wait();
+ virtual TestRole AssumeRole();
+
+ private:
+ // The name of the file in which the death test is located.
+ const char* const file_;
+ // The line number on which the death test is located.
+ const int line_;
+ // Handle to the write end of the pipe to the child process.
+ AutoHandle write_handle_;
+ // Child process handle.
+ AutoHandle child_handle_;
+ // Event the child process uses to signal the parent that it has
+ // acquired the handle to the write end of the pipe. After seeing this
+ // event the parent can release its own handles to make sure its
+ // ReadFile() calls return when the child terminates.
+ AutoHandle event_handle_;
+};
+
+// Waits for the child in a death test to exit, returning its exit
+// status, or 0 if no child process exists. As a side effect, sets the
+// outcome data member.
+int WindowsDeathTest::Wait() {
+ if (!spawned())
+ return 0;
+
+ // Wait until the child either signals that it has acquired the write end
+ // of the pipe or it dies.
+ const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
+ switch (::WaitForMultipleObjects(2,
+ wait_handles,
+ FALSE, // Waits for any of the handles.
+ INFINITE)) {
+ case WAIT_OBJECT_0:
+ case WAIT_OBJECT_0 + 1:
+ break;
+ default:
+ GTEST_DEATH_TEST_CHECK_(false); // Should not get here.
+ }
+
+ // The child has acquired the write end of the pipe or exited.
+ // We release the handle on our side and continue.
+ write_handle_.Reset();
+ event_handle_.Reset();
+
+ ReadAndInterpretStatusByte();
+
+ // Waits for the child process to exit if it haven't already. This
+ // returns immediately if the child has already exited, regardless of
+ // whether previous calls to WaitForMultipleObjects synchronized on this
+ // handle or not.
+ GTEST_DEATH_TEST_CHECK_(
+ WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
+ INFINITE));
+ DWORD status;
+ GTEST_DEATH_TEST_CHECK_(::GetExitCodeProcess(child_handle_.Get(), &status)
+ != FALSE);
+ child_handle_.Reset();
+ set_status(static_cast<int>(status));
+ return this->status();
+}
+
+// The AssumeRole process for a Windows death test. It creates a child
+// process with the same executable as the current process to run the
+// death test. The child process is given the --gtest_filter and
+// --gtest_internal_run_death_test flags such that it knows to run the
+// current death test only.
+DeathTest::TestRole WindowsDeathTest::AssumeRole() {
+ const UnitTestImpl* const impl = GetUnitTestImpl();
+ const InternalRunDeathTestFlag* const flag =
+ impl->internal_run_death_test_flag();
+ const TestInfo* const info = impl->current_test_info();
+ const int death_test_index = info->result()->death_test_count();
+
+ if (flag != NULL) {
+ // ParseInternalRunDeathTestFlag() has performed all the necessary
+ // processing.
+ set_write_fd(flag->write_fd());
+ return EXECUTE_TEST;
+ }
+
+ // WindowsDeathTest uses an anonymous pipe to communicate results of
+ // a death test.
+ SECURITY_ATTRIBUTES handles_are_inheritable = {
+ sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
+ HANDLE read_handle, write_handle;
+ GTEST_DEATH_TEST_CHECK_(
+ ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,
+ 0) // Default buffer size.
+ != FALSE);
+ set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),
+ O_RDONLY));
+ write_handle_.Reset(write_handle);
+ event_handle_.Reset(::CreateEvent(
+ &handles_are_inheritable,
+ TRUE, // The event will automatically reset to non-signaled state.
+ FALSE, // The initial state is non-signalled.
+ NULL)); // The even is unnamed.
+ GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);
+ const String filter_flag = String::Format("--%s%s=%s.%s",
+ GTEST_FLAG_PREFIX_, kFilterFlag,
+ info->test_case_name(),
+ info->name());
+ const String internal_flag = String::Format(
+ "--%s%s=%s|%d|%d|%u|%Iu|%Iu",
+ GTEST_FLAG_PREFIX_,
+ kInternalRunDeathTestFlag,
+ file_, line_,
+ death_test_index,
+ static_cast<unsigned int>(::GetCurrentProcessId()),
+ // size_t has the same with as pointers on both 32-bit and 64-bit
+ // Windows platforms.
+ // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
+ reinterpret_cast<size_t>(write_handle),
+ reinterpret_cast<size_t>(event_handle_.Get()));
+
+ char executable_path[_MAX_PATH + 1]; // NOLINT
+ GTEST_DEATH_TEST_CHECK_(
+ _MAX_PATH + 1 != ::GetModuleFileNameA(NULL,
+ executable_path,
+ _MAX_PATH));
+
+ String command_line = String::Format("%s %s \"%s\"",
+ ::GetCommandLineA(),
+ filter_flag.c_str(),
+ internal_flag.c_str());
+
+ DeathTest::set_last_death_test_message("");
+
+ CaptureStderr();
+ // Flush the log buffers since the log streams are shared with the child.
+ FlushInfoLog();
+
+ // The child process will share the standard handles with the parent.
+ STARTUPINFOA startup_info;
+ memset(&startup_info, 0, sizeof(STARTUPINFO));
+ startup_info.dwFlags = STARTF_USESTDHANDLES;
+ startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);
+ startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
+ startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
+
+ PROCESS_INFORMATION process_info;
+ GTEST_DEATH_TEST_CHECK_(::CreateProcessA(
+ executable_path,
+ const_cast<char*>(command_line.c_str()),
+ NULL, // Retuned process handle is not inheritable.
+ NULL, // Retuned thread handle is not inheritable.
+ TRUE, // Child inherits all inheritable handles (for write_handle_).
+ 0x0, // Default creation flags.
+ NULL, // Inherit the parent's environment.
+ UnitTest::GetInstance()->original_working_dir(),
+ &startup_info,
+ &process_info) != FALSE);
+ child_handle_.Reset(process_info.hProcess);
+ ::CloseHandle(process_info.hThread);
+ set_spawned(true);
+ return OVERSEE_TEST;
+}
+#else // We are not on Windows.
+
+// ForkingDeathTest provides implementations for most of the abstract
+// methods of the DeathTest interface. Only the AssumeRole method is
+// left undefined.
+class ForkingDeathTest : public DeathTestImpl {
+ public:
+ ForkingDeathTest(const char* statement, const RE* regex);
+
+ // All of these virtual functions are inherited from DeathTest.
+ virtual int Wait();
+
+ protected:
+ void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
+
+ private:
+ // PID of child process during death test; 0 in the child process itself.
+ pid_t child_pid_;
+};
+
+// Constructs a ForkingDeathTest.
+ForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex)
+ : DeathTestImpl(a_statement, a_regex),
+ child_pid_(-1) {}
+
+// Waits for the child in a death test to exit, returning its exit
+// status, or 0 if no child process exists. As a side effect, sets the
+// outcome data member.
+int ForkingDeathTest::Wait() {
+ if (!spawned())
+ return 0;
+
+ ReadAndInterpretStatusByte();
+
+ int status_value;
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0));
+ set_status(status_value);
+ return status_value;
+}
+
+// A concrete death test class that forks, then immediately runs the test
+// in the child process.
+class NoExecDeathTest : public ForkingDeathTest {
+ public:
+ NoExecDeathTest(const char* a_statement, const RE* a_regex) :
+ ForkingDeathTest(a_statement, a_regex) { }
+ virtual TestRole AssumeRole();
+};
+
+// The AssumeRole process for a fork-and-run death test. It implements a
+// straightforward fork, with a simple pipe to transmit the status byte.
+DeathTest::TestRole NoExecDeathTest::AssumeRole() {
+ const size_t thread_count = GetThreadCount();
+ if (thread_count != 1) {
+ GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);
+ }
+
+ int pipe_fd[2];
+ GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
+
+ DeathTest::set_last_death_test_message("");
+ CaptureStderr();
+ // When we fork the process below, the log file buffers are copied, but the
+ // file descriptors are shared. We flush all log files here so that closing
+ // the file descriptors in the child process doesn't throw off the
+ // synchronization between descriptors and buffers in the parent process.
+ // This is as close to the fork as possible to avoid a race condition in case
+ // there are multiple threads running before the death test, and another
+ // thread writes to the log file.
+ FlushInfoLog();
+
+ const pid_t child_pid = fork();
+ GTEST_DEATH_TEST_CHECK_(child_pid != -1);
+ set_child_pid(child_pid);
+ if (child_pid == 0) {
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
+ set_write_fd(pipe_fd[1]);
+ // Redirects all logging to stderr in the child process to prevent
+ // concurrent writes to the log files. We capture stderr in the parent
+ // process and append the child process' output to a log.
+ LogToStderr();
+ // Event forwarding to the listeners of event listener API mush be shut
+ // down in death test subprocesses.
+ GetUnitTestImpl()->listeners()->SuppressEventForwarding();
+ return EXECUTE_TEST;
+ } else {
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
+ set_read_fd(pipe_fd[0]);
+ set_spawned(true);
+ return OVERSEE_TEST;
+ }
+}
+
+// A concrete death test class that forks and re-executes the main
+// program from the beginning, with command-line flags set that cause
+// only this specific death test to be run.
+class ExecDeathTest : public ForkingDeathTest {
+ public:
+ ExecDeathTest(const char* a_statement, const RE* a_regex,
+ const char* file, int line) :
+ ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
+ virtual TestRole AssumeRole();
+ private:
+ // The name of the file in which the death test is located.
+ const char* const file_;
+ // The line number on which the death test is located.
+ const int line_;
+};
+
+// Utility class for accumulating command-line arguments.
+class Arguments {
+ public:
+ Arguments() {
+ args_.push_back(NULL);
+ }
+
+ ~Arguments() {
+ for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();
+ ++i) {
+ free(*i);
+ }
+ }
+ void AddArgument(const char* argument) {
+ args_.insert(args_.end() - 1, posix::StrDup(argument));
+ }
+
+ template <typename Str>
+ void AddArguments(const ::std::vector<Str>& arguments) {
+ for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
+ i != arguments.end();
+ ++i) {
+ args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
+ }
+ }
+ char* const* Argv() {
+ return &args_[0];
+ }
+ private:
+ std::vector<char*> args_;
+};
+
+// A struct that encompasses the arguments to the child process of a
+// threadsafe-style death test process.
+struct ExecDeathTestArgs {
+ char* const* argv; // Command-line arguments for the child's call to exec
+ int close_fd; // File descriptor to close; the read end of a pipe
+};
+
+#if GTEST_OS_MAC
+inline char** GetEnviron() {
+ // When Google Test is built as a framework on MacOS X, the environ variable
+ // is unavailable. Apple's documentation (man environ) recommends using
+ // _NSGetEnviron() instead.
+ return *_NSGetEnviron();
+}
+#else
+// Some POSIX platforms expect you to declare environ. extern "C" makes
+// it reside in the global namespace.
+extern "C" char** environ;
+inline char** GetEnviron() { return environ; }
+#endif // GTEST_OS_MAC
+
+// The main function for a threadsafe-style death test child process.
+// This function is called in a clone()-ed process and thus must avoid
+// any potentially unsafe operations like malloc or libc functions.
+static int ExecDeathTestChildMain(void* child_arg) {
+ ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));
+
+ // We need to execute the test program in the same environment where
+ // it was originally invoked. Therefore we change to the original
+ // working directory first.
+ const char* const original_dir =
+ UnitTest::GetInstance()->original_working_dir();
+ // We can safely call chdir() as it's a direct system call.
+ if (chdir(original_dir) != 0) {
+ DeathTestAbort(String::Format("chdir(\"%s\") failed: %s",
+ original_dir,
+ GetLastErrnoDescription().c_str()));
+ return EXIT_FAILURE;
+ }
+
+ // We can safely call execve() as it's a direct system call. We
+ // cannot use execvp() as it's a libc function and thus potentially
+ // unsafe. Since execve() doesn't search the PATH, the user must
+ // invoke the test program via a valid path that contains at least
+ // one path separator.
+ execve(args->argv[0], args->argv, GetEnviron());
+ DeathTestAbort(String::Format("execve(%s, ...) in %s failed: %s",
+ args->argv[0],
+ original_dir,
+ GetLastErrnoDescription().c_str()));
+ return EXIT_FAILURE;
+}
+
+// Two utility routines that together determine the direction the stack
+// grows.
+// This could be accomplished more elegantly by a single recursive
+// function, but we want to guard against the unlikely possibility of
+// a smart compiler optimizing the recursion away.
+bool StackLowerThanAddress(const void* ptr) {
+ int dummy;
+ return &dummy < ptr;
+}
+
+bool StackGrowsDown() {
+ int dummy;
+ return StackLowerThanAddress(&dummy);
+}
+
+// A threadsafe implementation of fork(2) for threadsafe-style death tests
+// that uses clone(2). It dies with an error message if anything goes
+// wrong.
+static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
+ ExecDeathTestArgs args = { argv, close_fd };
+ pid_t child_pid = -1;
+
+#if GTEST_HAS_CLONE
+ const bool use_fork = GTEST_FLAG(death_test_use_fork);
+
+ if (!use_fork) {
+ static const bool stack_grows_down = StackGrowsDown();
+ const size_t stack_size = getpagesize();
+ // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
+ void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
+ GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
+ void* const stack_top =
+ static_cast<char*>(stack) + (stack_grows_down ? stack_size : 0);
+
+ child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);
+
+ GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
+ }
+#else
+ const bool use_fork = true;
+#endif // GTEST_HAS_CLONE
+
+ if (use_fork && (child_pid = fork()) == 0) {
+ ExecDeathTestChildMain(&args);
+ _exit(0);
+ }
+
+ GTEST_DEATH_TEST_CHECK_(child_pid != -1);
+ return child_pid;
+}
+
+// The AssumeRole process for a fork-and-exec death test. It re-executes the
+// main program from the beginning, setting the --gtest_filter
+// and --gtest_internal_run_death_test flags to cause only the current
+// death test to be re-run.
+DeathTest::TestRole ExecDeathTest::AssumeRole() {
+ const UnitTestImpl* const impl = GetUnitTestImpl();
+ const InternalRunDeathTestFlag* const flag =
+ impl->internal_run_death_test_flag();
+ const TestInfo* const info = impl->current_test_info();
+ const int death_test_index = info->result()->death_test_count();
+
+ if (flag != NULL) {
+ set_write_fd(flag->write_fd());
+ return EXECUTE_TEST;
+ }
+
+ int pipe_fd[2];
+ GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
+ // Clear the close-on-exec flag on the write end of the pipe, lest
+ // it be closed when the child process does an exec:
+ GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
+
+ const String filter_flag =
+ String::Format("--%s%s=%s.%s",
+ GTEST_FLAG_PREFIX_, kFilterFlag,
+ info->test_case_name(), info->name());
+ const String internal_flag =
+ String::Format("--%s%s=%s|%d|%d|%d",
+ GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag,
+ file_, line_, death_test_index, pipe_fd[1]);
+ Arguments args;
+ args.AddArguments(GetArgvs());
+ args.AddArgument(filter_flag.c_str());
+ args.AddArgument(internal_flag.c_str());
+
+ DeathTest::set_last_death_test_message("");
+
+ CaptureStderr();
+ // See the comment in NoExecDeathTest::AssumeRole for why the next line
+ // is necessary.
+ FlushInfoLog();
+
+ const pid_t child_pid = ExecDeathTestFork(args.Argv(), pipe_fd[0]);
+ GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
+ set_child_pid(child_pid);
+ set_read_fd(pipe_fd[0]);
+ set_spawned(true);
+ return OVERSEE_TEST;
+}
+
+#endif // !GTEST_OS_WINDOWS
+
+// Creates a concrete DeathTest-derived class that depends on the
+// --gtest_death_test_style flag, and sets the pointer pointed to
+// by the "test" argument to its address. If the test should be
+// skipped, sets that pointer to NULL. Returns true, unless the
+// flag is set to an invalid value.
+bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
+ const char* file, int line,
+ DeathTest** test) {
+ UnitTestImpl* const impl = GetUnitTestImpl();
+ const InternalRunDeathTestFlag* const flag =
+ impl->internal_run_death_test_flag();
+ const int death_test_index = impl->current_test_info()
+ ->increment_death_test_count();
+
+ if (flag != NULL) {
+ if (death_test_index > flag->index()) {
+ DeathTest::set_last_death_test_message(String::Format(
+ "Death test count (%d) somehow exceeded expected maximum (%d)",
+ death_test_index, flag->index()));
+ return false;
+ }
+
+ if (!(flag->file() == file && flag->line() == line &&
+ flag->index() == death_test_index)) {
+ *test = NULL;
+ return true;
+ }
+ }
+
+#if GTEST_OS_WINDOWS
+ if (GTEST_FLAG(death_test_style) == "threadsafe" ||
+ GTEST_FLAG(death_test_style) == "fast") {
+ *test = new WindowsDeathTest(statement, regex, file, line);
+ }
+#else
+ if (GTEST_FLAG(death_test_style) == "threadsafe") {
+ *test = new ExecDeathTest(statement, regex, file, line);
+ } else if (GTEST_FLAG(death_test_style) == "fast") {
+ *test = new NoExecDeathTest(statement, regex);
+ }
+#endif // GTEST_OS_WINDOWS
+ else { // NOLINT - this is more readable than unbalanced brackets inside #if.
+ DeathTest::set_last_death_test_message(String::Format(
+ "Unknown death test style \"%s\" encountered",
+ GTEST_FLAG(death_test_style).c_str()));
+ return false;
+ }
+
+ return true;
+}
+
+// Splits a given string on a given delimiter, populating a given
+// vector with the fields. GTEST_HAS_DEATH_TEST implies that we have
+// ::std::string, so we can use it here.
+static void SplitString(const ::std::string& str, char delimiter,
+ ::std::vector< ::std::string>* dest) {
+ ::std::vector< ::std::string> parsed;
+ ::std::string::size_type pos = 0;
+ while (::testing::internal::AlwaysTrue()) {
+ const ::std::string::size_type colon = str.find(delimiter, pos);
+ if (colon == ::std::string::npos) {
+ parsed.push_back(str.substr(pos));
+ break;
+ } else {
+ parsed.push_back(str.substr(pos, colon - pos));
+ pos = colon + 1;
+ }
+ }
+ dest->swap(parsed);
+}
+
+#if GTEST_OS_WINDOWS
+// Recreates the pipe and event handles from the provided parameters,
+// signals the event, and returns a file descriptor wrapped around the pipe
+// handle. This function is called in the child process only.
+int GetStatusFileDescriptor(unsigned int parent_process_id,
+ size_t write_handle_as_size_t,
+ size_t event_handle_as_size_t) {
+ AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
+ FALSE, // Non-inheritable.
+ parent_process_id));
+ if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
+ DeathTestAbort(String::Format("Unable to open parent process %u",
+ parent_process_id));
+ }
+
+ // TODO(vladl@google.com): Replace the following check with a
+ // compile-time assertion when available.
+ GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));
+
+ const HANDLE write_handle =
+ reinterpret_cast<HANDLE>(write_handle_as_size_t);
+ HANDLE dup_write_handle;
+
+ // The newly initialized handle is accessible only in in the parent
+ // process. To obtain one accessible within the child, we need to use
+ // DuplicateHandle.
+ if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,
+ ::GetCurrentProcess(), &dup_write_handle,
+ 0x0, // Requested privileges ignored since
+ // DUPLICATE_SAME_ACCESS is used.
+ FALSE, // Request non-inheritable handler.
+ DUPLICATE_SAME_ACCESS)) {
+ DeathTestAbort(String::Format(
+ "Unable to duplicate the pipe handle %Iu from the parent process %u",
+ write_handle_as_size_t, parent_process_id));
+ }
+
+ const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);
+ HANDLE dup_event_handle;
+
+ if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,
+ ::GetCurrentProcess(), &dup_event_handle,
+ 0x0,
+ FALSE,
+ DUPLICATE_SAME_ACCESS)) {
+ DeathTestAbort(String::Format(
+ "Unable to duplicate the event handle %Iu from the parent process %u",
+ event_handle_as_size_t, parent_process_id));
+ }
+
+ const int write_fd =
+ ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);
+ if (write_fd == -1) {
+ DeathTestAbort(String::Format(
+ "Unable to convert pipe handle %Iu to a file descriptor",
+ write_handle_as_size_t));
+ }
+
+ // Signals the parent that the write end of the pipe has been acquired
+ // so the parent can release its own write end.
+ ::SetEvent(dup_event_handle);
+
+ return write_fd;
+}
+#endif // GTEST_OS_WINDOWS
+
+// Returns a newly created InternalRunDeathTestFlag object with fields
+// initialized from the GTEST_FLAG(internal_run_death_test) flag if
+// the flag is specified; otherwise returns NULL.
+InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
+ if (GTEST_FLAG(internal_run_death_test) == "") return NULL;
+
+ // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
+ // can use it here.
+ int line = -1;
+ int index = -1;
+ ::std::vector< ::std::string> fields;
+ SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
+ int write_fd = -1;
+
+#if GTEST_OS_WINDOWS
+ unsigned int parent_process_id = 0;
+ size_t write_handle_as_size_t = 0;
+ size_t event_handle_as_size_t = 0;
+
+ if (fields.size() != 6
+ || !ParseNaturalNumber(fields[1], &line)
+ || !ParseNaturalNumber(fields[2], &index)
+ || !ParseNaturalNumber(fields[3], &parent_process_id)
+ || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)
+ || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {
+ DeathTestAbort(String::Format(
+ "Bad --gtest_internal_run_death_test flag: %s",
+ GTEST_FLAG(internal_run_death_test).c_str()));
+ }
+ write_fd = GetStatusFileDescriptor(parent_process_id,
+ write_handle_as_size_t,
+ event_handle_as_size_t);
+#else
+ if (fields.size() != 4
+ || !ParseNaturalNumber(fields[1], &line)
+ || !ParseNaturalNumber(fields[2], &index)
+ || !ParseNaturalNumber(fields[3], &write_fd)) {
+ DeathTestAbort(String::Format(
+ "Bad --gtest_internal_run_death_test flag: %s",
+ GTEST_FLAG(internal_run_death_test).c_str()));
+ }
+#endif // GTEST_OS_WINDOWS
+ return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
+}
+
+} // namespace internal
+
+#endif // GTEST_HAS_DEATH_TEST
+
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-filepath.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-filepath.cc
new file mode 100644
index 0000000..c1ef918
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-filepath.cc
@@ -0,0 +1,380 @@
+// Copyright 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.
+//
+// Authors: keith.ray@gmail.com (Keith Ray)
+
+#include <gtest/internal/gtest-filepath.h>
+#include <gtest/internal/gtest-port.h>
+
+#include <stdlib.h>
+
+#if GTEST_OS_WINDOWS_MOBILE
+#include <windows.h>
+#elif GTEST_OS_WINDOWS
+#include <direct.h>
+#include <io.h>
+#elif GTEST_OS_SYMBIAN
+// Symbian OpenC has PATH_MAX in sys/syslimits.h
+#include <sys/syslimits.h>
+#else
+#include <limits.h>
+#include <climits> // Some Linux distributions define PATH_MAX here.
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+#if GTEST_OS_WINDOWS
+#define GTEST_PATH_MAX_ _MAX_PATH
+#elif defined(PATH_MAX)
+#define GTEST_PATH_MAX_ PATH_MAX
+#elif defined(_XOPEN_PATH_MAX)
+#define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
+#else
+#define GTEST_PATH_MAX_ _POSIX_PATH_MAX
+#endif // GTEST_OS_WINDOWS
+
+#include <gtest/internal/gtest-string.h>
+
+namespace testing {
+namespace internal {
+
+#if GTEST_OS_WINDOWS
+// On Windows, '\\' is the standard path separator, but many tools and the
+// Windows API also accept '/' as an alternate path separator. Unless otherwise
+// noted, a file path can contain either kind of path separators, or a mixture
+// of them.
+const char kPathSeparator = '\\';
+const char kAlternatePathSeparator = '/';
+const char kPathSeparatorString[] = "\\";
+const char kAlternatePathSeparatorString[] = "/";
+#if GTEST_OS_WINDOWS_MOBILE
+// Windows CE doesn't have a current directory. You should not use
+// the current directory in tests on Windows CE, but this at least
+// provides a reasonable fallback.
+const char kCurrentDirectoryString[] = "\\";
+// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
+const DWORD kInvalidFileAttributes = 0xffffffff;
+#else
+const char kCurrentDirectoryString[] = ".\\";
+#endif // GTEST_OS_WINDOWS_MOBILE
+#else
+const char kPathSeparator = '/';
+const char kPathSeparatorString[] = "/";
+const char kCurrentDirectoryString[] = "./";
+#endif // GTEST_OS_WINDOWS
+
+// Returns whether the given character is a valid path separator.
+static bool IsPathSeparator(char c) {
+#if GTEST_HAS_ALT_PATH_SEP_
+ return (c == kPathSeparator) || (c == kAlternatePathSeparator);
+#else
+ return c == kPathSeparator;
+#endif
+}
+
+// Returns the current working directory, or "" if unsuccessful.
+FilePath FilePath::GetCurrentDir() {
+#if GTEST_OS_WINDOWS_MOBILE
+ // Windows CE doesn't have a current directory, so we just return
+ // something reasonable.
+ return FilePath(kCurrentDirectoryString);
+#elif GTEST_OS_WINDOWS
+ char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
+ return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
+#else
+ char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
+ return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
+#endif // GTEST_OS_WINDOWS_MOBILE
+}
+
+// Returns a copy of the FilePath with the case-insensitive extension removed.
+// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
+// FilePath("dir/file"). If a case-insensitive extension is not
+// found, returns a copy of the original FilePath.
+FilePath FilePath::RemoveExtension(const char* extension) const {
+ String dot_extension(String::Format(".%s", extension));
+ if (pathname_.EndsWithCaseInsensitive(dot_extension.c_str())) {
+ return FilePath(String(pathname_.c_str(), pathname_.length() - 4));
+ }
+ return *this;
+}
+
+// Returns a pointer to the last occurence of a valid path separator in
+// the FilePath. On Windows, for example, both '/' and '\' are valid path
+// separators. Returns NULL if no path separator was found.
+const char* FilePath::FindLastPathSeparator() const {
+ const char* const last_sep = strrchr(c_str(), kPathSeparator);
+#if GTEST_HAS_ALT_PATH_SEP_
+ const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);
+ // Comparing two pointers of which only one is NULL is undefined.
+ if (last_alt_sep != NULL &&
+ (last_sep == NULL || last_alt_sep > last_sep)) {
+ return last_alt_sep;
+ }
+#endif
+ return last_sep;
+}
+
+// Returns a copy of the FilePath with the directory part removed.
+// Example: FilePath("path/to/file").RemoveDirectoryName() returns
+// FilePath("file"). If there is no directory part ("just_a_file"), it returns
+// the FilePath unmodified. If there is no file part ("just_a_dir/") it
+// returns an empty FilePath ("").
+// On Windows platform, '\' is the path separator, otherwise it is '/'.
+FilePath FilePath::RemoveDirectoryName() const {
+ const char* const last_sep = FindLastPathSeparator();
+ return last_sep ? FilePath(String(last_sep + 1)) : *this;
+}
+
+// RemoveFileName returns the directory path with the filename removed.
+// Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
+// If the FilePath is "a_file" or "/a_file", RemoveFileName returns
+// FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
+// not have a file, like "just/a/dir/", it returns the FilePath unmodified.
+// On Windows platform, '\' is the path separator, otherwise it is '/'.
+FilePath FilePath::RemoveFileName() const {
+ const char* const last_sep = FindLastPathSeparator();
+ String dir;
+ if (last_sep) {
+ dir = String(c_str(), last_sep + 1 - c_str());
+ } else {
+ dir = kCurrentDirectoryString;
+ }
+ return FilePath(dir);
+}
+
+// Helper functions for naming files in a directory for xml output.
+
+// Given directory = "dir", base_name = "test", number = 0,
+// extension = "xml", returns "dir/test.xml". If number is greater
+// than zero (e.g., 12), returns "dir/test_12.xml".
+// On Windows platform, uses \ as the separator rather than /.
+FilePath FilePath::MakeFileName(const FilePath& directory,
+ const FilePath& base_name,
+ int number,
+ const char* extension) {
+ String file;
+ if (number == 0) {
+ file = String::Format("%s.%s", base_name.c_str(), extension);
+ } else {
+ file = String::Format("%s_%d.%s", base_name.c_str(), number, extension);
+ }
+ return ConcatPaths(directory, FilePath(file));
+}
+
+// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
+// On Windows, uses \ as the separator rather than /.
+FilePath FilePath::ConcatPaths(const FilePath& directory,
+ const FilePath& relative_path) {
+ if (directory.IsEmpty())
+ return relative_path;
+ const FilePath dir(directory.RemoveTrailingPathSeparator());
+ return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
+ relative_path.c_str()));
+}
+
+// Returns true if pathname describes something findable in the file-system,
+// either a file, directory, or whatever.
+bool FilePath::FileOrDirectoryExists() const {
+#if GTEST_OS_WINDOWS_MOBILE
+ LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
+ const DWORD attributes = GetFileAttributes(unicode);
+ delete [] unicode;
+ return attributes != kInvalidFileAttributes;
+#else
+ posix::StatStruct file_stat;
+ return posix::Stat(pathname_.c_str(), &file_stat) == 0;
+#endif // GTEST_OS_WINDOWS_MOBILE
+}
+
+// Returns true if pathname describes a directory in the file-system
+// that exists.
+bool FilePath::DirectoryExists() const {
+ bool result = false;
+#if GTEST_OS_WINDOWS
+ // Don't strip off trailing separator if path is a root directory on
+ // Windows (like "C:\\").
+ const FilePath& path(IsRootDirectory() ? *this :
+ RemoveTrailingPathSeparator());
+#else
+ const FilePath& path(*this);
+#endif
+
+#if GTEST_OS_WINDOWS_MOBILE
+ LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
+ const DWORD attributes = GetFileAttributes(unicode);
+ delete [] unicode;
+ if ((attributes != kInvalidFileAttributes) &&
+ (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ result = true;
+ }
+#else
+ posix::StatStruct file_stat;
+ result = posix::Stat(path.c_str(), &file_stat) == 0 &&
+ posix::IsDir(file_stat);
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+ return result;
+}
+
+// Returns true if pathname describes a root directory. (Windows has one
+// root directory per disk drive.)
+bool FilePath::IsRootDirectory() const {
+#if GTEST_OS_WINDOWS
+ // TODO(wan@google.com): on Windows a network share like
+ // \\server\share can be a root directory, although it cannot be the
+ // current directory. Handle this properly.
+ return pathname_.length() == 3 && IsAbsolutePath();
+#else
+ return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]);
+#endif
+}
+
+// Returns true if pathname describes an absolute path.
+bool FilePath::IsAbsolutePath() const {
+ const char* const name = pathname_.c_str();
+#if GTEST_OS_WINDOWS
+ return pathname_.length() >= 3 &&
+ ((name[0] >= 'a' && name[0] <= 'z') ||
+ (name[0] >= 'A' && name[0] <= 'Z')) &&
+ name[1] == ':' &&
+ IsPathSeparator(name[2]);
+#else
+ return IsPathSeparator(name[0]);
+#endif
+}
+
+// Returns a pathname for a file that does not currently exist. The pathname
+// will be directory/base_name.extension or
+// directory/base_name_<number>.extension if directory/base_name.extension
+// already exists. The number will be incremented until a pathname is found
+// that does not already exist.
+// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
+// There could be a race condition if two or more processes are calling this
+// function at the same time -- they could both pick the same filename.
+FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
+ const FilePath& base_name,
+ const char* extension) {
+ FilePath full_pathname;
+ int number = 0;
+ do {
+ full_pathname.Set(MakeFileName(directory, base_name, number++, extension));
+ } while (full_pathname.FileOrDirectoryExists());
+ return full_pathname;
+}
+
+// Returns true if FilePath ends with a path separator, which indicates that
+// it is intended to represent a directory. Returns false otherwise.
+// This does NOT check that a directory (or file) actually exists.
+bool FilePath::IsDirectory() const {
+ return !pathname_.empty() &&
+ IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]);
+}
+
+// Create directories so that path exists. Returns true if successful or if
+// the directories already exist; returns false if unable to create directories
+// for any reason.
+bool FilePath::CreateDirectoriesRecursively() const {
+ if (!this->IsDirectory()) {
+ return false;
+ }
+
+ if (pathname_.length() == 0 || this->DirectoryExists()) {
+ return true;
+ }
+
+ const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
+ return parent.CreateDirectoriesRecursively() && this->CreateFolder();
+}
+
+// Create the directory so that path exists. Returns true if successful or
+// if the directory already exists; returns false if unable to create the
+// directory for any reason, including if the parent directory does not
+// exist. Not named "CreateDirectory" because that's a macro on Windows.
+bool FilePath::CreateFolder() const {
+#if GTEST_OS_WINDOWS_MOBILE
+ FilePath removed_sep(this->RemoveTrailingPathSeparator());
+ LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
+ int result = CreateDirectory(unicode, NULL) ? 0 : -1;
+ delete [] unicode;
+#elif GTEST_OS_WINDOWS
+ int result = _mkdir(pathname_.c_str());
+#else
+ int result = mkdir(pathname_.c_str(), 0777);
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+ if (result == -1) {
+ return this->DirectoryExists(); // An error is OK if the directory exists.
+ }
+ return true; // No error.
+}
+
+// If input name has a trailing separator character, remove it and return the
+// name, otherwise return the name string unmodified.
+// On Windows platform, uses \ as the separator, other platforms use /.
+FilePath FilePath::RemoveTrailingPathSeparator() const {
+ return IsDirectory()
+ ? FilePath(String(pathname_.c_str(), pathname_.length() - 1))
+ : *this;
+}
+
+// Removes any redundant separators that might be in the pathname.
+// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
+// redundancies that might be in a pathname involving "." or "..".
+// TODO(wan@google.com): handle Windows network shares (e.g. \\server\share).
+void FilePath::Normalize() {
+ if (pathname_.c_str() == NULL) {
+ pathname_ = "";
+ return;
+ }
+ const char* src = pathname_.c_str();
+ char* const dest = new char[pathname_.length() + 1];
+ char* dest_ptr = dest;
+ memset(dest_ptr, 0, pathname_.length() + 1);
+
+ while (*src != '\0') {
+ *dest_ptr = *src;
+ if (!IsPathSeparator(*src)) {
+ src++;
+ } else {
+#if GTEST_HAS_ALT_PATH_SEP_
+ if (*dest_ptr == kAlternatePathSeparator) {
+ *dest_ptr = kPathSeparator;
+ }
+#endif
+ while (IsPathSeparator(*src))
+ src++;
+ }
+ dest_ptr++;
+ }
+ *dest_ptr = '\0';
+ pathname_ = dest;
+ delete[] dest;
+}
+
+} // namespace internal
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-internal-inl.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-internal-inl.h
new file mode 100644
index 0000000..855b215
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-internal-inl.h
@@ -0,0 +1,1074 @@
+// Copyright 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.
+
+// Utility functions and classes used by the Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// This file contains purely Google Test's internal implementation. Please
+// DO NOT #INCLUDE IT IN A USER PROGRAM.
+
+#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
+#define GTEST_SRC_GTEST_INTERNAL_INL_H_
+
+// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
+// part of Google Test's implementation; otherwise it's undefined.
+#if !GTEST_IMPLEMENTATION_
+// A user is trying to include this from his code - just say no.
+#error "gtest-internal-inl.h is part of Google Test's internal implementation."
+#error "It must not be included except by Google Test itself."
+#endif // GTEST_IMPLEMENTATION_
+
+#ifndef _WIN32_WCE
+#include <errno.h>
+#endif // !_WIN32_WCE
+#include <stddef.h>
+#include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
+#include <string.h> // For memmove.
+
+#include <algorithm>
+#include <string>
+#include <vector>
+
+#include <gtest/internal/gtest-port.h>
+
+#if GTEST_OS_WINDOWS
+#include <windows.h> // For DWORD.
+#endif // GTEST_OS_WINDOWS
+
+#include <gtest/gtest.h> // NOLINT
+#include <gtest/gtest-spi.h>
+
+namespace testing {
+
+// Declares the flags.
+//
+// We don't want the users to modify this flag in the code, but want
+// Google Test's own unit tests to be able to access it. Therefore we
+// declare it here as opposed to in gtest.h.
+GTEST_DECLARE_bool_(death_test_use_fork);
+
+namespace internal {
+
+// The value of GetTestTypeId() as seen from within the Google Test
+// library. This is solely for testing GetTestTypeId().
+GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;
+
+// Names of the flags (needed for parsing Google Test flags).
+const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
+const char kBreakOnFailureFlag[] = "break_on_failure";
+const char kCatchExceptionsFlag[] = "catch_exceptions";
+const char kColorFlag[] = "color";
+const char kFilterFlag[] = "filter";
+const char kListTestsFlag[] = "list_tests";
+const char kOutputFlag[] = "output";
+const char kPrintTimeFlag[] = "print_time";
+const char kRandomSeedFlag[] = "random_seed";
+const char kRepeatFlag[] = "repeat";
+const char kShuffleFlag[] = "shuffle";
+const char kStackTraceDepthFlag[] = "stack_trace_depth";
+const char kThrowOnFailureFlag[] = "throw_on_failure";
+
+// A valid random seed must be in [1, kMaxRandomSeed].
+const int kMaxRandomSeed = 99999;
+
+// g_help_flag is true iff the --help flag or an equivalent form is
+// specified on the command line.
+GTEST_API_ extern bool g_help_flag;
+
+// Returns the current time in milliseconds.
+GTEST_API_ TimeInMillis GetTimeInMillis();
+
+// Returns true iff Google Test should use colors in the output.
+GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
+
+// Formats the given time in milliseconds as seconds.
+GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
+
+// Parses a string for an Int32 flag, in the form of "--flag=value".
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+GTEST_API_ bool ParseInt32Flag(
+ const char* str, const char* flag, Int32* value);
+
+// Returns a random seed in range [1, kMaxRandomSeed] based on the
+// given --gtest_random_seed flag value.
+inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
+ const unsigned int raw_seed = (random_seed_flag == 0) ?
+ static_cast<unsigned int>(GetTimeInMillis()) :
+ static_cast<unsigned int>(random_seed_flag);
+
+ // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
+ // it's easy to type.
+ const int normalized_seed =
+ static_cast<int>((raw_seed - 1U) %
+ static_cast<unsigned int>(kMaxRandomSeed)) + 1;
+ return normalized_seed;
+}
+
+// Returns the first valid random seed after 'seed'. The behavior is
+// undefined if 'seed' is invalid. The seed after kMaxRandomSeed is
+// considered to be 1.
+inline int GetNextRandomSeed(int seed) {
+ GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
+ << "Invalid random seed " << seed << " - must be in [1, "
+ << kMaxRandomSeed << "].";
+ const int next_seed = seed + 1;
+ return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
+}
+
+// This class saves the values of all Google Test flags in its c'tor, and
+// restores them in its d'tor.
+class GTestFlagSaver {
+ public:
+ // The c'tor.
+ GTestFlagSaver() {
+ also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
+ break_on_failure_ = GTEST_FLAG(break_on_failure);
+ catch_exceptions_ = GTEST_FLAG(catch_exceptions);
+ color_ = GTEST_FLAG(color);
+ death_test_style_ = GTEST_FLAG(death_test_style);
+ death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
+ filter_ = GTEST_FLAG(filter);
+ internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
+ list_tests_ = GTEST_FLAG(list_tests);
+ output_ = GTEST_FLAG(output);
+ print_time_ = GTEST_FLAG(print_time);
+ random_seed_ = GTEST_FLAG(random_seed);
+ repeat_ = GTEST_FLAG(repeat);
+ shuffle_ = GTEST_FLAG(shuffle);
+ stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
+ throw_on_failure_ = GTEST_FLAG(throw_on_failure);
+ }
+
+ // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
+ ~GTestFlagSaver() {
+ GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
+ GTEST_FLAG(break_on_failure) = break_on_failure_;
+ GTEST_FLAG(catch_exceptions) = catch_exceptions_;
+ GTEST_FLAG(color) = color_;
+ GTEST_FLAG(death_test_style) = death_test_style_;
+ GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
+ GTEST_FLAG(filter) = filter_;
+ GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
+ GTEST_FLAG(list_tests) = list_tests_;
+ GTEST_FLAG(output) = output_;
+ GTEST_FLAG(print_time) = print_time_;
+ GTEST_FLAG(random_seed) = random_seed_;
+ GTEST_FLAG(repeat) = repeat_;
+ GTEST_FLAG(shuffle) = shuffle_;
+ GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
+ GTEST_FLAG(throw_on_failure) = throw_on_failure_;
+ }
+ private:
+ // Fields for saving the original values of flags.
+ bool also_run_disabled_tests_;
+ bool break_on_failure_;
+ bool catch_exceptions_;
+ String color_;
+ String death_test_style_;
+ bool death_test_use_fork_;
+ String filter_;
+ String internal_run_death_test_;
+ bool list_tests_;
+ String output_;
+ bool print_time_;
+ bool pretty_;
+ internal::Int32 random_seed_;
+ internal::Int32 repeat_;
+ bool shuffle_;
+ internal::Int32 stack_trace_depth_;
+ bool throw_on_failure_;
+} GTEST_ATTRIBUTE_UNUSED_;
+
+// Converts a Unicode code point to a narrow string in UTF-8 encoding.
+// code_point parameter is of type UInt32 because wchar_t may not be
+// wide enough to contain a code point.
+// The output buffer str must containt at least 32 characters.
+// The function returns the address of the output buffer.
+// If the code_point is not a valid Unicode code point
+// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'.
+GTEST_API_ char* CodePointToUtf8(UInt32 code_point, char* str);
+
+// Converts a wide string to a narrow string in UTF-8 encoding.
+// The wide string is assumed to have the following encoding:
+// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
+// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
+// Parameter str points to a null-terminated wide string.
+// Parameter num_chars may additionally limit the number
+// of wchar_t characters processed. -1 is used when the entire string
+// should be processed.
+// If the string contains code points that are not valid Unicode code points
+// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
+// and contains invalid UTF-16 surrogate pairs, values in those pairs
+// will be encoded as individual Unicode characters from Basic Normal Plane.
+GTEST_API_ String WideStringToUtf8(const wchar_t* str, int num_chars);
+
+// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
+// if the variable is present. If a file already exists at this location, this
+// function will write over it. If the variable is present, but the file cannot
+// be created, prints an error and exits.
+void WriteToShardStatusFileIfNeeded();
+
+// Checks whether sharding is enabled by examining the relevant
+// environment variable values. If the variables are present,
+// but inconsistent (e.g., shard_index >= total_shards), prints
+// an error and exits. If in_subprocess_for_death_test, sharding is
+// disabled because it must only be applied to the original test
+// process. Otherwise, we could filter out death tests we intended to execute.
+GTEST_API_ bool ShouldShard(const char* total_shards_str,
+ const char* shard_index_str,
+ bool in_subprocess_for_death_test);
+
+// Parses the environment variable var as an Int32. If it is unset,
+// returns default_val. If it is not an Int32, prints an error and
+// and aborts.
+GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
+
+// Given the total number of shards, the shard index, and the test id,
+// returns true iff the test should be run on this shard. The test id is
+// some arbitrary but unique non-negative integer assigned to each test
+// method. Assumes that 0 <= shard_index < total_shards.
+GTEST_API_ bool ShouldRunTestOnShard(
+ int total_shards, int shard_index, int test_id);
+
+// STL container utilities.
+
+// Returns the number of elements in the given container that satisfy
+// the given predicate.
+template <class Container, typename Predicate>
+inline int CountIf(const Container& c, Predicate predicate) {
+ return static_cast<int>(std::count_if(c.begin(), c.end(), predicate));
+}
+
+// Applies a function/functor to each element in the container.
+template <class Container, typename Functor>
+void ForEach(const Container& c, Functor functor) {
+ std::for_each(c.begin(), c.end(), functor);
+}
+
+// Returns the i-th element of the vector, or default_value if i is not
+// in range [0, v.size()).
+template <typename E>
+inline E GetElementOr(const std::vector<E>& v, int i, E default_value) {
+ return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];
+}
+
+// Performs an in-place shuffle of a range of the vector's elements.
+// 'begin' and 'end' are element indices as an STL-style range;
+// i.e. [begin, end) are shuffled, where 'end' == size() means to
+// shuffle to the end of the vector.
+template <typename E>
+void ShuffleRange(internal::Random* random, int begin, int end,
+ std::vector<E>* v) {
+ const int size = static_cast<int>(v->size());
+ GTEST_CHECK_(0 <= begin && begin <= size)
+ << "Invalid shuffle range start " << begin << ": must be in range [0, "
+ << size << "].";
+ GTEST_CHECK_(begin <= end && end <= size)
+ << "Invalid shuffle range finish " << end << ": must be in range ["
+ << begin << ", " << size << "].";
+
+ // Fisher-Yates shuffle, from
+ // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
+ for (int range_width = end - begin; range_width >= 2; range_width--) {
+ const int last_in_range = begin + range_width - 1;
+ const int selected = begin + random->Generate(range_width);
+ std::swap((*v)[selected], (*v)[last_in_range]);
+ }
+}
+
+// Performs an in-place shuffle of the vector's elements.
+template <typename E>
+inline void Shuffle(internal::Random* random, std::vector<E>* v) {
+ ShuffleRange(random, 0, static_cast<int>(v->size()), v);
+}
+
+// A function for deleting an object. Handy for being used as a
+// functor.
+template <typename T>
+static void Delete(T* x) {
+ delete x;
+}
+
+// A predicate that checks the key of a TestProperty against a known key.
+//
+// TestPropertyKeyIs is copyable.
+class TestPropertyKeyIs {
+ public:
+ // Constructor.
+ //
+ // TestPropertyKeyIs has NO default constructor.
+ explicit TestPropertyKeyIs(const char* key)
+ : key_(key) {}
+
+ // Returns true iff the test name of test property matches on key_.
+ bool operator()(const TestProperty& test_property) const {
+ return String(test_property.key()).Compare(key_) == 0;
+ }
+
+ private:
+ String key_;
+};
+
+class TestInfoImpl {
+ public:
+ TestInfoImpl(TestInfo* parent, const char* test_case_name,
+ const char* name, const char* test_case_comment,
+ const char* comment, TypeId fixture_class_id,
+ internal::TestFactoryBase* factory);
+ ~TestInfoImpl();
+
+ // Returns true if this test should run.
+ bool should_run() const { return should_run_; }
+
+ // Sets the should_run member.
+ void set_should_run(bool should) { should_run_ = should; }
+
+ // Returns true if this test is disabled. Disabled tests are not run.
+ bool is_disabled() const { return is_disabled_; }
+
+ // Sets the is_disabled member.
+ void set_is_disabled(bool is) { is_disabled_ = is; }
+
+ // Returns true if this test matches the filter specified by the user.
+ bool matches_filter() const { return matches_filter_; }
+
+ // Sets the matches_filter member.
+ void set_matches_filter(bool matches) { matches_filter_ = matches; }
+
+ // Returns the test case name.
+ const char* test_case_name() const { return test_case_name_.c_str(); }
+
+ // Returns the test name.
+ const char* name() const { return name_.c_str(); }
+
+ // Returns the test case comment.
+ const char* test_case_comment() const { return test_case_comment_.c_str(); }
+
+ // Returns the test comment.
+ const char* comment() const { return comment_.c_str(); }
+
+ // Returns the ID of the test fixture class.
+ TypeId fixture_class_id() const { return fixture_class_id_; }
+
+ // Returns the test result.
+ TestResult* result() { return &result_; }
+ const TestResult* result() const { return &result_; }
+
+ // Creates the test object, runs it, records its result, and then
+ // deletes it.
+ void Run();
+
+ // Clears the test result.
+ void ClearResult() { result_.Clear(); }
+
+ // Clears the test result in the given TestInfo object.
+ static void ClearTestResult(TestInfo * test_info) {
+ test_info->impl()->ClearResult();
+ }
+
+ private:
+ // These fields are immutable properties of the test.
+ TestInfo* const parent_; // The owner of this object
+ const String test_case_name_; // Test case name
+ const String name_; // Test name
+ const String test_case_comment_; // Test case comment
+ const String comment_; // Test comment
+ const TypeId fixture_class_id_; // ID of the test fixture class
+ bool should_run_; // True iff this test should run
+ bool is_disabled_; // True iff this test is disabled
+ bool matches_filter_; // True if this test matches the
+ // user-specified filter.
+ internal::TestFactoryBase* const factory_; // The factory that creates
+ // the test object
+
+ // This field is mutable and needs to be reset before running the
+ // test for the second time.
+ TestResult result_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfoImpl);
+};
+
+// Class UnitTestOptions.
+//
+// This class contains functions for processing options the user
+// specifies when running the tests. It has only static members.
+//
+// In most cases, the user can specify an option using either an
+// environment variable or a command line flag. E.g. you can set the
+// test filter using either GTEST_FILTER or --gtest_filter. If both
+// the variable and the flag are present, the latter overrides the
+// former.
+class GTEST_API_ UnitTestOptions {
+ public:
+ // Functions for processing the gtest_output flag.
+
+ // Returns the output format, or "" for normal printed output.
+ static String GetOutputFormat();
+
+ // Returns the absolute path of the requested output file, or the
+ // default (test_detail.xml in the original working directory) if
+ // none was explicitly specified.
+ static String GetAbsolutePathToOutputFile();
+
+ // Functions for processing the gtest_filter flag.
+
+ // Returns true iff the wildcard pattern matches the string. The
+ // first ':' or '\0' character in pattern marks the end of it.
+ //
+ // This recursive algorithm isn't very efficient, but is clear and
+ // works well enough for matching test names, which are short.
+ static bool PatternMatchesString(const char *pattern, const char *str);
+
+ // Returns true iff the user-specified filter matches the test case
+ // name and the test name.
+ static bool FilterMatchesTest(const String &test_case_name,
+ const String &test_name);
+
+#if GTEST_OS_WINDOWS
+ // Function for supporting the gtest_catch_exception flag.
+
+ // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
+ // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
+ // This function is useful as an __except condition.
+ static int GTestShouldProcessSEH(DWORD exception_code);
+#endif // GTEST_OS_WINDOWS
+
+ // Returns true if "name" matches the ':' separated list of glob-style
+ // filters in "filter".
+ static bool MatchesFilter(const String& name, const char* filter);
+};
+
+// Returns the current application's name, removing directory path if that
+// is present. Used by UnitTestOptions::GetOutputFile.
+GTEST_API_ FilePath GetCurrentExecutableName();
+
+// The role interface for getting the OS stack trace as a string.
+class OsStackTraceGetterInterface {
+ public:
+ OsStackTraceGetterInterface() {}
+ virtual ~OsStackTraceGetterInterface() {}
+
+ // Returns the current OS stack trace as a String. Parameters:
+ //
+ // max_depth - the maximum number of stack frames to be included
+ // in the trace.
+ // skip_count - the number of top frames to be skipped; doesn't count
+ // against max_depth.
+ virtual String CurrentStackTrace(int max_depth, int skip_count) = 0;
+
+ // UponLeavingGTest() should be called immediately before Google Test calls
+ // user code. It saves some information about the current stack that
+ // CurrentStackTrace() will use to find and hide Google Test stack frames.
+ virtual void UponLeavingGTest() = 0;
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
+};
+
+// A working implementation of the OsStackTraceGetterInterface interface.
+class OsStackTraceGetter : public OsStackTraceGetterInterface {
+ public:
+ OsStackTraceGetter() : caller_frame_(NULL) {}
+ virtual String CurrentStackTrace(int max_depth, int skip_count);
+ virtual void UponLeavingGTest();
+
+ // This string is inserted in place of stack frames that are part of
+ // Google Test's implementation.
+ static const char* const kElidedFramesMarker;
+
+ private:
+ Mutex mutex_; // protects all internal state
+
+ // We save the stack frame below the frame that calls user code.
+ // We do this because the address of the frame immediately below
+ // the user code changes between the call to UponLeavingGTest()
+ // and any calls to CurrentStackTrace() from within the user code.
+ void* caller_frame_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
+};
+
+// Information about a Google Test trace point.
+struct TraceInfo {
+ const char* file;
+ int line;
+ String message;
+};
+
+// This is the default global test part result reporter used in UnitTestImpl.
+// This class should only be used by UnitTestImpl.
+class DefaultGlobalTestPartResultReporter
+ : public TestPartResultReporterInterface {
+ public:
+ explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
+ // Implements the TestPartResultReporterInterface. Reports the test part
+ // result in the current test.
+ virtual void ReportTestPartResult(const TestPartResult& result);
+
+ private:
+ UnitTestImpl* const unit_test_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
+};
+
+// This is the default per thread test part result reporter used in
+// UnitTestImpl. This class should only be used by UnitTestImpl.
+class DefaultPerThreadTestPartResultReporter
+ : public TestPartResultReporterInterface {
+ public:
+ explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
+ // Implements the TestPartResultReporterInterface. The implementation just
+ // delegates to the current global test part result reporter of *unit_test_.
+ virtual void ReportTestPartResult(const TestPartResult& result);
+
+ private:
+ UnitTestImpl* const unit_test_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
+};
+
+// The private implementation of the UnitTest class. We don't protect
+// the methods under a mutex, as this class is not accessible by a
+// user and the UnitTest class that delegates work to this class does
+// proper locking.
+class GTEST_API_ UnitTestImpl {
+ public:
+ explicit UnitTestImpl(UnitTest* parent);
+ virtual ~UnitTestImpl();
+
+ // There are two different ways to register your own TestPartResultReporter.
+ // You can register your own repoter to listen either only for test results
+ // from the current thread or for results from all threads.
+ // By default, each per-thread test result repoter just passes a new
+ // TestPartResult to the global test result reporter, which registers the
+ // test part result for the currently running test.
+
+ // Returns the global test part result reporter.
+ TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
+
+ // Sets the global test part result reporter.
+ void SetGlobalTestPartResultReporter(
+ TestPartResultReporterInterface* reporter);
+
+ // Returns the test part result reporter for the current thread.
+ TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
+
+ // Sets the test part result reporter for the current thread.
+ void SetTestPartResultReporterForCurrentThread(
+ TestPartResultReporterInterface* reporter);
+
+ // Gets the number of successful test cases.
+ int successful_test_case_count() const;
+
+ // Gets the number of failed test cases.
+ int failed_test_case_count() const;
+
+ // Gets the number of all test cases.
+ int total_test_case_count() const;
+
+ // Gets the number of all test cases that contain at least one test
+ // that should run.
+ int test_case_to_run_count() const;
+
+ // Gets the number of successful tests.
+ int successful_test_count() const;
+
+ // Gets the number of failed tests.
+ int failed_test_count() const;
+
+ // Gets the number of disabled tests.
+ int disabled_test_count() const;
+
+ // Gets the number of all tests.
+ int total_test_count() const;
+
+ // Gets the number of tests that should run.
+ int test_to_run_count() const;
+
+ // Gets the elapsed time, in milliseconds.
+ TimeInMillis elapsed_time() const { return elapsed_time_; }
+
+ // Returns true iff the unit test passed (i.e. all test cases passed).
+ bool Passed() const { return !Failed(); }
+
+ // Returns true iff the unit test failed (i.e. some test case failed
+ // or something outside of all tests failed).
+ bool Failed() const {
+ return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
+ }
+
+ // Gets the i-th test case among all the test cases. i can range from 0 to
+ // total_test_case_count() - 1. If i is not in that range, returns NULL.
+ const TestCase* GetTestCase(int i) const {
+ const int index = GetElementOr(test_case_indices_, i, -1);
+ return index < 0 ? NULL : test_cases_[i];
+ }
+
+ // Gets the i-th test case among all the test cases. i can range from 0 to
+ // total_test_case_count() - 1. If i is not in that range, returns NULL.
+ TestCase* GetMutableTestCase(int i) {
+ const int index = GetElementOr(test_case_indices_, i, -1);
+ return index < 0 ? NULL : test_cases_[index];
+ }
+
+ // Provides access to the event listener list.
+ TestEventListeners* listeners() { return &listeners_; }
+
+ // Returns the TestResult for the test that's currently running, or
+ // the TestResult for the ad hoc test if no test is running.
+ TestResult* current_test_result();
+
+ // Returns the TestResult for the ad hoc test.
+ const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
+
+ // Sets the OS stack trace getter.
+ //
+ // Does nothing if the input and the current OS stack trace getter
+ // are the same; otherwise, deletes the old getter and makes the
+ // input the current getter.
+ void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
+
+ // Returns the current OS stack trace getter if it is not NULL;
+ // otherwise, creates an OsStackTraceGetter, makes it the current
+ // getter, and returns it.
+ OsStackTraceGetterInterface* os_stack_trace_getter();
+
+ // Returns the current OS stack trace as a String.
+ //
+ // The maximum number of stack frames to be included is specified by
+ // the gtest_stack_trace_depth flag. The skip_count parameter
+ // specifies the number of top frames to be skipped, which doesn't
+ // count against the number of frames to be included.
+ //
+ // For example, if Foo() calls Bar(), which in turn calls
+ // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
+ // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
+ String CurrentOsStackTraceExceptTop(int skip_count);
+
+ // Finds and returns a TestCase with the given name. If one doesn't
+ // exist, creates one and returns it.
+ //
+ // Arguments:
+ //
+ // test_case_name: name of the test case
+ // set_up_tc: pointer to the function that sets up the test case
+ // tear_down_tc: pointer to the function that tears down the test case
+ TestCase* GetTestCase(const char* test_case_name,
+ const char* comment,
+ Test::SetUpTestCaseFunc set_up_tc,
+ Test::TearDownTestCaseFunc tear_down_tc);
+
+ // Adds a TestInfo to the unit test.
+ //
+ // Arguments:
+ //
+ // set_up_tc: pointer to the function that sets up the test case
+ // tear_down_tc: pointer to the function that tears down the test case
+ // test_info: the TestInfo object
+ void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,
+ Test::TearDownTestCaseFunc tear_down_tc,
+ TestInfo * test_info) {
+ // In order to support thread-safe death tests, we need to
+ // remember the original working directory when the test program
+ // was first invoked. We cannot do this in RUN_ALL_TESTS(), as
+ // the user may have changed the current directory before calling
+ // RUN_ALL_TESTS(). Therefore we capture the current directory in
+ // AddTestInfo(), which is called to register a TEST or TEST_F
+ // before main() is reached.
+ if (original_working_dir_.IsEmpty()) {
+ original_working_dir_.Set(FilePath::GetCurrentDir());
+ GTEST_CHECK_(!original_working_dir_.IsEmpty())
+ << "Failed to get the current working directory.";
+ }
+
+ GetTestCase(test_info->test_case_name(),
+ test_info->test_case_comment(),
+ set_up_tc,
+ tear_down_tc)->AddTestInfo(test_info);
+ }
+
+#if GTEST_HAS_PARAM_TEST
+ // Returns ParameterizedTestCaseRegistry object used to keep track of
+ // value-parameterized tests and instantiate and register them.
+ internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
+ return parameterized_test_registry_;
+ }
+#endif // GTEST_HAS_PARAM_TEST
+
+ // Sets the TestCase object for the test that's currently running.
+ void set_current_test_case(TestCase* a_current_test_case) {
+ current_test_case_ = a_current_test_case;
+ }
+
+ // Sets the TestInfo object for the test that's currently running. If
+ // current_test_info is NULL, the assertion results will be stored in
+ // ad_hoc_test_result_.
+ void set_current_test_info(TestInfo* a_current_test_info) {
+ current_test_info_ = a_current_test_info;
+ }
+
+ // Registers all parameterized tests defined using TEST_P and
+ // INSTANTIATE_TEST_P, creating regular tests for each test/parameter
+ // combination. This method can be called more then once; it has
+ // guards protecting from registering the tests more then once.
+ // If value-parameterized tests are disabled, RegisterParameterizedTests
+ // is present but does nothing.
+ void RegisterParameterizedTests();
+
+ // Runs all tests in this UnitTest object, prints the result, and
+ // returns 0 if all tests are successful, or 1 otherwise. If any
+ // exception is thrown during a test on Windows, this test is
+ // considered to be failed, but the rest of the tests will still be
+ // run. (We disable exceptions on Linux and Mac OS X, so the issue
+ // doesn't apply there.)
+ int RunAllTests();
+
+ // Clears the results of all tests, including the ad hoc test.
+ void ClearResult() {
+ ForEach(test_cases_, TestCase::ClearTestCaseResult);
+ ad_hoc_test_result_.Clear();
+ }
+
+ enum ReactionToSharding {
+ HONOR_SHARDING_PROTOCOL,
+ IGNORE_SHARDING_PROTOCOL
+ };
+
+ // Matches the full name of each test against the user-specified
+ // filter to decide whether the test should run, then records the
+ // result in each TestCase and TestInfo object.
+ // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
+ // based on sharding variables in the environment.
+ // Returns the number of tests that should run.
+ int FilterTests(ReactionToSharding shard_tests);
+
+ // Prints the names of the tests matching the user-specified filter flag.
+ void ListTestsMatchingFilter();
+
+ const TestCase* current_test_case() const { return current_test_case_; }
+ TestInfo* current_test_info() { return current_test_info_; }
+ const TestInfo* current_test_info() const { return current_test_info_; }
+
+ // Returns the vector of environments that need to be set-up/torn-down
+ // before/after the tests are run.
+ std::vector<Environment*>& environments() { return environments_; }
+
+ // Getters for the per-thread Google Test trace stack.
+ std::vector<TraceInfo>& gtest_trace_stack() {
+ return *(gtest_trace_stack_.pointer());
+ }
+ const std::vector<TraceInfo>& gtest_trace_stack() const {
+ return gtest_trace_stack_.get();
+ }
+
+#if GTEST_HAS_DEATH_TEST
+ void InitDeathTestSubprocessControlInfo() {
+ internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
+ }
+ // Returns a pointer to the parsed --gtest_internal_run_death_test
+ // flag, or NULL if that flag was not specified.
+ // This information is useful only in a death test child process.
+ // Must not be called before a call to InitGoogleTest.
+ const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
+ return internal_run_death_test_flag_.get();
+ }
+
+ // Returns a pointer to the current death test factory.
+ internal::DeathTestFactory* death_test_factory() {
+ return death_test_factory_.get();
+ }
+
+ void SuppressTestEventsIfInSubprocess();
+
+ friend class ReplaceDeathTestFactory;
+#endif // GTEST_HAS_DEATH_TEST
+
+ // Initializes the event listener performing XML output as specified by
+ // UnitTestOptions. Must not be called before InitGoogleTest.
+ void ConfigureXmlOutput();
+
+ // Performs initialization dependent upon flag values obtained in
+ // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
+ // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
+ // this function is also called from RunAllTests. Since this function can be
+ // called more than once, it has to be idempotent.
+ void PostFlagParsingInit();
+
+ // Gets the random seed used at the start of the current test iteration.
+ int random_seed() const { return random_seed_; }
+
+ // Gets the random number generator.
+ internal::Random* random() { return &random_; }
+
+ // Shuffles all test cases, and the tests within each test case,
+ // making sure that death tests are still run first.
+ void ShuffleTests();
+
+ // Restores the test cases and tests to their order before the first shuffle.
+ void UnshuffleTests();
+
+ private:
+ friend class ::testing::UnitTest;
+
+ // The UnitTest object that owns this implementation object.
+ UnitTest* const parent_;
+
+ // The working directory when the first TEST() or TEST_F() was
+ // executed.
+ internal::FilePath original_working_dir_;
+
+ // The default test part result reporters.
+ DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
+ DefaultPerThreadTestPartResultReporter
+ default_per_thread_test_part_result_reporter_;
+
+ // Points to (but doesn't own) the global test part result reporter.
+ TestPartResultReporterInterface* global_test_part_result_repoter_;
+
+ // Protects read and write access to global_test_part_result_reporter_.
+ internal::Mutex global_test_part_result_reporter_mutex_;
+
+ // Points to (but doesn't own) the per-thread test part result reporter.
+ internal::ThreadLocal<TestPartResultReporterInterface*>
+ per_thread_test_part_result_reporter_;
+
+ // The vector of environments that need to be set-up/torn-down
+ // before/after the tests are run.
+ std::vector<Environment*> environments_;
+
+ // The vector of TestCases in their original order. It owns the
+ // elements in the vector.
+ std::vector<TestCase*> test_cases_;
+
+ // Provides a level of indirection for the test case list to allow
+ // easy shuffling and restoring the test case order. The i-th
+ // element of this vector is the index of the i-th test case in the
+ // shuffled order.
+ std::vector<int> test_case_indices_;
+
+#if GTEST_HAS_PARAM_TEST
+ // ParameterizedTestRegistry object used to register value-parameterized
+ // tests.
+ internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
+
+ // Indicates whether RegisterParameterizedTests() has been called already.
+ bool parameterized_tests_registered_;
+#endif // GTEST_HAS_PARAM_TEST
+
+ // Index of the last death test case registered. Initially -1.
+ int last_death_test_case_;
+
+ // This points to the TestCase for the currently running test. It
+ // changes as Google Test goes through one test case after another.
+ // When no test is running, this is set to NULL and Google Test
+ // stores assertion results in ad_hoc_test_result_. Initially NULL.
+ TestCase* current_test_case_;
+
+ // This points to the TestInfo for the currently running test. It
+ // changes as Google Test goes through one test after another. When
+ // no test is running, this is set to NULL and Google Test stores
+ // assertion results in ad_hoc_test_result_. Initially NULL.
+ TestInfo* current_test_info_;
+
+ // Normally, a user only writes assertions inside a TEST or TEST_F,
+ // or inside a function called by a TEST or TEST_F. Since Google
+ // Test keeps track of which test is current running, it can
+ // associate such an assertion with the test it belongs to.
+ //
+ // If an assertion is encountered when no TEST or TEST_F is running,
+ // Google Test attributes the assertion result to an imaginary "ad hoc"
+ // test, and records the result in ad_hoc_test_result_.
+ TestResult ad_hoc_test_result_;
+
+ // The list of event listeners that can be used to track events inside
+ // Google Test.
+ TestEventListeners listeners_;
+
+ // The OS stack trace getter. Will be deleted when the UnitTest
+ // object is destructed. By default, an OsStackTraceGetter is used,
+ // but the user can set this field to use a custom getter if that is
+ // desired.
+ OsStackTraceGetterInterface* os_stack_trace_getter_;
+
+ // True iff PostFlagParsingInit() has been called.
+ bool post_flag_parse_init_performed_;
+
+ // The random number seed used at the beginning of the test run.
+ int random_seed_;
+
+ // Our random number generator.
+ internal::Random random_;
+
+ // How long the test took to run, in milliseconds.
+ TimeInMillis elapsed_time_;
+
+#if GTEST_HAS_DEATH_TEST
+ // The decomposed components of the gtest_internal_run_death_test flag,
+ // parsed when RUN_ALL_TESTS is called.
+ internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
+ internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;
+#endif // GTEST_HAS_DEATH_TEST
+
+ // A per-thread stack of traces created by the SCOPED_TRACE() macro.
+ internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
+}; // class UnitTestImpl
+
+// Convenience function for accessing the global UnitTest
+// implementation object.
+inline UnitTestImpl* GetUnitTestImpl() {
+ return UnitTest::GetInstance()->impl();
+}
+
+// Internal helper functions for implementing the simple regular
+// expression matcher.
+GTEST_API_ bool IsInSet(char ch, const char* str);
+GTEST_API_ bool IsDigit(char ch);
+GTEST_API_ bool IsPunct(char ch);
+GTEST_API_ bool IsRepeat(char ch);
+GTEST_API_ bool IsWhiteSpace(char ch);
+GTEST_API_ bool IsWordChar(char ch);
+GTEST_API_ bool IsValidEscape(char ch);
+GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
+GTEST_API_ bool ValidateRegex(const char* regex);
+GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
+GTEST_API_ bool MatchRepetitionAndRegexAtHead(
+ bool escaped, char ch, char repeat, const char* regex, const char* str);
+GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
+
+// Parses the command line for Google Test flags, without initializing
+// other parts of Google Test.
+GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
+GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
+
+#if GTEST_HAS_DEATH_TEST
+
+// Returns the message describing the last system error, regardless of the
+// platform.
+String GetLastErrnoDescription();
+
+#if GTEST_OS_WINDOWS
+// Provides leak-safe Windows kernel handle ownership.
+class AutoHandle {
+ public:
+ AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
+ explicit AutoHandle(HANDLE handle) : handle_(handle) {}
+
+ ~AutoHandle() { Reset(); }
+
+ HANDLE Get() const { return handle_; }
+ void Reset() { Reset(INVALID_HANDLE_VALUE); }
+ void Reset(HANDLE handle) {
+ if (handle != handle_) {
+ if (handle_ != INVALID_HANDLE_VALUE)
+ ::CloseHandle(handle_);
+ handle_ = handle;
+ }
+ }
+
+ private:
+ HANDLE handle_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
+};
+#endif // GTEST_OS_WINDOWS
+
+// Attempts to parse a string into a positive integer pointed to by the
+// number parameter. Returns true if that is possible.
+// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
+// it here.
+template <typename Integer>
+bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
+ // Fail fast if the given string does not begin with a digit;
+ // this bypasses strtoXXX's "optional leading whitespace and plus
+ // or minus sign" semantics, which are undesirable here.
+ if (str.empty() || !isdigit(str[0])) {
+ return false;
+ }
+ errno = 0;
+
+ char* end;
+ // BiggestConvertible is the largest integer type that system-provided
+ // string-to-number conversion routines can return.
+#if GTEST_OS_WINDOWS && !defined(__GNUC__)
+ // MSVC and C++ Builder define __int64 instead of the standard long long.
+ typedef unsigned __int64 BiggestConvertible;
+ const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
+#else
+ typedef unsigned long long BiggestConvertible; // NOLINT
+ const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
+#endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
+ const bool parse_success = *end == '\0' && errno == 0;
+
+ // TODO(vladl@google.com): Convert this to compile time assertion when it is
+ // available.
+ GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
+
+ const Integer result = static_cast<Integer>(parsed);
+ if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
+ *number = result;
+ return true;
+ }
+ return false;
+}
+#endif // GTEST_HAS_DEATH_TEST
+
+// TestResult contains some private methods that should be hidden from
+// Google Test user but are required for testing. This class allow our tests
+// to access them.
+//
+// This class is supplied only for the purpose of testing Google Test's own
+// constructs. Do not use it in user tests, either directly or indirectly.
+class TestResultAccessor {
+ public:
+ static void RecordProperty(TestResult* test_result,
+ const TestProperty& property) {
+ test_result->RecordProperty(property);
+ }
+
+ static void ClearTestPartResults(TestResult* test_result) {
+ test_result->ClearTestPartResults();
+ }
+
+ static const std::vector<testing::TestPartResult>& test_part_results(
+ const TestResult& test_result) {
+ return test_result.test_part_results();
+ }
+};
+
+} // namespace internal
+} // namespace testing
+
+#endif // GTEST_SRC_GTEST_INTERNAL_INL_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-port.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-port.cc
new file mode 100644
index 0000000..b9504f5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-port.cc
@@ -0,0 +1,711 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <gtest/internal/gtest-port.h>
+
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#if GTEST_OS_WINDOWS_MOBILE
+#include <windows.h> // For TerminateProcess()
+#elif GTEST_OS_WINDOWS
+#include <io.h>
+#include <sys/stat.h>
+#else
+#include <unistd.h>
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+#if GTEST_OS_MAC
+#include <mach/mach_init.h>
+#include <mach/task.h>
+#include <mach/vm_map.h>
+#endif // GTEST_OS_MAC
+
+#include <gtest/gtest-spi.h>
+#include <gtest/gtest-message.h>
+#include <gtest/internal/gtest-string.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+namespace testing {
+namespace internal {
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
+const int kStdOutFileno = 1;
+const int kStdErrFileno = 2;
+#else
+const int kStdOutFileno = STDOUT_FILENO;
+const int kStdErrFileno = STDERR_FILENO;
+#endif // _MSC_VER
+
+#if GTEST_OS_MAC
+
+// Returns the number of threads running in the process, or 0 to indicate that
+// we cannot detect it.
+size_t GetThreadCount() {
+ const task_t task = mach_task_self();
+ mach_msg_type_number_t thread_count;
+ thread_act_array_t thread_list;
+ const kern_return_t status = task_threads(task, &thread_list, &thread_count);
+ if (status == KERN_SUCCESS) {
+ // task_threads allocates resources in thread_list and we need to free them
+ // to avoid leaks.
+ vm_deallocate(task,
+ reinterpret_cast<vm_address_t>(thread_list),
+ sizeof(thread_t) * thread_count);
+ return static_cast<size_t>(thread_count);
+ } else {
+ return 0;
+ }
+}
+
+#else
+
+size_t GetThreadCount() {
+ // There's no portable way to detect the number of threads, so we just
+ // return 0 to indicate that we cannot detect it.
+ return 0;
+}
+
+#endif // GTEST_OS_MAC
+
+#if GTEST_USES_POSIX_RE
+
+// Implements RE. Currently only needed for death tests.
+
+RE::~RE() {
+ if (is_valid_) {
+ // regfree'ing an invalid regex might crash because the content
+ // of the regex is undefined. Since the regex's are essentially
+ // the same, one cannot be valid (or invalid) without the other
+ // being so too.
+ regfree(&partial_regex_);
+ regfree(&full_regex_);
+ }
+ free(const_cast<char*>(pattern_));
+}
+
+// Returns true iff regular expression re matches the entire str.
+bool RE::FullMatch(const char* str, const RE& re) {
+ if (!re.is_valid_) return false;
+
+ regmatch_t match;
+ return regexec(&re.full_regex_, str, 1, &match, 0) == 0;
+}
+
+// Returns true iff regular expression re matches a substring of str
+// (including str itself).
+bool RE::PartialMatch(const char* str, const RE& re) {
+ if (!re.is_valid_) return false;
+
+ regmatch_t match;
+ return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;
+}
+
+// Initializes an RE from its string representation.
+void RE::Init(const char* regex) {
+ pattern_ = posix::StrDup(regex);
+
+ // Reserves enough bytes to hold the regular expression used for a
+ // full match.
+ const size_t full_regex_len = strlen(regex) + 10;
+ char* const full_pattern = new char[full_regex_len];
+
+ snprintf(full_pattern, full_regex_len, "^(%s)$", regex);
+ is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0;
+ // We want to call regcomp(&partial_regex_, ...) even if the
+ // previous expression returns false. Otherwise partial_regex_ may
+ // not be properly initialized can may cause trouble when it's
+ // freed.
+ //
+ // Some implementation of POSIX regex (e.g. on at least some
+ // versions of Cygwin) doesn't accept the empty string as a valid
+ // regex. We change it to an equivalent form "()" to be safe.
+ if (is_valid_) {
+ const char* const partial_regex = (*regex == '\0') ? "()" : regex;
+ is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0;
+ }
+ EXPECT_TRUE(is_valid_)
+ << "Regular expression \"" << regex
+ << "\" is not a valid POSIX Extended regular expression.";
+
+ delete[] full_pattern;
+}
+
+#elif GTEST_USES_SIMPLE_RE
+
+// Returns true iff ch appears anywhere in str (excluding the
+// terminating '\0' character).
+bool IsInSet(char ch, const char* str) {
+ return ch != '\0' && strchr(str, ch) != NULL;
+}
+
+// Returns true iff ch belongs to the given classification. Unlike
+// similar functions in <ctype.h>, these aren't affected by the
+// current locale.
+bool IsDigit(char ch) { return '0' <= ch && ch <= '9'; }
+bool IsPunct(char ch) {
+ return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
+}
+bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
+bool IsWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
+bool IsWordChar(char ch) {
+ return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
+ ('0' <= ch && ch <= '9') || ch == '_';
+}
+
+// Returns true iff "\\c" is a supported escape sequence.
+bool IsValidEscape(char c) {
+ return (IsPunct(c) || IsInSet(c, "dDfnrsStvwW"));
+}
+
+// Returns true iff the given atom (specified by escaped and pattern)
+// matches ch. The result is undefined if the atom is invalid.
+bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
+ if (escaped) { // "\\p" where p is pattern_char.
+ switch (pattern_char) {
+ case 'd': return IsDigit(ch);
+ case 'D': return !IsDigit(ch);
+ case 'f': return ch == '\f';
+ case 'n': return ch == '\n';
+ case 'r': return ch == '\r';
+ case 's': return IsWhiteSpace(ch);
+ case 'S': return !IsWhiteSpace(ch);
+ case 't': return ch == '\t';
+ case 'v': return ch == '\v';
+ case 'w': return IsWordChar(ch);
+ case 'W': return !IsWordChar(ch);
+ }
+ return IsPunct(pattern_char) && pattern_char == ch;
+ }
+
+ return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
+}
+
+// Helper function used by ValidateRegex() to format error messages.
+String FormatRegexSyntaxError(const char* regex, int index) {
+ return (Message() << "Syntax error at index " << index
+ << " in simple regular expression \"" << regex << "\": ").GetString();
+}
+
+// Generates non-fatal failures and returns false if regex is invalid;
+// otherwise returns true.
+bool ValidateRegex(const char* regex) {
+ if (regex == NULL) {
+ // TODO(wan@google.com): fix the source file location in the
+ // assertion failures to match where the regex is used in user
+ // code.
+ ADD_FAILURE() << "NULL is not a valid simple regular expression.";
+ return false;
+ }
+
+ bool is_valid = true;
+
+ // True iff ?, *, or + can follow the previous atom.
+ bool prev_repeatable = false;
+ for (int i = 0; regex[i]; i++) {
+ if (regex[i] == '\\') { // An escape sequence
+ i++;
+ if (regex[i] == '\0') {
+ ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
+ << "'\\' cannot appear at the end.";
+ return false;
+ }
+
+ if (!IsValidEscape(regex[i])) {
+ ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
+ << "invalid escape sequence \"\\" << regex[i] << "\".";
+ is_valid = false;
+ }
+ prev_repeatable = true;
+ } else { // Not an escape sequence.
+ const char ch = regex[i];
+
+ if (ch == '^' && i > 0) {
+ ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
+ << "'^' can only appear at the beginning.";
+ is_valid = false;
+ } else if (ch == '$' && regex[i + 1] != '\0') {
+ ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
+ << "'$' can only appear at the end.";
+ is_valid = false;
+ } else if (IsInSet(ch, "()[]{}|")) {
+ ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
+ << "'" << ch << "' is unsupported.";
+ is_valid = false;
+ } else if (IsRepeat(ch) && !prev_repeatable) {
+ ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
+ << "'" << ch << "' can only follow a repeatable token.";
+ is_valid = false;
+ }
+
+ prev_repeatable = !IsInSet(ch, "^$?*+");
+ }
+ }
+
+ return is_valid;
+}
+
+// Matches a repeated regex atom followed by a valid simple regular
+// expression. The regex atom is defined as c if escaped is false,
+// or \c otherwise. repeat is the repetition meta character (?, *,
+// or +). The behavior is undefined if str contains too many
+// characters to be indexable by size_t, in which case the test will
+// probably time out anyway. We are fine with this limitation as
+// std::string has it too.
+bool MatchRepetitionAndRegexAtHead(
+ bool escaped, char c, char repeat, const char* regex,
+ const char* str) {
+ const size_t min_count = (repeat == '+') ? 1 : 0;
+ const size_t max_count = (repeat == '?') ? 1 :
+ static_cast<size_t>(-1) - 1;
+ // We cannot call numeric_limits::max() as it conflicts with the
+ // max() macro on Windows.
+
+ for (size_t i = 0; i <= max_count; ++i) {
+ // We know that the atom matches each of the first i characters in str.
+ if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
+ // We have enough matches at the head, and the tail matches too.
+ // Since we only care about *whether* the pattern matches str
+ // (as opposed to *how* it matches), there is no need to find a
+ // greedy match.
+ return true;
+ }
+ if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
+ return false;
+ }
+ return false;
+}
+
+// Returns true iff regex matches a prefix of str. regex must be a
+// valid simple regular expression and not start with "^", or the
+// result is undefined.
+bool MatchRegexAtHead(const char* regex, const char* str) {
+ if (*regex == '\0') // An empty regex matches a prefix of anything.
+ return true;
+
+ // "$" only matches the end of a string. Note that regex being
+ // valid guarantees that there's nothing after "$" in it.
+ if (*regex == '$')
+ return *str == '\0';
+
+ // Is the first thing in regex an escape sequence?
+ const bool escaped = *regex == '\\';
+ if (escaped)
+ ++regex;
+ if (IsRepeat(regex[1])) {
+ // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
+ // here's an indirect recursion. It terminates as the regex gets
+ // shorter in each recursion.
+ return MatchRepetitionAndRegexAtHead(
+ escaped, regex[0], regex[1], regex + 2, str);
+ } else {
+ // regex isn't empty, isn't "$", and doesn't start with a
+ // repetition. We match the first atom of regex with the first
+ // character of str and recurse.
+ return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
+ MatchRegexAtHead(regex + 1, str + 1);
+ }
+}
+
+// Returns true iff regex matches any substring of str. regex must be
+// a valid simple regular expression, or the result is undefined.
+//
+// The algorithm is recursive, but the recursion depth doesn't exceed
+// the regex length, so we won't need to worry about running out of
+// stack space normally. In rare cases the time complexity can be
+// exponential with respect to the regex length + the string length,
+// but usually it's must faster (often close to linear).
+bool MatchRegexAnywhere(const char* regex, const char* str) {
+ if (regex == NULL || str == NULL)
+ return false;
+
+ if (*regex == '^')
+ return MatchRegexAtHead(regex + 1, str);
+
+ // A successful match can be anywhere in str.
+ do {
+ if (MatchRegexAtHead(regex, str))
+ return true;
+ } while (*str++ != '\0');
+ return false;
+}
+
+// Implements the RE class.
+
+RE::~RE() {
+ free(const_cast<char*>(pattern_));
+ free(const_cast<char*>(full_pattern_));
+}
+
+// Returns true iff regular expression re matches the entire str.
+bool RE::FullMatch(const char* str, const RE& re) {
+ return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
+}
+
+// Returns true iff regular expression re matches a substring of str
+// (including str itself).
+bool RE::PartialMatch(const char* str, const RE& re) {
+ return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
+}
+
+// Initializes an RE from its string representation.
+void RE::Init(const char* regex) {
+ pattern_ = full_pattern_ = NULL;
+ if (regex != NULL) {
+ pattern_ = posix::StrDup(regex);
+ }
+
+ is_valid_ = ValidateRegex(regex);
+ if (!is_valid_) {
+ // No need to calculate the full pattern when the regex is invalid.
+ return;
+ }
+
+ const size_t len = strlen(regex);
+ // Reserves enough bytes to hold the regular expression used for a
+ // full match: we need space to prepend a '^', append a '$', and
+ // terminate the string with '\0'.
+ char* buffer = static_cast<char*>(malloc(len + 3));
+ full_pattern_ = buffer;
+
+ if (*regex != '^')
+ *buffer++ = '^'; // Makes sure full_pattern_ starts with '^'.
+
+ // We don't use snprintf or strncpy, as they trigger a warning when
+ // compiled with VC++ 8.0.
+ memcpy(buffer, regex, len);
+ buffer += len;
+
+ if (len == 0 || regex[len - 1] != '$')
+ *buffer++ = '$'; // Makes sure full_pattern_ ends with '$'.
+
+ *buffer = '\0';
+}
+
+#endif // GTEST_USES_POSIX_RE
+
+
+GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)
+ : severity_(severity) {
+ const char* const marker =
+ severity == GTEST_INFO ? "[ INFO ]" :
+ severity == GTEST_WARNING ? "[WARNING]" :
+ severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]";
+ GetStream() << ::std::endl << marker << " "
+ << FormatFileLocation(file, line).c_str() << ": ";
+}
+
+// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
+GTestLog::~GTestLog() {
+ GetStream() << ::std::endl;
+ if (severity_ == GTEST_FATAL) {
+ fflush(stderr);
+ posix::Abort();
+ }
+}
+// Disable Microsoft deprecation warnings for POSIX functions called from
+// this class (creat, dup, dup2, and close)
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4996)
+#endif // _MSC_VER
+
+#if GTEST_HAS_STREAM_REDIRECTION_
+
+// Object that captures an output stream (stdout/stderr).
+class CapturedStream {
+ public:
+ // The ctor redirects the stream to a temporary file.
+ CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
+#if GTEST_OS_WINDOWS
+ char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
+ char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
+
+ ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
+ const UINT success = ::GetTempFileNameA(temp_dir_path,
+ "gtest_redir",
+ 0, // Generate unique file name.
+ temp_file_path);
+ GTEST_CHECK_(success != 0)
+ << "Unable to create a temporary file in " << temp_dir_path;
+ const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
+ GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
+ << temp_file_path;
+ filename_ = temp_file_path;
+#else
+ // There's no guarantee that a test has write access to the
+ // current directory, so we create the temporary file in the /tmp
+ // directory instead.
+ char name_template[] = "/tmp/captured_stream.XXXXXX";
+ const int captured_fd = mkstemp(name_template);
+ filename_ = name_template;
+#endif // GTEST_OS_WINDOWS
+ fflush(NULL);
+ dup2(captured_fd, fd_);
+ close(captured_fd);
+ }
+
+ ~CapturedStream() {
+ remove(filename_.c_str());
+ }
+
+ String GetCapturedString() {
+ if (uncaptured_fd_ != -1) {
+ // Restores the original stream.
+ fflush(NULL);
+ dup2(uncaptured_fd_, fd_);
+ close(uncaptured_fd_);
+ uncaptured_fd_ = -1;
+ }
+
+ FILE* const file = posix::FOpen(filename_.c_str(), "r");
+ const String content = ReadEntireFile(file);
+ posix::FClose(file);
+ return content;
+ }
+
+ private:
+ // Reads the entire content of a file as a String.
+ static String ReadEntireFile(FILE* file);
+
+ // Returns the size (in bytes) of a file.
+ static size_t GetFileSize(FILE* file);
+
+ const int fd_; // A stream to capture.
+ int uncaptured_fd_;
+ // Name of the temporary file holding the stderr output.
+ ::std::string filename_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
+};
+
+// Returns the size (in bytes) of a file.
+size_t CapturedStream::GetFileSize(FILE* file) {
+ fseek(file, 0, SEEK_END);
+ return static_cast<size_t>(ftell(file));
+}
+
+// Reads the entire content of a file as a string.
+String CapturedStream::ReadEntireFile(FILE* file) {
+ const size_t file_size = GetFileSize(file);
+ char* const buffer = new char[file_size];
+
+ size_t bytes_last_read = 0; // # of bytes read in the last fread()
+ size_t bytes_read = 0; // # of bytes read so far
+
+ fseek(file, 0, SEEK_SET);
+
+ // Keeps reading the file until we cannot read further or the
+ // pre-determined file size is reached.
+ do {
+ bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
+ bytes_read += bytes_last_read;
+ } while (bytes_last_read > 0 && bytes_read < file_size);
+
+ const String content(buffer, bytes_read);
+ delete[] buffer;
+
+ return content;
+}
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif // _MSC_VER
+
+static CapturedStream* g_captured_stderr = NULL;
+static CapturedStream* g_captured_stdout = NULL;
+
+// Starts capturing an output stream (stdout/stderr).
+void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
+ if (*stream != NULL) {
+ GTEST_LOG_(FATAL) << "Only one " << stream_name
+ << " capturer can exist at a time.";
+ }
+ *stream = new CapturedStream(fd);
+}
+
+// Stops capturing the output stream and returns the captured string.
+String GetCapturedStream(CapturedStream** captured_stream) {
+ const String content = (*captured_stream)->GetCapturedString();
+
+ delete *captured_stream;
+ *captured_stream = NULL;
+
+ return content;
+}
+
+// Starts capturing stdout.
+void CaptureStdout() {
+ CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
+}
+
+// Starts capturing stderr.
+void CaptureStderr() {
+ CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr);
+}
+
+// Stops capturing stdout and returns the captured string.
+String GetCapturedStdout() { return GetCapturedStream(&g_captured_stdout); }
+
+// Stops capturing stderr and returns the captured string.
+String GetCapturedStderr() { return GetCapturedStream(&g_captured_stderr); }
+
+#endif // GTEST_HAS_STREAM_REDIRECTION_
+
+#if GTEST_HAS_DEATH_TEST
+
+// A copy of all command line arguments. Set by InitGoogleTest().
+::std::vector<String> g_argvs;
+
+// Returns the command line as a vector of strings.
+const ::std::vector<String>& GetArgvs() { return g_argvs; }
+
+#endif // GTEST_HAS_DEATH_TEST
+
+#if GTEST_OS_WINDOWS_MOBILE
+namespace posix {
+void Abort() {
+ DebugBreak();
+ TerminateProcess(GetCurrentProcess(), 1);
+}
+} // namespace posix
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+// Returns the name of the environment variable corresponding to the
+// given flag. For example, FlagToEnvVar("foo") will return
+// "GTEST_FOO" in the open-source version.
+static String FlagToEnvVar(const char* flag) {
+ const String full_flag =
+ (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
+
+ Message env_var;
+ for (size_t i = 0; i != full_flag.length(); i++) {
+ env_var << static_cast<char>(toupper(full_flag.c_str()[i]));
+ }
+
+ return env_var.GetString();
+}
+
+// Parses 'str' for a 32-bit signed integer. If successful, writes
+// the result to *value and returns true; otherwise leaves *value
+// unchanged and returns false.
+bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
+ // Parses the environment variable as a decimal integer.
+ char* end = NULL;
+ const long long_value = strtol(str, &end, 10); // NOLINT
+
+ // Has strtol() consumed all characters in the string?
+ if (*end != '\0') {
+ // No - an invalid character was encountered.
+ Message msg;
+ msg << "WARNING: " << src_text
+ << " is expected to be a 32-bit integer, but actually"
+ << " has value \"" << str << "\".\n";
+ printf("%s", msg.GetString().c_str());
+ fflush(stdout);
+ return false;
+ }
+
+ // Is the parsed value in the range of an Int32?
+ const Int32 result = static_cast<Int32>(long_value);
+ if (long_value == LONG_MAX || long_value == LONG_MIN ||
+ // The parsed value overflows as a long. (strtol() returns
+ // LONG_MAX or LONG_MIN when the input overflows.)
+ result != long_value
+ // The parsed value overflows as an Int32.
+ ) {
+ Message msg;
+ msg << "WARNING: " << src_text
+ << " is expected to be a 32-bit integer, but actually"
+ << " has value " << str << ", which overflows.\n";
+ printf("%s", msg.GetString().c_str());
+ fflush(stdout);
+ return false;
+ }
+
+ *value = result;
+ return true;
+}
+
+// Reads and returns the Boolean environment variable corresponding to
+// the given flag; if it's not set, returns default_value.
+//
+// The value is considered true iff it's not "0".
+bool BoolFromGTestEnv(const char* flag, bool default_value) {
+ const String env_var = FlagToEnvVar(flag);
+ const char* const string_value = posix::GetEnv(env_var.c_str());
+ return string_value == NULL ?
+ default_value : strcmp(string_value, "0") != 0;
+}
+
+// Reads and returns a 32-bit integer stored in the environment
+// variable corresponding to the given flag; if it isn't set or
+// doesn't represent a valid 32-bit integer, returns default_value.
+Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
+ const String env_var = FlagToEnvVar(flag);
+ const char* const string_value = posix::GetEnv(env_var.c_str());
+ if (string_value == NULL) {
+ // The environment variable is not set.
+ return default_value;
+ }
+
+ Int32 result = default_value;
+ if (!ParseInt32(Message() << "Environment variable " << env_var,
+ string_value, &result)) {
+ printf("The default value %s is used.\n",
+ (Message() << default_value).GetString().c_str());
+ fflush(stdout);
+ return default_value;
+ }
+
+ return result;
+}
+
+// Reads and returns the string environment variable corresponding to
+// the given flag; if it's not set, returns default_value.
+const char* StringFromGTestEnv(const char* flag, const char* default_value) {
+ const String env_var = FlagToEnvVar(flag);
+ const char* const value = posix::GetEnv(env_var.c_str());
+ return value == NULL ? default_value : value;
+}
+
+} // namespace internal
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-test-part.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-test-part.cc
new file mode 100644
index 0000000..5d183a4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-test-part.cc
@@ -0,0 +1,110 @@
+// Copyright 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.
+//
+// Author: mheule@google.com (Markus Heule)
+//
+// The Google C++ Testing Framework (Google Test)
+
+#include <gtest/gtest-test-part.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+namespace testing {
+
+using internal::GetUnitTestImpl;
+
+// Gets the summary of the failure message by omitting the stack trace
+// in it.
+internal::String TestPartResult::ExtractSummary(const char* message) {
+ const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
+ return stack_trace == NULL ? internal::String(message) :
+ internal::String(message, stack_trace - message);
+}
+
+// Prints a TestPartResult object.
+std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
+ return os
+ << result.file_name() << ":" << result.line_number() << ": "
+ << (result.type() == TestPartResult::kSuccess ? "Success" :
+ result.type() == TestPartResult::kFatalFailure ? "Fatal failure" :
+ "Non-fatal failure") << ":\n"
+ << result.message() << std::endl;
+}
+
+// Appends a TestPartResult to the array.
+void TestPartResultArray::Append(const TestPartResult& result) {
+ array_.push_back(result);
+}
+
+// Returns the TestPartResult at the given index (0-based).
+const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
+ if (index < 0 || index >= size()) {
+ printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
+ internal::posix::Abort();
+ }
+
+ return array_[index];
+}
+
+// Returns the number of TestPartResult objects in the array.
+int TestPartResultArray::size() const {
+ return static_cast<int>(array_.size());
+}
+
+namespace internal {
+
+HasNewFatalFailureHelper::HasNewFatalFailureHelper()
+ : has_new_fatal_failure_(false),
+ original_reporter_(GetUnitTestImpl()->
+ GetTestPartResultReporterForCurrentThread()) {
+ GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);
+}
+
+HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
+ GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
+ original_reporter_);
+}
+
+void HasNewFatalFailureHelper::ReportTestPartResult(
+ const TestPartResult& result) {
+ if (result.fatally_failed())
+ has_new_fatal_failure_ = true;
+ original_reporter_->ReportTestPartResult(result);
+}
+
+} // namespace internal
+
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-typed-test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-typed-test.cc
new file mode 100644
index 0000000..3cc4b5d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest-typed-test.cc
@@ -0,0 +1,110 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <gtest/gtest-typed-test.h>
+#include <gtest/gtest.h>
+
+namespace testing {
+namespace internal {
+
+#if GTEST_HAS_TYPED_TEST_P
+
+// Skips to the first non-space char in str. Returns an empty string if str
+// contains only whitespace characters.
+static const char* SkipSpaces(const char* str) {
+ while (isspace(*str))
+ str++;
+ return str;
+}
+
+// Verifies that registered_tests match the test names in
+// defined_test_names_; returns registered_tests if successful, or
+// aborts the program otherwise.
+const char* TypedTestCasePState::VerifyRegisteredTestNames(
+ const char* file, int line, const char* registered_tests) {
+ typedef ::std::set<const char*>::const_iterator DefinedTestIter;
+ registered_ = true;
+
+ // Skip initial whitespace in registered_tests since some
+ // preprocessors prefix stringizied literals with whitespace.
+ registered_tests = SkipSpaces(registered_tests);
+
+ Message errors;
+ ::std::set<String> tests;
+ for (const char* names = registered_tests; names != NULL;
+ names = SkipComma(names)) {
+ const String name = GetPrefixUntilComma(names);
+ if (tests.count(name) != 0) {
+ errors << "Test " << name << " is listed more than once.\n";
+ continue;
+ }
+
+ bool found = false;
+ for (DefinedTestIter it = defined_test_names_.begin();
+ it != defined_test_names_.end();
+ ++it) {
+ if (name == *it) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ tests.insert(name);
+ } else {
+ errors << "No test named " << name
+ << " can be found in this test case.\n";
+ }
+ }
+
+ for (DefinedTestIter it = defined_test_names_.begin();
+ it != defined_test_names_.end();
+ ++it) {
+ if (tests.count(*it) == 0) {
+ errors << "You forgot to list test " << *it << ".\n";
+ }
+ }
+
+ const String& errors_str = errors.GetString();
+ if (errors_str != "") {
+ fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
+ errors_str.c_str());
+ fflush(stderr);
+ posix::Abort();
+ }
+
+ return registered_tests;
+}
+
+#endif // GTEST_HAS_TYPED_TEST_P
+
+} // namespace internal
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest.cc
new file mode 100644
index 0000000..342d458
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest.cc
@@ -0,0 +1,4704 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+//
+// The Google C++ Testing Framework (Google Test)
+
+#include <gtest/gtest.h>
+#include <gtest/gtest-spi.h>
+
+#include <ctype.h>
+#include <math.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include <algorithm>
+#include <ostream>
+#include <sstream>
+#include <vector>
+
+#if GTEST_OS_LINUX
+
+// TODO(kenton@google.com): Use autoconf to detect availability of
+// gettimeofday().
+#define GTEST_HAS_GETTIMEOFDAY_ 1
+
+#include <fcntl.h>
+#include <limits.h>
+#include <sched.h>
+// Declares vsnprintf(). This header is not available on Windows.
+#include <strings.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <string>
+#include <vector>
+
+#elif GTEST_OS_SYMBIAN
+#define GTEST_HAS_GETTIMEOFDAY_ 1
+#include <sys/time.h> // NOLINT
+
+#elif GTEST_OS_ZOS
+#define GTEST_HAS_GETTIMEOFDAY_ 1
+#include <sys/time.h> // NOLINT
+
+// On z/OS we additionally need strings.h for strcasecmp.
+#include <strings.h> // NOLINT
+
+#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE.
+
+#include <windows.h> // NOLINT
+
+#elif GTEST_OS_WINDOWS // We are on Windows proper.
+
+#include <io.h> // NOLINT
+#include <sys/timeb.h> // NOLINT
+#include <sys/types.h> // NOLINT
+#include <sys/stat.h> // NOLINT
+
+#if GTEST_OS_WINDOWS_MINGW
+// MinGW has gettimeofday() but not _ftime64().
+// TODO(kenton@google.com): Use autoconf to detect availability of
+// gettimeofday().
+// TODO(kenton@google.com): There are other ways to get the time on
+// Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW
+// supports these. consider using them instead.
+#define GTEST_HAS_GETTIMEOFDAY_ 1
+#include <sys/time.h> // NOLINT
+#endif // GTEST_OS_WINDOWS_MINGW
+
+// cpplint thinks that the header is already included, so we want to
+// silence it.
+#include <windows.h> // NOLINT
+
+#else
+
+// Assume other platforms have gettimeofday().
+// TODO(kenton@google.com): Use autoconf to detect availability of
+// gettimeofday().
+#define GTEST_HAS_GETTIMEOFDAY_ 1
+
+// cpplint thinks that the header is already included, so we want to
+// silence it.
+#include <sys/time.h> // NOLINT
+#include <unistd.h> // NOLINT
+
+#endif // GTEST_OS_LINUX
+
+#if GTEST_HAS_EXCEPTIONS
+#include <stdexcept>
+#endif
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+#if GTEST_OS_WINDOWS
+#define vsnprintf _vsnprintf
+#endif // GTEST_OS_WINDOWS
+
+namespace testing {
+
+using internal::CountIf;
+using internal::ForEach;
+using internal::GetElementOr;
+using internal::Shuffle;
+
+// Constants.
+
+// A test whose test case name or test name matches this filter is
+// disabled and not run.
+static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*";
+
+// A test case whose name matches this filter is considered a death
+// test case and will be run before test cases whose name doesn't
+// match this filter.
+static const char kDeathTestCaseFilter[] = "*DeathTest:*DeathTest/*";
+
+// A test filter that matches everything.
+static const char kUniversalFilter[] = "*";
+
+// The default output file for XML output.
+static const char kDefaultOutputFile[] = "test_detail.xml";
+
+// The environment variable name for the test shard index.
+static const char kTestShardIndex[] = "GTEST_SHARD_INDEX";
+// The environment variable name for the total number of test shards.
+static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS";
+// The environment variable name for the test shard status file.
+static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE";
+
+namespace internal {
+
+// The text used in failure messages to indicate the start of the
+// stack trace.
+const char kStackTraceMarker[] = "\nStack trace:\n";
+
+// g_help_flag is true iff the --help flag or an equivalent form is
+// specified on the command line.
+bool g_help_flag = false;
+
+} // namespace internal
+
+GTEST_DEFINE_bool_(
+ also_run_disabled_tests,
+ internal::BoolFromGTestEnv("also_run_disabled_tests", false),
+ "Run disabled tests too, in addition to the tests normally being run.");
+
+GTEST_DEFINE_bool_(
+ break_on_failure,
+ internal::BoolFromGTestEnv("break_on_failure", false),
+ "True iff a failed assertion should be a debugger break-point.");
+
+GTEST_DEFINE_bool_(
+ catch_exceptions,
+ internal::BoolFromGTestEnv("catch_exceptions", false),
+ "True iff " GTEST_NAME_
+ " should catch exceptions and treat them as test failures.");
+
+GTEST_DEFINE_string_(
+ color,
+ internal::StringFromGTestEnv("color", "auto"),
+ "Whether to use colors in the output. Valid values: yes, no, "
+ "and auto. 'auto' means to use colors if the output is "
+ "being sent to a terminal and the TERM environment variable "
+ "is set to xterm, xterm-color, xterm-256color, linux or cygwin.");
+
+GTEST_DEFINE_string_(
+ filter,
+ internal::StringFromGTestEnv("filter", kUniversalFilter),
+ "A colon-separated list of glob (not regex) patterns "
+ "for filtering the tests to run, optionally followed by a "
+ "'-' and a : separated list of negative patterns (tests to "
+ "exclude). A test is run if it matches one of the positive "
+ "patterns and does not match any of the negative patterns.");
+
+GTEST_DEFINE_bool_(list_tests, false,
+ "List all tests without running them.");
+
+GTEST_DEFINE_string_(
+ output,
+ internal::StringFromGTestEnv("output", ""),
+ "A format (currently must be \"xml\"), optionally followed "
+ "by a colon and an output file name or directory. A directory "
+ "is indicated by a trailing pathname separator. "
+ "Examples: \"xml:filename.xml\", \"xml::directoryname/\". "
+ "If a directory is specified, output files will be created "
+ "within that directory, with file-names based on the test "
+ "executable's name and, if necessary, made unique by adding "
+ "digits.");
+
+GTEST_DEFINE_bool_(
+ print_time,
+ internal::BoolFromGTestEnv("print_time", true),
+ "True iff " GTEST_NAME_
+ " should display elapsed time in text output.");
+
+GTEST_DEFINE_int32_(
+ random_seed,
+ internal::Int32FromGTestEnv("random_seed", 0),
+ "Random number seed to use when shuffling test orders. Must be in range "
+ "[1, 99999], or 0 to use a seed based on the current time.");
+
+GTEST_DEFINE_int32_(
+ repeat,
+ internal::Int32FromGTestEnv("repeat", 1),
+ "How many times to repeat each test. Specify a negative number "
+ "for repeating forever. Useful for shaking out flaky tests.");
+
+GTEST_DEFINE_bool_(
+ show_internal_stack_frames, false,
+ "True iff " GTEST_NAME_ " should include internal stack frames when "
+ "printing test failure stack traces.");
+
+GTEST_DEFINE_bool_(
+ shuffle,
+ internal::BoolFromGTestEnv("shuffle", false),
+ "True iff " GTEST_NAME_
+ " should randomize tests' order on every run.");
+
+GTEST_DEFINE_int32_(
+ stack_trace_depth,
+ internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
+ "The maximum number of stack frames to print when an "
+ "assertion fails. The valid range is 0 through 100, inclusive.");
+
+GTEST_DEFINE_bool_(
+ throw_on_failure,
+ internal::BoolFromGTestEnv("throw_on_failure", false),
+ "When this flag is specified, a failed assertion will throw an exception "
+ "if exceptions are enabled or exit the program with a non-zero code "
+ "otherwise.");
+
+namespace internal {
+
+// Generates a random number from [0, range), using a Linear
+// Congruential Generator (LCG). Crashes if 'range' is 0 or greater
+// than kMaxRange.
+UInt32 Random::Generate(UInt32 range) {
+ // These constants are the same as are used in glibc's rand(3).
+ state_ = (1103515245U*state_ + 12345U) % kMaxRange;
+
+ GTEST_CHECK_(range > 0)
+ << "Cannot generate a number in the range [0, 0).";
+ GTEST_CHECK_(range <= kMaxRange)
+ << "Generation of a number in [0, " << range << ") was requested, "
+ << "but this can only generate numbers in [0, " << kMaxRange << ").";
+
+ // Converting via modulus introduces a bit of downward bias, but
+ // it's simple, and a linear congruential generator isn't too good
+ // to begin with.
+ return state_ % range;
+}
+
+// GTestIsInitialized() returns true iff the user has initialized
+// Google Test. Useful for catching the user mistake of not initializing
+// Google Test before calling RUN_ALL_TESTS().
+//
+// A user must call testing::InitGoogleTest() to initialize Google
+// Test. g_init_gtest_count is set to the number of times
+// InitGoogleTest() has been called. We don't protect this variable
+// under a mutex as it is only accessed in the main thread.
+int g_init_gtest_count = 0;
+static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
+
+// Iterates over a vector of TestCases, keeping a running sum of the
+// results of calling a given int-returning method on each.
+// Returns the sum.
+static int SumOverTestCaseList(const std::vector<TestCase*>& case_list,
+ int (TestCase::*method)() const) {
+ int sum = 0;
+ for (size_t i = 0; i < case_list.size(); i++) {
+ sum += (case_list[i]->*method)();
+ }
+ return sum;
+}
+
+// Returns true iff the test case passed.
+static bool TestCasePassed(const TestCase* test_case) {
+ return test_case->should_run() && test_case->Passed();
+}
+
+// Returns true iff the test case failed.
+static bool TestCaseFailed(const TestCase* test_case) {
+ return test_case->should_run() && test_case->Failed();
+}
+
+// Returns true iff test_case contains at least one test that should
+// run.
+static bool ShouldRunTestCase(const TestCase* test_case) {
+ return test_case->should_run();
+}
+
+// AssertHelper constructor.
+AssertHelper::AssertHelper(TestPartResult::Type type,
+ const char* file,
+ int line,
+ const char* message)
+ : data_(new AssertHelperData(type, file, line, message)) {
+}
+
+AssertHelper::~AssertHelper() {
+ delete data_;
+}
+
+// Message assignment, for assertion streaming support.
+void AssertHelper::operator=(const Message& message) const {
+ UnitTest::GetInstance()->
+ AddTestPartResult(data_->type, data_->file, data_->line,
+ AppendUserMessage(data_->message, message),
+ UnitTest::GetInstance()->impl()
+ ->CurrentOsStackTraceExceptTop(1)
+ // Skips the stack frame for this function itself.
+ ); // NOLINT
+}
+
+// Mutex for linked pointers.
+GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
+
+// Application pathname gotten in InitGoogleTest.
+String g_executable_path;
+
+// Returns the current application's name, removing directory path if that
+// is present.
+FilePath GetCurrentExecutableName() {
+ FilePath result;
+
+#if GTEST_OS_WINDOWS
+ result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
+#else
+ result.Set(FilePath(g_executable_path));
+#endif // GTEST_OS_WINDOWS
+
+ return result.RemoveDirectoryName();
+}
+
+// Functions for processing the gtest_output flag.
+
+// Returns the output format, or "" for normal printed output.
+String UnitTestOptions::GetOutputFormat() {
+ const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
+ if (gtest_output_flag == NULL) return String("");
+
+ const char* const colon = strchr(gtest_output_flag, ':');
+ return (colon == NULL) ?
+ String(gtest_output_flag) :
+ String(gtest_output_flag, colon - gtest_output_flag);
+}
+
+// Returns the name of the requested output file, or the default if none
+// was explicitly specified.
+String UnitTestOptions::GetAbsolutePathToOutputFile() {
+ const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
+ if (gtest_output_flag == NULL)
+ return String("");
+
+ const char* const colon = strchr(gtest_output_flag, ':');
+ if (colon == NULL)
+ return String(internal::FilePath::ConcatPaths(
+ internal::FilePath(
+ UnitTest::GetInstance()->original_working_dir()),
+ internal::FilePath(kDefaultOutputFile)).ToString() );
+
+ internal::FilePath output_name(colon + 1);
+ if (!output_name.IsAbsolutePath())
+ // TODO(wan@google.com): on Windows \some\path is not an absolute
+ // path (as its meaning depends on the current drive), yet the
+ // following logic for turning it into an absolute path is wrong.
+ // Fix it.
+ output_name = internal::FilePath::ConcatPaths(
+ internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
+ internal::FilePath(colon + 1));
+
+ if (!output_name.IsDirectory())
+ return output_name.ToString();
+
+ internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
+ output_name, internal::GetCurrentExecutableName(),
+ GetOutputFormat().c_str()));
+ return result.ToString();
+}
+
+// Returns true iff the wildcard pattern matches the string. The
+// first ':' or '\0' character in pattern marks the end of it.
+//
+// This recursive algorithm isn't very efficient, but is clear and
+// works well enough for matching test names, which are short.
+bool UnitTestOptions::PatternMatchesString(const char *pattern,
+ const char *str) {
+ switch (*pattern) {
+ case '\0':
+ case ':': // Either ':' or '\0' marks the end of the pattern.
+ return *str == '\0';
+ case '?': // Matches any single character.
+ return *str != '\0' && PatternMatchesString(pattern + 1, str + 1);
+ case '*': // Matches any string (possibly empty) of characters.
+ return (*str != '\0' && PatternMatchesString(pattern, str + 1)) ||
+ PatternMatchesString(pattern + 1, str);
+ default: // Non-special character. Matches itself.
+ return *pattern == *str &&
+ PatternMatchesString(pattern + 1, str + 1);
+ }
+}
+
+bool UnitTestOptions::MatchesFilter(const String& name, const char* filter) {
+ const char *cur_pattern = filter;
+ for (;;) {
+ if (PatternMatchesString(cur_pattern, name.c_str())) {
+ return true;
+ }
+
+ // Finds the next pattern in the filter.
+ cur_pattern = strchr(cur_pattern, ':');
+
+ // Returns if no more pattern can be found.
+ if (cur_pattern == NULL) {
+ return false;
+ }
+
+ // Skips the pattern separater (the ':' character).
+ cur_pattern++;
+ }
+}
+
+// TODO(keithray): move String function implementations to gtest-string.cc.
+
+// Returns true iff the user-specified filter matches the test case
+// name and the test name.
+bool UnitTestOptions::FilterMatchesTest(const String &test_case_name,
+ const String &test_name) {
+ const String& full_name = String::Format("%s.%s",
+ test_case_name.c_str(),
+ test_name.c_str());
+
+ // Split --gtest_filter at '-', if there is one, to separate into
+ // positive filter and negative filter portions
+ const char* const p = GTEST_FLAG(filter).c_str();
+ const char* const dash = strchr(p, '-');
+ String positive;
+ String negative;
+ if (dash == NULL) {
+ positive = GTEST_FLAG(filter).c_str(); // Whole string is a positive filter
+ negative = String("");
+ } else {
+ positive = String(p, dash - p); // Everything up to the dash
+ negative = String(dash+1); // Everything after the dash
+ if (positive.empty()) {
+ // Treat '-test1' as the same as '*-test1'
+ positive = kUniversalFilter;
+ }
+ }
+
+ // A filter is a colon-separated list of patterns. It matches a
+ // test if any pattern in it matches the test.
+ return (MatchesFilter(full_name, positive.c_str()) &&
+ !MatchesFilter(full_name, negative.c_str()));
+}
+
+#if GTEST_OS_WINDOWS
+// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
+// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
+// This function is useful as an __except condition.
+int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {
+ // Google Test should handle an exception if:
+ // 1. the user wants it to, AND
+ // 2. this is not a breakpoint exception.
+ return (GTEST_FLAG(catch_exceptions) &&
+ exception_code != EXCEPTION_BREAKPOINT) ?
+ EXCEPTION_EXECUTE_HANDLER :
+ EXCEPTION_CONTINUE_SEARCH;
+}
+#endif // GTEST_OS_WINDOWS
+
+} // namespace internal
+
+// The c'tor sets this object as the test part result reporter used by
+// Google Test. The 'result' parameter specifies where to report the
+// results. Intercepts only failures from the current thread.
+ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
+ TestPartResultArray* result)
+ : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
+ result_(result) {
+ Init();
+}
+
+// The c'tor sets this object as the test part result reporter used by
+// Google Test. The 'result' parameter specifies where to report the
+// results.
+ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
+ InterceptMode intercept_mode, TestPartResultArray* result)
+ : intercept_mode_(intercept_mode),
+ result_(result) {
+ Init();
+}
+
+void ScopedFakeTestPartResultReporter::Init() {
+ internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+ if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
+ old_reporter_ = impl->GetGlobalTestPartResultReporter();
+ impl->SetGlobalTestPartResultReporter(this);
+ } else {
+ old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();
+ impl->SetTestPartResultReporterForCurrentThread(this);
+ }
+}
+
+// The d'tor restores the test part result reporter used by Google Test
+// before.
+ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
+ internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+ if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
+ impl->SetGlobalTestPartResultReporter(old_reporter_);
+ } else {
+ impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
+ }
+}
+
+// Increments the test part result count and remembers the result.
+// This method is from the TestPartResultReporterInterface interface.
+void ScopedFakeTestPartResultReporter::ReportTestPartResult(
+ const TestPartResult& result) {
+ result_->Append(result);
+}
+
+namespace internal {
+
+// Returns the type ID of ::testing::Test. We should always call this
+// instead of GetTypeId< ::testing::Test>() to get the type ID of
+// testing::Test. This is to work around a suspected linker bug when
+// using Google Test as a framework on Mac OS X. The bug causes
+// GetTypeId< ::testing::Test>() to return different values depending
+// on whether the call is from the Google Test framework itself or
+// from user test code. GetTestTypeId() is guaranteed to always
+// return the same value, as it always calls GetTypeId<>() from the
+// gtest.cc, which is within the Google Test framework.
+TypeId GetTestTypeId() {
+ return GetTypeId<Test>();
+}
+
+// The value of GetTestTypeId() as seen from within the Google Test
+// library. This is solely for testing GetTestTypeId().
+extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
+
+// This predicate-formatter checks that 'results' contains a test part
+// failure of the given type and that the failure message contains the
+// given substring.
+AssertionResult HasOneFailure(const char* /* results_expr */,
+ const char* /* type_expr */,
+ const char* /* substr_expr */,
+ const TestPartResultArray& results,
+ TestPartResult::Type type,
+ const char* substr) {
+ const String expected(type == TestPartResult::kFatalFailure ?
+ "1 fatal failure" :
+ "1 non-fatal failure");
+ Message msg;
+ if (results.size() != 1) {
+ msg << "Expected: " << expected << "\n"
+ << " Actual: " << results.size() << " failures";
+ for (int i = 0; i < results.size(); i++) {
+ msg << "\n" << results.GetTestPartResult(i);
+ }
+ return AssertionFailure(msg);
+ }
+
+ const TestPartResult& r = results.GetTestPartResult(0);
+ if (r.type() != type) {
+ msg << "Expected: " << expected << "\n"
+ << " Actual:\n"
+ << r;
+ return AssertionFailure(msg);
+ }
+
+ if (strstr(r.message(), substr) == NULL) {
+ msg << "Expected: " << expected << " containing \""
+ << substr << "\"\n"
+ << " Actual:\n"
+ << r;
+ return AssertionFailure(msg);
+ }
+
+ return AssertionSuccess();
+}
+
+// The constructor of SingleFailureChecker remembers where to look up
+// test part results, what type of failure we expect, and what
+// substring the failure message should contain.
+SingleFailureChecker:: SingleFailureChecker(
+ const TestPartResultArray* results,
+ TestPartResult::Type type,
+ const char* substr)
+ : results_(results),
+ type_(type),
+ substr_(substr) {}
+
+// The destructor of SingleFailureChecker verifies that the given
+// TestPartResultArray contains exactly one failure that has the given
+// type and contains the given substring. If that's not the case, a
+// non-fatal failure will be generated.
+SingleFailureChecker::~SingleFailureChecker() {
+ EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_.c_str());
+}
+
+DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(
+ UnitTestImpl* unit_test) : unit_test_(unit_test) {}
+
+void DefaultGlobalTestPartResultReporter::ReportTestPartResult(
+ const TestPartResult& result) {
+ unit_test_->current_test_result()->AddTestPartResult(result);
+ unit_test_->listeners()->repeater()->OnTestPartResult(result);
+}
+
+DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(
+ UnitTestImpl* unit_test) : unit_test_(unit_test) {}
+
+void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
+ const TestPartResult& result) {
+ unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);
+}
+
+// Returns the global test part result reporter.
+TestPartResultReporterInterface*
+UnitTestImpl::GetGlobalTestPartResultReporter() {
+ internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
+ return global_test_part_result_repoter_;
+}
+
+// Sets the global test part result reporter.
+void UnitTestImpl::SetGlobalTestPartResultReporter(
+ TestPartResultReporterInterface* reporter) {
+ internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
+ global_test_part_result_repoter_ = reporter;
+}
+
+// Returns the test part result reporter for the current thread.
+TestPartResultReporterInterface*
+UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
+ return per_thread_test_part_result_reporter_.get();
+}
+
+// Sets the test part result reporter for the current thread.
+void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
+ TestPartResultReporterInterface* reporter) {
+ per_thread_test_part_result_reporter_.set(reporter);
+}
+
+// Gets the number of successful test cases.
+int UnitTestImpl::successful_test_case_count() const {
+ return CountIf(test_cases_, TestCasePassed);
+}
+
+// Gets the number of failed test cases.
+int UnitTestImpl::failed_test_case_count() const {
+ return CountIf(test_cases_, TestCaseFailed);
+}
+
+// Gets the number of all test cases.
+int UnitTestImpl::total_test_case_count() const {
+ return static_cast<int>(test_cases_.size());
+}
+
+// Gets the number of all test cases that contain at least one test
+// that should run.
+int UnitTestImpl::test_case_to_run_count() const {
+ return CountIf(test_cases_, ShouldRunTestCase);
+}
+
+// Gets the number of successful tests.
+int UnitTestImpl::successful_test_count() const {
+ return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);
+}
+
+// Gets the number of failed tests.
+int UnitTestImpl::failed_test_count() const {
+ return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);
+}
+
+// Gets the number of disabled tests.
+int UnitTestImpl::disabled_test_count() const {
+ return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);
+}
+
+// Gets the number of all tests.
+int UnitTestImpl::total_test_count() const {
+ return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);
+}
+
+// Gets the number of tests that should run.
+int UnitTestImpl::test_to_run_count() const {
+ return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);
+}
+
+// Returns the current OS stack trace as a String.
+//
+// The maximum number of stack frames to be included is specified by
+// the gtest_stack_trace_depth flag. The skip_count parameter
+// specifies the number of top frames to be skipped, which doesn't
+// count against the number of frames to be included.
+//
+// For example, if Foo() calls Bar(), which in turn calls
+// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
+// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
+String UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
+ (void)skip_count;
+ return String("");
+}
+
+// Returns the current time in milliseconds.
+TimeInMillis GetTimeInMillis() {
+#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)
+ // Difference between 1970-01-01 and 1601-01-01 in milliseconds.
+ // http://analogous.blogspot.com/2005/04/epoch.html
+ const TimeInMillis kJavaEpochToWinFileTimeDelta =
+ static_cast<TimeInMillis>(116444736UL) * 100000UL;
+ const DWORD kTenthMicrosInMilliSecond = 10000;
+
+ SYSTEMTIME now_systime;
+ FILETIME now_filetime;
+ ULARGE_INTEGER now_int64;
+ // TODO(kenton@google.com): Shouldn't this just use
+ // GetSystemTimeAsFileTime()?
+ GetSystemTime(&now_systime);
+ if (SystemTimeToFileTime(&now_systime, &now_filetime)) {
+ now_int64.LowPart = now_filetime.dwLowDateTime;
+ now_int64.HighPart = now_filetime.dwHighDateTime;
+ now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -
+ kJavaEpochToWinFileTimeDelta;
+ return now_int64.QuadPart;
+ }
+ return 0;
+#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
+ __timeb64 now;
+#ifdef _MSC_VER
+ // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
+ // (deprecated function) there.
+ // TODO(kenton@google.com): Use GetTickCount()? Or use
+ // SystemTimeToFileTime()
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4996) // Temporarily disables warning 4996.
+ _ftime64(&now);
+#pragma warning(pop) // Restores the warning state.
+#else
+ _ftime64(&now);
+#endif // _MSC_VER
+ return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
+#elif GTEST_HAS_GETTIMEOFDAY_
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
+#else
+#error "Don't know how to get the current time on your system."
+#endif
+}
+
+// Utilities
+
+// class String
+
+// Returns the input enclosed in double quotes if it's not NULL;
+// otherwise returns "(null)". For example, "\"Hello\"" is returned
+// for input "Hello".
+//
+// This is useful for printing a C string in the syntax of a literal.
+//
+// Known issue: escape sequences are not handled yet.
+String String::ShowCStringQuoted(const char* c_str) {
+ return c_str ? String::Format("\"%s\"", c_str) : String("(null)");
+}
+
+// Copies at most length characters from str into a newly-allocated
+// piece of memory of size length+1. The memory is allocated with new[].
+// A terminating null byte is written to the memory, and a pointer to it
+// is returned. If str is NULL, NULL is returned.
+static char* CloneString(const char* str, size_t length) {
+ if (str == NULL) {
+ return NULL;
+ } else {
+ char* const clone = new char[length + 1];
+ posix::StrNCpy(clone, str, length);
+ clone[length] = '\0';
+ return clone;
+ }
+}
+
+// Clones a 0-terminated C string, allocating memory using new. The
+// caller is responsible for deleting[] the return value. Returns the
+// cloned string, or NULL if the input is NULL.
+const char * String::CloneCString(const char* c_str) {
+ return (c_str == NULL) ?
+ NULL : CloneString(c_str, strlen(c_str));
+}
+
+#if GTEST_OS_WINDOWS_MOBILE
+// Creates a UTF-16 wide string from the given ANSI string, allocating
+// memory using new. The caller is responsible for deleting the return
+// value using delete[]. Returns the wide string, or NULL if the
+// input is NULL.
+LPCWSTR String::AnsiToUtf16(const char* ansi) {
+ if (!ansi) return NULL;
+ const int length = strlen(ansi);
+ const int unicode_length =
+ MultiByteToWideChar(CP_ACP, 0, ansi, length,
+ NULL, 0);
+ WCHAR* unicode = new WCHAR[unicode_length + 1];
+ MultiByteToWideChar(CP_ACP, 0, ansi, length,
+ unicode, unicode_length);
+ unicode[unicode_length] = 0;
+ return unicode;
+}
+
+// Creates an ANSI string from the given wide string, allocating
+// memory using new. The caller is responsible for deleting the return
+// value using delete[]. Returns the ANSI string, or NULL if the
+// input is NULL.
+const char* String::Utf16ToAnsi(LPCWSTR utf16_str) {
+ if (!utf16_str) return NULL;
+ const int ansi_length =
+ WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
+ NULL, 0, NULL, NULL);
+ char* ansi = new char[ansi_length + 1];
+ WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
+ ansi, ansi_length, NULL, NULL);
+ ansi[ansi_length] = 0;
+ return ansi;
+}
+
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+// Compares two C strings. Returns true iff they have the same content.
+//
+// Unlike strcmp(), this function can handle NULL argument(s). A NULL
+// C string is considered different to any non-NULL C string,
+// including the empty string.
+bool String::CStringEquals(const char * lhs, const char * rhs) {
+ if ( lhs == NULL ) return rhs == NULL;
+
+ if ( rhs == NULL ) return false;
+
+ return strcmp(lhs, rhs) == 0;
+}
+
+#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
+
+// Converts an array of wide chars to a narrow string using the UTF-8
+// encoding, and streams the result to the given Message object.
+static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
+ Message* msg) {
+ // TODO(wan): consider allowing a testing::String object to
+ // contain '\0'. This will make it behave more like std::string,
+ // and will allow ToUtf8String() to return the correct encoding
+ // for '\0' s.t. we can get rid of the conditional here (and in
+ // several other places).
+ for (size_t i = 0; i != length; ) { // NOLINT
+ if (wstr[i] != L'\0') {
+ *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));
+ while (i != length && wstr[i] != L'\0')
+ i++;
+ } else {
+ *msg << '\0';
+ i++;
+ }
+ }
+}
+
+#endif // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
+
+} // namespace internal
+
+#if GTEST_HAS_STD_WSTRING
+// Converts the given wide string to a narrow string using the UTF-8
+// encoding, and streams the result to this Message object.
+Message& Message::operator <<(const ::std::wstring& wstr) {
+ internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
+ return *this;
+}
+#endif // GTEST_HAS_STD_WSTRING
+
+#if GTEST_HAS_GLOBAL_WSTRING
+// Converts the given wide string to a narrow string using the UTF-8
+// encoding, and streams the result to this Message object.
+Message& Message::operator <<(const ::wstring& wstr) {
+ internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
+ return *this;
+}
+#endif // GTEST_HAS_GLOBAL_WSTRING
+
+namespace internal {
+
+// Formats a value to be used in a failure message.
+
+// For a char value, we print it as a C++ char literal and as an
+// unsigned integer (both in decimal and in hexadecimal).
+String FormatForFailureMessage(char ch) {
+ const unsigned int ch_as_uint = ch;
+ // A String object cannot contain '\0', so we print "\\0" when ch is
+ // '\0'.
+ return String::Format("'%s' (%u, 0x%X)",
+ ch ? String::Format("%c", ch).c_str() : "\\0",
+ ch_as_uint, ch_as_uint);
+}
+
+// For a wchar_t value, we print it as a C++ wchar_t literal and as an
+// unsigned integer (both in decimal and in hexidecimal).
+String FormatForFailureMessage(wchar_t wchar) {
+ // The C++ standard doesn't specify the exact size of the wchar_t
+ // type. It just says that it shall have the same size as another
+ // integral type, called its underlying type.
+ //
+ // Therefore, in order to print a wchar_t value in the numeric form,
+ // we first convert it to the largest integral type (UInt64) and
+ // then print the converted value.
+ //
+ // We use streaming to print the value as "%llu" doesn't work
+ // correctly with MSVC 7.1.
+ const UInt64 wchar_as_uint64 = wchar;
+ Message msg;
+ // A String object cannot contain '\0', so we print "\\0" when wchar is
+ // L'\0'.
+ char buffer[32]; // CodePointToUtf8 requires a buffer that big.
+ msg << "L'"
+ << (wchar ? CodePointToUtf8(static_cast<UInt32>(wchar), buffer) : "\\0")
+ << "' (" << wchar_as_uint64 << ", 0x" << ::std::setbase(16)
+ << wchar_as_uint64 << ")";
+ return msg.GetString();
+}
+
+} // namespace internal
+
+// AssertionResult constructors.
+// Used in EXPECT_TRUE/FALSE(assertion_result).
+AssertionResult::AssertionResult(const AssertionResult& other)
+ : success_(other.success_),
+ message_(other.message_.get() != NULL ?
+ new internal::String(*other.message_) :
+ static_cast<internal::String*>(NULL)) {
+}
+
+// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
+AssertionResult AssertionResult::operator!() const {
+ AssertionResult negation(!success_);
+ if (message_.get() != NULL)
+ negation << *message_;
+ return negation;
+}
+
+// Makes a successful assertion result.
+AssertionResult AssertionSuccess() {
+ return AssertionResult(true);
+}
+
+// Makes a failed assertion result.
+AssertionResult AssertionFailure() {
+ return AssertionResult(false);
+}
+
+// Makes a failed assertion result with the given failure message.
+// Deprecated; use AssertionFailure() << message.
+AssertionResult AssertionFailure(const Message& message) {
+ return AssertionFailure() << message;
+}
+
+namespace internal {
+
+// Constructs and returns the message for an equality assertion
+// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
+//
+// The first four parameters are the expressions used in the assertion
+// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
+// where foo is 5 and bar is 6, we have:
+//
+// expected_expression: "foo"
+// actual_expression: "bar"
+// expected_value: "5"
+// actual_value: "6"
+//
+// The ignoring_case parameter is true iff the assertion is a
+// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
+// be inserted into the message.
+AssertionResult EqFailure(const char* expected_expression,
+ const char* actual_expression,
+ const String& expected_value,
+ const String& actual_value,
+ bool ignoring_case) {
+ Message msg;
+ msg << "Value of: " << actual_expression;
+ if (actual_value != actual_expression) {
+ msg << "\n Actual: " << actual_value;
+ }
+
+ msg << "\nExpected: " << expected_expression;
+ if (ignoring_case) {
+ msg << " (ignoring case)";
+ }
+ if (expected_value != expected_expression) {
+ msg << "\nWhich is: " << expected_value;
+ }
+
+ return AssertionFailure(msg);
+}
+
+// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
+String GetBoolAssertionFailureMessage(const AssertionResult& assertion_result,
+ const char* expression_text,
+ const char* actual_predicate_value,
+ const char* expected_predicate_value) {
+ const char* actual_message = assertion_result.message();
+ Message msg;
+ msg << "Value of: " << expression_text
+ << "\n Actual: " << actual_predicate_value;
+ if (actual_message[0] != '\0')
+ msg << " (" << actual_message << ")";
+ msg << "\nExpected: " << expected_predicate_value;
+ return msg.GetString();
+}
+
+// Helper function for implementing ASSERT_NEAR.
+AssertionResult DoubleNearPredFormat(const char* expr1,
+ const char* expr2,
+ const char* abs_error_expr,
+ double val1,
+ double val2,
+ double abs_error) {
+ const double diff = fabs(val1 - val2);
+ if (diff <= abs_error) return AssertionSuccess();
+
+ // TODO(wan): do not print the value of an expression if it's
+ // already a literal.
+ Message msg;
+ msg << "The difference between " << expr1 << " and " << expr2
+ << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
+ << expr1 << " evaluates to " << val1 << ",\n"
+ << expr2 << " evaluates to " << val2 << ", and\n"
+ << abs_error_expr << " evaluates to " << abs_error << ".";
+ return AssertionFailure(msg);
+}
+
+
+// Helper template for implementing FloatLE() and DoubleLE().
+template <typename RawType>
+AssertionResult FloatingPointLE(const char* expr1,
+ const char* expr2,
+ RawType val1,
+ RawType val2) {
+ // Returns success if val1 is less than val2,
+ if (val1 < val2) {
+ return AssertionSuccess();
+ }
+
+ // or if val1 is almost equal to val2.
+ const FloatingPoint<RawType> lhs(val1), rhs(val2);
+ if (lhs.AlmostEquals(rhs)) {
+ return AssertionSuccess();
+ }
+
+ // Note that the above two checks will both fail if either val1 or
+ // val2 is NaN, as the IEEE floating-point standard requires that
+ // any predicate involving a NaN must return false.
+
+ StrStream val1_ss;
+ val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+ << val1;
+
+ StrStream val2_ss;
+ val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+ << val2;
+
+ Message msg;
+ msg << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n"
+ << " Actual: " << StrStreamToString(&val1_ss) << " vs "
+ << StrStreamToString(&val2_ss);
+
+ return AssertionFailure(msg);
+}
+
+} // namespace internal
+
+// Asserts that val1 is less than, or almost equal to, val2. Fails
+// otherwise. In particular, it fails if either val1 or val2 is NaN.
+AssertionResult FloatLE(const char* expr1, const char* expr2,
+ float val1, float val2) {
+ return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);
+}
+
+// Asserts that val1 is less than, or almost equal to, val2. Fails
+// otherwise. In particular, it fails if either val1 or val2 is NaN.
+AssertionResult DoubleLE(const char* expr1, const char* expr2,
+ double val1, double val2) {
+ return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);
+}
+
+namespace internal {
+
+// The helper function for {ASSERT|EXPECT}_EQ with int or enum
+// arguments.
+AssertionResult CmpHelperEQ(const char* expected_expression,
+ const char* actual_expression,
+ BiggestInt expected,
+ BiggestInt actual) {
+ if (expected == actual) {
+ return AssertionSuccess();
+ }
+
+ return EqFailure(expected_expression,
+ actual_expression,
+ FormatForComparisonFailureMessage(expected, actual),
+ FormatForComparisonFailureMessage(actual, expected),
+ false);
+}
+
+// A macro for implementing the helper functions needed to implement
+// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here
+// just to avoid copy-and-paste of similar code.
+#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
+AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
+ BiggestInt val1, BiggestInt val2) {\
+ if (val1 op val2) {\
+ return AssertionSuccess();\
+ } else {\
+ Message msg;\
+ msg << "Expected: (" << expr1 << ") " #op " (" << expr2\
+ << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
+ << " vs " << FormatForComparisonFailureMessage(val2, val1);\
+ return AssertionFailure(msg);\
+ }\
+}
+
+// Implements the helper function for {ASSERT|EXPECT}_NE with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(NE, !=)
+// Implements the helper function for {ASSERT|EXPECT}_LE with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(LE, <=)
+// Implements the helper function for {ASSERT|EXPECT}_LT with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(LT, < )
+// Implements the helper function for {ASSERT|EXPECT}_GE with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(GE, >=)
+// Implements the helper function for {ASSERT|EXPECT}_GT with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(GT, > )
+
+#undef GTEST_IMPL_CMP_HELPER_
+
+// The helper function for {ASSERT|EXPECT}_STREQ.
+AssertionResult CmpHelperSTREQ(const char* expected_expression,
+ const char* actual_expression,
+ const char* expected,
+ const char* actual) {
+ if (String::CStringEquals(expected, actual)) {
+ return AssertionSuccess();
+ }
+
+ return EqFailure(expected_expression,
+ actual_expression,
+ String::ShowCStringQuoted(expected),
+ String::ShowCStringQuoted(actual),
+ false);
+}
+
+// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
+AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
+ const char* actual_expression,
+ const char* expected,
+ const char* actual) {
+ if (String::CaseInsensitiveCStringEquals(expected, actual)) {
+ return AssertionSuccess();
+ }
+
+ return EqFailure(expected_expression,
+ actual_expression,
+ String::ShowCStringQuoted(expected),
+ String::ShowCStringQuoted(actual),
+ true);
+}
+
+// The helper function for {ASSERT|EXPECT}_STRNE.
+AssertionResult CmpHelperSTRNE(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2) {
+ if (!String::CStringEquals(s1, s2)) {
+ return AssertionSuccess();
+ } else {
+ Message msg;
+ msg << "Expected: (" << s1_expression << ") != ("
+ << s2_expression << "), actual: \""
+ << s1 << "\" vs \"" << s2 << "\"";
+ return AssertionFailure(msg);
+ }
+}
+
+// The helper function for {ASSERT|EXPECT}_STRCASENE.
+AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2) {
+ if (!String::CaseInsensitiveCStringEquals(s1, s2)) {
+ return AssertionSuccess();
+ } else {
+ Message msg;
+ msg << "Expected: (" << s1_expression << ") != ("
+ << s2_expression << ") (ignoring case), actual: \""
+ << s1 << "\" vs \"" << s2 << "\"";
+ return AssertionFailure(msg);
+ }
+}
+
+} // namespace internal
+
+namespace {
+
+// Helper functions for implementing IsSubString() and IsNotSubstring().
+
+// This group of overloaded functions return true iff needle is a
+// substring of haystack. NULL is considered a substring of itself
+// only.
+
+bool IsSubstringPred(const char* needle, const char* haystack) {
+ if (needle == NULL || haystack == NULL)
+ return needle == haystack;
+
+ return strstr(haystack, needle) != NULL;
+}
+
+bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {
+ if (needle == NULL || haystack == NULL)
+ return needle == haystack;
+
+ return wcsstr(haystack, needle) != NULL;
+}
+
+// StringType here can be either ::std::string or ::std::wstring.
+template <typename StringType>
+bool IsSubstringPred(const StringType& needle,
+ const StringType& haystack) {
+ return haystack.find(needle) != StringType::npos;
+}
+
+// This function implements either IsSubstring() or IsNotSubstring(),
+// depending on the value of the expected_to_be_substring parameter.
+// StringType here can be const char*, const wchar_t*, ::std::string,
+// or ::std::wstring.
+template <typename StringType>
+AssertionResult IsSubstringImpl(
+ bool expected_to_be_substring,
+ const char* needle_expr, const char* haystack_expr,
+ const StringType& needle, const StringType& haystack) {
+ if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
+ return AssertionSuccess();
+
+ const bool is_wide_string = sizeof(needle[0]) > 1;
+ const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
+ return AssertionFailure(
+ Message()
+ << "Value of: " << needle_expr << "\n"
+ << " Actual: " << begin_string_quote << needle << "\"\n"
+ << "Expected: " << (expected_to_be_substring ? "" : "not ")
+ << "a substring of " << haystack_expr << "\n"
+ << "Which is: " << begin_string_quote << haystack << "\"");
+}
+
+} // namespace
+
+// IsSubstring() and IsNotSubstring() check whether needle is a
+// substring of haystack (NULL is considered a substring of itself
+// only), and return an appropriate error message when they fail.
+
+AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const char* needle, const char* haystack) {
+ return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const wchar_t* needle, const wchar_t* haystack) {
+ return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const char* needle, const char* haystack) {
+ return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const wchar_t* needle, const wchar_t* haystack) {
+ return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::string& needle, const ::std::string& haystack) {
+ return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::string& needle, const ::std::string& haystack) {
+ return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+
+#if GTEST_HAS_STD_WSTRING
+AssertionResult IsSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::wstring& needle, const ::std::wstring& haystack) {
+ return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+ const char* needle_expr, const char* haystack_expr,
+ const ::std::wstring& needle, const ::std::wstring& haystack) {
+ return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+#endif // GTEST_HAS_STD_WSTRING
+
+namespace internal {
+
+#if GTEST_OS_WINDOWS
+
+namespace {
+
+// Helper function for IsHRESULT{SuccessFailure} predicates
+AssertionResult HRESULTFailureHelper(const char* expr,
+ const char* expected,
+ long hr) { // NOLINT
+#if GTEST_OS_WINDOWS_MOBILE
+ // Windows CE doesn't support FormatMessage.
+ const char error_text[] = "";
+#else
+ // Looks up the human-readable system message for the HRESULT code
+ // and since we're not passing any params to FormatMessage, we don't
+ // want inserts expanded.
+ const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS;
+ const DWORD kBufSize = 4096; // String::Format can't exceed this length.
+ // Gets the system's human readable message string for this HRESULT.
+ char error_text[kBufSize] = { '\0' };
+ DWORD message_length = ::FormatMessageA(kFlags,
+ 0, // no source, we're asking system
+ hr, // the error
+ 0, // no line width restrictions
+ error_text, // output buffer
+ kBufSize, // buf size
+ NULL); // no arguments for inserts
+ // Trims tailing white space (FormatMessage leaves a trailing cr-lf)
+ for (; message_length && isspace(error_text[message_length - 1]);
+ --message_length) {
+ error_text[message_length - 1] = '\0';
+ }
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+ const String error_hex(String::Format("0x%08X ", hr));
+ Message msg;
+ msg << "Expected: " << expr << " " << expected << ".\n"
+ << " Actual: " << error_hex << error_text << "\n";
+
+ return ::testing::AssertionFailure(msg);
+}
+
+} // namespace
+
+AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
+ if (SUCCEEDED(hr)) {
+ return AssertionSuccess();
+ }
+ return HRESULTFailureHelper(expr, "succeeds", hr);
+}
+
+AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
+ if (FAILED(hr)) {
+ return AssertionSuccess();
+ }
+ return HRESULTFailureHelper(expr, "fails", hr);
+}
+
+#endif // GTEST_OS_WINDOWS
+
+// Utility functions for encoding Unicode text (wide strings) in
+// UTF-8.
+
+// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8
+// like this:
+//
+// Code-point length Encoding
+// 0 - 7 bits 0xxxxxxx
+// 8 - 11 bits 110xxxxx 10xxxxxx
+// 12 - 16 bits 1110xxxx 10xxxxxx 10xxxxxx
+// 17 - 21 bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+
+// The maximum code-point a one-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) << 7) - 1;
+
+// The maximum code-point a two-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;
+
+// The maximum code-point a three-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;
+
+// The maximum code-point a four-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;
+
+// Chops off the n lowest bits from a bit pattern. Returns the n
+// lowest bits. As a side effect, the original bit pattern will be
+// shifted to the right by n bits.
+inline UInt32 ChopLowBits(UInt32* bits, int n) {
+ const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);
+ *bits >>= n;
+ return low_bits;
+}
+
+// Converts a Unicode code point to a narrow string in UTF-8 encoding.
+// code_point parameter is of type UInt32 because wchar_t may not be
+// wide enough to contain a code point.
+// The output buffer str must containt at least 32 characters.
+// The function returns the address of the output buffer.
+// If the code_point is not a valid Unicode code point
+// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'.
+char* CodePointToUtf8(UInt32 code_point, char* str) {
+ if (code_point <= kMaxCodePoint1) {
+ str[1] = '\0';
+ str[0] = static_cast<char>(code_point); // 0xxxxxxx
+ } else if (code_point <= kMaxCodePoint2) {
+ str[2] = '\0';
+ str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
+ str[0] = static_cast<char>(0xC0 | code_point); // 110xxxxx
+ } else if (code_point <= kMaxCodePoint3) {
+ str[3] = '\0';
+ str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
+ str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
+ str[0] = static_cast<char>(0xE0 | code_point); // 1110xxxx
+ } else if (code_point <= kMaxCodePoint4) {
+ str[4] = '\0';
+ str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
+ str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
+ str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
+ str[0] = static_cast<char>(0xF0 | code_point); // 11110xxx
+ } else {
+ // The longest string String::Format can produce when invoked
+ // with these parameters is 28 character long (not including
+ // the terminating nul character). We are asking for 32 character
+ // buffer just in case. This is also enough for strncpy to
+ // null-terminate the destination string.
+ posix::StrNCpy(
+ str, String::Format("(Invalid Unicode 0x%X)", code_point).c_str(), 32);
+ str[31] = '\0'; // Makes sure no change in the format to strncpy leaves
+ // the result unterminated.
+ }
+ return str;
+}
+
+// The following two functions only make sense if the the system
+// uses UTF-16 for wide string encoding. All supported systems
+// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.
+
+// Determines if the arguments constitute UTF-16 surrogate pair
+// and thus should be combined into a single Unicode code point
+// using CreateCodePointFromUtf16SurrogatePair.
+inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
+ return sizeof(wchar_t) == 2 &&
+ (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
+}
+
+// Creates a Unicode code point from UTF16 surrogate pair.
+inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
+ wchar_t second) {
+ const UInt32 mask = (1 << 10) - 1;
+ return (sizeof(wchar_t) == 2) ?
+ (((first & mask) << 10) | (second & mask)) + 0x10000 :
+ // This function should not be called when the condition is
+ // false, but we provide a sensible default in case it is.
+ static_cast<UInt32>(first);
+}
+
+// Converts a wide string to a narrow string in UTF-8 encoding.
+// The wide string is assumed to have the following encoding:
+// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
+// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
+// Parameter str points to a null-terminated wide string.
+// Parameter num_chars may additionally limit the number
+// of wchar_t characters processed. -1 is used when the entire string
+// should be processed.
+// If the string contains code points that are not valid Unicode code points
+// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
+// and contains invalid UTF-16 surrogate pairs, values in those pairs
+// will be encoded as individual Unicode characters from Basic Normal Plane.
+String WideStringToUtf8(const wchar_t* str, int num_chars) {
+ if (num_chars == -1)
+ num_chars = static_cast<int>(wcslen(str));
+
+ StrStream stream;
+ for (int i = 0; i < num_chars; ++i) {
+ UInt32 unicode_code_point;
+
+ if (str[i] == L'\0') {
+ break;
+ } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {
+ unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],
+ str[i + 1]);
+ i++;
+ } else {
+ unicode_code_point = static_cast<UInt32>(str[i]);
+ }
+
+ char buffer[32]; // CodePointToUtf8 requires a buffer this big.
+ stream << CodePointToUtf8(unicode_code_point, buffer);
+ }
+ return StrStreamToString(&stream);
+}
+
+// Converts a wide C string to a String using the UTF-8 encoding.
+// NULL will be converted to "(null)".
+String String::ShowWideCString(const wchar_t * wide_c_str) {
+ if (wide_c_str == NULL) return String("(null)");
+
+ return String(internal::WideStringToUtf8(wide_c_str, -1).c_str());
+}
+
+// Similar to ShowWideCString(), except that this function encloses
+// the converted string in double quotes.
+String String::ShowWideCStringQuoted(const wchar_t* wide_c_str) {
+ if (wide_c_str == NULL) return String("(null)");
+
+ return String::Format("L\"%s\"",
+ String::ShowWideCString(wide_c_str).c_str());
+}
+
+// Compares two wide C strings. Returns true iff they have the same
+// content.
+//
+// Unlike wcscmp(), this function can handle NULL argument(s). A NULL
+// C string is considered different to any non-NULL C string,
+// including the empty string.
+bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
+ if (lhs == NULL) return rhs == NULL;
+
+ if (rhs == NULL) return false;
+
+ return wcscmp(lhs, rhs) == 0;
+}
+
+// Helper function for *_STREQ on wide strings.
+AssertionResult CmpHelperSTREQ(const char* expected_expression,
+ const char* actual_expression,
+ const wchar_t* expected,
+ const wchar_t* actual) {
+ if (String::WideCStringEquals(expected, actual)) {
+ return AssertionSuccess();
+ }
+
+ return EqFailure(expected_expression,
+ actual_expression,
+ String::ShowWideCStringQuoted(expected),
+ String::ShowWideCStringQuoted(actual),
+ false);
+}
+
+// Helper function for *_STRNE on wide strings.
+AssertionResult CmpHelperSTRNE(const char* s1_expression,
+ const char* s2_expression,
+ const wchar_t* s1,
+ const wchar_t* s2) {
+ if (!String::WideCStringEquals(s1, s2)) {
+ return AssertionSuccess();
+ }
+
+ Message msg;
+ msg << "Expected: (" << s1_expression << ") != ("
+ << s2_expression << "), actual: "
+ << String::ShowWideCStringQuoted(s1)
+ << " vs " << String::ShowWideCStringQuoted(s2);
+ return AssertionFailure(msg);
+}
+
+// Compares two C strings, ignoring case. Returns true iff they have
+// the same content.
+//
+// Unlike strcasecmp(), this function can handle NULL argument(s). A
+// NULL C string is considered different to any non-NULL C string,
+// including the empty string.
+bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {
+ if (lhs == NULL)
+ return rhs == NULL;
+ if (rhs == NULL)
+ return false;
+ return posix::StrCaseCmp(lhs, rhs) == 0;
+}
+
+ // Compares two wide C strings, ignoring case. Returns true iff they
+ // have the same content.
+ //
+ // Unlike wcscasecmp(), this function can handle NULL argument(s).
+ // A NULL C string is considered different to any non-NULL wide C string,
+ // including the empty string.
+ // NB: The implementations on different platforms slightly differ.
+ // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
+ // environment variable. On GNU platform this method uses wcscasecmp
+ // which compares according to LC_CTYPE category of the current locale.
+ // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
+ // current locale.
+bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
+ const wchar_t* rhs) {
+ if ( lhs == NULL ) return rhs == NULL;
+
+ if ( rhs == NULL ) return false;
+
+#if GTEST_OS_WINDOWS
+ return _wcsicmp(lhs, rhs) == 0;
+#elif GTEST_OS_LINUX
+ return wcscasecmp(lhs, rhs) == 0;
+#else
+ // Mac OS X and Cygwin don't define wcscasecmp. Other unknown OSes
+ // may not define it either.
+ wint_t left, right;
+ do {
+ left = towlower(*lhs++);
+ right = towlower(*rhs++);
+ } while (left && left == right);
+ return left == right;
+#endif // OS selector
+}
+
+// Compares this with another String.
+// Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
+// if this is greater than rhs.
+int String::Compare(const String & rhs) const {
+ const char* const lhs_c_str = c_str();
+ const char* const rhs_c_str = rhs.c_str();
+
+ if (lhs_c_str == NULL) {
+ return rhs_c_str == NULL ? 0 : -1; // NULL < anything except NULL
+ } else if (rhs_c_str == NULL) {
+ return 1;
+ }
+
+ const size_t shorter_str_len =
+ length() <= rhs.length() ? length() : rhs.length();
+ for (size_t i = 0; i != shorter_str_len; i++) {
+ if (lhs_c_str[i] < rhs_c_str[i]) {
+ return -1;
+ } else if (lhs_c_str[i] > rhs_c_str[i]) {
+ return 1;
+ }
+ }
+ return (length() < rhs.length()) ? -1 :
+ (length() > rhs.length()) ? 1 : 0;
+}
+
+// Returns true iff this String ends with the given suffix. *Any*
+// String is considered to end with a NULL or empty suffix.
+bool String::EndsWith(const char* suffix) const {
+ if (suffix == NULL || CStringEquals(suffix, "")) return true;
+
+ if (c_str() == NULL) return false;
+
+ const size_t this_len = strlen(c_str());
+ const size_t suffix_len = strlen(suffix);
+ return (this_len >= suffix_len) &&
+ CStringEquals(c_str() + this_len - suffix_len, suffix);
+}
+
+// Returns true iff this String ends with the given suffix, ignoring case.
+// Any String is considered to end with a NULL or empty suffix.
+bool String::EndsWithCaseInsensitive(const char* suffix) const {
+ if (suffix == NULL || CStringEquals(suffix, "")) return true;
+
+ if (c_str() == NULL) return false;
+
+ const size_t this_len = strlen(c_str());
+ const size_t suffix_len = strlen(suffix);
+ return (this_len >= suffix_len) &&
+ CaseInsensitiveCStringEquals(c_str() + this_len - suffix_len, suffix);
+}
+
+// Formats a list of arguments to a String, using the same format
+// spec string as for printf.
+//
+// We do not use the StringPrintf class as it is not universally
+// available.
+//
+// The result is limited to 4096 characters (including the tailing 0).
+// If 4096 characters are not enough to format the input, or if
+// there's an error, "<formatting error or buffer exceeded>" is
+// returned.
+String String::Format(const char * format, ...) {
+ va_list args;
+ va_start(args, format);
+
+ char buffer[4096];
+ const int kBufferSize = sizeof(buffer)/sizeof(buffer[0]);
+
+ // MSVC 8 deprecates vsnprintf(), so we want to suppress warning
+ // 4996 (deprecated function) there.
+#ifdef _MSC_VER // We are using MSVC.
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4996) // Temporarily disables warning 4996.
+ const int size = vsnprintf(buffer, kBufferSize, format, args);
+#pragma warning(pop) // Restores the warning state.
+#else // We are not using MSVC.
+ const int size = vsnprintf(buffer, kBufferSize, format, args);
+#endif // _MSC_VER
+ va_end(args);
+
+ // vsnprintf()'s behavior is not portable. When the buffer is not
+ // big enough, it returns a negative value in MSVC, and returns the
+ // needed buffer size on Linux. When there is an output error, it
+ // always returns a negative value. For simplicity, we lump the two
+ // error cases together.
+ if (size < 0 || size >= kBufferSize) {
+ return String("<formatting error or buffer exceeded>");
+ } else {
+ return String(buffer, size);
+ }
+}
+
+// Converts the buffer in a StrStream to a String, converting NUL
+// bytes to "\\0" along the way.
+String StrStreamToString(StrStream* ss) {
+ const ::std::string& str = ss->str();
+ const char* const start = str.c_str();
+ const char* const end = start + str.length();
+
+ // We need to use a helper StrStream to do this transformation
+ // because String doesn't support push_back().
+ StrStream helper;
+ for (const char* ch = start; ch != end; ++ch) {
+ if (*ch == '\0') {
+ helper << "\\0"; // Replaces NUL with "\\0";
+ } else {
+ helper.put(*ch);
+ }
+ }
+
+ return String(helper.str().c_str());
+}
+
+// Appends the user-supplied message to the Google-Test-generated message.
+String AppendUserMessage(const String& gtest_msg,
+ const Message& user_msg) {
+ // Appends the user message if it's non-empty.
+ const String user_msg_string = user_msg.GetString();
+ if (user_msg_string.empty()) {
+ return gtest_msg;
+ }
+
+ Message msg;
+ msg << gtest_msg << "\n" << user_msg_string;
+
+ return msg.GetString();
+}
+
+} // namespace internal
+
+// class TestResult
+
+// Creates an empty TestResult.
+TestResult::TestResult()
+ : death_test_count_(0),
+ elapsed_time_(0) {
+}
+
+// D'tor.
+TestResult::~TestResult() {
+}
+
+// Returns the i-th test part result among all the results. i can
+// range from 0 to total_part_count() - 1. If i is not in that range,
+// aborts the program.
+const TestPartResult& TestResult::GetTestPartResult(int i) const {
+ if (i < 0 || i >= total_part_count())
+ internal::posix::Abort();
+ return test_part_results_.at(i);
+}
+
+// Returns the i-th test property. i can range from 0 to
+// test_property_count() - 1. If i is not in that range, aborts the
+// program.
+const TestProperty& TestResult::GetTestProperty(int i) const {
+ if (i < 0 || i >= test_property_count())
+ internal::posix::Abort();
+ return test_properties_.at(i);
+}
+
+// Clears the test part results.
+void TestResult::ClearTestPartResults() {
+ test_part_results_.clear();
+}
+
+// Adds a test part result to the list.
+void TestResult::AddTestPartResult(const TestPartResult& test_part_result) {
+ test_part_results_.push_back(test_part_result);
+}
+
+// Adds a test property to the list. If a property with the same key as the
+// supplied property is already represented, the value of this test_property
+// replaces the old value for that key.
+void TestResult::RecordProperty(const TestProperty& test_property) {
+ if (!ValidateTestProperty(test_property)) {
+ return;
+ }
+ internal::MutexLock lock(&test_properites_mutex_);
+ const std::vector<TestProperty>::iterator property_with_matching_key =
+ std::find_if(test_properties_.begin(), test_properties_.end(),
+ internal::TestPropertyKeyIs(test_property.key()));
+ if (property_with_matching_key == test_properties_.end()) {
+ test_properties_.push_back(test_property);
+ return;
+ }
+ property_with_matching_key->SetValue(test_property.value());
+}
+
+// Adds a failure if the key is a reserved attribute of Google Test
+// testcase tags. Returns true if the property is valid.
+bool TestResult::ValidateTestProperty(const TestProperty& test_property) {
+ internal::String key(test_property.key());
+ if (key == "name" || key == "status" || key == "time" || key == "classname") {
+ ADD_FAILURE()
+ << "Reserved key used in RecordProperty(): "
+ << key
+ << " ('name', 'status', 'time', and 'classname' are reserved by "
+ << GTEST_NAME_ << ")";
+ return false;
+ }
+ return true;
+}
+
+// Clears the object.
+void TestResult::Clear() {
+ test_part_results_.clear();
+ test_properties_.clear();
+ death_test_count_ = 0;
+ elapsed_time_ = 0;
+}
+
+// Returns true iff the test failed.
+bool TestResult::Failed() const {
+ for (int i = 0; i < total_part_count(); ++i) {
+ if (GetTestPartResult(i).failed())
+ return true;
+ }
+ return false;
+}
+
+// Returns true iff the test part fatally failed.
+static bool TestPartFatallyFailed(const TestPartResult& result) {
+ return result.fatally_failed();
+}
+
+// Returns true iff the test fatally failed.
+bool TestResult::HasFatalFailure() const {
+ return CountIf(test_part_results_, TestPartFatallyFailed) > 0;
+}
+
+// Returns true iff the test part non-fatally failed.
+static bool TestPartNonfatallyFailed(const TestPartResult& result) {
+ return result.nonfatally_failed();
+}
+
+// Returns true iff the test has a non-fatal failure.
+bool TestResult::HasNonfatalFailure() const {
+ return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;
+}
+
+// Gets the number of all test parts. This is the sum of the number
+// of successful test parts and the number of failed test parts.
+int TestResult::total_part_count() const {
+ return static_cast<int>(test_part_results_.size());
+}
+
+// Returns the number of the test properties.
+int TestResult::test_property_count() const {
+ return static_cast<int>(test_properties_.size());
+}
+
+// class Test
+
+// Creates a Test object.
+
+// The c'tor saves the values of all Google Test flags.
+Test::Test()
+ : gtest_flag_saver_(new internal::GTestFlagSaver) {
+}
+
+// The d'tor restores the values of all Google Test flags.
+Test::~Test() {
+ delete gtest_flag_saver_;
+}
+
+// Sets up the test fixture.
+//
+// A sub-class may override this.
+void Test::SetUp() {
+}
+
+// Tears down the test fixture.
+//
+// A sub-class may override this.
+void Test::TearDown() {
+}
+
+// Allows user supplied key value pairs to be recorded for later output.
+void Test::RecordProperty(const char* key, const char* value) {
+ UnitTest::GetInstance()->RecordPropertyForCurrentTest(key, value);
+}
+
+// Allows user supplied key value pairs to be recorded for later output.
+void Test::RecordProperty(const char* key, int value) {
+ Message value_message;
+ value_message << value;
+ RecordProperty(key, value_message.GetString().c_str());
+}
+
+namespace internal {
+
+void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
+ const String& message) {
+ // This function is a friend of UnitTest and as such has access to
+ // AddTestPartResult.
+ UnitTest::GetInstance()->AddTestPartResult(
+ result_type,
+ NULL, // No info about the source file where the exception occurred.
+ -1, // We have no info on which line caused the exception.
+ message,
+ String()); // No stack trace, either.
+}
+
+} // namespace internal
+
+#if GTEST_OS_WINDOWS
+// We are on Windows.
+
+// Adds an "exception thrown" fatal failure to the current test.
+static void AddExceptionThrownFailure(DWORD exception_code,
+ const char* location) {
+ Message message;
+ message << "Exception thrown with code 0x" << std::setbase(16) <<
+ exception_code << std::setbase(10) << " in " << location << ".";
+
+ internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
+ message.GetString());
+}
+
+#endif // GTEST_OS_WINDOWS
+
+// Google Test requires all tests in the same test case to use the same test
+// fixture class. This function checks if the current test has the
+// same fixture class as the first test in the current test case. If
+// yes, it returns true; otherwise it generates a Google Test failure and
+// returns false.
+bool Test::HasSameFixtureClass() {
+ internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+ const TestCase* const test_case = impl->current_test_case();
+
+ // Info about the first test in the current test case.
+ const internal::TestInfoImpl* const first_test_info =
+ test_case->test_info_list()[0]->impl();
+ const internal::TypeId first_fixture_id = first_test_info->fixture_class_id();
+ const char* const first_test_name = first_test_info->name();
+
+ // Info about the current test.
+ const internal::TestInfoImpl* const this_test_info =
+ impl->current_test_info()->impl();
+ const internal::TypeId this_fixture_id = this_test_info->fixture_class_id();
+ const char* const this_test_name = this_test_info->name();
+
+ if (this_fixture_id != first_fixture_id) {
+ // Is the first test defined using TEST?
+ const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
+ // Is this test defined using TEST?
+ const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
+
+ if (first_is_TEST || this_is_TEST) {
+ // The user mixed TEST and TEST_F in this test case - we'll tell
+ // him/her how to fix it.
+
+ // Gets the name of the TEST and the name of the TEST_F. Note
+ // that first_is_TEST and this_is_TEST cannot both be true, as
+ // the fixture IDs are different for the two tests.
+ const char* const TEST_name =
+ first_is_TEST ? first_test_name : this_test_name;
+ const char* const TEST_F_name =
+ first_is_TEST ? this_test_name : first_test_name;
+
+ ADD_FAILURE()
+ << "All tests in the same test case must use the same test fixture\n"
+ << "class, so mixing TEST_F and TEST in the same test case is\n"
+ << "illegal. In test case " << this_test_info->test_case_name()
+ << ",\n"
+ << "test " << TEST_F_name << " is defined using TEST_F but\n"
+ << "test " << TEST_name << " is defined using TEST. You probably\n"
+ << "want to change the TEST to TEST_F or move it to another test\n"
+ << "case.";
+ } else {
+ // The user defined two fixture classes with the same name in
+ // two namespaces - we'll tell him/her how to fix it.
+ ADD_FAILURE()
+ << "All tests in the same test case must use the same test fixture\n"
+ << "class. However, in test case "
+ << this_test_info->test_case_name() << ",\n"
+ << "you defined test " << first_test_name
+ << " and test " << this_test_name << "\n"
+ << "using two different test fixture classes. This can happen if\n"
+ << "the two classes are from different namespaces or translation\n"
+ << "units and have the same name. You should probably rename one\n"
+ << "of the classes to put the tests into different test cases.";
+ }
+ return false;
+ }
+
+ return true;
+}
+
+// Runs the test and updates the test result.
+void Test::Run() {
+ if (!HasSameFixtureClass()) return;
+
+ internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+#if GTEST_HAS_SEH
+ // Catch SEH-style exceptions.
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ __try {
+ SetUp();
+ } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
+ GetExceptionCode())) {
+ AddExceptionThrownFailure(GetExceptionCode(), "SetUp()");
+ }
+
+ // We will run the test only if SetUp() had no fatal failure.
+ if (!HasFatalFailure()) {
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ __try {
+ TestBody();
+ } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
+ GetExceptionCode())) {
+ AddExceptionThrownFailure(GetExceptionCode(), "the test body");
+ }
+ }
+
+ // However, we want to clean up as much as possible. Hence we will
+ // always call TearDown(), even if SetUp() or the test body has
+ // failed.
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ __try {
+ TearDown();
+ } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
+ GetExceptionCode())) {
+ AddExceptionThrownFailure(GetExceptionCode(), "TearDown()");
+ }
+
+#else // We are on a compiler or platform that doesn't support SEH.
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ SetUp();
+
+ // We will run the test only if SetUp() was successful.
+ if (!HasFatalFailure()) {
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ TestBody();
+ }
+
+ // However, we want to clean up as much as possible. Hence we will
+ // always call TearDown(), even if SetUp() or the test body has
+ // failed.
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ TearDown();
+#endif // GTEST_HAS_SEH
+}
+
+
+// Returns true iff the current test has a fatal failure.
+bool Test::HasFatalFailure() {
+ return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();
+}
+
+// Returns true iff the current test has a non-fatal failure.
+bool Test::HasNonfatalFailure() {
+ return internal::GetUnitTestImpl()->current_test_result()->
+ HasNonfatalFailure();
+}
+
+// class TestInfo
+
+// Constructs a TestInfo object. It assumes ownership of the test factory
+// object via impl_.
+TestInfo::TestInfo(const char* a_test_case_name,
+ const char* a_name,
+ const char* a_test_case_comment,
+ const char* a_comment,
+ internal::TypeId fixture_class_id,
+ internal::TestFactoryBase* factory) {
+ impl_ = new internal::TestInfoImpl(this, a_test_case_name, a_name,
+ a_test_case_comment, a_comment,
+ fixture_class_id, factory);
+}
+
+// Destructs a TestInfo object.
+TestInfo::~TestInfo() {
+ delete impl_;
+}
+
+namespace internal {
+
+// Creates a new TestInfo object and registers it with Google Test;
+// returns the created object.
+//
+// Arguments:
+//
+// test_case_name: name of the test case
+// name: name of the test
+// test_case_comment: a comment on the test case that will be included in
+// the test output
+// comment: a comment on the test that will be included in the
+// test output
+// fixture_class_id: ID of the test fixture class
+// set_up_tc: pointer to the function that sets up the test case
+// tear_down_tc: pointer to the function that tears down the test case
+// factory: pointer to the factory that creates a test object.
+// The newly created TestInfo instance will assume
+// ownership of the factory object.
+TestInfo* MakeAndRegisterTestInfo(
+ const char* test_case_name, const char* name,
+ const char* test_case_comment, const char* comment,
+ TypeId fixture_class_id,
+ SetUpTestCaseFunc set_up_tc,
+ TearDownTestCaseFunc tear_down_tc,
+ TestFactoryBase* factory) {
+ TestInfo* const test_info =
+ new TestInfo(test_case_name, name, test_case_comment, comment,
+ fixture_class_id, factory);
+ GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
+ return test_info;
+}
+
+#if GTEST_HAS_PARAM_TEST
+void ReportInvalidTestCaseType(const char* test_case_name,
+ const char* file, int line) {
+ Message errors;
+ errors
+ << "Attempted redefinition of test case " << test_case_name << ".\n"
+ << "All tests in the same test case must use the same test fixture\n"
+ << "class. However, in test case " << test_case_name << ", you tried\n"
+ << "to define a test using a fixture class different from the one\n"
+ << "used earlier. This can happen if the two fixture classes are\n"
+ << "from different namespaces and have the same name. You should\n"
+ << "probably rename one of the classes to put the tests into different\n"
+ << "test cases.";
+
+ fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
+ errors.GetString().c_str());
+}
+#endif // GTEST_HAS_PARAM_TEST
+
+} // namespace internal
+
+// Returns the test case name.
+const char* TestInfo::test_case_name() const {
+ return impl_->test_case_name();
+}
+
+// Returns the test name.
+const char* TestInfo::name() const {
+ return impl_->name();
+}
+
+// Returns the test case comment.
+const char* TestInfo::test_case_comment() const {
+ return impl_->test_case_comment();
+}
+
+// Returns the test comment.
+const char* TestInfo::comment() const {
+ return impl_->comment();
+}
+
+// Returns true if this test should run.
+bool TestInfo::should_run() const { return impl_->should_run(); }
+
+// Returns true if this test matches the user-specified filter.
+bool TestInfo::matches_filter() const { return impl_->matches_filter(); }
+
+// Returns the result of the test.
+const TestResult* TestInfo::result() const { return impl_->result(); }
+
+// Increments the number of death tests encountered in this test so
+// far.
+int TestInfo::increment_death_test_count() {
+ return impl_->result()->increment_death_test_count();
+}
+
+namespace {
+
+// A predicate that checks the test name of a TestInfo against a known
+// value.
+//
+// This is used for implementation of the TestCase class only. We put
+// it in the anonymous namespace to prevent polluting the outer
+// namespace.
+//
+// TestNameIs is copyable.
+class TestNameIs {
+ public:
+ // Constructor.
+ //
+ // TestNameIs has NO default constructor.
+ explicit TestNameIs(const char* name)
+ : name_(name) {}
+
+ // Returns true iff the test name of test_info matches name_.
+ bool operator()(const TestInfo * test_info) const {
+ return test_info && internal::String(test_info->name()).Compare(name_) == 0;
+ }
+
+ private:
+ internal::String name_;
+};
+
+} // namespace
+
+namespace internal {
+
+// This method expands all parameterized tests registered with macros TEST_P
+// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
+// This will be done just once during the program runtime.
+void UnitTestImpl::RegisterParameterizedTests() {
+#if GTEST_HAS_PARAM_TEST
+ if (!parameterized_tests_registered_) {
+ parameterized_test_registry_.RegisterTests();
+ parameterized_tests_registered_ = true;
+ }
+#endif
+}
+
+// Creates the test object, runs it, records its result, and then
+// deletes it.
+void TestInfoImpl::Run() {
+ if (!should_run_) return;
+
+ // Tells UnitTest where to store test result.
+ UnitTestImpl* const impl = internal::GetUnitTestImpl();
+ impl->set_current_test_info(parent_);
+
+ TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
+
+ // Notifies the unit test event listeners that a test is about to start.
+ repeater->OnTestStart(*parent_);
+
+ const TimeInMillis start = GetTimeInMillis();
+
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+#if GTEST_HAS_SEH
+ // Catch SEH-style exceptions.
+ Test* test = NULL;
+
+ __try {
+ // Creates the test object.
+ test = factory_->CreateTest();
+ } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
+ GetExceptionCode())) {
+ AddExceptionThrownFailure(GetExceptionCode(),
+ "the test fixture's constructor");
+ return;
+ }
+#else // We are on a compiler or platform that doesn't support SEH.
+
+ // TODO(wan): If test->Run() throws, test won't be deleted. This is
+ // not a problem now as we don't use exceptions. If we were to
+ // enable exceptions, we should revise the following to be
+ // exception-safe.
+
+ // Creates the test object.
+ Test* test = factory_->CreateTest();
+#endif // GTEST_HAS_SEH
+
+ // Runs the test only if the constructor of the test fixture didn't
+ // generate a fatal failure.
+ if (!Test::HasFatalFailure()) {
+ test->Run();
+ }
+
+ // Deletes the test object.
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ delete test;
+ test = NULL;
+
+ result_.set_elapsed_time(GetTimeInMillis() - start);
+
+ // Notifies the unit test event listener that a test has just finished.
+ repeater->OnTestEnd(*parent_);
+
+ // Tells UnitTest to stop associating assertion results to this
+ // test.
+ impl->set_current_test_info(NULL);
+}
+
+} // namespace internal
+
+// class TestCase
+
+// Gets the number of successful tests in this test case.
+int TestCase::successful_test_count() const {
+ return CountIf(test_info_list_, TestPassed);
+}
+
+// Gets the number of failed tests in this test case.
+int TestCase::failed_test_count() const {
+ return CountIf(test_info_list_, TestFailed);
+}
+
+int TestCase::disabled_test_count() const {
+ return CountIf(test_info_list_, TestDisabled);
+}
+
+// Get the number of tests in this test case that should run.
+int TestCase::test_to_run_count() const {
+ return CountIf(test_info_list_, ShouldRunTest);
+}
+
+// Gets the number of all tests.
+int TestCase::total_test_count() const {
+ return static_cast<int>(test_info_list_.size());
+}
+
+// Creates a TestCase with the given name.
+//
+// Arguments:
+//
+// name: name of the test case
+// set_up_tc: pointer to the function that sets up the test case
+// tear_down_tc: pointer to the function that tears down the test case
+TestCase::TestCase(const char* a_name, const char* a_comment,
+ Test::SetUpTestCaseFunc set_up_tc,
+ Test::TearDownTestCaseFunc tear_down_tc)
+ : name_(a_name),
+ comment_(a_comment),
+ set_up_tc_(set_up_tc),
+ tear_down_tc_(tear_down_tc),
+ should_run_(false),
+ elapsed_time_(0) {
+}
+
+// Destructor of TestCase.
+TestCase::~TestCase() {
+ // Deletes every Test in the collection.
+ ForEach(test_info_list_, internal::Delete<TestInfo>);
+}
+
+// Returns the i-th test among all the tests. i can range from 0 to
+// total_test_count() - 1. If i is not in that range, returns NULL.
+const TestInfo* TestCase::GetTestInfo(int i) const {
+ const int index = GetElementOr(test_indices_, i, -1);
+ return index < 0 ? NULL : test_info_list_[index];
+}
+
+// Returns the i-th test among all the tests. i can range from 0 to
+// total_test_count() - 1. If i is not in that range, returns NULL.
+TestInfo* TestCase::GetMutableTestInfo(int i) {
+ const int index = GetElementOr(test_indices_, i, -1);
+ return index < 0 ? NULL : test_info_list_[index];
+}
+
+// Adds a test to this test case. Will delete the test upon
+// destruction of the TestCase object.
+void TestCase::AddTestInfo(TestInfo * test_info) {
+ test_info_list_.push_back(test_info);
+ test_indices_.push_back(static_cast<int>(test_indices_.size()));
+}
+
+// Runs every test in this TestCase.
+void TestCase::Run() {
+ if (!should_run_) return;
+
+ internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+ impl->set_current_test_case(this);
+
+ TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
+
+ repeater->OnTestCaseStart(*this);
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ set_up_tc_();
+
+ const internal::TimeInMillis start = internal::GetTimeInMillis();
+ for (int i = 0; i < total_test_count(); i++) {
+ GetMutableTestInfo(i)->impl()->Run();
+ }
+ elapsed_time_ = internal::GetTimeInMillis() - start;
+
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ tear_down_tc_();
+ repeater->OnTestCaseEnd(*this);
+ impl->set_current_test_case(NULL);
+}
+
+// Clears the results of all tests in this test case.
+void TestCase::ClearResult() {
+ ForEach(test_info_list_, internal::TestInfoImpl::ClearTestResult);
+}
+
+// Returns true iff test passed.
+bool TestCase::TestPassed(const TestInfo * test_info) {
+ const internal::TestInfoImpl* const impl = test_info->impl();
+ return impl->should_run() && impl->result()->Passed();
+}
+
+// Returns true iff test failed.
+bool TestCase::TestFailed(const TestInfo * test_info) {
+ const internal::TestInfoImpl* const impl = test_info->impl();
+ return impl->should_run() && impl->result()->Failed();
+}
+
+// Returns true iff test is disabled.
+bool TestCase::TestDisabled(const TestInfo * test_info) {
+ return test_info->impl()->is_disabled();
+}
+
+// Returns true if the given test should run.
+bool TestCase::ShouldRunTest(const TestInfo *test_info) {
+ return test_info->impl()->should_run();
+}
+
+// Shuffles the tests in this test case.
+void TestCase::ShuffleTests(internal::Random* random) {
+ Shuffle(random, &test_indices_);
+}
+
+// Restores the test order to before the first shuffle.
+void TestCase::UnshuffleTests() {
+ for (size_t i = 0; i < test_indices_.size(); i++) {
+ test_indices_[i] = static_cast<int>(i);
+ }
+}
+
+// Formats a countable noun. Depending on its quantity, either the
+// singular form or the plural form is used. e.g.
+//
+// FormatCountableNoun(1, "formula", "formuli") returns "1 formula".
+// FormatCountableNoun(5, "book", "books") returns "5 books".
+static internal::String FormatCountableNoun(int count,
+ const char * singular_form,
+ const char * plural_form) {
+ return internal::String::Format("%d %s", count,
+ count == 1 ? singular_form : plural_form);
+}
+
+// Formats the count of tests.
+static internal::String FormatTestCount(int test_count) {
+ return FormatCountableNoun(test_count, "test", "tests");
+}
+
+// Formats the count of test cases.
+static internal::String FormatTestCaseCount(int test_case_count) {
+ return FormatCountableNoun(test_case_count, "test case", "test cases");
+}
+
+// Converts a TestPartResult::Type enum to human-friendly string
+// representation. Both kNonFatalFailure and kFatalFailure are translated
+// to "Failure", as the user usually doesn't care about the difference
+// between the two when viewing the test result.
+static const char * TestPartResultTypeToString(TestPartResult::Type type) {
+ switch (type) {
+ case TestPartResult::kSuccess:
+ return "Success";
+
+ case TestPartResult::kNonFatalFailure:
+ case TestPartResult::kFatalFailure:
+#ifdef _MSC_VER
+ return "error: ";
+#else
+ return "Failure\n";
+#endif
+ }
+
+ return "Unknown result type";
+}
+
+// Prints a TestPartResult to a String.
+static internal::String PrintTestPartResultToString(
+ const TestPartResult& test_part_result) {
+ return (Message()
+ << internal::FormatFileLocation(test_part_result.file_name(),
+ test_part_result.line_number())
+ << " " << TestPartResultTypeToString(test_part_result.type())
+ << test_part_result.message()).GetString();
+}
+
+// Prints a TestPartResult.
+static void PrintTestPartResult(const TestPartResult& test_part_result) {
+ const internal::String& result =
+ PrintTestPartResultToString(test_part_result);
+ printf("%s\n", result.c_str());
+ fflush(stdout);
+ // If the test program runs in Visual Studio or a debugger, the
+ // following statements add the test part result message to the Output
+ // window such that the user can double-click on it to jump to the
+ // corresponding source code location; otherwise they do nothing.
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+ // We don't call OutputDebugString*() on Windows Mobile, as printing
+ // to stdout is done by OutputDebugString() there already - we don't
+ // want the same message printed twice.
+ ::OutputDebugStringA(result.c_str());
+ ::OutputDebugStringA("\n");
+#endif
+}
+
+// class PrettyUnitTestResultPrinter
+
+namespace internal {
+
+enum GTestColor {
+ COLOR_DEFAULT,
+ COLOR_RED,
+ COLOR_GREEN,
+ COLOR_YELLOW
+};
+
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+
+// Returns the character attribute for the given color.
+WORD GetColorAttribute(GTestColor color) {
+ switch (color) {
+ case COLOR_RED: return FOREGROUND_RED;
+ case COLOR_GREEN: return FOREGROUND_GREEN;
+ case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;
+ default: return 0;
+ }
+}
+
+#else
+
+// Returns the ANSI color code for the given color. COLOR_DEFAULT is
+// an invalid input.
+const char* GetAnsiColorCode(GTestColor color) {
+ switch (color) {
+ case COLOR_RED: return "1";
+ case COLOR_GREEN: return "2";
+ case COLOR_YELLOW: return "3";
+ default: return NULL;
+ };
+}
+
+#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+
+// Returns true iff Google Test should use colors in the output.
+bool ShouldUseColor(bool stdout_is_tty) {
+ const char* const gtest_color = GTEST_FLAG(color).c_str();
+
+ if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
+#if GTEST_OS_WINDOWS
+ // On Windows the TERM variable is usually not set, but the
+ // console there does support colors.
+ return stdout_is_tty;
+#else
+ // On non-Windows platforms, we rely on the TERM variable.
+ const char* const term = posix::GetEnv("TERM");
+ const bool term_supports_color =
+ String::CStringEquals(term, "xterm") ||
+ String::CStringEquals(term, "xterm-color") ||
+ String::CStringEquals(term, "xterm-256color") ||
+ String::CStringEquals(term, "linux") ||
+ String::CStringEquals(term, "cygwin");
+ return stdout_is_tty && term_supports_color;
+#endif // GTEST_OS_WINDOWS
+ }
+
+ return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
+ String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
+ String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
+ String::CStringEquals(gtest_color, "1");
+ // We take "yes", "true", "t", and "1" as meaning "yes". If the
+ // value is neither one of these nor "auto", we treat it as "no" to
+ // be conservative.
+}
+
+// Helpers for printing colored strings to stdout. Note that on Windows, we
+// cannot simply emit special characters and have the terminal change colors.
+// This routine must actually emit the characters rather than return a string
+// that would be colored when printed, as can be done on Linux.
+void ColoredPrintf(GTestColor color, const char* fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+
+#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
+ const bool use_color = false;
+#else
+ static const bool in_color_mode =
+ ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
+ const bool use_color = in_color_mode && (color != COLOR_DEFAULT);
+#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
+ // The '!= 0' comparison is necessary to satisfy MSVC 7.1.
+
+ if (!use_color) {
+ vprintf(fmt, args);
+ va_end(args);
+ return;
+ }
+
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+ const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+
+ // Gets the current text color.
+ CONSOLE_SCREEN_BUFFER_INFO buffer_info;
+ GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
+ const WORD old_color_attrs = buffer_info.wAttributes;
+
+ // We need to flush the stream buffers into the console before each
+ // SetConsoleTextAttribute call lest it affect the text that is already
+ // printed but has not yet reached the console.
+ fflush(stdout);
+ SetConsoleTextAttribute(stdout_handle,
+ GetColorAttribute(color) | FOREGROUND_INTENSITY);
+ vprintf(fmt, args);
+
+ fflush(stdout);
+ // Restores the text color.
+ SetConsoleTextAttribute(stdout_handle, old_color_attrs);
+#else
+ printf("\033[0;3%sm", GetAnsiColorCode(color));
+ vprintf(fmt, args);
+ printf("\033[m"); // Resets the terminal to default.
+#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+ va_end(args);
+}
+
+// This class implements the TestEventListener interface.
+//
+// Class PrettyUnitTestResultPrinter is copyable.
+class PrettyUnitTestResultPrinter : public TestEventListener {
+ public:
+ PrettyUnitTestResultPrinter() {}
+ static void PrintTestName(const char * test_case, const char * test) {
+ printf("%s.%s", test_case, test);
+ }
+
+ // The following methods override what's in the TestEventListener class.
+ virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
+ virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
+ virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
+ virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
+ virtual void OnTestCaseStart(const TestCase& test_case);
+ virtual void OnTestStart(const TestInfo& test_info);
+ virtual void OnTestPartResult(const TestPartResult& result);
+ virtual void OnTestEnd(const TestInfo& test_info);
+ virtual void OnTestCaseEnd(const TestCase& test_case);
+ virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
+ virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
+ virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+ virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
+
+ private:
+ static void PrintFailedTests(const UnitTest& unit_test);
+
+ internal::String test_case_name_;
+};
+
+ // Fired before each iteration of tests starts.
+void PrettyUnitTestResultPrinter::OnTestIterationStart(
+ const UnitTest& unit_test, int iteration) {
+ if (GTEST_FLAG(repeat) != 1)
+ printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
+
+ const char* const filter = GTEST_FLAG(filter).c_str();
+
+ // Prints the filter if it's not *. This reminds the user that some
+ // tests may be skipped.
+ if (!internal::String::CStringEquals(filter, kUniversalFilter)) {
+ ColoredPrintf(COLOR_YELLOW,
+ "Note: %s filter = %s\n", GTEST_NAME_, filter);
+ }
+
+ if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
+ ColoredPrintf(COLOR_YELLOW,
+ "Note: This is test shard %s of %s.\n",
+ internal::posix::GetEnv(kTestShardIndex),
+ internal::posix::GetEnv(kTestTotalShards));
+ }
+
+ if (GTEST_FLAG(shuffle)) {
+ ColoredPrintf(COLOR_YELLOW,
+ "Note: Randomizing tests' orders with a seed of %d .\n",
+ unit_test.random_seed());
+ }
+
+ ColoredPrintf(COLOR_GREEN, "[==========] ");
+ printf("Running %s from %s.\n",
+ FormatTestCount(unit_test.test_to_run_count()).c_str(),
+ FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
+ fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
+ const UnitTest& /*unit_test*/) {
+ ColoredPrintf(COLOR_GREEN, "[----------] ");
+ printf("Global test environment set-up.\n");
+ fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
+ test_case_name_ = test_case.name();
+ const internal::String counts =
+ FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
+ ColoredPrintf(COLOR_GREEN, "[----------] ");
+ printf("%s from %s", counts.c_str(), test_case_name_.c_str());
+ if (test_case.comment()[0] == '\0') {
+ printf("\n");
+ } else {
+ printf(", where %s\n", test_case.comment());
+ }
+ fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
+ ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
+ PrintTestName(test_case_name_.c_str(), test_info.name());
+ if (test_info.comment()[0] == '\0') {
+ printf("\n");
+ } else {
+ printf(", where %s\n", test_info.comment());
+ }
+ fflush(stdout);
+}
+
+// Called after an assertion failure.
+void PrettyUnitTestResultPrinter::OnTestPartResult(
+ const TestPartResult& result) {
+ // If the test part succeeded, we don't need to do anything.
+ if (result.type() == TestPartResult::kSuccess)
+ return;
+
+ // Print failure message from the assertion (e.g. expected this and got that).
+ PrintTestPartResult(result);
+ fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
+ if (test_info.result()->Passed()) {
+ ColoredPrintf(COLOR_GREEN, "[ OK ] ");
+ } else {
+ ColoredPrintf(COLOR_RED, "[ FAILED ] ");
+ }
+ PrintTestName(test_case_name_.c_str(), test_info.name());
+ if (GTEST_FLAG(print_time)) {
+ printf(" (%s ms)\n", internal::StreamableToString(
+ test_info.result()->elapsed_time()).c_str());
+ } else {
+ printf("\n");
+ }
+ fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
+ if (!GTEST_FLAG(print_time)) return;
+
+ test_case_name_ = test_case.name();
+ const internal::String counts =
+ FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
+ ColoredPrintf(COLOR_GREEN, "[----------] ");
+ printf("%s from %s (%s ms total)\n\n",
+ counts.c_str(), test_case_name_.c_str(),
+ internal::StreamableToString(test_case.elapsed_time()).c_str());
+ fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(
+ const UnitTest& /*unit_test*/) {
+ ColoredPrintf(COLOR_GREEN, "[----------] ");
+ printf("Global test environment tear-down\n");
+ fflush(stdout);
+}
+
+// Internal helper for printing the list of failed tests.
+void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {
+ const int failed_test_count = unit_test.failed_test_count();
+ if (failed_test_count == 0) {
+ return;
+ }
+
+ for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
+ const TestCase& test_case = *unit_test.GetTestCase(i);
+ if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {
+ continue;
+ }
+ for (int j = 0; j < test_case.total_test_count(); ++j) {
+ const TestInfo& test_info = *test_case.GetTestInfo(j);
+ if (!test_info.should_run() || test_info.result()->Passed()) {
+ continue;
+ }
+ ColoredPrintf(COLOR_RED, "[ FAILED ] ");
+ printf("%s.%s", test_case.name(), test_info.name());
+ if (test_case.comment()[0] != '\0' ||
+ test_info.comment()[0] != '\0') {
+ printf(", where %s", test_case.comment());
+ if (test_case.comment()[0] != '\0' &&
+ test_info.comment()[0] != '\0') {
+ printf(" and ");
+ }
+ }
+ printf("%s\n", test_info.comment());
+ }
+ }
+}
+
+ void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
+ int /*iteration*/) {
+ ColoredPrintf(COLOR_GREEN, "[==========] ");
+ printf("%s from %s ran.",
+ FormatTestCount(unit_test.test_to_run_count()).c_str(),
+ FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
+ if (GTEST_FLAG(print_time)) {
+ printf(" (%s ms total)",
+ internal::StreamableToString(unit_test.elapsed_time()).c_str());
+ }
+ printf("\n");
+ ColoredPrintf(COLOR_GREEN, "[ PASSED ] ");
+ printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str());
+
+ int num_failures = unit_test.failed_test_count();
+ if (!unit_test.Passed()) {
+ const int failed_test_count = unit_test.failed_test_count();
+ ColoredPrintf(COLOR_RED, "[ FAILED ] ");
+ printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str());
+ PrintFailedTests(unit_test);
+ printf("\n%2d FAILED %s\n", num_failures,
+ num_failures == 1 ? "TEST" : "TESTS");
+ }
+
+ int num_disabled = unit_test.disabled_test_count();
+ if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
+ if (!num_failures) {
+ printf("\n"); // Add a spacer if no FAILURE banner is displayed.
+ }
+ ColoredPrintf(COLOR_YELLOW,
+ " YOU HAVE %d DISABLED %s\n\n",
+ num_disabled,
+ num_disabled == 1 ? "TEST" : "TESTS");
+ }
+ // Ensure that Google Test output is printed before, e.g., heapchecker output.
+ fflush(stdout);
+}
+
+// End PrettyUnitTestResultPrinter
+
+// class TestEventRepeater
+//
+// This class forwards events to other event listeners.
+class TestEventRepeater : public TestEventListener {
+ public:
+ TestEventRepeater() : forwarding_enabled_(true) {}
+ virtual ~TestEventRepeater();
+ void Append(TestEventListener *listener);
+ TestEventListener* Release(TestEventListener* listener);
+
+ // Controls whether events will be forwarded to listeners_. Set to false
+ // in death test child processes.
+ bool forwarding_enabled() const { return forwarding_enabled_; }
+ void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
+
+ virtual void OnTestProgramStart(const UnitTest& unit_test);
+ virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
+ virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
+ virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);
+ virtual void OnTestCaseStart(const TestCase& test_case);
+ virtual void OnTestStart(const TestInfo& test_info);
+ virtual void OnTestPartResult(const TestPartResult& result);
+ virtual void OnTestEnd(const TestInfo& test_info);
+ virtual void OnTestCaseEnd(const TestCase& test_case);
+ virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
+ virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);
+ virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+ virtual void OnTestProgramEnd(const UnitTest& unit_test);
+
+ private:
+ // Controls whether events will be forwarded to listeners_. Set to false
+ // in death test child processes.
+ bool forwarding_enabled_;
+ // The list of listeners that receive events.
+ std::vector<TestEventListener*> listeners_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);
+};
+
+TestEventRepeater::~TestEventRepeater() {
+ ForEach(listeners_, Delete<TestEventListener>);
+}
+
+void TestEventRepeater::Append(TestEventListener *listener) {
+ listeners_.push_back(listener);
+}
+
+// TODO(vladl@google.com): Factor the search functionality into Vector::Find.
+TestEventListener* TestEventRepeater::Release(TestEventListener *listener) {
+ for (size_t i = 0; i < listeners_.size(); ++i) {
+ if (listeners_[i] == listener) {
+ listeners_.erase(listeners_.begin() + i);
+ return listener;
+ }
+ }
+
+ return NULL;
+}
+
+// Since most methods are very similar, use macros to reduce boilerplate.
+// This defines a member that forwards the call to all listeners.
+#define GTEST_REPEATER_METHOD_(Name, Type) \
+void TestEventRepeater::Name(const Type& parameter) { \
+ if (forwarding_enabled_) { \
+ for (size_t i = 0; i < listeners_.size(); i++) { \
+ listeners_[i]->Name(parameter); \
+ } \
+ } \
+}
+// This defines a member that forwards the call to all listeners in reverse
+// order.
+#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \
+void TestEventRepeater::Name(const Type& parameter) { \
+ if (forwarding_enabled_) { \
+ for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \
+ listeners_[i]->Name(parameter); \
+ } \
+ } \
+}
+
+GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)
+GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)
+GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)
+GTEST_REPEATER_METHOD_(OnTestStart, TestInfo)
+GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)
+GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)
+GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)
+GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)
+GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)
+GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)
+GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)
+
+#undef GTEST_REPEATER_METHOD_
+#undef GTEST_REVERSE_REPEATER_METHOD_
+
+void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,
+ int iteration) {
+ if (forwarding_enabled_) {
+ for (size_t i = 0; i < listeners_.size(); i++) {
+ listeners_[i]->OnTestIterationStart(unit_test, iteration);
+ }
+ }
+}
+
+void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,
+ int iteration) {
+ if (forwarding_enabled_) {
+ for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {
+ listeners_[i]->OnTestIterationEnd(unit_test, iteration);
+ }
+ }
+}
+
+// End TestEventRepeater
+
+// This class generates an XML output file.
+class XmlUnitTestResultPrinter : public EmptyTestEventListener {
+ public:
+ explicit XmlUnitTestResultPrinter(const char* output_file);
+
+ virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+
+ private:
+ // Is c a whitespace character that is normalized to a space character
+ // when it appears in an XML attribute value?
+ static bool IsNormalizableWhitespace(char c) {
+ return c == 0x9 || c == 0xA || c == 0xD;
+ }
+
+ // May c appear in a well-formed XML document?
+ static bool IsValidXmlCharacter(char c) {
+ return IsNormalizableWhitespace(c) || c >= 0x20;
+ }
+
+ // Returns an XML-escaped copy of the input string str. If
+ // is_attribute is true, the text is meant to appear as an attribute
+ // value, and normalizable whitespace is preserved by replacing it
+ // with character references.
+ static String EscapeXml(const char* str, bool is_attribute);
+
+ // Returns the given string with all characters invalid in XML removed.
+ static String RemoveInvalidXmlCharacters(const char* str);
+
+ // Convenience wrapper around EscapeXml when str is an attribute value.
+ static String EscapeXmlAttribute(const char* str) {
+ return EscapeXml(str, true);
+ }
+
+ // Convenience wrapper around EscapeXml when str is not an attribute value.
+ static String EscapeXmlText(const char* str) { return EscapeXml(str, false); }
+
+ // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
+ static void OutputXmlCDataSection(::std::ostream* stream, const char* data);
+
+ // Streams an XML representation of a TestInfo object.
+ static void OutputXmlTestInfo(::std::ostream* stream,
+ const char* test_case_name,
+ const TestInfo& test_info);
+
+ // Prints an XML representation of a TestCase object
+ static void PrintXmlTestCase(FILE* out, const TestCase& test_case);
+
+ // Prints an XML summary of unit_test to output stream out.
+ static void PrintXmlUnitTest(FILE* out, const UnitTest& unit_test);
+
+ // Produces a string representing the test properties in a result as space
+ // delimited XML attributes based on the property key="value" pairs.
+ // When the String is not empty, it includes a space at the beginning,
+ // to delimit this attribute from prior attributes.
+ static String TestPropertiesAsXmlAttributes(const TestResult& result);
+
+ // The output file.
+ const String output_file_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
+};
+
+// Creates a new XmlUnitTestResultPrinter.
+XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
+ : output_file_(output_file) {
+ if (output_file_.c_str() == NULL || output_file_.empty()) {
+ fprintf(stderr, "XML output file may not be null\n");
+ fflush(stderr);
+ exit(EXIT_FAILURE);
+ }
+}
+
+// Called after the unit test ends.
+void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
+ int /*iteration*/) {
+ FILE* xmlout = NULL;
+ FilePath output_file(output_file_);
+ FilePath output_dir(output_file.RemoveFileName());
+
+ if (output_dir.CreateDirectoriesRecursively()) {
+ xmlout = posix::FOpen(output_file_.c_str(), "w");
+ }
+ if (xmlout == NULL) {
+ // TODO(wan): report the reason of the failure.
+ //
+ // We don't do it for now as:
+ //
+ // 1. There is no urgent need for it.
+ // 2. It's a bit involved to make the errno variable thread-safe on
+ // all three operating systems (Linux, Windows, and Mac OS).
+ // 3. To interpret the meaning of errno in a thread-safe way,
+ // we need the strerror_r() function, which is not available on
+ // Windows.
+ fprintf(stderr,
+ "Unable to open file \"%s\"\n",
+ output_file_.c_str());
+ fflush(stderr);
+ exit(EXIT_FAILURE);
+ }
+ PrintXmlUnitTest(xmlout, unit_test);
+ fclose(xmlout);
+}
+
+// Returns an XML-escaped copy of the input string str. If is_attribute
+// is true, the text is meant to appear as an attribute value, and
+// normalizable whitespace is preserved by replacing it with character
+// references.
+//
+// Invalid XML characters in str, if any, are stripped from the output.
+// It is expected that most, if not all, of the text processed by this
+// module will consist of ordinary English text.
+// If this module is ever modified to produce version 1.1 XML output,
+// most invalid characters can be retained using character references.
+// TODO(wan): It might be nice to have a minimally invasive, human-readable
+// escaping scheme for invalid characters, rather than dropping them.
+String XmlUnitTestResultPrinter::EscapeXml(const char* str, bool is_attribute) {
+ Message m;
+
+ if (str != NULL) {
+ for (const char* src = str; *src; ++src) {
+ switch (*src) {
+ case '<':
+ m << "&lt;";
+ break;
+ case '>':
+ m << "&gt;";
+ break;
+ case '&':
+ m << "&amp;";
+ break;
+ case '\'':
+ if (is_attribute)
+ m << "&apos;";
+ else
+ m << '\'';
+ break;
+ case '"':
+ if (is_attribute)
+ m << "&quot;";
+ else
+ m << '"';
+ break;
+ default:
+ if (IsValidXmlCharacter(*src)) {
+ if (is_attribute && IsNormalizableWhitespace(*src))
+ m << String::Format("&#x%02X;", unsigned(*src));
+ else
+ m << *src;
+ }
+ break;
+ }
+ }
+ }
+
+ return m.GetString();
+}
+
+// Returns the given string with all characters invalid in XML removed.
+// Currently invalid characters are dropped from the string. An
+// alternative is to replace them with certain characters such as . or ?.
+String XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(const char* str) {
+ char* const output = new char[strlen(str) + 1];
+ char* appender = output;
+ for (char ch = *str; ch != '\0'; ch = *++str)
+ if (IsValidXmlCharacter(ch))
+ *appender++ = ch;
+ *appender = '\0';
+
+ String ret_value(output);
+ delete[] output;
+ return ret_value;
+}
+
+// The following routines generate an XML representation of a UnitTest
+// object.
+//
+// This is how Google Test concepts map to the DTD:
+//
+// <testsuites name="AllTests"> <-- corresponds to a UnitTest object
+// <testsuite name="testcase-name"> <-- corresponds to a TestCase object
+// <testcase name="test-name"> <-- corresponds to a TestInfo object
+// <failure message="...">...</failure>
+// <failure message="...">...</failure>
+// <failure message="...">...</failure>
+// <-- individual assertion failures
+// </testcase>
+// </testsuite>
+// </testsuites>
+
+// Formats the given time in milliseconds as seconds.
+std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
+ ::std::stringstream ss;
+ ss << ms/1000.0;
+ return ss.str();
+}
+
+// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
+void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
+ const char* data) {
+ const char* segment = data;
+ *stream << "<![CDATA[";
+ for (;;) {
+ const char* const next_segment = strstr(segment, "]]>");
+ if (next_segment != NULL) {
+ stream->write(
+ segment, static_cast<std::streamsize>(next_segment - segment));
+ *stream << "]]>]]&gt;<![CDATA[";
+ segment = next_segment + strlen("]]>");
+ } else {
+ *stream << segment;
+ break;
+ }
+ }
+ *stream << "]]>";
+}
+
+// Prints an XML representation of a TestInfo object.
+// TODO(wan): There is also value in printing properties with the plain printer.
+void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
+ const char* test_case_name,
+ const TestInfo& test_info) {
+ const TestResult& result = *test_info.result();
+ *stream << " <testcase name=\""
+ << EscapeXmlAttribute(test_info.name()).c_str()
+ << "\" status=\""
+ << (test_info.should_run() ? "run" : "notrun")
+ << "\" time=\""
+ << FormatTimeInMillisAsSeconds(result.elapsed_time())
+ << "\" classname=\"" << EscapeXmlAttribute(test_case_name).c_str()
+ << "\"" << TestPropertiesAsXmlAttributes(result).c_str();
+
+ int failures = 0;
+ for (int i = 0; i < result.total_part_count(); ++i) {
+ const TestPartResult& part = result.GetTestPartResult(i);
+ if (part.failed()) {
+ if (++failures == 1)
+ *stream << ">\n";
+ *stream << " <failure message=\""
+ << EscapeXmlAttribute(part.summary()).c_str()
+ << "\" type=\"\">";
+ const String message = RemoveInvalidXmlCharacters(String::Format(
+ "%s:%d\n%s",
+ part.file_name(), part.line_number(),
+ part.message()).c_str());
+ OutputXmlCDataSection(stream, message.c_str());
+ *stream << "</failure>\n";
+ }
+ }
+
+ if (failures == 0)
+ *stream << " />\n";
+ else
+ *stream << " </testcase>\n";
+}
+
+// Prints an XML representation of a TestCase object
+void XmlUnitTestResultPrinter::PrintXmlTestCase(FILE* out,
+ const TestCase& test_case) {
+ fprintf(out,
+ " <testsuite name=\"%s\" tests=\"%d\" failures=\"%d\" "
+ "disabled=\"%d\" ",
+ EscapeXmlAttribute(test_case.name()).c_str(),
+ test_case.total_test_count(),
+ test_case.failed_test_count(),
+ test_case.disabled_test_count());
+ fprintf(out,
+ "errors=\"0\" time=\"%s\">\n",
+ FormatTimeInMillisAsSeconds(test_case.elapsed_time()).c_str());
+ for (int i = 0; i < test_case.total_test_count(); ++i) {
+ StrStream stream;
+ OutputXmlTestInfo(&stream, test_case.name(), *test_case.GetTestInfo(i));
+ fprintf(out, "%s", StrStreamToString(&stream).c_str());
+ }
+ fprintf(out, " </testsuite>\n");
+}
+
+// Prints an XML summary of unit_test to output stream out.
+void XmlUnitTestResultPrinter::PrintXmlUnitTest(FILE* out,
+ const UnitTest& unit_test) {
+ fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ fprintf(out,
+ "<testsuites tests=\"%d\" failures=\"%d\" disabled=\"%d\" "
+ "errors=\"0\" time=\"%s\" ",
+ unit_test.total_test_count(),
+ unit_test.failed_test_count(),
+ unit_test.disabled_test_count(),
+ FormatTimeInMillisAsSeconds(unit_test.elapsed_time()).c_str());
+ if (GTEST_FLAG(shuffle)) {
+ fprintf(out, "random_seed=\"%d\" ", unit_test.random_seed());
+ }
+ fprintf(out, "name=\"AllTests\">\n");
+ for (int i = 0; i < unit_test.total_test_case_count(); ++i)
+ PrintXmlTestCase(out, *unit_test.GetTestCase(i));
+ fprintf(out, "</testsuites>\n");
+}
+
+// Produces a string representing the test properties in a result as space
+// delimited XML attributes based on the property key="value" pairs.
+String XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
+ const TestResult& result) {
+ Message attributes;
+ for (int i = 0; i < result.test_property_count(); ++i) {
+ const TestProperty& property = result.GetTestProperty(i);
+ attributes << " " << property.key() << "="
+ << "\"" << EscapeXmlAttribute(property.value()) << "\"";
+ }
+ return attributes.GetString();
+}
+
+// End XmlUnitTestResultPrinter
+
+// Class ScopedTrace
+
+// Pushes the given source file location and message onto a per-thread
+// trace stack maintained by Google Test.
+// L < UnitTest::mutex_
+ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
+ TraceInfo trace;
+ trace.file = file;
+ trace.line = line;
+ trace.message = message.GetString();
+
+ UnitTest::GetInstance()->PushGTestTrace(trace);
+}
+
+// Pops the info pushed by the c'tor.
+// L < UnitTest::mutex_
+ScopedTrace::~ScopedTrace() {
+ UnitTest::GetInstance()->PopGTestTrace();
+}
+
+
+// class OsStackTraceGetter
+
+// Returns the current OS stack trace as a String. Parameters:
+//
+// max_depth - the maximum number of stack frames to be included
+// in the trace.
+// skip_count - the number of top frames to be skipped; doesn't count
+// against max_depth.
+//
+// L < mutex_
+// We use "L < mutex_" to denote that the function may acquire mutex_.
+String OsStackTraceGetter::CurrentStackTrace(int, int) {
+ return String("");
+}
+
+// L < mutex_
+void OsStackTraceGetter::UponLeavingGTest() {
+}
+
+const char* const
+OsStackTraceGetter::kElidedFramesMarker =
+ "... " GTEST_NAME_ " internal frames ...";
+
+} // namespace internal
+
+// class TestEventListeners
+
+TestEventListeners::TestEventListeners()
+ : repeater_(new internal::TestEventRepeater()),
+ default_result_printer_(NULL),
+ default_xml_generator_(NULL) {
+}
+
+TestEventListeners::~TestEventListeners() { delete repeater_; }
+
+// Returns the standard listener responsible for the default console
+// output. Can be removed from the listeners list to shut down default
+// console output. Note that removing this object from the listener list
+// with Release transfers its ownership to the user.
+void TestEventListeners::Append(TestEventListener* listener) {
+ repeater_->Append(listener);
+}
+
+// Removes the given event listener from the list and returns it. It then
+// becomes the caller's responsibility to delete the listener. Returns
+// NULL if the listener is not found in the list.
+TestEventListener* TestEventListeners::Release(TestEventListener* listener) {
+ if (listener == default_result_printer_)
+ default_result_printer_ = NULL;
+ else if (listener == default_xml_generator_)
+ default_xml_generator_ = NULL;
+ return repeater_->Release(listener);
+}
+
+// Returns repeater that broadcasts the TestEventListener events to all
+// subscribers.
+TestEventListener* TestEventListeners::repeater() { return repeater_; }
+
+// Sets the default_result_printer attribute to the provided listener.
+// The listener is also added to the listener list and previous
+// default_result_printer is removed from it and deleted. The listener can
+// also be NULL in which case it will not be added to the list. Does
+// nothing if the previous and the current listener objects are the same.
+void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {
+ if (default_result_printer_ != listener) {
+ // It is an error to pass this method a listener that is already in the
+ // list.
+ delete Release(default_result_printer_);
+ default_result_printer_ = listener;
+ if (listener != NULL)
+ Append(listener);
+ }
+}
+
+// Sets the default_xml_generator attribute to the provided listener. The
+// listener is also added to the listener list and previous
+// default_xml_generator is removed from it and deleted. The listener can
+// also be NULL in which case it will not be added to the list. Does
+// nothing if the previous and the current listener objects are the same.
+void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) {
+ if (default_xml_generator_ != listener) {
+ // It is an error to pass this method a listener that is already in the
+ // list.
+ delete Release(default_xml_generator_);
+ default_xml_generator_ = listener;
+ if (listener != NULL)
+ Append(listener);
+ }
+}
+
+// Controls whether events will be forwarded by the repeater to the
+// listeners in the list.
+bool TestEventListeners::EventForwardingEnabled() const {
+ return repeater_->forwarding_enabled();
+}
+
+void TestEventListeners::SuppressEventForwarding() {
+ repeater_->set_forwarding_enabled(false);
+}
+
+// class UnitTest
+
+// Gets the singleton UnitTest object. The first time this method is
+// called, a UnitTest object is constructed and returned. Consecutive
+// calls will return the same object.
+//
+// We don't protect this under mutex_ as a user is not supposed to
+// call this before main() starts, from which point on the return
+// value will never change.
+UnitTest * UnitTest::GetInstance() {
+ // When compiled with MSVC 7.1 in optimized mode, destroying the
+ // UnitTest object upon exiting the program messes up the exit code,
+ // causing successful tests to appear failed. We have to use a
+ // different implementation in this case to bypass the compiler bug.
+ // This implementation makes the compiler happy, at the cost of
+ // leaking the UnitTest object.
+
+ // CodeGear C++Builder insists on a public destructor for the
+ // default implementation. Use this implementation to keep good OO
+ // design with private destructor.
+
+#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
+ static UnitTest* const instance = new UnitTest;
+ return instance;
+#else
+ static UnitTest instance;
+ return &instance;
+#endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
+}
+
+// Gets the number of successful test cases.
+int UnitTest::successful_test_case_count() const {
+ return impl()->successful_test_case_count();
+}
+
+// Gets the number of failed test cases.
+int UnitTest::failed_test_case_count() const {
+ return impl()->failed_test_case_count();
+}
+
+// Gets the number of all test cases.
+int UnitTest::total_test_case_count() const {
+ return impl()->total_test_case_count();
+}
+
+// Gets the number of all test cases that contain at least one test
+// that should run.
+int UnitTest::test_case_to_run_count() const {
+ return impl()->test_case_to_run_count();
+}
+
+// Gets the number of successful tests.
+int UnitTest::successful_test_count() const {
+ return impl()->successful_test_count();
+}
+
+// Gets the number of failed tests.
+int UnitTest::failed_test_count() const { return impl()->failed_test_count(); }
+
+// Gets the number of disabled tests.
+int UnitTest::disabled_test_count() const {
+ return impl()->disabled_test_count();
+}
+
+// Gets the number of all tests.
+int UnitTest::total_test_count() const { return impl()->total_test_count(); }
+
+// Gets the number of tests that should run.
+int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
+
+// Gets the elapsed time, in milliseconds.
+internal::TimeInMillis UnitTest::elapsed_time() const {
+ return impl()->elapsed_time();
+}
+
+// Returns true iff the unit test passed (i.e. all test cases passed).
+bool UnitTest::Passed() const { return impl()->Passed(); }
+
+// Returns true iff the unit test failed (i.e. some test case failed
+// or something outside of all tests failed).
+bool UnitTest::Failed() const { return impl()->Failed(); }
+
+// Gets the i-th test case among all the test cases. i can range from 0 to
+// total_test_case_count() - 1. If i is not in that range, returns NULL.
+const TestCase* UnitTest::GetTestCase(int i) const {
+ return impl()->GetTestCase(i);
+}
+
+// Gets the i-th test case among all the test cases. i can range from 0 to
+// total_test_case_count() - 1. If i is not in that range, returns NULL.
+TestCase* UnitTest::GetMutableTestCase(int i) {
+ return impl()->GetMutableTestCase(i);
+}
+
+// Returns the list of event listeners that can be used to track events
+// inside Google Test.
+TestEventListeners& UnitTest::listeners() {
+ return *impl()->listeners();
+}
+
+// Registers and returns a global test environment. When a test
+// program is run, all global test environments will be set-up in the
+// order they were registered. After all tests in the program have
+// finished, all global test environments will be torn-down in the
+// *reverse* order they were registered.
+//
+// The UnitTest object takes ownership of the given environment.
+//
+// We don't protect this under mutex_, as we only support calling it
+// from the main thread.
+Environment* UnitTest::AddEnvironment(Environment* env) {
+ if (env == NULL) {
+ return NULL;
+ }
+
+ impl_->environments().push_back(env);
+ return env;
+}
+
+#if GTEST_HAS_EXCEPTIONS
+// A failed Google Test assertion will throw an exception of this type
+// when exceptions are enabled. We derive it from std::runtime_error,
+// which is for errors presumably detectable only at run time. Since
+// std::runtime_error inherits from std::exception, many testing
+// frameworks know how to extract and print the message inside it.
+class GoogleTestFailureException : public ::std::runtime_error {
+ public:
+ explicit GoogleTestFailureException(const TestPartResult& failure)
+ : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
+};
+#endif
+
+// Adds a TestPartResult to the current TestResult object. All Google Test
+// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
+// this to report their results. The user code should use the
+// assertion macros instead of calling this directly.
+// L < mutex_
+void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
+ const char* file_name,
+ int line_number,
+ const internal::String& message,
+ const internal::String& os_stack_trace) {
+ Message msg;
+ msg << message;
+
+ internal::MutexLock lock(&mutex_);
+ if (impl_->gtest_trace_stack().size() > 0) {
+ msg << "\n" << GTEST_NAME_ << " trace:";
+
+ for (int i = static_cast<int>(impl_->gtest_trace_stack().size());
+ i > 0; --i) {
+ const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];
+ msg << "\n" << internal::FormatFileLocation(trace.file, trace.line)
+ << " " << trace.message;
+ }
+ }
+
+ if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
+ msg << internal::kStackTraceMarker << os_stack_trace;
+ }
+
+ const TestPartResult result =
+ TestPartResult(result_type, file_name, line_number,
+ msg.GetString().c_str());
+ impl_->GetTestPartResultReporterForCurrentThread()->
+ ReportTestPartResult(result);
+
+ if (result_type != TestPartResult::kSuccess) {
+ // gtest_break_on_failure takes precedence over
+ // gtest_throw_on_failure. This allows a user to set the latter
+ // in the code (perhaps in order to use Google Test assertions
+ // with another testing framework) and specify the former on the
+ // command line for debugging.
+ if (GTEST_FLAG(break_on_failure)) {
+#if GTEST_OS_WINDOWS
+ // Using DebugBreak on Windows allows gtest to still break into a debugger
+ // when a failure happens and both the --gtest_break_on_failure and
+ // the --gtest_catch_exceptions flags are specified.
+ DebugBreak();
+#else
+ *static_cast<int*>(NULL) = 1;
+#endif // GTEST_OS_WINDOWS
+ } else if (GTEST_FLAG(throw_on_failure)) {
+#if GTEST_HAS_EXCEPTIONS
+ throw GoogleTestFailureException(result);
+#else
+ // We cannot call abort() as it generates a pop-up in debug mode
+ // that cannot be suppressed in VC 7.1 or below.
+ exit(1);
+#endif
+ }
+ }
+}
+
+// Creates and adds a property to the current TestResult. If a property matching
+// the supplied value already exists, updates its value instead.
+void UnitTest::RecordPropertyForCurrentTest(const char* key,
+ const char* value) {
+ const TestProperty test_property(key, value);
+ impl_->current_test_result()->RecordProperty(test_property);
+}
+
+// Runs all tests in this UnitTest object and prints the result.
+// Returns 0 if successful, or 1 otherwise.
+//
+// We don't protect this under mutex_, as we only support calling it
+// from the main thread.
+int UnitTest::Run() {
+#if GTEST_HAS_SEH
+ // Catch SEH-style exceptions.
+
+ const bool in_death_test_child_process =
+ internal::GTEST_FLAG(internal_run_death_test).length() > 0;
+
+ // Either the user wants Google Test to catch exceptions thrown by the
+ // tests or this is executing in the context of death test child
+ // process. In either case the user does not want to see pop-up dialogs
+ // about crashes - they are expected..
+ if (GTEST_FLAG(catch_exceptions) || in_death_test_child_process) {
+#if !GTEST_OS_WINDOWS_MOBILE
+ // SetErrorMode doesn't exist on CE.
+ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
+ SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
+#endif // !GTEST_OS_WINDOWS_MOBILE
+
+#if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
+ // Death test children can be terminated with _abort(). On Windows,
+ // _abort() can show a dialog with a warning message. This forces the
+ // abort message to go to stderr instead.
+ _set_error_mode(_OUT_TO_STDERR);
+#endif
+
+#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
+ // In the debug version, Visual Studio pops up a separate dialog
+ // offering a choice to debug the aborted program. We need to suppress
+ // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
+ // executed. Google Test will notify the user of any unexpected
+ // failure via stderr.
+ //
+ // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.
+ // Users of prior VC versions shall suffer the agony and pain of
+ // clicking through the countless debug dialogs.
+ // TODO(vladl@google.com): find a way to suppress the abort dialog() in the
+ // debug mode when compiled with VC 7.1 or lower.
+ if (!GTEST_FLAG(break_on_failure))
+ _set_abort_behavior(
+ 0x0, // Clear the following flags:
+ _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump.
+#endif
+ }
+
+ __try {
+ return impl_->RunAllTests();
+ } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
+ GetExceptionCode())) {
+ printf("Exception thrown with code 0x%x.\nFAIL\n", GetExceptionCode());
+ fflush(stdout);
+ return 1;
+ }
+
+#else // We are on a compiler or platform that doesn't support SEH.
+
+ return impl_->RunAllTests();
+#endif // GTEST_HAS_SEH
+}
+
+// Returns the working directory when the first TEST() or TEST_F() was
+// executed.
+const char* UnitTest::original_working_dir() const {
+ return impl_->original_working_dir_.c_str();
+}
+
+// Returns the TestCase object for the test that's currently running,
+// or NULL if no test is running.
+// L < mutex_
+const TestCase* UnitTest::current_test_case() const {
+ internal::MutexLock lock(&mutex_);
+ return impl_->current_test_case();
+}
+
+// Returns the TestInfo object for the test that's currently running,
+// or NULL if no test is running.
+// L < mutex_
+const TestInfo* UnitTest::current_test_info() const {
+ internal::MutexLock lock(&mutex_);
+ return impl_->current_test_info();
+}
+
+// Returns the random seed used at the start of the current test run.
+int UnitTest::random_seed() const { return impl_->random_seed(); }
+
+#if GTEST_HAS_PARAM_TEST
+// Returns ParameterizedTestCaseRegistry object used to keep track of
+// value-parameterized tests and instantiate and register them.
+// L < mutex_
+internal::ParameterizedTestCaseRegistry&
+ UnitTest::parameterized_test_registry() {
+ return impl_->parameterized_test_registry();
+}
+#endif // GTEST_HAS_PARAM_TEST
+
+// Creates an empty UnitTest.
+UnitTest::UnitTest() {
+ impl_ = new internal::UnitTestImpl(this);
+}
+
+// Destructor of UnitTest.
+UnitTest::~UnitTest() {
+ delete impl_;
+}
+
+// Pushes a trace defined by SCOPED_TRACE() on to the per-thread
+// Google Test trace stack.
+// L < mutex_
+void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) {
+ internal::MutexLock lock(&mutex_);
+ impl_->gtest_trace_stack().push_back(trace);
+}
+
+// Pops a trace from the per-thread Google Test trace stack.
+// L < mutex_
+void UnitTest::PopGTestTrace() {
+ internal::MutexLock lock(&mutex_);
+ impl_->gtest_trace_stack().pop_back();
+}
+
+namespace internal {
+
+UnitTestImpl::UnitTestImpl(UnitTest* parent)
+ : parent_(parent),
+#ifdef _MSC_VER
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4355) // Temporarily disables warning 4355
+ // (using this in initializer).
+ default_global_test_part_result_reporter_(this),
+ default_per_thread_test_part_result_reporter_(this),
+#pragma warning(pop) // Restores the warning state again.
+#else
+ default_global_test_part_result_reporter_(this),
+ default_per_thread_test_part_result_reporter_(this),
+#endif // _MSC_VER
+ global_test_part_result_repoter_(
+ &default_global_test_part_result_reporter_),
+ per_thread_test_part_result_reporter_(
+ &default_per_thread_test_part_result_reporter_),
+#if GTEST_HAS_PARAM_TEST
+ parameterized_test_registry_(),
+ parameterized_tests_registered_(false),
+#endif // GTEST_HAS_PARAM_TEST
+ last_death_test_case_(-1),
+ current_test_case_(NULL),
+ current_test_info_(NULL),
+ ad_hoc_test_result_(),
+ os_stack_trace_getter_(NULL),
+ post_flag_parse_init_performed_(false),
+ random_seed_(0), // Will be overridden by the flag before first use.
+ random_(0), // Will be reseeded before first use.
+#if GTEST_HAS_DEATH_TEST
+ elapsed_time_(0),
+ internal_run_death_test_flag_(NULL),
+ death_test_factory_(new DefaultDeathTestFactory) {
+#else
+ elapsed_time_(0) {
+#endif // GTEST_HAS_DEATH_TEST
+ listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter);
+}
+
+UnitTestImpl::~UnitTestImpl() {
+ // Deletes every TestCase.
+ ForEach(test_cases_, internal::Delete<TestCase>);
+
+ // Deletes every Environment.
+ ForEach(environments_, internal::Delete<Environment>);
+
+ delete os_stack_trace_getter_;
+}
+
+#if GTEST_HAS_DEATH_TEST
+// Disables event forwarding if the control is currently in a death test
+// subprocess. Must not be called before InitGoogleTest.
+void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
+ if (internal_run_death_test_flag_.get() != NULL)
+ listeners()->SuppressEventForwarding();
+}
+#endif // GTEST_HAS_DEATH_TEST
+
+// Initializes event listeners performing XML output as specified by
+// UnitTestOptions. Must not be called before InitGoogleTest.
+void UnitTestImpl::ConfigureXmlOutput() {
+ const String& output_format = UnitTestOptions::GetOutputFormat();
+ if (output_format == "xml") {
+ listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
+ } else if (output_format != "") {
+ printf("WARNING: unrecognized output format \"%s\" ignored.\n",
+ output_format.c_str());
+ fflush(stdout);
+ }
+}
+
+// Performs initialization dependent upon flag values obtained in
+// ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
+// ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
+// this function is also called from RunAllTests. Since this function can be
+// called more than once, it has to be idempotent.
+void UnitTestImpl::PostFlagParsingInit() {
+ // Ensures that this function does not execute more than once.
+ if (!post_flag_parse_init_performed_) {
+ post_flag_parse_init_performed_ = true;
+
+#if GTEST_HAS_DEATH_TEST
+ InitDeathTestSubprocessControlInfo();
+ SuppressTestEventsIfInSubprocess();
+#endif // GTEST_HAS_DEATH_TEST
+
+ // Registers parameterized tests. This makes parameterized tests
+ // available to the UnitTest reflection API without running
+ // RUN_ALL_TESTS.
+ RegisterParameterizedTests();
+
+ // Configures listeners for XML output. This makes it possible for users
+ // to shut down the default XML output before invoking RUN_ALL_TESTS.
+ ConfigureXmlOutput();
+ }
+}
+
+// A predicate that checks the name of a TestCase against a known
+// value.
+//
+// This is used for implementation of the UnitTest class only. We put
+// it in the anonymous namespace to prevent polluting the outer
+// namespace.
+//
+// TestCaseNameIs is copyable.
+class TestCaseNameIs {
+ public:
+ // Constructor.
+ explicit TestCaseNameIs(const String& name)
+ : name_(name) {}
+
+ // Returns true iff the name of test_case matches name_.
+ bool operator()(const TestCase* test_case) const {
+ return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;
+ }
+
+ private:
+ String name_;
+};
+
+// Finds and returns a TestCase with the given name. If one doesn't
+// exist, creates one and returns it. It's the CALLER'S
+// RESPONSIBILITY to ensure that this function is only called WHEN THE
+// TESTS ARE NOT SHUFFLED.
+//
+// Arguments:
+//
+// test_case_name: name of the test case
+// set_up_tc: pointer to the function that sets up the test case
+// tear_down_tc: pointer to the function that tears down the test case
+TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
+ const char* comment,
+ Test::SetUpTestCaseFunc set_up_tc,
+ Test::TearDownTestCaseFunc tear_down_tc) {
+ // Can we find a TestCase with the given name?
+ const std::vector<TestCase*>::const_iterator test_case =
+ std::find_if(test_cases_.begin(), test_cases_.end(),
+ TestCaseNameIs(test_case_name));
+
+ if (test_case != test_cases_.end())
+ return *test_case;
+
+ // No. Let's create one.
+ TestCase* const new_test_case =
+ new TestCase(test_case_name, comment, set_up_tc, tear_down_tc);
+
+ // Is this a death test case?
+ if (internal::UnitTestOptions::MatchesFilter(String(test_case_name),
+ kDeathTestCaseFilter)) {
+ // Yes. Inserts the test case after the last death test case
+ // defined so far. This only works when the test cases haven't
+ // been shuffled. Otherwise we may end up running a death test
+ // after a non-death test.
+ ++last_death_test_case_;
+ test_cases_.insert(test_cases_.begin() + last_death_test_case_,
+ new_test_case);
+ } else {
+ // No. Appends to the end of the list.
+ test_cases_.push_back(new_test_case);
+ }
+
+ test_case_indices_.push_back(static_cast<int>(test_case_indices_.size()));
+ return new_test_case;
+}
+
+// Helpers for setting up / tearing down the given environment. They
+// are for use in the ForEach() function.
+static void SetUpEnvironment(Environment* env) { env->SetUp(); }
+static void TearDownEnvironment(Environment* env) { env->TearDown(); }
+
+// Runs all tests in this UnitTest object, prints the result, and
+// returns 0 if all tests are successful, or 1 otherwise. If any
+// exception is thrown during a test on Windows, this test is
+// considered to be failed, but the rest of the tests will still be
+// run. (We disable exceptions on Linux and Mac OS X, so the issue
+// doesn't apply there.)
+// When parameterized tests are enabled, it expands and registers
+// parameterized tests first in RegisterParameterizedTests().
+// All other functions called from RunAllTests() may safely assume that
+// parameterized tests are ready to be counted and run.
+int UnitTestImpl::RunAllTests() {
+ // Makes sure InitGoogleTest() was called.
+ if (!GTestIsInitialized()) {
+ printf("%s",
+ "\nThis test program did NOT call ::testing::InitGoogleTest "
+ "before calling RUN_ALL_TESTS(). Please fix it.\n");
+ return 1;
+ }
+
+ // Do not run any test if the --help flag was specified.
+ if (g_help_flag)
+ return 0;
+
+ // Repeats the call to the post-flag parsing initialization in case the
+ // user didn't call InitGoogleTest.
+ PostFlagParsingInit();
+
+ // Even if sharding is not on, test runners may want to use the
+ // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
+ // protocol.
+ internal::WriteToShardStatusFileIfNeeded();
+
+ // True iff we are in a subprocess for running a thread-safe-style
+ // death test.
+ bool in_subprocess_for_death_test = false;
+
+#if GTEST_HAS_DEATH_TEST
+ in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
+#endif // GTEST_HAS_DEATH_TEST
+
+ const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
+ in_subprocess_for_death_test);
+
+ // Compares the full test names with the filter to decide which
+ // tests to run.
+ const bool has_tests_to_run = FilterTests(should_shard
+ ? HONOR_SHARDING_PROTOCOL
+ : IGNORE_SHARDING_PROTOCOL) > 0;
+
+ // Lists the tests and exits if the --gtest_list_tests flag was specified.
+ if (GTEST_FLAG(list_tests)) {
+ // This must be called *after* FilterTests() has been called.
+ ListTestsMatchingFilter();
+ return 0;
+ }
+
+ random_seed_ = GTEST_FLAG(shuffle) ?
+ GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
+
+ // True iff at least one test has failed.
+ bool failed = false;
+
+ TestEventListener* repeater = listeners()->repeater();
+
+ repeater->OnTestProgramStart(*parent_);
+
+ // How many times to repeat the tests? We don't want to repeat them
+ // when we are inside the subprocess of a death test.
+ const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat);
+ // Repeats forever if the repeat count is negative.
+ const bool forever = repeat < 0;
+ for (int i = 0; forever || i != repeat; i++) {
+ ClearResult();
+
+ const TimeInMillis start = GetTimeInMillis();
+
+ // Shuffles test cases and tests if requested.
+ if (has_tests_to_run && GTEST_FLAG(shuffle)) {
+ random()->Reseed(random_seed_);
+ // This should be done before calling OnTestIterationStart(),
+ // such that a test event listener can see the actual test order
+ // in the event.
+ ShuffleTests();
+ }
+
+ // Tells the unit test event listeners that the tests are about to start.
+ repeater->OnTestIterationStart(*parent_, i);
+
+ // Runs each test case if there is at least one test to run.
+ if (has_tests_to_run) {
+ // Sets up all environments beforehand.
+ repeater->OnEnvironmentsSetUpStart(*parent_);
+ ForEach(environments_, SetUpEnvironment);
+ repeater->OnEnvironmentsSetUpEnd(*parent_);
+
+ // Runs the tests only if there was no fatal failure during global
+ // set-up.
+ if (!Test::HasFatalFailure()) {
+ for (int test_index = 0; test_index < total_test_case_count();
+ test_index++) {
+ GetMutableTestCase(test_index)->Run();
+ }
+ }
+
+ // Tears down all environments in reverse order afterwards.
+ repeater->OnEnvironmentsTearDownStart(*parent_);
+ std::for_each(environments_.rbegin(), environments_.rend(),
+ TearDownEnvironment);
+ repeater->OnEnvironmentsTearDownEnd(*parent_);
+ }
+
+ elapsed_time_ = GetTimeInMillis() - start;
+
+ // Tells the unit test event listener that the tests have just finished.
+ repeater->OnTestIterationEnd(*parent_, i);
+
+ // Gets the result and clears it.
+ if (!Passed()) {
+ failed = true;
+ }
+
+ // Restores the original test order after the iteration. This
+ // allows the user to quickly repro a failure that happens in the
+ // N-th iteration without repeating the first (N - 1) iterations.
+ // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in
+ // case the user somehow changes the value of the flag somewhere
+ // (it's always safe to unshuffle the tests).
+ UnshuffleTests();
+
+ if (GTEST_FLAG(shuffle)) {
+ // Picks a new random seed for each iteration.
+ random_seed_ = GetNextRandomSeed(random_seed_);
+ }
+ }
+
+ repeater->OnTestProgramEnd(*parent_);
+
+ // Returns 0 if all tests passed, or 1 other wise.
+ return failed ? 1 : 0;
+}
+
+// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
+// if the variable is present. If a file already exists at this location, this
+// function will write over it. If the variable is present, but the file cannot
+// be created, prints an error and exits.
+void WriteToShardStatusFileIfNeeded() {
+ const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);
+ if (test_shard_file != NULL) {
+ FILE* const file = posix::FOpen(test_shard_file, "w");
+ if (file == NULL) {
+ ColoredPrintf(COLOR_RED,
+ "Could not write to the test shard status file \"%s\" "
+ "specified by the %s environment variable.\n",
+ test_shard_file, kTestShardStatusFile);
+ fflush(stdout);
+ exit(EXIT_FAILURE);
+ }
+ fclose(file);
+ }
+}
+
+// Checks whether sharding is enabled by examining the relevant
+// environment variable values. If the variables are present,
+// but inconsistent (i.e., shard_index >= total_shards), prints
+// an error and exits. If in_subprocess_for_death_test, sharding is
+// disabled because it must only be applied to the original test
+// process. Otherwise, we could filter out death tests we intended to execute.
+bool ShouldShard(const char* total_shards_env,
+ const char* shard_index_env,
+ bool in_subprocess_for_death_test) {
+ if (in_subprocess_for_death_test) {
+ return false;
+ }
+
+ const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1);
+ const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1);
+
+ if (total_shards == -1 && shard_index == -1) {
+ return false;
+ } else if (total_shards == -1 && shard_index != -1) {
+ const Message msg = Message()
+ << "Invalid environment variables: you have "
+ << kTestShardIndex << " = " << shard_index
+ << ", but have left " << kTestTotalShards << " unset.\n";
+ ColoredPrintf(COLOR_RED, msg.GetString().c_str());
+ fflush(stdout);
+ exit(EXIT_FAILURE);
+ } else if (total_shards != -1 && shard_index == -1) {
+ const Message msg = Message()
+ << "Invalid environment variables: you have "
+ << kTestTotalShards << " = " << total_shards
+ << ", but have left " << kTestShardIndex << " unset.\n";
+ ColoredPrintf(COLOR_RED, msg.GetString().c_str());
+ fflush(stdout);
+ exit(EXIT_FAILURE);
+ } else if (shard_index < 0 || shard_index >= total_shards) {
+ const Message msg = Message()
+ << "Invalid environment variables: we require 0 <= "
+ << kTestShardIndex << " < " << kTestTotalShards
+ << ", but you have " << kTestShardIndex << "=" << shard_index
+ << ", " << kTestTotalShards << "=" << total_shards << ".\n";
+ ColoredPrintf(COLOR_RED, msg.GetString().c_str());
+ fflush(stdout);
+ exit(EXIT_FAILURE);
+ }
+
+ return total_shards > 1;
+}
+
+// Parses the environment variable var as an Int32. If it is unset,
+// returns default_val. If it is not an Int32, prints an error
+// and aborts.
+Int32 Int32FromEnvOrDie(const char* const var, Int32 default_val) {
+ const char* str_val = posix::GetEnv(var);
+ if (str_val == NULL) {
+ return default_val;
+ }
+
+ Int32 result;
+ if (!ParseInt32(Message() << "The value of environment variable " << var,
+ str_val, &result)) {
+ exit(EXIT_FAILURE);
+ }
+ return result;
+}
+
+// Given the total number of shards, the shard index, and the test id,
+// returns true iff the test should be run on this shard. The test id is
+// some arbitrary but unique non-negative integer assigned to each test
+// method. Assumes that 0 <= shard_index < total_shards.
+bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
+ return (test_id % total_shards) == shard_index;
+}
+
+// Compares the name of each test with the user-specified filter to
+// decide whether the test should be run, then records the result in
+// each TestCase and TestInfo object.
+// If shard_tests == true, further filters tests based on sharding
+// variables in the environment - see
+// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide.
+// Returns the number of tests that should run.
+int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
+ const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
+ Int32FromEnvOrDie(kTestTotalShards, -1) : -1;
+ const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ?
+ Int32FromEnvOrDie(kTestShardIndex, -1) : -1;
+
+ // num_runnable_tests are the number of tests that will
+ // run across all shards (i.e., match filter and are not disabled).
+ // num_selected_tests are the number of tests to be run on
+ // this shard.
+ int num_runnable_tests = 0;
+ int num_selected_tests = 0;
+ for (size_t i = 0; i < test_cases_.size(); i++) {
+ TestCase* const test_case = test_cases_[i];
+ const String &test_case_name = test_case->name();
+ test_case->set_should_run(false);
+
+ for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
+ TestInfo* const test_info = test_case->test_info_list()[j];
+ const String test_name(test_info->name());
+ // A test is disabled if test case name or test name matches
+ // kDisableTestFilter.
+ const bool is_disabled =
+ internal::UnitTestOptions::MatchesFilter(test_case_name,
+ kDisableTestFilter) ||
+ internal::UnitTestOptions::MatchesFilter(test_name,
+ kDisableTestFilter);
+ test_info->impl()->set_is_disabled(is_disabled);
+
+ const bool matches_filter =
+ internal::UnitTestOptions::FilterMatchesTest(test_case_name,
+ test_name);
+ test_info->impl()->set_matches_filter(matches_filter);
+
+ const bool is_runnable =
+ (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) &&
+ matches_filter;
+
+ const bool is_selected = is_runnable &&
+ (shard_tests == IGNORE_SHARDING_PROTOCOL ||
+ ShouldRunTestOnShard(total_shards, shard_index,
+ num_runnable_tests));
+
+ num_runnable_tests += is_runnable;
+ num_selected_tests += is_selected;
+
+ test_info->impl()->set_should_run(is_selected);
+ test_case->set_should_run(test_case->should_run() || is_selected);
+ }
+ }
+ return num_selected_tests;
+}
+
+// Prints the names of the tests matching the user-specified filter flag.
+void UnitTestImpl::ListTestsMatchingFilter() {
+ for (size_t i = 0; i < test_cases_.size(); i++) {
+ const TestCase* const test_case = test_cases_[i];
+ bool printed_test_case_name = false;
+
+ for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
+ const TestInfo* const test_info =
+ test_case->test_info_list()[j];
+ if (test_info->matches_filter()) {
+ if (!printed_test_case_name) {
+ printed_test_case_name = true;
+ printf("%s.\n", test_case->name());
+ }
+ printf(" %s\n", test_info->name());
+ }
+ }
+ }
+ fflush(stdout);
+}
+
+// Sets the OS stack trace getter.
+//
+// Does nothing if the input and the current OS stack trace getter are
+// the same; otherwise, deletes the old getter and makes the input the
+// current getter.
+void UnitTestImpl::set_os_stack_trace_getter(
+ OsStackTraceGetterInterface* getter) {
+ if (os_stack_trace_getter_ != getter) {
+ delete os_stack_trace_getter_;
+ os_stack_trace_getter_ = getter;
+ }
+}
+
+// Returns the current OS stack trace getter if it is not NULL;
+// otherwise, creates an OsStackTraceGetter, makes it the current
+// getter, and returns it.
+OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
+ if (os_stack_trace_getter_ == NULL) {
+ os_stack_trace_getter_ = new OsStackTraceGetter;
+ }
+
+ return os_stack_trace_getter_;
+}
+
+// Returns the TestResult for the test that's currently running, or
+// the TestResult for the ad hoc test if no test is running.
+TestResult* UnitTestImpl::current_test_result() {
+ return current_test_info_ ?
+ current_test_info_->impl()->result() : &ad_hoc_test_result_;
+}
+
+// Shuffles all test cases, and the tests within each test case,
+// making sure that death tests are still run first.
+void UnitTestImpl::ShuffleTests() {
+ // Shuffles the death test cases.
+ ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_);
+
+ // Shuffles the non-death test cases.
+ ShuffleRange(random(), last_death_test_case_ + 1,
+ static_cast<int>(test_cases_.size()), &test_case_indices_);
+
+ // Shuffles the tests inside each test case.
+ for (size_t i = 0; i < test_cases_.size(); i++) {
+ test_cases_[i]->ShuffleTests(random());
+ }
+}
+
+// Restores the test cases and tests to their order before the first shuffle.
+void UnitTestImpl::UnshuffleTests() {
+ for (size_t i = 0; i < test_cases_.size(); i++) {
+ // Unshuffles the tests in each test case.
+ test_cases_[i]->UnshuffleTests();
+ // Resets the index of each test case.
+ test_case_indices_[i] = static_cast<int>(i);
+ }
+}
+
+// TestInfoImpl constructor. The new instance assumes ownership of the test
+// factory object.
+TestInfoImpl::TestInfoImpl(TestInfo* parent,
+ const char* a_test_case_name,
+ const char* a_name,
+ const char* a_test_case_comment,
+ const char* a_comment,
+ TypeId a_fixture_class_id,
+ internal::TestFactoryBase* factory) :
+ parent_(parent),
+ test_case_name_(String(a_test_case_name)),
+ name_(String(a_name)),
+ test_case_comment_(String(a_test_case_comment)),
+ comment_(String(a_comment)),
+ fixture_class_id_(a_fixture_class_id),
+ should_run_(false),
+ is_disabled_(false),
+ matches_filter_(false),
+ factory_(factory) {
+}
+
+// TestInfoImpl destructor.
+TestInfoImpl::~TestInfoImpl() {
+ delete factory_;
+}
+
+// Returns the current OS stack trace as a String.
+//
+// The maximum number of stack frames to be included is specified by
+// the gtest_stack_trace_depth flag. The skip_count parameter
+// specifies the number of top frames to be skipped, which doesn't
+// count against the number of frames to be included.
+//
+// For example, if Foo() calls Bar(), which in turn calls
+// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
+// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
+String GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
+ int skip_count) {
+ // We pass skip_count + 1 to skip this wrapper function in addition
+ // to what the user really wants to skip.
+ return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
+}
+
+// Used by the GTEST_HIDE_UNREACHABLE_CODE_ macro to suppress unreachable
+// code warnings.
+namespace {
+class ClassUniqueToAlwaysTrue {};
+}
+
+bool IsTrue(bool condition) { return condition; }
+
+bool AlwaysTrue() {
+#if GTEST_HAS_EXCEPTIONS
+ // This condition is always false so AlwaysTrue() never actually throws,
+ // but it makes the compiler think that it may throw.
+ if (IsTrue(false))
+ throw ClassUniqueToAlwaysTrue();
+#endif // GTEST_HAS_EXCEPTIONS
+ return true;
+}
+
+// If *pstr starts with the given prefix, modifies *pstr to be right
+// past the prefix and returns true; otherwise leaves *pstr unchanged
+// and returns false. None of pstr, *pstr, and prefix can be NULL.
+bool SkipPrefix(const char* prefix, const char** pstr) {
+ const size_t prefix_len = strlen(prefix);
+ if (strncmp(*pstr, prefix, prefix_len) == 0) {
+ *pstr += prefix_len;
+ return true;
+ }
+ return false;
+}
+
+// Parses a string as a command line flag. The string should have
+// the format "--flag=value". When def_optional is true, the "=value"
+// part can be omitted.
+//
+// Returns the value of the flag, or NULL if the parsing failed.
+const char* ParseFlagValue(const char* str,
+ const char* flag,
+ bool def_optional) {
+ // str and flag must not be NULL.
+ if (str == NULL || flag == NULL) return NULL;
+
+ // The flag must start with "--" followed by GTEST_FLAG_PREFIX_.
+ const String flag_str = String::Format("--%s%s", GTEST_FLAG_PREFIX_, flag);
+ const size_t flag_len = flag_str.length();
+ if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
+
+ // Skips the flag name.
+ const char* flag_end = str + flag_len;
+
+ // When def_optional is true, it's OK to not have a "=value" part.
+ if (def_optional && (flag_end[0] == '\0')) {
+ return flag_end;
+ }
+
+ // If def_optional is true and there are more characters after the
+ // flag name, or if def_optional is false, there must be a '=' after
+ // the flag name.
+ if (flag_end[0] != '=') return NULL;
+
+ // Returns the string after "=".
+ return flag_end + 1;
+}
+
+// Parses a string for a bool flag, in the form of either
+// "--flag=value" or "--flag".
+//
+// In the former case, the value is taken as true as long as it does
+// not start with '0', 'f', or 'F'.
+//
+// In the latter case, the value is taken as true.
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
+ // Gets the value of the flag as a string.
+ const char* const value_str = ParseFlagValue(str, flag, true);
+
+ // Aborts if the parsing failed.
+ if (value_str == NULL) return false;
+
+ // Converts the string value to a bool.
+ *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
+ return true;
+}
+
+// Parses a string for an Int32 flag, in the form of
+// "--flag=value".
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
+ // Gets the value of the flag as a string.
+ const char* const value_str = ParseFlagValue(str, flag, false);
+
+ // Aborts if the parsing failed.
+ if (value_str == NULL) return false;
+
+ // Sets *value to the value of the flag.
+ return ParseInt32(Message() << "The value of flag --" << flag,
+ value_str, value);
+}
+
+// Parses a string for a string flag, in the form of
+// "--flag=value".
+//
+// On success, stores the value of the flag in *value, and returns
+// true. On failure, returns false without changing *value.
+bool ParseStringFlag(const char* str, const char* flag, String* value) {
+ // Gets the value of the flag as a string.
+ const char* const value_str = ParseFlagValue(str, flag, false);
+
+ // Aborts if the parsing failed.
+ if (value_str == NULL) return false;
+
+ // Sets *value to the value of the flag.
+ *value = value_str;
+ return true;
+}
+
+// Determines whether a string has a prefix that Google Test uses for its
+// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
+// If Google Test detects that a command line flag has its prefix but is not
+// recognized, it will print its help message. Flags starting with
+// GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test
+// internal flags and do not trigger the help message.
+static bool HasGoogleTestFlagPrefix(const char* str) {
+ return (SkipPrefix("--", &str) ||
+ SkipPrefix("-", &str) ||
+ SkipPrefix("/", &str)) &&
+ !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) &&
+ (SkipPrefix(GTEST_FLAG_PREFIX_, &str) ||
+ SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str));
+}
+
+// Prints a string containing code-encoded text. The following escape
+// sequences can be used in the string to control the text color:
+//
+// @@ prints a single '@' character.
+// @R changes the color to red.
+// @G changes the color to green.
+// @Y changes the color to yellow.
+// @D changes to the default terminal text color.
+//
+// TODO(wan@google.com): Write tests for this once we add stdout
+// capturing to Google Test.
+static void PrintColorEncoded(const char* str) {
+ GTestColor color = COLOR_DEFAULT; // The current color.
+
+ // Conceptually, we split the string into segments divided by escape
+ // sequences. Then we print one segment at a time. At the end of
+ // each iteration, the str pointer advances to the beginning of the
+ // next segment.
+ for (;;) {
+ const char* p = strchr(str, '@');
+ if (p == NULL) {
+ ColoredPrintf(color, "%s", str);
+ return;
+ }
+
+ ColoredPrintf(color, "%s", String(str, p - str).c_str());
+
+ const char ch = p[1];
+ str = p + 2;
+ if (ch == '@') {
+ ColoredPrintf(color, "@");
+ } else if (ch == 'D') {
+ color = COLOR_DEFAULT;
+ } else if (ch == 'R') {
+ color = COLOR_RED;
+ } else if (ch == 'G') {
+ color = COLOR_GREEN;
+ } else if (ch == 'Y') {
+ color = COLOR_YELLOW;
+ } else {
+ --str;
+ }
+ }
+}
+
+static const char kColorEncodedHelpMessage[] =
+"This program contains tests written using " GTEST_NAME_ ". You can use the\n"
+"following command line flags to control its behavior:\n"
+"\n"
+"Test Selection:\n"
+" @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n"
+" List the names of all tests instead of running them. The name of\n"
+" TEST(Foo, Bar) is \"Foo.Bar\".\n"
+" @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS"
+ "[@G-@YNEGATIVE_PATTERNS]@D\n"
+" Run only the tests whose name matches one of the positive patterns but\n"
+" none of the negative patterns. '?' matches any single character; '*'\n"
+" matches any substring; ':' separates two patterns.\n"
+" @G--" GTEST_FLAG_PREFIX_ "also_run_disabled_tests@D\n"
+" Run all disabled tests too.\n"
+"\n"
+"Test Execution:\n"
+" @G--" GTEST_FLAG_PREFIX_ "repeat=@Y[COUNT]@D\n"
+" Run the tests repeatedly; use a negative count to repeat forever.\n"
+" @G--" GTEST_FLAG_PREFIX_ "shuffle@D\n"
+" Randomize tests' orders on every iteration.\n"
+" @G--" GTEST_FLAG_PREFIX_ "random_seed=@Y[NUMBER]@D\n"
+" Random number seed to use for shuffling test orders (between 1 and\n"
+" 99999, or 0 to use a seed based on the current time).\n"
+"\n"
+"Test Output:\n"
+" @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n"
+" Enable/disable colored output. The default is @Gauto@D.\n"
+" -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n"
+" Don't print the elapsed time of each test.\n"
+" @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G"
+ GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n"
+" Generate an XML report in the given directory or with the given file\n"
+" name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n"
+"\n"
+"Assertion Behavior:\n"
+#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
+" @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n"
+" Set the default death test style.\n"
+#endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
+" @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n"
+" Turn assertion failures into debugger break-points.\n"
+" @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n"
+" Turn assertion failures into C++ exceptions.\n"
+#if GTEST_OS_WINDOWS
+" @G--" GTEST_FLAG_PREFIX_ "catch_exceptions@D\n"
+" Suppress pop-ups caused by exceptions.\n"
+#endif // GTEST_OS_WINDOWS
+"\n"
+"Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set "
+ "the corresponding\n"
+"environment variable of a flag (all letters in upper-case). For example, to\n"
+"disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_
+ "color=no@D or set\n"
+"the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n"
+"\n"
+"For more information, please read the " GTEST_NAME_ " documentation at\n"
+"@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n"
+"(not one in your own code or tests), please report it to\n"
+"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
+
+// Parses the command line for Google Test flags, without initializing
+// other parts of Google Test. The type parameter CharType can be
+// instantiated to either char or wchar_t.
+template <typename CharType>
+void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
+ for (int i = 1; i < *argc; i++) {
+ const String arg_string = StreamableToString(argv[i]);
+ const char* const arg = arg_string.c_str();
+
+ using internal::ParseBoolFlag;
+ using internal::ParseInt32Flag;
+ using internal::ParseStringFlag;
+
+ // Do we see a Google Test flag?
+ if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
+ &GTEST_FLAG(also_run_disabled_tests)) ||
+ ParseBoolFlag(arg, kBreakOnFailureFlag,
+ &GTEST_FLAG(break_on_failure)) ||
+ ParseBoolFlag(arg, kCatchExceptionsFlag,
+ &GTEST_FLAG(catch_exceptions)) ||
+ ParseStringFlag(arg, kColorFlag, &GTEST_FLAG(color)) ||
+ ParseStringFlag(arg, kDeathTestStyleFlag,
+ &GTEST_FLAG(death_test_style)) ||
+ ParseBoolFlag(arg, kDeathTestUseFork,
+ &GTEST_FLAG(death_test_use_fork)) ||
+ ParseStringFlag(arg, kFilterFlag, &GTEST_FLAG(filter)) ||
+ ParseStringFlag(arg, kInternalRunDeathTestFlag,
+ &GTEST_FLAG(internal_run_death_test)) ||
+ ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||
+ ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||
+ ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||
+ ParseInt32Flag(arg, kRandomSeedFlag, &GTEST_FLAG(random_seed)) ||
+ ParseInt32Flag(arg, kRepeatFlag, &GTEST_FLAG(repeat)) ||
+ ParseBoolFlag(arg, kShuffleFlag, &GTEST_FLAG(shuffle)) ||
+ ParseInt32Flag(arg, kStackTraceDepthFlag,
+ &GTEST_FLAG(stack_trace_depth)) ||
+ ParseBoolFlag(arg, kThrowOnFailureFlag, &GTEST_FLAG(throw_on_failure))
+ ) {
+ // Yes. Shift the remainder of the argv list left by one. Note
+ // that argv has (*argc + 1) elements, the last one always being
+ // NULL. The following loop moves the trailing NULL element as
+ // well.
+ for (int j = i; j != *argc; j++) {
+ argv[j] = argv[j + 1];
+ }
+
+ // Decrements the argument count.
+ (*argc)--;
+
+ // We also need to decrement the iterator as we just removed
+ // an element.
+ i--;
+ } else if (arg_string == "--help" || arg_string == "-h" ||
+ arg_string == "-?" || arg_string == "/?" ||
+ HasGoogleTestFlagPrefix(arg)) {
+ // Both help flag and unrecognized Google Test flags (excluding
+ // internal ones) trigger help display.
+ g_help_flag = true;
+ }
+ }
+
+ if (g_help_flag) {
+ // We print the help here instead of in RUN_ALL_TESTS(), as the
+ // latter may not be called at all if the user is using Google
+ // Test with another testing framework.
+ PrintColorEncoded(kColorEncodedHelpMessage);
+ }
+}
+
+// Parses the command line for Google Test flags, without initializing
+// other parts of Google Test.
+void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
+ ParseGoogleTestFlagsOnlyImpl(argc, argv);
+}
+void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
+ ParseGoogleTestFlagsOnlyImpl(argc, argv);
+}
+
+// The internal implementation of InitGoogleTest().
+//
+// The type parameter CharType can be instantiated to either char or
+// wchar_t.
+template <typename CharType>
+void InitGoogleTestImpl(int* argc, CharType** argv) {
+ g_init_gtest_count++;
+
+ // We don't want to run the initialization code twice.
+ if (g_init_gtest_count != 1) return;
+
+ if (*argc <= 0) return;
+
+ internal::g_executable_path = internal::StreamableToString(argv[0]);
+
+#if GTEST_HAS_DEATH_TEST
+ g_argvs.clear();
+ for (int i = 0; i != *argc; i++) {
+ g_argvs.push_back(StreamableToString(argv[i]));
+ }
+#endif // GTEST_HAS_DEATH_TEST
+
+ ParseGoogleTestFlagsOnly(argc, argv);
+ GetUnitTestImpl()->PostFlagParsingInit();
+}
+
+} // namespace internal
+
+// Initializes Google Test. This must be called before calling
+// RUN_ALL_TESTS(). In particular, it parses a command line for the
+// flags that Google Test recognizes. Whenever a Google Test flag is
+// seen, it is removed from argv, and *argc is decremented.
+//
+// No value is returned. Instead, the Google Test flag variables are
+// updated.
+//
+// Calling the function for the second time has no user-visible effect.
+void InitGoogleTest(int* argc, char** argv) {
+ internal::InitGoogleTestImpl(argc, argv);
+}
+
+// This overloaded version can be used in Windows programs compiled in
+// UNICODE mode.
+void InitGoogleTest(int* argc, wchar_t** argv) {
+ internal::InitGoogleTestImpl(argc, argv);
+}
+
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest_main.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest_main.cc
new file mode 100644
index 0000000..d20c02f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/src/gtest_main.cc
@@ -0,0 +1,39 @@
+// Copyright 2006, 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 <iostream>
+
+#include <gtest/gtest.h>
+
+int main(int argc, char **argv) {
+ std::cout << "Running main() from gtest_main.cc\n";
+
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-death-test_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-death-test_test.cc
new file mode 100644
index 0000000..ed5b53b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-death-test_test.cc
@@ -0,0 +1,1230 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+//
+// Tests for death tests.
+
+#include <gtest/gtest-death-test.h>
+#include <gtest/gtest.h>
+#include <gtest/internal/gtest-filepath.h>
+
+using testing::internal::AlwaysFalse;
+using testing::internal::AlwaysTrue;
+
+#if GTEST_HAS_DEATH_TEST
+
+#if GTEST_OS_WINDOWS
+#include <direct.h> // For chdir().
+#else
+#include <unistd.h>
+#include <sys/wait.h> // For waitpid.
+#include <limits> // For std::numeric_limits.
+#endif // GTEST_OS_WINDOWS
+
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+
+#include <gtest/gtest-spi.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+namespace posix = ::testing::internal::posix;
+
+using testing::Message;
+using testing::internal::DeathTest;
+using testing::internal::DeathTestFactory;
+using testing::internal::FilePath;
+using testing::internal::GetLastErrnoDescription;
+using testing::internal::GetUnitTestImpl;
+using testing::internal::ParseNaturalNumber;
+using testing::internal::String;
+
+namespace testing {
+namespace internal {
+
+// A helper class whose objects replace the death test factory for a
+// single UnitTest object during their lifetimes.
+class ReplaceDeathTestFactory {
+ public:
+ explicit ReplaceDeathTestFactory(DeathTestFactory* new_factory)
+ : unit_test_impl_(GetUnitTestImpl()) {
+ old_factory_ = unit_test_impl_->death_test_factory_.release();
+ unit_test_impl_->death_test_factory_.reset(new_factory);
+ }
+
+ ~ReplaceDeathTestFactory() {
+ unit_test_impl_->death_test_factory_.release();
+ unit_test_impl_->death_test_factory_.reset(old_factory_);
+ }
+ private:
+ // Prevents copying ReplaceDeathTestFactory objects.
+ ReplaceDeathTestFactory(const ReplaceDeathTestFactory&);
+ void operator=(const ReplaceDeathTestFactory&);
+
+ UnitTestImpl* unit_test_impl_;
+ DeathTestFactory* old_factory_;
+};
+
+} // namespace internal
+} // namespace testing
+
+void DieInside(const char* function) {
+ fprintf(stderr, "death inside %s().", function);
+ fflush(stderr);
+ // We call _exit() instead of exit(), as the former is a direct
+ // system call and thus safer in the presence of threads. exit()
+ // will invoke user-defined exit-hooks, which may do dangerous
+ // things that conflict with death tests.
+ //
+ // Some compilers can recognize that _exit() never returns and issue the
+ // 'unreachable code' warning for code following this function, unless
+ // fooled by a fake condition.
+ if (AlwaysTrue())
+ _exit(1);
+}
+
+// Tests that death tests work.
+
+class TestForDeathTest : public testing::Test {
+ protected:
+ TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}
+
+ virtual ~TestForDeathTest() {
+ posix::ChDir(original_dir_.c_str());
+ }
+
+ // A static member function that's expected to die.
+ static void StaticMemberFunction() { DieInside("StaticMemberFunction"); }
+
+ // A method of the test fixture that may die.
+ void MemberFunction() {
+ if (should_die_)
+ DieInside("MemberFunction");
+ }
+
+ // True iff MemberFunction() should die.
+ bool should_die_;
+ const FilePath original_dir_;
+};
+
+// A class with a member function that may die.
+class MayDie {
+ public:
+ explicit MayDie(bool should_die) : should_die_(should_die) {}
+
+ // A member function that may die.
+ void MemberFunction() const {
+ if (should_die_)
+ DieInside("MayDie::MemberFunction");
+ }
+
+ private:
+ // True iff MemberFunction() should die.
+ bool should_die_;
+};
+
+// A global function that's expected to die.
+void GlobalFunction() { DieInside("GlobalFunction"); }
+
+// A non-void function that's expected to die.
+int NonVoidFunction() {
+ DieInside("NonVoidFunction");
+ return 1;
+}
+
+// A unary function that may die.
+void DieIf(bool should_die) {
+ if (should_die)
+ DieInside("DieIf");
+}
+
+// A binary function that may die.
+bool DieIfLessThan(int x, int y) {
+ if (x < y) {
+ DieInside("DieIfLessThan");
+ }
+ return true;
+}
+
+// Tests that ASSERT_DEATH can be used outside a TEST, TEST_F, or test fixture.
+void DeathTestSubroutine() {
+ EXPECT_DEATH(GlobalFunction(), "death.*GlobalFunction");
+ ASSERT_DEATH(GlobalFunction(), "death.*GlobalFunction");
+}
+
+// Death in dbg, not opt.
+int DieInDebugElse12(int* sideeffect) {
+ if (sideeffect) *sideeffect = 12;
+#ifndef NDEBUG
+ DieInside("DieInDebugElse12");
+#endif // NDEBUG
+ return 12;
+}
+
+#if GTEST_OS_WINDOWS
+
+// Tests the ExitedWithCode predicate.
+TEST(ExitStatusPredicateTest, ExitedWithCode) {
+ // On Windows, the process's exit code is the same as its exit status,
+ // so the predicate just compares the its input with its parameter.
+ EXPECT_TRUE(testing::ExitedWithCode(0)(0));
+ EXPECT_TRUE(testing::ExitedWithCode(1)(1));
+ EXPECT_TRUE(testing::ExitedWithCode(42)(42));
+ EXPECT_FALSE(testing::ExitedWithCode(0)(1));
+ EXPECT_FALSE(testing::ExitedWithCode(1)(0));
+}
+
+#else
+
+// Returns the exit status of a process that calls _exit(2) with a
+// given exit code. This is a helper function for the
+// ExitStatusPredicateTest test suite.
+static int NormalExitStatus(int exit_code) {
+ pid_t child_pid = fork();
+ if (child_pid == 0) {
+ _exit(exit_code);
+ }
+ int status;
+ waitpid(child_pid, &status, 0);
+ return status;
+}
+
+// Returns the exit status of a process that raises a given signal.
+// If the signal does not cause the process to die, then it returns
+// instead the exit status of a process that exits normally with exit
+// code 1. This is a helper function for the ExitStatusPredicateTest
+// test suite.
+static int KilledExitStatus(int signum) {
+ pid_t child_pid = fork();
+ if (child_pid == 0) {
+ raise(signum);
+ _exit(1);
+ }
+ int status;
+ waitpid(child_pid, &status, 0);
+ return status;
+}
+
+// Tests the ExitedWithCode predicate.
+TEST(ExitStatusPredicateTest, ExitedWithCode) {
+ const int status0 = NormalExitStatus(0);
+ const int status1 = NormalExitStatus(1);
+ const int status42 = NormalExitStatus(42);
+ const testing::ExitedWithCode pred0(0);
+ const testing::ExitedWithCode pred1(1);
+ const testing::ExitedWithCode pred42(42);
+ EXPECT_PRED1(pred0, status0);
+ EXPECT_PRED1(pred1, status1);
+ EXPECT_PRED1(pred42, status42);
+ EXPECT_FALSE(pred0(status1));
+ EXPECT_FALSE(pred42(status0));
+ EXPECT_FALSE(pred1(status42));
+}
+
+// Tests the KilledBySignal predicate.
+TEST(ExitStatusPredicateTest, KilledBySignal) {
+ const int status_segv = KilledExitStatus(SIGSEGV);
+ const int status_kill = KilledExitStatus(SIGKILL);
+ const testing::KilledBySignal pred_segv(SIGSEGV);
+ const testing::KilledBySignal pred_kill(SIGKILL);
+ EXPECT_PRED1(pred_segv, status_segv);
+ EXPECT_PRED1(pred_kill, status_kill);
+ EXPECT_FALSE(pred_segv(status_kill));
+ EXPECT_FALSE(pred_kill(status_segv));
+}
+
+#endif // GTEST_OS_WINDOWS
+
+// Tests that the death test macros expand to code which may or may not
+// be followed by operator<<, and that in either case the complete text
+// comprises only a single C++ statement.
+TEST_F(TestForDeathTest, SingleStatement) {
+ if (AlwaysFalse())
+ // This would fail if executed; this is a compilation test only
+ ASSERT_DEATH(return, "");
+
+ if (AlwaysTrue())
+ EXPECT_DEATH(_exit(1), "");
+ else
+ // This empty "else" branch is meant to ensure that EXPECT_DEATH
+ // doesn't expand into an "if" statement without an "else"
+ ;
+
+ if (AlwaysFalse())
+ ASSERT_DEATH(return, "") << "did not die";
+
+ if (AlwaysFalse())
+ ;
+ else
+ EXPECT_DEATH(_exit(1), "") << 1 << 2 << 3;
+}
+
+void DieWithEmbeddedNul() {
+ fprintf(stderr, "Hello%cmy null world.\n", '\0');
+ fflush(stderr);
+ _exit(1);
+}
+
+#if GTEST_USES_PCRE
+// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
+// message has a NUL character in it.
+TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
+ // TODO(wan@google.com): <regex.h> doesn't support matching strings
+ // with embedded NUL characters - find a way to workaround it.
+ EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
+ ASSERT_DEATH(DieWithEmbeddedNul(), "my null world");
+}
+#endif // GTEST_USES_PCRE
+
+// Tests that death test macros expand to code which interacts well with switch
+// statements.
+TEST_F(TestForDeathTest, SwitchStatement) {
+// Microsoft compiler usually complains about switch statements without
+// case labels. We suppress that warning for this test.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4065)
+#endif // _MSC_VER
+
+ switch (0)
+ default:
+ ASSERT_DEATH(_exit(1), "") << "exit in default switch handler";
+
+ switch (0)
+ case 0:
+ EXPECT_DEATH(_exit(1), "") << "exit in switch case";
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif // _MSC_VER
+}
+
+// Tests that a static member function can be used in a "fast" style
+// death test.
+TEST_F(TestForDeathTest, StaticMemberFunctionFastStyle) {
+ testing::GTEST_FLAG(death_test_style) = "fast";
+ ASSERT_DEATH(StaticMemberFunction(), "death.*StaticMember");
+}
+
+// Tests that a method of the test fixture can be used in a "fast"
+// style death test.
+TEST_F(TestForDeathTest, MemberFunctionFastStyle) {
+ testing::GTEST_FLAG(death_test_style) = "fast";
+ should_die_ = true;
+ EXPECT_DEATH(MemberFunction(), "inside.*MemberFunction");
+}
+
+void ChangeToRootDir() { posix::ChDir(GTEST_PATH_SEP_); }
+
+// Tests that death tests work even if the current directory has been
+// changed.
+TEST_F(TestForDeathTest, FastDeathTestInChangedDir) {
+ testing::GTEST_FLAG(death_test_style) = "fast";
+
+ ChangeToRootDir();
+ EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
+
+ ChangeToRootDir();
+ ASSERT_DEATH(_exit(1), "");
+}
+
+// Repeats a representative sample of death tests in the "threadsafe" style:
+
+TEST_F(TestForDeathTest, StaticMemberFunctionThreadsafeStyle) {
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
+ ASSERT_DEATH(StaticMemberFunction(), "death.*StaticMember");
+}
+
+TEST_F(TestForDeathTest, MemberFunctionThreadsafeStyle) {
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
+ should_die_ = true;
+ EXPECT_DEATH(MemberFunction(), "inside.*MemberFunction");
+}
+
+TEST_F(TestForDeathTest, ThreadsafeDeathTestInLoop) {
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
+
+ for (int i = 0; i < 3; ++i)
+ EXPECT_EXIT(_exit(i), testing::ExitedWithCode(i), "") << ": i = " << i;
+}
+
+TEST_F(TestForDeathTest, ThreadsafeDeathTestInChangedDir) {
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
+
+ ChangeToRootDir();
+ EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
+
+ ChangeToRootDir();
+ ASSERT_DEATH(_exit(1), "");
+}
+
+TEST_F(TestForDeathTest, MixedStyles) {
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
+ EXPECT_DEATH(_exit(1), "");
+ testing::GTEST_FLAG(death_test_style) = "fast";
+ EXPECT_DEATH(_exit(1), "");
+}
+
+namespace {
+
+bool pthread_flag;
+
+void SetPthreadFlag() {
+ pthread_flag = true;
+}
+
+} // namespace
+
+#if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
+
+TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
+ if (!testing::GTEST_FLAG(death_test_use_fork)) {
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
+ pthread_flag = false;
+ ASSERT_EQ(0, pthread_atfork(&SetPthreadFlag, NULL, NULL));
+ ASSERT_DEATH(_exit(1), "");
+ ASSERT_FALSE(pthread_flag);
+ }
+}
+
+#endif // GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
+
+// Tests that a method of another class can be used in a death test.
+TEST_F(TestForDeathTest, MethodOfAnotherClass) {
+ const MayDie x(true);
+ ASSERT_DEATH(x.MemberFunction(), "MayDie\\:\\:MemberFunction");
+}
+
+// Tests that a global function can be used in a death test.
+TEST_F(TestForDeathTest, GlobalFunction) {
+ EXPECT_DEATH(GlobalFunction(), "GlobalFunction");
+}
+
+// Tests that any value convertible to an RE works as a second
+// argument to EXPECT_DEATH.
+TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
+ static const char regex_c_str[] = "GlobalFunction";
+ EXPECT_DEATH(GlobalFunction(), regex_c_str);
+
+ const testing::internal::RE regex(regex_c_str);
+ EXPECT_DEATH(GlobalFunction(), regex);
+
+#if GTEST_HAS_GLOBAL_STRING
+ const string regex_str(regex_c_str);
+ EXPECT_DEATH(GlobalFunction(), regex_str);
+#endif // GTEST_HAS_GLOBAL_STRING
+
+ const ::std::string regex_std_str(regex_c_str);
+ EXPECT_DEATH(GlobalFunction(), regex_std_str);
+}
+
+// Tests that a non-void function can be used in a death test.
+TEST_F(TestForDeathTest, NonVoidFunction) {
+ ASSERT_DEATH(NonVoidFunction(), "NonVoidFunction");
+}
+
+// Tests that functions that take parameter(s) can be used in a death test.
+TEST_F(TestForDeathTest, FunctionWithParameter) {
+ EXPECT_DEATH(DieIf(true), "DieIf\\(\\)");
+ EXPECT_DEATH(DieIfLessThan(2, 3), "DieIfLessThan");
+}
+
+// Tests that ASSERT_DEATH can be used outside a TEST, TEST_F, or test fixture.
+TEST_F(TestForDeathTest, OutsideFixture) {
+ DeathTestSubroutine();
+}
+
+// Tests that death tests can be done inside a loop.
+TEST_F(TestForDeathTest, InsideLoop) {
+ for (int i = 0; i < 5; i++) {
+ EXPECT_DEATH(DieIfLessThan(-1, i), "DieIfLessThan") << "where i == " << i;
+ }
+}
+
+// Tests that a compound statement can be used in a death test.
+TEST_F(TestForDeathTest, CompoundStatement) {
+ EXPECT_DEATH({ // NOLINT
+ const int x = 2;
+ const int y = x + 1;
+ DieIfLessThan(x, y);
+ },
+ "DieIfLessThan");
+}
+
+// Tests that code that doesn't die causes a death test to fail.
+TEST_F(TestForDeathTest, DoesNotDie) {
+ EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(DieIf(false), "DieIf"),
+ "failed to die");
+}
+
+// Tests that a death test fails when the error message isn't expected.
+TEST_F(TestForDeathTest, ErrorMessageMismatch) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_DEATH(DieIf(true), "DieIfLessThan") << "End of death test message.";
+ }, "died but not with expected error");
+}
+
+// On exit, *aborted will be true iff the EXPECT_DEATH() statement
+// aborted the function.
+void ExpectDeathTestHelper(bool* aborted) {
+ *aborted = true;
+ EXPECT_DEATH(DieIf(false), "DieIf"); // This assertion should fail.
+ *aborted = false;
+}
+
+// Tests that EXPECT_DEATH doesn't abort the test on failure.
+TEST_F(TestForDeathTest, EXPECT_DEATH) {
+ bool aborted = true;
+ EXPECT_NONFATAL_FAILURE(ExpectDeathTestHelper(&aborted),
+ "failed to die");
+ EXPECT_FALSE(aborted);
+}
+
+// Tests that ASSERT_DEATH does abort the test on failure.
+TEST_F(TestForDeathTest, ASSERT_DEATH) {
+ static bool aborted;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ aborted = true;
+ ASSERT_DEATH(DieIf(false), "DieIf"); // This assertion should fail.
+ aborted = false;
+ }, "failed to die");
+ EXPECT_TRUE(aborted);
+}
+
+// Tests that EXPECT_DEATH evaluates the arguments exactly once.
+TEST_F(TestForDeathTest, SingleEvaluation) {
+ int x = 3;
+ EXPECT_DEATH(DieIf((++x) == 4), "DieIf");
+
+ const char* regex = "DieIf";
+ const char* regex_save = regex;
+ EXPECT_DEATH(DieIfLessThan(3, 4), regex++);
+ EXPECT_EQ(regex_save + 1, regex);
+}
+
+// Tests that run-away death tests are reported as failures.
+TEST_F(TestForDeathTest, Runaway) {
+ EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(static_cast<void>(0), "Foo"),
+ "failed to die.");
+
+ EXPECT_FATAL_FAILURE(ASSERT_DEATH(return, "Bar"),
+ "illegal return in test statement.");
+}
+
+
+// Tests that EXPECT_DEBUG_DEATH works as expected,
+// that is, in debug mode, it:
+// 1. Asserts on death.
+// 2. Has no side effect.
+//
+// And in opt mode, it:
+// 1. Has side effects but does not assert.
+TEST_F(TestForDeathTest, TestExpectDebugDeath) {
+ int sideeffect = 0;
+
+ EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect),
+ "death.*DieInDebugElse12");
+
+#ifdef NDEBUG
+ // Checks that the assignment occurs in opt mode (sideeffect).
+ EXPECT_EQ(12, sideeffect);
+#else
+ // Checks that the assignment does not occur in dbg mode (no sideeffect).
+ EXPECT_EQ(0, sideeffect);
+#endif
+}
+
+// Tests that ASSERT_DEBUG_DEATH works as expected
+// In debug mode:
+// 1. Asserts on debug death.
+// 2. Has no side effect.
+//
+// In opt mode:
+// 1. Has side effects and returns the expected value (12).
+TEST_F(TestForDeathTest, TestAssertDebugDeath) {
+ int sideeffect = 0;
+
+ ASSERT_DEBUG_DEATH({ // NOLINT
+ // Tests that the return value is 12 in opt mode.
+ EXPECT_EQ(12, DieInDebugElse12(&sideeffect));
+ // Tests that the side effect occurred in opt mode.
+ EXPECT_EQ(12, sideeffect);
+ }, "death.*DieInDebugElse12");
+
+#ifdef NDEBUG
+ // Checks that the assignment occurs in opt mode (sideeffect).
+ EXPECT_EQ(12, sideeffect);
+#else
+ // Checks that the assignment does not occur in dbg mode (no sideeffect).
+ EXPECT_EQ(0, sideeffect);
+#endif
+}
+
+#ifndef NDEBUG
+
+void ExpectDebugDeathHelper(bool* aborted) {
+ *aborted = true;
+ EXPECT_DEBUG_DEATH(return, "") << "This is expected to fail.";
+ *aborted = false;
+}
+
+#if GTEST_OS_WINDOWS
+TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
+ printf("This test should be considered failing if it shows "
+ "any pop-up dialogs.\n");
+ fflush(stdout);
+
+ EXPECT_DEATH({
+ testing::GTEST_FLAG(catch_exceptions) = false;
+ abort();
+ }, "");
+}
+
+TEST(PopUpDeathTest, DoesNotShowPopUpOnThrow) {
+ printf("This test should be considered failing if it shows "
+ "any pop-up dialogs.\n");
+ fflush(stdout);
+
+ EXPECT_DEATH({
+ testing::GTEST_FLAG(catch_exceptions) = false;
+ throw 1;
+ }, "");
+}
+#endif // GTEST_OS_WINDOWS
+
+// Tests that EXPECT_DEBUG_DEATH in debug mode does not abort
+// the function.
+TEST_F(TestForDeathTest, ExpectDebugDeathDoesNotAbort) {
+ bool aborted = true;
+ EXPECT_NONFATAL_FAILURE(ExpectDebugDeathHelper(&aborted), "");
+ EXPECT_FALSE(aborted);
+}
+
+void AssertDebugDeathHelper(bool* aborted) {
+ *aborted = true;
+ ASSERT_DEBUG_DEATH(return, "") << "This is expected to fail.";
+ *aborted = false;
+}
+
+// Tests that ASSERT_DEBUG_DEATH in debug mode aborts the function on
+// failure.
+TEST_F(TestForDeathTest, AssertDebugDeathAborts) {
+ static bool aborted;
+ aborted = false;
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+ EXPECT_TRUE(aborted);
+}
+
+#endif // _NDEBUG
+
+// Tests the *_EXIT family of macros, using a variety of predicates.
+static void TestExitMacros() {
+ EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
+ ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), "");
+
+#if GTEST_OS_WINDOWS
+ // Of all signals effects on the process exit code, only those of SIGABRT
+ // are documented on Windows.
+ // See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
+ EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "");
+#else
+ EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
+ ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
+
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "")
+ << "This failure is expected, too.";
+ }, "This failure is expected, too.");
+#endif // GTEST_OS_WINDOWS
+
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
+ << "This failure is expected.";
+ }, "This failure is expected.");
+}
+
+TEST_F(TestForDeathTest, ExitMacros) {
+ TestExitMacros();
+}
+
+TEST_F(TestForDeathTest, ExitMacrosUsingFork) {
+ testing::GTEST_FLAG(death_test_use_fork) = true;
+ TestExitMacros();
+}
+
+TEST_F(TestForDeathTest, InvalidStyle) {
+ testing::GTEST_FLAG(death_test_style) = "rococo";
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_DEATH(_exit(0), "") << "This failure is expected.";
+ }, "This failure is expected.");
+}
+
+// A DeathTestFactory that returns MockDeathTests.
+class MockDeathTestFactory : public DeathTestFactory {
+ public:
+ MockDeathTestFactory();
+ virtual bool Create(const char* statement,
+ const ::testing::internal::RE* regex,
+ const char* file, int line, DeathTest** test);
+
+ // Sets the parameters for subsequent calls to Create.
+ void SetParameters(bool create, DeathTest::TestRole role,
+ int status, bool passed);
+
+ // Accessors.
+ int AssumeRoleCalls() const { return assume_role_calls_; }
+ int WaitCalls() const { return wait_calls_; }
+ int PassedCalls() const { return passed_args_.size(); }
+ bool PassedArgument(int n) const { return passed_args_[n]; }
+ int AbortCalls() const { return abort_args_.size(); }
+ DeathTest::AbortReason AbortArgument(int n) const {
+ return abort_args_[n];
+ }
+ bool TestDeleted() const { return test_deleted_; }
+
+ private:
+ friend class MockDeathTest;
+ // If true, Create will return a MockDeathTest; otherwise it returns
+ // NULL.
+ bool create_;
+ // The value a MockDeathTest will return from its AssumeRole method.
+ DeathTest::TestRole role_;
+ // The value a MockDeathTest will return from its Wait method.
+ int status_;
+ // The value a MockDeathTest will return from its Passed method.
+ bool passed_;
+
+ // Number of times AssumeRole was called.
+ int assume_role_calls_;
+ // Number of times Wait was called.
+ int wait_calls_;
+ // The arguments to the calls to Passed since the last call to
+ // SetParameters.
+ std::vector<bool> passed_args_;
+ // The arguments to the calls to Abort since the last call to
+ // SetParameters.
+ std::vector<DeathTest::AbortReason> abort_args_;
+ // True if the last MockDeathTest returned by Create has been
+ // deleted.
+ bool test_deleted_;
+};
+
+
+// A DeathTest implementation useful in testing. It returns values set
+// at its creation from its various inherited DeathTest methods, and
+// reports calls to those methods to its parent MockDeathTestFactory
+// object.
+class MockDeathTest : public DeathTest {
+ public:
+ MockDeathTest(MockDeathTestFactory *parent,
+ TestRole role, int status, bool passed) :
+ parent_(parent), role_(role), status_(status), passed_(passed) {
+ }
+ virtual ~MockDeathTest() {
+ parent_->test_deleted_ = true;
+ }
+ virtual TestRole AssumeRole() {
+ ++parent_->assume_role_calls_;
+ return role_;
+ }
+ virtual int Wait() {
+ ++parent_->wait_calls_;
+ return status_;
+ }
+ virtual bool Passed(bool exit_status_ok) {
+ parent_->passed_args_.push_back(exit_status_ok);
+ return passed_;
+ }
+ virtual void Abort(AbortReason reason) {
+ parent_->abort_args_.push_back(reason);
+ }
+ private:
+ MockDeathTestFactory* const parent_;
+ const TestRole role_;
+ const int status_;
+ const bool passed_;
+};
+
+
+// MockDeathTestFactory constructor.
+MockDeathTestFactory::MockDeathTestFactory()
+ : create_(true),
+ role_(DeathTest::OVERSEE_TEST),
+ status_(0),
+ passed_(true),
+ assume_role_calls_(0),
+ wait_calls_(0),
+ passed_args_(),
+ abort_args_() {
+}
+
+
+// Sets the parameters for subsequent calls to Create.
+void MockDeathTestFactory::SetParameters(bool create,
+ DeathTest::TestRole role,
+ int status, bool passed) {
+ create_ = create;
+ role_ = role;
+ status_ = status;
+ passed_ = passed;
+
+ assume_role_calls_ = 0;
+ wait_calls_ = 0;
+ passed_args_.clear();
+ abort_args_.clear();
+}
+
+
+// Sets test to NULL (if create_ is false) or to the address of a new
+// MockDeathTest object with parameters taken from the last call
+// to SetParameters (if create_ is true). Always returns true.
+bool MockDeathTestFactory::Create(const char* /*statement*/,
+ const ::testing::internal::RE* /*regex*/,
+ const char* /*file*/,
+ int /*line*/,
+ DeathTest** test) {
+ test_deleted_ = false;
+ if (create_) {
+ *test = new MockDeathTest(this, role_, status_, passed_);
+ } else {
+ *test = NULL;
+ }
+ return true;
+}
+
+// A test fixture for testing the logic of the GTEST_DEATH_TEST_ macro.
+// It installs a MockDeathTestFactory that is used for the duration
+// of the test case.
+class MacroLogicDeathTest : public testing::Test {
+ protected:
+ static testing::internal::ReplaceDeathTestFactory* replacer_;
+ static MockDeathTestFactory* factory_;
+
+ static void SetUpTestCase() {
+ factory_ = new MockDeathTestFactory;
+ replacer_ = new testing::internal::ReplaceDeathTestFactory(factory_);
+ }
+
+ static void TearDownTestCase() {
+ delete replacer_;
+ replacer_ = NULL;
+ delete factory_;
+ factory_ = NULL;
+ }
+
+ // Runs a death test that breaks the rules by returning. Such a death
+ // test cannot be run directly from a test routine that uses a
+ // MockDeathTest, or the remainder of the routine will not be executed.
+ static void RunReturningDeathTest(bool* flag) {
+ ASSERT_DEATH({ // NOLINT
+ *flag = true;
+ return;
+ }, "");
+ }
+};
+
+testing::internal::ReplaceDeathTestFactory* MacroLogicDeathTest::replacer_
+ = NULL;
+MockDeathTestFactory* MacroLogicDeathTest::factory_ = NULL;
+
+
+// Test that nothing happens when the factory doesn't return a DeathTest:
+TEST_F(MacroLogicDeathTest, NothingHappens) {
+ bool flag = false;
+ factory_->SetParameters(false, DeathTest::OVERSEE_TEST, 0, true);
+ EXPECT_DEATH(flag = true, "");
+ EXPECT_FALSE(flag);
+ EXPECT_EQ(0, factory_->AssumeRoleCalls());
+ EXPECT_EQ(0, factory_->WaitCalls());
+ EXPECT_EQ(0, factory_->PassedCalls());
+ EXPECT_EQ(0, factory_->AbortCalls());
+ EXPECT_FALSE(factory_->TestDeleted());
+}
+
+// Test that the parent process doesn't run the death test code,
+// and that the Passed method returns false when the (simulated)
+// child process exits with status 0:
+TEST_F(MacroLogicDeathTest, ChildExitsSuccessfully) {
+ bool flag = false;
+ factory_->SetParameters(true, DeathTest::OVERSEE_TEST, 0, true);
+ EXPECT_DEATH(flag = true, "");
+ EXPECT_FALSE(flag);
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
+ EXPECT_EQ(1, factory_->WaitCalls());
+ ASSERT_EQ(1, factory_->PassedCalls());
+ EXPECT_FALSE(factory_->PassedArgument(0));
+ EXPECT_EQ(0, factory_->AbortCalls());
+ EXPECT_TRUE(factory_->TestDeleted());
+}
+
+// Tests that the Passed method was given the argument "true" when
+// the (simulated) child process exits with status 1:
+TEST_F(MacroLogicDeathTest, ChildExitsUnsuccessfully) {
+ bool flag = false;
+ factory_->SetParameters(true, DeathTest::OVERSEE_TEST, 1, true);
+ EXPECT_DEATH(flag = true, "");
+ EXPECT_FALSE(flag);
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
+ EXPECT_EQ(1, factory_->WaitCalls());
+ ASSERT_EQ(1, factory_->PassedCalls());
+ EXPECT_TRUE(factory_->PassedArgument(0));
+ EXPECT_EQ(0, factory_->AbortCalls());
+ EXPECT_TRUE(factory_->TestDeleted());
+}
+
+// Tests that the (simulated) child process executes the death test
+// code, and is aborted with the correct AbortReason if it
+// executes a return statement.
+TEST_F(MacroLogicDeathTest, ChildPerformsReturn) {
+ bool flag = false;
+ factory_->SetParameters(true, DeathTest::EXECUTE_TEST, 0, true);
+ RunReturningDeathTest(&flag);
+ EXPECT_TRUE(flag);
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
+ EXPECT_EQ(0, factory_->WaitCalls());
+ EXPECT_EQ(0, factory_->PassedCalls());
+ EXPECT_EQ(1, factory_->AbortCalls());
+ EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
+ factory_->AbortArgument(0));
+ EXPECT_TRUE(factory_->TestDeleted());
+}
+
+// Tests that the (simulated) child process is aborted with the
+// correct AbortReason if it does not die.
+TEST_F(MacroLogicDeathTest, ChildDoesNotDie) {
+ bool flag = false;
+ factory_->SetParameters(true, DeathTest::EXECUTE_TEST, 0, true);
+ EXPECT_DEATH(flag = true, "");
+ EXPECT_TRUE(flag);
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
+ EXPECT_EQ(0, factory_->WaitCalls());
+ EXPECT_EQ(0, factory_->PassedCalls());
+ // This time there are two calls to Abort: one since the test didn't
+ // die, and another from the ReturnSentinel when it's destroyed. The
+ // sentinel normally isn't destroyed if a test doesn't die, since
+ // _exit(2) is called in that case by ForkingDeathTest, but not by
+ // our MockDeathTest.
+ ASSERT_EQ(2, factory_->AbortCalls());
+ EXPECT_EQ(DeathTest::TEST_DID_NOT_DIE,
+ factory_->AbortArgument(0));
+ EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
+ factory_->AbortArgument(1));
+ EXPECT_TRUE(factory_->TestDeleted());
+}
+
+// Tests that a successful death test does not register a successful
+// test part.
+TEST(SuccessRegistrationDeathTest, NoSuccessPart) {
+ EXPECT_DEATH(_exit(1), "");
+ EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());
+}
+
+TEST(StreamingAssertionsDeathTest, DeathTest) {
+ EXPECT_DEATH(_exit(1), "") << "unexpected failure";
+ ASSERT_DEATH(_exit(1), "") << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_DEATH(_exit(0), "") << "expected failure";
+ }, "expected failure");
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_DEATH(_exit(0), "") << "expected failure";
+ }, "expected failure");
+}
+
+// Tests that GetLastErrnoDescription returns an empty string when the
+// last error is 0 and non-empty string when it is non-zero.
+TEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) {
+ errno = ENOENT;
+ EXPECT_STRNE("", GetLastErrnoDescription().c_str());
+ errno = 0;
+ EXPECT_STREQ("", GetLastErrnoDescription().c_str());
+}
+
+#if GTEST_OS_WINDOWS
+TEST(AutoHandleTest, AutoHandleWorks) {
+ HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
+ ASSERT_NE(INVALID_HANDLE_VALUE, handle);
+
+ // Tests that the AutoHandle is correctly initialized with a handle.
+ testing::internal::AutoHandle auto_handle(handle);
+ EXPECT_EQ(handle, auto_handle.Get());
+
+ // Tests that Reset assigns INVALID_HANDLE_VALUE.
+ // Note that this cannot verify whether the original handle is closed.
+ auto_handle.Reset();
+ EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle.Get());
+
+ // Tests that Reset assigns the new handle.
+ // Note that this cannot verify whether the original handle is closed.
+ handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
+ ASSERT_NE(INVALID_HANDLE_VALUE, handle);
+ auto_handle.Reset(handle);
+ EXPECT_EQ(handle, auto_handle.Get());
+
+ // Tests that AutoHandle contains INVALID_HANDLE_VALUE by default.
+ testing::internal::AutoHandle auto_handle2;
+ EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle2.Get());
+}
+#endif // GTEST_OS_WINDOWS
+
+#if GTEST_OS_WINDOWS
+typedef unsigned __int64 BiggestParsable;
+typedef signed __int64 BiggestSignedParsable;
+const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
+const BiggestParsable kBiggestSignedParsableMax = LLONG_MAX;
+#else
+typedef unsigned long long BiggestParsable;
+typedef signed long long BiggestSignedParsable;
+const BiggestParsable kBiggestParsableMax =
+ ::std::numeric_limits<BiggestParsable>::max();
+const BiggestSignedParsable kBiggestSignedParsableMax =
+ ::std::numeric_limits<BiggestSignedParsable>::max();
+#endif // GTEST_OS_WINDOWS
+
+TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
+ BiggestParsable result = 0;
+
+ // Rejects non-numbers.
+ EXPECT_FALSE(ParseNaturalNumber(String("non-number string"), &result));
+
+ // Rejects numbers with whitespace prefix.
+ EXPECT_FALSE(ParseNaturalNumber(String(" 123"), &result));
+
+ // Rejects negative numbers.
+ EXPECT_FALSE(ParseNaturalNumber(String("-123"), &result));
+
+ // Rejects numbers starting with a plus sign.
+ EXPECT_FALSE(ParseNaturalNumber(String("+123"), &result));
+ errno = 0;
+}
+
+TEST(ParseNaturalNumberTest, RejectsOverflownNumbers) {
+ BiggestParsable result = 0;
+
+ EXPECT_FALSE(ParseNaturalNumber(String("99999999999999999999999"), &result));
+
+ signed char char_result = 0;
+ EXPECT_FALSE(ParseNaturalNumber(String("200"), &char_result));
+ errno = 0;
+}
+
+TEST(ParseNaturalNumberTest, AcceptsValidNumbers) {
+ BiggestParsable result = 0;
+
+ result = 0;
+ ASSERT_TRUE(ParseNaturalNumber(String("123"), &result));
+ EXPECT_EQ(123U, result);
+
+ // Check 0 as an edge case.
+ result = 1;
+ ASSERT_TRUE(ParseNaturalNumber(String("0"), &result));
+ EXPECT_EQ(0U, result);
+
+ result = 1;
+ ASSERT_TRUE(ParseNaturalNumber(String("00000"), &result));
+ EXPECT_EQ(0U, result);
+}
+
+TEST(ParseNaturalNumberTest, AcceptsTypeLimits) {
+ Message msg;
+ msg << kBiggestParsableMax;
+
+ BiggestParsable result = 0;
+ EXPECT_TRUE(ParseNaturalNumber(msg.GetString(), &result));
+ EXPECT_EQ(kBiggestParsableMax, result);
+
+ Message msg2;
+ msg2 << kBiggestSignedParsableMax;
+
+ BiggestSignedParsable signed_result = 0;
+ EXPECT_TRUE(ParseNaturalNumber(msg2.GetString(), &signed_result));
+ EXPECT_EQ(kBiggestSignedParsableMax, signed_result);
+
+ Message msg3;
+ msg3 << INT_MAX;
+
+ int int_result = 0;
+ EXPECT_TRUE(ParseNaturalNumber(msg3.GetString(), &int_result));
+ EXPECT_EQ(INT_MAX, int_result);
+
+ Message msg4;
+ msg4 << UINT_MAX;
+
+ unsigned int uint_result = 0;
+ EXPECT_TRUE(ParseNaturalNumber(msg4.GetString(), &uint_result));
+ EXPECT_EQ(UINT_MAX, uint_result);
+}
+
+TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
+ short short_result = 0;
+ ASSERT_TRUE(ParseNaturalNumber(String("123"), &short_result));
+ EXPECT_EQ(123, short_result);
+
+ signed char char_result = 0;
+ ASSERT_TRUE(ParseNaturalNumber(String("123"), &char_result));
+ EXPECT_EQ(123, char_result);
+}
+
+#if GTEST_OS_WINDOWS
+TEST(EnvironmentTest, HandleFitsIntoSizeT) {
+ // TODO(vladl@google.com): Remove this test after this condition is verified
+ // in a static assertion in gtest-death-test.cc in the function
+ // GetStatusFileDescriptor.
+ ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
+}
+#endif // GTEST_OS_WINDOWS
+
+// Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED trigger
+// failures when death tests are available on the system.
+TEST(ConditionalDeathMacrosDeathTest, ExpectsDeathWhenDeathTestsAvailable) {
+ EXPECT_DEATH_IF_SUPPORTED(DieInside("CondDeathTestExpectMacro"),
+ "death inside CondDeathTestExpectMacro");
+ ASSERT_DEATH_IF_SUPPORTED(DieInside("CondDeathTestAssertMacro"),
+ "death inside CondDeathTestAssertMacro");
+
+ // Empty statement will not crash, which must trigger a failure.
+ EXPECT_NONFATAL_FAILURE(EXPECT_DEATH_IF_SUPPORTED(;, ""), "");
+ EXPECT_FATAL_FAILURE(ASSERT_DEATH_IF_SUPPORTED(;, ""), "");
+}
+
+#else
+
+using testing::internal::CaptureStderr;
+using testing::internal::GetCapturedStderr;
+using testing::internal::String;
+
+// Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED are still
+// defined but do not trigger failures when death tests are not available on
+// the system.
+TEST(ConditionalDeathMacrosTest, WarnsWhenDeathTestsNotAvailable) {
+ // Empty statement will not crash, but that should not trigger a failure
+ // when death tests are not supported.
+ CaptureStderr();
+ EXPECT_DEATH_IF_SUPPORTED(;, "");
+ String output = GetCapturedStderr();
+ ASSERT_TRUE(NULL != strstr(output.c_str(),
+ "Death tests are not supported on this platform"));
+ ASSERT_TRUE(NULL != strstr(output.c_str(), ";"));
+
+ // The streamed message should not be printed as there is no test failure.
+ CaptureStderr();
+ EXPECT_DEATH_IF_SUPPORTED(;, "") << "streamed message";
+ output = GetCapturedStderr();
+ ASSERT_TRUE(NULL == strstr(output.c_str(), "streamed message"));
+
+ CaptureStderr();
+ ASSERT_DEATH_IF_SUPPORTED(;, ""); // NOLINT
+ output = GetCapturedStderr();
+ ASSERT_TRUE(NULL != strstr(output.c_str(),
+ "Death tests are not supported on this platform"));
+ ASSERT_TRUE(NULL != strstr(output.c_str(), ";"));
+
+ CaptureStderr();
+ ASSERT_DEATH_IF_SUPPORTED(;, "") << "streamed message"; // NOLINT
+ output = GetCapturedStderr();
+ ASSERT_TRUE(NULL == strstr(output.c_str(), "streamed message"));
+}
+
+void FuncWithAssert(int* n) {
+ ASSERT_DEATH_IF_SUPPORTED(return;, "");
+ (*n)++;
+}
+
+// Tests that ASSERT_DEATH_IF_SUPPORTED does not return from the current
+// function (as ASSERT_DEATH does) if death tests are not supported.
+TEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) {
+ int n = 0;
+ FuncWithAssert(&n);
+ EXPECT_EQ(1, n);
+}
+#endif // GTEST_HAS_DEATH_TEST
+
+// Tests that the death test macros expand to code which may or may not
+// be followed by operator<<, and that in either case the complete text
+// comprises only a single C++ statement.
+//
+// The syntax should work whether death tests are available or not.
+TEST(ConditionalDeathMacrosSyntaxDeathTest, SingleStatement) {
+ if (AlwaysFalse())
+ // This would fail if executed; this is a compilation test only
+ ASSERT_DEATH_IF_SUPPORTED(return, "");
+
+ if (AlwaysTrue())
+ EXPECT_DEATH_IF_SUPPORTED(_exit(1), "");
+ else
+ // This empty "else" branch is meant to ensure that EXPECT_DEATH
+ // doesn't expand into an "if" statement without an "else"
+ ; // NOLINT
+
+ if (AlwaysFalse())
+ ASSERT_DEATH_IF_SUPPORTED(return, "") << "did not die";
+
+ if (AlwaysFalse())
+ ; // NOLINT
+ else
+ EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << 1 << 2 << 3;
+}
+
+// Tests that conditional death test macros expand to code which interacts
+// well with switch statements.
+TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
+// Microsoft compiler usually complains about switch statements without
+// case labels. We suppress that warning for this test.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4065)
+#endif // _MSC_VER
+
+ switch (0)
+ default:
+ ASSERT_DEATH_IF_SUPPORTED(_exit(1), "")
+ << "exit in default switch handler";
+
+ switch (0)
+ case 0:
+ EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << "exit in switch case";
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif // _MSC_VER
+}
+
+// Tests that a test case whose name ends with "DeathTest" works fine
+// on Windows.
+TEST(NotADeathTest, Test) {
+ SUCCEED();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-filepath_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-filepath_test.cc
new file mode 100644
index 0000000..6250282
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-filepath_test.cc
@@ -0,0 +1,690 @@
+// Copyright 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.
+//
+// Authors: keith.ray@gmail.com (Keith Ray)
+//
+// Google Test filepath utilities
+//
+// This file tests classes and functions used internally by
+// Google Test. They are subject to change without notice.
+//
+// This file is #included from gtest_unittest.cc, to avoid changing
+// build or make-files for some existing Google Test clients. Do not
+// #include this file anywhere else!
+
+#include <gtest/internal/gtest-filepath.h>
+#include <gtest/gtest.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+#if GTEST_OS_WINDOWS_MOBILE
+#include <windows.h> // NOLINT
+#elif GTEST_OS_WINDOWS
+#include <direct.h> // NOLINT
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+namespace testing {
+namespace internal {
+namespace {
+
+#if GTEST_OS_WINDOWS_MOBILE
+// TODO(wan@google.com): Move these to the POSIX adapter section in
+// gtest-port.h.
+
+// Windows CE doesn't have the remove C function.
+int remove(const char* path) {
+ LPCWSTR wpath = String::AnsiToUtf16(path);
+ int ret = DeleteFile(wpath) ? 0 : -1;
+ delete [] wpath;
+ return ret;
+}
+// Windows CE doesn't have the _rmdir C function.
+int _rmdir(const char* path) {
+ FilePath filepath(path);
+ LPCWSTR wpath = String::AnsiToUtf16(
+ filepath.RemoveTrailingPathSeparator().c_str());
+ int ret = RemoveDirectory(wpath) ? 0 : -1;
+ delete [] wpath;
+ return ret;
+}
+
+#else
+
+TEST(GetCurrentDirTest, ReturnsCurrentDir) {
+ const FilePath original_dir = FilePath::GetCurrentDir();
+ EXPECT_FALSE(original_dir.IsEmpty());
+
+ posix::ChDir(GTEST_PATH_SEP_);
+ const FilePath cwd = FilePath::GetCurrentDir();
+ posix::ChDir(original_dir.c_str());
+
+#if GTEST_OS_WINDOWS
+ // Skips the ":".
+ const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
+ ASSERT_TRUE(cwd_without_drive != NULL);
+ EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);
+#else
+ EXPECT_STREQ(GTEST_PATH_SEP_, cwd.c_str());
+#endif
+}
+
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+TEST(IsEmptyTest, ReturnsTrueForEmptyPath) {
+ EXPECT_TRUE(FilePath("").IsEmpty());
+ EXPECT_TRUE(FilePath(NULL).IsEmpty());
+}
+
+TEST(IsEmptyTest, ReturnsFalseForNonEmptyPath) {
+ EXPECT_FALSE(FilePath("a").IsEmpty());
+ EXPECT_FALSE(FilePath(".").IsEmpty());
+ EXPECT_FALSE(FilePath("a/b").IsEmpty());
+ EXPECT_FALSE(FilePath("a\\b\\").IsEmpty());
+}
+
+// RemoveDirectoryName "" -> ""
+TEST(RemoveDirectoryNameTest, WhenEmptyName) {
+ EXPECT_STREQ("", FilePath("").RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName "afile" -> "afile"
+TEST(RemoveDirectoryNameTest, ButNoDirectory) {
+ EXPECT_STREQ("afile",
+ FilePath("afile").RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName "/afile" -> "afile"
+TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) {
+ EXPECT_STREQ("afile",
+ FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName "adir/" -> ""
+TEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) {
+ EXPECT_STREQ("",
+ FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName "adir/afile" -> "afile"
+TEST(RemoveDirectoryNameTest, ShouldGiveFileName) {
+ EXPECT_STREQ("afile",
+ FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName "adir/subdir/afile" -> "afile"
+TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
+ EXPECT_STREQ("afile",
+ FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
+ .RemoveDirectoryName().c_str());
+}
+
+#if GTEST_HAS_ALT_PATH_SEP_
+
+// Tests that RemoveDirectoryName() works with the alternate separator
+// on Windows.
+
+// RemoveDirectoryName("/afile") -> "afile"
+TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileNameForAlternateSeparator) {
+ EXPECT_STREQ("afile",
+ FilePath("/afile").RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName("adir/") -> ""
+TEST(RemoveDirectoryNameTest, WhereThereIsNoFileNameForAlternateSeparator) {
+ EXPECT_STREQ("",
+ FilePath("adir/").RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName("adir/afile") -> "afile"
+TEST(RemoveDirectoryNameTest, ShouldGiveFileNameForAlternateSeparator) {
+ EXPECT_STREQ("afile",
+ FilePath("adir/afile").RemoveDirectoryName().c_str());
+}
+
+// RemoveDirectoryName("adir/subdir/afile") -> "afile"
+TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) {
+ EXPECT_STREQ("afile",
+ FilePath("adir/subdir/afile").RemoveDirectoryName().c_str());
+}
+
+#endif
+
+// RemoveFileName "" -> "./"
+TEST(RemoveFileNameTest, EmptyName) {
+#if GTEST_OS_WINDOWS_MOBILE
+ // On Windows CE, we use the root as the current directory.
+ EXPECT_STREQ(GTEST_PATH_SEP_,
+ FilePath("").RemoveFileName().c_str());
+#else
+ EXPECT_STREQ("." GTEST_PATH_SEP_,
+ FilePath("").RemoveFileName().c_str());
+#endif
+}
+
+// RemoveFileName "adir/" -> "adir/"
+TEST(RemoveFileNameTest, ButNoFile) {
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_,
+ FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().c_str());
+}
+
+// RemoveFileName "adir/afile" -> "adir/"
+TEST(RemoveFileNameTest, GivesDirName) {
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_,
+ FilePath("adir" GTEST_PATH_SEP_ "afile")
+ .RemoveFileName().c_str());
+}
+
+// RemoveFileName "adir/subdir/afile" -> "adir/subdir/"
+TEST(RemoveFileNameTest, GivesDirAndSubDirName) {
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
+ FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
+ .RemoveFileName().c_str());
+}
+
+// RemoveFileName "/afile" -> "/"
+TEST(RemoveFileNameTest, GivesRootDir) {
+ EXPECT_STREQ(GTEST_PATH_SEP_,
+ FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().c_str());
+}
+
+#if GTEST_HAS_ALT_PATH_SEP_
+
+// Tests that RemoveFileName() works with the alternate separator on
+// Windows.
+
+// RemoveFileName("adir/") -> "adir/"
+TEST(RemoveFileNameTest, ButNoFileForAlternateSeparator) {
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_,
+ FilePath("adir/").RemoveFileName().c_str());
+}
+
+// RemoveFileName("adir/afile") -> "adir/"
+TEST(RemoveFileNameTest, GivesDirNameForAlternateSeparator) {
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_,
+ FilePath("adir/afile").RemoveFileName().c_str());
+}
+
+// RemoveFileName("adir/subdir/afile") -> "adir/subdir/"
+TEST(RemoveFileNameTest, GivesDirAndSubDirNameForAlternateSeparator) {
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
+ FilePath("adir/subdir/afile").RemoveFileName().c_str());
+}
+
+// RemoveFileName("/afile") -> "\"
+TEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) {
+ EXPECT_STREQ(GTEST_PATH_SEP_,
+ FilePath("/afile").RemoveFileName().c_str());
+}
+
+#endif
+
+TEST(MakeFileNameTest, GenerateWhenNumberIsZero) {
+ FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
+ 0, "xml");
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+}
+
+TEST(MakeFileNameTest, GenerateFileNameNumberGtZero) {
+ FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
+ 12, "xml");
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
+}
+
+TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) {
+ FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
+ FilePath("bar"), 0, "xml");
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+}
+
+TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) {
+ FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
+ FilePath("bar"), 12, "xml");
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
+}
+
+TEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) {
+ FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
+ 0, "xml");
+ EXPECT_STREQ("bar.xml", actual.c_str());
+}
+
+TEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) {
+ FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
+ 14, "xml");
+ EXPECT_STREQ("bar_14.xml", actual.c_str());
+}
+
+TEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) {
+ FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
+ FilePath("bar.xml"));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+}
+
+TEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) {
+ FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_),
+ FilePath("bar.xml"));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+}
+
+TEST(ConcatPathsTest, Path1BeingEmpty) {
+ FilePath actual = FilePath::ConcatPaths(FilePath(""),
+ FilePath("bar.xml"));
+ EXPECT_STREQ("bar.xml", actual.c_str());
+}
+
+TEST(ConcatPathsTest, Path2BeingEmpty) {
+ FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
+ FilePath(""));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_, actual.c_str());
+}
+
+TEST(ConcatPathsTest, BothPathBeingEmpty) {
+ FilePath actual = FilePath::ConcatPaths(FilePath(""),
+ FilePath(""));
+ EXPECT_STREQ("", actual.c_str());
+}
+
+TEST(ConcatPathsTest, Path1ContainsPathSep) {
+ FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_ "bar"),
+ FilePath("foobar.xml"));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml",
+ actual.c_str());
+}
+
+TEST(ConcatPathsTest, Path2ContainsPathSep) {
+ FilePath actual = FilePath::ConcatPaths(
+ FilePath("foo" GTEST_PATH_SEP_),
+ FilePath("bar" GTEST_PATH_SEP_ "bar.xml"));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml",
+ actual.c_str());
+}
+
+TEST(ConcatPathsTest, Path2EndsWithPathSep) {
+ FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
+ FilePath("bar" GTEST_PATH_SEP_));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.c_str());
+}
+
+// RemoveTrailingPathSeparator "" -> ""
+TEST(RemoveTrailingPathSeparatorTest, EmptyString) {
+ EXPECT_STREQ("",
+ FilePath("").RemoveTrailingPathSeparator().c_str());
+}
+
+// RemoveTrailingPathSeparator "foo" -> "foo"
+TEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) {
+ EXPECT_STREQ("foo",
+ FilePath("foo").RemoveTrailingPathSeparator().c_str());
+}
+
+// RemoveTrailingPathSeparator "foo/" -> "foo"
+TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {
+ EXPECT_STREQ(
+ "foo",
+ FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str());
+#if GTEST_HAS_ALT_PATH_SEP_
+ EXPECT_STREQ("foo",
+ FilePath("foo/").RemoveTrailingPathSeparator().c_str());
+#endif
+}
+
+// RemoveTrailingPathSeparator "foo/bar/" -> "foo/bar/"
+TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) {
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_)
+ .RemoveTrailingPathSeparator().c_str());
+}
+
+// RemoveTrailingPathSeparator "foo/bar" -> "foo/bar"
+TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ "bar")
+ .RemoveTrailingPathSeparator().c_str());
+}
+
+TEST(DirectoryTest, RootDirectoryExists) {
+#if GTEST_OS_WINDOWS // We are on Windows.
+ char current_drive[_MAX_PATH]; // NOLINT
+ current_drive[0] = static_cast<char>(_getdrive() + 'A' - 1);
+ current_drive[1] = ':';
+ current_drive[2] = '\\';
+ current_drive[3] = '\0';
+ EXPECT_TRUE(FilePath(current_drive).DirectoryExists());
+#else
+ EXPECT_TRUE(FilePath("/").DirectoryExists());
+#endif // GTEST_OS_WINDOWS
+}
+
+#if GTEST_OS_WINDOWS
+TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
+ const int saved_drive_ = _getdrive();
+ // Find a drive that doesn't exist. Start with 'Z' to avoid common ones.
+ for (char drive = 'Z'; drive >= 'A'; drive--)
+ if (_chdrive(drive - 'A' + 1) == -1) {
+ char non_drive[_MAX_PATH]; // NOLINT
+ non_drive[0] = drive;
+ non_drive[1] = ':';
+ non_drive[2] = '\\';
+ non_drive[3] = '\0';
+ EXPECT_FALSE(FilePath(non_drive).DirectoryExists());
+ break;
+ }
+ _chdrive(saved_drive_);
+}
+#endif // GTEST_OS_WINDOWS
+
+#if !GTEST_OS_WINDOWS_MOBILE
+// Windows CE _does_ consider an empty directory to exist.
+TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
+ EXPECT_FALSE(FilePath("").DirectoryExists());
+}
+#endif // !GTEST_OS_WINDOWS_MOBILE
+
+TEST(DirectoryTest, CurrentDirectoryExists) {
+#if GTEST_OS_WINDOWS // We are on Windows.
+#ifndef _WIN32_CE // Windows CE doesn't have a current directory.
+ EXPECT_TRUE(FilePath(".").DirectoryExists());
+ EXPECT_TRUE(FilePath(".\\").DirectoryExists());
+#endif // _WIN32_CE
+#else
+ EXPECT_TRUE(FilePath(".").DirectoryExists());
+ EXPECT_TRUE(FilePath("./").DirectoryExists());
+#endif // GTEST_OS_WINDOWS
+}
+
+TEST(NormalizeTest, NullStringsEqualEmptyDirectory) {
+ EXPECT_STREQ("", FilePath(NULL).c_str());
+ EXPECT_STREQ("", FilePath(String(NULL)).c_str());
+}
+
+// "foo/bar" == foo//bar" == "foo///bar"
+TEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) {
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_
+ GTEST_PATH_SEP_ "bar").c_str());
+}
+
+// "/bar" == //bar" == "///bar"
+TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) {
+ EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
+ FilePath(GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
+ FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
+ FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
+}
+
+// "foo/" == foo//" == "foo///"
+TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo" GTEST_PATH_SEP_).c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
+}
+
+#if GTEST_HAS_ALT_PATH_SEP_
+
+// Tests that separators at the end of the string are normalized
+// regardless of their combination (e.g. "foo\" =="foo/\" ==
+// "foo\\/").
+TEST(NormalizeTest, MixAlternateSeparatorAtStringEnd) {
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo/").c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo" GTEST_PATH_SEP_ "/").c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo//" GTEST_PATH_SEP_).c_str());
+}
+
+#endif
+
+TEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) {
+ FilePath default_path;
+ FilePath non_default_path("path");
+ non_default_path = default_path;
+ EXPECT_STREQ("", non_default_path.c_str());
+ EXPECT_STREQ("", default_path.c_str()); // RHS var is unchanged.
+}
+
+TEST(AssignmentOperatorTest, NonDefaultAssignedToDefault) {
+ FilePath non_default_path("path");
+ FilePath default_path;
+ default_path = non_default_path;
+ EXPECT_STREQ("path", default_path.c_str());
+ EXPECT_STREQ("path", non_default_path.c_str()); // RHS var is unchanged.
+}
+
+TEST(AssignmentOperatorTest, ConstAssignedToNonConst) {
+ const FilePath const_default_path("const_path");
+ FilePath non_default_path("path");
+ non_default_path = const_default_path;
+ EXPECT_STREQ("const_path", non_default_path.c_str());
+}
+
+class DirectoryCreationTest : public Test {
+ protected:
+ virtual void SetUp() {
+ testdata_path_.Set(FilePath(String::Format("%s%s%s",
+ TempDir().c_str(), GetCurrentExecutableName().c_str(),
+ "_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_)));
+ testdata_file_.Set(testdata_path_.RemoveTrailingPathSeparator());
+
+ unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
+ 0, "txt"));
+ unique_file1_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
+ 1, "txt"));
+
+ remove(testdata_file_.c_str());
+ remove(unique_file0_.c_str());
+ remove(unique_file1_.c_str());
+ posix::RmDir(testdata_path_.c_str());
+ }
+
+ virtual void TearDown() {
+ remove(testdata_file_.c_str());
+ remove(unique_file0_.c_str());
+ remove(unique_file1_.c_str());
+ posix::RmDir(testdata_path_.c_str());
+ }
+
+ String TempDir() const {
+#if GTEST_OS_WINDOWS_MOBILE
+ return String("\\temp\\");
+#elif GTEST_OS_WINDOWS
+ const char* temp_dir = posix::GetEnv("TEMP");
+ if (temp_dir == NULL || temp_dir[0] == '\0')
+ return String("\\temp\\");
+ else if (String(temp_dir).EndsWith("\\"))
+ return String(temp_dir);
+ else
+ return String::Format("%s\\", temp_dir);
+#else
+ return String("/tmp/");
+#endif // GTEST_OS_WINDOWS_MOBILE
+ }
+
+ void CreateTextFile(const char* filename) {
+ FILE* f = posix::FOpen(filename, "w");
+ fprintf(f, "text\n");
+ fclose(f);
+ }
+
+ // Strings representing a directory and a file, with identical paths
+ // except for the trailing separator character that distinquishes
+ // a directory named 'test' from a file named 'test'. Example names:
+ FilePath testdata_path_; // "/tmp/directory_creation/test/"
+ FilePath testdata_file_; // "/tmp/directory_creation/test"
+ FilePath unique_file0_; // "/tmp/directory_creation/test/unique.txt"
+ FilePath unique_file1_; // "/tmp/directory_creation/test/unique_1.txt"
+};
+
+TEST_F(DirectoryCreationTest, CreateDirectoriesRecursively) {
+ EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.c_str();
+ EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());
+ EXPECT_TRUE(testdata_path_.DirectoryExists());
+}
+
+TEST_F(DirectoryCreationTest, CreateDirectoriesForAlreadyExistingPath) {
+ EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.c_str();
+ EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());
+ // Call 'create' again... should still succeed.
+ EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());
+}
+
+TEST_F(DirectoryCreationTest, CreateDirectoriesAndUniqueFilename) {
+ FilePath file_path(FilePath::GenerateUniqueFileName(testdata_path_,
+ FilePath("unique"), "txt"));
+ EXPECT_STREQ(unique_file0_.c_str(), file_path.c_str());
+ EXPECT_FALSE(file_path.FileOrDirectoryExists()); // file not there
+
+ testdata_path_.CreateDirectoriesRecursively();
+ EXPECT_FALSE(file_path.FileOrDirectoryExists()); // file still not there
+ CreateTextFile(file_path.c_str());
+ EXPECT_TRUE(file_path.FileOrDirectoryExists());
+
+ FilePath file_path2(FilePath::GenerateUniqueFileName(testdata_path_,
+ FilePath("unique"), "txt"));
+ EXPECT_STREQ(unique_file1_.c_str(), file_path2.c_str());
+ EXPECT_FALSE(file_path2.FileOrDirectoryExists()); // file not there
+ CreateTextFile(file_path2.c_str());
+ EXPECT_TRUE(file_path2.FileOrDirectoryExists());
+}
+
+TEST_F(DirectoryCreationTest, CreateDirectoriesFail) {
+ // force a failure by putting a file where we will try to create a directory.
+ CreateTextFile(testdata_file_.c_str());
+ EXPECT_TRUE(testdata_file_.FileOrDirectoryExists());
+ EXPECT_FALSE(testdata_file_.DirectoryExists());
+ EXPECT_FALSE(testdata_file_.CreateDirectoriesRecursively());
+}
+
+TEST(NoDirectoryCreationTest, CreateNoDirectoriesForDefaultXmlFile) {
+ const FilePath test_detail_xml("test_detail.xml");
+ EXPECT_FALSE(test_detail_xml.CreateDirectoriesRecursively());
+}
+
+TEST(FilePathTest, DefaultConstructor) {
+ FilePath fp;
+ EXPECT_STREQ("", fp.c_str());
+}
+
+TEST(FilePathTest, CharAndCopyConstructors) {
+ const FilePath fp("spicy");
+ EXPECT_STREQ("spicy", fp.c_str());
+
+ const FilePath fp_copy(fp);
+ EXPECT_STREQ("spicy", fp_copy.c_str());
+}
+
+TEST(FilePathTest, StringConstructor) {
+ const FilePath fp(String("cider"));
+ EXPECT_STREQ("cider", fp.c_str());
+}
+
+TEST(FilePathTest, Set) {
+ const FilePath apple("apple");
+ FilePath mac("mac");
+ mac.Set(apple); // Implement Set() since overloading operator= is forbidden.
+ EXPECT_STREQ("apple", mac.c_str());
+ EXPECT_STREQ("apple", apple.c_str());
+}
+
+TEST(FilePathTest, ToString) {
+ const FilePath file("drink");
+ String str(file.ToString());
+ EXPECT_STREQ("drink", str.c_str());
+}
+
+TEST(FilePathTest, RemoveExtension) {
+ EXPECT_STREQ("app", FilePath("app.exe").RemoveExtension("exe").c_str());
+ EXPECT_STREQ("APP", FilePath("APP.EXE").RemoveExtension("exe").c_str());
+}
+
+TEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) {
+ EXPECT_STREQ("app", FilePath("app").RemoveExtension("exe").c_str());
+}
+
+TEST(FilePathTest, IsDirectory) {
+ EXPECT_FALSE(FilePath("cola").IsDirectory());
+ EXPECT_TRUE(FilePath("koala" GTEST_PATH_SEP_).IsDirectory());
+#if GTEST_HAS_ALT_PATH_SEP_
+ EXPECT_TRUE(FilePath("koala/").IsDirectory());
+#endif
+}
+
+TEST(FilePathTest, IsAbsolutePath) {
+ EXPECT_FALSE(FilePath("is" GTEST_PATH_SEP_ "relative").IsAbsolutePath());
+ EXPECT_FALSE(FilePath("").IsAbsolutePath());
+#if GTEST_OS_WINDOWS
+ EXPECT_TRUE(FilePath("c:\\" GTEST_PATH_SEP_ "is_not"
+ GTEST_PATH_SEP_ "relative").IsAbsolutePath());
+ EXPECT_FALSE(FilePath("c:foo" GTEST_PATH_SEP_ "bar").IsAbsolutePath());
+ EXPECT_TRUE(FilePath("c:/" GTEST_PATH_SEP_ "is_not"
+ GTEST_PATH_SEP_ "relative").IsAbsolutePath());
+#else
+ EXPECT_TRUE(FilePath(GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative")
+ .IsAbsolutePath());
+#endif // GTEST_OS_WINDOWS
+}
+
+TEST(FilePathTest, IsRootDirectory) {
+#if GTEST_OS_WINDOWS
+ EXPECT_TRUE(FilePath("a:\\").IsRootDirectory());
+ EXPECT_TRUE(FilePath("Z:/").IsRootDirectory());
+ EXPECT_TRUE(FilePath("e://").IsRootDirectory());
+ EXPECT_FALSE(FilePath("").IsRootDirectory());
+ EXPECT_FALSE(FilePath("b:").IsRootDirectory());
+ EXPECT_FALSE(FilePath("b:a").IsRootDirectory());
+ EXPECT_FALSE(FilePath("8:/").IsRootDirectory());
+ EXPECT_FALSE(FilePath("c|/").IsRootDirectory());
+#else
+ EXPECT_TRUE(FilePath("/").IsRootDirectory());
+ EXPECT_TRUE(FilePath("//").IsRootDirectory());
+ EXPECT_FALSE(FilePath("").IsRootDirectory());
+ EXPECT_FALSE(FilePath("\\").IsRootDirectory());
+ EXPECT_FALSE(FilePath("/x").IsRootDirectory());
+#endif
+}
+
+} // namespace
+} // namespace internal
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-linked_ptr_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-linked_ptr_test.cc
new file mode 100644
index 0000000..eae8229
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-linked_ptr_test.cc
@@ -0,0 +1,154 @@
+// Copyright 2003, 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.
+//
+// Authors: Dan Egnor (egnor@google.com)
+// Ported to Windows: Vadim Berman (vadimb@google.com)
+
+#include <gtest/internal/gtest-linked_ptr.h>
+
+#include <stdlib.h>
+#include <gtest/gtest.h>
+
+namespace {
+
+using testing::Message;
+using testing::internal::linked_ptr;
+
+int num;
+Message* history = NULL;
+
+// Class which tracks allocation/deallocation
+class A {
+ public:
+ A(): mynum(num++) { *history << "A" << mynum << " ctor\n"; }
+ virtual ~A() { *history << "A" << mynum << " dtor\n"; }
+ virtual void Use() { *history << "A" << mynum << " use\n"; }
+ protected:
+ int mynum;
+};
+
+// Subclass
+class B : public A {
+ public:
+ B() { *history << "B" << mynum << " ctor\n"; }
+ ~B() { *history << "B" << mynum << " dtor\n"; }
+ virtual void Use() { *history << "B" << mynum << " use\n"; }
+};
+
+class LinkedPtrTest : public testing::Test {
+ public:
+ LinkedPtrTest() {
+ num = 0;
+ history = new Message;
+ }
+
+ virtual ~LinkedPtrTest() {
+ delete history;
+ history = NULL;
+ }
+};
+
+TEST_F(LinkedPtrTest, GeneralTest) {
+ {
+ linked_ptr<A> a0, a1, a2;
+ a0 = a0;
+ a1 = a2;
+ ASSERT_EQ(a0.get(), static_cast<A*>(NULL));
+ ASSERT_EQ(a1.get(), static_cast<A*>(NULL));
+ ASSERT_EQ(a2.get(), static_cast<A*>(NULL));
+ ASSERT_TRUE(a0 == NULL);
+ ASSERT_TRUE(a1 == NULL);
+ ASSERT_TRUE(a2 == NULL);
+
+ {
+ linked_ptr<A> a3(new A);
+ a0 = a3;
+ ASSERT_TRUE(a0 == a3);
+ ASSERT_TRUE(a0 != NULL);
+ ASSERT_TRUE(a0.get() == a3);
+ ASSERT_TRUE(a0 == a3.get());
+ linked_ptr<A> a4(a0);
+ a1 = a4;
+ linked_ptr<A> a5(new A);
+ ASSERT_TRUE(a5.get() != a3);
+ ASSERT_TRUE(a5 != a3.get());
+ a2 = a5;
+ linked_ptr<B> b0(new B);
+ linked_ptr<A> a6(b0);
+ ASSERT_TRUE(b0 == a6);
+ ASSERT_TRUE(a6 == b0);
+ ASSERT_TRUE(b0 != NULL);
+ a5 = b0;
+ a5 = b0;
+ a3->Use();
+ a4->Use();
+ a5->Use();
+ a6->Use();
+ b0->Use();
+ (*b0).Use();
+ b0.get()->Use();
+ }
+
+ a0->Use();
+ a1->Use();
+ a2->Use();
+
+ a1 = a2;
+ a2.reset(new A);
+ a0.reset();
+
+ linked_ptr<A> a7;
+ }
+
+ ASSERT_STREQ(
+ "A0 ctor\n"
+ "A1 ctor\n"
+ "A2 ctor\n"
+ "B2 ctor\n"
+ "A0 use\n"
+ "A0 use\n"
+ "B2 use\n"
+ "B2 use\n"
+ "B2 use\n"
+ "B2 use\n"
+ "B2 use\n"
+ "B2 dtor\n"
+ "A2 dtor\n"
+ "A0 use\n"
+ "A0 use\n"
+ "A1 use\n"
+ "A3 ctor\n"
+ "A0 dtor\n"
+ "A3 dtor\n"
+ "A1 dtor\n",
+ history->GetString().c_str()
+ );
+}
+
+} // Unnamed namespace
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-listener_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-listener_test.cc
new file mode 100644
index 0000000..c9be39a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-listener_test.cc
@@ -0,0 +1,313 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This file verifies Google Test event listeners receive events at the
+// right times.
+
+#include <gtest/gtest.h>
+#include <vector>
+
+using ::testing::AddGlobalTestEnvironment;
+using ::testing::Environment;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListener;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+using ::testing::internal::String;
+
+// Used by tests to register their events.
+std::vector<String>* g_events = NULL;
+
+namespace testing {
+namespace internal {
+
+class EventRecordingListener : public TestEventListener {
+ public:
+ EventRecordingListener(const char* name) : name_(name) {}
+
+ protected:
+ virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
+ g_events->push_back(GetFullMethodName("OnTestProgramStart"));
+ }
+
+ virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
+ int iteration) {
+ Message message;
+ message << GetFullMethodName("OnTestIterationStart")
+ << "(" << iteration << ")";
+ g_events->push_back(message.GetString());
+ }
+
+ virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {
+ g_events->push_back(GetFullMethodName("OnEnvironmentsSetUpStart"));
+ }
+
+ virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {
+ g_events->push_back(GetFullMethodName("OnEnvironmentsSetUpEnd"));
+ }
+
+ virtual void OnTestCaseStart(const TestCase& /*test_case*/) {
+ g_events->push_back(GetFullMethodName("OnTestCaseStart"));
+ }
+
+ virtual void OnTestStart(const TestInfo& /*test_info*/) {
+ g_events->push_back(GetFullMethodName("OnTestStart"));
+ }
+
+ virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {
+ g_events->push_back(GetFullMethodName("OnTestPartResult"));
+ }
+
+ virtual void OnTestEnd(const TestInfo& /*test_info*/) {
+ g_events->push_back(GetFullMethodName("OnTestEnd"));
+ }
+
+ virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {
+ g_events->push_back(GetFullMethodName("OnTestCaseEnd"));
+ }
+
+ virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {
+ g_events->push_back(GetFullMethodName("OnEnvironmentsTearDownStart"));
+ }
+
+ virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {
+ g_events->push_back(GetFullMethodName("OnEnvironmentsTearDownEnd"));
+ }
+
+ virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
+ int iteration) {
+ Message message;
+ message << GetFullMethodName("OnTestIterationEnd")
+ << "(" << iteration << ")";
+ g_events->push_back(message.GetString());
+ }
+
+ virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {
+ g_events->push_back(GetFullMethodName("OnTestProgramEnd"));
+ }
+
+ private:
+ String GetFullMethodName(const char* name) {
+ Message message;
+ message << name_ << "." << name;
+ return message.GetString();
+ }
+
+ String name_;
+};
+
+class EnvironmentInvocationCatcher : public Environment {
+ protected:
+ virtual void SetUp() {
+ g_events->push_back(String("Environment::SetUp"));
+ }
+
+ virtual void TearDown() {
+ g_events->push_back(String("Environment::TearDown"));
+ }
+};
+
+class ListenerTest : public Test {
+ protected:
+ static void SetUpTestCase() {
+ g_events->push_back(String("ListenerTest::SetUpTestCase"));
+ }
+
+ static void TearDownTestCase() {
+ g_events->push_back(String("ListenerTest::TearDownTestCase"));
+ }
+
+ virtual void SetUp() {
+ g_events->push_back(String("ListenerTest::SetUp"));
+ }
+
+ virtual void TearDown() {
+ g_events->push_back(String("ListenerTest::TearDown"));
+ }
+};
+
+TEST_F(ListenerTest, DoesFoo) {
+ // Test execution order within a test case is not guaranteed so we are not
+ // recording the test name.
+ g_events->push_back(String("ListenerTest::* Test Body"));
+ SUCCEED(); // Triggers OnTestPartResult.
+}
+
+TEST_F(ListenerTest, DoesBar) {
+ g_events->push_back(String("ListenerTest::* Test Body"));
+ SUCCEED(); // Triggers OnTestPartResult.
+}
+
+} // namespace internal
+
+} // namespace testing
+
+using ::testing::internal::EnvironmentInvocationCatcher;
+using ::testing::internal::EventRecordingListener;
+
+void VerifyResults(const std::vector<String>& data,
+ const char* const* expected_data,
+ int expected_data_size) {
+ const int actual_size = data.size();
+ // If the following assertion fails, a new entry will be appended to
+ // data. Hence we save data.size() first.
+ EXPECT_EQ(expected_data_size, actual_size);
+
+ // Compares the common prefix.
+ const int shorter_size = expected_data_size <= actual_size ?
+ expected_data_size : actual_size;
+ int i = 0;
+ for (; i < shorter_size; ++i) {
+ ASSERT_STREQ(expected_data[i], data[i].c_str())
+ << "at position " << i;
+ }
+
+ // Prints extra elements in the actual data.
+ for (; i < actual_size; ++i) {
+ printf(" Actual event #%d: %s\n", i, data[i].c_str());
+ }
+}
+
+int main(int argc, char **argv) {
+ std::vector<String> events;
+ g_events = &events;
+ InitGoogleTest(&argc, argv);
+
+ UnitTest::GetInstance()->listeners().Append(
+ new EventRecordingListener("1st"));
+ UnitTest::GetInstance()->listeners().Append(
+ new EventRecordingListener("2nd"));
+
+ AddGlobalTestEnvironment(new EnvironmentInvocationCatcher);
+
+ GTEST_CHECK_(events.size() == 0)
+ << "AddGlobalTestEnvironment should not generate any events itself.";
+
+ ::testing::GTEST_FLAG(repeat) = 2;
+ int ret_val = RUN_ALL_TESTS();
+
+ const char* const expected_events[] = {
+ "1st.OnTestProgramStart",
+ "2nd.OnTestProgramStart",
+ "1st.OnTestIterationStart(0)",
+ "2nd.OnTestIterationStart(0)",
+ "1st.OnEnvironmentsSetUpStart",
+ "2nd.OnEnvironmentsSetUpStart",
+ "Environment::SetUp",
+ "2nd.OnEnvironmentsSetUpEnd",
+ "1st.OnEnvironmentsSetUpEnd",
+ "1st.OnTestCaseStart",
+ "2nd.OnTestCaseStart",
+ "ListenerTest::SetUpTestCase",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "ListenerTest::TearDownTestCase",
+ "2nd.OnTestCaseEnd",
+ "1st.OnTestCaseEnd",
+ "1st.OnEnvironmentsTearDownStart",
+ "2nd.OnEnvironmentsTearDownStart",
+ "Environment::TearDown",
+ "2nd.OnEnvironmentsTearDownEnd",
+ "1st.OnEnvironmentsTearDownEnd",
+ "2nd.OnTestIterationEnd(0)",
+ "1st.OnTestIterationEnd(0)",
+ "1st.OnTestIterationStart(1)",
+ "2nd.OnTestIterationStart(1)",
+ "1st.OnEnvironmentsSetUpStart",
+ "2nd.OnEnvironmentsSetUpStart",
+ "Environment::SetUp",
+ "2nd.OnEnvironmentsSetUpEnd",
+ "1st.OnEnvironmentsSetUpEnd",
+ "1st.OnTestCaseStart",
+ "2nd.OnTestCaseStart",
+ "ListenerTest::SetUpTestCase",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "1st.OnTestStart",
+ "2nd.OnTestStart",
+ "ListenerTest::SetUp",
+ "ListenerTest::* Test Body",
+ "1st.OnTestPartResult",
+ "2nd.OnTestPartResult",
+ "ListenerTest::TearDown",
+ "2nd.OnTestEnd",
+ "1st.OnTestEnd",
+ "ListenerTest::TearDownTestCase",
+ "2nd.OnTestCaseEnd",
+ "1st.OnTestCaseEnd",
+ "1st.OnEnvironmentsTearDownStart",
+ "2nd.OnEnvironmentsTearDownStart",
+ "Environment::TearDown",
+ "2nd.OnEnvironmentsTearDownEnd",
+ "1st.OnEnvironmentsTearDownEnd",
+ "2nd.OnTestIterationEnd(1)",
+ "1st.OnTestIterationEnd(1)",
+ "2nd.OnTestProgramEnd",
+ "1st.OnTestProgramEnd"
+ };
+ VerifyResults(events,
+ expected_events,
+ sizeof(expected_events)/sizeof(expected_events[0]));
+
+ // We need to check manually for ad hoc test failures that happen after
+ // RUN_ALL_TESTS finishes.
+ if (UnitTest::GetInstance()->Failed())
+ ret_val = 1;
+
+ return ret_val;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-message_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-message_test.cc
new file mode 100644
index 0000000..e42b034
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-message_test.cc
@@ -0,0 +1,167 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+//
+// Tests for the Message class.
+
+#include <gtest/gtest-message.h>
+
+#include <gtest/gtest.h>
+
+namespace {
+
+using ::testing::Message;
+using ::testing::internal::StrStream;
+
+// A helper function that turns a Message into a C string.
+const char* ToCString(const Message& msg) {
+ static testing::internal::String result;
+ result = msg.GetString();
+ return result.c_str();
+}
+
+// Tests the testing::Message class
+
+// Tests the default constructor.
+TEST(MessageTest, DefaultConstructor) {
+ const Message msg;
+ EXPECT_STREQ("", ToCString(msg));
+}
+
+// Tests the copy constructor.
+TEST(MessageTest, CopyConstructor) {
+ const Message msg1("Hello");
+ const Message msg2(msg1);
+ EXPECT_STREQ("Hello", ToCString(msg2));
+}
+
+// Tests constructing a Message from a C-string.
+TEST(MessageTest, ConstructsFromCString) {
+ Message msg("Hello");
+ EXPECT_STREQ("Hello", ToCString(msg));
+}
+
+// Tests streaming a float.
+TEST(MessageTest, StreamsFloat) {
+ const char* const s = ToCString(Message() << 1.23456F << " " << 2.34567F);
+ // Both numbers should be printed with enough precision.
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "1.234560", s);
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, " 2.345669", s);
+}
+
+// Tests streaming a double.
+TEST(MessageTest, StreamsDouble) {
+ const char* const s = ToCString(Message() << 1260570880.4555497 << " "
+ << 1260572265.1954534);
+ // Both numbers should be printed with enough precision.
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "1260570880.45", s);
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, " 1260572265.19", s);
+}
+
+// Tests streaming a non-char pointer.
+TEST(MessageTest, StreamsPointer) {
+ int n = 0;
+ int* p = &n;
+ EXPECT_STRNE("(null)", ToCString(Message() << p));
+}
+
+// Tests streaming a NULL non-char pointer.
+TEST(MessageTest, StreamsNullPointer) {
+ int* p = NULL;
+ EXPECT_STREQ("(null)", ToCString(Message() << p));
+}
+
+// Tests streaming a C string.
+TEST(MessageTest, StreamsCString) {
+ EXPECT_STREQ("Foo", ToCString(Message() << "Foo"));
+}
+
+// Tests streaming a NULL C string.
+TEST(MessageTest, StreamsNullCString) {
+ char* p = NULL;
+ EXPECT_STREQ("(null)", ToCString(Message() << p));
+}
+
+// Tests streaming std::string.
+TEST(MessageTest, StreamsString) {
+ const ::std::string str("Hello");
+ EXPECT_STREQ("Hello", ToCString(Message() << str));
+}
+
+// Tests that we can output strings containing embedded NULs.
+TEST(MessageTest, StreamsStringWithEmbeddedNUL) {
+ const char char_array_with_nul[] =
+ "Here's a NUL\0 and some more string";
+ const ::std::string string_with_nul(char_array_with_nul,
+ sizeof(char_array_with_nul) - 1);
+ EXPECT_STREQ("Here's a NUL\\0 and some more string",
+ ToCString(Message() << string_with_nul));
+}
+
+// Tests streaming a NUL char.
+TEST(MessageTest, StreamsNULChar) {
+ EXPECT_STREQ("\\0", ToCString(Message() << '\0'));
+}
+
+// Tests streaming int.
+TEST(MessageTest, StreamsInt) {
+ EXPECT_STREQ("123", ToCString(Message() << 123));
+}
+
+// Tests that basic IO manipulators (endl, ends, and flush) can be
+// streamed to Message.
+TEST(MessageTest, StreamsBasicIoManip) {
+ EXPECT_STREQ("Line 1.\nA NUL char \\0 in line 2.",
+ ToCString(Message() << "Line 1." << std::endl
+ << "A NUL char " << std::ends << std::flush
+ << " in line 2."));
+}
+
+// Tests Message::GetString()
+TEST(MessageTest, GetString) {
+ Message msg;
+ msg << 1 << " lamb";
+ EXPECT_STREQ("1 lamb", msg.GetString().c_str());
+}
+
+// Tests streaming a Message object to an ostream.
+TEST(MessageTest, StreamsToOStream) {
+ Message msg("Hello");
+ StrStream ss;
+ ss << msg;
+ EXPECT_STREQ("Hello", testing::internal::StrStreamToString(&ss).c_str());
+}
+
+// Tests that a Message object doesn't take up too much stack space.
+TEST(MessageTest, DoesNotTakeUpMuchStackSpace) {
+ EXPECT_LE(sizeof(Message), 16U);
+}
+
+} // namespace
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-options_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-options_test.cc
new file mode 100644
index 0000000..2e2cbc9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-options_test.cc
@@ -0,0 +1,212 @@
+// Copyright 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.
+//
+// Authors: keith.ray@gmail.com (Keith Ray)
+//
+// Google Test UnitTestOptions tests
+//
+// This file tests classes and functions used internally by
+// Google Test. They are subject to change without notice.
+//
+// This file is #included from gtest.cc, to avoid changing build or
+// make-files on Windows and other platforms. Do not #include this file
+// anywhere else!
+
+#include <gtest/gtest.h>
+
+#if GTEST_OS_WINDOWS_MOBILE
+#include <windows.h>
+#elif GTEST_OS_WINDOWS
+#include <direct.h>
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+namespace testing {
+namespace internal {
+namespace {
+
+// Turns the given relative path into an absolute path.
+FilePath GetAbsolutePathOf(const FilePath& relative_path) {
+ return FilePath::ConcatPaths(FilePath::GetCurrentDir(), relative_path);
+}
+
+// Testing UnitTestOptions::GetOutputFormat/GetOutputFile.
+
+TEST(XmlOutputTest, GetOutputFormatDefault) {
+ GTEST_FLAG(output) = "";
+ EXPECT_STREQ("", UnitTestOptions::GetOutputFormat().c_str());
+}
+
+TEST(XmlOutputTest, GetOutputFormat) {
+ GTEST_FLAG(output) = "xml:filename";
+ EXPECT_STREQ("xml", UnitTestOptions::GetOutputFormat().c_str());
+}
+
+TEST(XmlOutputTest, GetOutputFileDefault) {
+ GTEST_FLAG(output) = "";
+ EXPECT_STREQ(GetAbsolutePathOf(FilePath("test_detail.xml")).c_str(),
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+}
+
+TEST(XmlOutputTest, GetOutputFileSingleFile) {
+ GTEST_FLAG(output) = "xml:filename.abc";
+ EXPECT_STREQ(GetAbsolutePathOf(FilePath("filename.abc")).c_str(),
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+}
+
+TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
+ GTEST_FLAG(output) = "xml:path" GTEST_PATH_SEP_;
+ const std::string expected_output_file =
+ GetAbsolutePathOf(
+ FilePath(std::string("path") + GTEST_PATH_SEP_ +
+ GetCurrentExecutableName().c_str() + ".xml")).c_str();
+ const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
+#if GTEST_OS_WINDOWS
+ EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
+#else
+ EXPECT_EQ(expected_output_file, output_file.c_str());
+#endif
+}
+
+TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
+ const std::string exe_str = GetCurrentExecutableName().c_str();
+#if GTEST_OS_WINDOWS
+ const bool success =
+ _strcmpi("gtest-options_test", exe_str.c_str()) == 0 ||
+ _strcmpi("gtest-options-ex_test", exe_str.c_str()) == 0 ||
+ _strcmpi("gtest_all_test", exe_str.c_str()) == 0 ||
+ _strcmpi("gtest_dll_test", exe_str.c_str()) == 0;
+#else
+ // TODO(wan@google.com): remove the hard-coded "lt-" prefix when
+ // Chandler Carruth's libtool replacement is ready.
+ const bool success =
+ exe_str == "gtest-options_test" ||
+ exe_str == "gtest_all_test" ||
+ exe_str == "lt-gtest_all_test" ||
+ exe_str == "gtest_dll_test";
+#endif // GTEST_OS_WINDOWS
+ if (!success)
+ FAIL() << "GetCurrentExecutableName() returns " << exe_str;
+}
+
+class XmlOutputChangeDirTest : public Test {
+ protected:
+ virtual void SetUp() {
+ original_working_dir_ = FilePath::GetCurrentDir();
+ posix::ChDir("..");
+ // This will make the test fail if run from the root directory.
+ EXPECT_STRNE(original_working_dir_.c_str(),
+ FilePath::GetCurrentDir().c_str());
+ }
+
+ virtual void TearDown() {
+ posix::ChDir(original_working_dir_.c_str());
+ }
+
+ FilePath original_working_dir_;
+};
+
+TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {
+ GTEST_FLAG(output) = "";
+ EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
+ FilePath("test_detail.xml")).c_str(),
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+}
+
+TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) {
+ GTEST_FLAG(output) = "xml";
+ EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
+ FilePath("test_detail.xml")).c_str(),
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+}
+
+TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {
+ GTEST_FLAG(output) = "xml:filename.abc";
+ EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
+ FilePath("filename.abc")).c_str(),
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+}
+
+TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
+ GTEST_FLAG(output) = "xml:path" GTEST_PATH_SEP_;
+ const std::string expected_output_file =
+ FilePath::ConcatPaths(
+ original_working_dir_,
+ FilePath(std::string("path") + GTEST_PATH_SEP_ +
+ GetCurrentExecutableName().c_str() + ".xml")).c_str();
+ const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
+#if GTEST_OS_WINDOWS
+ EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
+#else
+ EXPECT_EQ(expected_output_file, output_file.c_str());
+#endif
+}
+
+TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
+#if GTEST_OS_WINDOWS
+ GTEST_FLAG(output) = "xml:c:\\tmp\\filename.abc";
+ EXPECT_STREQ(FilePath("c:\\tmp\\filename.abc").c_str(),
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+#else
+ GTEST_FLAG(output) ="xml:/tmp/filename.abc";
+ EXPECT_STREQ(FilePath("/tmp/filename.abc").c_str(),
+ UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+#endif
+}
+
+TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
+#if GTEST_OS_WINDOWS
+ const std::string path = "c:\\tmp\\";
+#else
+ const std::string path = "/tmp/";
+#endif
+
+ GTEST_FLAG(output) = "xml:" + path;
+ const std::string expected_output_file =
+ path + GetCurrentExecutableName().c_str() + ".xml";
+ const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
+
+#if GTEST_OS_WINDOWS
+ EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
+#else
+ EXPECT_EQ(expected_output_file, output_file.c_str());
+#endif
+}
+
+} // namespace
+} // namespace internal
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test2_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test2_test.cc
new file mode 100644
index 0000000..ccb6cfa
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test2_test.cc
@@ -0,0 +1,65 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+//
+// Tests for Google Test itself. This verifies that the basic constructs of
+// Google Test work.
+
+#include <gtest/gtest.h>
+
+#include "test/gtest-param-test_test.h"
+
+#if GTEST_HAS_PARAM_TEST
+
+using ::testing::Values;
+using ::testing::internal::ParamGenerator;
+
+// Tests that generators defined in a different translation unit
+// are functional. The test using extern_gen is defined
+// in gtest-param-test_test.cc.
+ParamGenerator<int> extern_gen = Values(33);
+
+// Tests that a parameterized test case can be defined in one translation unit
+// and instantiated in another. The test is defined in gtest-param-test_test.cc
+// and ExternalInstantiationTest fixture class is defined in
+// gtest-param-test_test.h.
+INSTANTIATE_TEST_CASE_P(MultiplesOf33,
+ ExternalInstantiationTest,
+ Values(33, 66));
+
+// Tests that a parameterized test case can be instantiated
+// in multiple translation units. Another instantiation is defined
+// in gtest-param-test_test.cc and InstantiationInMultipleTranslaionUnitsTest
+// fixture is defined in gtest-param-test_test.h
+INSTANTIATE_TEST_CASE_P(Sequence2,
+ InstantiationInMultipleTranslaionUnitsTest,
+ Values(42*3, 42*4, 42*5));
+
+#endif // GTEST_HAS_PARAM_TEST
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.cc
new file mode 100644
index 0000000..d0a0e73
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.cc
@@ -0,0 +1,835 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+//
+// Tests for Google Test itself. This file verifies that the parameter
+// generators objects produce correct parameter sequences and that
+// Google Test runtime instantiates correct tests from those sequences.
+
+#include <gtest/gtest.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+#include <algorithm>
+#include <iostream>
+#include <list>
+#include <sstream>
+#include <string>
+#include <vector>
+
+// To include gtest-internal-inl.h.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h" // for UnitTestOptions
+#undef GTEST_IMPLEMENTATION_
+
+#include "test/gtest-param-test_test.h"
+
+using ::std::vector;
+using ::std::sort;
+
+using ::testing::AddGlobalTestEnvironment;
+using ::testing::Bool;
+using ::testing::Message;
+using ::testing::Range;
+using ::testing::TestWithParam;
+using ::testing::Values;
+using ::testing::ValuesIn;
+
+#if GTEST_HAS_COMBINE
+using ::testing::Combine;
+using ::std::tr1::get;
+using ::std::tr1::make_tuple;
+using ::std::tr1::tuple;
+#endif // GTEST_HAS_COMBINE
+
+using ::testing::internal::ParamGenerator;
+using ::testing::internal::UnitTestOptions;
+
+// Prints a value to a string.
+//
+// TODO(wan@google.com): remove PrintValue() when we move matchers and
+// EXPECT_THAT() from Google Mock to Google Test. At that time, we
+// can write EXPECT_THAT(x, Eq(y)) to compare two tuples x and y, as
+// EXPECT_THAT() and the matchers know how to print tuples.
+template <typename T>
+::std::string PrintValue(const T& value) {
+ ::std::stringstream stream;
+ stream << value;
+ return stream.str();
+}
+
+#if GTEST_HAS_COMBINE
+
+// These overloads allow printing tuples in our tests. We cannot
+// define an operator<< for tuples, as that definition needs to be in
+// the std namespace in order to be picked up by Google Test via
+// Argument-Dependent Lookup, yet defining anything in the std
+// namespace in non-STL code is undefined behavior.
+
+template <typename T1, typename T2>
+::std::string PrintValue(const tuple<T1, T2>& value) {
+ ::std::stringstream stream;
+ stream << "(" << get<0>(value) << ", " << get<1>(value) << ")";
+ return stream.str();
+}
+
+template <typename T1, typename T2, typename T3>
+::std::string PrintValue(const tuple<T1, T2, T3>& value) {
+ ::std::stringstream stream;
+ stream << "(" << get<0>(value) << ", " << get<1>(value)
+ << ", "<< get<2>(value) << ")";
+ return stream.str();
+}
+
+template <typename T1, typename T2, typename T3, typename T4, typename T5,
+ typename T6, typename T7, typename T8, typename T9, typename T10>
+::std::string PrintValue(
+ const tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& value) {
+ ::std::stringstream stream;
+ stream << "(" << get<0>(value) << ", " << get<1>(value)
+ << ", "<< get<2>(value) << ", " << get<3>(value)
+ << ", "<< get<4>(value) << ", " << get<5>(value)
+ << ", "<< get<6>(value) << ", " << get<7>(value)
+ << ", "<< get<8>(value) << ", " << get<9>(value) << ")";
+ return stream.str();
+}
+
+#endif // GTEST_HAS_COMBINE
+
+// Verifies that a sequence generated by the generator and accessed
+// via the iterator object matches the expected one using Google Test
+// assertions.
+template <typename T, size_t N>
+void VerifyGenerator(const ParamGenerator<T>& generator,
+ const T (&expected_values)[N]) {
+ typename ParamGenerator<T>::iterator it = generator.begin();
+ for (size_t i = 0; i < N; ++i) {
+ ASSERT_FALSE(it == generator.end())
+ << "At element " << i << " when accessing via an iterator "
+ << "created with the copy constructor.\n";
+ // We cannot use EXPECT_EQ() here as the values may be tuples,
+ // which don't support <<.
+ EXPECT_TRUE(expected_values[i] == *it)
+ << "where i is " << i
+ << ", expected_values[i] is " << PrintValue(expected_values[i])
+ << ", *it is " << PrintValue(*it)
+ << ", and 'it' is an iterator created with the copy constructor.\n";
+ it++;
+ }
+ EXPECT_TRUE(it == generator.end())
+ << "At the presumed end of sequence when accessing via an iterator "
+ << "created with the copy constructor.\n";
+
+ // Test the iterator assignment. The following lines verify that
+ // the sequence accessed via an iterator initialized via the
+ // assignment operator (as opposed to a copy constructor) matches
+ // just the same.
+ it = generator.begin();
+ for (size_t i = 0; i < N; ++i) {
+ ASSERT_FALSE(it == generator.end())
+ << "At element " << i << " when accessing via an iterator "
+ << "created with the assignment operator.\n";
+ EXPECT_TRUE(expected_values[i] == *it)
+ << "where i is " << i
+ << ", expected_values[i] is " << PrintValue(expected_values[i])
+ << ", *it is " << PrintValue(*it)
+ << ", and 'it' is an iterator created with the copy constructor.\n";
+ it++;
+ }
+ EXPECT_TRUE(it == generator.end())
+ << "At the presumed end of sequence when accessing via an iterator "
+ << "created with the assignment operator.\n";
+}
+
+template <typename T>
+void VerifyGeneratorIsEmpty(const ParamGenerator<T>& generator) {
+ typename ParamGenerator<T>::iterator it = generator.begin();
+ EXPECT_TRUE(it == generator.end());
+
+ it = generator.begin();
+ EXPECT_TRUE(it == generator.end());
+}
+
+// Generator tests. They test that each of the provided generator functions
+// generates an expected sequence of values. The general test pattern
+// instantiates a generator using one of the generator functions,
+// checks the sequence produced by the generator using its iterator API,
+// and then resets the iterator back to the beginning of the sequence
+// and checks the sequence again.
+
+// Tests that iterators produced by generator functions conform to the
+// ForwardIterator concept.
+TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
+ const ParamGenerator<int> gen = Range(0, 10);
+ ParamGenerator<int>::iterator it = gen.begin();
+
+ // Verifies that iterator initialization works as expected.
+ ParamGenerator<int>::iterator it2 = it;
+ EXPECT_TRUE(*it == *it2) << "Initialized iterators must point to the "
+ << "element same as its source points to";
+
+ // Verifies that iterator assignment works as expected.
+ it++;
+ EXPECT_FALSE(*it == *it2);
+ it2 = it;
+ EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the "
+ << "element same as its source points to";
+
+ // Verifies that prefix operator++() returns *this.
+ EXPECT_EQ(&it, &(++it)) << "Result of the prefix operator++ must be "
+ << "refer to the original object";
+
+ // Verifies that the result of the postfix operator++ points to the value
+ // pointed to by the original iterator.
+ int original_value = *it; // Have to compute it outside of macro call to be
+ // unaffected by the parameter evaluation order.
+ EXPECT_EQ(original_value, *(it++));
+
+ // Verifies that prefix and postfix operator++() advance an iterator
+ // all the same.
+ it2 = it;
+ it++;
+ ++it2;
+ EXPECT_TRUE(*it == *it2);
+}
+
+// Tests that Range() generates the expected sequence.
+TEST(RangeTest, IntRangeWithDefaultStep) {
+ const ParamGenerator<int> gen = Range(0, 3);
+ const int expected_values[] = {0, 1, 2};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Edge case. Tests that Range() generates the single element sequence
+// as expected when provided with range limits that are equal.
+TEST(RangeTest, IntRangeSingleValue) {
+ const ParamGenerator<int> gen = Range(0, 1);
+ const int expected_values[] = {0};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Edge case. Tests that Range() with generates empty sequence when
+// supplied with an empty range.
+TEST(RangeTest, IntRangeEmpty) {
+ const ParamGenerator<int> gen = Range(0, 0);
+ VerifyGeneratorIsEmpty(gen);
+}
+
+// Tests that Range() with custom step (greater then one) generates
+// the expected sequence.
+TEST(RangeTest, IntRangeWithCustomStep) {
+ const ParamGenerator<int> gen = Range(0, 9, 3);
+ const int expected_values[] = {0, 3, 6};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that Range() with custom step (greater then one) generates
+// the expected sequence when the last element does not fall on the
+// upper range limit. Sequences generated by Range() must not have
+// elements beyond the range limits.
+TEST(RangeTest, IntRangeWithCustomStepOverUpperBound) {
+ const ParamGenerator<int> gen = Range(0, 4, 3);
+ const int expected_values[] = {0, 3};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Verifies that Range works with user-defined types that define
+// copy constructor, operator=(), operator+(), and operator<().
+class DogAdder {
+ public:
+ explicit DogAdder(const char* a_value) : value_(a_value) {}
+ DogAdder(const DogAdder& other) : value_(other.value_.c_str()) {}
+
+ DogAdder operator=(const DogAdder& other) {
+ if (this != &other)
+ value_ = other.value_;
+ return *this;
+ }
+ DogAdder operator+(const DogAdder& other) const {
+ Message msg;
+ msg << value_.c_str() << other.value_.c_str();
+ return DogAdder(msg.GetString().c_str());
+ }
+ bool operator<(const DogAdder& other) const {
+ return value_ < other.value_;
+ }
+ const ::testing::internal::String& value() const { return value_; }
+
+ private:
+ ::testing::internal::String value_;
+};
+
+TEST(RangeTest, WorksWithACustomType) {
+ const ParamGenerator<DogAdder> gen =
+ Range(DogAdder("cat"), DogAdder("catdogdog"), DogAdder("dog"));
+ ParamGenerator<DogAdder>::iterator it = gen.begin();
+
+ ASSERT_FALSE(it == gen.end());
+ EXPECT_STREQ("cat", it->value().c_str());
+
+ ASSERT_FALSE(++it == gen.end());
+ EXPECT_STREQ("catdog", it->value().c_str());
+
+ EXPECT_TRUE(++it == gen.end());
+}
+
+class IntWrapper {
+ public:
+ explicit IntWrapper(int a_value) : value_(a_value) {}
+ IntWrapper(const IntWrapper& other) : value_(other.value_) {}
+
+ IntWrapper operator=(const IntWrapper& other) {
+ value_ = other.value_;
+ return *this;
+ }
+ // operator+() adds a different type.
+ IntWrapper operator+(int other) const { return IntWrapper(value_ + other); }
+ bool operator<(const IntWrapper& other) const {
+ return value_ < other.value_;
+ }
+ int value() const { return value_; }
+
+ private:
+ int value_;
+};
+
+TEST(RangeTest, WorksWithACustomTypeWithDifferentIncrementType) {
+ const ParamGenerator<IntWrapper> gen = Range(IntWrapper(0), IntWrapper(2));
+ ParamGenerator<IntWrapper>::iterator it = gen.begin();
+
+ ASSERT_FALSE(it == gen.end());
+ EXPECT_EQ(0, it->value());
+
+ ASSERT_FALSE(++it == gen.end());
+ EXPECT_EQ(1, it->value());
+
+ EXPECT_TRUE(++it == gen.end());
+}
+
+// Tests that ValuesIn() with an array parameter generates
+// the expected sequence.
+TEST(ValuesInTest, ValuesInArray) {
+ int array[] = {3, 5, 8};
+ const ParamGenerator<int> gen = ValuesIn(array);
+ VerifyGenerator(gen, array);
+}
+
+// Tests that ValuesIn() with a const array parameter generates
+// the expected sequence.
+TEST(ValuesInTest, ValuesInConstArray) {
+ const int array[] = {3, 5, 8};
+ const ParamGenerator<int> gen = ValuesIn(array);
+ VerifyGenerator(gen, array);
+}
+
+// Edge case. Tests that ValuesIn() with an array parameter containing a
+// single element generates the single element sequence.
+TEST(ValuesInTest, ValuesInSingleElementArray) {
+ int array[] = {42};
+ const ParamGenerator<int> gen = ValuesIn(array);
+ VerifyGenerator(gen, array);
+}
+
+// Tests that ValuesIn() generates the expected sequence for an STL
+// container (vector).
+TEST(ValuesInTest, ValuesInVector) {
+ typedef ::std::vector<int> ContainerType;
+ ContainerType values;
+ values.push_back(3);
+ values.push_back(5);
+ values.push_back(8);
+ const ParamGenerator<int> gen = ValuesIn(values);
+
+ const int expected_values[] = {3, 5, 8};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that ValuesIn() generates the expected sequence.
+TEST(ValuesInTest, ValuesInIteratorRange) {
+ typedef ::std::vector<int> ContainerType;
+ ContainerType values;
+ values.push_back(3);
+ values.push_back(5);
+ values.push_back(8);
+ const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
+
+ const int expected_values[] = {3, 5, 8};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Edge case. Tests that ValuesIn() provided with an iterator range specifying a
+// single value generates a single-element sequence.
+TEST(ValuesInTest, ValuesInSingleElementIteratorRange) {
+ typedef ::std::vector<int> ContainerType;
+ ContainerType values;
+ values.push_back(42);
+ const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
+
+ const int expected_values[] = {42};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Edge case. Tests that ValuesIn() provided with an empty iterator range
+// generates an empty sequence.
+TEST(ValuesInTest, ValuesInEmptyIteratorRange) {
+ typedef ::std::vector<int> ContainerType;
+ ContainerType values;
+ const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
+
+ VerifyGeneratorIsEmpty(gen);
+}
+
+// Tests that the Values() generates the expected sequence.
+TEST(ValuesTest, ValuesWorks) {
+ const ParamGenerator<int> gen = Values(3, 5, 8);
+
+ const int expected_values[] = {3, 5, 8};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that Values() generates the expected sequences from elements of
+// different types convertible to ParamGenerator's parameter type.
+TEST(ValuesTest, ValuesWorksForValuesOfCompatibleTypes) {
+ const ParamGenerator<double> gen = Values(3, 5.0f, 8.0);
+
+ const double expected_values[] = {3.0, 5.0, 8.0};
+ VerifyGenerator(gen, expected_values);
+}
+
+TEST(ValuesTest, ValuesWorksForMaxLengthList) {
+ const ParamGenerator<int> gen = Values(
+ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
+ 110, 120, 130, 140, 150, 160, 170, 180, 190, 200,
+ 210, 220, 230, 240, 250, 260, 270, 280, 290, 300,
+ 310, 320, 330, 340, 350, 360, 370, 380, 390, 400,
+ 410, 420, 430, 440, 450, 460, 470, 480, 490, 500);
+
+ const int expected_values[] = {
+ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
+ 110, 120, 130, 140, 150, 160, 170, 180, 190, 200,
+ 210, 220, 230, 240, 250, 260, 270, 280, 290, 300,
+ 310, 320, 330, 340, 350, 360, 370, 380, 390, 400,
+ 410, 420, 430, 440, 450, 460, 470, 480, 490, 500};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Edge case test. Tests that single-parameter Values() generates the sequence
+// with the single value.
+TEST(ValuesTest, ValuesWithSingleParameter) {
+ const ParamGenerator<int> gen = Values(42);
+
+ const int expected_values[] = {42};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that Bool() generates sequence (false, true).
+TEST(BoolTest, BoolWorks) {
+ const ParamGenerator<bool> gen = Bool();
+
+ const bool expected_values[] = {false, true};
+ VerifyGenerator(gen, expected_values);
+}
+
+#if GTEST_HAS_COMBINE
+
+// Tests that Combine() with two parameters generates the expected sequence.
+TEST(CombineTest, CombineWithTwoParameters) {
+ const char* foo = "foo";
+ const char* bar = "bar";
+ const ParamGenerator<tuple<const char*, int> > gen =
+ Combine(Values(foo, bar), Values(3, 4));
+
+ tuple<const char*, int> expected_values[] = {
+ make_tuple(foo, 3), make_tuple(foo, 4),
+ make_tuple(bar, 3), make_tuple(bar, 4)};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that Combine() with three parameters generates the expected sequence.
+TEST(CombineTest, CombineWithThreeParameters) {
+ const ParamGenerator<tuple<int, int, int> > gen = Combine(Values(0, 1),
+ Values(3, 4),
+ Values(5, 6));
+ tuple<int, int, int> expected_values[] = {
+ make_tuple(0, 3, 5), make_tuple(0, 3, 6),
+ make_tuple(0, 4, 5), make_tuple(0, 4, 6),
+ make_tuple(1, 3, 5), make_tuple(1, 3, 6),
+ make_tuple(1, 4, 5), make_tuple(1, 4, 6)};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that the Combine() with the first parameter generating a single value
+// sequence generates a sequence with the number of elements equal to the
+// number of elements in the sequence generated by the second parameter.
+TEST(CombineTest, CombineWithFirstParameterSingleValue) {
+ const ParamGenerator<tuple<int, int> > gen = Combine(Values(42),
+ Values(0, 1));
+
+ tuple<int, int> expected_values[] = {make_tuple(42, 0), make_tuple(42, 1)};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that the Combine() with the second parameter generating a single value
+// sequence generates a sequence with the number of elements equal to the
+// number of elements in the sequence generated by the first parameter.
+TEST(CombineTest, CombineWithSecondParameterSingleValue) {
+ const ParamGenerator<tuple<int, int> > gen = Combine(Values(0, 1),
+ Values(42));
+
+ tuple<int, int> expected_values[] = {make_tuple(0, 42), make_tuple(1, 42)};
+ VerifyGenerator(gen, expected_values);
+}
+
+// Tests that when the first parameter produces an empty sequence,
+// Combine() produces an empty sequence, too.
+TEST(CombineTest, CombineWithFirstParameterEmptyRange) {
+ const ParamGenerator<tuple<int, int> > gen = Combine(Range(0, 0),
+ Values(0, 1));
+ VerifyGeneratorIsEmpty(gen);
+}
+
+// Tests that when the second parameter produces an empty sequence,
+// Combine() produces an empty sequence, too.
+TEST(CombineTest, CombineWithSecondParameterEmptyRange) {
+ const ParamGenerator<tuple<int, int> > gen = Combine(Values(0, 1),
+ Range(1, 1));
+ VerifyGeneratorIsEmpty(gen);
+}
+
+// Edge case. Tests that combine works with the maximum number
+// of parameters supported by Google Test (currently 10).
+TEST(CombineTest, CombineWithMaxNumberOfParameters) {
+ const char* foo = "foo";
+ const char* bar = "bar";
+ const ParamGenerator<tuple<const char*, int, int, int, int, int, int, int,
+ int, int> > gen = Combine(Values(foo, bar),
+ Values(1), Values(2),
+ Values(3), Values(4),
+ Values(5), Values(6),
+ Values(7), Values(8),
+ Values(9));
+
+ tuple<const char*, int, int, int, int, int, int, int, int, int>
+ expected_values[] = {make_tuple(foo, 1, 2, 3, 4, 5, 6, 7, 8, 9),
+ make_tuple(bar, 1, 2, 3, 4, 5, 6, 7, 8, 9)};
+ VerifyGenerator(gen, expected_values);
+}
+
+#endif // GTEST_HAS_COMBINE
+
+// Tests that an generator produces correct sequence after being
+// assigned from another generator.
+TEST(ParamGeneratorTest, AssignmentWorks) {
+ ParamGenerator<int> gen = Values(1, 2);
+ const ParamGenerator<int> gen2 = Values(3, 4);
+ gen = gen2;
+
+ const int expected_values[] = {3, 4};
+ VerifyGenerator(gen, expected_values);
+}
+
+// This test verifies that the tests are expanded and run as specified:
+// one test per element from the sequence produced by the generator
+// specified in INSTANTIATE_TEST_CASE_P. It also verifies that the test's
+// fixture constructor, SetUp(), and TearDown() have run and have been
+// supplied with the correct parameters.
+
+// The use of environment object allows detection of the case where no test
+// case functionality is run at all. In this case TestCaseTearDown will not
+// be able to detect missing tests, naturally.
+template <int kExpectedCalls>
+class TestGenerationEnvironment : public ::testing::Environment {
+ public:
+ static TestGenerationEnvironment* Instance() {
+ static TestGenerationEnvironment* instance = new TestGenerationEnvironment;
+ return instance;
+ }
+
+ void FixtureConstructorExecuted() { fixture_constructor_count_++; }
+ void SetUpExecuted() { set_up_count_++; }
+ void TearDownExecuted() { tear_down_count_++; }
+ void TestBodyExecuted() { test_body_count_++; }
+
+ virtual void TearDown() {
+ // If all MultipleTestGenerationTest tests have been de-selected
+ // by the filter flag, the following checks make no sense.
+ bool perform_check = false;
+
+ for (int i = 0; i < kExpectedCalls; ++i) {
+ Message msg;
+ msg << "TestsExpandedAndRun/" << i;
+ if (UnitTestOptions::FilterMatchesTest(
+ "TestExpansionModule/MultipleTestGenerationTest",
+ msg.GetString().c_str())) {
+ perform_check = true;
+ }
+ }
+ if (perform_check) {
+ EXPECT_EQ(kExpectedCalls, fixture_constructor_count_)
+ << "Fixture constructor of ParamTestGenerationTest test case "
+ << "has not been run as expected.";
+ EXPECT_EQ(kExpectedCalls, set_up_count_)
+ << "Fixture SetUp method of ParamTestGenerationTest test case "
+ << "has not been run as expected.";
+ EXPECT_EQ(kExpectedCalls, tear_down_count_)
+ << "Fixture TearDown method of ParamTestGenerationTest test case "
+ << "has not been run as expected.";
+ EXPECT_EQ(kExpectedCalls, test_body_count_)
+ << "Test in ParamTestGenerationTest test case "
+ << "has not been run as expected.";
+ }
+ }
+ private:
+ TestGenerationEnvironment() : fixture_constructor_count_(0), set_up_count_(0),
+ tear_down_count_(0), test_body_count_(0) {}
+
+ int fixture_constructor_count_;
+ int set_up_count_;
+ int tear_down_count_;
+ int test_body_count_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationEnvironment);
+};
+
+const int test_generation_params[] = {36, 42, 72};
+
+class TestGenerationTest : public TestWithParam<int> {
+ public:
+ enum {
+ PARAMETER_COUNT =
+ sizeof(test_generation_params)/sizeof(test_generation_params[0])
+ };
+
+ typedef TestGenerationEnvironment<PARAMETER_COUNT> Environment;
+
+ TestGenerationTest() {
+ Environment::Instance()->FixtureConstructorExecuted();
+ current_parameter_ = GetParam();
+ }
+ virtual void SetUp() {
+ Environment::Instance()->SetUpExecuted();
+ EXPECT_EQ(current_parameter_, GetParam());
+ }
+ virtual void TearDown() {
+ Environment::Instance()->TearDownExecuted();
+ EXPECT_EQ(current_parameter_, GetParam());
+ }
+
+ static void SetUpTestCase() {
+ bool all_tests_in_test_case_selected = true;
+
+ for (int i = 0; i < PARAMETER_COUNT; ++i) {
+ Message test_name;
+ test_name << "TestsExpandedAndRun/" << i;
+ if ( !UnitTestOptions::FilterMatchesTest(
+ "TestExpansionModule/MultipleTestGenerationTest",
+ test_name.GetString())) {
+ all_tests_in_test_case_selected = false;
+ }
+ }
+ EXPECT_TRUE(all_tests_in_test_case_selected)
+ << "When running the TestGenerationTest test case all of its tests\n"
+ << "must be selected by the filter flag for the test case to pass.\n"
+ << "If not all of them are enabled, we can't reliably conclude\n"
+ << "that the correct number of tests have been generated.";
+
+ collected_parameters_.clear();
+ }
+
+ static void TearDownTestCase() {
+ vector<int> expected_values(test_generation_params,
+ test_generation_params + PARAMETER_COUNT);
+ // Test execution order is not guaranteed by Google Test,
+ // so the order of values in collected_parameters_ can be
+ // different and we have to sort to compare.
+ sort(expected_values.begin(), expected_values.end());
+ sort(collected_parameters_.begin(), collected_parameters_.end());
+
+ EXPECT_TRUE(collected_parameters_ == expected_values);
+ }
+ protected:
+ int current_parameter_;
+ static vector<int> collected_parameters_;
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationTest);
+};
+vector<int> TestGenerationTest::collected_parameters_;
+
+TEST_P(TestGenerationTest, TestsExpandedAndRun) {
+ Environment::Instance()->TestBodyExecuted();
+ EXPECT_EQ(current_parameter_, GetParam());
+ collected_parameters_.push_back(GetParam());
+}
+INSTANTIATE_TEST_CASE_P(TestExpansionModule, TestGenerationTest,
+ ValuesIn(test_generation_params));
+
+// This test verifies that the element sequence (third parameter of
+// INSTANTIATE_TEST_CASE_P) is evaluated in InitGoogleTest() and neither at
+// the call site of INSTANTIATE_TEST_CASE_P nor in RUN_ALL_TESTS(). For
+// that, we declare param_value_ to be a static member of
+// GeneratorEvaluationTest and initialize it to 0. We set it to 1 in
+// main(), just before invocation of InitGoogleTest(). After calling
+// InitGoogleTest(), we set the value to 2. If the sequence is evaluated
+// before or after InitGoogleTest, INSTANTIATE_TEST_CASE_P will create a
+// test with parameter other than 1, and the test body will fail the
+// assertion.
+class GeneratorEvaluationTest : public TestWithParam<int> {
+ public:
+ static int param_value() { return param_value_; }
+ static void set_param_value(int param_value) { param_value_ = param_value; }
+
+ private:
+ static int param_value_;
+};
+int GeneratorEvaluationTest::param_value_ = 0;
+
+TEST_P(GeneratorEvaluationTest, GeneratorsEvaluatedInMain) {
+ EXPECT_EQ(1, GetParam());
+}
+INSTANTIATE_TEST_CASE_P(GenEvalModule,
+ GeneratorEvaluationTest,
+ Values(GeneratorEvaluationTest::param_value()));
+
+// Tests that generators defined in a different translation unit are
+// functional. Generator extern_gen is defined in gtest-param-test_test2.cc.
+extern ParamGenerator<int> extern_gen;
+class ExternalGeneratorTest : public TestWithParam<int> {};
+TEST_P(ExternalGeneratorTest, ExternalGenerator) {
+ // Sequence produced by extern_gen contains only a single value
+ // which we verify here.
+ EXPECT_EQ(GetParam(), 33);
+}
+INSTANTIATE_TEST_CASE_P(ExternalGeneratorModule,
+ ExternalGeneratorTest,
+ extern_gen);
+
+// Tests that a parameterized test case can be defined in one translation
+// unit and instantiated in another. This test will be instantiated in
+// gtest-param-test_test2.cc. ExternalInstantiationTest fixture class is
+// defined in gtest-param-test_test.h.
+TEST_P(ExternalInstantiationTest, IsMultipleOf33) {
+ EXPECT_EQ(0, GetParam() % 33);
+}
+
+// Tests that a parameterized test case can be instantiated with multiple
+// generators.
+class MultipleInstantiationTest : public TestWithParam<int> {};
+TEST_P(MultipleInstantiationTest, AllowsMultipleInstances) {
+}
+INSTANTIATE_TEST_CASE_P(Sequence1, MultipleInstantiationTest, Values(1, 2));
+INSTANTIATE_TEST_CASE_P(Sequence2, MultipleInstantiationTest, Range(3, 5));
+
+// Tests that a parameterized test case can be instantiated
+// in multiple translation units. This test will be instantiated
+// here and in gtest-param-test_test2.cc.
+// InstantiationInMultipleTranslationUnitsTest fixture class
+// is defined in gtest-param-test_test.h.
+TEST_P(InstantiationInMultipleTranslaionUnitsTest, IsMultipleOf42) {
+ EXPECT_EQ(0, GetParam() % 42);
+}
+INSTANTIATE_TEST_CASE_P(Sequence1,
+ InstantiationInMultipleTranslaionUnitsTest,
+ Values(42, 42*2));
+
+// Tests that each iteration of parameterized test runs in a separate test
+// object.
+class SeparateInstanceTest : public TestWithParam<int> {
+ public:
+ SeparateInstanceTest() : count_(0) {}
+
+ static void TearDownTestCase() {
+ EXPECT_GE(global_count_, 2)
+ << "If some (but not all) SeparateInstanceTest tests have been "
+ << "filtered out this test will fail. Make sure that all "
+ << "GeneratorEvaluationTest are selected or de-selected together "
+ << "by the test filter.";
+ }
+
+ protected:
+ int count_;
+ static int global_count_;
+};
+int SeparateInstanceTest::global_count_ = 0;
+
+TEST_P(SeparateInstanceTest, TestsRunInSeparateInstances) {
+ EXPECT_EQ(0, count_++);
+ global_count_++;
+}
+INSTANTIATE_TEST_CASE_P(FourElemSequence, SeparateInstanceTest, Range(1, 4));
+
+// Tests that all instantiations of a test have named appropriately. Test
+// defined with TEST_P(TestCaseName, TestName) and instantiated with
+// INSTANTIATE_TEST_CASE_P(SequenceName, TestCaseName, generator) must be named
+// SequenceName/TestCaseName.TestName/i, where i is the 0-based index of the
+// sequence element used to instantiate the test.
+class NamingTest : public TestWithParam<int> {};
+
+TEST_P(NamingTest, TestsAreNamedAppropriately) {
+ const ::testing::TestInfo* const test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+
+ EXPECT_STREQ("ZeroToFiveSequence/NamingTest", test_info->test_case_name());
+
+ Message msg;
+ msg << "TestsAreNamedAppropriately/" << GetParam();
+ EXPECT_STREQ(msg.GetString().c_str(), test_info->name());
+}
+
+INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
+
+#endif // GTEST_HAS_PARAM_TEST
+
+TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {
+#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST
+ FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n"
+#endif
+}
+
+int main(int argc, char **argv) {
+#if GTEST_HAS_PARAM_TEST
+ // Used in TestGenerationTest test case.
+ AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
+ // Used in GeneratorEvaluationTest test case. Tests that the updated value
+ // will be picked up for instantiating tests in GeneratorEvaluationTest.
+ GeneratorEvaluationTest::set_param_value(1);
+#endif // GTEST_HAS_PARAM_TEST
+
+ ::testing::InitGoogleTest(&argc, argv);
+
+#if GTEST_HAS_PARAM_TEST
+ // Used in GeneratorEvaluationTest test case. Tests that value updated
+ // here will NOT be used for instantiating tests in
+ // GeneratorEvaluationTest.
+ GeneratorEvaluationTest::set_param_value(2);
+#endif // GTEST_HAS_PARAM_TEST
+
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.h
new file mode 100644
index 0000000..b7f9493
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-param-test_test.h
@@ -0,0 +1,55 @@
+// Copyright 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.
+//
+// Authors: vladl@google.com (Vlad Losev)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file provides classes and functions used internally
+// for testing Google Test itself.
+
+#ifndef GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
+#define GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
+
+#include <gtest/gtest.h>
+
+#if GTEST_HAS_PARAM_TEST
+
+// Test fixture for testing definition and instantiation of a test
+// in separate translation units.
+class ExternalInstantiationTest : public ::testing::TestWithParam<int> {};
+
+// Test fixture for testing instantiation of a test in multiple
+// translation units.
+class InstantiationInMultipleTranslaionUnitsTest
+ : public ::testing::TestWithParam<int> {};
+
+#endif // GTEST_HAS_PARAM_TEST
+
+#endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-port_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-port_test.cc
new file mode 100644
index 0000000..3725860
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-port_test.cc
@@ -0,0 +1,1018 @@
+// Copyright 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.
+//
+// Authors: vladl@google.com (Vlad Losev), wan@google.com (Zhanyong Wan)
+//
+// This file tests the internal cross-platform support utilities.
+
+#include <gtest/internal/gtest-port.h>
+
+#include <stdio.h>
+
+#if GTEST_OS_MAC
+#include <time.h>
+#endif // GTEST_OS_MAC
+
+#include <utility> // For std::pair and std::make_pair.
+
+#include <gtest/gtest.h>
+#include <gtest/gtest-spi.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+using std::make_pair;
+using std::pair;
+
+namespace testing {
+namespace internal {
+
+// Tests that the element_type typedef is available in scoped_ptr and refers
+// to the parameter type.
+TEST(ScopedPtrTest, DefinesElementType) {
+ StaticAssertTypeEq<int, ::testing::internal::scoped_ptr<int>::element_type>();
+}
+
+// TODO(vladl@google.com): Implement THE REST of scoped_ptr tests.
+
+TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {
+ if (AlwaysFalse())
+ GTEST_CHECK_(false) << "This should never be executed; "
+ "It's a compilation test only.";
+
+ if (AlwaysTrue())
+ GTEST_CHECK_(true);
+ else
+ ; // NOLINT
+
+ if (AlwaysFalse())
+ ; // NOLINT
+ else
+ GTEST_CHECK_(true) << "";
+}
+
+TEST(GtestCheckSyntaxTest, WorksWithSwitch) {
+ switch (0) {
+ case 1:
+ break;
+ default:
+ GTEST_CHECK_(true);
+ }
+
+ switch(0)
+ case 0:
+ GTEST_CHECK_(true) << "Check failed in switch case";
+}
+
+#if GTEST_OS_MAC
+void* ThreadFunc(void* data) {
+ pthread_mutex_t* mutex = static_cast<pthread_mutex_t*>(data);
+ pthread_mutex_lock(mutex);
+ pthread_mutex_unlock(mutex);
+ return NULL;
+}
+
+TEST(GetThreadCountTest, ReturnsCorrectValue) {
+ EXPECT_EQ(1U, GetThreadCount());
+ pthread_mutex_t mutex;
+ pthread_attr_t attr;
+ pthread_t thread_id;
+
+ // TODO(vladl@google.com): turn mutex into internal::Mutex for automatic
+ // destruction.
+ pthread_mutex_init(&mutex, NULL);
+ pthread_mutex_lock(&mutex);
+ ASSERT_EQ(0, pthread_attr_init(&attr));
+ ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE));
+
+ const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex);
+ ASSERT_EQ(0, pthread_attr_destroy(&attr));
+ ASSERT_EQ(0, status);
+ EXPECT_EQ(2U, GetThreadCount());
+ pthread_mutex_unlock(&mutex);
+
+ void* dummy;
+ ASSERT_EQ(0, pthread_join(thread_id, &dummy));
+
+ // MacOS X may not immediately report the updated thread count after
+ // joining a thread, causing flakiness in this test. To counter that, we
+ // wait for up to .5 seconds for the OS to report the correct value.
+ for (int i = 0; i < 5; ++i) {
+ if (GetThreadCount() == 1)
+ break;
+
+ SleepMilliseconds(100);
+ }
+ EXPECT_EQ(1U, GetThreadCount());
+ pthread_mutex_destroy(&mutex);
+}
+#else
+TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) {
+ EXPECT_EQ(0U, GetThreadCount());
+}
+#endif // GTEST_OS_MAC
+
+TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
+ const bool a_false_condition = false;
+ const char regex[] =
+#ifdef _MSC_VER
+ "gtest-port_test\\.cc\\(\\d+\\):"
+#else
+ "gtest-port_test\\.cc:[0-9]+"
+#endif // _MSC_VER
+ ".*a_false_condition.*Extra info.*";
+
+ EXPECT_DEATH_IF_SUPPORTED(GTEST_CHECK_(a_false_condition) << "Extra info",
+ regex);
+}
+
+#if GTEST_HAS_DEATH_TEST
+
+TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
+ EXPECT_EXIT({
+ GTEST_CHECK_(true) << "Extra info";
+ ::std::cerr << "Success\n";
+ exit(0); },
+ ::testing::ExitedWithCode(0), "Success");
+}
+
+#endif // GTEST_HAS_DEATH_TEST
+
+#if GTEST_USES_POSIX_RE
+
+#if GTEST_HAS_TYPED_TEST
+
+template <typename Str>
+class RETest : public ::testing::Test {};
+
+// Defines StringTypes as the list of all string types that class RE
+// supports.
+typedef testing::Types<
+ ::std::string,
+#if GTEST_HAS_GLOBAL_STRING
+ ::string,
+#endif // GTEST_HAS_GLOBAL_STRING
+ const char*> StringTypes;
+
+TYPED_TEST_CASE(RETest, StringTypes);
+
+// Tests RE's implicit constructors.
+TYPED_TEST(RETest, ImplicitConstructorWorks) {
+ const RE empty(TypeParam(""));
+ EXPECT_STREQ("", empty.pattern());
+
+ const RE simple(TypeParam("hello"));
+ EXPECT_STREQ("hello", simple.pattern());
+
+ const RE normal(TypeParam(".*(\\w+)"));
+ EXPECT_STREQ(".*(\\w+)", normal.pattern());
+}
+
+// Tests that RE's constructors reject invalid regular expressions.
+TYPED_TEST(RETest, RejectsInvalidRegex) {
+ EXPECT_NONFATAL_FAILURE({
+ const RE invalid(TypeParam("?"));
+ }, "\"?\" is not a valid POSIX Extended regular expression.");
+}
+
+// Tests RE::FullMatch().
+TYPED_TEST(RETest, FullMatchWorks) {
+ const RE empty(TypeParam(""));
+ EXPECT_TRUE(RE::FullMatch(TypeParam(""), empty));
+ EXPECT_FALSE(RE::FullMatch(TypeParam("a"), empty));
+
+ const RE re(TypeParam("a.*z"));
+ EXPECT_TRUE(RE::FullMatch(TypeParam("az"), re));
+ EXPECT_TRUE(RE::FullMatch(TypeParam("axyz"), re));
+ EXPECT_FALSE(RE::FullMatch(TypeParam("baz"), re));
+ EXPECT_FALSE(RE::FullMatch(TypeParam("azy"), re));
+}
+
+// Tests RE::PartialMatch().
+TYPED_TEST(RETest, PartialMatchWorks) {
+ const RE empty(TypeParam(""));
+ EXPECT_TRUE(RE::PartialMatch(TypeParam(""), empty));
+ EXPECT_TRUE(RE::PartialMatch(TypeParam("a"), empty));
+
+ const RE re(TypeParam("a.*z"));
+ EXPECT_TRUE(RE::PartialMatch(TypeParam("az"), re));
+ EXPECT_TRUE(RE::PartialMatch(TypeParam("axyz"), re));
+ EXPECT_TRUE(RE::PartialMatch(TypeParam("baz"), re));
+ EXPECT_TRUE(RE::PartialMatch(TypeParam("azy"), re));
+ EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
+}
+
+#endif // GTEST_HAS_TYPED_TEST
+
+#elif GTEST_USES_SIMPLE_RE
+
+TEST(IsInSetTest, NulCharIsNotInAnySet) {
+ EXPECT_FALSE(IsInSet('\0', ""));
+ EXPECT_FALSE(IsInSet('\0', "\0"));
+ EXPECT_FALSE(IsInSet('\0', "a"));
+}
+
+TEST(IsInSetTest, WorksForNonNulChars) {
+ EXPECT_FALSE(IsInSet('a', "Ab"));
+ EXPECT_FALSE(IsInSet('c', ""));
+
+ EXPECT_TRUE(IsInSet('b', "bcd"));
+ EXPECT_TRUE(IsInSet('b', "ab"));
+}
+
+TEST(IsDigitTest, IsFalseForNonDigit) {
+ EXPECT_FALSE(IsDigit('\0'));
+ EXPECT_FALSE(IsDigit(' '));
+ EXPECT_FALSE(IsDigit('+'));
+ EXPECT_FALSE(IsDigit('-'));
+ EXPECT_FALSE(IsDigit('.'));
+ EXPECT_FALSE(IsDigit('a'));
+}
+
+TEST(IsDigitTest, IsTrueForDigit) {
+ EXPECT_TRUE(IsDigit('0'));
+ EXPECT_TRUE(IsDigit('1'));
+ EXPECT_TRUE(IsDigit('5'));
+ EXPECT_TRUE(IsDigit('9'));
+}
+
+TEST(IsPunctTest, IsFalseForNonPunct) {
+ EXPECT_FALSE(IsPunct('\0'));
+ EXPECT_FALSE(IsPunct(' '));
+ EXPECT_FALSE(IsPunct('\n'));
+ EXPECT_FALSE(IsPunct('a'));
+ EXPECT_FALSE(IsPunct('0'));
+}
+
+TEST(IsPunctTest, IsTrueForPunct) {
+ for (const char* p = "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; *p; p++) {
+ EXPECT_PRED1(IsPunct, *p);
+ }
+}
+
+TEST(IsRepeatTest, IsFalseForNonRepeatChar) {
+ EXPECT_FALSE(IsRepeat('\0'));
+ EXPECT_FALSE(IsRepeat(' '));
+ EXPECT_FALSE(IsRepeat('a'));
+ EXPECT_FALSE(IsRepeat('1'));
+ EXPECT_FALSE(IsRepeat('-'));
+}
+
+TEST(IsRepeatTest, IsTrueForRepeatChar) {
+ EXPECT_TRUE(IsRepeat('?'));
+ EXPECT_TRUE(IsRepeat('*'));
+ EXPECT_TRUE(IsRepeat('+'));
+}
+
+TEST(IsWhiteSpaceTest, IsFalseForNonWhiteSpace) {
+ EXPECT_FALSE(IsWhiteSpace('\0'));
+ EXPECT_FALSE(IsWhiteSpace('a'));
+ EXPECT_FALSE(IsWhiteSpace('1'));
+ EXPECT_FALSE(IsWhiteSpace('+'));
+ EXPECT_FALSE(IsWhiteSpace('_'));
+}
+
+TEST(IsWhiteSpaceTest, IsTrueForWhiteSpace) {
+ EXPECT_TRUE(IsWhiteSpace(' '));
+ EXPECT_TRUE(IsWhiteSpace('\n'));
+ EXPECT_TRUE(IsWhiteSpace('\r'));
+ EXPECT_TRUE(IsWhiteSpace('\t'));
+ EXPECT_TRUE(IsWhiteSpace('\v'));
+ EXPECT_TRUE(IsWhiteSpace('\f'));
+}
+
+TEST(IsWordCharTest, IsFalseForNonWordChar) {
+ EXPECT_FALSE(IsWordChar('\0'));
+ EXPECT_FALSE(IsWordChar('+'));
+ EXPECT_FALSE(IsWordChar('.'));
+ EXPECT_FALSE(IsWordChar(' '));
+ EXPECT_FALSE(IsWordChar('\n'));
+}
+
+TEST(IsWordCharTest, IsTrueForLetter) {
+ EXPECT_TRUE(IsWordChar('a'));
+ EXPECT_TRUE(IsWordChar('b'));
+ EXPECT_TRUE(IsWordChar('A'));
+ EXPECT_TRUE(IsWordChar('Z'));
+}
+
+TEST(IsWordCharTest, IsTrueForDigit) {
+ EXPECT_TRUE(IsWordChar('0'));
+ EXPECT_TRUE(IsWordChar('1'));
+ EXPECT_TRUE(IsWordChar('7'));
+ EXPECT_TRUE(IsWordChar('9'));
+}
+
+TEST(IsWordCharTest, IsTrueForUnderscore) {
+ EXPECT_TRUE(IsWordChar('_'));
+}
+
+TEST(IsValidEscapeTest, IsFalseForNonPrintable) {
+ EXPECT_FALSE(IsValidEscape('\0'));
+ EXPECT_FALSE(IsValidEscape('\007'));
+}
+
+TEST(IsValidEscapeTest, IsFalseForDigit) {
+ EXPECT_FALSE(IsValidEscape('0'));
+ EXPECT_FALSE(IsValidEscape('9'));
+}
+
+TEST(IsValidEscapeTest, IsFalseForWhiteSpace) {
+ EXPECT_FALSE(IsValidEscape(' '));
+ EXPECT_FALSE(IsValidEscape('\n'));
+}
+
+TEST(IsValidEscapeTest, IsFalseForSomeLetter) {
+ EXPECT_FALSE(IsValidEscape('a'));
+ EXPECT_FALSE(IsValidEscape('Z'));
+}
+
+TEST(IsValidEscapeTest, IsTrueForPunct) {
+ EXPECT_TRUE(IsValidEscape('.'));
+ EXPECT_TRUE(IsValidEscape('-'));
+ EXPECT_TRUE(IsValidEscape('^'));
+ EXPECT_TRUE(IsValidEscape('$'));
+ EXPECT_TRUE(IsValidEscape('('));
+ EXPECT_TRUE(IsValidEscape(']'));
+ EXPECT_TRUE(IsValidEscape('{'));
+ EXPECT_TRUE(IsValidEscape('|'));
+}
+
+TEST(IsValidEscapeTest, IsTrueForSomeLetter) {
+ EXPECT_TRUE(IsValidEscape('d'));
+ EXPECT_TRUE(IsValidEscape('D'));
+ EXPECT_TRUE(IsValidEscape('s'));
+ EXPECT_TRUE(IsValidEscape('S'));
+ EXPECT_TRUE(IsValidEscape('w'));
+ EXPECT_TRUE(IsValidEscape('W'));
+}
+
+TEST(AtomMatchesCharTest, EscapedPunct) {
+ EXPECT_FALSE(AtomMatchesChar(true, '\\', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, '\\', ' '));
+ EXPECT_FALSE(AtomMatchesChar(true, '_', '.'));
+ EXPECT_FALSE(AtomMatchesChar(true, '.', 'a'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, '\\', '\\'));
+ EXPECT_TRUE(AtomMatchesChar(true, '_', '_'));
+ EXPECT_TRUE(AtomMatchesChar(true, '+', '+'));
+ EXPECT_TRUE(AtomMatchesChar(true, '.', '.'));
+}
+
+TEST(AtomMatchesCharTest, Escaped_d) {
+ EXPECT_FALSE(AtomMatchesChar(true, 'd', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'd', 'a'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'd', '.'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, 'd', '0'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'd', '9'));
+}
+
+TEST(AtomMatchesCharTest, Escaped_D) {
+ EXPECT_FALSE(AtomMatchesChar(true, 'D', '0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'D', '9'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, 'D', '\0'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'D', 'a'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'D', '-'));
+}
+
+TEST(AtomMatchesCharTest, Escaped_s) {
+ EXPECT_FALSE(AtomMatchesChar(true, 's', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 's', 'a'));
+ EXPECT_FALSE(AtomMatchesChar(true, 's', '.'));
+ EXPECT_FALSE(AtomMatchesChar(true, 's', '9'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, 's', ' '));
+ EXPECT_TRUE(AtomMatchesChar(true, 's', '\n'));
+ EXPECT_TRUE(AtomMatchesChar(true, 's', '\t'));
+}
+
+TEST(AtomMatchesCharTest, Escaped_S) {
+ EXPECT_FALSE(AtomMatchesChar(true, 'S', ' '));
+ EXPECT_FALSE(AtomMatchesChar(true, 'S', '\r'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, 'S', '\0'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'S', 'a'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'S', '9'));
+}
+
+TEST(AtomMatchesCharTest, Escaped_w) {
+ EXPECT_FALSE(AtomMatchesChar(true, 'w', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'w', '+'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'w', ' '));
+ EXPECT_FALSE(AtomMatchesChar(true, 'w', '\n'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, 'w', '0'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'w', 'b'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'w', 'C'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'w', '_'));
+}
+
+TEST(AtomMatchesCharTest, Escaped_W) {
+ EXPECT_FALSE(AtomMatchesChar(true, 'W', 'A'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'W', 'b'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'W', '9'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'W', '_'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, 'W', '\0'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'W', '*'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'W', '\n'));
+}
+
+TEST(AtomMatchesCharTest, EscapedWhiteSpace) {
+ EXPECT_FALSE(AtomMatchesChar(true, 'f', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'f', '\n'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'n', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'n', '\r'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'r', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'r', 'a'));
+ EXPECT_FALSE(AtomMatchesChar(true, 't', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 't', 't'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'v', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(true, 'v', '\f'));
+
+ EXPECT_TRUE(AtomMatchesChar(true, 'f', '\f'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'n', '\n'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'r', '\r'));
+ EXPECT_TRUE(AtomMatchesChar(true, 't', '\t'));
+ EXPECT_TRUE(AtomMatchesChar(true, 'v', '\v'));
+}
+
+TEST(AtomMatchesCharTest, UnescapedDot) {
+ EXPECT_FALSE(AtomMatchesChar(false, '.', '\n'));
+
+ EXPECT_TRUE(AtomMatchesChar(false, '.', '\0'));
+ EXPECT_TRUE(AtomMatchesChar(false, '.', '.'));
+ EXPECT_TRUE(AtomMatchesChar(false, '.', 'a'));
+ EXPECT_TRUE(AtomMatchesChar(false, '.', ' '));
+}
+
+TEST(AtomMatchesCharTest, UnescapedChar) {
+ EXPECT_FALSE(AtomMatchesChar(false, 'a', '\0'));
+ EXPECT_FALSE(AtomMatchesChar(false, 'a', 'b'));
+ EXPECT_FALSE(AtomMatchesChar(false, '$', 'a'));
+
+ EXPECT_TRUE(AtomMatchesChar(false, '$', '$'));
+ EXPECT_TRUE(AtomMatchesChar(false, '5', '5'));
+ EXPECT_TRUE(AtomMatchesChar(false, 'Z', 'Z'));
+}
+
+TEST(ValidateRegexTest, GeneratesFailureAndReturnsFalseForInvalid) {
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(NULL)),
+ "NULL is not a valid simple regular expression");
+ EXPECT_NONFATAL_FAILURE(
+ ASSERT_FALSE(ValidateRegex("a\\")),
+ "Syntax error at index 1 in simple regular expression \"a\\\": ");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a\\")),
+ "'\\' cannot appear at the end");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\n\\")),
+ "'\\' cannot appear at the end");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\s\\hb")),
+ "invalid escape sequence \"\\h\"");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^^")),
+ "'^' can only appear at the beginning");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(".*^b")),
+ "'^' can only appear at the beginning");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("$$")),
+ "'$' can only appear at the end");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^$a")),
+ "'$' can only appear at the end");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a(b")),
+ "'(' is unsupported");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("ab)")),
+ "')' is unsupported");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("[ab")),
+ "'[' is unsupported");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a{2")),
+ "'{' is unsupported");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("?")),
+ "'?' can only follow a repeatable token");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^*")),
+ "'*' can only follow a repeatable token");
+ EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("5*+")),
+ "'+' can only follow a repeatable token");
+}
+
+TEST(ValidateRegexTest, ReturnsTrueForValid) {
+ EXPECT_TRUE(ValidateRegex(""));
+ EXPECT_TRUE(ValidateRegex("a"));
+ EXPECT_TRUE(ValidateRegex(".*"));
+ EXPECT_TRUE(ValidateRegex("^a_+"));
+ EXPECT_TRUE(ValidateRegex("^a\\t\\&?"));
+ EXPECT_TRUE(ValidateRegex("09*$"));
+ EXPECT_TRUE(ValidateRegex("^Z$"));
+ EXPECT_TRUE(ValidateRegex("a\\^Z\\$\\(\\)\\|\\[\\]\\{\\}"));
+}
+
+TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrOne) {
+ EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "a", "ba"));
+ // Repeating more than once.
+ EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "aab"));
+
+ // Repeating zero times.
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ba"));
+ // Repeating once.
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ab"));
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '#', '?', ".", "##"));
+}
+
+TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrMany) {
+ EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '*', "a$", "baab"));
+
+ // Repeating zero times.
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "bc"));
+ // Repeating once.
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "abc"));
+ // Repeating more than once.
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '*', "-", "ab_1-g"));
+}
+
+TEST(MatchRepetitionAndRegexAtHeadTest, WorksForOneOrMany) {
+ EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "a$", "baab"));
+ // Repeating zero times.
+ EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "bc"));
+
+ // Repeating once.
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "abc"));
+ // Repeating more than once.
+ EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '+', "-", "ab_1-g"));
+}
+
+TEST(MatchRegexAtHeadTest, ReturnsTrueForEmptyRegex) {
+ EXPECT_TRUE(MatchRegexAtHead("", ""));
+ EXPECT_TRUE(MatchRegexAtHead("", "ab"));
+}
+
+TEST(MatchRegexAtHeadTest, WorksWhenDollarIsInRegex) {
+ EXPECT_FALSE(MatchRegexAtHead("$", "a"));
+
+ EXPECT_TRUE(MatchRegexAtHead("$", ""));
+ EXPECT_TRUE(MatchRegexAtHead("a$", "a"));
+}
+
+TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithEscapeSequence) {
+ EXPECT_FALSE(MatchRegexAtHead("\\w", "+"));
+ EXPECT_FALSE(MatchRegexAtHead("\\W", "ab"));
+
+ EXPECT_TRUE(MatchRegexAtHead("\\sa", "\nab"));
+ EXPECT_TRUE(MatchRegexAtHead("\\d", "1a"));
+}
+
+TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithRepetition) {
+ EXPECT_FALSE(MatchRegexAtHead(".+a", "abc"));
+ EXPECT_FALSE(MatchRegexAtHead("a?b", "aab"));
+
+ EXPECT_TRUE(MatchRegexAtHead(".*a", "bc12-ab"));
+ EXPECT_TRUE(MatchRegexAtHead("a?b", "b"));
+ EXPECT_TRUE(MatchRegexAtHead("a?b", "ab"));
+}
+
+TEST(MatchRegexAtHeadTest,
+ WorksWhenRegexStartsWithRepetionOfEscapeSequence) {
+ EXPECT_FALSE(MatchRegexAtHead("\\.+a", "abc"));
+ EXPECT_FALSE(MatchRegexAtHead("\\s?b", " b"));
+
+ EXPECT_TRUE(MatchRegexAtHead("\\(*a", "((((ab"));
+ EXPECT_TRUE(MatchRegexAtHead("\\^?b", "^b"));
+ EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "b"));
+ EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "\\b"));
+}
+
+TEST(MatchRegexAtHeadTest, MatchesSequentially) {
+ EXPECT_FALSE(MatchRegexAtHead("ab.*c", "acabc"));
+
+ EXPECT_TRUE(MatchRegexAtHead("ab.*c", "ab-fsc"));
+}
+
+TEST(MatchRegexAnywhereTest, ReturnsFalseWhenStringIsNull) {
+ EXPECT_FALSE(MatchRegexAnywhere("", NULL));
+}
+
+TEST(MatchRegexAnywhereTest, WorksWhenRegexStartsWithCaret) {
+ EXPECT_FALSE(MatchRegexAnywhere("^a", "ba"));
+ EXPECT_FALSE(MatchRegexAnywhere("^$", "a"));
+
+ EXPECT_TRUE(MatchRegexAnywhere("^a", "ab"));
+ EXPECT_TRUE(MatchRegexAnywhere("^", "ab"));
+ EXPECT_TRUE(MatchRegexAnywhere("^$", ""));
+}
+
+TEST(MatchRegexAnywhereTest, ReturnsFalseWhenNoMatch) {
+ EXPECT_FALSE(MatchRegexAnywhere("a", "bcde123"));
+ EXPECT_FALSE(MatchRegexAnywhere("a.+a", "--aa88888888"));
+}
+
+TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingPrefix) {
+ EXPECT_TRUE(MatchRegexAnywhere("\\w+", "ab1_ - 5"));
+ EXPECT_TRUE(MatchRegexAnywhere(".*=", "="));
+ EXPECT_TRUE(MatchRegexAnywhere("x.*ab?.*bc", "xaaabc"));
+}
+
+TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingNonPrefix) {
+ EXPECT_TRUE(MatchRegexAnywhere("\\w+", "$$$ ab1_ - 5"));
+ EXPECT_TRUE(MatchRegexAnywhere("\\.+=", "= ...="));
+}
+
+// Tests RE's implicit constructors.
+TEST(RETest, ImplicitConstructorWorks) {
+ const RE empty("");
+ EXPECT_STREQ("", empty.pattern());
+
+ const RE simple("hello");
+ EXPECT_STREQ("hello", simple.pattern());
+}
+
+// Tests that RE's constructors reject invalid regular expressions.
+TEST(RETest, RejectsInvalidRegex) {
+ EXPECT_NONFATAL_FAILURE({
+ const RE normal(NULL);
+ }, "NULL is not a valid simple regular expression");
+
+ EXPECT_NONFATAL_FAILURE({
+ const RE normal(".*(\\w+");
+ }, "'(' is unsupported");
+
+ EXPECT_NONFATAL_FAILURE({
+ const RE invalid("^?");
+ }, "'?' can only follow a repeatable token");
+}
+
+// Tests RE::FullMatch().
+TEST(RETest, FullMatchWorks) {
+ const RE empty("");
+ EXPECT_TRUE(RE::FullMatch("", empty));
+ EXPECT_FALSE(RE::FullMatch("a", empty));
+
+ const RE re1("a");
+ EXPECT_TRUE(RE::FullMatch("a", re1));
+
+ const RE re("a.*z");
+ EXPECT_TRUE(RE::FullMatch("az", re));
+ EXPECT_TRUE(RE::FullMatch("axyz", re));
+ EXPECT_FALSE(RE::FullMatch("baz", re));
+ EXPECT_FALSE(RE::FullMatch("azy", re));
+}
+
+// Tests RE::PartialMatch().
+TEST(RETest, PartialMatchWorks) {
+ const RE empty("");
+ EXPECT_TRUE(RE::PartialMatch("", empty));
+ EXPECT_TRUE(RE::PartialMatch("a", empty));
+
+ const RE re("a.*z");
+ EXPECT_TRUE(RE::PartialMatch("az", re));
+ EXPECT_TRUE(RE::PartialMatch("axyz", re));
+ EXPECT_TRUE(RE::PartialMatch("baz", re));
+ EXPECT_TRUE(RE::PartialMatch("azy", re));
+ EXPECT_FALSE(RE::PartialMatch("zza", re));
+}
+
+#endif // GTEST_USES_POSIX_RE
+
+#if !GTEST_OS_WINDOWS_MOBILE
+
+TEST(CaptureTest, CapturesStdout) {
+ CaptureStdout();
+ fprintf(stdout, "abc");
+ EXPECT_STREQ("abc", GetCapturedStdout().c_str());
+
+ CaptureStdout();
+ fprintf(stdout, "def%cghi", '\0');
+ EXPECT_EQ(::std::string("def\0ghi", 7), ::std::string(GetCapturedStdout()));
+}
+
+TEST(CaptureTest, CapturesStderr) {
+ CaptureStderr();
+ fprintf(stderr, "jkl");
+ EXPECT_STREQ("jkl", GetCapturedStderr().c_str());
+
+ CaptureStderr();
+ fprintf(stderr, "jkl%cmno", '\0');
+ EXPECT_EQ(::std::string("jkl\0mno", 7), ::std::string(GetCapturedStderr()));
+}
+
+// Tests that stdout and stderr capture don't interfere with each other.
+TEST(CaptureTest, CapturesStdoutAndStderr) {
+ CaptureStdout();
+ CaptureStderr();
+ fprintf(stdout, "pqr");
+ fprintf(stderr, "stu");
+ EXPECT_STREQ("pqr", GetCapturedStdout().c_str());
+ EXPECT_STREQ("stu", GetCapturedStderr().c_str());
+}
+
+TEST(CaptureDeathTest, CannotReenterStdoutCapture) {
+ CaptureStdout();
+ EXPECT_DEATH_IF_SUPPORTED(CaptureStdout();,
+ "Only one stdout capturer can exist at a time");
+ GetCapturedStdout();
+
+ // We cannot test stderr capturing using death tests as they use it
+ // themselves.
+}
+
+#endif // !GTEST_OS_WINDOWS_MOBILE
+
+TEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) {
+ ThreadLocal<int> t1;
+ EXPECT_EQ(0, t1.get());
+
+ ThreadLocal<void*> t2;
+ EXPECT_TRUE(t2.get() == NULL);
+}
+
+TEST(ThreadLocalTest, SingleParamConstructorInitializesToParam) {
+ ThreadLocal<int> t1(123);
+ EXPECT_EQ(123, t1.get());
+
+ int i = 0;
+ ThreadLocal<int*> t2(&i);
+ EXPECT_EQ(&i, t2.get());
+}
+
+class NoDefaultContructor {
+ public:
+ explicit NoDefaultContructor(const char*) {}
+ NoDefaultContructor(const NoDefaultContructor&) {}
+};
+
+TEST(ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion) {
+ ThreadLocal<NoDefaultContructor> bar(NoDefaultContructor("foo"));
+ bar.pointer();
+}
+
+TEST(ThreadLocalTest, GetAndPointerReturnSameValue) {
+ ThreadLocal<String> thread_local;
+
+ EXPECT_EQ(thread_local.pointer(), &(thread_local.get()));
+
+ // Verifies the condition still holds after calling set.
+ thread_local.set("foo");
+ EXPECT_EQ(thread_local.pointer(), &(thread_local.get()));
+}
+
+TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) {
+ ThreadLocal<String> thread_local;
+ const ThreadLocal<String>& const_thread_local = thread_local;
+
+ EXPECT_EQ(thread_local.pointer(), const_thread_local.pointer());
+
+ thread_local.set("foo");
+ EXPECT_EQ(thread_local.pointer(), const_thread_local.pointer());
+}
+
+#if GTEST_IS_THREADSAFE
+
+void AddTwo(int* param) { *param += 2; }
+
+TEST(ThreadWithParamTest, ConstructorExecutesThreadFunc) {
+ int i = 40;
+ ThreadWithParam<int*> thread(&AddTwo, &i, NULL);
+ thread.Join();
+ EXPECT_EQ(42, i);
+}
+
+TEST(MutexDeathTest, AssertHeldShouldAssertWhenNotLocked) {
+ // AssertHeld() is flaky only in the presence of multiple threads accessing
+ // the lock. In this case, the test is robust.
+ EXPECT_DEATH_IF_SUPPORTED({
+ Mutex m;
+ { MutexLock lock(&m); }
+ m.AssertHeld();
+ },
+ "thread .*hold");
+}
+
+TEST(MutexTest, AssertHeldShouldNotAssertWhenLocked) {
+ Mutex m;
+ MutexLock lock(&m);
+ m.AssertHeld();
+}
+
+class AtomicCounterWithMutex {
+ public:
+ explicit AtomicCounterWithMutex(Mutex* mutex) :
+ value_(0), mutex_(mutex), random_(42) {}
+
+ void Increment() {
+ MutexLock lock(mutex_);
+ int temp = value_;
+ {
+ // Locking a mutex puts up a memory barrier, preventing reads and
+ // writes to value_ rearranged when observed from other threads.
+ //
+ // We cannot use Mutex and MutexLock here or rely on their memory
+ // barrier functionality as we are testing them here.
+ pthread_mutex_t memory_barrier_mutex;
+ GTEST_CHECK_POSIX_SUCCESS_(
+ pthread_mutex_init(&memory_barrier_mutex, NULL));
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&memory_barrier_mutex));
+
+ SleepMilliseconds(random_.Generate(30));
+
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&memory_barrier_mutex));
+ }
+ value_ = temp + 1;
+ }
+ int value() const { return value_; }
+
+ private:
+ volatile int value_;
+ Mutex* const mutex_; // Protects value_.
+ Random random_;
+};
+
+void CountingThreadFunc(pair<AtomicCounterWithMutex*, int> param) {
+ for (int i = 0; i < param.second; ++i)
+ param.first->Increment();
+}
+
+// Tests that the mutex only lets one thread at a time to lock it.
+TEST(MutexTest, OnlyOneThreadCanLockAtATime) {
+ Mutex mutex;
+ AtomicCounterWithMutex locked_counter(&mutex);
+
+ typedef ThreadWithParam<pair<AtomicCounterWithMutex*, int> > ThreadType;
+ const int kCycleCount = 20;
+ const int kThreadCount = 7;
+ scoped_ptr<ThreadType> counting_threads[kThreadCount];
+ Notification threads_can_start;
+ // Creates and runs kThreadCount threads that increment locked_counter
+ // kCycleCount times each.
+ for (int i = 0; i < kThreadCount; ++i) {
+ counting_threads[i].reset(new ThreadType(&CountingThreadFunc,
+ make_pair(&locked_counter,
+ kCycleCount),
+ &threads_can_start));
+ }
+ threads_can_start.Notify();
+ for (int i = 0; i < kThreadCount; ++i)
+ counting_threads[i]->Join();
+
+ // If the mutex lets more than one thread to increment the counter at a
+ // time, they are likely to encounter a race condition and have some
+ // increments overwritten, resulting in the lower then expected counter
+ // value.
+ EXPECT_EQ(kCycleCount * kThreadCount, locked_counter.value());
+}
+
+template <typename T>
+void RunFromThread(void (func)(T), T param) {
+ ThreadWithParam<T> thread(func, param, NULL);
+ thread.Join();
+}
+
+void RetrieveThreadLocalValue(pair<ThreadLocal<String>*, String*> param) {
+ *param.second = param.first->get();
+}
+
+TEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) {
+ ThreadLocal<String> thread_local("foo");
+ EXPECT_STREQ("foo", thread_local.get().c_str());
+
+ thread_local.set("bar");
+ EXPECT_STREQ("bar", thread_local.get().c_str());
+
+ String result;
+ RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local, &result));
+ EXPECT_STREQ("foo", result.c_str());
+}
+
+// DestructorTracker keeps track of whether its instances have been
+// destroyed.
+static std::vector<bool> g_destroyed;
+
+class DestructorTracker {
+ public:
+ DestructorTracker() : index_(GetNewIndex()) {}
+ DestructorTracker(const DestructorTracker& /* rhs */)
+ : index_(GetNewIndex()) {}
+ ~DestructorTracker() {
+ // We never access g_destroyed concurrently, so we don't need to
+ // protect the write operation under a mutex.
+ g_destroyed[index_] = true;
+ }
+
+ private:
+ static int GetNewIndex() {
+ g_destroyed.push_back(false);
+ return g_destroyed.size() - 1;
+ }
+ const int index_;
+};
+
+typedef ThreadLocal<DestructorTracker>* ThreadParam;
+
+void CallThreadLocalGet(ThreadParam thread_local) {
+ thread_local->get();
+}
+
+// Tests that when a ThreadLocal object dies in a thread, it destroys
+// the managed object for that thread.
+TEST(ThreadLocalTest, DestroysManagedObjectForOwnThreadWhenDying) {
+ g_destroyed.clear();
+
+ {
+ // The next line default constructs a DestructorTracker object as
+ // the default value of objects managed by thread_local.
+ ThreadLocal<DestructorTracker> thread_local;
+ ASSERT_EQ(1U, g_destroyed.size());
+ ASSERT_FALSE(g_destroyed[0]);
+
+ // This creates another DestructorTracker object for the main thread.
+ thread_local.get();
+ ASSERT_EQ(2U, g_destroyed.size());
+ ASSERT_FALSE(g_destroyed[0]);
+ ASSERT_FALSE(g_destroyed[1]);
+ }
+
+ // Now thread_local has died. It should have destroyed both the
+ // default value shared by all threads and the value for the main
+ // thread.
+ ASSERT_EQ(2U, g_destroyed.size());
+ EXPECT_TRUE(g_destroyed[0]);
+ EXPECT_TRUE(g_destroyed[1]);
+
+ g_destroyed.clear();
+}
+
+// Tests that when a thread exits, the thread-local object for that
+// thread is destroyed.
+TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) {
+ g_destroyed.clear();
+
+ {
+ // The next line default constructs a DestructorTracker object as
+ // the default value of objects managed by thread_local.
+ ThreadLocal<DestructorTracker> thread_local;
+ ASSERT_EQ(1U, g_destroyed.size());
+ ASSERT_FALSE(g_destroyed[0]);
+
+ // This creates another DestructorTracker object in the new thread.
+ ThreadWithParam<ThreadParam> thread(
+ &CallThreadLocalGet, &thread_local, NULL);
+ thread.Join();
+
+ // Now the new thread has exited. The per-thread object for it
+ // should have been destroyed.
+ ASSERT_EQ(2U, g_destroyed.size());
+ ASSERT_FALSE(g_destroyed[0]);
+ ASSERT_TRUE(g_destroyed[1]);
+ }
+
+ // Now thread_local has died. The default value should have been
+ // destroyed too.
+ ASSERT_EQ(2U, g_destroyed.size());
+ EXPECT_TRUE(g_destroyed[0]);
+ EXPECT_TRUE(g_destroyed[1]);
+
+ g_destroyed.clear();
+}
+
+TEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) {
+ ThreadLocal<String> thread_local;
+ thread_local.set("Foo");
+ EXPECT_STREQ("Foo", thread_local.get().c_str());
+
+ String result;
+ RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local, &result));
+ EXPECT_TRUE(result.c_str() == NULL);
+}
+
+#endif // GTEST_IS_THREADSAFE
+
+} // namespace internal
+} // namespace testing
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-test-part_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-test-part_test.cc
new file mode 100644
index 0000000..5a3e919
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-test-part_test.cc
@@ -0,0 +1,208 @@
+// Copyright 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.
+//
+// Author: mheule@google.com (Markus Heule)
+//
+
+#include <gtest/gtest-test-part.h>
+
+#include <gtest/gtest.h>
+
+using testing::Message;
+using testing::Test;
+using testing::TestPartResult;
+using testing::TestPartResultArray;
+
+namespace {
+
+// Tests the TestPartResult class.
+
+// The test fixture for testing TestPartResult.
+class TestPartResultTest : public Test {
+ protected:
+ TestPartResultTest()
+ : r1_(TestPartResult::kSuccess, "foo/bar.cc", 10, "Success!"),
+ r2_(TestPartResult::kNonFatalFailure, "foo/bar.cc", -1, "Failure!"),
+ r3_(TestPartResult::kFatalFailure, NULL, -1, "Failure!") {}
+
+ TestPartResult r1_, r2_, r3_;
+};
+
+
+TEST_F(TestPartResultTest, ConstructorWorks) {
+ Message message;
+ message << "something is terribly wrong";
+ message << static_cast<const char*>(testing::internal::kStackTraceMarker);
+ message << "some unimportant stack trace";
+
+ const TestPartResult result(TestPartResult::kNonFatalFailure,
+ "some_file.cc",
+ 42,
+ message.GetString().c_str());
+
+ EXPECT_EQ(TestPartResult::kNonFatalFailure, result.type());
+ EXPECT_STREQ("some_file.cc", result.file_name());
+ EXPECT_EQ(42, result.line_number());
+ EXPECT_STREQ(message.GetString().c_str(), result.message());
+ EXPECT_STREQ("something is terribly wrong", result.summary());
+}
+
+TEST_F(TestPartResultTest, ResultAccessorsWork) {
+ const TestPartResult success(TestPartResult::kSuccess,
+ "file.cc",
+ 42,
+ "message");
+ EXPECT_TRUE(success.passed());
+ EXPECT_FALSE(success.failed());
+ EXPECT_FALSE(success.nonfatally_failed());
+ EXPECT_FALSE(success.fatally_failed());
+
+ const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure,
+ "file.cc",
+ 42,
+ "message");
+ EXPECT_FALSE(nonfatal_failure.passed());
+ EXPECT_TRUE(nonfatal_failure.failed());
+ EXPECT_TRUE(nonfatal_failure.nonfatally_failed());
+ EXPECT_FALSE(nonfatal_failure.fatally_failed());
+
+ const TestPartResult fatal_failure(TestPartResult::kFatalFailure,
+ "file.cc",
+ 42,
+ "message");
+ EXPECT_FALSE(fatal_failure.passed());
+ EXPECT_TRUE(fatal_failure.failed());
+ EXPECT_FALSE(fatal_failure.nonfatally_failed());
+ EXPECT_TRUE(fatal_failure.fatally_failed());
+}
+
+// Tests TestPartResult::type().
+TEST_F(TestPartResultTest, type) {
+ EXPECT_EQ(TestPartResult::kSuccess, r1_.type());
+ EXPECT_EQ(TestPartResult::kNonFatalFailure, r2_.type());
+ EXPECT_EQ(TestPartResult::kFatalFailure, r3_.type());
+}
+
+// Tests TestPartResult::file_name().
+TEST_F(TestPartResultTest, file_name) {
+ EXPECT_STREQ("foo/bar.cc", r1_.file_name());
+ EXPECT_STREQ(NULL, r3_.file_name());
+}
+
+// Tests TestPartResult::line_number().
+TEST_F(TestPartResultTest, line_number) {
+ EXPECT_EQ(10, r1_.line_number());
+ EXPECT_EQ(-1, r2_.line_number());
+}
+
+// Tests TestPartResult::message().
+TEST_F(TestPartResultTest, message) {
+ EXPECT_STREQ("Success!", r1_.message());
+}
+
+// Tests TestPartResult::passed().
+TEST_F(TestPartResultTest, Passed) {
+ EXPECT_TRUE(r1_.passed());
+ EXPECT_FALSE(r2_.passed());
+ EXPECT_FALSE(r3_.passed());
+}
+
+// Tests TestPartResult::failed().
+TEST_F(TestPartResultTest, Failed) {
+ EXPECT_FALSE(r1_.failed());
+ EXPECT_TRUE(r2_.failed());
+ EXPECT_TRUE(r3_.failed());
+}
+
+// Tests TestPartResult::fatally_failed().
+TEST_F(TestPartResultTest, FatallyFailed) {
+ EXPECT_FALSE(r1_.fatally_failed());
+ EXPECT_FALSE(r2_.fatally_failed());
+ EXPECT_TRUE(r3_.fatally_failed());
+}
+
+// Tests TestPartResult::nonfatally_failed().
+TEST_F(TestPartResultTest, NonfatallyFailed) {
+ EXPECT_FALSE(r1_.nonfatally_failed());
+ EXPECT_TRUE(r2_.nonfatally_failed());
+ EXPECT_FALSE(r3_.nonfatally_failed());
+}
+
+// Tests the TestPartResultArray class.
+
+class TestPartResultArrayTest : public Test {
+ protected:
+ TestPartResultArrayTest()
+ : r1_(TestPartResult::kNonFatalFailure, "foo/bar.cc", -1, "Failure 1"),
+ r2_(TestPartResult::kFatalFailure, "foo/bar.cc", -1, "Failure 2") {}
+
+ const TestPartResult r1_, r2_;
+};
+
+// Tests that TestPartResultArray initially has size 0.
+TEST_F(TestPartResultArrayTest, InitialSizeIsZero) {
+ TestPartResultArray results;
+ EXPECT_EQ(0, results.size());
+}
+
+// Tests that TestPartResultArray contains the given TestPartResult
+// after one Append() operation.
+TEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {
+ TestPartResultArray results;
+ results.Append(r1_);
+ EXPECT_EQ(1, results.size());
+ EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
+}
+
+// Tests that TestPartResultArray contains the given TestPartResults
+// after two Append() operations.
+TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
+ TestPartResultArray results;
+ results.Append(r1_);
+ results.Append(r2_);
+ EXPECT_EQ(2, results.size());
+ EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
+ EXPECT_STREQ("Failure 2", results.GetTestPartResult(1).message());
+}
+
+typedef TestPartResultArrayTest TestPartResultArrayDeathTest;
+
+// Tests that the program dies when GetTestPartResult() is called with
+// an invalid index.
+TEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) {
+ TestPartResultArray results;
+ results.Append(r1_);
+
+ EXPECT_DEATH_IF_SUPPORTED(results.GetTestPartResult(-1), "");
+ EXPECT_DEATH_IF_SUPPORTED(results.GetTestPartResult(1), "");
+}
+
+// TODO(mheule@google.com): Add a test for the class HasNewFatalFailureHelper.
+
+} // namespace
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-tuple_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-tuple_test.cc
new file mode 100644
index 0000000..532f70b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-tuple_test.cc
@@ -0,0 +1,320 @@
+// 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <gtest/internal/gtest-tuple.h>
+#include <utility>
+#include <gtest/gtest.h>
+
+namespace {
+
+using ::std::tr1::get;
+using ::std::tr1::make_tuple;
+using ::std::tr1::tuple;
+using ::std::tr1::tuple_element;
+using ::std::tr1::tuple_size;
+using ::testing::StaticAssertTypeEq;
+
+// Tests that tuple_element<K, tuple<T0, T1, ..., TN> >::type returns TK.
+TEST(tuple_element_Test, ReturnsElementType) {
+ StaticAssertTypeEq<int, tuple_element<0, tuple<int, char> >::type>();
+ StaticAssertTypeEq<int&, tuple_element<1, tuple<double, int&> >::type>();
+ StaticAssertTypeEq<bool, tuple_element<2, tuple<double, int, bool> >::type>();
+}
+
+// Tests that tuple_size<T>::value gives the number of fields in tuple
+// type T.
+TEST(tuple_size_Test, ReturnsNumberOfFields) {
+ EXPECT_EQ(0, +tuple_size<tuple<> >::value);
+ EXPECT_EQ(1, +tuple_size<tuple<void*> >::value);
+ EXPECT_EQ(1, +tuple_size<tuple<char> >::value);
+ EXPECT_EQ(1, +(tuple_size<tuple<tuple<int, double> > >::value));
+ EXPECT_EQ(2, +(tuple_size<tuple<int&, const char> >::value));
+ EXPECT_EQ(3, +(tuple_size<tuple<char*, void, const bool&> >::value));
+}
+
+// Tests comparing a tuple with itself.
+TEST(ComparisonTest, ComparesWithSelf) {
+ const tuple<int, char, bool> a(5, 'a', false);
+
+ EXPECT_TRUE(a == a);
+ EXPECT_FALSE(a != a);
+}
+
+// Tests comparing two tuples with the same value.
+TEST(ComparisonTest, ComparesEqualTuples) {
+ const tuple<int, bool> a(5, true), b(5, true);
+
+ EXPECT_TRUE(a == b);
+ EXPECT_FALSE(a != b);
+}
+
+// Tests comparing two different tuples that have no reference fields.
+TEST(ComparisonTest, ComparesUnequalTuplesWithoutReferenceFields) {
+ typedef tuple<const int, char> FooTuple;
+
+ const FooTuple a(0, 'x');
+ const FooTuple b(1, 'a');
+
+ EXPECT_TRUE(a != b);
+ EXPECT_FALSE(a == b);
+
+ const FooTuple c(1, 'b');
+
+ EXPECT_TRUE(b != c);
+ EXPECT_FALSE(b == c);
+}
+
+// Tests comparing two different tuples that have reference fields.
+TEST(ComparisonTest, ComparesUnequalTuplesWithReferenceFields) {
+ typedef tuple<int&, const char&> FooTuple;
+
+ int i = 5;
+ const char ch = 'a';
+ const FooTuple a(i, ch);
+
+ int j = 6;
+ const FooTuple b(j, ch);
+
+ EXPECT_TRUE(a != b);
+ EXPECT_FALSE(a == b);
+
+ j = 5;
+ const char ch2 = 'b';
+ const FooTuple c(j, ch2);
+
+ EXPECT_TRUE(b != c);
+ EXPECT_FALSE(b == c);
+}
+
+// Tests that a tuple field with a reference type is an alias of the
+// variable it's supposed to reference.
+TEST(ReferenceFieldTest, IsAliasOfReferencedVariable) {
+ int n = 0;
+ tuple<bool, int&> t(true, n);
+
+ n = 1;
+ EXPECT_EQ(n, get<1>(t))
+ << "Changing a underlying variable should update the reference field.";
+
+ // Makes sure that the implementation doesn't do anything funny with
+ // the & operator for the return type of get<>().
+ EXPECT_EQ(&n, &(get<1>(t)))
+ << "The address of a reference field should equal the address of "
+ << "the underlying variable.";
+
+ get<1>(t) = 2;
+ EXPECT_EQ(2, n)
+ << "Changing a reference field should update the underlying variable.";
+}
+
+// Tests that tuple's default constructor default initializes each field.
+// This test needs to compile without generating warnings.
+TEST(TupleConstructorTest, DefaultConstructorDefaultInitializesEachField) {
+ // The TR1 report requires that tuple's default constructor default
+ // initializes each field, even if it's a primitive type. If the
+ // implementation forgets to do this, this test will catch it by
+ // generating warnings about using uninitialized variables (assuming
+ // a decent compiler).
+
+ tuple<> empty;
+
+ tuple<int> a1, b1;
+ b1 = a1;
+ EXPECT_EQ(0, get<0>(b1));
+
+ tuple<int, double> a2, b2;
+ b2 = a2;
+ EXPECT_EQ(0, get<0>(b2));
+ EXPECT_EQ(0.0, get<1>(b2));
+
+ tuple<double, char, bool*> a3, b3;
+ b3 = a3;
+ EXPECT_EQ(0.0, get<0>(b3));
+ EXPECT_EQ('\0', get<1>(b3));
+ EXPECT_TRUE(get<2>(b3) == NULL);
+
+ tuple<int, int, int, int, int, int, int, int, int, int> a10, b10;
+ b10 = a10;
+ EXPECT_EQ(0, get<0>(b10));
+ EXPECT_EQ(0, get<1>(b10));
+ EXPECT_EQ(0, get<2>(b10));
+ EXPECT_EQ(0, get<3>(b10));
+ EXPECT_EQ(0, get<4>(b10));
+ EXPECT_EQ(0, get<5>(b10));
+ EXPECT_EQ(0, get<6>(b10));
+ EXPECT_EQ(0, get<7>(b10));
+ EXPECT_EQ(0, get<8>(b10));
+ EXPECT_EQ(0, get<9>(b10));
+}
+
+// Tests constructing a tuple from its fields.
+TEST(TupleConstructorTest, ConstructsFromFields) {
+ int n = 1;
+ // Reference field.
+ tuple<int&> a(n);
+ EXPECT_EQ(&n, &(get<0>(a)));
+
+ // Non-reference fields.
+ tuple<int, char> b(5, 'a');
+ EXPECT_EQ(5, get<0>(b));
+ EXPECT_EQ('a', get<1>(b));
+
+ // Const reference field.
+ const int m = 2;
+ tuple<bool, const int&> c(true, m);
+ EXPECT_TRUE(get<0>(c));
+ EXPECT_EQ(&m, &(get<1>(c)));
+}
+
+// Tests tuple's copy constructor.
+TEST(TupleConstructorTest, CopyConstructor) {
+ tuple<double, bool> a(0.0, true);
+ tuple<double, bool> b(a);
+
+ EXPECT_DOUBLE_EQ(0.0, get<0>(b));
+ EXPECT_TRUE(get<1>(b));
+}
+
+// Tests constructing a tuple from another tuple that has a compatible
+// but different type.
+TEST(TupleConstructorTest, ConstructsFromDifferentTupleType) {
+ tuple<int, int, char> a(0, 1, 'a');
+ tuple<double, long, int> b(a);
+
+ EXPECT_DOUBLE_EQ(0.0, get<0>(b));
+ EXPECT_EQ(1, get<1>(b));
+ EXPECT_EQ('a', get<2>(b));
+}
+
+// Tests constructing a 2-tuple from an std::pair.
+TEST(TupleConstructorTest, ConstructsFromPair) {
+ ::std::pair<int, char> a(1, 'a');
+ tuple<int, char> b(a);
+ tuple<int, const char&> c(a);
+}
+
+// Tests assigning a tuple to another tuple with the same type.
+TEST(TupleAssignmentTest, AssignsToSameTupleType) {
+ const tuple<int, long> a(5, 7L);
+ tuple<int, long> b;
+ b = a;
+ EXPECT_EQ(5, get<0>(b));
+ EXPECT_EQ(7L, get<1>(b));
+}
+
+// Tests assigning a tuple to another tuple with a different but
+// compatible type.
+TEST(TupleAssignmentTest, AssignsToDifferentTupleType) {
+ const tuple<int, long, bool> a(1, 7L, true);
+ tuple<long, int, bool> b;
+ b = a;
+ EXPECT_EQ(1L, get<0>(b));
+ EXPECT_EQ(7, get<1>(b));
+ EXPECT_TRUE(get<2>(b));
+}
+
+// Tests assigning an std::pair to a 2-tuple.
+TEST(TupleAssignmentTest, AssignsFromPair) {
+ const ::std::pair<int, bool> a(5, true);
+ tuple<int, bool> b;
+ b = a;
+ EXPECT_EQ(5, get<0>(b));
+ EXPECT_TRUE(get<1>(b));
+
+ tuple<long, bool> c;
+ c = a;
+ EXPECT_EQ(5L, get<0>(c));
+ EXPECT_TRUE(get<1>(c));
+}
+
+// A fixture for testing big tuples.
+class BigTupleTest : public testing::Test {
+ protected:
+ typedef tuple<int, int, int, int, int, int, int, int, int, int> BigTuple;
+
+ BigTupleTest() :
+ a_(1, 0, 0, 0, 0, 0, 0, 0, 0, 2),
+ b_(1, 0, 0, 0, 0, 0, 0, 0, 0, 3) {}
+
+ BigTuple a_, b_;
+};
+
+// Tests constructing big tuples.
+TEST_F(BigTupleTest, Construction) {
+ BigTuple a;
+ BigTuple b(b_);
+}
+
+// Tests that get<N>(t) returns the N-th (0-based) field of tuple t.
+TEST_F(BigTupleTest, get) {
+ EXPECT_EQ(1, get<0>(a_));
+ EXPECT_EQ(2, get<9>(a_));
+
+ // Tests that get() works on a const tuple too.
+ const BigTuple a(a_);
+ EXPECT_EQ(1, get<0>(a));
+ EXPECT_EQ(2, get<9>(a));
+}
+
+// Tests comparing big tuples.
+TEST_F(BigTupleTest, Comparisons) {
+ EXPECT_TRUE(a_ == a_);
+ EXPECT_FALSE(a_ != a_);
+
+ EXPECT_TRUE(a_ != b_);
+ EXPECT_FALSE(a_ == b_);
+}
+
+TEST(MakeTupleTest, WorksForScalarTypes) {
+ tuple<bool, int> a;
+ a = make_tuple(true, 5);
+ EXPECT_TRUE(get<0>(a));
+ EXPECT_EQ(5, get<1>(a));
+
+ tuple<char, int, long> b;
+ b = make_tuple('a', 'b', 5);
+ EXPECT_EQ('a', get<0>(b));
+ EXPECT_EQ('b', get<1>(b));
+ EXPECT_EQ(5, get<2>(b));
+}
+
+TEST(MakeTupleTest, WorksForPointers) {
+ int a[] = { 1, 2, 3, 4 };
+ const char* const str = "hi";
+ int* const p = a;
+
+ tuple<const char*, int*> t;
+ t = make_tuple(str, p);
+ EXPECT_EQ(str, get<0>(t));
+ EXPECT_EQ(p, get<1>(t));
+}
+
+} // namespace
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test2_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test2_test.cc
new file mode 100644
index 0000000..79a8a87
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test2_test.cc
@@ -0,0 +1,45 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <vector>
+
+#include "test/gtest-typed-test_test.h"
+#include <gtest/gtest.h>
+
+#if GTEST_HAS_TYPED_TEST_P
+
+// Tests that the same type-parameterized test case can be
+// instantiated in different translation units linked together.
+// (ContainerTest is also instantiated in gtest-typed-test_test.cc.)
+INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest,
+ testing::Types<std::vector<int> >);
+
+#endif // GTEST_HAS_TYPED_TEST_P
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.cc
new file mode 100644
index 0000000..f2c3972
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.cc
@@ -0,0 +1,360 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <set>
+#include <vector>
+
+#include "test/gtest-typed-test_test.h"
+#include <gtest/gtest.h>
+
+using testing::Test;
+
+// Used for testing that SetUpTestCase()/TearDownTestCase(), fixture
+// ctor/dtor, and SetUp()/TearDown() work correctly in typed tests and
+// type-parameterized test.
+template <typename T>
+class CommonTest : public Test {
+ // For some technical reason, SetUpTestCase() and TearDownTestCase()
+ // must be public.
+ public:
+ static void SetUpTestCase() {
+ shared_ = new T(5);
+ }
+
+ static void TearDownTestCase() {
+ delete shared_;
+ shared_ = NULL;
+ }
+
+ // This 'protected:' is optional. There's no harm in making all
+ // members of this fixture class template public.
+ protected:
+ // We used to use std::list here, but switched to std::vector since
+ // MSVC's <list> doesn't compile cleanly with /W4.
+ typedef std::vector<T> Vector;
+ typedef std::set<int> IntSet;
+
+ CommonTest() : value_(1) {}
+
+ virtual ~CommonTest() { EXPECT_EQ(3, value_); }
+
+ virtual void SetUp() {
+ EXPECT_EQ(1, value_);
+ value_++;
+ }
+
+ virtual void TearDown() {
+ EXPECT_EQ(2, value_);
+ value_++;
+ }
+
+ T value_;
+ static T* shared_;
+};
+
+template <typename T>
+T* CommonTest<T>::shared_ = NULL;
+
+// This #ifdef block tests typed tests.
+#if GTEST_HAS_TYPED_TEST
+
+using testing::Types;
+
+// Tests that SetUpTestCase()/TearDownTestCase(), fixture ctor/dtor,
+// and SetUp()/TearDown() work correctly in typed tests
+
+typedef Types<char, int> TwoTypes;
+TYPED_TEST_CASE(CommonTest, TwoTypes);
+
+TYPED_TEST(CommonTest, ValuesAreCorrect) {
+ // Static members of the fixture class template can be visited via
+ // the TestFixture:: prefix.
+ EXPECT_EQ(5, *TestFixture::shared_);
+
+ // Typedefs in the fixture class template can be visited via the
+ // "typename TestFixture::" prefix.
+ typename TestFixture::Vector empty;
+ EXPECT_EQ(0U, empty.size());
+
+ typename TestFixture::IntSet empty2;
+ EXPECT_EQ(0U, empty2.size());
+
+ // Non-static members of the fixture class must be visited via
+ // 'this', as required by C++ for class templates.
+ EXPECT_EQ(2, this->value_);
+}
+
+// The second test makes sure shared_ is not deleted after the first
+// test.
+TYPED_TEST(CommonTest, ValuesAreStillCorrect) {
+ // Static members of the fixture class template can also be visited
+ // via 'this'.
+ ASSERT_TRUE(this->shared_ != NULL);
+ EXPECT_EQ(5, *this->shared_);
+
+ // TypeParam can be used to refer to the type parameter.
+ EXPECT_EQ(static_cast<TypeParam>(2), this->value_);
+}
+
+// Tests that multiple TYPED_TEST_CASE's can be defined in the same
+// translation unit.
+
+template <typename T>
+class TypedTest1 : public Test {
+};
+
+// Verifies that the second argument of TYPED_TEST_CASE can be a
+// single type.
+TYPED_TEST_CASE(TypedTest1, int);
+TYPED_TEST(TypedTest1, A) {}
+
+template <typename T>
+class TypedTest2 : public Test {
+};
+
+// Verifies that the second argument of TYPED_TEST_CASE can be a
+// Types<...> type list.
+TYPED_TEST_CASE(TypedTest2, Types<int>);
+
+// This also verifies that tests from different typed test cases can
+// share the same name.
+TYPED_TEST(TypedTest2, A) {}
+
+// Tests that a typed test case can be defined in a namespace.
+
+namespace library1 {
+
+template <typename T>
+class NumericTest : public Test {
+};
+
+typedef Types<int, long> NumericTypes;
+TYPED_TEST_CASE(NumericTest, NumericTypes);
+
+TYPED_TEST(NumericTest, DefaultIsZero) {
+ EXPECT_EQ(0, TypeParam());
+}
+
+} // namespace library1
+
+#endif // GTEST_HAS_TYPED_TEST
+
+// This #ifdef block tests type-parameterized tests.
+#if GTEST_HAS_TYPED_TEST_P
+
+using testing::Types;
+using testing::internal::TypedTestCasePState;
+
+// Tests TypedTestCasePState.
+
+class TypedTestCasePStateTest : public Test {
+ protected:
+ virtual void SetUp() {
+ state_.AddTestName("foo.cc", 0, "FooTest", "A");
+ state_.AddTestName("foo.cc", 0, "FooTest", "B");
+ state_.AddTestName("foo.cc", 0, "FooTest", "C");
+ }
+
+ TypedTestCasePState state_;
+};
+
+TEST_F(TypedTestCasePStateTest, SucceedsForMatchingList) {
+ const char* tests = "A, B, C";
+ EXPECT_EQ(tests,
+ state_.VerifyRegisteredTestNames("foo.cc", 1, tests));
+}
+
+// Makes sure that the order of the tests and spaces around the names
+// don't matter.
+TEST_F(TypedTestCasePStateTest, IgnoresOrderAndSpaces) {
+ const char* tests = "A,C, B";
+ EXPECT_EQ(tests,
+ state_.VerifyRegisteredTestNames("foo.cc", 1, tests));
+}
+
+typedef TypedTestCasePStateTest TypedTestCasePStateDeathTest;
+
+TEST_F(TypedTestCasePStateDeathTest, DetectsDuplicates) {
+ EXPECT_DEATH_IF_SUPPORTED(
+ state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, A, C"),
+ "foo\\.cc.1.?: Test A is listed more than once\\.");
+}
+
+TEST_F(TypedTestCasePStateDeathTest, DetectsExtraTest) {
+ EXPECT_DEATH_IF_SUPPORTED(
+ state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, C, D"),
+ "foo\\.cc.1.?: No test named D can be found in this test case\\.");
+}
+
+TEST_F(TypedTestCasePStateDeathTest, DetectsMissedTest) {
+ EXPECT_DEATH_IF_SUPPORTED(
+ state_.VerifyRegisteredTestNames("foo.cc", 1, "A, C"),
+ "foo\\.cc.1.?: You forgot to list test B\\.");
+}
+
+// Tests that defining a test for a parameterized test case generates
+// a run-time error if the test case has been registered.
+TEST_F(TypedTestCasePStateDeathTest, DetectsTestAfterRegistration) {
+ state_.VerifyRegisteredTestNames("foo.cc", 1, "A, B, C");
+ EXPECT_DEATH_IF_SUPPORTED(
+ state_.AddTestName("foo.cc", 2, "FooTest", "D"),
+ "foo\\.cc.2.?: Test D must be defined before REGISTER_TYPED_TEST_CASE_P"
+ "\\(FooTest, \\.\\.\\.\\)\\.");
+}
+
+// Tests that SetUpTestCase()/TearDownTestCase(), fixture ctor/dtor,
+// and SetUp()/TearDown() work correctly in type-parameterized tests.
+
+template <typename T>
+class DerivedTest : public CommonTest<T> {
+};
+
+TYPED_TEST_CASE_P(DerivedTest);
+
+TYPED_TEST_P(DerivedTest, ValuesAreCorrect) {
+ // Static members of the fixture class template can be visited via
+ // the TestFixture:: prefix.
+ EXPECT_EQ(5, *TestFixture::shared_);
+
+ // Non-static members of the fixture class must be visited via
+ // 'this', as required by C++ for class templates.
+ EXPECT_EQ(2, this->value_);
+}
+
+// The second test makes sure shared_ is not deleted after the first
+// test.
+TYPED_TEST_P(DerivedTest, ValuesAreStillCorrect) {
+ // Static members of the fixture class template can also be visited
+ // via 'this'.
+ ASSERT_TRUE(this->shared_ != NULL);
+ EXPECT_EQ(5, *this->shared_);
+ EXPECT_EQ(2, this->value_);
+}
+
+REGISTER_TYPED_TEST_CASE_P(DerivedTest,
+ ValuesAreCorrect, ValuesAreStillCorrect);
+
+typedef Types<short, long> MyTwoTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, DerivedTest, MyTwoTypes);
+
+// Tests that multiple TYPED_TEST_CASE_P's can be defined in the same
+// translation unit.
+
+template <typename T>
+class TypedTestP1 : public Test {
+};
+
+TYPED_TEST_CASE_P(TypedTestP1);
+
+// For testing that the code between TYPED_TEST_CASE_P() and
+// TYPED_TEST_P() is not enclosed in a namespace.
+typedef int IntAfterTypedTestCaseP;
+
+TYPED_TEST_P(TypedTestP1, A) {}
+TYPED_TEST_P(TypedTestP1, B) {}
+
+// For testing that the code between TYPED_TEST_P() and
+// REGISTER_TYPED_TEST_CASE_P() is not enclosed in a namespace.
+typedef int IntBeforeRegisterTypedTestCaseP;
+
+REGISTER_TYPED_TEST_CASE_P(TypedTestP1, A, B);
+
+template <typename T>
+class TypedTestP2 : public Test {
+};
+
+TYPED_TEST_CASE_P(TypedTestP2);
+
+// This also verifies that tests from different type-parameterized
+// test cases can share the same name.
+TYPED_TEST_P(TypedTestP2, A) {}
+
+REGISTER_TYPED_TEST_CASE_P(TypedTestP2, A);
+
+// Verifies that the code between TYPED_TEST_CASE_P() and
+// REGISTER_TYPED_TEST_CASE_P() is not enclosed in a namespace.
+IntAfterTypedTestCaseP after = 0;
+IntBeforeRegisterTypedTestCaseP before = 0;
+
+// Verifies that the last argument of INSTANTIATE_TYPED_TEST_CASE_P()
+// can be either a single type or a Types<...> type list.
+INSTANTIATE_TYPED_TEST_CASE_P(Int, TypedTestP1, int);
+INSTANTIATE_TYPED_TEST_CASE_P(Int, TypedTestP2, Types<int>);
+
+// Tests that the same type-parameterized test case can be
+// instantiated more than once in the same translation unit.
+INSTANTIATE_TYPED_TEST_CASE_P(Double, TypedTestP2, Types<double>);
+
+// Tests that the same type-parameterized test case can be
+// instantiated in different translation units linked together.
+// (ContainerTest is also instantiated in gtest-typed-test_test.cc.)
+typedef Types<std::vector<double>, std::set<char> > MyContainers;
+INSTANTIATE_TYPED_TEST_CASE_P(My, ContainerTest, MyContainers);
+
+// Tests that a type-parameterized test case can be defined and
+// instantiated in a namespace.
+
+namespace library2 {
+
+template <typename T>
+class NumericTest : public Test {
+};
+
+TYPED_TEST_CASE_P(NumericTest);
+
+TYPED_TEST_P(NumericTest, DefaultIsZero) {
+ EXPECT_EQ(0, TypeParam());
+}
+
+TYPED_TEST_P(NumericTest, ZeroIsLessThanOne) {
+ EXPECT_LT(TypeParam(0), TypeParam(1));
+}
+
+REGISTER_TYPED_TEST_CASE_P(NumericTest,
+ DefaultIsZero, ZeroIsLessThanOne);
+typedef Types<int, double> NumericTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, NumericTest, NumericTypes);
+
+} // namespace library2
+
+#endif // GTEST_HAS_TYPED_TEST_P
+
+#if !defined(GTEST_HAS_TYPED_TEST) && !defined(GTEST_HAS_TYPED_TEST_P)
+
+// Google Test may not support type-parameterized tests with some
+// compilers. If we use conditional compilation to compile out all
+// code referring to the gtest_main library, MSVC linker will not link
+// that library at all and consequently complain about missing entry
+// point defined in that library (fatal error LNK1561: entry point
+// must be defined). This dummy test keeps gtest_main linked in.
+TEST(DummyTest, TypedTestsAreNotSupportedOnThisPlatform) {}
+
+#endif // #if !defined(GTEST_HAS_TYPED_TEST) && !defined(GTEST_HAS_TYPED_TEST_P)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.h
new file mode 100644
index 0000000..40dfeac
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-typed-test_test.h
@@ -0,0 +1,66 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#ifndef GTEST_TEST_GTEST_TYPED_TEST_TEST_H_
+#define GTEST_TEST_GTEST_TYPED_TEST_TEST_H_
+
+#include <gtest/gtest.h>
+
+#if GTEST_HAS_TYPED_TEST_P
+
+using testing::Test;
+
+// For testing that the same type-parameterized test case can be
+// instantiated in different translation units linked together.
+// ContainerTest will be instantiated in both gtest-typed-test_test.cc
+// and gtest-typed-test2_test.cc.
+
+template <typename T>
+class ContainerTest : public Test {
+};
+
+TYPED_TEST_CASE_P(ContainerTest);
+
+TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) {
+ TypeParam container;
+}
+
+TYPED_TEST_P(ContainerTest, InitialSizeIsZero) {
+ TypeParam container;
+ EXPECT_EQ(0U, container.size());
+}
+
+REGISTER_TYPED_TEST_CASE_P(ContainerTest,
+ CanBeDefaultConstructed, InitialSizeIsZero);
+
+#endif // GTEST_HAS_TYPED_TEST_P
+
+#endif // GTEST_TEST_GTEST_TYPED_TEST_TEST_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-unittest-api_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-unittest-api_test.cc
new file mode 100644
index 0000000..7e0f8f8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest-unittest-api_test.cc
@@ -0,0 +1,343 @@
+// Copyright 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.
+//
+// Author: vladl@google.com (Vlad Losev)
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This file contains tests verifying correctness of data provided via
+// UnitTest's public methods.
+
+#include <gtest/gtest.h>
+
+#include <string.h> // For strcmp.
+#include <algorithm>
+
+using ::testing::InitGoogleTest;
+
+namespace testing {
+namespace internal {
+
+template <typename T>
+struct LessByName {
+ bool operator()(const T* a, const T* b) {
+ return strcmp(a->name(), b->name()) < 0;
+ }
+};
+
+class UnitTestHelper {
+ public:
+ // Returns the array of pointers to all test cases sorted by the test case
+ // name. The caller is responsible for deleting the array.
+ static TestCase const** const GetSortedTestCases() {
+ UnitTest& unit_test = *UnitTest::GetInstance();
+ TestCase const** const test_cases =
+ new const TestCase*[unit_test.total_test_case_count()];
+
+ for (int i = 0; i < unit_test.total_test_case_count(); ++i)
+ test_cases[i] = unit_test.GetTestCase(i);
+
+ std::sort(test_cases,
+ test_cases + unit_test.total_test_case_count(),
+ LessByName<TestCase>());
+ return test_cases;
+ }
+
+ // Returns the test case by its name. The caller doesn't own the returned
+ // pointer.
+ static const TestCase* FindTestCase(const char* name) {
+ UnitTest& unit_test = *UnitTest::GetInstance();
+ for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
+ const TestCase* test_case = unit_test.GetTestCase(i);
+ if (0 == strcmp(test_case->name(), name))
+ return test_case;
+ }
+ return NULL;
+ }
+
+ // Returns the array of pointers to all tests in a particular test case
+ // sorted by the test name. The caller is responsible for deleting the
+ // array.
+ static TestInfo const** const GetSortedTests(const TestCase* test_case) {
+ TestInfo const** const tests =
+ new const TestInfo*[test_case->total_test_count()];
+
+ for (int i = 0; i < test_case->total_test_count(); ++i)
+ tests[i] = test_case->GetTestInfo(i);
+
+ std::sort(tests, tests + test_case->total_test_count(),
+ LessByName<TestInfo>());
+ return tests;
+ }
+};
+
+#if GTEST_HAS_TYPED_TEST
+template <typename T> class TestCaseWithCommentTest : public Test {};
+TYPED_TEST_CASE(TestCaseWithCommentTest, Types<int>);
+TYPED_TEST(TestCaseWithCommentTest, Dummy) {}
+
+const int kTypedTestCases = 1;
+const int kTypedTests = 1;
+
+String GetExpectedTestCaseComment() {
+ Message comment;
+ comment << "TypeParam = " << GetTypeName<int>().c_str();
+ return comment.GetString();
+}
+#else
+const int kTypedTestCases = 0;
+const int kTypedTests = 0;
+#endif // GTEST_HAS_TYPED_TEST
+
+// We can only test the accessors that do not change value while tests run.
+// Since tests can be run in any order, the values the accessors that track
+// test execution (such as failed_test_count) can not be predicted.
+TEST(ApiTest, UnitTestImmutableAccessorsWork) {
+ UnitTest* unit_test = UnitTest::GetInstance();
+
+ ASSERT_EQ(2 + kTypedTestCases, unit_test->total_test_case_count());
+ EXPECT_EQ(1 + kTypedTestCases, unit_test->test_case_to_run_count());
+ EXPECT_EQ(2, unit_test->disabled_test_count());
+ EXPECT_EQ(5 + kTypedTests, unit_test->total_test_count());
+ EXPECT_EQ(3 + kTypedTests, unit_test->test_to_run_count());
+
+ const TestCase** const test_cases = UnitTestHelper::GetSortedTestCases();
+
+ EXPECT_STREQ("ApiTest", test_cases[0]->name());
+ EXPECT_STREQ("DISABLED_Test", test_cases[1]->name());
+#if GTEST_HAS_TYPED_TEST
+ EXPECT_STREQ("TestCaseWithCommentTest/0", test_cases[2]->name());
+#endif // GTEST_HAS_TYPED_TEST
+
+ delete[] test_cases;
+
+ // The following lines initiate actions to verify certain methods in
+ // FinalSuccessChecker::TearDown.
+
+ // Records a test property to verify TestResult::GetTestProperty().
+ RecordProperty("key", "value");
+}
+
+TEST(ApiTest, TestCaseImmutableAccessorsWork) {
+ const TestCase* test_case = UnitTestHelper::FindTestCase("ApiTest");
+ ASSERT_TRUE(test_case != NULL);
+
+ EXPECT_STREQ("ApiTest", test_case->name());
+ EXPECT_STREQ("", test_case->comment());
+ EXPECT_TRUE(test_case->should_run());
+ EXPECT_EQ(1, test_case->disabled_test_count());
+ EXPECT_EQ(3, test_case->test_to_run_count());
+ ASSERT_EQ(4, test_case->total_test_count());
+
+ const TestInfo** tests = UnitTestHelper::GetSortedTests(test_case);
+
+ EXPECT_STREQ("DISABLED_Dummy1", tests[0]->name());
+ EXPECT_STREQ("ApiTest", tests[0]->test_case_name());
+ EXPECT_STREQ("", tests[0]->comment());
+ EXPECT_STREQ("", tests[0]->test_case_comment());
+ EXPECT_FALSE(tests[0]->should_run());
+
+ EXPECT_STREQ("TestCaseDisabledAccessorsWork", tests[1]->name());
+ EXPECT_STREQ("ApiTest", tests[1]->test_case_name());
+ EXPECT_STREQ("", tests[1]->comment());
+ EXPECT_STREQ("", tests[1]->test_case_comment());
+ EXPECT_TRUE(tests[1]->should_run());
+
+ EXPECT_STREQ("TestCaseImmutableAccessorsWork", tests[2]->name());
+ EXPECT_STREQ("ApiTest", tests[2]->test_case_name());
+ EXPECT_STREQ("", tests[2]->comment());
+ EXPECT_STREQ("", tests[2]->test_case_comment());
+ EXPECT_TRUE(tests[2]->should_run());
+
+ EXPECT_STREQ("UnitTestImmutableAccessorsWork", tests[3]->name());
+ EXPECT_STREQ("ApiTest", tests[3]->test_case_name());
+ EXPECT_STREQ("", tests[3]->comment());
+ EXPECT_STREQ("", tests[3]->test_case_comment());
+ EXPECT_TRUE(tests[3]->should_run());
+
+ delete[] tests;
+ tests = NULL;
+
+#if GTEST_HAS_TYPED_TEST
+ test_case = UnitTestHelper::FindTestCase("TestCaseWithCommentTest/0");
+ ASSERT_TRUE(test_case != NULL);
+
+ EXPECT_STREQ("TestCaseWithCommentTest/0", test_case->name());
+ EXPECT_STREQ(GetExpectedTestCaseComment().c_str(), test_case->comment());
+ EXPECT_TRUE(test_case->should_run());
+ EXPECT_EQ(0, test_case->disabled_test_count());
+ EXPECT_EQ(1, test_case->test_to_run_count());
+ ASSERT_EQ(1, test_case->total_test_count());
+
+ tests = UnitTestHelper::GetSortedTests(test_case);
+
+ EXPECT_STREQ("Dummy", tests[0]->name());
+ EXPECT_STREQ("TestCaseWithCommentTest/0", tests[0]->test_case_name());
+ EXPECT_STREQ("", tests[0]->comment());
+ EXPECT_STREQ(GetExpectedTestCaseComment().c_str(),
+ tests[0]->test_case_comment());
+ EXPECT_TRUE(tests[0]->should_run());
+
+ delete[] tests;
+#endif // GTEST_HAS_TYPED_TEST
+}
+
+TEST(ApiTest, TestCaseDisabledAccessorsWork) {
+ const TestCase* test_case = UnitTestHelper::FindTestCase("DISABLED_Test");
+ ASSERT_TRUE(test_case != NULL);
+
+ EXPECT_STREQ("DISABLED_Test", test_case->name());
+ EXPECT_STREQ("", test_case->comment());
+ EXPECT_FALSE(test_case->should_run());
+ EXPECT_EQ(1, test_case->disabled_test_count());
+ EXPECT_EQ(0, test_case->test_to_run_count());
+ ASSERT_EQ(1, test_case->total_test_count());
+
+ const TestInfo* const test_info = test_case->GetTestInfo(0);
+ EXPECT_STREQ("Dummy2", test_info->name());
+ EXPECT_STREQ("DISABLED_Test", test_info->test_case_name());
+ EXPECT_STREQ("", test_info->comment());
+ EXPECT_STREQ("", test_info->test_case_comment());
+ EXPECT_FALSE(test_info->should_run());
+}
+
+// These two tests are here to provide support for testing
+// test_case_to_run_count, disabled_test_count, and test_to_run_count.
+TEST(ApiTest, DISABLED_Dummy1) {}
+TEST(DISABLED_Test, Dummy2) {}
+
+class FinalSuccessChecker : public Environment {
+ protected:
+ virtual void TearDown() {
+ UnitTest* unit_test = UnitTest::GetInstance();
+
+ EXPECT_EQ(1 + kTypedTestCases, unit_test->successful_test_case_count());
+ EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count());
+ EXPECT_EQ(0, unit_test->failed_test_case_count());
+ EXPECT_EQ(0, unit_test->failed_test_count());
+ EXPECT_TRUE(unit_test->Passed());
+ EXPECT_FALSE(unit_test->Failed());
+ ASSERT_EQ(2 + kTypedTestCases, unit_test->total_test_case_count());
+
+ const TestCase** const test_cases = UnitTestHelper::GetSortedTestCases();
+
+ EXPECT_STREQ("ApiTest", test_cases[0]->name());
+ EXPECT_STREQ("", test_cases[0]->comment());
+ EXPECT_TRUE(test_cases[0]->should_run());
+ EXPECT_EQ(1, test_cases[0]->disabled_test_count());
+ ASSERT_EQ(4, test_cases[0]->total_test_count());
+ EXPECT_EQ(3, test_cases[0]->successful_test_count());
+ EXPECT_EQ(0, test_cases[0]->failed_test_count());
+ EXPECT_TRUE(test_cases[0]->Passed());
+ EXPECT_FALSE(test_cases[0]->Failed());
+
+ EXPECT_STREQ("DISABLED_Test", test_cases[1]->name());
+ EXPECT_STREQ("", test_cases[1]->comment());
+ EXPECT_FALSE(test_cases[1]->should_run());
+ EXPECT_EQ(1, test_cases[1]->disabled_test_count());
+ ASSERT_EQ(1, test_cases[1]->total_test_count());
+ EXPECT_EQ(0, test_cases[1]->successful_test_count());
+ EXPECT_EQ(0, test_cases[1]->failed_test_count());
+
+#if GTEST_HAS_TYPED_TEST
+ EXPECT_STREQ("TestCaseWithCommentTest/0", test_cases[2]->name());
+ EXPECT_STREQ(GetExpectedTestCaseComment().c_str(),
+ test_cases[2]->comment());
+ EXPECT_TRUE(test_cases[2]->should_run());
+ EXPECT_EQ(0, test_cases[2]->disabled_test_count());
+ ASSERT_EQ(1, test_cases[2]->total_test_count());
+ EXPECT_EQ(1, test_cases[2]->successful_test_count());
+ EXPECT_EQ(0, test_cases[2]->failed_test_count());
+ EXPECT_TRUE(test_cases[2]->Passed());
+ EXPECT_FALSE(test_cases[2]->Failed());
+#endif // GTEST_HAS_TYPED_TEST
+
+ const TestCase* test_case = UnitTestHelper::FindTestCase("ApiTest");
+ const TestInfo** tests = UnitTestHelper::GetSortedTests(test_case);
+ EXPECT_STREQ("DISABLED_Dummy1", tests[0]->name());
+ EXPECT_STREQ("ApiTest", tests[0]->test_case_name());
+ EXPECT_FALSE(tests[0]->should_run());
+
+ EXPECT_STREQ("TestCaseDisabledAccessorsWork", tests[1]->name());
+ EXPECT_STREQ("ApiTest", tests[1]->test_case_name());
+ EXPECT_STREQ("", tests[1]->comment());
+ EXPECT_STREQ("", tests[1]->test_case_comment());
+ EXPECT_TRUE(tests[1]->should_run());
+ EXPECT_TRUE(tests[1]->result()->Passed());
+ EXPECT_EQ(0, tests[1]->result()->test_property_count());
+
+ EXPECT_STREQ("TestCaseImmutableAccessorsWork", tests[2]->name());
+ EXPECT_STREQ("ApiTest", tests[2]->test_case_name());
+ EXPECT_STREQ("", tests[2]->comment());
+ EXPECT_STREQ("", tests[2]->test_case_comment());
+ EXPECT_TRUE(tests[2]->should_run());
+ EXPECT_TRUE(tests[2]->result()->Passed());
+ EXPECT_EQ(0, tests[2]->result()->test_property_count());
+
+ EXPECT_STREQ("UnitTestImmutableAccessorsWork", tests[3]->name());
+ EXPECT_STREQ("ApiTest", tests[3]->test_case_name());
+ EXPECT_STREQ("", tests[3]->comment());
+ EXPECT_STREQ("", tests[3]->test_case_comment());
+ EXPECT_TRUE(tests[3]->should_run());
+ EXPECT_TRUE(tests[3]->result()->Passed());
+ EXPECT_EQ(1, tests[3]->result()->test_property_count());
+ const TestProperty& property = tests[3]->result()->GetTestProperty(0);
+ EXPECT_STREQ("key", property.key());
+ EXPECT_STREQ("value", property.value());
+
+ delete[] tests;
+
+#if GTEST_HAS_TYPED_TEST
+ test_case = UnitTestHelper::FindTestCase("TestCaseWithCommentTest/0");
+ tests = UnitTestHelper::GetSortedTests(test_case);
+
+ EXPECT_STREQ("Dummy", tests[0]->name());
+ EXPECT_STREQ("TestCaseWithCommentTest/0", tests[0]->test_case_name());
+ EXPECT_STREQ("", tests[0]->comment());
+ EXPECT_STREQ(GetExpectedTestCaseComment().c_str(),
+ tests[0]->test_case_comment());
+ EXPECT_TRUE(tests[0]->should_run());
+ EXPECT_TRUE(tests[0]->result()->Passed());
+ EXPECT_EQ(0, tests[0]->result()->test_property_count());
+
+ delete[] tests;
+#endif // GTEST_HAS_TYPED_TEST
+ delete[] test_cases;
+ }
+};
+
+} // namespace internal
+} // namespace testing
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+
+ AddGlobalTestEnvironment(new testing::internal::FinalSuccessChecker());
+
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_all_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_all_test.cc
new file mode 100644
index 0000000..e1edb08
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_all_test.cc
@@ -0,0 +1,48 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// Tests for Google C++ Testing Framework (Google Test)
+//
+// Sometimes it's desirable to build most of Google Test's own tests
+// by compiling a single file. This file serves this purpose.
+#include "test/gtest-filepath_test.cc"
+#include "test/gtest-linked_ptr_test.cc"
+#include "test/gtest-message_test.cc"
+#include "test/gtest-options_test.cc"
+#include "test/gtest-port_test.cc"
+#include "test/gtest_pred_impl_unittest.cc"
+#include "test/gtest_prod_test.cc"
+#include "test/gtest-test-part_test.cc"
+#include "test/gtest-typed-test_test.cc"
+#include "test/gtest-typed-test2_test.cc"
+#include "test/gtest_unittest.cc"
+#include "test/production.cc"
+#include "src/gtest_main.cc"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest.py
new file mode 100755
index 0000000..c819183
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest.py
@@ -0,0 +1,218 @@
+#!/usr/bin/env python
+#
+# Copyright 2006, 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.
+
+"""Unit test for Google Test's break-on-failure mode.
+
+A user can ask Google Test to seg-fault when an assertion fails, using
+either the GTEST_BREAK_ON_FAILURE environment variable or the
+--gtest_break_on_failure flag. This script tests such functionality
+by invoking gtest_break_on_failure_unittest_ (a program written with
+Google Test) with different environments and command line flags.
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import gtest_test_utils
+import os
+import sys
+
+
+# Constants.
+
+IS_WINDOWS = os.name == 'nt'
+
+# The environment variable for enabling/disabling the break-on-failure mode.
+BREAK_ON_FAILURE_ENV_VAR = 'GTEST_BREAK_ON_FAILURE'
+
+# The command line flag for enabling/disabling the break-on-failure mode.
+BREAK_ON_FAILURE_FLAG = 'gtest_break_on_failure'
+
+# The environment variable for enabling/disabling the throw-on-failure mode.
+THROW_ON_FAILURE_ENV_VAR = 'GTEST_THROW_ON_FAILURE'
+
+# The environment variable for enabling/disabling the catch-exceptions mode.
+CATCH_EXCEPTIONS_ENV_VAR = 'GTEST_CATCH_EXCEPTIONS'
+
+# Path to the gtest_break_on_failure_unittest_ program.
+EXE_PATH = gtest_test_utils.GetTestExecutablePath(
+ 'gtest_break_on_failure_unittest_')
+
+
+# Utilities.
+
+
+environ = os.environ.copy()
+
+
+def SetEnvVar(env_var, value):
+ """Sets an environment variable to a given value; unsets it when the
+ given value is None.
+ """
+
+ if value is not None:
+ environ[env_var] = value
+ elif env_var in environ:
+ del environ[env_var]
+
+
+def Run(command):
+ """Runs a command; returns 1 if it was killed by a signal, or 0 otherwise."""
+
+ p = gtest_test_utils.Subprocess(command, env=environ)
+ if p.terminated_by_signal:
+ return 1
+ else:
+ return 0
+
+
+# The tests.
+
+
+class GTestBreakOnFailureUnitTest(gtest_test_utils.TestCase):
+ """Tests using the GTEST_BREAK_ON_FAILURE environment variable or
+ the --gtest_break_on_failure flag to turn assertion failures into
+ segmentation faults.
+ """
+
+ def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault):
+ """Runs gtest_break_on_failure_unittest_ and verifies that it does
+ (or does not) have a seg-fault.
+
+ Args:
+ env_var_value: value of the GTEST_BREAK_ON_FAILURE environment
+ variable; None if the variable should be unset.
+ flag_value: value of the --gtest_break_on_failure flag;
+ None if the flag should not be present.
+ expect_seg_fault: 1 if the program is expected to generate a seg-fault;
+ 0 otherwise.
+ """
+
+ SetEnvVar(BREAK_ON_FAILURE_ENV_VAR, env_var_value)
+
+ if env_var_value is None:
+ env_var_value_msg = ' is not set'
+ else:
+ env_var_value_msg = '=' + env_var_value
+
+ if flag_value is None:
+ flag = ''
+ elif flag_value == '0':
+ flag = '--%s=0' % BREAK_ON_FAILURE_FLAG
+ else:
+ flag = '--%s' % BREAK_ON_FAILURE_FLAG
+
+ command = [EXE_PATH]
+ if flag:
+ command.append(flag)
+
+ if expect_seg_fault:
+ should_or_not = 'should'
+ else:
+ should_or_not = 'should not'
+
+ has_seg_fault = Run(command)
+
+ SetEnvVar(BREAK_ON_FAILURE_ENV_VAR, None)
+
+ msg = ('when %s%s, an assertion failure in "%s" %s cause a seg-fault.' %
+ (BREAK_ON_FAILURE_ENV_VAR, env_var_value_msg, ' '.join(command),
+ should_or_not))
+ self.assert_(has_seg_fault == expect_seg_fault, msg)
+
+ def testDefaultBehavior(self):
+ """Tests the behavior of the default mode."""
+
+ self.RunAndVerify(env_var_value=None,
+ flag_value=None,
+ expect_seg_fault=0)
+
+ def testEnvVar(self):
+ """Tests using the GTEST_BREAK_ON_FAILURE environment variable."""
+
+ self.RunAndVerify(env_var_value='0',
+ flag_value=None,
+ expect_seg_fault=0)
+ self.RunAndVerify(env_var_value='1',
+ flag_value=None,
+ expect_seg_fault=1)
+
+ def testFlag(self):
+ """Tests using the --gtest_break_on_failure flag."""
+
+ self.RunAndVerify(env_var_value=None,
+ flag_value='0',
+ expect_seg_fault=0)
+ self.RunAndVerify(env_var_value=None,
+ flag_value='1',
+ expect_seg_fault=1)
+
+ def testFlagOverridesEnvVar(self):
+ """Tests that the flag overrides the environment variable."""
+
+ self.RunAndVerify(env_var_value='0',
+ flag_value='0',
+ expect_seg_fault=0)
+ self.RunAndVerify(env_var_value='0',
+ flag_value='1',
+ expect_seg_fault=1)
+ self.RunAndVerify(env_var_value='1',
+ flag_value='0',
+ expect_seg_fault=0)
+ self.RunAndVerify(env_var_value='1',
+ flag_value='1',
+ expect_seg_fault=1)
+
+ def testBreakOnFailureOverridesThrowOnFailure(self):
+ """Tests that gtest_break_on_failure overrides gtest_throw_on_failure."""
+
+ SetEnvVar(THROW_ON_FAILURE_ENV_VAR, '1')
+ try:
+ self.RunAndVerify(env_var_value=None,
+ flag_value='1',
+ expect_seg_fault=1)
+ finally:
+ SetEnvVar(THROW_ON_FAILURE_ENV_VAR, None)
+
+ if IS_WINDOWS:
+ def testCatchExceptionsDoesNotInterfere(self):
+ """Tests that gtest_catch_exceptions doesn't interfere."""
+
+ SetEnvVar(CATCH_EXCEPTIONS_ENV_VAR, '1')
+ try:
+ self.RunAndVerify(env_var_value='1',
+ flag_value='1',
+ expect_seg_fault=1)
+ finally:
+ SetEnvVar(CATCH_EXCEPTIONS_ENV_VAR, None)
+
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest_.cc
new file mode 100644
index 0000000..d28d1d3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_break_on_failure_unittest_.cc
@@ -0,0 +1,86 @@
+// Copyright 2006, 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: wan@google.com (Zhanyong Wan)
+
+// Unit test for Google Test's break-on-failure mode.
+//
+// A user can ask Google Test to seg-fault when an assertion fails, using
+// either the GTEST_BREAK_ON_FAILURE environment variable or the
+// --gtest_break_on_failure flag. This file is used for testing such
+// functionality.
+//
+// This program will be invoked from a Python unit test. It is
+// expected to fail. Don't run it directly.
+
+#include <gtest/gtest.h>
+
+#if GTEST_OS_WINDOWS
+#include <windows.h>
+#include <stdlib.h>
+#endif
+
+namespace {
+
+// A test that's expected to fail.
+TEST(Foo, Bar) {
+ EXPECT_EQ(2, 3);
+}
+
+#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
+// On Windows Mobile global exception handlers are not supported.
+LONG WINAPI ExitWithExceptionCode(
+ struct _EXCEPTION_POINTERS* exception_pointers) {
+ exit(exception_pointers->ExceptionRecord->ExceptionCode);
+}
+#endif
+
+} // namespace
+
+int main(int argc, char **argv) {
+#if GTEST_OS_WINDOWS
+ // Suppresses display of the Windows error dialog upon encountering
+ // a general protection fault (segment violation).
+ SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
+
+#if !GTEST_OS_WINDOWS_MOBILE
+ // The default unhandled exception filter does not always exit
+ // with the exception code as exit code - for example it exits with
+ // 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT
+ // if the application is compiled in debug mode. Thus we use our own
+ // filter which always exits with the exception code for unhandled
+ // exceptions.
+ SetUnhandledExceptionFilter(ExitWithExceptionCode);
+#endif
+#endif
+
+ testing::InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test.py
new file mode 100755
index 0000000..d02a53e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Verifies that Google Test correctly determines whether to use colors."""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import gtest_test_utils
+
+
+IS_WINDOWS = os.name = 'nt'
+
+COLOR_ENV_VAR = 'GTEST_COLOR'
+COLOR_FLAG = 'gtest_color'
+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_color_test_')
+
+
+def SetEnvVar(env_var, value):
+ """Sets the env variable to 'value'; unsets it when 'value' is None."""
+
+ if value is not None:
+ os.environ[env_var] = value
+ elif env_var in os.environ:
+ del os.environ[env_var]
+
+
+def UsesColor(term, color_env_var, color_flag):
+ """Runs gtest_color_test_ and returns its exit code."""
+
+ SetEnvVar('TERM', term)
+ SetEnvVar(COLOR_ENV_VAR, color_env_var)
+
+ if color_flag is None:
+ args = []
+ else:
+ args = ['--%s=%s' % (COLOR_FLAG, color_flag)]
+ p = gtest_test_utils.Subprocess([COMMAND] + args)
+ return not p.exited or p.exit_code
+
+
+class GTestColorTest(gtest_test_utils.TestCase):
+ def testNoEnvVarNoFlag(self):
+ """Tests the case when there's neither GTEST_COLOR nor --gtest_color."""
+
+ if not IS_WINDOWS:
+ self.assert_(not UsesColor('dumb', None, None))
+ self.assert_(not UsesColor('emacs', None, None))
+ self.assert_(not UsesColor('xterm-mono', None, None))
+ self.assert_(not UsesColor('unknown', None, None))
+ self.assert_(not UsesColor(None, None, None))
+ self.assert_(UsesColor('linux', None, None))
+ self.assert_(UsesColor('cygwin', None, None))
+ self.assert_(UsesColor('xterm', None, None))
+ self.assert_(UsesColor('xterm-color', None, None))
+ self.assert_(UsesColor('xterm-256color', None, None))
+
+ def testFlagOnly(self):
+ """Tests the case when there's --gtest_color but not GTEST_COLOR."""
+
+ self.assert_(not UsesColor('dumb', None, 'no'))
+ self.assert_(not UsesColor('xterm-color', None, 'no'))
+ if not IS_WINDOWS:
+ self.assert_(not UsesColor('emacs', None, 'auto'))
+ self.assert_(UsesColor('xterm', None, 'auto'))
+ self.assert_(UsesColor('dumb', None, 'yes'))
+ self.assert_(UsesColor('xterm', None, 'yes'))
+
+ def testEnvVarOnly(self):
+ """Tests the case when there's GTEST_COLOR but not --gtest_color."""
+
+ self.assert_(not UsesColor('dumb', 'no', None))
+ self.assert_(not UsesColor('xterm-color', 'no', None))
+ if not IS_WINDOWS:
+ self.assert_(not UsesColor('dumb', 'auto', None))
+ self.assert_(UsesColor('xterm-color', 'auto', None))
+ self.assert_(UsesColor('dumb', 'yes', None))
+ self.assert_(UsesColor('xterm-color', 'yes', None))
+
+ def testEnvVarAndFlag(self):
+ """Tests the case when there are both GTEST_COLOR and --gtest_color."""
+
+ self.assert_(not UsesColor('xterm-color', 'no', 'no'))
+ self.assert_(UsesColor('dumb', 'no', 'yes'))
+ self.assert_(UsesColor('xterm-color', 'no', 'auto'))
+
+ def testAliasesOfYesAndNo(self):
+ """Tests using aliases in specifying --gtest_color."""
+
+ self.assert_(UsesColor('dumb', None, 'true'))
+ self.assert_(UsesColor('dumb', None, 'YES'))
+ self.assert_(UsesColor('dumb', None, 'T'))
+ self.assert_(UsesColor('dumb', None, '1'))
+
+ self.assert_(not UsesColor('xterm', None, 'f'))
+ self.assert_(not UsesColor('xterm', None, 'false'))
+ self.assert_(not UsesColor('xterm', None, '0'))
+ self.assert_(not UsesColor('xterm', None, 'unknown'))
+
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test_.cc
new file mode 100644
index 0000000..58d377c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_color_test_.cc
@@ -0,0 +1,71 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// A helper program for testing how Google Test determines whether to use
+// colors in the output. It prints "YES" and returns 1 if Google Test
+// decides to use colors, and prints "NO" and returns 0 otherwise.
+
+#include <stdio.h>
+
+#include <gtest/gtest.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+using testing::internal::ShouldUseColor;
+
+// The purpose of this is to ensure that the UnitTest singleton is
+// created before main() is entered, and thus that ShouldUseColor()
+// works the same way as in a real Google-Test-based test. We don't actual
+// run the TEST itself.
+TEST(GTestColorTest, Dummy) {
+}
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ if (ShouldUseColor(true)) {
+ // Google Test decides to use colors in the output (assuming it
+ // goes to a TTY).
+ printf("YES\n");
+ return 1;
+ } else {
+ // Google Test decides not to use colors in the output.
+ printf("NO\n");
+ return 0;
+ }
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test.py
new file mode 100755
index 0000000..bcc0bfd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Verifies that Google Test correctly parses environment variables."""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import gtest_test_utils
+
+
+IS_WINDOWS = os.name == 'nt'
+IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
+
+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_env_var_test_')
+
+environ = os.environ.copy()
+
+
+def AssertEq(expected, actual):
+ if expected != actual:
+ print 'Expected: %s' % (expected,)
+ print ' Actual: %s' % (actual,)
+ raise AssertionError
+
+
+def SetEnvVar(env_var, value):
+ """Sets the env variable to 'value'; unsets it when 'value' is None."""
+
+ if value is not None:
+ environ[env_var] = value
+ elif env_var in environ:
+ del environ[env_var]
+
+
+def GetFlag(flag):
+ """Runs gtest_env_var_test_ and returns its output."""
+
+ args = [COMMAND]
+ if flag is not None:
+ args += [flag]
+ return gtest_test_utils.Subprocess(args, env=environ).output
+
+
+def TestFlag(flag, test_val, default_val):
+ """Verifies that the given flag is affected by the corresponding env var."""
+
+ env_var = 'GTEST_' + flag.upper()
+ SetEnvVar(env_var, test_val)
+ AssertEq(test_val, GetFlag(flag))
+ SetEnvVar(env_var, None)
+ AssertEq(default_val, GetFlag(flag))
+
+
+class GTestEnvVarTest(gtest_test_utils.TestCase):
+ def testEnvVarAffectsFlag(self):
+ """Tests that environment variable should affect the corresponding flag."""
+
+ TestFlag('break_on_failure', '1', '0')
+ TestFlag('color', 'yes', 'auto')
+ TestFlag('filter', 'FooTest.Bar', '*')
+ TestFlag('output', 'xml:tmp/foo.xml', '')
+ TestFlag('print_time', '0', '1')
+ TestFlag('repeat', '999', '1')
+ TestFlag('throw_on_failure', '1', '0')
+ TestFlag('death_test_style', 'threadsafe', 'fast')
+
+ if IS_WINDOWS:
+ TestFlag('catch_exceptions', '1', '0')
+
+ if IS_LINUX:
+ TestFlag('death_test_use_fork', '1', '0')
+ TestFlag('stack_trace_depth', '0', '100')
+
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test_.cc
new file mode 100644
index 0000000..f7c78fc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_env_var_test_.cc
@@ -0,0 +1,126 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// A helper program for testing that Google Test parses the environment
+// variables correctly.
+
+#include <gtest/gtest.h>
+
+#include <iostream>
+
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+using ::std::cout;
+
+namespace testing {
+
+// The purpose of this is to make the test more realistic by ensuring
+// that the UnitTest singleton is created before main() is entered.
+// We don't actual run the TEST itself.
+TEST(GTestEnvVarTest, Dummy) {
+}
+
+void PrintFlag(const char* flag) {
+ if (strcmp(flag, "break_on_failure") == 0) {
+ cout << GTEST_FLAG(break_on_failure);
+ return;
+ }
+
+ if (strcmp(flag, "catch_exceptions") == 0) {
+ cout << GTEST_FLAG(catch_exceptions);
+ return;
+ }
+
+ if (strcmp(flag, "color") == 0) {
+ cout << GTEST_FLAG(color);
+ return;
+ }
+
+ if (strcmp(flag, "death_test_style") == 0) {
+ cout << GTEST_FLAG(death_test_style);
+ return;
+ }
+
+ if (strcmp(flag, "death_test_use_fork") == 0) {
+ cout << GTEST_FLAG(death_test_use_fork);
+ return;
+ }
+
+ if (strcmp(flag, "filter") == 0) {
+ cout << GTEST_FLAG(filter);
+ return;
+ }
+
+ if (strcmp(flag, "output") == 0) {
+ cout << GTEST_FLAG(output);
+ return;
+ }
+
+ if (strcmp(flag, "print_time") == 0) {
+ cout << GTEST_FLAG(print_time);
+ return;
+ }
+
+ if (strcmp(flag, "repeat") == 0) {
+ cout << GTEST_FLAG(repeat);
+ return;
+ }
+
+ if (strcmp(flag, "stack_trace_depth") == 0) {
+ cout << GTEST_FLAG(stack_trace_depth);
+ return;
+ }
+
+ if (strcmp(flag, "throw_on_failure") == 0) {
+ cout << GTEST_FLAG(throw_on_failure);
+ return;
+ }
+
+ cout << "Invalid flag name " << flag
+ << ". Valid names are break_on_failure, color, filter, etc.\n";
+ exit(1);
+}
+
+} // namespace testing
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ if (argc != 2) {
+ cout << "Usage: gtest_env_var_test_ NAME_OF_FLAG\n";
+ return 1;
+ }
+
+ testing::PrintFlag(argv[1]);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_environment_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_environment_test.cc
new file mode 100644
index 0000000..c939261
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_environment_test.cc
@@ -0,0 +1,186 @@
+// 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// Tests using global test environments.
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <gtest/gtest.h>
+
+namespace testing {
+GTEST_DECLARE_string_(filter);
+}
+
+namespace {
+
+enum FailureType {
+ NO_FAILURE, NON_FATAL_FAILURE, FATAL_FAILURE
+};
+
+// For testing using global test environments.
+class MyEnvironment : public testing::Environment {
+ public:
+ MyEnvironment() { Reset(); }
+
+ // Depending on the value of failure_in_set_up_, SetUp() will
+ // generate a non-fatal failure, generate a fatal failure, or
+ // succeed.
+ virtual void SetUp() {
+ set_up_was_run_ = true;
+
+ switch (failure_in_set_up_) {
+ case NON_FATAL_FAILURE:
+ ADD_FAILURE() << "Expected non-fatal failure in global set-up.";
+ break;
+ case FATAL_FAILURE:
+ FAIL() << "Expected fatal failure in global set-up.";
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Generates a non-fatal failure.
+ virtual void TearDown() {
+ tear_down_was_run_ = true;
+ ADD_FAILURE() << "Expected non-fatal failure in global tear-down.";
+ }
+
+ // Resets the state of the environment s.t. it can be reused.
+ void Reset() {
+ failure_in_set_up_ = NO_FAILURE;
+ set_up_was_run_ = false;
+ tear_down_was_run_ = false;
+ }
+
+ // We call this function to set the type of failure SetUp() should
+ // generate.
+ void set_failure_in_set_up(FailureType type) {
+ failure_in_set_up_ = type;
+ }
+
+ // Was SetUp() run?
+ bool set_up_was_run() const { return set_up_was_run_; }
+
+ // Was TearDown() run?
+ bool tear_down_was_run() const { return tear_down_was_run_; }
+ private:
+ FailureType failure_in_set_up_;
+ bool set_up_was_run_;
+ bool tear_down_was_run_;
+};
+
+// Was the TEST run?
+bool test_was_run;
+
+// The sole purpose of this TEST is to enable us to check whether it
+// was run.
+TEST(FooTest, Bar) {
+ test_was_run = true;
+}
+
+// Prints the message and aborts the program if condition is false.
+void Check(bool condition, const char* msg) {
+ if (!condition) {
+ printf("FAILED: %s\n", msg);
+ abort();
+ }
+}
+
+// Runs the tests. Return true iff successful.
+//
+// The 'failure' parameter specifies the type of failure that should
+// be generated by the global set-up.
+int RunAllTests(MyEnvironment* env, FailureType failure) {
+ env->Reset();
+ env->set_failure_in_set_up(failure);
+ test_was_run = false;
+ return RUN_ALL_TESTS();
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ // Registers a global test environment, and verifies that the
+ // registration function returns its argument.
+ MyEnvironment* const env = new MyEnvironment;
+ Check(testing::AddGlobalTestEnvironment(env) == env,
+ "AddGlobalTestEnvironment() should return its argument.");
+
+ // Verifies that RUN_ALL_TESTS() runs the tests when the global
+ // set-up is successful.
+ Check(RunAllTests(env, NO_FAILURE) != 0,
+ "RUN_ALL_TESTS() should return non-zero, as the global tear-down "
+ "should generate a failure.");
+ Check(test_was_run,
+ "The tests should run, as the global set-up should generate no "
+ "failure");
+ Check(env->tear_down_was_run(),
+ "The global tear-down should run, as the global set-up was run.");
+
+ // Verifies that RUN_ALL_TESTS() runs the tests when the global
+ // set-up generates no fatal failure.
+ Check(RunAllTests(env, NON_FATAL_FAILURE) != 0,
+ "RUN_ALL_TESTS() should return non-zero, as both the global set-up "
+ "and the global tear-down should generate a non-fatal failure.");
+ Check(test_was_run,
+ "The tests should run, as the global set-up should generate no "
+ "fatal failure.");
+ Check(env->tear_down_was_run(),
+ "The global tear-down should run, as the global set-up was run.");
+
+ // Verifies that RUN_ALL_TESTS() runs no test when the global set-up
+ // generates a fatal failure.
+ Check(RunAllTests(env, FATAL_FAILURE) != 0,
+ "RUN_ALL_TESTS() should return non-zero, as the global set-up "
+ "should generate a fatal failure.");
+ Check(!test_was_run,
+ "The tests should not run, as the global set-up should generate "
+ "a fatal failure.");
+ Check(env->tear_down_was_run(),
+ "The global tear-down should run, as the global set-up was run.");
+
+ // Verifies that RUN_ALL_TESTS() doesn't do global set-up or
+ // tear-down when there is no test to run.
+ testing::GTEST_FLAG(filter) = "-*";
+ Check(RunAllTests(env, NO_FAILURE) == 0,
+ "RUN_ALL_TESTS() should return zero, as there is no test to run.");
+ Check(!env->set_up_was_run(),
+ "The global set-up should not run, as there is no test to run.");
+ Check(!env->tear_down_was_run(),
+ "The global tear-down should not run, "
+ "as the global set-up was not run.");
+
+ printf("PASS\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest.py
new file mode 100755
index 0000000..0d1a770
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest.py
@@ -0,0 +1,633 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Unit test for Google Test test filters.
+
+A user can specify which test(s) in a Google Test program to run via either
+the GTEST_FILTER environment variable or the --gtest_filter flag.
+This script tests such functionality by invoking
+gtest_filter_unittest_ (a program written with Google Test) with different
+environments and command line flags.
+
+Note that test sharding may also influence which tests are filtered. Therefore,
+we test that here also.
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import re
+import sets
+import sys
+
+import gtest_test_utils
+
+# Constants.
+
+# Checks if this platform can pass empty environment variables to child
+# processes. We set an env variable to an empty string and invoke a python
+# script in a subprocess to print whether the variable is STILL in
+# os.environ. We then use 'eval' to parse the child's output so that an
+# exception is thrown if the input is anything other than 'True' nor 'False'.
+os.environ['EMPTY_VAR'] = ''
+child = gtest_test_utils.Subprocess(
+ [sys.executable, '-c', 'import os; print \'EMPTY_VAR\' in os.environ'])
+CAN_PASS_EMPTY_ENV = eval(child.output)
+
+
+# Check if this platform can unset environment variables in child processes.
+# We set an env variable to a non-empty string, unset it, and invoke
+# a python script in a subprocess to print whether the variable
+# is NO LONGER in os.environ.
+# We use 'eval' to parse the child's output so that an exception
+# is thrown if the input is neither 'True' nor 'False'.
+os.environ['UNSET_VAR'] = 'X'
+del os.environ['UNSET_VAR']
+child = gtest_test_utils.Subprocess(
+ [sys.executable, '-c', 'import os; print \'UNSET_VAR\' not in os.environ'])
+CAN_UNSET_ENV = eval(child.output)
+
+
+# Checks if we should test with an empty filter. This doesn't
+# make sense on platforms that cannot pass empty env variables (Win32)
+# and on platforms that cannot unset variables (since we cannot tell
+# the difference between "" and NULL -- Borland and Solaris < 5.10)
+CAN_TEST_EMPTY_FILTER = (CAN_PASS_EMPTY_ENV and CAN_UNSET_ENV)
+
+
+# The environment variable for specifying the test filters.
+FILTER_ENV_VAR = 'GTEST_FILTER'
+
+# The environment variables for test sharding.
+TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS'
+SHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX'
+SHARD_STATUS_FILE_ENV_VAR = 'GTEST_SHARD_STATUS_FILE'
+
+# The command line flag for specifying the test filters.
+FILTER_FLAG = 'gtest_filter'
+
+# The command line flag for including disabled tests.
+ALSO_RUN_DISABED_TESTS_FLAG = 'gtest_also_run_disabled_tests'
+
+# Command to run the gtest_filter_unittest_ program.
+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_filter_unittest_')
+
+# Regex for determining whether parameterized tests are enabled in the binary.
+PARAM_TEST_REGEX = re.compile(r'/ParamTest')
+
+# Regex for parsing test case names from Google Test's output.
+TEST_CASE_REGEX = re.compile(r'^\[\-+\] \d+ tests? from (\w+(/\w+)?)')
+
+# Regex for parsing test names from Google Test's output.
+TEST_REGEX = re.compile(r'^\[\s*RUN\s*\].*\.(\w+(/\w+)?)')
+
+# The command line flag to tell Google Test to output the list of tests it
+# will run.
+LIST_TESTS_FLAG = '--gtest_list_tests'
+
+# Indicates whether Google Test supports death tests.
+SUPPORTS_DEATH_TESTS = 'HasDeathTest' in gtest_test_utils.Subprocess(
+ [COMMAND, LIST_TESTS_FLAG]).output
+
+# Full names of all tests in gtest_filter_unittests_.
+PARAM_TESTS = [
+ 'SeqP/ParamTest.TestX/0',
+ 'SeqP/ParamTest.TestX/1',
+ 'SeqP/ParamTest.TestY/0',
+ 'SeqP/ParamTest.TestY/1',
+ 'SeqQ/ParamTest.TestX/0',
+ 'SeqQ/ParamTest.TestX/1',
+ 'SeqQ/ParamTest.TestY/0',
+ 'SeqQ/ParamTest.TestY/1',
+ ]
+
+DISABLED_TESTS = [
+ 'BarTest.DISABLED_TestFour',
+ 'BarTest.DISABLED_TestFive',
+ 'BazTest.DISABLED_TestC',
+ 'DISABLED_FoobarTest.Test1',
+ 'DISABLED_FoobarTest.DISABLED_Test2',
+ 'DISABLED_FoobarbazTest.TestA',
+ ]
+
+if SUPPORTS_DEATH_TESTS:
+ DEATH_TESTS = [
+ 'HasDeathTest.Test1',
+ 'HasDeathTest.Test2',
+ ]
+else:
+ DEATH_TESTS = []
+
+# All the non-disabled tests.
+ACTIVE_TESTS = [
+ 'FooTest.Abc',
+ 'FooTest.Xyz',
+
+ 'BarTest.TestOne',
+ 'BarTest.TestTwo',
+ 'BarTest.TestThree',
+
+ 'BazTest.TestOne',
+ 'BazTest.TestA',
+ 'BazTest.TestB',
+ ] + DEATH_TESTS + PARAM_TESTS
+
+param_tests_present = None
+
+# Utilities.
+
+environ = os.environ.copy()
+
+
+def SetEnvVar(env_var, value):
+ """Sets the env variable to 'value'; unsets it when 'value' is None."""
+
+ if value is not None:
+ environ[env_var] = value
+ elif env_var in environ:
+ del environ[env_var]
+
+
+def RunAndReturnOutput(args = None):
+ """Runs the test program and returns its output."""
+
+ return gtest_test_utils.Subprocess([COMMAND] + (args or []),
+ env=environ).output
+
+
+def RunAndExtractTestList(args = None):
+ """Runs the test program and returns its exit code and a list of tests run."""
+
+ p = gtest_test_utils.Subprocess([COMMAND] + (args or []), env=environ)
+ tests_run = []
+ test_case = ''
+ test = ''
+ for line in p.output.split('\n'):
+ match = TEST_CASE_REGEX.match(line)
+ if match is not None:
+ test_case = match.group(1)
+ else:
+ match = TEST_REGEX.match(line)
+ if match is not None:
+ test = match.group(1)
+ tests_run.append(test_case + '.' + test)
+ return (tests_run, p.exit_code)
+
+
+def InvokeWithModifiedEnv(extra_env, function, *args, **kwargs):
+ """Runs the given function and arguments in a modified environment."""
+ try:
+ original_env = environ.copy()
+ environ.update(extra_env)
+ return function(*args, **kwargs)
+ finally:
+ environ.clear()
+ environ.update(original_env)
+
+
+def RunWithSharding(total_shards, shard_index, command):
+ """Runs a test program shard and returns exit code and a list of tests run."""
+
+ extra_env = {SHARD_INDEX_ENV_VAR: str(shard_index),
+ TOTAL_SHARDS_ENV_VAR: str(total_shards)}
+ return InvokeWithModifiedEnv(extra_env, RunAndExtractTestList, command)
+
+# The unit test.
+
+
+class GTestFilterUnitTest(gtest_test_utils.TestCase):
+ """Tests the env variable or the command line flag to filter tests."""
+
+ # Utilities.
+
+ def AssertSetEqual(self, lhs, rhs):
+ """Asserts that two sets are equal."""
+
+ for elem in lhs:
+ self.assert_(elem in rhs, '%s in %s' % (elem, rhs))
+
+ for elem in rhs:
+ self.assert_(elem in lhs, '%s in %s' % (elem, lhs))
+
+ def AssertPartitionIsValid(self, set_var, list_of_sets):
+ """Asserts that list_of_sets is a valid partition of set_var."""
+
+ full_partition = []
+ for slice_var in list_of_sets:
+ full_partition.extend(slice_var)
+ self.assertEqual(len(set_var), len(full_partition))
+ self.assertEqual(sets.Set(set_var), sets.Set(full_partition))
+
+ def AdjustForParameterizedTests(self, tests_to_run):
+ """Adjust tests_to_run in case value parameterized tests are disabled."""
+
+ global param_tests_present
+ if not param_tests_present:
+ return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS))
+ else:
+ return tests_to_run
+
+ def RunAndVerify(self, gtest_filter, tests_to_run):
+ """Checks that the binary runs correct set of tests for a given filter."""
+
+ tests_to_run = self.AdjustForParameterizedTests(tests_to_run)
+
+ # First, tests using the environment variable.
+
+ # Windows removes empty variables from the environment when passing it
+ # to a new process. This means it is impossible to pass an empty filter
+ # into a process using the environment variable. However, we can still
+ # test the case when the variable is not supplied (i.e., gtest_filter is
+ # None).
+ # pylint: disable-msg=C6403
+ if CAN_TEST_EMPTY_FILTER or gtest_filter != '':
+ SetEnvVar(FILTER_ENV_VAR, gtest_filter)
+ tests_run = RunAndExtractTestList()[0]
+ SetEnvVar(FILTER_ENV_VAR, None)
+ self.AssertSetEqual(tests_run, tests_to_run)
+ # pylint: enable-msg=C6403
+
+ # Next, tests using the command line flag.
+
+ if gtest_filter is None:
+ args = []
+ else:
+ args = ['--%s=%s' % (FILTER_FLAG, gtest_filter)]
+
+ tests_run = RunAndExtractTestList(args)[0]
+ self.AssertSetEqual(tests_run, tests_to_run)
+
+ def RunAndVerifyWithSharding(self, gtest_filter, total_shards, tests_to_run,
+ args=None, check_exit_0=False):
+ """Checks that binary runs correct tests for the given filter and shard.
+
+ Runs all shards of gtest_filter_unittest_ with the given filter, and
+ verifies that the right set of tests were run. The union of tests run
+ on each shard should be identical to tests_to_run, without duplicates.
+
+ Args:
+ gtest_filter: A filter to apply to the tests.
+ total_shards: A total number of shards to split test run into.
+ tests_to_run: A set of tests expected to run.
+ args : Arguments to pass to the to the test binary.
+ check_exit_0: When set to a true value, make sure that all shards
+ return 0.
+ """
+
+ tests_to_run = self.AdjustForParameterizedTests(tests_to_run)
+
+ # Windows removes empty variables from the environment when passing it
+ # to a new process. This means it is impossible to pass an empty filter
+ # into a process using the environment variable. However, we can still
+ # test the case when the variable is not supplied (i.e., gtest_filter is
+ # None).
+ # pylint: disable-msg=C6403
+ if CAN_TEST_EMPTY_FILTER or gtest_filter != '':
+ SetEnvVar(FILTER_ENV_VAR, gtest_filter)
+ partition = []
+ for i in range(0, total_shards):
+ (tests_run, exit_code) = RunWithSharding(total_shards, i, args)
+ if check_exit_0:
+ self.assertEqual(0, exit_code)
+ partition.append(tests_run)
+
+ self.AssertPartitionIsValid(tests_to_run, partition)
+ SetEnvVar(FILTER_ENV_VAR, None)
+ # pylint: enable-msg=C6403
+
+ def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run):
+ """Checks that the binary runs correct set of tests for the given filter.
+
+ Runs gtest_filter_unittest_ with the given filter, and enables
+ disabled tests. Verifies that the right set of tests were run.
+
+ Args:
+ gtest_filter: A filter to apply to the tests.
+ tests_to_run: A set of tests expected to run.
+ """
+
+ tests_to_run = self.AdjustForParameterizedTests(tests_to_run)
+
+ # Construct the command line.
+ args = ['--%s' % ALSO_RUN_DISABED_TESTS_FLAG]
+ if gtest_filter is not None:
+ args.append('--%s=%s' % (FILTER_FLAG, gtest_filter))
+
+ tests_run = RunAndExtractTestList(args)[0]
+ self.AssertSetEqual(tests_run, tests_to_run)
+
+ def setUp(self):
+ """Sets up test case.
+
+ Determines whether value-parameterized tests are enabled in the binary and
+ sets the flags accordingly.
+ """
+
+ global param_tests_present
+ if param_tests_present is None:
+ param_tests_present = PARAM_TEST_REGEX.search(
+ RunAndReturnOutput()) is not None
+
+ def testDefaultBehavior(self):
+ """Tests the behavior of not specifying the filter."""
+
+ self.RunAndVerify(None, ACTIVE_TESTS)
+
+ def testDefaultBehaviorWithShards(self):
+ """Tests the behavior without the filter, with sharding enabled."""
+
+ self.RunAndVerifyWithSharding(None, 1, ACTIVE_TESTS)
+ self.RunAndVerifyWithSharding(None, 2, ACTIVE_TESTS)
+ self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) - 1, ACTIVE_TESTS)
+ self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS), ACTIVE_TESTS)
+ self.RunAndVerifyWithSharding(None, len(ACTIVE_TESTS) + 1, ACTIVE_TESTS)
+
+ def testEmptyFilter(self):
+ """Tests an empty filter."""
+
+ self.RunAndVerify('', [])
+ self.RunAndVerifyWithSharding('', 1, [])
+ self.RunAndVerifyWithSharding('', 2, [])
+
+ def testBadFilter(self):
+ """Tests a filter that matches nothing."""
+
+ self.RunAndVerify('BadFilter', [])
+ self.RunAndVerifyAllowingDisabled('BadFilter', [])
+
+ def testFullName(self):
+ """Tests filtering by full name."""
+
+ self.RunAndVerify('FooTest.Xyz', ['FooTest.Xyz'])
+ self.RunAndVerifyAllowingDisabled('FooTest.Xyz', ['FooTest.Xyz'])
+ self.RunAndVerifyWithSharding('FooTest.Xyz', 5, ['FooTest.Xyz'])
+
+ def testUniversalFilters(self):
+ """Tests filters that match everything."""
+
+ self.RunAndVerify('*', ACTIVE_TESTS)
+ self.RunAndVerify('*.*', ACTIVE_TESTS)
+ self.RunAndVerifyWithSharding('*.*', len(ACTIVE_TESTS) - 3, ACTIVE_TESTS)
+ self.RunAndVerifyAllowingDisabled('*', ACTIVE_TESTS + DISABLED_TESTS)
+ self.RunAndVerifyAllowingDisabled('*.*', ACTIVE_TESTS + DISABLED_TESTS)
+
+ def testFilterByTestCase(self):
+ """Tests filtering by test case name."""
+
+ self.RunAndVerify('FooTest.*', ['FooTest.Abc', 'FooTest.Xyz'])
+
+ BAZ_TESTS = ['BazTest.TestOne', 'BazTest.TestA', 'BazTest.TestB']
+ self.RunAndVerify('BazTest.*', BAZ_TESTS)
+ self.RunAndVerifyAllowingDisabled('BazTest.*',
+ BAZ_TESTS + ['BazTest.DISABLED_TestC'])
+
+ def testFilterByTest(self):
+ """Tests filtering by test name."""
+
+ self.RunAndVerify('*.TestOne', ['BarTest.TestOne', 'BazTest.TestOne'])
+
+ def testFilterDisabledTests(self):
+ """Select only the disabled tests to run."""
+
+ self.RunAndVerify('DISABLED_FoobarTest.Test1', [])
+ self.RunAndVerifyAllowingDisabled('DISABLED_FoobarTest.Test1',
+ ['DISABLED_FoobarTest.Test1'])
+
+ self.RunAndVerify('*DISABLED_*', [])
+ self.RunAndVerifyAllowingDisabled('*DISABLED_*', DISABLED_TESTS)
+
+ self.RunAndVerify('*.DISABLED_*', [])
+ self.RunAndVerifyAllowingDisabled('*.DISABLED_*', [
+ 'BarTest.DISABLED_TestFour',
+ 'BarTest.DISABLED_TestFive',
+ 'BazTest.DISABLED_TestC',
+ 'DISABLED_FoobarTest.DISABLED_Test2',
+ ])
+
+ self.RunAndVerify('DISABLED_*', [])
+ self.RunAndVerifyAllowingDisabled('DISABLED_*', [
+ 'DISABLED_FoobarTest.Test1',
+ 'DISABLED_FoobarTest.DISABLED_Test2',
+ 'DISABLED_FoobarbazTest.TestA',
+ ])
+
+ def testWildcardInTestCaseName(self):
+ """Tests using wildcard in the test case name."""
+
+ self.RunAndVerify('*a*.*', [
+ 'BarTest.TestOne',
+ 'BarTest.TestTwo',
+ 'BarTest.TestThree',
+
+ 'BazTest.TestOne',
+ 'BazTest.TestA',
+ 'BazTest.TestB', ] + DEATH_TESTS + PARAM_TESTS)
+
+ def testWildcardInTestName(self):
+ """Tests using wildcard in the test name."""
+
+ self.RunAndVerify('*.*A*', ['FooTest.Abc', 'BazTest.TestA'])
+
+ def testFilterWithoutDot(self):
+ """Tests a filter that has no '.' in it."""
+
+ self.RunAndVerify('*z*', [
+ 'FooTest.Xyz',
+
+ 'BazTest.TestOne',
+ 'BazTest.TestA',
+ 'BazTest.TestB',
+ ])
+
+ def testTwoPatterns(self):
+ """Tests filters that consist of two patterns."""
+
+ self.RunAndVerify('Foo*.*:*A*', [
+ 'FooTest.Abc',
+ 'FooTest.Xyz',
+
+ 'BazTest.TestA',
+ ])
+
+ # An empty pattern + a non-empty one
+ self.RunAndVerify(':*A*', ['FooTest.Abc', 'BazTest.TestA'])
+
+ def testThreePatterns(self):
+ """Tests filters that consist of three patterns."""
+
+ self.RunAndVerify('*oo*:*A*:*One', [
+ 'FooTest.Abc',
+ 'FooTest.Xyz',
+
+ 'BarTest.TestOne',
+
+ 'BazTest.TestOne',
+ 'BazTest.TestA',
+ ])
+
+ # The 2nd pattern is empty.
+ self.RunAndVerify('*oo*::*One', [
+ 'FooTest.Abc',
+ 'FooTest.Xyz',
+
+ 'BarTest.TestOne',
+
+ 'BazTest.TestOne',
+ ])
+
+ # The last 2 patterns are empty.
+ self.RunAndVerify('*oo*::', [
+ 'FooTest.Abc',
+ 'FooTest.Xyz',
+ ])
+
+ def testNegativeFilters(self):
+ self.RunAndVerify('*-BazTest.TestOne', [
+ 'FooTest.Abc',
+ 'FooTest.Xyz',
+
+ 'BarTest.TestOne',
+ 'BarTest.TestTwo',
+ 'BarTest.TestThree',
+
+ 'BazTest.TestA',
+ 'BazTest.TestB',
+ ] + DEATH_TESTS + PARAM_TESTS)
+
+ self.RunAndVerify('*-FooTest.Abc:BazTest.*', [
+ 'FooTest.Xyz',
+
+ 'BarTest.TestOne',
+ 'BarTest.TestTwo',
+ 'BarTest.TestThree',
+ ] + DEATH_TESTS + PARAM_TESTS)
+
+ self.RunAndVerify('BarTest.*-BarTest.TestOne', [
+ 'BarTest.TestTwo',
+ 'BarTest.TestThree',
+ ])
+
+ # Tests without leading '*'.
+ self.RunAndVerify('-FooTest.Abc:FooTest.Xyz:BazTest.*', [
+ 'BarTest.TestOne',
+ 'BarTest.TestTwo',
+ 'BarTest.TestThree',
+ ] + DEATH_TESTS + PARAM_TESTS)
+
+ # Value parameterized tests.
+ self.RunAndVerify('*/*', PARAM_TESTS)
+
+ # Value parameterized tests filtering by the sequence name.
+ self.RunAndVerify('SeqP/*', [
+ 'SeqP/ParamTest.TestX/0',
+ 'SeqP/ParamTest.TestX/1',
+ 'SeqP/ParamTest.TestY/0',
+ 'SeqP/ParamTest.TestY/1',
+ ])
+
+ # Value parameterized tests filtering by the test name.
+ self.RunAndVerify('*/0', [
+ 'SeqP/ParamTest.TestX/0',
+ 'SeqP/ParamTest.TestY/0',
+ 'SeqQ/ParamTest.TestX/0',
+ 'SeqQ/ParamTest.TestY/0',
+ ])
+
+ def testFlagOverridesEnvVar(self):
+ """Tests that the filter flag overrides the filtering env. variable."""
+
+ SetEnvVar(FILTER_ENV_VAR, 'Foo*')
+ args = ['--%s=%s' % (FILTER_FLAG, '*One')]
+ tests_run = RunAndExtractTestList(args)[0]
+ SetEnvVar(FILTER_ENV_VAR, None)
+
+ self.AssertSetEqual(tests_run, ['BarTest.TestOne', 'BazTest.TestOne'])
+
+ def testShardStatusFileIsCreated(self):
+ """Tests that the shard file is created if specified in the environment."""
+
+ shard_status_file = os.path.join(gtest_test_utils.GetTempDir(),
+ 'shard_status_file')
+ self.assert_(not os.path.exists(shard_status_file))
+
+ extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file}
+ try:
+ InvokeWithModifiedEnv(extra_env, RunAndReturnOutput)
+ finally:
+ self.assert_(os.path.exists(shard_status_file))
+ os.remove(shard_status_file)
+
+ def testShardStatusFileIsCreatedWithListTests(self):
+ """Tests that the shard file is created with the "list_tests" flag."""
+
+ shard_status_file = os.path.join(gtest_test_utils.GetTempDir(),
+ 'shard_status_file2')
+ self.assert_(not os.path.exists(shard_status_file))
+
+ extra_env = {SHARD_STATUS_FILE_ENV_VAR: shard_status_file}
+ try:
+ output = InvokeWithModifiedEnv(extra_env,
+ RunAndReturnOutput,
+ [LIST_TESTS_FLAG])
+ finally:
+ # This assertion ensures that Google Test enumerated the tests as
+ # opposed to running them.
+ self.assert_('[==========]' not in output,
+ 'Unexpected output during test enumeration.\n'
+ 'Please ensure that LIST_TESTS_FLAG is assigned the\n'
+ 'correct flag value for listing Google Test tests.')
+
+ self.assert_(os.path.exists(shard_status_file))
+ os.remove(shard_status_file)
+
+ if SUPPORTS_DEATH_TESTS:
+ def testShardingWorksWithDeathTests(self):
+ """Tests integration with death tests and sharding."""
+
+ gtest_filter = 'HasDeathTest.*:SeqP/*'
+ expected_tests = [
+ 'HasDeathTest.Test1',
+ 'HasDeathTest.Test2',
+
+ 'SeqP/ParamTest.TestX/0',
+ 'SeqP/ParamTest.TestX/1',
+ 'SeqP/ParamTest.TestY/0',
+ 'SeqP/ParamTest.TestY/1',
+ ]
+
+ for flag in ['--gtest_death_test_style=threadsafe',
+ '--gtest_death_test_style=fast']:
+ self.RunAndVerifyWithSharding(gtest_filter, 3, expected_tests,
+ check_exit_0=True, args=[flag])
+ self.RunAndVerifyWithSharding(gtest_filter, 5, expected_tests,
+ check_exit_0=True, args=[flag])
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest_.cc
new file mode 100644
index 0000000..325504f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_filter_unittest_.cc
@@ -0,0 +1,140 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+
+// Unit test for Google Test test filters.
+//
+// A user can specify which test(s) in a Google Test program to run via
+// either the GTEST_FILTER environment variable or the --gtest_filter
+// flag. This is used for testing such functionality.
+//
+// The program will be invoked from a Python unit test. Don't run it
+// directly.
+
+#include <gtest/gtest.h>
+
+namespace {
+
+// Test case FooTest.
+
+class FooTest : public testing::Test {
+};
+
+TEST_F(FooTest, Abc) {
+}
+
+TEST_F(FooTest, Xyz) {
+ FAIL() << "Expected failure.";
+}
+
+// Test case BarTest.
+
+TEST(BarTest, TestOne) {
+}
+
+TEST(BarTest, TestTwo) {
+}
+
+TEST(BarTest, TestThree) {
+}
+
+TEST(BarTest, DISABLED_TestFour) {
+ FAIL() << "Expected failure.";
+}
+
+TEST(BarTest, DISABLED_TestFive) {
+ FAIL() << "Expected failure.";
+}
+
+// Test case BazTest.
+
+TEST(BazTest, TestOne) {
+ FAIL() << "Expected failure.";
+}
+
+TEST(BazTest, TestA) {
+}
+
+TEST(BazTest, TestB) {
+}
+
+TEST(BazTest, DISABLED_TestC) {
+ FAIL() << "Expected failure.";
+}
+
+// Test case HasDeathTest
+
+TEST(HasDeathTest, Test1) {
+ EXPECT_DEATH_IF_SUPPORTED(exit(1), ".*");
+}
+
+// We need at least two death tests to make sure that the all death tests
+// aren't on the first shard.
+TEST(HasDeathTest, Test2) {
+ EXPECT_DEATH_IF_SUPPORTED(exit(1), ".*");
+}
+
+// Test case FoobarTest
+
+TEST(DISABLED_FoobarTest, Test1) {
+ FAIL() << "Expected failure.";
+}
+
+TEST(DISABLED_FoobarTest, DISABLED_Test2) {
+ FAIL() << "Expected failure.";
+}
+
+// Test case FoobarbazTest
+
+TEST(DISABLED_FoobarbazTest, TestA) {
+ FAIL() << "Expected failure.";
+}
+
+#if GTEST_HAS_PARAM_TEST
+class ParamTest : public testing::TestWithParam<int> {
+};
+
+TEST_P(ParamTest, TestX) {
+}
+
+TEST_P(ParamTest, TestY) {
+}
+
+INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
+INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
+#endif // GTEST_HAS_PARAM_TEST
+
+} // namespace
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test.py
new file mode 100755
index 0000000..3cb4c48
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Tests the --help flag of Google C++ Testing Framework.
+
+SYNOPSIS
+ gtest_help_test.py --gtest_build_dir=BUILD/DIR
+ # where BUILD/DIR contains the built gtest_help_test_ file.
+ gtest_help_test.py
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import re
+import gtest_test_utils
+
+
+IS_WINDOWS = os.name == 'nt'
+
+PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_help_test_')
+FLAG_PREFIX = '--gtest_'
+CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions'
+DEATH_TEST_STYLE_FLAG = FLAG_PREFIX + 'death_test_style'
+UNKNOWN_FLAG = FLAG_PREFIX + 'unknown_flag_for_testing'
+LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests'
+INCORRECT_FLAG_VARIANTS = [re.sub('^--', '-', LIST_TESTS_FLAG),
+ re.sub('^--', '/', LIST_TESTS_FLAG),
+ re.sub('_', '-', LIST_TESTS_FLAG)]
+INTERNAL_FLAG_FOR_TESTING = FLAG_PREFIX + 'internal_flag_for_testing'
+
+SUPPORTS_DEATH_TESTS = "DeathTest" in gtest_test_utils.Subprocess(
+ [PROGRAM_PATH, LIST_TESTS_FLAG]).output
+
+# The help message must match this regex.
+HELP_REGEX = re.compile(
+ FLAG_PREFIX + r'list_tests.*' +
+ FLAG_PREFIX + r'filter=.*' +
+ FLAG_PREFIX + r'also_run_disabled_tests.*' +
+ FLAG_PREFIX + r'repeat=.*' +
+ FLAG_PREFIX + r'shuffle.*' +
+ FLAG_PREFIX + r'random_seed=.*' +
+ FLAG_PREFIX + r'color=.*' +
+ FLAG_PREFIX + r'print_time.*' +
+ FLAG_PREFIX + r'output=.*' +
+ FLAG_PREFIX + r'break_on_failure.*' +
+ FLAG_PREFIX + r'throw_on_failure.*',
+ re.DOTALL)
+
+
+def RunWithFlag(flag):
+ """Runs gtest_help_test_ with the given flag.
+
+ Returns:
+ the exit code and the text output as a tuple.
+ Args:
+ flag: the command-line flag to pass to gtest_help_test_, or None.
+ """
+
+ if flag is None:
+ command = [PROGRAM_PATH]
+ else:
+ command = [PROGRAM_PATH, flag]
+ child = gtest_test_utils.Subprocess(command)
+ return child.exit_code, child.output
+
+
+class GTestHelpTest(gtest_test_utils.TestCase):
+ """Tests the --help flag and its equivalent forms."""
+
+ def TestHelpFlag(self, flag):
+ """Verifies correct behavior when help flag is specified.
+
+ The right message must be printed and the tests must
+ skipped when the given flag is specified.
+
+ Args:
+ flag: A flag to pass to the binary or None.
+ """
+
+ exit_code, output = RunWithFlag(flag)
+ self.assertEquals(0, exit_code)
+ self.assert_(HELP_REGEX.search(output), output)
+ if IS_WINDOWS:
+ self.assert_(CATCH_EXCEPTIONS_FLAG in output, output)
+ else:
+ self.assert_(CATCH_EXCEPTIONS_FLAG not in output, output)
+
+ if SUPPORTS_DEATH_TESTS and not IS_WINDOWS:
+ self.assert_(DEATH_TEST_STYLE_FLAG in output, output)
+ else:
+ self.assert_(DEATH_TEST_STYLE_FLAG not in output, output)
+
+ def TestNonHelpFlag(self, flag):
+ """Verifies correct behavior when no help flag is specified.
+
+ Verifies that when no help flag is specified, the tests are run
+ and the help message is not printed.
+
+ Args:
+ flag: A flag to pass to the binary or None.
+ """
+
+ exit_code, output = RunWithFlag(flag)
+ self.assert_(exit_code != 0)
+ self.assert_(not HELP_REGEX.search(output), output)
+
+ def testPrintsHelpWithFullFlag(self):
+ self.TestHelpFlag('--help')
+
+ def testPrintsHelpWithShortFlag(self):
+ self.TestHelpFlag('-h')
+
+ def testPrintsHelpWithQuestionFlag(self):
+ self.TestHelpFlag('-?')
+
+ def testPrintsHelpWithWindowsStyleQuestionFlag(self):
+ self.TestHelpFlag('/?')
+
+ def testPrintsHelpWithUnrecognizedGoogleTestFlag(self):
+ self.TestHelpFlag(UNKNOWN_FLAG)
+
+ def testPrintsHelpWithIncorrectFlagStyle(self):
+ for incorrect_flag in INCORRECT_FLAG_VARIANTS:
+ self.TestHelpFlag(incorrect_flag)
+
+ def testRunsTestsWithoutHelpFlag(self):
+ """Verifies that when no help flag is specified, the tests are run
+ and the help message is not printed."""
+
+ self.TestNonHelpFlag(None)
+
+ def testRunsTestsWithGtestInternalFlag(self):
+ """Verifies that the tests are run and no help message is printed when
+ a flag starting with Google Test prefix and 'internal_' is supplied."""
+
+ self.TestNonHelpFlag(INTERNAL_FLAG_FOR_TESTING)
+
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test_.cc
new file mode 100644
index 0000000..aad0d72
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_help_test_.cc
@@ -0,0 +1,46 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// This program is meant to be run by gtest_help_test.py. Do not run
+// it directly.
+
+#include <gtest/gtest.h>
+
+// When a help flag is specified, this program should skip the tests
+// and exit with 0; otherwise the following test will be executed,
+// causing this program to exit with a non-zero code.
+TEST(HelpFlagTest, ShouldNotBeRun) {
+ ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified.";
+}
+
+#if GTEST_HAS_DEATH_TEST
+TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {}
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest.py
new file mode 100755
index 0000000..ce8c3ef
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest.py
@@ -0,0 +1,177 @@
+#!/usr/bin/env python
+#
+# Copyright 2006, 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.
+
+"""Unit test for Google Test's --gtest_list_tests flag.
+
+A user can ask Google Test to list all tests by specifying the
+--gtest_list_tests flag. This script tests such functionality
+by invoking gtest_list_tests_unittest_ (a program written with
+Google Test) the command line flags.
+"""
+
+__author__ = 'phanna@google.com (Patrick Hanna)'
+
+import gtest_test_utils
+
+
+# Constants.
+
+# The command line flag for enabling/disabling listing all tests.
+LIST_TESTS_FLAG = 'gtest_list_tests'
+
+# Path to the gtest_list_tests_unittest_ program.
+EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_list_tests_unittest_')
+
+# The expected output when running gtest_list_tests_unittest_ with
+# --gtest_list_tests
+EXPECTED_OUTPUT_NO_FILTER = """FooDeathTest.
+ Test1
+Foo.
+ Bar1
+ Bar2
+ DISABLED_Bar3
+Abc.
+ Xyz
+ Def
+FooBar.
+ Baz
+FooTest.
+ Test1
+ DISABLED_Test2
+ Test3
+"""
+
+# The expected output when running gtest_list_tests_unittest_ with
+# --gtest_list_tests and --gtest_filter=Foo*.
+EXPECTED_OUTPUT_FILTER_FOO = """FooDeathTest.
+ Test1
+Foo.
+ Bar1
+ Bar2
+ DISABLED_Bar3
+FooBar.
+ Baz
+FooTest.
+ Test1
+ DISABLED_Test2
+ Test3
+"""
+
+# Utilities.
+
+
+def Run(args):
+ """Runs gtest_list_tests_unittest_ and returns the list of tests printed."""
+
+ return gtest_test_utils.Subprocess([EXE_PATH] + args,
+ capture_stderr=False).output
+
+
+# The unit test.
+
+class GTestListTestsUnitTest(gtest_test_utils.TestCase):
+ """Tests using the --gtest_list_tests flag to list all tests."""
+
+ def RunAndVerify(self, flag_value, expected_output, other_flag):
+ """Runs gtest_list_tests_unittest_ and verifies that it prints
+ the correct tests.
+
+ Args:
+ flag_value: value of the --gtest_list_tests flag;
+ None if the flag should not be present.
+
+ expected_output: the expected output after running command;
+
+ other_flag: a different flag to be passed to command
+ along with gtest_list_tests;
+ None if the flag should not be present.
+ """
+
+ if flag_value is None:
+ flag = ''
+ flag_expression = 'not set'
+ elif flag_value == '0':
+ flag = '--%s=0' % LIST_TESTS_FLAG
+ flag_expression = '0'
+ else:
+ flag = '--%s' % LIST_TESTS_FLAG
+ flag_expression = '1'
+
+ args = [flag]
+
+ if other_flag is not None:
+ args += [other_flag]
+
+ output = Run(args)
+
+ msg = ('when %s is %s, the output of "%s" is "%s".' %
+ (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output))
+
+ if expected_output is not None:
+ self.assert_(output == expected_output, msg)
+ else:
+ self.assert_(output != EXPECTED_OUTPUT_NO_FILTER, msg)
+
+ def testDefaultBehavior(self):
+ """Tests the behavior of the default mode."""
+
+ self.RunAndVerify(flag_value=None,
+ expected_output=None,
+ other_flag=None)
+
+ def testFlag(self):
+ """Tests using the --gtest_list_tests flag."""
+
+ self.RunAndVerify(flag_value='0',
+ expected_output=None,
+ other_flag=None)
+ self.RunAndVerify(flag_value='1',
+ expected_output=EXPECTED_OUTPUT_NO_FILTER,
+ other_flag=None)
+
+ def testOverrideNonFilterFlags(self):
+ """Tests that --gtest_list_tests overrides the non-filter flags."""
+
+ self.RunAndVerify(flag_value='1',
+ expected_output=EXPECTED_OUTPUT_NO_FILTER,
+ other_flag='--gtest_break_on_failure')
+
+ def testWithFilterFlags(self):
+ """Tests that --gtest_list_tests takes into account the
+ --gtest_filter flag."""
+
+ self.RunAndVerify(flag_value='1',
+ expected_output=EXPECTED_OUTPUT_FILTER_FOO,
+ other_flag='--gtest_filter=Foo*')
+
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest_.cc
new file mode 100644
index 0000000..a0ed082
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest_.cc
@@ -0,0 +1,85 @@
+// Copyright 2006, 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: phanna@google.com (Patrick Hanna)
+
+// Unit test for Google Test's --gtest_list_tests flag.
+//
+// A user can ask Google Test to list all tests that will run
+// so that when using a filter, a user will know what
+// tests to look for. The tests will not be run after listing.
+//
+// This program will be invoked from a Python unit test.
+// Don't run it directly.
+
+#include <gtest/gtest.h>
+
+namespace {
+
+// Several different test cases and tests that will be listed.
+TEST(Foo, Bar1) {
+}
+
+TEST(Foo, Bar2) {
+}
+
+TEST(Foo, DISABLED_Bar3) {
+}
+
+TEST(Abc, Xyz) {
+}
+
+TEST(Abc, Def) {
+}
+
+TEST(FooBar, Baz) {
+}
+
+class FooTest : public testing::Test {
+};
+
+TEST_F(FooTest, Test1) {
+}
+
+TEST_F(FooTest, DISABLED_Test2) {
+}
+
+TEST_F(FooTest, Test3) {
+}
+
+TEST(FooDeathTest, Test1) {
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_main_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_main_unittest.cc
new file mode 100644
index 0000000..7a3f0ad
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_main_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 2006, 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: wan@google.com (Zhanyong Wan)
+
+#include <gtest/gtest.h>
+
+// Tests that we don't have to define main() when we link to
+// gtest_main instead of gtest.
+
+namespace {
+
+TEST(GTestMainTest, ShouldSucceed) {
+}
+
+} // namespace
+
+// We are using the main() function defined in src/gtest_main.cc, so
+// we don't define it here.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc.cc
new file mode 100644
index 0000000..73b5db6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc.cc
@@ -0,0 +1,234 @@
+// 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// This file is the input to a negative-compilation test for Google
+// Test. Code here is NOT supposed to compile. Its purpose is to
+// verify that certain incorrect usages of the Google Test API are
+// indeed rejected by the compiler.
+//
+// We still need to write the negative-compilation test itself, which
+// will be tightly coupled with the build environment.
+//
+// TODO(wan@google.com): finish the negative-compilation test.
+
+#ifdef TEST_CANNOT_IGNORE_RUN_ALL_TESTS_RESULT
+// Tests that the result of RUN_ALL_TESTS() cannot be ignored.
+
+#include <gtest/gtest.h>
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+ RUN_ALL_TESTS(); // This line shouldn't compile.
+}
+
+#elif defined(TEST_USER_CANNOT_INCLUDE_GTEST_INTERNAL_INL_H)
+// Tests that a user cannot include gtest-internal-inl.h in his code.
+
+#include "src/gtest-internal-inl.h"
+
+#elif defined(TEST_CATCHES_DECLARING_SETUP_IN_TEST_FIXTURE_WITH_TYPO)
+// Tests that the compiler catches the typo when a user declares a
+// Setup() method in a test fixture.
+
+#include <gtest/gtest.h>
+
+class MyTest : public testing::Test {
+ protected:
+ void Setup() {}
+};
+
+#elif defined(TEST_CATCHES_CALLING_SETUP_IN_TEST_WITH_TYPO)
+// Tests that the compiler catches the typo when a user calls Setup()
+// from a test fixture.
+
+#include <gtest/gtest.h>
+
+class MyTest : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ testing::Test::Setup(); // Tries to call SetUp() in the parent class.
+ }
+};
+
+#elif defined(TEST_CATCHES_DECLARING_SETUP_IN_ENVIRONMENT_WITH_TYPO)
+// Tests that the compiler catches the typo when a user declares a
+// Setup() method in a subclass of Environment.
+
+#include <gtest/gtest.h>
+
+class MyEnvironment : public testing::Environment {
+ public:
+ void Setup() {}
+};
+
+#elif defined(TEST_CATCHES_CALLING_SETUP_IN_ENVIRONMENT_WITH_TYPO)
+// Tests that the compiler catches the typo when a user calls Setup()
+// in an Environment.
+
+#include <gtest/gtest.h>
+
+class MyEnvironment : public testing::Environment {
+ protected:
+ virtual void SetUp() {
+ // Tries to call SetUp() in the parent class.
+ testing::Environment::Setup();
+ }
+};
+
+#elif defined(TEST_CATCHES_WRONG_CASE_IN_TYPED_TEST_P)
+// Tests that the compiler catches using the wrong test case name in
+// TYPED_TEST_P.
+
+#include <gtest/gtest.h>
+
+template <typename T>
+class FooTest : public testing::Test {
+};
+
+template <typename T>
+class BarTest : public testing::Test {
+};
+
+TYPED_TEST_CASE_P(FooTest);
+TYPED_TEST_P(BarTest, A) {} // Wrong test case name.
+REGISTER_TYPED_TEST_CASE_P(FooTest, A);
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>);
+
+#elif defined(TEST_CATCHES_WRONG_CASE_IN_REGISTER_TYPED_TEST_CASE_P)
+// Tests that the compiler catches using the wrong test case name in
+// REGISTER_TYPED_TEST_CASE_P.
+
+#include <gtest/gtest.h>
+
+template <typename T>
+class FooTest : public testing::Test {
+};
+
+template <typename T>
+class BarTest : public testing::Test {
+};
+
+TYPED_TEST_CASE_P(FooTest);
+TYPED_TEST_P(FooTest, A) {}
+REGISTER_TYPED_TEST_CASE_P(BarTest, A); // Wrong test case name.
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>);
+
+#elif defined(TEST_CATCHES_WRONG_CASE_IN_INSTANTIATE_TYPED_TEST_CASE_P)
+// Tests that the compiler catches using the wrong test case name in
+// INSTANTIATE_TYPED_TEST_CASE_P.
+
+#include <gtest/gtest.h>
+
+template <typename T>
+class FooTest : public testing::Test {
+};
+
+template <typename T>
+class BarTest : public testing::Test {
+};
+
+TYPED_TEST_CASE_P(FooTest);
+TYPED_TEST_P(FooTest, A) {}
+REGISTER_TYPED_TEST_CASE_P(FooTest, A);
+
+// Wrong test case name.
+INSTANTIATE_TYPED_TEST_CASE_P(My, BarTest, testing::Types<int>);
+
+#elif defined(TEST_CATCHES_INSTANTIATE_TYPED_TESET_CASE_P_WITH_SAME_NAME_PREFIX)
+// Tests that the compiler catches instantiating TYPED_TEST_CASE_P
+// twice with the same name prefix.
+
+#include <gtest/gtest.h>
+
+template <typename T>
+class FooTest : public testing::Test {
+};
+
+TYPED_TEST_CASE_P(FooTest);
+TYPED_TEST_P(FooTest, A) {}
+REGISTER_TYPED_TEST_CASE_P(FooTest, A);
+
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>);
+
+// Wrong name prefix: "My" has been used.
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<double>);
+
+#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE)
+
+#include <gtest/gtest.h>
+
+// Tests that StaticAssertTypeEq<T1, T2> cannot be used as a type.
+testing::StaticAssertTypeEq<int, int> dummy;
+
+#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE)
+
+#include <gtest/gtest.h>
+
+// Tests that StaticAssertTypeEq<T1, T2> works in a namespace scope.
+static bool dummy = testing::StaticAssertTypeEq<int, const int>();
+
+#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS)
+
+#include <gtest/gtest.h>
+
+template <typename T>
+class Helper {
+ public:
+ // Tests that StaticAssertTypeEq<T1, T2> works in a class.
+ Helper() { testing::StaticAssertTypeEq<int, T>(); }
+
+ void DoSomething() {}
+};
+
+void Test() {
+ Helper<bool> h;
+ h.DoSomething(); // To avoid the "unused variable" warning.
+}
+
+#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION)
+
+#include <gtest/gtest.h>
+
+void Test() {
+ // Tests that StaticAssertTypeEq<T1, T2> works inside a function.
+ testing::StaticAssertTypeEq<const int, int>();
+}
+
+#else
+// A sanity test. This should compile.
+
+#include <gtest/gtest.h>
+
+int main() {
+ return RUN_ALL_TESTS();
+}
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc_test.py
new file mode 100755
index 0000000..06ffb3f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_nc_test.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+#
+# 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.
+
+"""Negative compilation test for Google Test."""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import sys
+import unittest
+
+
+IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
+if not IS_LINUX:
+ sys.exit(0) # Negative compilation tests are not supported on Windows & Mac.
+
+
+class GTestNCTest(unittest.TestCase):
+ """Negative compilation test for Google Test."""
+
+ def testCompilerError(self):
+ """Verifies that erroneous code leads to expected compiler
+ messages."""
+
+ # Defines a list of test specs, where each element is a tuple
+ # (test name, list of regexes for matching the compiler errors).
+ test_specs = [
+ ('CANNOT_IGNORE_RUN_ALL_TESTS_RESULT',
+ [r'ignoring return value']),
+
+ ('USER_CANNOT_INCLUDE_GTEST_INTERNAL_INL_H',
+ [r'must not be included except by Google Test itself']),
+
+ ('CATCHES_DECLARING_SETUP_IN_TEST_FIXTURE_WITH_TYPO',
+ [r'Setup_should_be_spelled_SetUp']),
+
+ ('CATCHES_CALLING_SETUP_IN_TEST_WITH_TYPO',
+ [r'Setup_should_be_spelled_SetUp']),
+
+ ('CATCHES_DECLARING_SETUP_IN_ENVIRONMENT_WITH_TYPO',
+ [r'Setup_should_be_spelled_SetUp']),
+
+ ('CATCHES_CALLING_SETUP_IN_ENVIRONMENT_WITH_TYPO',
+ [r'Setup_should_be_spelled_SetUp']),
+
+ ('CATCHES_WRONG_CASE_IN_TYPED_TEST_P',
+ [r'BarTest.*was not declared']),
+
+ ('CATCHES_WRONG_CASE_IN_REGISTER_TYPED_TEST_CASE_P',
+ [r'BarTest.*was not declared']),
+
+ ('CATCHES_WRONG_CASE_IN_INSTANTIATE_TYPED_TEST_CASE_P',
+ [r'BarTest.*not declared']),
+
+ ('CATCHES_INSTANTIATE_TYPED_TESET_CASE_P_WITH_SAME_NAME_PREFIX',
+ [r'redefinition of.*My.*FooTest']),
+
+ ('STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE',
+ [r'StaticAssertTypeEq.* does not name a type']),
+
+ ('STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE',
+ [r'StaticAssertTypeEq.*int.*const int']),
+
+ ('STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS',
+ [r'StaticAssertTypeEq.*int.*bool']),
+
+ ('STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION',
+ [r'StaticAssertTypeEq.*const int.*int']),
+
+ ('SANITY',
+ None)
+ ]
+
+ # TODO(wan@google.com): verify that the test specs are satisfied.
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_no_test_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_no_test_unittest.cc
new file mode 100644
index 0000000..afe2dc0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_no_test_unittest.cc
@@ -0,0 +1,54 @@
+// Copyright 2006, 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.
+
+// Tests that a Google Test program that has no test defined can run
+// successfully.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <gtest/gtest.h>
+
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ // An ad-hoc assertion outside of all tests.
+ //
+ // This serves two purposes:
+ //
+ // 1. It verifies that an ad-hoc assertion can be executed even if
+ // no test is defined.
+ // 2. We had a bug where the XML output won't be generated if an
+ // assertion is executed before RUN_ALL_TESTS() is called, even
+ // though --gtest_output=xml is specified. This makes sure the
+ // bug is fixed and doesn't regress.
+ EXPECT_EQ(1, 1);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test.py
new file mode 100755
index 0000000..192030a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test.py
@@ -0,0 +1,327 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Tests the text output of Google C++ Testing Framework.
+
+SYNOPSIS
+ gtest_output_test.py --gtest_build_dir=BUILD/DIR --gengolden
+ # where BUILD/DIR contains the built gtest_output_test_ file.
+ gtest_output_test.py --gengolden
+ gtest_output_test.py
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import re
+import sys
+import gtest_test_utils
+
+
+# The flag for generating the golden file
+GENGOLDEN_FLAG = '--gengolden'
+CATCH_EXCEPTIONS_ENV_VAR_NAME = 'GTEST_CATCH_EXCEPTIONS'
+
+IS_WINDOWS = os.name == 'nt'
+
+if IS_WINDOWS:
+ GOLDEN_NAME = 'gtest_output_test_golden_win.txt'
+else:
+ GOLDEN_NAME = 'gtest_output_test_golden_lin.txt'
+
+PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_')
+
+# At least one command we exercise must not have the
+# --gtest_internal_skip_environment_and_ad_hoc_tests flag.
+COMMAND_LIST_TESTS = ({}, [PROGRAM_PATH, '--gtest_list_tests'])
+COMMAND_WITH_COLOR = ({}, [PROGRAM_PATH, '--gtest_color=yes'])
+COMMAND_WITH_TIME = ({}, [PROGRAM_PATH,
+ '--gtest_print_time',
+ '--gtest_internal_skip_environment_and_ad_hoc_tests',
+ '--gtest_filter=FatalFailureTest.*:LoggingTest.*'])
+COMMAND_WITH_DISABLED = (
+ {}, [PROGRAM_PATH,
+ '--gtest_also_run_disabled_tests',
+ '--gtest_internal_skip_environment_and_ad_hoc_tests',
+ '--gtest_filter=*DISABLED_*'])
+COMMAND_WITH_SHARDING = (
+ {'GTEST_SHARD_INDEX': '1', 'GTEST_TOTAL_SHARDS': '2'},
+ [PROGRAM_PATH,
+ '--gtest_internal_skip_environment_and_ad_hoc_tests',
+ '--gtest_filter=PassingTest.*'])
+
+GOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(), GOLDEN_NAME)
+
+
+def ToUnixLineEnding(s):
+ """Changes all Windows/Mac line endings in s to UNIX line endings."""
+
+ return s.replace('\r\n', '\n').replace('\r', '\n')
+
+
+def RemoveLocations(test_output):
+ """Removes all file location info from a Google Test program's output.
+
+ Args:
+ test_output: the output of a Google Test program.
+
+ Returns:
+ output with all file location info (in the form of
+ 'DIRECTORY/FILE_NAME:LINE_NUMBER: 'or
+ 'DIRECTORY\\FILE_NAME(LINE_NUMBER): ') replaced by
+ 'FILE_NAME:#: '.
+ """
+
+ return re.sub(r'.*[/\\](.+)(\:\d+|\(\d+\))\: ', r'\1:#: ', test_output)
+
+
+def RemoveStackTraceDetails(output):
+ """Removes all stack traces from a Google Test program's output."""
+
+ # *? means "find the shortest string that matches".
+ return re.sub(r'Stack trace:(.|\n)*?\n\n',
+ 'Stack trace: (omitted)\n\n', output)
+
+
+def RemoveStackTraces(output):
+ """Removes all traces of stack traces from a Google Test program's output."""
+
+ # *? means "find the shortest string that matches".
+ return re.sub(r'Stack trace:(.|\n)*?\n\n', '', output)
+
+
+def RemoveTime(output):
+ """Removes all time information from a Google Test program's output."""
+
+ return re.sub(r'\(\d+ ms', '(? ms', output)
+
+
+def RemoveTypeInfoDetails(test_output):
+ """Removes compiler-specific type info from Google Test program's output.
+
+ Args:
+ test_output: the output of a Google Test program.
+
+ Returns:
+ output with type information normalized to canonical form.
+ """
+
+ # some compilers output the name of type 'unsigned int' as 'unsigned'
+ return re.sub(r'unsigned int', 'unsigned', test_output)
+
+
+def RemoveTestCounts(output):
+ """Removes test counts from a Google Test program's output."""
+
+ output = re.sub(r'\d+ tests?, listed below',
+ '? tests, listed below', output)
+ output = re.sub(r'\d+ FAILED TESTS',
+ '? FAILED TESTS', output)
+ output = re.sub(r'\d+ tests? from \d+ test cases?',
+ '? tests from ? test cases', output)
+ output = re.sub(r'\d+ tests? from ([a-zA-Z_])',
+ r'? tests from \1', output)
+ return re.sub(r'\d+ tests?\.', '? tests.', output)
+
+
+def RemoveMatchingTests(test_output, pattern):
+ """Removes output of specified tests from a Google Test program's output.
+
+ This function strips not only the beginning and the end of a test but also
+ all output in between.
+
+ Args:
+ test_output: A string containing the test output.
+ pattern: A regex string that matches names of test cases or
+ tests to remove.
+
+ Returns:
+ Contents of test_output with tests whose names match pattern removed.
+ """
+
+ test_output = re.sub(
+ r'.*\[ RUN \] .*%s(.|\n)*?\[( FAILED | OK )\] .*%s.*\n' % (
+ pattern, pattern),
+ '',
+ test_output)
+ return re.sub(r'.*%s.*\n' % pattern, '', test_output)
+
+
+def NormalizeOutput(output):
+ """Normalizes output (the output of gtest_output_test_.exe)."""
+
+ output = ToUnixLineEnding(output)
+ output = RemoveLocations(output)
+ output = RemoveStackTraceDetails(output)
+ output = RemoveTime(output)
+ return output
+
+
+def GetShellCommandOutput(env_cmd):
+ """Runs a command in a sub-process, and returns its output in a string.
+
+ Args:
+ env_cmd: The shell command. A 2-tuple where element 0 is a dict of extra
+ environment variables to set, and element 1 is a string with
+ the command and any flags.
+
+ Returns:
+ A string with the command's combined standard and diagnostic output.
+ """
+
+ # Spawns cmd in a sub-process, and gets its standard I/O file objects.
+ # Set and save the environment properly.
+ environ = os.environ.copy()
+ environ.update(env_cmd[0])
+ p = gtest_test_utils.Subprocess(env_cmd[1], env=environ)
+
+ return p.output
+
+
+def GetCommandOutput(env_cmd):
+ """Runs a command and returns its output with all file location
+ info stripped off.
+
+ Args:
+ env_cmd: The shell command. A 2-tuple where element 0 is a dict of extra
+ environment variables to set, and element 1 is a string with
+ the command and any flags.
+ """
+
+ # Disables exception pop-ups on Windows.
+ environ, cmdline = env_cmd
+ environ = dict(environ) # Ensures we are modifying a copy.
+ environ[CATCH_EXCEPTIONS_ENV_VAR_NAME] = '1'
+ return NormalizeOutput(GetShellCommandOutput((environ, cmdline)))
+
+
+def GetOutputOfAllCommands():
+ """Returns concatenated output from several representative commands."""
+
+ return (GetCommandOutput(COMMAND_WITH_COLOR) +
+ GetCommandOutput(COMMAND_WITH_TIME) +
+ GetCommandOutput(COMMAND_WITH_DISABLED) +
+ GetCommandOutput(COMMAND_WITH_SHARDING))
+
+
+test_list = GetShellCommandOutput(COMMAND_LIST_TESTS)
+SUPPORTS_DEATH_TESTS = 'DeathTest' in test_list
+SUPPORTS_TYPED_TESTS = 'TypedTest' in test_list
+SUPPORTS_THREADS = 'ExpectFailureWithThreadsTest' in test_list
+SUPPORTS_STACK_TRACES = False
+
+CAN_GENERATE_GOLDEN_FILE = (SUPPORTS_DEATH_TESTS and
+ SUPPORTS_TYPED_TESTS and
+ SUPPORTS_THREADS)
+
+
+class GTestOutputTest(gtest_test_utils.TestCase):
+ def RemoveUnsupportedTests(self, test_output):
+ if not SUPPORTS_DEATH_TESTS:
+ test_output = RemoveMatchingTests(test_output, 'DeathTest')
+ if not SUPPORTS_TYPED_TESTS:
+ test_output = RemoveMatchingTests(test_output, 'TypedTest')
+ test_output = RemoveMatchingTests(test_output, 'TypedDeathTest')
+ test_output = RemoveMatchingTests(test_output, 'TypeParamDeathTest')
+ if not SUPPORTS_THREADS:
+ test_output = RemoveMatchingTests(test_output,
+ 'ExpectFailureWithThreadsTest')
+ test_output = RemoveMatchingTests(test_output,
+ 'ScopedFakeTestPartResultReporterTest')
+ test_output = RemoveMatchingTests(test_output,
+ 'WorksConcurrently')
+ if not SUPPORTS_STACK_TRACES:
+ test_output = RemoveStackTraces(test_output)
+
+ return test_output
+
+ def testOutput(self):
+ output = GetOutputOfAllCommands()
+
+ golden_file = open(GOLDEN_PATH, 'rb')
+ # A mis-configured source control system can cause \r appear in EOL
+ # sequences when we read the golden file irrespective of an operating
+ # system used. Therefore, we need to strip those \r's from newlines
+ # unconditionally.
+ golden = ToUnixLineEnding(golden_file.read())
+ golden_file.close()
+
+ # We want the test to pass regardless of certain features being
+ # supported or not.
+
+ # We still have to remove type name specifics in all cases.
+ normalized_actual = RemoveTypeInfoDetails(output)
+ normalized_golden = RemoveTypeInfoDetails(golden)
+
+ if CAN_GENERATE_GOLDEN_FILE:
+ self.assertEqual(normalized_golden, normalized_actual)
+ else:
+ normalized_actual = RemoveTestCounts(normalized_actual)
+ normalized_golden = RemoveTestCounts(self.RemoveUnsupportedTests(
+ normalized_golden))
+
+ # This code is very handy when debugging golden file differences:
+ if os.getenv('DEBUG_GTEST_OUTPUT_TEST'):
+ open(os.path.join(
+ gtest_test_utils.GetSourceDir(),
+ '_gtest_output_test_normalized_actual.txt'), 'wb').write(
+ normalized_actual)
+ open(os.path.join(
+ gtest_test_utils.GetSourceDir(),
+ '_gtest_output_test_normalized_golden.txt'), 'wb').write(
+ normalized_golden)
+
+ self.assertEqual(normalized_golden, normalized_actual)
+
+
+if __name__ == '__main__':
+ if sys.argv[1:] == [GENGOLDEN_FLAG]:
+ if CAN_GENERATE_GOLDEN_FILE:
+ output = GetOutputOfAllCommands()
+ golden_file = open(GOLDEN_PATH, 'wb')
+ golden_file.write(output)
+ golden_file.close()
+ else:
+ message = (
+ """Unable to write a golden file when compiled in an environment
+that does not support all the required features (death tests""")
+ if IS_WINDOWS:
+ message += (
+ """\nand typed tests). Please check that you are using VC++ 8.0 SP1
+or higher as your compiler.""")
+ else:
+ message += """\ntyped tests, and threads). Please generate the
+golden file using a binary built with those features enabled."""
+
+ sys.stderr.write(message)
+ sys.exit(1)
+ else:
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_.cc
new file mode 100644
index 0000000..273e8e9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_.cc
@@ -0,0 +1,1135 @@
+// Copyright 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.
+//
+// A unit test for Google Test itself. This verifies that the basic
+// constructs of Google Test work.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <gtest/gtest-spi.h>
+#include <gtest/gtest.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+#include <stdlib.h>
+
+#if GTEST_IS_THREADSAFE
+using testing::ScopedFakeTestPartResultReporter;
+using testing::TestPartResultArray;
+
+using testing::internal::Notification;
+using testing::internal::ThreadWithParam;
+#endif
+
+namespace posix = ::testing::internal::posix;
+using testing::internal::String;
+using testing::internal::scoped_ptr;
+
+// Tests catching fatal failures.
+
+// A subroutine used by the following test.
+void TestEq1(int x) {
+ ASSERT_EQ(1, x);
+}
+
+// This function calls a test subroutine, catches the fatal failure it
+// generates, and then returns early.
+void TryTestSubroutine() {
+ // Calls a subrountine that yields a fatal failure.
+ TestEq1(2);
+
+ // Catches the fatal failure and aborts the test.
+ //
+ // The testing::Test:: prefix is necessary when calling
+ // HasFatalFailure() outside of a TEST, TEST_F, or test fixture.
+ if (testing::Test::HasFatalFailure()) return;
+
+ // If we get here, something is wrong.
+ FAIL() << "This should never be reached.";
+}
+
+TEST(PassingTest, PassingTest1) {
+}
+
+TEST(PassingTest, PassingTest2) {
+}
+
+// Tests catching a fatal failure in a subroutine.
+TEST(FatalFailureTest, FatalFailureInSubroutine) {
+ printf("(expecting a failure that x should be 1)\n");
+
+ TryTestSubroutine();
+}
+
+// Tests catching a fatal failure in a nested subroutine.
+TEST(FatalFailureTest, FatalFailureInNestedSubroutine) {
+ printf("(expecting a failure that x should be 1)\n");
+
+ // Calls a subrountine that yields a fatal failure.
+ TryTestSubroutine();
+
+ // Catches the fatal failure and aborts the test.
+ //
+ // When calling HasFatalFailure() inside a TEST, TEST_F, or test
+ // fixture, the testing::Test:: prefix is not needed.
+ if (HasFatalFailure()) return;
+
+ // If we get here, something is wrong.
+ FAIL() << "This should never be reached.";
+}
+
+// Tests HasFatalFailure() after a failed EXPECT check.
+TEST(FatalFailureTest, NonfatalFailureInSubroutine) {
+ printf("(expecting a failure on false)\n");
+ EXPECT_TRUE(false); // Generates a nonfatal failure
+ ASSERT_FALSE(HasFatalFailure()); // This should succeed.
+}
+
+// Tests interleaving user logging and Google Test assertions.
+TEST(LoggingTest, InterleavingLoggingAndAssertions) {
+ static const int a[4] = {
+ 3, 9, 2, 6
+ };
+
+ printf("(expecting 2 failures on (3) >= (a[i]))\n");
+ for (int i = 0; i < static_cast<int>(sizeof(a)/sizeof(*a)); i++) {
+ printf("i == %d\n", i);
+ EXPECT_GE(3, a[i]);
+ }
+}
+
+// Tests the SCOPED_TRACE macro.
+
+// A helper function for testing SCOPED_TRACE.
+void SubWithoutTrace(int n) {
+ EXPECT_EQ(1, n);
+ ASSERT_EQ(2, n);
+}
+
+// Another helper function for testing SCOPED_TRACE.
+void SubWithTrace(int n) {
+ SCOPED_TRACE(testing::Message() << "n = " << n);
+
+ SubWithoutTrace(n);
+}
+
+// Tests that SCOPED_TRACE() obeys lexical scopes.
+TEST(SCOPED_TRACETest, ObeysScopes) {
+ printf("(expected to fail)\n");
+
+ // There should be no trace before SCOPED_TRACE() is invoked.
+ ADD_FAILURE() << "This failure is expected, and shouldn't have a trace.";
+
+ {
+ SCOPED_TRACE("Expected trace");
+ // After SCOPED_TRACE(), a failure in the current scope should contain
+ // the trace.
+ ADD_FAILURE() << "This failure is expected, and should have a trace.";
+ }
+
+ // Once the control leaves the scope of the SCOPED_TRACE(), there
+ // should be no trace again.
+ ADD_FAILURE() << "This failure is expected, and shouldn't have a trace.";
+}
+
+// Tests that SCOPED_TRACE works inside a loop.
+TEST(SCOPED_TRACETest, WorksInLoop) {
+ printf("(expected to fail)\n");
+
+ for (int i = 1; i <= 2; i++) {
+ SCOPED_TRACE(testing::Message() << "i = " << i);
+
+ SubWithoutTrace(i);
+ }
+}
+
+// Tests that SCOPED_TRACE works in a subroutine.
+TEST(SCOPED_TRACETest, WorksInSubroutine) {
+ printf("(expected to fail)\n");
+
+ SubWithTrace(1);
+ SubWithTrace(2);
+}
+
+// Tests that SCOPED_TRACE can be nested.
+TEST(SCOPED_TRACETest, CanBeNested) {
+ printf("(expected to fail)\n");
+
+ SCOPED_TRACE(""); // A trace without a message.
+
+ SubWithTrace(2);
+}
+
+// Tests that multiple SCOPED_TRACEs can be used in the same scope.
+TEST(SCOPED_TRACETest, CanBeRepeated) {
+ printf("(expected to fail)\n");
+
+ SCOPED_TRACE("A");
+ ADD_FAILURE()
+ << "This failure is expected, and should contain trace point A.";
+
+ SCOPED_TRACE("B");
+ ADD_FAILURE()
+ << "This failure is expected, and should contain trace point A and B.";
+
+ {
+ SCOPED_TRACE("C");
+ ADD_FAILURE() << "This failure is expected, and should contain "
+ << "trace point A, B, and C.";
+ }
+
+ SCOPED_TRACE("D");
+ ADD_FAILURE() << "This failure is expected, and should contain "
+ << "trace point A, B, and D.";
+}
+
+#if GTEST_IS_THREADSAFE
+// Tests that SCOPED_TRACE()s can be used concurrently from multiple
+// threads. Namely, an assertion should be affected by
+// SCOPED_TRACE()s in its own thread only.
+
+// Here's the sequence of actions that happen in the test:
+//
+// Thread A (main) | Thread B (spawned)
+// ===============================|================================
+// spawns thread B |
+// -------------------------------+--------------------------------
+// waits for n1 | SCOPED_TRACE("Trace B");
+// | generates failure #1
+// | notifies n1
+// -------------------------------+--------------------------------
+// SCOPED_TRACE("Trace A"); | waits for n2
+// generates failure #2 |
+// notifies n2 |
+// -------------------------------|--------------------------------
+// waits for n3 | generates failure #3
+// | trace B dies
+// | generates failure #4
+// | notifies n3
+// -------------------------------|--------------------------------
+// generates failure #5 | finishes
+// trace A dies |
+// generates failure #6 |
+// -------------------------------|--------------------------------
+// waits for thread B to finish |
+
+struct CheckPoints {
+ Notification n1;
+ Notification n2;
+ Notification n3;
+};
+
+static void ThreadWithScopedTrace(CheckPoints* check_points) {
+ {
+ SCOPED_TRACE("Trace B");
+ ADD_FAILURE()
+ << "Expected failure #1 (in thread B, only trace B alive).";
+ check_points->n1.Notify();
+ check_points->n2.WaitForNotification();
+
+ ADD_FAILURE()
+ << "Expected failure #3 (in thread B, trace A & B both alive).";
+ } // Trace B dies here.
+ ADD_FAILURE()
+ << "Expected failure #4 (in thread B, only trace A alive).";
+ check_points->n3.Notify();
+}
+
+TEST(SCOPED_TRACETest, WorksConcurrently) {
+ printf("(expecting 6 failures)\n");
+
+ CheckPoints check_points;
+ ThreadWithParam<CheckPoints*> thread(&ThreadWithScopedTrace,
+ &check_points,
+ NULL);
+ check_points.n1.WaitForNotification();
+
+ {
+ SCOPED_TRACE("Trace A");
+ ADD_FAILURE()
+ << "Expected failure #2 (in thread A, trace A & B both alive).";
+ check_points.n2.Notify();
+ check_points.n3.WaitForNotification();
+
+ ADD_FAILURE()
+ << "Expected failure #5 (in thread A, only trace A alive).";
+ } // Trace A dies here.
+ ADD_FAILURE()
+ << "Expected failure #6 (in thread A, no trace alive).";
+ thread.Join();
+}
+#endif // GTEST_IS_THREADSAFE
+
+TEST(DisabledTestsWarningTest,
+ DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning) {
+ // This test body is intentionally empty. Its sole purpose is for
+ // verifying that the --gtest_also_run_disabled_tests flag
+ // suppresses the "YOU HAVE 12 DISABLED TESTS" warning at the end of
+ // the test output.
+}
+
+// Tests using assertions outside of TEST and TEST_F.
+//
+// This function creates two failures intentionally.
+void AdHocTest() {
+ printf("The non-test part of the code is expected to have 2 failures.\n\n");
+ EXPECT_TRUE(false);
+ EXPECT_EQ(2, 3);
+}
+
+// Runs all TESTs, all TEST_Fs, and the ad hoc test.
+int RunAllTests() {
+ AdHocTest();
+ return RUN_ALL_TESTS();
+}
+
+// Tests non-fatal failures in the fixture constructor.
+class NonFatalFailureInFixtureConstructorTest : public testing::Test {
+ protected:
+ NonFatalFailureInFixtureConstructorTest() {
+ printf("(expecting 5 failures)\n");
+ ADD_FAILURE() << "Expected failure #1, in the test fixture c'tor.";
+ }
+
+ ~NonFatalFailureInFixtureConstructorTest() {
+ ADD_FAILURE() << "Expected failure #5, in the test fixture d'tor.";
+ }
+
+ virtual void SetUp() {
+ ADD_FAILURE() << "Expected failure #2, in SetUp().";
+ }
+
+ virtual void TearDown() {
+ ADD_FAILURE() << "Expected failure #4, in TearDown.";
+ }
+};
+
+TEST_F(NonFatalFailureInFixtureConstructorTest, FailureInConstructor) {
+ ADD_FAILURE() << "Expected failure #3, in the test body.";
+}
+
+// Tests fatal failures in the fixture constructor.
+class FatalFailureInFixtureConstructorTest : public testing::Test {
+ protected:
+ FatalFailureInFixtureConstructorTest() {
+ printf("(expecting 2 failures)\n");
+ Init();
+ }
+
+ ~FatalFailureInFixtureConstructorTest() {
+ ADD_FAILURE() << "Expected failure #2, in the test fixture d'tor.";
+ }
+
+ virtual void SetUp() {
+ ADD_FAILURE() << "UNEXPECTED failure in SetUp(). "
+ << "We should never get here, as the test fixture c'tor "
+ << "had a fatal failure.";
+ }
+
+ virtual void TearDown() {
+ ADD_FAILURE() << "UNEXPECTED failure in TearDown(). "
+ << "We should never get here, as the test fixture c'tor "
+ << "had a fatal failure.";
+ }
+ private:
+ void Init() {
+ FAIL() << "Expected failure #1, in the test fixture c'tor.";
+ }
+};
+
+TEST_F(FatalFailureInFixtureConstructorTest, FailureInConstructor) {
+ ADD_FAILURE() << "UNEXPECTED failure in the test body. "
+ << "We should never get here, as the test fixture c'tor "
+ << "had a fatal failure.";
+}
+
+// Tests non-fatal failures in SetUp().
+class NonFatalFailureInSetUpTest : public testing::Test {
+ protected:
+ virtual ~NonFatalFailureInSetUpTest() {
+ Deinit();
+ }
+
+ virtual void SetUp() {
+ printf("(expecting 4 failures)\n");
+ ADD_FAILURE() << "Expected failure #1, in SetUp().";
+ }
+
+ virtual void TearDown() {
+ FAIL() << "Expected failure #3, in TearDown().";
+ }
+ private:
+ void Deinit() {
+ FAIL() << "Expected failure #4, in the test fixture d'tor.";
+ }
+};
+
+TEST_F(NonFatalFailureInSetUpTest, FailureInSetUp) {
+ FAIL() << "Expected failure #2, in the test function.";
+}
+
+// Tests fatal failures in SetUp().
+class FatalFailureInSetUpTest : public testing::Test {
+ protected:
+ virtual ~FatalFailureInSetUpTest() {
+ Deinit();
+ }
+
+ virtual void SetUp() {
+ printf("(expecting 3 failures)\n");
+ FAIL() << "Expected failure #1, in SetUp().";
+ }
+
+ virtual void TearDown() {
+ FAIL() << "Expected failure #2, in TearDown().";
+ }
+ private:
+ void Deinit() {
+ FAIL() << "Expected failure #3, in the test fixture d'tor.";
+ }
+};
+
+TEST_F(FatalFailureInSetUpTest, FailureInSetUp) {
+ FAIL() << "UNEXPECTED failure in the test function. "
+ << "We should never get here, as SetUp() failed.";
+}
+
+#if GTEST_OS_WINDOWS
+
+// This group of tests verifies that Google Test handles SEH and C++
+// exceptions correctly.
+
+// A function that throws an SEH exception.
+static void ThrowSEH() {
+ int* p = NULL;
+ *p = 0; // Raises an access violation.
+}
+
+// Tests exceptions thrown in the test fixture constructor.
+class ExceptionInFixtureCtorTest : public testing::Test {
+ protected:
+ ExceptionInFixtureCtorTest() {
+ printf("(expecting a failure on thrown exception "
+ "in the test fixture's constructor)\n");
+
+ ThrowSEH();
+ }
+
+ virtual ~ExceptionInFixtureCtorTest() {
+ Deinit();
+ }
+
+ virtual void SetUp() {
+ FAIL() << "UNEXPECTED failure in SetUp(). "
+ << "We should never get here, as the test fixture c'tor threw.";
+ }
+
+ virtual void TearDown() {
+ FAIL() << "UNEXPECTED failure in TearDown(). "
+ << "We should never get here, as the test fixture c'tor threw.";
+ }
+ private:
+ void Deinit() {
+ FAIL() << "UNEXPECTED failure in the d'tor. "
+ << "We should never get here, as the test fixture c'tor threw.";
+ }
+};
+
+TEST_F(ExceptionInFixtureCtorTest, ExceptionInFixtureCtor) {
+ FAIL() << "UNEXPECTED failure in the test function. "
+ << "We should never get here, as the test fixture c'tor threw.";
+}
+
+// Tests exceptions thrown in SetUp().
+class ExceptionInSetUpTest : public testing::Test {
+ protected:
+ virtual ~ExceptionInSetUpTest() {
+ Deinit();
+ }
+
+ virtual void SetUp() {
+ printf("(expecting 3 failures)\n");
+
+ ThrowSEH();
+ }
+
+ virtual void TearDown() {
+ FAIL() << "Expected failure #2, in TearDown().";
+ }
+ private:
+ void Deinit() {
+ FAIL() << "Expected failure #3, in the test fixture d'tor.";
+ }
+};
+
+TEST_F(ExceptionInSetUpTest, ExceptionInSetUp) {
+ FAIL() << "UNEXPECTED failure in the test function. "
+ << "We should never get here, as SetUp() threw.";
+}
+
+// Tests that TearDown() and the test fixture d'tor are always called,
+// even when the test function throws an exception.
+class ExceptionInTestFunctionTest : public testing::Test {
+ protected:
+ virtual ~ExceptionInTestFunctionTest() {
+ Deinit();
+ }
+
+ virtual void TearDown() {
+ FAIL() << "Expected failure #2, in TearDown().";
+ }
+ private:
+ void Deinit() {
+ FAIL() << "Expected failure #3, in the test fixture d'tor.";
+ }
+};
+
+// Tests that the test fixture d'tor is always called, even when the
+// test function throws an SEH exception.
+TEST_F(ExceptionInTestFunctionTest, SEH) {
+ printf("(expecting 3 failures)\n");
+
+ ThrowSEH();
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+// Tests that the test fixture d'tor is always called, even when the
+// test function throws a C++ exception. We do this only when
+// GTEST_HAS_EXCEPTIONS is non-zero, i.e. C++ exceptions are enabled.
+TEST_F(ExceptionInTestFunctionTest, CppException) {
+ throw 1;
+}
+
+// Tests exceptions thrown in TearDown().
+class ExceptionInTearDownTest : public testing::Test {
+ protected:
+ virtual ~ExceptionInTearDownTest() {
+ Deinit();
+ }
+
+ virtual void TearDown() {
+ throw 1;
+ }
+ private:
+ void Deinit() {
+ FAIL() << "Expected failure #2, in the test fixture d'tor.";
+ }
+};
+
+TEST_F(ExceptionInTearDownTest, ExceptionInTearDown) {
+ printf("(expecting 2 failures)\n");
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+#endif // GTEST_OS_WINDOWS
+
+#if GTEST_IS_THREADSAFE
+
+// A unary function that may die.
+void DieIf(bool should_die) {
+ GTEST_CHECK_(!should_die) << " - death inside DieIf().";
+}
+
+// Tests running death tests in a multi-threaded context.
+
+// Used for coordination between the main and the spawn thread.
+struct SpawnThreadNotifications {
+ SpawnThreadNotifications() {}
+
+ Notification spawn_thread_started;
+ Notification spawn_thread_ok_to_terminate;
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(SpawnThreadNotifications);
+};
+
+// The function to be executed in the thread spawn by the
+// MultipleThreads test (below).
+static void ThreadRoutine(SpawnThreadNotifications* notifications) {
+ // Signals the main thread that this thread has started.
+ notifications->spawn_thread_started.Notify();
+
+ // Waits for permission to finish from the main thread.
+ notifications->spawn_thread_ok_to_terminate.WaitForNotification();
+}
+
+// This is a death-test test, but it's not named with a DeathTest
+// suffix. It starts threads which might interfere with later
+// death tests, so it must run after all other death tests.
+class DeathTestAndMultiThreadsTest : public testing::Test {
+ protected:
+ // Starts a thread and waits for it to begin.
+ virtual void SetUp() {
+ thread_.reset(new ThreadWithParam<SpawnThreadNotifications*>(
+ &ThreadRoutine, &notifications_, NULL));
+ notifications_.spawn_thread_started.WaitForNotification();
+ }
+ // Tells the thread to finish, and reaps it.
+ // Depending on the version of the thread library in use,
+ // a manager thread might still be left running that will interfere
+ // with later death tests. This is unfortunate, but this class
+ // cleans up after itself as best it can.
+ virtual void TearDown() {
+ notifications_.spawn_thread_ok_to_terminate.Notify();
+ }
+
+ private:
+ SpawnThreadNotifications notifications_;
+ scoped_ptr<ThreadWithParam<SpawnThreadNotifications*> > thread_;
+};
+
+#endif // GTEST_IS_THREADSAFE
+
+// The MixedUpTestCaseTest test case verifies that Google Test will fail a
+// test if it uses a different fixture class than what other tests in
+// the same test case use. It deliberately contains two fixture
+// classes with the same name but defined in different namespaces.
+
+// The MixedUpTestCaseWithSameTestNameTest test case verifies that
+// when the user defines two tests with the same test case name AND
+// same test name (but in different namespaces), the second test will
+// fail.
+
+namespace foo {
+
+class MixedUpTestCaseTest : public testing::Test {
+};
+
+TEST_F(MixedUpTestCaseTest, FirstTestFromNamespaceFoo) {}
+TEST_F(MixedUpTestCaseTest, SecondTestFromNamespaceFoo) {}
+
+class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
+};
+
+TEST_F(MixedUpTestCaseWithSameTestNameTest,
+ TheSecondTestWithThisNameShouldFail) {}
+
+} // namespace foo
+
+namespace bar {
+
+class MixedUpTestCaseTest : public testing::Test {
+};
+
+// The following two tests are expected to fail. We rely on the
+// golden file to check that Google Test generates the right error message.
+TEST_F(MixedUpTestCaseTest, ThisShouldFail) {}
+TEST_F(MixedUpTestCaseTest, ThisShouldFailToo) {}
+
+class MixedUpTestCaseWithSameTestNameTest : public testing::Test {
+};
+
+// Expected to fail. We rely on the golden file to check that Google Test
+// generates the right error message.
+TEST_F(MixedUpTestCaseWithSameTestNameTest,
+ TheSecondTestWithThisNameShouldFail) {}
+
+} // namespace bar
+
+// The following two test cases verify that Google Test catches the user
+// error of mixing TEST and TEST_F in the same test case. The first
+// test case checks the scenario where TEST_F appears before TEST, and
+// the second one checks where TEST appears before TEST_F.
+
+class TEST_F_before_TEST_in_same_test_case : public testing::Test {
+};
+
+TEST_F(TEST_F_before_TEST_in_same_test_case, DefinedUsingTEST_F) {}
+
+// Expected to fail. We rely on the golden file to check that Google Test
+// generates the right error message.
+TEST(TEST_F_before_TEST_in_same_test_case, DefinedUsingTESTAndShouldFail) {}
+
+class TEST_before_TEST_F_in_same_test_case : public testing::Test {
+};
+
+TEST(TEST_before_TEST_F_in_same_test_case, DefinedUsingTEST) {}
+
+// Expected to fail. We rely on the golden file to check that Google Test
+// generates the right error message.
+TEST_F(TEST_before_TEST_F_in_same_test_case, DefinedUsingTEST_FAndShouldFail) {
+}
+
+// Used for testing EXPECT_NONFATAL_FAILURE() and EXPECT_FATAL_FAILURE().
+int global_integer = 0;
+
+// Tests that EXPECT_NONFATAL_FAILURE() can reference global variables.
+TEST(ExpectNonfatalFailureTest, CanReferenceGlobalVariables) {
+ global_integer = 0;
+ EXPECT_NONFATAL_FAILURE({
+ EXPECT_EQ(1, global_integer) << "Expected non-fatal failure.";
+ }, "Expected non-fatal failure.");
+}
+
+// Tests that EXPECT_NONFATAL_FAILURE() can reference local variables
+// (static or not).
+TEST(ExpectNonfatalFailureTest, CanReferenceLocalVariables) {
+ int m = 0;
+ static int n;
+ n = 1;
+ EXPECT_NONFATAL_FAILURE({
+ EXPECT_EQ(m, n) << "Expected non-fatal failure.";
+ }, "Expected non-fatal failure.");
+}
+
+// Tests that EXPECT_NONFATAL_FAILURE() succeeds when there is exactly
+// one non-fatal failure and no fatal failure.
+TEST(ExpectNonfatalFailureTest, SucceedsWhenThereIsOneNonfatalFailure) {
+ EXPECT_NONFATAL_FAILURE({
+ ADD_FAILURE() << "Expected non-fatal failure.";
+ }, "Expected non-fatal failure.");
+}
+
+// Tests that EXPECT_NONFATAL_FAILURE() fails when there is no
+// non-fatal failure.
+TEST(ExpectNonfatalFailureTest, FailsWhenThereIsNoNonfatalFailure) {
+ printf("(expecting a failure)\n");
+ EXPECT_NONFATAL_FAILURE({
+ }, "");
+}
+
+// Tests that EXPECT_NONFATAL_FAILURE() fails when there are two
+// non-fatal failures.
+TEST(ExpectNonfatalFailureTest, FailsWhenThereAreTwoNonfatalFailures) {
+ printf("(expecting a failure)\n");
+ EXPECT_NONFATAL_FAILURE({
+ ADD_FAILURE() << "Expected non-fatal failure 1.";
+ ADD_FAILURE() << "Expected non-fatal failure 2.";
+ }, "");
+}
+
+// Tests that EXPECT_NONFATAL_FAILURE() fails when there is one fatal
+// failure.
+TEST(ExpectNonfatalFailureTest, FailsWhenThereIsOneFatalFailure) {
+ printf("(expecting a failure)\n");
+ EXPECT_NONFATAL_FAILURE({
+ FAIL() << "Expected fatal failure.";
+ }, "");
+}
+
+// Tests that EXPECT_NONFATAL_FAILURE() fails when the statement being
+// tested returns.
+TEST(ExpectNonfatalFailureTest, FailsWhenStatementReturns) {
+ printf("(expecting a failure)\n");
+ EXPECT_NONFATAL_FAILURE({
+ return;
+ }, "");
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+// Tests that EXPECT_NONFATAL_FAILURE() fails when the statement being
+// tested throws.
+TEST(ExpectNonfatalFailureTest, FailsWhenStatementThrows) {
+ printf("(expecting a failure)\n");
+ try {
+ EXPECT_NONFATAL_FAILURE({
+ throw 0;
+ }, "");
+ } catch(int) { // NOLINT
+ }
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+// Tests that EXPECT_FATAL_FAILURE() can reference global variables.
+TEST(ExpectFatalFailureTest, CanReferenceGlobalVariables) {
+ global_integer = 0;
+ EXPECT_FATAL_FAILURE({
+ ASSERT_EQ(1, global_integer) << "Expected fatal failure.";
+ }, "Expected fatal failure.");
+}
+
+// Tests that EXPECT_FATAL_FAILURE() can reference local static
+// variables.
+TEST(ExpectFatalFailureTest, CanReferenceLocalStaticVariables) {
+ static int n;
+ n = 1;
+ EXPECT_FATAL_FAILURE({
+ ASSERT_EQ(0, n) << "Expected fatal failure.";
+ }, "Expected fatal failure.");
+}
+
+// Tests that EXPECT_FATAL_FAILURE() succeeds when there is exactly
+// one fatal failure and no non-fatal failure.
+TEST(ExpectFatalFailureTest, SucceedsWhenThereIsOneFatalFailure) {
+ EXPECT_FATAL_FAILURE({
+ FAIL() << "Expected fatal failure.";
+ }, "Expected fatal failure.");
+}
+
+// Tests that EXPECT_FATAL_FAILURE() fails when there is no fatal
+// failure.
+TEST(ExpectFatalFailureTest, FailsWhenThereIsNoFatalFailure) {
+ printf("(expecting a failure)\n");
+ EXPECT_FATAL_FAILURE({
+ }, "");
+}
+
+// A helper for generating a fatal failure.
+void FatalFailure() {
+ FAIL() << "Expected fatal failure.";
+}
+
+// Tests that EXPECT_FATAL_FAILURE() fails when there are two
+// fatal failures.
+TEST(ExpectFatalFailureTest, FailsWhenThereAreTwoFatalFailures) {
+ printf("(expecting a failure)\n");
+ EXPECT_FATAL_FAILURE({
+ FatalFailure();
+ FatalFailure();
+ }, "");
+}
+
+// Tests that EXPECT_FATAL_FAILURE() fails when there is one non-fatal
+// failure.
+TEST(ExpectFatalFailureTest, FailsWhenThereIsOneNonfatalFailure) {
+ printf("(expecting a failure)\n");
+ EXPECT_FATAL_FAILURE({
+ ADD_FAILURE() << "Expected non-fatal failure.";
+ }, "");
+}
+
+// Tests that EXPECT_FATAL_FAILURE() fails when the statement being
+// tested returns.
+TEST(ExpectFatalFailureTest, FailsWhenStatementReturns) {
+ printf("(expecting a failure)\n");
+ EXPECT_FATAL_FAILURE({
+ return;
+ }, "");
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+// Tests that EXPECT_FATAL_FAILURE() fails when the statement being
+// tested throws.
+TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
+ printf("(expecting a failure)\n");
+ try {
+ EXPECT_FATAL_FAILURE({
+ throw 0;
+ }, "");
+ } catch(int) { // NOLINT
+ }
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+// This #ifdef block tests the output of typed tests.
+#if GTEST_HAS_TYPED_TEST
+
+template <typename T>
+class TypedTest : public testing::Test {
+};
+
+TYPED_TEST_CASE(TypedTest, testing::Types<int>);
+
+TYPED_TEST(TypedTest, Success) {
+ EXPECT_EQ(0, TypeParam());
+}
+
+TYPED_TEST(TypedTest, Failure) {
+ EXPECT_EQ(1, TypeParam()) << "Expected failure";
+}
+
+#endif // GTEST_HAS_TYPED_TEST
+
+// This #ifdef block tests the output of type-parameterized tests.
+#if GTEST_HAS_TYPED_TEST_P
+
+template <typename T>
+class TypedTestP : public testing::Test {
+};
+
+TYPED_TEST_CASE_P(TypedTestP);
+
+TYPED_TEST_P(TypedTestP, Success) {
+ EXPECT_EQ(0U, TypeParam());
+}
+
+TYPED_TEST_P(TypedTestP, Failure) {
+ EXPECT_EQ(1U, TypeParam()) << "Expected failure";
+}
+
+REGISTER_TYPED_TEST_CASE_P(TypedTestP, Success, Failure);
+
+typedef testing::Types<unsigned char, unsigned int> UnsignedTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
+
+#endif // GTEST_HAS_TYPED_TEST_P
+
+#if GTEST_HAS_DEATH_TEST
+
+// We rely on the golden file to verify that tests whose test case
+// name ends with DeathTest are run first.
+
+TEST(ADeathTest, ShouldRunFirst) {
+}
+
+#if GTEST_HAS_TYPED_TEST
+
+// We rely on the golden file to verify that typed tests whose test
+// case name ends with DeathTest are run first.
+
+template <typename T>
+class ATypedDeathTest : public testing::Test {
+};
+
+typedef testing::Types<int, double> NumericTypes;
+TYPED_TEST_CASE(ATypedDeathTest, NumericTypes);
+
+TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
+}
+
+#endif // GTEST_HAS_TYPED_TEST
+
+#if GTEST_HAS_TYPED_TEST_P
+
+
+// We rely on the golden file to verify that type-parameterized tests
+// whose test case name ends with DeathTest are run first.
+
+template <typename T>
+class ATypeParamDeathTest : public testing::Test {
+};
+
+TYPED_TEST_CASE_P(ATypeParamDeathTest);
+
+TYPED_TEST_P(ATypeParamDeathTest, ShouldRunFirst) {
+}
+
+REGISTER_TYPED_TEST_CASE_P(ATypeParamDeathTest, ShouldRunFirst);
+
+INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
+
+#endif // GTEST_HAS_TYPED_TEST_P
+
+#endif // GTEST_HAS_DEATH_TEST
+
+// Tests various failure conditions of
+// EXPECT_{,NON}FATAL_FAILURE{,_ON_ALL_THREADS}.
+class ExpectFailureTest : public testing::Test {
+ public: // Must be public and not protected due to a bug in g++ 3.4.2.
+ enum FailureMode {
+ FATAL_FAILURE,
+ NONFATAL_FAILURE
+ };
+ static void AddFailure(FailureMode failure) {
+ if (failure == FATAL_FAILURE) {
+ FAIL() << "Expected fatal failure.";
+ } else {
+ ADD_FAILURE() << "Expected non-fatal failure.";
+ }
+ }
+};
+
+TEST_F(ExpectFailureTest, ExpectFatalFailure) {
+ // Expected fatal failure, but succeeds.
+ printf("(expecting 1 failure)\n");
+ EXPECT_FATAL_FAILURE(SUCCEED(), "Expected fatal failure.");
+ // Expected fatal failure, but got a non-fatal failure.
+ printf("(expecting 1 failure)\n");
+ EXPECT_FATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Expected non-fatal "
+ "failure.");
+ // Wrong message.
+ printf("(expecting 1 failure)\n");
+ EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), "Some other fatal failure "
+ "expected.");
+}
+
+TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
+ // Expected non-fatal failure, but succeeds.
+ printf("(expecting 1 failure)\n");
+ EXPECT_NONFATAL_FAILURE(SUCCEED(), "Expected non-fatal failure.");
+ // Expected non-fatal failure, but got a fatal failure.
+ printf("(expecting 1 failure)\n");
+ EXPECT_NONFATAL_FAILURE(AddFailure(FATAL_FAILURE), "Expected fatal failure.");
+ // Wrong message.
+ printf("(expecting 1 failure)\n");
+ EXPECT_NONFATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Some other non-fatal "
+ "failure.");
+}
+
+#if GTEST_IS_THREADSAFE
+
+class ExpectFailureWithThreadsTest : public ExpectFailureTest {
+ protected:
+ static void AddFailureInOtherThread(FailureMode failure) {
+ ThreadWithParam<FailureMode> thread(&AddFailure, failure, NULL);
+ thread.Join();
+ }
+};
+
+TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailure) {
+ // We only intercept the current thread.
+ printf("(expecting 2 failures)\n");
+ EXPECT_FATAL_FAILURE(AddFailureInOtherThread(FATAL_FAILURE),
+ "Expected fatal failure.");
+}
+
+TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailure) {
+ // We only intercept the current thread.
+ printf("(expecting 2 failures)\n");
+ EXPECT_NONFATAL_FAILURE(AddFailureInOtherThread(NONFATAL_FAILURE),
+ "Expected non-fatal failure.");
+}
+
+typedef ExpectFailureWithThreadsTest ScopedFakeTestPartResultReporterTest;
+
+// Tests that the ScopedFakeTestPartResultReporter only catches failures from
+// the current thread if it is instantiated with INTERCEPT_ONLY_CURRENT_THREAD.
+TEST_F(ScopedFakeTestPartResultReporterTest, InterceptOnlyCurrentThread) {
+ printf("(expecting 2 failures)\n");
+ TestPartResultArray results;
+ {
+ ScopedFakeTestPartResultReporter reporter(
+ ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,
+ &results);
+ AddFailureInOtherThread(FATAL_FAILURE);
+ AddFailureInOtherThread(NONFATAL_FAILURE);
+ }
+ // The two failures should not have been intercepted.
+ EXPECT_EQ(0, results.size()) << "This shouldn't fail.";
+}
+
+#endif // GTEST_IS_THREADSAFE
+
+TEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {
+ // Expected fatal failure, but succeeds.
+ printf("(expecting 1 failure)\n");
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected fatal failure.");
+ // Expected fatal failure, but got a non-fatal failure.
+ printf("(expecting 1 failure)\n");
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
+ "Expected non-fatal failure.");
+ // Wrong message.
+ printf("(expecting 1 failure)\n");
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
+ "Some other fatal failure expected.");
+}
+
+TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
+ // Expected non-fatal failure, but succeeds.
+ printf("(expecting 1 failure)\n");
+ EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected non-fatal "
+ "failure.");
+ // Expected non-fatal failure, but got a fatal failure.
+ printf("(expecting 1 failure)\n");
+ EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
+ "Expected fatal failure.");
+ // Wrong message.
+ printf("(expecting 1 failure)\n");
+ EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
+ "Some other non-fatal failure.");
+}
+
+
+// Two test environments for testing testing::AddGlobalTestEnvironment().
+
+class FooEnvironment : public testing::Environment {
+ public:
+ virtual void SetUp() {
+ printf("%s", "FooEnvironment::SetUp() called.\n");
+ }
+
+ virtual void TearDown() {
+ printf("%s", "FooEnvironment::TearDown() called.\n");
+ FAIL() << "Expected fatal failure.";
+ }
+};
+
+class BarEnvironment : public testing::Environment {
+ public:
+ virtual void SetUp() {
+ printf("%s", "BarEnvironment::SetUp() called.\n");
+ }
+
+ virtual void TearDown() {
+ printf("%s", "BarEnvironment::TearDown() called.\n");
+ ADD_FAILURE() << "Expected non-fatal failure.";
+ }
+};
+
+GTEST_DEFINE_bool_(internal_skip_environment_and_ad_hoc_tests, false,
+ "This flag causes the program to skip test environment "
+ "tests and ad hoc tests.");
+
+// The main function.
+//
+// The idea is to use Google Test to run all the tests we have defined (some
+// of them are intended to fail), and then compare the test results
+// with the "golden" file.
+int main(int argc, char **argv) {
+ testing::GTEST_FLAG(print_time) = false;
+
+ // We just run the tests, knowing some of them are intended to fail.
+ // We will use a separate Python script to compare the output of
+ // this program with the golden file.
+
+ // It's hard to test InitGoogleTest() directly, as it has many
+ // global side effects. The following line serves as a sanity test
+ // for it.
+ testing::InitGoogleTest(&argc, argv);
+ if (argc >= 2 &&
+ String(argv[1]) == "--gtest_internal_skip_environment_and_ad_hoc_tests")
+ GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = true;
+
+#if GTEST_HAS_DEATH_TEST
+ if (testing::internal::GTEST_FLAG(internal_run_death_test) != "") {
+ // Skip the usual output capturing if we're running as the child
+ // process of an threadsafe-style death test.
+#if GTEST_OS_WINDOWS
+ posix::FReopen("nul:", "w", stdout);
+#else
+ posix::FReopen("/dev/null", "w", stdout);
+#endif // GTEST_OS_WINDOWS
+ return RUN_ALL_TESTS();
+ }
+#endif // GTEST_HAS_DEATH_TEST
+
+ if (GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests))
+ return RUN_ALL_TESTS();
+
+ // Registers two global test environments.
+ // The golden file verifies that they are set up in the order they
+ // are registered, and torn down in the reverse order.
+ testing::AddGlobalTestEnvironment(new FooEnvironment);
+ testing::AddGlobalTestEnvironment(new BarEnvironment);
+
+ return RunAllTests();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_lin.txt b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_lin.txt
new file mode 100644
index 0000000..ec60437
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_lin.txt
@@ -0,0 +1,696 @@
+The non-test part of the code is expected to have 2 failures.
+
+gtest_output_test_.cc:#: Failure
+Value of: false
+ Actual: false
+Expected: true
+gtest_output_test_.cc:#: Failure
+Value of: 3
+Expected: 2
+[==========] Running 60 tests from 25 test cases.
+[----------] Global test environment set-up.
+FooEnvironment::SetUp() called.
+BarEnvironment::SetUp() called.
+[----------] 1 test from ADeathTest
+[ RUN ] ADeathTest.ShouldRunFirst
+[ OK ] ADeathTest.ShouldRunFirst
+[----------] 1 test from ATypedDeathTest/0, where TypeParam = int
+[ RUN ] ATypedDeathTest/0.ShouldRunFirst
+[ OK ] ATypedDeathTest/0.ShouldRunFirst
+[----------] 1 test from ATypedDeathTest/1, where TypeParam = double
+[ RUN ] ATypedDeathTest/1.ShouldRunFirst
+[ OK ] ATypedDeathTest/1.ShouldRunFirst
+[----------] 1 test from My/ATypeParamDeathTest/0, where TypeParam = int
+[ RUN ] My/ATypeParamDeathTest/0.ShouldRunFirst
+[ OK ] My/ATypeParamDeathTest/0.ShouldRunFirst
+[----------] 1 test from My/ATypeParamDeathTest/1, where TypeParam = double
+[ RUN ] My/ATypeParamDeathTest/1.ShouldRunFirst
+[ OK ] My/ATypeParamDeathTest/1.ShouldRunFirst
+[----------] 2 tests from PassingTest
+[ RUN ] PassingTest.PassingTest1
+[ OK ] PassingTest.PassingTest1
+[ RUN ] PassingTest.PassingTest2
+[ OK ] PassingTest.PassingTest2
+[----------] 3 tests from FatalFailureTest
+[ RUN ] FatalFailureTest.FatalFailureInSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: Failure
+Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
+[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: Failure
+Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
+[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
+(expecting a failure on false)
+gtest_output_test_.cc:#: Failure
+Value of: false
+ Actual: false
+Expected: true
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
+[----------] 1 test from LoggingTest
+[ RUN ] LoggingTest.InterleavingLoggingAndAssertions
+(expecting 2 failures on (3) >= (a[i]))
+i == 0
+i == 1
+gtest_output_test_.cc:#: Failure
+Expected: (3) >= (a[i]), actual: 3 vs 9
+i == 2
+i == 3
+gtest_output_test_.cc:#: Failure
+Expected: (3) >= (a[i]), actual: 3 vs 6
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
+[----------] 6 tests from SCOPED_TRACETest
+[ RUN ] SCOPED_TRACETest.ObeysScopes
+(expected to fail)
+gtest_output_test_.cc:#: Failure
+Failed
+This failure is expected, and shouldn't have a trace.
+gtest_output_test_.cc:#: Failure
+Failed
+This failure is expected, and should have a trace.
+Google Test trace:
+gtest_output_test_.cc:#: Expected trace
+gtest_output_test_.cc:#: Failure
+Failed
+This failure is expected, and shouldn't have a trace.
+[ FAILED ] SCOPED_TRACETest.ObeysScopes
+[ RUN ] SCOPED_TRACETest.WorksInLoop
+(expected to fail)
+gtest_output_test_.cc:#: Failure
+Value of: n
+ Actual: 1
+Expected: 2
+Google Test trace:
+gtest_output_test_.cc:#: i = 1
+gtest_output_test_.cc:#: Failure
+Value of: n
+ Actual: 2
+Expected: 1
+Google Test trace:
+gtest_output_test_.cc:#: i = 2
+[ FAILED ] SCOPED_TRACETest.WorksInLoop
+[ RUN ] SCOPED_TRACETest.WorksInSubroutine
+(expected to fail)
+gtest_output_test_.cc:#: Failure
+Value of: n
+ Actual: 1
+Expected: 2
+Google Test trace:
+gtest_output_test_.cc:#: n = 1
+gtest_output_test_.cc:#: Failure
+Value of: n
+ Actual: 2
+Expected: 1
+Google Test trace:
+gtest_output_test_.cc:#: n = 2
+[ FAILED ] SCOPED_TRACETest.WorksInSubroutine
+[ RUN ] SCOPED_TRACETest.CanBeNested
+(expected to fail)
+gtest_output_test_.cc:#: Failure
+Value of: n
+ Actual: 2
+Expected: 1
+Google Test trace:
+gtest_output_test_.cc:#: n = 2
+gtest_output_test_.cc:#:
+[ FAILED ] SCOPED_TRACETest.CanBeNested
+[ RUN ] SCOPED_TRACETest.CanBeRepeated
+(expected to fail)
+gtest_output_test_.cc:#: Failure
+Failed
+This failure is expected, and should contain trace point A.
+Google Test trace:
+gtest_output_test_.cc:#: A
+gtest_output_test_.cc:#: Failure
+Failed
+This failure is expected, and should contain trace point A and B.
+Google Test trace:
+gtest_output_test_.cc:#: B
+gtest_output_test_.cc:#: A
+gtest_output_test_.cc:#: Failure
+Failed
+This failure is expected, and should contain trace point A, B, and C.
+Google Test trace:
+gtest_output_test_.cc:#: C
+gtest_output_test_.cc:#: B
+gtest_output_test_.cc:#: A
+gtest_output_test_.cc:#: Failure
+Failed
+This failure is expected, and should contain trace point A, B, and D.
+Google Test trace:
+gtest_output_test_.cc:#: D
+gtest_output_test_.cc:#: B
+gtest_output_test_.cc:#: A
+[ FAILED ] SCOPED_TRACETest.CanBeRepeated
+[ RUN ] SCOPED_TRACETest.WorksConcurrently
+(expecting 6 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #1 (in thread B, only trace B alive).
+Google Test trace:
+gtest_output_test_.cc:#: Trace B
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #2 (in thread A, trace A & B both alive).
+Google Test trace:
+gtest_output_test_.cc:#: Trace A
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #3 (in thread B, trace A & B both alive).
+Google Test trace:
+gtest_output_test_.cc:#: Trace B
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #4 (in thread B, only trace A alive).
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #5 (in thread A, only trace A alive).
+Google Test trace:
+gtest_output_test_.cc:#: Trace A
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #6 (in thread A, no trace alive).
+[ FAILED ] SCOPED_TRACETest.WorksConcurrently
+[----------] 1 test from NonFatalFailureInFixtureConstructorTest
+[ RUN ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
+(expecting 5 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #1, in the test fixture c'tor.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #2, in SetUp().
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #3, in the test body.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #4, in TearDown.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #5, in the test fixture d'tor.
+[ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
+[----------] 1 test from FatalFailureInFixtureConstructorTest
+[ RUN ] FatalFailureInFixtureConstructorTest.FailureInConstructor
+(expecting 2 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #1, in the test fixture c'tor.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #2, in the test fixture d'tor.
+[ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor
+[----------] 1 test from NonFatalFailureInSetUpTest
+[ RUN ] NonFatalFailureInSetUpTest.FailureInSetUp
+(expecting 4 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #1, in SetUp().
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #2, in the test function.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #3, in TearDown().
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #4, in the test fixture d'tor.
+[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
+[----------] 1 test from FatalFailureInSetUpTest
+[ RUN ] FatalFailureInSetUpTest.FailureInSetUp
+(expecting 3 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #1, in SetUp().
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #2, in TearDown().
+gtest_output_test_.cc:#: Failure
+Failed
+Expected failure #3, in the test fixture d'tor.
+[ FAILED ] FatalFailureInSetUpTest.FailureInSetUp
+[----------] 4 tests from MixedUpTestCaseTest
+[ RUN ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
+[ OK ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
+[ RUN ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
+[ OK ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
+[ RUN ] MixedUpTestCaseTest.ThisShouldFail
+gtest.cc:#: Failure
+Failed
+All tests in the same test case must use the same test fixture
+class. However, in test case MixedUpTestCaseTest,
+you defined test FirstTestFromNamespaceFoo and test ThisShouldFail
+using two different test fixture classes. This can happen if
+the two classes are from different namespaces or translation
+units and have the same name. You should probably rename one
+of the classes to put the tests into different test cases.
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
+[ RUN ] MixedUpTestCaseTest.ThisShouldFailToo
+gtest.cc:#: Failure
+Failed
+All tests in the same test case must use the same test fixture
+class. However, in test case MixedUpTestCaseTest,
+you defined test FirstTestFromNamespaceFoo and test ThisShouldFailToo
+using two different test fixture classes. This can happen if
+the two classes are from different namespaces or translation
+units and have the same name. You should probably rename one
+of the classes to put the tests into different test cases.
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
+[----------] 2 tests from MixedUpTestCaseWithSameTestNameTest
+[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ OK ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+gtest.cc:#: Failure
+Failed
+All tests in the same test case must use the same test fixture
+class. However, in test case MixedUpTestCaseWithSameTestNameTest,
+you defined test TheSecondTestWithThisNameShouldFail and test TheSecondTestWithThisNameShouldFail
+using two different test fixture classes. This can happen if
+the two classes are from different namespaces or translation
+units and have the same name. You should probably rename one
+of the classes to put the tests into different test cases.
+[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[----------] 2 tests from TEST_F_before_TEST_in_same_test_case
+[ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
+[ OK ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
+[ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
+gtest.cc:#: Failure
+Failed
+All tests in the same test case must use the same test fixture
+class, so mixing TEST_F and TEST in the same test case is
+illegal. In test case TEST_F_before_TEST_in_same_test_case,
+test DefinedUsingTEST_F is defined using TEST_F but
+test DefinedUsingTESTAndShouldFail is defined using TEST. You probably
+want to change the TEST to TEST_F or move it to another test
+case.
+[ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
+[----------] 2 tests from TEST_before_TEST_F_in_same_test_case
+[ RUN ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
+[ OK ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
+[ RUN ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
+gtest.cc:#: Failure
+Failed
+All tests in the same test case must use the same test fixture
+class, so mixing TEST_F and TEST in the same test case is
+illegal. In test case TEST_before_TEST_F_in_same_test_case,
+test DefinedUsingTEST_FAndShouldFail is defined using TEST_F but
+test DefinedUsingTEST is defined using TEST. You probably
+want to change the TEST to TEST_F or move it to another test
+case.
+[ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
+[----------] 8 tests from ExpectNonfatalFailureTest
+[ RUN ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables
+[ OK ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables
+[ RUN ] ExpectNonfatalFailureTest.CanReferenceLocalVariables
+[ OK ] ExpectNonfatalFailureTest.CanReferenceLocalVariables
+[ RUN ] ExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure
+[ OK ] ExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual: 2 failures
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure 1.
+
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure 2.
+
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
+[----------] 8 tests from ExpectFatalFailureTest
+[ RUN ] ExpectFatalFailureTest.CanReferenceGlobalVariables
+[ OK ] ExpectFatalFailureTest.CanReferenceGlobalVariables
+[ RUN ] ExpectFatalFailureTest.CanReferenceLocalStaticVariables
+[ OK ] ExpectFatalFailureTest.CanReferenceLocalStaticVariables
+[ RUN ] ExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure
+[ OK ] ExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure
+[ RUN ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
+[ RUN ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual: 2 failures
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
+[ RUN ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
+[ RUN ] ExpectFatalFailureTest.FailsWhenStatementReturns
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementReturns
+[ RUN ] ExpectFatalFailureTest.FailsWhenStatementThrows
+(expecting a failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
+[----------] 2 tests from TypedTest/0, where TypeParam = int
+[ RUN ] TypedTest/0.Success
+[ OK ] TypedTest/0.Success
+[ RUN ] TypedTest/0.Failure
+gtest_output_test_.cc:#: Failure
+Value of: TypeParam()
+ Actual: 0
+Expected: 1
+Expected failure
+[ FAILED ] TypedTest/0.Failure
+[----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
+[ RUN ] Unsigned/TypedTestP/0.Success
+[ OK ] Unsigned/TypedTestP/0.Success
+[ RUN ] Unsigned/TypedTestP/0.Failure
+gtest_output_test_.cc:#: Failure
+Value of: TypeParam()
+ Actual: \0
+Expected: 1U
+Which is: 1
+Expected failure
+[ FAILED ] Unsigned/TypedTestP/0.Failure
+[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
+[ RUN ] Unsigned/TypedTestP/1.Success
+[ OK ] Unsigned/TypedTestP/1.Success
+[ RUN ] Unsigned/TypedTestP/1.Failure
+gtest_output_test_.cc:#: Failure
+Value of: TypeParam()
+ Actual: 0
+Expected: 1U
+Which is: 1
+Expected failure
+[ FAILED ] Unsigned/TypedTestP/1.Failure
+[----------] 4 tests from ExpectFailureTest
+[ RUN ] ExpectFailureTest.ExpectFatalFailure
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure containing "Some other fatal failure expected."
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectFatalFailure
+[ RUN ] ExpectFailureTest.ExpectNonFatalFailure
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure containing "Some other non-fatal failure."
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
+[ RUN ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 fatal failure containing "Some other fatal failure expected."
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
+[ RUN ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure containing "Some other non-fatal failure."
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
+[----------] 2 tests from ExpectFailureWithThreadsTest
+[ RUN ] ExpectFailureWithThreadsTest.ExpectFatalFailure
+(expecting 2 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected fatal failure.
+gtest.cc:#: Failure
+Expected: 1 fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFailureWithThreadsTest.ExpectFatalFailure
+[ RUN ] ExpectFailureWithThreadsTest.ExpectNonFatalFailure
+(expecting 2 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected non-fatal failure.
+gtest.cc:#: Failure
+Expected: 1 non-fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFailureWithThreadsTest.ExpectNonFatalFailure
+[----------] 1 test from ScopedFakeTestPartResultReporterTest
+[ RUN ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
+(expecting 2 failures)
+gtest_output_test_.cc:#: Failure
+Failed
+Expected fatal failure.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected non-fatal failure.
+[ FAILED ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
+[----------] Global test environment tear-down
+BarEnvironment::TearDown() called.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected non-fatal failure.
+FooEnvironment::TearDown() called.
+gtest_output_test_.cc:#: Failure
+Failed
+Expected fatal failure.
+[==========] 60 tests from 25 test cases ran.
+[ PASSED ] 21 tests.
+[ FAILED ] 39 tests, listed below:
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
+[ FAILED ] SCOPED_TRACETest.ObeysScopes
+[ FAILED ] SCOPED_TRACETest.WorksInLoop
+[ FAILED ] SCOPED_TRACETest.WorksInSubroutine
+[ FAILED ] SCOPED_TRACETest.CanBeNested
+[ FAILED ] SCOPED_TRACETest.CanBeRepeated
+[ FAILED ] SCOPED_TRACETest.WorksConcurrently
+[ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
+[ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor
+[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
+[ FAILED ] FatalFailureInSetUpTest.FailureInSetUp
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
+[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
+[ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementReturns
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
+[ FAILED ] TypedTest/0.Failure, where TypeParam = int
+[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
+[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
+[ FAILED ] ExpectFailureTest.ExpectFatalFailure
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
+[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
+[ FAILED ] ExpectFailureWithThreadsTest.ExpectFatalFailure
+[ FAILED ] ExpectFailureWithThreadsTest.ExpectNonFatalFailure
+[ FAILED ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
+
+39 FAILED TESTS
+ YOU HAVE 1 DISABLED TEST
+
+Note: Google Test filter = FatalFailureTest.*:LoggingTest.*
+[==========] Running 4 tests from 2 test cases.
+[----------] Global test environment set-up.
+[----------] 3 tests from FatalFailureTest
+[ RUN ] FatalFailureTest.FatalFailureInSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: Failure
+Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms)
+[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: Failure
+Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
+[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
+(expecting a failure on false)
+gtest_output_test_.cc:#: Failure
+Value of: false
+ Actual: false
+Expected: true
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine (? ms)
+[----------] 3 tests from FatalFailureTest (? ms total)
+
+[----------] 1 test from LoggingTest
+[ RUN ] LoggingTest.InterleavingLoggingAndAssertions
+(expecting 2 failures on (3) >= (a[i]))
+i == 0
+i == 1
+gtest_output_test_.cc:#: Failure
+Expected: (3) >= (a[i]), actual: 3 vs 9
+i == 2
+i == 3
+gtest_output_test_.cc:#: Failure
+Expected: (3) >= (a[i]), actual: 3 vs 6
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions (? ms)
+[----------] 1 test from LoggingTest (? ms total)
+
+[----------] Global test environment tear-down
+[==========] 4 tests from 2 test cases ran. (? ms total)
+[ PASSED ] 0 tests.
+[ FAILED ] 4 tests, listed below:
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
+
+ 4 FAILED TESTS
+ YOU HAVE 1 DISABLED TEST
+
+Note: Google Test filter = *DISABLED_*
+[==========] Running 1 test from 1 test case.
+[----------] Global test environment set-up.
+[----------] 1 test from DisabledTestsWarningTest
+[ RUN ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
+[ OK ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
+[----------] Global test environment tear-down
+[==========] 1 test from 1 test case ran.
+[ PASSED ] 1 test.
+Note: Google Test filter = PassingTest.*
+Note: This is test shard 1 of 2.
+[==========] Running 1 test from 1 test case.
+[----------] Global test environment set-up.
+[----------] 1 test from PassingTest
+[ RUN ] PassingTest.PassingTest2
+[ OK ] PassingTest.PassingTest2
+[----------] Global test environment tear-down
+[==========] 1 test from 1 test case ran.
+[ PASSED ] 1 test.
+
+ YOU HAVE 1 DISABLED TEST
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_win.txt b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_win.txt
new file mode 100644
index 0000000..313c3aa
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_output_test_golden_win.txt
@@ -0,0 +1,605 @@
+The non-test part of the code is expected to have 2 failures.
+
+gtest_output_test_.cc:#: error: Value of: false
+ Actual: false
+Expected: true
+gtest_output_test_.cc:#: error: Value of: 3
+Expected: 2
+[==========] Running 61 tests from 27 test cases.
+[----------] Global test environment set-up.
+FooEnvironment::SetUp() called.
+BarEnvironment::SetUp() called.
+[----------] 1 test from ADeathTest
+[ RUN ] ADeathTest.ShouldRunFirst
+[ OK ] ADeathTest.ShouldRunFirst
+[----------] 1 test from ATypedDeathTest/0, where TypeParam = int
+[ RUN ] ATypedDeathTest/0.ShouldRunFirst
+[ OK ] ATypedDeathTest/0.ShouldRunFirst
+[----------] 1 test from ATypedDeathTest/1, where TypeParam = double
+[ RUN ] ATypedDeathTest/1.ShouldRunFirst
+[ OK ] ATypedDeathTest/1.ShouldRunFirst
+[----------] 1 test from My/ATypeParamDeathTest/0, where TypeParam = int
+[ RUN ] My/ATypeParamDeathTest/0.ShouldRunFirst
+[ OK ] My/ATypeParamDeathTest/0.ShouldRunFirst
+[----------] 1 test from My/ATypeParamDeathTest/1, where TypeParam = double
+[ RUN ] My/ATypeParamDeathTest/1.ShouldRunFirst
+[ OK ] My/ATypeParamDeathTest/1.ShouldRunFirst
+[----------] 2 tests from PassingTest
+[ RUN ] PassingTest.PassingTest1
+[ OK ] PassingTest.PassingTest1
+[ RUN ] PassingTest.PassingTest2
+[ OK ] PassingTest.PassingTest2
+[----------] 3 tests from FatalFailureTest
+[ RUN ] FatalFailureTest.FatalFailureInSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: error: Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
+[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: error: Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
+[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
+(expecting a failure on false)
+gtest_output_test_.cc:#: error: Value of: false
+ Actual: false
+Expected: true
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
+[----------] 1 test from LoggingTest
+[ RUN ] LoggingTest.InterleavingLoggingAndAssertions
+(expecting 2 failures on (3) >= (a[i]))
+i == 0
+i == 1
+gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 9
+i == 2
+i == 3
+gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 6
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
+[----------] 5 tests from SCOPED_TRACETest
+[ RUN ] SCOPED_TRACETest.ObeysScopes
+(expected to fail)
+gtest_output_test_.cc:#: error: Failed
+This failure is expected, and shouldn't have a trace.
+gtest_output_test_.cc:#: error: Failed
+This failure is expected, and should have a trace.
+Google Test trace:
+gtest_output_test_.cc:#: Expected trace
+gtest_output_test_.cc:#: error: Failed
+This failure is expected, and shouldn't have a trace.
+[ FAILED ] SCOPED_TRACETest.ObeysScopes
+[ RUN ] SCOPED_TRACETest.WorksInLoop
+(expected to fail)
+gtest_output_test_.cc:#: error: Value of: n
+ Actual: 1
+Expected: 2
+Google Test trace:
+gtest_output_test_.cc:#: i = 1
+gtest_output_test_.cc:#: error: Value of: n
+ Actual: 2
+Expected: 1
+Google Test trace:
+gtest_output_test_.cc:#: i = 2
+[ FAILED ] SCOPED_TRACETest.WorksInLoop
+[ RUN ] SCOPED_TRACETest.WorksInSubroutine
+(expected to fail)
+gtest_output_test_.cc:#: error: Value of: n
+ Actual: 1
+Expected: 2
+Google Test trace:
+gtest_output_test_.cc:#: n = 1
+gtest_output_test_.cc:#: error: Value of: n
+ Actual: 2
+Expected: 1
+Google Test trace:
+gtest_output_test_.cc:#: n = 2
+[ FAILED ] SCOPED_TRACETest.WorksInSubroutine
+[ RUN ] SCOPED_TRACETest.CanBeNested
+(expected to fail)
+gtest_output_test_.cc:#: error: Value of: n
+ Actual: 2
+Expected: 1
+Google Test trace:
+gtest_output_test_.cc:#: n = 2
+gtest_output_test_.cc:#:
+[ FAILED ] SCOPED_TRACETest.CanBeNested
+[ RUN ] SCOPED_TRACETest.CanBeRepeated
+(expected to fail)
+gtest_output_test_.cc:#: error: Failed
+This failure is expected, and should contain trace point A.
+Google Test trace:
+gtest_output_test_.cc:#: A
+gtest_output_test_.cc:#: error: Failed
+This failure is expected, and should contain trace point A and B.
+Google Test trace:
+gtest_output_test_.cc:#: B
+gtest_output_test_.cc:#: A
+gtest_output_test_.cc:#: error: Failed
+This failure is expected, and should contain trace point A, B, and C.
+Google Test trace:
+gtest_output_test_.cc:#: C
+gtest_output_test_.cc:#: B
+gtest_output_test_.cc:#: A
+gtest_output_test_.cc:#: error: Failed
+This failure is expected, and should contain trace point A, B, and D.
+Google Test trace:
+gtest_output_test_.cc:#: D
+gtest_output_test_.cc:#: B
+gtest_output_test_.cc:#: A
+[ FAILED ] SCOPED_TRACETest.CanBeRepeated
+[----------] 1 test from NonFatalFailureInFixtureConstructorTest
+[ RUN ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
+(expecting 5 failures)
+gtest_output_test_.cc:#: error: Failed
+Expected failure #1, in the test fixture c'tor.
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in SetUp().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #3, in the test body.
+gtest_output_test_.cc:#: error: Failed
+Expected failure #4, in TearDown.
+gtest_output_test_.cc:#: error: Failed
+Expected failure #5, in the test fixture d'tor.
+[ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
+[----------] 1 test from FatalFailureInFixtureConstructorTest
+[ RUN ] FatalFailureInFixtureConstructorTest.FailureInConstructor
+(expecting 2 failures)
+gtest_output_test_.cc:#: error: Failed
+Expected failure #1, in the test fixture c'tor.
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in the test fixture d'tor.
+[ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor
+[----------] 1 test from NonFatalFailureInSetUpTest
+[ RUN ] NonFatalFailureInSetUpTest.FailureInSetUp
+(expecting 4 failures)
+gtest_output_test_.cc:#: error: Failed
+Expected failure #1, in SetUp().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in the test function.
+gtest_output_test_.cc:#: error: Failed
+Expected failure #3, in TearDown().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #4, in the test fixture d'tor.
+[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
+[----------] 1 test from FatalFailureInSetUpTest
+[ RUN ] FatalFailureInSetUpTest.FailureInSetUp
+(expecting 3 failures)
+gtest_output_test_.cc:#: error: Failed
+Expected failure #1, in SetUp().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in TearDown().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #3, in the test fixture d'tor.
+[ FAILED ] FatalFailureInSetUpTest.FailureInSetUp
+[----------] 1 test from ExceptionInFixtureCtorTest
+[ RUN ] ExceptionInFixtureCtorTest.ExceptionInFixtureCtor
+(expecting a failure on thrown exception in the test fixture's constructor)
+unknown file: error: Exception thrown with code 0xc0000005 in the test fixture's constructor.
+[----------] 1 test from ExceptionInSetUpTest
+[ RUN ] ExceptionInSetUpTest.ExceptionInSetUp
+(expecting 3 failures)
+unknown file: error: Exception thrown with code 0xc0000005 in SetUp().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in TearDown().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #3, in the test fixture d'tor.
+[ FAILED ] ExceptionInSetUpTest.ExceptionInSetUp
+[----------] 2 tests from ExceptionInTestFunctionTest
+[ RUN ] ExceptionInTestFunctionTest.SEH
+(expecting 3 failures)
+unknown file: error: Exception thrown with code 0xc0000005 in the test body.
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in TearDown().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #3, in the test fixture d'tor.
+[ FAILED ] ExceptionInTestFunctionTest.SEH
+[ RUN ] ExceptionInTestFunctionTest.CppException
+unknown file: error: Exception thrown with code 0xe06d7363 in the test body.
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in TearDown().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #3, in the test fixture d'tor.
+[ FAILED ] ExceptionInTestFunctionTest.CppException
+[----------] 1 test from ExceptionInTearDownTest
+[ RUN ] ExceptionInTearDownTest.ExceptionInTearDown
+(expecting 2 failures)
+unknown file: error: Exception thrown with code 0xe06d7363 in TearDown().
+gtest_output_test_.cc:#: error: Failed
+Expected failure #2, in the test fixture d'tor.
+[ FAILED ] ExceptionInTearDownTest.ExceptionInTearDown
+[----------] 4 tests from MixedUpTestCaseTest
+[ RUN ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
+[ OK ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
+[ RUN ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
+[ OK ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
+[ RUN ] MixedUpTestCaseTest.ThisShouldFail
+gtest.cc:#: error: Failed
+All tests in the same test case must use the same test fixture
+class. However, in test case MixedUpTestCaseTest,
+you defined test FirstTestFromNamespaceFoo and test ThisShouldFail
+using two different test fixture classes. This can happen if
+the two classes are from different namespaces or translation
+units and have the same name. You should probably rename one
+of the classes to put the tests into different test cases.
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
+[ RUN ] MixedUpTestCaseTest.ThisShouldFailToo
+gtest.cc:#: error: Failed
+All tests in the same test case must use the same test fixture
+class. However, in test case MixedUpTestCaseTest,
+you defined test FirstTestFromNamespaceFoo and test ThisShouldFailToo
+using two different test fixture classes. This can happen if
+the two classes are from different namespaces or translation
+units and have the same name. You should probably rename one
+of the classes to put the tests into different test cases.
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
+[----------] 2 tests from MixedUpTestCaseWithSameTestNameTest
+[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ OK ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+gtest.cc:#: error: Failed
+All tests in the same test case must use the same test fixture
+class. However, in test case MixedUpTestCaseWithSameTestNameTest,
+you defined test TheSecondTestWithThisNameShouldFail and test TheSecondTestWithThisNameShouldFail
+using two different test fixture classes. This can happen if
+the two classes are from different namespaces or translation
+units and have the same name. You should probably rename one
+of the classes to put the tests into different test cases.
+[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[----------] 2 tests from TEST_F_before_TEST_in_same_test_case
+[ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
+[ OK ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
+[ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
+gtest.cc:#: error: Failed
+All tests in the same test case must use the same test fixture
+class, so mixing TEST_F and TEST in the same test case is
+illegal. In test case TEST_F_before_TEST_in_same_test_case,
+test DefinedUsingTEST_F is defined using TEST_F but
+test DefinedUsingTESTAndShouldFail is defined using TEST. You probably
+want to change the TEST to TEST_F or move it to another test
+case.
+[ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
+[----------] 2 tests from TEST_before_TEST_F_in_same_test_case
+[ RUN ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
+[ OK ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
+[ RUN ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
+gtest.cc:#: error: Failed
+All tests in the same test case must use the same test fixture
+class, so mixing TEST_F and TEST in the same test case is
+illegal. In test case TEST_before_TEST_F_in_same_test_case,
+test DefinedUsingTEST_FAndShouldFail is defined using TEST_F but
+test DefinedUsingTEST is defined using TEST. You probably
+want to change the TEST to TEST_F or move it to another test
+case.
+[ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
+[----------] 8 tests from ExpectNonfatalFailureTest
+[ RUN ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables
+[ OK ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables
+[ RUN ] ExpectNonfatalFailureTest.CanReferenceLocalVariables
+[ OK ] ExpectNonfatalFailureTest.CanReferenceLocalVariables
+[ RUN ] ExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure
+[ OK ] ExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual: 2 failures
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure 1.
+
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure 2.
+
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
+[ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
+[----------] 8 tests from ExpectFatalFailureTest
+[ RUN ] ExpectFatalFailureTest.CanReferenceGlobalVariables
+[ OK ] ExpectFatalFailureTest.CanReferenceGlobalVariables
+[ RUN ] ExpectFatalFailureTest.CanReferenceLocalStaticVariables
+[ OK ] ExpectFatalFailureTest.CanReferenceLocalStaticVariables
+[ RUN ] ExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure
+[ OK ] ExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure
+[ RUN ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
+[ RUN ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual: 2 failures
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
+[ RUN ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
+[ RUN ] ExpectFatalFailureTest.FailsWhenStatementReturns
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementReturns
+[ RUN ] ExpectFatalFailureTest.FailsWhenStatementThrows
+(expecting a failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual: 0 failures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
+[----------] 2 tests from TypedTest/0, where TypeParam = int
+[ RUN ] TypedTest/0.Success
+[ OK ] TypedTest/0.Success
+[ RUN ] TypedTest/0.Failure
+gtest_output_test_.cc:#: error: Value of: TypeParam()
+ Actual: 0
+Expected: 1
+Expected failure
+[ FAILED ] TypedTest/0.Failure
+[----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
+[ RUN ] Unsigned/TypedTestP/0.Success
+[ OK ] Unsigned/TypedTestP/0.Success
+[ RUN ] Unsigned/TypedTestP/0.Failure
+gtest_output_test_.cc:#: error: Value of: TypeParam()
+ Actual: \0
+Expected: 1U
+Which is: 1
+Expected failure
+[ FAILED ] Unsigned/TypedTestP/0.Failure
+[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
+[ RUN ] Unsigned/TypedTestP/1.Success
+[ OK ] Unsigned/TypedTestP/1.Success
+[ RUN ] Unsigned/TypedTestP/1.Failure
+gtest_output_test_.cc:#: error: Value of: TypeParam()
+ Actual: 0
+Expected: 1U
+Which is: 1
+Expected failure
+[ FAILED ] Unsigned/TypedTestP/1.Failure
+[----------] 4 tests from ExpectFailureTest
+[ RUN ] ExpectFailureTest.ExpectFatalFailure
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectFatalFailure
+[ RUN ] ExpectFailureTest.ExpectNonFatalFailure
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
+[ RUN ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 fatal failure
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
+[ RUN ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Success:
+Succeeded
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure
+ Actual:
+gtest_output_test_.cc:#: Fatal failure:
+Failed
+Expected fatal failure.
+
+(expecting 1 failure)
+gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
+ Actual:
+gtest_output_test_.cc:#: Non-fatal failure:
+Failed
+Expected non-fatal failure.
+
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
+[----------] Global test environment tear-down
+BarEnvironment::TearDown() called.
+gtest_output_test_.cc:#: error: Failed
+Expected non-fatal failure.
+FooEnvironment::TearDown() called.
+gtest_output_test_.cc:#: error: Failed
+Expected fatal failure.
+[==========] 61 tests from 27 test cases ran.
+[ PASSED ] 21 tests.
+[ FAILED ] 40 tests, listed below:
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
+[ FAILED ] SCOPED_TRACETest.ObeysScopes
+[ FAILED ] SCOPED_TRACETest.WorksInLoop
+[ FAILED ] SCOPED_TRACETest.WorksInSubroutine
+[ FAILED ] SCOPED_TRACETest.CanBeNested
+[ FAILED ] SCOPED_TRACETest.CanBeRepeated
+[ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
+[ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor
+[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
+[ FAILED ] FatalFailureInSetUpTest.FailureInSetUp
+[ FAILED ] ExceptionInFixtureCtorTest.ExceptionInFixtureCtor
+[ FAILED ] ExceptionInSetUpTest.ExceptionInSetUp
+[ FAILED ] ExceptionInTestFunctionTest.SEH
+[ FAILED ] ExceptionInTestFunctionTest.CppException
+[ FAILED ] ExceptionInTearDownTest.ExceptionInTearDown
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFail
+[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
+[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
+[ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
+[ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
+[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
+[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementReturns
+[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
+[ FAILED ] TypedTest/0.Failure, where TypeParam = int
+[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
+[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
+[ FAILED ] ExpectFailureTest.ExpectFatalFailure
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
+[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
+[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
+
+40 FAILED TESTS
+ YOU HAVE 1 DISABLED TEST
+
+Note: Google Test filter = FatalFailureTest.*:LoggingTest.*
+[==========] Running 4 tests from 2 test cases.
+[----------] Global test environment set-up.
+[----------] 3 tests from FatalFailureTest
+[ RUN ] FatalFailureTest.FatalFailureInSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: error: Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms)
+[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
+(expecting a failure that x should be 1)
+gtest_output_test_.cc:#: error: Value of: x
+ Actual: 2
+Expected: 1
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
+[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
+(expecting a failure on false)
+gtest_output_test_.cc:#: error: Value of: false
+ Actual: false
+Expected: true
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine (? ms)
+[----------] 3 tests from FatalFailureTest (? ms total)
+
+[----------] 1 test from LoggingTest
+[ RUN ] LoggingTest.InterleavingLoggingAndAssertions
+(expecting 2 failures on (3) >= (a[i]))
+i == 0
+i == 1
+gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 9
+i == 2
+i == 3
+gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 6
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions (? ms)
+[----------] 1 test from LoggingTest (? ms total)
+
+[----------] Global test environment tear-down
+[==========] 4 tests from 2 test cases ran. (? ms total)
+[ PASSED ] 0 tests.
+[ FAILED ] 4 tests, listed below:
+[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
+[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
+[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
+[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
+
+ 4 FAILED TESTS
+ YOU HAVE 1 DISABLED TEST
+
+Note: Google Test filter = *DISABLED_*
+[==========] Running 1 test from 1 test case.
+[----------] Global test environment set-up.
+[----------] 1 test from DisabledTestsWarningTest
+[ RUN ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
+[ OK ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
+[----------] Global test environment tear-down
+[==========] 1 test from 1 test case ran.
+[ PASSED ] 1 test.
+Note: Google Test filter = PassingTest.*
+Note: This is test shard 1 of 2.
+[==========] Running 1 test from 1 test case.
+[----------] Global test environment set-up.
+[----------] 1 test from PassingTest
+[ RUN ] PassingTest.PassingTest2
+[ OK ] PassingTest.PassingTest2
+[----------] Global test environment tear-down
+[==========] 1 test from 1 test case ran.
+[ PASSED ] 1 test.
+
+ YOU HAVE 1 DISABLED TEST
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_pred_impl_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_pred_impl_unittest.cc
new file mode 100644
index 0000000..e7ee54b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_pred_impl_unittest.cc
@@ -0,0 +1,2432 @@
+// Copyright 2006, 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 file is AUTOMATICALLY GENERATED on 10/02/2008 by command
+// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
+
+// Regression test for gtest_pred_impl.h
+//
+// This file is generated by a script and quite long. If you intend to
+// learn how Google Test works by reading its unit tests, read
+// gtest_unittest.cc instead.
+//
+// This is intended as a regression test for the Google Test predicate
+// assertions. We compile it as part of the gtest_unittest target
+// only to keep the implementation tidy and compact, as it is quite
+// involved to set up the stage for testing Google Test using Google
+// Test itself.
+//
+// Currently, gtest_unittest takes ~11 seconds to run in the testing
+// daemon. In the future, if it grows too large and needs much more
+// time to finish, we should consider separating this file into a
+// stand-alone regression test.
+
+#include <iostream>
+
+#include <gtest/gtest.h>
+#include <gtest/gtest-spi.h>
+
+// A user-defined data type.
+struct Bool {
+ explicit Bool(int val) : value(val != 0) {}
+
+ bool operator>(int n) const { return value > Bool(n).value; }
+
+ Bool operator+(const Bool& rhs) const { return Bool(value + rhs.value); }
+
+ bool operator==(const Bool& rhs) const { return value == rhs.value; }
+
+ bool value;
+};
+
+// Enables Bool to be used in assertions.
+std::ostream& operator<<(std::ostream& os, const Bool& x) {
+ return os << (x.value ? "true" : "false");
+}
+
+// Sample functions/functors for testing unary predicate assertions.
+
+// A unary predicate function.
+template <typename T1>
+bool PredFunction1(T1 v1) {
+ return v1 > 0;
+}
+
+// The following two functions are needed to circumvent a bug in
+// gcc 2.95.3, which sometimes has problem with the above template
+// function.
+bool PredFunction1Int(int v1) {
+ return v1 > 0;
+}
+bool PredFunction1Bool(Bool v1) {
+ return v1 > 0;
+}
+
+// A unary predicate functor.
+struct PredFunctor1 {
+ template <typename T1>
+ bool operator()(const T1& v1) {
+ return v1 > 0;
+ }
+};
+
+// A unary predicate-formatter function.
+template <typename T1>
+testing::AssertionResult PredFormatFunction1(const char* e1,
+ const T1& v1) {
+ if (PredFunction1(v1))
+ return testing::AssertionSuccess();
+
+ testing::Message msg;
+ msg << e1
+ << " is expected to be positive, but evaluates to "
+ << v1 << ".";
+ return testing::AssertionFailure(msg);
+}
+
+// A unary predicate-formatter functor.
+struct PredFormatFunctor1 {
+ template <typename T1>
+ testing::AssertionResult operator()(const char* e1,
+ const T1& v1) const {
+ return PredFormatFunction1(e1, v1);
+ }
+};
+
+// Tests for {EXPECT|ASSERT}_PRED_FORMAT1.
+
+class Predicate1Test : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ expected_to_finish_ = true;
+ finished_ = false;
+ n1_ = 0;
+ }
+
+ virtual void TearDown() {
+ // Verifies that each of the predicate's arguments was evaluated
+ // exactly once.
+ EXPECT_EQ(1, n1_) <<
+ "The predicate assertion didn't evaluate argument 2 "
+ "exactly once.";
+
+ // Verifies that the control flow in the test function is expected.
+ if (expected_to_finish_ && !finished_) {
+ FAIL() << "The predicate assertion unexpactedly aborted the test.";
+ } else if (!expected_to_finish_ && finished_) {
+ FAIL() << "The failed predicate assertion didn't abort the test "
+ "as expected.";
+ }
+ }
+
+ // true iff the test function is expected to run to finish.
+ static bool expected_to_finish_;
+
+ // true iff the test function did run to finish.
+ static bool finished_;
+
+ static int n1_;
+};
+
+bool Predicate1Test::expected_to_finish_;
+bool Predicate1Test::finished_;
+int Predicate1Test::n1_;
+
+typedef Predicate1Test EXPECT_PRED_FORMAT1Test;
+typedef Predicate1Test ASSERT_PRED_FORMAT1Test;
+typedef Predicate1Test EXPECT_PRED1Test;
+typedef Predicate1Test ASSERT_PRED1Test;
+
+// Tests a successful EXPECT_PRED1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED1Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED1(PredFunction1Int,
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED1Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED1(PredFunction1Bool,
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED1Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED1(PredFunctor1(),
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED1Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED1(PredFunctor1(),
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED1Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED1(PredFunction1Int,
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED1Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED1(PredFunction1Bool,
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED1Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED1(PredFunctor1(),
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED1Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED1(PredFunctor1(),
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED1Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED1(PredFunction1Int,
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED1Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED1(PredFunction1Bool,
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED1Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED1(PredFunctor1(),
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED1Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED1(PredFunctor1(),
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED1Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED1(PredFunction1Int,
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED1Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED1(PredFunction1Bool,
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED1Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED1(PredFunctor1(),
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED1Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED1(PredFunctor1(),
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT1(PredFormatFunction1,
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT1(PredFormatFunction1,
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT1(PredFormatFunction1,
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT1(PredFormatFunction1,
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT1(PredFormatFunction1,
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT1(PredFormatFunction1,
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
+ ++n1_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
+ Bool(++n1_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT1(PredFormatFunction1,
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT1(PredFormatFunction1,
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
+ n1_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT1 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
+ Bool(n1_++));
+ finished_ = true;
+ }, "");
+}
+// Sample functions/functors for testing binary predicate assertions.
+
+// A binary predicate function.
+template <typename T1, typename T2>
+bool PredFunction2(T1 v1, T2 v2) {
+ return v1 + v2 > 0;
+}
+
+// The following two functions are needed to circumvent a bug in
+// gcc 2.95.3, which sometimes has problem with the above template
+// function.
+bool PredFunction2Int(int v1, int v2) {
+ return v1 + v2 > 0;
+}
+bool PredFunction2Bool(Bool v1, Bool v2) {
+ return v1 + v2 > 0;
+}
+
+// A binary predicate functor.
+struct PredFunctor2 {
+ template <typename T1, typename T2>
+ bool operator()(const T1& v1,
+ const T2& v2) {
+ return v1 + v2 > 0;
+ }
+};
+
+// A binary predicate-formatter function.
+template <typename T1, typename T2>
+testing::AssertionResult PredFormatFunction2(const char* e1,
+ const char* e2,
+ const T1& v1,
+ const T2& v2) {
+ if (PredFunction2(v1, v2))
+ return testing::AssertionSuccess();
+
+ testing::Message msg;
+ msg << e1 << " + " << e2
+ << " is expected to be positive, but evaluates to "
+ << v1 + v2 << ".";
+ return testing::AssertionFailure(msg);
+}
+
+// A binary predicate-formatter functor.
+struct PredFormatFunctor2 {
+ template <typename T1, typename T2>
+ testing::AssertionResult operator()(const char* e1,
+ const char* e2,
+ const T1& v1,
+ const T2& v2) const {
+ return PredFormatFunction2(e1, e2, v1, v2);
+ }
+};
+
+// Tests for {EXPECT|ASSERT}_PRED_FORMAT2.
+
+class Predicate2Test : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ expected_to_finish_ = true;
+ finished_ = false;
+ n1_ = n2_ = 0;
+ }
+
+ virtual void TearDown() {
+ // Verifies that each of the predicate's arguments was evaluated
+ // exactly once.
+ EXPECT_EQ(1, n1_) <<
+ "The predicate assertion didn't evaluate argument 2 "
+ "exactly once.";
+ EXPECT_EQ(1, n2_) <<
+ "The predicate assertion didn't evaluate argument 3 "
+ "exactly once.";
+
+ // Verifies that the control flow in the test function is expected.
+ if (expected_to_finish_ && !finished_) {
+ FAIL() << "The predicate assertion unexpactedly aborted the test.";
+ } else if (!expected_to_finish_ && finished_) {
+ FAIL() << "The failed predicate assertion didn't abort the test "
+ "as expected.";
+ }
+ }
+
+ // true iff the test function is expected to run to finish.
+ static bool expected_to_finish_;
+
+ // true iff the test function did run to finish.
+ static bool finished_;
+
+ static int n1_;
+ static int n2_;
+};
+
+bool Predicate2Test::expected_to_finish_;
+bool Predicate2Test::finished_;
+int Predicate2Test::n1_;
+int Predicate2Test::n2_;
+
+typedef Predicate2Test EXPECT_PRED_FORMAT2Test;
+typedef Predicate2Test ASSERT_PRED_FORMAT2Test;
+typedef Predicate2Test EXPECT_PRED2Test;
+typedef Predicate2Test ASSERT_PRED2Test;
+
+// Tests a successful EXPECT_PRED2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED2Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED2(PredFunction2Int,
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED2Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED2(PredFunction2Bool,
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED2Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED2(PredFunctor2(),
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED2Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED2(PredFunctor2(),
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED2Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED2(PredFunction2Int,
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED2Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED2(PredFunction2Bool,
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED2Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED2(PredFunctor2(),
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED2Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED2(PredFunctor2(),
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED2Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED2(PredFunction2Int,
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED2Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED2(PredFunction2Bool,
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED2Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED2(PredFunctor2(),
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED2Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED2(PredFunctor2(),
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED2Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED2(PredFunction2Int,
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED2Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED2(PredFunction2Bool,
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED2Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED2(PredFunctor2(),
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED2Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED2(PredFunctor2(),
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT2(PredFormatFunction2,
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT2(PredFormatFunction2,
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(PredFormatFunction2,
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(PredFormatFunction2,
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT2(PredFormatFunction2,
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT2(PredFormatFunction2,
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
+ ++n1_,
+ ++n2_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
+ Bool(++n1_),
+ Bool(++n2_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT2(PredFormatFunction2,
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT2(PredFormatFunction2,
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
+ n1_++,
+ n2_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT2 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
+ Bool(n1_++),
+ Bool(n2_++));
+ finished_ = true;
+ }, "");
+}
+// Sample functions/functors for testing ternary predicate assertions.
+
+// A ternary predicate function.
+template <typename T1, typename T2, typename T3>
+bool PredFunction3(T1 v1, T2 v2, T3 v3) {
+ return v1 + v2 + v3 > 0;
+}
+
+// The following two functions are needed to circumvent a bug in
+// gcc 2.95.3, which sometimes has problem with the above template
+// function.
+bool PredFunction3Int(int v1, int v2, int v3) {
+ return v1 + v2 + v3 > 0;
+}
+bool PredFunction3Bool(Bool v1, Bool v2, Bool v3) {
+ return v1 + v2 + v3 > 0;
+}
+
+// A ternary predicate functor.
+struct PredFunctor3 {
+ template <typename T1, typename T2, typename T3>
+ bool operator()(const T1& v1,
+ const T2& v2,
+ const T3& v3) {
+ return v1 + v2 + v3 > 0;
+ }
+};
+
+// A ternary predicate-formatter function.
+template <typename T1, typename T2, typename T3>
+testing::AssertionResult PredFormatFunction3(const char* e1,
+ const char* e2,
+ const char* e3,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3) {
+ if (PredFunction3(v1, v2, v3))
+ return testing::AssertionSuccess();
+
+ testing::Message msg;
+ msg << e1 << " + " << e2 << " + " << e3
+ << " is expected to be positive, but evaluates to "
+ << v1 + v2 + v3 << ".";
+ return testing::AssertionFailure(msg);
+}
+
+// A ternary predicate-formatter functor.
+struct PredFormatFunctor3 {
+ template <typename T1, typename T2, typename T3>
+ testing::AssertionResult operator()(const char* e1,
+ const char* e2,
+ const char* e3,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3) const {
+ return PredFormatFunction3(e1, e2, e3, v1, v2, v3);
+ }
+};
+
+// Tests for {EXPECT|ASSERT}_PRED_FORMAT3.
+
+class Predicate3Test : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ expected_to_finish_ = true;
+ finished_ = false;
+ n1_ = n2_ = n3_ = 0;
+ }
+
+ virtual void TearDown() {
+ // Verifies that each of the predicate's arguments was evaluated
+ // exactly once.
+ EXPECT_EQ(1, n1_) <<
+ "The predicate assertion didn't evaluate argument 2 "
+ "exactly once.";
+ EXPECT_EQ(1, n2_) <<
+ "The predicate assertion didn't evaluate argument 3 "
+ "exactly once.";
+ EXPECT_EQ(1, n3_) <<
+ "The predicate assertion didn't evaluate argument 4 "
+ "exactly once.";
+
+ // Verifies that the control flow in the test function is expected.
+ if (expected_to_finish_ && !finished_) {
+ FAIL() << "The predicate assertion unexpactedly aborted the test.";
+ } else if (!expected_to_finish_ && finished_) {
+ FAIL() << "The failed predicate assertion didn't abort the test "
+ "as expected.";
+ }
+ }
+
+ // true iff the test function is expected to run to finish.
+ static bool expected_to_finish_;
+
+ // true iff the test function did run to finish.
+ static bool finished_;
+
+ static int n1_;
+ static int n2_;
+ static int n3_;
+};
+
+bool Predicate3Test::expected_to_finish_;
+bool Predicate3Test::finished_;
+int Predicate3Test::n1_;
+int Predicate3Test::n2_;
+int Predicate3Test::n3_;
+
+typedef Predicate3Test EXPECT_PRED_FORMAT3Test;
+typedef Predicate3Test ASSERT_PRED_FORMAT3Test;
+typedef Predicate3Test EXPECT_PRED3Test;
+typedef Predicate3Test ASSERT_PRED3Test;
+
+// Tests a successful EXPECT_PRED3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED3Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED3(PredFunction3Int,
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED3Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED3(PredFunction3Bool,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED3Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED3(PredFunctor3(),
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED3Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED3(PredFunctor3(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED3Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED3(PredFunction3Int,
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED3Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED3(PredFunction3Bool,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED3Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED3(PredFunctor3(),
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED3Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED3(PredFunctor3(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED3Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED3(PredFunction3Int,
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED3Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED3(PredFunction3Bool,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED3Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED3(PredFunctor3(),
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED3Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED3(PredFunctor3(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED3Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED3(PredFunction3Int,
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED3Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED3(PredFunction3Bool,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED3Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED3(PredFunctor3(),
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED3Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED3(PredFunctor3(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT3(PredFormatFunction3,
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT3(PredFormatFunction3,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT3(PredFormatFunction3,
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT3(PredFormatFunction3,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT3(PredFormatFunction3,
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT3(PredFormatFunction3,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
+ ++n1_,
+ ++n2_,
+ ++n3_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT3(PredFormatFunction3,
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT3(PredFormatFunction3,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
+ n1_++,
+ n2_++,
+ n3_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT3 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++));
+ finished_ = true;
+ }, "");
+}
+// Sample functions/functors for testing 4-ary predicate assertions.
+
+// A 4-ary predicate function.
+template <typename T1, typename T2, typename T3, typename T4>
+bool PredFunction4(T1 v1, T2 v2, T3 v3, T4 v4) {
+ return v1 + v2 + v3 + v4 > 0;
+}
+
+// The following two functions are needed to circumvent a bug in
+// gcc 2.95.3, which sometimes has problem with the above template
+// function.
+bool PredFunction4Int(int v1, int v2, int v3, int v4) {
+ return v1 + v2 + v3 + v4 > 0;
+}
+bool PredFunction4Bool(Bool v1, Bool v2, Bool v3, Bool v4) {
+ return v1 + v2 + v3 + v4 > 0;
+}
+
+// A 4-ary predicate functor.
+struct PredFunctor4 {
+ template <typename T1, typename T2, typename T3, typename T4>
+ bool operator()(const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4) {
+ return v1 + v2 + v3 + v4 > 0;
+ }
+};
+
+// A 4-ary predicate-formatter function.
+template <typename T1, typename T2, typename T3, typename T4>
+testing::AssertionResult PredFormatFunction4(const char* e1,
+ const char* e2,
+ const char* e3,
+ const char* e4,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4) {
+ if (PredFunction4(v1, v2, v3, v4))
+ return testing::AssertionSuccess();
+
+ testing::Message msg;
+ msg << e1 << " + " << e2 << " + " << e3 << " + " << e4
+ << " is expected to be positive, but evaluates to "
+ << v1 + v2 + v3 + v4 << ".";
+ return testing::AssertionFailure(msg);
+}
+
+// A 4-ary predicate-formatter functor.
+struct PredFormatFunctor4 {
+ template <typename T1, typename T2, typename T3, typename T4>
+ testing::AssertionResult operator()(const char* e1,
+ const char* e2,
+ const char* e3,
+ const char* e4,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4) const {
+ return PredFormatFunction4(e1, e2, e3, e4, v1, v2, v3, v4);
+ }
+};
+
+// Tests for {EXPECT|ASSERT}_PRED_FORMAT4.
+
+class Predicate4Test : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ expected_to_finish_ = true;
+ finished_ = false;
+ n1_ = n2_ = n3_ = n4_ = 0;
+ }
+
+ virtual void TearDown() {
+ // Verifies that each of the predicate's arguments was evaluated
+ // exactly once.
+ EXPECT_EQ(1, n1_) <<
+ "The predicate assertion didn't evaluate argument 2 "
+ "exactly once.";
+ EXPECT_EQ(1, n2_) <<
+ "The predicate assertion didn't evaluate argument 3 "
+ "exactly once.";
+ EXPECT_EQ(1, n3_) <<
+ "The predicate assertion didn't evaluate argument 4 "
+ "exactly once.";
+ EXPECT_EQ(1, n4_) <<
+ "The predicate assertion didn't evaluate argument 5 "
+ "exactly once.";
+
+ // Verifies that the control flow in the test function is expected.
+ if (expected_to_finish_ && !finished_) {
+ FAIL() << "The predicate assertion unexpactedly aborted the test.";
+ } else if (!expected_to_finish_ && finished_) {
+ FAIL() << "The failed predicate assertion didn't abort the test "
+ "as expected.";
+ }
+ }
+
+ // true iff the test function is expected to run to finish.
+ static bool expected_to_finish_;
+
+ // true iff the test function did run to finish.
+ static bool finished_;
+
+ static int n1_;
+ static int n2_;
+ static int n3_;
+ static int n4_;
+};
+
+bool Predicate4Test::expected_to_finish_;
+bool Predicate4Test::finished_;
+int Predicate4Test::n1_;
+int Predicate4Test::n2_;
+int Predicate4Test::n3_;
+int Predicate4Test::n4_;
+
+typedef Predicate4Test EXPECT_PRED_FORMAT4Test;
+typedef Predicate4Test ASSERT_PRED_FORMAT4Test;
+typedef Predicate4Test EXPECT_PRED4Test;
+typedef Predicate4Test ASSERT_PRED4Test;
+
+// Tests a successful EXPECT_PRED4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED4Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED4(PredFunction4Int,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED4Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED4(PredFunction4Bool,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED4Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED4(PredFunctor4(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED4Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED4(PredFunctor4(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED4Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED4(PredFunction4Int,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED4Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED4(PredFunction4Bool,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED4Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED4(PredFunctor4(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED4Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED4(PredFunctor4(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED4Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED4(PredFunction4Int,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED4Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED4(PredFunction4Bool,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED4Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED4(PredFunctor4(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED4Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED4(PredFunctor4(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED4Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED4(PredFunction4Int,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED4Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED4(PredFunction4Bool,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED4Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED4(PredFunctor4(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED4Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED4(PredFunctor4(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT4(PredFormatFunction4,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT4(PredFormatFunction4,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT4(PredFormatFunction4,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT4(PredFormatFunction4,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT4(PredFormatFunction4,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT4(PredFormatFunction4,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT4(PredFormatFunction4,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT4(PredFormatFunction4,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT4 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++));
+ finished_ = true;
+ }, "");
+}
+// Sample functions/functors for testing 5-ary predicate assertions.
+
+// A 5-ary predicate function.
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+bool PredFunction5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) {
+ return v1 + v2 + v3 + v4 + v5 > 0;
+}
+
+// The following two functions are needed to circumvent a bug in
+// gcc 2.95.3, which sometimes has problem with the above template
+// function.
+bool PredFunction5Int(int v1, int v2, int v3, int v4, int v5) {
+ return v1 + v2 + v3 + v4 + v5 > 0;
+}
+bool PredFunction5Bool(Bool v1, Bool v2, Bool v3, Bool v4, Bool v5) {
+ return v1 + v2 + v3 + v4 + v5 > 0;
+}
+
+// A 5-ary predicate functor.
+struct PredFunctor5 {
+ template <typename T1, typename T2, typename T3, typename T4, typename T5>
+ bool operator()(const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4,
+ const T5& v5) {
+ return v1 + v2 + v3 + v4 + v5 > 0;
+ }
+};
+
+// A 5-ary predicate-formatter function.
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+testing::AssertionResult PredFormatFunction5(const char* e1,
+ const char* e2,
+ const char* e3,
+ const char* e4,
+ const char* e5,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4,
+ const T5& v5) {
+ if (PredFunction5(v1, v2, v3, v4, v5))
+ return testing::AssertionSuccess();
+
+ testing::Message msg;
+ msg << e1 << " + " << e2 << " + " << e3 << " + " << e4 << " + " << e5
+ << " is expected to be positive, but evaluates to "
+ << v1 + v2 + v3 + v4 + v5 << ".";
+ return testing::AssertionFailure(msg);
+}
+
+// A 5-ary predicate-formatter functor.
+struct PredFormatFunctor5 {
+ template <typename T1, typename T2, typename T3, typename T4, typename T5>
+ testing::AssertionResult operator()(const char* e1,
+ const char* e2,
+ const char* e3,
+ const char* e4,
+ const char* e5,
+ const T1& v1,
+ const T2& v2,
+ const T3& v3,
+ const T4& v4,
+ const T5& v5) const {
+ return PredFormatFunction5(e1, e2, e3, e4, e5, v1, v2, v3, v4, v5);
+ }
+};
+
+// Tests for {EXPECT|ASSERT}_PRED_FORMAT5.
+
+class Predicate5Test : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ expected_to_finish_ = true;
+ finished_ = false;
+ n1_ = n2_ = n3_ = n4_ = n5_ = 0;
+ }
+
+ virtual void TearDown() {
+ // Verifies that each of the predicate's arguments was evaluated
+ // exactly once.
+ EXPECT_EQ(1, n1_) <<
+ "The predicate assertion didn't evaluate argument 2 "
+ "exactly once.";
+ EXPECT_EQ(1, n2_) <<
+ "The predicate assertion didn't evaluate argument 3 "
+ "exactly once.";
+ EXPECT_EQ(1, n3_) <<
+ "The predicate assertion didn't evaluate argument 4 "
+ "exactly once.";
+ EXPECT_EQ(1, n4_) <<
+ "The predicate assertion didn't evaluate argument 5 "
+ "exactly once.";
+ EXPECT_EQ(1, n5_) <<
+ "The predicate assertion didn't evaluate argument 6 "
+ "exactly once.";
+
+ // Verifies that the control flow in the test function is expected.
+ if (expected_to_finish_ && !finished_) {
+ FAIL() << "The predicate assertion unexpactedly aborted the test.";
+ } else if (!expected_to_finish_ && finished_) {
+ FAIL() << "The failed predicate assertion didn't abort the test "
+ "as expected.";
+ }
+ }
+
+ // true iff the test function is expected to run to finish.
+ static bool expected_to_finish_;
+
+ // true iff the test function did run to finish.
+ static bool finished_;
+
+ static int n1_;
+ static int n2_;
+ static int n3_;
+ static int n4_;
+ static int n5_;
+};
+
+bool Predicate5Test::expected_to_finish_;
+bool Predicate5Test::finished_;
+int Predicate5Test::n1_;
+int Predicate5Test::n2_;
+int Predicate5Test::n3_;
+int Predicate5Test::n4_;
+int Predicate5Test::n5_;
+
+typedef Predicate5Test EXPECT_PRED_FORMAT5Test;
+typedef Predicate5Test ASSERT_PRED_FORMAT5Test;
+typedef Predicate5Test EXPECT_PRED5Test;
+typedef Predicate5Test ASSERT_PRED5Test;
+
+// Tests a successful EXPECT_PRED5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED5Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED5(PredFunction5Int,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED5Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED5(PredFunction5Bool,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED5Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED5(PredFunctor5(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED5Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED5(PredFunctor5(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED5Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED5(PredFunction5Int,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED5Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED5(PredFunction5Bool,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED5Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED5(PredFunctor5(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED5Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED5(PredFunctor5(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED5Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED5(PredFunction5Int,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED5Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED5(PredFunction5Bool,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED5Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED5(PredFunctor5(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED5Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED5(PredFunctor5(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED5Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED5(PredFunction5Int,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED5Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED5(PredFunction5Bool,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED5Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED5(PredFunctor5(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED5Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED5(PredFunctor5(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT5(PredFormatFunction5,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT5(PredFormatFunction5,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnBuiltInTypeSuccess) {
+ EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnUserTypeSuccess) {
+ EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a failed EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT5(PredFormatFunction5,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT5(PredFormatFunction5,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnBuiltInTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed EXPECT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnUserTypeFailure) {
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a successful ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT5(PredFormatFunction5,
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT5(PredFormatFunction5,
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnBuiltInTypeSuccess) {
+ ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
+ ++n1_,
+ ++n2_,
+ ++n3_,
+ ++n4_,
+ ++n5_);
+ finished_ = true;
+}
+
+// Tests a successful ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnUserTypeSuccess) {
+ ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
+ Bool(++n1_),
+ Bool(++n2_),
+ Bool(++n3_),
+ Bool(++n4_),
+ Bool(++n5_));
+ finished_ = true;
+}
+
+// Tests a failed ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT5(PredFormatFunction5,
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a function on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT5(PredFormatFunction5,
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a built-in type (int).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnBuiltInTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
+ n1_++,
+ n2_++,
+ n3_++,
+ n4_++,
+ n5_++);
+ finished_ = true;
+ }, "");
+}
+
+// Tests a failed ASSERT_PRED_FORMAT5 where the
+// predicate-formatter is a functor on a user-defined type (Bool).
+TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnUserTypeFailure) {
+ expected_to_finish_ = false;
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
+ Bool(n1_++),
+ Bool(n2_++),
+ Bool(n3_++),
+ Bool(n4_++),
+ Bool(n5_++));
+ finished_ = true;
+ }, "");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_prod_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_prod_test.cc
new file mode 100644
index 0000000..bc3201d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_prod_test.cc
@@ -0,0 +1,57 @@
+// Copyright 2006, 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: wan@google.com (Zhanyong Wan)
+//
+// Unit test for include/gtest/gtest_prod.h.
+
+#include <gtest/gtest.h>
+#include "test/production.h"
+
+// Tests that private members can be accessed from a TEST declared as
+// a friend of the class.
+TEST(PrivateCodeTest, CanAccessPrivateMembers) {
+ PrivateCode a;
+ EXPECT_EQ(0, a.x_);
+
+ a.set_x(1);
+ EXPECT_EQ(1, a.x_);
+}
+
+typedef testing::Test PrivateCodeFixtureTest;
+
+// Tests that private members can be accessed from a TEST_F declared
+// as a friend of the class.
+TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) {
+ PrivateCode a;
+ EXPECT_EQ(0, a.x_);
+
+ a.set_x(2);
+ EXPECT_EQ(2, a.x_);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_repeat_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_repeat_test.cc
new file mode 100644
index 0000000..df6868b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_repeat_test.cc
@@ -0,0 +1,253 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Tests the --gtest_repeat=number flag.
+
+#include <stdlib.h>
+#include <iostream>
+#include <gtest/gtest.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+namespace testing {
+
+GTEST_DECLARE_string_(death_test_style);
+GTEST_DECLARE_string_(filter);
+GTEST_DECLARE_int32_(repeat);
+
+} // namespace testing
+
+using testing::GTEST_FLAG(death_test_style);
+using testing::GTEST_FLAG(filter);
+using testing::GTEST_FLAG(repeat);
+
+namespace {
+
+// We need this when we are testing Google Test itself and therefore
+// cannot use Google Test assertions.
+#define GTEST_CHECK_INT_EQ_(expected, actual) \
+ do {\
+ const int expected_val = (expected);\
+ const int actual_val = (actual);\
+ if (::testing::internal::IsTrue(expected_val != actual_val)) {\
+ ::std::cout << "Value of: " #actual "\n"\
+ << " Actual: " << actual_val << "\n"\
+ << "Expected: " #expected "\n"\
+ << "Which is: " << expected_val << "\n";\
+ abort();\
+ }\
+ } while(::testing::internal::AlwaysFalse())
+
+
+// Used for verifying that global environment set-up and tear-down are
+// inside the gtest_repeat loop.
+
+int g_environment_set_up_count = 0;
+int g_environment_tear_down_count = 0;
+
+class MyEnvironment : public testing::Environment {
+ public:
+ MyEnvironment() {}
+ virtual void SetUp() { g_environment_set_up_count++; }
+ virtual void TearDown() { g_environment_tear_down_count++; }
+};
+
+// A test that should fail.
+
+int g_should_fail_count = 0;
+
+TEST(FooTest, ShouldFail) {
+ g_should_fail_count++;
+ EXPECT_EQ(0, 1) << "Expected failure.";
+}
+
+// A test that should pass.
+
+int g_should_pass_count = 0;
+
+TEST(FooTest, ShouldPass) {
+ g_should_pass_count++;
+}
+
+// A test that contains a thread-safe death test and a fast death
+// test. It should pass.
+
+int g_death_test_count = 0;
+
+TEST(BarDeathTest, ThreadSafeAndFast) {
+ g_death_test_count++;
+
+ GTEST_FLAG(death_test_style) = "threadsafe";
+ EXPECT_DEATH_IF_SUPPORTED(abort(), "");
+
+ GTEST_FLAG(death_test_style) = "fast";
+ EXPECT_DEATH_IF_SUPPORTED(abort(), "");
+}
+
+#if GTEST_HAS_PARAM_TEST
+int g_param_test_count = 0;
+
+const int kNumberOfParamTests = 10;
+
+class MyParamTest : public testing::TestWithParam<int> {};
+
+TEST_P(MyParamTest, ShouldPass) {
+ // TODO(vladl@google.com): Make parameter value checking robust
+ // WRT order of tests.
+ GTEST_CHECK_INT_EQ_(g_param_test_count % kNumberOfParamTests, GetParam());
+ g_param_test_count++;
+}
+INSTANTIATE_TEST_CASE_P(MyParamSequence,
+ MyParamTest,
+ testing::Range(0, kNumberOfParamTests));
+#endif // GTEST_HAS_PARAM_TEST
+
+// Resets the count for each test.
+void ResetCounts() {
+ g_environment_set_up_count = 0;
+ g_environment_tear_down_count = 0;
+ g_should_fail_count = 0;
+ g_should_pass_count = 0;
+ g_death_test_count = 0;
+#if GTEST_HAS_PARAM_TEST
+ g_param_test_count = 0;
+#endif // GTEST_HAS_PARAM_TEST
+}
+
+// Checks that the count for each test is expected.
+void CheckCounts(int expected) {
+ GTEST_CHECK_INT_EQ_(expected, g_environment_set_up_count);
+ GTEST_CHECK_INT_EQ_(expected, g_environment_tear_down_count);
+ GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);
+ GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
+ GTEST_CHECK_INT_EQ_(expected, g_death_test_count);
+#if GTEST_HAS_PARAM_TEST
+ GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);
+#endif // GTEST_HAS_PARAM_TEST
+}
+
+// Tests the behavior of Google Test when --gtest_repeat is not specified.
+void TestRepeatUnspecified() {
+ ResetCounts();
+ GTEST_CHECK_INT_EQ_(1, RUN_ALL_TESTS());
+ CheckCounts(1);
+}
+
+// Tests the behavior of Google Test when --gtest_repeat has the given value.
+void TestRepeat(int repeat) {
+ GTEST_FLAG(repeat) = repeat;
+
+ ResetCounts();
+ GTEST_CHECK_INT_EQ_(repeat > 0 ? 1 : 0, RUN_ALL_TESTS());
+ CheckCounts(repeat);
+}
+
+// Tests using --gtest_repeat when --gtest_filter specifies an empty
+// set of tests.
+void TestRepeatWithEmptyFilter(int repeat) {
+ GTEST_FLAG(repeat) = repeat;
+ GTEST_FLAG(filter) = "None";
+
+ ResetCounts();
+ GTEST_CHECK_INT_EQ_(0, RUN_ALL_TESTS());
+ CheckCounts(0);
+}
+
+// Tests using --gtest_repeat when --gtest_filter specifies a set of
+// successful tests.
+void TestRepeatWithFilterForSuccessfulTests(int repeat) {
+ GTEST_FLAG(repeat) = repeat;
+ GTEST_FLAG(filter) = "*-*ShouldFail";
+
+ ResetCounts();
+ GTEST_CHECK_INT_EQ_(0, RUN_ALL_TESTS());
+ GTEST_CHECK_INT_EQ_(repeat, g_environment_set_up_count);
+ GTEST_CHECK_INT_EQ_(repeat, g_environment_tear_down_count);
+ GTEST_CHECK_INT_EQ_(0, g_should_fail_count);
+ GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
+ GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);
+#if GTEST_HAS_PARAM_TEST
+ GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);
+#endif // GTEST_HAS_PARAM_TEST
+}
+
+// Tests using --gtest_repeat when --gtest_filter specifies a set of
+// failed tests.
+void TestRepeatWithFilterForFailedTests(int repeat) {
+ GTEST_FLAG(repeat) = repeat;
+ GTEST_FLAG(filter) = "*ShouldFail";
+
+ ResetCounts();
+ GTEST_CHECK_INT_EQ_(1, RUN_ALL_TESTS());
+ GTEST_CHECK_INT_EQ_(repeat, g_environment_set_up_count);
+ GTEST_CHECK_INT_EQ_(repeat, g_environment_tear_down_count);
+ GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);
+ GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
+ GTEST_CHECK_INT_EQ_(0, g_death_test_count);
+#if GTEST_HAS_PARAM_TEST
+ GTEST_CHECK_INT_EQ_(0, g_param_test_count);
+#endif // GTEST_HAS_PARAM_TEST
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+ testing::AddGlobalTestEnvironment(new MyEnvironment);
+
+ TestRepeatUnspecified();
+ TestRepeat(0);
+ TestRepeat(1);
+ TestRepeat(5);
+
+ TestRepeatWithEmptyFilter(2);
+ TestRepeatWithEmptyFilter(3);
+
+ TestRepeatWithFilterForSuccessfulTests(3);
+
+ TestRepeatWithFilterForFailedTests(4);
+
+ // It would be nice to verify that the tests indeed loop forever
+ // when GTEST_FLAG(repeat) is negative, but this test will be quite
+ // complicated to write. Since this flag is for interactive
+ // debugging only and doesn't affect the normal test result, such a
+ // test would be an overkill.
+
+ printf("PASS\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test.py
new file mode 100755
index 0000000..30d0303
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test.py
@@ -0,0 +1,325 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Verifies that test shuffling works."""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import gtest_test_utils
+
+# Command to run the gtest_shuffle_test_ program.
+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_shuffle_test_')
+
+# The environment variables for test sharding.
+TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS'
+SHARD_INDEX_ENV_VAR = 'GTEST_SHARD_INDEX'
+
+TEST_FILTER = 'A*.A:A*.B:C*'
+
+ALL_TESTS = []
+ACTIVE_TESTS = []
+FILTERED_TESTS = []
+SHARDED_TESTS = []
+
+SHUFFLED_ALL_TESTS = []
+SHUFFLED_ACTIVE_TESTS = []
+SHUFFLED_FILTERED_TESTS = []
+SHUFFLED_SHARDED_TESTS = []
+
+
+def AlsoRunDisabledTestsFlag():
+ return '--gtest_also_run_disabled_tests'
+
+
+def FilterFlag(test_filter):
+ return '--gtest_filter=%s' % (test_filter,)
+
+
+def RepeatFlag(n):
+ return '--gtest_repeat=%s' % (n,)
+
+
+def ShuffleFlag():
+ return '--gtest_shuffle'
+
+
+def RandomSeedFlag(n):
+ return '--gtest_random_seed=%s' % (n,)
+
+
+def RunAndReturnOutput(extra_env, args):
+ """Runs the test program and returns its output."""
+
+ environ_copy = os.environ.copy()
+ environ_copy.update(extra_env)
+
+ return gtest_test_utils.Subprocess([COMMAND] + args, env=environ_copy).output
+
+
+def GetTestsForAllIterations(extra_env, args):
+ """Runs the test program and returns a list of test lists.
+
+ Args:
+ extra_env: a map from environment variables to their values
+ args: command line flags to pass to gtest_shuffle_test_
+
+ Returns:
+ A list where the i-th element is the list of tests run in the i-th
+ test iteration.
+ """
+
+ test_iterations = []
+ for line in RunAndReturnOutput(extra_env, args).split('\n'):
+ if line.startswith('----'):
+ tests = []
+ test_iterations.append(tests)
+ elif line.strip():
+ tests.append(line.strip()) # 'TestCaseName.TestName'
+
+ return test_iterations
+
+
+def GetTestCases(tests):
+ """Returns a list of test cases in the given full test names.
+
+ Args:
+ tests: a list of full test names
+
+ Returns:
+ A list of test cases from 'tests', in their original order.
+ Consecutive duplicates are removed.
+ """
+
+ test_cases = []
+ for test in tests:
+ test_case = test.split('.')[0]
+ if not test_case in test_cases:
+ test_cases.append(test_case)
+
+ return test_cases
+
+
+def CalculateTestLists():
+ """Calculates the list of tests run under different flags."""
+
+ if not ALL_TESTS:
+ ALL_TESTS.extend(
+ GetTestsForAllIterations({}, [AlsoRunDisabledTestsFlag()])[0])
+
+ if not ACTIVE_TESTS:
+ ACTIVE_TESTS.extend(GetTestsForAllIterations({}, [])[0])
+
+ if not FILTERED_TESTS:
+ FILTERED_TESTS.extend(
+ GetTestsForAllIterations({}, [FilterFlag(TEST_FILTER)])[0])
+
+ if not SHARDED_TESTS:
+ SHARDED_TESTS.extend(
+ GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
+ SHARD_INDEX_ENV_VAR: '1'},
+ [])[0])
+
+ if not SHUFFLED_ALL_TESTS:
+ SHUFFLED_ALL_TESTS.extend(GetTestsForAllIterations(
+ {}, [AlsoRunDisabledTestsFlag(), ShuffleFlag(), RandomSeedFlag(1)])[0])
+
+ if not SHUFFLED_ACTIVE_TESTS:
+ SHUFFLED_ACTIVE_TESTS.extend(GetTestsForAllIterations(
+ {}, [ShuffleFlag(), RandomSeedFlag(1)])[0])
+
+ if not SHUFFLED_FILTERED_TESTS:
+ SHUFFLED_FILTERED_TESTS.extend(GetTestsForAllIterations(
+ {}, [ShuffleFlag(), RandomSeedFlag(1), FilterFlag(TEST_FILTER)])[0])
+
+ if not SHUFFLED_SHARDED_TESTS:
+ SHUFFLED_SHARDED_TESTS.extend(
+ GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
+ SHARD_INDEX_ENV_VAR: '1'},
+ [ShuffleFlag(), RandomSeedFlag(1)])[0])
+
+
+class GTestShuffleUnitTest(gtest_test_utils.TestCase):
+ """Tests test shuffling."""
+
+ def setUp(self):
+ CalculateTestLists()
+
+ def testShufflePreservesNumberOfTests(self):
+ self.assertEqual(len(ALL_TESTS), len(SHUFFLED_ALL_TESTS))
+ self.assertEqual(len(ACTIVE_TESTS), len(SHUFFLED_ACTIVE_TESTS))
+ self.assertEqual(len(FILTERED_TESTS), len(SHUFFLED_FILTERED_TESTS))
+ self.assertEqual(len(SHARDED_TESTS), len(SHUFFLED_SHARDED_TESTS))
+
+ def testShuffleChangesTestOrder(self):
+ self.assert_(SHUFFLED_ALL_TESTS != ALL_TESTS, SHUFFLED_ALL_TESTS)
+ self.assert_(SHUFFLED_ACTIVE_TESTS != ACTIVE_TESTS, SHUFFLED_ACTIVE_TESTS)
+ self.assert_(SHUFFLED_FILTERED_TESTS != FILTERED_TESTS,
+ SHUFFLED_FILTERED_TESTS)
+ self.assert_(SHUFFLED_SHARDED_TESTS != SHARDED_TESTS,
+ SHUFFLED_SHARDED_TESTS)
+
+ def testShuffleChangesTestCaseOrder(self):
+ self.assert_(GetTestCases(SHUFFLED_ALL_TESTS) != GetTestCases(ALL_TESTS),
+ GetTestCases(SHUFFLED_ALL_TESTS))
+ self.assert_(
+ GetTestCases(SHUFFLED_ACTIVE_TESTS) != GetTestCases(ACTIVE_TESTS),
+ GetTestCases(SHUFFLED_ACTIVE_TESTS))
+ self.assert_(
+ GetTestCases(SHUFFLED_FILTERED_TESTS) != GetTestCases(FILTERED_TESTS),
+ GetTestCases(SHUFFLED_FILTERED_TESTS))
+ self.assert_(
+ GetTestCases(SHUFFLED_SHARDED_TESTS) != GetTestCases(SHARDED_TESTS),
+ GetTestCases(SHUFFLED_SHARDED_TESTS))
+
+ def testShuffleDoesNotRepeatTest(self):
+ for test in SHUFFLED_ALL_TESTS:
+ self.assertEqual(1, SHUFFLED_ALL_TESTS.count(test),
+ '%s appears more than once' % (test,))
+ for test in SHUFFLED_ACTIVE_TESTS:
+ self.assertEqual(1, SHUFFLED_ACTIVE_TESTS.count(test),
+ '%s appears more than once' % (test,))
+ for test in SHUFFLED_FILTERED_TESTS:
+ self.assertEqual(1, SHUFFLED_FILTERED_TESTS.count(test),
+ '%s appears more than once' % (test,))
+ for test in SHUFFLED_SHARDED_TESTS:
+ self.assertEqual(1, SHUFFLED_SHARDED_TESTS.count(test),
+ '%s appears more than once' % (test,))
+
+ def testShuffleDoesNotCreateNewTest(self):
+ for test in SHUFFLED_ALL_TESTS:
+ self.assert_(test in ALL_TESTS, '%s is an invalid test' % (test,))
+ for test in SHUFFLED_ACTIVE_TESTS:
+ self.assert_(test in ACTIVE_TESTS, '%s is an invalid test' % (test,))
+ for test in SHUFFLED_FILTERED_TESTS:
+ self.assert_(test in FILTERED_TESTS, '%s is an invalid test' % (test,))
+ for test in SHUFFLED_SHARDED_TESTS:
+ self.assert_(test in SHARDED_TESTS, '%s is an invalid test' % (test,))
+
+ def testShuffleIncludesAllTests(self):
+ for test in ALL_TESTS:
+ self.assert_(test in SHUFFLED_ALL_TESTS, '%s is missing' % (test,))
+ for test in ACTIVE_TESTS:
+ self.assert_(test in SHUFFLED_ACTIVE_TESTS, '%s is missing' % (test,))
+ for test in FILTERED_TESTS:
+ self.assert_(test in SHUFFLED_FILTERED_TESTS, '%s is missing' % (test,))
+ for test in SHARDED_TESTS:
+ self.assert_(test in SHUFFLED_SHARDED_TESTS, '%s is missing' % (test,))
+
+ def testShuffleLeavesDeathTestsAtFront(self):
+ non_death_test_found = False
+ for test in SHUFFLED_ACTIVE_TESTS:
+ if 'DeathTest.' in test:
+ self.assert_(not non_death_test_found,
+ '%s appears after a non-death test' % (test,))
+ else:
+ non_death_test_found = True
+
+ def _VerifyTestCasesDoNotInterleave(self, tests):
+ test_cases = []
+ for test in tests:
+ [test_case, _] = test.split('.')
+ if test_cases and test_cases[-1] != test_case:
+ test_cases.append(test_case)
+ self.assertEqual(1, test_cases.count(test_case),
+ 'Test case %s is not grouped together in %s' %
+ (test_case, tests))
+
+ def testShuffleDoesNotInterleaveTestCases(self):
+ self._VerifyTestCasesDoNotInterleave(SHUFFLED_ALL_TESTS)
+ self._VerifyTestCasesDoNotInterleave(SHUFFLED_ACTIVE_TESTS)
+ self._VerifyTestCasesDoNotInterleave(SHUFFLED_FILTERED_TESTS)
+ self._VerifyTestCasesDoNotInterleave(SHUFFLED_SHARDED_TESTS)
+
+ def testShuffleRestoresOrderAfterEachIteration(self):
+ # Get the test lists in all 3 iterations, using random seed 1, 2,
+ # and 3 respectively. Google Test picks a different seed in each
+ # iteration, and this test depends on the current implementation
+ # picking successive numbers. This dependency is not ideal, but
+ # makes the test much easier to write.
+ [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
+ GetTestsForAllIterations(
+ {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
+
+ # Make sure running the tests with random seed 1 gets the same
+ # order as in iteration 1 above.
+ [tests_with_seed1] = GetTestsForAllIterations(
+ {}, [ShuffleFlag(), RandomSeedFlag(1)])
+ self.assertEqual(tests_in_iteration1, tests_with_seed1)
+
+ # Make sure running the tests with random seed 2 gets the same
+ # order as in iteration 2 above. Success means that Google Test
+ # correctly restores the test order before re-shuffling at the
+ # beginning of iteration 2.
+ [tests_with_seed2] = GetTestsForAllIterations(
+ {}, [ShuffleFlag(), RandomSeedFlag(2)])
+ self.assertEqual(tests_in_iteration2, tests_with_seed2)
+
+ # Make sure running the tests with random seed 3 gets the same
+ # order as in iteration 3 above. Success means that Google Test
+ # correctly restores the test order before re-shuffling at the
+ # beginning of iteration 3.
+ [tests_with_seed3] = GetTestsForAllIterations(
+ {}, [ShuffleFlag(), RandomSeedFlag(3)])
+ self.assertEqual(tests_in_iteration3, tests_with_seed3)
+
+ def testShuffleGeneratesNewOrderInEachIteration(self):
+ [tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
+ GetTestsForAllIterations(
+ {}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
+
+ self.assert_(tests_in_iteration1 != tests_in_iteration2,
+ tests_in_iteration1)
+ self.assert_(tests_in_iteration1 != tests_in_iteration3,
+ tests_in_iteration1)
+ self.assert_(tests_in_iteration2 != tests_in_iteration3,
+ tests_in_iteration2)
+
+ def testShuffleShardedTestsPreservesPartition(self):
+ # If we run M tests on N shards, the same M tests should be run in
+ # total, regardless of the random seeds used by the shards.
+ [tests1] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
+ SHARD_INDEX_ENV_VAR: '0'},
+ [ShuffleFlag(), RandomSeedFlag(1)])
+ [tests2] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
+ SHARD_INDEX_ENV_VAR: '1'},
+ [ShuffleFlag(), RandomSeedFlag(20)])
+ [tests3] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
+ SHARD_INDEX_ENV_VAR: '2'},
+ [ShuffleFlag(), RandomSeedFlag(25)])
+ sorted_sharded_tests = tests1 + tests2 + tests3
+ sorted_sharded_tests.sort()
+ sorted_active_tests = []
+ sorted_active_tests.extend(ACTIVE_TESTS)
+ sorted_active_tests.sort()
+ self.assertEqual(sorted_active_tests, sorted_sharded_tests)
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test_.cc
new file mode 100644
index 0000000..53ecf77
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_shuffle_test_.cc
@@ -0,0 +1,104 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Verifies that test shuffling works.
+
+#include <gtest/gtest.h>
+
+namespace {
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Message;
+using ::testing::Test;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::UnitTest;
+using ::testing::internal::String;
+using ::testing::internal::scoped_ptr;
+
+// The test methods are empty, as the sole purpose of this program is
+// to print the test names before/after shuffling.
+
+class A : public Test {};
+TEST_F(A, A) {}
+TEST_F(A, B) {}
+
+TEST(ADeathTest, A) {}
+TEST(ADeathTest, B) {}
+TEST(ADeathTest, C) {}
+
+TEST(B, A) {}
+TEST(B, B) {}
+TEST(B, C) {}
+TEST(B, DISABLED_D) {}
+TEST(B, DISABLED_E) {}
+
+TEST(BDeathTest, A) {}
+TEST(BDeathTest, B) {}
+
+TEST(C, A) {}
+TEST(C, B) {}
+TEST(C, C) {}
+TEST(C, DISABLED_D) {}
+
+TEST(CDeathTest, A) {}
+
+TEST(DISABLED_D, A) {}
+TEST(DISABLED_D, DISABLED_B) {}
+
+// This printer prints the full test names only, starting each test
+// iteration with a "----" marker.
+class TestNamePrinter : public EmptyTestEventListener {
+ public:
+ virtual void OnTestIterationStart(const UnitTest& /* unit_test */,
+ int /* iteration */) {
+ printf("----\n");
+ }
+
+ virtual void OnTestStart(const TestInfo& test_info) {
+ printf("%s.%s\n", test_info.test_case_name(), test_info.name());
+ }
+};
+
+} // namespace
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+
+ // Replaces the default printer with TestNamePrinter, which prints
+ // the test name only.
+ TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
+ delete listeners.Release(listeners.default_result_printer());
+ listeners.Append(new TestNamePrinter);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_sole_header_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_sole_header_test.cc
new file mode 100644
index 0000000..de91e80
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_sole_header_test.cc
@@ -0,0 +1,57 @@
+// Copyright 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.
+//
+// Author: mheule@google.com (Markus Heule)
+//
+// This test verifies that it's possible to use Google Test by including
+// the gtest.h header file alone.
+
+#include <gtest/gtest.h>
+
+namespace {
+
+void Subroutine() {
+ EXPECT_EQ(42, 42);
+}
+
+TEST(NoFatalFailureTest, ExpectNoFatalFailure) {
+ EXPECT_NO_FATAL_FAILURE(;);
+ EXPECT_NO_FATAL_FAILURE(SUCCEED());
+ EXPECT_NO_FATAL_FAILURE(Subroutine());
+ EXPECT_NO_FATAL_FAILURE({ SUCCEED(); });
+}
+
+TEST(NoFatalFailureTest, AssertNoFatalFailure) {
+ ASSERT_NO_FATAL_FAILURE(;);
+ ASSERT_NO_FATAL_FAILURE(SUCCEED());
+ ASSERT_NO_FATAL_FAILURE(Subroutine());
+ ASSERT_NO_FATAL_FAILURE({ SUCCEED(); });
+}
+
+} // namespace
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_stress_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_stress_test.cc
new file mode 100644
index 0000000..f5af78c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_stress_test.cc
@@ -0,0 +1,257 @@
+// 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Tests that SCOPED_TRACE() and various Google Test assertions can be
+// used in a large number of threads concurrently.
+
+#include <gtest/gtest.h>
+
+#include <iostream>
+#include <vector>
+
+// We must define this macro in order to #include
+// gtest-internal-inl.h. This is how Google Test prevents a user from
+// accidentally depending on its internal implementation.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+#if GTEST_IS_THREADSAFE
+
+namespace testing {
+namespace {
+
+using internal::Notification;
+using internal::String;
+using internal::TestPropertyKeyIs;
+using internal::ThreadWithParam;
+using internal::scoped_ptr;
+
+// In order to run tests in this file, for platforms where Google Test is
+// thread safe, implement ThreadWithParam. See the description of its API
+// in gtest-port.h, where it is defined for already supported platforms.
+
+// How many threads to create?
+const int kThreadCount = 50;
+
+String IdToKey(int id, const char* suffix) {
+ Message key;
+ key << "key_" << id << "_" << suffix;
+ return key.GetString();
+}
+
+String IdToString(int id) {
+ Message id_message;
+ id_message << id;
+ return id_message.GetString();
+}
+
+void ExpectKeyAndValueWereRecordedForId(
+ const std::vector<TestProperty>& properties,
+ int id, const char* suffix) {
+ TestPropertyKeyIs matches_key(IdToKey(id, suffix).c_str());
+ const std::vector<TestProperty>::const_iterator property =
+ std::find_if(properties.begin(), properties.end(), matches_key);
+ ASSERT_TRUE(property != properties.end())
+ << "expecting " << suffix << " value for id " << id;
+ EXPECT_STREQ(IdToString(id).c_str(), property->value());
+}
+
+// Calls a large number of Google Test assertions, where exactly one of them
+// will fail.
+void ManyAsserts(int id) {
+ GTEST_LOG_(INFO) << "Thread #" << id << " running...";
+
+ SCOPED_TRACE(Message() << "Thread #" << id);
+
+ for (int i = 0; i < kThreadCount; i++) {
+ SCOPED_TRACE(Message() << "Iteration #" << i);
+
+ // A bunch of assertions that should succeed.
+ EXPECT_TRUE(true);
+ ASSERT_FALSE(false) << "This shouldn't fail.";
+ EXPECT_STREQ("a", "a");
+ ASSERT_LE(5, 6);
+ EXPECT_EQ(i, i) << "This shouldn't fail.";
+
+ // RecordProperty() should interact safely with other threads as well.
+ // The shared_key forces property updates.
+ Test::RecordProperty(IdToKey(id, "string").c_str(), IdToString(id).c_str());
+ Test::RecordProperty(IdToKey(id, "int").c_str(), id);
+ Test::RecordProperty("shared_key", IdToString(id).c_str());
+
+ // This assertion should fail kThreadCount times per thread. It
+ // is for testing whether Google Test can handle failed assertions in a
+ // multi-threaded context.
+ EXPECT_LT(i, 0) << "This should always fail.";
+ }
+}
+
+void CheckTestFailureCount(int expected_failures) {
+ const TestInfo* const info = UnitTest::GetInstance()->current_test_info();
+ const TestResult* const result = info->result();
+ GTEST_CHECK_(expected_failures == result->total_part_count())
+ << "Logged " << result->total_part_count() << " failures "
+ << " vs. " << expected_failures << " expected";
+}
+
+// Tests using SCOPED_TRACE() and Google Test assertions in many threads
+// concurrently.
+TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) {
+ {
+ scoped_ptr<ThreadWithParam<int> > threads[kThreadCount];
+ Notification threads_can_start;
+ for (int i = 0; i != kThreadCount; i++)
+ threads[i].reset(new ThreadWithParam<int>(&ManyAsserts,
+ i,
+ &threads_can_start));
+
+ threads_can_start.Notify();
+
+ // Blocks until all the threads are done.
+ for (int i = 0; i != kThreadCount; i++)
+ threads[i]->Join();
+ }
+
+ // Ensures that kThreadCount*kThreadCount failures have been reported.
+ const TestInfo* const info = UnitTest::GetInstance()->current_test_info();
+ const TestResult* const result = info->result();
+
+ std::vector<TestProperty> properties;
+ // We have no access to the TestResult's list of properties but we can
+ // copy them one by one.
+ for (int i = 0; i < result->test_property_count(); ++i)
+ properties.push_back(result->GetTestProperty(i));
+
+ EXPECT_EQ(kThreadCount * 2 + 1, result->test_property_count())
+ << "String and int values recorded on each thread, "
+ << "as well as one shared_key";
+ for (int i = 0; i < kThreadCount; ++i) {
+ ExpectKeyAndValueWereRecordedForId(properties, i, "string");
+ ExpectKeyAndValueWereRecordedForId(properties, i, "int");
+ }
+ CheckTestFailureCount(kThreadCount*kThreadCount);
+}
+
+void FailingThread(bool is_fatal) {
+ if (is_fatal)
+ FAIL() << "Fatal failure in some other thread. "
+ << "(This failure is expected.)";
+ else
+ ADD_FAILURE() << "Non-fatal failure in some other thread. "
+ << "(This failure is expected.)";
+}
+
+void GenerateFatalFailureInAnotherThread(bool is_fatal) {
+ ThreadWithParam<bool> thread(&FailingThread, is_fatal, NULL);
+ thread.Join();
+}
+
+TEST(NoFatalFailureTest, ExpectNoFatalFailureIgnoresFailuresInOtherThreads) {
+ EXPECT_NO_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true));
+ // We should only have one failure (the one from
+ // GenerateFatalFailureInAnotherThread()), since the EXPECT_NO_FATAL_FAILURE
+ // should succeed.
+ CheckTestFailureCount(1);
+}
+
+void AssertNoFatalFailureIgnoresFailuresInOtherThreads() {
+ ASSERT_NO_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true));
+}
+TEST(NoFatalFailureTest, AssertNoFatalFailureIgnoresFailuresInOtherThreads) {
+ // Using a subroutine, to make sure, that the test continues.
+ AssertNoFatalFailureIgnoresFailuresInOtherThreads();
+ // We should only have one failure (the one from
+ // GenerateFatalFailureInAnotherThread()), since the EXPECT_NO_FATAL_FAILURE
+ // should succeed.
+ CheckTestFailureCount(1);
+}
+
+TEST(FatalFailureTest, ExpectFatalFailureIgnoresFailuresInOtherThreads) {
+ // This statement should fail, since the current thread doesn't generate a
+ // fatal failure, only another one does.
+ EXPECT_FATAL_FAILURE(GenerateFatalFailureInAnotherThread(true), "expected");
+ CheckTestFailureCount(2);
+}
+
+TEST(FatalFailureOnAllThreadsTest, ExpectFatalFailureOnAllThreads) {
+ // This statement should succeed, because failures in all threads are
+ // considered.
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(
+ GenerateFatalFailureInAnotherThread(true), "expected");
+ CheckTestFailureCount(0);
+ // We need to add a failure, because main() checks that there are failures.
+ // But when only this test is run, we shouldn't have any failures.
+ ADD_FAILURE() << "This is an expected non-fatal failure.";
+}
+
+TEST(NonFatalFailureTest, ExpectNonFatalFailureIgnoresFailuresInOtherThreads) {
+ // This statement should fail, since the current thread doesn't generate a
+ // fatal failure, only another one does.
+ EXPECT_NONFATAL_FAILURE(GenerateFatalFailureInAnotherThread(false),
+ "expected");
+ CheckTestFailureCount(2);
+}
+
+TEST(NonFatalFailureOnAllThreadsTest, ExpectNonFatalFailureOnAllThreads) {
+ // This statement should succeed, because failures in all threads are
+ // considered.
+ EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(
+ GenerateFatalFailureInAnotherThread(false), "expected");
+ CheckTestFailureCount(0);
+ // We need to add a failure, because main() checks that there are failures,
+ // But when only this test is run, we shouldn't have any failures.
+ ADD_FAILURE() << "This is an expected non-fatal failure.";
+}
+
+} // namespace
+} // namespace testing
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ const int result = RUN_ALL_TESTS(); // Expected to fail.
+ GTEST_CHECK_(result == 1) << "RUN_ALL_TESTS() did not fail as expected";
+
+ printf("\nPASS\n");
+ return 0;
+}
+
+#else
+TEST(StressTest,
+ DISABLED_ThreadSafetyTestsAreSkippedWhenGoogleTestIsNotThreadSafe) {
+}
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+#endif // GTEST_IS_THREADSAFE
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_test_utils.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_test_utils.py
new file mode 100755
index 0000000..e0f5973
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_test_utils.py
@@ -0,0 +1,309 @@
+#!/usr/bin/env python
+#
+# Copyright 2006, 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.
+
+"""Unit test utilities for Google C++ Testing Framework."""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import atexit
+import os
+import shutil
+import sys
+import tempfile
+import unittest
+_test_module = unittest
+
+# Suppresses the 'Import not at the top of the file' lint complaint.
+# pylint: disable-msg=C6204
+try:
+ import subprocess
+ _SUBPROCESS_MODULE_AVAILABLE = True
+except:
+ import popen2
+ _SUBPROCESS_MODULE_AVAILABLE = False
+# pylint: enable-msg=C6204
+
+GTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'
+
+IS_WINDOWS = os.name == 'nt'
+IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]
+
+# Here we expose a class from a particular module, depending on the
+# environment. The comment suppresses the 'Invalid variable name' lint
+# complaint.
+TestCase = _test_module.TestCase # pylint: disable-msg=C6409
+
+# Initially maps a flag to its default value. After
+# _ParseAndStripGTestFlags() is called, maps a flag to its actual value.
+_flag_map = {'gtest_source_dir': os.path.dirname(sys.argv[0]),
+ 'gtest_build_dir': os.path.dirname(sys.argv[0])}
+_gtest_flags_are_parsed = False
+
+
+def _ParseAndStripGTestFlags(argv):
+ """Parses and strips Google Test flags from argv. This is idempotent."""
+
+ # Suppresses the lint complaint about a global variable since we need it
+ # here to maintain module-wide state.
+ global _gtest_flags_are_parsed # pylint: disable-msg=W0603
+ if _gtest_flags_are_parsed:
+ return
+
+ _gtest_flags_are_parsed = True
+ for flag in _flag_map:
+ # The environment variable overrides the default value.
+ if flag.upper() in os.environ:
+ _flag_map[flag] = os.environ[flag.upper()]
+
+ # The command line flag overrides the environment variable.
+ i = 1 # Skips the program name.
+ while i < len(argv):
+ prefix = '--' + flag + '='
+ if argv[i].startswith(prefix):
+ _flag_map[flag] = argv[i][len(prefix):]
+ del argv[i]
+ break
+ else:
+ # We don't increment i in case we just found a --gtest_* flag
+ # and removed it from argv.
+ i += 1
+
+
+def GetFlag(flag):
+ """Returns the value of the given flag."""
+
+ # In case GetFlag() is called before Main(), we always call
+ # _ParseAndStripGTestFlags() here to make sure the --gtest_* flags
+ # are parsed.
+ _ParseAndStripGTestFlags(sys.argv)
+
+ return _flag_map[flag]
+
+
+def GetSourceDir():
+ """Returns the absolute path of the directory where the .py files are."""
+
+ return os.path.abspath(GetFlag('gtest_source_dir'))
+
+
+def GetBuildDir():
+ """Returns the absolute path of the directory where the test binaries are."""
+
+ return os.path.abspath(GetFlag('gtest_build_dir'))
+
+
+_temp_dir = None
+
+def _RemoveTempDir():
+ if _temp_dir:
+ shutil.rmtree(_temp_dir, ignore_errors=True)
+
+atexit.register(_RemoveTempDir)
+
+
+def GetTempDir():
+ """Returns a directory for temporary files."""
+
+ global _temp_dir
+ if not _temp_dir:
+ _temp_dir = tempfile.mkdtemp()
+ return _temp_dir
+
+
+def GetTestExecutablePath(executable_name, build_dir=None):
+ """Returns the absolute path of the test binary given its name.
+
+ The function will print a message and abort the program if the resulting file
+ doesn't exist.
+
+ Args:
+ executable_name: name of the test binary that the test script runs.
+ build_dir: directory where to look for executables, by default
+ the result of GetBuildDir().
+
+ Returns:
+ The absolute path of the test binary.
+ """
+
+ path = os.path.abspath(os.path.join(build_dir or GetBuildDir(),
+ executable_name))
+ if (IS_WINDOWS or IS_CYGWIN) and not path.endswith('.exe'):
+ path += '.exe'
+
+ if not os.path.exists(path):
+ message = (
+ 'Unable to find the test binary. Please make sure to provide path\n'
+ 'to the binary via the --gtest_build_dir flag or the GTEST_BUILD_DIR\n'
+ 'environment variable. For convenient use, invoke this script via\n'
+ 'mk_test.py.\n'
+ # TODO(vladl@google.com): change mk_test.py to test.py after renaming
+ # the file.
+ 'Please run mk_test.py -h for help.')
+ print >> sys.stderr, message
+ sys.exit(1)
+
+ return path
+
+
+def GetExitStatus(exit_code):
+ """Returns the argument to exit(), or -1 if exit() wasn't called.
+
+ Args:
+ exit_code: the result value of os.system(command).
+ """
+
+ if os.name == 'nt':
+ # On Windows, os.WEXITSTATUS() doesn't work and os.system() returns
+ # the argument to exit() directly.
+ return exit_code
+ else:
+ # On Unix, os.WEXITSTATUS() must be used to extract the exit status
+ # from the result of os.system().
+ if os.WIFEXITED(exit_code):
+ return os.WEXITSTATUS(exit_code)
+ else:
+ return -1
+
+
+class Subprocess:
+ def __init__(self, command, working_dir=None, capture_stderr=True, env=None):
+ """Changes into a specified directory, if provided, and executes a command.
+
+ Restores the old directory afterwards.
+
+ Args:
+ command: The command to run, in the form of sys.argv.
+ working_dir: The directory to change into.
+ capture_stderr: Determines whether to capture stderr in the output member
+ or to discard it.
+ env: Dictionary with environment to pass to the subprocess.
+
+ Returns:
+ An object that represents outcome of the executed process. It has the
+ following attributes:
+ terminated_by_signal True iff the child process has been terminated
+ by a signal.
+ signal Sygnal that terminated the child process.
+ exited True iff the child process exited normally.
+ exit_code The code with which the child process exited.
+ output Child process's stdout and stderr output
+ combined in a string.
+ """
+
+ # The subprocess module is the preferrable way of running programs
+ # since it is available and behaves consistently on all platforms,
+ # including Windows. But it is only available starting in python 2.4.
+ # In earlier python versions, we revert to the popen2 module, which is
+ # available in python 2.0 and later but doesn't provide required
+ # functionality (Popen4) under Windows. This allows us to support Mac
+ # OS X 10.4 Tiger, which has python 2.3 installed.
+ if _SUBPROCESS_MODULE_AVAILABLE:
+ if capture_stderr:
+ stderr = subprocess.STDOUT
+ else:
+ stderr = subprocess.PIPE
+
+ p = subprocess.Popen(command,
+ stdout=subprocess.PIPE, stderr=stderr,
+ cwd=working_dir, universal_newlines=True, env=env)
+ # communicate returns a tuple with the file obect for the child's
+ # output.
+ self.output = p.communicate()[0]
+ self._return_code = p.returncode
+ else:
+ old_dir = os.getcwd()
+
+ def _ReplaceEnvDict(dest, src):
+ # Changes made by os.environ.clear are not inheritable by child
+ # processes until Python 2.6. To produce inheritable changes we have
+ # to delete environment items with the del statement.
+ for key in dest:
+ del dest[key]
+ dest.update(src)
+
+ # When 'env' is not None, backup the environment variables and replace
+ # them with the passed 'env'. When 'env' is None, we simply use the
+ # current 'os.environ' for compatibility with the subprocess.Popen
+ # semantics used above.
+ if env is not None:
+ old_environ = os.environ.copy()
+ _ReplaceEnvDict(os.environ, env)
+
+ try:
+ if working_dir is not None:
+ os.chdir(working_dir)
+ if capture_stderr:
+ p = popen2.Popen4(command)
+ else:
+ p = popen2.Popen3(command)
+ p.tochild.close()
+ self.output = p.fromchild.read()
+ ret_code = p.wait()
+ finally:
+ os.chdir(old_dir)
+
+ # Restore the old environment variables
+ # if they were replaced.
+ if env is not None:
+ _ReplaceEnvDict(os.environ, old_environ)
+
+ # Converts ret_code to match the semantics of
+ # subprocess.Popen.returncode.
+ if os.WIFSIGNALED(ret_code):
+ self._return_code = -os.WTERMSIG(ret_code)
+ else: # os.WIFEXITED(ret_code) should return True here.
+ self._return_code = os.WEXITSTATUS(ret_code)
+
+ if self._return_code < 0:
+ self.terminated_by_signal = True
+ self.exited = False
+ self.signal = -self._return_code
+ else:
+ self.terminated_by_signal = False
+ self.exited = True
+ self.exit_code = self._return_code
+
+
+def Main():
+ """Runs the unit test."""
+
+ # We must call _ParseAndStripGTestFlags() before calling
+ # unittest.main(). Otherwise the latter will be confused by the
+ # --gtest_* flags.
+ _ParseAndStripGTestFlags(sys.argv)
+ # The tested binaries should not be writing XML output files unless the
+ # script explicitly instructs them to.
+ # TODO(vladl@google.com): Move this into Subprocess when we implement
+ # passing environment into it as a parameter.
+ if GTEST_OUTPUT_VAR_NAME in os.environ:
+ del os.environ[GTEST_OUTPUT_VAR_NAME]
+
+ _test_module.main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_ex_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_ex_test.cc
new file mode 100644
index 0000000..8bf9dc9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_ex_test.cc
@@ -0,0 +1,92 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Tests Google Test's throw-on-failure mode with exceptions enabled.
+
+#include <gtest/gtest.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdexcept>
+
+// Prints the given failure message and exits the program with
+// non-zero. We use this instead of a Google Test assertion to
+// indicate a failure, as the latter is been tested and cannot be
+// relied on.
+void Fail(const char* msg) {
+ printf("FAILURE: %s\n", msg);
+ fflush(stdout);
+ exit(1);
+}
+
+// Tests that an assertion failure throws a subclass of
+// std::runtime_error.
+void TestFailureThrowsRuntimeError() {
+ testing::GTEST_FLAG(throw_on_failure) = true;
+
+ // A successful assertion shouldn't throw.
+ try {
+ EXPECT_EQ(3, 3);
+ } catch(...) {
+ Fail("A successful assertion wrongfully threw.");
+ }
+
+ // A failed assertion should throw a subclass of std::runtime_error.
+ try {
+ EXPECT_EQ(2, 3) << "Expected failure";
+ } catch(const std::runtime_error& e) {
+ if (strstr(e.what(), "Expected failure") != NULL)
+ return;
+
+ printf("%s",
+ "A failed assertion did throw an exception of the right type, "
+ "but the message is incorrect. Instead of containing \"Expected "
+ "failure\", it is:\n");
+ Fail(e.what());
+ } catch(...) {
+ Fail("A failed assertion threw the wrong type of exception.");
+ }
+ Fail("A failed assertion should've thrown but didn't.");
+}
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ // We want to ensure that people can use Google Test assertions in
+ // other testing frameworks, as long as they initialize Google Test
+ // properly and set the thrown-on-failure mode. Therefore, we don't
+ // use Google Test's constructs for defining and running tests
+ // (e.g. TEST and RUN_ALL_TESTS) here.
+
+ TestFailureThrowsRuntimeError();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test.py
new file mode 100755
index 0000000..5678ffe
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test.py
@@ -0,0 +1,171 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Tests Google Test's throw-on-failure mode with exceptions disabled.
+
+This script invokes gtest_throw_on_failure_test_ (a program written with
+Google Test) with different environments and command line flags.
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import gtest_test_utils
+
+
+# Constants.
+
+# The command line flag for enabling/disabling the throw-on-failure mode.
+THROW_ON_FAILURE = 'gtest_throw_on_failure'
+
+# Path to the gtest_throw_on_failure_test_ program, compiled with
+# exceptions disabled.
+EXE_PATH = gtest_test_utils.GetTestExecutablePath(
+ 'gtest_throw_on_failure_test_')
+
+
+# Utilities.
+
+
+def SetEnvVar(env_var, value):
+ """Sets an environment variable to a given value; unsets it when the
+ given value is None.
+ """
+
+ env_var = env_var.upper()
+ if value is not None:
+ os.environ[env_var] = value
+ elif env_var in os.environ:
+ del os.environ[env_var]
+
+
+def Run(command):
+ """Runs a command; returns True/False if its exit code is/isn't 0."""
+
+ print 'Running "%s". . .' % ' '.join(command)
+ p = gtest_test_utils.Subprocess(command)
+ return p.exited and p.exit_code == 0
+
+
+# The tests. TODO(wan@google.com): refactor the class to share common
+# logic with code in gtest_break_on_failure_unittest.py.
+class ThrowOnFailureTest(gtest_test_utils.TestCase):
+ """Tests the throw-on-failure mode."""
+
+ def RunAndVerify(self, env_var_value, flag_value, should_fail):
+ """Runs gtest_throw_on_failure_test_ and verifies that it does
+ (or does not) exit with a non-zero code.
+
+ Args:
+ env_var_value: value of the GTEST_BREAK_ON_FAILURE environment
+ variable; None if the variable should be unset.
+ flag_value: value of the --gtest_break_on_failure flag;
+ None if the flag should not be present.
+ should_fail: True iff the program is expected to fail.
+ """
+
+ SetEnvVar(THROW_ON_FAILURE, env_var_value)
+
+ if env_var_value is None:
+ env_var_value_msg = ' is not set'
+ else:
+ env_var_value_msg = '=' + env_var_value
+
+ if flag_value is None:
+ flag = ''
+ elif flag_value == '0':
+ flag = '--%s=0' % THROW_ON_FAILURE
+ else:
+ flag = '--%s' % THROW_ON_FAILURE
+
+ command = [EXE_PATH]
+ if flag:
+ command.append(flag)
+
+ if should_fail:
+ should_or_not = 'should'
+ else:
+ should_or_not = 'should not'
+
+ failed = not Run(command)
+
+ SetEnvVar(THROW_ON_FAILURE, None)
+
+ msg = ('when %s%s, an assertion failure in "%s" %s cause a non-zero '
+ 'exit code.' %
+ (THROW_ON_FAILURE, env_var_value_msg, ' '.join(command),
+ should_or_not))
+ self.assert_(failed == should_fail, msg)
+
+ def testDefaultBehavior(self):
+ """Tests the behavior of the default mode."""
+
+ self.RunAndVerify(env_var_value=None, flag_value=None, should_fail=False)
+
+ def testThrowOnFailureEnvVar(self):
+ """Tests using the GTEST_THROW_ON_FAILURE environment variable."""
+
+ self.RunAndVerify(env_var_value='0',
+ flag_value=None,
+ should_fail=False)
+ self.RunAndVerify(env_var_value='1',
+ flag_value=None,
+ should_fail=True)
+
+ def testThrowOnFailureFlag(self):
+ """Tests using the --gtest_throw_on_failure flag."""
+
+ self.RunAndVerify(env_var_value=None,
+ flag_value='0',
+ should_fail=False)
+ self.RunAndVerify(env_var_value=None,
+ flag_value='1',
+ should_fail=True)
+
+ def testThrowOnFailureFlagOverridesEnvVar(self):
+ """Tests that --gtest_throw_on_failure overrides GTEST_THROW_ON_FAILURE."""
+
+ self.RunAndVerify(env_var_value='0',
+ flag_value='0',
+ should_fail=False)
+ self.RunAndVerify(env_var_value='0',
+ flag_value='1',
+ should_fail=True)
+ self.RunAndVerify(env_var_value='1',
+ flag_value='0',
+ should_fail=False)
+ self.RunAndVerify(env_var_value='1',
+ flag_value='1',
+ should_fail=True)
+
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test_.cc
new file mode 100644
index 0000000..88fbd5a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_throw_on_failure_test_.cc
@@ -0,0 +1,56 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+// Tests Google Test's throw-on-failure mode with exceptions disabled.
+//
+// This program must be compiled with exceptions disabled. It will be
+// invoked by gtest_throw_on_failure_test.py, and is expected to exit
+// with non-zero in the throw-on-failure mode or 0 otherwise.
+
+#include <gtest/gtest.h>
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ // We want to ensure that people can use Google Test assertions in
+ // other testing frameworks, as long as they initialize Google Test
+ // properly and set the thrown-on-failure mode. Therefore, we don't
+ // use Google Test's constructs for defining and running tests
+ // (e.g. TEST and RUN_ALL_TESTS) here.
+
+ // In the throw-on-failure mode with exceptions disabled, this
+ // assertion will cause the program to exit with a non-zero code.
+ EXPECT_EQ(2, 3);
+
+ // When not in the throw-on-failure mode, the control will reach
+ // here.
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test.py
new file mode 100755
index 0000000..6ae57ee
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Verifies that Google Test warns the user when not initialized properly."""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import gtest_test_utils
+
+
+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_')
+
+
+def Assert(condition):
+ if not condition:
+ raise AssertionError
+
+
+def AssertEq(expected, actual):
+ if expected != actual:
+ print 'Expected: %s' % (expected,)
+ print ' Actual: %s' % (actual,)
+ raise AssertionError
+
+
+def TestExitCodeAndOutput(command):
+ """Runs the given command and verifies its exit code and output."""
+
+ # Verifies that 'command' exits with code 1.
+ p = gtest_test_utils.Subprocess(command)
+ Assert(p.exited)
+ AssertEq(1, p.exit_code)
+ Assert('InitGoogleTest' in p.output)
+
+
+class GTestUninitializedTest(gtest_test_utils.TestCase):
+ def testExitCodeAndOutput(self):
+ TestExitCodeAndOutput(COMMAND)
+
+
+if __name__ == '__main__':
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test_.cc
new file mode 100644
index 0000000..e8b2aa8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_uninitialized_test_.cc
@@ -0,0 +1,43 @@
+// Copyright 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.
+//
+// Author: wan@google.com (Zhanyong Wan)
+
+#include <gtest/gtest.h>
+
+TEST(DummyTest, Dummy) {
+ // This test doesn't verify anything. We just need it to create a
+ // realistic stage for testing the behavior of Google Test when
+ // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being
+ // called first.
+}
+
+int main() {
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_unittest.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_unittest.cc
new file mode 100644
index 0000000..a14f065
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_unittest.cc
@@ -0,0 +1,6718 @@
+// Copyright 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: wan@google.com (Zhanyong Wan)
+//
+// Tests for Google Test itself. This verifies that the basic constructs of
+// Google Test work.
+
+#include <gtest/gtest.h>
+#include <vector>
+
+// Verifies that the command line flag variables can be accessed
+// in code once <gtest/gtest.h> has been #included.
+// Do not move it after other #includes.
+TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
+ bool dummy = testing::GTEST_FLAG(also_run_disabled_tests)
+ || testing::GTEST_FLAG(break_on_failure)
+ || testing::GTEST_FLAG(catch_exceptions)
+ || testing::GTEST_FLAG(color) != "unknown"
+ || testing::GTEST_FLAG(filter) != "unknown"
+ || testing::GTEST_FLAG(list_tests)
+ || testing::GTEST_FLAG(output) != "unknown"
+ || testing::GTEST_FLAG(print_time)
+ || testing::GTEST_FLAG(random_seed)
+ || testing::GTEST_FLAG(repeat) > 0
+ || testing::GTEST_FLAG(show_internal_stack_frames)
+ || testing::GTEST_FLAG(shuffle)
+ || testing::GTEST_FLAG(stack_trace_depth) > 0
+ || testing::GTEST_FLAG(throw_on_failure);
+ EXPECT_TRUE(dummy || !dummy); // Suppresses warning that dummy is unused.
+}
+
+#include <gtest/gtest-spi.h>
+
+// Indicates that this translation unit is part of Google Test's
+// implementation. It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error. This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+#include "src/gtest-internal-inl.h"
+#undef GTEST_IMPLEMENTATION_
+
+#include <limits.h> // For INT_MAX.
+#include <stdlib.h>
+#include <time.h>
+
+#include <map>
+
+namespace testing {
+namespace internal {
+
+// Provides access to otherwise private parts of the TestEventListeners class
+// that are needed to test it.
+class TestEventListenersAccessor {
+ public:
+ static TestEventListener* GetRepeater(TestEventListeners* listeners) {
+ return listeners->repeater();
+ }
+
+ static void SetDefaultResultPrinter(TestEventListeners* listeners,
+ TestEventListener* listener) {
+ listeners->SetDefaultResultPrinter(listener);
+ }
+ static void SetDefaultXmlGenerator(TestEventListeners* listeners,
+ TestEventListener* listener) {
+ listeners->SetDefaultXmlGenerator(listener);
+ }
+
+ static bool EventForwardingEnabled(const TestEventListeners& listeners) {
+ return listeners.EventForwardingEnabled();
+ }
+
+ static void SuppressEventForwarding(TestEventListeners* listeners) {
+ listeners->SuppressEventForwarding();
+ }
+};
+
+} // namespace internal
+} // namespace testing
+
+using testing::AssertionFailure;
+using testing::AssertionResult;
+using testing::AssertionSuccess;
+using testing::DoubleLE;
+using testing::EmptyTestEventListener;
+using testing::FloatLE;
+using testing::GTEST_FLAG(also_run_disabled_tests);
+using testing::GTEST_FLAG(break_on_failure);
+using testing::GTEST_FLAG(catch_exceptions);
+using testing::GTEST_FLAG(color);
+using testing::GTEST_FLAG(death_test_use_fork);
+using testing::GTEST_FLAG(filter);
+using testing::GTEST_FLAG(list_tests);
+using testing::GTEST_FLAG(output);
+using testing::GTEST_FLAG(print_time);
+using testing::GTEST_FLAG(random_seed);
+using testing::GTEST_FLAG(repeat);
+using testing::GTEST_FLAG(show_internal_stack_frames);
+using testing::GTEST_FLAG(shuffle);
+using testing::GTEST_FLAG(stack_trace_depth);
+using testing::GTEST_FLAG(throw_on_failure);
+using testing::IsNotSubstring;
+using testing::IsSubstring;
+using testing::Message;
+using testing::ScopedFakeTestPartResultReporter;
+using testing::StaticAssertTypeEq;
+using testing::Test;
+using testing::TestEventListeners;
+using testing::TestCase;
+using testing::TestPartResult;
+using testing::TestPartResultArray;
+using testing::TestProperty;
+using testing::TestResult;
+using testing::UnitTest;
+using testing::kMaxStackTraceDepth;
+using testing::internal::AlwaysFalse;
+using testing::internal::AlwaysTrue;
+using testing::internal::AppendUserMessage;
+using testing::internal::CodePointToUtf8;
+using testing::internal::CountIf;
+using testing::internal::EqFailure;
+using testing::internal::FloatingPoint;
+using testing::internal::FormatTimeInMillisAsSeconds;
+using testing::internal::ForEach;
+using testing::internal::GTestFlagSaver;
+using testing::internal::GetCurrentOsStackTraceExceptTop;
+using testing::internal::GetElementOr;
+using testing::internal::GetNextRandomSeed;
+using testing::internal::GetRandomSeedFromFlag;
+using testing::internal::GetTestTypeId;
+using testing::internal::GetTypeId;
+using testing::internal::GetUnitTestImpl;
+using testing::internal::Int32;
+using testing::internal::Int32FromEnvOrDie;
+using testing::internal::ParseInt32Flag;
+using testing::internal::ShouldRunTestOnShard;
+using testing::internal::ShouldShard;
+using testing::internal::ShouldUseColor;
+using testing::internal::Shuffle;
+using testing::internal::ShuffleRange;
+using testing::internal::StreamableToString;
+using testing::internal::String;
+using testing::internal::TestEventListenersAccessor;
+using testing::internal::TestResultAccessor;
+using testing::internal::UInt32;
+using testing::internal::WideStringToUtf8;
+using testing::internal::kMaxRandomSeed;
+using testing::internal::kTestTypeIdInGoogleTest;
+using testing::internal::scoped_ptr;
+
+#if GTEST_HAS_STREAM_REDIRECTION_
+using testing::internal::CaptureStdout;
+using testing::internal::GetCapturedStdout;
+#endif // GTEST_HAS_STREAM_REDIRECTION_
+
+#if GTEST_IS_THREADSAFE
+using testing::internal::ThreadWithParam;
+#endif
+
+class TestingVector : public std::vector<int> {
+};
+
+::std::ostream& operator<<(::std::ostream& os,
+ const TestingVector& vector) {
+ os << "{ ";
+ for (size_t i = 0; i < vector.size(); i++) {
+ os << vector[i] << " ";
+ }
+ os << "}";
+ return os;
+}
+
+// This line tests that we can define tests in an unnamed namespace.
+namespace {
+
+TEST(GetRandomSeedFromFlagTest, HandlesZero) {
+ const int seed = GetRandomSeedFromFlag(0);
+ EXPECT_LE(1, seed);
+ EXPECT_LE(seed, static_cast<int>(kMaxRandomSeed));
+}
+
+TEST(GetRandomSeedFromFlagTest, PreservesValidSeed) {
+ EXPECT_EQ(1, GetRandomSeedFromFlag(1));
+ EXPECT_EQ(2, GetRandomSeedFromFlag(2));
+ EXPECT_EQ(kMaxRandomSeed - 1, GetRandomSeedFromFlag(kMaxRandomSeed - 1));
+ EXPECT_EQ(static_cast<int>(kMaxRandomSeed),
+ GetRandomSeedFromFlag(kMaxRandomSeed));
+}
+
+TEST(GetRandomSeedFromFlagTest, NormalizesInvalidSeed) {
+ const int seed1 = GetRandomSeedFromFlag(-1);
+ EXPECT_LE(1, seed1);
+ EXPECT_LE(seed1, static_cast<int>(kMaxRandomSeed));
+
+ const int seed2 = GetRandomSeedFromFlag(kMaxRandomSeed + 1);
+ EXPECT_LE(1, seed2);
+ EXPECT_LE(seed2, static_cast<int>(kMaxRandomSeed));
+}
+
+TEST(GetNextRandomSeedTest, WorksForValidInput) {
+ EXPECT_EQ(2, GetNextRandomSeed(1));
+ EXPECT_EQ(3, GetNextRandomSeed(2));
+ EXPECT_EQ(static_cast<int>(kMaxRandomSeed),
+ GetNextRandomSeed(kMaxRandomSeed - 1));
+ EXPECT_EQ(1, GetNextRandomSeed(kMaxRandomSeed));
+
+ // We deliberately don't test GetNextRandomSeed() with invalid
+ // inputs, as that requires death tests, which are expensive. This
+ // is fine as GetNextRandomSeed() is internal and has a
+ // straightforward definition.
+}
+
+static void ClearCurrentTestPartResults() {
+ TestResultAccessor::ClearTestPartResults(
+ GetUnitTestImpl()->current_test_result());
+}
+
+// Tests GetTypeId.
+
+TEST(GetTypeIdTest, ReturnsSameValueForSameType) {
+ EXPECT_EQ(GetTypeId<int>(), GetTypeId<int>());
+ EXPECT_EQ(GetTypeId<Test>(), GetTypeId<Test>());
+}
+
+class SubClassOfTest : public Test {};
+class AnotherSubClassOfTest : public Test {};
+
+TEST(GetTypeIdTest, ReturnsDifferentValuesForDifferentTypes) {
+ EXPECT_NE(GetTypeId<int>(), GetTypeId<const int>());
+ EXPECT_NE(GetTypeId<int>(), GetTypeId<char>());
+ EXPECT_NE(GetTypeId<int>(), GetTestTypeId());
+ EXPECT_NE(GetTypeId<SubClassOfTest>(), GetTestTypeId());
+ EXPECT_NE(GetTypeId<AnotherSubClassOfTest>(), GetTestTypeId());
+ EXPECT_NE(GetTypeId<AnotherSubClassOfTest>(), GetTypeId<SubClassOfTest>());
+}
+
+// Verifies that GetTestTypeId() returns the same value, no matter it
+// is called from inside Google Test or outside of it.
+TEST(GetTestTypeIdTest, ReturnsTheSameValueInsideOrOutsideOfGoogleTest) {
+ EXPECT_EQ(kTestTypeIdInGoogleTest, GetTestTypeId());
+}
+
+// Tests FormatTimeInMillisAsSeconds().
+
+TEST(FormatTimeInMillisAsSecondsTest, FormatsZero) {
+ EXPECT_EQ("0", FormatTimeInMillisAsSeconds(0));
+}
+
+TEST(FormatTimeInMillisAsSecondsTest, FormatsPositiveNumber) {
+ EXPECT_EQ("0.003", FormatTimeInMillisAsSeconds(3));
+ EXPECT_EQ("0.01", FormatTimeInMillisAsSeconds(10));
+ EXPECT_EQ("0.2", FormatTimeInMillisAsSeconds(200));
+ EXPECT_EQ("1.2", FormatTimeInMillisAsSeconds(1200));
+ EXPECT_EQ("3", FormatTimeInMillisAsSeconds(3000));
+}
+
+TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) {
+ EXPECT_EQ("-0.003", FormatTimeInMillisAsSeconds(-3));
+ EXPECT_EQ("-0.01", FormatTimeInMillisAsSeconds(-10));
+ EXPECT_EQ("-0.2", FormatTimeInMillisAsSeconds(-200));
+ EXPECT_EQ("-1.2", FormatTimeInMillisAsSeconds(-1200));
+ EXPECT_EQ("-3", FormatTimeInMillisAsSeconds(-3000));
+}
+
+#if GTEST_CAN_COMPARE_NULL
+
+#ifdef __BORLANDC__
+// Silences warnings: "Condition is always true", "Unreachable code"
+#pragma option push -w-ccc -w-rch
+#endif
+
+// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null
+// pointer literal.
+TEST(NullLiteralTest, IsTrueForNullLiterals) {
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(NULL));
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0));
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U));
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L));
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(false));
+#ifndef __BORLANDC__
+ // Some compilers may fail to detect some null pointer literals;
+ // as long as users of the framework don't use such literals, this
+ // is harmless.
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1));
+ EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(true && false));
+#endif
+}
+
+// Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null
+// pointer literal.
+TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
+ EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(1));
+ EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(0.0));
+ EXPECT_FALSE(GTEST_IS_NULL_LITERAL_('a'));
+ EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL)));
+}
+
+#ifdef __BORLANDC__
+// Restores warnings after previous "#pragma option push" suppressed them.
+#pragma option pop
+#endif
+
+#endif // GTEST_CAN_COMPARE_NULL
+//
+// Tests CodePointToUtf8().
+
+// Tests that the NUL character L'\0' is encoded correctly.
+TEST(CodePointToUtf8Test, CanEncodeNul) {
+ char buffer[32];
+ EXPECT_STREQ("", CodePointToUtf8(L'\0', buffer));
+}
+
+// Tests that ASCII characters are encoded correctly.
+TEST(CodePointToUtf8Test, CanEncodeAscii) {
+ char buffer[32];
+ EXPECT_STREQ("a", CodePointToUtf8(L'a', buffer));
+ EXPECT_STREQ("Z", CodePointToUtf8(L'Z', buffer));
+ EXPECT_STREQ("&", CodePointToUtf8(L'&', buffer));
+ EXPECT_STREQ("\x7F", CodePointToUtf8(L'\x7F', buffer));
+}
+
+// Tests that Unicode code-points that have 8 to 11 bits are encoded
+// as 110xxxxx 10xxxxxx.
+TEST(CodePointToUtf8Test, CanEncode8To11Bits) {
+ char buffer[32];
+ // 000 1101 0011 => 110-00011 10-010011
+ EXPECT_STREQ("\xC3\x93", CodePointToUtf8(L'\xD3', buffer));
+
+ // 101 0111 0110 => 110-10101 10-110110
+ EXPECT_STREQ("\xD5\xB6", CodePointToUtf8(L'\x576', buffer));
+}
+
+// Tests that Unicode code-points that have 12 to 16 bits are encoded
+// as 1110xxxx 10xxxxxx 10xxxxxx.
+TEST(CodePointToUtf8Test, CanEncode12To16Bits) {
+ char buffer[32];
+ // 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011
+ EXPECT_STREQ("\xE0\xA3\x93", CodePointToUtf8(L'\x8D3', buffer));
+
+ // 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101
+ EXPECT_STREQ("\xEC\x9D\x8D", CodePointToUtf8(L'\xC74D', buffer));
+}
+
+#if !GTEST_WIDE_STRING_USES_UTF16_
+// Tests in this group require a wchar_t to hold > 16 bits, and thus
+// are skipped on Windows, Cygwin, and Symbian, where a wchar_t is
+// 16-bit wide. This code may not compile on those systems.
+
+// Tests that Unicode code-points that have 17 to 21 bits are encoded
+// as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx.
+TEST(CodePointToUtf8Test, CanEncode17To21Bits) {
+ char buffer[32];
+ // 0 0001 0000 1000 1101 0011 => 11110-000 10-010000 10-100011 10-010011
+ EXPECT_STREQ("\xF0\x90\xA3\x93", CodePointToUtf8(L'\x108D3', buffer));
+
+ // 0 0001 0000 0100 0000 0000 => 11110-000 10-010000 10-010000 10-000000
+ EXPECT_STREQ("\xF0\x90\x90\x80", CodePointToUtf8(L'\x10400', buffer));
+
+ // 1 0000 1000 0110 0011 0100 => 11110-100 10-001000 10-011000 10-110100
+ EXPECT_STREQ("\xF4\x88\x98\xB4", CodePointToUtf8(L'\x108634', buffer));
+}
+
+// Tests that encoding an invalid code-point generates the expected result.
+TEST(CodePointToUtf8Test, CanEncodeInvalidCodePoint) {
+ char buffer[32];
+ EXPECT_STREQ("(Invalid Unicode 0x1234ABCD)",
+ CodePointToUtf8(L'\x1234ABCD', buffer));
+}
+
+#endif // !GTEST_WIDE_STRING_USES_UTF16_
+
+// Tests WideStringToUtf8().
+
+// Tests that the NUL character L'\0' is encoded correctly.
+TEST(WideStringToUtf8Test, CanEncodeNul) {
+ EXPECT_STREQ("", WideStringToUtf8(L"", 0).c_str());
+ EXPECT_STREQ("", WideStringToUtf8(L"", -1).c_str());
+}
+
+// Tests that ASCII strings are encoded correctly.
+TEST(WideStringToUtf8Test, CanEncodeAscii) {
+ EXPECT_STREQ("a", WideStringToUtf8(L"a", 1).c_str());
+ EXPECT_STREQ("ab", WideStringToUtf8(L"ab", 2).c_str());
+ EXPECT_STREQ("a", WideStringToUtf8(L"a", -1).c_str());
+ EXPECT_STREQ("ab", WideStringToUtf8(L"ab", -1).c_str());
+}
+
+// Tests that Unicode code-points that have 8 to 11 bits are encoded
+// as 110xxxxx 10xxxxxx.
+TEST(WideStringToUtf8Test, CanEncode8To11Bits) {
+ // 000 1101 0011 => 110-00011 10-010011
+ EXPECT_STREQ("\xC3\x93", WideStringToUtf8(L"\xD3", 1).c_str());
+ EXPECT_STREQ("\xC3\x93", WideStringToUtf8(L"\xD3", -1).c_str());
+
+ // 101 0111 0110 => 110-10101 10-110110
+ EXPECT_STREQ("\xD5\xB6", WideStringToUtf8(L"\x576", 1).c_str());
+ EXPECT_STREQ("\xD5\xB6", WideStringToUtf8(L"\x576", -1).c_str());
+}
+
+// Tests that Unicode code-points that have 12 to 16 bits are encoded
+// as 1110xxxx 10xxxxxx 10xxxxxx.
+TEST(WideStringToUtf8Test, CanEncode12To16Bits) {
+ // 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011
+ EXPECT_STREQ("\xE0\xA3\x93", WideStringToUtf8(L"\x8D3", 1).c_str());
+ EXPECT_STREQ("\xE0\xA3\x93", WideStringToUtf8(L"\x8D3", -1).c_str());
+
+ // 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101
+ EXPECT_STREQ("\xEC\x9D\x8D", WideStringToUtf8(L"\xC74D", 1).c_str());
+ EXPECT_STREQ("\xEC\x9D\x8D", WideStringToUtf8(L"\xC74D", -1).c_str());
+}
+
+// Tests that the conversion stops when the function encounters \0 character.
+TEST(WideStringToUtf8Test, StopsOnNulCharacter) {
+ EXPECT_STREQ("ABC", WideStringToUtf8(L"ABC\0XYZ", 100).c_str());
+}
+
+// Tests that the conversion stops when the function reaches the limit
+// specified by the 'length' parameter.
+TEST(WideStringToUtf8Test, StopsWhenLengthLimitReached) {
+ EXPECT_STREQ("ABC", WideStringToUtf8(L"ABCDEF", 3).c_str());
+}
+
+
+#if !GTEST_WIDE_STRING_USES_UTF16_
+// Tests that Unicode code-points that have 17 to 21 bits are encoded
+// as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. This code may not compile
+// on the systems using UTF-16 encoding.
+TEST(WideStringToUtf8Test, CanEncode17To21Bits) {
+ // 0 0001 0000 1000 1101 0011 => 11110-000 10-010000 10-100011 10-010011
+ EXPECT_STREQ("\xF0\x90\xA3\x93", WideStringToUtf8(L"\x108D3", 1).c_str());
+ EXPECT_STREQ("\xF0\x90\xA3\x93", WideStringToUtf8(L"\x108D3", -1).c_str());
+
+ // 1 0000 1000 0110 0011 0100 => 11110-100 10-001000 10-011000 10-110100
+ EXPECT_STREQ("\xF4\x88\x98\xB4", WideStringToUtf8(L"\x108634", 1).c_str());
+ EXPECT_STREQ("\xF4\x88\x98\xB4", WideStringToUtf8(L"\x108634", -1).c_str());
+}
+
+// Tests that encoding an invalid code-point generates the expected result.
+TEST(WideStringToUtf8Test, CanEncodeInvalidCodePoint) {
+ EXPECT_STREQ("(Invalid Unicode 0xABCDFF)",
+ WideStringToUtf8(L"\xABCDFF", -1).c_str());
+}
+#else // !GTEST_WIDE_STRING_USES_UTF16_
+// Tests that surrogate pairs are encoded correctly on the systems using
+// UTF-16 encoding in the wide strings.
+TEST(WideStringToUtf8Test, CanEncodeValidUtf16SUrrogatePairs) {
+ EXPECT_STREQ("\xF0\x90\x90\x80",
+ WideStringToUtf8(L"\xD801\xDC00", -1).c_str());
+}
+
+// Tests that encoding an invalid UTF-16 surrogate pair
+// generates the expected result.
+TEST(WideStringToUtf8Test, CanEncodeInvalidUtf16SurrogatePair) {
+ // Leading surrogate is at the end of the string.
+ EXPECT_STREQ("\xED\xA0\x80", WideStringToUtf8(L"\xD800", -1).c_str());
+ // Leading surrogate is not followed by the trailing surrogate.
+ EXPECT_STREQ("\xED\xA0\x80$", WideStringToUtf8(L"\xD800$", -1).c_str());
+ // Trailing surrogate appearas without a leading surrogate.
+ EXPECT_STREQ("\xED\xB0\x80PQR", WideStringToUtf8(L"\xDC00PQR", -1).c_str());
+}
+#endif // !GTEST_WIDE_STRING_USES_UTF16_
+
+// Tests that codepoint concatenation works correctly.
+#if !GTEST_WIDE_STRING_USES_UTF16_
+TEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {
+ EXPECT_STREQ(
+ "\xF4\x88\x98\xB4"
+ "\xEC\x9D\x8D"
+ "\n"
+ "\xD5\xB6"
+ "\xE0\xA3\x93"
+ "\xF4\x88\x98\xB4",
+ WideStringToUtf8(L"\x108634\xC74D\n\x576\x8D3\x108634", -1).c_str());
+}
+#else
+TEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {
+ EXPECT_STREQ(
+ "\xEC\x9D\x8D" "\n" "\xD5\xB6" "\xE0\xA3\x93",
+ WideStringToUtf8(L"\xC74D\n\x576\x8D3", -1).c_str());
+}
+#endif // !GTEST_WIDE_STRING_USES_UTF16_
+
+// Tests the Random class.
+
+TEST(RandomDeathTest, GeneratesCrashesOnInvalidRange) {
+ testing::internal::Random random(42);
+ EXPECT_DEATH_IF_SUPPORTED(
+ random.Generate(0),
+ "Cannot generate a number in the range \\[0, 0\\)");
+ EXPECT_DEATH_IF_SUPPORTED(
+ random.Generate(testing::internal::Random::kMaxRange + 1),
+ "Generation of a number in \\[0, 2147483649\\) was requested, "
+ "but this can only generate numbers in \\[0, 2147483648\\)");
+}
+
+TEST(RandomTest, GeneratesNumbersWithinRange) {
+ const UInt32 kRange = 10000;
+ testing::internal::Random random(12345);
+ for (int i = 0; i < 10; i++) {
+ EXPECT_LT(random.Generate(kRange), kRange) << " for iteration " << i;
+ }
+
+ testing::internal::Random random2(testing::internal::Random::kMaxRange);
+ for (int i = 0; i < 10; i++) {
+ EXPECT_LT(random2.Generate(kRange), kRange) << " for iteration " << i;
+ }
+}
+
+TEST(RandomTest, RepeatsWhenReseeded) {
+ const int kSeed = 123;
+ const int kArraySize = 10;
+ const UInt32 kRange = 10000;
+ UInt32 values[kArraySize];
+
+ testing::internal::Random random(kSeed);
+ for (int i = 0; i < kArraySize; i++) {
+ values[i] = random.Generate(kRange);
+ }
+
+ random.Reseed(kSeed);
+ for (int i = 0; i < kArraySize; i++) {
+ EXPECT_EQ(values[i], random.Generate(kRange)) << " for iteration " << i;
+ }
+}
+
+// Tests STL container utilities.
+
+// Tests CountIf().
+
+static bool IsPositive(int n) { return n > 0; }
+
+TEST(ContainerUtilityTest, CountIf) {
+ std::vector<int> v;
+ EXPECT_EQ(0, CountIf(v, IsPositive)); // Works for an empty container.
+
+ v.push_back(-1);
+ v.push_back(0);
+ EXPECT_EQ(0, CountIf(v, IsPositive)); // Works when no value satisfies.
+
+ v.push_back(2);
+ v.push_back(-10);
+ v.push_back(10);
+ EXPECT_EQ(2, CountIf(v, IsPositive));
+}
+
+// Tests ForEach().
+
+static int g_sum = 0;
+static void Accumulate(int n) { g_sum += n; }
+
+TEST(ContainerUtilityTest, ForEach) {
+ std::vector<int> v;
+ g_sum = 0;
+ ForEach(v, Accumulate);
+ EXPECT_EQ(0, g_sum); // Works for an empty container;
+
+ g_sum = 0;
+ v.push_back(1);
+ ForEach(v, Accumulate);
+ EXPECT_EQ(1, g_sum); // Works for a container with one element.
+
+ g_sum = 0;
+ v.push_back(20);
+ v.push_back(300);
+ ForEach(v, Accumulate);
+ EXPECT_EQ(321, g_sum);
+}
+
+// Tests GetElementOr().
+TEST(ContainerUtilityTest, GetElementOr) {
+ std::vector<char> a;
+ EXPECT_EQ('x', GetElementOr(a, 0, 'x'));
+
+ a.push_back('a');
+ a.push_back('b');
+ EXPECT_EQ('a', GetElementOr(a, 0, 'x'));
+ EXPECT_EQ('b', GetElementOr(a, 1, 'x'));
+ EXPECT_EQ('x', GetElementOr(a, -2, 'x'));
+ EXPECT_EQ('x', GetElementOr(a, 2, 'x'));
+}
+
+TEST(ContainerUtilityDeathTest, ShuffleRange) {
+ std::vector<int> a;
+ a.push_back(0);
+ a.push_back(1);
+ a.push_back(2);
+ testing::internal::Random random(1);
+
+ EXPECT_DEATH_IF_SUPPORTED(
+ ShuffleRange(&random, -1, 1, &a),
+ "Invalid shuffle range start -1: must be in range \\[0, 3\\]");
+ EXPECT_DEATH_IF_SUPPORTED(
+ ShuffleRange(&random, 4, 4, &a),
+ "Invalid shuffle range start 4: must be in range \\[0, 3\\]");
+ EXPECT_DEATH_IF_SUPPORTED(
+ ShuffleRange(&random, 3, 2, &a),
+ "Invalid shuffle range finish 2: must be in range \\[3, 3\\]");
+ EXPECT_DEATH_IF_SUPPORTED(
+ ShuffleRange(&random, 3, 4, &a),
+ "Invalid shuffle range finish 4: must be in range \\[3, 3\\]");
+}
+
+class VectorShuffleTest : public Test {
+ protected:
+ static const int kVectorSize = 20;
+
+ VectorShuffleTest() : random_(1) {
+ for (int i = 0; i < kVectorSize; i++) {
+ vector_.push_back(i);
+ }
+ }
+
+ static bool VectorIsCorrupt(const TestingVector& vector) {
+ if (kVectorSize != static_cast<int>(vector.size())) {
+ return true;
+ }
+
+ bool found_in_vector[kVectorSize] = { false };
+ for (size_t i = 0; i < vector.size(); i++) {
+ const int e = vector[i];
+ if (e < 0 || e >= kVectorSize || found_in_vector[e]) {
+ return true;
+ }
+ found_in_vector[e] = true;
+ }
+
+ // Vector size is correct, elements' range is correct, no
+ // duplicate elements. Therefore no corruption has occurred.
+ return false;
+ }
+
+ static bool VectorIsNotCorrupt(const TestingVector& vector) {
+ return !VectorIsCorrupt(vector);
+ }
+
+ static bool RangeIsShuffled(const TestingVector& vector, int begin, int end) {
+ for (int i = begin; i < end; i++) {
+ if (i != vector[i]) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static bool RangeIsUnshuffled(
+ const TestingVector& vector, int begin, int end) {
+ return !RangeIsShuffled(vector, begin, end);
+ }
+
+ static bool VectorIsShuffled(const TestingVector& vector) {
+ return RangeIsShuffled(vector, 0, static_cast<int>(vector.size()));
+ }
+
+ static bool VectorIsUnshuffled(const TestingVector& vector) {
+ return !VectorIsShuffled(vector);
+ }
+
+ testing::internal::Random random_;
+ TestingVector vector_;
+}; // class VectorShuffleTest
+
+const int VectorShuffleTest::kVectorSize;
+
+TEST_F(VectorShuffleTest, HandlesEmptyRange) {
+ // Tests an empty range at the beginning...
+ ShuffleRange(&random_, 0, 0, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsUnshuffled, vector_);
+
+ // ...in the middle...
+ ShuffleRange(&random_, kVectorSize/2, kVectorSize/2, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsUnshuffled, vector_);
+
+ // ...at the end...
+ ShuffleRange(&random_, kVectorSize - 1, kVectorSize - 1, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsUnshuffled, vector_);
+
+ // ...and past the end.
+ ShuffleRange(&random_, kVectorSize, kVectorSize, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsUnshuffled, vector_);
+}
+
+TEST_F(VectorShuffleTest, HandlesRangeOfSizeOne) {
+ // Tests a size one range at the beginning...
+ ShuffleRange(&random_, 0, 1, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsUnshuffled, vector_);
+
+ // ...in the middle...
+ ShuffleRange(&random_, kVectorSize/2, kVectorSize/2 + 1, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsUnshuffled, vector_);
+
+ // ...and at the end.
+ ShuffleRange(&random_, kVectorSize - 1, kVectorSize, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsUnshuffled, vector_);
+}
+
+// Because we use our own random number generator and a fixed seed,
+// we can guarantee that the following "random" tests will succeed.
+
+TEST_F(VectorShuffleTest, ShufflesEntireVector) {
+ Shuffle(&random_, &vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ EXPECT_FALSE(VectorIsUnshuffled(vector_)) << vector_;
+
+ // Tests the first and last elements in particular to ensure that
+ // there are no off-by-one problems in our shuffle algorithm.
+ EXPECT_NE(0, vector_[0]);
+ EXPECT_NE(kVectorSize - 1, vector_[kVectorSize - 1]);
+}
+
+TEST_F(VectorShuffleTest, ShufflesStartOfVector) {
+ const int kRangeSize = kVectorSize/2;
+
+ ShuffleRange(&random_, 0, kRangeSize, &vector_);
+
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ EXPECT_PRED3(RangeIsShuffled, vector_, 0, kRangeSize);
+ EXPECT_PRED3(RangeIsUnshuffled, vector_, kRangeSize, kVectorSize);
+}
+
+TEST_F(VectorShuffleTest, ShufflesEndOfVector) {
+ const int kRangeSize = kVectorSize / 2;
+ ShuffleRange(&random_, kRangeSize, kVectorSize, &vector_);
+
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ EXPECT_PRED3(RangeIsUnshuffled, vector_, 0, kRangeSize);
+ EXPECT_PRED3(RangeIsShuffled, vector_, kRangeSize, kVectorSize);
+}
+
+TEST_F(VectorShuffleTest, ShufflesMiddleOfVector) {
+ int kRangeSize = kVectorSize/3;
+ ShuffleRange(&random_, kRangeSize, 2*kRangeSize, &vector_);
+
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ EXPECT_PRED3(RangeIsUnshuffled, vector_, 0, kRangeSize);
+ EXPECT_PRED3(RangeIsShuffled, vector_, kRangeSize, 2*kRangeSize);
+ EXPECT_PRED3(RangeIsUnshuffled, vector_, 2*kRangeSize, kVectorSize);
+}
+
+TEST_F(VectorShuffleTest, ShufflesRepeatably) {
+ TestingVector vector2;
+ for (int i = 0; i < kVectorSize; i++) {
+ vector2.push_back(i);
+ }
+
+ random_.Reseed(1234);
+ Shuffle(&random_, &vector_);
+ random_.Reseed(1234);
+ Shuffle(&random_, &vector2);
+
+ ASSERT_PRED1(VectorIsNotCorrupt, vector_);
+ ASSERT_PRED1(VectorIsNotCorrupt, vector2);
+
+ for (int i = 0; i < kVectorSize; i++) {
+ EXPECT_EQ(vector_[i], vector2[i]) << " where i is " << i;
+ }
+}
+
+// Tests the size of the AssertHelper class.
+
+TEST(AssertHelperTest, AssertHelperIsSmall) {
+ // To avoid breaking clients that use lots of assertions in one
+ // function, we cannot grow the size of AssertHelper.
+ EXPECT_LE(sizeof(testing::internal::AssertHelper), sizeof(void*));
+}
+
+// Tests the String class.
+
+// Tests String's constructors.
+TEST(StringTest, Constructors) {
+ // Default ctor.
+ String s1;
+ // We aren't using EXPECT_EQ(NULL, s1.c_str()) because comparing
+ // pointers with NULL isn't supported on all platforms.
+ EXPECT_EQ(0U, s1.length());
+ EXPECT_TRUE(NULL == s1.c_str());
+
+ // Implicitly constructs from a C-string.
+ String s2 = "Hi";
+ EXPECT_EQ(2U, s2.length());
+ EXPECT_STREQ("Hi", s2.c_str());
+
+ // Constructs from a C-string and a length.
+ String s3("hello", 3);
+ EXPECT_EQ(3U, s3.length());
+ EXPECT_STREQ("hel", s3.c_str());
+
+ // The empty String should be created when String is constructed with
+ // a NULL pointer and length 0.
+ EXPECT_EQ(0U, String(NULL, 0).length());
+ EXPECT_FALSE(String(NULL, 0).c_str() == NULL);
+
+ // Constructs a String that contains '\0'.
+ String s4("a\0bcd", 4);
+ EXPECT_EQ(4U, s4.length());
+ EXPECT_EQ('a', s4.c_str()[0]);
+ EXPECT_EQ('\0', s4.c_str()[1]);
+ EXPECT_EQ('b', s4.c_str()[2]);
+ EXPECT_EQ('c', s4.c_str()[3]);
+
+ // Copy ctor where the source is NULL.
+ const String null_str;
+ String s5 = null_str;
+ EXPECT_TRUE(s5.c_str() == NULL);
+
+ // Copy ctor where the source isn't NULL.
+ String s6 = s3;
+ EXPECT_EQ(3U, s6.length());
+ EXPECT_STREQ("hel", s6.c_str());
+
+ // Copy ctor where the source contains '\0'.
+ String s7 = s4;
+ EXPECT_EQ(4U, s7.length());
+ EXPECT_EQ('a', s7.c_str()[0]);
+ EXPECT_EQ('\0', s7.c_str()[1]);
+ EXPECT_EQ('b', s7.c_str()[2]);
+ EXPECT_EQ('c', s7.c_str()[3]);
+}
+
+TEST(StringTest, ConvertsFromStdString) {
+ // An empty std::string.
+ const std::string src1("");
+ const String dest1 = src1;
+ EXPECT_EQ(0U, dest1.length());
+ EXPECT_STREQ("", dest1.c_str());
+
+ // A normal std::string.
+ const std::string src2("Hi");
+ const String dest2 = src2;
+ EXPECT_EQ(2U, dest2.length());
+ EXPECT_STREQ("Hi", dest2.c_str());
+
+ // An std::string with an embedded NUL character.
+ const char src3[] = "a\0b";
+ const String dest3 = std::string(src3, sizeof(src3));
+ EXPECT_EQ(sizeof(src3), dest3.length());
+ EXPECT_EQ('a', dest3.c_str()[0]);
+ EXPECT_EQ('\0', dest3.c_str()[1]);
+ EXPECT_EQ('b', dest3.c_str()[2]);
+}
+
+TEST(StringTest, ConvertsToStdString) {
+ // An empty String.
+ const String src1("");
+ const std::string dest1 = src1;
+ EXPECT_EQ("", dest1);
+
+ // A normal String.
+ const String src2("Hi");
+ const std::string dest2 = src2;
+ EXPECT_EQ("Hi", dest2);
+
+ // A String containing a '\0'.
+ const String src3("x\0y", 3);
+ const std::string dest3 = src3;
+ EXPECT_EQ(std::string("x\0y", 3), dest3);
+}
+
+#if GTEST_HAS_GLOBAL_STRING
+
+TEST(StringTest, ConvertsFromGlobalString) {
+ // An empty ::string.
+ const ::string src1("");
+ const String dest1 = src1;
+ EXPECT_EQ(0U, dest1.length());
+ EXPECT_STREQ("", dest1.c_str());
+
+ // A normal ::string.
+ const ::string src2("Hi");
+ const String dest2 = src2;
+ EXPECT_EQ(2U, dest2.length());
+ EXPECT_STREQ("Hi", dest2.c_str());
+
+ // An ::string with an embedded NUL character.
+ const char src3[] = "x\0y";
+ const String dest3 = ::string(src3, sizeof(src3));
+ EXPECT_EQ(sizeof(src3), dest3.length());
+ EXPECT_EQ('x', dest3.c_str()[0]);
+ EXPECT_EQ('\0', dest3.c_str()[1]);
+ EXPECT_EQ('y', dest3.c_str()[2]);
+}
+
+TEST(StringTest, ConvertsToGlobalString) {
+ // An empty String.
+ const String src1("");
+ const ::string dest1 = src1;
+ EXPECT_EQ("", dest1);
+
+ // A normal String.
+ const String src2("Hi");
+ const ::string dest2 = src2;
+ EXPECT_EQ("Hi", dest2);
+
+ const String src3("x\0y", 3);
+ const ::string dest3 = src3;
+ EXPECT_EQ(::string("x\0y", 3), dest3);
+}
+
+#endif // GTEST_HAS_GLOBAL_STRING
+
+// Tests String::ShowCStringQuoted().
+TEST(StringTest, ShowCStringQuoted) {
+ EXPECT_STREQ("(null)",
+ String::ShowCStringQuoted(NULL).c_str());
+ EXPECT_STREQ("\"\"",
+ String::ShowCStringQuoted("").c_str());
+ EXPECT_STREQ("\"foo\"",
+ String::ShowCStringQuoted("foo").c_str());
+}
+
+// Tests String::empty().
+TEST(StringTest, Empty) {
+ EXPECT_TRUE(String("").empty());
+ EXPECT_FALSE(String().empty());
+ EXPECT_FALSE(String(NULL).empty());
+ EXPECT_FALSE(String("a").empty());
+ EXPECT_FALSE(String("\0", 1).empty());
+}
+
+// Tests String::Compare().
+TEST(StringTest, Compare) {
+ // NULL vs NULL.
+ EXPECT_EQ(0, String().Compare(String()));
+
+ // NULL vs non-NULL.
+ EXPECT_EQ(-1, String().Compare(String("")));
+
+ // Non-NULL vs NULL.
+ EXPECT_EQ(1, String("").Compare(String()));
+
+ // The following covers non-NULL vs non-NULL.
+
+ // "" vs "".
+ EXPECT_EQ(0, String("").Compare(String("")));
+
+ // "" vs non-"".
+ EXPECT_EQ(-1, String("").Compare(String("\0", 1)));
+ EXPECT_EQ(-1, String("").Compare(" "));
+
+ // Non-"" vs "".
+ EXPECT_EQ(1, String("a").Compare(String("")));
+
+ // The following covers non-"" vs non-"".
+
+ // Same length and equal.
+ EXPECT_EQ(0, String("a").Compare(String("a")));
+
+ // Same length and different.
+ EXPECT_EQ(-1, String("a\0b", 3).Compare(String("a\0c", 3)));
+ EXPECT_EQ(1, String("b").Compare(String("a")));
+
+ // Different lengths.
+ EXPECT_EQ(-1, String("a").Compare(String("ab")));
+ EXPECT_EQ(-1, String("a").Compare(String("a\0", 2)));
+ EXPECT_EQ(1, String("abc").Compare(String("aacd")));
+}
+
+// Tests String::operator==().
+TEST(StringTest, Equals) {
+ const String null(NULL);
+ EXPECT_TRUE(null == NULL); // NOLINT
+ EXPECT_FALSE(null == ""); // NOLINT
+ EXPECT_FALSE(null == "bar"); // NOLINT
+
+ const String empty("");
+ EXPECT_FALSE(empty == NULL); // NOLINT
+ EXPECT_TRUE(empty == ""); // NOLINT
+ EXPECT_FALSE(empty == "bar"); // NOLINT
+
+ const String foo("foo");
+ EXPECT_FALSE(foo == NULL); // NOLINT
+ EXPECT_FALSE(foo == ""); // NOLINT
+ EXPECT_FALSE(foo == "bar"); // NOLINT
+ EXPECT_TRUE(foo == "foo"); // NOLINT
+
+ const String bar("x\0y", 3);
+ EXPECT_FALSE(bar == "x");
+}
+
+// Tests String::operator!=().
+TEST(StringTest, NotEquals) {
+ const String null(NULL);
+ EXPECT_FALSE(null != NULL); // NOLINT
+ EXPECT_TRUE(null != ""); // NOLINT
+ EXPECT_TRUE(null != "bar"); // NOLINT
+
+ const String empty("");
+ EXPECT_TRUE(empty != NULL); // NOLINT
+ EXPECT_FALSE(empty != ""); // NOLINT
+ EXPECT_TRUE(empty != "bar"); // NOLINT
+
+ const String foo("foo");
+ EXPECT_TRUE(foo != NULL); // NOLINT
+ EXPECT_TRUE(foo != ""); // NOLINT
+ EXPECT_TRUE(foo != "bar"); // NOLINT
+ EXPECT_FALSE(foo != "foo"); // NOLINT
+
+ const String bar("x\0y", 3);
+ EXPECT_TRUE(bar != "x");
+}
+
+// Tests String::length().
+TEST(StringTest, Length) {
+ EXPECT_EQ(0U, String().length());
+ EXPECT_EQ(0U, String("").length());
+ EXPECT_EQ(2U, String("ab").length());
+ EXPECT_EQ(3U, String("a\0b", 3).length());
+}
+
+// Tests String::EndsWith().
+TEST(StringTest, EndsWith) {
+ EXPECT_TRUE(String("foobar").EndsWith("bar"));
+ EXPECT_TRUE(String("foobar").EndsWith(""));
+ EXPECT_TRUE(String("").EndsWith(""));
+
+ EXPECT_FALSE(String("foobar").EndsWith("foo"));
+ EXPECT_FALSE(String("").EndsWith("foo"));
+}
+
+// Tests String::EndsWithCaseInsensitive().
+TEST(StringTest, EndsWithCaseInsensitive) {
+ EXPECT_TRUE(String("foobar").EndsWithCaseInsensitive("BAR"));
+ EXPECT_TRUE(String("foobaR").EndsWithCaseInsensitive("bar"));
+ EXPECT_TRUE(String("foobar").EndsWithCaseInsensitive(""));
+ EXPECT_TRUE(String("").EndsWithCaseInsensitive(""));
+
+ EXPECT_FALSE(String("Foobar").EndsWithCaseInsensitive("foo"));
+ EXPECT_FALSE(String("foobar").EndsWithCaseInsensitive("Foo"));
+ EXPECT_FALSE(String("").EndsWithCaseInsensitive("foo"));
+}
+
+// C++Builder's preprocessor is buggy; it fails to expand macros that
+// appear in macro parameters after wide char literals. Provide an alias
+// for NULL as a workaround.
+static const wchar_t* const kNull = NULL;
+
+// Tests String::CaseInsensitiveWideCStringEquals
+TEST(StringTest, CaseInsensitiveWideCStringEquals) {
+ EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(NULL, NULL));
+ EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(kNull, L""));
+ EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(L"", kNull));
+ EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(kNull, L"foobar"));
+ EXPECT_FALSE(String::CaseInsensitiveWideCStringEquals(L"foobar", kNull));
+ EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L"foobar", L"foobar"));
+ EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L"foobar", L"FOOBAR"));
+ EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L"FOOBAR", L"foobar"));
+}
+
+// Tests that NULL can be assigned to a String.
+TEST(StringTest, CanBeAssignedNULL) {
+ const String src(NULL);
+ String dest;
+
+ dest = src;
+ EXPECT_STREQ(NULL, dest.c_str());
+}
+
+// Tests that the empty string "" can be assigned to a String.
+TEST(StringTest, CanBeAssignedEmpty) {
+ const String src("");
+ String dest;
+
+ dest = src;
+ EXPECT_STREQ("", dest.c_str());
+}
+
+// Tests that a non-empty string can be assigned to a String.
+TEST(StringTest, CanBeAssignedNonEmpty) {
+ const String src("hello");
+ String dest;
+ dest = src;
+ EXPECT_EQ(5U, dest.length());
+ EXPECT_STREQ("hello", dest.c_str());
+
+ const String src2("x\0y", 3);
+ String dest2;
+ dest2 = src2;
+ EXPECT_EQ(3U, dest2.length());
+ EXPECT_EQ('x', dest2.c_str()[0]);
+ EXPECT_EQ('\0', dest2.c_str()[1]);
+ EXPECT_EQ('y', dest2.c_str()[2]);
+}
+
+// Tests that a String can be assigned to itself.
+TEST(StringTest, CanBeAssignedSelf) {
+ String dest("hello");
+
+ dest = dest;
+ EXPECT_STREQ("hello", dest.c_str());
+}
+
+// Sun Studio < 12 incorrectly rejects this code due to an overloading
+// ambiguity.
+#if !(defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
+// Tests streaming a String.
+TEST(StringTest, Streams) {
+ EXPECT_EQ(StreamableToString(String()), "(null)");
+ EXPECT_EQ(StreamableToString(String("")), "");
+ EXPECT_EQ(StreamableToString(String("a\0b", 3)), "a\\0b");
+}
+#endif
+
+// Tests that String::Format() works.
+TEST(StringTest, FormatWorks) {
+ // Normal case: the format spec is valid, the arguments match the
+ // spec, and the result is < 4095 characters.
+ EXPECT_STREQ("Hello, 42", String::Format("%s, %d", "Hello", 42).c_str());
+
+ // Edge case: the result is 4095 characters.
+ char buffer[4096];
+ const size_t kSize = sizeof(buffer);
+ memset(buffer, 'a', kSize - 1);
+ buffer[kSize - 1] = '\0';
+ EXPECT_STREQ(buffer, String::Format("%s", buffer).c_str());
+
+ // The result needs to be 4096 characters, exceeding Format()'s limit.
+ EXPECT_STREQ("<formatting error or buffer exceeded>",
+ String::Format("x%s", buffer).c_str());
+
+#if GTEST_OS_LINUX
+ // On Linux, invalid format spec should lead to an error message.
+ // In other environment (e.g. MSVC on Windows), String::Format() may
+ // simply ignore a bad format spec, so this assertion is run on
+ // Linux only.
+ EXPECT_STREQ("<formatting error or buffer exceeded>",
+ String::Format("%").c_str());
+#endif
+}
+
+#if GTEST_OS_WINDOWS
+
+// Tests String::ShowWideCString().
+TEST(StringTest, ShowWideCString) {
+ EXPECT_STREQ("(null)",
+ String::ShowWideCString(NULL).c_str());
+ EXPECT_STREQ("", String::ShowWideCString(L"").c_str());
+ EXPECT_STREQ("foo", String::ShowWideCString(L"foo").c_str());
+}
+
+// Tests String::ShowWideCStringQuoted().
+TEST(StringTest, ShowWideCStringQuoted) {
+ EXPECT_STREQ("(null)",
+ String::ShowWideCStringQuoted(NULL).c_str());
+ EXPECT_STREQ("L\"\"",
+ String::ShowWideCStringQuoted(L"").c_str());
+ EXPECT_STREQ("L\"foo\"",
+ String::ShowWideCStringQuoted(L"foo").c_str());
+}
+
+#if GTEST_OS_WINDOWS_MOBILE
+TEST(StringTest, AnsiAndUtf16Null) {
+ EXPECT_EQ(NULL, String::AnsiToUtf16(NULL));
+ EXPECT_EQ(NULL, String::Utf16ToAnsi(NULL));
+}
+
+TEST(StringTest, AnsiAndUtf16ConvertBasic) {
+ const char* ansi = String::Utf16ToAnsi(L"str");
+ EXPECT_STREQ("str", ansi);
+ delete [] ansi;
+ const WCHAR* utf16 = String::AnsiToUtf16("str");
+ EXPECT_EQ(0, wcsncmp(L"str", utf16, 3));
+ delete [] utf16;
+}
+
+TEST(StringTest, AnsiAndUtf16ConvertPathChars) {
+ const char* ansi = String::Utf16ToAnsi(L".:\\ \"*?");
+ EXPECT_STREQ(".:\\ \"*?", ansi);
+ delete [] ansi;
+ const WCHAR* utf16 = String::AnsiToUtf16(".:\\ \"*?");
+ EXPECT_EQ(0, wcsncmp(L".:\\ \"*?", utf16, 3));
+ delete [] utf16;
+}
+#endif // GTEST_OS_WINDOWS_MOBILE
+
+#endif // GTEST_OS_WINDOWS
+
+// Tests TestProperty construction.
+TEST(TestPropertyTest, StringValue) {
+ TestProperty property("key", "1");
+ EXPECT_STREQ("key", property.key());
+ EXPECT_STREQ("1", property.value());
+}
+
+// Tests TestProperty replacing a value.
+TEST(TestPropertyTest, ReplaceStringValue) {
+ TestProperty property("key", "1");
+ EXPECT_STREQ("1", property.value());
+ property.SetValue("2");
+ EXPECT_STREQ("2", property.value());
+}
+
+// AddFatalFailure() and AddNonfatalFailure() must be stand-alone
+// functions (i.e. their definitions cannot be inlined at the call
+// sites), or C++Builder won't compile the code.
+static void AddFatalFailure() {
+ FAIL() << "Expected fatal failure.";
+}
+
+static void AddNonfatalFailure() {
+ ADD_FAILURE() << "Expected non-fatal failure.";
+}
+
+class ScopedFakeTestPartResultReporterTest : public Test {
+ public: // Must be public and not protected due to a bug in g++ 3.4.2.
+ enum FailureMode {
+ FATAL_FAILURE,
+ NONFATAL_FAILURE
+ };
+ static void AddFailure(FailureMode failure) {
+ if (failure == FATAL_FAILURE) {
+ AddFatalFailure();
+ } else {
+ AddNonfatalFailure();
+ }
+ }
+};
+
+// Tests that ScopedFakeTestPartResultReporter intercepts test
+// failures.
+TEST_F(ScopedFakeTestPartResultReporterTest, InterceptsTestFailures) {
+ TestPartResultArray results;
+ {
+ ScopedFakeTestPartResultReporter reporter(
+ ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,
+ &results);
+ AddFailure(NONFATAL_FAILURE);
+ AddFailure(FATAL_FAILURE);
+ }
+
+ EXPECT_EQ(2, results.size());
+ EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());
+ EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
+}
+
+TEST_F(ScopedFakeTestPartResultReporterTest, DeprecatedConstructor) {
+ TestPartResultArray results;
+ {
+ // Tests, that the deprecated constructor still works.
+ ScopedFakeTestPartResultReporter reporter(&results);
+ AddFailure(NONFATAL_FAILURE);
+ }
+ EXPECT_EQ(1, results.size());
+}
+
+#if GTEST_IS_THREADSAFE
+
+class ScopedFakeTestPartResultReporterWithThreadsTest
+ : public ScopedFakeTestPartResultReporterTest {
+ protected:
+ static void AddFailureInOtherThread(FailureMode failure) {
+ ThreadWithParam<FailureMode> thread(&AddFailure, failure, NULL);
+ thread.Join();
+ }
+};
+
+TEST_F(ScopedFakeTestPartResultReporterWithThreadsTest,
+ InterceptsTestFailuresInAllThreads) {
+ TestPartResultArray results;
+ {
+ ScopedFakeTestPartResultReporter reporter(
+ ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, &results);
+ AddFailure(NONFATAL_FAILURE);
+ AddFailure(FATAL_FAILURE);
+ AddFailureInOtherThread(NONFATAL_FAILURE);
+ AddFailureInOtherThread(FATAL_FAILURE);
+ }
+
+ EXPECT_EQ(4, results.size());
+ EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());
+ EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
+ EXPECT_TRUE(results.GetTestPartResult(2).nonfatally_failed());
+ EXPECT_TRUE(results.GetTestPartResult(3).fatally_failed());
+}
+
+#endif // GTEST_IS_THREADSAFE
+
+// Tests EXPECT_FATAL_FAILURE{,ON_ALL_THREADS}. Makes sure that they
+// work even if the failure is generated in a called function rather than
+// the current context.
+
+typedef ScopedFakeTestPartResultReporterTest ExpectFatalFailureTest;
+
+TEST_F(ExpectFatalFailureTest, CatchesFatalFaliure) {
+ EXPECT_FATAL_FAILURE(AddFatalFailure(), "Expected fatal failure.");
+}
+
+TEST_F(ExpectFatalFailureTest, CatchesFatalFailureOnAllThreads) {
+ // We have another test below to verify that the macro catches fatal
+ // failures generated on another thread.
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFatalFailure(),
+ "Expected fatal failure.");
+}
+
+#ifdef __BORLANDC__
+// Silences warnings: "Condition is always true"
+#pragma option push -w-ccc
+#endif
+
+// Tests that EXPECT_FATAL_FAILURE() can be used in a non-void
+// function even when the statement in it contains ASSERT_*.
+
+int NonVoidFunction() {
+ EXPECT_FATAL_FAILURE(ASSERT_TRUE(false), "");
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(FAIL(), "");
+ return 0;
+}
+
+TEST_F(ExpectFatalFailureTest, CanBeUsedInNonVoidFunction) {
+ NonVoidFunction();
+}
+
+// Tests that EXPECT_FATAL_FAILURE(statement, ...) doesn't abort the
+// current function even though 'statement' generates a fatal failure.
+
+void DoesNotAbortHelper(bool* aborted) {
+ EXPECT_FATAL_FAILURE(ASSERT_TRUE(false), "");
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(FAIL(), "");
+
+ *aborted = false;
+}
+
+#ifdef __BORLANDC__
+// Restores warnings after previous "#pragma option push" suppressed them.
+#pragma option pop
+#endif
+
+TEST_F(ExpectFatalFailureTest, DoesNotAbort) {
+ bool aborted = true;
+ DoesNotAbortHelper(&aborted);
+ EXPECT_FALSE(aborted);
+}
+
+// Tests that the EXPECT_FATAL_FAILURE{,_ON_ALL_THREADS} accepts a
+// statement that contains a macro which expands to code containing an
+// unprotected comma.
+
+static int global_var = 0;
+#define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++
+
+TEST_F(ExpectFatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
+#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x600
+ // ICE's in C++Builder 2007.
+ EXPECT_FATAL_FAILURE({
+ GTEST_USE_UNPROTECTED_COMMA_;
+ AddFatalFailure();
+ }, "");
+#endif
+
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS({
+ GTEST_USE_UNPROTECTED_COMMA_;
+ AddFatalFailure();
+ }, "");
+}
+
+// Tests EXPECT_NONFATAL_FAILURE{,ON_ALL_THREADS}.
+
+typedef ScopedFakeTestPartResultReporterTest ExpectNonfatalFailureTest;
+
+TEST_F(ExpectNonfatalFailureTest, CatchesNonfatalFailure) {
+ EXPECT_NONFATAL_FAILURE(AddNonfatalFailure(),
+ "Expected non-fatal failure.");
+}
+
+TEST_F(ExpectNonfatalFailureTest, CatchesNonfatalFailureOnAllThreads) {
+ // We have another test below to verify that the macro catches
+ // non-fatal failures generated on another thread.
+ EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddNonfatalFailure(),
+ "Expected non-fatal failure.");
+}
+
+// Tests that the EXPECT_NONFATAL_FAILURE{,_ON_ALL_THREADS} accepts a
+// statement that contains a macro which expands to code containing an
+// unprotected comma.
+TEST_F(ExpectNonfatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
+ EXPECT_NONFATAL_FAILURE({
+ GTEST_USE_UNPROTECTED_COMMA_;
+ AddNonfatalFailure();
+ }, "");
+
+ EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS({
+ GTEST_USE_UNPROTECTED_COMMA_;
+ AddNonfatalFailure();
+ }, "");
+}
+
+#if GTEST_IS_THREADSAFE
+
+typedef ScopedFakeTestPartResultReporterWithThreadsTest
+ ExpectFailureWithThreadsTest;
+
+TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailureOnAllThreads) {
+ EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailureInOtherThread(FATAL_FAILURE),
+ "Expected fatal failure.");
+}
+
+TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailureOnAllThreads) {
+ EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(
+ AddFailureInOtherThread(NONFATAL_FAILURE), "Expected non-fatal failure.");
+}
+
+#endif // GTEST_IS_THREADSAFE
+
+// Tests the TestProperty class.
+
+TEST(TestPropertyTest, ConstructorWorks) {
+ const TestProperty property("key", "value");
+ EXPECT_STREQ("key", property.key());
+ EXPECT_STREQ("value", property.value());
+}
+
+TEST(TestPropertyTest, SetValue) {
+ TestProperty property("key", "value_1");
+ EXPECT_STREQ("key", property.key());
+ property.SetValue("value_2");
+ EXPECT_STREQ("key", property.key());
+ EXPECT_STREQ("value_2", property.value());
+}
+
+// Tests the TestResult class
+
+// The test fixture for testing TestResult.
+class TestResultTest : public Test {
+ protected:
+ typedef std::vector<TestPartResult> TPRVector;
+
+ // We make use of 2 TestPartResult objects,
+ TestPartResult * pr1, * pr2;
+
+ // ... and 3 TestResult objects.
+ TestResult * r0, * r1, * r2;
+
+ virtual void SetUp() {
+ // pr1 is for success.
+ pr1 = new TestPartResult(TestPartResult::kSuccess,
+ "foo/bar.cc",
+ 10,
+ "Success!");
+
+ // pr2 is for fatal failure.
+ pr2 = new TestPartResult(TestPartResult::kFatalFailure,
+ "foo/bar.cc",
+ -1, // This line number means "unknown"
+ "Failure!");
+
+ // Creates the TestResult objects.
+ r0 = new TestResult();
+ r1 = new TestResult();
+ r2 = new TestResult();
+
+ // In order to test TestResult, we need to modify its internal
+ // state, in particular the TestPartResult vector it holds.
+ // test_part_results() returns a const reference to this vector.
+ // We cast it to a non-const object s.t. it can be modified (yes,
+ // this is a hack).
+ TPRVector* results1 = const_cast<TPRVector*>(
+ &TestResultAccessor::test_part_results(*r1));
+ TPRVector* results2 = const_cast<TPRVector*>(
+ &TestResultAccessor::test_part_results(*r2));
+
+ // r0 is an empty TestResult.
+
+ // r1 contains a single SUCCESS TestPartResult.
+ results1->push_back(*pr1);
+
+ // r2 contains a SUCCESS, and a FAILURE.
+ results2->push_back(*pr1);
+ results2->push_back(*pr2);
+ }
+
+ virtual void TearDown() {
+ delete pr1;
+ delete pr2;
+
+ delete r0;
+ delete r1;
+ delete r2;
+ }
+
+ // Helper that compares two two TestPartResults.
+ static void CompareTestPartResult(const TestPartResult& expected,
+ const TestPartResult& actual) {
+ EXPECT_EQ(expected.type(), actual.type());
+ EXPECT_STREQ(expected.file_name(), actual.file_name());
+ EXPECT_EQ(expected.line_number(), actual.line_number());
+ EXPECT_STREQ(expected.summary(), actual.summary());
+ EXPECT_STREQ(expected.message(), actual.message());
+ EXPECT_EQ(expected.passed(), actual.passed());
+ EXPECT_EQ(expected.failed(), actual.failed());
+ EXPECT_EQ(expected.nonfatally_failed(), actual.nonfatally_failed());
+ EXPECT_EQ(expected.fatally_failed(), actual.fatally_failed());
+ }
+};
+
+// Tests TestResult::total_part_count().
+TEST_F(TestResultTest, total_part_count) {
+ ASSERT_EQ(0, r0->total_part_count());
+ ASSERT_EQ(1, r1->total_part_count());
+ ASSERT_EQ(2, r2->total_part_count());
+}
+
+// Tests TestResult::Passed().
+TEST_F(TestResultTest, Passed) {
+ ASSERT_TRUE(r0->Passed());
+ ASSERT_TRUE(r1->Passed());
+ ASSERT_FALSE(r2->Passed());
+}
+
+// Tests TestResult::Failed().
+TEST_F(TestResultTest, Failed) {
+ ASSERT_FALSE(r0->Failed());
+ ASSERT_FALSE(r1->Failed());
+ ASSERT_TRUE(r2->Failed());
+}
+
+// Tests TestResult::GetTestPartResult().
+
+typedef TestResultTest TestResultDeathTest;
+
+TEST_F(TestResultDeathTest, GetTestPartResult) {
+ CompareTestPartResult(*pr1, r2->GetTestPartResult(0));
+ CompareTestPartResult(*pr2, r2->GetTestPartResult(1));
+ EXPECT_DEATH_IF_SUPPORTED(r2->GetTestPartResult(2), "");
+ EXPECT_DEATH_IF_SUPPORTED(r2->GetTestPartResult(-1), "");
+}
+
+// Tests TestResult has no properties when none are added.
+TEST(TestResultPropertyTest, NoPropertiesFoundWhenNoneAreAdded) {
+ TestResult test_result;
+ ASSERT_EQ(0, test_result.test_property_count());
+}
+
+// Tests TestResult has the expected property when added.
+TEST(TestResultPropertyTest, OnePropertyFoundWhenAdded) {
+ TestResult test_result;
+ TestProperty property("key_1", "1");
+ TestResultAccessor::RecordProperty(&test_result, property);
+ ASSERT_EQ(1, test_result.test_property_count());
+ const TestProperty& actual_property = test_result.GetTestProperty(0);
+ EXPECT_STREQ("key_1", actual_property.key());
+ EXPECT_STREQ("1", actual_property.value());
+}
+
+// Tests TestResult has multiple properties when added.
+TEST(TestResultPropertyTest, MultiplePropertiesFoundWhenAdded) {
+ TestResult test_result;
+ TestProperty property_1("key_1", "1");
+ TestProperty property_2("key_2", "2");
+ TestResultAccessor::RecordProperty(&test_result, property_1);
+ TestResultAccessor::RecordProperty(&test_result, property_2);
+ ASSERT_EQ(2, test_result.test_property_count());
+ const TestProperty& actual_property_1 = test_result.GetTestProperty(0);
+ EXPECT_STREQ("key_1", actual_property_1.key());
+ EXPECT_STREQ("1", actual_property_1.value());
+
+ const TestProperty& actual_property_2 = test_result.GetTestProperty(1);
+ EXPECT_STREQ("key_2", actual_property_2.key());
+ EXPECT_STREQ("2", actual_property_2.value());
+}
+
+// Tests TestResult::RecordProperty() overrides values for duplicate keys.
+TEST(TestResultPropertyTest, OverridesValuesForDuplicateKeys) {
+ TestResult test_result;
+ TestProperty property_1_1("key_1", "1");
+ TestProperty property_2_1("key_2", "2");
+ TestProperty property_1_2("key_1", "12");
+ TestProperty property_2_2("key_2", "22");
+ TestResultAccessor::RecordProperty(&test_result, property_1_1);
+ TestResultAccessor::RecordProperty(&test_result, property_2_1);
+ TestResultAccessor::RecordProperty(&test_result, property_1_2);
+ TestResultAccessor::RecordProperty(&test_result, property_2_2);
+
+ ASSERT_EQ(2, test_result.test_property_count());
+ const TestProperty& actual_property_1 = test_result.GetTestProperty(0);
+ EXPECT_STREQ("key_1", actual_property_1.key());
+ EXPECT_STREQ("12", actual_property_1.value());
+
+ const TestProperty& actual_property_2 = test_result.GetTestProperty(1);
+ EXPECT_STREQ("key_2", actual_property_2.key());
+ EXPECT_STREQ("22", actual_property_2.value());
+}
+
+// Tests TestResult::GetTestProperty().
+TEST(TestResultPropertyDeathTest, GetTestProperty) {
+ TestResult test_result;
+ TestProperty property_1("key_1", "1");
+ TestProperty property_2("key_2", "2");
+ TestProperty property_3("key_3", "3");
+ TestResultAccessor::RecordProperty(&test_result, property_1);
+ TestResultAccessor::RecordProperty(&test_result, property_2);
+ TestResultAccessor::RecordProperty(&test_result, property_3);
+
+ const TestProperty& fetched_property_1 = test_result.GetTestProperty(0);
+ const TestProperty& fetched_property_2 = test_result.GetTestProperty(1);
+ const TestProperty& fetched_property_3 = test_result.GetTestProperty(2);
+
+ EXPECT_STREQ("key_1", fetched_property_1.key());
+ EXPECT_STREQ("1", fetched_property_1.value());
+
+ EXPECT_STREQ("key_2", fetched_property_2.key());
+ EXPECT_STREQ("2", fetched_property_2.value());
+
+ EXPECT_STREQ("key_3", fetched_property_3.key());
+ EXPECT_STREQ("3", fetched_property_3.value());
+
+ EXPECT_DEATH_IF_SUPPORTED(test_result.GetTestProperty(3), "");
+ EXPECT_DEATH_IF_SUPPORTED(test_result.GetTestProperty(-1), "");
+}
+
+// When a property using a reserved key is supplied to this function, it tests
+// that a non-fatal failure is added, a fatal failure is not added, and that the
+// property is not recorded.
+void ExpectNonFatalFailureRecordingPropertyWithReservedKey(const char* key) {
+ TestResult test_result;
+ TestProperty property(key, "1");
+ EXPECT_NONFATAL_FAILURE(
+ TestResultAccessor::RecordProperty(&test_result, property),
+ "Reserved key");
+ ASSERT_EQ(0, test_result.test_property_count()) << "Not recorded";
+}
+
+// Attempting to recording a property with the Reserved literal "name"
+// should add a non-fatal failure and the property should not be recorded.
+TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledName) {
+ ExpectNonFatalFailureRecordingPropertyWithReservedKey("name");
+}
+
+// Attempting to recording a property with the Reserved literal "status"
+// should add a non-fatal failure and the property should not be recorded.
+TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledStatus) {
+ ExpectNonFatalFailureRecordingPropertyWithReservedKey("status");
+}
+
+// Attempting to recording a property with the Reserved literal "time"
+// should add a non-fatal failure and the property should not be recorded.
+TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledTime) {
+ ExpectNonFatalFailureRecordingPropertyWithReservedKey("time");
+}
+
+// Attempting to recording a property with the Reserved literal "classname"
+// should add a non-fatal failure and the property should not be recorded.
+TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledClassname) {
+ ExpectNonFatalFailureRecordingPropertyWithReservedKey("classname");
+}
+
+// Tests that GTestFlagSaver works on Windows and Mac.
+
+class GTestFlagSaverTest : public Test {
+ protected:
+ // Saves the Google Test flags such that we can restore them later, and
+ // then sets them to their default values. This will be called
+ // before the first test in this test case is run.
+ static void SetUpTestCase() {
+ saver_ = new GTestFlagSaver;
+
+ GTEST_FLAG(also_run_disabled_tests) = false;
+ GTEST_FLAG(break_on_failure) = false;
+ GTEST_FLAG(catch_exceptions) = false;
+ GTEST_FLAG(death_test_use_fork) = false;
+ GTEST_FLAG(color) = "auto";
+ GTEST_FLAG(filter) = "";
+ GTEST_FLAG(list_tests) = false;
+ GTEST_FLAG(output) = "";
+ GTEST_FLAG(print_time) = true;
+ GTEST_FLAG(random_seed) = 0;
+ GTEST_FLAG(repeat) = 1;
+ GTEST_FLAG(shuffle) = false;
+ GTEST_FLAG(stack_trace_depth) = kMaxStackTraceDepth;
+ GTEST_FLAG(throw_on_failure) = false;
+ }
+
+ // Restores the Google Test flags that the tests have modified. This will
+ // be called after the last test in this test case is run.
+ static void TearDownTestCase() {
+ delete saver_;
+ saver_ = NULL;
+ }
+
+ // Verifies that the Google Test flags have their default values, and then
+ // modifies each of them.
+ void VerifyAndModifyFlags() {
+ EXPECT_FALSE(GTEST_FLAG(also_run_disabled_tests));
+ EXPECT_FALSE(GTEST_FLAG(break_on_failure));
+ EXPECT_FALSE(GTEST_FLAG(catch_exceptions));
+ EXPECT_STREQ("auto", GTEST_FLAG(color).c_str());
+ EXPECT_FALSE(GTEST_FLAG(death_test_use_fork));
+ EXPECT_STREQ("", GTEST_FLAG(filter).c_str());
+ EXPECT_FALSE(GTEST_FLAG(list_tests));
+ EXPECT_STREQ("", GTEST_FLAG(output).c_str());
+ EXPECT_TRUE(GTEST_FLAG(print_time));
+ EXPECT_EQ(0, GTEST_FLAG(random_seed));
+ EXPECT_EQ(1, GTEST_FLAG(repeat));
+ EXPECT_FALSE(GTEST_FLAG(shuffle));
+ EXPECT_EQ(kMaxStackTraceDepth, GTEST_FLAG(stack_trace_depth));
+ EXPECT_FALSE(GTEST_FLAG(throw_on_failure));
+
+ GTEST_FLAG(also_run_disabled_tests) = true;
+ GTEST_FLAG(break_on_failure) = true;
+ GTEST_FLAG(catch_exceptions) = true;
+ GTEST_FLAG(color) = "no";
+ GTEST_FLAG(death_test_use_fork) = true;
+ GTEST_FLAG(filter) = "abc";
+ GTEST_FLAG(list_tests) = true;
+ GTEST_FLAG(output) = "xml:foo.xml";
+ GTEST_FLAG(print_time) = false;
+ GTEST_FLAG(random_seed) = 1;
+ GTEST_FLAG(repeat) = 100;
+ GTEST_FLAG(shuffle) = true;
+ GTEST_FLAG(stack_trace_depth) = 1;
+ GTEST_FLAG(throw_on_failure) = true;
+ }
+ private:
+ // For saving Google Test flags during this test case.
+ static GTestFlagSaver* saver_;
+};
+
+GTestFlagSaver* GTestFlagSaverTest::saver_ = NULL;
+
+// Google Test doesn't guarantee the order of tests. The following two
+// tests are designed to work regardless of their order.
+
+// Modifies the Google Test flags in the test body.
+TEST_F(GTestFlagSaverTest, ModifyGTestFlags) {
+ VerifyAndModifyFlags();
+}
+
+// Verifies that the Google Test flags in the body of the previous test were
+// restored to their original values.
+TEST_F(GTestFlagSaverTest, VerifyGTestFlags) {
+ VerifyAndModifyFlags();
+}
+
+// Sets an environment variable with the given name to the given
+// value. If the value argument is "", unsets the environment
+// variable. The caller must ensure that both arguments are not NULL.
+static void SetEnv(const char* name, const char* value) {
+#if GTEST_OS_WINDOWS_MOBILE
+ // Environment variables are not supported on Windows CE.
+ return;
+#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
+ // C++Builder's putenv only stores a pointer to its parameter; we have to
+ // ensure that the string remains valid as long as it might be needed.
+ // We use an std::map to do so.
+ static std::map<String, String*> added_env;
+
+ // Because putenv stores a pointer to the string buffer, we can't delete the
+ // previous string (if present) until after it's replaced.
+ String *prev_env = NULL;
+ if (added_env.find(name) != added_env.end()) {
+ prev_env = added_env[name];
+ }
+ added_env[name] = new String((Message() << name << "=" << value).GetString());
+
+ // The standard signature of putenv accepts a 'char*' argument. Other
+ // implementations, like C++Builder's, accept a 'const char*'.
+ // We cast away the 'const' since that would work for both variants.
+ putenv(const_cast<char*>(added_env[name]->c_str()));
+ delete prev_env;
+#elif GTEST_OS_WINDOWS // If we are on Windows proper.
+ _putenv((Message() << name << "=" << value).GetString().c_str());
+#else
+ if (*value == '\0') {
+ unsetenv(name);
+ } else {
+ setenv(name, value, 1);
+ }
+#endif // GTEST_OS_WINDOWS_MOBILE
+}
+
+#if !GTEST_OS_WINDOWS_MOBILE
+// Environment variables are not supported on Windows CE.
+
+using testing::internal::Int32FromGTestEnv;
+
+// Tests Int32FromGTestEnv().
+
+// Tests that Int32FromGTestEnv() returns the default value when the
+// environment variable is not set.
+TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenVariableIsNotSet) {
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "");
+ EXPECT_EQ(10, Int32FromGTestEnv("temp", 10));
+}
+
+// Tests that Int32FromGTestEnv() returns the default value when the
+// environment variable overflows as an Int32.
+TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueOverflows) {
+ printf("(expecting 2 warnings)\n");
+
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "12345678987654321");
+ EXPECT_EQ(20, Int32FromGTestEnv("temp", 20));
+
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "-12345678987654321");
+ EXPECT_EQ(30, Int32FromGTestEnv("temp", 30));
+}
+
+// Tests that Int32FromGTestEnv() returns the default value when the
+// environment variable does not represent a valid decimal integer.
+TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueIsInvalid) {
+ printf("(expecting 2 warnings)\n");
+
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "A1");
+ EXPECT_EQ(40, Int32FromGTestEnv("temp", 40));
+
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "12X");
+ EXPECT_EQ(50, Int32FromGTestEnv("temp", 50));
+}
+
+// Tests that Int32FromGTestEnv() parses and returns the value of the
+// environment variable when it represents a valid decimal integer in
+// the range of an Int32.
+TEST(Int32FromGTestEnvTest, ParsesAndReturnsValidValue) {
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "123");
+ EXPECT_EQ(123, Int32FromGTestEnv("temp", 0));
+
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "-321");
+ EXPECT_EQ(-321, Int32FromGTestEnv("temp", 0));
+}
+#endif // !GTEST_OS_WINDOWS_MOBILE
+
+// Tests ParseInt32Flag().
+
+// Tests that ParseInt32Flag() returns false and doesn't change the
+// output value when the flag has wrong format
+TEST(ParseInt32FlagTest, ReturnsFalseForInvalidFlag) {
+ Int32 value = 123;
+ EXPECT_FALSE(ParseInt32Flag("--a=100", "b", &value));
+ EXPECT_EQ(123, value);
+
+ EXPECT_FALSE(ParseInt32Flag("a=100", "a", &value));
+ EXPECT_EQ(123, value);
+}
+
+// Tests that ParseInt32Flag() returns false and doesn't change the
+// output value when the flag overflows as an Int32.
+TEST(ParseInt32FlagTest, ReturnsDefaultWhenValueOverflows) {
+ printf("(expecting 2 warnings)\n");
+
+ Int32 value = 123;
+ EXPECT_FALSE(ParseInt32Flag("--abc=12345678987654321", "abc", &value));
+ EXPECT_EQ(123, value);
+
+ EXPECT_FALSE(ParseInt32Flag("--abc=-12345678987654321", "abc", &value));
+ EXPECT_EQ(123, value);
+}
+
+// Tests that ParseInt32Flag() returns false and doesn't change the
+// output value when the flag does not represent a valid decimal
+// integer.
+TEST(ParseInt32FlagTest, ReturnsDefaultWhenValueIsInvalid) {
+ printf("(expecting 2 warnings)\n");
+
+ Int32 value = 123;
+ EXPECT_FALSE(ParseInt32Flag("--abc=A1", "abc", &value));
+ EXPECT_EQ(123, value);
+
+ EXPECT_FALSE(ParseInt32Flag("--abc=12X", "abc", &value));
+ EXPECT_EQ(123, value);
+}
+
+// Tests that ParseInt32Flag() parses the value of the flag and
+// returns true when the flag represents a valid decimal integer in
+// the range of an Int32.
+TEST(ParseInt32FlagTest, ParsesAndReturnsValidValue) {
+ Int32 value = 123;
+ EXPECT_TRUE(ParseInt32Flag("--" GTEST_FLAG_PREFIX_ "abc=456", "abc", &value));
+ EXPECT_EQ(456, value);
+
+ EXPECT_TRUE(ParseInt32Flag("--" GTEST_FLAG_PREFIX_ "abc=-789",
+ "abc", &value));
+ EXPECT_EQ(-789, value);
+}
+
+// Tests that Int32FromEnvOrDie() parses the value of the var or
+// returns the correct default.
+// Environment variables are not supported on Windows CE.
+#if !GTEST_OS_WINDOWS_MOBILE
+TEST(Int32FromEnvOrDieTest, ParsesAndReturnsValidValue) {
+ EXPECT_EQ(333, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", 333));
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", "123");
+ EXPECT_EQ(123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", 333));
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", "-123");
+ EXPECT_EQ(-123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", 333));
+}
+#endif // !GTEST_OS_WINDOWS_MOBILE
+
+// Tests that Int32FromEnvOrDie() aborts with an error message
+// if the variable is not an Int32.
+TEST(Int32FromEnvOrDieDeathTest, AbortsOnFailure) {
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "VAR", "xxx");
+ EXPECT_DEATH_IF_SUPPORTED(
+ Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "VAR", 123),
+ ".*");
+}
+
+// Tests that Int32FromEnvOrDie() aborts with an error message
+// if the variable cannot be represnted by an Int32.
+TEST(Int32FromEnvOrDieDeathTest, AbortsOnInt32Overflow) {
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "VAR", "1234567891234567891234");
+ EXPECT_DEATH_IF_SUPPORTED(
+ Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "VAR", 123),
+ ".*");
+}
+
+// Tests that ShouldRunTestOnShard() selects all tests
+// where there is 1 shard.
+TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereIsOneShard) {
+ EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 0));
+ EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 1));
+ EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 2));
+ EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 3));
+ EXPECT_TRUE(ShouldRunTestOnShard(1, 0, 4));
+}
+
+class ShouldShardTest : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ index_var_ = GTEST_FLAG_PREFIX_UPPER_ "INDEX";
+ total_var_ = GTEST_FLAG_PREFIX_UPPER_ "TOTAL";
+ }
+
+ virtual void TearDown() {
+ SetEnv(index_var_, "");
+ SetEnv(total_var_, "");
+ }
+
+ const char* index_var_;
+ const char* total_var_;
+};
+
+// Tests that sharding is disabled if neither of the environment variables
+// are set.
+TEST_F(ShouldShardTest, ReturnsFalseWhenNeitherEnvVarIsSet) {
+ SetEnv(index_var_, "");
+ SetEnv(total_var_, "");
+
+ EXPECT_FALSE(ShouldShard(total_var_, index_var_, false));
+ EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));
+}
+
+// Tests that sharding is not enabled if total_shards == 1.
+TEST_F(ShouldShardTest, ReturnsFalseWhenTotalShardIsOne) {
+ SetEnv(index_var_, "0");
+ SetEnv(total_var_, "1");
+ EXPECT_FALSE(ShouldShard(total_var_, index_var_, false));
+ EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));
+}
+
+// Tests that sharding is enabled if total_shards > 1 and
+// we are not in a death test subprocess.
+// Environment variables are not supported on Windows CE.
+#if !GTEST_OS_WINDOWS_MOBILE
+TEST_F(ShouldShardTest, WorksWhenShardEnvVarsAreValid) {
+ SetEnv(index_var_, "4");
+ SetEnv(total_var_, "22");
+ EXPECT_TRUE(ShouldShard(total_var_, index_var_, false));
+ EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));
+
+ SetEnv(index_var_, "8");
+ SetEnv(total_var_, "9");
+ EXPECT_TRUE(ShouldShard(total_var_, index_var_, false));
+ EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));
+
+ SetEnv(index_var_, "0");
+ SetEnv(total_var_, "9");
+ EXPECT_TRUE(ShouldShard(total_var_, index_var_, false));
+ EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));
+}
+#endif // !GTEST_OS_WINDOWS_MOBILE
+
+// Tests that we exit in error if the sharding values are not valid.
+
+typedef ShouldShardTest ShouldShardDeathTest;
+
+TEST_F(ShouldShardDeathTest, AbortsWhenShardingEnvVarsAreInvalid) {
+ SetEnv(index_var_, "4");
+ SetEnv(total_var_, "4");
+ EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), ".*");
+
+ SetEnv(index_var_, "4");
+ SetEnv(total_var_, "-2");
+ EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), ".*");
+
+ SetEnv(index_var_, "5");
+ SetEnv(total_var_, "");
+ EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), ".*");
+
+ SetEnv(index_var_, "");
+ SetEnv(total_var_, "5");
+ EXPECT_DEATH_IF_SUPPORTED(ShouldShard(total_var_, index_var_, false), ".*");
+}
+
+// Tests that ShouldRunTestOnShard is a partition when 5
+// shards are used.
+TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereAreFiveShards) {
+ // Choose an arbitrary number of tests and shards.
+ const int num_tests = 17;
+ const int num_shards = 5;
+
+ // Check partitioning: each test should be on exactly 1 shard.
+ for (int test_id = 0; test_id < num_tests; test_id++) {
+ int prev_selected_shard_index = -1;
+ for (int shard_index = 0; shard_index < num_shards; shard_index++) {
+ if (ShouldRunTestOnShard(num_shards, shard_index, test_id)) {
+ if (prev_selected_shard_index < 0) {
+ prev_selected_shard_index = shard_index;
+ } else {
+ ADD_FAILURE() << "Shard " << prev_selected_shard_index << " and "
+ << shard_index << " are both selected to run test " << test_id;
+ }
+ }
+ }
+ }
+
+ // Check balance: This is not required by the sharding protocol, but is a
+ // desirable property for performance.
+ for (int shard_index = 0; shard_index < num_shards; shard_index++) {
+ int num_tests_on_shard = 0;
+ for (int test_id = 0; test_id < num_tests; test_id++) {
+ num_tests_on_shard +=
+ ShouldRunTestOnShard(num_shards, shard_index, test_id);
+ }
+ EXPECT_GE(num_tests_on_shard, num_tests / num_shards);
+ }
+}
+
+// For the same reason we are not explicitly testing everything in the
+// Test class, there are no separate tests for the following classes
+// (except for some trivial cases):
+//
+// TestCase, UnitTest, UnitTestResultPrinter.
+//
+// Similarly, there are no separate tests for the following macros:
+//
+// TEST, TEST_F, RUN_ALL_TESTS
+
+TEST(UnitTestTest, CanGetOriginalWorkingDir) {
+ ASSERT_TRUE(UnitTest::GetInstance()->original_working_dir() != NULL);
+ EXPECT_STRNE(UnitTest::GetInstance()->original_working_dir(), "");
+}
+
+// This group of tests is for predicate assertions (ASSERT_PRED*, etc)
+// of various arities. They do not attempt to be exhaustive. Rather,
+// view them as smoke tests that can be easily reviewed and verified.
+// A more complete set of tests for predicate assertions can be found
+// in gtest_pred_impl_unittest.cc.
+
+// First, some predicates and predicate-formatters needed by the tests.
+
+// Returns true iff the argument is an even number.
+bool IsEven(int n) {
+ return (n % 2) == 0;
+}
+
+// A functor that returns true iff the argument is an even number.
+struct IsEvenFunctor {
+ bool operator()(int n) { return IsEven(n); }
+};
+
+// A predicate-formatter function that asserts the argument is an even
+// number.
+AssertionResult AssertIsEven(const char* expr, int n) {
+ if (IsEven(n)) {
+ return AssertionSuccess();
+ }
+
+ Message msg;
+ msg << expr << " evaluates to " << n << ", which is not even.";
+ return AssertionFailure(msg);
+}
+
+// A predicate function that returns AssertionResult for use in
+// EXPECT/ASSERT_TRUE/FALSE.
+AssertionResult ResultIsEven(int n) {
+ if (IsEven(n))
+ return AssertionSuccess() << n << " is even";
+ else
+ return AssertionFailure() << n << " is odd";
+}
+
+// A predicate function that returns AssertionResult but gives no
+// explanation why it succeeds. Needed for testing that
+// EXPECT/ASSERT_FALSE handles such functions correctly.
+AssertionResult ResultIsEvenNoExplanation(int n) {
+ if (IsEven(n))
+ return AssertionSuccess();
+ else
+ return AssertionFailure() << n << " is odd";
+}
+
+// A predicate-formatter functor that asserts the argument is an even
+// number.
+struct AssertIsEvenFunctor {
+ AssertionResult operator()(const char* expr, int n) {
+ return AssertIsEven(expr, n);
+ }
+};
+
+// Returns true iff the sum of the arguments is an even number.
+bool SumIsEven2(int n1, int n2) {
+ return IsEven(n1 + n2);
+}
+
+// A functor that returns true iff the sum of the arguments is an even
+// number.
+struct SumIsEven3Functor {
+ bool operator()(int n1, int n2, int n3) {
+ return IsEven(n1 + n2 + n3);
+ }
+};
+
+// A predicate-formatter function that asserts the sum of the
+// arguments is an even number.
+AssertionResult AssertSumIsEven4(
+ const char* e1, const char* e2, const char* e3, const char* e4,
+ int n1, int n2, int n3, int n4) {
+ const int sum = n1 + n2 + n3 + n4;
+ if (IsEven(sum)) {
+ return AssertionSuccess();
+ }
+
+ Message msg;
+ msg << e1 << " + " << e2 << " + " << e3 << " + " << e4
+ << " (" << n1 << " + " << n2 << " + " << n3 << " + " << n4
+ << ") evaluates to " << sum << ", which is not even.";
+ return AssertionFailure(msg);
+}
+
+// A predicate-formatter functor that asserts the sum of the arguments
+// is an even number.
+struct AssertSumIsEven5Functor {
+ AssertionResult operator()(
+ const char* e1, const char* e2, const char* e3, const char* e4,
+ const char* e5, int n1, int n2, int n3, int n4, int n5) {
+ const int sum = n1 + n2 + n3 + n4 + n5;
+ if (IsEven(sum)) {
+ return AssertionSuccess();
+ }
+
+ Message msg;
+ msg << e1 << " + " << e2 << " + " << e3 << " + " << e4 << " + " << e5
+ << " ("
+ << n1 << " + " << n2 << " + " << n3 << " + " << n4 << " + " << n5
+ << ") evaluates to " << sum << ", which is not even.";
+ return AssertionFailure(msg);
+ }
+};
+
+
+// Tests unary predicate assertions.
+
+// Tests unary predicate assertions that don't use a custom formatter.
+TEST(Pred1Test, WithoutFormat) {
+ // Success cases.
+ EXPECT_PRED1(IsEvenFunctor(), 2) << "This failure is UNEXPECTED!";
+ ASSERT_PRED1(IsEven, 4);
+
+ // Failure cases.
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED1(IsEven, 5) << "This failure is expected.";
+ }, "This failure is expected.");
+ EXPECT_FATAL_FAILURE(ASSERT_PRED1(IsEvenFunctor(), 5),
+ "evaluates to false");
+}
+
+// Tests unary predicate assertions that use a custom formatter.
+TEST(Pred1Test, WithFormat) {
+ // Success cases.
+ EXPECT_PRED_FORMAT1(AssertIsEven, 2);
+ ASSERT_PRED_FORMAT1(AssertIsEvenFunctor(), 4)
+ << "This failure is UNEXPECTED!";
+
+ // Failure cases.
+ const int n = 5;
+ EXPECT_NONFATAL_FAILURE(EXPECT_PRED_FORMAT1(AssertIsEvenFunctor(), n),
+ "n evaluates to 5, which is not even.");
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT1(AssertIsEven, 5) << "This failure is expected.";
+ }, "This failure is expected.");
+}
+
+// Tests that unary predicate assertions evaluates their arguments
+// exactly once.
+TEST(Pred1Test, SingleEvaluationOnFailure) {
+ // A success case.
+ static int n = 0;
+ EXPECT_PRED1(IsEven, n++);
+ EXPECT_EQ(1, n) << "The argument is not evaluated exactly once.";
+
+ // A failure case.
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT1(AssertIsEvenFunctor(), n++)
+ << "This failure is expected.";
+ }, "This failure is expected.");
+ EXPECT_EQ(2, n) << "The argument is not evaluated exactly once.";
+}
+
+
+// Tests predicate assertions whose arity is >= 2.
+
+// Tests predicate assertions that don't use a custom formatter.
+TEST(PredTest, WithoutFormat) {
+ // Success cases.
+ ASSERT_PRED2(SumIsEven2, 2, 4) << "This failure is UNEXPECTED!";
+ EXPECT_PRED3(SumIsEven3Functor(), 4, 6, 8);
+
+ // Failure cases.
+ const int n1 = 1;
+ const int n2 = 2;
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED2(SumIsEven2, n1, n2) << "This failure is expected.";
+ }, "This failure is expected.");
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED3(SumIsEven3Functor(), 1, 2, 4);
+ }, "evaluates to false");
+}
+
+// Tests predicate assertions that use a custom formatter.
+TEST(PredTest, WithFormat) {
+ // Success cases.
+ ASSERT_PRED_FORMAT4(AssertSumIsEven4, 4, 6, 8, 10) <<
+ "This failure is UNEXPECTED!";
+ EXPECT_PRED_FORMAT5(AssertSumIsEven5Functor(), 2, 4, 6, 8, 10);
+
+ // Failure cases.
+ const int n1 = 1;
+ const int n2 = 2;
+ const int n3 = 4;
+ const int n4 = 6;
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT4(AssertSumIsEven4, n1, n2, n3, n4);
+ }, "evaluates to 13, which is not even.");
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT5(AssertSumIsEven5Functor(), 1, 2, 4, 6, 8)
+ << "This failure is expected.";
+ }, "This failure is expected.");
+}
+
+// Tests that predicate assertions evaluates their arguments
+// exactly once.
+TEST(PredTest, SingleEvaluationOnFailure) {
+ // A success case.
+ int n1 = 0;
+ int n2 = 0;
+ EXPECT_PRED2(SumIsEven2, n1++, n2++);
+ EXPECT_EQ(1, n1) << "Argument 1 is not evaluated exactly once.";
+ EXPECT_EQ(1, n2) << "Argument 2 is not evaluated exactly once.";
+
+ // Another success case.
+ n1 = n2 = 0;
+ int n3 = 0;
+ int n4 = 0;
+ int n5 = 0;
+ ASSERT_PRED_FORMAT5(AssertSumIsEven5Functor(),
+ n1++, n2++, n3++, n4++, n5++)
+ << "This failure is UNEXPECTED!";
+ EXPECT_EQ(1, n1) << "Argument 1 is not evaluated exactly once.";
+ EXPECT_EQ(1, n2) << "Argument 2 is not evaluated exactly once.";
+ EXPECT_EQ(1, n3) << "Argument 3 is not evaluated exactly once.";
+ EXPECT_EQ(1, n4) << "Argument 4 is not evaluated exactly once.";
+ EXPECT_EQ(1, n5) << "Argument 5 is not evaluated exactly once.";
+
+ // A failure case.
+ n1 = n2 = n3 = 0;
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED3(SumIsEven3Functor(), ++n1, n2++, n3++)
+ << "This failure is expected.";
+ }, "This failure is expected.");
+ EXPECT_EQ(1, n1) << "Argument 1 is not evaluated exactly once.";
+ EXPECT_EQ(1, n2) << "Argument 2 is not evaluated exactly once.";
+ EXPECT_EQ(1, n3) << "Argument 3 is not evaluated exactly once.";
+
+ // Another failure case.
+ n1 = n2 = n3 = n4 = 0;
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT4(AssertSumIsEven4, ++n1, n2++, n3++, n4++);
+ }, "evaluates to 1, which is not even.");
+ EXPECT_EQ(1, n1) << "Argument 1 is not evaluated exactly once.";
+ EXPECT_EQ(1, n2) << "Argument 2 is not evaluated exactly once.";
+ EXPECT_EQ(1, n3) << "Argument 3 is not evaluated exactly once.";
+ EXPECT_EQ(1, n4) << "Argument 4 is not evaluated exactly once.";
+}
+
+
+// Some helper functions for testing using overloaded/template
+// functions with ASSERT_PREDn and EXPECT_PREDn.
+
+bool IsPositive(double x) {
+ return x > 0;
+}
+
+template <typename T>
+bool IsNegative(T x) {
+ return x < 0;
+}
+
+template <typename T1, typename T2>
+bool GreaterThan(T1 x1, T2 x2) {
+ return x1 > x2;
+}
+
+// Tests that overloaded functions can be used in *_PRED* as long as
+// their types are explicitly specified.
+TEST(PredicateAssertionTest, AcceptsOverloadedFunction) {
+ // C++Builder requires C-style casts rather than static_cast.
+ EXPECT_PRED1((bool (*)(int))(IsPositive), 5); // NOLINT
+ ASSERT_PRED1((bool (*)(double))(IsPositive), 6.0); // NOLINT
+}
+
+// Tests that template functions can be used in *_PRED* as long as
+// their types are explicitly specified.
+TEST(PredicateAssertionTest, AcceptsTemplateFunction) {
+ EXPECT_PRED1(IsNegative<int>, -5);
+ // Makes sure that we can handle templates with more than one
+ // parameter.
+ ASSERT_PRED2((GreaterThan<int, int>), 5, 0);
+}
+
+
+// Some helper functions for testing using overloaded/template
+// functions with ASSERT_PRED_FORMATn and EXPECT_PRED_FORMATn.
+
+AssertionResult IsPositiveFormat(const char* /* expr */, int n) {
+ return n > 0 ? AssertionSuccess() :
+ AssertionFailure(Message() << "Failure");
+}
+
+AssertionResult IsPositiveFormat(const char* /* expr */, double x) {
+ return x > 0 ? AssertionSuccess() :
+ AssertionFailure(Message() << "Failure");
+}
+
+template <typename T>
+AssertionResult IsNegativeFormat(const char* /* expr */, T x) {
+ return x < 0 ? AssertionSuccess() :
+ AssertionFailure(Message() << "Failure");
+}
+
+template <typename T1, typename T2>
+AssertionResult EqualsFormat(const char* /* expr1 */, const char* /* expr2 */,
+ const T1& x1, const T2& x2) {
+ return x1 == x2 ? AssertionSuccess() :
+ AssertionFailure(Message() << "Failure");
+}
+
+// Tests that overloaded functions can be used in *_PRED_FORMAT*
+// without explicitly specifying their types.
+TEST(PredicateFormatAssertionTest, AcceptsOverloadedFunction) {
+ EXPECT_PRED_FORMAT1(IsPositiveFormat, 5);
+ ASSERT_PRED_FORMAT1(IsPositiveFormat, 6.0);
+}
+
+// Tests that template functions can be used in *_PRED_FORMAT* without
+// explicitly specifying their types.
+TEST(PredicateFormatAssertionTest, AcceptsTemplateFunction) {
+ EXPECT_PRED_FORMAT1(IsNegativeFormat, -5);
+ ASSERT_PRED_FORMAT2(EqualsFormat, 3, 3);
+}
+
+
+// Tests string assertions.
+
+// Tests ASSERT_STREQ with non-NULL arguments.
+TEST(StringAssertionTest, ASSERT_STREQ) {
+ const char * const p1 = "good";
+ ASSERT_STREQ(p1, p1);
+
+ // Let p2 have the same content as p1, but be at a different address.
+ const char p2[] = "good";
+ ASSERT_STREQ(p1, p2);
+
+ EXPECT_FATAL_FAILURE(ASSERT_STREQ("bad", "good"),
+ "Expected: \"bad\"");
+}
+
+// Tests ASSERT_STREQ with NULL arguments.
+TEST(StringAssertionTest, ASSERT_STREQ_Null) {
+ ASSERT_STREQ(static_cast<const char *>(NULL), NULL);
+ EXPECT_FATAL_FAILURE(ASSERT_STREQ(NULL, "non-null"),
+ "non-null");
+}
+
+// Tests ASSERT_STREQ with NULL arguments.
+TEST(StringAssertionTest, ASSERT_STREQ_Null2) {
+ EXPECT_FATAL_FAILURE(ASSERT_STREQ("non-null", NULL),
+ "non-null");
+}
+
+// Tests ASSERT_STRNE.
+TEST(StringAssertionTest, ASSERT_STRNE) {
+ ASSERT_STRNE("hi", "Hi");
+ ASSERT_STRNE("Hi", NULL);
+ ASSERT_STRNE(NULL, "Hi");
+ ASSERT_STRNE("", NULL);
+ ASSERT_STRNE(NULL, "");
+ ASSERT_STRNE("", "Hi");
+ ASSERT_STRNE("Hi", "");
+ EXPECT_FATAL_FAILURE(ASSERT_STRNE("Hi", "Hi"),
+ "\"Hi\" vs \"Hi\"");
+}
+
+// Tests ASSERT_STRCASEEQ.
+TEST(StringAssertionTest, ASSERT_STRCASEEQ) {
+ ASSERT_STRCASEEQ("hi", "Hi");
+ ASSERT_STRCASEEQ(static_cast<const char *>(NULL), NULL);
+
+ ASSERT_STRCASEEQ("", "");
+ EXPECT_FATAL_FAILURE(ASSERT_STRCASEEQ("Hi", "hi2"),
+ "(ignoring case)");
+}
+
+// Tests ASSERT_STRCASENE.
+TEST(StringAssertionTest, ASSERT_STRCASENE) {
+ ASSERT_STRCASENE("hi1", "Hi2");
+ ASSERT_STRCASENE("Hi", NULL);
+ ASSERT_STRCASENE(NULL, "Hi");
+ ASSERT_STRCASENE("", NULL);
+ ASSERT_STRCASENE(NULL, "");
+ ASSERT_STRCASENE("", "Hi");
+ ASSERT_STRCASENE("Hi", "");
+ EXPECT_FATAL_FAILURE(ASSERT_STRCASENE("Hi", "hi"),
+ "(ignoring case)");
+}
+
+// Tests *_STREQ on wide strings.
+TEST(StringAssertionTest, STREQ_Wide) {
+ // NULL strings.
+ ASSERT_STREQ(static_cast<const wchar_t *>(NULL), NULL);
+
+ // Empty strings.
+ ASSERT_STREQ(L"", L"");
+
+ // Non-null vs NULL.
+ EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(L"non-null", NULL),
+ "non-null");
+
+ // Equal strings.
+ EXPECT_STREQ(L"Hi", L"Hi");
+
+ // Unequal strings.
+ EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(L"abc", L"Abc"),
+ "Abc");
+
+ // Strings containing wide characters.
+ EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(L"abc\x8119", L"abc\x8120"),
+ "abc");
+}
+
+// Tests *_STRNE on wide strings.
+TEST(StringAssertionTest, STRNE_Wide) {
+ // NULL strings.
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_STRNE(static_cast<const wchar_t *>(NULL), NULL);
+ }, "");
+
+ // Empty strings.
+ EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(L"", L""),
+ "L\"\"");
+
+ // Non-null vs NULL.
+ ASSERT_STRNE(L"non-null", NULL);
+
+ // Equal strings.
+ EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(L"Hi", L"Hi"),
+ "L\"Hi\"");
+
+ // Unequal strings.
+ EXPECT_STRNE(L"abc", L"Abc");
+
+ // Strings containing wide characters.
+ EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(L"abc\x8119", L"abc\x8119"),
+ "abc");
+}
+
+// Tests for ::testing::IsSubstring().
+
+// Tests that IsSubstring() returns the correct result when the input
+// argument type is const char*.
+TEST(IsSubstringTest, ReturnsCorrectResultForCString) {
+ EXPECT_FALSE(IsSubstring("", "", NULL, "a"));
+ EXPECT_FALSE(IsSubstring("", "", "b", NULL));
+ EXPECT_FALSE(IsSubstring("", "", "needle", "haystack"));
+
+ EXPECT_TRUE(IsSubstring("", "", static_cast<const char*>(NULL), NULL));
+ EXPECT_TRUE(IsSubstring("", "", "needle", "two needles"));
+}
+
+// Tests that IsSubstring() returns the correct result when the input
+// argument type is const wchar_t*.
+TEST(IsSubstringTest, ReturnsCorrectResultForWideCString) {
+ EXPECT_FALSE(IsSubstring("", "", kNull, L"a"));
+ EXPECT_FALSE(IsSubstring("", "", L"b", kNull));
+ EXPECT_FALSE(IsSubstring("", "", L"needle", L"haystack"));
+
+ EXPECT_TRUE(IsSubstring("", "", static_cast<const wchar_t*>(NULL), NULL));
+ EXPECT_TRUE(IsSubstring("", "", L"needle", L"two needles"));
+}
+
+// Tests that IsSubstring() generates the correct message when the input
+// argument type is const char*.
+TEST(IsSubstringTest, GeneratesCorrectMessageForCString) {
+ EXPECT_STREQ("Value of: needle_expr\n"
+ " Actual: \"needle\"\n"
+ "Expected: a substring of haystack_expr\n"
+ "Which is: \"haystack\"",
+ IsSubstring("needle_expr", "haystack_expr",
+ "needle", "haystack").failure_message());
+}
+
+// Tests that IsSubstring returns the correct result when the input
+// argument type is ::std::string.
+TEST(IsSubstringTest, ReturnsCorrectResultsForStdString) {
+ EXPECT_TRUE(IsSubstring("", "", std::string("hello"), "ahellob"));
+ EXPECT_FALSE(IsSubstring("", "", "hello", std::string("world")));
+}
+
+#if GTEST_HAS_STD_WSTRING
+// Tests that IsSubstring returns the correct result when the input
+// argument type is ::std::wstring.
+TEST(IsSubstringTest, ReturnsCorrectResultForStdWstring) {
+ EXPECT_TRUE(IsSubstring("", "", ::std::wstring(L"needle"), L"two needles"));
+ EXPECT_FALSE(IsSubstring("", "", L"needle", ::std::wstring(L"haystack")));
+}
+
+// Tests that IsSubstring() generates the correct message when the input
+// argument type is ::std::wstring.
+TEST(IsSubstringTest, GeneratesCorrectMessageForWstring) {
+ EXPECT_STREQ("Value of: needle_expr\n"
+ " Actual: L\"needle\"\n"
+ "Expected: a substring of haystack_expr\n"
+ "Which is: L\"haystack\"",
+ IsSubstring(
+ "needle_expr", "haystack_expr",
+ ::std::wstring(L"needle"), L"haystack").failure_message());
+}
+
+#endif // GTEST_HAS_STD_WSTRING
+
+// Tests for ::testing::IsNotSubstring().
+
+// Tests that IsNotSubstring() returns the correct result when the input
+// argument type is const char*.
+TEST(IsNotSubstringTest, ReturnsCorrectResultForCString) {
+ EXPECT_TRUE(IsNotSubstring("", "", "needle", "haystack"));
+ EXPECT_FALSE(IsNotSubstring("", "", "needle", "two needles"));
+}
+
+// Tests that IsNotSubstring() returns the correct result when the input
+// argument type is const wchar_t*.
+TEST(IsNotSubstringTest, ReturnsCorrectResultForWideCString) {
+ EXPECT_TRUE(IsNotSubstring("", "", L"needle", L"haystack"));
+ EXPECT_FALSE(IsNotSubstring("", "", L"needle", L"two needles"));
+}
+
+// Tests that IsNotSubstring() generates the correct message when the input
+// argument type is const wchar_t*.
+TEST(IsNotSubstringTest, GeneratesCorrectMessageForWideCString) {
+ EXPECT_STREQ("Value of: needle_expr\n"
+ " Actual: L\"needle\"\n"
+ "Expected: not a substring of haystack_expr\n"
+ "Which is: L\"two needles\"",
+ IsNotSubstring(
+ "needle_expr", "haystack_expr",
+ L"needle", L"two needles").failure_message());
+}
+
+// Tests that IsNotSubstring returns the correct result when the input
+// argument type is ::std::string.
+TEST(IsNotSubstringTest, ReturnsCorrectResultsForStdString) {
+ EXPECT_FALSE(IsNotSubstring("", "", std::string("hello"), "ahellob"));
+ EXPECT_TRUE(IsNotSubstring("", "", "hello", std::string("world")));
+}
+
+// Tests that IsNotSubstring() generates the correct message when the input
+// argument type is ::std::string.
+TEST(IsNotSubstringTest, GeneratesCorrectMessageForStdString) {
+ EXPECT_STREQ("Value of: needle_expr\n"
+ " Actual: \"needle\"\n"
+ "Expected: not a substring of haystack_expr\n"
+ "Which is: \"two needles\"",
+ IsNotSubstring(
+ "needle_expr", "haystack_expr",
+ ::std::string("needle"), "two needles").failure_message());
+}
+
+#if GTEST_HAS_STD_WSTRING
+
+// Tests that IsNotSubstring returns the correct result when the input
+// argument type is ::std::wstring.
+TEST(IsNotSubstringTest, ReturnsCorrectResultForStdWstring) {
+ EXPECT_FALSE(
+ IsNotSubstring("", "", ::std::wstring(L"needle"), L"two needles"));
+ EXPECT_TRUE(IsNotSubstring("", "", L"needle", ::std::wstring(L"haystack")));
+}
+
+#endif // GTEST_HAS_STD_WSTRING
+
+// Tests floating-point assertions.
+
+template <typename RawType>
+class FloatingPointTest : public Test {
+ protected:
+
+ // Pre-calculated numbers to be used by the tests.
+ struct TestValues {
+ RawType close_to_positive_zero;
+ RawType close_to_negative_zero;
+ RawType further_from_negative_zero;
+
+ RawType close_to_one;
+ RawType further_from_one;
+
+ RawType infinity;
+ RawType close_to_infinity;
+ RawType further_from_infinity;
+
+ RawType nan1;
+ RawType nan2;
+ };
+
+ typedef typename testing::internal::FloatingPoint<RawType> Floating;
+ typedef typename Floating::Bits Bits;
+
+ virtual void SetUp() {
+ const size_t max_ulps = Floating::kMaxUlps;
+
+ // The bits that represent 0.0.
+ const Bits zero_bits = Floating(0).bits();
+
+ // Makes some numbers close to 0.0.
+ values_.close_to_positive_zero = Floating::ReinterpretBits(
+ zero_bits + max_ulps/2);
+ values_.close_to_negative_zero = -Floating::ReinterpretBits(
+ zero_bits + max_ulps - max_ulps/2);
+ values_.further_from_negative_zero = -Floating::ReinterpretBits(
+ zero_bits + max_ulps + 1 - max_ulps/2);
+
+ // The bits that represent 1.0.
+ const Bits one_bits = Floating(1).bits();
+
+ // Makes some numbers close to 1.0.
+ values_.close_to_one = Floating::ReinterpretBits(one_bits + max_ulps);
+ values_.further_from_one = Floating::ReinterpretBits(
+ one_bits + max_ulps + 1);
+
+ // +infinity.
+ values_.infinity = Floating::Infinity();
+
+ // The bits that represent +infinity.
+ const Bits infinity_bits = Floating(values_.infinity).bits();
+
+ // Makes some numbers close to infinity.
+ values_.close_to_infinity = Floating::ReinterpretBits(
+ infinity_bits - max_ulps);
+ values_.further_from_infinity = Floating::ReinterpretBits(
+ infinity_bits - max_ulps - 1);
+
+ // Makes some NAN's. Sets the most significant bit of the fraction so that
+ // our NaN's are quiet; trying to process a signaling NaN would raise an
+ // exception if our environment enables floating point exceptions.
+ values_.nan1 = Floating::ReinterpretBits(Floating::kExponentBitMask
+ | (static_cast<Bits>(1) << (Floating::kFractionBitCount - 1)) | 1);
+ values_.nan2 = Floating::ReinterpretBits(Floating::kExponentBitMask
+ | (static_cast<Bits>(1) << (Floating::kFractionBitCount - 1)) | 200);
+ }
+
+ void TestSize() {
+ EXPECT_EQ(sizeof(RawType), sizeof(Bits));
+ }
+
+ static TestValues values_;
+};
+
+template <typename RawType>
+typename FloatingPointTest<RawType>::TestValues
+ FloatingPointTest<RawType>::values_;
+
+// Instantiates FloatingPointTest for testing *_FLOAT_EQ.
+typedef FloatingPointTest<float> FloatTest;
+
+// Tests that the size of Float::Bits matches the size of float.
+TEST_F(FloatTest, Size) {
+ TestSize();
+}
+
+// Tests comparing with +0 and -0.
+TEST_F(FloatTest, Zeros) {
+ EXPECT_FLOAT_EQ(0.0, -0.0);
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(-0.0, 1.0),
+ "1.0");
+ EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(0.0, 1.5),
+ "1.5");
+}
+
+// Tests comparing numbers close to 0.
+//
+// This ensures that *_FLOAT_EQ handles the sign correctly and no
+// overflow occurs when comparing numbers whose absolute value is very
+// small.
+TEST_F(FloatTest, AlmostZeros) {
+ // In C++Builder, names within local classes (such as used by
+ // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the
+ // scoping class. Use a static local alias as a workaround.
+ // We use the assignment syntax since some compilers, like Sun Studio,
+ // don't allow initializing references using construction syntax
+ // (parentheses).
+ static const FloatTest::TestValues& v = this->values_;
+
+ EXPECT_FLOAT_EQ(0.0, v.close_to_positive_zero);
+ EXPECT_FLOAT_EQ(-0.0, v.close_to_negative_zero);
+ EXPECT_FLOAT_EQ(v.close_to_positive_zero, v.close_to_negative_zero);
+
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_FLOAT_EQ(v.close_to_positive_zero,
+ v.further_from_negative_zero);
+ }, "v.further_from_negative_zero");
+}
+
+// Tests comparing numbers close to each other.
+TEST_F(FloatTest, SmallDiff) {
+ EXPECT_FLOAT_EQ(1.0, values_.close_to_one);
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(1.0, values_.further_from_one),
+ "values_.further_from_one");
+}
+
+// Tests comparing numbers far apart.
+TEST_F(FloatTest, LargeDiff) {
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(2.5, 3.0),
+ "3.0");
+}
+
+// Tests comparing with infinity.
+//
+// This ensures that no overflow occurs when comparing numbers whose
+// absolute value is very large.
+TEST_F(FloatTest, Infinity) {
+ EXPECT_FLOAT_EQ(values_.infinity, values_.close_to_infinity);
+ EXPECT_FLOAT_EQ(-values_.infinity, -values_.close_to_infinity);
+#if !GTEST_OS_SYMBIAN
+ // Nokia's STLport crashes if we try to output infinity or NaN.
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(values_.infinity, -values_.infinity),
+ "-values_.infinity");
+
+ // This is interesting as the representations of infinity and nan1
+ // are only 1 DLP apart.
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(values_.infinity, values_.nan1),
+ "values_.nan1");
+#endif // !GTEST_OS_SYMBIAN
+}
+
+// Tests that comparing with NAN always returns false.
+TEST_F(FloatTest, NaN) {
+#if !GTEST_OS_SYMBIAN
+// Nokia's STLport crashes if we try to output infinity or NaN.
+
+ // In C++Builder, names within local classes (such as used by
+ // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the
+ // scoping class. Use a static local alias as a workaround.
+ // We use the assignment syntax since some compilers, like Sun Studio,
+ // don't allow initializing references using construction syntax
+ // (parentheses).
+ static const FloatTest::TestValues& v = this->values_;
+
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(v.nan1, v.nan1),
+ "v.nan1");
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(v.nan1, v.nan2),
+ "v.nan2");
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(1.0, v.nan1),
+ "v.nan1");
+
+ EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(v.nan1, v.infinity),
+ "v.infinity");
+#endif // !GTEST_OS_SYMBIAN
+}
+
+// Tests that *_FLOAT_EQ are reflexive.
+TEST_F(FloatTest, Reflexive) {
+ EXPECT_FLOAT_EQ(0.0, 0.0);
+ EXPECT_FLOAT_EQ(1.0, 1.0);
+ ASSERT_FLOAT_EQ(values_.infinity, values_.infinity);
+}
+
+// Tests that *_FLOAT_EQ are commutative.
+TEST_F(FloatTest, Commutative) {
+ // We already tested EXPECT_FLOAT_EQ(1.0, values_.close_to_one).
+ EXPECT_FLOAT_EQ(values_.close_to_one, 1.0);
+
+ // We already tested EXPECT_FLOAT_EQ(1.0, values_.further_from_one).
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(values_.further_from_one, 1.0),
+ "1.0");
+}
+
+// Tests EXPECT_NEAR.
+TEST_F(FloatTest, EXPECT_NEAR) {
+ EXPECT_NEAR(-1.0f, -1.1f, 0.2f);
+ EXPECT_NEAR(2.0f, 3.0f, 1.0f);
+ EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0f,1.5f, 0.25f), // NOLINT
+ "The difference between 1.0f and 1.5f is 0.5, "
+ "which exceeds 0.25f");
+ // To work around a bug in gcc 2.95.0, there is intentionally no
+ // space after the first comma in the previous line.
+}
+
+// Tests ASSERT_NEAR.
+TEST_F(FloatTest, ASSERT_NEAR) {
+ ASSERT_NEAR(-1.0f, -1.1f, 0.2f);
+ ASSERT_NEAR(2.0f, 3.0f, 1.0f);
+ EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0f,1.5f, 0.25f), // NOLINT
+ "The difference between 1.0f and 1.5f is 0.5, "
+ "which exceeds 0.25f");
+ // To work around a bug in gcc 2.95.0, there is intentionally no
+ // space after the first comma in the previous line.
+}
+
+// Tests the cases where FloatLE() should succeed.
+TEST_F(FloatTest, FloatLESucceeds) {
+ EXPECT_PRED_FORMAT2(FloatLE, 1.0f, 2.0f); // When val1 < val2,
+ ASSERT_PRED_FORMAT2(FloatLE, 1.0f, 1.0f); // val1 == val2,
+
+ // or when val1 is greater than, but almost equals to, val2.
+ EXPECT_PRED_FORMAT2(FloatLE, values_.close_to_positive_zero, 0.0f);
+}
+
+// Tests the cases where FloatLE() should fail.
+TEST_F(FloatTest, FloatLEFails) {
+ // When val1 is greater than val2 by a large margin,
+ EXPECT_NONFATAL_FAILURE(EXPECT_PRED_FORMAT2(FloatLE, 2.0f, 1.0f),
+ "(2.0f) <= (1.0f)");
+
+ // or by a small yet non-negligible margin,
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(FloatLE, values_.further_from_one, 1.0f);
+ }, "(values_.further_from_one) <= (1.0f)");
+
+#if !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)
+ // Nokia's STLport crashes if we try to output infinity or NaN.
+ // C++Builder gives bad results for ordered comparisons involving NaNs
+ // due to compiler bugs.
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(FloatLE, values_.nan1, values_.infinity);
+ }, "(values_.nan1) <= (values_.infinity)");
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(FloatLE, -values_.infinity, values_.nan1);
+ }, "(-values_.infinity) <= (values_.nan1)");
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT2(FloatLE, values_.nan1, values_.nan1);
+ }, "(values_.nan1) <= (values_.nan1)");
+#endif // !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)
+}
+
+// Instantiates FloatingPointTest for testing *_DOUBLE_EQ.
+typedef FloatingPointTest<double> DoubleTest;
+
+// Tests that the size of Double::Bits matches the size of double.
+TEST_F(DoubleTest, Size) {
+ TestSize();
+}
+
+// Tests comparing with +0 and -0.
+TEST_F(DoubleTest, Zeros) {
+ EXPECT_DOUBLE_EQ(0.0, -0.0);
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(-0.0, 1.0),
+ "1.0");
+ EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(0.0, 1.0),
+ "1.0");
+}
+
+// Tests comparing numbers close to 0.
+//
+// This ensures that *_DOUBLE_EQ handles the sign correctly and no
+// overflow occurs when comparing numbers whose absolute value is very
+// small.
+TEST_F(DoubleTest, AlmostZeros) {
+ // In C++Builder, names within local classes (such as used by
+ // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the
+ // scoping class. Use a static local alias as a workaround.
+ // We use the assignment syntax since some compilers, like Sun Studio,
+ // don't allow initializing references using construction syntax
+ // (parentheses).
+ static const DoubleTest::TestValues& v = this->values_;
+
+ EXPECT_DOUBLE_EQ(0.0, v.close_to_positive_zero);
+ EXPECT_DOUBLE_EQ(-0.0, v.close_to_negative_zero);
+ EXPECT_DOUBLE_EQ(v.close_to_positive_zero, v.close_to_negative_zero);
+
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_DOUBLE_EQ(v.close_to_positive_zero,
+ v.further_from_negative_zero);
+ }, "v.further_from_negative_zero");
+}
+
+// Tests comparing numbers close to each other.
+TEST_F(DoubleTest, SmallDiff) {
+ EXPECT_DOUBLE_EQ(1.0, values_.close_to_one);
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, values_.further_from_one),
+ "values_.further_from_one");
+}
+
+// Tests comparing numbers far apart.
+TEST_F(DoubleTest, LargeDiff) {
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(2.0, 3.0),
+ "3.0");
+}
+
+// Tests comparing with infinity.
+//
+// This ensures that no overflow occurs when comparing numbers whose
+// absolute value is very large.
+TEST_F(DoubleTest, Infinity) {
+ EXPECT_DOUBLE_EQ(values_.infinity, values_.close_to_infinity);
+ EXPECT_DOUBLE_EQ(-values_.infinity, -values_.close_to_infinity);
+#if !GTEST_OS_SYMBIAN
+ // Nokia's STLport crashes if we try to output infinity or NaN.
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.infinity, -values_.infinity),
+ "-values_.infinity");
+
+ // This is interesting as the representations of infinity_ and nan1_
+ // are only 1 DLP apart.
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.infinity, values_.nan1),
+ "values_.nan1");
+#endif // !GTEST_OS_SYMBIAN
+}
+
+// Tests that comparing with NAN always returns false.
+TEST_F(DoubleTest, NaN) {
+#if !GTEST_OS_SYMBIAN
+ // In C++Builder, names within local classes (such as used by
+ // EXPECT_FATAL_FAILURE) cannot be resolved against static members of the
+ // scoping class. Use a static local alias as a workaround.
+ // We use the assignment syntax since some compilers, like Sun Studio,
+ // don't allow initializing references using construction syntax
+ // (parentheses).
+ static const DoubleTest::TestValues& v = this->values_;
+
+ // Nokia's STLport crashes if we try to output infinity or NaN.
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(v.nan1, v.nan1),
+ "v.nan1");
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(v.nan1, v.nan2), "v.nan2");
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, v.nan1), "v.nan1");
+ EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(v.nan1, v.infinity),
+ "v.infinity");
+#endif // !GTEST_OS_SYMBIAN
+}
+
+// Tests that *_DOUBLE_EQ are reflexive.
+TEST_F(DoubleTest, Reflexive) {
+ EXPECT_DOUBLE_EQ(0.0, 0.0);
+ EXPECT_DOUBLE_EQ(1.0, 1.0);
+#if !GTEST_OS_SYMBIAN
+ // Nokia's STLport crashes if we try to output infinity or NaN.
+ ASSERT_DOUBLE_EQ(values_.infinity, values_.infinity);
+#endif // !GTEST_OS_SYMBIAN
+}
+
+// Tests that *_DOUBLE_EQ are commutative.
+TEST_F(DoubleTest, Commutative) {
+ // We already tested EXPECT_DOUBLE_EQ(1.0, values_.close_to_one).
+ EXPECT_DOUBLE_EQ(values_.close_to_one, 1.0);
+
+ // We already tested EXPECT_DOUBLE_EQ(1.0, values_.further_from_one).
+ EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(values_.further_from_one, 1.0),
+ "1.0");
+}
+
+// Tests EXPECT_NEAR.
+TEST_F(DoubleTest, EXPECT_NEAR) {
+ EXPECT_NEAR(-1.0, -1.1, 0.2);
+ EXPECT_NEAR(2.0, 3.0, 1.0);
+ EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0, 1.5, 0.25), // NOLINT
+ "The difference between 1.0 and 1.5 is 0.5, "
+ "which exceeds 0.25");
+ // To work around a bug in gcc 2.95.0, there is intentionally no
+ // space after the first comma in the previous statement.
+}
+
+// Tests ASSERT_NEAR.
+TEST_F(DoubleTest, ASSERT_NEAR) {
+ ASSERT_NEAR(-1.0, -1.1, 0.2);
+ ASSERT_NEAR(2.0, 3.0, 1.0);
+ EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0, 1.5, 0.25), // NOLINT
+ "The difference between 1.0 and 1.5 is 0.5, "
+ "which exceeds 0.25");
+ // To work around a bug in gcc 2.95.0, there is intentionally no
+ // space after the first comma in the previous statement.
+}
+
+// Tests the cases where DoubleLE() should succeed.
+TEST_F(DoubleTest, DoubleLESucceeds) {
+ EXPECT_PRED_FORMAT2(DoubleLE, 1.0, 2.0); // When val1 < val2,
+ ASSERT_PRED_FORMAT2(DoubleLE, 1.0, 1.0); // val1 == val2,
+
+ // or when val1 is greater than, but almost equals to, val2.
+ EXPECT_PRED_FORMAT2(DoubleLE, values_.close_to_positive_zero, 0.0);
+}
+
+// Tests the cases where DoubleLE() should fail.
+TEST_F(DoubleTest, DoubleLEFails) {
+ // When val1 is greater than val2 by a large margin,
+ EXPECT_NONFATAL_FAILURE(EXPECT_PRED_FORMAT2(DoubleLE, 2.0, 1.0),
+ "(2.0) <= (1.0)");
+
+ // or by a small yet non-negligible margin,
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(DoubleLE, values_.further_from_one, 1.0);
+ }, "(values_.further_from_one) <= (1.0)");
+
+#if !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)
+ // Nokia's STLport crashes if we try to output infinity or NaN.
+ // C++Builder gives bad results for ordered comparisons involving NaNs
+ // due to compiler bugs.
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(DoubleLE, values_.nan1, values_.infinity);
+ }, "(values_.nan1) <= (values_.infinity)");
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_PRED_FORMAT2(DoubleLE, -values_.infinity, values_.nan1);
+ }, " (-values_.infinity) <= (values_.nan1)");
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_PRED_FORMAT2(DoubleLE, values_.nan1, values_.nan1);
+ }, "(values_.nan1) <= (values_.nan1)");
+#endif // !GTEST_OS_SYMBIAN && !defined(__BORLANDC__)
+}
+
+
+// Verifies that a test or test case whose name starts with DISABLED_ is
+// not run.
+
+// A test whose name starts with DISABLED_.
+// Should not run.
+TEST(DisabledTest, DISABLED_TestShouldNotRun) {
+ FAIL() << "Unexpected failure: Disabled test should not be run.";
+}
+
+// A test whose name does not start with DISABLED_.
+// Should run.
+TEST(DisabledTest, NotDISABLED_TestShouldRun) {
+ EXPECT_EQ(1, 1);
+}
+
+// A test case whose name starts with DISABLED_.
+// Should not run.
+TEST(DISABLED_TestCase, TestShouldNotRun) {
+ FAIL() << "Unexpected failure: Test in disabled test case should not be run.";
+}
+
+// A test case and test whose names start with DISABLED_.
+// Should not run.
+TEST(DISABLED_TestCase, DISABLED_TestShouldNotRun) {
+ FAIL() << "Unexpected failure: Test in disabled test case should not be run.";
+}
+
+// Check that when all tests in a test case are disabled, SetupTestCase() and
+// TearDownTestCase() are not called.
+class DisabledTestsTest : public Test {
+ protected:
+ static void SetUpTestCase() {
+ FAIL() << "Unexpected failure: All tests disabled in test case. "
+ "SetupTestCase() should not be called.";
+ }
+
+ static void TearDownTestCase() {
+ FAIL() << "Unexpected failure: All tests disabled in test case. "
+ "TearDownTestCase() should not be called.";
+ }
+};
+
+TEST_F(DisabledTestsTest, DISABLED_TestShouldNotRun_1) {
+ FAIL() << "Unexpected failure: Disabled test should not be run.";
+}
+
+TEST_F(DisabledTestsTest, DISABLED_TestShouldNotRun_2) {
+ FAIL() << "Unexpected failure: Disabled test should not be run.";
+}
+
+// Tests that disabled typed tests aren't run.
+
+#if GTEST_HAS_TYPED_TEST
+
+template <typename T>
+class TypedTest : public Test {
+};
+
+typedef testing::Types<int, double> NumericTypes;
+TYPED_TEST_CASE(TypedTest, NumericTypes);
+
+TYPED_TEST(TypedTest, DISABLED_ShouldNotRun) {
+ FAIL() << "Unexpected failure: Disabled typed test should not run.";
+}
+
+template <typename T>
+class DISABLED_TypedTest : public Test {
+};
+
+TYPED_TEST_CASE(DISABLED_TypedTest, NumericTypes);
+
+TYPED_TEST(DISABLED_TypedTest, ShouldNotRun) {
+ FAIL() << "Unexpected failure: Disabled typed test should not run.";
+}
+
+#endif // GTEST_HAS_TYPED_TEST
+
+// Tests that disabled type-parameterized tests aren't run.
+
+#if GTEST_HAS_TYPED_TEST_P
+
+template <typename T>
+class TypedTestP : public Test {
+};
+
+TYPED_TEST_CASE_P(TypedTestP);
+
+TYPED_TEST_P(TypedTestP, DISABLED_ShouldNotRun) {
+ FAIL() << "Unexpected failure: "
+ << "Disabled type-parameterized test should not run.";
+}
+
+REGISTER_TYPED_TEST_CASE_P(TypedTestP, DISABLED_ShouldNotRun);
+
+INSTANTIATE_TYPED_TEST_CASE_P(My, TypedTestP, NumericTypes);
+
+template <typename T>
+class DISABLED_TypedTestP : public Test {
+};
+
+TYPED_TEST_CASE_P(DISABLED_TypedTestP);
+
+TYPED_TEST_P(DISABLED_TypedTestP, ShouldNotRun) {
+ FAIL() << "Unexpected failure: "
+ << "Disabled type-parameterized test should not run.";
+}
+
+REGISTER_TYPED_TEST_CASE_P(DISABLED_TypedTestP, ShouldNotRun);
+
+INSTANTIATE_TYPED_TEST_CASE_P(My, DISABLED_TypedTestP, NumericTypes);
+
+#endif // GTEST_HAS_TYPED_TEST_P
+
+// Tests that assertion macros evaluate their arguments exactly once.
+
+class SingleEvaluationTest : public Test {
+ public: // Must be public and not protected due to a bug in g++ 3.4.2.
+ // This helper function is needed by the FailedASSERT_STREQ test
+ // below. It's public to work around C++Builder's bug with scoping local
+ // classes.
+ static void CompareAndIncrementCharPtrs() {
+ ASSERT_STREQ(p1_++, p2_++);
+ }
+
+ // This helper function is needed by the FailedASSERT_NE test below. It's
+ // public to work around C++Builder's bug with scoping local classes.
+ static void CompareAndIncrementInts() {
+ ASSERT_NE(a_++, b_++);
+ }
+
+ protected:
+ SingleEvaluationTest() {
+ p1_ = s1_;
+ p2_ = s2_;
+ a_ = 0;
+ b_ = 0;
+ }
+
+ static const char* const s1_;
+ static const char* const s2_;
+ static const char* p1_;
+ static const char* p2_;
+
+ static int a_;
+ static int b_;
+};
+
+const char* const SingleEvaluationTest::s1_ = "01234";
+const char* const SingleEvaluationTest::s2_ = "abcde";
+const char* SingleEvaluationTest::p1_;
+const char* SingleEvaluationTest::p2_;
+int SingleEvaluationTest::a_;
+int SingleEvaluationTest::b_;
+
+// Tests that when ASSERT_STREQ fails, it evaluates its arguments
+// exactly once.
+TEST_F(SingleEvaluationTest, FailedASSERT_STREQ) {
+ EXPECT_FATAL_FAILURE(SingleEvaluationTest::CompareAndIncrementCharPtrs(),
+ "p2_++");
+ EXPECT_EQ(s1_ + 1, p1_);
+ EXPECT_EQ(s2_ + 1, p2_);
+}
+
+// Tests that string assertion arguments are evaluated exactly once.
+TEST_F(SingleEvaluationTest, ASSERT_STR) {
+ // successful EXPECT_STRNE
+ EXPECT_STRNE(p1_++, p2_++);
+ EXPECT_EQ(s1_ + 1, p1_);
+ EXPECT_EQ(s2_ + 1, p2_);
+
+ // failed EXPECT_STRCASEEQ
+ EXPECT_NONFATAL_FAILURE(EXPECT_STRCASEEQ(p1_++, p2_++),
+ "ignoring case");
+ EXPECT_EQ(s1_ + 2, p1_);
+ EXPECT_EQ(s2_ + 2, p2_);
+}
+
+// Tests that when ASSERT_NE fails, it evaluates its arguments exactly
+// once.
+TEST_F(SingleEvaluationTest, FailedASSERT_NE) {
+ EXPECT_FATAL_FAILURE(SingleEvaluationTest::CompareAndIncrementInts(),
+ "(a_++) != (b_++)");
+ EXPECT_EQ(1, a_);
+ EXPECT_EQ(1, b_);
+}
+
+// Tests that assertion arguments are evaluated exactly once.
+TEST_F(SingleEvaluationTest, OtherCases) {
+ // successful EXPECT_TRUE
+ EXPECT_TRUE(0 == a_++); // NOLINT
+ EXPECT_EQ(1, a_);
+
+ // failed EXPECT_TRUE
+ EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(-1 == a_++), "-1 == a_++");
+ EXPECT_EQ(2, a_);
+
+ // successful EXPECT_GT
+ EXPECT_GT(a_++, b_++);
+ EXPECT_EQ(3, a_);
+ EXPECT_EQ(1, b_);
+
+ // failed EXPECT_LT
+ EXPECT_NONFATAL_FAILURE(EXPECT_LT(a_++, b_++), "(a_++) < (b_++)");
+ EXPECT_EQ(4, a_);
+ EXPECT_EQ(2, b_);
+
+ // successful ASSERT_TRUE
+ ASSERT_TRUE(0 < a_++); // NOLINT
+ EXPECT_EQ(5, a_);
+
+ // successful ASSERT_GT
+ ASSERT_GT(a_++, b_++);
+ EXPECT_EQ(6, a_);
+ EXPECT_EQ(3, b_);
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+void ThrowAnInteger() {
+ throw 1;
+}
+
+// Tests that assertion arguments are evaluated exactly once.
+TEST_F(SingleEvaluationTest, ExceptionTests) {
+ // successful EXPECT_THROW
+ EXPECT_THROW({ // NOLINT
+ a_++;
+ ThrowAnInteger();
+ }, int);
+ EXPECT_EQ(1, a_);
+
+ // failed EXPECT_THROW, throws different
+ EXPECT_NONFATAL_FAILURE(EXPECT_THROW({ // NOLINT
+ a_++;
+ ThrowAnInteger();
+ }, bool), "throws a different type");
+ EXPECT_EQ(2, a_);
+
+ // failed EXPECT_THROW, throws nothing
+ EXPECT_NONFATAL_FAILURE(EXPECT_THROW(a_++, bool), "throws nothing");
+ EXPECT_EQ(3, a_);
+
+ // successful EXPECT_NO_THROW
+ EXPECT_NO_THROW(a_++);
+ EXPECT_EQ(4, a_);
+
+ // failed EXPECT_NO_THROW
+ EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW({ // NOLINT
+ a_++;
+ ThrowAnInteger();
+ }), "it throws");
+ EXPECT_EQ(5, a_);
+
+ // successful EXPECT_ANY_THROW
+ EXPECT_ANY_THROW({ // NOLINT
+ a_++;
+ ThrowAnInteger();
+ });
+ EXPECT_EQ(6, a_);
+
+ // failed EXPECT_ANY_THROW
+ EXPECT_NONFATAL_FAILURE(EXPECT_ANY_THROW(a_++), "it doesn't");
+ EXPECT_EQ(7, a_);
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+// Tests {ASSERT|EXPECT}_NO_FATAL_FAILURE.
+class NoFatalFailureTest : public Test {
+ protected:
+ void Succeeds() {}
+ void FailsNonFatal() {
+ ADD_FAILURE() << "some non-fatal failure";
+ }
+ void Fails() {
+ FAIL() << "some fatal failure";
+ }
+
+ void DoAssertNoFatalFailureOnFails() {
+ ASSERT_NO_FATAL_FAILURE(Fails());
+ ADD_FAILURE() << "shold not reach here.";
+ }
+
+ void DoExpectNoFatalFailureOnFails() {
+ EXPECT_NO_FATAL_FAILURE(Fails());
+ ADD_FAILURE() << "other failure";
+ }
+};
+
+TEST_F(NoFatalFailureTest, NoFailure) {
+ EXPECT_NO_FATAL_FAILURE(Succeeds());
+ ASSERT_NO_FATAL_FAILURE(Succeeds());
+}
+
+TEST_F(NoFatalFailureTest, NonFatalIsNoFailure) {
+ EXPECT_NONFATAL_FAILURE(
+ EXPECT_NO_FATAL_FAILURE(FailsNonFatal()),
+ "some non-fatal failure");
+ EXPECT_NONFATAL_FAILURE(
+ ASSERT_NO_FATAL_FAILURE(FailsNonFatal()),
+ "some non-fatal failure");
+}
+
+TEST_F(NoFatalFailureTest, AssertNoFatalFailureOnFatalFailure) {
+ TestPartResultArray gtest_failures;
+ {
+ ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);
+ DoAssertNoFatalFailureOnFails();
+ }
+ ASSERT_EQ(2, gtest_failures.size());
+ EXPECT_EQ(TestPartResult::kFatalFailure,
+ gtest_failures.GetTestPartResult(0).type());
+ EXPECT_EQ(TestPartResult::kFatalFailure,
+ gtest_failures.GetTestPartResult(1).type());
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "some fatal failure",
+ gtest_failures.GetTestPartResult(0).message());
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "it does",
+ gtest_failures.GetTestPartResult(1).message());
+}
+
+TEST_F(NoFatalFailureTest, ExpectNoFatalFailureOnFatalFailure) {
+ TestPartResultArray gtest_failures;
+ {
+ ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);
+ DoExpectNoFatalFailureOnFails();
+ }
+ ASSERT_EQ(3, gtest_failures.size());
+ EXPECT_EQ(TestPartResult::kFatalFailure,
+ gtest_failures.GetTestPartResult(0).type());
+ EXPECT_EQ(TestPartResult::kNonFatalFailure,
+ gtest_failures.GetTestPartResult(1).type());
+ EXPECT_EQ(TestPartResult::kNonFatalFailure,
+ gtest_failures.GetTestPartResult(2).type());
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "some fatal failure",
+ gtest_failures.GetTestPartResult(0).message());
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "it does",
+ gtest_failures.GetTestPartResult(1).message());
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "other failure",
+ gtest_failures.GetTestPartResult(2).message());
+}
+
+TEST_F(NoFatalFailureTest, MessageIsStreamable) {
+ TestPartResultArray gtest_failures;
+ {
+ ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);
+ EXPECT_NO_FATAL_FAILURE(FAIL() << "foo") << "my message";
+ }
+ ASSERT_EQ(2, gtest_failures.size());
+ EXPECT_EQ(TestPartResult::kNonFatalFailure,
+ gtest_failures.GetTestPartResult(0).type());
+ EXPECT_EQ(TestPartResult::kNonFatalFailure,
+ gtest_failures.GetTestPartResult(1).type());
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "foo",
+ gtest_failures.GetTestPartResult(0).message());
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "my message",
+ gtest_failures.GetTestPartResult(1).message());
+}
+
+// Tests non-string assertions.
+
+// Tests EqFailure(), used for implementing *EQ* assertions.
+TEST(AssertionTest, EqFailure) {
+ const String foo_val("5"), bar_val("6");
+ const String msg1(
+ EqFailure("foo", "bar", foo_val, bar_val, false)
+ .failure_message());
+ EXPECT_STREQ(
+ "Value of: bar\n"
+ " Actual: 6\n"
+ "Expected: foo\n"
+ "Which is: 5",
+ msg1.c_str());
+
+ const String msg2(
+ EqFailure("foo", "6", foo_val, bar_val, false)
+ .failure_message());
+ EXPECT_STREQ(
+ "Value of: 6\n"
+ "Expected: foo\n"
+ "Which is: 5",
+ msg2.c_str());
+
+ const String msg3(
+ EqFailure("5", "bar", foo_val, bar_val, false)
+ .failure_message());
+ EXPECT_STREQ(
+ "Value of: bar\n"
+ " Actual: 6\n"
+ "Expected: 5",
+ msg3.c_str());
+
+ const String msg4(
+ EqFailure("5", "6", foo_val, bar_val, false).failure_message());
+ EXPECT_STREQ(
+ "Value of: 6\n"
+ "Expected: 5",
+ msg4.c_str());
+
+ const String msg5(
+ EqFailure("foo", "bar",
+ String("\"x\""), String("\"y\""),
+ true).failure_message());
+ EXPECT_STREQ(
+ "Value of: bar\n"
+ " Actual: \"y\"\n"
+ "Expected: foo (ignoring case)\n"
+ "Which is: \"x\"",
+ msg5.c_str());
+}
+
+// Tests AppendUserMessage(), used for implementing the *EQ* macros.
+TEST(AssertionTest, AppendUserMessage) {
+ const String foo("foo");
+
+ Message msg;
+ EXPECT_STREQ("foo",
+ AppendUserMessage(foo, msg).c_str());
+
+ msg << "bar";
+ EXPECT_STREQ("foo\nbar",
+ AppendUserMessage(foo, msg).c_str());
+}
+
+#ifdef __BORLANDC__
+// Silences warnings: "Condition is always true", "Unreachable code"
+#pragma option push -w-ccc -w-rch
+#endif
+
+// Tests ASSERT_TRUE.
+TEST(AssertionTest, ASSERT_TRUE) {
+ ASSERT_TRUE(2 > 1); // NOLINT
+ EXPECT_FATAL_FAILURE(ASSERT_TRUE(2 < 1),
+ "2 < 1");
+}
+
+// Tests ASSERT_TRUE(predicate) for predicates returning AssertionResult.
+TEST(AssertionTest, AssertTrueWithAssertionResult) {
+ ASSERT_TRUE(ResultIsEven(2));
+#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x600
+ // ICE's in C++Builder 2007.
+ EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEven(3)),
+ "Value of: ResultIsEven(3)\n"
+ " Actual: false (3 is odd)\n"
+ "Expected: true");
+#endif
+ ASSERT_TRUE(ResultIsEvenNoExplanation(2));
+ EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEvenNoExplanation(3)),
+ "Value of: ResultIsEvenNoExplanation(3)\n"
+ " Actual: false (3 is odd)\n"
+ "Expected: true");
+}
+
+// Tests ASSERT_FALSE.
+TEST(AssertionTest, ASSERT_FALSE) {
+ ASSERT_FALSE(2 < 1); // NOLINT
+ EXPECT_FATAL_FAILURE(ASSERT_FALSE(2 > 1),
+ "Value of: 2 > 1\n"
+ " Actual: true\n"
+ "Expected: false");
+}
+
+// Tests ASSERT_FALSE(predicate) for predicates returning AssertionResult.
+TEST(AssertionTest, AssertFalseWithAssertionResult) {
+ ASSERT_FALSE(ResultIsEven(3));
+#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x600
+ // ICE's in C++Builder 2007.
+ EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEven(2)),
+ "Value of: ResultIsEven(2)\n"
+ " Actual: true (2 is even)\n"
+ "Expected: false");
+#endif
+ ASSERT_FALSE(ResultIsEvenNoExplanation(3));
+ EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEvenNoExplanation(2)),
+ "Value of: ResultIsEvenNoExplanation(2)\n"
+ " Actual: true\n"
+ "Expected: false");
+}
+
+#ifdef __BORLANDC__
+// Restores warnings after previous "#pragma option push" supressed them
+#pragma option pop
+#endif
+
+// Tests using ASSERT_EQ on double values. The purpose is to make
+// sure that the specialization we did for integer and anonymous enums
+// isn't used for double arguments.
+TEST(ExpectTest, ASSERT_EQ_Double) {
+ // A success.
+ ASSERT_EQ(5.6, 5.6);
+
+ // A failure.
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(5.1, 5.2),
+ "5.1");
+}
+
+// Tests ASSERT_EQ.
+TEST(AssertionTest, ASSERT_EQ) {
+ ASSERT_EQ(5, 2 + 3);
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(5, 2*3),
+ "Value of: 2*3\n"
+ " Actual: 6\n"
+ "Expected: 5");
+}
+
+// Tests ASSERT_EQ(NULL, pointer).
+#if GTEST_CAN_COMPARE_NULL
+TEST(AssertionTest, ASSERT_EQ_NULL) {
+ // A success.
+ const char* p = NULL;
+ // Some older GCC versions may issue a spurious waring in this or the next
+ // assertion statement. This warning should not be suppressed with
+ // static_cast since the test verifies the ability to use bare NULL as the
+ // expected parameter to the macro.
+ ASSERT_EQ(NULL, p);
+
+ // A failure.
+ static int n = 0;
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
+ "Value of: &n\n");
+}
+#endif // GTEST_CAN_COMPARE_NULL
+
+// Tests ASSERT_EQ(0, non_pointer). Since the literal 0 can be
+// treated as a null pointer by the compiler, we need to make sure
+// that ASSERT_EQ(0, non_pointer) isn't interpreted by Google Test as
+// ASSERT_EQ(static_cast<void*>(NULL), non_pointer).
+TEST(ExpectTest, ASSERT_EQ_0) {
+ int n = 0;
+
+ // A success.
+ ASSERT_EQ(0, n);
+
+ // A failure.
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(0, 5.6),
+ "Expected: 0");
+}
+
+// Tests ASSERT_NE.
+TEST(AssertionTest, ASSERT_NE) {
+ ASSERT_NE(6, 7);
+ EXPECT_FATAL_FAILURE(ASSERT_NE('a', 'a'),
+ "Expected: ('a') != ('a'), "
+ "actual: 'a' (97, 0x61) vs 'a' (97, 0x61)");
+}
+
+// Tests ASSERT_LE.
+TEST(AssertionTest, ASSERT_LE) {
+ ASSERT_LE(2, 3);
+ ASSERT_LE(2, 2);
+ EXPECT_FATAL_FAILURE(ASSERT_LE(2, 0),
+ "Expected: (2) <= (0), actual: 2 vs 0");
+}
+
+// Tests ASSERT_LT.
+TEST(AssertionTest, ASSERT_LT) {
+ ASSERT_LT(2, 3);
+ EXPECT_FATAL_FAILURE(ASSERT_LT(2, 2),
+ "Expected: (2) < (2), actual: 2 vs 2");
+}
+
+// Tests ASSERT_GE.
+TEST(AssertionTest, ASSERT_GE) {
+ ASSERT_GE(2, 1);
+ ASSERT_GE(2, 2);
+ EXPECT_FATAL_FAILURE(ASSERT_GE(2, 3),
+ "Expected: (2) >= (3), actual: 2 vs 3");
+}
+
+// Tests ASSERT_GT.
+TEST(AssertionTest, ASSERT_GT) {
+ ASSERT_GT(2, 1);
+ EXPECT_FATAL_FAILURE(ASSERT_GT(2, 2),
+ "Expected: (2) > (2), actual: 2 vs 2");
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+void ThrowNothing() {}
+
+// Tests ASSERT_THROW.
+TEST(AssertionTest, ASSERT_THROW) {
+ ASSERT_THROW(ThrowAnInteger(), int);
+
+#ifndef __BORLANDC__
+ // ICE's in C++Builder 2007 and 2009.
+ EXPECT_FATAL_FAILURE(
+ ASSERT_THROW(ThrowAnInteger(), bool),
+ "Expected: ThrowAnInteger() throws an exception of type bool.\n"
+ " Actual: it throws a different type.");
+#endif
+
+ EXPECT_FATAL_FAILURE(
+ ASSERT_THROW(ThrowNothing(), bool),
+ "Expected: ThrowNothing() throws an exception of type bool.\n"
+ " Actual: it throws nothing.");
+}
+
+// Tests ASSERT_NO_THROW.
+TEST(AssertionTest, ASSERT_NO_THROW) {
+ ASSERT_NO_THROW(ThrowNothing());
+ EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnInteger()),
+ "Expected: ThrowAnInteger() doesn't throw an exception."
+ "\n Actual: it throws.");
+}
+
+// Tests ASSERT_ANY_THROW.
+TEST(AssertionTest, ASSERT_ANY_THROW) {
+ ASSERT_ANY_THROW(ThrowAnInteger());
+ EXPECT_FATAL_FAILURE(
+ ASSERT_ANY_THROW(ThrowNothing()),
+ "Expected: ThrowNothing() throws an exception.\n"
+ " Actual: it doesn't.");
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+// Makes sure we deal with the precedence of <<. This test should
+// compile.
+TEST(AssertionTest, AssertPrecedence) {
+ ASSERT_EQ(1 < 2, true);
+ ASSERT_EQ(true && false, false);
+}
+
+// A subroutine used by the following test.
+void TestEq1(int x) {
+ ASSERT_EQ(1, x);
+}
+
+// Tests calling a test subroutine that's not part of a fixture.
+TEST(AssertionTest, NonFixtureSubroutine) {
+ EXPECT_FATAL_FAILURE(TestEq1(2),
+ "Value of: x");
+}
+
+// An uncopyable class.
+class Uncopyable {
+ public:
+ explicit Uncopyable(int a_value) : value_(a_value) {}
+
+ int value() const { return value_; }
+ bool operator==(const Uncopyable& rhs) const {
+ return value() == rhs.value();
+ }
+ private:
+ // This constructor deliberately has no implementation, as we don't
+ // want this class to be copyable.
+ Uncopyable(const Uncopyable&); // NOLINT
+
+ int value_;
+};
+
+::std::ostream& operator<<(::std::ostream& os, const Uncopyable& value) {
+ return os << value.value();
+}
+
+
+bool IsPositiveUncopyable(const Uncopyable& x) {
+ return x.value() > 0;
+}
+
+// A subroutine used by the following test.
+void TestAssertNonPositive() {
+ Uncopyable y(-1);
+ ASSERT_PRED1(IsPositiveUncopyable, y);
+}
+// A subroutine used by the following test.
+void TestAssertEqualsUncopyable() {
+ Uncopyable x(5);
+ Uncopyable y(-1);
+ ASSERT_EQ(x, y);
+}
+
+// Tests that uncopyable objects can be used in assertions.
+TEST(AssertionTest, AssertWorksWithUncopyableObject) {
+ Uncopyable x(5);
+ ASSERT_PRED1(IsPositiveUncopyable, x);
+ ASSERT_EQ(x, x);
+ EXPECT_FATAL_FAILURE(TestAssertNonPositive(),
+ "IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
+ EXPECT_FATAL_FAILURE(TestAssertEqualsUncopyable(),
+ "Value of: y\n Actual: -1\nExpected: x\nWhich is: 5");
+}
+
+// Tests that uncopyable objects can be used in expects.
+TEST(AssertionTest, ExpectWorksWithUncopyableObject) {
+ Uncopyable x(5);
+ EXPECT_PRED1(IsPositiveUncopyable, x);
+ Uncopyable y(-1);
+ EXPECT_NONFATAL_FAILURE(EXPECT_PRED1(IsPositiveUncopyable, y),
+ "IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
+ EXPECT_EQ(x, x);
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y),
+ "Value of: y\n Actual: -1\nExpected: x\nWhich is: 5");
+}
+
+
+// The version of gcc used in XCode 2.2 has a bug and doesn't allow
+// anonymous enums in assertions. Therefore the following test is not
+// done on Mac.
+// Sun Studio also rejects this code.
+#if !GTEST_OS_MAC && !defined(__SUNPRO_CC)
+
+// Tests using assertions with anonymous enums.
+enum {
+ CASE_A = -1,
+#if GTEST_OS_LINUX
+ // We want to test the case where the size of the anonymous enum is
+ // larger than sizeof(int), to make sure our implementation of the
+ // assertions doesn't truncate the enums. However, MSVC
+ // (incorrectly) doesn't allow an enum value to exceed the range of
+ // an int, so this has to be conditionally compiled.
+ //
+ // On Linux, CASE_B and CASE_A have the same value when truncated to
+ // int size. We want to test whether this will confuse the
+ // assertions.
+ CASE_B = testing::internal::kMaxBiggestInt,
+#else
+ CASE_B = INT_MAX,
+#endif // GTEST_OS_LINUX
+};
+
+TEST(AssertionTest, AnonymousEnum) {
+#if GTEST_OS_LINUX
+ EXPECT_EQ(static_cast<int>(CASE_A), static_cast<int>(CASE_B));
+#endif // GTEST_OS_LINUX
+
+ EXPECT_EQ(CASE_A, CASE_A);
+ EXPECT_NE(CASE_A, CASE_B);
+ EXPECT_LT(CASE_A, CASE_B);
+ EXPECT_LE(CASE_A, CASE_B);
+ EXPECT_GT(CASE_B, CASE_A);
+ EXPECT_GE(CASE_A, CASE_A);
+ EXPECT_NONFATAL_FAILURE(EXPECT_GE(CASE_A, CASE_B),
+ "(CASE_A) >= (CASE_B)");
+
+ ASSERT_EQ(CASE_A, CASE_A);
+ ASSERT_NE(CASE_A, CASE_B);
+ ASSERT_LT(CASE_A, CASE_B);
+ ASSERT_LE(CASE_A, CASE_B);
+ ASSERT_GT(CASE_B, CASE_A);
+ ASSERT_GE(CASE_A, CASE_A);
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(CASE_A, CASE_B),
+ "Value of: CASE_B");
+}
+
+#endif // !GTEST_OS_MAC && !defined(__SUNPRO_CC)
+
+#if GTEST_OS_WINDOWS
+
+static HRESULT UnexpectedHRESULTFailure() {
+ return E_UNEXPECTED;
+}
+
+static HRESULT OkHRESULTSuccess() {
+ return S_OK;
+}
+
+static HRESULT FalseHRESULTSuccess() {
+ return S_FALSE;
+}
+
+// HRESULT assertion tests test both zero and non-zero
+// success codes as well as failure message for each.
+//
+// Windows CE doesn't support message texts.
+TEST(HRESULTAssertionTest, EXPECT_HRESULT_SUCCEEDED) {
+ EXPECT_HRESULT_SUCCEEDED(S_OK);
+ EXPECT_HRESULT_SUCCEEDED(S_FALSE);
+
+ EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_SUCCEEDED(UnexpectedHRESULTFailure()),
+ "Expected: (UnexpectedHRESULTFailure()) succeeds.\n"
+ " Actual: 0x8000FFFF");
+}
+
+TEST(HRESULTAssertionTest, ASSERT_HRESULT_SUCCEEDED) {
+ ASSERT_HRESULT_SUCCEEDED(S_OK);
+ ASSERT_HRESULT_SUCCEEDED(S_FALSE);
+
+ EXPECT_FATAL_FAILURE(ASSERT_HRESULT_SUCCEEDED(UnexpectedHRESULTFailure()),
+ "Expected: (UnexpectedHRESULTFailure()) succeeds.\n"
+ " Actual: 0x8000FFFF");
+}
+
+TEST(HRESULTAssertionTest, EXPECT_HRESULT_FAILED) {
+ EXPECT_HRESULT_FAILED(E_UNEXPECTED);
+
+ EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(OkHRESULTSuccess()),
+ "Expected: (OkHRESULTSuccess()) fails.\n"
+ " Actual: 0x00000000");
+ EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(FalseHRESULTSuccess()),
+ "Expected: (FalseHRESULTSuccess()) fails.\n"
+ " Actual: 0x00000001");
+}
+
+TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {
+ ASSERT_HRESULT_FAILED(E_UNEXPECTED);
+
+#ifndef __BORLANDC__
+ // ICE's in C++Builder 2007 and 2009.
+ EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()),
+ "Expected: (OkHRESULTSuccess()) fails.\n"
+ " Actual: 0x00000000");
+#endif
+ EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()),
+ "Expected: (FalseHRESULTSuccess()) fails.\n"
+ " Actual: 0x00000001");
+}
+
+// Tests that streaming to the HRESULT macros works.
+TEST(HRESULTAssertionTest, Streaming) {
+ EXPECT_HRESULT_SUCCEEDED(S_OK) << "unexpected failure";
+ ASSERT_HRESULT_SUCCEEDED(S_OK) << "unexpected failure";
+ EXPECT_HRESULT_FAILED(E_UNEXPECTED) << "unexpected failure";
+ ASSERT_HRESULT_FAILED(E_UNEXPECTED) << "unexpected failure";
+
+ EXPECT_NONFATAL_FAILURE(
+ EXPECT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure",
+ "expected failure");
+
+#ifndef __BORLANDC__
+ // ICE's in C++Builder 2007 and 2009.
+ EXPECT_FATAL_FAILURE(
+ ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure",
+ "expected failure");
+#endif
+
+ EXPECT_NONFATAL_FAILURE(
+ EXPECT_HRESULT_FAILED(S_OK) << "expected failure",
+ "expected failure");
+
+ EXPECT_FATAL_FAILURE(
+ ASSERT_HRESULT_FAILED(S_OK) << "expected failure",
+ "expected failure");
+}
+
+#endif // GTEST_OS_WINDOWS
+
+#ifdef __BORLANDC__
+// Silences warnings: "Condition is always true", "Unreachable code"
+#pragma option push -w-ccc -w-rch
+#endif
+
+// Tests that the assertion macros behave like single statements.
+TEST(AssertionSyntaxTest, BasicAssertionsBehavesLikeSingleStatement) {
+ if (AlwaysFalse())
+ ASSERT_TRUE(false) << "This should never be executed; "
+ "It's a compilation test only.";
+
+ if (AlwaysTrue())
+ EXPECT_FALSE(false);
+ else
+ ; // NOLINT
+
+ if (AlwaysFalse())
+ ASSERT_LT(1, 3);
+
+ if (AlwaysFalse())
+ ; // NOLINT
+ else
+ EXPECT_GT(3, 2) << "";
+}
+
+#if GTEST_HAS_EXCEPTIONS
+// Tests that the compiler will not complain about unreachable code in the
+// EXPECT_THROW/EXPECT_ANY_THROW/EXPECT_NO_THROW macros.
+TEST(ExpectThrowTest, DoesNotGenerateUnreachableCodeWarning) {
+ int n = 0;
+
+ EXPECT_THROW(throw 1, int);
+ EXPECT_NONFATAL_FAILURE(EXPECT_THROW(n++, int), "");
+ EXPECT_NONFATAL_FAILURE(EXPECT_THROW(throw 1, const char*), "");
+ EXPECT_NO_THROW(n++);
+ EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(throw 1), "");
+ EXPECT_ANY_THROW(throw 1);
+ EXPECT_NONFATAL_FAILURE(EXPECT_ANY_THROW(n++), "");
+}
+
+TEST(AssertionSyntaxTest, ExceptionAssertionsBehavesLikeSingleStatement) {
+ if (AlwaysFalse())
+ EXPECT_THROW(ThrowNothing(), bool);
+
+ if (AlwaysTrue())
+ EXPECT_THROW(ThrowAnInteger(), int);
+ else
+ ; // NOLINT
+
+ if (AlwaysFalse())
+ EXPECT_NO_THROW(ThrowAnInteger());
+
+ if (AlwaysTrue())
+ EXPECT_NO_THROW(ThrowNothing());
+ else
+ ; // NOLINT
+
+ if (AlwaysFalse())
+ EXPECT_ANY_THROW(ThrowNothing());
+
+ if (AlwaysTrue())
+ EXPECT_ANY_THROW(ThrowAnInteger());
+ else
+ ; // NOLINT
+}
+#endif // GTEST_HAS_EXCEPTIONS
+
+TEST(AssertionSyntaxTest, NoFatalFailureAssertionsBehavesLikeSingleStatement) {
+ if (AlwaysFalse())
+ EXPECT_NO_FATAL_FAILURE(FAIL()) << "This should never be executed. "
+ << "It's a compilation test only.";
+ else
+ ; // NOLINT
+
+ if (AlwaysFalse())
+ ASSERT_NO_FATAL_FAILURE(FAIL()) << "";
+ else
+ ; // NOLINT
+
+ if (AlwaysTrue())
+ EXPECT_NO_FATAL_FAILURE(SUCCEED());
+ else
+ ; // NOLINT
+
+ if (AlwaysFalse())
+ ; // NOLINT
+ else
+ ASSERT_NO_FATAL_FAILURE(SUCCEED());
+}
+
+// Tests that the assertion macros work well with switch statements.
+TEST(AssertionSyntaxTest, WorksWithSwitch) {
+ switch (0) {
+ case 1:
+ break;
+ default:
+ ASSERT_TRUE(true);
+ }
+
+ switch (0)
+ case 0:
+ EXPECT_FALSE(false) << "EXPECT_FALSE failed in switch case";
+
+ // Binary assertions are implemented using a different code path
+ // than the Boolean assertions. Hence we test them separately.
+ switch (0) {
+ case 1:
+ default:
+ ASSERT_EQ(1, 1) << "ASSERT_EQ failed in default switch handler";
+ }
+
+ switch (0)
+ case 0:
+ EXPECT_NE(1, 2);
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+void ThrowAString() {
+ throw "String";
+}
+
+// Test that the exception assertion macros compile and work with const
+// type qualifier.
+TEST(AssertionSyntaxTest, WorksWithConst) {
+ ASSERT_THROW(ThrowAString(), const char*);
+
+ EXPECT_THROW(ThrowAString(), const char*);
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+} // namespace
+
+namespace testing {
+
+// Tests that Google Test tracks SUCCEED*.
+TEST(SuccessfulAssertionTest, SUCCEED) {
+ SUCCEED();
+ SUCCEED() << "OK";
+ EXPECT_EQ(2, GetUnitTestImpl()->current_test_result()->total_part_count());
+}
+
+// Tests that Google Test doesn't track successful EXPECT_*.
+TEST(SuccessfulAssertionTest, EXPECT) {
+ EXPECT_TRUE(true);
+ EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());
+}
+
+// Tests that Google Test doesn't track successful EXPECT_STR*.
+TEST(SuccessfulAssertionTest, EXPECT_STR) {
+ EXPECT_STREQ("", "");
+ EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());
+}
+
+// Tests that Google Test doesn't track successful ASSERT_*.
+TEST(SuccessfulAssertionTest, ASSERT) {
+ ASSERT_TRUE(true);
+ EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());
+}
+
+// Tests that Google Test doesn't track successful ASSERT_STR*.
+TEST(SuccessfulAssertionTest, ASSERT_STR) {
+ ASSERT_STREQ("", "");
+ EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());
+}
+
+} // namespace testing
+
+namespace {
+
+// Tests EXPECT_TRUE.
+TEST(ExpectTest, EXPECT_TRUE) {
+ EXPECT_TRUE(2 > 1); // NOLINT
+ EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(2 < 1),
+ "Value of: 2 < 1\n"
+ " Actual: false\n"
+ "Expected: true");
+ EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(2 > 3),
+ "2 > 3");
+}
+
+// Tests EXPECT_TRUE(predicate) for predicates returning AssertionResult.
+TEST(ExpectTest, ExpectTrueWithAssertionResult) {
+ EXPECT_TRUE(ResultIsEven(2));
+ EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(ResultIsEven(3)),
+ "Value of: ResultIsEven(3)\n"
+ " Actual: false (3 is odd)\n"
+ "Expected: true");
+ EXPECT_TRUE(ResultIsEvenNoExplanation(2));
+ EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(ResultIsEvenNoExplanation(3)),
+ "Value of: ResultIsEvenNoExplanation(3)\n"
+ " Actual: false (3 is odd)\n"
+ "Expected: true");
+}
+
+// Tests EXPECT_FALSE.
+TEST(ExpectTest, EXPECT_FALSE) {
+ EXPECT_FALSE(2 < 1); // NOLINT
+ EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(2 > 1),
+ "Value of: 2 > 1\n"
+ " Actual: true\n"
+ "Expected: false");
+ EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(2 < 3),
+ "2 < 3");
+}
+
+// Tests EXPECT_FALSE(predicate) for predicates returning AssertionResult.
+TEST(ExpectTest, ExpectFalseWithAssertionResult) {
+ EXPECT_FALSE(ResultIsEven(3));
+ EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(ResultIsEven(2)),
+ "Value of: ResultIsEven(2)\n"
+ " Actual: true (2 is even)\n"
+ "Expected: false");
+ EXPECT_FALSE(ResultIsEvenNoExplanation(3));
+ EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(ResultIsEvenNoExplanation(2)),
+ "Value of: ResultIsEvenNoExplanation(2)\n"
+ " Actual: true\n"
+ "Expected: false");
+}
+
+#ifdef __BORLANDC__
+// Restores warnings after previous "#pragma option push" supressed them
+#pragma option pop
+#endif
+
+// Tests EXPECT_EQ.
+TEST(ExpectTest, EXPECT_EQ) {
+ EXPECT_EQ(5, 2 + 3);
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2*3),
+ "Value of: 2*3\n"
+ " Actual: 6\n"
+ "Expected: 5");
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2 - 3),
+ "2 - 3");
+}
+
+// Tests using EXPECT_EQ on double values. The purpose is to make
+// sure that the specialization we did for integer and anonymous enums
+// isn't used for double arguments.
+TEST(ExpectTest, EXPECT_EQ_Double) {
+ // A success.
+ EXPECT_EQ(5.6, 5.6);
+
+ // A failure.
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5.1, 5.2),
+ "5.1");
+}
+
+#if GTEST_CAN_COMPARE_NULL
+// Tests EXPECT_EQ(NULL, pointer).
+TEST(ExpectTest, EXPECT_EQ_NULL) {
+ // A success.
+ const char* p = NULL;
+ // Some older GCC versions may issue a spurious waring in this or the next
+ // assertion statement. This warning should not be suppressed with
+ // static_cast since the test verifies the ability to use bare NULL as the
+ // expected parameter to the macro.
+ EXPECT_EQ(NULL, p);
+
+ // A failure.
+ int n = 0;
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
+ "Value of: &n\n");
+}
+#endif // GTEST_CAN_COMPARE_NULL
+
+// Tests EXPECT_EQ(0, non_pointer). Since the literal 0 can be
+// treated as a null pointer by the compiler, we need to make sure
+// that EXPECT_EQ(0, non_pointer) isn't interpreted by Google Test as
+// EXPECT_EQ(static_cast<void*>(NULL), non_pointer).
+TEST(ExpectTest, EXPECT_EQ_0) {
+ int n = 0;
+
+ // A success.
+ EXPECT_EQ(0, n);
+
+ // A failure.
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(0, 5.6),
+ "Expected: 0");
+}
+
+// Tests EXPECT_NE.
+TEST(ExpectTest, EXPECT_NE) {
+ EXPECT_NE(6, 7);
+
+ EXPECT_NONFATAL_FAILURE(EXPECT_NE('a', 'a'),
+ "Expected: ('a') != ('a'), "
+ "actual: 'a' (97, 0x61) vs 'a' (97, 0x61)");
+ EXPECT_NONFATAL_FAILURE(EXPECT_NE(2, 2),
+ "2");
+ char* const p0 = NULL;
+ EXPECT_NONFATAL_FAILURE(EXPECT_NE(p0, p0),
+ "p0");
+ // Only way to get the Nokia compiler to compile the cast
+ // is to have a separate void* variable first. Putting
+ // the two casts on the same line doesn't work, neither does
+ // a direct C-style to char*.
+ void* pv1 = (void*)0x1234; // NOLINT
+ char* const p1 = reinterpret_cast<char*>(pv1);
+ EXPECT_NONFATAL_FAILURE(EXPECT_NE(p1, p1),
+ "p1");
+}
+
+// Tests EXPECT_LE.
+TEST(ExpectTest, EXPECT_LE) {
+ EXPECT_LE(2, 3);
+ EXPECT_LE(2, 2);
+ EXPECT_NONFATAL_FAILURE(EXPECT_LE(2, 0),
+ "Expected: (2) <= (0), actual: 2 vs 0");
+ EXPECT_NONFATAL_FAILURE(EXPECT_LE(1.1, 0.9),
+ "(1.1) <= (0.9)");
+}
+
+// Tests EXPECT_LT.
+TEST(ExpectTest, EXPECT_LT) {
+ EXPECT_LT(2, 3);
+ EXPECT_NONFATAL_FAILURE(EXPECT_LT(2, 2),
+ "Expected: (2) < (2), actual: 2 vs 2");
+ EXPECT_NONFATAL_FAILURE(EXPECT_LT(2, 1),
+ "(2) < (1)");
+}
+
+// Tests EXPECT_GE.
+TEST(ExpectTest, EXPECT_GE) {
+ EXPECT_GE(2, 1);
+ EXPECT_GE(2, 2);
+ EXPECT_NONFATAL_FAILURE(EXPECT_GE(2, 3),
+ "Expected: (2) >= (3), actual: 2 vs 3");
+ EXPECT_NONFATAL_FAILURE(EXPECT_GE(0.9, 1.1),
+ "(0.9) >= (1.1)");
+}
+
+// Tests EXPECT_GT.
+TEST(ExpectTest, EXPECT_GT) {
+ EXPECT_GT(2, 1);
+ EXPECT_NONFATAL_FAILURE(EXPECT_GT(2, 2),
+ "Expected: (2) > (2), actual: 2 vs 2");
+ EXPECT_NONFATAL_FAILURE(EXPECT_GT(2, 3),
+ "(2) > (3)");
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+// Tests EXPECT_THROW.
+TEST(ExpectTest, EXPECT_THROW) {
+ EXPECT_THROW(ThrowAnInteger(), int);
+ EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnInteger(), bool),
+ "Expected: ThrowAnInteger() throws an exception of "
+ "type bool.\n Actual: it throws a different type.");
+ EXPECT_NONFATAL_FAILURE(
+ EXPECT_THROW(ThrowNothing(), bool),
+ "Expected: ThrowNothing() throws an exception of type bool.\n"
+ " Actual: it throws nothing.");
+}
+
+// Tests EXPECT_NO_THROW.
+TEST(ExpectTest, EXPECT_NO_THROW) {
+ EXPECT_NO_THROW(ThrowNothing());
+ EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnInteger()),
+ "Expected: ThrowAnInteger() doesn't throw an "
+ "exception.\n Actual: it throws.");
+}
+
+// Tests EXPECT_ANY_THROW.
+TEST(ExpectTest, EXPECT_ANY_THROW) {
+ EXPECT_ANY_THROW(ThrowAnInteger());
+ EXPECT_NONFATAL_FAILURE(
+ EXPECT_ANY_THROW(ThrowNothing()),
+ "Expected: ThrowNothing() throws an exception.\n"
+ " Actual: it doesn't.");
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+// Make sure we deal with the precedence of <<.
+TEST(ExpectTest, ExpectPrecedence) {
+ EXPECT_EQ(1 < 2, true);
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false),
+ "Value of: true && false");
+}
+
+
+// Tests the StreamableToString() function.
+
+// Tests using StreamableToString() on a scalar.
+TEST(StreamableToStringTest, Scalar) {
+ EXPECT_STREQ("5", StreamableToString(5).c_str());
+}
+
+// Tests using StreamableToString() on a non-char pointer.
+TEST(StreamableToStringTest, Pointer) {
+ int n = 0;
+ int* p = &n;
+ EXPECT_STRNE("(null)", StreamableToString(p).c_str());
+}
+
+// Tests using StreamableToString() on a NULL non-char pointer.
+TEST(StreamableToStringTest, NullPointer) {
+ int* p = NULL;
+ EXPECT_STREQ("(null)", StreamableToString(p).c_str());
+}
+
+// Tests using StreamableToString() on a C string.
+TEST(StreamableToStringTest, CString) {
+ EXPECT_STREQ("Foo", StreamableToString("Foo").c_str());
+}
+
+// Tests using StreamableToString() on a NULL C string.
+TEST(StreamableToStringTest, NullCString) {
+ char* p = NULL;
+ EXPECT_STREQ("(null)", StreamableToString(p).c_str());
+}
+
+// Tests using streamable values as assertion messages.
+
+// Tests using std::string as an assertion message.
+TEST(StreamableTest, string) {
+ static const std::string str(
+ "This failure message is a std::string, and is expected.");
+ EXPECT_FATAL_FAILURE(FAIL() << str,
+ str.c_str());
+}
+
+// Tests that we can output strings containing embedded NULs.
+// Limited to Linux because we can only do this with std::string's.
+TEST(StreamableTest, stringWithEmbeddedNUL) {
+ static const char char_array_with_nul[] =
+ "Here's a NUL\0 and some more string";
+ static const std::string string_with_nul(char_array_with_nul,
+ sizeof(char_array_with_nul)
+ - 1); // drops the trailing NUL
+ EXPECT_FATAL_FAILURE(FAIL() << string_with_nul,
+ "Here's a NUL\\0 and some more string");
+}
+
+// Tests that we can output a NUL char.
+TEST(StreamableTest, NULChar) {
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ FAIL() << "A NUL" << '\0' << " and some more string";
+ }, "A NUL\\0 and some more string");
+}
+
+// Tests using int as an assertion message.
+TEST(StreamableTest, int) {
+ EXPECT_FATAL_FAILURE(FAIL() << 900913,
+ "900913");
+}
+
+// Tests using NULL char pointer as an assertion message.
+//
+// In MSVC, streaming a NULL char * causes access violation. Google Test
+// implemented a workaround (substituting "(null)" for NULL). This
+// tests whether the workaround works.
+TEST(StreamableTest, NullCharPtr) {
+ EXPECT_FATAL_FAILURE(FAIL() << static_cast<const char*>(NULL),
+ "(null)");
+}
+
+// Tests that basic IO manipulators (endl, ends, and flush) can be
+// streamed to testing::Message.
+TEST(StreamableTest, BasicIoManip) {
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ FAIL() << "Line 1." << std::endl
+ << "A NUL char " << std::ends << std::flush << " in line 2.";
+ }, "Line 1.\nA NUL char \\0 in line 2.");
+}
+
+// Tests the macros that haven't been covered so far.
+
+void AddFailureHelper(bool* aborted) {
+ *aborted = true;
+ ADD_FAILURE() << "Failure";
+ *aborted = false;
+}
+
+// Tests ADD_FAILURE.
+TEST(MacroTest, ADD_FAILURE) {
+ bool aborted = true;
+ EXPECT_NONFATAL_FAILURE(AddFailureHelper(&aborted),
+ "Failure");
+ EXPECT_FALSE(aborted);
+}
+
+// Tests FAIL.
+TEST(MacroTest, FAIL) {
+ EXPECT_FATAL_FAILURE(FAIL(),
+ "Failed");
+ EXPECT_FATAL_FAILURE(FAIL() << "Intentional failure.",
+ "Intentional failure.");
+}
+
+// Tests SUCCEED
+TEST(MacroTest, SUCCEED) {
+ SUCCEED();
+ SUCCEED() << "Explicit success.";
+}
+
+
+// Tests for EXPECT_EQ() and ASSERT_EQ().
+//
+// These tests fail *intentionally*, s.t. the failure messages can be
+// generated and tested.
+//
+// We have different tests for different argument types.
+
+// Tests using bool values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, Bool) {
+ EXPECT_EQ(true, true);
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(false, true),
+ "Value of: true");
+}
+
+// Tests using int values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, Int) {
+ ASSERT_EQ(32, 32);
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(32, 33),
+ "33");
+}
+
+// Tests using time_t values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, Time_T) {
+ EXPECT_EQ(static_cast<time_t>(0),
+ static_cast<time_t>(0));
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<time_t>(0),
+ static_cast<time_t>(1234)),
+ "1234");
+}
+
+// Tests using char values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, Char) {
+ ASSERT_EQ('z', 'z');
+ const char ch = 'b';
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ('\0', ch),
+ "ch");
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ('a', ch),
+ "ch");
+}
+
+// Tests using wchar_t values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, WideChar) {
+ EXPECT_EQ(L'b', L'b');
+
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'\0', L'x'),
+ "Value of: L'x'\n"
+ " Actual: L'x' (120, 0x78)\n"
+ "Expected: L'\0'\n"
+ "Which is: L'\0' (0, 0x0)");
+
+ static wchar_t wchar;
+ wchar = L'b';
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'a', wchar),
+ "wchar");
+ wchar = L'\x8119';
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(L'\x8120', wchar),
+ "Value of: wchar");
+}
+
+// Tests using ::std::string values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, StdString) {
+ // Compares a const char* to an std::string that has identical
+ // content.
+ ASSERT_EQ("Test", ::std::string("Test"));
+
+ // Compares two identical std::strings.
+ static const ::std::string str1("A * in the middle");
+ static const ::std::string str2(str1);
+ EXPECT_EQ(str1, str2);
+
+ // Compares a const char* to an std::string that has different
+ // content
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ("Test", ::std::string("test")),
+ "::std::string(\"test\")");
+
+ // Compares an std::string to a char* that has different content.
+ char* const p1 = const_cast<char*>("foo");
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(::std::string("bar"), p1),
+ "p1");
+
+ // Compares two std::strings that have different contents, one of
+ // which having a NUL character in the middle. This should fail.
+ static ::std::string str3(str1);
+ str3.at(2) = '\0';
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3),
+ "Value of: str3\n"
+ " Actual: \"A \\0 in the middle\"");
+}
+
+#if GTEST_HAS_STD_WSTRING
+
+// Tests using ::std::wstring values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, StdWideString) {
+ // Compares an std::wstring to a const wchar_t* that has identical
+ // content.
+ EXPECT_EQ(::std::wstring(L"Test\x8119"), L"Test\x8119");
+
+ // Compares two identical std::wstrings.
+ const ::std::wstring wstr1(L"A * in the middle");
+ const ::std::wstring wstr2(wstr1);
+ ASSERT_EQ(wstr1, wstr2);
+
+ // Compares an std::wstring to a const wchar_t* that has different
+ // content.
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_EQ(::std::wstring(L"Test\x8119"), L"Test\x8120");
+ }, "L\"Test\\x8120\"");
+
+ // Compares two std::wstrings that have different contents, one of
+ // which having a NUL character in the middle.
+ ::std::wstring wstr3(wstr1);
+ wstr3.at(2) = L'\0';
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(wstr1, wstr3),
+ "wstr3");
+
+ // Compares a wchar_t* to an std::wstring that has different
+ // content.
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_EQ(const_cast<wchar_t*>(L"foo"), ::std::wstring(L"bar"));
+ }, "");
+}
+
+#endif // GTEST_HAS_STD_WSTRING
+
+#if GTEST_HAS_GLOBAL_STRING
+// Tests using ::string values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, GlobalString) {
+ // Compares a const char* to a ::string that has identical content.
+ EXPECT_EQ("Test", ::string("Test"));
+
+ // Compares two identical ::strings.
+ const ::string str1("A * in the middle");
+ const ::string str2(str1);
+ ASSERT_EQ(str1, str2);
+
+ // Compares a ::string to a const char* that has different content.
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(::string("Test"), "test"),
+ "test");
+
+ // Compares two ::strings that have different contents, one of which
+ // having a NUL character in the middle.
+ ::string str3(str1);
+ str3.at(2) = '\0';
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(str1, str3),
+ "str3");
+
+ // Compares a ::string to a char* that has different content.
+ EXPECT_FATAL_FAILURE({ // NOLINT
+ ASSERT_EQ(::string("bar"), const_cast<char*>("foo"));
+ }, "");
+}
+
+#endif // GTEST_HAS_GLOBAL_STRING
+
+#if GTEST_HAS_GLOBAL_WSTRING
+
+// Tests using ::wstring values in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, GlobalWideString) {
+ // Compares a const wchar_t* to a ::wstring that has identical content.
+ ASSERT_EQ(L"Test\x8119", ::wstring(L"Test\x8119"));
+
+ // Compares two identical ::wstrings.
+ static const ::wstring wstr1(L"A * in the middle");
+ static const ::wstring wstr2(wstr1);
+ EXPECT_EQ(wstr1, wstr2);
+
+ // Compares a const wchar_t* to a ::wstring that has different
+ // content.
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
+ EXPECT_EQ(L"Test\x8120", ::wstring(L"Test\x8119"));
+ }, "Test\\x8119");
+
+ // Compares a wchar_t* to a ::wstring that has different content.
+ wchar_t* const p1 = const_cast<wchar_t*>(L"foo");
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, ::wstring(L"bar")),
+ "bar");
+
+ // Compares two ::wstrings that have different contents, one of which
+ // having a NUL character in the middle.
+ static ::wstring wstr3;
+ wstr3 = wstr1;
+ wstr3.at(2) = L'\0';
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(wstr1, wstr3),
+ "wstr3");
+}
+
+#endif // GTEST_HAS_GLOBAL_WSTRING
+
+// Tests using char pointers in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, CharPointer) {
+ char* const p0 = NULL;
+ // Only way to get the Nokia compiler to compile the cast
+ // is to have a separate void* variable first. Putting
+ // the two casts on the same line doesn't work, neither does
+ // a direct C-style to char*.
+ void* pv1 = (void*)0x1234; // NOLINT
+ void* pv2 = (void*)0xABC0; // NOLINT
+ char* const p1 = reinterpret_cast<char*>(pv1);
+ char* const p2 = reinterpret_cast<char*>(pv2);
+ ASSERT_EQ(p1, p1);
+
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
+ "Value of: p2");
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
+ "p2");
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast<char*>(0x1234),
+ reinterpret_cast<char*>(0xABC0)),
+ "ABC0");
+}
+
+// Tests using wchar_t pointers in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, WideCharPointer) {
+ wchar_t* const p0 = NULL;
+ // Only way to get the Nokia compiler to compile the cast
+ // is to have a separate void* variable first. Putting
+ // the two casts on the same line doesn't work, neither does
+ // a direct C-style to char*.
+ void* pv1 = (void*)0x1234; // NOLINT
+ void* pv2 = (void*)0xABC0; // NOLINT
+ wchar_t* const p1 = reinterpret_cast<wchar_t*>(pv1);
+ wchar_t* const p2 = reinterpret_cast<wchar_t*>(pv2);
+ EXPECT_EQ(p0, p0);
+
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
+ "Value of: p2");
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
+ "p2");
+ void* pv3 = (void*)0x1234; // NOLINT
+ void* pv4 = (void*)0xABC0; // NOLINT
+ const wchar_t* p3 = reinterpret_cast<const wchar_t*>(pv3);
+ const wchar_t* p4 = reinterpret_cast<const wchar_t*>(pv4);
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p3, p4),
+ "p4");
+}
+
+// Tests using other types of pointers in {EXPECT|ASSERT}_EQ.
+TEST(EqAssertionTest, OtherPointer) {
+ ASSERT_EQ(static_cast<const int*>(NULL),
+ static_cast<const int*>(NULL));
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<const int*>(NULL),
+ reinterpret_cast<const int*>(0x1234)),
+ "0x1234");
+}
+
+// Tests the FRIEND_TEST macro.
+
+// This class has a private member we want to test. We will test it
+// both in a TEST and in a TEST_F.
+class Foo {
+ public:
+ Foo() {}
+
+ private:
+ int Bar() const { return 1; }
+
+ // Declares the friend tests that can access the private member
+ // Bar().
+ FRIEND_TEST(FRIEND_TEST_Test, TEST);
+ FRIEND_TEST(FRIEND_TEST_Test2, TEST_F);
+};
+
+// Tests that the FRIEND_TEST declaration allows a TEST to access a
+// class's private members. This should compile.
+TEST(FRIEND_TEST_Test, TEST) {
+ ASSERT_EQ(1, Foo().Bar());
+}
+
+// The fixture needed to test using FRIEND_TEST with TEST_F.
+class FRIEND_TEST_Test2 : public Test {
+ protected:
+ Foo foo;
+};
+
+// Tests that the FRIEND_TEST declaration allows a TEST_F to access a
+// class's private members. This should compile.
+TEST_F(FRIEND_TEST_Test2, TEST_F) {
+ ASSERT_EQ(1, foo.Bar());
+}
+
+// Tests the life cycle of Test objects.
+
+// The test fixture for testing the life cycle of Test objects.
+//
+// This class counts the number of live test objects that uses this
+// fixture.
+class TestLifeCycleTest : public Test {
+ protected:
+ // Constructor. Increments the number of test objects that uses
+ // this fixture.
+ TestLifeCycleTest() { count_++; }
+
+ // Destructor. Decrements the number of test objects that uses this
+ // fixture.
+ ~TestLifeCycleTest() { count_--; }
+
+ // Returns the number of live test objects that uses this fixture.
+ int count() const { return count_; }
+
+ private:
+ static int count_;
+};
+
+int TestLifeCycleTest::count_ = 0;
+
+// Tests the life cycle of test objects.
+TEST_F(TestLifeCycleTest, Test1) {
+ // There should be only one test object in this test case that's
+ // currently alive.
+ ASSERT_EQ(1, count());
+}
+
+// Tests the life cycle of test objects.
+TEST_F(TestLifeCycleTest, Test2) {
+ // After Test1 is done and Test2 is started, there should still be
+ // only one live test object, as the object for Test1 should've been
+ // deleted.
+ ASSERT_EQ(1, count());
+}
+
+} // namespace
+
+// Tests that the copy constructor works when it is NOT optimized away by
+// the compiler.
+TEST(AssertionResultTest, CopyConstructorWorksWhenNotOptimied) {
+ // Checks that the copy constructor doesn't try to dereference NULL pointers
+ // in the source object.
+ AssertionResult r1 = AssertionSuccess();
+ AssertionResult r2 = r1;
+ // The following line is added to prevent the compiler from optimizing
+ // away the constructor call.
+ r1 << "abc";
+
+ AssertionResult r3 = r1;
+ EXPECT_EQ(static_cast<bool>(r3), static_cast<bool>(r1));
+ EXPECT_STREQ("abc", r1.message());
+}
+
+// Tests that AssertionSuccess and AssertionFailure construct
+// AssertionResult objects as expected.
+TEST(AssertionResultTest, ConstructionWorks) {
+ AssertionResult r1 = AssertionSuccess();
+ EXPECT_TRUE(r1);
+ EXPECT_STREQ("", r1.message());
+
+ AssertionResult r2 = AssertionSuccess() << "abc";
+ EXPECT_TRUE(r2);
+ EXPECT_STREQ("abc", r2.message());
+
+ AssertionResult r3 = AssertionFailure();
+ EXPECT_FALSE(r3);
+ EXPECT_STREQ("", r3.message());
+
+ AssertionResult r4 = AssertionFailure() << "def";
+ EXPECT_FALSE(r4);
+ EXPECT_STREQ("def", r4.message());
+
+ AssertionResult r5 = AssertionFailure(Message() << "ghi");
+ EXPECT_FALSE(r5);
+ EXPECT_STREQ("ghi", r5.message());
+}
+
+// Tests that the negation fips the predicate result but keeps the message.
+TEST(AssertionResultTest, NegationWorks) {
+ AssertionResult r1 = AssertionSuccess() << "abc";
+ EXPECT_FALSE(!r1);
+ EXPECT_STREQ("abc", (!r1).message());
+
+ AssertionResult r2 = AssertionFailure() << "def";
+ EXPECT_TRUE(!r2);
+ EXPECT_STREQ("def", (!r2).message());
+}
+
+TEST(AssertionResultTest, StreamingWorks) {
+ AssertionResult r = AssertionSuccess();
+ r << "abc" << 'd' << 0 << true;
+ EXPECT_STREQ("abcd0true", r.message());
+}
+
+// Tests streaming a user type whose definition and operator << are
+// both in the global namespace.
+class Base {
+ public:
+ explicit Base(int an_x) : x_(an_x) {}
+ int x() const { return x_; }
+ private:
+ int x_;
+};
+std::ostream& operator<<(std::ostream& os,
+ const Base& val) {
+ return os << val.x();
+}
+std::ostream& operator<<(std::ostream& os,
+ const Base* pointer) {
+ return os << "(" << pointer->x() << ")";
+}
+
+TEST(MessageTest, CanStreamUserTypeInGlobalNameSpace) {
+ Message msg;
+ Base a(1);
+
+ msg << a << &a; // Uses ::operator<<.
+ EXPECT_STREQ("1(1)", msg.GetString().c_str());
+}
+
+// Tests streaming a user type whose definition and operator<< are
+// both in an unnamed namespace.
+namespace {
+class MyTypeInUnnamedNameSpace : public Base {
+ public:
+ explicit MyTypeInUnnamedNameSpace(int an_x): Base(an_x) {}
+};
+std::ostream& operator<<(std::ostream& os,
+ const MyTypeInUnnamedNameSpace& val) {
+ return os << val.x();
+}
+std::ostream& operator<<(std::ostream& os,
+ const MyTypeInUnnamedNameSpace* pointer) {
+ return os << "(" << pointer->x() << ")";
+}
+} // namespace
+
+TEST(MessageTest, CanStreamUserTypeInUnnamedNameSpace) {
+ Message msg;
+ MyTypeInUnnamedNameSpace a(1);
+
+ msg << a << &a; // Uses <unnamed_namespace>::operator<<.
+ EXPECT_STREQ("1(1)", msg.GetString().c_str());
+}
+
+// Tests streaming a user type whose definition and operator<< are
+// both in a user namespace.
+namespace namespace1 {
+class MyTypeInNameSpace1 : public Base {
+ public:
+ explicit MyTypeInNameSpace1(int an_x): Base(an_x) {}
+};
+std::ostream& operator<<(std::ostream& os,
+ const MyTypeInNameSpace1& val) {
+ return os << val.x();
+}
+std::ostream& operator<<(std::ostream& os,
+ const MyTypeInNameSpace1* pointer) {
+ return os << "(" << pointer->x() << ")";
+}
+} // namespace namespace1
+
+TEST(MessageTest, CanStreamUserTypeInUserNameSpace) {
+ Message msg;
+ namespace1::MyTypeInNameSpace1 a(1);
+
+ msg << a << &a; // Uses namespace1::operator<<.
+ EXPECT_STREQ("1(1)", msg.GetString().c_str());
+}
+
+// Tests streaming a user type whose definition is in a user namespace
+// but whose operator<< is in the global namespace.
+namespace namespace2 {
+class MyTypeInNameSpace2 : public ::Base {
+ public:
+ explicit MyTypeInNameSpace2(int an_x): Base(an_x) {}
+};
+} // namespace namespace2
+std::ostream& operator<<(std::ostream& os,
+ const namespace2::MyTypeInNameSpace2& val) {
+ return os << val.x();
+}
+std::ostream& operator<<(std::ostream& os,
+ const namespace2::MyTypeInNameSpace2* pointer) {
+ return os << "(" << pointer->x() << ")";
+}
+
+TEST(MessageTest, CanStreamUserTypeInUserNameSpaceWithStreamOperatorInGlobal) {
+ Message msg;
+ namespace2::MyTypeInNameSpace2 a(1);
+
+ msg << a << &a; // Uses ::operator<<.
+ EXPECT_STREQ("1(1)", msg.GetString().c_str());
+}
+
+// Tests streaming NULL pointers to testing::Message.
+TEST(MessageTest, NullPointers) {
+ Message msg;
+ char* const p1 = NULL;
+ unsigned char* const p2 = NULL;
+ int* p3 = NULL;
+ double* p4 = NULL;
+ bool* p5 = NULL;
+ Message* p6 = NULL;
+
+ msg << p1 << p2 << p3 << p4 << p5 << p6;
+ ASSERT_STREQ("(null)(null)(null)(null)(null)(null)",
+ msg.GetString().c_str());
+}
+
+// Tests streaming wide strings to testing::Message.
+TEST(MessageTest, WideStrings) {
+ // Streams a NULL of type const wchar_t*.
+ const wchar_t* const_wstr = NULL;
+ EXPECT_STREQ("(null)",
+ (Message() << const_wstr).GetString().c_str());
+
+ // Streams a NULL of type wchar_t*.
+ wchar_t* wstr = NULL;
+ EXPECT_STREQ("(null)",
+ (Message() << wstr).GetString().c_str());
+
+ // Streams a non-NULL of type const wchar_t*.
+ const_wstr = L"abc\x8119";
+ EXPECT_STREQ("abc\xe8\x84\x99",
+ (Message() << const_wstr).GetString().c_str());
+
+ // Streams a non-NULL of type wchar_t*.
+ wstr = const_cast<wchar_t*>(const_wstr);
+ EXPECT_STREQ("abc\xe8\x84\x99",
+ (Message() << wstr).GetString().c_str());
+}
+
+
+// This line tests that we can define tests in the testing namespace.
+namespace testing {
+
+// Tests the TestInfo class.
+
+class TestInfoTest : public Test {
+ protected:
+ static const TestInfo* GetTestInfo(const char* test_name) {
+ const TestCase* const test_case = GetUnitTestImpl()->
+ GetTestCase("TestInfoTest", "", NULL, NULL);
+
+ for (int i = 0; i < test_case->total_test_count(); ++i) {
+ const TestInfo* const test_info = test_case->GetTestInfo(i);
+ if (strcmp(test_name, test_info->name()) == 0)
+ return test_info;
+ }
+ return NULL;
+ }
+
+ static const TestResult* GetTestResult(
+ const TestInfo* test_info) {
+ return test_info->result();
+ }
+};
+
+// Tests TestInfo::test_case_name() and TestInfo::name().
+TEST_F(TestInfoTest, Names) {
+ const TestInfo* const test_info = GetTestInfo("Names");
+
+ ASSERT_STREQ("TestInfoTest", test_info->test_case_name());
+ ASSERT_STREQ("Names", test_info->name());
+}
+
+// Tests TestInfo::result().
+TEST_F(TestInfoTest, result) {
+ const TestInfo* const test_info = GetTestInfo("result");
+
+ // Initially, there is no TestPartResult for this test.
+ ASSERT_EQ(0, GetTestResult(test_info)->total_part_count());
+
+ // After the previous assertion, there is still none.
+ ASSERT_EQ(0, GetTestResult(test_info)->total_part_count());
+}
+
+// Tests setting up and tearing down a test case.
+
+class SetUpTestCaseTest : public Test {
+ protected:
+ // This will be called once before the first test in this test case
+ // is run.
+ static void SetUpTestCase() {
+ printf("Setting up the test case . . .\n");
+
+ // Initializes some shared resource. In this simple example, we
+ // just create a C string. More complex stuff can be done if
+ // desired.
+ shared_resource_ = "123";
+
+ // Increments the number of test cases that have been set up.
+ counter_++;
+
+ // SetUpTestCase() should be called only once.
+ EXPECT_EQ(1, counter_);
+ }
+
+ // This will be called once after the last test in this test case is
+ // run.
+ static void TearDownTestCase() {
+ printf("Tearing down the test case . . .\n");
+
+ // Decrements the number of test cases that have been set up.
+ counter_--;
+
+ // TearDownTestCase() should be called only once.
+ EXPECT_EQ(0, counter_);
+
+ // Cleans up the shared resource.
+ shared_resource_ = NULL;
+ }
+
+ // This will be called before each test in this test case.
+ virtual void SetUp() {
+ // SetUpTestCase() should be called only once, so counter_ should
+ // always be 1.
+ EXPECT_EQ(1, counter_);
+ }
+
+ // Number of test cases that have been set up.
+ static int counter_;
+
+ // Some resource to be shared by all tests in this test case.
+ static const char* shared_resource_;
+};
+
+int SetUpTestCaseTest::counter_ = 0;
+const char* SetUpTestCaseTest::shared_resource_ = NULL;
+
+// A test that uses the shared resource.
+TEST_F(SetUpTestCaseTest, Test1) {
+ EXPECT_STRNE(NULL, shared_resource_);
+}
+
+// Another test that uses the shared resource.
+TEST_F(SetUpTestCaseTest, Test2) {
+ EXPECT_STREQ("123", shared_resource_);
+}
+
+// The InitGoogleTestTest test case tests testing::InitGoogleTest().
+
+// The Flags struct stores a copy of all Google Test flags.
+struct Flags {
+ // Constructs a Flags struct where each flag has its default value.
+ Flags() : also_run_disabled_tests(false),
+ break_on_failure(false),
+ catch_exceptions(false),
+ death_test_use_fork(false),
+ filter(""),
+ list_tests(false),
+ output(""),
+ print_time(true),
+ random_seed(0),
+ repeat(1),
+ shuffle(false),
+ stack_trace_depth(kMaxStackTraceDepth),
+ throw_on_failure(false) {}
+
+ // Factory methods.
+
+ // Creates a Flags struct where the gtest_also_run_disabled_tests flag has
+ // the given value.
+ static Flags AlsoRunDisabledTests(bool also_run_disabled_tests) {
+ Flags flags;
+ flags.also_run_disabled_tests = also_run_disabled_tests;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_break_on_failure flag has
+ // the given value.
+ static Flags BreakOnFailure(bool break_on_failure) {
+ Flags flags;
+ flags.break_on_failure = break_on_failure;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_catch_exceptions flag has
+ // the given value.
+ static Flags CatchExceptions(bool catch_exceptions) {
+ Flags flags;
+ flags.catch_exceptions = catch_exceptions;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_death_test_use_fork flag has
+ // the given value.
+ static Flags DeathTestUseFork(bool death_test_use_fork) {
+ Flags flags;
+ flags.death_test_use_fork = death_test_use_fork;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_filter flag has the given
+ // value.
+ static Flags Filter(const char* filter) {
+ Flags flags;
+ flags.filter = filter;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_list_tests flag has the
+ // given value.
+ static Flags ListTests(bool list_tests) {
+ Flags flags;
+ flags.list_tests = list_tests;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_output flag has the given
+ // value.
+ static Flags Output(const char* output) {
+ Flags flags;
+ flags.output = output;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_print_time flag has the given
+ // value.
+ static Flags PrintTime(bool print_time) {
+ Flags flags;
+ flags.print_time = print_time;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_random_seed flag has
+ // the given value.
+ static Flags RandomSeed(Int32 random_seed) {
+ Flags flags;
+ flags.random_seed = random_seed;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_repeat flag has the given
+ // value.
+ static Flags Repeat(Int32 repeat) {
+ Flags flags;
+ flags.repeat = repeat;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_shuffle flag has
+ // the given value.
+ static Flags Shuffle(bool shuffle) {
+ Flags flags;
+ flags.shuffle = shuffle;
+ return flags;
+ }
+
+ // Creates a Flags struct where the GTEST_FLAG(stack_trace_depth) flag has
+ // the given value.
+ static Flags StackTraceDepth(Int32 stack_trace_depth) {
+ Flags flags;
+ flags.stack_trace_depth = stack_trace_depth;
+ return flags;
+ }
+
+ // Creates a Flags struct where the gtest_throw_on_failure flag has
+ // the given value.
+ static Flags ThrowOnFailure(bool throw_on_failure) {
+ Flags flags;
+ flags.throw_on_failure = throw_on_failure;
+ return flags;
+ }
+
+ // These fields store the flag values.
+ bool also_run_disabled_tests;
+ bool break_on_failure;
+ bool catch_exceptions;
+ bool death_test_use_fork;
+ const char* filter;
+ bool list_tests;
+ const char* output;
+ bool print_time;
+ Int32 random_seed;
+ Int32 repeat;
+ bool shuffle;
+ Int32 stack_trace_depth;
+ bool throw_on_failure;
+};
+
+// Fixture for testing InitGoogleTest().
+class InitGoogleTestTest : public Test {
+ protected:
+ // Clears the flags before each test.
+ virtual void SetUp() {
+ GTEST_FLAG(also_run_disabled_tests) = false;
+ GTEST_FLAG(break_on_failure) = false;
+ GTEST_FLAG(catch_exceptions) = false;
+ GTEST_FLAG(death_test_use_fork) = false;
+ GTEST_FLAG(filter) = "";
+ GTEST_FLAG(list_tests) = false;
+ GTEST_FLAG(output) = "";
+ GTEST_FLAG(print_time) = true;
+ GTEST_FLAG(random_seed) = 0;
+ GTEST_FLAG(repeat) = 1;
+ GTEST_FLAG(shuffle) = false;
+ GTEST_FLAG(stack_trace_depth) = kMaxStackTraceDepth;
+ GTEST_FLAG(throw_on_failure) = false;
+ }
+
+ // Asserts that two narrow or wide string arrays are equal.
+ template <typename CharType>
+ static void AssertStringArrayEq(size_t size1, CharType** array1,
+ size_t size2, CharType** array2) {
+ ASSERT_EQ(size1, size2) << " Array sizes different.";
+
+ for (size_t i = 0; i != size1; i++) {
+ ASSERT_STREQ(array1[i], array2[i]) << " where i == " << i;
+ }
+ }
+
+ // Verifies that the flag values match the expected values.
+ static void CheckFlags(const Flags& expected) {
+ EXPECT_EQ(expected.also_run_disabled_tests,
+ GTEST_FLAG(also_run_disabled_tests));
+ EXPECT_EQ(expected.break_on_failure, GTEST_FLAG(break_on_failure));
+ EXPECT_EQ(expected.catch_exceptions, GTEST_FLAG(catch_exceptions));
+ EXPECT_EQ(expected.death_test_use_fork, GTEST_FLAG(death_test_use_fork));
+ EXPECT_STREQ(expected.filter, GTEST_FLAG(filter).c_str());
+ EXPECT_EQ(expected.list_tests, GTEST_FLAG(list_tests));
+ EXPECT_STREQ(expected.output, GTEST_FLAG(output).c_str());
+ EXPECT_EQ(expected.print_time, GTEST_FLAG(print_time));
+ EXPECT_EQ(expected.random_seed, GTEST_FLAG(random_seed));
+ EXPECT_EQ(expected.repeat, GTEST_FLAG(repeat));
+ EXPECT_EQ(expected.shuffle, GTEST_FLAG(shuffle));
+ EXPECT_EQ(expected.throw_on_failure, GTEST_FLAG(throw_on_failure));
+ EXPECT_EQ(expected.stack_trace_depth, GTEST_FLAG(stack_trace_depth));
+ }
+
+ // Parses a command line (specified by argc1 and argv1), then
+ // verifies that the flag values are expected and that the
+ // recognized flags are removed from the command line.
+ template <typename CharType>
+ static void TestParsingFlags(int argc1, const CharType** argv1,
+ int argc2, const CharType** argv2,
+ const Flags& expected, bool should_print_help) {
+ const bool saved_help_flag = ::testing::internal::g_help_flag;
+ ::testing::internal::g_help_flag = false;
+
+#if GTEST_HAS_STREAM_REDIRECTION_
+ CaptureStdout();
+#endif // GTEST_HAS_STREAM_REDIRECTION_
+
+ // Parses the command line.
+ internal::ParseGoogleTestFlagsOnly(&argc1, const_cast<CharType**>(argv1));
+
+#if GTEST_HAS_STREAM_REDIRECTION_
+ const String captured_stdout = GetCapturedStdout();
+#endif // GTEST_HAS_STREAM_REDIRECTION_
+
+ // Verifies the flag values.
+ CheckFlags(expected);
+
+ // Verifies that the recognized flags are removed from the command
+ // line.
+ AssertStringArrayEq(argc1 + 1, argv1, argc2 + 1, argv2);
+
+ // ParseGoogleTestFlagsOnly should neither set g_help_flag nor print the
+ // help message for the flags it recognizes.
+ EXPECT_EQ(should_print_help, ::testing::internal::g_help_flag);
+
+#if GTEST_HAS_STREAM_REDIRECTION_
+ const char* const expected_help_fragment =
+ "This program contains tests written using";
+ if (should_print_help) {
+ EXPECT_PRED_FORMAT2(IsSubstring, expected_help_fragment, captured_stdout);
+ } else {
+ EXPECT_PRED_FORMAT2(IsNotSubstring,
+ expected_help_fragment, captured_stdout);
+ }
+#endif // GTEST_HAS_STREAM_REDIRECTION_
+
+ ::testing::internal::g_help_flag = saved_help_flag;
+ }
+
+ // This macro wraps TestParsingFlags s.t. the user doesn't need
+ // to specify the array sizes.
+#define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \
+ TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \
+ sizeof(argv2)/sizeof(*argv2) - 1, argv2, \
+ expected, should_print_help)
+};
+
+// Tests parsing an empty command line.
+TEST_F(InitGoogleTestTest, Empty) {
+ const char* argv[] = {
+ NULL
+ };
+
+ const char* argv2[] = {
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false);
+}
+
+// Tests parsing a command line that has no flag.
+TEST_F(InitGoogleTestTest, NoFlag) {
+ const char* argv[] = {
+ "foo.exe",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false);
+}
+
+// Tests parsing a bad --gtest_filter flag.
+TEST_F(InitGoogleTestTest, FilterBad) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_filter",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ "--gtest_filter",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), true);
+}
+
+// Tests parsing an empty --gtest_filter flag.
+TEST_F(InitGoogleTestTest, FilterEmpty) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_filter=",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), false);
+}
+
+// Tests parsing a non-empty --gtest_filter flag.
+TEST_F(InitGoogleTestTest, FilterNonEmpty) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_filter=abc",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("abc"), false);
+}
+
+// Tests parsing --gtest_break_on_failure.
+TEST_F(InitGoogleTestTest, BreakOnFailureWithoutValue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_break_on_failure",
+ NULL
+};
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false);
+}
+
+// Tests parsing --gtest_break_on_failure=0.
+TEST_F(InitGoogleTestTest, BreakOnFailureFalse_0) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_break_on_failure=0",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false);
+}
+
+// Tests parsing --gtest_break_on_failure=f.
+TEST_F(InitGoogleTestTest, BreakOnFailureFalse_f) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_break_on_failure=f",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false);
+}
+
+// Tests parsing --gtest_break_on_failure=F.
+TEST_F(InitGoogleTestTest, BreakOnFailureFalse_F) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_break_on_failure=F",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false);
+}
+
+// Tests parsing a --gtest_break_on_failure flag that has a "true"
+// definition.
+TEST_F(InitGoogleTestTest, BreakOnFailureTrue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_break_on_failure=1",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false);
+}
+
+// Tests parsing --gtest_catch_exceptions.
+TEST_F(InitGoogleTestTest, CatchExceptions) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_catch_exceptions",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::CatchExceptions(true), false);
+}
+
+// Tests parsing --gtest_death_test_use_fork.
+TEST_F(InitGoogleTestTest, DeathTestUseFork) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_death_test_use_fork",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::DeathTestUseFork(true), false);
+}
+
+// Tests having the same flag twice with different values. The
+// expected behavior is that the one coming last takes precedence.
+TEST_F(InitGoogleTestTest, DuplicatedFlags) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_filter=a",
+ "--gtest_filter=b",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("b"), false);
+}
+
+// Tests having an unrecognized flag on the command line.
+TEST_F(InitGoogleTestTest, UnrecognizedFlag) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_break_on_failure",
+ "bar", // Unrecognized by Google Test.
+ "--gtest_filter=b",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ "bar",
+ NULL
+ };
+
+ Flags flags;
+ flags.break_on_failure = true;
+ flags.filter = "b";
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, flags, false);
+}
+
+// Tests having a --gtest_list_tests flag
+TEST_F(InitGoogleTestTest, ListTestsFlag) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_list_tests",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false);
+}
+
+// Tests having a --gtest_list_tests flag with a "true" value
+TEST_F(InitGoogleTestTest, ListTestsTrue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_list_tests=1",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false);
+}
+
+// Tests having a --gtest_list_tests flag with a "false" value
+TEST_F(InitGoogleTestTest, ListTestsFalse) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_list_tests=0",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false);
+}
+
+// Tests parsing --gtest_list_tests=f.
+TEST_F(InitGoogleTestTest, ListTestsFalse_f) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_list_tests=f",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false);
+}
+
+// Tests parsing --gtest_list_tests=F.
+TEST_F(InitGoogleTestTest, ListTestsFalse_F) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_list_tests=F",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false);
+}
+
+// Tests parsing --gtest_output (invalid).
+TEST_F(InitGoogleTestTest, OutputEmpty) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_output",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ "--gtest_output",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true);
+}
+
+// Tests parsing --gtest_output=xml
+TEST_F(InitGoogleTestTest, OutputXml) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_output=xml",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml"), false);
+}
+
+// Tests parsing --gtest_output=xml:file
+TEST_F(InitGoogleTestTest, OutputXmlFile) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_output=xml:file",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml:file"), false);
+}
+
+// Tests parsing --gtest_output=xml:directory/path/
+TEST_F(InitGoogleTestTest, OutputXmlDirectory) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_output=xml:directory/path/",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2,
+ Flags::Output("xml:directory/path/"), false);
+}
+
+// Tests having a --gtest_print_time flag
+TEST_F(InitGoogleTestTest, PrintTimeFlag) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_print_time",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false);
+}
+
+// Tests having a --gtest_print_time flag with a "true" value
+TEST_F(InitGoogleTestTest, PrintTimeTrue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_print_time=1",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false);
+}
+
+// Tests having a --gtest_print_time flag with a "false" value
+TEST_F(InitGoogleTestTest, PrintTimeFalse) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_print_time=0",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false);
+}
+
+// Tests parsing --gtest_print_time=f.
+TEST_F(InitGoogleTestTest, PrintTimeFalse_f) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_print_time=f",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false);
+}
+
+// Tests parsing --gtest_print_time=F.
+TEST_F(InitGoogleTestTest, PrintTimeFalse_F) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_print_time=F",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false);
+}
+
+// Tests parsing --gtest_random_seed=number
+TEST_F(InitGoogleTestTest, RandomSeed) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_random_seed=1000",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::RandomSeed(1000), false);
+}
+
+// Tests parsing --gtest_repeat=number
+TEST_F(InitGoogleTestTest, Repeat) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_repeat=1000",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Repeat(1000), false);
+}
+
+// Tests having a --gtest_also_run_disabled_tests flag
+TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFlag) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_also_run_disabled_tests",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2,
+ Flags::AlsoRunDisabledTests(true), false);
+}
+
+// Tests having a --gtest_also_run_disabled_tests flag with a "true" value
+TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsTrue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_also_run_disabled_tests=1",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2,
+ Flags::AlsoRunDisabledTests(true), false);
+}
+
+// Tests having a --gtest_also_run_disabled_tests flag with a "false" value
+TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFalse) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_also_run_disabled_tests=0",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2,
+ Flags::AlsoRunDisabledTests(false), false);
+}
+
+// Tests parsing --gtest_shuffle.
+TEST_F(InitGoogleTestTest, ShuffleWithoutValue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_shuffle",
+ NULL
+};
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false);
+}
+
+// Tests parsing --gtest_shuffle=0.
+TEST_F(InitGoogleTestTest, ShuffleFalse_0) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_shuffle=0",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(false), false);
+}
+
+// Tests parsing a --gtest_shuffle flag that has a "true"
+// definition.
+TEST_F(InitGoogleTestTest, ShuffleTrue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_shuffle=1",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false);
+}
+
+// Tests parsing --gtest_stack_trace_depth=number.
+TEST_F(InitGoogleTestTest, StackTraceDepth) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_stack_trace_depth=5",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::StackTraceDepth(5), false);
+}
+
+// Tests parsing --gtest_throw_on_failure.
+TEST_F(InitGoogleTestTest, ThrowOnFailureWithoutValue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_throw_on_failure",
+ NULL
+};
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(true), false);
+}
+
+// Tests parsing --gtest_throw_on_failure=0.
+TEST_F(InitGoogleTestTest, ThrowOnFailureFalse_0) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_throw_on_failure=0",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(false), false);
+}
+
+// Tests parsing a --gtest_throw_on_failure flag that has a "true"
+// definition.
+TEST_F(InitGoogleTestTest, ThrowOnFailureTrue) {
+ const char* argv[] = {
+ "foo.exe",
+ "--gtest_throw_on_failure=1",
+ NULL
+ };
+
+ const char* argv2[] = {
+ "foo.exe",
+ NULL
+ };
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(true), false);
+}
+
+#if GTEST_OS_WINDOWS
+// Tests parsing wide strings.
+TEST_F(InitGoogleTestTest, WideStrings) {
+ const wchar_t* argv[] = {
+ L"foo.exe",
+ L"--gtest_filter=Foo*",
+ L"--gtest_list_tests=1",
+ L"--gtest_break_on_failure",
+ L"--non_gtest_flag",
+ NULL
+ };
+
+ const wchar_t* argv2[] = {
+ L"foo.exe",
+ L"--non_gtest_flag",
+ NULL
+ };
+
+ Flags expected_flags;
+ expected_flags.break_on_failure = true;
+ expected_flags.filter = "Foo*";
+ expected_flags.list_tests = true;
+
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, expected_flags, false);
+}
+#endif // GTEST_OS_WINDOWS
+
+// Tests current_test_info() in UnitTest.
+class CurrentTestInfoTest : public Test {
+ protected:
+ // Tests that current_test_info() returns NULL before the first test in
+ // the test case is run.
+ static void SetUpTestCase() {
+ // There should be no tests running at this point.
+ const TestInfo* test_info =
+ UnitTest::GetInstance()->current_test_info();
+ EXPECT_TRUE(test_info == NULL)
+ << "There should be no tests running at this point.";
+ }
+
+ // Tests that current_test_info() returns NULL after the last test in
+ // the test case has run.
+ static void TearDownTestCase() {
+ const TestInfo* test_info =
+ UnitTest::GetInstance()->current_test_info();
+ EXPECT_TRUE(test_info == NULL)
+ << "There should be no tests running at this point.";
+ }
+};
+
+// Tests that current_test_info() returns TestInfo for currently running
+// test by checking the expected test name against the actual one.
+TEST_F(CurrentTestInfoTest, WorksForFirstTestInATestCase) {
+ const TestInfo* test_info =
+ UnitTest::GetInstance()->current_test_info();
+ ASSERT_TRUE(NULL != test_info)
+ << "There is a test running so we should have a valid TestInfo.";
+ EXPECT_STREQ("CurrentTestInfoTest", test_info->test_case_name())
+ << "Expected the name of the currently running test case.";
+ EXPECT_STREQ("WorksForFirstTestInATestCase", test_info->name())
+ << "Expected the name of the currently running test.";
+}
+
+// Tests that current_test_info() returns TestInfo for currently running
+// test by checking the expected test name against the actual one. We
+// use this test to see that the TestInfo object actually changed from
+// the previous invocation.
+TEST_F(CurrentTestInfoTest, WorksForSecondTestInATestCase) {
+ const TestInfo* test_info =
+ UnitTest::GetInstance()->current_test_info();
+ ASSERT_TRUE(NULL != test_info)
+ << "There is a test running so we should have a valid TestInfo.";
+ EXPECT_STREQ("CurrentTestInfoTest", test_info->test_case_name())
+ << "Expected the name of the currently running test case.";
+ EXPECT_STREQ("WorksForSecondTestInATestCase", test_info->name())
+ << "Expected the name of the currently running test.";
+}
+
+} // namespace testing
+
+// These two lines test that we can define tests in a namespace that
+// has the name "testing" and is nested in another namespace.
+namespace my_namespace {
+namespace testing {
+
+// Makes sure that TEST knows to use ::testing::Test instead of
+// ::my_namespace::testing::Test.
+class Test {};
+
+// Makes sure that an assertion knows to use ::testing::Message instead of
+// ::my_namespace::testing::Message.
+class Message {};
+
+// Makes sure that an assertion knows to use
+// ::testing::AssertionResult instead of
+// ::my_namespace::testing::AssertionResult.
+class AssertionResult {};
+
+// Tests that an assertion that should succeed works as expected.
+TEST(NestedTestingNamespaceTest, Success) {
+ EXPECT_EQ(1, 1) << "This shouldn't fail.";
+}
+
+// Tests that an assertion that should fail works as expected.
+TEST(NestedTestingNamespaceTest, Failure) {
+ EXPECT_FATAL_FAILURE(FAIL() << "This failure is expected.",
+ "This failure is expected.");
+}
+
+} // namespace testing
+} // namespace my_namespace
+
+// Tests that one can call superclass SetUp and TearDown methods--
+// that is, that they are not private.
+// No tests are based on this fixture; the test "passes" if it compiles
+// successfully.
+class ProtectedFixtureMethodsTest : public Test {
+ protected:
+ virtual void SetUp() {
+ Test::SetUp();
+ }
+ virtual void TearDown() {
+ Test::TearDown();
+ }
+};
+
+// StreamingAssertionsTest tests the streaming versions of a representative
+// sample of assertions.
+TEST(StreamingAssertionsTest, Unconditional) {
+ SUCCEED() << "expected success";
+ EXPECT_NONFATAL_FAILURE(ADD_FAILURE() << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(FAIL() << "expected failure",
+ "expected failure");
+}
+
+#ifdef __BORLANDC__
+// Silences warnings: "Condition is always true", "Unreachable code"
+#pragma option push -w-ccc -w-rch
+#endif
+
+TEST(StreamingAssertionsTest, Truth) {
+ EXPECT_TRUE(true) << "unexpected failure";
+ ASSERT_TRUE(true) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(false) << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_TRUE(false) << "expected failure",
+ "expected failure");
+}
+
+TEST(StreamingAssertionsTest, Truth2) {
+ EXPECT_FALSE(false) << "unexpected failure";
+ ASSERT_FALSE(false) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(true) << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_FALSE(true) << "expected failure",
+ "expected failure");
+}
+
+#ifdef __BORLANDC__
+// Restores warnings after previous "#pragma option push" supressed them
+#pragma option pop
+#endif
+
+TEST(StreamingAssertionsTest, IntegerEquals) {
+ EXPECT_EQ(1, 1) << "unexpected failure";
+ ASSERT_EQ(1, 1) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(1, 2) << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_EQ(1, 2) << "expected failure",
+ "expected failure");
+}
+
+TEST(StreamingAssertionsTest, IntegerLessThan) {
+ EXPECT_LT(1, 2) << "unexpected failure";
+ ASSERT_LT(1, 2) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_LT(2, 1) << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_LT(2, 1) << "expected failure",
+ "expected failure");
+}
+
+TEST(StreamingAssertionsTest, StringsEqual) {
+ EXPECT_STREQ("foo", "foo") << "unexpected failure";
+ ASSERT_STREQ("foo", "foo") << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_STREQ("foo", "bar") << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_STREQ("foo", "bar") << "expected failure",
+ "expected failure");
+}
+
+TEST(StreamingAssertionsTest, StringsNotEqual) {
+ EXPECT_STRNE("foo", "bar") << "unexpected failure";
+ ASSERT_STRNE("foo", "bar") << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_STRNE("foo", "foo") << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_STRNE("foo", "foo") << "expected failure",
+ "expected failure");
+}
+
+TEST(StreamingAssertionsTest, StringsEqualIgnoringCase) {
+ EXPECT_STRCASEEQ("foo", "FOO") << "unexpected failure";
+ ASSERT_STRCASEEQ("foo", "FOO") << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_STRCASEEQ("foo", "bar") << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_STRCASEEQ("foo", "bar") << "expected failure",
+ "expected failure");
+}
+
+TEST(StreamingAssertionsTest, StringNotEqualIgnoringCase) {
+ EXPECT_STRCASENE("foo", "bar") << "unexpected failure";
+ ASSERT_STRCASENE("foo", "bar") << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_STRCASENE("foo", "FOO") << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_STRCASENE("bar", "BAR") << "expected failure",
+ "expected failure");
+}
+
+TEST(StreamingAssertionsTest, FloatingPointEquals) {
+ EXPECT_FLOAT_EQ(1.0, 1.0) << "unexpected failure";
+ ASSERT_FLOAT_EQ(1.0, 1.0) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(0.0, 1.0) << "expected failure",
+ "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(0.0, 1.0) << "expected failure",
+ "expected failure");
+}
+
+#if GTEST_HAS_EXCEPTIONS
+
+TEST(StreamingAssertionsTest, Throw) {
+ EXPECT_THROW(ThrowAnInteger(), int) << "unexpected failure";
+ ASSERT_THROW(ThrowAnInteger(), int) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnInteger(), bool) <<
+ "expected failure", "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_THROW(ThrowAnInteger(), bool) <<
+ "expected failure", "expected failure");
+}
+
+TEST(StreamingAssertionsTest, NoThrow) {
+ EXPECT_NO_THROW(ThrowNothing()) << "unexpected failure";
+ ASSERT_NO_THROW(ThrowNothing()) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnInteger()) <<
+ "expected failure", "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnInteger()) <<
+ "expected failure", "expected failure");
+}
+
+TEST(StreamingAssertionsTest, AnyThrow) {
+ EXPECT_ANY_THROW(ThrowAnInteger()) << "unexpected failure";
+ ASSERT_ANY_THROW(ThrowAnInteger()) << "unexpected failure";
+ EXPECT_NONFATAL_FAILURE(EXPECT_ANY_THROW(ThrowNothing()) <<
+ "expected failure", "expected failure");
+ EXPECT_FATAL_FAILURE(ASSERT_ANY_THROW(ThrowNothing()) <<
+ "expected failure", "expected failure");
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+// Tests that Google Test correctly decides whether to use colors in the output.
+
+TEST(ColoredOutputTest, UsesColorsWhenGTestColorFlagIsYes) {
+ GTEST_FLAG(color) = "yes";
+
+ SetEnv("TERM", "xterm"); // TERM supports colors.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+ EXPECT_TRUE(ShouldUseColor(false)); // Stdout is not a TTY.
+
+ SetEnv("TERM", "dumb"); // TERM doesn't support colors.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+ EXPECT_TRUE(ShouldUseColor(false)); // Stdout is not a TTY.
+}
+
+TEST(ColoredOutputTest, UsesColorsWhenGTestColorFlagIsAliasOfYes) {
+ SetEnv("TERM", "dumb"); // TERM doesn't support colors.
+
+ GTEST_FLAG(color) = "True";
+ EXPECT_TRUE(ShouldUseColor(false)); // Stdout is not a TTY.
+
+ GTEST_FLAG(color) = "t";
+ EXPECT_TRUE(ShouldUseColor(false)); // Stdout is not a TTY.
+
+ GTEST_FLAG(color) = "1";
+ EXPECT_TRUE(ShouldUseColor(false)); // Stdout is not a TTY.
+}
+
+TEST(ColoredOutputTest, UsesNoColorWhenGTestColorFlagIsNo) {
+ GTEST_FLAG(color) = "no";
+
+ SetEnv("TERM", "xterm"); // TERM supports colors.
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+ EXPECT_FALSE(ShouldUseColor(false)); // Stdout is not a TTY.
+
+ SetEnv("TERM", "dumb"); // TERM doesn't support colors.
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+ EXPECT_FALSE(ShouldUseColor(false)); // Stdout is not a TTY.
+}
+
+TEST(ColoredOutputTest, UsesNoColorWhenGTestColorFlagIsInvalid) {
+ SetEnv("TERM", "xterm"); // TERM supports colors.
+
+ GTEST_FLAG(color) = "F";
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ GTEST_FLAG(color) = "0";
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ GTEST_FLAG(color) = "unknown";
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+}
+
+TEST(ColoredOutputTest, UsesColorsWhenStdoutIsTty) {
+ GTEST_FLAG(color) = "auto";
+
+ SetEnv("TERM", "xterm"); // TERM supports colors.
+ EXPECT_FALSE(ShouldUseColor(false)); // Stdout is not a TTY.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+}
+
+TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
+ GTEST_FLAG(color) = "auto";
+
+#if GTEST_OS_WINDOWS
+ // On Windows, we ignore the TERM variable as it's usually not set.
+
+ SetEnv("TERM", "dumb");
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "");
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "xterm");
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+#else
+ // On non-Windows platforms, we rely on TERM to determine if the
+ // terminal supports colors.
+
+ SetEnv("TERM", "dumb"); // TERM doesn't support colors.
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "emacs"); // TERM doesn't support colors.
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "vt100"); // TERM doesn't support colors.
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "xterm-mono"); // TERM doesn't support colors.
+ EXPECT_FALSE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "xterm"); // TERM supports colors.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "xterm-color"); // TERM supports colors.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "linux"); // TERM supports colors.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+#endif // GTEST_OS_WINDOWS
+}
+
+// Verifies that StaticAssertTypeEq works in a namespace scope.
+
+static bool dummy1 = StaticAssertTypeEq<bool, bool>();
+static bool dummy2 = StaticAssertTypeEq<const int, const int>();
+
+// Verifies that StaticAssertTypeEq works in a class.
+
+template <typename T>
+class StaticAssertTypeEqTestHelper {
+ public:
+ StaticAssertTypeEqTestHelper() { StaticAssertTypeEq<bool, T>(); }
+};
+
+TEST(StaticAssertTypeEqTest, WorksInClass) {
+ StaticAssertTypeEqTestHelper<bool>();
+}
+
+// Verifies that StaticAssertTypeEq works inside a function.
+
+typedef int IntAlias;
+
+TEST(StaticAssertTypeEqTest, CompilesForEqualTypes) {
+ StaticAssertTypeEq<int, IntAlias>();
+ StaticAssertTypeEq<int*, IntAlias*>();
+}
+
+TEST(GetCurrentOsStackTraceExceptTopTest, ReturnsTheStackTrace) {
+ testing::UnitTest* const unit_test = testing::UnitTest::GetInstance();
+
+ // We don't have a stack walker in Google Test yet.
+ EXPECT_STREQ("", GetCurrentOsStackTraceExceptTop(unit_test, 0).c_str());
+ EXPECT_STREQ("", GetCurrentOsStackTraceExceptTop(unit_test, 1).c_str());
+}
+
+TEST(HasNonfatalFailureTest, ReturnsFalseWhenThereIsNoFailure) {
+ EXPECT_FALSE(HasNonfatalFailure());
+}
+
+static void FailFatally() { FAIL(); }
+
+TEST(HasNonfatalFailureTest, ReturnsFalseWhenThereIsOnlyFatalFailure) {
+ FailFatally();
+ const bool has_nonfatal_failure = HasNonfatalFailure();
+ ClearCurrentTestPartResults();
+ EXPECT_FALSE(has_nonfatal_failure);
+}
+
+TEST(HasNonfatalFailureTest, ReturnsTrueWhenThereIsNonfatalFailure) {
+ ADD_FAILURE();
+ const bool has_nonfatal_failure = HasNonfatalFailure();
+ ClearCurrentTestPartResults();
+ EXPECT_TRUE(has_nonfatal_failure);
+}
+
+TEST(HasNonfatalFailureTest, ReturnsTrueWhenThereAreFatalAndNonfatalFailures) {
+ FailFatally();
+ ADD_FAILURE();
+ const bool has_nonfatal_failure = HasNonfatalFailure();
+ ClearCurrentTestPartResults();
+ EXPECT_TRUE(has_nonfatal_failure);
+}
+
+// A wrapper for calling HasNonfatalFailure outside of a test body.
+static bool HasNonfatalFailureHelper() {
+ return testing::Test::HasNonfatalFailure();
+}
+
+TEST(HasNonfatalFailureTest, WorksOutsideOfTestBody) {
+ EXPECT_FALSE(HasNonfatalFailureHelper());
+}
+
+TEST(HasNonfatalFailureTest, WorksOutsideOfTestBody2) {
+ ADD_FAILURE();
+ const bool has_nonfatal_failure = HasNonfatalFailureHelper();
+ ClearCurrentTestPartResults();
+ EXPECT_TRUE(has_nonfatal_failure);
+}
+
+TEST(HasFailureTest, ReturnsFalseWhenThereIsNoFailure) {
+ EXPECT_FALSE(HasFailure());
+}
+
+TEST(HasFailureTest, ReturnsTrueWhenThereIsFatalFailure) {
+ FailFatally();
+ const bool has_failure = HasFailure();
+ ClearCurrentTestPartResults();
+ EXPECT_TRUE(has_failure);
+}
+
+TEST(HasFailureTest, ReturnsTrueWhenThereIsNonfatalFailure) {
+ ADD_FAILURE();
+ const bool has_failure = HasFailure();
+ ClearCurrentTestPartResults();
+ EXPECT_TRUE(has_failure);
+}
+
+TEST(HasFailureTest, ReturnsTrueWhenThereAreFatalAndNonfatalFailures) {
+ FailFatally();
+ ADD_FAILURE();
+ const bool has_failure = HasFailure();
+ ClearCurrentTestPartResults();
+ EXPECT_TRUE(has_failure);
+}
+
+// A wrapper for calling HasFailure outside of a test body.
+static bool HasFailureHelper() { return testing::Test::HasFailure(); }
+
+TEST(HasFailureTest, WorksOutsideOfTestBody) {
+ EXPECT_FALSE(HasFailureHelper());
+}
+
+TEST(HasFailureTest, WorksOutsideOfTestBody2) {
+ ADD_FAILURE();
+ const bool has_failure = HasFailureHelper();
+ ClearCurrentTestPartResults();
+ EXPECT_TRUE(has_failure);
+}
+
+class TestListener : public EmptyTestEventListener {
+ public:
+ TestListener() : on_start_counter_(NULL), is_destroyed_(NULL) {}
+ TestListener(int* on_start_counter, bool* is_destroyed)
+ : on_start_counter_(on_start_counter),
+ is_destroyed_(is_destroyed) {}
+
+ virtual ~TestListener() {
+ if (is_destroyed_)
+ *is_destroyed_ = true;
+ }
+
+ protected:
+ virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
+ if (on_start_counter_ != NULL)
+ (*on_start_counter_)++;
+ }
+
+ private:
+ int* on_start_counter_;
+ bool* is_destroyed_;
+};
+
+// Tests the constructor.
+TEST(TestEventListenersTest, ConstructionWorks) {
+ TestEventListeners listeners;
+
+ EXPECT_TRUE(TestEventListenersAccessor::GetRepeater(&listeners) != NULL);
+ EXPECT_TRUE(listeners.default_result_printer() == NULL);
+ EXPECT_TRUE(listeners.default_xml_generator() == NULL);
+}
+
+// Tests that the TestEventListeners destructor deletes all the listeners it
+// owns.
+TEST(TestEventListenersTest, DestructionWorks) {
+ bool default_result_printer_is_destroyed = false;
+ bool default_xml_printer_is_destroyed = false;
+ bool extra_listener_is_destroyed = false;
+ TestListener* default_result_printer = new TestListener(
+ NULL, &default_result_printer_is_destroyed);
+ TestListener* default_xml_printer = new TestListener(
+ NULL, &default_xml_printer_is_destroyed);
+ TestListener* extra_listener = new TestListener(
+ NULL, &extra_listener_is_destroyed);
+
+ {
+ TestEventListeners listeners;
+ TestEventListenersAccessor::SetDefaultResultPrinter(&listeners,
+ default_result_printer);
+ TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners,
+ default_xml_printer);
+ listeners.Append(extra_listener);
+ }
+ EXPECT_TRUE(default_result_printer_is_destroyed);
+ EXPECT_TRUE(default_xml_printer_is_destroyed);
+ EXPECT_TRUE(extra_listener_is_destroyed);
+}
+
+// Tests that a listener Append'ed to a TestEventListeners list starts
+// receiving events.
+TEST(TestEventListenersTest, Append) {
+ int on_start_counter = 0;
+ bool is_destroyed = false;
+ TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);
+ {
+ TestEventListeners listeners;
+ listeners.Append(listener);
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ EXPECT_EQ(1, on_start_counter);
+ }
+ EXPECT_TRUE(is_destroyed);
+}
+
+// Tests that listeners receive events in the order they were appended to
+// the list, except for *End requests, which must be received in the reverse
+// order.
+class SequenceTestingListener : public EmptyTestEventListener {
+ public:
+ SequenceTestingListener(std::vector<String>* vector, const char* id)
+ : vector_(vector), id_(id) {}
+
+ protected:
+ virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
+ vector_->push_back(GetEventDescription("OnTestProgramStart"));
+ }
+
+ virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {
+ vector_->push_back(GetEventDescription("OnTestProgramEnd"));
+ }
+
+ virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
+ int /*iteration*/) {
+ vector_->push_back(GetEventDescription("OnTestIterationStart"));
+ }
+
+ virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
+ int /*iteration*/) {
+ vector_->push_back(GetEventDescription("OnTestIterationEnd"));
+ }
+
+ private:
+ String GetEventDescription(const char* method) {
+ Message message;
+ message << id_ << "." << method;
+ return message.GetString();
+ }
+
+ std::vector<String>* vector_;
+ const char* const id_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(SequenceTestingListener);
+};
+
+TEST(EventListenerTest, AppendKeepsOrder) {
+ std::vector<String> vec;
+ TestEventListeners listeners;
+ listeners.Append(new SequenceTestingListener(&vec, "1st"));
+ listeners.Append(new SequenceTestingListener(&vec, "2nd"));
+ listeners.Append(new SequenceTestingListener(&vec, "3rd"));
+
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ ASSERT_EQ(3U, vec.size());
+ EXPECT_STREQ("1st.OnTestProgramStart", vec[0].c_str());
+ EXPECT_STREQ("2nd.OnTestProgramStart", vec[1].c_str());
+ EXPECT_STREQ("3rd.OnTestProgramStart", vec[2].c_str());
+
+ vec.clear();
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramEnd(
+ *UnitTest::GetInstance());
+ ASSERT_EQ(3U, vec.size());
+ EXPECT_STREQ("3rd.OnTestProgramEnd", vec[0].c_str());
+ EXPECT_STREQ("2nd.OnTestProgramEnd", vec[1].c_str());
+ EXPECT_STREQ("1st.OnTestProgramEnd", vec[2].c_str());
+
+ vec.clear();
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestIterationStart(
+ *UnitTest::GetInstance(), 0);
+ ASSERT_EQ(3U, vec.size());
+ EXPECT_STREQ("1st.OnTestIterationStart", vec[0].c_str());
+ EXPECT_STREQ("2nd.OnTestIterationStart", vec[1].c_str());
+ EXPECT_STREQ("3rd.OnTestIterationStart", vec[2].c_str());
+
+ vec.clear();
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestIterationEnd(
+ *UnitTest::GetInstance(), 0);
+ ASSERT_EQ(3U, vec.size());
+ EXPECT_STREQ("3rd.OnTestIterationEnd", vec[0].c_str());
+ EXPECT_STREQ("2nd.OnTestIterationEnd", vec[1].c_str());
+ EXPECT_STREQ("1st.OnTestIterationEnd", vec[2].c_str());
+}
+
+// Tests that a listener removed from a TestEventListeners list stops receiving
+// events and is not deleted when the list is destroyed.
+TEST(TestEventListenersTest, Release) {
+ int on_start_counter = 0;
+ bool is_destroyed = false;
+ // Although Append passes the ownership of this object to the list,
+ // the following calls release it, and we need to delete it before the
+ // test ends.
+ TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);
+ {
+ TestEventListeners listeners;
+ listeners.Append(listener);
+ EXPECT_EQ(listener, listeners.Release(listener));
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ EXPECT_TRUE(listeners.Release(listener) == NULL);
+ }
+ EXPECT_EQ(0, on_start_counter);
+ EXPECT_FALSE(is_destroyed);
+ delete listener;
+}
+
+// Tests that no events are forwarded when event forwarding is disabled.
+TEST(EventListenerTest, SuppressEventForwarding) {
+ int on_start_counter = 0;
+ TestListener* listener = new TestListener(&on_start_counter, NULL);
+
+ TestEventListeners listeners;
+ listeners.Append(listener);
+ ASSERT_TRUE(TestEventListenersAccessor::EventForwardingEnabled(listeners));
+ TestEventListenersAccessor::SuppressEventForwarding(&listeners);
+ ASSERT_FALSE(TestEventListenersAccessor::EventForwardingEnabled(listeners));
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ EXPECT_EQ(0, on_start_counter);
+}
+
+// Tests that events generated by Google Test are not forwarded in
+// death test subprocesses.
+TEST(EventListenerDeathTest, EventsNotForwardedInDeathTestSubprecesses) {
+ EXPECT_DEATH_IF_SUPPORTED({
+ GTEST_CHECK_(TestEventListenersAccessor::EventForwardingEnabled(
+ *GetUnitTestImpl()->listeners())) << "expected failure";},
+ "expected failure");
+}
+
+// Tests that a listener installed via SetDefaultResultPrinter() starts
+// receiving events and is returned via default_result_printer() and that
+// the previous default_result_printer is removed from the list and deleted.
+TEST(EventListenerTest, default_result_printer) {
+ int on_start_counter = 0;
+ bool is_destroyed = false;
+ TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);
+
+ TestEventListeners listeners;
+ TestEventListenersAccessor::SetDefaultResultPrinter(&listeners, listener);
+
+ EXPECT_EQ(listener, listeners.default_result_printer());
+
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+
+ EXPECT_EQ(1, on_start_counter);
+
+ // Replacing default_result_printer with something else should remove it
+ // from the list and destroy it.
+ TestEventListenersAccessor::SetDefaultResultPrinter(&listeners, NULL);
+
+ EXPECT_TRUE(listeners.default_result_printer() == NULL);
+ EXPECT_TRUE(is_destroyed);
+
+ // After broadcasting an event the counter is still the same, indicating
+ // the listener is not in the list anymore.
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ EXPECT_EQ(1, on_start_counter);
+}
+
+// Tests that the default_result_printer listener stops receiving events
+// when removed via Release and that is not owned by the list anymore.
+TEST(EventListenerTest, RemovingDefaultResultPrinterWorks) {
+ int on_start_counter = 0;
+ bool is_destroyed = false;
+ // Although Append passes the ownership of this object to the list,
+ // the following calls release it, and we need to delete it before the
+ // test ends.
+ TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);
+ {
+ TestEventListeners listeners;
+ TestEventListenersAccessor::SetDefaultResultPrinter(&listeners, listener);
+
+ EXPECT_EQ(listener, listeners.Release(listener));
+ EXPECT_TRUE(listeners.default_result_printer() == NULL);
+ EXPECT_FALSE(is_destroyed);
+
+ // Broadcasting events now should not affect default_result_printer.
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ EXPECT_EQ(0, on_start_counter);
+ }
+ // Destroying the list should not affect the listener now, too.
+ EXPECT_FALSE(is_destroyed);
+ delete listener;
+}
+
+// Tests that a listener installed via SetDefaultXmlGenerator() starts
+// receiving events and is returned via default_xml_generator() and that
+// the previous default_xml_generator is removed from the list and deleted.
+TEST(EventListenerTest, default_xml_generator) {
+ int on_start_counter = 0;
+ bool is_destroyed = false;
+ TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);
+
+ TestEventListeners listeners;
+ TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners, listener);
+
+ EXPECT_EQ(listener, listeners.default_xml_generator());
+
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+
+ EXPECT_EQ(1, on_start_counter);
+
+ // Replacing default_xml_generator with something else should remove it
+ // from the list and destroy it.
+ TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners, NULL);
+
+ EXPECT_TRUE(listeners.default_xml_generator() == NULL);
+ EXPECT_TRUE(is_destroyed);
+
+ // After broadcasting an event the counter is still the same, indicating
+ // the listener is not in the list anymore.
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ EXPECT_EQ(1, on_start_counter);
+}
+
+// Tests that the default_xml_generator listener stops receiving events
+// when removed via Release and that is not owned by the list anymore.
+TEST(EventListenerTest, RemovingDefaultXmlGeneratorWorks) {
+ int on_start_counter = 0;
+ bool is_destroyed = false;
+ // Although Append passes the ownership of this object to the list,
+ // the following calls release it, and we need to delete it before the
+ // test ends.
+ TestListener* listener = new TestListener(&on_start_counter, &is_destroyed);
+ {
+ TestEventListeners listeners;
+ TestEventListenersAccessor::SetDefaultXmlGenerator(&listeners, listener);
+
+ EXPECT_EQ(listener, listeners.Release(listener));
+ EXPECT_TRUE(listeners.default_xml_generator() == NULL);
+ EXPECT_FALSE(is_destroyed);
+
+ // Broadcasting events now should not affect default_xml_generator.
+ TestEventListenersAccessor::GetRepeater(&listeners)->OnTestProgramStart(
+ *UnitTest::GetInstance());
+ EXPECT_EQ(0, on_start_counter);
+ }
+ // Destroying the list should not affect the listener now, too.
+ EXPECT_FALSE(is_destroyed);
+ delete listener;
+}
+
+// Sanity tests to ensure that the alternative, verbose spellings of
+// some of the macros work. We don't test them thoroughly as that
+// would be quite involved. Since their implementations are
+// straightforward, and they are rarely used, we'll just rely on the
+// users to tell us when they are broken.
+GTEST_TEST(AlternativeNameTest, Works) { // GTEST_TEST is the same as TEST.
+ GTEST_SUCCEED() << "OK"; // GTEST_SUCCEED is the same as SUCCEED.
+
+ // GTEST_FAIL is the same as FAIL.
+ EXPECT_FATAL_FAILURE(GTEST_FAIL() << "An expected failure",
+ "An expected failure");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile1_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile1_test_.cc
new file mode 100644
index 0000000..664baad
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile1_test_.cc
@@ -0,0 +1,49 @@
+// Copyright 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.
+//
+// Author: keith.ray@gmail.com (Keith Ray)
+//
+// gtest_xml_outfile1_test_ writes some xml via TestProperty used by
+// gtest_xml_outfiles_test.py
+
+#include <gtest/gtest.h>
+
+class PropertyOne : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ RecordProperty("SetUpProp", 1);
+ }
+ virtual void TearDown() {
+ RecordProperty("TearDownProp", 1);
+ }
+};
+
+TEST_F(PropertyOne, TestSomeProperties) {
+ RecordProperty("TestSomeProperty", 1);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile2_test_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile2_test_.cc
new file mode 100644
index 0000000..3411a3d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfile2_test_.cc
@@ -0,0 +1,49 @@
+// Copyright 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.
+//
+// Author: keith.ray@gmail.com (Keith Ray)
+//
+// gtest_xml_outfile2_test_ writes some xml via TestProperty used by
+// gtest_xml_outfiles_test.py
+
+#include <gtest/gtest.h>
+
+class PropertyTwo : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ RecordProperty("SetUpProp", 2);
+ }
+ virtual void TearDown() {
+ RecordProperty("TearDownProp", 2);
+ }
+};
+
+TEST_F(PropertyTwo, TestSomeProperties) {
+ RecordProperty("TestSomeProperty", 2);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfiles_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfiles_test.py
new file mode 100755
index 0000000..0fe947f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_outfiles_test.py
@@ -0,0 +1,132 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Unit test for the gtest_xml_output module."""
+
+__author__ = "keith.ray@gmail.com (Keith Ray)"
+
+import os
+from xml.dom import minidom, Node
+
+import gtest_test_utils
+import gtest_xml_test_utils
+
+
+GTEST_OUTPUT_SUBDIR = "xml_outfiles"
+GTEST_OUTPUT_1_TEST = "gtest_xml_outfile1_test_"
+GTEST_OUTPUT_2_TEST = "gtest_xml_outfile2_test_"
+
+EXPECTED_XML_1 = """<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="1" failures="0" disabled="0" errors="0" time="*" name="AllTests">
+ <testsuite name="PropertyOne" tests="1" failures="0" disabled="0" errors="0" time="*">
+ <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyOne" SetUpProp="1" TestSomeProperty="1" TearDownProp="1" />
+ </testsuite>
+</testsuites>
+"""
+
+EXPECTED_XML_2 = """<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="1" failures="0" disabled="0" errors="0" time="*" name="AllTests">
+ <testsuite name="PropertyTwo" tests="1" failures="0" disabled="0" errors="0" time="*">
+ <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyTwo" SetUpProp="2" TestSomeProperty="2" TearDownProp="2" />
+ </testsuite>
+</testsuites>
+"""
+
+
+class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase):
+ """Unit test for Google Test's XML output functionality."""
+
+ def setUp(self):
+ # We want the trailing '/' that the last "" provides in os.path.join, for
+ # telling Google Test to create an output directory instead of a single file
+ # for xml output.
+ self.output_dir_ = os.path.join(gtest_test_utils.GetTempDir(),
+ GTEST_OUTPUT_SUBDIR, "")
+ self.DeleteFilesAndDir()
+
+ def tearDown(self):
+ self.DeleteFilesAndDir()
+
+ def DeleteFilesAndDir(self):
+ try:
+ os.remove(os.path.join(self.output_dir_, GTEST_OUTPUT_1_TEST + ".xml"))
+ except os.error:
+ pass
+ try:
+ os.remove(os.path.join(self.output_dir_, GTEST_OUTPUT_2_TEST + ".xml"))
+ except os.error:
+ pass
+ try:
+ os.rmdir(self.output_dir_)
+ except os.error:
+ pass
+
+ def testOutfile1(self):
+ self._TestOutFile(GTEST_OUTPUT_1_TEST, EXPECTED_XML_1)
+
+ def testOutfile2(self):
+ self._TestOutFile(GTEST_OUTPUT_2_TEST, EXPECTED_XML_2)
+
+ def _TestOutFile(self, test_name, expected_xml):
+ gtest_prog_path = gtest_test_utils.GetTestExecutablePath(test_name)
+ command = [gtest_prog_path, "--gtest_output=xml:%s" % self.output_dir_]
+ p = gtest_test_utils.Subprocess(command,
+ working_dir=gtest_test_utils.GetTempDir())
+ self.assert_(p.exited)
+ self.assertEquals(0, p.exit_code)
+
+ # TODO(wan@google.com): libtool causes the built test binary to be
+ # named lt-gtest_xml_outfiles_test_ instead of
+ # gtest_xml_outfiles_test_. To account for this possibillity, we
+ # allow both names in the following code. We should remove this
+ # hack when Chandler Carruth's libtool replacement tool is ready.
+ output_file_name1 = test_name + ".xml"
+ output_file1 = os.path.join(self.output_dir_, output_file_name1)
+ output_file_name2 = 'lt-' + output_file_name1
+ output_file2 = os.path.join(self.output_dir_, output_file_name2)
+ self.assert_(os.path.isfile(output_file1) or os.path.isfile(output_file2),
+ output_file1)
+
+ expected = minidom.parseString(expected_xml)
+ if os.path.isfile(output_file1):
+ actual = minidom.parse(output_file1)
+ else:
+ actual = minidom.parse(output_file2)
+ self.NormalizeXml(actual.documentElement)
+ self.AssertEquivalentNodes(expected.documentElement,
+ actual.documentElement)
+ expected.unlink()
+ actual.unlink()
+
+
+if __name__ == "__main__":
+ os.environ["GTEST_STACK_TRACE_DEPTH"] = "0"
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest.py
new file mode 100755
index 0000000..6d44929
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest.py
@@ -0,0 +1,224 @@
+#!/usr/bin/env python
+#
+# Copyright 2006, 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.
+
+"""Unit test for the gtest_xml_output module"""
+
+__author__ = 'eefacm@gmail.com (Sean Mcafee)'
+
+import errno
+import os
+import sys
+from xml.dom import minidom, Node
+
+import gtest_test_utils
+import gtest_xml_test_utils
+
+
+GTEST_OUTPUT_FLAG = "--gtest_output"
+GTEST_DEFAULT_OUTPUT_FILE = "test_detail.xml"
+GTEST_PROGRAM_NAME = "gtest_xml_output_unittest_"
+
+SUPPORTS_STACK_TRACES = False
+
+if SUPPORTS_STACK_TRACES:
+ STACK_TRACE_TEMPLATE = "\nStack trace:\n*"
+else:
+ STACK_TRACE_TEMPLATE = ""
+
+EXPECTED_NON_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="15" failures="4" disabled="2" errors="0" time="*" name="AllTests">
+ <testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
+ <testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
+ </testsuite>
+ <testsuite name="FailedTest" tests="1" failures="1" disabled="0" errors="0" time="*">
+ <testcase name="Fails" status="run" time="*" classname="FailedTest">
+ <failure message="Value of: 2&#x0A;Expected: 1" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Value of: 2
+Expected: 1%(stack)s]]></failure>
+ </testcase>
+ </testsuite>
+ <testsuite name="MixedResultTest" tests="3" failures="1" disabled="1" errors="0" time="*">
+ <testcase name="Succeeds" status="run" time="*" classname="MixedResultTest"/>
+ <testcase name="Fails" status="run" time="*" classname="MixedResultTest">
+ <failure message="Value of: 2&#x0A;Expected: 1" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Value of: 2
+Expected: 1%(stack)s]]></failure>
+ <failure message="Value of: 3&#x0A;Expected: 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Value of: 3
+Expected: 2%(stack)s]]></failure>
+ </testcase>
+ <testcase name="DISABLED_test" status="notrun" time="*" classname="MixedResultTest"/>
+ </testsuite>
+ <testsuite name="XmlQuotingTest" tests="1" failures="1" disabled="0" errors="0" time="*">
+ <testcase name="OutputsCData" status="run" time="*" classname="XmlQuotingTest">
+ <failure message="Failed&#x0A;XML output: &lt;?xml encoding=&quot;utf-8&quot;&gt;&lt;top&gt;&lt;![CDATA[cdata text]]&gt;&lt;/top&gt;" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Failed
+XML output: <?xml encoding="utf-8"><top><![CDATA[cdata text]]>]]&gt;<![CDATA[</top>%(stack)s]]></failure>
+ </testcase>
+ </testsuite>
+ <testsuite name="InvalidCharactersTest" tests="1" failures="1" disabled="0" errors="0" time="*">
+ <testcase name="InvalidCharactersInMessage" status="run" time="*" classname="InvalidCharactersTest">
+ <failure message="Failed&#x0A;Invalid characters in brackets []" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Failed
+Invalid characters in brackets []%(stack)s]]></failure>
+ </testcase>
+ </testsuite>
+ <testsuite name="DisabledTest" tests="1" failures="0" disabled="1" errors="0" time="*">
+ <testcase name="DISABLED_test_not_run" status="notrun" time="*" classname="DisabledTest"/>
+ </testsuite>
+ <testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*">
+ <testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest" key_1="1"/>
+ <testcase name="IntValuedProperty" status="run" time="*" classname="PropertyRecordingTest" key_int="1"/>
+ <testcase name="ThreeProperties" status="run" time="*" classname="PropertyRecordingTest" key_1="1" key_2="2" key_3="3"/>
+ <testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecordingTest" key_1="2"/>
+ </testsuite>
+ <testsuite name="NoFixtureTest" tests="3" failures="0" disabled="0" errors="0" time="*">
+ <testcase name="RecordProperty" status="run" time="*" classname="NoFixtureTest" key="1"/>
+ <testcase name="ExternalUtilityThatCallsRecordIntValuedProperty" status="run" time="*" classname="NoFixtureTest" key_for_utility_int="1"/>
+ <testcase name="ExternalUtilityThatCallsRecordStringValuedProperty" status="run" time="*" classname="NoFixtureTest" key_for_utility_string="1"/>
+ </testsuite>
+</testsuites>""" % {'stack': STACK_TRACE_TEMPLATE}
+
+
+EXPECTED_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="0" failures="0" disabled="0" errors="0" time="*" name="AllTests">
+</testsuites>"""
+
+
+class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
+ """
+ Unit test for Google Test's XML output functionality.
+ """
+
+ def testNonEmptyXmlOutput(self):
+ """
+ Runs a test program that generates a non-empty XML output, and
+ tests that the XML output is expected.
+ """
+ self._TestXmlOutput(GTEST_PROGRAM_NAME, EXPECTED_NON_EMPTY_XML, 1)
+
+ def testEmptyXmlOutput(self):
+ """
+ Runs a test program that generates an empty XML output, and
+ tests that the XML output is expected.
+ """
+
+ self._TestXmlOutput("gtest_no_test_unittest",
+ EXPECTED_EMPTY_XML, 0)
+
+ def testDefaultOutputFile(self):
+ """
+ Confirms that Google Test produces an XML output file with the expected
+ default name if no name is explicitly specified.
+ """
+ output_file = os.path.join(gtest_test_utils.GetTempDir(),
+ GTEST_DEFAULT_OUTPUT_FILE)
+ gtest_prog_path = gtest_test_utils.GetTestExecutablePath(
+ "gtest_no_test_unittest")
+ try:
+ os.remove(output_file)
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+
+ p = gtest_test_utils.Subprocess(
+ [gtest_prog_path, "%s=xml" % GTEST_OUTPUT_FLAG],
+ working_dir=gtest_test_utils.GetTempDir())
+ self.assert_(p.exited)
+ self.assertEquals(0, p.exit_code)
+ self.assert_(os.path.isfile(output_file))
+
+ def testSuppressedXmlOutput(self):
+ """
+ Tests that no XML file is generated if the default XML listener is
+ shut down before RUN_ALL_TESTS is invoked.
+ """
+
+ xml_path = os.path.join(gtest_test_utils.GetTempDir(),
+ GTEST_PROGRAM_NAME + "out.xml")
+ if os.path.isfile(xml_path):
+ os.remove(xml_path)
+
+ gtest_prog_path = gtest_test_utils.GetTestExecutablePath(GTEST_PROGRAM_NAME)
+
+ command = [gtest_prog_path,
+ "%s=xml:%s" % (GTEST_OUTPUT_FLAG, xml_path),
+ "--shut_down_xml"]
+ p = gtest_test_utils.Subprocess(command)
+ if p.terminated_by_signal:
+ self.assert_(False,
+ "%s was killed by signal %d" % (gtest_prog_name, p.signal))
+ else:
+ self.assert_(p.exited)
+ self.assertEquals(1, p.exit_code,
+ "'%s' exited with code %s, which doesn't match "
+ "the expected exit code %s."
+ % (command, p.exit_code, 1))
+
+ self.assert_(not os.path.isfile(xml_path))
+
+
+ def _TestXmlOutput(self, gtest_prog_name, expected_xml, expected_exit_code):
+ """
+ Asserts that the XML document generated by running the program
+ gtest_prog_name matches expected_xml, a string containing another
+ XML document. Furthermore, the program's exit code must be
+ expected_exit_code.
+ """
+ xml_path = os.path.join(gtest_test_utils.GetTempDir(),
+ gtest_prog_name + "out.xml")
+ gtest_prog_path = gtest_test_utils.GetTestExecutablePath(gtest_prog_name)
+
+ command = [gtest_prog_path, "%s=xml:%s" % (GTEST_OUTPUT_FLAG, xml_path)]
+ p = gtest_test_utils.Subprocess(command)
+ if p.terminated_by_signal:
+ self.assert_(False,
+ "%s was killed by signal %d" % (gtest_prog_name, p.signal))
+ else:
+ self.assert_(p.exited)
+ self.assertEquals(expected_exit_code, p.exit_code,
+ "'%s' exited with code %s, which doesn't match "
+ "the expected exit code %s."
+ % (command, p.exit_code, expected_exit_code))
+
+ expected = minidom.parseString(expected_xml)
+ actual = minidom.parse(xml_path)
+ self.NormalizeXml(actual.documentElement)
+ self.AssertEquivalentNodes(expected.documentElement,
+ actual.documentElement)
+ expected.unlink()
+ actual .unlink()
+
+
+
+if __name__ == '__main__':
+ os.environ['GTEST_STACK_TRACE_DEPTH'] = '1'
+ gtest_test_utils.Main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest_.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest_.cc
new file mode 100644
index 0000000..fc07ef4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_output_unittest_.cc
@@ -0,0 +1,145 @@
+// Copyright 2006, 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: eefacm@gmail.com (Sean Mcafee)
+
+// Unit test for Google Test XML output.
+//
+// A user can specify XML output in a Google Test program to run via
+// either the GTEST_OUTPUT environment variable or the --gtest_output
+// flag. This is used for testing such functionality.
+//
+// This program will be invoked from a Python unit test. Don't run it
+// directly.
+
+#include <gtest/gtest.h>
+
+using ::testing::InitGoogleTest;
+using ::testing::TestEventListeners;
+using ::testing::UnitTest;
+
+class SuccessfulTest : public testing::Test {
+};
+
+TEST_F(SuccessfulTest, Succeeds) {
+ SUCCEED() << "This is a success.";
+ ASSERT_EQ(1, 1);
+}
+
+class FailedTest : public testing::Test {
+};
+
+TEST_F(FailedTest, Fails) {
+ ASSERT_EQ(1, 2);
+}
+
+class DisabledTest : public testing::Test {
+};
+
+TEST_F(DisabledTest, DISABLED_test_not_run) {
+ FAIL() << "Unexpected failure: Disabled test should not be run";
+}
+
+TEST(MixedResultTest, Succeeds) {
+ EXPECT_EQ(1, 1);
+ ASSERT_EQ(1, 1);
+}
+
+TEST(MixedResultTest, Fails) {
+ EXPECT_EQ(1, 2);
+ ASSERT_EQ(2, 3);
+}
+
+TEST(MixedResultTest, DISABLED_test) {
+ FAIL() << "Unexpected failure: Disabled test should not be run";
+}
+
+TEST(XmlQuotingTest, OutputsCData) {
+ FAIL() << "XML output: "
+ "<?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]></top>";
+}
+
+// Helps to test that invalid characters produced by test code do not make
+// it into the XML file.
+TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
+ FAIL() << "Invalid characters in brackets [\x1\x2]";
+}
+
+class PropertyRecordingTest : public testing::Test {
+};
+
+TEST_F(PropertyRecordingTest, OneProperty) {
+ RecordProperty("key_1", "1");
+}
+
+TEST_F(PropertyRecordingTest, IntValuedProperty) {
+ RecordProperty("key_int", 1);
+}
+
+TEST_F(PropertyRecordingTest, ThreeProperties) {
+ RecordProperty("key_1", "1");
+ RecordProperty("key_2", "2");
+ RecordProperty("key_3", "3");
+}
+
+TEST_F(PropertyRecordingTest, TwoValuesForOneKeyUsesLastValue) {
+ RecordProperty("key_1", "1");
+ RecordProperty("key_1", "2");
+}
+
+TEST(NoFixtureTest, RecordProperty) {
+ RecordProperty("key", "1");
+}
+
+void ExternalUtilityThatCallsRecordProperty(const char* key, int value) {
+ testing::Test::RecordProperty(key, value);
+}
+
+void ExternalUtilityThatCallsRecordProperty(const char* key,
+ const char* value) {
+ testing::Test::RecordProperty(key, value);
+}
+
+TEST(NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty) {
+ ExternalUtilityThatCallsRecordProperty("key_for_utility_int", 1);
+}
+
+TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {
+ ExternalUtilityThatCallsRecordProperty("key_for_utility_string", "1");
+}
+
+int main(int argc, char** argv) {
+ InitGoogleTest(&argc, argv);
+
+ if (argc > 1 && strcmp(argv[1], "--shut_down_xml") == 0) {
+ TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
+ delete listeners.Release(listeners.default_xml_generator());
+ }
+ return RUN_ALL_TESTS();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_test_utils.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_test_utils.py
new file mode 100755
index 0000000..c83c3b7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/gtest_xml_test_utils.py
@@ -0,0 +1,172 @@
+#!/usr/bin/env python
+#
+# Copyright 2006, 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.
+
+"""Unit test utilities for gtest_xml_output"""
+
+__author__ = 'eefacm@gmail.com (Sean Mcafee)'
+
+import re
+from xml.dom import minidom, Node
+
+import gtest_test_utils
+
+
+GTEST_OUTPUT_FLAG = "--gtest_output"
+GTEST_DEFAULT_OUTPUT_FILE = "test_detail.xml"
+
+class GTestXMLTestCase(gtest_test_utils.TestCase):
+ """
+ Base class for tests of Google Test's XML output functionality.
+ """
+
+
+ def AssertEquivalentNodes(self, expected_node, actual_node):
+ """
+ Asserts that actual_node (a DOM node object) is equivalent to
+ expected_node (another DOM node object), in that either both of
+ them are CDATA nodes and have the same value, or both are DOM
+ elements and actual_node meets all of the following conditions:
+
+ * It has the same tag name as expected_node.
+ * It has the same set of attributes as expected_node, each with
+ the same value as the corresponding attribute of expected_node.
+ An exception is any attribute named "time", which needs only be
+ convertible to a floating-point number.
+ * It has an equivalent set of child nodes (including elements and
+ CDATA sections) as expected_node. Note that we ignore the
+ order of the children as they are not guaranteed to be in any
+ particular order.
+ """
+
+ if expected_node.nodeType == Node.CDATA_SECTION_NODE:
+ self.assertEquals(Node.CDATA_SECTION_NODE, actual_node.nodeType)
+ self.assertEquals(expected_node.nodeValue, actual_node.nodeValue)
+ return
+
+ self.assertEquals(Node.ELEMENT_NODE, actual_node.nodeType)
+ self.assertEquals(Node.ELEMENT_NODE, expected_node.nodeType)
+ self.assertEquals(expected_node.tagName, actual_node.tagName)
+
+ expected_attributes = expected_node.attributes
+ actual_attributes = actual_node .attributes
+ self.assertEquals(
+ expected_attributes.length, actual_attributes.length,
+ "attribute numbers differ in element " + actual_node.tagName)
+ for i in range(expected_attributes.length):
+ expected_attr = expected_attributes.item(i)
+ actual_attr = actual_attributes.get(expected_attr.name)
+ self.assert_(
+ actual_attr is not None,
+ "expected attribute %s not found in element %s" %
+ (expected_attr.name, actual_node.tagName))
+ self.assertEquals(expected_attr.value, actual_attr.value,
+ " values of attribute %s in element %s differ" %
+ (expected_attr.name, actual_node.tagName))
+
+ expected_children = self._GetChildren(expected_node)
+ actual_children = self._GetChildren(actual_node)
+ self.assertEquals(
+ len(expected_children), len(actual_children),
+ "number of child elements differ in element " + actual_node.tagName)
+ for child_id, child in expected_children.iteritems():
+ self.assert_(child_id in actual_children,
+ '<%s> is not in <%s> (in element %s)' %
+ (child_id, actual_children, actual_node.tagName))
+ self.AssertEquivalentNodes(child, actual_children[child_id])
+
+ identifying_attribute = {
+ "testsuites": "name",
+ "testsuite": "name",
+ "testcase": "name",
+ "failure": "message",
+ }
+
+ def _GetChildren(self, element):
+ """
+ Fetches all of the child nodes of element, a DOM Element object.
+ Returns them as the values of a dictionary keyed by the IDs of the
+ children. For <testsuites>, <testsuite> and <testcase> elements, the ID
+ is the value of their "name" attribute; for <failure> elements, it is
+ the value of the "message" attribute; CDATA sections and non-whitespace
+ text nodes are concatenated into a single CDATA section with ID
+ "detail". An exception is raised if any element other than the above
+ four is encountered, if two child elements with the same identifying
+ attributes are encountered, or if any other type of node is encountered.
+ """
+
+ children = {}
+ for child in element.childNodes:
+ if child.nodeType == Node.ELEMENT_NODE:
+ self.assert_(child.tagName in self.identifying_attribute,
+ "Encountered unknown element <%s>" % child.tagName)
+ childID = child.getAttribute(self.identifying_attribute[child.tagName])
+ self.assert_(childID not in children)
+ children[childID] = child
+ elif child.nodeType in [Node.TEXT_NODE, Node.CDATA_SECTION_NODE]:
+ if "detail" not in children:
+ if (child.nodeType == Node.CDATA_SECTION_NODE or
+ not child.nodeValue.isspace()):
+ children["detail"] = child.ownerDocument.createCDATASection(
+ child.nodeValue)
+ else:
+ children["detail"].nodeValue += child.nodeValue
+ else:
+ self.fail("Encountered unexpected node type %d" % child.nodeType)
+ return children
+
+ def NormalizeXml(self, element):
+ """
+ Normalizes Google Test's XML output to eliminate references to transient
+ information that may change from run to run.
+
+ * The "time" attribute of <testsuites>, <testsuite> and <testcase>
+ elements is replaced with a single asterisk, if it contains
+ only digit characters.
+ * The line number reported in the first line of the "message"
+ attribute of <failure> elements is replaced with a single asterisk.
+ * The directory names in file paths are removed.
+ * The stack traces are removed.
+ """
+
+ if element.tagName in ("testsuites", "testsuite", "testcase"):
+ time = element.getAttributeNode("time")
+ time.value = re.sub(r"^\d+(\.\d+)?$", "*", time.value)
+ elif element.tagName == "failure":
+ for child in element.childNodes:
+ if child.nodeType == Node.CDATA_SECTION_NODE:
+ # Removes the source line number.
+ cdata = re.sub(r"^.*[/\\](.*:)\d+\n", "\\1*\n", child.nodeValue)
+ # Removes the actual stack trace.
+ child.nodeValue = re.sub(r"\nStack trace:\n(.|\n)*",
+ "", cdata)
+ for child in element.childNodes:
+ if child.nodeType == Node.ELEMENT_NODE:
+ self.NormalizeXml(child)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.cc
new file mode 100644
index 0000000..8b8a40b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.cc
@@ -0,0 +1,36 @@
+// Copyright 2006, 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: wan@google.com (Zhanyong Wan)
+//
+// This is part of the unit test for include/gtest/gtest_prod.h.
+
+#include "production.h"
+
+PrivateCode::PrivateCode() : x_(0) {}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.h
new file mode 100644
index 0000000..8f16fff
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/production.h
@@ -0,0 +1,55 @@
+// Copyright 2006, 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: wan@google.com (Zhanyong Wan)
+//
+// This is part of the unit test for include/gtest/gtest_prod.h.
+
+#ifndef GTEST_TEST_PRODUCTION_H_
+#define GTEST_TEST_PRODUCTION_H_
+
+#include <gtest/gtest_prod.h>
+
+class PrivateCode {
+ public:
+ // Declares a friend test that does not use a fixture.
+ FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers);
+
+ // Declares a friend test that uses a fixture.
+ FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers);
+
+ PrivateCode();
+
+ int x() const { return x_; }
+ private:
+ void set_x(int an_x) { x_ = an_x; }
+ int x_;
+};
+
+#endif // GTEST_TEST_PRODUCTION_H_
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util.py
new file mode 100755
index 0000000..9e57931
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util.py
@@ -0,0 +1,466 @@
+# Copyright 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.
+
+"""Provides facilities for running SCons-built Google Test/Mock tests."""
+
+
+import optparse
+import os
+import re
+import sets
+import sys
+
+try:
+ # subrocess module is a preferable way to invoke subprocesses but it may
+ # not be available on MacOS X 10.4.
+ # Suppresses the 'Import not at the top of the file' lint complaint.
+ # pylint: disable-msg=C6204
+ import subprocess
+except ImportError:
+ subprocess = None
+
+HELP_MSG = """Runs the specified tests for %(proj)s.
+
+SYNOPSIS
+ run_tests.py [OPTION]... [BUILD_DIR]... [TEST]...
+
+DESCRIPTION
+ Runs the specified tests (either binary or Python), and prints a
+ summary of the results. BUILD_DIRS will be used to search for the
+ binaries. If no TESTs are specified, all binary tests found in
+ BUILD_DIRs and all Python tests found in the directory test/ (in the
+ %(proj)s root) are run.
+
+ TEST is a name of either a binary or a Python test. A binary test is
+ an executable file named *_test or *_unittest (with the .exe
+ extension on Windows) A Python test is a script named *_test.py or
+ *_unittest.py.
+
+OPTIONS
+ -h, --help
+ Print this help message.
+ -c CONFIGURATIONS
+ Specify build directories via build configurations.
+ CONFIGURATIONS is either a comma-separated list of build
+ configurations or 'all'. Each configuration is equivalent to
+ adding 'scons/build/<configuration>/%(proj)s/scons' to BUILD_DIRs.
+ Specifying -c=all is equivalent to providing all directories
+ listed in KNOWN BUILD DIRECTORIES section below.
+ -a
+ Equivalent to -c=all
+ -b
+ Equivalent to -c=all with the exception that the script will not
+ fail if some of the KNOWN BUILD DIRECTORIES do not exists; the
+ script will simply not run the tests there. 'b' stands for
+ 'built directories'.
+
+RETURN VALUE
+ Returns 0 if all tests are successful; otherwise returns 1.
+
+EXAMPLES
+ run_tests.py
+ Runs all tests for the default build configuration.
+ run_tests.py -a
+ Runs all tests with binaries in KNOWN BUILD DIRECTORIES.
+ run_tests.py -b
+ Runs all tests in KNOWN BUILD DIRECTORIES that have been
+ built.
+ run_tests.py foo/
+ Runs all tests in the foo/ directory and all Python tests in
+ the directory test. The Python tests are instructed to look
+ for binaries in foo/.
+ run_tests.py bar_test.exe test/baz_test.exe foo/ bar/
+ Runs foo/bar_test.exe, bar/bar_test.exe, foo/baz_test.exe, and
+ bar/baz_test.exe.
+ run_tests.py foo bar test/foo_test.py
+ Runs test/foo_test.py twice instructing it to look for its
+ test binaries in the directories foo and bar,
+ correspondingly.
+
+KNOWN BUILD DIRECTORIES
+ run_tests.py knows about directories where the SCons build script
+ deposits its products. These are the directories where run_tests.py
+ will be looking for its binaries. Currently, %(proj)s's SConstruct file
+ defines them as follows (the default build directory is the first one
+ listed in each group):
+ On Windows:
+ <%(proj)s root>/scons/build/win-dbg8/%(proj)s/scons/
+ <%(proj)s root>/scons/build/win-opt8/%(proj)s/scons/
+ On Mac:
+ <%(proj)s root>/scons/build/mac-dbg/%(proj)s/scons/
+ <%(proj)s root>/scons/build/mac-opt/%(proj)s/scons/
+ On other platforms:
+ <%(proj)s root>/scons/build/dbg/%(proj)s/scons/
+ <%(proj)s root>/scons/build/opt/%(proj)s/scons/"""
+
+IS_WINDOWS = os.name == 'nt'
+IS_MAC = os.name == 'posix' and os.uname()[0] == 'Darwin'
+IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]
+
+# Definition of CONFIGS must match that of the build directory names in the
+# SConstruct script. The first list item is the default build configuration.
+if IS_WINDOWS:
+ CONFIGS = ('win-dbg8', 'win-opt8')
+elif IS_MAC:
+ CONFIGS = ('mac-dbg', 'mac-opt')
+else:
+ CONFIGS = ('dbg', 'opt')
+
+if IS_WINDOWS or IS_CYGWIN:
+ PYTHON_TEST_REGEX = re.compile(r'_(unit)?test\.py$', re.IGNORECASE)
+ BINARY_TEST_REGEX = re.compile(r'_(unit)?test(\.exe)?$', re.IGNORECASE)
+ BINARY_TEST_SEARCH_REGEX = re.compile(r'_(unit)?test\.exe$', re.IGNORECASE)
+else:
+ PYTHON_TEST_REGEX = re.compile(r'_(unit)?test\.py$')
+ BINARY_TEST_REGEX = re.compile(r'_(unit)?test$')
+ BINARY_TEST_SEARCH_REGEX = BINARY_TEST_REGEX
+
+
+def _GetGtestBuildDir(injected_os, script_dir, config):
+ """Calculates path to the Google Test SCons build directory."""
+
+ return injected_os.path.normpath(injected_os.path.join(script_dir,
+ 'scons/build',
+ config,
+ 'gtest/scons'))
+
+
+def _GetConfigFromBuildDir(build_dir):
+ """Extracts the configuration name from the build directory."""
+
+ # We don't want to depend on build_dir containing the correct path
+ # separators.
+ m = re.match(r'.*[\\/]([^\\/]+)[\\/][^\\/]+[\\/]scons[\\/]?$', build_dir)
+ if m:
+ return m.group(1)
+ else:
+ print >>sys.stderr, ('%s is an invalid build directory that does not '
+ 'correspond to any configuration.' % (build_dir,))
+ return ''
+
+
+# All paths in this script are either absolute or relative to the current
+# working directory, unless otherwise specified.
+class TestRunner(object):
+ """Provides facilities for running Python and binary tests for Google Test."""
+
+ def __init__(self,
+ script_dir,
+ build_dir_var_name='GTEST_BUILD_DIR',
+ injected_os=os,
+ injected_subprocess=subprocess,
+ injected_build_dir_finder=_GetGtestBuildDir):
+ """Initializes a TestRunner instance.
+
+ Args:
+ script_dir: File path to the calling script.
+ build_dir_var_name: Name of the env variable used to pass the
+ the build directory path to the invoked
+ tests.
+ injected_os: standard os module or a mock/stub for
+ testing.
+ injected_subprocess: standard subprocess module or a mock/stub
+ for testing
+ injected_build_dir_finder: function that determines the path to
+ the build directory.
+ """
+
+ self.os = injected_os
+ self.subprocess = injected_subprocess
+ self.build_dir_finder = injected_build_dir_finder
+ self.build_dir_var_name = build_dir_var_name
+ self.script_dir = script_dir
+
+ def _GetBuildDirForConfig(self, config):
+ """Returns the build directory for a given configuration."""
+
+ return self.build_dir_finder(self.os, self.script_dir, config)
+
+ def _Run(self, args):
+ """Runs the executable with given args (args[0] is the executable name).
+
+ Args:
+ args: Command line arguments for the process.
+
+ Returns:
+ Process's exit code if it exits normally, or -signal if the process is
+ killed by a signal.
+ """
+
+ if self.subprocess:
+ return self.subprocess.Popen(args).wait()
+ else:
+ return self.os.spawnv(self.os.P_WAIT, args[0], args)
+
+ def _RunBinaryTest(self, test):
+ """Runs the binary test given its path.
+
+ Args:
+ test: Path to the test binary.
+
+ Returns:
+ Process's exit code if it exits normally, or -signal if the process is
+ killed by a signal.
+ """
+
+ return self._Run([test])
+
+ def _RunPythonTest(self, test, build_dir):
+ """Runs the Python test script with the specified build directory.
+
+ Args:
+ test: Path to the test's Python script.
+ build_dir: Path to the directory where the test binary is to be found.
+
+ Returns:
+ Process's exit code if it exits normally, or -signal if the process is
+ killed by a signal.
+ """
+
+ old_build_dir = self.os.environ.get(self.build_dir_var_name)
+
+ try:
+ self.os.environ[self.build_dir_var_name] = build_dir
+
+ # If this script is run on a Windows machine that has no association
+ # between the .py extension and a python interpreter, simply passing
+ # the script name into subprocess.Popen/os.spawn will not work.
+ print 'Running %s . . .' % (test,)
+ return self._Run([sys.executable, test])
+
+ finally:
+ if old_build_dir is None:
+ del self.os.environ[self.build_dir_var_name]
+ else:
+ self.os.environ[self.build_dir_var_name] = old_build_dir
+
+ def _FindFilesByRegex(self, directory, regex):
+ """Returns files in a directory whose names match a regular expression.
+
+ Args:
+ directory: Path to the directory to search for files.
+ regex: Regular expression to filter file names.
+
+ Returns:
+ The list of the paths to the files in the directory.
+ """
+
+ return [self.os.path.join(directory, file_name)
+ for file_name in self.os.listdir(directory)
+ if re.search(regex, file_name)]
+
+ # TODO(vladl@google.com): Implement parsing of scons/SConscript to run all
+ # tests defined there when no tests are specified.
+ # TODO(vladl@google.com): Update the docstring after the code is changed to
+ # try to test all builds defined in scons/SConscript.
+ def GetTestsToRun(self,
+ args,
+ named_configurations,
+ built_configurations,
+ available_configurations=CONFIGS,
+ python_tests_to_skip=None):
+ """Determines what tests should be run.
+
+ Args:
+ args: The list of non-option arguments from the command line.
+ named_configurations: The list of configurations specified via -c or -a.
+ built_configurations: True if -b has been specified.
+ available_configurations: a list of configurations available on the
+ current platform, injectable for testing.
+ python_tests_to_skip: a collection of (configuration, python test name)s
+ that need to be skipped.
+
+ Returns:
+ A tuple with 2 elements: the list of Python tests to run and the list of
+ binary tests to run.
+ """
+
+ if named_configurations == 'all':
+ named_configurations = ','.join(available_configurations)
+
+ normalized_args = [self.os.path.normpath(arg) for arg in args]
+
+ # A final list of build directories which will be searched for the test
+ # binaries. First, add directories specified directly on the command
+ # line.
+ build_dirs = filter(self.os.path.isdir, normalized_args)
+
+ # Adds build directories specified via their build configurations using
+ # the -c or -a options.
+ if named_configurations:
+ build_dirs += [self._GetBuildDirForConfig(config)
+ for config in named_configurations.split(',')]
+
+ # Adds KNOWN BUILD DIRECTORIES if -b is specified.
+ if built_configurations:
+ build_dirs += [self._GetBuildDirForConfig(config)
+ for config in available_configurations
+ if self.os.path.isdir(self._GetBuildDirForConfig(config))]
+
+ # If no directories were specified either via -a, -b, -c, or directly, use
+ # the default configuration.
+ elif not build_dirs:
+ build_dirs = [self._GetBuildDirForConfig(available_configurations[0])]
+
+ # Makes sure there are no duplications.
+ build_dirs = sets.Set(build_dirs)
+
+ errors_found = False
+ listed_python_tests = [] # All Python tests listed on the command line.
+ listed_binary_tests = [] # All binary tests listed on the command line.
+
+ test_dir = self.os.path.normpath(self.os.path.join(self.script_dir, 'test'))
+
+ # Sifts through non-directory arguments fishing for any Python or binary
+ # tests and detecting errors.
+ for argument in sets.Set(normalized_args) - build_dirs:
+ if re.search(PYTHON_TEST_REGEX, argument):
+ python_path = self.os.path.join(test_dir,
+ self.os.path.basename(argument))
+ if self.os.path.isfile(python_path):
+ listed_python_tests.append(python_path)
+ else:
+ sys.stderr.write('Unable to find Python test %s' % argument)
+ errors_found = True
+ elif re.search(BINARY_TEST_REGEX, argument):
+ # This script also accepts binary test names prefixed with test/ for
+ # the convenience of typing them (can use path completions in the
+ # shell). Strips test/ prefix from the binary test names.
+ listed_binary_tests.append(self.os.path.basename(argument))
+ else:
+ sys.stderr.write('%s is neither test nor build directory' % argument)
+ errors_found = True
+
+ if errors_found:
+ return None
+
+ user_has_listed_tests = listed_python_tests or listed_binary_tests
+
+ if user_has_listed_tests:
+ selected_python_tests = listed_python_tests
+ else:
+ selected_python_tests = self._FindFilesByRegex(test_dir,
+ PYTHON_TEST_REGEX)
+
+ # TODO(vladl@google.com): skip unbuilt Python tests when -b is specified.
+ python_test_pairs = []
+ for directory in build_dirs:
+ for test in selected_python_tests:
+ config = _GetConfigFromBuildDir(directory)
+ file_name = os.path.basename(test)
+ if python_tests_to_skip and (config, file_name) in python_tests_to_skip:
+ print ('NOTE: %s is skipped for configuration %s, as it does not '
+ 'work there.' % (file_name, config))
+ else:
+ python_test_pairs.append((directory, test))
+
+ binary_test_pairs = []
+ for directory in build_dirs:
+ if user_has_listed_tests:
+ binary_test_pairs.extend(
+ [(directory, self.os.path.join(directory, test))
+ for test in listed_binary_tests])
+ else:
+ tests = self._FindFilesByRegex(directory, BINARY_TEST_SEARCH_REGEX)
+ binary_test_pairs.extend([(directory, test) for test in tests])
+
+ return (python_test_pairs, binary_test_pairs)
+
+ def RunTests(self, python_tests, binary_tests):
+ """Runs Python and binary tests and reports results to the standard output.
+
+ Args:
+ python_tests: List of Python tests to run in the form of tuples
+ (build directory, Python test script).
+ binary_tests: List of binary tests to run in the form of tuples
+ (build directory, binary file).
+
+ Returns:
+ The exit code the program should pass into sys.exit().
+ """
+
+ if python_tests or binary_tests:
+ results = []
+ for directory, test in python_tests:
+ results.append((directory,
+ test,
+ self._RunPythonTest(test, directory) == 0))
+ for directory, test in binary_tests:
+ results.append((directory,
+ self.os.path.basename(test),
+ self._RunBinaryTest(test) == 0))
+
+ failed = [(directory, test)
+ for (directory, test, success) in results
+ if not success]
+ print
+ print '%d tests run.' % len(results)
+ if failed:
+ print 'The following %d tests failed:' % len(failed)
+ for (directory, test) in failed:
+ print '%s in %s' % (test, directory)
+ return 1
+ else:
+ print 'All tests passed!'
+ else: # No tests defined
+ print 'Nothing to test - no tests specified!'
+
+ return 0
+
+
+def ParseArgs(project_name, argv=None, help_callback=None):
+ """Parses the options run_tests.py uses."""
+
+ # Suppresses lint warning on unused arguments. These arguments are
+ # required by optparse, even though they are unused.
+ # pylint: disable-msg=W0613
+ def PrintHelp(option, opt, value, parser):
+ print HELP_MSG % {'proj': project_name}
+ sys.exit(1)
+
+ parser = optparse.OptionParser()
+ parser.add_option('-c',
+ action='store',
+ dest='configurations',
+ default=None)
+ parser.add_option('-a',
+ action='store_const',
+ dest='configurations',
+ default=None,
+ const='all')
+ parser.add_option('-b',
+ action='store_const',
+ dest='built_configurations',
+ default=False,
+ const=True)
+ # Replaces the built-in help with ours.
+ parser.remove_option('-h')
+ parser.add_option('-h', '--help',
+ action='callback',
+ callback=help_callback or PrintHelp)
+ return parser.parse_args(argv)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util_test.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util_test.py
new file mode 100755
index 0000000..9c55726
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/test/run_tests_util_test.py
@@ -0,0 +1,676 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""Tests for run_tests_util.py test runner script."""
+
+__author__ = 'vladl@google.com (Vlad Losev)'
+
+import os
+import re
+import sets
+import unittest
+
+import run_tests_util
+
+
+GTEST_DBG_DIR = 'scons/build/dbg/gtest/scons'
+GTEST_OPT_DIR = 'scons/build/opt/gtest/scons'
+GTEST_OTHER_DIR = 'scons/build/other/gtest/scons'
+
+
+def AddExeExtension(path):
+ """Appends .exe to the path on Windows or Cygwin."""
+
+ if run_tests_util.IS_WINDOWS or run_tests_util.IS_CYGWIN:
+ return path + '.exe'
+ else:
+ return path
+
+
+class FakePath(object):
+ """A fake os.path module for testing."""
+
+ def __init__(self, current_dir=os.getcwd(), known_paths=None):
+ self.current_dir = current_dir
+ self.tree = {}
+ self.path_separator = os.sep
+
+ # known_paths contains either absolute or relative paths. Relative paths
+ # are absolutized with self.current_dir.
+ if known_paths:
+ self._AddPaths(known_paths)
+
+ def _AddPath(self, path):
+ ends_with_slash = path.endswith('/')
+ path = self.abspath(path)
+ if ends_with_slash:
+ path += self.path_separator
+ name_list = path.split(self.path_separator)
+ tree = self.tree
+ for name in name_list[:-1]:
+ if not name:
+ continue
+ if name in tree:
+ tree = tree[name]
+ else:
+ tree[name] = {}
+ tree = tree[name]
+
+ name = name_list[-1]
+ if name:
+ if name in tree:
+ assert tree[name] == 1
+ else:
+ tree[name] = 1
+
+ def _AddPaths(self, paths):
+ for path in paths:
+ self._AddPath(path)
+
+ def PathElement(self, path):
+ """Returns an internal representation of directory tree entry for path."""
+ tree = self.tree
+ name_list = self.abspath(path).split(self.path_separator)
+ for name in name_list:
+ if not name:
+ continue
+ tree = tree.get(name, None)
+ if tree is None:
+ break
+
+ return tree
+
+ # Silences pylint warning about using standard names.
+ # pylint: disable-msg=C6409
+ def normpath(self, path):
+ return os.path.normpath(path)
+
+ def abspath(self, path):
+ return self.normpath(os.path.join(self.current_dir, path))
+
+ def isfile(self, path):
+ return self.PathElement(self.abspath(path)) == 1
+
+ def isdir(self, path):
+ return type(self.PathElement(self.abspath(path))) == type(dict())
+
+ def basename(self, path):
+ return os.path.basename(path)
+
+ def dirname(self, path):
+ return os.path.dirname(path)
+
+ def join(self, *kargs):
+ return os.path.join(*kargs)
+
+
+class FakeOs(object):
+ """A fake os module for testing."""
+ P_WAIT = os.P_WAIT
+
+ def __init__(self, fake_path_module):
+ self.path = fake_path_module
+
+ # Some methods/attributes are delegated to the real os module.
+ self.environ = os.environ
+
+ # pylint: disable-msg=C6409
+ def listdir(self, path):
+ assert self.path.isdir(path)
+ return self.path.PathElement(path).iterkeys()
+
+ def spawnv(self, wait, executable, *kargs):
+ assert wait == FakeOs.P_WAIT
+ return self.spawn_impl(executable, kargs)
+
+
+class GetTestsToRunTest(unittest.TestCase):
+ """Exercises TestRunner.GetTestsToRun."""
+
+ def NormalizeGetTestsToRunResults(self, results):
+ """Normalizes path data returned from GetTestsToRun for comparison."""
+
+ def NormalizePythonTestPair(pair):
+ """Normalizes path data in the (directory, python_script) pair."""
+
+ return (os.path.normpath(pair[0]), os.path.normpath(pair[1]))
+
+ def NormalizeBinaryTestPair(pair):
+ """Normalizes path data in the (directory, binary_executable) pair."""
+
+ directory, executable = map(os.path.normpath, pair)
+
+ # On Windows and Cygwin, the test file names have the .exe extension, but
+ # they can be invoked either by name or by name+extension. Our test must
+ # accommodate both situations.
+ if run_tests_util.IS_WINDOWS or run_tests_util.IS_CYGWIN:
+ executable = re.sub(r'\.exe$', '', executable)
+ return (directory, executable)
+
+ python_tests = sets.Set(map(NormalizePythonTestPair, results[0]))
+ binary_tests = sets.Set(map(NormalizeBinaryTestPair, results[1]))
+ return (python_tests, binary_tests)
+
+ def AssertResultsEqual(self, results, expected):
+ """Asserts results returned by GetTestsToRun equal to expected results."""
+
+ self.assertEqual(self.NormalizeGetTestsToRunResults(results),
+ self.NormalizeGetTestsToRunResults(expected),
+ 'Incorrect set of tests returned:\n%s\nexpected:\n%s' %
+ (results, expected))
+
+ def setUp(self):
+ self.fake_os = FakeOs(FakePath(
+ current_dir=os.path.abspath(os.path.dirname(run_tests_util.__file__)),
+ known_paths=[AddExeExtension(GTEST_DBG_DIR + '/gtest_unittest'),
+ AddExeExtension(GTEST_OPT_DIR + '/gtest_unittest'),
+ 'test/gtest_color_test.py']))
+ self.fake_configurations = ['dbg', 'opt']
+ self.test_runner = run_tests_util.TestRunner(script_dir='.',
+ injected_os=self.fake_os,
+ injected_subprocess=None)
+
+ def testBinaryTestsOnly(self):
+ """Exercises GetTestsToRun with parameters designating binary tests only."""
+
+ # A default build.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_unittest'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]))
+
+ # An explicitly specified directory.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'gtest_unittest'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]))
+
+ # A particular configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_unittest'],
+ 'other',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_OTHER_DIR, GTEST_OTHER_DIR + '/gtest_unittest')]))
+
+ # All available configurations
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_unittest'],
+ 'all',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest'),
+ (GTEST_OPT_DIR, GTEST_OPT_DIR + '/gtest_unittest')]))
+
+ # All built configurations (unbuilt don't cause failure).
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_unittest'],
+ '',
+ True,
+ available_configurations=self.fake_configurations + ['unbuilt']),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest'),
+ (GTEST_OPT_DIR, GTEST_OPT_DIR + '/gtest_unittest')]))
+
+ # A combination of an explicit directory and a configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'gtest_unittest'],
+ 'opt',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest'),
+ (GTEST_OPT_DIR, GTEST_OPT_DIR + '/gtest_unittest')]))
+
+ # Same test specified in an explicit directory and via a configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'gtest_unittest'],
+ 'dbg',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]))
+
+ # All built configurations + explicit directory + explicit configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'gtest_unittest'],
+ 'opt',
+ True,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest'),
+ (GTEST_OPT_DIR, GTEST_OPT_DIR + '/gtest_unittest')]))
+
+ def testPythonTestsOnly(self):
+ """Exercises GetTestsToRun with parameters designating Python tests only."""
+
+ # A default build.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_color_test.py'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ # An explicitly specified directory.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'test/gtest_color_test.py'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ # A particular configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_color_test.py'],
+ 'other',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_OTHER_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ # All available configurations
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['test/gtest_color_test.py'],
+ 'all',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py'),
+ (GTEST_OPT_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ # All built configurations (unbuilt don't cause failure).
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_color_test.py'],
+ '',
+ True,
+ available_configurations=self.fake_configurations + ['unbuilt']),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py'),
+ (GTEST_OPT_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ # A combination of an explicit directory and a configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'gtest_color_test.py'],
+ 'opt',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py'),
+ (GTEST_OPT_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ # Same test specified in an explicit directory and via a configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'gtest_color_test.py'],
+ 'dbg',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ # All built configurations + explicit directory + explicit configuration.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [GTEST_DBG_DIR, 'gtest_color_test.py'],
+ 'opt',
+ True,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py'),
+ (GTEST_OPT_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ def testCombinationOfBinaryAndPythonTests(self):
+ """Exercises GetTestsToRun with mixed binary/Python tests."""
+
+ # Use only default configuration for this test.
+
+ # Neither binary nor Python tests are specified so find all.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]))
+
+ # Specifying both binary and Python tests.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_unittest', 'gtest_color_test.py'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]))
+
+ # Specifying binary tests suppresses Python tests.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_unittest'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]))
+
+ # Specifying Python tests suppresses binary tests.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_color_test.py'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ []))
+
+ def testIgnoresNonTestFiles(self):
+ """Verifies that GetTestsToRun ignores non-test files in the filesystem."""
+
+ self.fake_os = FakeOs(FakePath(
+ current_dir=os.path.abspath(os.path.dirname(run_tests_util.__file__)),
+ known_paths=[AddExeExtension(GTEST_DBG_DIR + '/gtest_nontest'),
+ 'test/']))
+ self.test_runner = run_tests_util.TestRunner(script_dir='.',
+ injected_os=self.fake_os,
+ injected_subprocess=None)
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [],
+ '',
+ True,
+ available_configurations=self.fake_configurations),
+ ([], []))
+
+ def testWorksFromDifferentDir(self):
+ """Exercises GetTestsToRun from a directory different from run_test.py's."""
+
+ # Here we simulate an test script in directory /d/ called from the
+ # directory /a/b/c/.
+ self.fake_os = FakeOs(FakePath(
+ current_dir=os.path.abspath('/a/b/c'),
+ known_paths=[
+ '/a/b/c/',
+ AddExeExtension('/d/' + GTEST_DBG_DIR + '/gtest_unittest'),
+ AddExeExtension('/d/' + GTEST_OPT_DIR + '/gtest_unittest'),
+ '/d/test/gtest_color_test.py']))
+ self.fake_configurations = ['dbg', 'opt']
+ self.test_runner = run_tests_util.TestRunner(script_dir='/d/',
+ injected_os=self.fake_os,
+ injected_subprocess=None)
+ # A binary test.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_unittest'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([],
+ [('/d/' + GTEST_DBG_DIR, '/d/' + GTEST_DBG_DIR + '/gtest_unittest')]))
+
+ # A Python test.
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ ['gtest_color_test.py'],
+ '',
+ False,
+ available_configurations=self.fake_configurations),
+ ([('/d/' + GTEST_DBG_DIR, '/d/test/gtest_color_test.py')], []))
+
+ def testNonTestBinary(self):
+ """Exercises GetTestsToRun with a non-test parameter."""
+
+ self.assert_(
+ not self.test_runner.GetTestsToRun(
+ ['gtest_unittest_not_really'],
+ '',
+ False,
+ available_configurations=self.fake_configurations))
+
+ def testNonExistingPythonTest(self):
+ """Exercises GetTestsToRun with a non-existent Python test parameter."""
+
+ self.assert_(
+ not self.test_runner.GetTestsToRun(
+ ['nonexistent_test.py'],
+ '',
+ False,
+ available_configurations=self.fake_configurations))
+
+ if run_tests_util.IS_WINDOWS or run_tests_util.IS_CYGWIN:
+
+ def testDoesNotPickNonExeFilesOnWindows(self):
+ """Verifies that GetTestsToRun does not find _test files on Windows."""
+
+ self.fake_os = FakeOs(FakePath(
+ current_dir=os.path.abspath(os.path.dirname(run_tests_util.__file__)),
+ known_paths=['/d/' + GTEST_DBG_DIR + '/gtest_test', 'test/']))
+ self.test_runner = run_tests_util.TestRunner(script_dir='.',
+ injected_os=self.fake_os,
+ injected_subprocess=None)
+ self.AssertResultsEqual(
+ self.test_runner.GetTestsToRun(
+ [],
+ '',
+ True,
+ available_configurations=self.fake_configurations),
+ ([], []))
+
+
+class RunTestsTest(unittest.TestCase):
+ """Exercises TestRunner.RunTests."""
+
+ def SpawnSuccess(self, unused_executable, unused_argv):
+ """Fakes test success by returning 0 as an exit code."""
+
+ self.num_spawn_calls += 1
+ return 0
+
+ def SpawnFailure(self, unused_executable, unused_argv):
+ """Fakes test success by returning 1 as an exit code."""
+
+ self.num_spawn_calls += 1
+ return 1
+
+ def setUp(self):
+ self.fake_os = FakeOs(FakePath(
+ current_dir=os.path.abspath(os.path.dirname(run_tests_util.__file__)),
+ known_paths=[
+ AddExeExtension(GTEST_DBG_DIR + '/gtest_unittest'),
+ AddExeExtension(GTEST_OPT_DIR + '/gtest_unittest'),
+ 'test/gtest_color_test.py']))
+ self.fake_configurations = ['dbg', 'opt']
+ self.test_runner = run_tests_util.TestRunner(
+ script_dir=os.path.dirname(__file__) or '.',
+ injected_os=self.fake_os,
+ injected_subprocess=None)
+ self.num_spawn_calls = 0 # A number of calls to spawn.
+
+ def testRunPythonTestSuccess(self):
+ """Exercises RunTests to handle a Python test success."""
+
+ self.fake_os.spawn_impl = self.SpawnSuccess
+ self.assertEqual(
+ self.test_runner.RunTests(
+ [(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ []),
+ 0)
+ self.assertEqual(self.num_spawn_calls, 1)
+
+ def testRunBinaryTestSuccess(self):
+ """Exercises RunTests to handle a binary test success."""
+
+ self.fake_os.spawn_impl = self.SpawnSuccess
+ self.assertEqual(
+ self.test_runner.RunTests(
+ [],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]),
+ 0)
+ self.assertEqual(self.num_spawn_calls, 1)
+
+ def testRunPythonTestFauilure(self):
+ """Exercises RunTests to handle a Python test failure."""
+
+ self.fake_os.spawn_impl = self.SpawnFailure
+ self.assertEqual(
+ self.test_runner.RunTests(
+ [(GTEST_DBG_DIR, 'test/gtest_color_test.py')],
+ []),
+ 1)
+ self.assertEqual(self.num_spawn_calls, 1)
+
+ def testRunBinaryTestFailure(self):
+ """Exercises RunTests to handle a binary test failure."""
+
+ self.fake_os.spawn_impl = self.SpawnFailure
+ self.assertEqual(
+ self.test_runner.RunTests(
+ [],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]),
+ 1)
+ self.assertEqual(self.num_spawn_calls, 1)
+
+ def testCombinedTestSuccess(self):
+ """Exercises RunTests to handle a success of both Python and binary test."""
+
+ self.fake_os.spawn_impl = self.SpawnSuccess
+ self.assertEqual(
+ self.test_runner.RunTests(
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]),
+ 0)
+ self.assertEqual(self.num_spawn_calls, 2)
+
+ def testCombinedTestSuccessAndFailure(self):
+ """Exercises RunTests to handle a success of both Python and binary test."""
+
+ def SpawnImpl(executable, argv):
+ self.num_spawn_calls += 1
+ # Simulates failure of a Python test and success of a binary test.
+ if '.py' in executable or '.py' in argv[0]:
+ return 1
+ else:
+ return 0
+
+ self.fake_os.spawn_impl = SpawnImpl
+ self.assertEqual(
+ self.test_runner.RunTests(
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')],
+ [(GTEST_DBG_DIR, GTEST_DBG_DIR + '/gtest_unittest')]),
+ 0)
+ self.assertEqual(self.num_spawn_calls, 2)
+
+
+class ParseArgsTest(unittest.TestCase):
+ """Exercises ParseArgs."""
+
+ def testNoOptions(self):
+ options, args = run_tests_util.ParseArgs('gtest', argv=['script.py'])
+ self.assertEqual(args, ['script.py'])
+ self.assert_(options.configurations is None)
+ self.assertFalse(options.built_configurations)
+
+ def testOptionC(self):
+ options, args = run_tests_util.ParseArgs(
+ 'gtest', argv=['script.py', '-c', 'dbg'])
+ self.assertEqual(args, ['script.py'])
+ self.assertEqual(options.configurations, 'dbg')
+ self.assertFalse(options.built_configurations)
+
+ def testOptionA(self):
+ options, args = run_tests_util.ParseArgs('gtest', argv=['script.py', '-a'])
+ self.assertEqual(args, ['script.py'])
+ self.assertEqual(options.configurations, 'all')
+ self.assertFalse(options.built_configurations)
+
+ def testOptionB(self):
+ options, args = run_tests_util.ParseArgs('gtest', argv=['script.py', '-b'])
+ self.assertEqual(args, ['script.py'])
+ self.assert_(options.configurations is None)
+ self.assertTrue(options.built_configurations)
+
+ def testOptionCAndOptionB(self):
+ options, args = run_tests_util.ParseArgs(
+ 'gtest', argv=['script.py', '-c', 'dbg', '-b'])
+ self.assertEqual(args, ['script.py'])
+ self.assertEqual(options.configurations, 'dbg')
+ self.assertTrue(options.built_configurations)
+
+ def testOptionH(self):
+ help_called = [False]
+
+ # Suppresses lint warning on unused arguments. These arguments are
+ # required by optparse, even though they are unused.
+ # pylint: disable-msg=W0613
+ def VerifyHelp(option, opt, value, parser):
+ help_called[0] = True
+
+ # Verifies that -h causes the help callback to be called.
+ help_called[0] = False
+ _, args = run_tests_util.ParseArgs(
+ 'gtest', argv=['script.py', '-h'], help_callback=VerifyHelp)
+ self.assertEqual(args, ['script.py'])
+ self.assertTrue(help_called[0])
+
+ # Verifies that --help causes the help callback to be called.
+ help_called[0] = False
+ _, args = run_tests_util.ParseArgs(
+ 'gtest', argv=['script.py', '--help'], help_callback=VerifyHelp)
+ self.assertEqual(args, ['script.py'])
+ self.assertTrue(help_called[0])
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/DebugProject.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/DebugProject.xcconfig
new file mode 100644
index 0000000..3d68157
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/DebugProject.xcconfig
@@ -0,0 +1,30 @@
+//
+// DebugProject.xcconfig
+//
+// These are Debug Configuration project settings for the gtest framework and
+// examples. It is set in the "Based On:" dropdown in the "Project" info
+// dialog.
+// This file is based on the Xcode Configuration files in:
+// http://code.google.com/p/google-toolbox-for-mac/
+//
+
+#include "General.xcconfig"
+
+// No optimization
+GCC_OPTIMIZATION_LEVEL = 0
+
+// Deployment postprocessing is what triggers Xcode to strip, turn it off
+DEPLOYMENT_POSTPROCESSING = NO
+
+// Dead code stripping off
+DEAD_CODE_STRIPPING = NO
+
+// Debug symbols should be on obviously
+GCC_GENERATE_DEBUGGING_SYMBOLS = YES
+
+// Define the DEBUG macro in all debug builds
+OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1
+
+// These are turned off to avoid STL incompatibilities with client code
+// // Turns on special C++ STL checks to "encourage" good STL use
+// GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/FrameworkTarget.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/FrameworkTarget.xcconfig
new file mode 100644
index 0000000..357b1c8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/FrameworkTarget.xcconfig
@@ -0,0 +1,17 @@
+//
+// FrameworkTarget.xcconfig
+//
+// These are Framework target settings for the gtest framework and examples. It
+// is set in the "Based On:" dropdown in the "Target" info dialog.
+// This file is based on the Xcode Configuration files in:
+// http://code.google.com/p/google-toolbox-for-mac/
+//
+
+// Dynamic libs need to be position independent
+GCC_DYNAMIC_NO_PIC = NO
+
+// Dynamic libs should not have their external symbols stripped.
+STRIP_STYLE = non-global
+
+// Let the user install by specifying the $DSTROOT with xcodebuild
+SKIP_INSTALL = NO
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/General.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/General.xcconfig
new file mode 100644
index 0000000..f23e322
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/General.xcconfig
@@ -0,0 +1,41 @@
+//
+// General.xcconfig
+//
+// These are General configuration settings for the gtest framework and
+// examples.
+// This file is based on the Xcode Configuration files in:
+// http://code.google.com/p/google-toolbox-for-mac/
+//
+
+// Build for PPC and Intel, 32- and 64-bit
+ARCHS = i386 x86_64 ppc ppc64
+
+// Zerolink prevents link warnings so turn it off
+ZERO_LINK = NO
+
+// Prebinding considered unhelpful in 10.3 and later
+PREBINDING = NO
+
+// Strictest warning policy
+WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow
+
+// Work around Xcode bugs by using external strip. See:
+// http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html
+SEPARATE_STRIP = YES
+
+// Force C99 dialect
+GCC_C_LANGUAGE_STANDARD = c99
+
+// not sure why apple defaults this on, but it's pretty risky
+ALWAYS_SEARCH_USER_PATHS = NO
+
+// Turn on position dependent code for most cases (overridden where appropriate)
+GCC_DYNAMIC_NO_PIC = YES
+
+// Default SDK and minimum OS version is 10.4
+SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
+MACOSX_DEPLOYMENT_TARGET = 10.4
+GCC_VERSION = 4.0
+
+// VERSIONING BUILD SETTINGS (used in Info.plist)
+GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/ReleaseProject.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/ReleaseProject.xcconfig
new file mode 100644
index 0000000..5349f0a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/ReleaseProject.xcconfig
@@ -0,0 +1,32 @@
+//
+// ReleaseProject.xcconfig
+//
+// These are Release Configuration project settings for the gtest framework
+// and examples. It is set in the "Based On:" dropdown in the "Project" info
+// dialog.
+// This file is based on the Xcode Configuration files in:
+// http://code.google.com/p/google-toolbox-for-mac/
+//
+
+#include "General.xcconfig"
+
+// subconfig/Release.xcconfig
+
+// Optimize for space and size (Apple recommendation)
+GCC_OPTIMIZATION_LEVEL = s
+
+// Deploment postprocessing is what triggers Xcode to strip
+DEPLOYMENT_POSTPROCESSING = YES
+
+// No symbols
+GCC_GENERATE_DEBUGGING_SYMBOLS = NO
+
+// Dead code strip does not affect ObjC code but can help for C
+DEAD_CODE_STRIPPING = YES
+
+// NDEBUG is used by things like assert.h, so define it for general compat.
+// ASSERT going away in release tends to create unused vars.
+OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable
+
+// When we strip we want to strip all symbols in release, but save externals.
+STRIP_STYLE = all
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/StaticLibraryTarget.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/StaticLibraryTarget.xcconfig
new file mode 100644
index 0000000..3922fa5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/StaticLibraryTarget.xcconfig
@@ -0,0 +1,18 @@
+//
+// StaticLibraryTarget.xcconfig
+//
+// These are static library target settings for libgtest.a. It
+// is set in the "Based On:" dropdown in the "Target" info dialog.
+// This file is based on the Xcode Configuration files in:
+// http://code.google.com/p/google-toolbox-for-mac/
+//
+
+// Static libs can be included in bundles so make them position independent
+GCC_DYNAMIC_NO_PIC = NO
+
+// Static libs should not have their internal globals or external symbols
+// stripped.
+STRIP_STYLE = debugging
+
+// Let the user install by specifying the $DSTROOT with xcodebuild
+SKIP_INSTALL = NO
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/TestTarget.xcconfig b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/TestTarget.xcconfig
new file mode 100644
index 0000000..e6652ba
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Config/TestTarget.xcconfig
@@ -0,0 +1,8 @@
+//
+// TestTarget.xcconfig
+//
+// These are Test target settings for the gtest framework and examples. It
+// is set in the "Based On:" dropdown in the "Target" info dialog.
+
+PRODUCT_NAME = $(TARGET_NAME)
+HEADER_SEARCH_PATHS = ../include
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Resources/Info.plist b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Resources/Info.plist
new file mode 100644
index 0000000..9dd28ea
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Resources/Info.plist
@@ -0,0 +1,30 @@
+<?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>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.google.${PRODUCT_NAME}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>GTEST_VERSIONINFO_LONG</string>
+ <key>CFBundleShortVersionString</key>
+ <string>GTEST_VERSIONINFO_SHORT</string>
+ <key>CFBundleGetInfoString</key>
+ <string>${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT}</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>${GTEST_VERSIONINFO_ABOUT}</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+</dict>
+</plist>
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/Info.plist b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/Info.plist
new file mode 100644
index 0000000..f3852ed
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/Info.plist
@@ -0,0 +1,28 @@
+<?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>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.google.gtest.${PRODUCT_NAME:identifier}</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>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+</dict>
+</plist>
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..497617e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj
@@ -0,0 +1,457 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXAggregateTarget section */
+ 4024D162113D7D2400C7059E /* Test */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 4024D169113D7D4600C7059E /* Build configuration list for PBXAggregateTarget "Test" */;
+ buildPhases = (
+ 4024D161113D7D2400C7059E /* ShellScript */,
+ );
+ dependencies = (
+ 4024D166113D7D3100C7059E /* PBXTargetDependency */,
+ );
+ name = Test;
+ productName = TestAndBuild;
+ };
+ 4024D1E9113D83FF00C7059E /* TestAndBuild */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 4024D1F0113D842B00C7059E /* Build configuration list for PBXAggregateTarget "TestAndBuild" */;
+ buildPhases = (
+ );
+ dependencies = (
+ 4024D1ED113D840900C7059E /* PBXTargetDependency */,
+ 4024D1EF113D840D00C7059E /* PBXTargetDependency */,
+ );
+ name = TestAndBuild;
+ productName = TestAndBuild;
+ };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+ 3B7EB1250E5AEE3500C7F239 /* widget.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B7EB1230E5AEE3500C7F239 /* widget.cc */; };
+ 3B7EB1260E5AEE3500C7F239 /* widget.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B7EB1240E5AEE3500C7F239 /* widget.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 3B7EB1280E5AEE4600C7F239 /* widget_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B7EB1270E5AEE4600C7F239 /* widget_test.cc */; };
+ 3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D07F2C80486CC7A007CD1D0 /* Widget.framework */; };
+ 4024D188113D7D7800C7059E /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4024D185113D7D5500C7059E /* libgtest.a */; };
+ 4024D189113D7D7A00C7059E /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4024D183113D7D5500C7059E /* libgtest_main.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 3B07BDF00E3F3FAE00647869 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
+ remoteInfo = gTestExample;
+ };
+ 4024D165113D7D3100C7059E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 3B07BDE90E3F3F9E00647869;
+ remoteInfo = WidgetFrameworkTest;
+ };
+ 4024D1EC113D840900C7059E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
+ remoteInfo = WidgetFramework;
+ };
+ 4024D1EE113D840D00C7059E /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4024D162113D7D2400C7059E;
+ remoteInfo = Test;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WidgetFrameworkTest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 3B7EB1230E5AEE3500C7F239 /* widget.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget.cc; sourceTree = "<group>"; };
+ 3B7EB1240E5AEE3500C7F239 /* widget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = widget.h; sourceTree = "<group>"; };
+ 3B7EB1270E5AEE4600C7F239 /* widget_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget_test.cc; sourceTree = "<group>"; };
+ 4024D183113D7D5500C7059E /* libgtest_main.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest_main.a; path = /usr/local/lib/libgtest_main.a; sourceTree = "<absolute>"; };
+ 4024D185113D7D5500C7059E /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest.a; path = /usr/local/lib/libgtest.a; sourceTree = "<absolute>"; };
+ 4024D1E2113D838200C7059E /* runtests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests.sh; sourceTree = "<group>"; };
+ 8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+ 8D07F2C80486CC7A007CD1D0 /* Widget.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Widget.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 3B07BDE80E3F3F9E00647869 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4024D189113D7D7A00C7059E /* libgtest_main.a in Frameworks */,
+ 4024D188113D7D7800C7059E /* libgtest.a in Frameworks */,
+ 3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8D07F2C30486CC7A007CD1D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 034768DDFF38A45A11DB9C8B /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D07F2C80486CC7A007CD1D0 /* Widget.framework */,
+ 3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 0867D691FE84028FC02AAC07 /* gTestExample */ = {
+ isa = PBXGroup;
+ children = (
+ 4024D1E1113D836C00C7059E /* Scripts */,
+ 08FB77ACFE841707C02AAC07 /* Source */,
+ 089C1665FE841158C02AAC07 /* Resources */,
+ 3B07BE350E4094E400647869 /* Test */,
+ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
+ 034768DDFF38A45A11DB9C8B /* Products */,
+ );
+ name = gTestExample;
+ sourceTree = "<group>";
+ };
+ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 4024D183113D7D5500C7059E /* libgtest_main.a */,
+ 4024D185113D7D5500C7059E /* libgtest.a */,
+ );
+ name = "External Frameworks and Libraries";
+ sourceTree = "<group>";
+ };
+ 089C1665FE841158C02AAC07 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D07F2C70486CC7A007CD1D0 /* Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 08FB77ACFE841707C02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 3B7EB1230E5AEE3500C7F239 /* widget.cc */,
+ 3B7EB1240E5AEE3500C7F239 /* widget.h */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ 3B07BE350E4094E400647869 /* Test */ = {
+ isa = PBXGroup;
+ children = (
+ 3B7EB1270E5AEE4600C7F239 /* widget_test.cc */,
+ );
+ name = Test;
+ sourceTree = "<group>";
+ };
+ 4024D1E1113D836C00C7059E /* Scripts */ = {
+ isa = PBXGroup;
+ children = (
+ 4024D1E2113D838200C7059E /* runtests.sh */,
+ );
+ name = Scripts;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 8D07F2BD0486CC7A007CD1D0 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 3B7EB1260E5AEE3500C7F239 /* widget.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 3B07BDF40E3F3FB600647869 /* Build configuration list for PBXNativeTarget "WidgetFrameworkTest" */;
+ buildPhases = (
+ 3B07BDE70E3F3F9E00647869 /* Sources */,
+ 3B07BDE80E3F3F9E00647869 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 3B07BDF10E3F3FAE00647869 /* PBXTargetDependency */,
+ );
+ name = WidgetFrameworkTest;
+ productName = gTestExampleTest;
+ productReference = 3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */;
+ productType = "com.apple.product-type.tool";
+ };
+ 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "WidgetFramework" */;
+ buildPhases = (
+ 8D07F2C10486CC7A007CD1D0 /* Sources */,
+ 8D07F2C30486CC7A007CD1D0 /* Frameworks */,
+ 8D07F2BD0486CC7A007CD1D0 /* Headers */,
+ 8D07F2BF0486CC7A007CD1D0 /* Resources */,
+ 8D07F2C50486CC7A007CD1D0 /* Rez */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = WidgetFramework;
+ productInstallPath = "$(HOME)/Library/Frameworks";
+ productName = gTestExample;
+ productReference = 8D07F2C80486CC7A007CD1D0 /* Widget.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 0867D690FE84028FC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "WidgetFramework" */;
+ compatibilityVersion = "Xcode 2.4";
+ hasScannedForEncodings = 1;
+ mainGroup = 0867D691FE84028FC02AAC07 /* gTestExample */;
+ productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */,
+ 3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */,
+ 4024D162113D7D2400C7059E /* Test */,
+ 4024D1E9113D83FF00C7059E /* TestAndBuild */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D07F2BF0486CC7A007CD1D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+ 8D07F2C50486CC7A007CD1D0 /* Rez */ = {
+ isa = PBXRezBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 4024D161113D7D2400C7059E /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/bash $SRCROOT/runtests.sh $BUILT_PRODUCTS_DIR/WidgetFrameworkTest\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 3B07BDE70E3F3F9E00647869 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 3B7EB1280E5AEE4600C7F239 /* widget_test.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8D07F2C10486CC7A007CD1D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 3B7EB1250E5AEE3500C7F239 /* widget.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 3B07BDF10E3F3FAE00647869 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */;
+ targetProxy = 3B07BDF00E3F3FAE00647869 /* PBXContainerItemProxy */;
+ };
+ 4024D166113D7D3100C7059E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 3B07BDE90E3F3F9E00647869 /* WidgetFrameworkTest */;
+ targetProxy = 4024D165113D7D3100C7059E /* PBXContainerItemProxy */;
+ };
+ 4024D1ED113D840900C7059E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 8D07F2BC0486CC7A007CD1D0 /* WidgetFramework */;
+ targetProxy = 4024D1EC113D840900C7059E /* PBXContainerItemProxy */;
+ };
+ 4024D1EF113D840D00C7059E /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4024D162113D7D2400C7059E /* Test */;
+ targetProxy = 4024D1EE113D840D00C7059E /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 3B07BDEC0E3F3F9F00647869 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = WidgetFrameworkTest;
+ };
+ name = Debug;
+ };
+ 3B07BDED0E3F3F9F00647869 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = WidgetFrameworkTest;
+ };
+ name = Release;
+ };
+ 4024D163113D7D2400C7059E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = TestAndBuild;
+ };
+ name = Debug;
+ };
+ 4024D164113D7D2400C7059E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = TestAndBuild;
+ };
+ name = Release;
+ };
+ 4024D1EA113D83FF00C7059E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = TestAndBuild;
+ };
+ name = Debug;
+ };
+ 4024D1EB113D83FF00C7059E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = TestAndBuild;
+ };
+ name = Release;
+ };
+ 4FADC24308B4156D00ABE55E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ FRAMEWORK_VERSION = A;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "@loader_path/../Frameworks";
+ PRODUCT_NAME = Widget;
+ };
+ name = Debug;
+ };
+ 4FADC24408B4156D00ABE55E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ FRAMEWORK_VERSION = A;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "@loader_path/../Frameworks";
+ PRODUCT_NAME = Widget;
+ };
+ name = Release;
+ };
+ 4FADC24708B4156D00ABE55E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_VERSION = 4.0;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ };
+ name = Debug;
+ };
+ 4FADC24808B4156D00ABE55E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_VERSION = 4.0;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 3B07BDF40E3F3FB600647869 /* Build configuration list for PBXNativeTarget "WidgetFrameworkTest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 3B07BDEC0E3F3F9F00647869 /* Debug */,
+ 3B07BDED0E3F3F9F00647869 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4024D169113D7D4600C7059E /* Build configuration list for PBXAggregateTarget "Test" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4024D163113D7D2400C7059E /* Debug */,
+ 4024D164113D7D2400C7059E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4024D1F0113D842B00C7059E /* Build configuration list for PBXAggregateTarget "TestAndBuild" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4024D1EA113D83FF00C7059E /* Debug */,
+ 4024D1EB113D83FF00C7059E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "WidgetFramework" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4FADC24308B4156D00ABE55E /* Debug */,
+ 4FADC24408B4156D00ABE55E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "WidgetFramework" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4FADC24708B4156D00ABE55E /* Debug */,
+ 4FADC24808B4156D00ABE55E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/runtests.sh b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/runtests.sh
new file mode 100644
index 0000000..4a0d413
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/runtests.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# Copyright 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.
+
+# Executes the samples and tests for the Google Test Framework.
+
+# Help the dynamic linker find the path to the libraries.
+export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR
+export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR
+
+# Create some executables.
+test_executables=$@
+
+# Now execute each one in turn keeping track of how many succeeded and failed.
+succeeded=0
+failed=0
+failed_list=()
+for test in ${test_executables[*]}; do
+ "$test"
+ result=$?
+ if [ $result -eq 0 ]; then
+ succeeded=$(( $succeeded + 1 ))
+ else
+ failed=$(( failed + 1 ))
+ failed_list="$failed_list $test"
+ fi
+done
+
+# Report the successes and failures to the console.
+echo "Tests complete with $succeeded successes and $failed failures."
+if [ $failed -ne 0 ]; then
+ echo "The following tests failed:"
+ echo $failed_list
+fi
+exit $failed
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.cc
new file mode 100644
index 0000000..bfc4e7f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.cc
@@ -0,0 +1,63 @@
+// Copyright 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.
+//
+// Author: preston.a.jackson@gmail.com (Preston Jackson)
+//
+// Google Test - FrameworkSample
+// widget.cc
+//
+
+// Widget is a very simple class used for demonstrating the use of gtest
+
+#include "widget.h"
+
+Widget::Widget(int number, const std::string& name)
+ : number_(number),
+ name_(name) {}
+
+Widget::~Widget() {}
+
+float Widget::GetFloatValue() const {
+ return number_;
+}
+
+int Widget::GetIntValue() const {
+ return static_cast<int>(number_);
+}
+
+std::string Widget::GetStringValue() const {
+ return name_;
+}
+
+void Widget::GetCharPtrValue(char* buffer, size_t max_size) const {
+ // Copy the char* representation of name_ into buffer, up to max_size.
+ strncpy(buffer, name_.c_str(), max_size-1);
+ buffer[max_size-1] = '\0';
+ return;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.h b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.h
new file mode 100644
index 0000000..0c55cdc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget.h
@@ -0,0 +1,59 @@
+// Copyright 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.
+//
+// Author: preston.a.jackson@gmail.com (Preston Jackson)
+//
+// Google Test - FrameworkSample
+// widget.h
+//
+
+// Widget is a very simple class used for demonstrating the use of gtest. It
+// simply stores two values a string and an integer, which are returned via
+// public accessors in multiple forms.
+
+#import <string>
+
+class Widget {
+ public:
+ Widget(int number, const std::string& name);
+ ~Widget();
+
+ // Public accessors to number data
+ float GetFloatValue() const;
+ int GetIntValue() const;
+
+ // Public accessors to the string data
+ std::string GetStringValue() const;
+ void GetCharPtrValue(char* buffer, size_t max_size) const;
+
+ private:
+ // Data members
+ float number_;
+ std::string name_;
+};
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget_test.cc b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget_test.cc
new file mode 100644
index 0000000..61c0d2f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Samples/FrameworkSample/widget_test.cc
@@ -0,0 +1,68 @@
+// Copyright 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.
+//
+// Author: preston.a.jackson@gmail.com (Preston Jackson)
+//
+// Google Test - FrameworkSample
+// widget_test.cc
+//
+
+// This is a simple test file for the Widget class in the Widget.framework
+
+#include <string>
+#include <gtest/gtest.h>
+
+#include <Widget/widget.h>
+
+// This test verifies that the constructor sets the internal state of the
+// Widget class correctly.
+TEST(WidgetInitializerTest, TestConstructor) {
+ Widget widget(1.0f, "name");
+ EXPECT_FLOAT_EQ(1.0f, widget.GetFloatValue());
+ EXPECT_EQ(std::string("name"), widget.GetStringValue());
+}
+
+// This test verifies the conversion of the float and string values to int and
+// char*, respectively.
+TEST(WidgetInitializerTest, TestConversion) {
+ Widget widget(1.0f, "name");
+ EXPECT_EQ(1, widget.GetIntValue());
+
+ size_t max_size = 128;
+ char buffer[max_size];
+ widget.GetCharPtrValue(buffer, max_size);
+ EXPECT_STREQ("name", buffer);
+}
+
+// Use the Google Test main that is linked into the framework. It does something
+// like this:
+// int main(int argc, char** argv) {
+// testing::InitGoogleTest(&argc, argv);
+// return RUN_ALL_TESTS();
+// }
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/runtests.sh b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/runtests.sh
new file mode 100644
index 0000000..3fc229f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/runtests.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+#
+# Copyright 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.
+
+# Executes the samples and tests for the Google Test Framework.
+
+# Help the dynamic linker find the path to the libraries.
+export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR
+export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR
+
+# Create some executables.
+test_executables=("$BUILT_PRODUCTS_DIR/gtest_unittest-framework"
+ "$BUILT_PRODUCTS_DIR/gtest_unittest"
+ "$BUILT_PRODUCTS_DIR/sample1_unittest-framework"
+ "$BUILT_PRODUCTS_DIR/sample1_unittest-static")
+
+# Now execute each one in turn keeping track of how many succeeded and failed.
+succeeded=0
+failed=0
+failed_list=()
+for test in ${test_executables[*]}; do
+ "$test"
+ result=$?
+ if [ $result -eq 0 ]; then
+ succeeded=$(( $succeeded + 1 ))
+ else
+ failed=$(( failed + 1 ))
+ failed_list="$failed_list $test"
+ fi
+done
+
+# Report the successes and failures to the console.
+echo "Tests complete with $succeeded successes and $failed failures."
+if [ $failed -ne 0 ]; then
+ echo "The following tests failed:"
+ echo $failed_list
+fi
+exit $failed
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/versiongenerate.py b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/versiongenerate.py
new file mode 100644
index 0000000..81de8c9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/Scripts/versiongenerate.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+
+"""A script to prepare version informtion for use the gtest Info.plist file.
+
+ This script extracts the version information from the configure.ac file and
+ uses it to generate a header file containing the same information. The
+ #defines in this header file will be included in during the generation of
+ the Info.plist of the framework, giving the correct value to the version
+ shown in the Finder.
+
+ This script makes the following assumptions (these are faults of the script,
+ not problems with the Autoconf):
+ 1. The AC_INIT macro will be contained within the first 1024 characters
+ of configure.ac
+ 2. The version string will be 3 integers separated by periods and will be
+ surrounded by squre brackets, "[" and "]" (e.g. [1.0.1]). The first
+ segment represents the major version, the second represents the minor
+ version and the third represents the fix version.
+ 3. No ")" character exists between the opening "(" and closing ")" of
+ AC_INIT, including in comments and character strings.
+"""
+
+import sys
+import re
+
+# Read the command line argument (the output directory for Version.h)
+if (len(sys.argv) < 3):
+ print "Usage: versiongenerate.py input_dir output_dir"
+ sys.exit(1)
+else:
+ input_dir = sys.argv[1]
+ output_dir = sys.argv[2]
+
+# Read the first 1024 characters of the configure.ac file
+config_file = open("%s/configure.ac" % input_dir, 'r')
+buffer_size = 1024
+opening_string = config_file.read(buffer_size)
+config_file.close()
+
+# Extract the version string from the AC_INIT macro
+# The following init_expression means:
+# Extract three integers separated by periods and surrounded by squre
+# brackets(e.g. "[1.0.1]") between "AC_INIT(" and ")". Do not be greedy
+# (*? is the non-greedy flag) since that would pull in everything between
+# the first "(" and the last ")" in the file.
+version_expression = re.compile(r"AC_INIT\(.*?\[(\d+)\.(\d+)\.(\d+)\].*?\)",
+ re.DOTALL)
+version_values = version_expression.search(opening_string)
+major_version = version_values.group(1)
+minor_version = version_values.group(2)
+fix_version = version_values.group(3)
+
+# Write the version information to a header file to be included in the
+# Info.plist file.
+file_data = """//
+// DO NOT MODIFY THIS FILE (but you can delete it)
+//
+// This file is autogenerated by the versiongenerate.py script. This script
+// is executed in a "Run Script" build phase when creating gtest.framework. This
+// header file is not used during compilation of C-source. Rather, it simply
+// defines some version strings for substitution in the Info.plist. Because of
+// this, we are not not restricted to C-syntax nor are we using include guards.
+//
+
+#define GTEST_VERSIONINFO_SHORT %s.%s
+#define GTEST_VERSIONINFO_LONG %s.%s.%s
+
+""" % (major_version, minor_version, major_version, minor_version, fix_version)
+version_file = open("%s/Version.h" % output_dir, 'w')
+version_file.write(file_data)
+version_file.close()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/gtest.xcodeproj/project.pbxproj b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/gtest.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..4234e72
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gtest/xcode/gtest.xcodeproj/project.pbxproj
@@ -0,0 +1,1080 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXAggregateTarget section */
+ 3B238F5F0E828B5400846E11 /* Check */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 3B238FA30E828BB600846E11 /* Build configuration list for PBXAggregateTarget "Check" */;
+ buildPhases = (
+ 3B238F5E0E828B5400846E11 /* ShellScript */,
+ );
+ dependencies = (
+ 40899F9D0FFA740F000B29AE /* PBXTargetDependency */,
+ 40C849F7101A43440083642A /* PBXTargetDependency */,
+ 4089A0980FFAD34A000B29AE /* PBXTargetDependency */,
+ 40C849F9101A43490083642A /* PBXTargetDependency */,
+ );
+ name = Check;
+ productName = Check;
+ };
+ 40C44ADC0E3798F4008FCC51 /* Version Info */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 40C44AE40E379905008FCC51 /* Build configuration list for PBXAggregateTarget "Version Info" */;
+ buildPhases = (
+ 40C44ADB0E3798F4008FCC51 /* Generate Version.h */,
+ );
+ comments = "The generation of Version.h must be performed in its own target. Since the Info.plist is preprocessed before any of the other build phases in gtest, the Version.h file would not be ready if included as a build phase of that target.";
+ dependencies = (
+ );
+ name = "Version Info";
+ productName = Version.h;
+ };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+ 224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */ = {isa = PBXBuildFile; fileRef = 224A12A20E9EADCC00BD17FD /* gtest-test-part.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 3BF6F2A00E79B5AD000F2EEE /* gtest-type-util.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */; };
+ 3BF6F2A50E79B616000F2EEE /* gtest-typed-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 404884380E2F799B00CF7658 /* gtest-death-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DB0E2F799B00CF7658 /* gtest-death-test.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 404884390E2F799B00CF7658 /* gtest-message.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DC0E2F799B00CF7658 /* gtest-message.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4048843A0E2F799B00CF7658 /* gtest-spi.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DD0E2F799B00CF7658 /* gtest-spi.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4048843B0E2F799B00CF7658 /* gtest.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DE0E2F799B00CF7658 /* gtest.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883E00E2F799B00CF7658 /* gtest_prod.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 404884500E2F799B00CF7658 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 404883F60E2F799B00CF7658 /* README */; };
+ 404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */; };
+ 404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E30E2F799B00CF7658 /* gtest-filepath.h */; };
+ 404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E40E2F799B00CF7658 /* gtest-internal.h */; };
+ 404884A30E2F7BE600CF7658 /* gtest-port.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E50E2F799B00CF7658 /* gtest-port.h */; };
+ 404884A40E2F7BE600CF7658 /* gtest-string.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E60E2F799B00CF7658 /* gtest-string.h */; };
+ 404884AC0E2F7CD900CF7658 /* CHANGES in Resources */ = {isa = PBXBuildFile; fileRef = 404884A90E2F7CD900CF7658 /* CHANGES */; };
+ 404884AD0E2F7CD900CF7658 /* CONTRIBUTORS in Resources */ = {isa = PBXBuildFile; fileRef = 404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */; };
+ 404884AE0E2F7CD900CF7658 /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = 404884AB0E2F7CD900CF7658 /* COPYING */; };
+ 40899F3A0FFA70D4000B29AE /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A12A10E9EADA700BD17FD /* gtest-all.cc */; };
+ 40899F500FFA7281000B29AE /* gtest-tuple.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 40899F4D0FFA7271000B29AE /* gtest-tuple.h */; };
+ 40899F530FFA72A0000B29AE /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };
+ 4089A0440FFAD1BE000B29AE /* sample1.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02C0FFACF7F000B29AE /* sample1.cc */; };
+ 4089A0460FFAD1BE000B29AE /* sample1_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */; };
+ 40C848FF101A21150083642A /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A12A10E9EADA700BD17FD /* gtest-all.cc */; };
+ 40C84915101A21DF0083642A /* gtest_main.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4048840D0E2F799B00CF7658 /* gtest_main.cc */; };
+ 40C84916101A235B0083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };
+ 40C84921101A23AD0083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };
+ 40C84978101A36540083642A /* libgtest_main.a in Resources */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };
+ 40C84980101A36850083642A /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };
+ 40C84982101A36850083642A /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C848FA101A209C0083642A /* libgtest.a */; };
+ 40C84983101A36850083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };
+ 40C8498F101A36A60083642A /* sample1.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02C0FFACF7F000B29AE /* sample1.cc */; };
+ 40C84990101A36A60083642A /* sample1_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */; };
+ 40C84992101A36A60083642A /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C848FA101A209C0083642A /* libgtest.a */; };
+ 40C84993101A36A60083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C8490B101A217E0083642A /* libgtest_main.a */; };
+ 40C849A2101A37050083642A /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4539C8FF0EC27F6400A70F4C /* gtest.framework */; };
+ 40C849A4101A37150083642A /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4539C8FF0EC27F6400A70F4C /* gtest.framework */; };
+ 4539C9340EC280AE00A70F4C /* gtest-param-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 4539C9330EC280AE00A70F4C /* gtest-param-test.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4539C9380EC280E200A70F4C /* gtest-linked_ptr.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */; };
+ 4539C9390EC280E200A70F4C /* gtest-param-util-generated.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */; };
+ 4539C93A0EC280E200A70F4C /* gtest-param-util.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9370EC280E200A70F4C /* gtest-param-util.h */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 40899F9C0FFA740F000B29AE /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40899F420FFA7184000B29AE;
+ remoteInfo = gtest_unittest;
+ };
+ 4089A0970FFAD34A000B29AE /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4089A0120FFACEFC000B29AE;
+ remoteInfo = sample1_unittest;
+ };
+ 408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C848F9101A209C0083642A;
+ remoteInfo = "gtest-static";
+ };
+ 40C44AE50E379922008FCC51 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C44ADC0E3798F4008FCC51;
+ remoteInfo = Version.h;
+ };
+ 40C8497C101A36850083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C848F9101A209C0083642A;
+ remoteInfo = "gtest-static";
+ };
+ 40C8497E101A36850083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C8490A101A217E0083642A;
+ remoteInfo = "gtest_main-static";
+ };
+ 40C8498B101A36A60083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C848F9101A209C0083642A;
+ remoteInfo = "gtest-static";
+ };
+ 40C8498D101A36A60083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C8490A101A217E0083642A;
+ remoteInfo = "gtest_main-static";
+ };
+ 40C8499B101A36DC0083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C8490A101A217E0083642A;
+ remoteInfo = "gtest_main-static";
+ };
+ 40C8499D101A36E50083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
+ remoteInfo = "gtest-framework";
+ };
+ 40C8499F101A36F10083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
+ remoteInfo = "gtest-framework";
+ };
+ 40C849F6101A43440083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C8497A101A36850083642A;
+ remoteInfo = "gtest_unittest-static";
+ };
+ 40C849F8101A43490083642A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 40C84989101A36A60083642A;
+ remoteInfo = "sample1_unittest-static";
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 404884A50E2F7C0400CF7658 /* Copy Headers Internal */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = Headers/internal;
+ dstSubfolderSpec = 6;
+ files = (
+ 404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */,
+ 404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */,
+ 404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */,
+ 4539C9380EC280E200A70F4C /* gtest-linked_ptr.h in Copy Headers Internal */,
+ 4539C9390EC280E200A70F4C /* gtest-param-util-generated.h in Copy Headers Internal */,
+ 4539C93A0EC280E200A70F4C /* gtest-param-util.h in Copy Headers Internal */,
+ 404884A30E2F7BE600CF7658 /* gtest-port.h in Copy Headers Internal */,
+ 404884A40E2F7BE600CF7658 /* gtest-string.h in Copy Headers Internal */,
+ 40899F500FFA7281000B29AE /* gtest-tuple.h in Copy Headers Internal */,
+ 3BF6F2A00E79B5AD000F2EEE /* gtest-type-util.h in Copy Headers Internal */,
+ );
+ name = "Copy Headers Internal";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 224A12A10E9EADA700BD17FD /* gtest-all.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-all.cc"; sourceTree = "<group>"; };
+ 224A12A20E9EADCC00BD17FD /* gtest-test-part.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "gtest-test-part.h"; sourceTree = "<group>"; };
+ 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_unittest.cc; sourceTree = "<group>"; };
+ 3B87D2100E96B92E000D1852 /* runtests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests.sh; sourceTree = "<group>"; };
+ 3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-type-util.h"; sourceTree = "<group>"; };
+ 3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-typed-test.h"; sourceTree = "<group>"; };
+ 403EE37C0E377822004BD1E2 /* versiongenerate.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = versiongenerate.py; sourceTree = "<group>"; };
+ 404883DB0E2F799B00CF7658 /* gtest-death-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-death-test.h"; sourceTree = "<group>"; };
+ 404883DC0E2F799B00CF7658 /* gtest-message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-message.h"; sourceTree = "<group>"; };
+ 404883DD0E2F799B00CF7658 /* gtest-spi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-spi.h"; sourceTree = "<group>"; };
+ 404883DE0E2F799B00CF7658 /* gtest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest.h; sourceTree = "<group>"; };
+ 404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest_pred_impl.h; sourceTree = "<group>"; };
+ 404883E00E2F799B00CF7658 /* gtest_prod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest_prod.h; sourceTree = "<group>"; };
+ 404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-death-test-internal.h"; sourceTree = "<group>"; };
+ 404883E30E2F799B00CF7658 /* gtest-filepath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-filepath.h"; sourceTree = "<group>"; };
+ 404883E40E2F799B00CF7658 /* gtest-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-internal.h"; sourceTree = "<group>"; };
+ 404883E50E2F799B00CF7658 /* gtest-port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-port.h"; sourceTree = "<group>"; };
+ 404883E60E2F799B00CF7658 /* gtest-string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-string.h"; sourceTree = "<group>"; };
+ 404883F60E2F799B00CF7658 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README; path = ../README; sourceTree = SOURCE_ROOT; };
+ 4048840D0E2F799B00CF7658 /* gtest_main.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_main.cc; sourceTree = "<group>"; };
+ 404884A90E2F7CD900CF7658 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CHANGES; path = ../CHANGES; sourceTree = SOURCE_ROOT; };
+ 404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CONTRIBUTORS; path = ../CONTRIBUTORS; sourceTree = SOURCE_ROOT; };
+ 404884AB0E2F7CD900CF7658 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = SOURCE_ROOT; };
+ 40899F430FFA7184000B29AE /* gtest_unittest-framework */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "gtest_unittest-framework"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 40899F4D0FFA7271000B29AE /* gtest-tuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-tuple.h"; sourceTree = "<group>"; };
+ 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = StaticLibraryTarget.xcconfig; sourceTree = "<group>"; };
+ 4089A0130FFACEFC000B29AE /* sample1_unittest-framework */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "sample1_unittest-framework"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4089A02C0FFACF7F000B29AE /* sample1.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sample1.cc; sourceTree = "<group>"; };
+ 4089A02D0FFACF7F000B29AE /* sample1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sample1.h; sourceTree = "<group>"; };
+ 4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sample1_unittest.cc; sourceTree = "<group>"; };
+ 40C848FA101A209C0083642A /* libgtest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 40C8490B101A217E0083642A /* libgtest_main.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgtest_main.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 40C84987101A36850083642A /* gtest_unittest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = gtest_unittest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 40C84997101A36A60083642A /* sample1_unittest-static */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "sample1_unittest-static"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 40D4CDF10E30E07400294801 /* DebugProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugProject.xcconfig; sourceTree = "<group>"; };
+ 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FrameworkTarget.xcconfig; sourceTree = "<group>"; };
+ 40D4CDF30E30E07400294801 /* General.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = "<group>"; };
+ 40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ReleaseProject.xcconfig; sourceTree = "<group>"; };
+ 40D4CF510E30F5E200294801 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 4539C8FF0EC27F6400A70F4C /* gtest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = gtest.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4539C9330EC280AE00A70F4C /* gtest-param-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-param-test.h"; sourceTree = "<group>"; };
+ 4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-linked_ptr.h"; sourceTree = "<group>"; };
+ 4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-param-util-generated.h"; sourceTree = "<group>"; };
+ 4539C9370EC280E200A70F4C /* gtest-param-util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-param-util.h"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 40899F410FFA7184000B29AE /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C849A4101A37150083642A /* gtest.framework in Frameworks */,
+ 40C84916101A235B0083642A /* libgtest_main.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 4089A0110FFACEFC000B29AE /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C849A2101A37050083642A /* gtest.framework in Frameworks */,
+ 40C84921101A23AD0083642A /* libgtest_main.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 40C84981101A36850083642A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C84982101A36850083642A /* libgtest.a in Frameworks */,
+ 40C84983101A36850083642A /* libgtest_main.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 40C84991101A36A60083642A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C84992101A36A60083642A /* libgtest.a in Frameworks */,
+ 40C84993101A36A60083642A /* libgtest_main.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 034768DDFF38A45A11DB9C8B /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 4539C8FF0EC27F6400A70F4C /* gtest.framework */,
+ 40C848FA101A209C0083642A /* libgtest.a */,
+ 40C8490B101A217E0083642A /* libgtest_main.a */,
+ 40899F430FFA7184000B29AE /* gtest_unittest-framework */,
+ 40C84987101A36850083642A /* gtest_unittest */,
+ 4089A0130FFACEFC000B29AE /* sample1_unittest-framework */,
+ 40C84997101A36A60083642A /* sample1_unittest-static */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 0867D691FE84028FC02AAC07 /* gtest */ = {
+ isa = PBXGroup;
+ children = (
+ 40D4CDF00E30E07400294801 /* Config */,
+ 08FB77ACFE841707C02AAC07 /* Source */,
+ 40D4CF4E0E30F5E200294801 /* Resources */,
+ 403EE37B0E377822004BD1E2 /* Scripts */,
+ 034768DDFF38A45A11DB9C8B /* Products */,
+ );
+ name = gtest;
+ sourceTree = "<group>";
+ };
+ 08FB77ACFE841707C02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 404884A90E2F7CD900CF7658 /* CHANGES */,
+ 404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */,
+ 404884AB0E2F7CD900CF7658 /* COPYING */,
+ 404883F60E2F799B00CF7658 /* README */,
+ 404883D90E2F799B00CF7658 /* include */,
+ 4089A02F0FFACF84000B29AE /* samples */,
+ 404884070E2F799B00CF7658 /* src */,
+ 3B238BF00E7FE13B00846E11 /* test */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ 3B238BF00E7FE13B00846E11 /* test */ = {
+ isa = PBXGroup;
+ children = (
+ 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */,
+ );
+ name = test;
+ path = ../test;
+ sourceTree = SOURCE_ROOT;
+ };
+ 403EE37B0E377822004BD1E2 /* Scripts */ = {
+ isa = PBXGroup;
+ children = (
+ 403EE37C0E377822004BD1E2 /* versiongenerate.py */,
+ 3B87D2100E96B92E000D1852 /* runtests.sh */,
+ );
+ path = Scripts;
+ sourceTree = "<group>";
+ };
+ 404883D90E2F799B00CF7658 /* include */ = {
+ isa = PBXGroup;
+ children = (
+ 404883DA0E2F799B00CF7658 /* gtest */,
+ );
+ name = include;
+ path = ../include;
+ sourceTree = SOURCE_ROOT;
+ };
+ 404883DA0E2F799B00CF7658 /* gtest */ = {
+ isa = PBXGroup;
+ children = (
+ 404883E10E2F799B00CF7658 /* internal */,
+ 224A12A20E9EADCC00BD17FD /* gtest-test-part.h */,
+ 404883DB0E2F799B00CF7658 /* gtest-death-test.h */,
+ 404883DC0E2F799B00CF7658 /* gtest-message.h */,
+ 4539C9330EC280AE00A70F4C /* gtest-param-test.h */,
+ 404883DD0E2F799B00CF7658 /* gtest-spi.h */,
+ 404883DE0E2F799B00CF7658 /* gtest.h */,
+ 404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */,
+ 404883E00E2F799B00CF7658 /* gtest_prod.h */,
+ 3BF6F2A40E79B616000F2EEE /* gtest-typed-test.h */,
+ );
+ path = gtest;
+ sourceTree = "<group>";
+ };
+ 404883E10E2F799B00CF7658 /* internal */ = {
+ isa = PBXGroup;
+ children = (
+ 404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */,
+ 404883E30E2F799B00CF7658 /* gtest-filepath.h */,
+ 404883E40E2F799B00CF7658 /* gtest-internal.h */,
+ 4539C9350EC280E200A70F4C /* gtest-linked_ptr.h */,
+ 4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */,
+ 4539C9370EC280E200A70F4C /* gtest-param-util.h */,
+ 404883E50E2F799B00CF7658 /* gtest-port.h */,
+ 404883E60E2F799B00CF7658 /* gtest-string.h */,
+ 40899F4D0FFA7271000B29AE /* gtest-tuple.h */,
+ 3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */,
+ );
+ path = internal;
+ sourceTree = "<group>";
+ };
+ 404884070E2F799B00CF7658 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ 224A12A10E9EADA700BD17FD /* gtest-all.cc */,
+ 4048840D0E2F799B00CF7658 /* gtest_main.cc */,
+ );
+ name = src;
+ path = ../src;
+ sourceTree = SOURCE_ROOT;
+ };
+ 4089A02F0FFACF84000B29AE /* samples */ = {
+ isa = PBXGroup;
+ children = (
+ 4089A02C0FFACF7F000B29AE /* sample1.cc */,
+ 4089A02D0FFACF7F000B29AE /* sample1.h */,
+ 4089A02E0FFACF7F000B29AE /* sample1_unittest.cc */,
+ );
+ name = samples;
+ path = ../samples;
+ sourceTree = SOURCE_ROOT;
+ };
+ 40D4CDF00E30E07400294801 /* Config */ = {
+ isa = PBXGroup;
+ children = (
+ 40D4CDF10E30E07400294801 /* DebugProject.xcconfig */,
+ 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */,
+ 40D4CDF30E30E07400294801 /* General.xcconfig */,
+ 40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */,
+ 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */,
+ );
+ path = Config;
+ sourceTree = "<group>";
+ };
+ 40D4CF4E0E30F5E200294801 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 40D4CF510E30F5E200294801 /* Info.plist */,
+ );
+ path = Resources;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 8D07F2BD0486CC7A007CD1D0 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 404884380E2F799B00CF7658 /* gtest-death-test.h in Headers */,
+ 404884390E2F799B00CF7658 /* gtest-message.h in Headers */,
+ 4539C9340EC280AE00A70F4C /* gtest-param-test.h in Headers */,
+ 3BF6F2A50E79B616000F2EEE /* gtest-typed-test.h in Headers */,
+ 4048843A0E2F799B00CF7658 /* gtest-spi.h in Headers */,
+ 4048843B0E2F799B00CF7658 /* gtest.h in Headers */,
+ 4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */,
+ 4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */,
+ 224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 40899F420FFA7184000B29AE /* gtest_unittest-framework */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 40899F4A0FFA71BC000B29AE /* Build configuration list for PBXNativeTarget "gtest_unittest-framework" */;
+ buildPhases = (
+ 40899F400FFA7184000B29AE /* Sources */,
+ 40899F410FFA7184000B29AE /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 40C849A0101A36F10083642A /* PBXTargetDependency */,
+ );
+ name = "gtest_unittest-framework";
+ productName = gtest_unittest;
+ productReference = 40899F430FFA7184000B29AE /* gtest_unittest-framework */;
+ productType = "com.apple.product-type.tool";
+ };
+ 4089A0120FFACEFC000B29AE /* sample1_unittest-framework */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4089A0240FFACF01000B29AE /* Build configuration list for PBXNativeTarget "sample1_unittest-framework" */;
+ buildPhases = (
+ 4089A0100FFACEFC000B29AE /* Sources */,
+ 4089A0110FFACEFC000B29AE /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 40C8499E101A36E50083642A /* PBXTargetDependency */,
+ );
+ name = "sample1_unittest-framework";
+ productName = sample1_unittest;
+ productReference = 4089A0130FFACEFC000B29AE /* sample1_unittest-framework */;
+ productType = "com.apple.product-type.tool";
+ };
+ 40C848F9101A209C0083642A /* gtest-static */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 40C84902101A212E0083642A /* Build configuration list for PBXNativeTarget "gtest-static" */;
+ buildPhases = (
+ 40C848F7101A209C0083642A /* Sources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "gtest-static";
+ productName = "gtest-static";
+ productReference = 40C848FA101A209C0083642A /* libgtest.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 40C8490A101A217E0083642A /* gtest_main-static */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 40C84912101A21D20083642A /* Build configuration list for PBXNativeTarget "gtest_main-static" */;
+ buildPhases = (
+ 40C84908101A217E0083642A /* Sources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "gtest_main-static";
+ productName = "gtest_main-static";
+ productReference = 40C8490B101A217E0083642A /* libgtest_main.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 40C8497A101A36850083642A /* gtest_unittest-static */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 40C84984101A36850083642A /* Build configuration list for PBXNativeTarget "gtest_unittest-static" */;
+ buildPhases = (
+ 40C8497F101A36850083642A /* Sources */,
+ 40C84981101A36850083642A /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 40C8497B101A36850083642A /* PBXTargetDependency */,
+ 40C8497D101A36850083642A /* PBXTargetDependency */,
+ );
+ name = "gtest_unittest-static";
+ productName = gtest_unittest;
+ productReference = 40C84987101A36850083642A /* gtest_unittest */;
+ productType = "com.apple.product-type.tool";
+ };
+ 40C84989101A36A60083642A /* sample1_unittest-static */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 40C84994101A36A60083642A /* Build configuration list for PBXNativeTarget "sample1_unittest-static" */;
+ buildPhases = (
+ 40C8498E101A36A60083642A /* Sources */,
+ 40C84991101A36A60083642A /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 40C8498A101A36A60083642A /* PBXTargetDependency */,
+ 40C8498C101A36A60083642A /* PBXTargetDependency */,
+ );
+ name = "sample1_unittest-static";
+ productName = sample1_unittest;
+ productReference = 40C84997101A36A60083642A /* sample1_unittest-static */;
+ productType = "com.apple.product-type.tool";
+ };
+ 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "gtest-framework" */;
+ buildPhases = (
+ 8D07F2C10486CC7A007CD1D0 /* Sources */,
+ 8D07F2BD0486CC7A007CD1D0 /* Headers */,
+ 404884A50E2F7C0400CF7658 /* Copy Headers Internal */,
+ 8D07F2BF0486CC7A007CD1D0 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 40C44AE60E379922008FCC51 /* PBXTargetDependency */,
+ 408BEC101046CFE900DEF522 /* PBXTargetDependency */,
+ 40C8499C101A36DC0083642A /* PBXTargetDependency */,
+ );
+ name = "gtest-framework";
+ productInstallPath = "$(HOME)/Library/Frameworks";
+ productName = gtest;
+ productReference = 4539C8FF0EC27F6400A70F4C /* gtest.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 0867D690FE84028FC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "gtest" */;
+ compatibilityVersion = "Xcode 2.4";
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ en,
+ );
+ mainGroup = 0867D691FE84028FC02AAC07 /* gtest */;
+ productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */,
+ 40C848F9101A209C0083642A /* gtest-static */,
+ 40C8490A101A217E0083642A /* gtest_main-static */,
+ 40899F420FFA7184000B29AE /* gtest_unittest-framework */,
+ 40C8497A101A36850083642A /* gtest_unittest-static */,
+ 4089A0120FFACEFC000B29AE /* sample1_unittest-framework */,
+ 40C84989101A36A60083642A /* sample1_unittest-static */,
+ 3B238F5F0E828B5400846E11 /* Check */,
+ 40C44ADC0E3798F4008FCC51 /* Version Info */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D07F2BF0486CC7A007CD1D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 404884500E2F799B00CF7658 /* README in Resources */,
+ 404884AC0E2F7CD900CF7658 /* CHANGES in Resources */,
+ 404884AD0E2F7CD900CF7658 /* CONTRIBUTORS in Resources */,
+ 404884AE0E2F7CD900CF7658 /* COPYING in Resources */,
+ 40C84978101A36540083642A /* libgtest_main.a in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3B238F5E0E828B5400846E11 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Remember, this \"Run Script\" build phase will be executed from $SRCROOT\n/bin/bash Scripts/runtests.sh";
+ };
+ 40C44ADB0E3798F4008FCC51 /* Generate Version.h */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(SRCROOT)/Scripts/versiongenerate.py",
+ "$(SRCROOT)/../configure.ac",
+ );
+ name = "Generate Version.h";
+ outputPaths = (
+ "$(PROJECT_TEMP_DIR)/Version.h",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Remember, this \"Run Script\" build phase will be executed from $SRCROOT\n/usr/bin/python Scripts/versiongenerate.py ../ $PROJECT_TEMP_DIR";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 40899F400FFA7184000B29AE /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40899F530FFA72A0000B29AE /* gtest_unittest.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 4089A0100FFACEFC000B29AE /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4089A0440FFAD1BE000B29AE /* sample1.cc in Sources */,
+ 4089A0460FFAD1BE000B29AE /* sample1_unittest.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 40C848F7101A209C0083642A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C848FF101A21150083642A /* gtest-all.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 40C84908101A217E0083642A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C84915101A21DF0083642A /* gtest_main.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 40C8497F101A36850083642A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C84980101A36850083642A /* gtest_unittest.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 40C8498E101A36A60083642A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40C8498F101A36A60083642A /* sample1.cc in Sources */,
+ 40C84990101A36A60083642A /* sample1_unittest.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8D07F2C10486CC7A007CD1D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 40899F3A0FFA70D4000B29AE /* gtest-all.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 40899F9D0FFA740F000B29AE /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40899F420FFA7184000B29AE /* gtest_unittest-framework */;
+ targetProxy = 40899F9C0FFA740F000B29AE /* PBXContainerItemProxy */;
+ };
+ 4089A0980FFAD34A000B29AE /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4089A0120FFACEFC000B29AE /* sample1_unittest-framework */;
+ targetProxy = 4089A0970FFAD34A000B29AE /* PBXContainerItemProxy */;
+ };
+ 408BEC101046CFE900DEF522 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C848F9101A209C0083642A /* gtest-static */;
+ targetProxy = 408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */;
+ };
+ 40C44AE60E379922008FCC51 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C44ADC0E3798F4008FCC51 /* Version Info */;
+ targetProxy = 40C44AE50E379922008FCC51 /* PBXContainerItemProxy */;
+ };
+ 40C8497B101A36850083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C848F9101A209C0083642A /* gtest-static */;
+ targetProxy = 40C8497C101A36850083642A /* PBXContainerItemProxy */;
+ };
+ 40C8497D101A36850083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C8490A101A217E0083642A /* gtest_main-static */;
+ targetProxy = 40C8497E101A36850083642A /* PBXContainerItemProxy */;
+ };
+ 40C8498A101A36A60083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C848F9101A209C0083642A /* gtest-static */;
+ targetProxy = 40C8498B101A36A60083642A /* PBXContainerItemProxy */;
+ };
+ 40C8498C101A36A60083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C8490A101A217E0083642A /* gtest_main-static */;
+ targetProxy = 40C8498D101A36A60083642A /* PBXContainerItemProxy */;
+ };
+ 40C8499C101A36DC0083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C8490A101A217E0083642A /* gtest_main-static */;
+ targetProxy = 40C8499B101A36DC0083642A /* PBXContainerItemProxy */;
+ };
+ 40C8499E101A36E50083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */;
+ targetProxy = 40C8499D101A36E50083642A /* PBXContainerItemProxy */;
+ };
+ 40C849A0101A36F10083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 8D07F2BC0486CC7A007CD1D0 /* gtest-framework */;
+ targetProxy = 40C8499F101A36F10083642A /* PBXContainerItemProxy */;
+ };
+ 40C849F7101A43440083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C8497A101A36850083642A /* gtest_unittest-static */;
+ targetProxy = 40C849F6101A43440083642A /* PBXContainerItemProxy */;
+ };
+ 40C849F9101A43490083642A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 40C84989101A36A60083642A /* sample1_unittest-static */;
+ targetProxy = 40C849F8101A43490083642A /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 3B238F600E828B5400846E11 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ PRODUCT_NAME = Check;
+ };
+ name = Debug;
+ };
+ 3B238F610E828B5400846E11 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ PRODUCT_NAME = Check;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 40899F450FFA7185000B29AE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = ../;
+ PRODUCT_NAME = "gtest_unittest-framework";
+ };
+ name = Debug;
+ };
+ 40899F460FFA7185000B29AE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = ../;
+ PRODUCT_NAME = "gtest_unittest-framework";
+ };
+ name = Release;
+ };
+ 4089A0150FFACEFD000B29AE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "sample1_unittest-framework";
+ };
+ name = Debug;
+ };
+ 4089A0160FFACEFD000B29AE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "sample1_unittest-framework";
+ };
+ name = Release;
+ };
+ 40C44ADF0E3798F4008FCC51 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = gtest;
+ TARGET_NAME = gtest;
+ };
+ name = Debug;
+ };
+ 40C44AE00E3798F4008FCC51 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = gtest;
+ TARGET_NAME = gtest;
+ };
+ name = Release;
+ };
+ 40C848FB101A209D0083642A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
+ buildSettings = {
+ GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
+ GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+ HEADER_SEARCH_PATHS = (
+ ../,
+ ../include/,
+ );
+ PRODUCT_NAME = gtest;
+ };
+ name = Debug;
+ };
+ 40C848FC101A209D0083642A /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
+ buildSettings = {
+ GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
+ GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+ HEADER_SEARCH_PATHS = (
+ ../,
+ ../include/,
+ );
+ PRODUCT_NAME = gtest;
+ };
+ name = Release;
+ };
+ 40C8490E101A217F0083642A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ ../,
+ ../include/,
+ );
+ PRODUCT_NAME = gtest_main;
+ };
+ name = Debug;
+ };
+ 40C8490F101A217F0083642A /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ ../,
+ ../include/,
+ );
+ PRODUCT_NAME = gtest_main;
+ };
+ name = Release;
+ };
+ 40C84985101A36850083642A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = ../;
+ PRODUCT_NAME = gtest_unittest;
+ };
+ name = Debug;
+ };
+ 40C84986101A36850083642A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = ../;
+ PRODUCT_NAME = gtest_unittest;
+ };
+ name = Release;
+ };
+ 40C84995101A36A60083642A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "sample1_unittest-static";
+ };
+ name = Debug;
+ };
+ 40C84996101A36A60083642A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "sample1_unittest-static";
+ };
+ name = Release;
+ };
+ 4FADC24308B4156D00ABE55E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ HEADER_SEARCH_PATHS = (
+ ../,
+ ../include/,
+ );
+ INFOPLIST_FILE = Resources/Info.plist;
+ INFOPLIST_PREFIX_HEADER = "$(PROJECT_TEMP_DIR)/Version.h";
+ INFOPLIST_PREPROCESS = YES;
+ PRODUCT_NAME = gtest;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Debug;
+ };
+ 4FADC24408B4156D00ABE55E /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ HEADER_SEARCH_PATHS = (
+ ../,
+ ../include/,
+ );
+ INFOPLIST_FILE = Resources/Info.plist;
+ INFOPLIST_PREFIX_HEADER = "$(PROJECT_TEMP_DIR)/Version.h";
+ INFOPLIST_PREPROCESS = YES;
+ PRODUCT_NAME = gtest;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Release;
+ };
+ 4FADC24708B4156D00ABE55E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40D4CDF10E30E07400294801 /* DebugProject.xcconfig */;
+ buildSettings = {
+ };
+ name = Debug;
+ };
+ 4FADC24808B4156D00ABE55E /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */;
+ buildSettings = {
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 3B238FA30E828BB600846E11 /* Build configuration list for PBXAggregateTarget "Check" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 3B238F600E828B5400846E11 /* Debug */,
+ 3B238F610E828B5400846E11 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 40899F4A0FFA71BC000B29AE /* Build configuration list for PBXNativeTarget "gtest_unittest-framework" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 40899F450FFA7185000B29AE /* Debug */,
+ 40899F460FFA7185000B29AE /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4089A0240FFACF01000B29AE /* Build configuration list for PBXNativeTarget "sample1_unittest-framework" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4089A0150FFACEFD000B29AE /* Debug */,
+ 4089A0160FFACEFD000B29AE /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 40C44AE40E379905008FCC51 /* Build configuration list for PBXAggregateTarget "Version Info" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 40C44ADF0E3798F4008FCC51 /* Debug */,
+ 40C44AE00E3798F4008FCC51 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 40C84902101A212E0083642A /* Build configuration list for PBXNativeTarget "gtest-static" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 40C848FB101A209D0083642A /* Debug */,
+ 40C848FC101A209D0083642A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 40C84912101A21D20083642A /* Build configuration list for PBXNativeTarget "gtest_main-static" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 40C8490E101A217F0083642A /* Debug */,
+ 40C8490F101A217F0083642A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 40C84984101A36850083642A /* Build configuration list for PBXNativeTarget "gtest_unittest-static" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 40C84985101A36850083642A /* Debug */,
+ 40C84986101A36850083642A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 40C84994101A36A60083642A /* Build configuration list for PBXNativeTarget "sample1_unittest-static" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 40C84995101A36A60083642A /* Debug */,
+ 40C84996101A36A60083642A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "gtest-framework" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4FADC24308B4156D00ABE55E /* Debug */,
+ 4FADC24408B4156D00ABE55E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "gtest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4FADC24708B4156D00ABE55E /* Debug */,
+ 4FADC24808B4156D00ABE55E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/AUTHORS b/src/3rdparty/webkit/Source/ThirdParty/gyp/AUTHORS
new file mode 100644
index 0000000..f0b6752
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/AUTHORS
@@ -0,0 +1,5 @@
+# Names should be added to this file like so:
+# Name or Organization <email address>
+
+Google Inc.
+Steven Knight <knight@baldmt.com>
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/DEPS b/src/3rdparty/webkit/Source/ThirdParty/gyp/DEPS
new file mode 100644
index 0000000..0e56c06
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/DEPS
@@ -0,0 +1,8 @@
+# DEPS file for gclient use in buildbot execution of gyp tests.
+#
+# (You don't need to use gclient for normal GYP development work.)
+
+deps = {
+ "scons":
+ "http://src.chromium.org/svn/trunk/src/third_party/scons@44099",
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/LICENSE b/src/3rdparty/webkit/Source/ThirdParty/gyp/LICENSE
new file mode 100644
index 0000000..ab6b011
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/LICENSE
@@ -0,0 +1,27 @@
+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.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/MANIFEST b/src/3rdparty/webkit/Source/ThirdParty/gyp/MANIFEST
new file mode 100644
index 0000000..925ecc1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/MANIFEST
@@ -0,0 +1,21 @@
+setup.py
+gyp
+LICENSE
+AUTHORS
+pylib/gyp/MSVSNew.py
+pylib/gyp/MSVSProject.py
+pylib/gyp/MSVSToolFile.py
+pylib/gyp/MSVSUserFile.py
+pylib/gyp/MSVSVersion.py
+pylib/gyp/SCons.py
+pylib/gyp/__init__.py
+pylib/gyp/common.py
+pylib/gyp/input.py
+pylib/gyp/xcodeproj_file.py
+pylib/gyp/generator/__init__.py
+pylib/gyp/generator/gypd.py
+pylib/gyp/generator/gypsh.py
+pylib/gyp/generator/make.py
+pylib/gyp/generator/msvs.py
+pylib/gyp/generator/scons.py
+pylib/gyp/generator/xcode.py
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/PRESUBMIT.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/PRESUBMIT.py
new file mode 100755
index 0000000..4c99288
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/PRESUBMIT.py
@@ -0,0 +1,53 @@
+# 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.
+
+
+EXCLUDED_PATHS = ()
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ report = []
+ black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDED_PATHS
+ sources = lambda x: input_api.FilterSourceFile(x, black_list=black_list)
+ report.extend(input_api.canned_checks.CheckChangeSvnEolStyle(
+ input_api, output_api, sources))
+ return report
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ report = []
+ black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDED_PATHS
+ sources = lambda x: input_api.FilterSourceFile(x, black_list=black_list)
+ report.extend(input_api.canned_checks.CheckChangeSvnEolStyle(
+ input_api, output_api, sources))
+ report.extend(input_api.canned_checks.CheckTreeIsOpen(
+ input_api, output_api,
+ 'http://gyp-status.appspot.com/status',
+ 'http://gyp-status.appspot.com/current'))
+ return report
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/README.WebKit b/src/3rdparty/webkit/Source/ThirdParty/gyp/README.WebKit
new file mode 100644
index 0000000..9eed075
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/README.WebKit
@@ -0,0 +1 @@
+This directory is a copy of http://gyp.googlecode.com/svn/trunk/ at revision 903.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/codereview.settings b/src/3rdparty/webkit/Source/ThirdParty/gyp/codereview.settings
new file mode 100644
index 0000000..a04a244
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/codereview.settings
@@ -0,0 +1,10 @@
+# This file is used by gcl to get repository specific information.
+CODE_REVIEW_SERVER: codereview.chromium.org
+CC_LIST: gyp-developer@googlegroups.com
+VIEW_VC: http://code.google.com/p/gyp/source/detail?r=
+TRY_ON_UPLOAD: True
+TRYSERVER_PROJECT: gyp
+TRYSERVER_PATCHLEVEL: 0
+TRYSERVER_ROOT: trunk
+TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-nacl
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp
new file mode 100755
index 0000000..d52e711
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+# TODO(mark): sys.path manipulation is some temporary testing stuff.
+try:
+ import gyp
+except ImportError, e:
+ import os.path
+ sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib'))
+ import gyp
+
+if __name__ == '__main__':
+ sys.exit(gyp.main(sys.argv[1:]))
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp.bat b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp.bat
new file mode 100755
index 0000000..91ebf1e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp.bat
@@ -0,0 +1,5 @@
+@rem Copyright (c) 2009 Google Inc. All rights reserved.
+@rem Use of this source code is governed by a BSD-style license that can be
+@rem found in the LICENSE file.
+
+@python "%~dp0/gyp" %*
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp_dummy.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp_dummy.c
new file mode 100644
index 0000000..fb55bbc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyp_dummy.c
@@ -0,0 +1,7 @@
+/* Copyright (c) 2009 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+int main() {
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/gyptest.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyptest.py
new file mode 100755
index 0000000..d9677db
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/gyptest.py
@@ -0,0 +1,255 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+__doc__ = """
+gyptest.py -- test runner for GYP tests.
+"""
+
+import os
+import optparse
+import subprocess
+import sys
+
+class CommandRunner:
+ """
+ Executor class for commands, including "commands" implemented by
+ Python functions.
+ """
+ verbose = True
+ active = True
+
+ def __init__(self, dictionary={}):
+ self.subst_dictionary(dictionary)
+
+ def subst_dictionary(self, dictionary):
+ self._subst_dictionary = dictionary
+
+ def subst(self, string, dictionary=None):
+ """
+ Substitutes (via the format operator) the values in the specified
+ dictionary into the specified command.
+
+ The command can be an (action, string) tuple. In all cases, we
+ perform substitution on strings and don't worry if something isn't
+ a string. (It's probably a Python function to be executed.)
+ """
+ if dictionary is None:
+ dictionary = self._subst_dictionary
+ if dictionary:
+ try:
+ string = string % dictionary
+ except TypeError:
+ pass
+ return string
+
+ def display(self, command, stdout=None, stderr=None):
+ if not self.verbose:
+ return
+ if type(command) == type(()):
+ func = command[0]
+ args = command[1:]
+ s = '%s(%s)' % (func.__name__, ', '.join(map(repr, args)))
+ if type(command) == type([]):
+ # TODO: quote arguments containing spaces
+ # TODO: handle meta characters?
+ s = ' '.join(command)
+ else:
+ s = self.subst(command)
+ if not s.endswith('\n'):
+ s += '\n'
+ sys.stdout.write(s)
+ sys.stdout.flush()
+
+ def execute(self, command, stdout=None, stderr=None):
+ """
+ Executes a single command.
+ """
+ if not self.active:
+ return 0
+ if type(command) == type(''):
+ command = self.subst(command)
+ cmdargs = shlex.split(command)
+ if cmdargs[0] == 'cd':
+ command = (os.chdir,) + tuple(cmdargs[1:])
+ if type(command) == type(()):
+ func = command[0]
+ args = command[1:]
+ return func(*args)
+ else:
+ if stdout is sys.stdout:
+ # Same as passing sys.stdout, except python2.4 doesn't fail on it.
+ subout = None
+ else:
+ # Open pipe for anything else so Popen works on python2.4.
+ subout = subprocess.PIPE
+ if stderr is sys.stderr:
+ # Same as passing sys.stderr, except python2.4 doesn't fail on it.
+ suberr = None
+ elif stderr is None:
+ # Merge with stdout if stderr isn't specified.
+ suberr = subprocess.STDOUT
+ else:
+ # Open pipe for anything else so Popen works on python2.4.
+ suberr = subprocess.PIPE
+ p = subprocess.Popen(command,
+ shell=(sys.platform == 'win32'),
+ stdout=subout,
+ stderr=suberr)
+ p.wait()
+ if stdout is None:
+ self.stdout = p.stdout.read()
+ elif stdout is not sys.stdout:
+ stdout.write(p.stdout.read())
+ if stderr not in (None, sys.stderr):
+ stderr.write(p.stderr.read())
+ return p.returncode
+
+ def run(self, command, display=None, stdout=None, stderr=None):
+ """
+ Runs a single command, displaying it first.
+ """
+ if display is None:
+ display = command
+ self.display(display)
+ return self.execute(command, stdout, stderr)
+
+
+class Unbuffered:
+ def __init__(self, fp):
+ self.fp = fp
+ def write(self, arg):
+ self.fp.write(arg)
+ self.fp.flush()
+ def __getattr__(self, attr):
+ return getattr(self.fp, attr)
+
+sys.stdout = Unbuffered(sys.stdout)
+sys.stderr = Unbuffered(sys.stderr)
+
+
+def find_all_gyptest_files(directory):
+ result = []
+ for root, dirs, files in os.walk(directory):
+ if '.svn' in dirs:
+ dirs.remove('.svn')
+ result.extend([ os.path.join(root, f) for f in files
+ if f.startswith('gyptest') and f.endswith('.py') ])
+ result.sort()
+ return result
+
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+
+ usage = "gyptest.py [-ahlnq] [-f formats] [test ...]"
+ parser = optparse.OptionParser(usage=usage)
+ parser.add_option("-a", "--all", action="store_true",
+ help="run all tests")
+ parser.add_option("-C", "--chdir", action="store", default=None,
+ help="chdir to the specified directory")
+ parser.add_option("-f", "--format", action="store", default='',
+ help="run tests with the specified formats")
+ parser.add_option("-l", "--list", action="store_true",
+ help="list available tests and exit")
+ parser.add_option("-n", "--no-exec", action="store_true",
+ help="no execute, just print the command line")
+ parser.add_option("--passed", action="store_true",
+ help="report passed tests")
+ parser.add_option("--path", action="append", default=[],
+ help="additional $PATH directory")
+ parser.add_option("-q", "--quiet", action="store_true",
+ help="quiet, don't print test command lines")
+ opts, args = parser.parse_args(argv[1:])
+
+ if opts.chdir:
+ os.chdir(opts.chdir)
+
+ if opts.path:
+ os.environ['PATH'] += ':' + ':'.join(opts.path)
+
+ if not args:
+ if not opts.all:
+ sys.stderr.write('Specify -a to get all tests.\n')
+ return 1
+ args = ['test']
+
+ tests = []
+ for arg in args:
+ if os.path.isdir(arg):
+ tests.extend(find_all_gyptest_files(os.path.normpath(arg)))
+ else:
+ tests.append(arg)
+
+ if opts.list:
+ for test in tests:
+ print test
+ sys.exit(0)
+
+ CommandRunner.verbose = not opts.quiet
+ CommandRunner.active = not opts.no_exec
+ cr = CommandRunner()
+
+ os.environ['PYTHONPATH'] = os.path.abspath('test/lib')
+ if not opts.quiet:
+ sys.stdout.write('PYTHONPATH=%s\n' % os.environ['PYTHONPATH'])
+
+ passed = []
+ failed = []
+ no_result = []
+
+ if opts.format:
+ format_list = opts.format.split(',')
+ else:
+ # TODO: not duplicate this mapping from pylib/gyp/__init__.py
+ format_list = [ {
+ 'freebsd7': 'make',
+ 'freebsd8': 'make',
+ 'cygwin': 'msvs',
+ 'win32': 'msvs',
+ 'linux2': 'make',
+ 'darwin': 'xcode',
+ }[sys.platform] ]
+
+ for format in format_list:
+ os.environ['TESTGYP_FORMAT'] = format
+ if not opts.quiet:
+ sys.stdout.write('TESTGYP_FORMAT=%s\n' % format)
+
+ for test in tests:
+ status = cr.run([sys.executable, test],
+ stdout=sys.stdout,
+ stderr=sys.stderr)
+ if status == 2:
+ no_result.append(test)
+ elif status:
+ failed.append(test)
+ else:
+ passed.append(test)
+
+ if not opts.quiet:
+ def report(description, tests):
+ if tests:
+ if len(tests) == 1:
+ sys.stdout.write("\n%s the following test:\n" % description)
+ else:
+ fmt = "\n%s the following %d tests:\n"
+ sys.stdout.write(fmt % (description, len(tests)))
+ sys.stdout.write("\t" + "\n\t".join(tests) + "\n")
+
+ if opts.passed:
+ report("Passed", passed)
+ report("Failed", failed)
+ report("No result from", no_result)
+
+ if failed:
+ return 1
+ else:
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSNew.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSNew.py
new file mode 100644
index 0000000..1277d4a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSNew.py
@@ -0,0 +1,341 @@
+#!/usr/bin/python2.4
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""New implementation of Visual Studio project generation for SCons."""
+
+import common
+import os
+import random
+
+import gyp.common
+
+# hashlib is supplied as of Python 2.5 as the replacement interface for md5
+# and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if
+# available, avoiding a deprecation warning under 2.6. Import md5 otherwise,
+# preserving 2.4 compatibility.
+try:
+ import hashlib
+ _new_md5 = hashlib.md5
+except ImportError:
+ import md5
+ _new_md5 = md5.new
+
+
+# Initialize random number generator
+random.seed()
+
+# GUIDs for project types
+ENTRY_TYPE_GUIDS = {
+ 'project': '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}',
+ 'folder': '{2150E333-8FDC-42A3-9474-1A3956D46DE8}',
+}
+
+#------------------------------------------------------------------------------
+# Helper functions
+
+
+def MakeGuid(name, seed='msvs_new'):
+ """Returns a GUID for the specified target name.
+
+ Args:
+ name: Target name.
+ seed: Seed for MD5 hash.
+ Returns:
+ A GUID-line string calculated from the name and seed.
+
+ This generates something which looks like a GUID, but depends only on the
+ name and seed. This means the same name/seed will always generate the same
+ GUID, so that projects and solutions which refer to each other can explicitly
+ determine the GUID to refer to explicitly. It also means that the GUID will
+ not change when the project for a target is rebuilt.
+ """
+ # Calculate a MD5 signature for the seed and name.
+ d = _new_md5(str(seed) + str(name)).hexdigest().upper()
+ # Convert most of the signature to GUID form (discard the rest)
+ guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20]
+ + '-' + d[20:32] + '}')
+ return guid
+
+#------------------------------------------------------------------------------
+
+
+class MSVSFolder:
+ """Folder in a Visual Studio project or solution."""
+
+ def __init__(self, path, name = None, entries = None,
+ guid = None, items = None):
+ """Initializes the folder.
+
+ Args:
+ path: Full path to the folder.
+ name: Name of the folder.
+ entries: List of folder entries to nest inside this folder. May contain
+ Folder or Project objects. May be None, if the folder is empty.
+ guid: GUID to use for folder, if not None.
+ items: List of solution items to include in the folder project. May be
+ None, if the folder does not directly contain items.
+ """
+ if name:
+ self.name = name
+ else:
+ # Use last layer.
+ self.name = os.path.basename(path)
+
+ self.path = path
+ self.guid = guid
+
+ # Copy passed lists (or set to empty lists)
+ self.entries = list(entries or [])
+ self.items = list(items or [])
+
+ self.entry_type_guid = ENTRY_TYPE_GUIDS['folder']
+
+ def get_guid(self):
+ if self.guid is None:
+ # Use consistent guids for folders (so things don't regenerate).
+ self.guid = MakeGuid(self.path, seed='msvs_folder')
+ return self.guid
+
+
+#------------------------------------------------------------------------------
+
+
+class MSVSProject:
+ """Visual Studio project."""
+
+ def __init__(self, path, name = None, dependencies = None, guid = None,
+ spec = None, build_file = None, config_platform_overrides = None,
+ fixpath_prefix = None):
+ """Initializes the project.
+
+ Args:
+ path: Absolute path to the project file.
+ name: Name of project. If None, the name will be the same as the base
+ name of the project file.
+ dependencies: List of other Project objects this project is dependent
+ upon, if not None.
+ guid: GUID to use for project, if not None.
+ spec: Dictionary specifying how to build this project.
+ build_file: Filename of the .gyp file that the vcproj file comes from.
+ config_platform_overrides: optional dict of configuration platforms to
+ used in place of the default for this target.
+ fixpath_prefix: the path used to adjust the behavior of _fixpath
+ """
+ self.path = path
+ self.guid = guid
+ self.spec = spec
+ self.build_file = build_file
+ # Use project filename if name not specified
+ self.name = name or os.path.splitext(os.path.basename(path))[0]
+
+ # Copy passed lists (or set to empty lists)
+ self.dependencies = list(dependencies or [])
+
+ self.entry_type_guid = ENTRY_TYPE_GUIDS['project']
+
+ if config_platform_overrides:
+ self.config_platform_overrides = config_platform_overrides
+ else:
+ self.config_platform_overrides = {}
+ self.fixpath_prefix = fixpath_prefix
+
+ def set_dependencies(self, dependencies):
+ self.dependencies = list(dependencies or [])
+
+ def get_guid(self):
+ if self.guid is None:
+ # Set GUID from path
+ # TODO(rspangler): This is fragile.
+ # 1. We can't just use the project filename sans path, since there could
+ # be multiple projects with the same base name (for example,
+ # foo/unittest.vcproj and bar/unittest.vcproj).
+ # 2. The path needs to be relative to $SOURCE_ROOT, so that the project
+ # GUID is the same whether it's included from base/base.sln or
+ # foo/bar/baz/baz.sln.
+ # 3. The GUID needs to be the same each time this builder is invoked, so
+ # that we don't need to rebuild the solution when the project changes.
+ # 4. We should be able to handle pre-built project files by reading the
+ # GUID from the files.
+ self.guid = MakeGuid(self.name)
+ return self.guid
+
+#------------------------------------------------------------------------------
+
+
+class MSVSSolution:
+ """Visual Studio solution."""
+
+ def __init__(self, path, version, entries=None, variants=None,
+ websiteProperties=True):
+ """Initializes the solution.
+
+ Args:
+ path: Path to solution file.
+ version: Format version to emit.
+ entries: List of entries in solution. May contain Folder or Project
+ objects. May be None, if the folder is empty.
+ variants: List of build variant strings. If none, a default list will
+ be used.
+ websiteProperties: Flag to decide if the website properties section
+ is generated.
+ """
+ self.path = path
+ self.websiteProperties = websiteProperties
+ self.version = version
+
+ # Copy passed lists (or set to empty lists)
+ self.entries = list(entries or [])
+
+ if variants:
+ # Copy passed list
+ self.variants = variants[:]
+ else:
+ # Use default
+ self.variants = ['Debug|Win32', 'Release|Win32']
+ # TODO(rspangler): Need to be able to handle a mapping of solution config
+ # to project config. Should we be able to handle variants being a dict,
+ # or add a separate variant_map variable? If it's a dict, we can't
+ # guarantee the order of variants since dict keys aren't ordered.
+
+
+ # TODO(rspangler): Automatically write to disk for now; should delay until
+ # node-evaluation time.
+ self.Write()
+
+
+ def Write(self, writer=common.WriteOnDiff):
+ """Writes the solution file to disk.
+
+ Raises:
+ IndexError: An entry appears multiple times.
+ """
+ # Walk the entry tree and collect all the folders and projects.
+ all_entries = []
+ entries_to_check = self.entries[:]
+ while entries_to_check:
+ # Pop from the beginning of the list to preserve the user's order.
+ e = entries_to_check.pop(0)
+
+ # A project or folder can only appear once in the solution's folder tree.
+ # This also protects from cycles.
+ if e in all_entries:
+ #raise IndexError('Entry "%s" appears more than once in solution' %
+ # e.name)
+ continue
+
+ all_entries.append(e)
+
+ # If this is a folder, check its entries too.
+ if isinstance(e, MSVSFolder):
+ entries_to_check += e.entries
+
+ # Sort by name then guid (so things are in order on vs2008).
+ def NameThenGuid(a, b):
+ if a.name < b.name: return -1
+ if a.name > b.name: return 1
+ if a.get_guid() < b.get_guid(): return -1
+ if a.get_guid() > b.get_guid(): return 1
+ return 0
+
+ all_entries = sorted(all_entries, NameThenGuid)
+
+ # Open file and print header
+ f = writer(self.path)
+ f.write('Microsoft Visual Studio Solution File, '
+ 'Format Version %s\r\n' % self.version.SolutionVersion())
+ f.write('# %s\r\n' % self.version.Description())
+
+ # Project entries
+ sln_root = os.path.split(self.path)[0]
+ for e in all_entries:
+ relative_path = gyp.common.RelativePath(e.path, sln_root)
+ f.write('Project("%s") = "%s", "%s", "%s"\r\n' % (
+ e.entry_type_guid, # Entry type GUID
+ e.name, # Folder name
+ relative_path.replace('/', '\\'), # Folder name (again)
+ e.get_guid(), # Entry GUID
+ ))
+
+ # TODO(rspangler): Need a way to configure this stuff
+ if self.websiteProperties:
+ f.write('\tProjectSection(WebsiteProperties) = preProject\r\n'
+ '\t\tDebug.AspNetCompiler.Debug = "True"\r\n'
+ '\t\tRelease.AspNetCompiler.Debug = "False"\r\n'
+ '\tEndProjectSection\r\n')
+
+ if isinstance(e, MSVSFolder):
+ if e.items:
+ f.write('\tProjectSection(SolutionItems) = preProject\r\n')
+ for i in e.items:
+ f.write('\t\t%s = %s\r\n' % (i, i))
+ f.write('\tEndProjectSection\r\n')
+
+ if isinstance(e, MSVSProject):
+ if e.dependencies:
+ f.write('\tProjectSection(ProjectDependencies) = postProject\r\n')
+ for d in e.dependencies:
+ f.write('\t\t%s = %s\r\n' % (d.get_guid(), d.get_guid()))
+ f.write('\tEndProjectSection\r\n')
+
+ f.write('EndProject\r\n')
+
+ # Global section
+ f.write('Global\r\n')
+
+ # Configurations (variants)
+ f.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n')
+ for v in self.variants:
+ f.write('\t\t%s = %s\r\n' % (v, v))
+ f.write('\tEndGlobalSection\r\n')
+
+ # Sort config guids for easier diffing of solution changes.
+ config_guids = []
+ config_guids_overrides = {}
+ for e in all_entries:
+ if isinstance(e, MSVSProject):
+ config_guids.append(e.get_guid())
+ config_guids_overrides[e.get_guid()] = e.config_platform_overrides
+ config_guids.sort()
+
+ f.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n')
+ for g in config_guids:
+ for v in self.variants:
+ nv = config_guids_overrides[g].get(v, v)
+ # Pick which project configuration to build for this solution
+ # configuration.
+ f.write('\t\t%s.%s.ActiveCfg = %s\r\n' % (
+ g, # Project GUID
+ v, # Solution build configuration
+ nv, # Project build config for that solution config
+ ))
+
+ # Enable project in this solution configuration.
+ f.write('\t\t%s.%s.Build.0 = %s\r\n' % (
+ g, # Project GUID
+ v, # Solution build configuration
+ nv, # Project build config for that solution config
+ ))
+ f.write('\tEndGlobalSection\r\n')
+
+ # TODO(rspangler): Should be able to configure this stuff too (though I've
+ # never seen this be any different)
+ f.write('\tGlobalSection(SolutionProperties) = preSolution\r\n')
+ f.write('\t\tHideSolutionNode = FALSE\r\n')
+ f.write('\tEndGlobalSection\r\n')
+
+ # Folder mappings
+ # TODO(rspangler): Should omit this section if there are no folders
+ f.write('\tGlobalSection(NestedProjects) = preSolution\r\n')
+ for e in all_entries:
+ if not isinstance(e, MSVSFolder):
+ continue # Does not apply to projects, only folders
+ for subentry in e.entries:
+ f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid()))
+ f.write('\tEndGlobalSection\r\n')
+
+ f.write('EndGlobal\r\n')
+
+ f.close()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSProject.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSProject.py
new file mode 100644
index 0000000..1246fdd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSProject.py
@@ -0,0 +1,245 @@
+#!/usr/bin/python2.4
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Visual Studio project reader/writer."""
+
+import common
+import xml.dom
+import xml_fix
+
+#------------------------------------------------------------------------------
+
+
+class Tool(object):
+ """Visual Studio tool."""
+
+ def __init__(self, name, attrs=None):
+ """Initializes the tool.
+
+ Args:
+ name: Tool name.
+ attrs: Dict of tool attributes; may be None.
+ """
+ self.name = name
+ self.attrs = attrs or {}
+
+ def CreateElement(self, doc):
+ """Creates an element for the tool.
+
+ Args:
+ doc: xml.dom.Document object to use for node creation.
+
+ Returns:
+ A new xml.dom.Element for the tool.
+ """
+ node = doc.createElement('Tool')
+ node.setAttribute('Name', self.name)
+ for k, v in self.attrs.items():
+ node.setAttribute(k, v)
+ return node
+
+
+class Filter(object):
+ """Visual Studio filter - that is, a virtual folder."""
+
+ def __init__(self, name, contents=None):
+ """Initializes the folder.
+
+ Args:
+ name: Filter (folder) name.
+ contents: List of filenames and/or Filter objects contained.
+ """
+ self.name = name
+ self.contents = list(contents or [])
+
+
+#------------------------------------------------------------------------------
+
+
+class Writer(object):
+ """Visual Studio XML project writer."""
+
+ def __init__(self, project_path, version):
+ """Initializes the project.
+
+ Args:
+ project_path: Path to the project file.
+ version: Format version to emit.
+ """
+ self.project_path = project_path
+ self.doc = None
+ self.version = version
+
+ def Create(self, name, guid=None, platforms=None):
+ """Creates the project document.
+
+ Args:
+ name: Name of the project.
+ guid: GUID to use for project, if not None.
+ """
+ self.name = name
+ self.guid = guid
+
+ # Default to Win32 for platforms.
+ if not platforms:
+ platforms = ['Win32']
+
+ # Create XML doc
+ xml_impl = xml.dom.getDOMImplementation()
+ self.doc = xml_impl.createDocument(None, 'VisualStudioProject', None)
+
+ # Add attributes to root element
+ self.n_root = self.doc.documentElement
+ self.n_root.setAttribute('ProjectType', 'Visual C++')
+ self.n_root.setAttribute('Version', self.version.ProjectVersion())
+ self.n_root.setAttribute('Name', self.name)
+ self.n_root.setAttribute('ProjectGUID', self.guid)
+ self.n_root.setAttribute('RootNamespace', self.name)
+ self.n_root.setAttribute('Keyword', 'Win32Proj')
+
+ # Add platform list
+ n_platform = self.doc.createElement('Platforms')
+ self.n_root.appendChild(n_platform)
+ for platform in platforms:
+ n = self.doc.createElement('Platform')
+ n.setAttribute('Name', platform)
+ n_platform.appendChild(n)
+
+ # Add tool files section
+ self.n_tool_files = self.doc.createElement('ToolFiles')
+ self.n_root.appendChild(self.n_tool_files)
+
+ # Add configurations section
+ self.n_configs = self.doc.createElement('Configurations')
+ self.n_root.appendChild(self.n_configs)
+
+ # Add empty References section
+ self.n_root.appendChild(self.doc.createElement('References'))
+
+ # Add files section
+ self.n_files = self.doc.createElement('Files')
+ self.n_root.appendChild(self.n_files)
+ # Keep a dict keyed on filename to speed up access.
+ self.n_files_dict = dict()
+
+ # Add empty Globals section
+ self.n_root.appendChild(self.doc.createElement('Globals'))
+
+ def AddToolFile(self, path):
+ """Adds a tool file to the project.
+
+ Args:
+ path: Relative path from project to tool file.
+ """
+ n_tool = self.doc.createElement('ToolFile')
+ n_tool.setAttribute('RelativePath', path)
+ self.n_tool_files.appendChild(n_tool)
+
+ def _AddConfigToNode(self, parent, config_type, config_name, attrs=None,
+ tools=None):
+ """Adds a configuration to the parent node.
+
+ Args:
+ parent: Destination node.
+ config_type: Type of configuration node.
+ config_name: Configuration name.
+ attrs: Dict of configuration attributes; may be None.
+ tools: List of tools (strings or Tool objects); may be None.
+ """
+ # Handle defaults
+ if not attrs:
+ attrs = {}
+ if not tools:
+ tools = []
+
+ # Add configuration node and its attributes
+ n_config = self.doc.createElement(config_type)
+ n_config.setAttribute('Name', config_name)
+ for k, v in attrs.items():
+ n_config.setAttribute(k, v)
+ parent.appendChild(n_config)
+
+ # Add tool nodes and their attributes
+ if tools:
+ for t in tools:
+ if isinstance(t, Tool):
+ n_config.appendChild(t.CreateElement(self.doc))
+ else:
+ n_config.appendChild(Tool(t).CreateElement(self.doc))
+
+ def AddConfig(self, name, attrs=None, tools=None):
+ """Adds a configuration to the project.
+
+ Args:
+ name: Configuration name.
+ attrs: Dict of configuration attributes; may be None.
+ tools: List of tools (strings or Tool objects); may be None.
+ """
+ self._AddConfigToNode(self.n_configs, 'Configuration', name, attrs, tools)
+
+ def _AddFilesToNode(self, parent, files):
+ """Adds files and/or filters to the parent node.
+
+ Args:
+ parent: Destination node
+ files: A list of Filter objects and/or relative paths to files.
+
+ Will call itself recursively, if the files list contains Filter objects.
+ """
+ for f in files:
+ if isinstance(f, Filter):
+ node = self.doc.createElement('Filter')
+ node.setAttribute('Name', f.name)
+ self._AddFilesToNode(node, f.contents)
+ else:
+ node = self.doc.createElement('File')
+ node.setAttribute('RelativePath', f)
+ self.n_files_dict[f] = node
+ parent.appendChild(node)
+
+ def AddFiles(self, files):
+ """Adds files to the project.
+
+ Args:
+ files: A list of Filter objects and/or relative paths to files.
+
+ This makes a copy of the file/filter tree at the time of this call. If you
+ later add files to a Filter object which was passed into a previous call
+ to AddFiles(), it will not be reflected in this project.
+ """
+ self._AddFilesToNode(self.n_files, files)
+ # TODO(rspangler) This also doesn't handle adding files to an existing
+ # filter. That is, it doesn't merge the trees.
+
+ def AddFileConfig(self, path, config, attrs=None, tools=None):
+ """Adds a configuration to a file.
+
+ Args:
+ path: Relative path to the file.
+ config: Name of configuration to add.
+ attrs: Dict of configuration attributes; may be None.
+ tools: List of tools (strings or Tool objects); may be None.
+
+ Raises:
+ ValueError: Relative path does not match any file added via AddFiles().
+ """
+ # Find the file node with the right relative path
+ parent = self.n_files_dict.get(path)
+ if not parent:
+ raise ValueError('AddFileConfig: file "%s" not in project.' % path)
+
+ # Add the config to the file node
+ self._AddConfigToNode(parent, 'FileConfiguration', config, attrs, tools)
+
+ def Write(self, writer=common.WriteOnDiff):
+ """Writes the project file."""
+ f = writer(self.project_path)
+ fix = xml_fix.XmlFix()
+ self.doc.writexml(f, encoding='Windows-1252', addindent=' ', newl='\r\n')
+ fix.Cleanup()
+ f.close()
+
+#------------------------------------------------------------------------------
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py
new file mode 100644
index 0000000..5b79dd5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py
@@ -0,0 +1,980 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+""" Code to validate and convert settings of the Microsoft build tools.
+
+This file contains code to validate and convert settings of the Microsoft
+build tools. The function ConvertToMsBuildSettings(), ValidateMSVSSettings(),
+and ValidateMSBuildSettings() are the entry points.
+
+This file was created by comparing the projects created by Visual Studio 2008
+and Visual Studio 2010 for all available settings through the user interface.
+The MSBuild schemas were also considered. They are typically found in the
+MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
+"""
+
+import sys
+
+
+# Dictionaries of settings validators. The key is the tool name, the value is
+# a dictionary mapping setting names to validation functions.
+_msvs_validators = {}
+_msbuild_validators = {}
+
+
+# A dictionary of settings converters. The key is the tool name, the value is
+# a dictionary mapping setting names to conversion functions.
+_msvs_to_msbuild_converters = {}
+
+
+# Tool name mapping from MSVS to MSBuild.
+_msbuild_name_of_tool = {}
+
+
+def _AddTool(names):
+ """ Adds a tool to the four dictionaries used to process settings.
+
+ This only defines the tool. Each setting also needs to be added.
+
+ Args:
+ names: a dictionary of the MSVS and MSBuild names of this tool.
+ """
+ msvs_name = names['msvs']
+ msbuild_name = names['msbuild']
+ _msvs_validators[msvs_name] = {}
+ _msbuild_validators[msbuild_name] = {}
+ _msvs_to_msbuild_converters[msvs_name] = {}
+ _msbuild_name_of_tool[msvs_name] = msbuild_name
+
+
+def _GetMsBuildToolSettings(msbuild_settings, tool):
+ """ Returns an MSBuild tool dictionary. Creates it if needed. """
+ tool_name = tool['msbuild']
+ return _GetOrCreateSubDictionary(msbuild_settings, tool_name)
+
+
+def _GetOrCreateSubDictionary(dict, name):
+ """ Returns or creates one of the sub-dictionary of dict. """
+ if not name in dict:
+ dict[name] = {}
+ return dict[name]
+
+
+class _Type:
+ """ Type of settings (Base class). """
+ def ValidateMSVS(self, value):
+ """ Raises ValueError if value is not valid for MSVS. """
+ pass
+ def ValidateMSBuild(self, value):
+ """ Raises ValueError if value is not valid for MSBuild. """
+ pass
+ def ConvertToMSBuild(self, value):
+ """ Returns the MSBuild equivalent of the MSVS value given.
+
+ Raises ValueError if value is not valid.
+ """
+ return value
+
+
+class _String(_Type):
+ """ A setting that's just a string. """
+ def ValidateMSVS(self, value):
+ if not isinstance(value, str):
+ raise ValueError
+ def ValidateMSBuild(self, value):
+ if not isinstance(value, str):
+ raise ValueError
+ def ConvertToMSBuild(self, value):
+ # Convert the macros
+ return _ConvertVCMacrosToMsBuild(value)
+
+
+class _StringList(_Type):
+ """ A settings that's a list of strings. """
+ def ValidateMSVS(self, value):
+ if not isinstance(value, str) and not isinstance(value, list):
+ raise ValueError
+ def ValidateMSBuild(self, value):
+ if not isinstance(value, str) and not isinstance(value, list):
+ raise ValueError
+ def ConvertToMSBuild(self, value):
+ # Convert the macros
+ if isinstance(value, list):
+ return [_ConvertVCMacrosToMsBuild(i) for i in value]
+ else:
+ return _ConvertVCMacrosToMsBuild(value)
+
+
+class _Boolean(_Type):
+ """ Boolean settings, can have the values 'false' or 'true'. """
+ def _Validate(self, value):
+ if value != 'true' and value != 'false':
+ raise ValueError
+ def ValidateMSVS(self, value):
+ self._Validate(value)
+ def ValidateMSBuild(self, value):
+ self._Validate(value)
+ def ConvertToMSBuild(self, value):
+ self._Validate(value)
+ return value
+
+
+class _Integer(_Type):
+ """ Integer settings. """
+ def __init__(self, msbuild_base=10):
+ self.msbuild_base = msbuild_base
+ def ValidateMSVS(self, value):
+ # Try to convert, this will raise ValueError if invalid.
+ self.ConvertToMSBuild(value)
+ def ValidateMSBuild(self, value):
+ # Try to convert, this will raise ValueError if invalid.
+ int(value, self.msbuild_base)
+ def ConvertToMSBuild(self, value):
+ format = (self.msbuild_base == 10) and '%d' or '0x%04x'
+ return format % int(value)
+
+
+class _Enumeration(_Type):
+ """ Type of settings that is an enumeration.
+
+ In MSVS, the values are indexes like '0', '1', and '2'.
+ MSBuild uses text labels that are more representative, like 'Win32'.
+
+ Constructor args:
+ label_list: an array of MSBuild labels that correspond to the MSVS index.
+ In the rare cases where MSVS has skipped an index value, None is
+ used in the array to indicate the unused spot.
+ new: an array of labels that are new to MSBuild.
+ """
+ def __init__(self, label_list, new=[]):
+ self.label_list = label_list
+ self.msbuild_values = set()
+ for value in label_list:
+ if not value is None:
+ self.msbuild_values.add(value)
+ for value in new:
+ self.msbuild_values.add(value)
+ def ValidateMSVS(self, value):
+ # Try to convert. It will raise an exception if not valid.
+ self.ConvertToMSBuild(value)
+ def ValidateMSBuild(self, value):
+ if not value in self.msbuild_values:
+ raise ValueError
+ def ConvertToMSBuild(self, value):
+ index = int(value)
+ if index < 0 or index >= len(self.label_list):
+ raise ValueError
+ label = self.label_list[index]
+ if label is None:
+ raise ValueError
+ return label
+
+
+# Instantiate the various generic types.
+_boolean = _Boolean()
+_integer = _Integer()
+# For now, we don't do any special validation on these types:
+_string = _String()
+_file_name = _String()
+_folder_name = _String()
+_file_list = _StringList()
+_folder_list = _StringList()
+_string_list = _StringList()
+# Some boolean settings went from numerical values to boolean. The
+# mapping is 0: default, 1: false, 2: true.
+_newly_boolean = _Enumeration(['', 'false', 'true'])
+
+
+def _Same(tool, name, type):
+ """ Defines a setting that has the same name in MSVS and MSBuild.
+
+ Args:
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
+ name: the name of the setting.
+ type: the type of this setting.
+ """
+ _Renamed(tool, name, name, type)
+
+
+def _Renamed(tool, msvs_name, msbuild_name, type):
+ """ Defines a setting for which the name has changed.
+
+ Args:
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
+ msvs_name: the name of the MSVS setting.
+ msbuild_name: the name of the MSBuild setting.
+ type: the type of this setting.
+ """
+ def _Translate(value, msbuild_settings):
+ msbuild_tool_settings = _GetMsBuildToolSettings(msbuild_settings, tool)
+ msbuild_tool_settings[msbuild_name] = type.ConvertToMSBuild(value)
+ msvs_tool_name = tool['msvs']
+ msbuild_tool_name = tool['msbuild']
+ _msvs_validators[msvs_tool_name][msvs_name] = type.ValidateMSVS
+ _msbuild_validators[msbuild_tool_name][msbuild_name] = type.ValidateMSBuild
+ _msvs_to_msbuild_converters[msvs_tool_name][msvs_name] = _Translate
+
+
+def _Moved(tool, settings_name, msbuild_tool_name, type):
+ _MovedAndRenamed(tool, settings_name, msbuild_tool_name, settings_name,
+ type)
+
+
+def _MovedAndRenamed(tool, msvs_settings_name, msbuild_tool_name,
+ msbuild_settings_name, type):
+ """ Defines a setting that may have moved to a new section.
+
+ Args:
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
+ msvs_settings_name: the MSVS name of the setting.
+ msbuild_tool_name: the name of the MSBuild tool to place the setting under.
+ msbuild_settings_name: the MSBuild name of the setting.
+ type: the type of this setting.
+ """
+ def _Translate(value, msbuild_settings):
+ tool_settings = _GetOrCreateSubDictionary(msbuild_settings,
+ msbuild_tool_name)
+ tool_settings[msbuild_settings_name] = type.ConvertToMSBuild(value)
+ msvs_tool_name = tool['msvs']
+ _msvs_validators[msvs_tool_name][msvs_settings_name] = type.ValidateMSVS
+ validator = type.ValidateMSBuild
+ _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator
+ _msvs_to_msbuild_converters[msvs_tool_name][msvs_settings_name] = _Translate
+
+
+def _MSVSOnly(tool, name, type):
+ """ Defines a setting that is only found in MSVS.
+
+ Args:
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
+ name: the name of the setting.
+ type: the type of this setting.
+ """
+ def _Translate(value, msbuild_settings):
+ pass
+ msvs_tool_name = tool['msvs']
+ _msvs_validators[msvs_tool_name][name] = type.ValidateMSVS
+ _msvs_to_msbuild_converters[msvs_tool_name][name] = _Translate
+
+
+def _MSBuildOnly(tool, name, type):
+ """ Defines a setting that is only found in MSBuild.
+
+ Args:
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
+ name: the name of the setting.
+ type: the type of this setting.
+ """
+ msbuild_tool_name = tool['msbuild']
+ _msbuild_validators[msbuild_tool_name][name] = type.ValidateMSBuild
+
+
+def _ConvertedToAdditionalOption(tool, msvs_name, flag):
+ """ Defines a setting that's handled via a command line option in MSBuild.
+
+ Args:
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
+ msvs_name: the name of the MSVS setting that if 'true' becomes a flag
+ flag: the flag to insert at the end of the AdditionalOptions
+ """
+ def _Translate(value, msbuild_settings):
+ if value == 'true':
+ tool_settings = _GetMsBuildToolSettings(msbuild_settings, tool)
+ if 'AdditionalOptions' in tool_settings:
+ new_flags = "%s %s" % (tool_settings['AdditionalOptions'], flag)
+ else:
+ new_flags = flag
+ tool_settings['AdditionalOptions'] = new_flags
+ msvs_tool_name = tool['msvs']
+ _msvs_validators[msvs_tool_name][msvs_name] = _boolean.ValidateMSVS
+ _msvs_to_msbuild_converters[msvs_tool_name][msvs_name] = _Translate
+
+
+def _CustomGeneratePreprocessedFile(tool, msvs_name):
+ def _Translate(value, msbuild_settings):
+ tool_settings = _GetMsBuildToolSettings(msbuild_settings, tool)
+ if value == '0':
+ tool_settings['PreprocessToFile'] = 'false'
+ tool_settings['PreprocessSuppressLineNumbers'] = 'false'
+ elif value == '1': # /P
+ tool_settings['PreprocessToFile'] = 'true'
+ tool_settings['PreprocessSuppressLineNumbers'] = 'false'
+ elif value == '2': # /EP /P
+ tool_settings['PreprocessToFile'] = 'true'
+ tool_settings['PreprocessSuppressLineNumbers'] = 'true'
+ else:
+ raise ValueError
+ msvs_tool_name = tool['msvs']
+ # Create a bogus validator that looks for '0', '1', or '2'
+ msvs_validator = _Enumeration(['a', 'b', 'c']).ValidateMSVS
+ _msvs_validators[msvs_tool_name][msvs_name] = msvs_validator
+ msbuild_validator = _boolean.ValidateMSBuild
+ msbuild_tool_validators = _msbuild_validators[tool['msbuild']]
+ msbuild_tool_validators['PreprocessToFile'] = msbuild_validator
+ msbuild_tool_validators['PreprocessSuppressLineNumbers'] = msbuild_validator
+ _msvs_to_msbuild_converters[msvs_tool_name][msvs_name] = _Translate
+
+
+def _ConvertVCMacrosToMsBuild(s):
+ if (s.find('$') >= 0):
+ s = s.replace('$(ConfigurationName)', '$(Configuration)')
+ s = s.replace('$(InputDir)', '%(RootDir)%(Directory)')
+ s = s.replace('$(InputExt)', '%(Extension)')
+ s = s.replace('$(InputFileName)', '%(Filename)%(Extension)')
+ s = s.replace('$(InputName)', '%(Filename)')
+ s = s.replace('$(InputPath)', '%(FullPath)')
+ s = s.replace('$(ParentName)', '$(ProjectFileName)')
+ s = s.replace('$(PlatformName)', '$(Platform)')
+ s = s.replace('$(SafeInputName)', '%(Filename)')
+
+ s = s.replace('$(IntDir)\\', '$(IntDir)')
+ s = s.replace('$(OutDir)\\', '$(OutDir)')
+ s = s.replace('$(IntDir)/', '$(IntDir)')
+ s = s.replace('$(OutDir)/', '$(OutDir)')
+ return s
+
+
+def ConvertToMsBuildSettings(msvs_settings, stderr=sys.stderr):
+ """ Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
+
+ Args:
+ msvs_settings: A dictionary. The key is the tool name. The values are
+ themselves dictionaries of settings and their values.
+ stderr: The stream receiving the error messages.
+ Returns:
+ A dictionary of MSBuild settings. The key is either the MSBuild tool name
+ or the empty string (for the global settings). The values are themselves
+ dictionaries of settings and their values.
+ """
+ msbuild_settings = {}
+ for msvs_tool_name, msvs_tool_settings in msvs_settings.iteritems():
+ if msvs_tool_name in _msvs_to_msbuild_converters:
+ msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
+ for msvs_setting, msvs_value in msvs_tool_settings.iteritems():
+ if msvs_setting in msvs_tool:
+ # Invoke the translation function.
+ try:
+ msvs_tool[msvs_setting](msvs_value, msbuild_settings)
+ except ValueError:
+ print >> stderr, ('Warning: unrecognized value "%s" for %s/%s '
+ 'while converting to MSBuild.' %
+ (msvs_value, msvs_tool_name, msvs_setting))
+ else:
+ # We don't know this setting. Give a warning.
+ print >> stderr, ('Warning: unrecognized setting %s/%s '
+ 'while converting to MSBuild.' % (msvs_tool_name, msvs_setting))
+ else:
+ print >> stderr, ('Warning: unrecognized tool %s while converting to '
+ 'MSBuild.' % msvs_tool_name)
+ return msbuild_settings
+
+
+def ValidateMSVSSettings(settings, stderr=sys.stderr):
+ """ Validates that the names of the settings are valid for MSVS.
+
+ Args:
+ settings: A dictionary. The key is the tool name. The values are
+ themselves dictionaries of settings and their values.
+ stderr: The stream receiving the error messages.
+ """
+ _ValidateSettings(_msvs_validators, settings, stderr)
+
+
+def ValidateMSBuildSettings(settings, stderr=sys.stderr):
+ """ Validates that the names of the settings are valid for MSBuild.
+
+ Args:
+ settings: A dictionary. The key is the tool name. The values are
+ themselves dictionaries of settings and their values.
+ stderr: The stream receiving the error messages.
+ """
+ _ValidateSettings(_msbuild_validators, settings, stderr)
+
+
+def _ValidateSettings(validators, settings, stderr):
+ """ Validates that the settings are valid for MSBuild or MSVS.
+
+ We currently only validate the names of the settings, not their values.
+
+ Args:
+ validators: A dictionary of tools and their validators.
+ settings: A dictionary. The key is the tool name. The values are
+ themselves dictionaries of settings and their values.
+ stderr: The stream receiving the error messages.
+ """
+ for tool_name in settings:
+ if tool_name in validators:
+ tool_validators = validators[tool_name]
+ for setting, value in settings[tool_name].iteritems():
+ if setting in tool_validators:
+ try:
+ tool_validators[setting](value)
+ except ValueError:
+ print >> stderr, ('Warning: unrecognized value "%s" for %s/%s' %
+ (value, tool_name, setting))
+ #except TypeError: #(jeanluc)
+ # print ('***value "%s" for %s/%s' % (value, tool_name, setting))
+ else:
+ print >> stderr, ('Warning: unrecognized setting %s/%s' %
+ (tool_name, setting))
+ else:
+ print >> stderr, ('Warning: unrecognized tool %s' % tool_name)
+
+
+# MSVS and MBuild names of the tools.
+_compile = {'msvs': 'VCCLCompilerTool', 'msbuild': 'ClCompile'}
+_link = {'msvs': 'VCLinkerTool', 'msbuild': 'Link'}
+_midl = {'msvs': 'VCMIDLTool', 'msbuild': 'Midl'}
+_rc = {'msvs': 'VCResourceCompilerTool', 'msbuild': 'ResourceCompile'}
+_lib = {'msvs': 'VCLibrarianTool', 'msbuild': 'Lib'}
+_manifest = {'msvs': 'VCManifestTool', 'msbuild': 'Mt'}
+
+
+_AddTool(_compile)
+_AddTool(_link)
+_AddTool(_midl)
+_AddTool(_rc)
+_AddTool(_lib)
+_AddTool(_manifest)
+# Add sections only found in the MSBuild settings.
+_msbuild_validators[''] = {}
+_msbuild_validators['ProjectReference'] = {}
+_msbuild_validators['ManifestResourceCompile'] = {}
+
+# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and
+# ClCompile in MSBuild.
+# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for
+# the schema of the MSBuild ClCompile settings.
+
+# Options that have the same name in MSVS and MSBuild
+_Same(_compile, 'AdditionalIncludeDirectories', _folder_list) # /I
+_Same(_compile, 'AdditionalOptions', _string_list)
+_Same(_compile, 'AdditionalUsingDirectories', _folder_list) # /AI
+_Same(_compile, 'AssemblerListingLocation', _file_name) # /Fa
+_Same(_compile, 'BrowseInformationFile', _file_name)
+_Same(_compile, 'BufferSecurityCheck', _boolean) # /GS
+_Same(_compile, 'DisableLanguageExtensions', _boolean) # /Za
+_Same(_compile, 'DisableSpecificWarnings', _string_list) # /wd
+_Same(_compile, 'EnableFiberSafeOptimizations', _boolean) # /GT
+_Same(_compile, 'EnablePREfast', _boolean) # /analyze Visible='false'
+_Same(_compile, 'ExpandAttributedSource', _boolean) # /Fx
+_Same(_compile, 'FloatingPointExceptions', _boolean) # /fp:except
+_Same(_compile, 'ForceConformanceInForLoopScope', _boolean) # /Zc:forScope
+_Same(_compile, 'ForcedIncludeFiles', _file_list) # /FI
+_Same(_compile, 'ForcedUsingFiles', _file_list) # /FU
+_Same(_compile, 'GenerateXMLDocumentationFiles', _boolean) # /doc
+_Same(_compile, 'IgnoreStandardIncludePath', _boolean) # /X
+_Same(_compile, 'MinimalRebuild', _boolean) # /Gm
+_Same(_compile, 'OmitDefaultLibName', _boolean) # /Zl
+_Same(_compile, 'OmitFramePointers', _boolean) # /Oy
+_Same(_compile, 'PreprocessorDefinitions', _string_list) # /D
+_Same(_compile, 'ProgramDataBaseFileName', _file_name) # /Fd
+_Same(_compile, 'RuntimeTypeInfo', _boolean) # /GR
+_Same(_compile, 'ShowIncludes', _boolean) # /showIncludes
+_Same(_compile, 'SmallerTypeCheck', _boolean) # /RTCc
+_Same(_compile, 'StringPooling', _boolean) # /GF
+_Same(_compile, 'SuppressStartupBanner', _boolean) # /nologo
+_Same(_compile, 'TreatWChar_tAsBuiltInType', _boolean) # /Zc:wchar_t
+_Same(_compile, 'UndefineAllPreprocessorDefinitions', _boolean) # /u
+_Same(_compile, 'UndefinePreprocessorDefinitions', _string_list) # /U
+_Same(_compile, 'UseFullPaths', _boolean) # /FC
+_Same(_compile, 'WholeProgramOptimization', _boolean) # /GL
+_Same(_compile, 'XMLDocumentationFileName', _file_name)
+
+_Same(_compile, 'AssemblerOutput',
+ _Enumeration(['NoListing',
+ 'AssemblyCode', # /FA
+ 'All', # /FAcs
+ 'AssemblyAndMachineCode', # /FAc
+ 'AssemblyAndSourceCode'])) # /FAs
+_Same(_compile, 'BasicRuntimeChecks',
+ _Enumeration(['Default',
+ 'StackFrameRuntimeCheck', # /RTCs
+ 'UninitializedLocalUsageCheck', # /RTCu
+ 'EnableFastChecks'])) # /RTC1
+_Same(_compile, 'BrowseInformation',
+ _Enumeration(['false',
+ 'true', # /FR
+ 'true'])) # /Fr
+_Same(_compile, 'CallingConvention',
+ _Enumeration(['Cdecl', # /Gd
+ 'FastCall', # /Gr
+ 'StdCall'])) # /Gz
+_Same(_compile, 'CompileAs',
+ _Enumeration(['Default',
+ 'CompileAsC', # /TC
+ 'CompileAsCpp'])) # /TP
+_Same(_compile, 'DebugInformationFormat',
+ _Enumeration(['', # Disabled
+ 'OldStyle', # /Z7
+ None,
+ 'ProgramDatabase', # /Zi
+ 'EditAndContinue'])) # /ZI
+_Same(_compile, 'EnableEnhancedInstructionSet',
+ _Enumeration(['NotSet',
+ 'StreamingSIMDExtensions', # /arch:SSE
+ 'StreamingSIMDExtensions2'])) # /arch:SSE2
+_Same(_compile, 'ErrorReporting',
+ _Enumeration(['None', # /errorReport:none
+ 'Prompt', # /errorReport:prompt
+ 'Queue'], # /errorReport:queue
+ new=['Send'])) # /errorReport:send"
+_Same(_compile, 'ExceptionHandling',
+ _Enumeration(['false',
+ 'Sync', # /EHsc
+ 'Async'], # /EHa
+ new=['SyncCThrow'])) # /EHs
+_Same(_compile, 'FavorSizeOrSpeed',
+ _Enumeration(['Neither',
+ 'Speed', # /Ot
+ 'Size'])) # /Os
+_Same(_compile, 'FloatingPointModel',
+ _Enumeration(['Precise', # /fp:precise
+ 'Strict', # /fp:strict
+ 'Fast'])) # /fp:fast
+_Same(_compile, 'InlineFunctionExpansion',
+ _Enumeration(['Default',
+ 'OnlyExplicitInline', # /Ob1
+ 'AnySuitable'], # /Ob2
+ new=['Disabled'])) # /Ob0
+_Same(_compile, 'Optimization',
+ _Enumeration(['Disabled', # /Od
+ 'MinSpace', # /O1
+ 'MaxSpeed', # /O2
+ 'Full'])) # /Ox
+_Same(_compile, 'RuntimeLibrary',
+ _Enumeration(['MultiThreaded', # /MT
+ 'MultiThreadedDebug', # /MTd
+ 'MultiThreadedDLL', # /MD
+ 'MultiThreadedDebugDLL'])) # /MDd
+_Same(_compile, 'StructMemberAlignment',
+ _Enumeration(['Default',
+ '1Byte', # /Zp1
+ '2Bytes', # /Zp2
+ '4Bytes', # /Zp4
+ '8Bytes', # /Zp8
+ '16Bytes'])) # /Zp16
+_Same(_compile, 'WarningLevel',
+ _Enumeration(['TurnOffAllWarnings', # /W0
+ 'Level1', # /W1
+ 'Level2', # /W2
+ 'Level3', # /W3
+ 'Level4'], # /W4
+ new=['EnableAllWarnings'])) # /Wall
+
+# Options found in MSVS that have been renamed in MSBuild.
+_Renamed(_compile, 'EnableFunctionLevelLinking', 'FunctionLevelLinking',
+ _boolean) # /Gy
+_Renamed(_compile, 'EnableIntrinsicFunctions', 'IntrinsicFunctions',
+ _boolean) # /Oi
+_Renamed(_compile, 'KeepComments', 'PreprocessKeepComments', _boolean) # /C
+_Renamed(_compile, 'ObjectFile', 'ObjectFileName', _file_name) # /Fo
+_Renamed(_compile, 'OpenMP', 'OpenMPSupport', _boolean) # /openmp
+_Renamed(_compile, 'PrecompiledHeaderThrough', 'PrecompiledHeaderFile',
+ _file_name) # Used with /Yc and /Yu
+_Renamed(_compile, 'PrecompiledHeaderFile', 'PrecompiledHeaderOutputFile',
+ _file_name) # /Fp
+_Renamed(_compile, 'UsePrecompiledHeader', 'PrecompiledHeader',
+ _Enumeration(['NotUsing', # VS recognized '' for this value too.
+ 'Create', # /Yc
+ 'Use'])) # /Yu
+_Renamed(_compile, 'WarnAsError', 'TreatWarningAsError', _boolean) # /WX
+
+_ConvertedToAdditionalOption(_compile, 'DefaultCharIsUnsigned', '/J')
+
+# MSVS options not found in MSBuild.
+_MSVSOnly(_compile, 'Detect64BitPortabilityProblems', _boolean)
+_MSVSOnly(_compile, 'UseUnicodeResponseFiles', _boolean)
+
+# MSBuild options not found in MSVS.
+_MSBuildOnly(_compile, 'BuildingInIDE', _boolean)
+_MSBuildOnly(_compile, 'CompileAsManaged',
+ _Enumeration([], new=['false',
+ 'true', # /clr
+ 'Pure', # /clr:pure
+ 'Safe', # /clr:safe
+ 'OldSyntax'])) # /clr:oldSyntax
+_MSBuildOnly(_compile, 'CreateHotpatchableImage', _boolean) # /hotpatch
+_MSBuildOnly(_compile, 'MultiProcessorCompilation', _boolean) # /MP
+_MSBuildOnly(_compile, 'PreprocessOutputPath', _string) # /Fi
+_MSBuildOnly(_compile, 'ProcessorNumber', _integer) # the number of processors
+_MSBuildOnly(_compile, 'TrackerLogDirectory', _folder_name)
+_MSBuildOnly(_compile, 'TreatSpecificWarningsAsErrors', _string_list) # /we
+_MSBuildOnly(_compile, 'UseUnicodeForAssemblerListing', _boolean) # /FAu
+
+# Defines a setting that needs very customized processing
+_CustomGeneratePreprocessedFile(_compile, 'GeneratePreprocessedFile')
+
+
+# Directives for converting MSVS VCLinkerTool to MSBuild Link.
+# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
+# the schema of the MSBuild Link settings.
+
+# Options that have the same name in MSVS and MSBuild
+_Same(_link, 'AdditionalDependencies', _file_list)
+_Same(_link, 'AdditionalLibraryDirectories', _folder_list) # /LIBPATH
+_Same(_link, 'AdditionalManifestDependencies', _file_list) # /MANIFESTDEPENDENCY
+_Same(_link, 'AdditionalOptions', _string_list)
+_Same(_link, 'AddModuleNamesToAssembly', _file_list) # /ASSEMBLYMODULE
+_Same(_link, 'AllowIsolation', _boolean) # /ALLOWISOLATION
+_Same(_link, 'AssemblyLinkResource', _file_list) # /ASSEMBLYLINKRESOURCE
+_Same(_link, 'BaseAddress', _string) # /BASE
+_Same(_link, 'CLRUnmanagedCodeCheck', _boolean) # /CLRUNMANAGEDCODECHECK
+_Same(_link, 'DelayLoadDLLs', _file_list) # /DELAYLOAD
+_Same(_link, 'DelaySign', _boolean) # /DELAYSIGN
+_Same(_link, 'EmbedManagedResourceFile', _file_list) # /ASSEMBLYRESOURCE
+_Same(_link, 'EnableUAC', _boolean) # /MANIFESTUAC
+_Same(_link, 'EntryPointSymbol', _string) # /ENTRY
+_Same(_link, 'ForceSymbolReferences', _file_list) # /INCLUDE
+_Same(_link, 'FunctionOrder', _file_name) # /ORDER
+_Same(_link, 'GenerateDebugInformation', _boolean) # /DEBUG
+_Same(_link, 'GenerateMapFile', _boolean) # /MAP
+_Same(_link, 'HeapCommitSize', _string)
+_Same(_link, 'HeapReserveSize', _string) # /HEAP
+_Same(_link, 'IgnoreAllDefaultLibraries', _boolean) # /NODEFAULTLIB
+_Same(_link, 'IgnoreEmbeddedIDL', _boolean) # /IGNOREIDL
+_Same(_link, 'ImportLibrary', _file_name) # /IMPLIB
+_Same(_link, 'KeyContainer', _file_name) # /KEYCONTAINER
+_Same(_link, 'KeyFile', _file_name) # /KEYFILE
+_Same(_link, 'ManifestFile', _file_name) # /ManifestFile
+_Same(_link, 'MapExports', _boolean) # /MAPINFO:EXPORTS
+_Same(_link, 'MapFileName', _file_name)
+_Same(_link, 'MergedIDLBaseFileName', _file_name) # /IDLOUT
+_Same(_link, 'MergeSections', _string) # /MERGE
+_Same(_link, 'MidlCommandFile', _file_name) # /MIDL
+_Same(_link, 'ModuleDefinitionFile', _file_name) # /DEF
+_Same(_link, 'OutputFile', _file_name) # /OUT
+_Same(_link, 'PerUserRedirection', _boolean)
+_Same(_link, 'Profile', _boolean) # /PROFILE
+_Same(_link, 'ProfileGuidedDatabase', _file_name) # /PGD
+_Same(_link, 'ProgramDatabaseFile', _file_name) # /PDB
+_Same(_link, 'RegisterOutput', _boolean)
+_Same(_link, 'SetChecksum', _boolean) # /RELEASE
+_Same(_link, 'StackCommitSize', _string)
+_Same(_link, 'StackReserveSize', _string) # /STACK
+_Same(_link, 'StripPrivateSymbols', _file_name) # /PDBSTRIPPED
+_Same(_link, 'SupportUnloadOfDelayLoadedDLL', _boolean) # /DELAY:UNLOAD
+_Same(_link, 'SuppressStartupBanner', _boolean) # /NOLOGO
+_Same(_link, 'SwapRunFromCD', _boolean) # /SWAPRUN:CD
+_Same(_link, 'TurnOffAssemblyGeneration', _boolean) # /NOASSEMBLY
+_Same(_link, 'TypeLibraryFile', _file_name) # /TLBOUT
+_Same(_link, 'TypeLibraryResourceID', _integer) # /TLBID
+_Same(_link, 'UACUIAccess', _boolean) # /uiAccess='true'
+_Same(_link, 'Version', _string) # /VERSION
+
+_Same(_link, 'EnableCOMDATFolding', _newly_boolean) # /OPT:ICF
+_Same(_link, 'FixedBaseAddress', _newly_boolean) # /FIXED
+_Same(_link, 'LargeAddressAware', _newly_boolean) # /LARGEADDRESSAWARE
+_Same(_link, 'OptimizeReferences', _newly_boolean) # /OPT:REF
+_Same(_link, 'RandomizedBaseAddress', _newly_boolean) # /DYNAMICBASE
+_Same(_link, 'TerminalServerAware', _newly_boolean) # /TSAWARE
+
+_subsystem_enumeration = _Enumeration([
+ 'NotSet',
+ 'Console', # /SUBSYSTEM:CONSOLE
+ 'Windows', # /SUBSYSTEM:WINDOWS
+ 'Native', # /SUBSYSTEM:NATIVE
+ 'EFI Application', # /SUBSYSTEM:EFI_APPLICATION
+ 'EFI Boot Service Driver', # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
+ 'EFI ROM', # /SUBSYSTEM:EFI_ROM
+ 'EFI Runtime', # /SUBSYSTEM:EFI_RUNTIME_DRIVER
+ 'WindowsCE'], # /SUBSYSTEM:WINDOWSCE
+ new=['POSIX']) # /SUBSYSTEM:POSIX
+
+_target_machine_enumeration = _Enumeration([
+ 'NotSet',
+ 'MachineX86', # /MACHINE:X86
+ None,
+ 'MachineARM', # /MACHINE:ARM
+ 'MachineEBC', # /MACHINE:EBC
+ 'MachineIA64', # /MACHINE:IA64
+ None,
+ 'MachineMIPS', # /MACHINE:MIPS
+ 'MachineMIPS16', # /MACHINE:MIPS16
+ 'MachineMIPSFPU', # /MACHINE:MIPSFPU
+ 'MachineMIPSFPU16', # /MACHINE:MIPSFPU16
+ None,
+ None,
+ None,
+ 'MachineSH4', # /MACHINE:SH4
+ None,
+ 'MachineTHUMB', # /MACHINE:THUMB
+ 'MachineX64']) # /MACHINE:X64
+
+_Same(_link, 'AssemblyDebug',
+ _Enumeration(['',
+ 'true', # /ASSEMBLYDEBUG
+ 'false'])) # /ASSEMBLYDEBUG:DISABLE
+_Same(_link, 'CLRImageType',
+ _Enumeration(['Default',
+ 'ForceIJWImage', # /CLRIMAGETYPE:IJW
+ 'ForcePureILImage', # /Switch="CLRIMAGETYPE:PURE
+ 'ForceSafeILImage'])) # /Switch="CLRIMAGETYPE:SAFE
+_Same(_link, 'CLRThreadAttribute',
+ _Enumeration(['DefaultThreadingAttribute', # /CLRTHREADATTRIBUTE:NONE
+ 'MTAThreadingAttribute', # /CLRTHREADATTRIBUTE:MTA
+ 'STAThreadingAttribute'])) # /CLRTHREADATTRIBUTE:STA
+_Same(_link, 'DataExecutionPrevention',
+ _Enumeration(['',
+ 'false', # /NXCOMPAT:NO
+ 'true'])) # /NXCOMPAT
+_Same(_link, 'Driver',
+ _Enumeration(['NotSet',
+ 'Driver', # /Driver
+ 'UpOnly', # /DRIVER:UPONLY
+ 'WDM'])) # /DRIVER:WDM
+_Same(_link, 'LinkTimeCodeGeneration',
+ _Enumeration(['Default',
+ 'UseLinkTimeCodeGeneration', # /LTCG
+ 'PGInstrument', # /LTCG:PGInstrument
+ 'PGOptimization', # /LTCG:PGOptimize
+ 'PGUpdate'])) # /LTCG:PGUpdate
+_Same(_link, 'ShowProgress',
+ _Enumeration(['NotSet',
+ 'LinkVerbose', # /VERBOSE
+ 'LinkVerboseLib'], # /VERBOSE:Lib
+ new=['LinkVerboseICF', # /VERBOSE:ICF
+ 'LinkVerboseREF', # /VERBOSE:REF
+ 'LinkVerboseSAFESEH', # /VERBOSE:SAFESEH
+ 'LinkVerboseCLR'])) # /VERBOSE:CLR
+_Same(_link, 'SubSystem', _subsystem_enumeration)
+_Same(_link, 'TargetMachine', _target_machine_enumeration)
+_Same(_link, 'UACExecutionLevel',
+ _Enumeration(['AsInvoker', # /level='asInvoker'
+ 'HighestAvailable', # /level='highestAvailable'
+ 'RequireAdministrator'])) # /level='requireAdministrator'
+
+
+# Options found in MSVS that have been renamed in MSBuild.
+_Renamed(_link, 'ErrorReporting', 'LinkErrorReporting',
+ _Enumeration(['NoErrorReport', # /ERRORREPORT:NONE
+ 'PromptImmediately', # /ERRORREPORT:PROMPT
+ 'QueueForNextLogin'], # /ERRORREPORT:QUEUE
+ new=['SendErrorReport'])) # /ERRORREPORT:SEND
+_Renamed(_link, 'IgnoreDefaultLibraryNames', 'IgnoreSpecificDefaultLibraries',
+ _file_list) # /NODEFAULTLIB
+_Renamed(_link, 'ResourceOnlyDLL', 'NoEntryPoint', _boolean) # /NOENTRY
+_Renamed(_link, 'SwapRunFromNet', 'SwapRunFromNET', _boolean) # /SWAPRUN:NET
+
+_Moved(_link, 'GenerateManifest', '', _boolean)
+_Moved(_link, 'IgnoreImportLibrary', '', _boolean)
+_Moved(_link, 'LinkIncremental', '', _newly_boolean)
+_Moved(_link, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
+_Moved(_link, 'UseLibraryDependencyInputs', 'ProjectReference', _boolean)
+
+# MSVS options not found in MSBuild.
+_MSVSOnly(_link, 'OptimizeForWindows98', _newly_boolean)
+_MSVSOnly(_link, 'UseUnicodeResponseFiles', _boolean)
+# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp.
+_MSVSOnly(_link, 'AdditionalLibraryDirectories_excluded', _folder_list)
+
+# MSBuild options not found in MSVS.
+_MSBuildOnly(_link, 'BuildingInIDE', _boolean)
+_MSBuildOnly(_link, 'ImageHasSafeExceptionHandlers', _boolean) # /SAFESEH
+_MSBuildOnly(_link, 'LinkDLL', _boolean) # /DLL Visible='false'
+_MSBuildOnly(_link, 'LinkStatus', _boolean) # /LTCG:STATUS
+_MSBuildOnly(_link, 'PreventDllBinding', _boolean) # /ALLOWBIND
+_MSBuildOnly(_link, 'SupportNobindOfDelayLoadedDLL', _boolean) # /DELAY:NOBIND
+_MSBuildOnly(_link, 'TrackerLogDirectory', _folder_name)
+_MSBuildOnly(_link, 'TreatLinkerWarningAsErrors', _boolean) # /WX
+_MSBuildOnly(_link, 'MinimumRequiredVersion', _string)
+_MSBuildOnly(_link, 'MSDOSStubFileName', _file_name) # /STUB Visible='false'
+_MSBuildOnly(_link, 'SectionAlignment', _integer) # /ALIGN
+_MSBuildOnly(_link, 'SpecifySectionAttributes', _string) # /SECTION
+_MSBuildOnly(_link, 'ForceFileOutput',
+ _Enumeration([], new=['Enabled', # /FORCE
+ 'MultiplyDefinedSymbolOnly', #/FORCE:MULTIPLE
+ 'UndefinedSymbolOnly'])) # /FORCE:UNRESOLVED
+_MSBuildOnly(_link, 'CreateHotPatchableImage',
+ _Enumeration([], new=['Enabled', # /FUNCTIONPADMIN
+ 'X86Image', # /FUNCTIONPADMIN:5
+ 'X64Image', # /FUNCTIONPADMIN:6
+ 'ItaniumImage'])) # /FUNCTIONPADMIN:16
+_MSBuildOnly(_link, 'CLRSupportLastError',
+ _Enumeration([], new=['Enabled', # /CLRSupportLastError
+ 'Disabled', # /CLRSupportLastError:NO
+ # /CLRSupportLastError:SYSTEMDLL
+ 'SystemDlls']))
+
+
+# Directives for converting VCResourceCompilerTool to ResourceCompile.
+# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
+# the schema of the MSBuild ResourceCompile settings.
+
+_Same(_rc, 'AdditionalOptions', _string_list)
+_Same(_rc, 'AdditionalIncludeDirectories', _folder_list) # /I
+_Same(_rc, 'Culture', _Integer(msbuild_base=16))
+_Same(_rc, 'IgnoreStandardIncludePath', _boolean) # /X
+_Same(_rc, 'PreprocessorDefinitions', _string_list) # /D
+_Same(_rc, 'ResourceOutputFileName', _string) # /fo
+_Same(_rc, 'ShowProgress', _boolean) # /v
+# There is no UI in VisualStudio 2008 to set the following properties.
+# However they are found in CL and other tools. Include them here for
+# completeness, as they are very likely to have the same usage pattern.
+_Same(_rc, 'SuppressStartupBanner', _boolean) # /nologo
+_Same(_rc, 'UndefinePreprocessorDefinitions', _string_list) # /u
+
+# MSBuild options not found in MSVS.
+_MSBuildOnly(_rc, 'NullTerminateStrings', _boolean) # /n
+_MSBuildOnly(_rc, 'TrackerLogDirectory', _folder_name)
+
+
+# Directives for converting VCMIDLTool to Midl.
+# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
+# the schema of the MSBuild Midl settings.
+
+_Same(_midl, 'AdditionalIncludeDirectories', _folder_list) # /I
+_Same(_midl, 'AdditionalOptions', _string_list)
+_Same(_midl, 'CPreprocessOptions', _string) # /cpp_opt
+_Same(_midl, 'ErrorCheckAllocations', _boolean) # /error allocation
+_Same(_midl, 'ErrorCheckBounds', _boolean) # /error bounds_check
+_Same(_midl, 'ErrorCheckEnumRange', _boolean) # /error enum
+_Same(_midl, 'ErrorCheckRefPointers', _boolean) # /error ref
+_Same(_midl, 'ErrorCheckStubData', _boolean) # /error stub_data
+_Same(_midl, 'GenerateStublessProxies', _boolean) # /Oicf
+_Same(_midl, 'GenerateTypeLibrary', _boolean)
+_Same(_midl, 'HeaderFileName', _file_name) # /h
+_Same(_midl, 'IgnoreStandardIncludePath', _boolean) # /no_def_idir
+_Same(_midl, 'InterfaceIdentifierFileName', _file_name) # /iid
+_Same(_midl, 'MkTypLibCompatible', _boolean) # /mktyplib203
+_Same(_midl, 'OutputDirectory', _string) # /out
+_Same(_midl, 'PreprocessorDefinitions', _string_list) # /D
+_Same(_midl, 'ProxyFileName', _file_name) # /proxy
+_Same(_midl, 'RedirectOutputAndErrors', _file_name) # /o
+_Same(_midl, 'SuppressStartupBanner', _boolean) # /nologo
+_Same(_midl, 'TypeLibraryName', _file_name) # /tlb
+_Same(_midl, 'UndefinePreprocessorDefinitions', _string_list) # /U
+_Same(_midl, 'WarnAsError', _boolean) # /WX
+
+_Same(_midl, 'DefaultCharType',
+ _Enumeration(['Unsigned', # /char unsigned
+ 'Signed', # /char signed
+ 'Ascii'])) # /char ascii7
+_Same(_midl, 'TargetEnvironment',
+ _Enumeration(['NotSet',
+ 'Win32', # /env win32
+ 'Itanium', # /env ia64
+ 'X64'])) # /env x64
+_Same(_midl, 'EnableErrorChecks',
+ _Enumeration(['EnableCustom',
+ 'None', # /error none
+ 'All'])) # /error all
+_Same(_midl, 'StructMemberAlignment',
+ _Enumeration(['NotSet',
+ '1', # Zp1
+ '2', # Zp2
+ '4', # Zp4
+ '8'])) # Zp8
+_Same(_midl, 'WarningLevel',
+ _Enumeration(['0', # /W0
+ '1', # /W1
+ '2', # /W2
+ '3', # /W3
+ '4'])) # /W4
+
+_Renamed(_midl, 'DLLDataFileName', 'DllDataFileName', _file_name) # /dlldata
+_Renamed(_midl, 'ValidateParameters', 'ValidateAllParameters',
+ _boolean) # /robust
+
+# MSBuild options not found in MSVS.
+_MSBuildOnly(_midl, 'ApplicationConfigurationMode', _boolean) # /app_config
+_MSBuildOnly(_midl, 'ClientStubFile', _file_name) # /cstub
+_MSBuildOnly(_midl, 'GenerateClientFiles',
+ _Enumeration([], new=['Stub', # /client stub
+ 'None'])) # /client none
+_MSBuildOnly(_midl, 'GenerateServerFiles',
+ _Enumeration([], new=['Stub', # /client stub
+ 'None'])) # /client none
+_MSBuildOnly(_midl, 'LocaleID', _integer) # /lcid DECIMAL
+_MSBuildOnly(_midl, 'ServerStubFile', _file_name) # /sstub
+_MSBuildOnly(_midl, 'SuppressCompilerWarnings', _boolean) # /no_warn
+_MSBuildOnly(_midl, 'TrackerLogDirectory', _folder_name)
+_MSBuildOnly(_midl, 'TypeLibFormat',
+ _Enumeration([], new=['NewFormat', # /newtlb
+ 'OldFormat'])) # /oldtlb
+
+
+# Directives for converting VCLibrarianTool to Lib.
+# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
+# the schema of the MSBuild Lib settings.
+
+_Same(_lib, 'AdditionalDependencies', _file_list)
+_Same(_lib, 'AdditionalLibraryDirectories', _folder_list) # /LIBPATH
+_Same(_lib, 'AdditionalOptions', _string_list)
+_Same(_lib, 'ExportNamedFunctions', _string_list) # /EXPORT
+_Same(_lib, 'ForceSymbolReferences', _string) # /INCLUDE
+_Same(_lib, 'IgnoreAllDefaultLibraries', _boolean) # /NODEFAULTLIB
+_Same(_lib, 'IgnoreSpecificDefaultLibraries', _file_list) # /NODEFAULTLIB
+_Same(_lib, 'ModuleDefinitionFile', _file_name) # /DEF
+_Same(_lib, 'OutputFile', _file_name) # /OUT
+_Same(_lib, 'SuppressStartupBanner', _boolean) # /NOLOGO
+_Same(_lib, 'UseUnicodeResponseFiles', _boolean)
+
+# TODO(jeanluc) _link defines the same value that gets moved to
+# ProjectReference. We may want to validate that they are consistent.
+_Moved(_lib, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
+
+# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp.
+_MSVSOnly(_lib, 'AdditionalLibraryDirectories_excluded', _folder_list)
+
+_MSBuildOnly(_lib, 'DisplayLibrary', _string) # /LIST Visible='false'
+_MSBuildOnly(_lib, 'ErrorReporting',
+ _Enumeration([], new=['PromptImmediately', # /ERRORREPORT:PROMPT
+ 'QueueForNextLogin', # /ERRORREPORT:QUEUE
+ 'SendErrorReport', # /ERRORREPORT:SEND
+ 'NoErrorReport'])) # /ERRORREPORT:NONE
+_MSBuildOnly(_lib, 'LinkTimeCodeGeneration', _boolean) # /LTCG
+_MSBuildOnly(_lib, 'MinimumRequiredVersion', _string)
+_MSBuildOnly(_lib, 'Name', _file_name) # /NAME
+_MSBuildOnly(_lib, 'RemoveObjects', _file_list) # /REMOVE
+_MSBuildOnly(_lib, 'SubSystem', _subsystem_enumeration)
+_MSBuildOnly(_lib, 'TargetMachine', _target_machine_enumeration)
+_MSBuildOnly(_lib, 'TrackerLogDirectory', _folder_name)
+_MSBuildOnly(_lib, 'TreatLibWarningAsErrors', _boolean) # /WX
+_MSBuildOnly(_lib, 'Verbose', _boolean)
+
+
+# Directives for converting VCManifestTool to Mt.
+# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
+# the schema of the MSBuild Lib settings.
+
+# Options that have the same name in MSVS and MSBuild
+_Same(_manifest, 'AdditionalManifestFiles', _file_list) # /manifest
+_Same(_manifest, 'AdditionalOptions', _string_list)
+_Same(_manifest, 'AssemblyIdentity', _string) # /identity:
+_Same(_manifest, 'ComponentFileName', _file_name) # /dll
+_Same(_manifest, 'GenerateCatalogFiles', _boolean) # /makecdfs
+_Same(_manifest, 'InputResourceManifests', _string) # /inputresource
+_Same(_manifest, 'OutputManifestFile', _file_name) # /out
+_Same(_manifest, 'RegistrarScriptFile', _file_name) # /rgs
+_Same(_manifest, 'ReplacementsFile', _file_name) # /replacements
+_Same(_manifest, 'SuppressStartupBanner', _boolean) # /nologo
+_Same(_manifest, 'TypeLibraryFile', _file_name) # /tlb:
+_Same(_manifest, 'UpdateFileHashes', _boolean) # /hashupdate
+_Same(_manifest, 'UpdateFileHashesSearchPath', _file_name)
+_Same(_manifest, 'VerboseOutput', _boolean) # /verbose
+
+# Options that have moved location.
+_MovedAndRenamed(_manifest, 'ManifestResourceFile',
+ 'ManifestResourceCompile',
+ 'ResourceOutputFileName',
+ _file_name)
+_Moved(_manifest, 'EmbedManifest', '', _boolean)
+
+# MSVS options not found in MSBuild.
+_MSVSOnly(_manifest, 'DependencyInformationFile', _file_name)
+_MSVSOnly(_manifest, 'UseFAT32Workaround', _boolean)
+_MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean)
+
+# MSBuild options not found in MSVS.
+_MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean)
+_MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category
+_MSBuildOnly(_manifest, 'ManifestFromManagedAssembly',
+ _file_name) # /managedassemblyname
+_MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource
+_MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency
+_MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name)
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings_test.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings_test.py
new file mode 100644
index 0000000..c9ca7fd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings_test.py
@@ -0,0 +1,1478 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+""" Unit tests for the MSVSSettings.py file. """
+
+import sys
+import unittest
+import MSVSSettings
+import StringIO
+
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.stderr = StringIO.StringIO()
+
+ def _ExpectedWarnings(self, expected):
+ """ Compares recorded lines to expected warnings. """
+ self.stderr.seek(0)
+ actual = self.stderr.read().split('\n')
+ actual = [line for line in actual if line != '']
+ self.assertEqual(sorted(expected), sorted(actual))
+
+ def test_ValidateMSVSSettings_tool_names(self):
+ """ Tests that only MSVS tool names are allowed. """
+ MSVSSettings.ValidateMSVSSettings({
+ 'VCCLCompilerTool': {},
+ 'VCLinkerTool': {},
+ 'VCMIDLTool': {},
+ 'foo': {},
+ 'VCResourceCompilerTool': {},
+ 'VCLibrarianTool': {},
+ 'VCManifestTool': {},
+ 'ClCompile': {}},
+ self.stderr)
+ self._ExpectedWarnings([
+ 'Warning: unrecognized tool foo',
+ 'Warning: unrecognized tool ClCompile'])
+
+ def test_ValidateMSVSSettings_settings(self):
+ """ Tests that for invalid MSVS settings. """
+ MSVSSettings.ValidateMSVSSettings({
+ 'VCCLCompilerTool': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2',
+ 'AdditionalOptions': ['string1', 'string2'],
+ 'AdditionalUsingDirectories': 'folder1;folder2',
+ 'AssemblerListingLocation': 'a_file_name',
+ 'AssemblerOutput': '0',
+ 'BasicRuntimeChecks': '5',
+ 'BrowseInformation': 'fdkslj',
+ 'BrowseInformationFile': 'a_file_name',
+ 'BufferSecurityCheck': 'true',
+ 'CallingConvention': '-1',
+ 'CompileAs': '1',
+ 'DebugInformationFormat': '2',
+ 'DefaultCharIsUnsigned': 'true',
+ 'Detect64BitPortabilityProblems': 'true',
+ 'DisableLanguageExtensions': 'true',
+ 'DisableSpecificWarnings': 'string1;string2',
+ 'EnableEnhancedInstructionSet': '1',
+ 'EnableFiberSafeOptimizations': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'EnableIntrinsicFunctions': 'true',
+ 'EnablePREfast': 'true',
+ 'Enableprefast': 'bogus',
+ 'ErrorReporting': '1',
+ 'ExceptionHandling': '1',
+ 'ExpandAttributedSource': 'true',
+ 'FavorSizeOrSpeed': '1',
+ 'FloatingPointExceptions': 'true',
+ 'FloatingPointModel': '1',
+ 'ForceConformanceInForLoopScope': 'true',
+ 'ForcedIncludeFiles': 'file1;file2',
+ 'ForcedUsingFiles': 'file1;file2',
+ 'GeneratePreprocessedFile': '1',
+ 'GenerateXMLDocumentationFiles': 'true',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InlineFunctionExpansion': '1',
+ 'KeepComments': 'true',
+ 'MinimalRebuild': 'true',
+ 'ObjectFile': 'a_file_name',
+ 'OmitDefaultLibName': 'true',
+ 'OmitFramePointers': 'true',
+ 'OpenMP': 'true',
+ 'Optimization': '1',
+ 'PrecompiledHeaderFile': 'a_file_name',
+ 'PrecompiledHeaderThrough': 'a_file_name',
+ 'PreprocessorDefinitions': 'string1;string2',
+ 'ProgramDataBaseFileName': 'a_file_name',
+ 'RuntimeLibrary': '1',
+ 'RuntimeTypeInfo': 'true',
+ 'ShowIncludes': 'true',
+ 'SmallerTypeCheck': 'true',
+ 'StringPooling': 'true',
+ 'StructMemberAlignment': '1',
+ 'SuppressStartupBanner': 'true',
+ 'TreatWChar_tAsBuiltInType': 'true',
+ 'UndefineAllPreprocessorDefinitions': 'true',
+ 'UndefinePreprocessorDefinitions': 'string1;string2',
+ 'UseFullPaths': 'true',
+ 'UsePrecompiledHeader': '1',
+ 'UseUnicodeResponseFiles': 'true',
+ 'WarnAsError': 'true',
+ 'WarningLevel': '1',
+ 'WholeProgramOptimization': 'true',
+ 'XMLDocumentationFileName': 'a_file_name',
+ 'ZZXYZ': 'bogus'},
+ 'VCLinkerTool': {
+ 'AdditionalDependencies': 'file1;file2',
+ 'AdditionalLibraryDirectories': 'folder1;folder2',
+ 'AdditionalManifestDependencies': 'file1;file2',
+ 'AdditionalOptions': 'a string1',
+ 'AddModuleNamesToAssembly': 'file1;file2',
+ 'AllowIsolation': 'true',
+ 'AssemblyDebug': '2',
+ 'AssemblyLinkResource': 'file1;file2',
+ 'BaseAddress': 'a string1',
+ 'CLRImageType': '2',
+ 'CLRThreadAttribute': '2',
+ 'CLRUnmanagedCodeCheck': 'true',
+ 'DataExecutionPrevention': '2',
+ 'DelayLoadDLLs': 'file1;file2',
+ 'DelaySign': 'true',
+ 'Driver': '2',
+ 'EmbedManagedResourceFile': 'file1;file2',
+ 'EnableCOMDATFolding': '2',
+ 'EnableUAC': 'true',
+ 'EntryPointSymbol': 'a string1',
+ 'ErrorReporting': '2',
+ 'FixedBaseAddress': '2',
+ 'ForceSymbolReferences': 'file1;file2',
+ 'FunctionOrder': 'a_file_name',
+ 'GenerateDebugInformation': 'true',
+ 'GenerateManifest': 'true',
+ 'GenerateMapFile': 'true',
+ 'HeapCommitSize': 'a string1',
+ 'HeapReserveSize': 'a string1',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreDefaultLibraryNames': 'file1;file2',
+ 'IgnoreEmbeddedIDL': 'true',
+ 'IgnoreImportLibrary': 'true',
+ 'ImportLibrary': 'a_file_name',
+ 'KeyContainer': 'a_file_name',
+ 'KeyFile': 'a_file_name',
+ 'LargeAddressAware': '2',
+ 'LinkIncremental': '2',
+ 'LinkLibraryDependencies': 'true',
+ 'LinkTimeCodeGeneration': '2',
+ 'ManifestFile': 'a_file_name',
+ 'MapExports': 'true',
+ 'MapFileName': 'a_file_name',
+ 'MergedIDLBaseFileName': 'a_file_name',
+ 'MergeSections': 'a string1',
+ 'MidlCommandFile': 'a_file_name',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'OptimizeForWindows98': '1',
+ 'OptimizeReferences': '2',
+ 'OutputFile': 'a_file_name',
+ 'PerUserRedirection': 'true',
+ 'Profile': 'true',
+ 'ProfileGuidedDatabase': 'a_file_name',
+ 'ProgramDatabaseFile': 'a_file_name',
+ 'RandomizedBaseAddress': '2',
+ 'RegisterOutput': 'true',
+ 'ResourceOnlyDLL': 'true',
+ 'SetChecksum': 'true',
+ 'ShowProgress': '2',
+ 'StackCommitSize': 'a string1',
+ 'StackReserveSize': 'a string1',
+ 'StripPrivateSymbols': 'a_file_name',
+ 'SubSystem': '2',
+ 'SupportUnloadOfDelayLoadedDLL': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'SwapRunFromCD': 'true',
+ 'SwapRunFromNet': 'true',
+ 'TargetMachine': '2',
+ 'TerminalServerAware': '2',
+ 'TurnOffAssemblyGeneration': 'true',
+ 'TypeLibraryFile': 'a_file_name',
+ 'TypeLibraryResourceID': '33',
+ 'UACExecutionLevel': '2',
+ 'UACUIAccess': 'true',
+ 'UseLibraryDependencyInputs': 'true',
+ 'UseUnicodeResponseFiles': 'true',
+ 'Version': 'a string1'},
+ 'VCMIDLTool': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2',
+ 'AdditionalOptions': 'a string1',
+ 'CPreprocessOptions': 'a string1',
+ 'DefaultCharType': '1',
+ 'DLLDataFileName': 'a_file_name',
+ 'EnableErrorChecks': '1',
+ 'ErrorCheckAllocations': 'true',
+ 'ErrorCheckBounds': 'true',
+ 'ErrorCheckEnumRange': 'true',
+ 'ErrorCheckRefPointers': 'true',
+ 'ErrorCheckStubData': 'true',
+ 'GenerateStublessProxies': 'true',
+ 'GenerateTypeLibrary': 'true',
+ 'HeaderFileName': 'a_file_name',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InterfaceIdentifierFileName': 'a_file_name',
+ 'MkTypLibCompatible': 'true',
+ 'notgood': 'bogus',
+ 'OutputDirectory': 'a string1',
+ 'PreprocessorDefinitions': 'string1;string2',
+ 'ProxyFileName': 'a_file_name',
+ 'RedirectOutputAndErrors': 'a_file_name',
+ 'StructMemberAlignment': '1',
+ 'SuppressStartupBanner': 'true',
+ 'TargetEnvironment': '1',
+ 'TypeLibraryName': 'a_file_name',
+ 'UndefinePreprocessorDefinitions': 'string1;string2',
+ 'ValidateParameters': 'true',
+ 'WarnAsError': 'true',
+ 'WarningLevel': '1'},
+ 'VCResourceCompilerTool': {
+ 'AdditionalOptions': 'a string1',
+ 'AdditionalIncludeDirectories': 'folder1;folder2',
+ 'Culture': '1003',
+ 'IgnoreStandardIncludePath': 'true',
+ 'notgood2': 'bogus',
+ 'PreprocessorDefinitions': 'string1;string2',
+ 'ResourceOutputFileName': 'a string1',
+ 'ShowProgress': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'UndefinePreprocessorDefinitions': 'string1;string2'},
+ 'VCLibrarianTool': {
+ 'AdditionalDependencies': 'file1;file2',
+ 'AdditionalLibraryDirectories': 'folder1;folder2',
+ 'AdditionalOptions': 'a string1',
+ 'ExportNamedFunctions': 'string1;string2',
+ 'ForceSymbolReferences': 'a string1',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreSpecificDefaultLibraries': 'file1;file2',
+ 'LinkLibraryDependencies': 'true',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'OutputFile': 'a_file_name',
+ 'SuppressStartupBanner': 'true',
+ 'UseUnicodeResponseFiles': 'true'},
+ 'VCManifestTool': {
+ 'AdditionalManifestFiles': 'file1;file2',
+ 'AdditionalOptions': 'a string1',
+ 'AssemblyIdentity': 'a string1',
+ 'ComponentFileName': 'a_file_name',
+ 'DependencyInformationFile': 'a_file_name',
+ 'GenerateCatalogFiles': 'true',
+ 'InputResourceManifests': 'a string1',
+ 'ManifestResourceFile': 'a_file_name',
+ 'OutputManifestFile': 'a_file_name',
+ 'RegistrarScriptFile': 'a_file_name',
+ 'ReplacementsFile': 'a_file_name',
+ 'SuppressStartupBanner': 'true',
+ 'TypeLibraryFile': 'a_file_name',
+ 'UpdateFileHashes': 'truel',
+ 'UpdateFileHashesSearchPath': 'a_file_name',
+ 'UseFAT32Workaround': 'true',
+ 'UseUnicodeResponseFiles': 'true',
+ 'VerboseOutput': 'true'}},
+ self.stderr)
+ self._ExpectedWarnings([
+ 'Warning: unrecognized value "5" for VCCLCompilerTool/'
+ 'BasicRuntimeChecks',
+ 'Warning: unrecognized value "fdkslj" for VCCLCompilerTool/'
+ 'BrowseInformation',
+ 'Warning: unrecognized value "-1" for VCCLCompilerTool/'
+ 'CallingConvention',
+ 'Warning: unrecognized value "2" for VCCLCompilerTool/'
+ 'DebugInformationFormat',
+ 'Warning: unrecognized setting VCCLCompilerTool/Enableprefast',
+ 'Warning: unrecognized setting VCCLCompilerTool/ZZXYZ',
+ 'Warning: unrecognized value "2" for VCLinkerTool/TargetMachine',
+ 'Warning: unrecognized setting VCMIDLTool/notgood',
+ 'Warning: unrecognized setting VCResourceCompilerTool/notgood2',
+ 'Warning: unrecognized value "truel" for VCManifestTool/'
+ 'UpdateFileHashes'])
+
+ def test_ValidateMSBuildSettings_settings(self):
+ """ Tests that for invalid MSBuild settings. """
+ MSVSSettings.ValidateMSBuildSettings({
+ 'ClCompile': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2',
+ 'AdditionalOptions': ['string1', 'string2'],
+ 'AdditionalUsingDirectories': 'folder1;folder2',
+ 'AssemblerListingLocation': 'a_file_name',
+ 'AssemblerOutput': 'NoListing',
+ 'BasicRuntimeChecks': 'StackFrameRuntimeCheck',
+ 'BrowseInformation': 'false',
+ 'BrowseInformationFile': 'a_file_name',
+ 'BufferSecurityCheck': 'true',
+ 'BuildingInIDE': 'true',
+ 'CallingConvention': 'Cdecl',
+ 'CompileAs': 'CompileAsC',
+ 'CompileAsManaged': 'Pure',
+ 'CreateHotpatchableImage': 'true',
+ 'DebugInformationFormat': 'ProgramDatabase',
+ 'DisableLanguageExtensions': 'true',
+ 'DisableSpecificWarnings': 'string1;string2',
+ 'EnableEnhancedInstructionSet': 'StreamingSIMDExtensions',
+ 'EnableFiberSafeOptimizations': 'true',
+ 'EnablePREfast': 'true',
+ 'Enableprefast': 'bogus',
+ 'ErrorReporting': 'Prompt',
+ 'ExceptionHandling': 'SyncCThrow',
+ 'ExpandAttributedSource': 'true',
+ 'FavorSizeOrSpeed': 'Neither',
+ 'FloatingPointExceptions': 'true',
+ 'FloatingPointModel': 'Precise',
+ 'ForceConformanceInForLoopScope': 'true',
+ 'ForcedIncludeFiles': 'file1;file2',
+ 'ForcedUsingFiles': 'file1;file2',
+ 'FunctionLevelLinking': 'false',
+ 'GenerateXMLDocumentationFiles': 'true',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InlineFunctionExpansion': 'OnlyExplicitInline',
+ 'IntrinsicFunctions': 'false',
+ 'MinimalRebuild': 'true',
+ 'MultiProcessorCompilation': 'true',
+ 'ObjectFileName': 'a_file_name',
+ 'OmitDefaultLibName': 'true',
+ 'OmitFramePointers': 'true',
+ 'OpenMPSupport': 'true',
+ 'Optimization': 'Disabled',
+ 'PrecompiledHeader': 'NotUsing',
+ 'PrecompiledHeaderFile': 'a_file_name',
+ 'PrecompiledHeaderOutputFile': 'a_file_name',
+ 'PreprocessKeepComments': 'true',
+ 'PreprocessorDefinitions': 'string1;string2',
+ 'PreprocessOutputPath': 'a string1',
+ 'PreprocessSuppressLineNumbers': 'false',
+ 'PreprocessToFile': 'false',
+ 'ProcessorNumber': '33',
+ 'ProgramDataBaseFileName': 'a_file_name',
+ 'RuntimeLibrary': 'MultiThreaded',
+ 'RuntimeTypeInfo': 'true',
+ 'ShowIncludes': 'true',
+ 'SmallerTypeCheck': 'true',
+ 'StringPooling': 'true',
+ 'StructMemberAlignment': '1Byte',
+ 'SuppressStartupBanner': 'true',
+ 'TrackerLogDirectory': 'a_folder',
+ 'TreatSpecificWarningsAsErrors': 'string1;string2',
+ 'TreatWarningAsError': 'true',
+ 'TreatWChar_tAsBuiltInType': 'true',
+ 'UndefineAllPreprocessorDefinitions': 'true',
+ 'UndefinePreprocessorDefinitions': 'string1;string2',
+ 'UseFullPaths': 'true',
+ 'UseUnicodeForAssemblerListing': 'true',
+ 'WarningLevel': 'TurnOffAllWarnings',
+ 'WholeProgramOptimization': 'true',
+ 'XMLDocumentationFileName': 'a_file_name',
+ 'ZZXYZ': 'bogus'},
+ 'Link': {
+ 'AdditionalDependencies': 'file1;file2',
+ 'AdditionalLibraryDirectories': 'folder1;folder2',
+ 'AdditionalManifestDependencies': 'file1;file2',
+ 'AdditionalOptions': 'a string1',
+ 'AddModuleNamesToAssembly': 'file1;file2',
+ 'AllowIsolation': 'true',
+ 'AssemblyDebug': '',
+ 'AssemblyLinkResource': 'file1;file2',
+ 'BaseAddress': 'a string1',
+ 'BuildingInIDE': 'true',
+ 'CLRImageType': 'ForceIJWImage',
+ 'CLRSupportLastError': 'Enabled',
+ 'CLRThreadAttribute': 'MTAThreadingAttribute',
+ 'CLRUnmanagedCodeCheck': 'true',
+ 'CreateHotPatchableImage': 'X86Image',
+ 'DataExecutionPrevention': 'false',
+ 'DelayLoadDLLs': 'file1;file2',
+ 'DelaySign': 'true',
+ 'Driver': 'NotSet',
+ 'EmbedManagedResourceFile': 'file1;file2',
+ 'EnableCOMDATFolding': 'false',
+ 'EnableUAC': 'true',
+ 'EntryPointSymbol': 'a string1',
+ 'FixedBaseAddress': 'false',
+ 'ForceFileOutput': 'Enabled',
+ 'ForceSymbolReferences': 'file1;file2',
+ 'FunctionOrder': 'a_file_name',
+ 'GenerateDebugInformation': 'true',
+ 'GenerateMapFile': 'true',
+ 'HeapCommitSize': 'a string1',
+ 'HeapReserveSize': 'a string1',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreEmbeddedIDL': 'true',
+ 'IgnoreSpecificDefaultLibraries': 'a_file_list',
+ 'ImageHasSafeExceptionHandlers': 'true',
+ 'ImportLibrary': 'a_file_name',
+ 'KeyContainer': 'a_file_name',
+ 'KeyFile': 'a_file_name',
+ 'LargeAddressAware': 'false',
+ 'LinkDLL': 'true',
+ 'LinkErrorReporting': 'SendErrorReport',
+ 'LinkStatus': 'true',
+ 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration',
+ 'ManifestFile': 'a_file_name',
+ 'MapExports': 'true',
+ 'MapFileName': 'a_file_name',
+ 'MergedIDLBaseFileName': 'a_file_name',
+ 'MergeSections': 'a string1',
+ 'MidlCommandFile': 'a_file_name',
+ 'MinimumRequiredVersion': 'a string1',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'MSDOSStubFileName': 'a_file_name',
+ 'NoEntryPoint': 'true',
+ 'OptimizeReferences': 'false',
+ 'OutputFile': 'a_file_name',
+ 'PerUserRedirection': 'true',
+ 'PreventDllBinding': 'true',
+ 'Profile': 'true',
+ 'ProfileGuidedDatabase': 'a_file_name',
+ 'ProgramDatabaseFile': 'a_file_name',
+ 'RandomizedBaseAddress': 'false',
+ 'RegisterOutput': 'true',
+ 'SectionAlignment': '33',
+ 'SetChecksum': 'true',
+ 'ShowProgress': 'LinkVerboseREF',
+ 'SpecifySectionAttributes': 'a string1',
+ 'StackCommitSize': 'a string1',
+ 'StackReserveSize': 'a string1',
+ 'StripPrivateSymbols': 'a_file_name',
+ 'SubSystem': 'Console',
+ 'SupportNobindOfDelayLoadedDLL': 'true',
+ 'SupportUnloadOfDelayLoadedDLL': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'SwapRunFromCD': 'true',
+ 'SwapRunFromNET': 'true',
+ 'TargetMachine': 'MachineX86',
+ 'TerminalServerAware': 'false',
+ 'TrackerLogDirectory': 'a_folder',
+ 'TreatLinkerWarningAsErrors': 'true',
+ 'TurnOffAssemblyGeneration': 'true',
+ 'TypeLibraryFile': 'a_file_name',
+ 'TypeLibraryResourceID': '33',
+ 'UACExecutionLevel': 'AsInvoker',
+ 'UACUIAccess': 'true',
+ 'Version': 'a string1'},
+ 'ResourceCompile': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2',
+ 'AdditionalOptions': 'a string1',
+ 'Culture': '0x236',
+ 'IgnoreStandardIncludePath': 'true',
+ 'NullTerminateStrings': 'true',
+ 'PreprocessorDefinitions': 'string1;string2',
+ 'ResourceOutputFileName': 'a string1',
+ 'ShowProgress': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'TrackerLogDirectory': 'a_folder',
+ 'UndefinePreprocessorDefinitions': 'string1;string2'},
+ 'Midl': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2',
+ 'AdditionalOptions': 'a string1',
+ 'ApplicationConfigurationMode': 'true',
+ 'ClientStubFile': 'a_file_name',
+ 'CPreprocessOptions': 'a string1',
+ 'DefaultCharType': 'Signed',
+ 'DllDataFileName': 'a_file_name',
+ 'EnableErrorChecks': 'EnableCustom',
+ 'ErrorCheckAllocations': 'true',
+ 'ErrorCheckBounds': 'true',
+ 'ErrorCheckEnumRange': 'true',
+ 'ErrorCheckRefPointers': 'true',
+ 'ErrorCheckStubData': 'true',
+ 'GenerateClientFiles': 'Stub',
+ 'GenerateServerFiles': 'None',
+ 'GenerateStublessProxies': 'true',
+ 'GenerateTypeLibrary': 'true',
+ 'HeaderFileName': 'a_file_name',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InterfaceIdentifierFileName': 'a_file_name',
+ 'LocaleID': '33',
+ 'MkTypLibCompatible': 'true',
+ 'OutputDirectory': 'a string1',
+ 'PreprocessorDefinitions': 'string1;string2',
+ 'ProxyFileName': 'a_file_name',
+ 'RedirectOutputAndErrors': 'a_file_name',
+ 'ServerStubFile': 'a_file_name',
+ 'StructMemberAlignment': 'NotSet',
+ 'SuppressCompilerWarnings': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'TargetEnvironment': 'Itanium',
+ 'TrackerLogDirectory': 'a_folder',
+ 'TypeLibFormat': 'NewFormat',
+ 'TypeLibraryName': 'a_file_name',
+ 'UndefinePreprocessorDefinitions': 'string1;string2',
+ 'ValidateAllParameters': 'true',
+ 'WarnAsError': 'true',
+ 'WarningLevel': '1'},
+ 'Lib': {
+ 'AdditionalDependencies': 'file1;file2',
+ 'AdditionalLibraryDirectories': 'folder1;folder2',
+ 'AdditionalOptions': 'a string1',
+ 'DisplayLibrary': 'a string1',
+ 'ErrorReporting': 'PromptImmediately',
+ 'ExportNamedFunctions': 'string1;string2',
+ 'ForceSymbolReferences': 'a string1',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreSpecificDefaultLibraries': 'file1;file2',
+ 'LinkTimeCodeGeneration': 'true',
+ 'MinimumRequiredVersion': 'a string1',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'Name': 'a_file_name',
+ 'OutputFile': 'a_file_name',
+ 'RemoveObjects': 'file1;file2',
+ 'SubSystem': 'Console',
+ 'SuppressStartupBanner': 'true',
+ 'TargetMachine': 'MachineX86i',
+ 'TrackerLogDirectory': 'a_folder',
+ 'TreatLibWarningAsErrors': 'true',
+ 'UseUnicodeResponseFiles': 'true',
+ 'Verbose': 'true'},
+ 'Mt': {
+ 'AdditionalManifestFiles': 'file1;file2',
+ 'AdditionalOptions': 'a string1',
+ 'AssemblyIdentity': 'a string1',
+ 'ComponentFileName': 'a_file_name',
+ 'EnableDPIAwareness': 'fal',
+ 'GenerateCatalogFiles': 'truel',
+ 'GenerateCategoryTags': 'true',
+ 'InputResourceManifests': 'a string1',
+ 'ManifestFromManagedAssembly': 'a_file_name',
+ 'notgood3': 'bogus',
+ 'OutputManifestFile': 'a_file_name',
+ 'OutputResourceManifests': 'a string1',
+ 'RegistrarScriptFile': 'a_file_name',
+ 'ReplacementsFile': 'a_file_name',
+ 'SuppressDependencyElement': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'TrackerLogDirectory': 'a_folder',
+ 'TypeLibraryFile': 'a_file_name',
+ 'UpdateFileHashes': 'true',
+ 'UpdateFileHashesSearchPath': 'a_file_name',
+ 'VerboseOutput': 'true'},
+ 'ProjectReference': {
+ 'LinkLibraryDependencies': 'true',
+ 'UseLibraryDependencyInputs': 'true'},
+ 'ManifestResourceCompile': {
+ 'ResourceOutputFileName': 'a_file_name'},
+ '': {
+ 'EmbedManifest': 'true',
+ 'GenerateManifest': 'true',
+ 'IgnoreImportLibrary': 'true',
+ 'LinkIncremental': 'false'}},
+ self.stderr)
+ self._ExpectedWarnings([
+ 'Warning: unrecognized setting ClCompile/Enableprefast',
+ 'Warning: unrecognized setting ClCompile/ZZXYZ',
+ 'Warning: unrecognized setting Mt/notgood3',
+ 'Warning: unrecognized value "truel" for Mt/GenerateCatalogFiles',
+ 'Warning: unrecognized value "MachineX86i" for Lib/TargetMachine',
+ 'Warning: unrecognized value "fal" for Mt/EnableDPIAwareness'])
+
+ def test_ConvertToMsBuildSettings_empty(self):
+ """ Tests an empty conversion. """
+ msvs_settings = {}
+ expected_msbuild_settings = {}
+ actual_msbuild_settings = MSVSSettings.ConvertToMsBuildSettings(
+ msvs_settings,
+ self.stderr)
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
+ self._ExpectedWarnings([])
+
+ def test_ConvertToMsBuildSettings_minimal(self):
+ """ Tests a minimal conversion. """
+ msvs_settings = {
+ 'VCCLCompilerTool': {
+ 'AdditionalIncludeDirectories': 'dir1',
+ 'AdditionalOptions': '/foo',
+ 'BasicRuntimeChecks': '0',
+ },
+ 'VCLinkerTool': {
+ 'LinkTimeCodeGeneration': '1',
+ 'ErrorReporting': '1',
+ 'DataExecutionPrevention': '2',
+ },
+ }
+ expected_msbuild_settings = {
+ 'ClCompile': {
+ 'AdditionalIncludeDirectories': 'dir1',
+ 'AdditionalOptions': '/foo',
+ 'BasicRuntimeChecks': 'Default',
+ },
+ 'Link': {
+ 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration',
+ 'LinkErrorReporting': 'PromptImmediately',
+ 'DataExecutionPrevention': 'true',
+ },
+ }
+ actual_msbuild_settings = MSVSSettings.ConvertToMsBuildSettings(
+ msvs_settings,
+ self.stderr)
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
+ self._ExpectedWarnings([])
+
+ def test_ConvertToMsBuildSettings_warnings(self):
+ """ Tests conversion that generates warnings. """
+ msvs_settings = {
+ 'VCCLCompilerTool': {
+ 'AdditionalIncludeDirectories': '1',
+ 'AdditionalOptions': '2',
+ # These are incorrect values:
+ 'BasicRuntimeChecks': '12',
+ 'BrowseInformation': '21',
+ 'UsePrecompiledHeader': '13',
+ 'GeneratePreprocessedFile': '14'},
+ 'VCLinkerTool': {
+ # These are incorrect values:
+ 'Driver': '10',
+ 'LinkTimeCodeGeneration': '31',
+ 'ErrorReporting': '21',
+ 'FixedBaseAddress': '6'},
+ 'VCResourceCompilerTool': {
+ # Custom
+ 'Culture': '1003'}}
+ expected_msbuild_settings = {
+ 'ClCompile': {
+ 'AdditionalIncludeDirectories': '1',
+ 'AdditionalOptions': '2'},
+ 'Link': {},
+ 'ResourceCompile': {
+ # Custom
+ 'Culture': '0x03eb'}}
+ actual_msbuild_settings = MSVSSettings.ConvertToMsBuildSettings(
+ msvs_settings,
+ self.stderr)
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
+ self._ExpectedWarnings([
+ 'Warning: unrecognized value "12" for VCCLCompilerTool/'
+ 'BasicRuntimeChecks while converting to MSBuild.',
+ 'Warning: unrecognized value "21" for VCCLCompilerTool/'
+ 'BrowseInformation while converting to MSBuild.',
+ 'Warning: unrecognized value "13" for VCCLCompilerTool/'
+ 'UsePrecompiledHeader while converting to MSBuild.',
+ 'Warning: unrecognized value "14" for VCCLCompilerTool/'
+ 'GeneratePreprocessedFile while converting to MSBuild.',
+
+ 'Warning: unrecognized value "10" for VCLinkerTool/'
+ 'Driver while converting to MSBuild.',
+ 'Warning: unrecognized value "31" for VCLinkerTool/'
+ 'LinkTimeCodeGeneration while converting to MSBuild.',
+ 'Warning: unrecognized value "21" for VCLinkerTool/'
+ 'ErrorReporting while converting to MSBuild.',
+ 'Warning: unrecognized value "6" for VCLinkerTool/'
+ 'FixedBaseAddress while converting to MSBuild.',
+ ])
+
+ def test_ConvertToMsBuildSettings_full_synthetic(self):
+ """ Tests conversion of all the MsBuild settings. """
+ msvs_settings = {
+ 'VCCLCompilerTool': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string',
+ 'AdditionalUsingDirectories': 'folder1;folder2;folder3',
+ 'AssemblerListingLocation': 'a_file_name',
+ 'AssemblerOutput': '0',
+ 'BasicRuntimeChecks': '1',
+ 'BrowseInformation': '2',
+ 'BrowseInformationFile': 'a_file_name',
+ 'BufferSecurityCheck': 'true',
+ 'CallingConvention': '0',
+ 'CompileAs': '1',
+ 'DebugInformationFormat': '4',
+ 'DefaultCharIsUnsigned': 'true',
+ 'Detect64BitPortabilityProblems': 'true',
+ 'DisableLanguageExtensions': 'true',
+ 'DisableSpecificWarnings': 'd1;d2;d3',
+ 'EnableEnhancedInstructionSet': '0',
+ 'EnableFiberSafeOptimizations': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'EnableIntrinsicFunctions': 'true',
+ 'EnablePREfast': 'true',
+ 'ErrorReporting': '1',
+ 'ExceptionHandling': '2',
+ 'ExpandAttributedSource': 'true',
+ 'FavorSizeOrSpeed': '0',
+ 'FloatingPointExceptions': 'true',
+ 'FloatingPointModel': '1',
+ 'ForceConformanceInForLoopScope': 'true',
+ 'ForcedIncludeFiles': 'file1;file2;file3',
+ 'ForcedUsingFiles': 'file1;file2;file3',
+ 'GeneratePreprocessedFile': '1',
+ 'GenerateXMLDocumentationFiles': 'true',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InlineFunctionExpansion': '2',
+ 'KeepComments': 'true',
+ 'MinimalRebuild': 'true',
+ 'ObjectFile': 'a_file_name',
+ 'OmitDefaultLibName': 'true',
+ 'OmitFramePointers': 'true',
+ 'OpenMP': 'true',
+ 'Optimization': '3',
+ 'PrecompiledHeaderFile': 'a_file_name',
+ 'PrecompiledHeaderThrough': 'a_file_name',
+ 'PreprocessorDefinitions': 'd1;d2;d3',
+ 'ProgramDataBaseFileName': 'a_file_name',
+ 'RuntimeLibrary': '0',
+ 'RuntimeTypeInfo': 'true',
+ 'ShowIncludes': 'true',
+ 'SmallerTypeCheck': 'true',
+ 'StringPooling': 'true',
+ 'StructMemberAlignment': '1',
+ 'SuppressStartupBanner': 'true',
+ 'TreatWChar_tAsBuiltInType': 'true',
+ 'UndefineAllPreprocessorDefinitions': 'true',
+ 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
+ 'UseFullPaths': 'true',
+ 'UsePrecompiledHeader': '1',
+ 'UseUnicodeResponseFiles': 'true',
+ 'WarnAsError': 'true',
+ 'WarningLevel': '2',
+ 'WholeProgramOptimization': 'true',
+ 'XMLDocumentationFileName': 'a_file_name'},
+ 'VCLinkerTool': {
+ 'AdditionalDependencies': 'file1;file2;file3',
+ 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
+ 'AdditionalLibraryDirectories_excluded': 'folder1;folder2;folder3',
+ 'AdditionalManifestDependencies': 'file1;file2;file3',
+ 'AdditionalOptions': 'a_string',
+ 'AddModuleNamesToAssembly': 'file1;file2;file3',
+ 'AllowIsolation': 'true',
+ 'AssemblyDebug': '0',
+ 'AssemblyLinkResource': 'file1;file2;file3',
+ 'BaseAddress': 'a_string',
+ 'CLRImageType': '1',
+ 'CLRThreadAttribute': '2',
+ 'CLRUnmanagedCodeCheck': 'true',
+ 'DataExecutionPrevention': '0',
+ 'DelayLoadDLLs': 'file1;file2;file3',
+ 'DelaySign': 'true',
+ 'Driver': '1',
+ 'EmbedManagedResourceFile': 'file1;file2;file3',
+ 'EnableCOMDATFolding': '0',
+ 'EnableUAC': 'true',
+ 'EntryPointSymbol': 'a_string',
+ 'ErrorReporting': '0',
+ 'FixedBaseAddress': '1',
+ 'ForceSymbolReferences': 'file1;file2;file3',
+ 'FunctionOrder': 'a_file_name',
+ 'GenerateDebugInformation': 'true',
+ 'GenerateManifest': 'true',
+ 'GenerateMapFile': 'true',
+ 'HeapCommitSize': 'a_string',
+ 'HeapReserveSize': 'a_string',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreDefaultLibraryNames': 'file1;file2;file3',
+ 'IgnoreEmbeddedIDL': 'true',
+ 'IgnoreImportLibrary': 'true',
+ 'ImportLibrary': 'a_file_name',
+ 'KeyContainer': 'a_file_name',
+ 'KeyFile': 'a_file_name',
+ 'LargeAddressAware': '2',
+ 'LinkIncremental': '1',
+ 'LinkLibraryDependencies': 'true',
+ 'LinkTimeCodeGeneration': '2',
+ 'ManifestFile': 'a_file_name',
+ 'MapExports': 'true',
+ 'MapFileName': 'a_file_name',
+ 'MergedIDLBaseFileName': 'a_file_name',
+ 'MergeSections': 'a_string',
+ 'MidlCommandFile': 'a_file_name',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'OptimizeForWindows98': '1',
+ 'OptimizeReferences': '0',
+ 'OutputFile': 'a_file_name',
+ 'PerUserRedirection': 'true',
+ 'Profile': 'true',
+ 'ProfileGuidedDatabase': 'a_file_name',
+ 'ProgramDatabaseFile': 'a_file_name',
+ 'RandomizedBaseAddress': '1',
+ 'RegisterOutput': 'true',
+ 'ResourceOnlyDLL': 'true',
+ 'SetChecksum': 'true',
+ 'ShowProgress': '0',
+ 'StackCommitSize': 'a_string',
+ 'StackReserveSize': 'a_string',
+ 'StripPrivateSymbols': 'a_file_name',
+ 'SubSystem': '2',
+ 'SupportUnloadOfDelayLoadedDLL': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'SwapRunFromCD': 'true',
+ 'SwapRunFromNet': 'true',
+ 'TargetMachine': '3',
+ 'TerminalServerAware': '2',
+ 'TurnOffAssemblyGeneration': 'true',
+ 'TypeLibraryFile': 'a_file_name',
+ 'TypeLibraryResourceID': '33',
+ 'UACExecutionLevel': '1',
+ 'UACUIAccess': 'true',
+ 'UseLibraryDependencyInputs': 'false',
+ 'UseUnicodeResponseFiles': 'true',
+ 'Version': 'a_string'},
+ 'VCResourceCompilerTool': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string',
+ 'Culture': '1003',
+ 'IgnoreStandardIncludePath': 'true',
+ 'PreprocessorDefinitions': 'd1;d2;d3',
+ 'ResourceOutputFileName': 'a_string',
+ 'ShowProgress': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'UndefinePreprocessorDefinitions': 'd1;d2;d3'},
+ 'VCMIDLTool': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string',
+ 'CPreprocessOptions': 'a_string',
+ 'DefaultCharType': '0',
+ 'DLLDataFileName': 'a_file_name',
+ 'EnableErrorChecks': '2',
+ 'ErrorCheckAllocations': 'true',
+ 'ErrorCheckBounds': 'true',
+ 'ErrorCheckEnumRange': 'true',
+ 'ErrorCheckRefPointers': 'true',
+ 'ErrorCheckStubData': 'true',
+ 'GenerateStublessProxies': 'true',
+ 'GenerateTypeLibrary': 'true',
+ 'HeaderFileName': 'a_file_name',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InterfaceIdentifierFileName': 'a_file_name',
+ 'MkTypLibCompatible': 'true',
+ 'OutputDirectory': 'a_string',
+ 'PreprocessorDefinitions': 'd1;d2;d3',
+ 'ProxyFileName': 'a_file_name',
+ 'RedirectOutputAndErrors': 'a_file_name',
+ 'StructMemberAlignment': '3',
+ 'SuppressStartupBanner': 'true',
+ 'TargetEnvironment': '1',
+ 'TypeLibraryName': 'a_file_name',
+ 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
+ 'ValidateParameters': 'true',
+ 'WarnAsError': 'true',
+ 'WarningLevel': '4'},
+ 'VCLibrarianTool': {
+ 'AdditionalDependencies': 'file1;file2;file3',
+ 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
+ 'AdditionalLibraryDirectories_excluded': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string',
+ 'ExportNamedFunctions': 'd1;d2;d3',
+ 'ForceSymbolReferences': 'a_string',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3',
+ 'LinkLibraryDependencies': 'true',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'OutputFile': 'a_file_name',
+ 'SuppressStartupBanner': 'true',
+ 'UseUnicodeResponseFiles': 'true'},
+ 'VCManifestTool': {
+ 'AdditionalManifestFiles': 'file1;file2;file3',
+ 'AdditionalOptions': 'a_string',
+ 'AssemblyIdentity': 'a_string',
+ 'ComponentFileName': 'a_file_name',
+ 'DependencyInformationFile': 'a_file_name',
+ 'EmbedManifest': 'true',
+ 'GenerateCatalogFiles': 'true',
+ 'InputResourceManifests': 'a_string',
+ 'ManifestResourceFile': 'my_name',
+ 'OutputManifestFile': 'a_file_name',
+ 'RegistrarScriptFile': 'a_file_name',
+ 'ReplacementsFile': 'a_file_name',
+ 'SuppressStartupBanner': 'true',
+ 'TypeLibraryFile': 'a_file_name',
+ 'UpdateFileHashes': 'true',
+ 'UpdateFileHashesSearchPath': 'a_file_name',
+ 'UseFAT32Workaround': 'true',
+ 'UseUnicodeResponseFiles': 'true',
+ 'VerboseOutput': 'true'}}
+ expected_msbuild_settings = {
+ 'ClCompile': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string /J',
+ 'AdditionalUsingDirectories': 'folder1;folder2;folder3',
+ 'AssemblerListingLocation': 'a_file_name',
+ 'AssemblerOutput': 'NoListing',
+ 'BasicRuntimeChecks': 'StackFrameRuntimeCheck',
+ 'BrowseInformation': 'true',
+ 'BrowseInformationFile': 'a_file_name',
+ 'BufferSecurityCheck': 'true',
+ 'CallingConvention': 'Cdecl',
+ 'CompileAs': 'CompileAsC',
+ 'DebugInformationFormat': 'EditAndContinue',
+ 'DisableLanguageExtensions': 'true',
+ 'DisableSpecificWarnings': 'd1;d2;d3',
+ 'EnableEnhancedInstructionSet': 'NotSet',
+ 'EnableFiberSafeOptimizations': 'true',
+ 'EnablePREfast': 'true',
+ 'ErrorReporting': 'Prompt',
+ 'ExceptionHandling': 'Async',
+ 'ExpandAttributedSource': 'true',
+ 'FavorSizeOrSpeed': 'Neither',
+ 'FloatingPointExceptions': 'true',
+ 'FloatingPointModel': 'Strict',
+ 'ForceConformanceInForLoopScope': 'true',
+ 'ForcedIncludeFiles': 'file1;file2;file3',
+ 'ForcedUsingFiles': 'file1;file2;file3',
+ 'FunctionLevelLinking': 'true',
+ 'GenerateXMLDocumentationFiles': 'true',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InlineFunctionExpansion': 'AnySuitable',
+ 'IntrinsicFunctions': 'true',
+ 'MinimalRebuild': 'true',
+ 'ObjectFileName': 'a_file_name',
+ 'OmitDefaultLibName': 'true',
+ 'OmitFramePointers': 'true',
+ 'OpenMPSupport': 'true',
+ 'Optimization': 'Full',
+ 'PrecompiledHeader': 'Create',
+ 'PrecompiledHeaderFile': 'a_file_name',
+ 'PrecompiledHeaderOutputFile': 'a_file_name',
+ 'PreprocessKeepComments': 'true',
+ 'PreprocessorDefinitions': 'd1;d2;d3',
+ 'PreprocessSuppressLineNumbers': 'false',
+ 'PreprocessToFile': 'true',
+ 'ProgramDataBaseFileName': 'a_file_name',
+ 'RuntimeLibrary': 'MultiThreaded',
+ 'RuntimeTypeInfo': 'true',
+ 'ShowIncludes': 'true',
+ 'SmallerTypeCheck': 'true',
+ 'StringPooling': 'true',
+ 'StructMemberAlignment': '1Byte',
+ 'SuppressStartupBanner': 'true',
+ 'TreatWarningAsError': 'true',
+ 'TreatWChar_tAsBuiltInType': 'true',
+ 'UndefineAllPreprocessorDefinitions': 'true',
+ 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
+ 'UseFullPaths': 'true',
+ 'WarningLevel': 'Level2',
+ 'WholeProgramOptimization': 'true',
+ 'XMLDocumentationFileName': 'a_file_name'},
+ 'Link': {
+ 'AdditionalDependencies': 'file1;file2;file3',
+ 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
+ 'AdditionalManifestDependencies': 'file1;file2;file3',
+ 'AdditionalOptions': 'a_string',
+ 'AddModuleNamesToAssembly': 'file1;file2;file3',
+ 'AllowIsolation': 'true',
+ 'AssemblyDebug': '',
+ 'AssemblyLinkResource': 'file1;file2;file3',
+ 'BaseAddress': 'a_string',
+ 'CLRImageType': 'ForceIJWImage',
+ 'CLRThreadAttribute': 'STAThreadingAttribute',
+ 'CLRUnmanagedCodeCheck': 'true',
+ 'DataExecutionPrevention': '',
+ 'DelayLoadDLLs': 'file1;file2;file3',
+ 'DelaySign': 'true',
+ 'Driver': 'Driver',
+ 'EmbedManagedResourceFile': 'file1;file2;file3',
+ 'EnableCOMDATFolding': '',
+ 'EnableUAC': 'true',
+ 'EntryPointSymbol': 'a_string',
+ 'FixedBaseAddress': 'false',
+ 'ForceSymbolReferences': 'file1;file2;file3',
+ 'FunctionOrder': 'a_file_name',
+ 'GenerateDebugInformation': 'true',
+ 'GenerateMapFile': 'true',
+ 'HeapCommitSize': 'a_string',
+ 'HeapReserveSize': 'a_string',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreEmbeddedIDL': 'true',
+ 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3',
+ 'ImportLibrary': 'a_file_name',
+ 'KeyContainer': 'a_file_name',
+ 'KeyFile': 'a_file_name',
+ 'LargeAddressAware': 'true',
+ 'LinkErrorReporting': 'NoErrorReport',
+ 'LinkTimeCodeGeneration': 'PGInstrument',
+ 'ManifestFile': 'a_file_name',
+ 'MapExports': 'true',
+ 'MapFileName': 'a_file_name',
+ 'MergedIDLBaseFileName': 'a_file_name',
+ 'MergeSections': 'a_string',
+ 'MidlCommandFile': 'a_file_name',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'NoEntryPoint': 'true',
+ 'OptimizeReferences': '',
+ 'OutputFile': 'a_file_name',
+ 'PerUserRedirection': 'true',
+ 'Profile': 'true',
+ 'ProfileGuidedDatabase': 'a_file_name',
+ 'ProgramDatabaseFile': 'a_file_name',
+ 'RandomizedBaseAddress': 'false',
+ 'RegisterOutput': 'true',
+ 'SetChecksum': 'true',
+ 'ShowProgress': 'NotSet',
+ 'StackCommitSize': 'a_string',
+ 'StackReserveSize': 'a_string',
+ 'StripPrivateSymbols': 'a_file_name',
+ 'SubSystem': 'Windows',
+ 'SupportUnloadOfDelayLoadedDLL': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'SwapRunFromCD': 'true',
+ 'SwapRunFromNET': 'true',
+ 'TargetMachine': 'MachineARM',
+ 'TerminalServerAware': 'true',
+ 'TurnOffAssemblyGeneration': 'true',
+ 'TypeLibraryFile': 'a_file_name',
+ 'TypeLibraryResourceID': '33',
+ 'UACExecutionLevel': 'HighestAvailable',
+ 'UACUIAccess': 'true',
+ 'Version': 'a_string'},
+ 'ResourceCompile': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string',
+ 'Culture': '0x03eb',
+ 'IgnoreStandardIncludePath': 'true',
+ 'PreprocessorDefinitions': 'd1;d2;d3',
+ 'ResourceOutputFileName': 'a_string',
+ 'ShowProgress': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'UndefinePreprocessorDefinitions': 'd1;d2;d3'},
+ 'Midl': {
+ 'AdditionalIncludeDirectories': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string',
+ 'CPreprocessOptions': 'a_string',
+ 'DefaultCharType': 'Unsigned',
+ 'DllDataFileName': 'a_file_name',
+ 'EnableErrorChecks': 'All',
+ 'ErrorCheckAllocations': 'true',
+ 'ErrorCheckBounds': 'true',
+ 'ErrorCheckEnumRange': 'true',
+ 'ErrorCheckRefPointers': 'true',
+ 'ErrorCheckStubData': 'true',
+ 'GenerateStublessProxies': 'true',
+ 'GenerateTypeLibrary': 'true',
+ 'HeaderFileName': 'a_file_name',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InterfaceIdentifierFileName': 'a_file_name',
+ 'MkTypLibCompatible': 'true',
+ 'OutputDirectory': 'a_string',
+ 'PreprocessorDefinitions': 'd1;d2;d3',
+ 'ProxyFileName': 'a_file_name',
+ 'RedirectOutputAndErrors': 'a_file_name',
+ 'StructMemberAlignment': '4',
+ 'SuppressStartupBanner': 'true',
+ 'TargetEnvironment': 'Win32',
+ 'TypeLibraryName': 'a_file_name',
+ 'UndefinePreprocessorDefinitions': 'd1;d2;d3',
+ 'ValidateAllParameters': 'true',
+ 'WarnAsError': 'true',
+ 'WarningLevel': '4'},
+ 'Lib': {
+ 'AdditionalDependencies': 'file1;file2;file3',
+ 'AdditionalLibraryDirectories': 'folder1;folder2;folder3',
+ 'AdditionalOptions': 'a_string',
+ 'ExportNamedFunctions': 'd1;d2;d3',
+ 'ForceSymbolReferences': 'a_string',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3',
+ 'ModuleDefinitionFile': 'a_file_name',
+ 'OutputFile': 'a_file_name',
+ 'SuppressStartupBanner': 'true',
+ 'UseUnicodeResponseFiles': 'true'},
+ 'Mt': {
+ 'AdditionalManifestFiles': 'file1;file2;file3',
+ 'AdditionalOptions': 'a_string',
+ 'AssemblyIdentity': 'a_string',
+ 'ComponentFileName': 'a_file_name',
+ 'GenerateCatalogFiles': 'true',
+ 'InputResourceManifests': 'a_string',
+ 'OutputManifestFile': 'a_file_name',
+ 'RegistrarScriptFile': 'a_file_name',
+ 'ReplacementsFile': 'a_file_name',
+ 'SuppressStartupBanner': 'true',
+ 'TypeLibraryFile': 'a_file_name',
+ 'UpdateFileHashes': 'true',
+ 'UpdateFileHashesSearchPath': 'a_file_name',
+ 'VerboseOutput': 'true'},
+ 'ManifestResourceCompile': {
+ 'ResourceOutputFileName': 'my_name'},
+ 'ProjectReference': {
+ 'LinkLibraryDependencies': 'true',
+ 'UseLibraryDependencyInputs': 'false'},
+ '': {
+ 'EmbedManifest': 'true',
+ 'GenerateManifest': 'true',
+ 'IgnoreImportLibrary': 'true',
+ 'LinkIncremental': 'false'}}
+ actual_msbuild_settings = MSVSSettings.ConvertToMsBuildSettings(
+ msvs_settings,
+ self.stderr)
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
+ self._ExpectedWarnings([])
+
+ def test_ConvertToMsBuildSettings_actual(self):
+ """ Tests the conversion of an actual project.
+
+ A VS2008 project with most of the options defined was created through the
+ VS2008 IDE. It was then converted to VS2010. The tool settings found in
+ the .vcproj and .vcxproj files were converted to the two dictionaries
+ msvs_settings and expected_msbuild_settings.
+
+ Note that for many settings, the VS2010 converter adds macros like
+ %(AdditionalIncludeDirectories) to make sure than inherited values are
+ included. Since the Gyp projects we generate do not use inheritance,
+ we removed these macros. They were:
+ ClCompile:
+ AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)'
+ AdditionalOptions: ' %(AdditionalOptions)'
+ AdditionalUsingDirectories: ';%(AdditionalUsingDirectories)'
+ DisableSpecificWarnings: ';%(DisableSpecificWarnings)',
+ ForcedIncludeFiles: ';%(ForcedIncludeFiles)',
+ ForcedUsingFiles: ';%(ForcedUsingFiles)',
+ PreprocessorDefinitions: ';%(PreprocessorDefinitions)',
+ UndefinePreprocessorDefinitions:
+ ';%(UndefinePreprocessorDefinitions)',
+ Link:
+ AdditionalDependencies: ';%(AdditionalDependencies)',
+ AdditionalLibraryDirectories: ';%(AdditionalLibraryDirectories)',
+ AdditionalManifestDependencies:
+ ';%(AdditionalManifestDependencies)',
+ AdditionalOptions: ' %(AdditionalOptions)',
+ AddModuleNamesToAssembly: ';%(AddModuleNamesToAssembly)',
+ AssemblyLinkResource: ';%(AssemblyLinkResource)',
+ DelayLoadDLLs: ';%(DelayLoadDLLs)',
+ EmbedManagedResourceFile: ';%(EmbedManagedResourceFile)',
+ ForceSymbolReferences: ';%(ForceSymbolReferences)',
+ IgnoreSpecificDefaultLibraries:
+ ';%(IgnoreSpecificDefaultLibraries)',
+ ResourceCompile:
+ AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)',
+ AdditionalOptions: ' %(AdditionalOptions)',
+ PreprocessorDefinitions: ';%(PreprocessorDefinitions)',
+ Mt:
+ AdditionalManifestFiles: ';%(AdditionalManifestFiles)',
+ AdditionalOptions: ' %(AdditionalOptions)',
+ InputResourceManifests: ';%(InputResourceManifests)',
+ """
+ msvs_settings = {
+ 'VCCLCompilerTool': {
+ 'AdditionalIncludeDirectories': 'dir1',
+ 'AdditionalOptions': '/more',
+ 'AdditionalUsingDirectories': 'test',
+ 'AssemblerListingLocation': '$(IntDir)\\a',
+ 'AssemblerOutput': '1',
+ 'BasicRuntimeChecks': '3',
+ 'BrowseInformation': '1',
+ 'BrowseInformationFile': '$(IntDir)\\e',
+ 'BufferSecurityCheck': 'false',
+ 'CallingConvention': '1',
+ 'CompileAs': '1',
+ 'DebugInformationFormat': '4',
+ 'DefaultCharIsUnsigned': 'true',
+ 'Detect64BitPortabilityProblems': 'true',
+ 'DisableLanguageExtensions': 'true',
+ 'DisableSpecificWarnings': 'abc',
+ 'EnableEnhancedInstructionSet': '1',
+ 'EnableFiberSafeOptimizations': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'EnableIntrinsicFunctions': 'true',
+ 'EnablePREfast': 'true',
+ 'ErrorReporting': '2',
+ 'ExceptionHandling': '2',
+ 'ExpandAttributedSource': 'true',
+ 'FavorSizeOrSpeed': '2',
+ 'FloatingPointExceptions': 'true',
+ 'FloatingPointModel': '1',
+ 'ForceConformanceInForLoopScope': 'false',
+ 'ForcedIncludeFiles': 'def',
+ 'ForcedUsingFiles': 'ge',
+ 'GeneratePreprocessedFile': '2',
+ 'GenerateXMLDocumentationFiles': 'true',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InlineFunctionExpansion': '1',
+ 'KeepComments': 'true',
+ 'MinimalRebuild': 'true',
+ 'ObjectFile': '$(IntDir)\\b',
+ 'OmitDefaultLibName': 'true',
+ 'OmitFramePointers': 'true',
+ 'OpenMP': 'true',
+ 'Optimization': '3',
+ 'PrecompiledHeaderFile': '$(IntDir)\\$(TargetName).pche',
+ 'PrecompiledHeaderThrough': 'StdAfx.hd',
+ 'PreprocessorDefinitions': 'WIN32;_DEBUG;_CONSOLE',
+ 'ProgramDataBaseFileName': '$(IntDir)\\vc90b.pdb',
+ 'RuntimeLibrary': '3',
+ 'RuntimeTypeInfo': 'false',
+ 'ShowIncludes': 'true',
+ 'SmallerTypeCheck': 'true',
+ 'StringPooling': 'true',
+ 'StructMemberAlignment': '3',
+ 'SuppressStartupBanner': 'false',
+ 'TreatWChar_tAsBuiltInType': 'false',
+ 'UndefineAllPreprocessorDefinitions': 'true',
+ 'UndefinePreprocessorDefinitions': 'wer',
+ 'UseFullPaths': 'true',
+ 'UsePrecompiledHeader': '0',
+ 'UseUnicodeResponseFiles': 'false',
+ 'WarnAsError': 'true',
+ 'WarningLevel': '3',
+ 'WholeProgramOptimization': 'true',
+ 'XMLDocumentationFileName': '$(IntDir)\\c'},
+ 'VCLinkerTool': {
+ 'AdditionalDependencies': 'zx',
+ 'AdditionalLibraryDirectories': 'asd',
+ 'AdditionalManifestDependencies': 's2',
+ 'AdditionalOptions': '/mor2',
+ 'AddModuleNamesToAssembly': 'd1',
+ 'AllowIsolation': 'false',
+ 'AssemblyDebug': '1',
+ 'AssemblyLinkResource': 'd5',
+ 'BaseAddress': '23423',
+ 'CLRImageType': '3',
+ 'CLRThreadAttribute': '1',
+ 'CLRUnmanagedCodeCheck': 'true',
+ 'DataExecutionPrevention': '0',
+ 'DelayLoadDLLs': 'd4',
+ 'DelaySign': 'true',
+ 'Driver': '2',
+ 'EmbedManagedResourceFile': 'd2',
+ 'EnableCOMDATFolding': '1',
+ 'EnableUAC': 'false',
+ 'EntryPointSymbol': 'f5',
+ 'ErrorReporting': '2',
+ 'FixedBaseAddress': '1',
+ 'ForceSymbolReferences': 'd3',
+ 'FunctionOrder': 'fssdfsd',
+ 'GenerateDebugInformation': 'true',
+ 'GenerateManifest': 'false',
+ 'GenerateMapFile': 'true',
+ 'HeapCommitSize': '13',
+ 'HeapReserveSize': '12',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreDefaultLibraryNames': 'flob;flok',
+ 'IgnoreEmbeddedIDL': 'true',
+ 'IgnoreImportLibrary': 'true',
+ 'ImportLibrary': 'f4',
+ 'KeyContainer': 'f7',
+ 'KeyFile': 'f6',
+ 'LargeAddressAware': '2',
+ 'LinkIncremental': '0',
+ 'LinkLibraryDependencies': 'false',
+ 'LinkTimeCodeGeneration': '1',
+ 'ManifestFile':
+ '$(IntDir)\\$(TargetFileName).2intermediate.manifest',
+ 'MapExports': 'true',
+ 'MapFileName': 'd5',
+ 'MergedIDLBaseFileName': 'f2',
+ 'MergeSections': 'f5',
+ 'MidlCommandFile': 'f1',
+ 'ModuleDefinitionFile': 'sdsd',
+ 'OptimizeForWindows98': '2',
+ 'OptimizeReferences': '2',
+ 'OutputFile': '$(OutDir)\\$(ProjectName)2.exe',
+ 'PerUserRedirection': 'true',
+ 'Profile': 'true',
+ 'ProfileGuidedDatabase': '$(TargetDir)$(TargetName).pgdd',
+ 'ProgramDatabaseFile': 'Flob.pdb',
+ 'RandomizedBaseAddress': '1',
+ 'RegisterOutput': 'true',
+ 'ResourceOnlyDLL': 'true',
+ 'SetChecksum': 'false',
+ 'ShowProgress': '1',
+ 'StackCommitSize': '15',
+ 'StackReserveSize': '14',
+ 'StripPrivateSymbols': 'd3',
+ 'SubSystem': '1',
+ 'SupportUnloadOfDelayLoadedDLL': 'true',
+ 'SuppressStartupBanner': 'false',
+ 'SwapRunFromCD': 'true',
+ 'SwapRunFromNet': 'true',
+ 'TargetMachine': '1',
+ 'TerminalServerAware': '1',
+ 'TurnOffAssemblyGeneration': 'true',
+ 'TypeLibraryFile': 'f3',
+ 'TypeLibraryResourceID': '12',
+ 'UACExecutionLevel': '2',
+ 'UACUIAccess': 'true',
+ 'UseLibraryDependencyInputs': 'true',
+ 'UseUnicodeResponseFiles': 'false',
+ 'Version': '333'},
+ 'VCResourceCompilerTool': {
+ 'AdditionalIncludeDirectories': 'f3',
+ 'AdditionalOptions': '/more3',
+ 'Culture': '3084',
+ 'IgnoreStandardIncludePath': 'true',
+ 'PreprocessorDefinitions': '_UNICODE;UNICODE2',
+ 'ResourceOutputFileName': '$(IntDir)/$(InputName)3.res',
+ 'ShowProgress': 'true'},
+ 'VCManifestTool': {
+ 'AdditionalManifestFiles': 'sfsdfsd',
+ 'AdditionalOptions': 'afdsdafsd',
+ 'AssemblyIdentity': 'sddfdsadfsa',
+ 'ComponentFileName': 'fsdfds',
+ 'DependencyInformationFile': '$(IntDir)\\mt.depdfd',
+ 'EmbedManifest': 'false',
+ 'GenerateCatalogFiles': 'true',
+ 'InputResourceManifests': 'asfsfdafs',
+ 'ManifestResourceFile':
+ '$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf',
+ 'OutputManifestFile': '$(TargetPath).manifestdfs',
+ 'RegistrarScriptFile': 'sdfsfd',
+ 'ReplacementsFile': 'sdffsd',
+ 'SuppressStartupBanner': 'false',
+ 'TypeLibraryFile': 'sfsd',
+ 'UpdateFileHashes': 'true',
+ 'UpdateFileHashesSearchPath': 'sfsd',
+ 'UseFAT32Workaround': 'true',
+ 'UseUnicodeResponseFiles': 'false',
+ 'VerboseOutput': 'true'}}
+ expected_msbuild_settings = {
+ 'ClCompile': {
+ 'AdditionalIncludeDirectories': 'dir1',
+ 'AdditionalOptions': '/more /J',
+ 'AdditionalUsingDirectories': 'test',
+ 'AssemblerListingLocation': '$(IntDir)a',
+ 'AssemblerOutput': 'AssemblyCode',
+ 'BasicRuntimeChecks': 'EnableFastChecks',
+ 'BrowseInformation': 'true',
+ 'BrowseInformationFile': '$(IntDir)e',
+ 'BufferSecurityCheck': 'false',
+ 'CallingConvention': 'FastCall',
+ 'CompileAs': 'CompileAsC',
+ 'DebugInformationFormat': 'EditAndContinue',
+ 'DisableLanguageExtensions': 'true',
+ 'DisableSpecificWarnings': 'abc',
+ 'EnableEnhancedInstructionSet': 'StreamingSIMDExtensions',
+ 'EnableFiberSafeOptimizations': 'true',
+ 'EnablePREfast': 'true',
+ 'ErrorReporting': 'Queue',
+ 'ExceptionHandling': 'Async',
+ 'ExpandAttributedSource': 'true',
+ 'FavorSizeOrSpeed': 'Size',
+ 'FloatingPointExceptions': 'true',
+ 'FloatingPointModel': 'Strict',
+ 'ForceConformanceInForLoopScope': 'false',
+ 'ForcedIncludeFiles': 'def',
+ 'ForcedUsingFiles': 'ge',
+ 'FunctionLevelLinking': 'true',
+ 'GenerateXMLDocumentationFiles': 'true',
+ 'IgnoreStandardIncludePath': 'true',
+ 'InlineFunctionExpansion': 'OnlyExplicitInline',
+ 'IntrinsicFunctions': 'true',
+ 'MinimalRebuild': 'true',
+ 'ObjectFileName': '$(IntDir)b',
+ 'OmitDefaultLibName': 'true',
+ 'OmitFramePointers': 'true',
+ 'OpenMPSupport': 'true',
+ 'Optimization': 'Full',
+ 'PrecompiledHeader': 'NotUsing', # Actual conversion gives ''
+ 'PrecompiledHeaderFile': 'StdAfx.hd',
+ 'PrecompiledHeaderOutputFile': '$(IntDir)$(TargetName).pche',
+ 'PreprocessKeepComments': 'true',
+ 'PreprocessorDefinitions': 'WIN32;_DEBUG;_CONSOLE',
+ 'PreprocessSuppressLineNumbers': 'true',
+ 'PreprocessToFile': 'true',
+ 'ProgramDataBaseFileName': '$(IntDir)vc90b.pdb',
+ 'RuntimeLibrary': 'MultiThreadedDebugDLL',
+ 'RuntimeTypeInfo': 'false',
+ 'ShowIncludes': 'true',
+ 'SmallerTypeCheck': 'true',
+ 'StringPooling': 'true',
+ 'StructMemberAlignment': '4Bytes',
+ 'SuppressStartupBanner': 'false',
+ 'TreatWarningAsError': 'true',
+ 'TreatWChar_tAsBuiltInType': 'false',
+ 'UndefineAllPreprocessorDefinitions': 'true',
+ 'UndefinePreprocessorDefinitions': 'wer',
+ 'UseFullPaths': 'true',
+ 'WarningLevel': 'Level3',
+ 'WholeProgramOptimization': 'true',
+ 'XMLDocumentationFileName': '$(IntDir)c'},
+ 'Link': {
+ 'AdditionalDependencies': 'zx',
+ 'AdditionalLibraryDirectories': 'asd',
+ 'AdditionalManifestDependencies': 's2',
+ 'AdditionalOptions': '/mor2',
+ 'AddModuleNamesToAssembly': 'd1',
+ 'AllowIsolation': 'false',
+ 'AssemblyDebug': 'true',
+ 'AssemblyLinkResource': 'd5',
+ 'BaseAddress': '23423',
+ 'CLRImageType': 'ForceSafeILImage',
+ 'CLRThreadAttribute': 'MTAThreadingAttribute',
+ 'CLRUnmanagedCodeCheck': 'true',
+ 'DataExecutionPrevention': '',
+ 'DelayLoadDLLs': 'd4',
+ 'DelaySign': 'true',
+ 'Driver': 'UpOnly',
+ 'EmbedManagedResourceFile': 'd2',
+ 'EnableCOMDATFolding': 'false',
+ 'EnableUAC': 'false',
+ 'EntryPointSymbol': 'f5',
+ 'FixedBaseAddress': 'false',
+ 'ForceSymbolReferences': 'd3',
+ 'FunctionOrder': 'fssdfsd',
+ 'GenerateDebugInformation': 'true',
+ 'GenerateMapFile': 'true',
+ 'HeapCommitSize': '13',
+ 'HeapReserveSize': '12',
+ 'IgnoreAllDefaultLibraries': 'true',
+ 'IgnoreEmbeddedIDL': 'true',
+ 'IgnoreSpecificDefaultLibraries': 'flob;flok',
+ 'ImportLibrary': 'f4',
+ 'KeyContainer': 'f7',
+ 'KeyFile': 'f6',
+ 'LargeAddressAware': 'true',
+ 'LinkErrorReporting': 'QueueForNextLogin',
+ 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration',
+ 'ManifestFile': '$(IntDir)$(TargetFileName).2intermediate.manifest',
+ 'MapExports': 'true',
+ 'MapFileName': 'd5',
+ 'MergedIDLBaseFileName': 'f2',
+ 'MergeSections': 'f5',
+ 'MidlCommandFile': 'f1',
+ 'ModuleDefinitionFile': 'sdsd',
+ 'NoEntryPoint': 'true',
+ 'OptimizeReferences': 'true',
+ 'OutputFile': '$(OutDir)$(ProjectName)2.exe',
+ 'PerUserRedirection': 'true',
+ 'Profile': 'true',
+ 'ProfileGuidedDatabase': '$(TargetDir)$(TargetName).pgdd',
+ 'ProgramDatabaseFile': 'Flob.pdb',
+ 'RandomizedBaseAddress': 'false',
+ 'RegisterOutput': 'true',
+ 'SetChecksum': 'false',
+ 'ShowProgress': 'LinkVerbose',
+ 'StackCommitSize': '15',
+ 'StackReserveSize': '14',
+ 'StripPrivateSymbols': 'd3',
+ 'SubSystem': 'Console',
+ 'SupportUnloadOfDelayLoadedDLL': 'true',
+ 'SuppressStartupBanner': 'false',
+ 'SwapRunFromCD': 'true',
+ 'SwapRunFromNET': 'true',
+ 'TargetMachine': 'MachineX86',
+ 'TerminalServerAware': 'false',
+ 'TurnOffAssemblyGeneration': 'true',
+ 'TypeLibraryFile': 'f3',
+ 'TypeLibraryResourceID': '12',
+ 'UACExecutionLevel': 'RequireAdministrator',
+ 'UACUIAccess': 'true',
+ 'Version': '333'},
+ 'ResourceCompile': {
+ 'AdditionalIncludeDirectories': 'f3',
+ 'AdditionalOptions': '/more3',
+ 'Culture': '0x0c0c',
+ 'IgnoreStandardIncludePath': 'true',
+ 'PreprocessorDefinitions': '_UNICODE;UNICODE2',
+ 'ResourceOutputFileName': '$(IntDir)%(Filename)3.res',
+ 'ShowProgress': 'true'},
+ 'Mt': {
+ 'AdditionalManifestFiles': 'sfsdfsd',
+ 'AdditionalOptions': 'afdsdafsd',
+ 'AssemblyIdentity': 'sddfdsadfsa',
+ 'ComponentFileName': 'fsdfds',
+ 'GenerateCatalogFiles': 'true',
+ 'InputResourceManifests': 'asfsfdafs',
+ 'OutputManifestFile': '$(TargetPath).manifestdfs',
+ 'RegistrarScriptFile': 'sdfsfd',
+ 'ReplacementsFile': 'sdffsd',
+ 'SuppressStartupBanner': 'false',
+ 'TypeLibraryFile': 'sfsd',
+ 'UpdateFileHashes': 'true',
+ 'UpdateFileHashesSearchPath': 'sfsd',
+ 'VerboseOutput': 'true'},
+ 'ProjectReference': {
+ 'LinkLibraryDependencies': 'false',
+ 'UseLibraryDependencyInputs': 'true'},
+ '': {
+ 'EmbedManifest': 'false',
+ 'GenerateManifest': 'false',
+ 'IgnoreImportLibrary': 'true',
+ 'LinkIncremental': ''
+ },
+ 'ManifestResourceCompile': {
+ 'ResourceOutputFileName':
+ '$(IntDir)$(TargetFileName).embed.manifest.resfdsf'}
+ }
+ actual_msbuild_settings = MSVSSettings.ConvertToMsBuildSettings(
+ msvs_settings,
+ self.stderr)
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
+ self._ExpectedWarnings([])
+
+if __name__ == '__main__':
+ unittest.main() \ No newline at end of file
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSToolFile.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSToolFile.py
new file mode 100644
index 0000000..493a9c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSToolFile.py
@@ -0,0 +1,81 @@
+#!/usr/bin/python2.4
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Visual Studio project reader/writer."""
+
+import common
+import xml.dom
+import xml_fix
+
+
+#------------------------------------------------------------------------------
+
+
+class Writer(object):
+ """Visual Studio XML tool file writer."""
+
+ def __init__(self, tool_file_path):
+ """Initializes the tool file.
+
+ Args:
+ tool_file_path: Path to the tool file.
+ """
+ self.tool_file_path = tool_file_path
+ self.doc = None
+
+ def Create(self, name):
+ """Creates the tool file document.
+
+ Args:
+ name: Name of the tool file.
+ """
+ self.name = name
+
+ # Create XML doc
+ xml_impl = xml.dom.getDOMImplementation()
+ self.doc = xml_impl.createDocument(None, 'VisualStudioToolFile', None)
+
+ # Add attributes to root element
+ self.n_root = self.doc.documentElement
+ self.n_root.setAttribute('Version', '8.00')
+ self.n_root.setAttribute('Name', self.name)
+
+ # Add rules section
+ self.n_rules = self.doc.createElement('Rules')
+ self.n_root.appendChild(self.n_rules)
+
+ def AddCustomBuildRule(self, name, cmd, description,
+ additional_dependencies,
+ outputs, extensions):
+ """Adds a rule to the tool file.
+
+ Args:
+ name: Name of the rule.
+ description: Description of the rule.
+ cmd: Command line of the rule.
+ additional_dependencies: other files which may trigger the rule.
+ outputs: outputs of the rule.
+ extensions: extensions handled by the rule.
+ """
+ n_rule = self.doc.createElement('CustomBuildRule')
+ n_rule.setAttribute('Name', name)
+ n_rule.setAttribute('ExecutionDescription', description)
+ n_rule.setAttribute('CommandLine', cmd)
+ n_rule.setAttribute('Outputs', ';'.join(outputs))
+ n_rule.setAttribute('FileExtensions', ';'.join(extensions))
+ n_rule.setAttribute('AdditionalDependencies',
+ ';'.join(additional_dependencies))
+ self.n_rules.appendChild(n_rule)
+
+ def Write(self, writer=common.WriteOnDiff):
+ """Writes the tool file."""
+ f = writer(self.tool_file_path)
+ fix = xml_fix.XmlFix()
+ self.doc.writexml(f, encoding='Windows-1252', addindent=' ', newl='\r\n')
+ fix.Cleanup()
+ f.close()
+
+#------------------------------------------------------------------------------
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSUserFile.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSUserFile.py
new file mode 100644
index 0000000..ba166a9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSUserFile.py
@@ -0,0 +1,182 @@
+#!/usr/bin/python2.4
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Visual Studio user preferences file writer."""
+
+import common
+import os
+import re
+import socket # for gethostname
+import xml.dom
+import xml_fix
+
+
+#------------------------------------------------------------------------------
+
+def _FindCommandInPath(command):
+ """If there are no slashes in the command given, this function
+ searches the PATH env to find the given command, and converts it
+ to an absolute path. We have to do this because MSVS is looking
+ for an actual file to launch a debugger on, not just a command
+ line. Note that this happens at GYP time, so anything needing to
+ be built needs to have a full path."""
+ if '/' in command or '\\' in command:
+ # If the command already has path elements (either relative or
+ # absolute), then assume it is constructed properly.
+ return command
+ else:
+ # Search through the path list and find an existing file that
+ # we can access.
+ paths = os.environ.get('PATH','').split(os.pathsep)
+ for path in paths:
+ item = os.path.join(path, command)
+ if os.path.isfile(item) and os.access(item, os.X_OK):
+ return item
+ return command
+
+def _QuoteWin32CommandLineArgs(args):
+ new_args = []
+ for arg in args:
+ # Replace all double-quotes with double-double-quotes to escape
+ # them for cmd shell, and then quote the whole thing if there
+ # are any.
+ if arg.find('"') != -1:
+ arg = '""'.join(arg.split('"'))
+ arg = '"%s"' % arg
+
+ # Otherwise, if there are any spaces, quote the whole arg.
+ elif re.search(r'[ \t\n]', arg):
+ arg = '"%s"' % arg
+ new_args.append(arg)
+ return new_args
+
+class Writer(object):
+ """Visual Studio XML user user file writer."""
+
+ def __init__(self, user_file_path, version):
+ """Initializes the user file.
+
+ Args:
+ user_file_path: Path to the user file.
+ """
+ self.user_file_path = user_file_path
+ self.version = version
+ self.doc = None
+
+ def Create(self, name):
+ """Creates the user file document.
+
+ Args:
+ name: Name of the user file.
+ """
+ self.name = name
+
+ # Create XML doc
+ xml_impl = xml.dom.getDOMImplementation()
+ self.doc = xml_impl.createDocument(None, 'VisualStudioUserFile', None)
+
+ # Add attributes to root element
+ self.n_root = self.doc.documentElement
+ self.n_root.setAttribute('Version', self.version.ProjectVersion())
+ self.n_root.setAttribute('Name', self.name)
+
+ # Add configurations section
+ self.n_configs = self.doc.createElement('Configurations')
+ self.n_root.appendChild(self.n_configs)
+
+ def _AddConfigToNode(self, parent, config_type, config_name):
+ """Adds a configuration to the parent node.
+
+ Args:
+ parent: Destination node.
+ config_type: Type of configuration node.
+ config_name: Configuration name.
+ """
+ # Add configuration node and its attributes
+ n_config = self.doc.createElement(config_type)
+ n_config.setAttribute('Name', config_name)
+ parent.appendChild(n_config)
+
+ def AddConfig(self, name):
+ """Adds a configuration to the project.
+
+ Args:
+ name: Configuration name.
+ """
+ self._AddConfigToNode(self.n_configs, 'Configuration', name)
+
+
+ def AddDebugSettings(self, config_name, command, environment = {},
+ working_directory=""):
+ """Adds a DebugSettings node to the user file for a particular config.
+
+ Args:
+ command: command line to run. First element in the list is the
+ executable. All elements of the command will be quoted if
+ necessary.
+ working_directory: other files which may trigger the rule. (optional)
+ """
+ command = _QuoteWin32CommandLineArgs(command)
+
+ n_cmd = self.doc.createElement('DebugSettings')
+ abs_command = _FindCommandInPath(command[0])
+ n_cmd.setAttribute('Command', abs_command)
+ n_cmd.setAttribute('WorkingDirectory', working_directory)
+ n_cmd.setAttribute('CommandArguments', " ".join(command[1:]))
+ n_cmd.setAttribute('RemoteMachine', socket.gethostname())
+
+ if environment and isinstance(environment, dict):
+ n_cmd.setAttribute('Environment',
+ " ".join(['%s="%s"' % (key, val)
+ for (key,val) in environment.iteritems()]))
+ else:
+ n_cmd.setAttribute('Environment', '')
+
+ n_cmd.setAttribute('EnvironmentMerge', 'true')
+
+ # Currently these are all "dummy" values that we're just setting
+ # in the default manner that MSVS does it. We could use some of
+ # these to add additional capabilities, I suppose, but they might
+ # not have parity with other platforms then.
+ n_cmd.setAttribute('Attach', 'false')
+ n_cmd.setAttribute('DebuggerType', '3') # 'auto' debugger
+ n_cmd.setAttribute('Remote', '1')
+ n_cmd.setAttribute('RemoteCommand', '')
+ n_cmd.setAttribute('HttpUrl', '')
+ n_cmd.setAttribute('PDBPath', '')
+ n_cmd.setAttribute('SQLDebugging', '')
+ n_cmd.setAttribute('DebuggerFlavor', '0')
+ n_cmd.setAttribute('MPIRunCommand', '')
+ n_cmd.setAttribute('MPIRunArguments', '')
+ n_cmd.setAttribute('MPIRunWorkingDirectory', '')
+ n_cmd.setAttribute('ApplicationCommand', '')
+ n_cmd.setAttribute('ApplicationArguments', '')
+ n_cmd.setAttribute('ShimCommand', '')
+ n_cmd.setAttribute('MPIAcceptMode', '')
+ n_cmd.setAttribute('MPIAcceptFilter', '')
+
+ # Find the config, and add it if it doesn't exist.
+ found = False
+ for config in self.n_configs.childNodes:
+ if config.getAttribute("Name") == config_name:
+ found = True
+
+ if not found:
+ self.AddConfig(config_name)
+
+ # Add the DebugSettings onto the appropriate config.
+ for config in self.n_configs.childNodes:
+ if config.getAttribute("Name") == config_name:
+ config.appendChild(n_cmd)
+ break
+
+ def Write(self, writer=common.WriteOnDiff):
+ """Writes the user file."""
+ f = writer(self.user_file_path)
+ self.doc.writexml(f, encoding='Windows-1252', addindent=' ', newl='\r\n')
+ f.close()
+
+#------------------------------------------------------------------------------
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSVersion.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSVersion.py
new file mode 100755
index 0000000..f206eb6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSVersion.py
@@ -0,0 +1,200 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Handle version information related to Visual Stuio."""
+
+import os
+import re
+import subprocess
+import sys
+
+
+class VisualStudioVersion:
+ """Information regarding a version of Visual Studio."""
+
+ def __init__(self, short_name, description,
+ solution_version, project_version, flat_sln, uses_vcxproj):
+ self.short_name = short_name
+ self.description = description
+ self.solution_version = solution_version
+ self.project_version = project_version
+ self.flat_sln = flat_sln
+ self.uses_vcxproj = uses_vcxproj
+
+ def ShortName(self):
+ return self.short_name
+
+ def Description(self):
+ """Get the full description of the version."""
+ return self.description
+
+ def SolutionVersion(self):
+ """Get the version number of the sln files."""
+ return self.solution_version
+
+ def ProjectVersion(self):
+ """Get the version number of the vcproj or vcxproj files."""
+ return self.project_version
+
+ def FlatSolution(self):
+ return self.flat_sln
+
+ def UsesVcxproj(self):
+ """Returns true if this version uses a vcxproj file."""
+ return self.uses_vcxproj
+
+ def ProjectExtension(self):
+ """Returns the file extension for the project."""
+ return self.uses_vcxproj and '.vcxproj' or '.vcproj'
+
+def _RegistryGetValue(key, value):
+ """Use reg.exe to read a paricular key.
+
+ While ideally we might use the win32 module, we would like gyp to be
+ python neutral, so for instance cygwin python lacks this module.
+
+ Arguments:
+ key: The registry key to read from.
+ value: The particular value to read.
+ Return:
+ The contents there, or None for failure.
+ """
+ # Skip if not on Windows.
+ if sys.platform not in ('win32', 'cygwin'):
+ return None
+ # Run reg.exe.
+ cmd = [os.path.join(os.environ.get('WINDIR', ''), 'System32', 'reg.exe'),
+ 'query', key, '/v', value]
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ text = p.communicate()[0]
+ # Require a successful return value.
+ if p.returncode:
+ return None
+ # Extract value.
+ match = re.search(r'REG_\w+\s+([^\r]+)\r\n', text)
+ if not match:
+ return None
+ return match.group(1)
+
+
+def _RegistryKeyExists(key):
+ """Use reg.exe to see if a key exists.
+
+ Args:
+ key: The registry key to check.
+ Return:
+ True if the key exists
+ """
+ # Skip if not on Windows.
+ if sys.platform not in ('win32', 'cygwin'):
+ return None
+ # Run reg.exe.
+ cmd = [os.path.join(os.environ.get('WINDIR', ''), 'System32', 'reg.exe'),
+ 'query', key]
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ return p.returncode == 0
+
+
+def _CreateVersion(name):
+ versions = {
+ '2010': VisualStudioVersion('2010',
+ 'Visual Studio 2010',
+ solution_version='11.00',
+ project_version='4.0',
+ flat_sln=False,
+ uses_vcxproj=True),
+ '2008': VisualStudioVersion('2008',
+ 'Visual Studio 2008',
+ solution_version='10.00',
+ project_version='9.00',
+ flat_sln=False,
+ uses_vcxproj=False),
+ '2008e': VisualStudioVersion('2008e',
+ 'Visual Studio 2008',
+ solution_version='10.00',
+ project_version='9.00',
+ flat_sln=True,
+ uses_vcxproj=False),
+ '2005': VisualStudioVersion('2005',
+ 'Visual Studio 2005',
+ solution_version='9.00',
+ project_version='8.00',
+ flat_sln=False,
+ uses_vcxproj=False),
+ '2005e': VisualStudioVersion('2005e',
+ 'Visual Studio 2005',
+ solution_version='9.00',
+ project_version='8.00',
+ flat_sln=True,
+ uses_vcxproj=False),
+ }
+ return versions[str(name)]
+
+
+def _DetectVisualStudioVersions():
+ """Collect the list of installed visual studio versions.
+
+ Returns:
+ A list of visual studio versions installed in descending order of
+ usage preference.
+ Base this on the registry and a quick check if devenv.exe exists.
+ Only versions 8-10 are considered.
+ Possibilities are:
+ 2005 - Visual Studio 2005 (8)
+ 2008 - Visual Studio 2008 (9)
+ 2010 - Visual Studio 2010 (10)
+ """
+ version_to_year = {'8.0': '2005', '9.0': '2008', '10.0': '2010'}
+ versions = []
+ # For now, prefer versions before VS2010
+ for version in ('9.0', '8.0', '10.0'):
+ # Check if VS2010 and later is installed as specified by
+ # http://msdn.microsoft.com/en-us/library/bb164659.aspx
+ key32 = r'HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\%s' % version
+ key64 = r'HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\%sD' % (
+ version)
+ if _RegistryKeyExists(key32) or _RegistryKeyExists(key64):
+ # Add this one.
+ # TODO(jeanluc) This does not check for an express version.
+ # TODO(jeanluc) Uncomment this line when ready to support VS2010:
+ # versions.append(_CreateVersion(version_to_year[version]))
+ continue
+ # Get the install dir for this version.
+ key = r'HKLM\Software\Microsoft\VisualStudio\%s' % version
+ path = _RegistryGetValue(key, 'InstallDir')
+ if not path:
+ continue
+ # Check for full.
+ if os.path.exists(os.path.join(path, 'devenv.exe')):
+ # Add this one.
+ versions.append(_CreateVersion(version_to_year[version]))
+ # Check for express.
+ elif os.path.exists(os.path.join(path, 'vcexpress.exe')):
+ # Add this one.
+ versions.append(_CreateVersion(version_to_year[version] + 'e'))
+ return versions
+
+
+def SelectVisualStudioVersion(version='auto'):
+ """Select which version of Visual Studio projects to generate.
+
+ Arguments:
+ version: Hook to allow caller to force a particular version (vs auto).
+ Returns:
+ An object representing a visual studio project format version.
+ """
+ # In auto mode, check environment variable for override.
+ if version == 'auto':
+ version = os.environ.get('GYP_MSVS_VERSION', 'auto')
+ # In auto mode, pick the most preferred version present.
+ if version == 'auto':
+ versions = _DetectVisualStudioVersions()
+ if not versions:
+ # Default to 2005.
+ return _CreateVersion('2005')
+ return versions[0]
+ # Convert version string into a version object.
+ return _CreateVersion(version)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/SCons.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/SCons.py
new file mode 100644
index 0000000..9c57bcb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/SCons.py
@@ -0,0 +1,200 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+SCons generator.
+
+This contains class definitions and supporting functions for generating
+pieces of SCons files for the different types of GYP targets.
+"""
+
+import os
+
+
+def WriteList(fp, list, prefix='',
+ separator=',\n ',
+ preamble=None,
+ postamble=None):
+ fp.write(preamble or '')
+ fp.write((separator or ' ').join([prefix + l for l in list]))
+ fp.write(postamble or '')
+
+
+class TargetBase(object):
+ """
+ Base class for a SCons representation of a GYP target.
+ """
+ is_ignored = False
+ target_prefix = ''
+ target_suffix = ''
+ def __init__(self, spec):
+ self.spec = spec
+ def full_product_name(self):
+ """
+ Returns the full name of the product being built:
+
+ * Uses 'product_name' if it's set, else prefix + 'target_name'.
+ * Prepends 'product_dir' if set.
+ * Appends SCons suffix variables for the target type (or
+ product_extension).
+ """
+ suffix = self.target_suffix
+ product_extension = self.spec.get('product_extension')
+ if product_extension:
+ suffix = '.' + product_extension
+ prefix = self.spec.get('product_prefix', self.target_prefix)
+ name = self.spec['target_name']
+ name = prefix + self.spec.get('product_name', name) + suffix
+ product_dir = self.spec.get('product_dir')
+ if product_dir:
+ name = os.path.join(product_dir, name)
+ else:
+ name = os.path.join(self.out_dir, name)
+ return name
+
+ def write_input_files(self, fp):
+ """
+ Writes the definition of the input files (sources).
+ """
+ sources = self.spec.get('sources')
+ if not sources:
+ fp.write('\ninput_files = []\n')
+ return
+ preamble = '\ninput_files = [\n '
+ postamble = ',\n]\n'
+ WriteList(fp, map(repr, sources), preamble=preamble, postamble=postamble)
+
+ def builder_call(self):
+ """
+ Returns the actual SCons builder call to build this target.
+ """
+ name = self.full_product_name()
+ return 'env.%s(env.File(%r), input_files)' % (self.builder_name, name)
+ def write_target(self, fp, src_dir='', pre=''):
+ """
+ Writes the lines necessary to build this target.
+ """
+ fp.write('\n' + pre)
+ fp.write('_outputs = %s\n' % self.builder_call())
+ fp.write('target_files.extend(_outputs)\n')
+
+
+class NoneTarget(TargetBase):
+ """
+ A GYP target type of 'none', implicitly or explicitly.
+ """
+ def write_target(self, fp, pre=''):
+ fp.write('\ntarget_files.extend(input_files)\n')
+
+
+class SettingsTarget(TargetBase):
+ """
+ A GYP target type of 'settings'.
+ """
+ is_ignored = True
+
+
+compilable_sources_template = """
+_result = []
+for infile in input_files:
+ if env.compilable(infile):
+ if (type(infile) == type('')
+ and (infile.startswith(%(src_dir)r)
+ or not os.path.isabs(env.subst(infile)))):
+ # Force files below the build directory by replacing all '..'
+ # elements in the path with '__':
+ base, ext = os.path.splitext(os.path.normpath(infile))
+ base = [d == '..' and '__' or d for d in base.split('/')]
+ base = os.path.join(*base)
+ object = '${OBJ_DIR}/${COMPONENT_NAME}/${TARGET_NAME}/' + base
+ if not infile.startswith(%(src_dir)r):
+ infile = %(src_dir)r + infile
+ infile = env.%(name)s(object, infile)[0]
+ else:
+ infile = env.%(name)s(infile)[0]
+ _result.append(infile)
+input_files = _result
+"""
+
+class CompilableSourcesTargetBase(TargetBase):
+ """
+ An abstract base class for targets that compile their source files.
+
+ We explicitly transform compilable files into object files,
+ even though SCons could infer that for us, because we want
+ to control where the object file ends up. (The implicit rules
+ in SCons always put the object file next to the source file.)
+ """
+ intermediate_builder_name = None
+ def write_target(self, fp, src_dir='', pre=''):
+ if self.intermediate_builder_name is None:
+ raise NotImplementedError
+ if src_dir and not src_dir.endswith('/'):
+ src_dir += '/'
+ variables = {
+ 'src_dir': src_dir,
+ 'name': self.intermediate_builder_name,
+ }
+ fp.write(compilable_sources_template % variables)
+ super(CompilableSourcesTargetBase, self).write_target(fp)
+
+
+class ProgramTarget(CompilableSourcesTargetBase):
+ """
+ A GYP target type of 'executable'.
+ """
+ builder_name = 'GypProgram'
+ intermediate_builder_name = 'StaticObject'
+ target_prefix = '${PROGPREFIX}'
+ target_suffix = '${PROGSUFFIX}'
+ out_dir = '${TOP_BUILDDIR}'
+
+
+class StaticLibraryTarget(CompilableSourcesTargetBase):
+ """
+ A GYP target type of 'static_library'.
+ """
+ builder_name = 'GypStaticLibrary'
+ intermediate_builder_name = 'StaticObject'
+ target_prefix = '${LIBPREFIX}'
+ target_suffix = '${LIBSUFFIX}'
+ out_dir = '${LIB_DIR}'
+
+
+class SharedLibraryTarget(CompilableSourcesTargetBase):
+ """
+ A GYP target type of 'shared_library'.
+ """
+ builder_name = 'GypSharedLibrary'
+ intermediate_builder_name = 'SharedObject'
+ target_prefix = '${SHLIBPREFIX}'
+ target_suffix = '${SHLIBSUFFIX}'
+ out_dir = '${LIB_DIR}'
+
+
+class LoadableModuleTarget(CompilableSourcesTargetBase):
+ """
+ A GYP target type of 'loadable_module'.
+ """
+ builder_name = 'GypLoadableModule'
+ intermediate_builder_name = 'SharedObject'
+ target_prefix = '${SHLIBPREFIX}'
+ target_suffix = '${SHLIBSUFFIX}'
+ out_dir = '${TOP_BUILDDIR}'
+
+
+TargetMap = {
+ None : NoneTarget,
+ 'none' : NoneTarget,
+ 'settings' : SettingsTarget,
+ 'executable' : ProgramTarget,
+ 'static_library' : StaticLibraryTarget,
+ 'shared_library' : SharedLibraryTarget,
+ 'loadable_module' : LoadableModuleTarget,
+}
+
+def Target(spec):
+ return TargetMap[spec.get('type')](spec)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/__init__.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/__init__.py
new file mode 100644
index 0000000..4b088f6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/__init__.py
@@ -0,0 +1,461 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import copy
+import gyp.input
+import optparse
+import os.path
+import re
+import shlex
+import sys
+
+# Default debug modes for GYP
+debug = {}
+
+# List of "official" debug modes, but you can use anything you like.
+DEBUG_GENERAL = 'general'
+DEBUG_VARIABLES = 'variables'
+DEBUG_INCLUDES = 'includes'
+
+def DebugOutput(mode, message):
+ if mode in gyp.debug.keys():
+ print "%s: %s" % (mode.upper(), message)
+
+def FindBuildFiles():
+ extension = '.gyp'
+ files = os.listdir(os.getcwd())
+ build_files = []
+ for file in files:
+ if file[-len(extension):] == extension:
+ build_files.append(file)
+ return build_files
+
+
+def Load(build_files, format, default_variables={},
+ includes=[], depth='.', params={}, check=False, circular_check=True):
+ """
+ Loads one or more specified build files.
+ default_variables and includes will be copied before use.
+ Returns the generator for the specified format and the
+ data returned by loading the specified build files.
+ """
+ default_variables = copy.copy(default_variables)
+
+ # Default variables provided by this program and its modules should be
+ # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace,
+ # avoiding collisions with user and automatic variables.
+ default_variables['GENERATOR'] = format
+
+ generator_name = 'gyp.generator.' + format
+ # These parameters are passed in order (as opposed to by key)
+ # because ActivePython cannot handle key parameters to __import__.
+ generator = __import__(generator_name, globals(), locals(), generator_name)
+ for (key, val) in generator.generator_default_variables.items():
+ default_variables.setdefault(key, val)
+
+ # Give the generator the opportunity to set additional variables based on
+ # the params it will receive in the output phase.
+ if getattr(generator, 'CalculateVariables', None):
+ generator.CalculateVariables(default_variables, params)
+
+ # Fetch the generator specific info that gets fed to input, we use getattr
+ # so we can default things and the generators only have to provide what
+ # they need.
+ generator_input_info = {
+ 'generator_wants_absolute_build_file_paths':
+ getattr(generator, 'generator_wants_absolute_build_file_paths', False),
+ 'generator_handles_variants':
+ getattr(generator, 'generator_handles_variants', False),
+ 'non_configuration_keys':
+ getattr(generator, 'generator_additional_non_configuration_keys', []),
+ 'path_sections':
+ getattr(generator, 'generator_additional_path_sections', []),
+ 'extra_sources_for_rules':
+ getattr(generator, 'generator_extra_sources_for_rules', []),
+ 'generator_supports_multiple_toolsets':
+ getattr(generator, 'generator_supports_multiple_toolsets', False),
+ }
+
+ # Process the input specific to this generator.
+ result = gyp.input.Load(build_files, default_variables, includes[:],
+ depth, generator_input_info, check, circular_check)
+ return [generator] + result
+
+def NameValueListToDict(name_value_list):
+ """
+ Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
+ of the pairs. If a string is simply NAME, then the value in the dictionary
+ is set to True. If VALUE can be converted to an integer, it is.
+ """
+ result = { }
+ for item in name_value_list:
+ tokens = item.split('=', 1)
+ if len(tokens) == 2:
+ # If we can make it an int, use that, otherwise, use the string.
+ try:
+ token_value = int(tokens[1])
+ except ValueError:
+ token_value = tokens[1]
+ # Set the variable to the supplied value.
+ result[tokens[0]] = token_value
+ else:
+ # No value supplied, treat it as a boolean and set it.
+ result[tokens[0]] = True
+ return result
+
+def ShlexEnv(env_name):
+ flags = os.environ.get(env_name, [])
+ if flags:
+ flags = shlex.split(flags)
+ return flags
+
+def FormatOpt(opt, value):
+ if opt.startswith('--'):
+ return '%s=%s' % (opt, value)
+ return opt + value
+
+def RegenerateAppendFlag(flag, values, predicate, env_name, options):
+ """Regenerate a list of command line flags, for an option of action='append'.
+
+ The |env_name|, if given, is checked in the environment and used to generate
+ an initial list of options, then the options that were specified on the
+ command line (given in |values|) are appended. This matches the handling of
+ environment variables and command line flags where command line flags override
+ the environment, while not requiring the environment to be set when the flags
+ are used again.
+ """
+ flags = []
+ if options.use_environment and env_name:
+ for flag_value in ShlexEnv(env_name):
+ flags.append(FormatOpt(flag, predicate(flag_value)))
+ if values:
+ for flag_value in values:
+ flags.append(FormatOpt(flag, predicate(flag_value)))
+ return flags
+
+def RegenerateFlags(options):
+ """Given a parsed options object, and taking the environment variables into
+ account, returns a list of flags that should regenerate an equivalent options
+ object (even in the absence of the environment variables.)
+
+ Any path options will be normalized relative to depth.
+
+ The format flag is not included, as it is assumed the calling generator will
+ set that as appropriate.
+ """
+ def FixPath(path):
+ path = gyp.common.FixIfRelativePath(path, options.depth)
+ if not path:
+ return os.path.curdir
+ return path
+
+ def Noop(value):
+ return value
+
+ # We always want to ignore the environment when regenerating, to avoid
+ # duplicate or changed flags in the environment at the time of regeneration.
+ flags = ['--ignore-environment']
+ for name, metadata in options._regeneration_metadata.iteritems():
+ opt = metadata['opt']
+ value = getattr(options, name)
+ value_predicate = metadata['type'] == 'path' and FixPath or Noop
+ action = metadata['action']
+ env_name = metadata['env_name']
+ if action == 'append':
+ flags.extend(RegenerateAppendFlag(opt, value, value_predicate,
+ env_name, options))
+ elif action in ('store', None): # None is a synonym for 'store'.
+ if value:
+ flags.append(FormatOpt(opt, value_predicate(value)))
+ elif options.use_environment and env_name and os.environ.get(env_name):
+ flags.append(FormatOpt(opt, value_predicate(os.environ.get(env_name))))
+ elif action in ('store_true', 'store_false'):
+ if ((action == 'store_true' and value) or
+ (action == 'store_false' and not value)):
+ flags.append(opt)
+ elif options.use_environment and env_name:
+ print >>sys.stderr, ('Warning: environment regeneration unimplemented '
+ 'for %s flag %r env_name %r' % (action, opt,
+ env_name))
+ else:
+ print >>sys.stderr, ('Warning: regeneration unimplemented for action %r '
+ 'flag %r' % (action, opt))
+
+ return flags
+
+class RegeneratableOptionParser(optparse.OptionParser):
+ def __init__(self):
+ self.__regeneratable_options = {}
+ optparse.OptionParser.__init__(self)
+
+ def add_option(self, *args, **kw):
+ """Add an option to the parser.
+
+ This accepts the same arguments as OptionParser.add_option, plus the
+ following:
+ regenerate: can be set to False to prevent this option from being included
+ in regeneration.
+ env_name: name of environment variable that additional values for this
+ option come from.
+ type: adds type='path', to tell the regenerator that the values of
+ this option need to be made relative to options.depth
+ """
+ env_name = kw.pop('env_name', None)
+ if 'dest' in kw and kw.pop('regenerate', True):
+ dest = kw['dest']
+
+ # The path type is needed for regenerating, for optparse we can just treat
+ # it as a string.
+ type = kw.get('type')
+ if type == 'path':
+ kw['type'] = 'string'
+
+ self.__regeneratable_options[dest] = {
+ 'action': kw.get('action'),
+ 'type': type,
+ 'env_name': env_name,
+ 'opt': args[0],
+ }
+
+ optparse.OptionParser.add_option(self, *args, **kw)
+
+ def parse_args(self, *args):
+ values, args = optparse.OptionParser.parse_args(self, *args)
+ values._regeneration_metadata = self.__regeneratable_options
+ return values, args
+
+def main(args):
+ my_name = os.path.basename(sys.argv[0])
+
+ parser = RegeneratableOptionParser()
+ usage = 'usage: %s [options ...] [build_file ...]'
+ parser.set_usage(usage.replace('%s', '%prog'))
+ parser.add_option('-D', dest='defines', action='append', metavar='VAR=VAL',
+ env_name='GYP_DEFINES',
+ help='sets variable VAR to value VAL')
+ parser.add_option('-f', '--format', dest='formats', action='append',
+ env_name='GYP_GENERATORS', regenerate=False,
+ help='output formats to generate')
+ parser.add_option('--msvs-version', dest='msvs_version',
+ regenerate=False,
+ help='Deprecated; use -G msvs_version=MSVS_VERSION instead')
+ parser.add_option('-I', '--include', dest='includes', action='append',
+ metavar='INCLUDE', type='path',
+ help='files to include in all loaded .gyp files')
+ parser.add_option('--depth', dest='depth', metavar='PATH', type='path',
+ help='set DEPTH gyp variable to a relative path to PATH')
+ parser.add_option('-d', '--debug', dest='debug', metavar='DEBUGMODE',
+ action='append', default=[], help='turn on a debugging '
+ 'mode for debugging GYP. Supported modes are "variables" '
+ 'and "general"')
+ parser.add_option('-S', '--suffix', dest='suffix', default='',
+ help='suffix to add to generated files')
+ parser.add_option('-G', dest='generator_flags', action='append', default=[],
+ metavar='FLAG=VAL', env_name='GYP_GENERATOR_FLAGS',
+ help='sets generator flag FLAG to VAL')
+ parser.add_option('--generator-output', dest='generator_output',
+ action='store', default=None, metavar='DIR', type='path',
+ env_name='GYP_GENERATOR_OUTPUT',
+ help='puts generated build files under DIR')
+ parser.add_option('--ignore-environment', dest='use_environment',
+ action='store_false', default=True, regenerate=False,
+ help='do not read options from environment variables')
+ parser.add_option('--check', dest='check', action='store_true',
+ help='check format of gyp files')
+ parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store',
+ default=None, metavar='DIR', type='path',
+ help='directory to use as the root of the source tree')
+ # --no-circular-check disables the check for circular relationships between
+ # .gyp files. These relationships should not exist, but they've only been
+ # observed to be harmful with the Xcode generator. Chromium's .gyp files
+ # currently have some circular relationships on non-Mac platforms, so this
+ # option allows the strict behavior to be used on Macs and the lenient
+ # behavior to be used elsewhere.
+ # TODO(mark): Remove this option when http://crbug.com/35878 is fixed.
+ parser.add_option('--no-circular-check', dest='circular_check',
+ action='store_false', default=True, regenerate=False,
+ help="don't check for circular relationships between files")
+
+ # We read a few things from ~/.gyp, so set up a var for that.
+ home_vars = ['HOME']
+ if sys.platform in ('cygwin', 'win32'):
+ home_vars.append('USERPROFILE')
+ home = None
+ home_dot_gyp = None
+ for home_var in home_vars:
+ home = os.getenv(home_var)
+ if home != None:
+ home_dot_gyp = os.path.join(home, '.gyp')
+ if not os.path.exists(home_dot_gyp):
+ home_dot_gyp = None
+ else:
+ break
+
+ # TODO(thomasvl): add support for ~/.gyp/defaults
+
+ options, build_files_arg = parser.parse_args(args)
+ build_files = build_files_arg
+
+ if not options.formats:
+ # If no format was given on the command line, then check the env variable.
+ generate_formats = []
+ if options.use_environment:
+ generate_formats = os.environ.get('GYP_GENERATORS', [])
+ if generate_formats:
+ generate_formats = re.split('[\s,]', generate_formats)
+ if generate_formats:
+ options.formats = generate_formats
+ else:
+ # Nothing in the variable, default based on platform.
+ options.formats = [ {'darwin': 'xcode',
+ 'win32': 'msvs',
+ 'cygwin': 'msvs',
+ 'freebsd7': 'make',
+ 'freebsd8': 'make',
+ 'linux2': 'make',
+ 'openbsd4': 'make',
+ 'sunos5': 'make',}[sys.platform] ]
+
+ if not options.generator_output and options.use_environment:
+ g_o = os.environ.get('GYP_GENERATOR_OUTPUT')
+ if g_o:
+ options.generator_output = g_o
+
+ for mode in options.debug:
+ gyp.debug[mode] = 1
+
+ # Do an extra check to avoid work when we're not debugging.
+ if DEBUG_GENERAL in gyp.debug.keys():
+ DebugOutput(DEBUG_GENERAL, 'running with these options:')
+ for option, value in sorted(options.__dict__.items()):
+ if option[0] == '_':
+ continue
+ if isinstance(value, basestring):
+ DebugOutput(DEBUG_GENERAL, " %s: '%s'" % (option, value))
+ else:
+ DebugOutput(DEBUG_GENERAL, " %s: %s" % (option, str(value)))
+
+ if not build_files:
+ build_files = FindBuildFiles()
+ if not build_files:
+ print >>sys.stderr, (usage + '\n\n%s: error: no build_file') % \
+ (my_name, my_name)
+ return 1
+
+ # TODO(mark): Chromium-specific hack!
+ # For Chromium, the gyp "depth" variable should always be a relative path
+ # to Chromium's top-level "src" directory. If no depth variable was set
+ # on the command line, try to find a "src" directory by looking at the
+ # absolute path to each build file's directory. The first "src" component
+ # found will be treated as though it were the path used for --depth.
+ if not options.depth:
+ for build_file in build_files:
+ build_file_dir = os.path.abspath(os.path.dirname(build_file))
+ build_file_dir_components = build_file_dir.split(os.path.sep)
+ components_len = len(build_file_dir_components)
+ for index in xrange(components_len - 1, -1, -1):
+ if build_file_dir_components[index] == 'src':
+ options.depth = os.path.sep.join(build_file_dir_components)
+ break
+ del build_file_dir_components[index]
+
+ # If the inner loop found something, break without advancing to another
+ # build file.
+ if options.depth:
+ break
+
+ if not options.depth:
+ raise Exception, \
+ 'Could not automatically locate src directory. This is a ' + \
+ 'temporary Chromium feature that will be removed. Use ' + \
+ '--depth as a workaround.'
+
+ # If toplevel-dir is not set, we assume that depth is the root of our source
+ # tree.
+ if not options.toplevel_dir:
+ options.toplevel_dir = options.depth
+
+ # -D on the command line sets variable defaults - D isn't just for define,
+ # it's for default. Perhaps there should be a way to force (-F?) a
+ # variable's value so that it can't be overridden by anything else.
+ cmdline_default_variables = {}
+ defines = []
+ if options.use_environment:
+ defines += ShlexEnv('GYP_DEFINES')
+ if options.defines:
+ defines += options.defines
+ cmdline_default_variables = NameValueListToDict(defines)
+ if DEBUG_GENERAL in gyp.debug.keys():
+ DebugOutput(DEBUG_GENERAL,
+ "cmdline_default_variables: %s" % cmdline_default_variables)
+
+ # Set up includes.
+ includes = []
+
+ # If ~/.gyp/include.gypi exists, it'll be forcibly included into every
+ # .gyp file that's loaded, before anything else is included.
+ if home_dot_gyp != None:
+ default_include = os.path.join(home_dot_gyp, 'include.gypi')
+ if os.path.exists(default_include):
+ includes.append(default_include)
+
+ # Command-line --include files come after the default include.
+ if options.includes:
+ includes.extend(options.includes)
+
+ # Generator flags should be prefixed with the target generator since they
+ # are global across all generator runs.
+ gen_flags = []
+ if options.use_environment:
+ gen_flags += ShlexEnv('GYP_GENERATOR_FLAGS')
+ if options.generator_flags:
+ gen_flags += options.generator_flags
+ generator_flags = NameValueListToDict(gen_flags)
+ if DEBUG_GENERAL in gyp.debug.keys():
+ DebugOutput(DEBUG_GENERAL, "generator_flags: %s" % generator_flags)
+
+ # TODO: Remove this and the option after we've gotten folks to move to the
+ # generator flag.
+ if options.msvs_version:
+ print >>sys.stderr, \
+ 'DEPRECATED: Use generator flag (-G msvs_version=' + \
+ options.msvs_version + ') instead of --msvs-version=' + \
+ options.msvs_version
+ generator_flags['msvs_version'] = options.msvs_version
+
+ # Generate all requested formats (use a set in case we got one format request
+ # twice)
+ for format in set(options.formats):
+ params = {'options': options,
+ 'build_files': build_files,
+ 'generator_flags': generator_flags,
+ 'cwd': os.getcwd(),
+ 'build_files_arg': build_files_arg,
+ 'gyp_binary': sys.argv[0],
+ 'home_dot_gyp': home_dot_gyp}
+
+ # Start with the default variables from the command line.
+ [generator, flat_list, targets, data] = Load(build_files, format,
+ cmdline_default_variables,
+ includes, options.depth,
+ params, options.check,
+ options.circular_check)
+
+ # TODO(mark): Pass |data| for now because the generator needs a list of
+ # build files that came in. In the future, maybe it should just accept
+ # a list, and not the whole data dict.
+ # NOTE: flat_list is the flattened dependency graph specifying the order
+ # that targets may be built. Build systems that operate serially or that
+ # need to have dependencies defined before dependents reference them should
+ # generate targets in the order specified in flat_list.
+ generator.GenerateOutput(flat_list, targets, data, params)
+
+ # Done
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/common.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/common.py
new file mode 100644
index 0000000..bae3ae7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/common.py
@@ -0,0 +1,345 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import errno
+import filecmp
+import os.path
+import re
+import tempfile
+import sys
+
+def ExceptionAppend(e, msg):
+ """Append a message to the given exception's message."""
+ if not e.args:
+ e.args = (msg,)
+ elif len(e.args) == 1:
+ e.args = (str(e.args[0]) + ' ' + msg,)
+ else:
+ e.args = (str(e.args[0]) + ' ' + msg,) + e.args[1:]
+
+
+def ParseQualifiedTarget(target):
+ # Splits a qualified target into a build file, target name and toolset.
+
+ # NOTE: rsplit is used to disambiguate the Windows drive letter separator.
+ target_split = target.rsplit(':', 1)
+ if len(target_split) == 2:
+ [build_file, target] = target_split
+ else:
+ build_file = None
+
+ target_split = target.rsplit('#', 1)
+ if len(target_split) == 2:
+ [target, toolset] = target_split
+ else:
+ toolset = None
+
+ return [build_file, target, toolset]
+
+
+def ResolveTarget(build_file, target, toolset):
+ # This function resolves a target into a canonical form:
+ # - a fully defined build file, either absolute or relative to the current
+ # directory
+ # - a target name
+ # - a toolset
+ #
+ # build_file is the file relative to which 'target' is defined.
+ # target is the qualified target.
+ # toolset is the default toolset for that target.
+ [parsed_build_file, target, parsed_toolset] = ParseQualifiedTarget(target)
+
+ if parsed_build_file:
+ if build_file:
+ # If a relative path, parsed_build_file is relative to the directory
+ # containing build_file. If build_file is not in the current directory,
+ # parsed_build_file is not a usable path as-is. Resolve it by
+ # interpreting it as relative to build_file. If parsed_build_file is
+ # absolute, it is usable as a path regardless of the current directory,
+ # and os.path.join will return it as-is.
+ build_file = os.path.normpath(os.path.join(os.path.dirname(build_file),
+ parsed_build_file))
+ else:
+ build_file = parsed_build_file
+
+ if parsed_toolset:
+ toolset = parsed_toolset
+
+ return [build_file, target, toolset]
+
+
+def BuildFile(fully_qualified_target):
+ # Extracts the build file from the fully qualified target.
+ return ParseQualifiedTarget(fully_qualified_target)[0]
+
+
+def QualifiedTarget(build_file, target, toolset):
+ # "Qualified" means the file that a target was defined in and the target
+ # name, separated by a colon, suffixed by a # and the toolset name:
+ # /path/to/file.gyp:target_name#toolset
+ fully_qualified = build_file + ':' + target
+ if toolset:
+ fully_qualified = fully_qualified + '#' + toolset
+ return fully_qualified
+
+
+def RelativePath(path, relative_to):
+ # Assuming both |path| and |relative_to| are relative to the current
+ # directory, returns a relative path that identifies path relative to
+ # relative_to.
+
+ # Convert to absolute (and therefore normalized paths).
+ path = os.path.abspath(path)
+ relative_to = os.path.abspath(relative_to)
+
+ # Split the paths into components.
+ path_split = path.split(os.path.sep)
+ relative_to_split = relative_to.split(os.path.sep)
+
+ # Determine how much of the prefix the two paths share.
+ prefix_len = len(os.path.commonprefix([path_split, relative_to_split]))
+
+ # Put enough ".." components to back up out of relative_to to the common
+ # prefix, and then append the part of path_split after the common prefix.
+ relative_split = [os.path.pardir] * (len(relative_to_split) - prefix_len) + \
+ path_split[prefix_len:]
+
+ if len(relative_split) == 0:
+ # The paths were the same.
+ return ''
+
+ # Turn it back into a string and we're done.
+ return os.path.join(*relative_split)
+
+
+def FixIfRelativePath(path, relative_to):
+ # Like RelativePath but returns |path| unchanged if it is absolute.
+ if os.path.isabs(path):
+ return path
+ return RelativePath(path, relative_to)
+
+
+def UnrelativePath(path, relative_to):
+ # Assuming that |relative_to| is relative to the current directory, and |path|
+ # is a path relative to the dirname of |relative_to|, returns a path that
+ # identifies |path| relative to the current directory.
+ rel_dir = os.path.dirname(relative_to)
+ return os.path.normpath(os.path.join(rel_dir, path))
+
+
+# re objects used by EncodePOSIXShellArgument. See IEEE 1003.1 XCU.2.2 at
+# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_02
+# and the documentation for various shells.
+
+# _quote is a pattern that should match any argument that needs to be quoted
+# with double-quotes by EncodePOSIXShellArgument. It matches the following
+# characters appearing anywhere in an argument:
+# \t, \n, space parameter separators
+# # comments
+# $ expansions (quoted to always expand within one argument)
+# % called out by IEEE 1003.1 XCU.2.2
+# & job control
+# ' quoting
+# (, ) subshell execution
+# *, ?, [ pathname expansion
+# ; command delimiter
+# <, >, | redirection
+# = assignment
+# {, } brace expansion (bash)
+# ~ tilde expansion
+# It also matches the empty string, because "" (or '') is the only way to
+# represent an empty string literal argument to a POSIX shell.
+#
+# This does not match the characters in _escape, because those need to be
+# backslash-escaped regardless of whether they appear in a double-quoted
+# string.
+_quote = re.compile('[\t\n #$%&\'()*;<=>?[{|}~]|^$')
+
+# _escape is a pattern that should match any character that needs to be
+# escaped with a backslash, whether or not the argument matched the _quote
+# pattern. _escape is used with re.sub to backslash anything in _escape's
+# first match group, hence the (parentheses) in the regular expression.
+#
+# _escape matches the following characters appearing anywhere in an argument:
+# " to prevent POSIX shells from interpreting this character for quoting
+# \ to prevent POSIX shells from interpreting this character for escaping
+# ` to prevent POSIX shells from interpreting this character for command
+# substitution
+# Missing from this list is $, because the desired behavior of
+# EncodePOSIXShellArgument is to permit parameter (variable) expansion.
+#
+# Also missing from this list is !, which bash will interpret as the history
+# expansion character when history is enabled. bash does not enable history
+# by default in non-interactive shells, so this is not thought to be a problem.
+# ! was omitted from this list because bash interprets "\!" as a literal string
+# including the backslash character (avoiding history expansion but retaining
+# the backslash), which would not be correct for argument encoding. Handling
+# this case properly would also be problematic because bash allows the history
+# character to be changed with the histchars shell variable. Fortunately,
+# as history is not enabled in non-interactive shells and
+# EncodePOSIXShellArgument is only expected to encode for non-interactive
+# shells, there is no room for error here by ignoring !.
+_escape = re.compile(r'(["\\`])')
+
+def EncodePOSIXShellArgument(argument):
+ """Encodes |argument| suitably for consumption by POSIX shells.
+
+ argument may be quoted and escaped as necessary to ensure that POSIX shells
+ treat the returned value as a literal representing the argument passed to
+ this function. Parameter (variable) expansions beginning with $ are allowed
+ to remain intact without escaping the $, to allow the argument to contain
+ references to variables to be expanded by the shell.
+ """
+
+ if not isinstance(argument, str):
+ argument = str(argument)
+
+ if _quote.search(argument):
+ quote = '"'
+ else:
+ quote = ''
+
+ encoded = quote + re.sub(_escape, r'\\\1', argument) + quote
+
+ return encoded
+
+
+def EncodePOSIXShellList(list):
+ """Encodes |list| suitably for consumption by POSIX shells.
+
+ Returns EncodePOSIXShellArgument for each item in list, and joins them
+ together using the space character as an argument separator.
+ """
+
+ encoded_arguments = []
+ for argument in list:
+ encoded_arguments.append(EncodePOSIXShellArgument(argument))
+ return ' '.join(encoded_arguments)
+
+
+def DeepDependencyTargets(target_dicts, roots):
+ """Returns the recursive list of target dependencies."""
+ dependencies = set()
+ pending = set(roots)
+ while pending:
+ # Pluck out one.
+ r = pending.pop()
+ # Skip if visited already.
+ if r in dependencies:
+ continue
+ # Add it.
+ dependencies.add(r)
+ # Add its children.
+ spec = target_dicts[r]
+ pending.update(set(spec.get('dependencies', [])))
+ pending.update(set(spec.get('dependencies_original', [])))
+ return list(dependencies - set(roots))
+
+
+def BuildFileTargets(target_list, build_file):
+ """From a target_list, returns the subset from the specified build_file.
+ """
+ return [p for p in target_list if BuildFile(p) == build_file]
+
+
+def AllTargets(target_list, target_dicts, build_file):
+ """Returns all targets (direct and dependencies) for the specified build_file.
+ """
+ bftargets = BuildFileTargets(target_list, build_file)
+ deptargets = DeepDependencyTargets(target_dicts, bftargets)
+ return bftargets + deptargets
+
+
+def WriteOnDiff(filename):
+ """Write to a file only if the new contents differ.
+
+ Arguments:
+ filename: name of the file to potentially write to.
+ Returns:
+ A file like object which will write to temporary file and only overwrite
+ the target if it differs (on close).
+ """
+
+ class Writer:
+ """Wrapper around file which only covers the target if it differs."""
+ def __init__(self):
+ # Pick temporary file.
+ tmp_fd, self.tmp_path = tempfile.mkstemp(
+ suffix='.tmp',
+ prefix=os.path.split(filename)[1] + '.gyp.',
+ dir=os.path.split(filename)[0])
+ try:
+ self.tmp_file = os.fdopen(tmp_fd, 'wb')
+ except Exception:
+ # Don't leave turds behind.
+ os.unlink(self.tmp_path)
+ raise
+
+ def __getattr__(self, attrname):
+ # Delegate everything else to self.tmp_file
+ return getattr(self.tmp_file, attrname)
+
+ def close(self):
+ try:
+ # Close tmp file.
+ self.tmp_file.close()
+ # Determine if different.
+ same = False
+ try:
+ same = filecmp.cmp(self.tmp_path, filename, False)
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+
+ if same:
+ # The new file is identical to the old one, just get rid of the new
+ # one.
+ os.unlink(self.tmp_path)
+ else:
+ # The new file is different from the old one, or there is no old one.
+ # Rename the new file to the permanent name.
+ #
+ # tempfile.mkstemp uses an overly restrictive mode, resulting in a
+ # file that can only be read by the owner, regardless of the umask.
+ # There's no reason to not respect the umask here, which means that
+ # an extra hoop is required to fetch it and reset the new file's mode.
+ #
+ # No way to get the umask without setting a new one? Set a safe one
+ # and then set it back to the old value.
+ umask = os.umask(077)
+ os.umask(umask)
+ os.chmod(self.tmp_path, 0666 & ~umask)
+ if sys.platform == 'win32' and os.path.exists(filename):
+ # NOTE: on windows (but not cygwin) rename will not replace an
+ # existing file, so it must be preceded with a remove. Sadly there
+ # is no way to make the switch atomic.
+ os.remove(filename)
+ os.rename(self.tmp_path, filename)
+ except Exception:
+ # Don't leave turds behind.
+ os.unlink(self.tmp_path)
+ raise
+
+ return Writer()
+
+
+# From Alex Martelli,
+# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
+# ASPN: Python Cookbook: Remove duplicates from a sequence
+# First comment, dated 2001/10/13.
+# (Also in the printed Python Cookbook.)
+
+def uniquer(seq, idfun=None):
+ if idfun is None:
+ def idfun(x): return x
+ seen = {}
+ result = []
+ for item in seq:
+ marker = idfun(item)
+ if marker in seen: continue
+ seen[marker] = 1
+ result.append(item)
+ return result
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml.py
new file mode 100644
index 0000000..98e2923
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml.py
@@ -0,0 +1,121 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import xml.dom
+import xml_fix
+import common
+
+class EasyXml(object):
+ """ Class to easily create XML files with substantial pre-defined structures.
+
+ Visual Studio files have a lot of pre-defined structures. This class makes
+ it easy to represent these structures as Python data structures, instead of
+ having to create a lot of function calls.
+
+ For this class, an XML element is represented as a list composed of:
+ 1. The name of the element, a string,
+ 2. The attributes of the element, an dictionary (optional), and
+ 3+. The content of the element, if any. Strings are simple text nodes and
+ lists are child elements.
+
+ Example 1:
+ <test/>
+ becomes
+ ['test']
+
+ Example 2:
+ <myelement a='value1' b='value2'>
+ <childtype>This is</childtype>
+ <childtype>it!</childtype>
+ </myelement>
+
+ becomes
+ ['myelement', {'a':'value1', 'b':'value2'},
+ ['childtype', 'This is'],
+ ['childtype', 'it!'],
+ ]
+ """
+
+ def __init__(self, name, attributes=None):
+ """ Constructs an object representing an XML document.
+
+ Args:
+ name: A string, the name of the root element.
+ attributes: A dictionary, the attributes of the root.
+ """
+ xml_impl = xml.dom.getDOMImplementation()
+ self.doc = xml_impl.createDocument(None, name, None)
+ if attributes:
+ self.SetAttributes(self.doc.documentElement, attributes)
+
+ def AppendChildren(self, parent, children_specifications):
+ """ Appends multiple children.
+
+ Args:
+ parent: The node to which the children will be added.
+ children_specifications: A list of node specifications.
+ """
+ for specification in children_specifications:
+ # If it's a string, append a text node.
+ # Otherwise append an XML node.
+ if isinstance(specification, str):
+ parent.appendChild(self.doc.createTextNode(specification))
+ else:
+ self.AppendNode(parent, specification)
+
+ def AppendNode(self, parent, specification):
+ """ Appends multiple children.
+
+ Args:
+ parent: The node to which the child will be added.
+ children_specifications: A list, the node specification. The first
+ entry is the name of the element. If the second entry is a
+ dictionary, it is the attributes. The remaining entries of the
+ list are the sub-elements.
+ Returns:
+ The XML element created.
+ """
+ name = specification[0]
+ if not isinstance(name, str):
+ raise Exception('The first item of an EasyXml specification should be '
+ 'a string. Specification was ' + str(specification))
+ element = self.doc.createElement(name)
+ parent.appendChild(element)
+ rest = specification[1:]
+ # The second element is optionally a dictionary of the attributes.
+ if rest and isinstance(rest[0], dict):
+ self.SetAttributes(element, rest[0])
+ rest = rest[1:]
+ if rest:
+ self.AppendChildren(element, rest)
+ return element
+
+ def SetAttributes(self, element, attribute_description):
+ """ Sets the attributes of an element.
+
+ Args:
+ element: The node to which the child will be added.
+ attribute_description: A dictionary that maps attribute names to
+ attribute values.
+ """
+ for attribute, value in attribute_description.iteritems():
+ element.setAttribute(attribute, value)
+
+ def Root(self):
+ """ Returns the root element. """
+ return self.doc.documentElement
+
+ def WriteIfChanged(self, path):
+ """ Writes the XML doc but don't touch the file if unchanged. """
+ f = common.WriteOnDiff(path)
+ fix = xml_fix.XmlFix()
+ self.doc.writexml(f, encoding='utf-8', addindent='', newl='')
+ fix.Cleanup()
+ f.close()
+
+ def __str__(self):
+ """ Converts the doc to a string. """
+ return self.doc.toxml()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml_test.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml_test.py
new file mode 100644
index 0000000..e34821f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/easy_xml_test.py
@@ -0,0 +1,92 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+""" Unit tests for the easy_xml.py file. """
+
+import easy_xml
+import unittest
+import StringIO
+
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.stderr = StringIO.StringIO()
+
+ def test_EasyXml_simple(self):
+ xml = easy_xml.EasyXml('test')
+ self.assertEqual(str(xml), '<?xml version="1.0" ?><test/>')
+
+ def test_EasyXml_simple_with_attributes(self):
+ xml = easy_xml.EasyXml('test2', {'a': 'value1', 'b': 'value2'})
+ self.assertEqual(str(xml),
+ '<?xml version="1.0" ?><test2 a="value1" b="value2"/>')
+
+ def test_EasyXml_add_node(self):
+ # We want to create:
+ target = ('<?xml version="1.0" ?>'
+ '<test3>'
+ '<GrandParent>'
+ '<Parent1>'
+ '<Child/>'
+ '</Parent1>'
+ '<Parent2/>'
+ '</GrandParent>'
+ '</test3>')
+
+ # Do it the hard way first:
+ xml = easy_xml.EasyXml('test3')
+ grand_parent = xml.AppendNode(xml.Root(), ['GrandParent'])
+ parent1 = xml.AppendNode(grand_parent, ['Parent1'])
+ parent2 = xml.AppendNode(grand_parent, ['Parent2'])
+ xml.AppendNode(parent1, ['Child'])
+ self.assertEqual(str(xml), target)
+
+ # Do it the easier way:
+ xml = easy_xml.EasyXml('test3')
+ xml.AppendNode(xml.Root(),
+ ['GrandParent',
+ ['Parent1', ['Child']],
+ ['Parent2']])
+ self.assertEqual(str(xml), target)
+
+ def test_EasyXml_complex(self):
+ # We want to create:
+ target = ('<?xml version="1.0" ?>'
+ '<Project>'
+ '<PropertyGroup Label="Globals">'
+ '<ProjectGuid>{D2250C20-3A94-4FB9-AF73-11BC5B73884B}</ProjectGuid>'
+ '<Keyword>Win32Proj</Keyword>'
+ '<RootNamespace>automated_ui_tests</RootNamespace>'
+ '</PropertyGroup>'
+ '<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props"/>'
+ '<PropertyGroup Condition="\'$(Configuration)|$(Platform)\'==\''
+ 'Debug|Win32\'" Label="Configuration">'
+ '<ConfigurationType>Application</ConfigurationType>'
+ '<CharacterSet>Unicode</CharacterSet>'
+ '</PropertyGroup>'
+ '</Project>')
+
+ xml = easy_xml.EasyXml('Project')
+ xml.AppendChildren(xml.Root(), [
+ ['PropertyGroup', {'Label': 'Globals'},
+ ['ProjectGuid', '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}'],
+ ['Keyword', 'Win32Proj'],
+ ['RootNamespace', 'automated_ui_tests']
+ ],
+ ['Import', {'Project': '$(VCTargetsPath)\\Microsoft.Cpp.props'}],
+ ['PropertyGroup',
+ {'Condition': "'$(Configuration)|$(Platform)'=='Debug|Win32'",
+ 'Label': 'Configuration'},
+ ['ConfigurationType', 'Application'],
+ ['CharacterSet', 'Unicode']
+ ]
+ ])
+ self.assertEqual(str(xml), target)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceListener.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/__init__.py
index e69de29..e69de29 100644
--- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceListener.h
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/__init__.py
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/filelist.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/filelist.py
new file mode 100644
index 0000000..9e39363
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/filelist.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""filelist output module
+
+Just dumps the list of files to a text file for import into another build system.
+"""
+
+import gyp.common
+import errno
+import os
+
+
+# FIXME: These defaults are wrong, but serve to allow us to generate something for now.
+generator_default_variables = {
+ 'OS': 'linux',
+ 'PRODUCT_DIR': '$(builddir)',
+}
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ options = params['options']
+
+ for build_file, build_file_dict in data.iteritems():
+ (build_file_root, build_file_ext) = os.path.splitext(build_file)
+ if build_file_ext != '.gyp':
+ continue
+
+ filelist_suffix = ".am" # FIXME: This should be configurable in the .gyp file
+ filelist_path = build_file_root + options.suffix + filelist_suffix
+
+ with open(filelist_path, 'w') as output:
+
+ for qualified_target in target_list:
+ [input_file, target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2]
+
+ lowered_target = target.lower() # FIXME: This is a hack for now to matche gtk automake style.
+
+ output.write("%s_sources += \\\n" % lowered_target)
+
+ for source in target_dicts[qualified_target]['sources']:
+ output.write("\t%s \\\n" % source)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypd.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypd.py
new file mode 100644
index 0000000..948f0b8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypd.py
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""gypd output module
+
+This module produces gyp input as its output. Output files are given the
+.gypd extension to avoid overwriting the .gyp files that they are generated
+from. Internal references to .gyp files (such as those found in
+"dependencies" sections) are not adjusted to point to .gypd files instead;
+unlike other paths, which are relative to the .gyp or .gypd file, such paths
+are relative to the directory from which gyp was run to create the .gypd file.
+
+This generator module is intended to be a sample and a debugging aid, hence
+the "d" for "debug" in .gypd. It is useful to inspect the results of the
+various merges, expansions, and conditional evaluations performed by gyp
+and to see a representation of what would be fed to a generator module.
+
+It's not advisable to rename .gypd files produced by this module to .gyp,
+because they will have all merges, expansions, and evaluations already
+performed and the relevant constructs not present in the output; paths to
+dependencies may be wrong; and various sections that do not belong in .gyp
+files such as such as "included_files" and "*_excluded" will be present.
+Output will also be stripped of comments. This is not intended to be a
+general-purpose gyp pretty-printer; for that, you probably just want to
+run "pprint.pprint(eval(open('source.gyp').read()))", which will still strip
+comments but won't do all of the other things done to this module's output.
+
+The specific formatting of the output generated by this module is subject
+to change.
+"""
+
+
+import gyp.common
+import errno
+import os
+import pprint
+
+
+# These variables should just be spit back out as variable references.
+_generator_identity_variables = [
+ 'EXECUTABLE_PREFIX',
+ 'EXECUTABLE_SUFFIX',
+ 'INTERMEDIATE_DIR',
+ 'PRODUCT_DIR',
+ 'RULE_INPUT_ROOT',
+ 'RULE_INPUT_EXT',
+ 'RULE_INPUT_NAME',
+ 'RULE_INPUT_PATH',
+ 'SHARED_INTERMEDIATE_DIR',
+]
+
+# gypd doesn't define a default value for OS like many other generator
+# modules. Specify "-D OS=whatever" on the command line to provide a value.
+generator_default_variables = {
+}
+
+# gypd supports multiple toolsets
+generator_supports_multiple_toolsets = True
+
+# TODO(mark): This always uses <, which isn't right. The input module should
+# notify the generator to tell it which phase it is operating in, and this
+# module should use < for the early phase and then switch to > for the late
+# phase. Bonus points for carrying @ back into the output too.
+for v in _generator_identity_variables:
+ generator_default_variables[v] = '<(%s)' % v
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ output_files = {}
+ for qualified_target in target_list:
+ [input_file, target] = \
+ gyp.common.ParseQualifiedTarget(qualified_target)[0:2]
+
+ if input_file[-4:] != '.gyp':
+ continue
+ input_file_stem = input_file[:-4]
+ output_file = input_file_stem + params['options'].suffix + '.gypd'
+
+ if not output_file in output_files:
+ output_files[output_file] = input_file
+
+ for output_file, input_file in output_files.iteritems():
+ output = open(output_file, 'w')
+ pprint.pprint(data[input_file], output)
+ output.close()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypsh.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypsh.py
new file mode 100644
index 0000000..f48b03f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/gypsh.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""gypsh output module
+
+gypsh is a GYP shell. It's not really a generator per se. All it does is
+fire up an interactive Python session with a few local variables set to the
+variables passed to the generator. Like gypd, it's intended as a debugging
+aid, to facilitate the exploration of .gyp structures after being processed
+by the input module.
+
+The expected usage is "gyp -f gypsh -D OS=desired_os".
+"""
+
+
+import code
+import sys
+
+
+# All of this stuff about generator variables was lovingly ripped from gypd.py.
+# That module has a much better description of what's going on and why.
+_generator_identity_variables = [
+ 'EXECUTABLE_PREFIX',
+ 'EXECUTABLE_SUFFIX',
+ 'INTERMEDIATE_DIR',
+ 'PRODUCT_DIR',
+ 'RULE_INPUT_ROOT',
+ 'RULE_INPUT_EXT',
+ 'RULE_INPUT_NAME',
+ 'RULE_INPUT_PATH',
+ 'SHARED_INTERMEDIATE_DIR',
+]
+
+generator_default_variables = {
+}
+
+for v in _generator_identity_variables:
+ generator_default_variables[v] = '<(%s)' % v
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ locals = {
+ 'target_list': target_list,
+ 'target_dicts': target_dicts,
+ 'data': data,
+ }
+
+ # Use a banner that looks like the stock Python one and like what
+ # code.interact uses by default, but tack on something to indicate what
+ # locals are available, and identify gypsh.
+ banner='Python %s on %s\nlocals.keys() = %s\ngypsh' % \
+ (sys.version, sys.platform, repr(sorted(locals.keys())))
+
+ code.interact(banner, local=locals)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/make.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/make.py
new file mode 100644
index 0000000..e72c0fb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/make.py
@@ -0,0 +1,1423 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Notes:
+#
+# This is all roughly based on the Makefile system used by the Linux
+# kernel, but is a non-recursive make -- we put the entire dependency
+# graph in front of make and let it figure it out.
+#
+# The code below generates a separate .mk file for each target, but
+# all are sourced by the top-level Makefile. This means that all
+# variables in .mk-files clobber one another. Be careful to use :=
+# where appropriate for immediate evaluation, and similarly to watch
+# that you're not relying on a variable value to last beween different
+# .mk files.
+#
+# TODOs:
+#
+# Global settings and utility functions are currently stuffed in the
+# toplevel Makefile. It may make sense to generate some .mk files on
+# the side to keep the the files readable.
+
+import gyp
+import gyp.common
+import gyp.system_test
+import os.path
+import os
+
+# Debugging-related imports -- remove me once we're solid.
+import code
+import pprint
+
+generator_default_variables = {
+ 'EXECUTABLE_PREFIX': '',
+ 'EXECUTABLE_SUFFIX': '',
+ 'OS': 'linux',
+ 'STATIC_LIB_PREFIX': 'lib',
+ 'SHARED_LIB_PREFIX': 'lib',
+ 'STATIC_LIB_SUFFIX': '.a',
+ 'SHARED_LIB_SUFFIX': '.so',
+ 'INTERMEDIATE_DIR': '$(obj).$(TOOLSET)/geni',
+ 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen',
+ 'PRODUCT_DIR': '$(builddir)',
+ 'SHARED_LIB_DIR': '$(builddir)/lib.$(TOOLSET)',
+ 'LIB_DIR': '$(obj).$(TOOLSET)',
+ 'RULE_INPUT_ROOT': '%(INPUT_ROOT)s', # This gets expanded by Python.
+ 'RULE_INPUT_PATH': '$(abspath $<)',
+ 'RULE_INPUT_EXT': '$(suffix $<)',
+ 'RULE_INPUT_NAME': '$(notdir $<)',
+
+ # This appears unused --- ?
+ 'CONFIGURATION_NAME': '$(BUILDTYPE)',
+}
+
+# Make supports multiple toolsets
+generator_supports_multiple_toolsets = True
+
+def ensure_directory_exists(path):
+ dir = os.path.dirname(path)
+ if dir and not os.path.exists(dir):
+ os.makedirs(dir)
+
+# Header of toplevel Makefile.
+# This should go into the build tree, but it's easier to keep it here for now.
+SHARED_HEADER = ("""\
+# We borrow heavily from the kernel build setup, though we are simpler since
+# we don't have Kconfig tweaking settings on us.
+
+# The implicit make rules have it looking for RCS files, among other things.
+# We instead explicitly write all the rules we care about.
+# It's even quicker (saves ~200ms) to pass -r on the command line.
+MAKEFLAGS=-r
+
+# The source directory tree.
+srcdir := %(srcdir)s
+
+# The name of the builddir.
+builddir_name ?= %(builddir)s
+
+# The V=1 flag on command line makes us verbosely print command lines.
+ifdef V
+ quiet=
+else
+ quiet=quiet_
+endif
+
+# Specify BUILDTYPE=Release on the command line for a release build.
+BUILDTYPE ?= %(default_configuration)s
+
+# Directory all our build output goes into.
+# Note that this must be two directories beneath src/ for unit tests to pass,
+# as they reach into the src/ directory for data with relative paths.
+builddir ?= $(builddir_name)/$(BUILDTYPE)
+abs_builddir := $(abspath $(builddir))
+depsdir := $(builddir)/.deps
+
+# Object output directory.
+obj := $(builddir)/obj
+abs_obj := $(abspath $(obj))
+
+# We build up a list of every single one of the targets so we can slurp in the
+# generated dependency rule Makefiles in one pass.
+all_deps :=
+
+# C++ apps need to be linked with g++. Not sure what's appropriate.
+#
+# Note, the flock is used to seralize linking. Linking is a memory-intensive
+# process so running parallel links can often lead to thrashing. To disable
+# the serialization, override LINK via an envrionment variable as follows:
+#
+# export LINK="$(CXX)"
+#
+# This will allow make to invoke N linker processes as specified in -jN.
+LINK ?= flock $(builddir)/linker.lock $(CXX) %(LINK_flags)s
+
+CC.target ?= $(CC)
+CFLAGS.target ?= $(CFLAGS)
+CXX.target ?= $(CXX)
+CXXFLAGS.target ?= $(CXXFLAGS)
+LINK.target ?= $(LINK)
+LDFLAGS.target ?= $(LDFLAGS)
+AR.target ?= $(AR)
+ARFLAGS.target ?= %(ARFLAGS.target)s
+
+# N.B.: the logic of which commands to run should match the computation done
+# in gyp's make.py where ARFLAGS.host etc. is computed.
+# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
+# to replicate this environment fallback in make as well.
+CC.host ?= gcc
+CFLAGS.host ?=
+CXX.host ?= g++
+CXXFLAGS.host ?=
+LINK.host ?= g++
+LDFLAGS.host ?=
+AR.host ?= ar
+ARFLAGS.host := %(ARFLAGS.host)s
+
+# Flags to make gcc output dependency info. Note that you need to be
+# careful here to use the flags that ccache and distcc can understand.
+# We write to a dep file on the side first and then rename at the end
+# so we can't end up with a broken dep file.
+depfile = $(depsdir)/$@.d
+DEPFLAGS = -MMD -MF $(depfile).raw
+
+# We have to fixup the deps output in a few ways.
+# (1) the file output should mention the proper .o file.
+# ccache or distcc lose the path to the target, so we convert a rule of
+# the form:
+# foobar.o: DEP1 DEP2
+# into
+# path/to/foobar.o: DEP1 DEP2
+# (2) we want missing files not to cause us to fail to build.
+# We want to rewrite
+# foobar.o: DEP1 DEP2 \\
+# DEP3
+# to
+# DEP1:
+# DEP2:
+# DEP3:
+# so if the files are missing, they're just considered phony rules.
+# We have to do some pretty insane escaping to get those backslashes
+# and dollar signs past make, the shell, and sed at the same time."""
+r"""
+define fixup_dep
+# The depfile may not exist if the input file didn't have any #includes.
+touch $(depfile).raw
+# Fixup path as in (1).
+sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
+# Add extra rules as in (2).
+# We remove slashes and replace spaces with new lines;
+# remove blank lines;
+# delete the first line and append a colon to the remaining lines.
+sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
+ grep -v '^$$' |\
+ sed -e 1d -e 's|$$|:|' \
+ >> $(depfile)
+rm $(depfile).raw
+endef
+"""
+"""
+# Command definitions:
+# - cmd_foo is the actual command to run;
+# - quiet_cmd_foo is the brief-output summary of the command.
+
+quiet_cmd_cc = CC($(TOOLSET)) $@
+cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
+
+quiet_cmd_cxx = CXX($(TOOLSET)) $@
+cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
+
+quiet_cmd_alink = AR($(TOOLSET)) $@
+cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %%.o,$^)
+
+quiet_cmd_touch = TOUCH $@
+cmd_touch = touch $@
+
+quiet_cmd_copy = COPY $@
+# send stderr to /dev/null to ignore messages when linking directories.
+cmd_copy = ln -f $< $@ 2>/dev/null || cp -af $< $@
+
+# Due to circular dependencies between libraries :(, we wrap the
+# special "figure out circular dependencies" flags around the entire
+# input list during linking.
+quiet_cmd_link = LINK($(TOOLSET)) $@
+cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
+
+# Shared-object link (for generating .so).
+# Set SONAME to the library filename so our binaries don't reference the local,
+# absolute paths used on the link command-line.
+# TODO: perhaps this can share with the LINK command above?
+quiet_cmd_solink = SOLINK($(TOOLSET)) $@
+cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
+"""
+r"""
+# Define an escape_quotes function to escape single quotes.
+# This allows us to handle quotes properly as long as we always use
+# use single quotes and escape_quotes.
+escape_quotes = $(subst ','\'',$(1))
+# This comment is here just to include a ' to unconfuse syntax highlighting.
+# Define an escape_vars function to escape '$' variable syntax.
+# This allows us to read/write command lines with shell variables (e.g.
+# $LD_LIBRARY_PATH), without triggering make substitution.
+escape_vars = $(subst $$,$$$$,$(1))
+# Helper that expands to a shell command to echo a string exactly as it is in
+# make. This uses printf instead of echo because printf's behaviour with respect
+# to escape sequences is more portable than echo's across different shells
+# (e.g., dash, bash).
+exact_echo = printf '%%s\n' '$(call escape_quotes,$(1))'
+"""
+"""
+# Helper to compare the command we're about to run against the command
+# we logged the last time we ran the command. Produces an empty
+# string (false) when the commands match.
+# Tricky point: Make has no string-equality test function.
+# The kernel uses the following, but it seems like it would have false
+# positives, where one string reordered its arguments.
+# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \\
+# $(filter-out $(cmd_$@), $(cmd_$(1))))
+# We instead substitute each for the empty string into the other, and
+# say they're equal if both substitutions produce the empty string.
+command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$@)),\\
+ $(subst $(cmd_$@),,$(cmd_$(1))))
+
+# Helper that is non-empty when a prerequisite changes.
+# Normally make does this implicitly, but we force rules to always run
+# so we can check their command lines.
+# $? -- new prerequisites
+# $| -- order-only dependencies
+prereq_changed = $(filter-out $|,$?)
+
+# do_cmd: run a command via the above cmd_foo names, if necessary.
+# Should always run for a given target to handle command-line changes.
+# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
+define do_cmd
+$(if $(or $(command_changed),$(prereq_changed)),
+ @$(call exact_echo, $($(quiet)cmd_$(1)))
+ @mkdir -p $(dir $@) $(dir $(depfile))
+ @$(cmd_$(1))
+ @$(call exact_echo,$(call escape_vars,cmd_$@ := $(cmd_$(1)))) > $(depfile)
+ @$(if $(2),$(fixup_dep))
+)
+endef
+
+# Declare "all" target first so it is the default, even though we don't have the
+# deps yet.
+.PHONY: all
+all:
+
+# Use FORCE_DO_CMD to force a target to run. Should be coupled with
+# do_cmd.
+.PHONY: FORCE_DO_CMD
+FORCE_DO_CMD:
+
+""")
+
+ROOT_HEADER_SUFFIX_RULES = ("""\
+# Suffix rules, putting all outputs into $(obj).
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+# Try building from generated source, too.
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+""")
+
+SHARED_HEADER_SUFFIX_RULES_COMMENT1 = ("""\
+# Suffix rules, putting all outputs into $(obj).
+""")
+
+SHARED_HEADER_SUFFIX_RULES_SRCDIR = {
+ '.c': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+"""),
+ '.s': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+"""),
+ '.S': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+"""),
+ '.cpp': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+"""),
+ '.cc': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+"""),
+ '.cxx': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+"""),
+}
+
+SHARED_HEADER_SUFFIX_RULES_COMMENT2 = ("""\
+# Try building from generated source, too.
+""")
+
+SHARED_HEADER_SUFFIX_RULES_OBJDIR1 = {
+ '.c': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+"""),
+ '.cc': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+"""),
+ '.cpp': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+"""),
+}
+
+SHARED_HEADER_SUFFIX_RULES_OBJDIR2 = {
+ '.c': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+"""),
+ '.cc': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+"""),
+ '.cpp': ("""\
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+"""),
+}
+
+SHARED_HEADER_SUFFIX_RULES = (
+ SHARED_HEADER_SUFFIX_RULES_COMMENT1 +
+ ''.join(SHARED_HEADER_SUFFIX_RULES_SRCDIR.values()) +
+ SHARED_HEADER_SUFFIX_RULES_COMMENT2 +
+ ''.join(SHARED_HEADER_SUFFIX_RULES_OBJDIR1.values()) +
+ ''.join(SHARED_HEADER_SUFFIX_RULES_OBJDIR2.values())
+)
+
+SHARED_FOOTER = """\
+# "all" is a concatenation of the "all" targets from all the included
+# sub-makefiles. This is just here to clarify.
+all:
+
+# Add in dependency-tracking rules. $(all_deps) is the list of every single
+# target in our tree. First, only consider targets that already have been
+# built, as unbuilt targets will be built regardless of dependency info:
+all_deps := $(wildcard $(sort $(all_deps)))
+# Of those, only consider the ones with .d (dependency) info:
+d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
+ifneq ($(d_files),)
+ # Rather than include each individual .d file, concatenate them into a
+ # single file which make is able to load faster. We split this into
+ # commands that take 1000 files at a time to avoid overflowing the
+ # command line.
+ $(shell cat $(wordlist 1,1000,$(d_files)) > $(depsdir)/all.deps)
+%(generate_all_deps)s
+ # make looks for ways to re-generate included makefiles, but in our case, we
+ # don't have a direct way. Explicitly telling make that it has nothing to do
+ # for them makes it go faster.
+ $(depsdir)/all.deps: ;
+
+ include $(depsdir)/all.deps
+endif
+"""
+
+header = """\
+# This file is generated by gyp; do not edit.
+
+"""
+
+
+def Compilable(filename):
+ """Return true if the file is compilable (should be in OBJS)."""
+ for res in (filename.endswith(e) for e
+ in ['.c', '.cc', '.cpp', '.cxx', '.s', '.S']):
+ if res:
+ return True
+ return False
+
+
+def Linkable(filename):
+ """Return true if the file is linkable (should be on the link line)."""
+ return filename.endswith('.o')
+
+
+def Target(filename):
+ """Translate a compilable filename to its .o target."""
+ return os.path.splitext(filename)[0] + '.o'
+
+
+def EscapeShellArgument(s):
+ """Quotes an argument so that it will be interpreted literally by a POSIX
+ shell. Taken from
+ http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
+ """
+ return "'" + s.replace("'", "'\\''") + "'"
+
+
+def EscapeMakeVariableExpansion(s):
+ """Make has its own variable expansion syntax using $. We must escape it for
+ string to be interpreted literally."""
+ return s.replace('$', '$$')
+
+
+def EscapeCppDefine(s):
+ """Escapes a CPP define so that it will reach the compiler unaltered."""
+ s = EscapeShellArgument(s)
+ s = EscapeMakeVariableExpansion(s)
+ return s
+
+
+def QuoteIfNecessary(string):
+ """TODO: Should this ideally be replaced with one or more of the above
+ functions?"""
+ if '"' in string:
+ string = '"' + string.replace('"', '\\"') + '"'
+ return string
+
+
+def StringToMakefileVariable(string):
+ """Convert a string to a value that is acceptable as a make variable name."""
+ # TODO: replace other metacharacters that we encounter.
+ return string.replace(' ', '_')
+
+
+srcdir_prefix = ''
+def Sourceify(path):
+ """Convert a path to its source directory form."""
+ if '$(' in path:
+ return path
+ if os.path.isabs(path):
+ return path
+ return srcdir_prefix + path
+
+
+# Map from qualified target to path to output.
+target_outputs = {}
+# Map from qualified target to a list of all linker dependencies,
+# transitively expanded.
+# Used in building shared-library-based executables.
+target_link_deps = {}
+
+
+class MakefileWriter:
+ """MakefileWriter packages up the writing of one target-specific foobar.mk.
+
+ Its only real entry point is Write(), and is mostly used for namespacing.
+ """
+
+ def __init__(self):
+ # Keep track of the total number of outputs for this makefile.
+ self._num_outputs = 0
+
+
+ def NumOutputs(self):
+ return self._num_outputs
+
+
+ def Write(self, qualified_target, base_path, output_filename, spec, configs,
+ part_of_all):
+ """The main entry point: writes a .mk file for a single target.
+
+ Arguments:
+ qualified_target: target we're generating
+ base_path: path relative to source root we're building in, used to resolve
+ target-relative paths
+ output_filename: output .mk file name to write
+ spec, configs: gyp info
+ part_of_all: flag indicating this target is part of 'all'
+ """
+ ensure_directory_exists(output_filename)
+
+ self.fp = open(output_filename, 'w')
+
+ self.fp.write(header)
+
+ self.path = base_path
+ self.target = spec['target_name']
+ self.type = spec['type']
+ self.toolset = spec['toolset']
+
+ deps, link_deps = self.ComputeDeps(spec)
+
+ # Some of the generation below can add extra output, sources, or
+ # link dependencies. All of the out params of the functions that
+ # follow use names like extra_foo.
+ extra_outputs = []
+ extra_sources = []
+ extra_link_deps = []
+
+ self.output = self.ComputeOutput(spec)
+ self._INSTALLABLE_TARGETS = ('executable', 'loadable_module',
+ 'shared_library')
+ if self.type in self._INSTALLABLE_TARGETS:
+ self.alias = os.path.basename(self.output)
+ install_path = self._InstallableTargetInstallPath()
+ else:
+ self.alias = self.output
+ install_path = self.output
+
+ self.WriteLn("TOOLSET := " + self.toolset)
+ self.WriteLn("TARGET := " + self.target)
+
+ # Actions must come first, since they can generate more OBJs for use below.
+ if 'actions' in spec:
+ self.WriteActions(spec['actions'], extra_sources, extra_outputs,
+ part_of_all)
+
+ # Rules must be early like actions.
+ if 'rules' in spec:
+ self.WriteRules(spec['rules'], extra_sources, extra_outputs, part_of_all)
+
+ if 'copies' in spec:
+ self.WriteCopies(spec['copies'], extra_outputs, part_of_all)
+
+ all_sources = spec.get('sources', []) + extra_sources
+ if all_sources:
+ self.WriteSources(configs, deps, all_sources,
+ extra_outputs, extra_link_deps, part_of_all)
+ sources = filter(Compilable, all_sources)
+ if sources:
+ self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1)
+ extensions = set([os.path.splitext(s)[1] for s in sources])
+ for ext in extensions:
+ if ext in SHARED_HEADER_SUFFIX_RULES_SRCDIR:
+ self.WriteLn(SHARED_HEADER_SUFFIX_RULES_SRCDIR[ext])
+ self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2)
+ for ext in extensions:
+ if ext in SHARED_HEADER_SUFFIX_RULES_OBJDIR1:
+ self.WriteLn(SHARED_HEADER_SUFFIX_RULES_OBJDIR1[ext])
+ for ext in extensions:
+ if ext in SHARED_HEADER_SUFFIX_RULES_OBJDIR2:
+ self.WriteLn(SHARED_HEADER_SUFFIX_RULES_OBJDIR2[ext])
+ self.WriteLn('# End of this set of suffix rules')
+
+
+ self.WriteTarget(spec, configs, deps,
+ extra_link_deps + link_deps, extra_outputs, part_of_all)
+
+ # Update global list of target outputs, used in dependency tracking.
+ target_outputs[qualified_target] = install_path
+
+ # Update global list of link dependencies.
+ if self.type == 'static_library':
+ target_link_deps[qualified_target] = [self.output]
+ elif self.type == 'shared_library':
+ # Anyone that uses us transitively depend on all of our link
+ # dependencies.
+ target_link_deps[qualified_target] = [self.output] + link_deps
+
+ self.fp.close()
+
+
+ def WriteSubMake(self, output_filename, makefile_path, targets, build_dir):
+ """Write a "sub-project" Makefile.
+
+ This is a small, wrapper Makefile that calls the top-level Makefile to build
+ the targets from a single gyp file (i.e. a sub-project).
+
+ Arguments:
+ output_filename: sub-project Makefile name to write
+ makefile_path: path to the top-level Makefile
+ targets: list of "all" targets for this sub-project
+ build_dir: build output directory, relative to the sub-project
+ """
+ ensure_directory_exists(output_filename)
+ self.fp = open(output_filename, 'w')
+ self.fp.write(header)
+ # For consistency with other builders, put sub-project build output in the
+ # sub-project dir (see test/subdirectory/gyptest-subdir-all.py).
+ self.WriteLn('export builddir_name ?= %s' %
+ os.path.join(os.path.dirname(output_filename), build_dir))
+ self.WriteLn('.PHONY: all')
+ self.WriteLn('all:')
+ if makefile_path:
+ makefile_path = ' -C ' + makefile_path
+ self.WriteLn('\t$(MAKE)%s %s' % (makefile_path, ' '.join(targets)))
+ self.fp.close()
+
+
+ def WriteActions(self, actions, extra_sources, extra_outputs, part_of_all):
+ """Write Makefile code for any 'actions' from the gyp input.
+
+ extra_sources: a list that will be filled in with newly generated source
+ files, if any
+ extra_outputs: a list that will be filled in with any outputs of these
+ actions (used to make other pieces dependent on these
+ actions)
+ part_of_all: flag indicating this target is part of 'all'
+ """
+ for action in actions:
+ name = self.target + '_' + StringToMakefileVariable(action['action_name'])
+ self.WriteLn('### Rules for action "%s":' % action['action_name'])
+ inputs = action['inputs']
+ outputs = action['outputs']
+
+ # Build up a list of outputs.
+ # Collect the output dirs we'll need.
+ dirs = set()
+ for out in outputs:
+ dir = os.path.split(out)[0]
+ if dir:
+ dirs.add(dir)
+ if int(action.get('process_outputs_as_sources', False)):
+ extra_sources += outputs
+
+ # Write the actual command.
+ command = gyp.common.EncodePOSIXShellList(action['action'])
+ if 'message' in action:
+ self.WriteLn('quiet_cmd_%s = ACTION %s $@' % (name, action['message']))
+ else:
+ self.WriteLn('quiet_cmd_%s = ACTION %s $@' % (name, name))
+ if len(dirs) > 0:
+ command = 'mkdir -p %s' % ' '.join(dirs) + '; ' + command
+ # Set LD_LIBRARY_PATH in case the action runs an executable from this
+ # build which links to shared libs from this build.
+ if self.path:
+ cd_action = 'cd %s; ' % Sourceify(self.path)
+ else:
+ cd_action = ''
+ # actions run on the host, so they should in theory only use host
+ # libraries, but until everything is made cross-compile safe, also use
+ # target libraries.
+ # TODO(piman): when everything is cross-compile safe, remove lib.target
+ self.WriteLn('cmd_%s = export LD_LIBRARY_PATH=$(builddir)/lib.host:'
+ '$(builddir)/lib.target:$$LD_LIBRARY_PATH; %s%s'
+ % (name, cd_action, command))
+ self.WriteLn()
+ outputs = map(self.Absolutify, outputs)
+ # The makefile rules are all relative to the top dir, but the gyp actions
+ # are defined relative to their containing dir. This replaces the obj
+ # variable for the action rule with an absolute version so that the output
+ # goes in the right place.
+ # Only write the 'obj' and 'builddir' rules for the "primary" output (:1);
+ # it's superfluous for the "extra outputs", and this avoids accidentally
+ # writing duplicate dummy rules for those outputs.
+ self.WriteMakeRule(outputs[:1], ['obj := $(abs_obj)'])
+ self.WriteMakeRule(outputs[:1], ['builddir := $(abs_builddir)'])
+ self.WriteDoCmd(outputs, map(Sourceify, map(self.Absolutify, inputs)),
+ part_of_all=part_of_all, command=name)
+
+ # Stuff the outputs in a variable so we can refer to them later.
+ outputs_variable = 'action_%s_outputs' % name
+ self.WriteLn('%s := %s' % (outputs_variable, ' '.join(outputs)))
+ extra_outputs.append('$(%s)' % outputs_variable)
+ self.WriteLn()
+
+ self.WriteLn()
+
+
+ def WriteRules(self, rules, extra_sources, extra_outputs, part_of_all):
+ """Write Makefile code for any 'rules' from the gyp input.
+
+ extra_sources: a list that will be filled in with newly generated source
+ files, if any
+ extra_outputs: a list that will be filled in with any outputs of these
+ rules (used to make other pieces dependent on these rules)
+ part_of_all: flag indicating this target is part of 'all'
+ """
+ for rule in rules:
+ name = self.target + '_' + StringToMakefileVariable(rule['rule_name'])
+ count = 0
+ self.WriteLn('### Generated for rule %s:' % name)
+
+ all_outputs = []
+
+ for rule_source in rule.get('rule_sources', []):
+ dirs = set()
+ rule_source_basename = os.path.basename(rule_source)
+ (rule_source_root, rule_source_ext) = \
+ os.path.splitext(rule_source_basename)
+
+ outputs = [self.ExpandInputRoot(out, rule_source_root)
+ for out in rule['outputs']]
+ for out in outputs:
+ dir = os.path.dirname(out)
+ if dir:
+ dirs.add(dir)
+ if int(rule.get('process_outputs_as_sources', False)):
+ extra_sources.append(out)
+ all_outputs += outputs
+ inputs = map(Sourceify, map(self.Absolutify, [rule_source] +
+ rule.get('inputs', [])))
+ actions = ['$(call do_cmd,%s_%d)' % (name, count)]
+
+ if name == 'resources_grit':
+ # HACK: This is ugly. Grit intentionally doesn't touch the
+ # timestamp of its output file when the file doesn't change,
+ # which is fine in hash-based dependency systems like scons
+ # and forge, but not kosher in the make world. After some
+ # discussion, hacking around it here seems like the least
+ # amount of pain.
+ actions += ['@touch --no-create $@']
+
+ # Only write the 'obj' and 'builddir' rules for the "primary" output
+ # (:1); it's superfluous for the "extra outputs", and this avoids
+ # accidentally writing duplicate dummy rules for those outputs.
+ self.WriteMakeRule(outputs[:1], ['obj := $(abs_obj)'])
+ self.WriteMakeRule(outputs[:1], ['builddir := $(abs_builddir)'])
+ self.WriteMakeRule(outputs, inputs + ['FORCE_DO_CMD'], actions)
+ self.WriteLn('all_deps += %s' % ' '.join(outputs))
+ self._num_outputs += len(outputs)
+
+ action = [self.ExpandInputRoot(ac, rule_source_root)
+ for ac in rule['action']]
+ mkdirs = ''
+ if len(dirs) > 0:
+ mkdirs = 'mkdir -p %s; ' % ' '.join(dirs)
+ if self.path:
+ cd_action = 'cd %s; ' % Sourceify(self.path)
+ else:
+ cd_action = ''
+ # Set LD_LIBRARY_PATH in case the rule runs an executable from this
+ # build which links to shared libs from this build.
+ # rules run on the host, so they should in theory only use host
+ # libraries, but until everything is made cross-compile safe, also use
+ # target libraries.
+ # TODO(piman): when everything is cross-compile safe, remove lib.target
+ self.WriteLn(
+ "cmd_%(name)s_%(count)d = export LD_LIBRARY_PATH="
+ "$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; "
+ "%(cd_action)s%(mkdirs)s%(action)s" % {
+ 'action': gyp.common.EncodePOSIXShellList(action),
+ 'cd_action': cd_action,
+ 'count': count,
+ 'mkdirs': mkdirs,
+ 'name': name,
+ })
+ self.WriteLn(
+ 'quiet_cmd_%(name)s_%(count)d = RULE %(name)s_%(count)d $@' % {
+ 'count': count,
+ 'name': name,
+ })
+ self.WriteLn()
+ count += 1
+
+ outputs_variable = 'rule_%s_outputs' % name
+ self.WriteList(all_outputs, outputs_variable)
+ extra_outputs.append('$(%s)' % outputs_variable)
+
+ self.WriteLn('### Finished generating for rule: %s' % name)
+ self.WriteLn()
+ self.WriteLn('### Finished generating for all rules')
+ self.WriteLn('')
+
+
+ def WriteCopies(self, copies, extra_outputs, part_of_all):
+ """Write Makefile code for any 'copies' from the gyp input.
+
+ extra_outputs: a list that will be filled in with any outputs of this action
+ (used to make other pieces dependent on this action)
+ part_of_all: flag indicating this target is part of 'all'
+ """
+ self.WriteLn('### Generated for copy rule.')
+
+ variable = self.target + '_copies'
+ outputs = []
+ for copy in copies:
+ for path in copy['files']:
+ path = Sourceify(self.Absolutify(path))
+ filename = os.path.split(path)[1]
+ output = Sourceify(self.Absolutify(os.path.join(copy['destination'],
+ filename)))
+ self.WriteDoCmd([output], [path], 'copy', part_of_all)
+ outputs.append(output)
+ self.WriteLn('%s = %s' % (variable, ' '.join(outputs)))
+ extra_outputs.append('$(%s)' % variable)
+ self.WriteLn()
+
+
+ def WriteSources(self, configs, deps, sources,
+ extra_outputs, extra_link_deps,
+ part_of_all):
+ """Write Makefile code for any 'sources' from the gyp input.
+ These are source files necessary to build the current target.
+
+ configs, deps, sources: input from gyp.
+ extra_outputs: a list of extra outputs this action should be dependent on;
+ used to serialize action/rules before compilation
+ extra_link_deps: a list that will be filled in with any outputs of
+ compilation (to be used in link lines)
+ part_of_all: flag indicating this target is part of 'all'
+ """
+
+ # Write configuration-specific variables for CFLAGS, etc.
+ for configname in sorted(configs.keys()):
+ config = configs[configname]
+ self.WriteList(config.get('defines'), 'DEFS_%s' % configname, prefix='-D',
+ quoter=EscapeCppDefine)
+ self.WriteLn("# Flags passed to both C and C++ files.");
+ self.WriteList(config.get('cflags'), 'CFLAGS_%s' % configname)
+ self.WriteLn("# Flags passed to only C (and not C++) files.");
+ self.WriteList(config.get('cflags_c'), 'CFLAGS_C_%s' % configname)
+ self.WriteLn("# Flags passed to only C++ (and not C) files.");
+ self.WriteList(config.get('cflags_cc'), 'CFLAGS_CC_%s' % configname)
+ includes = config.get('include_dirs')
+ if includes:
+ includes = map(Sourceify, map(self.Absolutify, includes))
+ self.WriteList(includes, 'INCS_%s' % configname, prefix='-I')
+
+ compilable = filter(Compilable, sources)
+ objs = map(self.Objectify, map(self.Absolutify, map(Target, compilable)))
+ self.WriteList(objs, 'OBJS')
+
+ self.WriteLn('# Add to the list of files we specially track '
+ 'dependencies for.')
+ self.WriteLn('all_deps += $(OBJS)')
+ self._num_outputs += len(objs)
+ self.WriteLn()
+
+ # Make sure our dependencies are built first.
+ if deps:
+ self.WriteMakeRule(['$(OBJS)'], deps,
+ comment = 'Make sure our dependencies are built '
+ 'before any of us.',
+ order_only = True)
+
+ # Make sure the actions and rules run first.
+ # If they generate any extra headers etc., the per-.o file dep tracking
+ # will catch the proper rebuilds, so order only is still ok here.
+ if extra_outputs:
+ self.WriteMakeRule(['$(OBJS)'], extra_outputs,
+ comment = 'Make sure our actions/rules run '
+ 'before any of us.',
+ order_only = True)
+
+ if objs:
+ extra_link_deps.append('$(OBJS)')
+ self.WriteLn("""\
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.""")
+ self.WriteLn("$(OBJS): TOOLSET := $(TOOLSET)")
+ self.WriteLn("$(OBJS): GYP_CFLAGS := "
+ "$(DEFS_$(BUILDTYPE)) "
+ "$(INCS_$(BUILDTYPE)) "
+ "$(CFLAGS_$(BUILDTYPE)) "
+ "$(CFLAGS_C_$(BUILDTYPE))")
+ self.WriteLn("$(OBJS): GYP_CXXFLAGS := "
+ "$(DEFS_$(BUILDTYPE)) "
+ "$(INCS_$(BUILDTYPE)) "
+ "$(CFLAGS_$(BUILDTYPE)) "
+ "$(CFLAGS_CC_$(BUILDTYPE))")
+
+ # If there are any object files in our input file list, link them into our
+ # output.
+ extra_link_deps += filter(Linkable, sources)
+
+ self.WriteLn()
+
+
+ def ComputeOutput(self, spec):
+ """Return the 'output' (full output path) of a gyp spec.
+
+ E.g., the loadable module 'foobar' in directory 'baz' will produce
+ '$(obj)/baz/libfoobar.so'
+ """
+ output = None
+ target = spec['target_name']
+ target_prefix = ''
+ target_ext = ''
+ path = os.path.join('$(obj).' + self.toolset, self.path)
+ if self.type == 'static_library':
+ if target[:3] == 'lib':
+ target = target[3:]
+ target_prefix = 'lib'
+ target_ext = '.a'
+ elif self.type in ('loadable_module', 'shared_library'):
+ if target[:3] == 'lib':
+ target = target[3:]
+ target_prefix = 'lib'
+ target_ext = '.so'
+ elif self.type == 'none':
+ target = '%s.stamp' % target
+ elif self.type == 'settings':
+ return None
+ elif self.type == 'executable':
+ path = os.path.join('$(builddir)')
+ else:
+ print ("ERROR: What output file should be generated?",
+ "typ", self.type, "target", target)
+
+ path = spec.get('product_dir', path)
+ target_prefix = spec.get('product_prefix', target_prefix)
+ target = spec.get('product_name', target)
+ product_ext = spec.get('product_extension')
+ if product_ext:
+ target_ext = '.' + product_ext
+
+ return os.path.join(path, target_prefix + target + target_ext)
+
+
+ def ComputeDeps(self, spec):
+ """Compute the dependencies of a gyp spec.
+
+ Returns a tuple (deps, link_deps), where each is a list of
+ filenames that will need to be put in front of make for either
+ building (deps) or linking (link_deps).
+ """
+ deps = []
+ link_deps = []
+ if 'dependencies' in spec:
+ deps.extend([target_outputs[dep] for dep in spec['dependencies']
+ if target_outputs[dep]])
+ for dep in spec['dependencies']:
+ if dep in target_link_deps:
+ link_deps.extend(target_link_deps[dep])
+ deps.extend(link_deps)
+ # TODO: It seems we need to transitively link in libraries (e.g. -lfoo)?
+ # This hack makes it work:
+ # link_deps.extend(spec.get('libraries', []))
+ return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps))
+
+
+ def WriteTarget(self, spec, configs, deps, link_deps, extra_outputs,
+ part_of_all):
+ """Write Makefile code to produce the final target of the gyp spec.
+
+ spec, configs: input from gyp.
+ deps, link_deps: dependency lists; see ComputeDeps()
+ extra_outputs: any extra outputs that our target should depend on
+ part_of_all: flag indicating this target is part of 'all'
+ """
+
+ self.WriteLn('### Rules for final target.')
+
+ if extra_outputs:
+ self.WriteMakeRule([self.output], extra_outputs,
+ comment = 'Build our special outputs first.',
+ order_only = True)
+ self.WriteMakeRule(extra_outputs, deps,
+ comment=('Preserve order dependency of '
+ 'special output on deps.'),
+ order_only = True,
+ multiple_output_trick = False)
+
+ if self.type not in ('settings', 'none'):
+ for configname in sorted(configs.keys()):
+ config = configs[configname]
+ self.WriteList(config.get('ldflags'), 'LDFLAGS_%s' % configname)
+ libraries = spec.get('libraries')
+ if libraries:
+ # Remove duplicate entries
+ libraries = gyp.common.uniquer(libraries)
+ self.WriteList(libraries, 'LIBS')
+ self.WriteLn('%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))' % self.output)
+ self.WriteLn('%s: LIBS := $(LIBS)' % self.output)
+
+ if self.type == 'executable':
+ self.WriteDoCmd([self.output], link_deps, 'link', part_of_all)
+ elif self.type == 'static_library':
+ self.WriteDoCmd([self.output], link_deps, 'alink', part_of_all)
+ elif self.type in ('loadable_module', 'shared_library'):
+ self.WriteDoCmd([self.output], link_deps, 'solink', part_of_all)
+ elif self.type == 'none':
+ # Write a stamp line.
+ self.WriteDoCmd([self.output], deps, 'touch', part_of_all)
+ elif self.type == 'settings':
+ # Only used for passing flags around.
+ pass
+ else:
+ print "WARNING: no output for", self.type, target
+
+ # Add an alias for each target (if there are any outputs).
+ # Installable target aliases are created below.
+ if ((self.output and self.output != self.target) and
+ (self.type not in self._INSTALLABLE_TARGETS)):
+ self.WriteMakeRule([self.target], [self.output],
+ comment='Add target alias', phony = True)
+ if part_of_all:
+ self.WriteMakeRule(['all'], [self.target],
+ comment = 'Add target alias to "all" target.',
+ phony = True)
+
+ # Add special-case rules for our installable targets.
+ # 1) They need to install to the build dir or "product" dir.
+ # 2) They get shortcuts for building (e.g. "make chrome").
+ # 3) They are part of "make all".
+ if self.type in self._INSTALLABLE_TARGETS:
+ if self.type == 'shared_library':
+ file_desc = 'shared library'
+ else:
+ file_desc = 'executable'
+ install_path = self._InstallableTargetInstallPath()
+ installable_deps = [self.output]
+ # Point the target alias to the final binary output.
+ self.WriteMakeRule([self.target], [install_path],
+ comment='Add target alias', phony = True)
+ if install_path != self.output:
+ self.WriteDoCmd([install_path], [self.output], 'copy',
+ comment = 'Copy this to the %s output path.' %
+ file_desc, part_of_all=part_of_all)
+ installable_deps.append(install_path)
+ if self.output != self.alias and self.alias != self.target:
+ self.WriteMakeRule([self.alias], installable_deps,
+ comment = 'Short alias for building this %s.' %
+ file_desc, phony = True)
+ if part_of_all:
+ self.WriteMakeRule(['all'], [install_path],
+ comment = 'Add %s to "all" target.' % file_desc,
+ phony = True)
+
+
+ def WriteList(self, list, variable=None, prefix='', quoter=QuoteIfNecessary):
+ """Write a variable definition that is a list of values.
+
+ E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
+ foo = blaha blahb
+ but in a pretty-printed style.
+ """
+ self.fp.write(variable + " := ")
+ if list:
+ list = [quoter(prefix + l) for l in list]
+ self.fp.write(" \\\n\t".join(list))
+ self.fp.write("\n\n")
+
+
+ def WriteDoCmd(self, outputs, inputs, command, part_of_all, comment=None):
+ """Write a Makefile rule that uses do_cmd.
+
+ This makes the outputs dependent on the command line that was run,
+ as well as support the V= make command line flag.
+ """
+ self.WriteMakeRule(outputs, inputs,
+ actions = ['$(call do_cmd,%s)' % command],
+ comment = comment,
+ force = True)
+ # Add our outputs to the list of targets we read depfiles from.
+ self.WriteLn('all_deps += %s' % ' '.join(outputs))
+ self._num_outputs += len(outputs)
+
+
+ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
+ order_only=False, force=False, phony=False,
+ multiple_output_trick=True):
+ """Write a Makefile rule, with some extra tricks.
+
+ outputs: a list of outputs for the rule (note: this is not directly
+ supported by make; see comments below)
+ inputs: a list of inputs for the rule
+ actions: a list of shell commands to run for the rule
+ comment: a comment to put in the Makefile above the rule (also useful
+ for making this Python script's code self-documenting)
+ order_only: if true, makes the dependency order-only
+ force: if true, include FORCE_DO_CMD as an order-only dep
+ phony: if true, the rule does not actually generate the named output, the
+ output is just a name to run the rule
+ multiple_output_trick: if true (the default), perform tricks such as dummy
+ rules to avoid problems with multiple outputs.
+ """
+ if comment:
+ self.WriteLn('# ' + comment)
+ if phony:
+ self.WriteLn('.PHONY: ' + ' '.join(outputs))
+ # TODO(evanm): just make order_only a list of deps instead of these hacks.
+ if order_only:
+ order_insert = '| '
+ else:
+ order_insert = ''
+ if force:
+ force_append = ' FORCE_DO_CMD'
+ else:
+ force_append = ''
+ if actions:
+ self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0])
+ self.WriteLn('%s: %s%s%s' % (outputs[0], order_insert, ' '.join(inputs),
+ force_append))
+ if actions:
+ for action in actions:
+ self.WriteLn('\t%s' % action)
+ if multiple_output_trick and len(outputs) > 1:
+ # If we have more than one output, a rule like
+ # foo bar: baz
+ # that for *each* output we must run the action, potentially
+ # in parallel. That is not what we're trying to write -- what
+ # we want is that we run the action once and it generates all
+ # the files.
+ # http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html
+ # discusses this problem and has this solution:
+ # 1) Write the naive rule that would produce parallel runs of
+ # the action.
+ # 2) Make the outputs seralized on each other, so we won't start
+ # a parallel run until the first run finishes, at which point
+ # we'll have generated all the outputs and we're done.
+ self.WriteLn('%s: %s' % (' '.join(outputs[1:]), outputs[0]))
+ # Add a dummy command to the "extra outputs" rule, otherwise make seems to
+ # think these outputs haven't (couldn't have?) changed, and thus doesn't
+ # flag them as changed (i.e. include in '$?') when evaluating dependent
+ # rules, which in turn causes do_cmd() to skip running dependent commands.
+ self.WriteLn('%s: ;' % (' '.join(outputs[1:])))
+ self.WriteLn()
+
+
+ def WriteLn(self, text=''):
+ self.fp.write(text + '\n')
+
+
+ def Objectify(self, path):
+ """Convert a path to its output directory form."""
+ if '$(' in path:
+ path = path.replace('$(obj)/', '$(obj).%s/$(TARGET)/' % self.toolset)
+ return path
+ return '$(obj).%s/$(TARGET)/%s' % (self.toolset, path)
+
+ def Absolutify(self, path):
+ """Convert a subdirectory-relative path into a base-relative path.
+ Skips over paths that contain variables."""
+ if '$(' in path:
+ return path
+ return os.path.normpath(os.path.join(self.path, path))
+
+
+ def FixupArgPath(self, arg):
+ if '/' in arg or '.h.' in arg:
+ return self.Absolutify(arg)
+ return arg
+
+
+ def ExpandInputRoot(self, template, expansion):
+ if '%(INPUT_ROOT)s' not in template:
+ return template
+ path = template % { 'INPUT_ROOT': expansion }
+ if not os.path.dirname(path):
+ # If it's just the file name, turn it into a path so FixupArgPath()
+ # will know to Absolutify() it.
+ path = os.path.join('.', path)
+ return path
+
+
+ def _InstallableTargetInstallPath(self):
+ """Returns the location of the final output for an installable target."""
+ if self.type == 'shared_library':
+ # Install all shared libs into a common directory (per toolset) for
+ # convenient access with LD_LIBRARY_PATH.
+ return '$(builddir)/lib.%s/%s' % (self.toolset, self.alias)
+ return '$(builddir)/' + self.alias
+
+
+def WriteAutoRegenerationRule(params, root_makefile, makefile_name,
+ build_files):
+ """Write the target to regenerate the Makefile."""
+ options = params['options']
+ build_files_args = [gyp.common.RelativePath(filename, options.toplevel_dir)
+ for filename in params['build_files_arg']]
+ gyp_binary = gyp.common.FixIfRelativePath(params['gyp_binary'],
+ options.toplevel_dir)
+ if not gyp_binary.startswith(os.sep):
+ gyp_binary = os.path.join('.', gyp_binary)
+ root_makefile.write(
+ "quiet_cmd_regen_makefile = ACTION Regenerating $@\n"
+ "cmd_regen_makefile = %(cmd)s\n"
+ "%(makefile_name)s: %(deps)s\n"
+ "\t$(call do_cmd,regen_makefile)\n\n" % {
+ 'makefile_name': makefile_name,
+ 'deps': ' '.join(map(Sourceify, build_files)),
+ 'cmd': gyp.common.EncodePOSIXShellList(
+ [gyp_binary, '-fmake'] +
+ gyp.RegenerateFlags(options) +
+ build_files_args)})
+
+
+def RunSystemTests():
+ """Run tests against the system to compute default settings for commands.
+
+ Returns:
+ dictionary of settings matching the block of command-lines used in
+ SHARED_HEADER. E.g. the dictionary will contain a ARFLAGS.target
+ key for the default ARFLAGS for the target ar command.
+ """
+ # Compute flags used for building static archives.
+ # N.B.: this fallback logic should match the logic in SHARED_HEADER.
+ # See comment there for more details.
+ ar_target = os.environ.get('AR.target', os.environ.get('AR', 'ar'))
+ cc_target = os.environ.get('CC.target', os.environ.get('CC', 'cc'))
+ arflags_target = 'crs'
+ if gyp.system_test.TestArSupportsT(ar_command=ar_target,
+ cc_command=cc_target):
+ arflags_target = 'crsT'
+
+ ar_host = os.environ.get('AR.host', 'ar')
+ cc_host = os.environ.get('CC.host', 'gcc')
+ arflags_host = 'crs'
+ # It feels redundant to compute this again given that most builds aren't
+ # cross-compiles, but due to quirks of history CC.host defaults to 'gcc'
+ # while CC.target defaults to 'cc', so the commands really are different
+ # even though they're nearly guaranteed to run the same code underneath.
+ if gyp.system_test.TestArSupportsT(ar_command=ar_host, cc_command=cc_host):
+ arflags_host = 'crsT'
+
+ link_flags = ''
+ if gyp.system_test.TestLinkerSupportsThreads(cc_command=cc_target):
+ # N.B. we don't test for cross-compilation; as currently written, we
+ # don't even use flock when linking in the cross-compile setup!
+ # TODO(evan): refactor cross-compilation such that this code can
+ # be reused.
+ link_flags = '-Wl,--threads --Wl,--thread-count=4'
+
+ # TODO(evan): cache this output. (But then we'll need to add extra
+ # flags to gyp to flush the cache, yuk! It's fast enough for now to
+ # just run it every time.)
+
+ return { 'ARFLAGS.target': arflags_target,
+ 'ARFLAGS.host': arflags_host,
+ 'LINK_flags': link_flags }
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ options = params['options']
+ generator_flags = params.get('generator_flags', {})
+ builddir_name = generator_flags.get('output_dir', 'out')
+
+ def CalculateMakefilePath(build_file, base_name):
+ """Determine where to write a Makefile for a given gyp file."""
+ # Paths in gyp files are relative to the .gyp file, but we want
+ # paths relative to the source root for the master makefile. Grab
+ # the path of the .gyp file as the base to relativize against.
+ # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp".
+ base_path = gyp.common.RelativePath(os.path.dirname(build_file),
+ options.depth)
+ # We write the file in the base_path directory.
+ output_file = os.path.join(options.depth, base_path, base_name)
+ if options.generator_output:
+ output_file = os.path.join(options.generator_output, output_file)
+ base_path = gyp.common.RelativePath(os.path.dirname(build_file),
+ options.toplevel_dir)
+ return base_path, output_file
+
+ # TODO: search for the first non-'Default' target. This can go
+ # away when we add verification that all targets have the
+ # necessary configurations.
+ default_configuration = None
+ toolsets = set([target_dicts[target]['toolset'] for target in target_list])
+ for target in target_list:
+ spec = target_dicts[target]
+ if spec['default_configuration'] != 'Default':
+ default_configuration = spec['default_configuration']
+ break
+ if not default_configuration:
+ default_configuration = 'Default'
+
+ srcdir = '.'
+ makefile_name = 'Makefile' + options.suffix
+ makefile_path = os.path.join(options.toplevel_dir, makefile_name)
+ if options.generator_output:
+ global srcdir_prefix
+ makefile_path = os.path.join(options.generator_output, makefile_path)
+ srcdir = gyp.common.RelativePath(srcdir, options.generator_output)
+ srcdir_prefix = '$(srcdir)/'
+
+ header_params = {
+ 'srcdir': srcdir,
+ 'builddir': builddir_name,
+ 'default_configuration': default_configuration,
+ }
+ header_params.update(RunSystemTests())
+
+ ensure_directory_exists(makefile_path)
+ root_makefile = open(makefile_path, 'w')
+ root_makefile.write(SHARED_HEADER % header_params)
+ for toolset in toolsets:
+ root_makefile.write('TOOLSET := %s\n' % toolset)
+ root_makefile.write(ROOT_HEADER_SUFFIX_RULES)
+
+ # Find the list of targets that derive from the gyp file(s) being built.
+ needed_targets = set()
+ for build_file in params['build_files']:
+ for target in gyp.common.AllTargets(target_list, target_dicts, build_file):
+ needed_targets.add(target)
+
+ num_outputs = 0
+ build_files = set()
+ include_list = set()
+ for qualified_target in target_list:
+ build_file, target, toolset = gyp.common.ParseQualifiedTarget(
+ qualified_target)
+ build_files.add(gyp.common.RelativePath(build_file, options.toplevel_dir))
+ included_files = data[build_file]['included_files']
+ for included_file in included_files:
+ # The included_files entries are relative to the dir of the build file
+ # that included them, so we have to undo that and then make them relative
+ # to the root dir.
+ relative_include_file = gyp.common.RelativePath(
+ gyp.common.UnrelativePath(included_file, build_file),
+ options.toplevel_dir)
+ abs_include_file = os.path.abspath(relative_include_file)
+ # If the include file is from the ~/.gyp dir, we should use absolute path
+ # so that relocating the src dir doesn't break the path.
+ if (params['home_dot_gyp'] and
+ abs_include_file.startswith(params['home_dot_gyp'])):
+ build_files.add(abs_include_file)
+ else:
+ build_files.add(relative_include_file)
+
+ base_path, output_file = CalculateMakefilePath(build_file,
+ target + '.' + toolset + options.suffix + '.mk')
+
+ spec = target_dicts[qualified_target]
+ configs = spec['configurations']
+
+ writer = MakefileWriter()
+ writer.Write(qualified_target, base_path, output_file, spec, configs,
+ part_of_all=qualified_target in needed_targets)
+ num_outputs += writer.NumOutputs()
+
+ # Our root_makefile lives at the source root. Compute the relative path
+ # from there to the output_file for including.
+ mkfile_rel_path = gyp.common.RelativePath(output_file,
+ os.path.dirname(makefile_path))
+ include_list.add(mkfile_rel_path)
+
+ # Write out per-gyp (sub-project) Makefiles.
+ depth_rel_path = gyp.common.RelativePath(options.depth, os.getcwd())
+ for build_file in build_files:
+ # The paths in build_files were relativized above, so undo that before
+ # testing against the non-relativized items in target_list and before
+ # calculating the Makefile path.
+ build_file = os.path.join(depth_rel_path, build_file)
+ gyp_targets = [target_dicts[target]['target_name'] for target in target_list
+ if target.startswith(build_file) and
+ target in needed_targets]
+ # Only generate Makefiles for gyp files with targets.
+ if not gyp_targets:
+ continue
+ base_path, output_file = CalculateMakefilePath(build_file,
+ os.path.splitext(os.path.basename(build_file))[0] + '.Makefile')
+ makefile_rel_path = gyp.common.RelativePath(os.path.dirname(makefile_path),
+ os.path.dirname(output_file))
+ writer.WriteSubMake(output_file, makefile_rel_path, gyp_targets,
+ builddir_name)
+
+
+ # Write out the sorted list of includes.
+ root_makefile.write('\n')
+ for include_file in sorted(include_list):
+ # We wrap each .mk include in an if statement so users can tell make to
+ # not load a file by setting NO_LOAD. The below make code says, only
+ # load the .mk file if the .mk filename doesn't start with a token in
+ # NO_LOAD.
+ root_makefile.write(
+ "ifeq ($(strip $(foreach prefix,$(NO_LOAD),\\\n"
+ " $(findstring $(join ^,$(prefix)),\\\n"
+ " $(join ^," + include_file + ")))),)\n")
+ root_makefile.write(" include " + include_file + "\n")
+ root_makefile.write("endif\n")
+ root_makefile.write('\n')
+
+ if generator_flags.get('auto_regeneration', True):
+ WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files)
+
+ # Write the rule to load dependencies. We batch 1000 files at a time to
+ # avoid overflowing the command line.
+ all_deps = ""
+ for i in range(1001, num_outputs, 1000):
+ all_deps += ("""
+ ifneq ($(word %(start)d,$(d_files)),)
+ $(shell cat $(wordlist %(start)d,%(end)d,$(d_files)) >> $(depsdir)/all.deps)
+ endif""" % { 'start': i, 'end': i + 999 })
+
+ # Add a check to make sure we tried to process all the .d files.
+ all_deps += """
+ ifneq ($(word %(last)d,$(d_files)),)
+ $(error Found unprocessed dependency files (gyp didn't generate enough rules!))
+ endif
+""" % { 'last': ((num_outputs / 1000) + 1) * 1000 + 1 }
+
+ root_makefile.write(SHARED_FOOTER % { 'generate_all_deps': all_deps })
+
+ root_makefile.close()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/msvs.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/msvs.py
new file mode 100644
index 0000000..f7153e6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/msvs.py
@@ -0,0 +1,1541 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import ntpath
+import posixpath
+import os
+import re
+import subprocess
+import sys
+
+import gyp.MSVSNew as MSVSNew
+import gyp.MSVSProject as MSVSProject
+import gyp.MSVSToolFile as MSVSToolFile
+import gyp.MSVSUserFile as MSVSUserFile
+import gyp.MSVSVersion as MSVSVersion
+import gyp.MSVSSettings as MSVSSettings
+import gyp.common
+
+
+# Regular expression for validating Visual Studio GUIDs. If the GUID
+# contains lowercase hex letters, MSVS will be fine. However,
+# IncrediBuild BuildConsole will parse the solution file, but then
+# silently skip building the target causing hard to track down errors.
+# Note that this only happens with the BuildConsole, and does not occur
+# if IncrediBuild is executed from inside Visual Studio. This regex
+# validates that the string looks like a GUID with all uppercase hex
+# letters.
+VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$')
+
+
+generator_default_variables = {
+ 'EXECUTABLE_PREFIX': '',
+ 'EXECUTABLE_SUFFIX': '.exe',
+ 'STATIC_LIB_PREFIX': '',
+ 'SHARED_LIB_PREFIX': '',
+ 'STATIC_LIB_SUFFIX': '.lib',
+ 'SHARED_LIB_SUFFIX': '.dll',
+ 'INTERMEDIATE_DIR': '$(IntDir)',
+ 'SHARED_INTERMEDIATE_DIR': '$(OutDir)/obj/global_intermediate',
+ 'OS': 'win',
+ 'PRODUCT_DIR': '$(OutDir)',
+ 'LIB_DIR': '$(OutDir)/lib',
+ 'RULE_INPUT_ROOT': '$(InputName)',
+ 'RULE_INPUT_EXT': '$(InputExt)',
+ 'RULE_INPUT_NAME': '$(InputFileName)',
+ 'RULE_INPUT_PATH': '$(InputPath)',
+ 'CONFIGURATION_NAME': '$(ConfigurationName)',
+}
+
+
+# The msvs specific sections that hold paths
+generator_additional_path_sections = [
+ 'msvs_cygwin_dirs',
+ 'msvs_props',
+]
+
+generator_additional_non_configuration_keys = [
+ 'msvs_cygwin_dirs',
+ 'msvs_cygwin_shell',
+]
+
+# List of precompiled header related keys.
+precomp_keys = [
+ 'msvs_precompiled_header',
+ 'msvs_precompiled_source',
+]
+
+cached_username = None
+cached_domain = None
+
+# TODO(gspencer): Switch the os.environ calls to be
+# win32api.GetDomainName() and win32api.GetUserName() once the
+# python version in depot_tools has been updated to work on Vista
+# 64-bit.
+def _GetDomainAndUserName():
+ if sys.platform not in ('win32', 'cygwin'):
+ return ('DOMAIN', 'USERNAME')
+ global cached_username
+ global cached_domain
+ if not cached_domain or not cached_username:
+ domain = os.environ.get('USERDOMAIN')
+ username = os.environ.get('USERNAME')
+ if not domain or not username:
+ call = subprocess.Popen(['net', 'config', 'Workstation'],
+ stdout=subprocess.PIPE)
+ config = call.communicate()[0]
+ username_re = re.compile('^User name\s+(\S+)', re.MULTILINE)
+ username_match = username_re.search(config)
+ if username_match:
+ username = username_match.group(1)
+ domain_re = re.compile('^Logon domain\s+(\S+)', re.MULTILINE)
+ domain_match = domain_re.search(config)
+ if domain_match:
+ domain = domain_match.group(1)
+ cached_domain = domain
+ cached_username = username
+ return (cached_domain, cached_username)
+
+fixpath_prefix = None
+
+
+def _NormalizedSource(source):
+ """ Normalize the path.
+
+ But not if that gets rid of a variable, as this may expand to something
+ larger than one directory.
+ """
+ normalized = os.path.normpath(source)
+ if source.count('$') == normalized.count('$'):
+ source = normalized
+ return source
+
+
+def _FixPath(path):
+ """Convert paths to a form that will make sense in a vcproj file.
+
+ Arguments:
+ path: The path to convert, may contain / etc.
+ Returns:
+ The path with all slashes made into backslashes.
+ """
+ if fixpath_prefix and path and not os.path.isabs(path) and not path[0] == '$':
+ path = os.path.join(fixpath_prefix, path)
+ path = path.replace('/', '\\')
+ path = _NormalizedSource(path)
+ if len(path) > 0 and path[-1] == '\\':
+ path = path[:-1]
+ return path
+
+
+def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None):
+ """Converts a list split source file paths into a vcproj folder hierarchy.
+
+ Arguments:
+ sources: A list of source file paths split.
+ prefix: A list of source file path layers meant to apply to each of sources.
+ Returns:
+ A hierarchy of filenames and MSVSProject.Filter objects that matches the
+ layout of the source tree.
+ For example:
+ _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']],
+ prefix=['joe'])
+ -->
+ [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']),
+ MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])]
+ """
+ if not prefix: prefix = []
+ result = []
+ excluded_result = []
+ folders = dict()
+ # Gather files into the final result, excluded, or folders.
+ for s in sources:
+ if len(s) == 1:
+ filename = _NormalizedSource('\\'.join(prefix + s))
+ if filename in excluded:
+ excluded_result.append(filename)
+ else:
+ result.append(filename)
+ else:
+ if not folders.get(s[0]):
+ folders[s[0]] = []
+ folders[s[0]].append(s[1:])
+ # Add a folder for excluded files.
+ if excluded_result:
+ excluded_folder = MSVSProject.Filter('_excluded_files',
+ contents=excluded_result)
+ result.append(excluded_folder)
+ # Populate all the folders.
+ for f in folders:
+ contents = _ConvertSourcesToFilterHierarchy(folders[f], prefix=prefix + [f],
+ excluded=excluded)
+ contents = MSVSProject.Filter(f, contents=contents)
+ result.append(contents)
+
+ return result
+
+
+def _ToolAppend(tools, tool_name, setting, value, only_if_unset=False):
+ if not value: return
+ # TODO(bradnelson): ugly hack, fix this more generally!!!
+ if 'Directories' in setting or 'Dependencies' in setting:
+ if type(value) == str:
+ value = value.replace('/', '\\')
+ else:
+ value = [i.replace('/', '\\') for i in value]
+ if not tools.get(tool_name):
+ tools[tool_name] = dict()
+ tool = tools[tool_name]
+ if tool.get(setting):
+ if only_if_unset: return
+ if type(tool[setting]) == list:
+ tool[setting] += value
+ else:
+ raise TypeError(
+ 'Appending "%s" to a non-list setting "%s" for tool "%s" is '
+ 'not allowed, previous value: %s' % (
+ value, setting, tool_name, str(tool[setting])))
+ else:
+ tool[setting] = value
+
+
+def _ConfigPlatform(config_data):
+ return config_data.get('msvs_configuration_platform', 'Win32')
+
+
+def _ConfigBaseName(config_name, platform_name):
+ if config_name.endswith('_' + platform_name):
+ return config_name[0:-len(platform_name)-1]
+ else:
+ return config_name
+
+
+def _ConfigFullName(config_name, config_data):
+ platform_name = _ConfigPlatform(config_data)
+ return '%s|%s' % (_ConfigBaseName(config_name, platform_name), platform_name)
+
+
+def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
+ quote_cmd):
+ if cygwin_shell:
+ # Find path to cygwin.
+ cygwin_dir = _FixPath(spec.get('msvs_cygwin_dirs', ['.'])[0])
+ # Prepare command.
+ direct_cmd = cmd
+ direct_cmd = [i.replace('$(IntDir)',
+ '`cygpath -m "${INTDIR}"`') for i in direct_cmd]
+ direct_cmd = [i.replace('$(OutDir)',
+ '`cygpath -m "${OUTDIR}"`') for i in direct_cmd]
+ if has_input_path:
+ direct_cmd = [i.replace('$(InputPath)',
+ '`cygpath -m "${INPUTPATH}"`')
+ for i in direct_cmd]
+ direct_cmd = ['"%s"' % i for i in direct_cmd]
+ direct_cmd = [i.replace('"', '\\"') for i in direct_cmd]
+ #direct_cmd = gyp.common.EncodePOSIXShellList(direct_cmd)
+ direct_cmd = ' '.join(direct_cmd)
+ # TODO(quote): regularize quoting path names throughout the module
+ cmd = (
+ 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && '
+ 'set CYGWIN=nontsec&& ')
+ if direct_cmd.find('NUMBER_OF_PROCESSORS') >= 0:
+ cmd += 'set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& '
+ if direct_cmd.find('INTDIR') >= 0:
+ cmd += 'set INTDIR=$(IntDir)&& '
+ if direct_cmd.find('OUTDIR') >= 0:
+ cmd += 'set OUTDIR=$(OutDir)&& '
+ if has_input_path and direct_cmd.find('INPUTPATH') >= 0:
+ cmd += 'set INPUTPATH=$(InputPath) && '
+ cmd += (
+ 'bash -c "%(cmd)s"')
+ cmd = cmd % {'cygwin_dir': cygwin_dir,
+ 'cmd': direct_cmd}
+ return cmd
+ else:
+ # Convert cat --> type to mimic unix.
+ if cmd[0] == 'cat':
+ command = ['type']
+ else:
+ command = [cmd[0].replace('/', '\\')]
+ # Fix the paths
+ # If the argument starts with a slash, it's probably a command line switch
+ arguments = [i.startswith('/') and i or _FixPath(i) for i in cmd[1:]]
+ if quote_cmd:
+ # Support a mode for using cmd directly.
+ # Convert any paths to native form (first element is used directly).
+ # TODO(quote): regularize quoting path names throughout the module
+ arguments = ['"%s"' % i for i in arguments]
+ # Collapse into a single command.
+ return ' '.join(command + arguments)
+
+
+def _BuildCommandLineForRule(spec, rule, has_input_path):
+ # Find path to cygwin.
+ cygwin_dir = _FixPath(spec.get('msvs_cygwin_dirs', ['.'])[0])
+
+ # Currently this weird argument munging is used to duplicate the way a
+ # python script would need to be run as part of the chrome tree.
+ # Eventually we should add some sort of rule_default option to set this
+ # per project. For now the behavior chrome needs is the default.
+ mcs = rule.get('msvs_cygwin_shell')
+ if mcs is None:
+ mcs = int(spec.get('msvs_cygwin_shell', 1))
+ elif isinstance(mcs, str):
+ mcs = int(mcs)
+ quote_cmd = int(rule.get('msvs_quote_cmd', 1))
+ return _BuildCommandLineForRuleRaw(spec, rule['action'], mcs, has_input_path,
+ quote_cmd)
+
+
+def _AddActionStep(actions_dict, inputs, outputs, description, command):
+ """Merge action into an existing list of actions.
+
+ Care must be taken so that actions which have overlapping inputs either don't
+ get assigned to the same input, or get collapsed into one.
+
+ Arguments:
+ actions_dict: dictionary keyed on input name, which maps to a list of
+ dicts describing the actions attached to that input file.
+ inputs: list of inputs
+ outputs: list of outputs
+ description: description of the action
+ command: command line to execute
+ """
+ # Require there to be at least one input (call sites will ensure this).
+ assert inputs
+
+ action = {
+ 'inputs': inputs,
+ 'outputs': outputs,
+ 'description': description,
+ 'command': command,
+ }
+
+ # Pick where to stick this action.
+ # While less than optimal in terms of build time, attach them to the first
+ # input for now.
+ chosen_input = inputs[0]
+
+ # Add it there.
+ if chosen_input not in actions_dict:
+ actions_dict[chosen_input] = []
+ actions_dict[chosen_input].append(action)
+
+
+def _AddCustomBuildToolForMSVS(p, spec, primary_input,
+ inputs, outputs, description, cmd):
+ """Add a custom build tool to execute something.
+
+ Arguments:
+ p: the target project
+ spec: the target project dict
+ primary_input: input file to attach the build tool to
+ inputs: list of inputs
+ outputs: list of outputs
+ description: description of the action
+ cmd: command line to execute
+ """
+ inputs = [_FixPath(i) for i in inputs]
+ outputs = [_FixPath(i) for i in outputs]
+ tool = MSVSProject.Tool(
+ 'VCCustomBuildTool', {
+ 'Description': description,
+ 'AdditionalDependencies': ';'.join(inputs),
+ 'Outputs': ';'.join(outputs),
+ 'CommandLine': cmd,
+ })
+ # Add to the properties of primary input for each config.
+ for config_name, c_data in spec['configurations'].iteritems():
+ p.AddFileConfig(_FixPath(primary_input),
+ _ConfigFullName(config_name, c_data), tools=[tool])
+
+
+def _AddAccumulatedActionsToMSVS(p, spec, actions_dict):
+ """Add actions accumulated into an actions_dict, merging as needed.
+
+ Arguments:
+ p: the target project
+ spec: the target project dict
+ actions_dict: dictionary keyed on input name, which maps to a list of
+ dicts describing the actions attached to that input file.
+ """
+ for input in actions_dict:
+ inputs = set()
+ outputs = set()
+ descriptions = []
+ commands = []
+ for action in actions_dict[input]:
+ inputs.update(set(action['inputs']))
+ outputs.update(set(action['outputs']))
+ descriptions.append(action['description'])
+ commands.append(action['command'])
+ # Add the custom build step for one input file.
+ description = ', and also '.join(descriptions)
+ command = '\r\n'.join(commands)
+ _AddCustomBuildToolForMSVS(p, spec,
+ primary_input=input,
+ inputs=inputs,
+ outputs=outputs,
+ description=description,
+ cmd=command)
+
+
+def _RuleExpandPath(path, input_file):
+ """Given the input file to which a rule applied, string substitute a path.
+
+ Arguments:
+ path: a path to string expand
+ input_file: the file to which the rule applied.
+ Returns:
+ The string substituted path.
+ """
+ path = path.replace('$(InputName)',
+ os.path.splitext(os.path.split(input_file)[1])[0])
+ path = path.replace('$(InputExt)',
+ os.path.splitext(os.path.split(input_file)[1])[1])
+ path = path.replace('$(InputFileName)', os.path.split(input_file)[1])
+ path = path.replace('$(InputPath)', input_file)
+ return path
+
+
+def _FindRuleTriggerFiles(rule, sources):
+ """Find the list of files which a particular rule applies to.
+
+ Arguments:
+ rule: the rule in question
+ sources: the set of all known source files for this project
+ Returns:
+ The list of sources that trigger a particular rule.
+ """
+ rule_ext = rule['extension']
+ return [s for s in sources if s.endswith('.' + rule_ext)]
+
+
+def _RuleInputsAndOutputs(rule, trigger_file):
+ """Find the inputs and outputs generated by a rule.
+
+ Arguments:
+ rule: the rule in question
+ sources: the set of all known source files for this project
+ Returns:
+ The pair of (inputs, outputs) involved in this rule.
+ """
+ raw_inputs = [_FixPath(i) for i in rule.get('inputs', [])]
+ raw_outputs = [_FixPath(i) for i in rule.get('outputs', [])]
+ inputs = set()
+ outputs = set()
+ inputs.add(trigger_file)
+ for i in raw_inputs:
+ inputs.add(_RuleExpandPath(i, trigger_file))
+ for o in raw_outputs:
+ outputs.add(_RuleExpandPath(o, trigger_file))
+ return (inputs, outputs)
+
+
+def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options):
+ """Generate a native rules file.
+
+ Arguments:
+ p: the target project
+ rules: the set of rules to include
+ output_dir: the directory in which the project/gyp resides
+ spec: the project dict
+ options: global generator options
+ """
+ rules_filename = '%s%s.rules' % (spec['target_name'],
+ options.suffix)
+ rules_file = MSVSToolFile.Writer(os.path.join(output_dir, rules_filename))
+ rules_file.Create(spec['target_name'])
+ # Add each rule.
+ for r in rules:
+ rule_name = r['rule_name']
+ rule_ext = r['extension']
+ inputs = [_FixPath(i) for i in r.get('inputs', [])]
+ outputs = [_FixPath(i) for i in r.get('outputs', [])]
+ cmd = _BuildCommandLineForRule(spec, r, has_input_path=True)
+ rules_file.AddCustomBuildRule(name=rule_name,
+ description=r.get('message', rule_name),
+ extensions=[rule_ext],
+ additional_dependencies=inputs,
+ outputs=outputs,
+ cmd=cmd)
+ # Write out rules file.
+ rules_file.Write()
+
+ # Add rules file to project.
+ p.AddToolFile(rules_filename)
+
+
+def _Cygwinify(path):
+ path = path.replace('$(OutDir)', '$(OutDirCygwin)')
+ path = path.replace('$(IntDir)', '$(IntDirCygwin)')
+ return path
+
+
+def _GenerateExternalRules(rules, output_dir, spec,
+ sources, options, actions_to_add):
+ """Generate an external makefile to do a set of rules.
+
+ Arguments:
+ rules: the list of rules to include
+ output_dir: path containing project and gyp files
+ spec: project specification data
+ sources: set of sources known
+ options: global generator options
+ """
+ filename = '%s_rules%s.mk' % (spec['target_name'], options.suffix)
+ file = gyp.common.WriteOnDiff(os.path.join(output_dir, filename))
+ # Find cygwin style versions of some paths.
+ file.write('OutDirCygwin:=$(shell cygpath -u "$(OutDir)")\n')
+ file.write('IntDirCygwin:=$(shell cygpath -u "$(IntDir)")\n')
+ # Gather stuff needed to emit all: target.
+ all_inputs = set()
+ all_outputs = set()
+ all_output_dirs = set()
+ first_outputs = []
+ for rule in rules:
+ trigger_files = _FindRuleTriggerFiles(rule, sources)
+ for tf in trigger_files:
+ inputs, outputs = _RuleInputsAndOutputs(rule, tf)
+ all_inputs.update(set(inputs))
+ all_outputs.update(set(outputs))
+ # Only use one target from each rule as the dependency for
+ # 'all' so we don't try to build each rule multiple times.
+ first_outputs.append(list(outputs)[0])
+ # Get the unique output directories for this rule.
+ output_dirs = [os.path.split(i)[0] for i in outputs]
+ for od in output_dirs:
+ all_output_dirs.add(od)
+ first_outputs_cyg = [_Cygwinify(i) for i in first_outputs]
+ # Write out all: target, including mkdir for each output directory.
+ file.write('all: %s\n' % ' '.join(first_outputs_cyg))
+ for od in all_output_dirs:
+ file.write('\tmkdir -p %s\n' % od)
+ file.write('\n')
+ # Define how each output is generated.
+ for rule in rules:
+ trigger_files = _FindRuleTriggerFiles(rule, sources)
+ for tf in trigger_files:
+ # Get all the inputs and outputs for this rule for this trigger file.
+ inputs, outputs = _RuleInputsAndOutputs(rule, tf)
+ inputs = [_Cygwinify(i) for i in inputs]
+ outputs = [_Cygwinify(i) for i in outputs]
+ # Prepare the command line for this rule.
+ cmd = [_RuleExpandPath(c, tf) for c in rule['action']]
+ cmd = ['"%s"' % i for i in cmd]
+ cmd = ' '.join(cmd)
+ # Add it to the makefile.
+ file.write('%s: %s\n' % (' '.join(outputs), ' '.join(inputs)))
+ file.write('\t%s\n\n' % cmd)
+ # Close up the file.
+ file.close()
+
+ # Add makefile to list of sources.
+ sources.add(filename)
+ # Add a build action to call makefile.
+ cmd = ['make',
+ 'OutDir=$(OutDir)',
+ 'IntDir=$(IntDir)',
+ '-j', '${NUMBER_OF_PROCESSORS_PLUS_1}',
+ '-f', filename]
+ cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True)
+ # Insert makefile as 0'th input, so it gets the action attached there,
+ # as this is easier to understand from in the IDE.
+ all_inputs = list(all_inputs)
+ all_inputs.insert(0, filename)
+ _AddActionStep(actions_to_add,
+ inputs=[_FixPath(i) for i in all_inputs],
+ outputs=[_FixPath(i) for i in all_outputs],
+ description='Running %s' % cmd,
+ command=cmd)
+
+
+def _EscapeEnvironmentVariableExpansion(s):
+ """Escapes any % characters so that Windows-style environment variable
+ expansions will leave them alone.
+ See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile
+ to understand why we have to do this."""
+ s = s.replace('%', '%%')
+ return s
+
+
+quote_replacer_regex = re.compile(r'(\\*)"')
+def _EscapeCommandLineArgumentForMSVS(s):
+ """Escapes a Windows command-line argument, so that the Win32
+ CommandLineToArgv function will turn the escaped result back into the
+ original string. See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
+ ("Parsing C++ Command-Line Arguments") to understand why we have to do
+ this."""
+ def replace(match):
+ # For a literal quote, CommandLineToArgv requires an odd number of
+ # backslashes preceding it, and it produces half as many literal backslashes
+ # (rounded down). So we need to produce 2n+1 backslashes.
+ return 2 * match.group(1) + '\\"'
+ # Escape all quotes so that they are interpreted literally.
+ s = quote_replacer_regex.sub(replace, s)
+ # Now add unescaped quotes so that any whitespace is interpreted literally.
+ s = '"' + s + '"'
+ return s
+
+
+delimiters_replacer_regex = re.compile(r'(\\*)([,;]+)')
+def _EscapeVCProjCommandLineArgListItem(s):
+ """The VCProj format stores string lists in a single string using commas and
+ semi-colons as separators, which must be quoted if they are to be
+ interpreted literally. However, command-line arguments may already have
+ quotes, and the VCProj parser is ignorant of the backslash escaping
+ convention used by CommandLineToArgv, so the command-line quotes and the
+ VCProj quotes may not be the same quotes. So to store a general
+ command-line argument in a VCProj list, we need to parse the existing
+ quoting according to VCProj's convention and quote any delimiters that are
+ not already quoted by that convention. The quotes that we add will also be
+ seen by CommandLineToArgv, so if backslashes precede them then we also have
+ to escape those backslashes according to the CommandLineToArgv
+ convention."""
+ def replace(match):
+ # For a non-literal quote, CommandLineToArgv requires an even number of
+ # backslashes preceding it, and it produces half as many literal
+ # backslashes. So we need to produce 2n backslashes.
+ return 2 * match.group(1) + '"' + match.group(2) + '"'
+ list = s.split('"')
+ # The unquoted segments are at the even-numbered indices.
+ for i in range(0, len(list), 2):
+ list[i] = delimiters_replacer_regex.sub(replace, list[i])
+ # Concatenate back into a single string
+ s = '"'.join(list)
+ if len(list) % 2 == 0:
+ # String ends while still quoted according to VCProj's convention. This
+ # means the delimiter and the next list item that follow this one in the
+ # .vcproj file will be misinterpreted as part of this item. There is nothing
+ # we can do about this. Adding an extra quote would correct the problem in
+ # the VCProj but cause the same problem on the final command-line. Moving
+ # the item to the end of the list does works, but that's only possible if
+ # there's only one such item. Let's just warn the user.
+ print >> sys.stderr, ('Warning: MSVS may misinterpret the odd number of ' +
+ 'quotes in ' + s)
+ return s
+
+
+def _EscapeCppDefineForMSVS(s):
+ """Escapes a CPP define so that it will reach the compiler unaltered."""
+ s = _EscapeEnvironmentVariableExpansion(s)
+ s = _EscapeCommandLineArgumentForMSVS(s)
+ s = _EscapeVCProjCommandLineArgListItem(s)
+ return s
+
+
+def _GenerateRulesForMSVS(p, output_dir, options, spec,
+ sources, excluded_sources,
+ actions_to_add):
+ """Generate all the rules for a particular project.
+
+ Arguments:
+ output_dir: directory to emit rules to
+ options: global options passed to the generator
+ spec: the specification for this project
+ sources: the set of all known source files in this project
+ excluded_sources: the set of sources excluded from normal processing
+ actions_to_add: deferred list of actions to add in
+ """
+ rules = spec.get('rules', [])
+ rules_native = [r for r in rules if not int(r.get('msvs_external_rule', 0))]
+ rules_external = [r for r in rules if int(r.get('msvs_external_rule', 0))]
+
+ # Handle rules that use a native rules file.
+ if rules_native:
+ _GenerateNativeRulesForMSVS(p, rules_native, output_dir, spec, options)
+
+ # Handle external rules (non-native rules).
+ if rules_external:
+ _GenerateExternalRules(rules_external, output_dir, spec,
+ sources, options, actions_to_add)
+ _AdjustSourcesForRules(rules, sources, excluded_sources)
+
+
+def _AdjustSourcesForRules(rules, sources, excluded_sources):
+ # Add outputs generated by each rule (if applicable).
+ for rule in rules:
+ # Done if not processing outputs as sources.
+ if int(rule.get('process_outputs_as_sources', False)):
+ # Add in the outputs from this rule.
+ trigger_files = _FindRuleTriggerFiles(rule, sources)
+ for trigger_file in trigger_files:
+ inputs, outputs = _RuleInputsAndOutputs(rule, trigger_file)
+ inputs = set([_FixPath(i) for i in inputs])
+ outputs = set([_FixPath(i) for i in outputs])
+ inputs.remove(_FixPath(trigger_file))
+ sources.update(inputs)
+ excluded_sources.update(inputs)
+ sources.update(outputs)
+
+
+def _FilterActionsFromExcluded(excluded_sources, actions_to_add):
+ """Take inputs with actions attached out of the list of exclusions.
+
+ Arguments:
+ excluded_sources: list of source files not to be built.
+ actions_to_add: dict of actions keyed on source file they're attached to.
+ Returns:
+ excluded_sources with files that have actions attached removed.
+ """
+ must_keep = set([_FixPath(s) for s in actions_to_add.keys()])
+ return [s for s in excluded_sources if s not in must_keep]
+
+
+def _GetDefaultConfiguration(spec):
+ return spec['configurations'][spec['default_configuration']]
+
+
+def _GetGuidOfProject(proj_path, spec):
+ """Get the guid for the project
+
+ Arguments:
+ proj_path: Path of the vcproj file to generate.
+ spec: The target dictionary containing the properties of the target.
+ """
+ # Pluck out the default configuration.
+ default_config = _GetDefaultConfiguration(spec)
+ # Decide the guid of the project.
+ guid = default_config.get('msvs_guid')
+ if guid:
+ if VALID_MSVS_GUID_CHARS.match(guid) == None:
+ raise ValueError('Invalid MSVS guid: "%s". Must match regex: "%s".' %
+ (guid, VALID_MSVS_GUID_CHARS.pattern))
+ guid = '{%s}' % guid
+ guid = guid or MSVSNew.MakeGuid(proj_path)
+ return guid
+
+
+def _GenerateProject(project, options, version):
+ """Generates a vcproj file.
+
+ Arguments:
+ project: the MSVSProject object.
+ options: global generator options.
+ version: the MSVSVersion object.
+"""
+ default_config = _GetDefaultConfiguration(project.spec)
+
+ # Skip emitting anything if told to with msvs_existing_vcproj option.
+ if default_config.get('msvs_existing_vcproj'):
+ return
+
+ _GenerateMSVSProject(project, options, version)
+
+
+def _GenerateMSVSProject(project, options, version):
+ """Generates a .vcproj file. It may create .rules and .user files too.
+
+ Arguments:
+ project: The project object we will generate the file for.
+ options: Global options passed to the generator.
+ version: The VisualStudioVersion object.
+ """
+ spec = project.spec
+ vcproj_dir = os.path.dirname(project.path)
+ if vcproj_dir and not os.path.exists(vcproj_dir):
+ os.makedirs(vcproj_dir)
+
+ platforms = _GetUniquePlatforms(spec)
+ p = MSVSProject.Writer(project.path, version=version)
+ p.Create(spec['target_name'], guid=project.guid, platforms=platforms)
+
+ # Get directory project file is in.
+ gyp_dir = os.path.split(project.path)[0]
+ gyp_file = posixpath.split(project.build_file)[1]
+ gyp_path = _NormalizedSource(gyp_file)
+ relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, gyp_dir)
+
+ config_type = _GetMSVSConfigurationType(spec, project.build_file)
+ for config_name, config in spec['configurations'].iteritems():
+ _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config)
+
+ # Prepare list of sources and excluded sources.
+ sources, excluded_sources = _PrepareListOfSources(project, spec,
+ relative_path_of_gyp_file)
+
+ # Add rules.
+ actions_to_add = {}
+ _GenerateRulesForMSVS(p, gyp_dir, options, spec,
+ sources, excluded_sources,
+ actions_to_add)
+ sources, excluded_sources, excluded_idl = (
+ _AdjustSourcesAndConvertToFilterHierarchy(
+ spec, options, gyp_dir, sources, excluded_sources))
+
+ # Add in files.
+ p.AddFiles(sources)
+
+ _AddToolFilesToMSVS(p, spec)
+ _HandlePreCompileHeaderStubs(p, spec)
+ _AddActions(actions_to_add, spec, relative_path_of_gyp_file)
+ _AddCopies(actions_to_add, spec)
+ _WriteMSVSUserFile(project.path, version, spec)
+
+ # NOTE: this stanza must appear after all actions have been decided.
+ # Don't excluded sources with actions attached, or they won't run.
+ excluded_sources = _FilterActionsFromExcluded(
+ excluded_sources, actions_to_add)
+ _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl)
+ _AddAccumulatedActionsToMSVS(p, spec, actions_to_add)
+
+ # Write it out.
+ p.Write()
+
+
+def _GetUniquePlatforms(spec):
+ """Return the list of unique platforms for this spec, e.g ['win32', ...]
+
+ Arguments:
+ spec: The target dictionary containing the properties of the target.
+ Returns:
+ The MSVSUserFile object created.
+ """
+ # Gather list of unique platforms.
+ platforms = set()
+ for configuration in spec['configurations']:
+ platforms.add(_ConfigPlatform(spec['configurations'][configuration]))
+ platforms = list(platforms)
+ return platforms
+
+
+def _CreateMSVSUserFile(proj_path, version, spec):
+ """Generates a .user file for the user running this Gyp program.
+
+ Arguments:
+ proj_path: The path of the project file being created. The .user file
+ shares the same path (with an appropriate suffix).
+ version: The VisualStudioVersion object.
+ spec: The target dictionary containing the properties of the target.
+ Returns:
+ The MSVSUserFile object created.
+ """
+ (domain, username) = _GetDomainAndUserName()
+ vcuser_filename = '.'.join([proj_path, domain, username, 'user'])
+ user_file = MSVSUserFile.Writer(vcuser_filename, version=version)
+ user_file.Create(spec['target_name'])
+ return user_file
+
+
+def _GetMSVSConfigurationType(spec, build_file):
+ """Returns the configuration type for this project. It's a number defined
+ by Microsoft. May raise an exception.
+ Returns:
+ An integer, the configuration type.
+ """
+ try:
+ config_type = {
+ 'executable': '1', # .exe
+ 'shared_library': '2', # .dll
+ 'loadable_module': '2', # .dll
+ 'static_library': '4', # .lib
+ 'none': '10', # Utility type
+ 'dummy_executable': '1', # .exe
+ }[spec['type']]
+ except KeyError, e:
+ if spec.get('type'):
+ raise Exception('Target type %s is not a valid target type for '
+ 'target %s in %s.' %
+ (spec['type'], spec['target_name'], build_file))
+ else:
+ raise Exception('Missing type field for target %s in %s.' %
+ (spec['target_name'], build_file))
+ return config_type
+
+
+def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config):
+ """Many settings in a vcproj file are specific to a configuration. This
+ function the main part of the vcproj file that's configuration specific.
+
+ Arguments:
+ p: The target project being generated.
+ spec: The target dictionary containing the properties of the target.
+ config_type: The configuration type, a number as defined by Microsoft.
+ config_name: The name of the configuration.
+ config: The dictionnary that defines the special processing to be done
+ for this configuration.
+ """
+ # Get the information for this configuration
+ include_dirs, resource_include_dirs = _GetIncludeDirs(config)
+ libraries = _GetLibraries(config, spec)
+ out_file, vc_tool = _GetOutputFilePathAndTool(spec)
+ defines = _GetDefines(config)
+ defines = [_EscapeCppDefineForMSVS(d) for d in defines]
+ disabled_warnings = _GetDisabledWarnings(config)
+ prebuild = config.get('msvs_prebuild')
+ postbuild = config.get('msvs_postbuild')
+ def_file = _GetModuleDefinition(spec)
+ precompiled_header = config.get('msvs_precompiled_header')
+
+ # Prepare the list of tools as a dictionary.
+ tools = dict()
+ # Add in user specified msvs_settings.
+ msvs_settings = config.get('msvs_settings', {})
+ MSVSSettings.ValidateMSVSSettings(msvs_settings)
+ for tool in msvs_settings:
+ settings = config['msvs_settings'][tool]
+ for setting in settings:
+ _ToolAppend(tools, tool, setting, settings[setting])
+ # Add the information to the appropriate tool
+ _ToolAppend(tools, 'VCCLCompilerTool',
+ 'AdditionalIncludeDirectories', include_dirs)
+ _ToolAppend(tools, 'VCResourceCompilerTool',
+ 'AdditionalIncludeDirectories', resource_include_dirs)
+ # Add in libraries.
+ _ToolAppend(tools, 'VCLinkerTool', 'AdditionalDependencies', libraries)
+ if out_file:
+ _ToolAppend(tools, vc_tool, 'OutputFile', out_file, only_if_unset=True)
+ # Add defines.
+ _ToolAppend(tools, 'VCCLCompilerTool', 'PreprocessorDefinitions', defines)
+ _ToolAppend(tools, 'VCResourceCompilerTool', 'PreprocessorDefinitions',
+ defines)
+ # Change program database directory to prevent collisions.
+ _ToolAppend(tools, 'VCCLCompilerTool', 'ProgramDataBaseFileName',
+ '$(IntDir)\\$(ProjectName)\\vc80.pdb')
+ # Add disabled warnings.
+ _ToolAppend(tools, 'VCCLCompilerTool',
+ 'DisableSpecificWarnings', disabled_warnings)
+ # Add Pre-build.
+ _ToolAppend(tools, 'VCPreBuildEventTool', 'CommandLine', prebuild)
+ # Add Post-build.
+ _ToolAppend(tools, 'VCPostBuildEventTool', 'CommandLine', postbuild)
+ # Turn on precompiled headers if appropriate.
+ if precompiled_header:
+ precompiled_header = os.path.split(precompiled_header)[1]
+ _ToolAppend(tools, 'VCCLCompilerTool', 'UsePrecompiledHeader', '2')
+ _ToolAppend(tools, 'VCCLCompilerTool',
+ 'PrecompiledHeaderThrough', precompiled_header)
+ _ToolAppend(tools, 'VCCLCompilerTool',
+ 'ForcedIncludeFiles', precompiled_header)
+ # Loadable modules don't generate import libraries;
+ # tell dependent projects to not expect one.
+ if spec['type'] == 'loadable_module':
+ _ToolAppend(tools, 'VCLinkerTool', 'IgnoreImportLibrary', 'true')
+ # Set the module definition file if any.
+ if def_file:
+ _ToolAppend(tools, 'VCLinkerTool', 'ModuleDefinitionFile', def_file)
+
+ _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name)
+
+
+def _GetIncludeDirs(config):
+ """Returns the list of directories to be used for #include directives.
+
+ Arguments:
+ config: The dictionnary that defines the special processing to be done
+ for this configuration.
+ Returns:
+ The list of directory paths.
+ """
+ # TODO(bradnelson): include_dirs should really be flexible enough not to
+ # require this sort of thing.
+ include_dirs = (
+ config.get('include_dirs', []) +
+ config.get('msvs_system_include_dirs', []))
+ resource_include_dirs = config.get('resource_include_dirs', include_dirs)
+ include_dirs = [_FixPath(i) for i in include_dirs]
+ resource_include_dirs = [_FixPath(i) for i in resource_include_dirs]
+ return include_dirs, resource_include_dirs
+
+
+def _GetLibraries(config, spec):
+ """Returns the list of libraries for this configuration.
+
+ Arguments:
+ config: The dictionnary that defines the special processing to be done
+ for this configuration.
+ spec: The target dictionary containing the properties of the target.
+ Returns:
+ The list of directory paths.
+ """
+ libraries = spec.get('libraries', [])
+ # Strip out -l, as it is not used on windows (but is needed so we can pass
+ # in libraries that are assumed to be in the default library path).
+ return [re.sub('^(\-l)', '', lib) for lib in libraries]
+
+
+def _GetOutputFilePathAndTool(spec):
+ """Figures out the path of the file this spec will create and the name of
+ the VC tool that will create it.
+
+ Arguments:
+ spec: The target dictionary containing the properties of the target.
+ Returns:
+ A pair of (file path, name of the tool)
+ """
+ # Select a name for the output file.
+ out_file = ''
+ vc_tool = ''
+ output_file_map = {
+ 'executable': ('VCLinkerTool', '$(OutDir)\\', '.exe'),
+ 'shared_library': ('VCLinkerTool', '$(OutDir)\\', '.dll'),
+ 'loadable_module': ('VCLinkerTool', '$(OutDir)\\', '.dll'),
+ 'static_library': ('VCLibrarianTool', '$(OutDir)\\lib\\', '.lib'),
+ 'dummy_executable': ('VCLinkerTool', '$(IntDir)\\', '.junk'),
+ }
+ output_file_props = output_file_map.get(spec['type'])
+ if output_file_props and int(spec.get('msvs_auto_output_file', 1)):
+ vc_tool, out_dir, suffix = output_file_props
+ out_dir = spec.get('product_dir', out_dir)
+ product_extension = spec.get('product_extension')
+ if product_extension:
+ suffix = '.' + product_extension
+ prefix = spec.get('product_prefix', '')
+ product_name = spec.get('product_name', '$(ProjectName)')
+ out_file = ntpath.join(out_dir, prefix + product_name + suffix)
+ return out_file, vc_tool
+
+
+def _GetDefines(config):
+ """Returns the list of preprocessor definitions for this configuation.
+
+ Arguments:
+ config: The dictionnary that defines the special processing to be done
+ for this configuration.
+ Returns:
+ The list of preprocessor definitions.
+ """
+ defines = []
+ for d in config.get('defines', []):
+ if type(d) == list:
+ fd = '='.join([str(dpart) for dpart in d])
+ else:
+ fd = str(d)
+ defines.append(fd)
+ return defines
+
+
+def _GetDisabledWarnings(config):
+ return [str(i) for i in config.get('msvs_disabled_warnings', [])]
+
+
+def _GetModuleDefinition(spec):
+ def_file = ""
+ if spec['type'] in ['shared_library', 'loadable_module']:
+ def_files = [s for s in spec.get('sources', []) if s.endswith('.def')]
+ if len(def_files) == 1:
+ def_file = _FixPath(def_files[0])
+ elif def_files:
+ raise ValueError('Multiple module definition files in one target, '
+ 'target %s lists multiple .def files: %s' % (
+ spec['target_name'], ' '.join(def_files)))
+ return def_file
+
+
+def _ConvertToolsToExpectedForm(tools):
+ """ Convert the content of the tools array to a form expected by
+ VisualStudio.
+
+ Arguments:
+ tools: A dictionnary of settings; the tool name is the key.
+ Returns:
+ A list of Tool objects.
+ """
+ tool_list = []
+ for tool, settings in tools.iteritems():
+ # Collapse settings with lists.
+ settings_fixed = {}
+ for setting, value in settings.iteritems():
+ if type(value) == list:
+ if ((tool == 'VCLinkerTool' and
+ setting == 'AdditionalDependencies') or
+ setting == 'AdditionalOptions'):
+ settings_fixed[setting] = ' '.join(value)
+ else:
+ settings_fixed[setting] = ';'.join(value)
+ else:
+ settings_fixed[setting] = value
+ # Add in this tool.
+ tool_list.append(MSVSProject.Tool(tool, settings_fixed))
+ return tool_list
+
+
+def _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name):
+ """Add to the project file the configuration specified by config.
+
+ Arguments:
+ p: The target project being generated.
+ spec: the target project dict.
+ tools: A dictionnary of settings; the tool name is the key.
+ config: The dictionnary that defines the special processing to be done
+ for this configuration.
+ config_type: The configuration type, a number as defined by Microsoft.
+ config_name: The name of the configuration.
+ """
+ attributes = _GetMSVSAttributes(spec, config, config_type)
+ # Add in this configuration.
+ tool_list = _ConvertToolsToExpectedForm(tools)
+ p.AddConfig(_ConfigFullName(config_name, config),
+ attrs=attributes, tools=tool_list)
+
+def _GetMSVSAttributes(spec, config, config_type):
+ # Prepare configuration attributes.
+ prepared_attrs = {}
+ source_attrs = config.get('msvs_configuration_attributes', {})
+ for a in source_attrs:
+ prepared_attrs[a] = source_attrs[a]
+ # Add props files.
+ vsprops_dirs = config.get('msvs_props', [])
+ vsprops_dirs = [_FixPath(i) for i in vsprops_dirs]
+ if vsprops_dirs:
+ prepared_attrs['InheritedPropertySheets'] = ';'.join(vsprops_dirs)
+ # Set configuration type.
+ prepared_attrs['ConfigurationType'] = config_type
+ if not prepared_attrs.has_key('OutputDirectory'):
+ prepared_attrs['OutputDirectory'] = '$(SolutionDir)$(ConfigurationName)'
+ if not prepared_attrs.has_key('IntermediateDirectory'):
+ intermediate = '$(ConfigurationName)\\obj\\$(ProjectName)'
+ prepared_attrs['IntermediateDirectory'] = intermediate
+ return prepared_attrs
+
+def _AddNormalizedSources(sources_set, sources_array):
+ sources = [_NormalizedSource(s) for s in sources_array]
+ sources_set.update(set(sources))
+
+def _PrepareListOfSources(project, spec, relative_path_of_gyp_file):
+ """Prepare list of sources and excluded sources.
+
+ Besides the sources specified directly in the spec, adds the gyp file so
+ that a change to it will cause a re-compile. Also adds appropriate sources
+ for actions and copies. Assumes later stage will un-exclude files which
+ have custom build steps attached.
+
+ Arguments:
+ project: the MSVSProject object.
+ spec: The target dictionary containing the properties of the target.
+ relative_path_of_gyp_file: The relative path of the gyp file.
+ Returns:
+ A pair of (list of sources, list of excluded sources)
+ """
+ sources = set()
+ _AddNormalizedSources(sources, spec.get('sources', []))
+ excluded_sources = set()
+ # Add in the gyp file.
+ sources.add(relative_path_of_gyp_file)
+
+ # Add in 'action' inputs and outputs.
+ for a in spec.get('actions', []):
+ inputs = a.get('inputs', [])
+ inputs = [_NormalizedSource(i) for i in inputs]
+ # Add all inputs to sources and excluded sources.
+ inputs = set(inputs)
+ sources.update(inputs)
+ excluded_sources.update(inputs)
+ if int(a.get('process_outputs_as_sources', False)):
+ _AddNormalizedSources(sources, a.get('outputs', []))
+ # Add in 'copies' inputs and outputs.
+ for cpy in spec.get('copies', []):
+ _AddNormalizedSources(sources, cpy.get('files', []))
+ return (sources, excluded_sources)
+
+
+def _AdjustSourcesAndConvertToFilterHierarchy(
+ spec, options, gyp_dir, sources, excluded_sources):
+ """Adjusts the list of sources and excluded sources.
+ Also converts the sets to lists.
+
+ Arguments:
+ spec: The target dictionary containing the properties of the target.
+ options: Global generator options.
+ gyp_dir: The path to the gyp file being processed.
+ sources: A set of sources to be included for this project.
+ sources: A set of sources to be excluded for this project.
+ Returns:
+ A trio of (list of sources, list of excluded sources,
+ path of excluded IDL file)
+ """
+ # Exclude excluded sources coming into the generator.
+ excluded_sources.update(set(spec.get('sources_excluded', [])))
+ # Add excluded sources into sources for good measure.
+ sources.update(excluded_sources)
+ # Convert to proper windows form.
+ # NOTE: sources goes from being a set to a list here.
+ # NOTE: excluded_sources goes from being a set to a list here.
+ sources = [_FixPath(i) for i in sources]
+ # Convert to proper windows form.
+ excluded_sources = [_FixPath(i) for i in excluded_sources]
+
+ excluded_idl = _IdlFilesHandledNonNatively(spec, sources)
+
+ precompiled_related = _GetPrecompileRelatedFiles(spec)
+ # Find the excluded ones, minus the precompiled header related ones.
+ fully_excluded = [i for i in excluded_sources if i not in precompiled_related]
+
+ # Convert to folders and the right slashes.
+ sources = [i.split('\\') for i in sources]
+ sources = _ConvertSourcesToFilterHierarchy(sources, excluded=fully_excluded)
+ # Add in dummy file for type none.
+ if spec['type'] == 'dummy_executable':
+ # Pull in a dummy main so it can link successfully.
+ dummy_relpath = gyp.common.RelativePath(
+ options.depth + '\\tools\\gyp\\gyp_dummy.c', gyp_dir)
+ sources.append(dummy_relpath)
+
+ return sources, excluded_sources, excluded_idl
+
+
+def _IdlFilesHandledNonNatively(spec, sources):
+ # If any non-native rules use 'idl' as an extension exclude idl files.
+ # Gather a list here to use later.
+ using_idl = False
+ for rule in spec.get('rules', []):
+ if rule['extension'] == 'idl' and int(rule.get('msvs_external_rule', 0)):
+ using_idl = True
+ break
+ if using_idl:
+ excluded_idl = [i for i in sources if i.endswith('.idl')]
+ else:
+ excluded_idl = []
+ return excluded_idl
+
+
+def _GetPrecompileRelatedFiles(spec):
+ # Gather a list of precompiled header related sources.
+ precompiled_related = []
+ for config_name, config in spec['configurations'].iteritems():
+ for k in precomp_keys:
+ f = config.get(k)
+ if f:
+ precompiled_related.append(_FixPath(f))
+ return precompiled_related
+
+
+def _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl):
+ exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl)
+ for file_name, excluded_configs in exclusions.iteritems():
+ for config_name, config in excluded_configs:
+ p.AddFileConfig(file_name, _ConfigFullName(config_name, config),
+ {'ExcludedFromBuild': 'true'})
+
+
+def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl):
+ exclusions = {}
+ # Exclude excluded sources from being built.
+ for f in excluded_sources:
+ excluded_configs = []
+ for config_name, config in spec['configurations'].iteritems():
+ precomped = [_FixPath(config.get(i, '')) for i in precomp_keys]
+ # Don't do this for ones that are precompiled header related.
+ if f not in precomped:
+ excluded_configs.append((config_name, config))
+ exclusions[f] = excluded_configs
+ # If any non-native rules use 'idl' as an extension exclude idl files.
+ # Exclude them now.
+ for f in excluded_idl:
+ excluded_configs = []
+ for config_name, config in spec['configurations'].iteritems():
+ excluded_configs.append((config_name, config))
+ exclusions[f] = excluded_configs
+ return exclusions
+
+def _AddToolFilesToMSVS(p, spec):
+ # Add in tool files (rules).
+ tool_files = set()
+ for config_name, config in spec['configurations'].iteritems():
+ for f in config.get('msvs_tool_files', []):
+ tool_files.add(f)
+ for f in tool_files:
+ p.AddToolFile(f)
+
+
+def _HandlePreCompileHeaderStubs(p, spec):
+ # Handle pre-compiled headers source stubs specially.
+ for config_name, config in spec['configurations'].iteritems():
+ source = config.get('msvs_precompiled_source')
+ if source:
+ source = _FixPath(source)
+ # UsePrecompiledHeader=1 for if using precompiled headers.
+ tool = MSVSProject.Tool('VCCLCompilerTool',
+ {'UsePrecompiledHeader': '1'})
+ p.AddFileConfig(source, _ConfigFullName(config_name, config),
+ {}, tools=[tool])
+
+
+def _AddActions(actions_to_add, spec, relative_path_of_gyp_file):
+ # Add actions.
+ actions = spec.get('actions', [])
+ for a in actions:
+ cmd = _BuildCommandLineForRule(spec, a, has_input_path=False)
+ # Attach actions to the gyp file if nothing else is there.
+ inputs = a.get('inputs') or [relative_path_of_gyp_file]
+ # Add the action.
+ _AddActionStep(actions_to_add,
+ inputs=inputs,
+ outputs=a.get('outputs', []),
+ description=a.get('message', a['action_name']),
+ command=cmd)
+
+
+def _WriteMSVSUserFile(project_path, version, spec):
+ # Add run_as and test targets.
+ if 'run_as' in spec:
+ run_as = spec['run_as']
+ action = run_as.get('action', [])
+ environment = run_as.get('environment', [])
+ working_directory = run_as.get('working_directory', '.')
+ elif int(spec.get('test', 0)):
+ action = ['$(TargetPath)', '--gtest_print_time']
+ environment = []
+ working_directory = '.'
+ else:
+ return # Nothing to add
+ # Write out the user file.
+ user_file = _CreateMSVSUserFile(project_path, version, spec)
+ for config_name, c_data in spec['configurations'].iteritems():
+ user_file.AddDebugSettings(_ConfigFullName(config_name, c_data),
+ action, environment, working_directory)
+ user_file.Write()
+
+
+def _AddCopies(actions_to_add, spec):
+ copies = _GetCopies(spec)
+ for inputs, outputs, cmd, description in copies:
+ _AddActionStep(actions_to_add, inputs=inputs, outputs=outputs,
+ description=description, command=cmd)
+
+
+def _GetCopies(spec):
+ copies = []
+ # Add copies.
+ for cpy in spec.get('copies', []):
+ for src in cpy.get('files', []):
+ dst = os.path.join(cpy['destination'], os.path.basename(src))
+ # _AddCustomBuildToolForMSVS() will call _FixPath() on the inputs and
+ # outputs, so do the same for our generated command line.
+ if src.endswith('/'):
+ src_bare = src[:-1]
+ base_dir = posixpath.split(src_bare)[0]
+ outer_dir = posixpath.split(src_bare)[1]
+ cmd = 'cd "%s" && xcopy /e /f /y "%s" "%s\\%s\\"' % (
+ _FixPath(base_dir), outer_dir, _FixPath(dst), outer_dir)
+ copies.append(([src], ['dummy_copies', dst], cmd,
+ 'Copying %s to %s' % (src, dst)))
+ else:
+ cmd = 'mkdir "%s" 2>nul & set ERRORLEVEL=0 & copy /Y "%s" "%s"' % (
+ _FixPath(cpy['destination']), _FixPath(src), _FixPath(dst))
+ copies.append(([src], [dst], cmd, 'Copying %s to %s' % (src, dst)))
+ return copies
+
+
+def _GetPathDict(root, path):
+ if path == '':
+ return root
+ parent, folder = os.path.split(path)
+ parent_dict = _GetPathDict(root, parent)
+ if folder not in parent_dict:
+ parent_dict[folder] = dict()
+ return parent_dict[folder]
+
+
+def _DictsToFolders(base_path, bucket, flat):
+ # Convert to folders recursively.
+ children = []
+ for folder, contents in bucket.iteritems():
+ if type(contents) == dict:
+ folder_children = _DictsToFolders(os.path.join(base_path, folder),
+ contents, flat)
+ if flat:
+ children += folder_children
+ else:
+ folder_children = MSVSNew.MSVSFolder(os.path.join(base_path, folder),
+ name='(' + folder + ')',
+ entries=folder_children)
+ children.append(folder_children)
+ else:
+ children.append(contents)
+ return children
+
+
+def _CollapseSingles(parent, node):
+ # Recursively explorer the tree of dicts looking for projects which are
+ # the sole item in a folder which has the same name as the project. Bring
+ # such projects up one level.
+ if (type(node) == dict and
+ len(node) == 1 and
+ node.keys()[0] == parent + '.vcproj'):
+ return node[node.keys()[0]]
+ if type(node) != dict:
+ return node
+ for child in node.keys():
+ node[child] = _CollapseSingles(child, node[child])
+ return node
+
+
+def _GatherSolutionFolders(sln_projects, project_objects, flat):
+ root = {}
+ # Convert into a tree of dicts on path.
+ for p in sln_projects:
+ gyp_file, target = gyp.common.ParseQualifiedTarget(p)[0:2]
+ gyp_dir = os.path.dirname(gyp_file)
+ path_dict = _GetPathDict(root, gyp_dir)
+ path_dict[target + '.vcproj'] = project_objects[p]
+ # Walk down from the top until we hit a folder that has more than one entry.
+ # In practice, this strips the top-level "src/" dir from the hierarchy in
+ # the solution.
+ while len(root) == 1 and type(root[root.keys()[0]]) == dict:
+ root = root[root.keys()[0]]
+ # Collapse singles.
+ root = _CollapseSingles('', root)
+ # Merge buckets until everything is a root entry.
+ return _DictsToFolders('', root, flat)
+
+
+def _GetPathOfProject(qualified_target, spec, options, msvs_version):
+ default_config = _GetDefaultConfiguration(spec)
+ proj_filename = default_config.get('msvs_existing_vcproj')
+ if not proj_filename:
+ proj_filename = (spec['target_name'] + options.suffix +
+ msvs_version.ProjectExtension())
+
+ build_file = gyp.common.BuildFile(qualified_target)
+ proj_path = os.path.join(os.path.split(build_file)[0], proj_filename)
+ fixpath_prefix = None
+ if options.generator_output:
+ projectDirPath = os.path.dirname(os.path.abspath(proj_path))
+ proj_path = os.path.join(options.generator_output, proj_path)
+ fixpath_prefix = gyp.common.RelativePath(projectDirPath,
+ os.path.dirname(proj_path))
+ return proj_path, fixpath_prefix
+
+
+def _GetPlatformOverridesOfProject(spec):
+ # Prepare a dict indicating which project configurations are used for which
+ # solution configurations for this target.
+ config_platform_overrides = {}
+ for config_name, c in spec['configurations'].iteritems():
+ config_fullname = _ConfigFullName(config_name, c)
+ platform = c.get('msvs_target_platform', _ConfigPlatform(c))
+ fixed_config_fullname = '%s|%s' % (
+ _ConfigBaseName(config_name, _ConfigPlatform(c)), platform)
+ config_platform_overrides[config_fullname] = fixed_config_fullname
+ return config_platform_overrides
+
+
+def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
+ """Create a MSVSProject object for the targets found in target list.
+
+ Arguments:
+ target_list: the list of targets to generate project objects for.
+ target_dicts: the dictionary of specifications.
+ options: global generator options.
+ version: the MSVSVersion object.
+ Returns:
+ A set of created projects, keyed by target.
+ """
+ global fixpath_prefix
+ # Generate each project.
+ projects = {}
+ for qualified_target in target_list:
+ spec = target_dicts[qualified_target]
+ if spec['toolset'] != 'target':
+ raise Exception(
+ 'Multiple toolsets not supported in msvs build (target %s)' %
+ qualified_target)
+ proj_path, fixpath_prefix = _GetPathOfProject(qualified_target, spec,
+ options, msvs_version)
+ guid = _GetGuidOfProject(proj_path, spec)
+ overrides = _GetPlatformOverridesOfProject(spec)
+ build_file = gyp.common.BuildFile(qualified_target)
+ # Create object for this project.
+ obj = MSVSNew.MSVSProject(
+ _FixPath(proj_path),
+ name=spec['target_name'],
+ guid=guid,
+ spec=spec,
+ build_file=build_file,
+ config_platform_overrides=overrides,
+ fixpath_prefix=fixpath_prefix)
+ projects[qualified_target] = obj
+ # Set all the dependencies
+ for project in projects.values():
+ deps = project.spec.get('dependencies', [])
+ deps = [projects[d] for d in deps]
+ project.set_dependencies(deps)
+ return projects
+
+
+def CalculateVariables(default_variables, params):
+ """Generated variables that require params to be known."""
+
+ generator_flags = params.get('generator_flags', {})
+
+ # Select project file format version (if unset, default to auto detecting).
+ msvs_version = \
+ MSVSVersion.SelectVisualStudioVersion(generator_flags.get('msvs_version',
+ 'auto'))
+ # Stash msvs_version for later (so we don't have to probe the system twice).
+ params['msvs_version'] = msvs_version
+
+ # Set a variable so conditions can be based on msvs_version.
+ default_variables['MSVS_VERSION'] = msvs_version.ShortName()
+
+ # To determine processor word size on Windows, in addition to checking
+ # PROCESSOR_ARCHITECTURE (which reflects the word size of the current
+ # process), it is also necessary to check PROCESSOR_ARCITEW6432 (which
+ # contains the actual word size of the system when running thru WOW64).
+ if (os.environ.get('PROCESSOR_ARCHITECTURE', '').find('64') >= 0 or
+ os.environ.get('PROCESSOR_ARCHITEW6432', '').find('64') >= 0):
+ default_variables['MSVS_OS_BITS'] = 64
+ else:
+ default_variables['MSVS_OS_BITS'] = 32
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ """Generate .sln and .vcproj files.
+
+ This is the entry point for this generator.
+ Arguments:
+ target_list: List of target pairs: 'base/base.gyp:base'.
+ target_dicts: Dict of target properties keyed on target pair.
+ data: Dictionary containing per .gyp data.
+ """
+ global fixpath_prefix
+
+ options = params['options']
+ generator_flags = params.get('generator_flags', {})
+
+ # Get the project file format version back out of where we stashed it in
+ # GeneratorCalculatedVariables.
+ msvs_version = params['msvs_version']
+
+ # Prepare the set of configurations.
+ configs = set()
+ for qualified_target in target_list:
+ spec = target_dicts[qualified_target]
+ for config_name, config in spec['configurations'].iteritems():
+ configs.add(_ConfigFullName(config_name, config))
+ configs = list(configs)
+
+ # Figure out all the projects that will be generated and their guids
+ project_objects = _CreateProjectObjects(target_list, target_dicts, options,
+ msvs_version)
+
+ # Generate each project.
+ for project in project_objects.values():
+ fixpath_prefix = project.fixpath_prefix
+ _GenerateProject(project, options, msvs_version)
+ fixpath_prefix = None
+
+ for build_file in data.keys():
+ # Validate build_file extension
+ if build_file[-4:] != '.gyp':
+ continue
+ sln_path = build_file[:-4] + options.suffix + '.sln'
+ if options.generator_output:
+ sln_path = os.path.join(options.generator_output, sln_path)
+ # Get projects in the solution, and their dependents.
+ sln_projects = gyp.common.BuildFileTargets(target_list, build_file)
+ sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects)
+ # Create folder hierarchy.
+ root_entries = _GatherSolutionFolders(
+ sln_projects, project_objects, flat=msvs_version.FlatSolution())
+ # Create solution.
+ sln = MSVSNew.MSVSSolution(sln_path,
+ entries=root_entries,
+ variants=configs,
+ websiteProperties=False,
+ version=msvs_version)
+ sln.Write()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/scons.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/scons.py
new file mode 100644
index 0000000..073f9e0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/scons.py
@@ -0,0 +1,1045 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import gyp
+import gyp.common
+import gyp.SCons as SCons
+import os.path
+import pprint
+import re
+
+
+# TODO: remove when we delete the last WriteList() call in this module
+WriteList = SCons.WriteList
+
+
+generator_default_variables = {
+ 'EXECUTABLE_PREFIX': '',
+ 'EXECUTABLE_SUFFIX': '',
+ 'STATIC_LIB_PREFIX': '${LIBPREFIX}',
+ 'SHARED_LIB_PREFIX': '${SHLIBPREFIX}',
+ 'STATIC_LIB_SUFFIX': '${LIBSUFFIX}',
+ 'SHARED_LIB_SUFFIX': '${SHLIBSUFFIX}',
+ 'INTERMEDIATE_DIR': '${INTERMEDIATE_DIR}',
+ 'SHARED_INTERMEDIATE_DIR': '${SHARED_INTERMEDIATE_DIR}',
+ 'OS': 'linux',
+ 'PRODUCT_DIR': '$TOP_BUILDDIR',
+ 'SHARED_LIB_DIR': '$LIB_DIR',
+ 'LIB_DIR': '$LIB_DIR',
+ 'RULE_INPUT_ROOT': '${SOURCE.filebase}',
+ 'RULE_INPUT_EXT': '${SOURCE.suffix}',
+ 'RULE_INPUT_NAME': '${SOURCE.file}',
+ 'RULE_INPUT_PATH': '${SOURCE.abspath}',
+ 'CONFIGURATION_NAME': '${CONFIG_NAME}',
+}
+
+# Tell GYP how to process the input for us.
+generator_handles_variants = True
+generator_wants_absolute_build_file_paths = True
+
+
+def FixPath(path, prefix):
+ if not os.path.isabs(path) and not path[0] == '$':
+ path = prefix + path
+ return path
+
+
+header = """\
+# This file is generated; do not edit.
+"""
+
+
+_alias_template = """
+if GetOption('verbose'):
+ _action = Action([%(action)s])
+else:
+ _action = Action([%(action)s], %(message)s)
+_outputs = env.Alias(
+ ['_%(target_name)s_action'],
+ %(inputs)s,
+ _action
+)
+env.AlwaysBuild(_outputs)
+"""
+
+_run_as_template = """
+if GetOption('verbose'):
+ _action = Action([%(action)s])
+else:
+ _action = Action([%(action)s], %(message)s)
+"""
+
+_run_as_template_suffix = """
+_run_as_target = env.Alias('run_%(target_name)s', target_files, _action)
+env.Requires(_run_as_target, [
+ Alias('%(target_name)s'),
+])
+env.AlwaysBuild(_run_as_target)
+"""
+
+_command_template = """
+if GetOption('verbose'):
+ _action = Action([%(action)s])
+else:
+ _action = Action([%(action)s], %(message)s)
+_outputs = env.Command(
+ %(outputs)s,
+ %(inputs)s,
+ _action
+)
+"""
+
+# This is copied from the default SCons action, updated to handle symlinks.
+_copy_action_template = """
+import shutil
+import SCons.Action
+
+def _copy_files_or_dirs_or_symlinks(dest, src):
+ SCons.Node.FS.invalidate_node_memos(dest)
+ if SCons.Util.is_List(src) and os.path.isdir(dest):
+ for file in src:
+ shutil.copy2(file, dest)
+ return 0
+ elif os.path.islink(src):
+ linkto = os.readlink(src)
+ os.symlink(linkto, dest)
+ return 0
+ elif os.path.isfile(src):
+ return shutil.copy2(src, dest)
+ else:
+ return shutil.copytree(src, dest, 1)
+
+def _copy_files_or_dirs_or_symlinks_str(dest, src):
+ return 'Copying %s to %s ...' % (src, dest)
+
+GYPCopy = SCons.Action.ActionFactory(_copy_files_or_dirs_or_symlinks,
+ _copy_files_or_dirs_or_symlinks_str,
+ convert=str)
+"""
+
+_rule_template = """
+%(name)s_additional_inputs = %(inputs)s
+%(name)s_outputs = %(outputs)s
+def %(name)s_emitter(target, source, env):
+ return (%(name)s_outputs, source + %(name)s_additional_inputs)
+if GetOption('verbose'):
+ %(name)s_action = Action([%(action)s])
+else:
+ %(name)s_action = Action([%(action)s], %(message)s)
+env['BUILDERS']['%(name)s'] = Builder(action=%(name)s_action,
+ emitter=%(name)s_emitter)
+
+_outputs = []
+_processed_input_files = []
+for infile in input_files:
+ if (type(infile) == type('')
+ and not os.path.isabs(infile)
+ and not infile[0] == '$'):
+ infile = %(src_dir)r + infile
+ if str(infile).endswith('.%(extension)s'):
+ _generated = env.%(name)s(infile)
+ env.Precious(_generated)
+ _outputs.append(_generated)
+ %(process_outputs_as_sources_line)s
+ else:
+ _processed_input_files.append(infile)
+prerequisites.extend(_outputs)
+input_files = _processed_input_files
+"""
+
+_spawn_hack = """
+import re
+import SCons.Platform.posix
+needs_shell = re.compile('["\\'><!^&]')
+def gyp_spawn(sh, escape, cmd, args, env):
+ def strip_scons_quotes(arg):
+ if arg[0] == '"' and arg[-1] == '"':
+ return arg[1:-1]
+ return arg
+ stripped_args = [strip_scons_quotes(a) for a in args]
+ if needs_shell.search(' '.join(stripped_args)):
+ return SCons.Platform.posix.exec_spawnvpe([sh, '-c', ' '.join(args)], env)
+ else:
+ return SCons.Platform.posix.exec_spawnvpe(stripped_args, env)
+"""
+
+
+def EscapeShellArgument(s):
+ """Quotes an argument so that it will be interpreted literally by a POSIX
+ shell. Taken from
+ http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
+ """
+ return "'" + s.replace("'", "'\\''") + "'"
+
+
+def InvertNaiveSConsQuoting(s):
+ """SCons tries to "help" with quoting by naively putting double-quotes around
+ command-line arguments containing space or tab, which is broken for all
+ but trivial cases, so we undo it. (See quote_spaces() in Subst.py)"""
+ if ' ' in s or '\t' in s:
+ # Then SCons will put double-quotes around this, so add our own quotes
+ # to close its quotes at the beginning and end.
+ s = '"' + s + '"'
+ return s
+
+
+def EscapeSConsVariableExpansion(s):
+ """SCons has its own variable expansion syntax using $. We must escape it for
+ strings to be interpreted literally. For some reason this requires four
+ dollar signs, not two, even without the shell involved."""
+ return s.replace('$', '$$$$')
+
+
+def EscapeCppDefine(s):
+ """Escapes a CPP define so that it will reach the compiler unaltered."""
+ s = EscapeShellArgument(s)
+ s = InvertNaiveSConsQuoting(s)
+ s = EscapeSConsVariableExpansion(s)
+ return s
+
+
+def GenerateConfig(fp, config, indent='', src_dir=''):
+ """
+ Generates SCons dictionary items for a gyp configuration.
+
+ This provides the main translation between the (lower-case) gyp settings
+ keywords and the (upper-case) SCons construction variables.
+ """
+ var_mapping = {
+ 'ASFLAGS' : 'asflags',
+ 'CCFLAGS' : 'cflags',
+ 'CFLAGS' : 'cflags_c',
+ 'CXXFLAGS' : 'cflags_cc',
+ 'CPPDEFINES' : 'defines',
+ 'CPPPATH' : 'include_dirs',
+ # Add the ldflags value to $LINKFLAGS, but not $SHLINKFLAGS.
+ # SCons defines $SHLINKFLAGS to incorporate $LINKFLAGS, so
+ # listing both here would case 'ldflags' to get appended to
+ # both, and then have it show up twice on the command line.
+ 'LINKFLAGS' : 'ldflags',
+ }
+ postamble='\n%s],\n' % indent
+ for scons_var in sorted(var_mapping.keys()):
+ gyp_var = var_mapping[scons_var]
+ value = config.get(gyp_var)
+ if value:
+ if gyp_var in ('defines',):
+ value = [EscapeCppDefine(v) for v in value]
+ if gyp_var in ('include_dirs',):
+ if src_dir and not src_dir.endswith('/'):
+ src_dir += '/'
+ result = []
+ for v in value:
+ v = FixPath(v, src_dir)
+ # Force SCons to evaluate the CPPPATH directories at
+ # SConscript-read time, so delayed evaluation of $SRC_DIR
+ # doesn't point it to the --generator-output= directory.
+ result.append('env.Dir(%r)' % v)
+ value = result
+ else:
+ value = map(repr, value)
+ WriteList(fp,
+ value,
+ prefix=indent,
+ preamble='%s%s = [\n ' % (indent, scons_var),
+ postamble=postamble)
+
+
+def GenerateSConscript(output_filename, spec, build_file, build_file_data):
+ """
+ Generates a SConscript file for a specific target.
+
+ This generates a SConscript file suitable for building any or all of
+ the target's configurations.
+
+ A SConscript file may be called multiple times to generate targets for
+ multiple configurations. Consequently, it needs to be ready to build
+ the target for any requested configuration, and therefore contains
+ information about the settings for all configurations (generated into
+ the SConscript file at gyp configuration time) as well as logic for
+ selecting (at SCons build time) the specific configuration being built.
+
+ The general outline of a generated SConscript file is:
+
+ -- Header
+
+ -- Import 'env'. This contains a $CONFIG_NAME construction
+ variable that specifies what configuration to build
+ (e.g. Debug, Release).
+
+ -- Configurations. This is a dictionary with settings for
+ the different configurations (Debug, Release) under which this
+ target can be built. The values in the dictionary are themselves
+ dictionaries specifying what construction variables should added
+ to the local copy of the imported construction environment
+ (Append), should be removed (FilterOut), and should outright
+ replace the imported values (Replace).
+
+ -- Clone the imported construction environment and update
+ with the proper configuration settings.
+
+ -- Initialize the lists of the targets' input files and prerequisites.
+
+ -- Target-specific actions and rules. These come after the
+ input file and prerequisite initializations because the
+ outputs of the actions and rules may affect the input file
+ list (process_outputs_as_sources) and get added to the list of
+ prerequisites (so that they're guaranteed to be executed before
+ building the target).
+
+ -- Call the Builder for the target itself.
+
+ -- Arrange for any copies to be made into installation directories.
+
+ -- Set up the {name} Alias (phony Node) for the target as the
+ primary handle for building all of the target's pieces.
+
+ -- Use env.Require() to make sure the prerequisites (explicitly
+ specified, but also including the actions and rules) are built
+ before the target itself.
+
+ -- Return the {name} Alias to the calling SConstruct file
+ so it can be added to the list of default targets.
+ """
+ scons_target = SCons.Target(spec)
+
+ gyp_dir = os.path.dirname(output_filename)
+ if not gyp_dir:
+ gyp_dir = '.'
+ gyp_dir = os.path.abspath(gyp_dir)
+
+ output_dir = os.path.dirname(output_filename)
+ src_dir = build_file_data['_DEPTH']
+ src_dir_rel = gyp.common.RelativePath(src_dir, output_dir)
+ subdir = gyp.common.RelativePath(os.path.dirname(build_file), src_dir)
+ src_subdir = '$SRC_DIR/' + subdir
+ src_subdir_ = src_subdir + '/'
+
+ component_name = os.path.splitext(os.path.basename(build_file))[0]
+ target_name = spec['target_name']
+
+ if not os.path.exists(gyp_dir):
+ os.makedirs(gyp_dir)
+ fp = open(output_filename, 'w')
+ fp.write(header)
+
+ fp.write('\nimport os\n')
+ fp.write('\nImport("env")\n')
+
+ #
+ fp.write('\n')
+ fp.write('env = env.Clone(COMPONENT_NAME=%s,\n' % repr(component_name))
+ fp.write(' TARGET_NAME=%s)\n' % repr(target_name))
+
+ #
+ for config in spec['configurations'].itervalues():
+ if config.get('scons_line_length'):
+ fp.write(_spawn_hack)
+ break
+
+ #
+ indent = ' ' * 12
+ fp.write('\n')
+ fp.write('configurations = {\n')
+ for config_name, config in spec['configurations'].iteritems():
+ fp.write(' \'%s\' : {\n' % config_name)
+
+ fp.write(' \'Append\' : dict(\n')
+ GenerateConfig(fp, config, indent, src_subdir)
+ libraries = spec.get('libraries')
+ if libraries:
+ WriteList(fp,
+ map(repr, libraries),
+ prefix=indent,
+ preamble='%sLIBS = [\n ' % indent,
+ postamble='\n%s],\n' % indent)
+ fp.write(' ),\n')
+
+ fp.write(' \'FilterOut\' : dict(\n' )
+ for key, var in config.get('scons_remove', {}).iteritems():
+ fp.write(' %s = %s,\n' % (key, repr(var)))
+ fp.write(' ),\n')
+
+ fp.write(' \'Replace\' : dict(\n' )
+ scons_settings = config.get('scons_variable_settings', {})
+ for key in sorted(scons_settings.keys()):
+ val = pprint.pformat(scons_settings[key])
+ fp.write(' %s = %s,\n' % (key, val))
+ if 'c++' in spec.get('link_languages', []):
+ fp.write(' %s = %s,\n' % ('LINK', repr('$CXX')))
+ if config.get('scons_line_length'):
+ fp.write(' SPAWN = gyp_spawn,\n')
+ fp.write(' ),\n')
+
+ fp.write(' \'ImportExternal\' : [\n' )
+ for var in config.get('scons_import_variables', []):
+ fp.write(' %s,\n' % repr(var))
+ fp.write(' ],\n')
+
+ fp.write(' \'PropagateExternal\' : [\n' )
+ for var in config.get('scons_propagate_variables', []):
+ fp.write(' %s,\n' % repr(var))
+ fp.write(' ],\n')
+
+ fp.write(' },\n')
+ fp.write('}\n')
+
+ fp.write('\n'
+ 'config = configurations[env[\'CONFIG_NAME\']]\n'
+ 'env.Append(**config[\'Append\'])\n'
+ 'env.FilterOut(**config[\'FilterOut\'])\n'
+ 'env.Replace(**config[\'Replace\'])\n')
+
+ fp.write('\n'
+ '# Scons forces -fPIC for SHCCFLAGS on some platforms.\n'
+ '# Disable that so we can control it from cflags in gyp.\n'
+ '# Note that Scons itself is inconsistent with its -fPIC\n'
+ '# setting. SHCCFLAGS forces -fPIC, and SHCFLAGS does not.\n'
+ '# This will make SHCCFLAGS consistent with SHCFLAGS.\n'
+ 'env[\'SHCCFLAGS\'] = [\'$CCFLAGS\']\n')
+
+ fp.write('\n'
+ 'for _var in config[\'ImportExternal\']:\n'
+ ' if _var in ARGUMENTS:\n'
+ ' env[_var] = ARGUMENTS[_var]\n'
+ ' elif _var in os.environ:\n'
+ ' env[_var] = os.environ[_var]\n'
+ 'for _var in config[\'PropagateExternal\']:\n'
+ ' if _var in ARGUMENTS:\n'
+ ' env[_var] = ARGUMENTS[_var]\n'
+ ' elif _var in os.environ:\n'
+ ' env[\'ENV\'][_var] = os.environ[_var]\n')
+
+ fp.write('\n'
+ "env['ENV']['LD_LIBRARY_PATH'] = env.subst('$LIB_DIR')\n")
+
+ #
+ #fp.write("\nif env.has_key('CPPPATH'):\n")
+ #fp.write(" env['CPPPATH'] = map(env.Dir, env['CPPPATH'])\n")
+
+ variants = spec.get('variants', {})
+ for setting in sorted(variants.keys()):
+ if_fmt = 'if ARGUMENTS.get(%s) not in (None, \'0\'):\n'
+ fp.write('\n')
+ fp.write(if_fmt % repr(setting.upper()))
+ fp.write(' env.AppendUnique(\n')
+ GenerateConfig(fp, variants[setting], indent, src_subdir)
+ fp.write(' )\n')
+
+ #
+ scons_target.write_input_files(fp)
+
+ fp.write('\n')
+ fp.write('target_files = []\n')
+ prerequisites = spec.get('scons_prerequisites', [])
+ fp.write('prerequisites = %s\n' % pprint.pformat(prerequisites))
+
+ actions = spec.get('actions', [])
+ for action in actions:
+ a = ['cd', src_subdir, '&&'] + action['action']
+ message = action.get('message')
+ if message:
+ message = repr(message)
+ inputs = [FixPath(f, src_subdir_) for f in action.get('inputs', [])]
+ outputs = [FixPath(f, src_subdir_) for f in action.get('outputs', [])]
+ if outputs:
+ template = _command_template
+ else:
+ template = _alias_template
+ fp.write(template % {
+ 'inputs' : pprint.pformat(inputs),
+ 'outputs' : pprint.pformat(outputs),
+ 'action' : pprint.pformat(a),
+ 'message' : message,
+ 'target_name': target_name,
+ })
+ if int(action.get('process_outputs_as_sources', 0)):
+ fp.write('input_files.extend(_outputs)\n')
+ fp.write('prerequisites.extend(_outputs)\n')
+ fp.write('target_files.extend(_outputs)\n')
+
+ rules = spec.get('rules', [])
+ for rule in rules:
+ name = rule['rule_name']
+ a = ['cd', src_subdir, '&&'] + rule['action']
+ message = rule.get('message')
+ if message:
+ message = repr(message)
+ if int(rule.get('process_outputs_as_sources', 0)):
+ poas_line = '_processed_input_files.extend(_generated)'
+ else:
+ poas_line = '_processed_input_files.append(infile)'
+ inputs = [FixPath(f, src_subdir_) for f in rule.get('inputs', [])]
+ outputs = [FixPath(f, src_subdir_) for f in rule.get('outputs', [])]
+ fp.write(_rule_template % {
+ 'inputs' : pprint.pformat(inputs),
+ 'outputs' : pprint.pformat(outputs),
+ 'action' : pprint.pformat(a),
+ 'extension' : rule['extension'],
+ 'name' : name,
+ 'message' : message,
+ 'process_outputs_as_sources_line' : poas_line,
+ 'src_dir' : src_subdir_,
+ })
+
+ scons_target.write_target(fp, src_subdir)
+
+ copies = spec.get('copies', [])
+ if copies:
+ fp.write(_copy_action_template)
+ for copy in copies:
+ destdir = None
+ files = None
+ try:
+ destdir = copy['destination']
+ except KeyError, e:
+ gyp.common.ExceptionAppend(
+ e,
+ "Required 'destination' key missing for 'copies' in %s." % build_file)
+ raise
+ try:
+ files = copy['files']
+ except KeyError, e:
+ gyp.common.ExceptionAppend(
+ e, "Required 'files' key missing for 'copies' in %s." % build_file)
+ raise
+ if not files:
+ # TODO: should probably add a (suppressible) warning;
+ # a null file list may be unintentional.
+ continue
+ if not destdir:
+ raise Exception(
+ "Required 'destination' key is empty for 'copies' in %s." % build_file)
+
+ fmt = ('\n'
+ '_outputs = env.Command(%s,\n'
+ ' %s,\n'
+ ' GYPCopy(\'$TARGET\', \'$SOURCE\'))\n')
+ for f in copy['files']:
+ # Remove trailing separators so basename() acts like Unix basename and
+ # always returns the last element, whether a file or dir. Without this,
+ # only the contents, not the directory itself, are copied (and nothing
+ # might be copied if dest already exists, since scons thinks nothing needs
+ # to be done).
+ dest = os.path.join(destdir, os.path.basename(f.rstrip(os.sep)))
+ f = FixPath(f, src_subdir_)
+ dest = FixPath(dest, src_subdir_)
+ fp.write(fmt % (repr(dest), repr(f)))
+ fp.write('target_files.extend(_outputs)\n')
+
+ run_as = spec.get('run_as')
+ if run_as:
+ action = run_as.get('action', [])
+ working_directory = run_as.get('working_directory')
+ if not working_directory:
+ working_directory = gyp_dir
+ else:
+ if not os.path.isabs(working_directory):
+ working_directory = os.path.normpath(os.path.join(gyp_dir,
+ working_directory))
+ if run_as.get('environment'):
+ for (key, val) in run_as.get('environment').iteritems():
+ action = ['%s="%s"' % (key, val)] + action
+ action = ['cd', '"%s"' % working_directory, '&&'] + action
+ fp.write(_run_as_template % {
+ 'action' : pprint.pformat(action),
+ 'message' : run_as.get('message', ''),
+ })
+
+ fmt = "\ngyp_target = env.Alias('%s', target_files)\n"
+ fp.write(fmt % target_name)
+
+ dependencies = spec.get('scons_dependencies', [])
+ if dependencies:
+ WriteList(fp, dependencies, preamble='dependencies = [\n ',
+ postamble='\n]\n')
+ fp.write('env.Requires(target_files, dependencies)\n')
+ fp.write('env.Requires(gyp_target, dependencies)\n')
+ fp.write('for prerequisite in prerequisites:\n')
+ fp.write(' env.Requires(prerequisite, dependencies)\n')
+ fp.write('env.Requires(gyp_target, prerequisites)\n')
+
+ if run_as:
+ fp.write(_run_as_template_suffix % {
+ 'target_name': target_name,
+ })
+
+ fp.write('Return("gyp_target")\n')
+
+ fp.close()
+
+
+#############################################################################
+# TEMPLATE BEGIN
+
+_wrapper_template = """\
+
+__doc__ = '''
+Wrapper configuration for building this entire "solution,"
+including all the specific targets in various *.scons files.
+'''
+
+import os
+import sys
+
+import SCons.Environment
+import SCons.Util
+
+def GetProcessorCount():
+ '''
+ Detects the number of CPUs on the system. Adapted form:
+ http://codeliberates.blogspot.com/2008/05/detecting-cpuscores-in-python.html
+ '''
+ # Linux, Unix and Mac OS X:
+ if hasattr(os, 'sysconf'):
+ if os.sysconf_names.has_key('SC_NPROCESSORS_ONLN'):
+ # Linux and Unix or Mac OS X with python >= 2.5:
+ return os.sysconf('SC_NPROCESSORS_ONLN')
+ else: # Mac OS X with Python < 2.5:
+ return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+ # Windows:
+ if os.environ.has_key('NUMBER_OF_PROCESSORS'):
+ return max(int(os.environ.get('NUMBER_OF_PROCESSORS', '1')), 1)
+ return 1 # Default
+
+# Support PROGRESS= to show progress in different ways.
+p = ARGUMENTS.get('PROGRESS')
+if p == 'spinner':
+ Progress(['/\\r', '|\\r', '\\\\\\r', '-\\r'],
+ interval=5,
+ file=open('/dev/tty', 'w'))
+elif p == 'name':
+ Progress('$TARGET\\r', overwrite=True, file=open('/dev/tty', 'w'))
+
+# Set the default -j value based on the number of processors.
+SetOption('num_jobs', GetProcessorCount() + 1)
+
+# Have SCons use its cached dependency information.
+SetOption('implicit_cache', 1)
+
+# Only re-calculate MD5 checksums if a timestamp has changed.
+Decider('MD5-timestamp')
+
+# Since we set the -j value by default, suppress SCons warnings about being
+# unable to support parallel build on versions of Python with no threading.
+default_warnings = ['no-no-parallel-support']
+SetOption('warn', default_warnings + GetOption('warn'))
+
+AddOption('--mode', nargs=1, dest='conf_list', default=[],
+ action='append', help='Configuration to build.')
+
+AddOption('--verbose', dest='verbose', default=False,
+ action='store_true', help='Verbose command-line output.')
+
+
+#
+sconscript_file_map = %(sconscript_files)s
+
+class LoadTarget:
+ '''
+ Class for deciding if a given target sconscript is to be included
+ based on a list of included target names, optionally prefixed with '-'
+ to exclude a target name.
+ '''
+ def __init__(self, load):
+ '''
+ Initialize a class with a list of names for possible loading.
+
+ Arguments:
+ load: list of elements in the LOAD= specification
+ '''
+ self.included = set([c for c in load if not c.startswith('-')])
+ self.excluded = set([c[1:] for c in load if c.startswith('-')])
+
+ if not self.included:
+ self.included = set(['all'])
+
+ def __call__(self, target):
+ '''
+ Returns True if the specified target's sconscript file should be
+ loaded, based on the initialized included and excluded lists.
+ '''
+ return (target in self.included or
+ ('all' in self.included and not target in self.excluded))
+
+if 'LOAD' in ARGUMENTS:
+ load = ARGUMENTS['LOAD'].split(',')
+else:
+ load = []
+load_target = LoadTarget(load)
+
+sconscript_files = []
+for target, sconscript in sconscript_file_map.iteritems():
+ if load_target(target):
+ sconscript_files.append(sconscript)
+
+
+target_alias_list= []
+
+conf_list = GetOption('conf_list')
+if conf_list:
+ # In case the same --mode= value was specified multiple times.
+ conf_list = list(set(conf_list))
+else:
+ conf_list = [%(default_configuration)r]
+
+sconsbuild_dir = Dir(%(sconsbuild_dir)s)
+
+
+def FilterOut(self, **kw):
+ kw = SCons.Environment.copy_non_reserved_keywords(kw)
+ for key, val in kw.items():
+ envval = self.get(key, None)
+ if envval is None:
+ # No existing variable in the environment, so nothing to delete.
+ continue
+
+ for vremove in val:
+ # Use while not if, so we can handle duplicates.
+ while vremove in envval:
+ envval.remove(vremove)
+
+ self[key] = envval
+
+ # TODO(sgk): SCons.Environment.Append() has much more logic to deal
+ # with various types of values. We should handle all those cases in here
+ # too. (If variable is a dict, etc.)
+
+
+non_compilable_suffixes = {
+ 'LINUX' : set([
+ '.bdic',
+ '.css',
+ '.dat',
+ '.fragment',
+ '.gperf',
+ '.h',
+ '.hh',
+ '.hpp',
+ '.html',
+ '.hxx',
+ '.idl',
+ '.in',
+ '.in0',
+ '.in1',
+ '.js',
+ '.mk',
+ '.rc',
+ '.sigs',
+ '',
+ ]),
+ 'WINDOWS' : set([
+ '.h',
+ '.hh',
+ '.hpp',
+ '.dat',
+ '.idl',
+ '.in',
+ '.in0',
+ '.in1',
+ ]),
+}
+
+def compilable(env, file):
+ base, ext = os.path.splitext(str(file))
+ if ext in non_compilable_suffixes[env['TARGET_PLATFORM']]:
+ return False
+ return True
+
+def compilable_files(env, sources):
+ return [x for x in sources if compilable(env, x)]
+
+def GypProgram(env, target, source, *args, **kw):
+ source = compilable_files(env, source)
+ result = env.Program(target, source, *args, **kw)
+ if env.get('INCREMENTAL'):
+ env.Precious(result)
+ return result
+
+def GypTestProgram(env, target, source, *args, **kw):
+ source = compilable_files(env, source)
+ result = env.Program(target, source, *args, **kw)
+ if env.get('INCREMENTAL'):
+ env.Precious(*result)
+ return result
+
+def GypLibrary(env, target, source, *args, **kw):
+ source = compilable_files(env, source)
+ result = env.Library(target, source, *args, **kw)
+ return result
+
+def GypLoadableModule(env, target, source, *args, **kw):
+ source = compilable_files(env, source)
+ result = env.LoadableModule(target, source, *args, **kw)
+ return result
+
+def GypStaticLibrary(env, target, source, *args, **kw):
+ source = compilable_files(env, source)
+ result = env.StaticLibrary(target, source, *args, **kw)
+ return result
+
+def GypSharedLibrary(env, target, source, *args, **kw):
+ source = compilable_files(env, source)
+ result = env.SharedLibrary(target, source, *args, **kw)
+ if env.get('INCREMENTAL'):
+ env.Precious(result)
+ return result
+
+def add_gyp_methods(env):
+ env.AddMethod(GypProgram)
+ env.AddMethod(GypTestProgram)
+ env.AddMethod(GypLibrary)
+ env.AddMethod(GypLoadableModule)
+ env.AddMethod(GypStaticLibrary)
+ env.AddMethod(GypSharedLibrary)
+
+ env.AddMethod(FilterOut)
+
+ env.AddMethod(compilable)
+
+
+base_env = Environment(
+ tools = %(scons_tools)s,
+ INTERMEDIATE_DIR='$OBJ_DIR/${COMPONENT_NAME}/_${TARGET_NAME}_intermediate',
+ LIB_DIR='$TOP_BUILDDIR/lib',
+ OBJ_DIR='$TOP_BUILDDIR/obj',
+ SCONSBUILD_DIR=sconsbuild_dir.abspath,
+ SHARED_INTERMEDIATE_DIR='$OBJ_DIR/_global_intermediate',
+ SRC_DIR=Dir(%(src_dir)r),
+ TARGET_PLATFORM='LINUX',
+ TOP_BUILDDIR='$SCONSBUILD_DIR/$CONFIG_NAME',
+ LIBPATH=['$LIB_DIR'],
+)
+
+if not GetOption('verbose'):
+ base_env.SetDefault(
+ ARCOMSTR='Creating library $TARGET',
+ ASCOMSTR='Assembling $TARGET',
+ CCCOMSTR='Compiling $TARGET',
+ CONCATSOURCECOMSTR='ConcatSource $TARGET',
+ CXXCOMSTR='Compiling $TARGET',
+ LDMODULECOMSTR='Building loadable module $TARGET',
+ LINKCOMSTR='Linking $TARGET',
+ MANIFESTCOMSTR='Updating manifest for $TARGET',
+ MIDLCOMSTR='Compiling IDL $TARGET',
+ PCHCOMSTR='Precompiling $TARGET',
+ RANLIBCOMSTR='Indexing $TARGET',
+ RCCOMSTR='Compiling resource $TARGET',
+ SHCCCOMSTR='Compiling $TARGET',
+ SHCXXCOMSTR='Compiling $TARGET',
+ SHLINKCOMSTR='Linking $TARGET',
+ SHMANIFESTCOMSTR='Updating manifest for $TARGET',
+ )
+
+add_gyp_methods(base_env)
+
+for conf in conf_list:
+ env = base_env.Clone(CONFIG_NAME=conf)
+ SConsignFile(env.File('$TOP_BUILDDIR/.sconsign').abspath)
+ for sconscript in sconscript_files:
+ target_alias = env.SConscript(sconscript, exports=['env'])
+ if target_alias:
+ target_alias_list.extend(target_alias)
+
+Default(Alias('all', target_alias_list))
+
+help_fmt = '''
+Usage: hammer [SCONS_OPTIONS] [VARIABLES] [TARGET] ...
+
+Local command-line build options:
+ --mode=CONFIG Configuration to build:
+ --mode=Debug [default]
+ --mode=Release
+ --verbose Print actual executed command lines.
+
+Supported command-line build variables:
+ LOAD=[module,...] Comma-separated list of components to load in the
+ dependency graph ('-' prefix excludes)
+ PROGRESS=type Display a progress indicator:
+ name: print each evaluated target name
+ spinner: print a spinner every 5 targets
+
+The following TARGET names can also be used as LOAD= module names:
+
+%%s
+'''
+
+if GetOption('help'):
+ def columnar_text(items, width=78, indent=2, sep=2):
+ result = []
+ colwidth = max(map(len, items)) + sep
+ cols = (width - indent) / colwidth
+ if cols < 1:
+ cols = 1
+ rows = (len(items) + cols - 1) / cols
+ indent = '%%*s' %% (indent, '')
+ sep = indent
+ for row in xrange(0, rows):
+ result.append(sep)
+ for i in xrange(row, len(items), rows):
+ result.append('%%-*s' %% (colwidth, items[i]))
+ sep = '\\n' + indent
+ result.append('\\n')
+ return ''.join(result)
+
+ load_list = set(sconscript_file_map.keys())
+ target_aliases = set(map(str, target_alias_list))
+
+ common = load_list and target_aliases
+ load_only = load_list - common
+ target_only = target_aliases - common
+ help_text = [help_fmt %% columnar_text(sorted(list(common)))]
+ if target_only:
+ fmt = "The following are additional TARGET names:\\n\\n%%s\\n"
+ help_text.append(fmt %% columnar_text(sorted(list(target_only))))
+ if load_only:
+ fmt = "The following are additional LOAD= module names:\\n\\n%%s\\n"
+ help_text.append(fmt %% columnar_text(sorted(list(load_only))))
+ Help(''.join(help_text))
+"""
+
+# TEMPLATE END
+#############################################################################
+
+
+def GenerateSConscriptWrapper(build_file, build_file_data, name,
+ output_filename, sconscript_files,
+ default_configuration):
+ """
+ Generates the "wrapper" SConscript file (analogous to the Visual Studio
+ solution) that calls all the individual target SConscript files.
+ """
+ output_dir = os.path.dirname(output_filename)
+ src_dir = build_file_data['_DEPTH']
+ src_dir_rel = gyp.common.RelativePath(src_dir, output_dir)
+ if not src_dir_rel:
+ src_dir_rel = '.'
+ scons_settings = build_file_data.get('scons_settings', {})
+ sconsbuild_dir = scons_settings.get('sconsbuild_dir', '#')
+ scons_tools = scons_settings.get('tools', ['default'])
+
+ sconscript_file_lines = ['dict(']
+ for target in sorted(sconscript_files.keys()):
+ sconscript = sconscript_files[target]
+ sconscript_file_lines.append(' %s = %r,' % (target, sconscript))
+ sconscript_file_lines.append(')')
+
+ fp = open(output_filename, 'w')
+ fp.write(header)
+ fp.write(_wrapper_template % {
+ 'default_configuration' : default_configuration,
+ 'name' : name,
+ 'scons_tools' : repr(scons_tools),
+ 'sconsbuild_dir' : repr(sconsbuild_dir),
+ 'sconscript_files' : '\n'.join(sconscript_file_lines),
+ 'src_dir' : src_dir_rel,
+ })
+ fp.close()
+
+ # Generate the SConstruct file that invokes the wrapper SConscript.
+ dir, fname = os.path.split(output_filename)
+ SConstruct = os.path.join(dir, 'SConstruct')
+ fp = open(SConstruct, 'w')
+ fp.write(header)
+ fp.write('SConscript(%s)\n' % repr(fname))
+ fp.close()
+
+
+def TargetFilename(target, build_file=None, output_suffix=''):
+ """Returns the .scons file name for the specified target.
+ """
+ if build_file is None:
+ build_file, target = gyp.common.ParseQualifiedTarget(target)[:2]
+ output_file = os.path.join(os.path.dirname(build_file),
+ target + output_suffix + '.scons')
+ return output_file
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ """
+ Generates all the output files for the specified targets.
+ """
+ options = params['options']
+
+ if options.generator_output:
+ def output_path(filename):
+ return filename.replace(params['cwd'], options.generator_output)
+ else:
+ def output_path(filename):
+ return filename
+
+ default_configuration = None
+
+ for qualified_target in target_list:
+ spec = target_dicts[qualified_target]
+ if spec['toolset'] != 'target':
+ raise Exception(
+ 'Multiple toolsets not supported in scons build (target %s)' %
+ qualified_target)
+ scons_target = SCons.Target(spec)
+ if scons_target.is_ignored:
+ continue
+
+ # TODO: assumes the default_configuration of the first target
+ # non-Default target is the correct default for all targets.
+ # Need a better model for handle variation between targets.
+ if (not default_configuration and
+ spec['default_configuration'] != 'Default'):
+ default_configuration = spec['default_configuration']
+
+ build_file, target = gyp.common.ParseQualifiedTarget(qualified_target)[:2]
+ output_file = TargetFilename(target, build_file, options.suffix)
+ if options.generator_output:
+ output_file = output_path(output_file)
+
+ if not spec.has_key('libraries'):
+ spec['libraries'] = []
+
+ # Add dependent static library targets to the 'libraries' value.
+ deps = spec.get('dependencies', [])
+ spec['scons_dependencies'] = []
+ for d in deps:
+ td = target_dicts[d]
+ target_name = td['target_name']
+ spec['scons_dependencies'].append("Alias('%s')" % target_name)
+ if td['type'] in ('static_library', 'shared_library'):
+ libname = td.get('product_name', target_name)
+ spec['libraries'].append('lib' + libname)
+ if td['type'] == 'loadable_module':
+ prereqs = spec.get('scons_prerequisites', [])
+ # TODO: parameterize with <(SHARED_LIBRARY_*) variables?
+ td_target = SCons.Target(td)
+ td_target.target_prefix = '${SHLIBPREFIX}'
+ td_target.target_suffix = '${SHLIBSUFFIX}'
+
+ GenerateSConscript(output_file, spec, build_file, data[build_file])
+
+ if not default_configuration:
+ default_configuration = 'Default'
+
+ for build_file in sorted(data.keys()):
+ path, ext = os.path.splitext(build_file)
+ if ext != '.gyp':
+ continue
+ output_dir, basename = os.path.split(path)
+ output_filename = path + '_main' + options.suffix + '.scons'
+
+ all_targets = gyp.common.AllTargets(target_list, target_dicts, build_file)
+ sconscript_files = {}
+ for t in all_targets:
+ scons_target = SCons.Target(target_dicts[t])
+ if scons_target.is_ignored:
+ continue
+ bf, target = gyp.common.ParseQualifiedTarget(t)[:2]
+ target_filename = TargetFilename(target, bf, options.suffix)
+ tpath = gyp.common.RelativePath(target_filename, output_dir)
+ sconscript_files[target] = tpath
+
+ output_filename = output_path(output_filename)
+ if sconscript_files:
+ GenerateSConscriptWrapper(build_file, data[build_file], basename,
+ output_filename, sconscript_files,
+ default_configuration)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/xcode.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/xcode.py
new file mode 100644
index 0000000..c7ce5b0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/generator/xcode.py
@@ -0,0 +1,1201 @@
+#!/usr/bin/python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import filecmp
+import gyp.common
+import gyp.xcodeproj_file
+import errno
+import os
+import posixpath
+import re
+import shutil
+import subprocess
+import tempfile
+
+
+# Project files generated by this module will use _intermediate_var as a
+# custom Xcode setting whose value is a DerivedSources-like directory that's
+# project-specific and configuration-specific. The normal choice,
+# DERIVED_FILE_DIR, is target-specific, which is thought to be too restrictive
+# as it is likely that multiple targets within a single project file will want
+# to access the same set of generated files. The other option,
+# PROJECT_DERIVED_FILE_DIR, is unsuitable because while it is project-specific,
+# it is not configuration-specific. INTERMEDIATE_DIR is defined as
+# $(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION).
+_intermediate_var = 'INTERMEDIATE_DIR'
+
+# SHARED_INTERMEDIATE_DIR is the same, except that it is shared among all
+# targets that share the same BUILT_PRODUCTS_DIR.
+_shared_intermediate_var = 'SHARED_INTERMEDIATE_DIR'
+
+_library_search_paths_var = 'LIBRARY_SEARCH_PATHS'
+
+generator_default_variables = {
+ 'EXECUTABLE_PREFIX': '',
+ 'EXECUTABLE_SUFFIX': '',
+ 'STATIC_LIB_PREFIX': 'lib',
+ 'SHARED_LIB_PREFIX': 'lib',
+ 'STATIC_LIB_SUFFIX': '.a',
+ 'SHARED_LIB_SUFFIX': '.dylib',
+ # INTERMEDIATE_DIR is a place for targets to build up intermediate products.
+ # It is specific to each build environment. It is only guaranteed to exist
+ # and be constant within the context of a project, corresponding to a single
+ # input file. Some build environments may allow their intermediate directory
+ # to be shared on a wider scale, but this is not guaranteed.
+ 'INTERMEDIATE_DIR': '$(%s)' % _intermediate_var,
+ 'OS': 'mac',
+ 'PRODUCT_DIR': '$(BUILT_PRODUCTS_DIR)',
+ 'LIB_DIR': '$(BUILT_PRODUCTS_DIR)',
+ 'RULE_INPUT_ROOT': '$(INPUT_FILE_BASE)',
+ 'RULE_INPUT_EXT': '$(INPUT_FILE_SUFFIX)',
+ 'RULE_INPUT_NAME': '$(INPUT_FILE_NAME)',
+ 'RULE_INPUT_PATH': '$(INPUT_FILE_PATH)',
+ 'SHARED_INTERMEDIATE_DIR': '$(%s)' % _shared_intermediate_var,
+ 'CONFIGURATION_NAME': '$(CONFIGURATION)',
+}
+
+# The Xcode-specific sections that hold paths.
+generator_additional_path_sections = [
+ 'mac_bundle_resources',
+ 'mac_framework_headers',
+ 'mac_framework_private_headers',
+ # 'mac_framework_dirs', input already handles _dirs endings.
+]
+
+# The Xcode-specific keys that exist on targets and aren't moved down to
+# configurations.
+generator_additional_non_configuration_keys = [
+ 'mac_bundle',
+ 'mac_bundle_resources',
+ 'mac_framework_headers',
+ 'mac_framework_private_headers',
+ 'xcode_create_dependents_test_runner',
+]
+
+# We want to let any rules apply to files that are resources also.
+generator_extra_sources_for_rules = [
+ 'mac_bundle_resources',
+ 'mac_framework_headers',
+ 'mac_framework_private_headers',
+]
+
+# Xcode's standard set of library directories, which don't need to be duplicated
+# in LIBRARY_SEARCH_PATHS. This list is not exhaustive, but that's okay.
+xcode_standard_library_dirs = frozenset([
+ '$(SDKROOT)/usr/lib',
+ '$(SDKROOT)/usr/local/lib',
+])
+
+def CreateXCConfigurationList(configuration_names):
+ xccl = gyp.xcodeproj_file.XCConfigurationList({'buildConfigurations': []})
+ if len(configuration_names) == 0:
+ configuration_names = ['Default']
+ for configuration_name in configuration_names:
+ xcbc = gyp.xcodeproj_file.XCBuildConfiguration({
+ 'name': configuration_name})
+ xccl.AppendProperty('buildConfigurations', xcbc)
+ xccl.SetProperty('defaultConfigurationName', configuration_names[0])
+ return xccl
+
+
+class XcodeProject(object):
+ def __init__(self, gyp_path, path, build_file_dict):
+ self.gyp_path = gyp_path
+ self.path = path
+ self.project = gyp.xcodeproj_file.PBXProject(path=path)
+ projectDirPath = gyp.common.RelativePath(
+ os.path.dirname(os.path.abspath(self.gyp_path)),
+ os.path.dirname(path) or '.')
+ self.project.SetProperty('projectDirPath', projectDirPath)
+ self.project_file = \
+ gyp.xcodeproj_file.XCProjectFile({'rootObject': self.project})
+ self.build_file_dict = build_file_dict
+
+ # TODO(mark): add destructor that cleans up self.path if created_dir is
+ # True and things didn't complete successfully. Or do something even
+ # better with "try"?
+ self.created_dir = False
+ try:
+ os.makedirs(self.path)
+ self.created_dir = True
+ except OSError, e:
+ if e.errno != errno.EEXIST:
+ raise
+
+ def Finalize1(self, xcode_targets, serialize_all_tests):
+ # Collect a list of all of the build configuration names used by the
+ # various targets in the file. It is very heavily advised to keep each
+ # target in an entire project (even across multiple project files) using
+ # the same set of configuration names.
+ configurations = []
+ for xct in self.project.GetProperty('targets'):
+ xccl = xct.GetProperty('buildConfigurationList')
+ xcbcs = xccl.GetProperty('buildConfigurations')
+ for xcbc in xcbcs:
+ name = xcbc.GetProperty('name')
+ if name not in configurations:
+ configurations.append(name)
+
+ # Replace the XCConfigurationList attached to the PBXProject object with
+ # a new one specifying all of the configuration names used by the various
+ # targets.
+ try:
+ xccl = CreateXCConfigurationList(configurations)
+ self.project.SetProperty('buildConfigurationList', xccl)
+ except:
+ import sys
+ sys.stderr.write("Problem with gyp file %s\n" % self.gyp_path)
+ raise
+
+ # The need for this setting is explained above where _intermediate_var is
+ # defined. The comments below about wanting to avoid project-wide build
+ # settings apply here too, but this needs to be set on a project-wide basis
+ # so that files relative to the _intermediate_var setting can be displayed
+ # properly in the Xcode UI.
+ #
+ # Note that for configuration-relative files such as anything relative to
+ # _intermediate_var, for the purposes of UI tree view display, Xcode will
+ # only resolve the configuration name once, when the project file is
+ # opened. If the active build configuration is changed, the project file
+ # must be closed and reopened if it is desired for the tree view to update.
+ # This is filed as Apple radar 6588391.
+ xccl.SetBuildSetting(_intermediate_var,
+ '$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)')
+ xccl.SetBuildSetting(_shared_intermediate_var,
+ '$(SYMROOT)/DerivedSources/$(CONFIGURATION)')
+
+ # Set user-specified project-wide build settings and config files. This
+ # is intended to be used very sparingly. Really, almost everything should
+ # go into target-specific build settings sections. The project-wide
+ # settings are only intended to be used in cases where Xcode attempts to
+ # resolve variable references in a project context as opposed to a target
+ # context, such as when resolving sourceTree references while building up
+ # the tree tree view for UI display.
+ # Any values set globally are applied to all configurations, then any
+ # per-configuration values are applied.
+ for xck, xcv in self.build_file_dict.get('xcode_settings', {}).iteritems():
+ xccl.SetBuildSetting(xck, xcv)
+ if 'xcode_config_file' in self.build_file_dict:
+ config_ref = self.project.AddOrGetFileInRootGroup(
+ self.build_file_dict['xcode_config_file'])
+ xccl.SetBaseConfiguration(config_ref)
+ build_file_configurations = self.build_file_dict.get('configurations', {})
+ if build_file_configurations:
+ for config_name in configurations:
+ build_file_configuration_named = \
+ build_file_configurations.get(config_name, {})
+ if build_file_configuration_named:
+ xcc = xccl.ConfigurationNamed(config_name)
+ for xck, xcv in build_file_configuration_named.get('xcode_settings',
+ {}).iteritems():
+ xcc.SetBuildSetting(xck, xcv)
+ if 'xcode_config_file' in build_file_configuration_named:
+ config_ref = self.project.AddOrGetFileInRootGroup(
+ build_file_configurations[config_name]['xcode_config_file'])
+ xcc.SetBaseConfiguration(config_ref)
+
+ # Sort the targets based on how they appeared in the input.
+ # TODO(mark): Like a lot of other things here, this assumes internal
+ # knowledge of PBXProject - in this case, of its "targets" property.
+
+ # ordinary_targets are ordinary targets that are already in the project
+ # file. run_test_targets are the targets that run unittests and should be
+ # used for the Run All Tests target. support_targets are the action/rule
+ # targets used by GYP file targets, just kept for the assert check.
+ ordinary_targets = []
+ run_test_targets = []
+ support_targets = []
+
+ # targets is full list of targets in the project.
+ targets = []
+
+ # does the it define it's own "all"?
+ has_custom_all = False
+
+ # targets_for_all is the list of ordinary_targets that should be listed
+ # in this project's "All" target. It includes each non_runtest_target
+ # that does not have suppress_wildcard set.
+ targets_for_all = []
+
+ for target in self.build_file_dict['targets']:
+ target_name = target['target_name']
+ toolset = target['toolset']
+ qualified_target = gyp.common.QualifiedTarget(self.gyp_path, target_name,
+ toolset)
+ xcode_target = xcode_targets[qualified_target]
+ # Make sure that the target being added to the sorted list is already in
+ # the unsorted list.
+ assert xcode_target in self.project._properties['targets']
+ targets.append(xcode_target)
+ ordinary_targets.append(xcode_target)
+ if xcode_target.support_target:
+ support_targets.append(xcode_target.support_target)
+ targets.append(xcode_target.support_target)
+
+ if not int(target.get('suppress_wildcard', False)):
+ targets_for_all.append(xcode_target)
+
+ if target_name.lower() == 'all':
+ has_custom_all = True;
+
+ # If this target has a 'run_as' attribute, add its target to the
+ # targets, and add it to the test targets.
+ if target.get('run_as'):
+ # Make a target to run something. It should have one
+ # dependency, the parent xcode target.
+ xccl = CreateXCConfigurationList(configurations)
+ run_target = gyp.xcodeproj_file.PBXAggregateTarget({
+ 'name': 'Run ' + target_name,
+ 'productName': xcode_target.GetProperty('productName'),
+ 'buildConfigurationList': xccl,
+ },
+ parent=self.project)
+ run_target.AddDependency(xcode_target)
+
+ command = target['run_as']
+ script = ''
+ if command.get('working_directory'):
+ script = script + 'cd "%s"\n' % \
+ gyp.xcodeproj_file.ConvertVariablesToShellSyntax(
+ command.get('working_directory'))
+
+ if command.get('environment'):
+ script = script + "\n".join(
+ ['export %s="%s"' %
+ (key, gyp.xcodeproj_file.ConvertVariablesToShellSyntax(val))
+ for (key, val) in command.get('environment').iteritems()]) + "\n"
+
+ # Some test end up using sockets, files on disk, etc. and can get
+ # confused if more then one test runs at a time. The generator
+ # flag 'xcode_serialize_all_test_runs' controls the forcing of all
+ # tests serially. It defaults to True. To get serial runs this
+ # little bit of python does the same as the linux flock utility to
+ # make sure only one runs at a time.
+ command_prefix = ''
+ if serialize_all_tests:
+ command_prefix = \
+"""python -c "import fcntl, subprocess, sys
+file = open('$TMPDIR/GYP_serialize_test_runs', 'a')
+fcntl.flock(file.fileno(), fcntl.LOCK_EX)
+sys.exit(subprocess.call(sys.argv[1:]))" """
+
+ # If we were unable to exec for some reason, we want to exit
+ # with an error, and fixup variable references to be shell
+ # syntax instead of xcode syntax.
+ script = script + 'exec ' + command_prefix + '%s\nexit 1\n' % \
+ gyp.xcodeproj_file.ConvertVariablesToShellSyntax(
+ gyp.common.EncodePOSIXShellList(command.get('action')))
+
+ ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({
+ 'shellScript': script,
+ 'showEnvVarsInLog': 0,
+ })
+ run_target.AppendProperty('buildPhases', ssbp)
+
+ # Add the run target to the project file.
+ targets.append(run_target)
+ run_test_targets.append(run_target)
+ xcode_target.test_runner = run_target
+
+
+ # Make sure that the list of targets being replaced is the same length as
+ # the one replacing it, but allow for the added test runner targets.
+ assert len(self.project._properties['targets']) == \
+ len(ordinary_targets) + len(support_targets)
+
+ self.project._properties['targets'] = targets
+
+ # Get rid of unnecessary levels of depth in groups like the Source group.
+ self.project.RootGroupsTakeOverOnlyChildren(True)
+
+ # Sort the groups nicely. Do this after sorting the targets, because the
+ # Products group is sorted based on the order of the targets.
+ self.project.SortGroups()
+
+ # Create an "All" target if there's more than one target in this project
+ # file and the project didn't define its own "All" target. Put a generated
+ # "All" target first so that people opening up the project for the first
+ # time will build everything by default.
+ if len(targets_for_all) > 1 and not has_custom_all:
+ xccl = CreateXCConfigurationList(configurations)
+ all_target = gyp.xcodeproj_file.PBXAggregateTarget(
+ {
+ 'buildConfigurationList': xccl,
+ 'name': 'All',
+ },
+ parent=self.project)
+
+ for target in targets_for_all:
+ all_target.AddDependency(target)
+
+ # TODO(mark): This is evil because it relies on internal knowledge of
+ # PBXProject._properties. It's important to get the "All" target first,
+ # though.
+ self.project._properties['targets'].insert(0, all_target)
+
+ # The same, but for run_test_targets.
+ if len(run_test_targets) > 1:
+ xccl = CreateXCConfigurationList(configurations)
+ run_all_tests_target = gyp.xcodeproj_file.PBXAggregateTarget(
+ {
+ 'buildConfigurationList': xccl,
+ 'name': 'Run All Tests',
+ },
+ parent=self.project)
+ for run_test_target in run_test_targets:
+ run_all_tests_target.AddDependency(run_test_target)
+
+ # Insert after the "All" target, which must exist if there is more than
+ # one run_test_target.
+ self.project._properties['targets'].insert(1, run_all_tests_target)
+
+ def Finalize2(self, xcode_targets, xcode_target_to_target_dict):
+ # Finalize2 needs to happen in a separate step because the process of
+ # updating references to other projects depends on the ordering of targets
+ # within remote project files. Finalize1 is responsible for sorting duty,
+ # and once all project files are sorted, Finalize2 can come in and update
+ # these references.
+
+ # To support making a "test runner" target that will run all the tests
+ # that are direct dependents of any given target, we look for
+ # xcode_create_dependents_test_runner being set on an Aggregate target,
+ # and generate a second target that will run the tests runners found under
+ # the marked target.
+ for bf_tgt in self.build_file_dict['targets']:
+ if int(bf_tgt.get('xcode_create_dependents_test_runner', 0)):
+ tgt_name = bf_tgt['target_name']
+ toolset = bf_tgt['toolset']
+ qualified_target = gyp.common.QualifiedTarget(self.gyp_path,
+ tgt_name, toolset)
+ xcode_target = xcode_targets[qualified_target]
+ if isinstance(xcode_target, gyp.xcodeproj_file.PBXAggregateTarget):
+ # Collect all the run test targets.
+ all_run_tests = []
+ pbxtds = xcode_target.GetProperty('dependencies')
+ for pbxtd in pbxtds:
+ pbxcip = pbxtd.GetProperty('targetProxy')
+ dependency_xct = pbxcip.GetProperty('remoteGlobalIDString')
+ if hasattr(dependency_xct, 'test_runner'):
+ all_run_tests.append(dependency_xct.test_runner)
+
+ # Directly depend on all the runners as they depend on the target
+ # that builds them.
+ if len(all_run_tests) > 0:
+ run_all_target = gyp.xcodeproj_file.PBXAggregateTarget({
+ 'name': 'Run %s Tests' % tgt_name,
+ 'productName': tgt_name,
+ },
+ parent=self.project)
+ for run_test_target in all_run_tests:
+ run_all_target.AddDependency(run_test_target)
+
+ # Insert the test runner after the related target.
+ idx = self.project._properties['targets'].index(xcode_target)
+ self.project._properties['targets'].insert(idx + 1, run_all_target)
+
+ # Update all references to other projects, to make sure that the lists of
+ # remote products are complete. Otherwise, Xcode will fill them in when
+ # it opens the project file, which will result in unnecessary diffs.
+ # TODO(mark): This is evil because it relies on internal knowledge of
+ # PBXProject._other_pbxprojects.
+ for other_pbxproject in self.project._other_pbxprojects.keys():
+ self.project.AddOrGetProjectReference(other_pbxproject)
+
+ self.project.SortRemoteProductReferences()
+
+ # Give everything an ID.
+ self.project_file.ComputeIDs()
+
+ # Make sure that no two objects in the project file have the same ID. If
+ # multiple objects wind up with the same ID, upon loading the file, Xcode
+ # will only recognize one object (the last one in the file?) and the
+ # results are unpredictable.
+ self.project_file.EnsureNoIDCollisions()
+
+ def Write(self):
+ # Write the project file to a temporary location first. Xcode watches for
+ # changes to the project file and presents a UI sheet offering to reload
+ # the project when it does change. However, in some cases, especially when
+ # multiple projects are open or when Xcode is busy, things don't work so
+ # seamlessly. Sometimes, Xcode is able to detect that a project file has
+ # changed but can't unload it because something else is referencing it.
+ # To mitigate this problem, and to avoid even having Xcode present the UI
+ # sheet when an open project is rewritten for inconsequential changes, the
+ # project file is written to a temporary file in the xcodeproj directory
+ # first. The new temporary file is then compared to the existing project
+ # file, if any. If they differ, the new file replaces the old; otherwise,
+ # the new project file is simply deleted. Xcode properly detects a file
+ # being renamed over an open project file as a change and so it remains
+ # able to present the "project file changed" sheet under this system.
+ # Writing to a temporary file first also avoids the possible problem of
+ # Xcode rereading an incomplete project file.
+ (output_fd, new_pbxproj_path) = \
+ tempfile.mkstemp(suffix='.tmp', prefix='project.pbxproj.gyp.',
+ dir=self.path)
+
+ try:
+ output_file = os.fdopen(output_fd, 'wb')
+
+ self.project_file.Print(output_file)
+ output_file.close()
+
+ pbxproj_path = os.path.join(self.path, 'project.pbxproj')
+
+ same = False
+ try:
+ same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False)
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+
+ if same:
+ # The new file is identical to the old one, just get rid of the new
+ # one.
+ os.unlink(new_pbxproj_path)
+ else:
+ # The new file is different from the old one, or there is no old one.
+ # Rename the new file to the permanent name.
+ #
+ # tempfile.mkstemp uses an overly restrictive mode, resulting in a
+ # file that can only be read by the owner, regardless of the umask.
+ # There's no reason to not respect the umask here, which means that
+ # an extra hoop is required to fetch it and reset the new file's mode.
+ #
+ # No way to get the umask without setting a new one? Set a safe one
+ # and then set it back to the old value.
+ umask = os.umask(077)
+ os.umask(umask)
+
+ os.chmod(new_pbxproj_path, 0666 & ~umask)
+ os.rename(new_pbxproj_path, pbxproj_path)
+
+ except Exception:
+ # Don't leave turds behind. In fact, if this code was responsible for
+ # creating the xcodeproj directory, get rid of that too.
+ os.unlink(new_pbxproj_path)
+ if self.created_dir:
+ shutil.rmtree(self.path, True)
+ raise
+
+
+cached_xcode_version = None
+def InstalledXcodeVersion():
+ """Fetches the installed version of Xcode, returns empty string if it is
+ unable to figure it out."""
+
+ global cached_xcode_version
+ if not cached_xcode_version is None:
+ return cached_xcode_version
+
+ # Default to an empty string
+ cached_xcode_version = ''
+
+ # Collect the xcodebuild's version information.
+ try:
+ import subprocess
+ cmd = ['/usr/bin/xcodebuild', '-version']
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ xcodebuild_version_info = proc.communicate()[0]
+ # Any error, return empty string
+ if proc.returncode:
+ xcodebuild_version_info = ''
+ except OSError:
+ # We failed to launch the tool
+ xcodebuild_version_info = ''
+
+ # Pull out the Xcode version itself.
+ match_line = re.search('^Xcode (.*)$', xcodebuild_version_info, re.MULTILINE)
+ if match_line:
+ cached_xcode_version = match_line.group(1)
+ # Done!
+ return cached_xcode_version
+
+
+def AddSourceToTarget(source, pbxp, xct):
+ # TODO(mark): Perhaps source_extensions and library_extensions can be made a
+ # little bit fancier.
+ source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's']
+
+ # .o is conceptually more of a "source" than a "library," but Xcode thinks
+ # of "sources" as things to compile and "libraries" (or "frameworks") as
+ # things to link with. Adding an object file to an Xcode target's frameworks
+ # phase works properly.
+ library_extensions = ['a', 'dylib', 'framework', 'o']
+
+ basename = posixpath.basename(source)
+ (root, ext) = posixpath.splitext(basename)
+ if ext != '':
+ ext = ext[1:].lower()
+
+ if ext in source_extensions:
+ xct.SourcesPhase().AddFile(source)
+ elif ext in library_extensions:
+ xct.FrameworksPhase().AddFile(source)
+ else:
+ # Files that aren't added to a sources or frameworks build phase can still
+ # go into the project file, just not as part of a build phase.
+ pbxp.AddOrGetFileInRootGroup(source)
+
+
+def AddResourceToTarget(resource, pbxp, xct):
+ # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call
+ # where it's used.
+ xct.ResourcesPhase().AddFile(resource)
+
+
+def AddHeaderToTarget(header, pbxp, xct, is_public):
+ # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call
+ # where it's used.
+ settings = '{ATTRIBUTES = (%s, ); }' % ('Private', 'Public')[is_public]
+ xct.HeadersPhase().AddFile(header, settings)
+
+
+_xcode_variable_re = re.compile('(\$\((.*?)\))')
+def ExpandXcodeVariables(string, expansions):
+ """Expands Xcode-style $(VARIABLES) in string per the expansions dict.
+
+ In some rare cases, it is appropriate to expand Xcode variables when a
+ project file is generated. For any substring $(VAR) in string, if VAR is a
+ key in the expansions dict, $(VAR) will be replaced with expansions[VAR].
+ Any $(VAR) substring in string for which VAR is not a key in the expansions
+ dict will remain in the returned string.
+ """
+
+ matches = _xcode_variable_re.findall(string)
+ if matches == None:
+ return string
+
+ matches.reverse()
+ for match in matches:
+ (to_replace, variable) = match
+ if not variable in expansions:
+ continue
+
+ replacement = expansions[variable]
+ string = re.sub(re.escape(to_replace), replacement, string)
+
+ return string
+
+
+def EscapeXCodeArgument(s):
+ """We must escape the arguments that we give to XCode so that it knows not to
+ split on spaces and to respect backslash and quote literals."""
+ s = s.replace('\\', '\\\\')
+ s = s.replace('"', '\\"')
+ return '"' + s + '"'
+
+
+def GenerateOutput(target_list, target_dicts, data, params):
+ options = params['options']
+ generator_flags = params.get('generator_flags', {})
+ parallel_builds = generator_flags.get('xcode_parallel_builds', True)
+ serialize_all_tests = \
+ generator_flags.get('xcode_serialize_all_test_runs', True)
+ project_version = generator_flags.get('xcode_project_version', None)
+ skip_excluded_files = \
+ not generator_flags.get('xcode_list_excluded_files', True)
+ xcode_projects = {}
+ for build_file, build_file_dict in data.iteritems():
+ (build_file_root, build_file_ext) = os.path.splitext(build_file)
+ if build_file_ext != '.gyp':
+ continue
+ xcodeproj_path = build_file_root + options.suffix + '.xcodeproj'
+ if options.generator_output:
+ xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path)
+ xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict)
+ xcode_projects[build_file] = xcp
+ pbxp = xcp.project
+
+ if parallel_builds:
+ pbxp.SetProperty('attributes',
+ {'BuildIndependentTargetsInParallel': 'YES'})
+ if project_version:
+ xcp.project_file.SetXcodeVersion(project_version)
+
+ main_group = pbxp.GetProperty('mainGroup')
+ build_group = gyp.xcodeproj_file.PBXGroup({'name': 'Build'})
+ main_group.AppendChild(build_group)
+ for included_file in build_file_dict['included_files']:
+ build_group.AddOrGetFileByPath(included_file, False)
+
+ xcode_targets = {}
+ xcode_target_to_target_dict = {}
+ for qualified_target in target_list:
+ [build_file, target_name, toolset] = \
+ gyp.common.ParseQualifiedTarget(qualified_target)
+
+ spec = target_dicts[qualified_target]
+ if spec['toolset'] != 'target':
+ raise Exception(
+ 'Multiple toolsets not supported in xcode build (target %s)' %
+ qualified_target)
+ configuration_names = [spec['default_configuration']]
+ for configuration_name in sorted(spec['configurations'].keys()):
+ if configuration_name not in configuration_names:
+ configuration_names.append(configuration_name)
+ xcp = xcode_projects[build_file]
+ pbxp = xcp.project
+
+ # Set up the configurations for the target according to the list of names
+ # supplied.
+ xccl = CreateXCConfigurationList(configuration_names)
+
+ # Create an XCTarget subclass object for the target. The type with
+ # "+bundle" appended will be used if the target has "mac_bundle" set.
+ # loadable_modules not in a mac_bundle are mapped to
+ # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets
+ # to create a single-file mh_bundle.
+ _types = {
+ 'executable': 'com.apple.product-type.tool',
+ 'loadable_module': 'com.googlecode.gyp.xcode.bundle',
+ 'shared_library': 'com.apple.product-type.library.dynamic',
+ 'static_library': 'com.apple.product-type.library.static',
+ 'executable+bundle': 'com.apple.product-type.application',
+ 'loadable_module+bundle': 'com.apple.product-type.bundle',
+ 'shared_library+bundle': 'com.apple.product-type.framework',
+ }
+
+ target_properties = {
+ 'buildConfigurationList': xccl,
+ 'name': target_name,
+ }
+
+ type = spec['type']
+ is_bundle = int(spec.get('mac_bundle', 0))
+ if type != 'none':
+ type_bundle_key = type
+ if is_bundle:
+ type_bundle_key += '+bundle'
+ xctarget_type = gyp.xcodeproj_file.PBXNativeTarget
+ try:
+ target_properties['productType'] = _types[type_bundle_key]
+ except KeyError, e:
+ gyp.common.ExceptionAppend(e, "-- unknown product type while "
+ "writing target %s" % target_name)
+ raise
+ else:
+ xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget
+
+ target_product_name = spec.get('product_name')
+ if target_product_name is not None:
+ target_properties['productName'] = target_product_name
+
+ xct = xctarget_type(target_properties, parent=pbxp,
+ force_outdir=spec.get('product_dir'),
+ force_prefix=spec.get('product_prefix'),
+ force_extension=spec.get('product_extension'))
+ pbxp.AppendProperty('targets', xct)
+ xcode_targets[qualified_target] = xct
+ xcode_target_to_target_dict[xct] = spec
+
+ spec_actions = spec.get('actions', [])
+ spec_rules = spec.get('rules', [])
+
+ # Xcode has some "issues" with checking dependencies for the "Compile
+ # sources" step with any source files/headers generated by actions/rules.
+ # To work around this, if a target is building anything directly (not
+ # type "none"), then a second target as used to run the GYP actions/rules
+ # and is made a dependency of this target. This way the work is done
+ # before the dependency checks for what should be recompiled.
+ support_xct = None
+ if type != 'none' and (spec_actions or spec_rules):
+ support_xccl = CreateXCConfigurationList(configuration_names);
+ support_target_properties = {
+ 'buildConfigurationList': support_xccl,
+ 'name': target_name + ' Support',
+ }
+ if target_product_name:
+ support_target_properties['productName'] = \
+ target_product_name + ' Support'
+ support_xct = \
+ gyp.xcodeproj_file.PBXAggregateTarget(support_target_properties,
+ parent=pbxp)
+ pbxp.AppendProperty('targets', support_xct)
+ xct.AddDependency(support_xct)
+ # Hang the support target off the main target so it can be tested/found
+ # by the generator during Finalize.
+ xct.support_target = support_xct
+
+ prebuild_index = 0
+
+ # Add custom shell script phases for "actions" sections.
+ for action in spec_actions:
+ # There's no need to write anything into the script to ensure that the
+ # output directories already exist, because Xcode will look at the
+ # declared outputs and automatically ensure that they exist for us.
+
+ # Do we have a message to print when this action runs?
+ message = action.get('message')
+ if message:
+ message = 'echo note: ' + gyp.common.EncodePOSIXShellArgument(message)
+ else:
+ message = ''
+
+ # Turn the list into a string that can be passed to a shell.
+ action_string = gyp.common.EncodePOSIXShellList(action['action'])
+
+ # Convert Xcode-type variable references to sh-compatible environment
+ # variable references.
+ message_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax(message)
+ action_string_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax(
+ action_string)
+
+ script = ''
+ # Include the optional message
+ if message_sh:
+ script += message_sh + '\n'
+ # Be sure the script runs in exec, and that if exec fails, the script
+ # exits signalling an error.
+ script += 'exec ' + action_string_sh + '\nexit 1\n'
+ ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({
+ 'inputPaths': action['inputs'],
+ 'name': 'Action "' + action['action_name'] + '"',
+ 'outputPaths': action['outputs'],
+ 'shellScript': script,
+ 'showEnvVarsInLog': 0,
+ })
+
+ if support_xct:
+ support_xct.AppendProperty('buildPhases', ssbp)
+ else:
+ # TODO(mark): this assumes too much knowledge of the internals of
+ # xcodeproj_file; some of these smarts should move into xcodeproj_file
+ # itself.
+ xct._properties['buildPhases'].insert(prebuild_index, ssbp)
+ prebuild_index = prebuild_index + 1
+
+ # TODO(mark): Should verify that at most one of these is specified.
+ if int(action.get('process_outputs_as_sources', False)):
+ for output in action['outputs']:
+ AddSourceToTarget(output, pbxp, xct)
+
+ if int(action.get('process_outputs_as_mac_bundle_resources', False)):
+ for output in action['outputs']:
+ AddResourceToTarget(output, pbxp, xct)
+
+ # tgt_mac_bundle_resources holds the list of bundle resources so
+ # the rule processing can check against it.
+ if is_bundle:
+ tgt_mac_bundle_resources = spec.get('mac_bundle_resources', [])
+ else:
+ tgt_mac_bundle_resources = []
+
+ # Add custom shell script phases driving "make" for "rules" sections.
+ #
+ # Xcode's built-in rule support is almost powerful enough to use directly,
+ # but there are a few significant deficiencies that render them unusable.
+ # There are workarounds for some of its inadequacies, but in aggregate,
+ # the workarounds added complexity to the generator, and some workarounds
+ # actually require input files to be crafted more carefully than I'd like.
+ # Consequently, until Xcode rules are made more capable, "rules" input
+ # sections will be handled in Xcode output by shell script build phases
+ # performed prior to the compilation phase.
+ #
+ # The following problems with Xcode rules were found. The numbers are
+ # Apple radar IDs. I hope that these shortcomings are addressed, I really
+ # liked having the rules handled directly in Xcode during the period that
+ # I was prototyping this.
+ #
+ # 6588600 Xcode compiles custom script rule outputs too soon, compilation
+ # fails. This occurs when rule outputs from distinct inputs are
+ # interdependent. The only workaround is to put rules and their
+ # inputs in a separate target from the one that compiles the rule
+ # outputs. This requires input file cooperation and it means that
+ # process_outputs_as_sources is unusable.
+ # 6584932 Need to declare that custom rule outputs should be excluded from
+ # compilation. A possible workaround is to lie to Xcode about a
+ # rule's output, giving it a dummy file it doesn't know how to
+ # compile. The rule action script would need to touch the dummy.
+ # 6584839 I need a way to declare additional inputs to a custom rule.
+ # A possible workaround is a shell script phase prior to
+ # compilation that touches a rule's primary input files if any
+ # would-be additional inputs are newer than the output. Modifying
+ # the source tree - even just modification times - feels dirty.
+ # 6564240 Xcode "custom script" build rules always dump all environment
+ # variables. This is a low-prioroty problem and is not a
+ # show-stopper.
+ rules_by_ext = {}
+ for rule in spec_rules:
+ rules_by_ext[rule['extension']] = rule
+
+ # First, some definitions:
+ #
+ # A "rule source" is a file that was listed in a target's "sources"
+ # list and will have a rule applied to it on the basis of matching the
+ # rule's "extensions" attribute. Rule sources are direct inputs to
+ # rules.
+ #
+ # Rule definitions may specify additional inputs in their "inputs"
+ # attribute. These additional inputs are used for dependency tracking
+ # purposes.
+ #
+ # A "concrete output" is a rule output with input-dependent variables
+ # resolved. For example, given a rule with:
+ # 'extension': 'ext', 'outputs': ['$(INPUT_FILE_BASE).cc'],
+ # if the target's "sources" list contained "one.ext" and "two.ext",
+ # the "concrete output" for rule input "two.ext" would be "two.cc". If
+ # a rule specifies multiple outputs, each input file that the rule is
+ # applied to will have the same number of concrete outputs.
+ #
+ # If any concrete outputs are outdated or missing relative to their
+ # corresponding rule_source or to any specified additional input, the
+ # rule action must be performed to generate the concrete outputs.
+
+ # concrete_outputs_by_rule_source will have an item at the same index
+ # as the rule['rule_sources'] that it corresponds to. Each item is a
+ # list of all of the concrete outputs for the rule_source.
+ concrete_outputs_by_rule_source = []
+
+ # concrete_outputs_all is a flat list of all concrete outputs that this
+ # rule is able to produce, given the known set of input files
+ # (rule_sources) that apply to it.
+ concrete_outputs_all = []
+
+ # messages & actions are keyed by the same indices as rule['rule_sources']
+ # and concrete_outputs_by_rule_source. They contain the message and
+ # action to perform after resolving input-dependent variables. The
+ # message is optional, in which case None is stored for each rule source.
+ messages = []
+ actions = []
+
+ for rule_source in rule.get('rule_sources', []):
+ rule_source_basename = posixpath.basename(rule_source)
+ (rule_source_root, rule_source_ext) = \
+ posixpath.splitext(rule_source_basename)
+
+ # These are the same variable names that Xcode uses for its own native
+ # rule support. Because Xcode's rule engine is not being used, they
+ # need to be expanded as they are written to the makefile.
+ rule_input_dict = {
+ 'INPUT_FILE_BASE': rule_source_root,
+ 'INPUT_FILE_SUFFIX': rule_source_ext,
+ 'INPUT_FILE_NAME': rule_source_basename,
+ 'INPUT_FILE_PATH': rule_source,
+ }
+
+ concrete_outputs_for_this_rule_source = []
+ for output in rule.get('outputs', []):
+ # Fortunately, Xcode and make both use $(VAR) format for their
+ # variables, so the expansion is the only transformation necessary.
+ # Any remaning $(VAR)-type variables in the string can be given
+ # directly to make, which will pick up the correct settings from
+ # what Xcode puts into the environment.
+ concrete_output = ExpandXcodeVariables(output, rule_input_dict)
+ concrete_outputs_for_this_rule_source.append(concrete_output)
+
+ # Add all concrete outputs to the project.
+ pbxp.AddOrGetFileInRootGroup(concrete_output)
+
+ concrete_outputs_by_rule_source.append( \
+ concrete_outputs_for_this_rule_source)
+ concrete_outputs_all.extend(concrete_outputs_for_this_rule_source)
+
+ # TODO(mark): Should verify that at most one of these is specified.
+ if int(rule.get('process_outputs_as_sources', False)):
+ for output in concrete_outputs_for_this_rule_source:
+ AddSourceToTarget(output, pbxp, xct)
+
+ # If the file came from the mac_bundle_resources list or if the rule
+ # is marked to process outputs as bundle resource, do so.
+ was_mac_bundle_resource = rule_source in tgt_mac_bundle_resources
+ if was_mac_bundle_resource or \
+ int(rule.get('process_outputs_as_mac_bundle_resources', False)):
+ for output in concrete_outputs_for_this_rule_source:
+ AddResourceToTarget(output, pbxp, xct)
+
+ # Do we have a message to print when this rule runs?
+ message = rule.get('message')
+ if message:
+ message = gyp.common.EncodePOSIXShellArgument(message)
+ message = ExpandXcodeVariables(message, rule_input_dict)
+ messages.append(message)
+
+ # Turn the list into a string that can be passed to a shell.
+ action_string = gyp.common.EncodePOSIXShellList(rule['action'])
+
+ action = ExpandXcodeVariables(action_string, rule_input_dict)
+ actions.append(action)
+
+ if len(concrete_outputs_all) > 0:
+ # TODO(mark): There's a possibilty for collision here. Consider
+ # target "t" rule "A_r" and target "t_A" rule "r".
+ makefile_name = '%s_%s.make' % (target_name, rule['rule_name'])
+ makefile_path = os.path.join(xcode_projects[build_file].path,
+ makefile_name)
+ # TODO(mark): try/close? Write to a temporary file and swap it only
+ # if it's got changes?
+ makefile = open(makefile_path, 'wb')
+
+ # make will build the first target in the makefile by default. By
+ # convention, it's called "all". List all (or at least one)
+ # concrete output for each rule source as a prerequisite of the "all"
+ # target.
+ makefile.write('all: \\\n')
+ for concrete_output_index in \
+ xrange(0, len(concrete_outputs_by_rule_source)):
+ # Only list the first (index [0]) concrete output of each input
+ # in the "all" target. Otherwise, a parallel make (-j > 1) would
+ # attempt to process each input multiple times simultaneously.
+ # Otherwise, "all" could just contain the entire list of
+ # concrete_outputs_all.
+ concrete_output = \
+ concrete_outputs_by_rule_source[concrete_output_index][0]
+ if concrete_output_index == len(concrete_outputs_by_rule_source) - 1:
+ eol = ''
+ else:
+ eol = ' \\'
+ makefile.write(' %s%s\n' % (concrete_output, eol))
+
+ for (rule_source, concrete_outputs, message, action) in \
+ zip(rule['rule_sources'], concrete_outputs_by_rule_source,
+ messages, actions):
+ makefile.write('\n')
+
+ # Add a rule that declares it can build each concrete output of a
+ # rule source. Collect the names of the directories that are
+ # required.
+ concrete_output_dirs = []
+ for concrete_output_index in xrange(0, len(concrete_outputs)):
+ concrete_output = concrete_outputs[concrete_output_index]
+ if concrete_output_index == 0:
+ bol = ''
+ else:
+ bol = ' '
+ makefile.write('%s%s \\\n' % (bol, concrete_output))
+
+ concrete_output_dir = posixpath.dirname(concrete_output)
+ if (concrete_output_dir and
+ concrete_output_dir not in concrete_output_dirs):
+ concrete_output_dirs.append(concrete_output_dir)
+
+ makefile.write(' : \\\n')
+
+ # The prerequisites for this rule are the rule source itself and
+ # the set of additional rule inputs, if any.
+ prerequisites = [rule_source]
+ prerequisites.extend(rule.get('inputs', []))
+ for prerequisite_index in xrange(0, len(prerequisites)):
+ prerequisite = prerequisites[prerequisite_index]
+ if prerequisite_index == len(prerequisites) - 1:
+ eol = ''
+ else:
+ eol = ' \\'
+ makefile.write(' %s%s\n' % (prerequisite, eol))
+
+ # Make sure that output directories exist before executing the rule
+ # action.
+ if len(concrete_output_dirs) > 0:
+ makefile.write('\t@mkdir -p "%s"\n' %
+ '" "'.join(concrete_output_dirs))
+
+ # The rule message and action have already had the necessary variable
+ # substitutions performed.
+ if message:
+ # Mark it with note: so Xcode picks it up in build output.
+ makefile.write('\t@echo note: %s\n' % message)
+ makefile.write('\t%s\n' % action)
+
+ makefile.close()
+
+ # It might be nice to ensure that needed output directories exist
+ # here rather than in each target in the Makefile, but that wouldn't
+ # work if there ever was a concrete output that had an input-dependent
+ # variable anywhere other than in the leaf position.
+
+ # Don't declare any inputPaths or outputPaths. If they're present,
+ # Xcode will provide a slight optimization by only running the script
+ # phase if any output is missing or outdated relative to any input.
+ # Unfortunately, it will also assume that all outputs are touched by
+ # the script, and if the outputs serve as files in a compilation
+ # phase, they will be unconditionally rebuilt. Since make might not
+ # rebuild everything that could be declared here as an output, this
+ # extra compilation activity is unnecessary. With inputPaths and
+ # outputPaths not supplied, make will always be called, but it knows
+ # enough to not do anything when everything is up-to-date.
+
+ # To help speed things up, pass -j COUNT to make so it does some work
+ # in parallel. Don't use ncpus because Xcode will build ncpus targets
+ # in parallel and if each target happens to have a rules step, there
+ # would be ncpus^2 things going. With a machine that has 2 quad-core
+ # Xeons, a build can quickly run out of processes based on
+ # scheduling/other tasks, and randomly failing builds are no good.
+ script = \
+"""JOB_COUNT="$(/usr/sbin/sysctl -n hw.ncpu)"
+if [ "${JOB_COUNT}" -gt 4 ]; then
+ JOB_COUNT=4
+fi
+exec "${DEVELOPER_BIN_DIR}/make" -f "${PROJECT_FILE_PATH}/%s" -j "${JOB_COUNT}"
+exit 1
+""" % makefile_name
+ ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({
+ 'name': 'Rule "' + rule['rule_name'] + '"',
+ 'shellScript': script,
+ 'showEnvVarsInLog': 0,
+ })
+
+ if support_xct:
+ support_xct.AppendProperty('buildPhases', ssbp)
+ else:
+ # TODO(mark): this assumes too much knowledge of the internals of
+ # xcodeproj_file; some of these smarts should move into xcodeproj_file
+ # itself.
+ xct._properties['buildPhases'].insert(prebuild_index, ssbp)
+ prebuild_index = prebuild_index + 1
+
+ # Extra rule inputs also go into the project file. Concrete outputs were
+ # already added when they were computed.
+ groups = ['inputs', 'inputs_excluded']
+ if skip_excluded_files:
+ groups = [x for x in groups if not x.endswith('_excluded')]
+ for group in groups:
+ for item in rule.get(group, []):
+ pbxp.AddOrGetFileInRootGroup(item)
+
+ # Add "sources".
+ for source in spec.get('sources', []):
+ (source_root, source_extension) = posixpath.splitext(source)
+ if source_extension[1:] not in rules_by_ext:
+ # AddSourceToTarget will add the file to a root group if it's not
+ # already there.
+ AddSourceToTarget(source, pbxp, xct)
+ else:
+ pbxp.AddOrGetFileInRootGroup(source)
+
+ # Add "mac_bundle_resources", "mac_framework_headers", and
+ # "mac_framework_private_headers" if it's a bundle of any type.
+ if is_bundle:
+ for resource in tgt_mac_bundle_resources:
+ (resource_root, resource_extension) = posixpath.splitext(resource)
+ if resource_extension[1:] not in rules_by_ext:
+ AddResourceToTarget(resource, pbxp, xct)
+ else:
+ pbxp.AddOrGetFileInRootGroup(resource)
+
+ for header in spec.get('mac_framework_headers', []):
+ AddHeaderToTarget(header, pbxp, xct, True)
+
+ for header in spec.get('mac_framework_private_headers', []):
+ AddHeaderToTarget(header, pbxp, xct, False)
+
+ # Add "copies".
+ for copy_group in spec.get('copies', []):
+ pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({
+ 'name': 'Copy to ' + copy_group['destination']
+ },
+ parent=xct)
+ dest = copy_group['destination']
+ if dest[0] not in ('/', '$'):
+ # Relative paths are relative to $(SRCROOT).
+ dest = '$(SRCROOT)/' + dest
+ pbxcp.SetDestination(dest)
+
+ # TODO(mark): The usual comment about this knowing too much about
+ # gyp.xcodeproj_file internals applies.
+ xct._properties['buildPhases'].insert(prebuild_index, pbxcp)
+
+ for file in copy_group['files']:
+ pbxcp.AddFile(file)
+
+ # Excluded files can also go into the project file.
+ if not skip_excluded_files:
+ for key in ['sources', 'mac_bundle_resources', 'mac_framework_headers',
+ 'mac_framework_private_headers']:
+ excluded_key = key + '_excluded'
+ for item in spec.get(excluded_key, []):
+ pbxp.AddOrGetFileInRootGroup(item)
+
+ # So can "inputs" and "outputs" sections of "actions" groups.
+ groups = ['inputs', 'inputs_excluded', 'outputs', 'outputs_excluded']
+ if skip_excluded_files:
+ groups = [x for x in groups if not x.endswith('_excluded')]
+ for action in spec.get('actions', []):
+ for group in groups:
+ for item in action.get(group, []):
+ # Exclude anything in BUILT_PRODUCTS_DIR. They're products, not
+ # sources.
+ if not item.startswith('$(BUILT_PRODUCTS_DIR)/'):
+ pbxp.AddOrGetFileInRootGroup(item)
+
+ for postbuild in spec.get('postbuilds', []):
+ action_string_sh = gyp.common.EncodePOSIXShellList(postbuild['action'])
+ script = 'exec ' + action_string_sh + '\nexit 1\n'
+
+ # Make the postbuild step depend on the output of ld or ar from this
+ # target. Apparently putting the script step after the link step isn't
+ # sufficient to ensure proper ordering in all cases. With an input
+ # declared but no outputs, the script step should run every time, as
+ # desired.
+ ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({
+ 'inputPaths': ['$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)'],
+ 'name': 'Postbuild "' + postbuild['postbuild_name'] + '"',
+ 'shellScript': script,
+ 'showEnvVarsInLog': 0,
+ })
+ xct.AppendProperty('buildPhases', ssbp)
+
+ # Add dependencies before libraries, because adding a dependency may imply
+ # adding a library. It's preferable to keep dependencies listed first
+ # during a link phase so that they can override symbols that would
+ # otherwise be provided by libraries, which will usually include system
+ # libraries. On some systems, ld is finicky and even requires the
+ # libraries to be ordered in such a way that unresolved symbols in
+ # earlier-listed libraries may only be resolved by later-listed libraries.
+ # The Mac linker doesn't work that way, but other platforms do, and so
+ # their linker invocations need to be constructed in this way. There's
+ # no compelling reason for Xcode's linker invocations to differ.
+
+ if 'dependencies' in spec:
+ for dependency in spec['dependencies']:
+ xct.AddDependency(xcode_targets[dependency])
+ # The support project also gets the dependencies (in case they are
+ # needed for the actions/rules to work).
+ if support_xct:
+ support_xct.AddDependency(xcode_targets[dependency])
+
+ if 'libraries' in spec:
+ for library in spec['libraries']:
+ xct.FrameworksPhase().AddFile(library)
+ # Add the library's directory to LIBRARY_SEARCH_PATHS if necessary.
+ # I wish Xcode handled this automatically.
+ library_dir = posixpath.dirname(library)
+ if library_dir not in xcode_standard_library_dirs and (
+ not xct.HasBuildSetting(_library_search_paths_var) or
+ library_dir not in xct.GetBuildSetting(_library_search_paths_var)):
+ xct.AppendBuildSetting(_library_search_paths_var, library_dir)
+
+ for configuration_name in configuration_names:
+ configuration = spec['configurations'][configuration_name]
+ xcbc = xct.ConfigurationNamed(configuration_name)
+ for include_dir in configuration.get('mac_framework_dirs', []):
+ xcbc.AppendBuildSetting('FRAMEWORK_SEARCH_PATHS', include_dir)
+ for include_dir in configuration.get('include_dirs', []):
+ xcbc.AppendBuildSetting('HEADER_SEARCH_PATHS', include_dir)
+ if 'defines' in configuration:
+ for define in configuration['defines']:
+ set_define = EscapeXCodeArgument(define)
+ xcbc.AppendBuildSetting('GCC_PREPROCESSOR_DEFINITIONS', set_define)
+ if 'xcode_settings' in configuration:
+ for xck, xcv in configuration['xcode_settings'].iteritems():
+ xcbc.SetBuildSetting(xck, xcv)
+ if 'xcode_config_file' in configuration:
+ config_ref = pbxp.AddOrGetFileInRootGroup(
+ configuration['xcode_config_file'])
+ xcbc.SetBaseConfiguration(config_ref)
+
+ build_files = []
+ for build_file, build_file_dict in data.iteritems():
+ if build_file.endswith('.gyp'):
+ build_files.append(build_file)
+
+ for build_file in build_files:
+ xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests)
+
+ for build_file in build_files:
+ xcode_projects[build_file].Finalize2(xcode_targets,
+ xcode_target_to_target_dict)
+
+ for build_file in build_files:
+ xcode_projects[build_file].Write()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/input.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/input.py
new file mode 100644
index 0000000..54e2466
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/input.py
@@ -0,0 +1,2250 @@
+#!/usr/bin/python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from compiler.ast import Const
+from compiler.ast import Dict
+from compiler.ast import Discard
+from compiler.ast import List
+from compiler.ast import Module
+from compiler.ast import Node
+from compiler.ast import Stmt
+import compiler
+import copy
+import gyp.common
+import optparse
+import os.path
+import re
+import shlex
+import subprocess
+import sys
+
+
+# A list of types that are treated as linkable.
+linkable_types = ['executable', 'shared_library', 'loadable_module']
+
+# A list of sections that contain links to other targets.
+dependency_sections = ['dependencies', 'export_dependent_settings']
+
+# base_path_sections is a list of sections defined by GYP that contain
+# pathnames. The generators can provide more keys, the two lists are merged
+# into path_sections, but you should call IsPathSection instead of using either
+# list directly.
+base_path_sections = [
+ 'destination',
+ 'files',
+ 'include_dirs',
+ 'inputs',
+ 'libraries',
+ 'outputs',
+ 'sources',
+]
+path_sections = []
+
+
+def IsPathSection(section):
+ # If section ends in one of these characters, it's applied to a section
+ # without the trailing characters. '/' is notably absent from this list,
+ # because there's no way for a regular expression to be treated as a path.
+ while section[-1:] in ('=', '+', '?', '!'):
+ section = section[0:-1]
+
+ if section in path_sections or \
+ section.endswith('_dir') or section.endswith('_dirs') or \
+ section.endswith('_file') or section.endswith('_files') or \
+ section.endswith('_path') or section.endswith('_paths'):
+ return True
+ return False
+
+
+# base_non_configuraiton_keys is a list of key names that belong in the target
+# itself and should not be propagated into its configurations. It is merged
+# with a list that can come from the generator to
+# create non_configuration_keys.
+base_non_configuration_keys = [
+ # Sections that must exist inside targets and not configurations.
+ 'actions',
+ 'configurations',
+ 'copies',
+ 'default_configuration',
+ 'dependencies',
+ 'dependencies_original',
+ 'link_languages',
+ 'libraries',
+ 'postbuilds',
+ 'product_dir',
+ 'product_extension',
+ 'product_name',
+ 'product_prefix',
+ 'rules',
+ 'run_as',
+ 'sources',
+ 'suppress_wildcard',
+ 'target_name',
+ 'toolset',
+ 'toolsets',
+ 'type',
+ 'variants',
+
+ # Sections that can be found inside targets or configurations, but that
+ # should not be propagated from targets into their configurations.
+ 'variables',
+]
+non_configuration_keys = []
+
+# Keys that do not belong inside a configuration dictionary.
+invalid_configuration_keys = [
+ 'actions',
+ 'all_dependent_settings',
+ 'configurations',
+ 'dependencies',
+ 'direct_dependent_settings',
+ 'libraries',
+ 'link_settings',
+ 'sources',
+ 'target_name',
+ 'type',
+]
+
+# Controls how the generator want the build file paths.
+absolute_build_file_paths = False
+
+# Controls whether or not the generator supports multiple toolsets.
+multiple_toolsets = False
+
+
+def GetIncludedBuildFiles(build_file_path, aux_data, included=None):
+ """Return a list of all build files included into build_file_path.
+
+ The returned list will contain build_file_path as well as all other files
+ that it included, either directly or indirectly. Note that the list may
+ contain files that were included into a conditional section that evaluated
+ to false and was not merged into build_file_path's dict.
+
+ aux_data is a dict containing a key for each build file or included build
+ file. Those keys provide access to dicts whose "included" keys contain
+ lists of all other files included by the build file.
+
+ included should be left at its default None value by external callers. It
+ is used for recursion.
+
+ The returned list will not contain any duplicate entries. Each build file
+ in the list will be relative to the current directory.
+ """
+
+ if included == None:
+ included = []
+
+ if build_file_path in included:
+ return included
+
+ included.append(build_file_path)
+
+ for included_build_file in aux_data[build_file_path].get('included', []):
+ GetIncludedBuildFiles(included_build_file, aux_data, included)
+
+ return included
+
+
+def CheckedEval(file_contents):
+ """Return the eval of a gyp file.
+
+ The gyp file is restricted to dictionaries and lists only, and
+ repeated keys are not allowed.
+
+ Note that this is slower than eval() is.
+ """
+
+ ast = compiler.parse(file_contents)
+ assert isinstance(ast, Module)
+ c1 = ast.getChildren()
+ assert c1[0] is None
+ assert isinstance(c1[1], Stmt)
+ c2 = c1[1].getChildren()
+ assert isinstance(c2[0], Discard)
+ c3 = c2[0].getChildren()
+ assert len(c3) == 1
+ return CheckNode(c3[0], [])
+
+
+def CheckNode(node, keypath):
+ if isinstance(node, Dict):
+ c = node.getChildren()
+ dict = {}
+ for n in range(0, len(c), 2):
+ assert isinstance(c[n], Const)
+ key = c[n].getChildren()[0]
+ if key in dict:
+ raise KeyError, "Key '" + key + "' repeated at level " + \
+ repr(len(keypath) + 1) + " with key path '" + \
+ '.'.join(keypath) + "'"
+ kp = list(keypath) # Make a copy of the list for descending this node.
+ kp.append(key)
+ dict[key] = CheckNode(c[n + 1], kp)
+ return dict
+ elif isinstance(node, List):
+ c = node.getChildren()
+ children = []
+ for index, child in enumerate(c):
+ kp = list(keypath) # Copy list.
+ kp.append(repr(index))
+ children.append(CheckNode(child, kp))
+ return children
+ elif isinstance(node, Const):
+ return node.getChildren()[0]
+ else:
+ raise TypeError, "Unknown AST node at key path '" + '.'.join(keypath) + \
+ "': " + repr(node)
+
+
+def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes,
+ is_target, check):
+ if build_file_path in data:
+ return data[build_file_path]
+
+ if os.path.exists(build_file_path):
+ build_file_contents = open(build_file_path).read()
+ else:
+ raise Exception("%s not found (cwd: %s)" % (build_file_path, os.getcwd()))
+
+ build_file_data = None
+ try:
+ if check:
+ build_file_data = CheckedEval(build_file_contents)
+ else:
+ build_file_data = eval(build_file_contents, {'__builtins__': None},
+ None)
+ except SyntaxError, e:
+ e.filename = build_file_path
+ raise
+ except Exception, e:
+ gyp.common.ExceptionAppend(e, 'while reading ' + build_file_path)
+ raise
+
+ data[build_file_path] = build_file_data
+ aux_data[build_file_path] = {}
+
+ # Scan for includes and merge them in.
+ try:
+ if is_target:
+ LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data,
+ aux_data, variables, includes, check)
+ else:
+ LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data,
+ aux_data, variables, None, check)
+ except Exception, e:
+ gyp.common.ExceptionAppend(e,
+ 'while reading includes of ' + build_file_path)
+ raise
+
+ return build_file_data
+
+
+def LoadBuildFileIncludesIntoDict(subdict, subdict_path, data, aux_data,
+ variables, includes, check):
+ includes_list = []
+ if includes != None:
+ includes_list.extend(includes)
+ if 'includes' in subdict:
+ for include in subdict['includes']:
+ # "include" is specified relative to subdict_path, so compute the real
+ # path to include by appending the provided "include" to the directory
+ # in which subdict_path resides.
+ relative_include = \
+ os.path.normpath(os.path.join(os.path.dirname(subdict_path), include))
+ includes_list.append(relative_include)
+ # Unhook the includes list, it's no longer needed.
+ del subdict['includes']
+
+ # Merge in the included files.
+ for include in includes_list:
+ if not 'included' in aux_data[subdict_path]:
+ aux_data[subdict_path]['included'] = []
+ aux_data[subdict_path]['included'].append(include)
+
+ gyp.DebugOutput(gyp.DEBUG_INCLUDES, "Loading Included File: '%s'" % include)
+
+ MergeDicts(subdict,
+ LoadOneBuildFile(include, data, aux_data, variables, None,
+ False, check),
+ subdict_path, include)
+
+ # Recurse into subdictionaries.
+ for k, v in subdict.iteritems():
+ if v.__class__ == dict:
+ LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, variables,
+ None, check)
+ elif v.__class__ == list:
+ LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, variables,
+ check)
+
+
+# This recurses into lists so that it can look for dicts.
+def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data,
+ variables, check):
+ for item in sublist:
+ if item.__class__ == dict:
+ LoadBuildFileIncludesIntoDict(item, sublist_path, data, aux_data,
+ variables, None, check)
+ elif item.__class__ == list:
+ LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data,
+ variables, check)
+
+# Processes toolsets in all the targets. This recurses into condition entries
+# since they can contain toolsets as well.
+def ProcessToolsetsInDict(data):
+ if 'targets' in data:
+ target_list = data['targets']
+ new_target_list = []
+ for target in target_list:
+ global multiple_toolsets
+ if multiple_toolsets:
+ toolsets = target.get('toolsets', ['target'])
+ else:
+ toolsets = ['target']
+ if len(toolsets) > 0:
+ # Optimization: only do copies if more than one toolset is specified.
+ for build in toolsets[1:]:
+ new_target = copy.deepcopy(target)
+ new_target['toolset'] = build
+ new_target_list.append(new_target)
+ target['toolset'] = toolsets[0]
+ new_target_list.append(target)
+ data['targets'] = new_target_list
+ if 'conditions' in data:
+ for condition in data['conditions']:
+ if isinstance(condition, list):
+ for condition_dict in condition[1:]:
+ ProcessToolsetsInDict(condition_dict)
+
+
+# TODO(mark): I don't love this name. It just means that it's going to load
+# a build file that contains targets and is expected to provide a targets dict
+# that contains the targets...
+def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes,
+ depth, check):
+ global absolute_build_file_paths
+
+ # If depth is set, predefine the DEPTH variable to be a relative path from
+ # this build file's directory to the directory identified by depth.
+ if depth:
+ # TODO(dglazkov) The backslash/forward-slash replacement at the end is a
+ # temporary measure. This should really be addressed by keeping all paths
+ # in POSIX until actual project generation.
+ d = gyp.common.RelativePath(depth, os.path.dirname(build_file_path))
+ if d == '':
+ variables['DEPTH'] = '.'
+ else:
+ variables['DEPTH'] = d.replace('\\', '/')
+
+ # If the generator needs absolue paths, then do so.
+ if absolute_build_file_paths:
+ build_file_path = os.path.abspath(build_file_path)
+
+ if build_file_path in data['target_build_files']:
+ # Already loaded.
+ return
+ data['target_build_files'].add(build_file_path)
+
+ gyp.DebugOutput(gyp.DEBUG_INCLUDES,
+ "Loading Target Build File '%s'" % build_file_path)
+
+ build_file_data = LoadOneBuildFile(build_file_path, data, aux_data, variables,
+ includes, True, check)
+
+ # Store DEPTH for later use in generators.
+ build_file_data['_DEPTH'] = depth
+
+ # Set up the included_files key indicating which .gyp files contributed to
+ # this target dict.
+ if 'included_files' in build_file_data:
+ raise KeyError, build_file_path + ' must not contain included_files key'
+
+ included = GetIncludedBuildFiles(build_file_path, aux_data)
+ build_file_data['included_files'] = []
+ for included_file in included:
+ # included_file is relative to the current directory, but it needs to
+ # be made relative to build_file_path's directory.
+ included_relative = \
+ gyp.common.RelativePath(included_file,
+ os.path.dirname(build_file_path))
+ build_file_data['included_files'].append(included_relative)
+
+ ProcessToolsetsInDict(build_file_data)
+
+ # Apply "pre"/"early" variable expansions and condition evaluations.
+ ProcessVariablesAndConditionsInDict(build_file_data, False, variables,
+ build_file_path)
+
+ # Look at each project's target_defaults dict, and merge settings into
+ # targets.
+ if 'target_defaults' in build_file_data:
+ index = 0
+ if 'targets' in build_file_data:
+ while index < len(build_file_data['targets']):
+ # This procedure needs to give the impression that target_defaults is
+ # used as defaults, and the individual targets inherit from that.
+ # The individual targets need to be merged into the defaults. Make
+ # a deep copy of the defaults for each target, merge the target dict
+ # as found in the input file into that copy, and then hook up the
+ # copy with the target-specific data merged into it as the replacement
+ # target dict.
+ old_target_dict = build_file_data['targets'][index]
+ new_target_dict = copy.deepcopy(build_file_data['target_defaults'])
+ MergeDicts(new_target_dict, old_target_dict,
+ build_file_path, build_file_path)
+ build_file_data['targets'][index] = new_target_dict
+ index = index + 1
+ else:
+ raise Exception, \
+ "Unable to find targets in build file %s" % build_file_path
+
+ # No longer needed.
+ del build_file_data['target_defaults']
+
+ # Look for dependencies. This means that dependency resolution occurs
+ # after "pre" conditionals and variable expansion, but before "post" -
+ # in other words, you can't put a "dependencies" section inside a "post"
+ # conditional within a target.
+
+ if 'targets' in build_file_data:
+ for target_dict in build_file_data['targets']:
+ if 'dependencies' not in target_dict:
+ continue
+ for dependency in target_dict['dependencies']:
+ other_build_file = \
+ gyp.common.ResolveTarget(build_file_path, dependency, None)[0]
+ try:
+ LoadTargetBuildFile(other_build_file, data, aux_data, variables,
+ includes, depth, check)
+ except Exception, e:
+ gyp.common.ExceptionAppend(
+ e, 'while loading dependencies of %s' % build_file_path)
+ raise
+
+ return data
+
+
+# Look for the bracket that matches the first bracket seen in a
+# string, and return the start and end as a tuple. For example, if
+# the input is something like "<(foo <(bar)) blah", then it would
+# return (1, 13), indicating the entire string except for the leading
+# "<" and trailing " blah".
+def FindEnclosingBracketGroup(input):
+ brackets = { '}': '{',
+ ']': '[',
+ ')': '(', }
+ stack = []
+ count = 0
+ start = -1
+ for char in input:
+ if char in brackets.values():
+ stack.append(char)
+ if start == -1:
+ start = count
+ if char in brackets.keys():
+ try:
+ last_bracket = stack.pop()
+ except IndexError:
+ return (-1, -1)
+ if last_bracket != brackets[char]:
+ return (-1, -1)
+ if len(stack) == 0:
+ return (start, count + 1)
+ count = count + 1
+ return (-1, -1)
+
+
+canonical_int_re = re.compile('^(0|-?[1-9][0-9]*)$')
+
+
+def IsStrCanonicalInt(string):
+ """Returns True if |string| is in its canonical integer form.
+
+ The canonical form is such that str(int(string)) == string.
+ """
+ if not isinstance(string, str) or not canonical_int_re.match(string):
+ return False
+
+ return True
+
+
+early_variable_re = re.compile('(?P<replace>(?P<type><((!?@?)|\|)?)'
+ '\((?P<is_array>\s*\[?)'
+ '(?P<content>.*?)(\]?)\))')
+late_variable_re = re.compile('(?P<replace>(?P<type>>((!?@?)|\|)?)'
+ '\((?P<is_array>\s*\[?)'
+ '(?P<content>.*?)(\]?)\))')
+
+# Global cache of results from running commands so they don't have to be run
+# more then once.
+cached_command_results = {}
+
+
+def FixupPlatformCommand(cmd):
+ if sys.platform == 'win32':
+ if type(cmd) == list:
+ cmd = [re.sub('^cat ', 'type ', cmd[0])] + cmd[1:]
+ else:
+ cmd = re.sub('^cat ', 'type ', cmd)
+ return cmd
+
+
+def ExpandVariables(input, is_late, variables, build_file):
+ # Look for the pattern that gets expanded into variables
+ if not is_late:
+ variable_re = early_variable_re
+ expansion_symbol = '<'
+ else:
+ variable_re = late_variable_re
+ expansion_symbol = '>'
+
+ input_str = str(input)
+ # Do a quick scan to determine if an expensive regex search is warranted.
+ if expansion_symbol in input_str:
+ # Get the entire list of matches as a list of MatchObject instances.
+ # (using findall here would return strings instead of MatchObjects).
+ matches = [match for match in variable_re.finditer(input_str)]
+ else:
+ matches = None
+
+ output = input_str
+ if matches:
+ # Reverse the list of matches so that replacements are done right-to-left.
+ # That ensures that earlier replacements won't mess up the string in a
+ # way that causes later calls to find the earlier substituted text instead
+ # of what's intended for replacement.
+ matches.reverse()
+ for match_group in matches:
+ match = match_group.groupdict()
+ gyp.DebugOutput(gyp.DEBUG_VARIABLES,
+ "Matches: %s" % repr(match))
+ # match['replace'] is the substring to look for, match['type']
+ # is the character code for the replacement type (< > <! >! <| >| <@
+ # >@ <!@ >!@), match['is_array'] contains a '[' for command
+ # arrays, and match['content'] is the name of the variable (< >)
+ # or command to run (<! >!).
+
+ # run_command is true if a ! variant is used.
+ run_command = '!' in match['type']
+
+ # file_list is true if a | variant is used.
+ file_list = '|' in match['type']
+
+ # Capture these now so we can adjust them later.
+ replace_start = match_group.start('replace')
+ replace_end = match_group.end('replace')
+
+ # Find the ending paren, and re-evaluate the contained string.
+ (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:])
+
+ # Adjust the replacement range to match the entire command
+ # found by FindEnclosingBracketGroup (since the variable_re
+ # probably doesn't match the entire command if it contained
+ # nested variables).
+ replace_end = replace_start + c_end
+
+ # Find the "real" replacement, matching the appropriate closing
+ # paren, and adjust the replacement start and end.
+ replacement = input_str[replace_start:replace_end]
+
+ # Figure out what the contents of the variable parens are.
+ contents_start = replace_start + c_start + 1
+ contents_end = replace_end - 1
+ contents = input_str[contents_start:contents_end]
+
+ # Do filter substitution now for <|().
+ # Admittedly, this is different than the evaluation order in other
+ # contexts. However, since filtration has no chance to run on <|(),
+ # this seems like the only obvious way to give them access to filters.
+ if file_list:
+ processed_variables = copy.deepcopy(variables)
+ ProcessListFiltersInDict(contents, processed_variables)
+ # Recurse to expand variables in the contents
+ contents = ExpandVariables(contents, is_late,
+ processed_variables, build_file)
+ else:
+ # Recurse to expand variables in the contents
+ contents = ExpandVariables(contents, is_late, variables, build_file)
+
+ # Strip off leading/trailing whitespace so that variable matches are
+ # simpler below (and because they are rarely needed).
+ contents = contents.strip()
+
+ # expand_to_list is true if an @ variant is used. In that case,
+ # the expansion should result in a list. Note that the caller
+ # is to be expecting a list in return, and not all callers do
+ # because not all are working in list context. Also, for list
+ # expansions, there can be no other text besides the variable
+ # expansion in the input string.
+ expand_to_list = '@' in match['type'] and input_str == replacement
+
+ if run_command or file_list:
+ # Find the build file's directory, so commands can be run or file lists
+ # generated relative to it.
+ build_file_dir = os.path.dirname(build_file)
+ if build_file_dir == '':
+ # If build_file is just a leaf filename indicating a file in the
+ # current directory, build_file_dir might be an empty string. Set
+ # it to None to signal to subprocess.Popen that it should run the
+ # command in the current directory.
+ build_file_dir = None
+
+ # Support <|(listfile.txt ...) which generates a file
+ # containing items from a gyp list, generated at gyp time.
+ # This works around actions/rules which have more inputs than will
+ # fit on the command line.
+ if file_list:
+ if type(contents) == list:
+ contents_list = contents
+ else:
+ contents_list = contents.split(' ')
+ replacement = contents_list[0]
+ path = replacement
+ if not os.path.isabs(path):
+ path = os.path.join(build_file_dir, path)
+ f = gyp.common.WriteOnDiff(path)
+ for i in contents_list[1:]:
+ f.write('%s\n' % i)
+ f.close()
+
+ elif run_command:
+ use_shell = True
+ if match['is_array']:
+ contents = eval(contents)
+ use_shell = False
+
+ # Check for a cached value to avoid executing commands, or generating
+ # file lists more than once.
+ # TODO(http://code.google.com/p/gyp/issues/detail?id=112): It is
+ # possible that the command being invoked depends on the current
+ # directory. For that case the syntax needs to be extended so that the
+ # directory is also used in cache_key (it becomes a tuple).
+ # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory,
+ # someone could author a set of GYP files where each time the command
+ # is invoked it produces different output by design. When the need
+ # arises, the syntax should be extended to support no caching off a
+ # command's output so it is run every time.
+ cache_key = str(contents)
+ cached_value = cached_command_results.get(cache_key, None)
+ if cached_value is None:
+ gyp.DebugOutput(gyp.DEBUG_VARIABLES,
+ "Executing command '%s' in directory '%s'" %
+ (contents,build_file_dir))
+
+ # Fix up command with platform specific workarounds.
+ contents = FixupPlatformCommand(contents)
+ p = subprocess.Popen(contents, shell=use_shell,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ cwd=build_file_dir)
+
+ (p_stdout, p_stderr) = p.communicate('')
+
+ if p.wait() != 0 or p_stderr:
+ sys.stderr.write(p_stderr)
+ # Simulate check_call behavior, since check_call only exists
+ # in python 2.5 and later.
+ raise Exception("Call to '%s' returned exit status %d." %
+ (contents, p.returncode))
+ replacement = p_stdout.rstrip()
+
+ cached_command_results[cache_key] = replacement
+ else:
+ gyp.DebugOutput(gyp.DEBUG_VARIABLES,
+ "Had cache value for command '%s' in directory '%s'" %
+ (contents,build_file_dir))
+ replacement = cached_value
+
+ else:
+ if not contents in variables:
+ raise KeyError, 'Undefined variable ' + contents + \
+ ' in ' + build_file
+ replacement = variables[contents]
+
+ if isinstance(replacement, list):
+ for item in replacement:
+ if not isinstance(item, str) and not isinstance(item, int):
+ raise TypeError, 'Variable ' + contents + \
+ ' must expand to a string or list of strings; ' + \
+ 'list contains a ' + \
+ item.__class__.__name__
+ # Run through the list and handle variable expansions in it. Since
+ # the list is guaranteed not to contain dicts, this won't do anything
+ # with conditions sections.
+ ProcessVariablesAndConditionsInList(replacement, is_late, variables,
+ build_file)
+ elif not isinstance(replacement, str) and \
+ not isinstance(replacement, int):
+ raise TypeError, 'Variable ' + contents + \
+ ' must expand to a string or list of strings; ' + \
+ 'found a ' + replacement.__class__.__name__
+
+ if expand_to_list:
+ # Expanding in list context. It's guaranteed that there's only one
+ # replacement to do in |input_str| and that it's this replacement. See
+ # above.
+ if isinstance(replacement, list):
+ # If it's already a list, make a copy.
+ output = replacement[:]
+ else:
+ # Split it the same way sh would split arguments.
+ output = shlex.split(str(replacement))
+ else:
+ # Expanding in string context.
+ encoded_replacement = ''
+ if isinstance(replacement, list):
+ # When expanding a list into string context, turn the list items
+ # into a string in a way that will work with a subprocess call.
+ #
+ # TODO(mark): This isn't completely correct. This should
+ # call a generator-provided function that observes the
+ # proper list-to-argument quoting rules on a specific
+ # platform instead of just calling the POSIX encoding
+ # routine.
+ encoded_replacement = gyp.common.EncodePOSIXShellList(replacement)
+ else:
+ encoded_replacement = replacement
+
+ output = output[:replace_start] + str(encoded_replacement) + \
+ output[replace_end:]
+ # Prepare for the next match iteration.
+ input_str = output
+
+ # Look for more matches now that we've replaced some, to deal with
+ # expanding local variables (variables defined in the same
+ # variables block as this one).
+ gyp.DebugOutput(gyp.DEBUG_VARIABLES,
+ "Found output %s, recursing." % repr(output))
+ if isinstance(output, list):
+ new_output = []
+ for item in output:
+ new_output.append(ExpandVariables(item, is_late, variables, build_file))
+ output = new_output
+ else:
+ output = ExpandVariables(output, is_late, variables, build_file)
+
+ # Convert all strings that are canonically-represented integers into integers.
+ if isinstance(output, list):
+ for index in xrange(0, len(output)):
+ if IsStrCanonicalInt(output[index]):
+ output[index] = int(output[index])
+ elif IsStrCanonicalInt(output):
+ output = int(output)
+
+ gyp.DebugOutput(gyp.DEBUG_VARIABLES,
+ "Expanding %s to %s" % (repr(input), repr(output)))
+ return output
+
+
+def ProcessConditionsInDict(the_dict, is_late, variables, build_file):
+ # Process a 'conditions' or 'target_conditions' section in the_dict,
+ # depending on is_late. If is_late is False, 'conditions' is used.
+ #
+ # Each item in a conditions list consists of cond_expr, a string expression
+ # evaluated as the condition, and true_dict, a dict that will be merged into
+ # the_dict if cond_expr evaluates to true. Optionally, a third item,
+ # false_dict, may be present. false_dict is merged into the_dict if
+ # cond_expr evaluates to false.
+ #
+ # Any dict merged into the_dict will be recursively processed for nested
+ # conditionals and other expansions, also according to is_late, immediately
+ # prior to being merged.
+
+ if not is_late:
+ conditions_key = 'conditions'
+ else:
+ conditions_key = 'target_conditions'
+
+ if not conditions_key in the_dict:
+ return
+
+ conditions_list = the_dict[conditions_key]
+ # Unhook the conditions list, it's no longer needed.
+ del the_dict[conditions_key]
+
+ for condition in conditions_list:
+ if not isinstance(condition, list):
+ raise TypeError, conditions_key + ' must be a list'
+ if len(condition) != 2 and len(condition) != 3:
+ # It's possible that condition[0] won't work in which case this
+ # attempt will raise its own IndexError. That's probably fine.
+ raise IndexError, conditions_key + ' ' + condition[0] + \
+ ' must be length 2 or 3, not ' + str(len(condition))
+
+ [cond_expr, true_dict] = condition[0:2]
+ false_dict = None
+ if len(condition) == 3:
+ false_dict = condition[2]
+
+ # Do expansions on the condition itself. Since the conditon can naturally
+ # contain variable references without needing to resort to GYP expansion
+ # syntax, this is of dubious value for variables, but someone might want to
+ # use a command expansion directly inside a condition.
+ cond_expr_expanded = ExpandVariables(cond_expr, is_late, variables,
+ build_file)
+ if not isinstance(cond_expr_expanded, str) and \
+ not isinstance(cond_expr_expanded, int):
+ raise ValueError, \
+ 'Variable expansion in this context permits str and int ' + \
+ 'only, found ' + expanded.__class__.__name__
+
+ try:
+ ast_code = compile(cond_expr_expanded, '<string>', 'eval')
+
+ if eval(ast_code, {'__builtins__': None}, variables):
+ merge_dict = true_dict
+ else:
+ merge_dict = false_dict
+ except SyntaxError, e:
+ syntax_error = SyntaxError('%s while evaluating condition \'%s\' in %s '
+ 'at character %d.' %
+ (str(e.args[0]), e.text, build_file, e.offset),
+ e.filename, e.lineno, e.offset, e.text)
+ raise syntax_error
+ except NameError, e:
+ gyp.common.ExceptionAppend(e, 'while evaluating condition \'%s\' in %s' %
+ (cond_expr_expanded, build_file))
+ raise
+
+ if merge_dict != None:
+ # Expand variables and nested conditinals in the merge_dict before
+ # merging it.
+ ProcessVariablesAndConditionsInDict(merge_dict, is_late,
+ variables, build_file)
+
+ MergeDicts(the_dict, merge_dict, build_file, build_file)
+
+
+def LoadAutomaticVariablesFromDict(variables, the_dict):
+ # Any keys with plain string values in the_dict become automatic variables.
+ # The variable name is the key name with a "_" character prepended.
+ for key, value in the_dict.iteritems():
+ if isinstance(value, str) or isinstance(value, int) or \
+ isinstance(value, list):
+ variables['_' + key] = value
+
+
+def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):
+ # Any keys in the_dict's "variables" dict, if it has one, becomes a
+ # variable. The variable name is the key name in the "variables" dict.
+ # Variables that end with the % character are set only if they are unset in
+ # the variables dict. the_dict_key is the name of the key that accesses
+ # the_dict in the_dict's parent dict. If the_dict's parent is not a dict
+ # (it could be a list or it could be parentless because it is a root dict),
+ # the_dict_key will be None.
+ for key, value in the_dict.get('variables', {}).iteritems():
+ if not isinstance(value, str) and not isinstance(value, int) and \
+ not isinstance(value, list):
+ continue
+
+ if key.endswith('%'):
+ variable_name = key[:-1]
+ if variable_name in variables:
+ # If the variable is already set, don't set it.
+ continue
+ if the_dict_key is 'variables' and variable_name in the_dict:
+ # If the variable is set without a % in the_dict, and the_dict is a
+ # variables dict (making |variables| a varaibles sub-dict of a
+ # variables dict), use the_dict's definition.
+ value = the_dict[variable_name]
+ else:
+ variable_name = key
+
+ variables[variable_name] = value
+
+
+def ProcessVariablesAndConditionsInDict(the_dict, is_late, variables_in,
+ build_file, the_dict_key=None):
+ """Handle all variable and command expansion and conditional evaluation.
+
+ This function is the public entry point for all variable expansions and
+ conditional evaluations. The variables_in dictionary will not be modified
+ by this function.
+ """
+
+ # Make a copy of the variables_in dict that can be modified during the
+ # loading of automatics and the loading of the variables dict.
+ variables = variables_in.copy()
+ LoadAutomaticVariablesFromDict(variables, the_dict)
+
+ if 'variables' in the_dict:
+ # Make sure all the local variables are added to the variables
+ # list before we process them so that you can reference one
+ # variable from another. They will be fully expanded by recursion
+ # in ExpandVariables.
+ for key, value in the_dict['variables'].iteritems():
+ variables[key] = value
+
+ # Handle the associated variables dict first, so that any variable
+ # references within can be resolved prior to using them as variables.
+ # Pass a copy of the variables dict to avoid having it be tainted.
+ # Otherwise, it would have extra automatics added for everything that
+ # should just be an ordinary variable in this scope.
+ ProcessVariablesAndConditionsInDict(the_dict['variables'], is_late,
+ variables, build_file, 'variables')
+
+ LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key)
+
+ for key, value in the_dict.iteritems():
+ # Skip "variables", which was already processed if present.
+ if key != 'variables' and isinstance(value, str):
+ expanded = ExpandVariables(value, is_late, variables, build_file)
+ if not isinstance(expanded, str) and not isinstance(expanded, int):
+ raise ValueError, \
+ 'Variable expansion in this context permits str and int ' + \
+ 'only, found ' + expanded.__class__.__name__ + ' for ' + key
+ the_dict[key] = expanded
+
+ # Variable expansion may have resulted in changes to automatics. Reload.
+ # TODO(mark): Optimization: only reload if no changes were made.
+ variables = variables_in.copy()
+ LoadAutomaticVariablesFromDict(variables, the_dict)
+ LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key)
+
+ # Process conditions in this dict. This is done after variable expansion
+ # so that conditions may take advantage of expanded variables. For example,
+ # if the_dict contains:
+ # {'type': '<(library_type)',
+ # 'conditions': [['_type=="static_library"', { ... }]]},
+ # _type, as used in the condition, will only be set to the value of
+ # library_type if variable expansion is performed before condition
+ # processing. However, condition processing should occur prior to recursion
+ # so that variables (both automatic and "variables" dict type) may be
+ # adjusted by conditions sections, merged into the_dict, and have the
+ # intended impact on contained dicts.
+ #
+ # This arrangement means that a "conditions" section containing a "variables"
+ # section will only have those variables effective in subdicts, not in
+ # the_dict. The workaround is to put a "conditions" section within a
+ # "variables" section. For example:
+ # {'conditions': [['os=="mac"', {'variables': {'define': 'IS_MAC'}}]],
+ # 'defines': ['<(define)'],
+ # 'my_subdict': {'defines': ['<(define)']}},
+ # will not result in "IS_MAC" being appended to the "defines" list in the
+ # current scope but would result in it being appended to the "defines" list
+ # within "my_subdict". By comparison:
+ # {'variables': {'conditions': [['os=="mac"', {'define': 'IS_MAC'}]]},
+ # 'defines': ['<(define)'],
+ # 'my_subdict': {'defines': ['<(define)']}},
+ # will append "IS_MAC" to both "defines" lists.
+
+ # Evaluate conditions sections, allowing variable expansions within them
+ # as well as nested conditionals. This will process a 'conditions' or
+ # 'target_conditions' section, perform appropriate merging and recursive
+ # conditional and variable processing, and then remove the conditions section
+ # from the_dict if it is present.
+ ProcessConditionsInDict(the_dict, is_late, variables, build_file)
+
+ # Conditional processing may have resulted in changes to automatics or the
+ # variables dict. Reload.
+ variables = variables_in.copy()
+ LoadAutomaticVariablesFromDict(variables, the_dict)
+ LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key)
+
+ # Recurse into child dicts, or process child lists which may result in
+ # further recursion into descendant dicts.
+ for key, value in the_dict.iteritems():
+ # Skip "variables" and string values, which were already processed if
+ # present.
+ if key == 'variables' or isinstance(value, str):
+ continue
+ if isinstance(value, dict):
+ # Pass a copy of the variables dict so that subdicts can't influence
+ # parents.
+ ProcessVariablesAndConditionsInDict(value, is_late, variables,
+ build_file, key)
+ elif isinstance(value, list):
+ # The list itself can't influence the variables dict, and
+ # ProcessVariablesAndConditionsInList will make copies of the variables
+ # dict if it needs to pass it to something that can influence it. No
+ # copy is necessary here.
+ ProcessVariablesAndConditionsInList(value, is_late, variables,
+ build_file)
+ elif not isinstance(value, int):
+ raise TypeError, 'Unknown type ' + value.__class__.__name__ + \
+ ' for ' + key
+
+
+def ProcessVariablesAndConditionsInList(the_list, is_late, variables,
+ build_file):
+ # Iterate using an index so that new values can be assigned into the_list.
+ index = 0
+ while index < len(the_list):
+ item = the_list[index]
+ if isinstance(item, dict):
+ # Make a copy of the variables dict so that it won't influence anything
+ # outside of its own scope.
+ ProcessVariablesAndConditionsInDict(item, is_late, variables, build_file)
+ elif isinstance(item, list):
+ ProcessVariablesAndConditionsInList(item, is_late, variables, build_file)
+ elif isinstance(item, str):
+ expanded = ExpandVariables(item, is_late, variables, build_file)
+ if isinstance(expanded, str) or isinstance(expanded, int):
+ the_list[index] = expanded
+ elif isinstance(expanded, list):
+ del the_list[index]
+ for expanded_item in expanded:
+ the_list.insert(index, expanded_item)
+ index = index + 1
+
+ # index now identifies the next item to examine. Continue right now
+ # without falling into the index increment below.
+ continue
+ else:
+ raise ValueError, \
+ 'Variable expansion in this context permits strings and ' + \
+ 'lists only, found ' + expanded.__class__.__name__ + ' at ' + \
+ index
+ elif not isinstance(item, int):
+ raise TypeError, 'Unknown type ' + item.__class__.__name__ + \
+ ' at index ' + index
+ index = index + 1
+
+
+def BuildTargetsDict(data):
+ """Builds a dict mapping fully-qualified target names to their target dicts.
+
+ |data| is a dict mapping loaded build files by pathname relative to the
+ current directory. Values in |data| are build file contents. For each
+ |data| value with a "targets" key, the value of the "targets" key is taken
+ as a list containing target dicts. Each target's fully-qualified name is
+ constructed from the pathname of the build file (|data| key) and its
+ "target_name" property. These fully-qualified names are used as the keys
+ in the returned dict. These keys provide access to the target dicts,
+ the dicts in the "targets" lists.
+ """
+
+ targets = {}
+ for build_file in data['target_build_files']:
+ for target in data[build_file].get('targets', []):
+ target_name = gyp.common.QualifiedTarget(build_file,
+ target['target_name'],
+ target['toolset'])
+ if target_name in targets:
+ raise KeyError, 'Duplicate target definitions for ' + target_name
+ targets[target_name] = target
+
+ return targets
+
+
+def QualifyDependencies(targets):
+ """Make dependency links fully-qualified relative to the current directory.
+
+ |targets| is a dict mapping fully-qualified target names to their target
+ dicts. For each target in this dict, keys known to contain dependency
+ links are examined, and any dependencies referenced will be rewritten
+ so that they are fully-qualified and relative to the current directory.
+ All rewritten dependencies are suitable for use as keys to |targets| or a
+ similar dict.
+ """
+
+ for target, target_dict in targets.iteritems():
+ target_build_file = gyp.common.BuildFile(target)
+ toolset = target_dict['toolset']
+ for dependency_key in dependency_sections:
+ dependencies = target_dict.get(dependency_key, [])
+ for index in xrange(0, len(dependencies)):
+ dep_file, dep_target, dep_toolset = gyp.common.ResolveTarget(
+ target_build_file, dependencies[index], toolset)
+ global multiple_toolsets
+ if not multiple_toolsets:
+ # Ignore toolset specification in the dependency if it is specified.
+ dep_toolset = toolset
+ dependency = gyp.common.QualifiedTarget(dep_file,
+ dep_target,
+ dep_toolset)
+ dependencies[index] = dependency
+
+ # Make sure anything appearing in a list other than "dependencies" also
+ # appears in the "dependencies" list.
+ if dependency_key != 'dependencies' and \
+ dependency not in target_dict['dependencies']:
+ raise KeyError, 'Found ' + dependency + ' in ' + dependency_key + \
+ ' of ' + target + ', but not in dependencies'
+
+
+def ExpandWildcardDependencies(targets, data):
+ """Expands dependencies specified as build_file:*.
+
+ For each target in |targets|, examines sections containing links to other
+ targets. If any such section contains a link of the form build_file:*, it
+ is taken as a wildcard link, and is expanded to list each target in
+ build_file. The |data| dict provides access to build file dicts.
+
+ Any target that does not wish to be included by wildcard can provide an
+ optional "suppress_wildcard" key in its target dict. When present and
+ true, a wildcard dependency link will not include such targets.
+
+ All dependency names, including the keys to |targets| and the values in each
+ dependency list, must be qualified when this function is called.
+ """
+
+ for target, target_dict in targets.iteritems():
+ toolset = target_dict['toolset']
+ target_build_file = gyp.common.BuildFile(target)
+ for dependency_key in dependency_sections:
+ dependencies = target_dict.get(dependency_key, [])
+
+ # Loop this way instead of "for dependency in" or "for index in xrange"
+ # because the dependencies list will be modified within the loop body.
+ index = 0
+ while index < len(dependencies):
+ (dependency_build_file, dependency_target, dependency_toolset) = \
+ gyp.common.ParseQualifiedTarget(dependencies[index])
+ if dependency_target != '*' and dependency_toolset != '*':
+ # Not a wildcard. Keep it moving.
+ index = index + 1
+ continue
+
+ if dependency_build_file == target_build_file:
+ # It's an error for a target to depend on all other targets in
+ # the same file, because a target cannot depend on itself.
+ raise KeyError, 'Found wildcard in ' + dependency_key + ' of ' + \
+ target + ' referring to same build file'
+
+ # Take the wildcard out and adjust the index so that the next
+ # dependency in the list will be processed the next time through the
+ # loop.
+ del dependencies[index]
+ index = index - 1
+
+ # Loop through the targets in the other build file, adding them to
+ # this target's list of dependencies in place of the removed
+ # wildcard.
+ dependency_target_dicts = data[dependency_build_file]['targets']
+ for dependency_target_dict in dependency_target_dicts:
+ if int(dependency_target_dict.get('suppress_wildcard', False)):
+ continue
+ dependency_target_name = dependency_target_dict['target_name']
+ if (dependency_target != '*' and
+ dependency_target != dependency_target_name):
+ continue
+ dependency_target_toolset = dependency_target_dict['toolset']
+ if (dependency_toolset != '*' and
+ dependency_toolset != dependency_target_toolset):
+ continue
+ dependency = gyp.common.QualifiedTarget(dependency_build_file,
+ dependency_target_name,
+ dependency_target_toolset)
+ index = index + 1
+ dependencies.insert(index, dependency)
+
+ index = index + 1
+
+
+class DependencyGraphNode(object):
+ """
+
+ Attributes:
+ ref: A reference to an object that this DependencyGraphNode represents.
+ dependencies: List of DependencyGraphNodes on which this one depends.
+ dependents: List of DependencyGraphNodes that depend on this one.
+ """
+
+ class CircularException(Exception):
+ pass
+
+ def __init__(self, ref):
+ self.ref = ref
+ self.dependencies = []
+ self.dependents = []
+
+ def FlattenToList(self):
+ # flat_list is the sorted list of dependencies - actually, the list items
+ # are the "ref" attributes of DependencyGraphNodes. Every target will
+ # appear in flat_list after all of its dependencies, and before all of its
+ # dependents.
+ flat_list = []
+
+ # in_degree_zeros is the list of DependencyGraphNodes that have no
+ # dependencies not in flat_list. Initially, it is a copy of the children
+ # of this node, because when the graph was built, nodes with no
+ # dependencies were made implicit dependents of the root node.
+ in_degree_zeros = self.dependents[:]
+
+ while in_degree_zeros:
+ # Nodes in in_degree_zeros have no dependencies not in flat_list, so they
+ # can be appended to flat_list. Take these nodes out of in_degree_zeros
+ # as work progresses, so that the next node to process from the list can
+ # always be accessed at a consistent position.
+ node = in_degree_zeros.pop(0)
+ flat_list.append(node.ref)
+
+ # Look at dependents of the node just added to flat_list. Some of them
+ # may now belong in in_degree_zeros.
+ for node_dependent in node.dependents:
+ is_in_degree_zero = True
+ for node_dependent_dependency in node_dependent.dependencies:
+ if not node_dependent_dependency.ref in flat_list:
+ # The dependent one or more dependencies not in flat_list. There
+ # will be more chances to add it to flat_list when examining
+ # it again as a dependent of those other dependencies, provided
+ # that there are no cycles.
+ is_in_degree_zero = False
+ break
+
+ if is_in_degree_zero:
+ # All of the dependent's dependencies are already in flat_list. Add
+ # it to in_degree_zeros where it will be processed in a future
+ # iteration of the outer loop.
+ in_degree_zeros.append(node_dependent)
+
+ return flat_list
+
+ def DirectDependencies(self, dependencies=None):
+ """Returns a list of just direct dependencies."""
+ if dependencies == None:
+ dependencies = []
+
+ for dependency in self.dependencies:
+ # Check for None, corresponding to the root node.
+ if dependency.ref != None and dependency.ref not in dependencies:
+ dependencies.append(dependency.ref)
+
+ return dependencies
+
+ def _AddImportedDependencies(self, targets, dependencies=None):
+ """Given a list of direct dependencies, adds indirect dependencies that
+ other dependencies have declared to export their settings.
+
+ This method does not operate on self. Rather, it operates on the list
+ of dependencies in the |dependencies| argument. For each dependency in
+ that list, if any declares that it exports the settings of one of its
+ own dependencies, those dependencies whose settings are "passed through"
+ are added to the list. As new items are added to the list, they too will
+ be processed, so it is possible to import settings through multiple levels
+ of dependencies.
+
+ This method is not terribly useful on its own, it depends on being
+ "primed" with a list of direct dependencies such as one provided by
+ DirectDependencies. DirectAndImportedDependencies is intended to be the
+ public entry point.
+ """
+
+ if dependencies == None:
+ dependencies = []
+
+ index = 0
+ while index < len(dependencies):
+ dependency = dependencies[index]
+ dependency_dict = targets[dependency]
+ # Add any dependencies whose settings should be imported to the list
+ # if not already present. Newly-added items will be checked for
+ # their own imports when the list iteration reaches them.
+ # Rather than simply appending new items, insert them after the
+ # dependency that exported them. This is done to more closely match
+ # the depth-first method used by DeepDependencies.
+ add_index = 1
+ for imported_dependency in \
+ dependency_dict.get('export_dependent_settings', []):
+ if imported_dependency not in dependencies:
+ dependencies.insert(index + add_index, imported_dependency)
+ add_index = add_index + 1
+ index = index + 1
+
+ return dependencies
+
+ def DirectAndImportedDependencies(self, targets, dependencies=None):
+ """Returns a list of a target's direct dependencies and all indirect
+ dependencies that a dependency has advertised settings should be exported
+ through the dependency for.
+ """
+
+ dependencies = self.DirectDependencies(dependencies)
+ return self._AddImportedDependencies(targets, dependencies)
+
+ def DeepDependencies(self, dependencies=None):
+ """Returns a list of all of a target's dependencies, recursively."""
+ if dependencies == None:
+ dependencies = []
+
+ for dependency in self.dependencies:
+ # Check for None, corresponding to the root node.
+ if dependency.ref != None and dependency.ref not in dependencies:
+ dependencies.append(dependency.ref)
+ dependency.DeepDependencies(dependencies)
+
+ return dependencies
+
+ def LinkDependencies(self, targets, dependencies=None, initial=True):
+ """Returns a list of dependency targets that are linked into this target.
+
+ This function has a split personality, depending on the setting of
+ |initial|. Outside callers should always leave |initial| at its default
+ setting.
+
+ When adding a target to the list of dependencies, this function will
+ recurse into itself with |initial| set to False, to collect depenedencies
+ that are linked into the linkable target for which the list is being built.
+ """
+ if dependencies == None:
+ dependencies = []
+
+ # Check for None, corresponding to the root node.
+ if self.ref == None:
+ return dependencies
+
+ # It's kind of sucky that |targets| has to be passed into this function,
+ # but that's presently the easiest way to access the target dicts so that
+ # this function can find target types.
+
+ if not 'target_name' in targets[self.ref]:
+ raise Exception("Missing 'target_name' field in target.")
+
+ try:
+ target_type = targets[self.ref]['type']
+ except KeyError, e:
+ raise Exception("Missing 'type' field in target %s" %
+ targets[self.ref]['target_name'])
+
+ is_linkable = target_type in linkable_types
+
+ if initial and not is_linkable:
+ # If this is the first target being examined and it's not linkable,
+ # return an empty list of link dependencies, because the link
+ # dependencies are intended to apply to the target itself (initial is
+ # True) and this target won't be linked.
+ return dependencies
+
+ # Executables and loadable modules are already fully and finally linked.
+ # Nothing else can be a link dependency of them, there can only be
+ # dependencies in the sense that a dependent target might run an
+ # executable or load the loadable_module.
+ if not initial and target_type in ('executable', 'loadable_module'):
+ return dependencies
+
+ # The target is linkable, add it to the list of link dependencies.
+ if self.ref not in dependencies:
+ if target_type != 'none':
+ # Special case: "none" type targets don't produce any linkable products
+ # and shouldn't be exposed as link dependencies, although dependencies
+ # of "none" type targets may still be link dependencies.
+ dependencies.append(self.ref)
+ if initial or not is_linkable:
+ # If this is a subsequent target and it's linkable, don't look any
+ # further for linkable dependencies, as they'll already be linked into
+ # this target linkable. Always look at dependencies of the initial
+ # target, and always look at dependencies of non-linkables.
+ for dependency in self.dependencies:
+ dependency.LinkDependencies(targets, dependencies, False)
+
+ return dependencies
+
+
+def BuildDependencyList(targets):
+ # Create a DependencyGraphNode for each target. Put it into a dict for easy
+ # access.
+ dependency_nodes = {}
+ for target, spec in targets.iteritems():
+ if not target in dependency_nodes:
+ dependency_nodes[target] = DependencyGraphNode(target)
+
+ # Set up the dependency links. Targets that have no dependencies are treated
+ # as dependent on root_node.
+ root_node = DependencyGraphNode(None)
+ for target, spec in targets.iteritems():
+ target_node = dependency_nodes[target]
+ target_build_file = gyp.common.BuildFile(target)
+ if not 'dependencies' in spec or len(spec['dependencies']) == 0:
+ target_node.dependencies = [root_node]
+ root_node.dependents.append(target_node)
+ else:
+ dependencies = spec['dependencies']
+ for index in xrange(0, len(dependencies)):
+ try:
+ dependency = dependencies[index]
+ dependency_node = dependency_nodes[dependency]
+ target_node.dependencies.append(dependency_node)
+ dependency_node.dependents.append(target_node)
+ except KeyError, e:
+ gyp.common.ExceptionAppend(e,
+ 'while trying to load target %s' % target)
+ raise
+
+ flat_list = root_node.FlattenToList()
+
+ # If there's anything left unvisited, there must be a circular dependency
+ # (cycle). If you need to figure out what's wrong, look for elements of
+ # targets that are not in flat_list.
+ if len(flat_list) != len(targets):
+ raise DependencyGraphNode.CircularException, \
+ 'Some targets not reachable, cycle in dependency graph detected'
+
+ return [dependency_nodes, flat_list]
+
+
+def VerifyNoGYPFileCircularDependencies(targets):
+ # Create a DependencyGraphNode for each gyp file containing a target. Put
+ # it into a dict for easy access.
+ dependency_nodes = {}
+ for target in targets.iterkeys():
+ build_file = gyp.common.BuildFile(target)
+ if not build_file in dependency_nodes:
+ dependency_nodes[build_file] = DependencyGraphNode(build_file)
+
+ # Set up the dependency links.
+ for target, spec in targets.iteritems():
+ build_file = gyp.common.BuildFile(target)
+ build_file_node = dependency_nodes[build_file]
+ target_dependencies = spec.get('dependencies', [])
+ for dependency in target_dependencies:
+ try:
+ dependency_build_file = gyp.common.BuildFile(dependency)
+ if dependency_build_file == build_file:
+ # A .gyp file is allowed to refer back to itself.
+ continue
+ dependency_node = dependency_nodes[dependency_build_file]
+ if dependency_node not in build_file_node.dependencies:
+ build_file_node.dependencies.append(dependency_node)
+ dependency_node.dependents.append(build_file_node)
+ except KeyError, e:
+ gyp.common.ExceptionAppend(
+ e, 'while computing dependencies of .gyp file %s' % build_file)
+ raise
+
+ # Files that have no dependencies are treated as dependent on root_node.
+ root_node = DependencyGraphNode(None)
+ for build_file_node in dependency_nodes.itervalues():
+ if len(build_file_node.dependencies) == 0:
+ build_file_node.dependencies.append(root_node)
+ root_node.dependents.append(build_file_node)
+
+ flat_list = root_node.FlattenToList()
+
+ # If there's anything left unvisited, there must be a circular dependency
+ # (cycle).
+ if len(flat_list) != len(dependency_nodes):
+ bad_files = []
+ for file in dependency_nodes.iterkeys():
+ if not file in flat_list:
+ bad_files.append(file)
+ raise DependencyGraphNode.CircularException, \
+ 'Some files not reachable, cycle in .gyp file dependency graph ' + \
+ 'detected involving some or all of: ' + \
+ ' '.join(bad_files)
+
+
+def DoDependentSettings(key, flat_list, targets, dependency_nodes):
+ # key should be one of all_dependent_settings, direct_dependent_settings,
+ # or link_settings.
+
+ for target in flat_list:
+ target_dict = targets[target]
+ build_file = gyp.common.BuildFile(target)
+
+ if key == 'all_dependent_settings':
+ dependencies = dependency_nodes[target].DeepDependencies()
+ elif key == 'direct_dependent_settings':
+ dependencies = \
+ dependency_nodes[target].DirectAndImportedDependencies(targets)
+ elif key == 'link_settings':
+ dependencies = dependency_nodes[target].LinkDependencies(targets)
+ else:
+ raise KeyError, "DoDependentSettings doesn't know how to determine " + \
+ 'dependencies for ' + key
+
+ for dependency in dependencies:
+ dependency_dict = targets[dependency]
+ if not key in dependency_dict:
+ continue
+ dependency_build_file = gyp.common.BuildFile(dependency)
+ MergeDicts(target_dict, dependency_dict[key],
+ build_file, dependency_build_file)
+
+
+def AdjustStaticLibraryDependencies(flat_list, targets, dependency_nodes):
+ # Recompute target "dependencies" properties. For each static library
+ # target, remove "dependencies" entries referring to other static libraries,
+ # unless the dependency has the "hard_dependency" attribute set. For each
+ # linkable target, add a "dependencies" entry referring to all of the
+ # target's computed list of link dependencies (including static libraries
+ # if no such entry is already present.
+ for target in flat_list:
+ target_dict = targets[target]
+ target_type = target_dict['type']
+
+ if target_type == 'static_library':
+ if not 'dependencies' in target_dict:
+ continue
+
+ target_dict['dependencies_original'] = target_dict.get(
+ 'dependencies', [])[:]
+
+ index = 0
+ while index < len(target_dict['dependencies']):
+ dependency = target_dict['dependencies'][index]
+ dependency_dict = targets[dependency]
+ if dependency_dict['type'] == 'static_library' and \
+ (not 'hard_dependency' in dependency_dict or \
+ not dependency_dict['hard_dependency']):
+ # A static library should not depend on another static library unless
+ # the dependency relationship is "hard," which should only be done
+ # when a dependent relies on some side effect other than just the
+ # build product, like a rule or action output. Take the dependency
+ # out of the list, and don't increment index because the next
+ # dependency to analyze will shift into the index formerly occupied
+ # by the one being removed.
+ del target_dict['dependencies'][index]
+ else:
+ index = index + 1
+
+ # If the dependencies list is empty, it's not needed, so unhook it.
+ if len(target_dict['dependencies']) == 0:
+ del target_dict['dependencies']
+
+ elif target_type in linkable_types:
+ # Get a list of dependency targets that should be linked into this
+ # target. Add them to the dependencies list if they're not already
+ # present.
+
+ link_dependencies = dependency_nodes[target].LinkDependencies(targets)
+ for dependency in link_dependencies:
+ if dependency == target:
+ continue
+ if not 'dependencies' in target_dict:
+ target_dict['dependencies'] = []
+ if not dependency in target_dict['dependencies']:
+ target_dict['dependencies'].append(dependency)
+
+# Initialize this here to speed up MakePathRelative.
+exception_re = re.compile(r'''["']?[-/$<>]''')
+
+
+def MakePathRelative(to_file, fro_file, item):
+ # If item is a relative path, it's relative to the build file dict that it's
+ # coming from. Fix it up to make it relative to the build file dict that
+ # it's going into.
+ # Exception: any |item| that begins with these special characters is
+ # returned without modification.
+ # / Used when a path is already absolute (shortcut optimization;
+ # such paths would be returned as absolute anyway)
+ # $ Used for build environment variables
+ # - Used for some build environment flags (such as -lapr-1 in a
+ # "libraries" section)
+ # < Used for our own variable and command expansions (see ExpandVariables)
+ # > Used for our own variable and command expansions (see ExpandVariables)
+ #
+ # "/' Used when a value is quoted. If these are present, then we
+ # check the second character instead.
+ #
+ if to_file == fro_file or exception_re.match(item):
+ return item
+ else:
+ # TODO(dglazkov) The backslash/forward-slash replacement at the end is a
+ # temporary measure. This should really be addressed by keeping all paths
+ # in POSIX until actual project generation.
+ ret = os.path.normpath(os.path.join(
+ gyp.common.RelativePath(os.path.dirname(fro_file),
+ os.path.dirname(to_file)),
+ item)).replace('\\', '/')
+ if item[-1] == '/':
+ ret += '/'
+ return ret
+
+def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True):
+ prepend_index = 0
+
+ for item in fro:
+ singleton = False
+ if isinstance(item, str) or isinstance(item, int):
+ # The cheap and easy case.
+ if is_paths:
+ to_item = MakePathRelative(to_file, fro_file, item)
+ else:
+ to_item = item
+
+ if not isinstance(item, str) or not item.startswith('-'):
+ # Any string that doesn't begin with a "-" is a singleton - it can
+ # only appear once in a list, to be enforced by the list merge append
+ # or prepend.
+ singleton = True
+ elif isinstance(item, dict):
+ # Make a copy of the dictionary, continuing to look for paths to fix.
+ # The other intelligent aspects of merge processing won't apply because
+ # item is being merged into an empty dict.
+ to_item = {}
+ MergeDicts(to_item, item, to_file, fro_file)
+ elif isinstance(item, list):
+ # Recurse, making a copy of the list. If the list contains any
+ # descendant dicts, path fixing will occur. Note that here, custom
+ # values for is_paths and append are dropped; those are only to be
+ # applied to |to| and |fro|, not sublists of |fro|. append shouldn't
+ # matter anyway because the new |to_item| list is empty.
+ to_item = []
+ MergeLists(to_item, item, to_file, fro_file)
+ else:
+ raise TypeError, \
+ 'Attempt to merge list item of unsupported type ' + \
+ item.__class__.__name__
+
+ if append:
+ # If appending a singleton that's already in the list, don't append.
+ # This ensures that the earliest occurrence of the item will stay put.
+ if not singleton or not to_item in to:
+ to.append(to_item)
+ else:
+ # If prepending a singleton that's already in the list, remove the
+ # existing instance and proceed with the prepend. This ensures that the
+ # item appears at the earliest possible position in the list.
+ while singleton and to_item in to:
+ to.remove(to_item)
+
+ # Don't just insert everything at index 0. That would prepend the new
+ # items to the list in reverse order, which would be an unwelcome
+ # surprise.
+ to.insert(prepend_index, to_item)
+ prepend_index = prepend_index + 1
+
+
+def MergeDicts(to, fro, to_file, fro_file):
+ # I wanted to name the parameter "from" but it's a Python keyword...
+ for k, v in fro.iteritems():
+ # It would be nice to do "if not k in to: to[k] = v" but that wouldn't give
+ # copy semantics. Something else may want to merge from the |fro| dict
+ # later, and having the same dict ref pointed to twice in the tree isn't
+ # what anyone wants considering that the dicts may subsequently be
+ # modified.
+ if k in to:
+ bad_merge = False
+ if isinstance(v, str) or isinstance(v, int):
+ if not (isinstance(to[k], str) or isinstance(to[k], int)):
+ bad_merge = True
+ elif v.__class__ != to[k].__class__:
+ bad_merge = True
+
+ if bad_merge:
+ raise TypeError, \
+ 'Attempt to merge dict value of type ' + v.__class__.__name__ + \
+ ' into incompatible type ' + to[k].__class__.__name__ + \
+ ' for key ' + k
+ if isinstance(v, str) or isinstance(v, int):
+ # Overwrite the existing value, if any. Cheap and easy.
+ is_path = IsPathSection(k)
+ if is_path:
+ to[k] = MakePathRelative(to_file, fro_file, v)
+ else:
+ to[k] = v
+ elif isinstance(v, dict):
+ # Recurse, guaranteeing copies will be made of objects that require it.
+ if not k in to:
+ to[k] = {}
+ MergeDicts(to[k], v, to_file, fro_file)
+ elif isinstance(v, list):
+ # Lists in dicts can be merged with different policies, depending on
+ # how the key in the "from" dict (k, the from-key) is written.
+ #
+ # If the from-key has ...the to-list will have this action
+ # this character appended:... applied when receiving the from-list:
+ # = replace
+ # + prepend
+ # ? set, only if to-list does not yet exist
+ # (none) append
+ #
+ # This logic is list-specific, but since it relies on the associated
+ # dict key, it's checked in this dict-oriented function.
+ ext = k[-1]
+ append = True
+ if ext == '=':
+ list_base = k[:-1]
+ lists_incompatible = [list_base, list_base + '?']
+ to[list_base] = []
+ elif ext == '+':
+ list_base = k[:-1]
+ lists_incompatible = [list_base + '=', list_base + '?']
+ append = False
+ elif ext == '?':
+ list_base = k[:-1]
+ lists_incompatible = [list_base, list_base + '=', list_base + '+']
+ else:
+ list_base = k
+ lists_incompatible = [list_base + '=', list_base + '?']
+
+ # Some combinations of merge policies appearing together are meaningless.
+ # It's stupid to replace and append simultaneously, for example. Append
+ # and prepend are the only policies that can coexist.
+ for list_incompatible in lists_incompatible:
+ if list_incompatible in fro:
+ raise KeyError, 'Incompatible list policies ' + k + ' and ' + \
+ list_incompatible
+
+ if list_base in to:
+ if ext == '?':
+ # If the key ends in "?", the list will only be merged if it doesn't
+ # already exist.
+ continue
+ if not isinstance(to[list_base], list):
+ # This may not have been checked above if merging in a list with an
+ # extension character.
+ raise TypeError, \
+ 'Attempt to merge dict value of type ' + v.__class__.__name__ + \
+ ' into incompatible type ' + to[list_base].__class__.__name__ + \
+ ' for key ' + list_base + '(' + k + ')'
+ else:
+ to[list_base] = []
+
+ # Call MergeLists, which will make copies of objects that require it.
+ # MergeLists can recurse back into MergeDicts, although this will be
+ # to make copies of dicts (with paths fixed), there will be no
+ # subsequent dict "merging" once entering a list because lists are
+ # always replaced, appended to, or prepended to.
+ is_paths = IsPathSection(list_base)
+ MergeLists(to[list_base], v, to_file, fro_file, is_paths, append)
+ else:
+ raise TypeError, \
+ 'Attempt to merge dict value of unsupported type ' + \
+ v.__class__.__name__ + ' for key ' + k
+
+
+def MergeConfigWithInheritance(new_configuration_dict, build_file,
+ target_dict, configuration, visited):
+ # Skip if previously visted.
+ if configuration in visited:
+ return
+
+ # Look at this configuration.
+ configuration_dict = target_dict['configurations'][configuration]
+
+ # Merge in parents.
+ for parent in configuration_dict.get('inherit_from', []):
+ MergeConfigWithInheritance(new_configuration_dict, build_file,
+ target_dict, parent, visited + [configuration])
+
+ # Merge it into the new config.
+ MergeDicts(new_configuration_dict, configuration_dict,
+ build_file, build_file)
+
+ # Drop abstract.
+ if 'abstract' in new_configuration_dict:
+ del new_configuration_dict['abstract']
+
+
+def SetUpConfigurations(target, target_dict):
+ global non_configuration_keys
+ # key_suffixes is a list of key suffixes that might appear on key names.
+ # These suffixes are handled in conditional evaluations (for =, +, and ?)
+ # and rules/exclude processing (for ! and /). Keys with these suffixes
+ # should be treated the same as keys without.
+ key_suffixes = ['=', '+', '?', '!', '/']
+
+ build_file = gyp.common.BuildFile(target)
+
+ # Provide a single configuration by default if none exists.
+ # TODO(mark): Signal an error if default_configurations exists but
+ # configurations does not.
+ if not 'configurations' in target_dict:
+ target_dict['configurations'] = {'Default': {}}
+ if not 'default_configuration' in target_dict:
+ concrete = [i for i in target_dict['configurations'].keys()
+ if not target_dict['configurations'][i].get('abstract')]
+ target_dict['default_configuration'] = sorted(concrete)[0]
+
+ for configuration in target_dict['configurations'].keys():
+ old_configuration_dict = target_dict['configurations'][configuration]
+ # Skip abstract configurations (saves work only).
+ if old_configuration_dict.get('abstract'):
+ continue
+ # Configurations inherit (most) settings from the enclosing target scope.
+ # Get the inheritance relationship right by making a copy of the target
+ # dict.
+ new_configuration_dict = copy.deepcopy(target_dict)
+
+ # Take out the bits that don't belong in a "configurations" section.
+ # Since configuration setup is done before conditional, exclude, and rules
+ # processing, be careful with handling of the suffix characters used in
+ # those phases.
+ delete_keys = []
+ for key in new_configuration_dict:
+ key_ext = key[-1:]
+ if key_ext in key_suffixes:
+ key_base = key[:-1]
+ else:
+ key_base = key
+ if key_base in non_configuration_keys:
+ delete_keys.append(key)
+
+ for key in delete_keys:
+ del new_configuration_dict[key]
+
+ # Merge in configuration (with all its parents first).
+ MergeConfigWithInheritance(new_configuration_dict, build_file,
+ target_dict, configuration, [])
+
+ # Put the new result back into the target dict as a configuration.
+ target_dict['configurations'][configuration] = new_configuration_dict
+
+ # Now drop all the abstract ones.
+ for configuration in target_dict['configurations'].keys():
+ old_configuration_dict = target_dict['configurations'][configuration]
+ if old_configuration_dict.get('abstract'):
+ del target_dict['configurations'][configuration]
+
+ # Now that all of the target's configurations have been built, go through
+ # the target dict's keys and remove everything that's been moved into a
+ # "configurations" section.
+ delete_keys = []
+ for key in target_dict:
+ key_ext = key[-1:]
+ if key_ext in key_suffixes:
+ key_base = key[:-1]
+ else:
+ key_base = key
+ if not key_base in non_configuration_keys:
+ delete_keys.append(key)
+ for key in delete_keys:
+ del target_dict[key]
+
+ # Check the configurations to see if they contain invalid keys.
+ for configuration in target_dict['configurations'].keys():
+ configuration_dict = target_dict['configurations'][configuration]
+ for key in configuration_dict.keys():
+ if key in invalid_configuration_keys:
+ raise KeyError, ('%s not allowed in the %s configuration, found in '
+ 'target %s' % (key, configuration, target))
+
+
+
+def ProcessListFiltersInDict(name, the_dict):
+ """Process regular expression and exclusion-based filters on lists.
+
+ An exclusion list is in a dict key named with a trailing "!", like
+ "sources!". Every item in such a list is removed from the associated
+ main list, which in this example, would be "sources". Removed items are
+ placed into a "sources_excluded" list in the dict.
+
+ Regular expression (regex) filters are contained in dict keys named with a
+ trailing "/", such as "sources/" to operate on the "sources" list. Regex
+ filters in a dict take the form:
+ 'sources/': [ ['exclude', '_(linux|mac|win)\\.cc$'] ],
+ ['include', '_mac\\.cc$'] ],
+ The first filter says to exclude all files ending in _linux.cc, _mac.cc, and
+ _win.cc. The second filter then includes all files ending in _mac.cc that
+ are now or were once in the "sources" list. Items matching an "exclude"
+ filter are subject to the same processing as would occur if they were listed
+ by name in an exclusion list (ending in "!"). Items matching an "include"
+ filter are brought back into the main list if previously excluded by an
+ exclusion list or exclusion regex filter. Subsequent matching "exclude"
+ patterns can still cause items to be excluded after matching an "include".
+ """
+
+ # Look through the dictionary for any lists whose keys end in "!" or "/".
+ # These are lists that will be treated as exclude lists and regular
+ # expression-based exclude/include lists. Collect the lists that are
+ # needed first, looking for the lists that they operate on, and assemble
+ # then into |lists|. This is done in a separate loop up front, because
+ # the _included and _excluded keys need to be added to the_dict, and that
+ # can't be done while iterating through it.
+
+ lists = []
+ del_lists = []
+ for key, value in the_dict.iteritems():
+ operation = key[-1]
+ if operation != '!' and operation != '/':
+ continue
+
+ if not isinstance(value, list):
+ raise ValueError, name + ' key ' + key + ' must be list, not ' + \
+ value.__class__.__name__
+
+ list_key = key[:-1]
+ if list_key not in the_dict:
+ # This happens when there's a list like "sources!" but no corresponding
+ # "sources" list. Since there's nothing for it to operate on, queue up
+ # the "sources!" list for deletion now.
+ del_lists.append(key)
+ continue
+
+ if not isinstance(the_dict[list_key], list):
+ raise ValueError, name + ' key ' + list_key + \
+ ' must be list, not ' + \
+ value.__class__.__name__ + ' when applying ' + \
+ {'!': 'exclusion', '/': 'regex'}[operation]
+
+ if not list_key in lists:
+ lists.append(list_key)
+
+ # Delete the lists that are known to be unneeded at this point.
+ for del_list in del_lists:
+ del the_dict[del_list]
+
+ for list_key in lists:
+ the_list = the_dict[list_key]
+
+ # Initialize the list_actions list, which is parallel to the_list. Each
+ # item in list_actions identifies whether the corresponding item in
+ # the_list should be excluded, unconditionally preserved (included), or
+ # whether no exclusion or inclusion has been applied. Items for which
+ # no exclusion or inclusion has been applied (yet) have value -1, items
+ # excluded have value 0, and items included have value 1. Includes and
+ # excludes override previous actions. All items in list_actions are
+ # initialized to -1 because no excludes or includes have been processed
+ # yet.
+ list_actions = list((-1,) * len(the_list))
+
+ exclude_key = list_key + '!'
+ if exclude_key in the_dict:
+ for exclude_item in the_dict[exclude_key]:
+ for index in xrange(0, len(the_list)):
+ if exclude_item == the_list[index]:
+ # This item matches the exclude_item, so set its action to 0
+ # (exclude).
+ list_actions[index] = 0
+
+ # The "whatever!" list is no longer needed, dump it.
+ del the_dict[exclude_key]
+
+ regex_key = list_key + '/'
+ if regex_key in the_dict:
+ for regex_item in the_dict[regex_key]:
+ [action, pattern] = regex_item
+ pattern_re = re.compile(pattern)
+
+ for index in xrange(0, len(the_list)):
+ list_item = the_list[index]
+ if pattern_re.search(list_item):
+ # Regular expression match.
+
+ if action == 'exclude':
+ # This item matches an exclude regex, so set its value to 0
+ # (exclude).
+ list_actions[index] = 0
+ elif action == 'include':
+ # This item matches an include regex, so set its value to 1
+ # (include).
+ list_actions[index] = 1
+ else:
+ # This is an action that doesn't make any sense.
+ raise ValueError, 'Unrecognized action ' + action + ' in ' + \
+ name + ' key ' + key
+
+ # The "whatever/" list is no longer needed, dump it.
+ del the_dict[regex_key]
+
+ # Add excluded items to the excluded list.
+ #
+ # Note that exclude_key ("sources!") is different from excluded_key
+ # ("sources_excluded"). The exclude_key list is input and it was already
+ # processed and deleted; the excluded_key list is output and it's about
+ # to be created.
+ excluded_key = list_key + '_excluded'
+ if excluded_key in the_dict:
+ raise KeyError, \
+ name + ' key ' + excluded_key + ' must not be present prior ' + \
+ ' to applying exclusion/regex filters for ' + list_key
+
+ excluded_list = []
+
+ # Go backwards through the list_actions list so that as items are deleted,
+ # the indices of items that haven't been seen yet don't shift. That means
+ # that things need to be prepended to excluded_list to maintain them in the
+ # same order that they existed in the_list.
+ for index in xrange(len(list_actions) - 1, -1, -1):
+ if list_actions[index] == 0:
+ # Dump anything with action 0 (exclude). Keep anything with action 1
+ # (include) or -1 (no include or exclude seen for the item).
+ excluded_list.insert(0, the_list[index])
+ del the_list[index]
+
+ # If anything was excluded, put the excluded list into the_dict at
+ # excluded_key.
+ if len(excluded_list) > 0:
+ the_dict[excluded_key] = excluded_list
+
+ # Now recurse into subdicts and lists that may contain dicts.
+ for key, value in the_dict.iteritems():
+ if isinstance(value, dict):
+ ProcessListFiltersInDict(key, value)
+ elif isinstance(value, list):
+ ProcessListFiltersInList(key, value)
+
+
+def ProcessListFiltersInList(name, the_list):
+ for item in the_list:
+ if isinstance(item, dict):
+ ProcessListFiltersInDict(name, item)
+ elif isinstance(item, list):
+ ProcessListFiltersInList(name, item)
+
+
+def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules):
+ """Ensures that the rules sections in target_dict are valid and consistent,
+ and determines which sources they apply to.
+
+ Arguments:
+ target: string, name of target.
+ target_dict: dict, target spec containing "rules" and "sources" lists.
+ extra_sources_for_rules: a list of keys to scan for rule matches in
+ addition to 'sources'.
+ """
+
+ # Dicts to map between values found in rules' 'rule_name' and 'extension'
+ # keys and the rule dicts themselves.
+ rule_names = {}
+ rule_extensions = {}
+
+ rules = target_dict.get('rules', [])
+ for rule in rules:
+ # Make sure that there's no conflict among rule names and extensions.
+ rule_name = rule['rule_name']
+ if rule_name in rule_names:
+ raise KeyError, 'rule %s exists in duplicate, target %s' % \
+ (rule_name, target)
+ rule_names[rule_name] = rule
+
+ rule_extension = rule['extension']
+ if rule_extension in rule_extensions:
+ raise KeyError, ('extension %s associated with multiple rules, ' +
+ 'target %s rules %s and %s') % \
+ (rule_extension, target,
+ rule_extensions[rule_extension]['rule_name'],
+ rule_name)
+ rule_extensions[rule_extension] = rule
+
+ # Make sure rule_sources isn't already there. It's going to be
+ # created below if needed.
+ if 'rule_sources' in rule:
+ raise KeyError, \
+ 'rule_sources must not exist in input, target %s rule %s' % \
+ (target, rule_name)
+ extension = rule['extension']
+
+ rule_sources = []
+ source_keys = ['sources']
+ source_keys.extend(extra_sources_for_rules)
+ for source_key in source_keys:
+ for source in target_dict.get(source_key, []):
+ (source_root, source_extension) = os.path.splitext(source)
+ if source_extension.startswith('.'):
+ source_extension = source_extension[1:]
+ if source_extension == extension:
+ rule_sources.append(source)
+
+ if len(rule_sources) > 0:
+ rule['rule_sources'] = rule_sources
+
+
+def ValidateActionsInTarget(target, target_dict, build_file):
+ '''Validates the inputs to the actions in a target.'''
+ target_name = target_dict.get('target_name')
+ actions = target_dict.get('actions', [])
+ for action in actions:
+ action_name = action.get('action_name')
+ if not action_name:
+ raise Exception("Anonymous action in target %s. "
+ "An action must have an 'action_name' field." %
+ target_name)
+ inputs = action.get('inputs', [])
+
+
+def ValidateRunAsInTarget(target, target_dict, build_file):
+ target_name = target_dict.get('target_name')
+ run_as = target_dict.get('run_as')
+ if not run_as:
+ return
+ if not isinstance(run_as, dict):
+ raise Exception("The 'run_as' in target %s from file %s should be a "
+ "dictionary." %
+ (target_name, build_file))
+ action = run_as.get('action')
+ if not action:
+ raise Exception("The 'run_as' in target %s from file %s must have an "
+ "'action' section." %
+ (target_name, build_file))
+ if not isinstance(action, list):
+ raise Exception("The 'action' for 'run_as' in target %s from file %s "
+ "must be a list." %
+ (target_name, build_file))
+ working_directory = run_as.get('working_directory')
+ if working_directory and not isinstance(working_directory, str):
+ raise Exception("The 'working_directory' for 'run_as' in target %s "
+ "in file %s should be a string." %
+ (target_name, build_file))
+ environment = run_as.get('environment')
+ if environment and not isinstance(environment, dict):
+ raise Exception("The 'environment' for 'run_as' in target %s "
+ "in file %s should be a dictionary." %
+ (target_name, build_file))
+
+
+def TurnIntIntoStrInDict(the_dict):
+ """Given dict the_dict, recursively converts all integers into strings.
+ """
+ # Use items instead of iteritems because there's no need to try to look at
+ # reinserted keys and their associated values.
+ for k, v in the_dict.items():
+ if isinstance(v, int):
+ v = str(v)
+ the_dict[k] = v
+ elif isinstance(v, dict):
+ TurnIntIntoStrInDict(v)
+ elif isinstance(v, list):
+ TurnIntIntoStrInList(v)
+
+ if isinstance(k, int):
+ the_dict[str(k)] = v
+ del the_dict[k]
+
+
+def TurnIntIntoStrInList(the_list):
+ """Given list the_list, recursively converts all integers into strings.
+ """
+ for index in xrange(0, len(the_list)):
+ item = the_list[index]
+ if isinstance(item, int):
+ the_list[index] = str(item)
+ elif isinstance(item, dict):
+ TurnIntIntoStrInDict(item)
+ elif isinstance(item, list):
+ TurnIntIntoStrInList(item)
+
+
+def VerifyNoCollidingTargets(targets):
+ """Verify that no two targets in the same directory share the same name.
+
+ Arguments:
+ targets: A list of targets in the form 'path/to/file.gyp:target_name'.
+ """
+ # Keep a dict going from 'subdirectory:target_name' to 'foo.gyp'.
+ used = {}
+ for target in targets:
+ # Separate out 'path/to/file.gyp, 'target_name' from
+ # 'path/to/file.gyp:target_name'.
+ path, name = target.split(':')
+ # Separate out 'path/to', 'file.gyp' from 'path/to/file.gyp'.
+ subdir, gyp = os.path.split(path)
+ # Use '.' for the current directory '', so that the error messages make
+ # more sense.
+ if not subdir:
+ subdir = '.'
+ # Prepare a key like 'path/to:target_name'.
+ key = subdir + ':' + name
+ if key in used:
+ # Complain if this target is already used.
+ raise Exception('Duplicate target name "%s" in directory "%s" used both '
+ 'in "%s" and "%s".' % (name, subdir, gyp, used[key]))
+ used[key] = gyp
+
+
+def Load(build_files, variables, includes, depth, generator_input_info, check,
+ circular_check):
+ # Set up path_sections and non_configuration_keys with the default data plus
+ # the generator-specifc data.
+ global path_sections
+ path_sections = base_path_sections[:]
+ path_sections.extend(generator_input_info['path_sections'])
+
+ global non_configuration_keys
+ non_configuration_keys = base_non_configuration_keys[:]
+ non_configuration_keys.extend(generator_input_info['non_configuration_keys'])
+
+ # TODO(mark) handle variants if the generator doesn't want them directly.
+ generator_handles_variants = \
+ generator_input_info['generator_handles_variants']
+
+ global absolute_build_file_paths
+ absolute_build_file_paths = \
+ generator_input_info['generator_wants_absolute_build_file_paths']
+
+ global multiple_toolsets
+ multiple_toolsets = generator_input_info[
+ 'generator_supports_multiple_toolsets']
+
+ # A generator can have other lists (in addition to sources) be processed
+ # for rules.
+ extra_sources_for_rules = generator_input_info['extra_sources_for_rules']
+
+ # Load build files. This loads every target-containing build file into
+ # the |data| dictionary such that the keys to |data| are build file names,
+ # and the values are the entire build file contents after "early" or "pre"
+ # processing has been done and includes have been resolved.
+ # NOTE: data contains both "target" files (.gyp) and "includes" (.gypi), as
+ # well as meta-data (e.g. 'included_files' key). 'target_build_files' keeps
+ # track of the keys corresponding to "target" files.
+ data = {'target_build_files': set()}
+ aux_data = {}
+ for build_file in build_files:
+ # Normalize paths everywhere. This is important because paths will be
+ # used as keys to the data dict and for references between input files.
+ build_file = os.path.normpath(build_file)
+ try:
+ LoadTargetBuildFile(build_file, data, aux_data, variables, includes,
+ depth, check)
+ except Exception, e:
+ gyp.common.ExceptionAppend(e, 'while trying to load %s' % build_file)
+ raise
+
+ # Build a dict to access each target's subdict by qualified name.
+ targets = BuildTargetsDict(data)
+
+ # Fully qualify all dependency links.
+ QualifyDependencies(targets)
+
+ # Expand dependencies specified as build_file:*.
+ ExpandWildcardDependencies(targets, data)
+
+ if circular_check:
+ # Make sure that any targets in a.gyp don't contain dependencies in other
+ # .gyp files that further depend on a.gyp.
+ VerifyNoGYPFileCircularDependencies(targets)
+
+ [dependency_nodes, flat_list] = BuildDependencyList(targets)
+
+ # Check that no two targets in the same directory have the same name.
+ VerifyNoCollidingTargets(flat_list)
+
+
+ # Handle dependent settings of various types.
+ for settings_type in ['all_dependent_settings',
+ 'direct_dependent_settings',
+ 'link_settings']:
+ DoDependentSettings(settings_type, flat_list, targets, dependency_nodes)
+
+ # Take out the dependent settings now that they've been published to all
+ # of the targets that require them.
+ for target in flat_list:
+ if settings_type in targets[target]:
+ del targets[target][settings_type]
+
+ # Make sure static libraries don't declare dependencies on other static
+ # libraries, but that linkables depend on all unlinked static libraries
+ # that they need so that their link steps will be correct.
+ AdjustStaticLibraryDependencies(flat_list, targets, dependency_nodes)
+
+ # Apply "post"/"late"/"target" variable expansions and condition evaluations.
+ for target in flat_list:
+ target_dict = targets[target]
+ build_file = gyp.common.BuildFile(target)
+ ProcessVariablesAndConditionsInDict(target_dict, True, variables,
+ build_file)
+
+ # Move everything that can go into a "configurations" section into one.
+ for target in flat_list:
+ target_dict = targets[target]
+ SetUpConfigurations(target, target_dict)
+
+ # Apply exclude (!) and regex (/) list filters.
+ for target in flat_list:
+ target_dict = targets[target]
+ ProcessListFiltersInDict(target, target_dict)
+
+ # Make sure that the rules make sense, and build up rule_sources lists as
+ # needed. Not all generators will need to use the rule_sources lists, but
+ # some may, and it seems best to build the list in a common spot.
+ # Also validate actions and run_as elements in targets.
+ for target in flat_list:
+ target_dict = targets[target]
+ build_file = gyp.common.BuildFile(target)
+ ValidateRulesInTarget(target, target_dict, extra_sources_for_rules)
+ ValidateRunAsInTarget(target, target_dict, build_file)
+ ValidateActionsInTarget(target, target_dict, build_file)
+
+ # Generators might not expect ints. Turn them into strs.
+ TurnIntIntoStrInDict(data)
+
+ # TODO(mark): Return |data| for now because the generator needs a list of
+ # build files that came in. In the future, maybe it should just accept
+ # a list, and not the whole data dict.
+ return [flat_list, targets, data]
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/system_test.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/system_test.py
new file mode 100644
index 0000000..7aa2d93
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/system_test.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import tempfile
+import shutil
+import subprocess
+
+def TestCommands(commands, files={}, env={}):
+ """Run commands in a temporary directory, returning true if they all succeed.
+ Return false on failures or if any commands produce output.
+
+ Arguments:
+ commands: an array of shell-interpretable commands, e.g. ['ls -l', 'pwd']
+ each will be expanded with Python %-expansion using env first.
+ files: a dictionary mapping filename to contents;
+ files will be created in the temporary directory before running
+ the command.
+ env: a dictionary of strings to expand commands with.
+ """
+ tempdir = tempfile.mkdtemp()
+ try:
+ for name, contents in files.items():
+ f = open(os.path.join(tempdir, name), 'wb')
+ f.write(contents)
+ f.close()
+ for command in commands:
+ proc = subprocess.Popen(command % env, shell=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ cwd=tempdir)
+ output = proc.communicate()[0]
+ if proc.returncode != 0 or output:
+ return False
+ return True
+ finally:
+ shutil.rmtree(tempdir)
+ return False
+
+
+def TestArSupportsT(ar_command='ar', cc_command='cc'):
+ """Test whether 'ar' supports the 'T' flag."""
+ return TestCommands(['%(cc)s -c test.c',
+ '%(ar)s crsT test.a test.o',
+ '%(cc)s test.a'],
+ files={'test.c': 'int main(){}'},
+ env={'ar': ar_command, 'cc': cc_command})
+
+
+def TestLinkerSupportsThreads(cc_command='cc'):
+ """Test whether the linker supports the --threads flag."""
+ return TestCommands(['%(cc)s -Wl,--threads test.c'],
+ files={'test.c': 'int main(){}'},
+ env={'cc': cc_command})
+
+
+if __name__ == '__main__':
+ # Run the various test functions and print the results.
+ def RunTest(description, function, **kwargs):
+ print "Testing " + description + ':',
+ if function(**kwargs):
+ print 'ok'
+ else:
+ print 'fail'
+ RunTest("ar 'T' flag", TestArSupportsT)
+ RunTest("ar 'T' flag with ccache", TestArSupportsT, cc_command='ccache cc')
+ RunTest("ld --threads", TestLinkerSupportsThreads)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xcodeproj_file.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xcodeproj_file.py
new file mode 100644
index 0000000..fcf9abf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xcodeproj_file.py
@@ -0,0 +1,2840 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Xcode project file generator.
+
+This module is both an Xcode project file generator and a documentation of the
+Xcode project file format. Knowledge of the project file format was gained
+based on extensive experience with Xcode, and by making changes to projects in
+Xcode.app and observing the resultant changes in the associated project files.
+
+XCODE PROJECT FILES
+
+The generator targets the file format as written by Xcode 3.1 (specifically,
+3.1.2), but past experience has taught that the format has not changed
+significantly in the past several years, and future versions of Xcode are able
+to read older project files.
+
+Xcode project files are "bundled": the project "file" from an end-user's
+perspective is actually a directory with an ".xcodeproj" extension. The
+project file from this module's perspective is actually a file inside this
+directory, always named "project.pbxproj". This file contains a complete
+description of the project and is all that is needed to use the xcodeproj.
+Other files contained in the xcodeproj directory are simply used to store
+per-user settings, such as the state of various UI elements in the Xcode
+application.
+
+The project.pbxproj file is a property list, stored in a format almost
+identical to the NeXTstep property list format. The file is able to carry
+Unicode data, and is encoded in UTF-8. The root element in the property list
+is a dictionary that contains several properties of minimal interest, and two
+properties of immense interest. The most important property is a dictionary
+named "objects". The entire structure of the project is represented by the
+children of this property. The objects dictionary is keyed by unique 96-bit
+values represented by 24 uppercase hexadecimal characters. Each value in the
+objects dictionary is itself a dictionary, describing an individual object.
+
+Each object in the dictionary is a member of a class, which is identified by
+the "isa" property of each object. A variety of classes are represented in a
+project file. Objects can refer to other objects by ID, using the 24-character
+hexadecimal object key. A project's objects form a tree, with a root object
+of class PBXProject at the root. As an example, the PBXProject object serves
+as parent to an XCConfigurationList object defining the build configurations
+used in the project, a PBXGroup object serving as a container for all files
+referenced in the project, and a list of target objects, each of which defines
+a target in the project. There are several different types of target object,
+such as PBXNativeTarget and PBXAggregateTarget. In this module, this
+relationship is expressed by having each target type derive from an abstract
+base named XCTarget.
+
+The project.pbxproj file's root dictionary also contains a property, sibling to
+the "objects" dictionary, named "rootObject". The value of rootObject is a
+24-character object key referring to the root PBXProject object in the
+objects dictionary.
+
+In Xcode, every file used as input to a target or produced as a final product
+of a target must appear somewhere in the hierarchy rooted at the PBXGroup
+object referenced by the PBXProject's mainGroup property. A PBXGroup is
+generally represented as a folder in the Xcode application. PBXGroups can
+contain other PBXGroups as well as PBXFileReferences, which are pointers to
+actual files.
+
+Each XCTarget contains a list of build phases, represented in this module by
+the abstract base XCBuildPhase. Examples of concrete XCBuildPhase derivations
+are PBXSourcesBuildPhase and PBXFrameworksBuildPhase, which correspond to the
+"Compile Sources" and "Link Binary With Libraries" phases displayed in the
+Xcode application. Files used as input to these phases (for example, source
+files in the former case and libraries and frameworks in the latter) are
+represented by PBXBuildFile objects, referenced by elements of "files" lists
+in XCTarget objects. Each PBXBuildFile object refers to a PBXBuildFile
+object as a "weak" reference: it does not "own" the PBXBuildFile, which is
+owned by the root object's mainGroup or a descendant group. In most cases, the
+layer of indirection between an XCBuildPhase and a PBXFileReference via a
+PBXBuildFile appears extraneous, but there's actually one reason for this:
+file-specific compiler flags are added to the PBXBuildFile object so as to
+allow a single file to be a member of multiple targets while having distinct
+compiler flags for each. These flags can be modified in the Xcode applciation
+in the "Build" tab of a File Info window.
+
+When a project is open in the Xcode application, Xcode will rewrite it. As
+such, this module is careful to adhere to the formatting used by Xcode, to
+avoid insignificant changes appearing in the file when it is used in the
+Xcode application. This will keep version control repositories happy, and
+makes it possible to compare a project file used in Xcode to one generated by
+this module to determine if any significant changes were made in the
+application.
+
+Xcode has its own way of assigning 24-character identifiers to each object,
+which is not duplicated here. Because the identifier only is only generated
+once, when an object is created, and is then left unchanged, there is no need
+to attempt to duplicate Xcode's behavior in this area. The generator is free
+to select any identifier, even at random, to refer to the objects it creates,
+and Xcode will retain those identifiers and use them when subsequently
+rewriting the project file. However, the generator would choose new random
+identifiers each time the project files are generated, leading to difficulties
+comparing "used" project files to "pristine" ones produced by this module,
+and causing the appearance of changes as every object identifier is changed
+when updated projects are checked in to a version control repository. To
+mitigate this problem, this module chooses identifiers in a more deterministic
+way, by hashing a description of each object as well as its parent and ancestor
+objects. This strategy should result in minimal "shift" in IDs as successive
+generations of project files are produced.
+
+THIS MODULE
+
+This module introduces several classes, all derived from the XCObject class.
+Nearly all of the "brains" are built into the XCObject class, which understands
+how to create and modify objects, maintain the proper tree structure, compute
+identifiers, and print objects. For the most part, classes derived from
+XCObject need only provide a _schema class object, a dictionary that
+expresses what properties objects of the class may contain.
+
+Given this structure, it's possible to build a minimal project file by creating
+objects of the appropriate types and making the proper connections:
+
+ config_list = XCConfigurationList()
+ group = PBXGroup()
+ project = PBXProject({'buildConfigurationList': config_list,
+ 'mainGroup': group})
+
+With the project object set up, it can be added to an XCProjectFile object.
+XCProjectFile is a pseudo-class in the sense that it is a concrete XCObject
+subclass that does not actually correspond to a class type found in a project
+file. Rather, it is used to represent the project file's root dictionary.
+Printing an XCProjectFile will print the entire project file, including the
+full "objects" dictionary.
+
+ project_file = XCProjectFile({'rootObject': project})
+ project_file.ComputeIDs()
+ project_file.Print()
+
+Xcode project files are always encoded in UTF-8. This module will accept
+strings of either the str class or the unicode class. Strings of class str
+are assumed to already be encoded in UTF-8. Obviously, if you're just using
+ASCII, you won't encounter difficulties because ASCII is a UTF-8 subset.
+Strings of class unicode are handled properly and encoded in UTF-8 when
+a project file is output.
+"""
+
+import gyp.common
+import posixpath
+import re
+import struct
+import sys
+
+# hashlib is supplied as of Python 2.5 as the replacement interface for sha
+# and other secure hashes. In 2.6, sha is deprecated. Import hashlib if
+# available, avoiding a deprecation warning under 2.6. Import sha otherwise,
+# preserving 2.4 compatibility.
+try:
+ import hashlib
+ _new_sha1 = hashlib.sha1
+except ImportError:
+ import sha
+ _new_sha1 = sha.new
+
+
+# See XCObject._EncodeString. This pattern is used to determine when a string
+# can be printed unquoted. Strings that match this pattern may be printed
+# unquoted. Strings that do not match must be quoted and may be further
+# transformed to be properly encoded. Note that this expression matches the
+# characters listed with "+", for 1 or more occurrences: if a string is empty,
+# it must not match this pattern, because it needs to be encoded as "".
+_unquoted = re.compile('^[A-Za-z0-9$./_]+$')
+
+# Strings that match this pattern are quoted regardless of what _unquoted says.
+# Oddly, Xcode will quote any string with a run of three or more underscores.
+_quoted = re.compile('___')
+
+# This pattern should match any character that needs to be escaped by
+# XCObject._EncodeString. See that function.
+_escaped = re.compile('[\\\\"]|[^ -~]')
+
+
+# Used by SourceTreeAndPathFromPath
+_path_leading_variable = re.compile('^\$\((.*?)\)(/(.*))?$')
+
+def SourceTreeAndPathFromPath(input_path):
+ """Given input_path, returns a tuple with sourceTree and path values.
+
+ Examples:
+ input_path (source_tree, output_path)
+ '$(VAR)/path' ('VAR', 'path')
+ '$(VAR)' ('VAR', None)
+ 'path' (None, 'path')
+ """
+
+ source_group_match = _path_leading_variable.match(input_path)
+ if source_group_match:
+ source_tree = source_group_match.group(1)
+ output_path = source_group_match.group(3) # This may be None.
+ else:
+ source_tree = None
+ output_path = input_path
+
+ return (source_tree, output_path)
+
+def ConvertVariablesToShellSyntax(input_string):
+ return re.sub('\$\((.*?)\)', '${\\1}', input_string)
+
+class XCObject(object):
+ """The abstract base of all class types used in Xcode project files.
+
+ Class variables:
+ _schema: A dictionary defining the properties of this class. The keys to
+ _schema are string property keys as used in project files. Values
+ are a list of four or five elements:
+ [ is_list, property_type, is_strong, is_required, default ]
+ is_list: True if the property described is a list, as opposed
+ to a single element.
+ property_type: The type to use as the value of the property,
+ or if is_list is True, the type to use for each
+ element of the value's list. property_type must
+ be an XCObject subclass, or one of the built-in
+ types str, int, or dict.
+ is_strong: If property_type is an XCObject subclass, is_strong
+ is True to assert that this class "owns," or serves
+ as parent, to the property value (or, if is_list is
+ True, values). is_strong must be False if
+ property_type is not an XCObject subclass.
+ is_required: True if the property is required for the class.
+ Note that is_required being True does not preclude
+ an empty string ("", in the case of property_type
+ str) or list ([], in the case of is_list True) from
+ being set for the property.
+ default: Optional. If is_requried is True, default may be set
+ to provide a default value for objects that do not supply
+ their own value. If is_required is True and default
+ is not provided, users of the class must supply their own
+ value for the property.
+ Note that although the values of the array are expressed in
+ boolean terms, subclasses provide values as integers to conserve
+ horizontal space.
+ _should_print_single_line: False in XCObject. Subclasses whose objects
+ should be written to the project file in the
+ alternate single-line format, such as
+ PBXFileReference and PBXBuildFile, should
+ set this to True.
+ _encode_transforms: Used by _EncodeString to encode unprintable characters.
+ The index into this list is the ordinal of the
+ character to transform; each value is a string
+ used to represent the character in the output. XCObject
+ provides an _encode_transforms list suitable for most
+ XCObject subclasses.
+ _alternate_encode_transforms: Provided for subclasses that wish to use
+ the alternate encoding rules. Xcode seems
+ to use these rules when printing objects in
+ single-line format. Subclasses that desire
+ this behavior should set _encode_transforms
+ to _alternate_encode_transforms.
+ _hashables: A list of XCObject subclasses that can be hashed by ComputeIDs
+ to construct this object's ID. Most classes that need custom
+ hashing behavior should do it by overriding Hashables,
+ but in some cases an object's parent may wish to push a
+ hashable value into its child, and it can do so by appending
+ to _hashables.
+ Attribues:
+ id: The object's identifier, a 24-character uppercase hexadecimal string.
+ Usually, objects being created should not set id until the entire
+ project file structure is built. At that point, UpdateIDs() should
+ be called on the root object to assign deterministic values for id to
+ each object in the tree.
+ parent: The object's parent. This is set by a parent XCObject when a child
+ object is added to it.
+ _properties: The object's property dictionary. An object's properties are
+ described by its class' _schema variable.
+ """
+
+ _schema = {}
+ _should_print_single_line = False
+
+ # See _EncodeString.
+ _encode_transforms = []
+ i = 0
+ while i < ord(' '):
+ _encode_transforms.append('\\U%04x' % i)
+ i = i + 1
+ _encode_transforms[7] = '\\a'
+ _encode_transforms[8] = '\\b'
+ _encode_transforms[9] = '\\t'
+ _encode_transforms[10] = '\\n'
+ _encode_transforms[11] = '\\v'
+ _encode_transforms[12] = '\\f'
+ _encode_transforms[13] = '\\n'
+
+ _alternate_encode_transforms = list(_encode_transforms)
+ _alternate_encode_transforms[9] = chr(9)
+ _alternate_encode_transforms[10] = chr(10)
+ _alternate_encode_transforms[11] = chr(11)
+
+ def __init__(self, properties=None, id=None, parent=None):
+ self.id = id
+ self.parent = parent
+ self._properties = {}
+ self._hashables = []
+ self._SetDefaultsFromSchema()
+ self.UpdateProperties(properties)
+
+ def __repr__(self):
+ try:
+ name = self.Name()
+ except NotImplementedError:
+ return '<%s at 0x%x>' % (self.__class__.__name__, id(self))
+ return '<%s %r at 0x%x>' % (self.__class__.__name__, name, id(self))
+
+ def Copy(self):
+ """Make a copy of this object.
+
+ The new object will have its own copy of lists and dicts. Any XCObject
+ objects owned by this object (marked "strong") will be copied in the
+ new object, even those found in lists. If this object has any weak
+ references to other XCObjects, the same references are added to the new
+ object without making a copy.
+ """
+
+ that = self.__class__(id=self.id, parent=self.parent)
+ for key, value in self._properties.iteritems():
+ is_strong = self._schema[key][2]
+
+ if isinstance(value, XCObject):
+ if is_strong:
+ new_value = value.Copy()
+ new_value.parent = that
+ that._properties[key] = new_value
+ else:
+ that._properties[key] = value
+ elif isinstance(value, str) or isinstance(value, unicode) or \
+ isinstance(value, int):
+ that._properties[key] = value
+ elif isinstance(value, list):
+ if is_strong:
+ # If is_strong is True, each element is an XCObject, so it's safe to
+ # call Copy.
+ that._properties[key] = []
+ for item in value:
+ new_item = item.Copy()
+ new_item.parent = that
+ that._properties[key].append(new_item)
+ else:
+ that._properties[key] = value[:]
+ elif isinstance(value, dict):
+ # dicts are never strong.
+ if is_strong:
+ raise TypeError, 'Strong dict for key ' + key + ' in ' + \
+ self.__class__.__name__
+ else:
+ that._properties[key] = value.copy()
+ else:
+ raise TypeError, 'Unexpected type ' + value.__class__.__name__ + \
+ ' for key ' + key + ' in ' + self.__class__.__name__
+
+ return that
+
+ def Name(self):
+ """Return the name corresponding to an object.
+
+ Not all objects necessarily need to be nameable, and not all that do have
+ a "name" property. Override as needed.
+ """
+
+ # If the schema indicates that "name" is required, try to access the
+ # property even if it doesn't exist. This will result in a KeyError
+ # being raised for the property that should be present, which seems more
+ # appropriate than NotImplementedError in this case.
+ if 'name' in self._properties or \
+ ('name' in self._schema and self._schema['name'][3]):
+ return self._properties['name']
+
+ raise NotImplementedError, \
+ self.__class__.__name__ + ' must implement Name'
+
+ def Comment(self):
+ """Return a comment string for the object.
+
+ Most objects just use their name as the comment, but PBXProject uses
+ different values.
+
+ The returned comment is not escaped and does not have any comment marker
+ strings applied to it.
+ """
+
+ return self.Name()
+
+ def Hashables(self):
+ hashables = [self.__class__.__name__]
+
+ name = self.Name()
+ if name != None:
+ hashables.append(name)
+
+ hashables.extend(self._hashables)
+
+ return hashables
+
+ def ComputeIDs(self, recursive=True, overwrite=True, hash=None):
+ """Set "id" properties deterministically.
+
+ An object's "id" property is set based on a hash of its class type and
+ name, as well as the class type and name of all ancestor objects. As
+ such, it is only advisable to call ComputeIDs once an entire project file
+ tree is built.
+
+ If recursive is True, recurse into all descendant objects and update their
+ hashes.
+
+ If overwrite is True, any existing value set in the "id" property will be
+ replaced.
+ """
+
+ def _HashUpdate(hash, data):
+ """Update hash with data's length and contents.
+
+ If the hash were updated only with the value of data, it would be
+ possible for clowns to induce collisions by manipulating the names of
+ their objects. By adding the length, it's exceedingly less likely that
+ ID collisions will be encountered, intentionally or not.
+ """
+
+ hash.update(struct.pack('>i', len(data)))
+ hash.update(data)
+
+ if hash == None:
+ hash = _new_sha1()
+
+ hashables = self.Hashables()
+ assert len(hashables) > 0
+ for hashable in hashables:
+ _HashUpdate(hash, hashable)
+
+ if recursive:
+ for child in self.Children():
+ child.ComputeIDs(recursive, overwrite, hash.copy())
+
+ if overwrite or self.id == None:
+ # Xcode IDs are only 96 bits (24 hex characters), but a SHA-1 digest is
+ # is 160 bits. Instead of throwing out 64 bits of the digest, xor them
+ # into the portion that gets used.
+ assert hash.digest_size % 4 == 0
+ digest_int_count = hash.digest_size / 4
+ digest_ints = struct.unpack('>' + 'I' * digest_int_count, hash.digest())
+ id_ints = [0, 0, 0]
+ for index in xrange(0, digest_int_count):
+ id_ints[index % 3] ^= digest_ints[index]
+ self.id = '%08X%08X%08X' % tuple(id_ints)
+
+ def EnsureNoIDCollisions(self):
+ """Verifies that no two objects have the same ID. Checks all descendants.
+ """
+
+ ids = {}
+ descendants = self.Descendants()
+ for descendant in descendants:
+ if descendant.id in ids:
+ other = ids[descendant.id]
+ raise KeyError, \
+ 'Duplicate ID %s, objects "%s" and "%s" in "%s"' % \
+ (descendant.id, str(descendant._properties),
+ str(other._properties), self._properties['rootObject'].Name())
+ ids[descendant.id] = descendant
+
+ def Children(self):
+ """Returns a list of all of this object's owned (strong) children."""
+
+ children = []
+ for property, attributes in self._schema.iteritems():
+ (is_list, property_type, is_strong) = attributes[0:3]
+ if is_strong and property in self._properties:
+ if not is_list:
+ children.append(self._properties[property])
+ else:
+ children.extend(self._properties[property])
+ return children
+
+ def Descendants(self):
+ """Returns a list of all of this object's descendants, including this
+ object.
+ """
+
+ children = self.Children()
+ descendants = [self]
+ for child in children:
+ descendants.extend(child.Descendants())
+ return descendants
+
+ def PBXProjectAncestor(self):
+ # The base case for recursion is defined at PBXProject.PBXProjectAncestor.
+ if self.parent:
+ return self.parent.PBXProjectAncestor()
+ return None
+
+ def _EncodeComment(self, comment):
+ """Encodes a comment to be placed in the project file output, mimicing
+ Xcode behavior.
+ """
+
+ # This mimics Xcode behavior by wrapping the comment in "/*" and "*/". If
+ # the string already contains a "*/", it is turned into "(*)/". This keeps
+ # the file writer from outputting something that would be treated as the
+ # end of a comment in the middle of something intended to be entirely a
+ # comment.
+
+ return '/* ' + comment.replace('*/', '(*)/') + ' */'
+
+ def _EncodeTransform(self, match):
+ # This function works closely with _EncodeString. It will only be called
+ # by re.sub with match.group(0) containing a character matched by the
+ # the _escaped expression.
+ char = match.group(0)
+
+ # Backslashes (\) and quotation marks (") are always replaced with a
+ # backslash-escaped version of the same. Everything else gets its
+ # replacement from the class' _encode_transforms array.
+ if char == '\\':
+ return '\\\\'
+ if char == '"':
+ return '\\"'
+ return self._encode_transforms[ord(char)]
+
+ def _EncodeString(self, value):
+ """Encodes a string to be placed in the project file output, mimicing
+ Xcode behavior.
+ """
+
+ # Use quotation marks when any character outside of the range A-Z, a-z, 0-9,
+ # $ (dollar sign), . (period), and _ (underscore) is present. Also use
+ # quotation marks to represent empty strings.
+ #
+ # Escape " (double-quote) and \ (backslash) by preceding them with a
+ # backslash.
+ #
+ # Some characters below the printable ASCII range are encoded specially:
+ # 7 ^G BEL is encoded as "\a"
+ # 8 ^H BS is encoded as "\b"
+ # 11 ^K VT is encoded as "\v"
+ # 12 ^L NP is encoded as "\f"
+ # 127 ^? DEL is passed through as-is without escaping
+ # - In PBXFileReference and PBXBuildFile objects:
+ # 9 ^I HT is passed through as-is without escaping
+ # 10 ^J NL is passed through as-is without escaping
+ # 13 ^M CR is passed through as-is without escaping
+ # - In other objects:
+ # 9 ^I HT is encoded as "\t"
+ # 10 ^J NL is encoded as "\n"
+ # 13 ^M CR is encoded as "\n" rendering it indistinguishable from
+ # 10 ^J NL
+ # All other nonprintable characters within the ASCII range (0 through 127
+ # inclusive) are encoded as "\U001f" referring to the Unicode code point in
+ # hexadecimal. For example, character 14 (^N SO) is encoded as "\U000e".
+ # Characters above the ASCII range are passed through to the output encoded
+ # as UTF-8 without any escaping. These mappings are contained in the
+ # class' _encode_transforms list.
+
+ if _unquoted.search(value) and not _quoted.search(value):
+ return value
+
+ return '"' + _escaped.sub(self._EncodeTransform, value) + '"'
+
+ def _XCPrint(self, file, tabs, line):
+ file.write('\t' * tabs + line)
+
+ def _XCPrintableValue(self, tabs, value, flatten_list=False):
+ """Returns a representation of value that may be printed in a project file,
+ mimicing Xcode's behavior.
+
+ _XCPrintableValue can handle str and int values, XCObjects (which are
+ made printable by returning their id property), and list and dict objects
+ composed of any of the above types. When printing a list or dict, and
+ _should_print_single_line is False, the tabs parameter is used to determine
+ how much to indent the lines corresponding to the items in the list or
+ dict.
+
+ If flatten_list is True, single-element lists will be transformed into
+ strings.
+ """
+
+ printable = ''
+ comment = None
+
+ if self._should_print_single_line:
+ sep = ' '
+ element_tabs = ''
+ end_tabs = ''
+ else:
+ sep = '\n'
+ element_tabs = '\t' * (tabs + 1)
+ end_tabs = '\t' * tabs
+
+ if isinstance(value, XCObject):
+ printable += value.id
+ comment = value.Comment()
+ elif isinstance(value, str):
+ printable += self._EncodeString(value)
+ elif isinstance(value, unicode):
+ printable += self._EncodeString(value.encode('utf-8'))
+ elif isinstance(value, int):
+ printable += str(value)
+ elif isinstance(value, list):
+ if flatten_list and len(value) <= 1:
+ if len(value) == 0:
+ printable += self._EncodeString('')
+ else:
+ printable += self._EncodeString(value[0])
+ else:
+ printable = '(' + sep
+ for item in value:
+ printable += element_tabs + \
+ self._XCPrintableValue(tabs + 1, item, flatten_list) + \
+ ',' + sep
+ printable += end_tabs + ')'
+ elif isinstance(value, dict):
+ printable = '{' + sep
+ for item_key, item_value in sorted(value.iteritems()):
+ printable += element_tabs + \
+ self._XCPrintableValue(tabs + 1, item_key, flatten_list) + ' = ' + \
+ self._XCPrintableValue(tabs + 1, item_value, flatten_list) + ';' + \
+ sep
+ printable += end_tabs + '}'
+ else:
+ raise TypeError, "Can't make " + value.__class__.__name__ + ' printable'
+
+ if comment != None:
+ printable += ' ' + self._EncodeComment(comment)
+
+ return printable
+
+ def _XCKVPrint(self, file, tabs, key, value):
+ """Prints a key and value, members of an XCObject's _properties dictionary,
+ to file.
+
+ tabs is an int identifying the indentation level. If the class'
+ _should_print_single_line variable is True, tabs is ignored and the
+ key-value pair will be followed by a space insead of a newline.
+ """
+
+ if self._should_print_single_line:
+ printable = ''
+ after_kv = ' '
+ else:
+ printable = '\t' * tabs
+ after_kv = '\n'
+
+ # Xcode usually prints remoteGlobalIDString values in PBXContainerItemProxy
+ # objects without comments. Sometimes it prints them with comments, but
+ # the majority of the time, it doesn't. To avoid unnecessary changes to
+ # the project file after Xcode opens it, don't write comments for
+ # remoteGlobalIDString. This is a sucky hack and it would certainly be
+ # cleaner to extend the schema to indicate whether or not a comment should
+ # be printed, but since this is the only case where the problem occurs and
+ # Xcode itself can't seem to make up its mind, the hack will suffice.
+ #
+ # Also see PBXContainerItemProxy._schema['remoteGlobalIDString'].
+ if key == 'remoteGlobalIDString' and isinstance(self,
+ PBXContainerItemProxy):
+ value_to_print = value.id
+ else:
+ value_to_print = value
+
+ # PBXBuildFile's settings property is represented in the output as a dict,
+ # but a hack here has it represented as a string. Arrange to strip off the
+ # quotes so that it shows up in the output as expected.
+ if key == 'settings' and isinstance(self, PBXBuildFile):
+ strip_value_quotes = True
+ else:
+ strip_value_quotes = False
+
+ # In another one-off, let's set flatten_list on buildSettings properties
+ # of XCBuildConfiguration objects, because that's how Xcode treats them.
+ if key == 'buildSettings' and isinstance(self, XCBuildConfiguration):
+ flatten_list = True
+ else:
+ flatten_list = False
+
+ try:
+ printable_key = self._XCPrintableValue(tabs, key, flatten_list)
+ printable_value = self._XCPrintableValue(tabs, value_to_print,
+ flatten_list)
+ if strip_value_quotes and len(printable_value) > 1 and \
+ printable_value[0] == '"' and printable_value[-1] == '"':
+ printable_value = printable_value[1:-1]
+ printable += printable_key + ' = ' + printable_value + ';' + after_kv
+ except TypeError, e:
+ gyp.common.ExceptionAppend(e,
+ 'while printing key "%s"' % key)
+ raise
+
+ self._XCPrint(file, 0, printable)
+
+ def Print(self, file=sys.stdout):
+ """Prints a reprentation of this object to file, adhering to Xcode output
+ formatting.
+ """
+
+ self.VerifyHasRequiredProperties()
+
+ if self._should_print_single_line:
+ # When printing an object in a single line, Xcode doesn't put any space
+ # between the beginning of a dictionary (or presumably a list) and the
+ # first contained item, so you wind up with snippets like
+ # ...CDEF = {isa = PBXFileReference; fileRef = 0123...
+ # If it were me, I would have put a space in there after the opening
+ # curly, but I guess this is just another one of those inconsistencies
+ # between how Xcode prints PBXFileReference and PBXBuildFile objects as
+ # compared to other objects. Mimic Xcode's behavior here by using an
+ # empty string for sep.
+ sep = ''
+ end_tabs = 0
+ else:
+ sep = '\n'
+ end_tabs = 2
+
+ # Start the object. For example, '\t\tPBXProject = {\n'.
+ self._XCPrint(file, 2, self._XCPrintableValue(2, self) + ' = {' + sep)
+
+ # "isa" isn't in the _properties dictionary, it's an intrinsic property
+ # of the class which the object belongs to. Xcode always outputs "isa"
+ # as the first element of an object dictionary.
+ self._XCKVPrint(file, 3, 'isa', self.__class__.__name__)
+
+ # The remaining elements of an object dictionary are sorted alphabetically.
+ for property, value in sorted(self._properties.iteritems()):
+ self._XCKVPrint(file, 3, property, value)
+
+ # End the object.
+ self._XCPrint(file, end_tabs, '};\n')
+
+ def UpdateProperties(self, properties, do_copy=False):
+ """Merge the supplied properties into the _properties dictionary.
+
+ The input properties must adhere to the class schema or a KeyError or
+ TypeError exception will be raised. If adding an object of an XCObject
+ subclass and the schema indicates a strong relationship, the object's
+ parent will be set to this object.
+
+ If do_copy is True, then lists, dicts, strong-owned XCObjects, and
+ strong-owned XCObjects in lists will be copied instead of having their
+ references added.
+ """
+
+ if properties == None:
+ return
+
+ for property, value in properties.iteritems():
+ # Make sure the property is in the schema.
+ if not property in self._schema:
+ raise KeyError, property + ' not in ' + self.__class__.__name__
+
+ # Make sure the property conforms to the schema.
+ (is_list, property_type, is_strong) = self._schema[property][0:3]
+ if is_list:
+ if value.__class__ != list:
+ raise TypeError, \
+ property + ' of ' + self.__class__.__name__ + \
+ ' must be list, not ' + value.__class__.__name__
+ for item in value:
+ if not isinstance(item, property_type) and \
+ not (item.__class__ == unicode and property_type == str):
+ # Accept unicode where str is specified. str is treated as
+ # UTF-8-encoded.
+ raise TypeError, \
+ 'item of ' + property + ' of ' + self.__class__.__name__ + \
+ ' must be ' + property_type.__name__ + ', not ' + \
+ item.__class__.__name__
+ elif not isinstance(value, property_type) and \
+ not (value.__class__ == unicode and property_type == str):
+ # Accept unicode where str is specified. str is treated as
+ # UTF-8-encoded.
+ raise TypeError, \
+ property + ' of ' + self.__class__.__name__ + ' must be ' + \
+ property_type.__name__ + ', not ' + value.__class__.__name__
+
+ # Checks passed, perform the assignment.
+ if do_copy:
+ if isinstance(value, XCObject):
+ if is_strong:
+ self._properties[property] = value.Copy()
+ else:
+ self._properties[property] = value
+ elif isinstance(value, str) or isinstance(value, unicode) or \
+ isinstance(value, int):
+ self._properties[property] = value
+ elif isinstance(value, list):
+ if is_strong:
+ # If is_strong is True, each element is an XCObject, so it's safe
+ # to call Copy.
+ self._properties[property] = []
+ for item in value:
+ self._properties[property].append(item.Copy())
+ else:
+ self._properties[property] = value[:]
+ elif isinstance(value, dict):
+ self._properties[property] = value.copy()
+ else:
+ raise TypeError, "Don't know how to copy a " + \
+ value.__class__.__name__ + ' object for ' + \
+ property + ' in ' + self.__class__.__name__
+ else:
+ self._properties[property] = value
+
+ # Set up the child's back-reference to this object. Don't use |value|
+ # any more because it may not be right if do_copy is true.
+ if is_strong:
+ if not is_list:
+ self._properties[property].parent = self
+ else:
+ for item in self._properties[property]:
+ item.parent = self
+
+ def HasProperty(self, key):
+ return key in self._properties
+
+ def GetProperty(self, key):
+ return self._properties[key]
+
+ def SetProperty(self, key, value):
+ self.UpdateProperties({key: value})
+
+ def DelProperty(self, key):
+ if key in self._properties:
+ del self._properties[key]
+
+ def AppendProperty(self, key, value):
+ # TODO(mark): Support ExtendProperty too (and make this call that)?
+
+ # Schema validation.
+ if not key in self._schema:
+ raise KeyError, key + ' not in ' + self.__class__.__name__
+
+ (is_list, property_type, is_strong) = self._schema[key][0:3]
+ if not is_list:
+ raise TypeError, key + ' of ' + self.__class__.__name__ + ' must be list'
+ if not isinstance(value, property_type):
+ raise TypeError, 'item of ' + key + ' of ' + self.__class__.__name__ + \
+ ' must be ' + property_type.__name__ + ', not ' + \
+ value.__class__.__name__
+
+ # If the property doesn't exist yet, create a new empty list to receive the
+ # item.
+ if not key in self._properties:
+ self._properties[key] = []
+
+ # Set up the ownership link.
+ if is_strong:
+ value.parent = self
+
+ # Store the item.
+ self._properties[key].append(value)
+
+ def VerifyHasRequiredProperties(self):
+ """Ensure that all properties identified as required by the schema are
+ set.
+ """
+
+ # TODO(mark): A stronger verification mechanism is needed. Some
+ # subclasses need to perform validation beyond what the schema can enforce.
+ for property, attributes in self._schema.iteritems():
+ (is_list, property_type, is_strong, is_required) = attributes[0:4]
+ if is_required and not property in self._properties:
+ raise KeyError, self.__class__.__name__ + ' requires ' + property
+
+ def _SetDefaultsFromSchema(self):
+ """Assign object default values according to the schema. This will not
+ overwrite properties that have already been set."""
+
+ defaults = {}
+ for property, attributes in self._schema.iteritems():
+ (is_list, property_type, is_strong, is_required) = attributes[0:4]
+ if is_required and len(attributes) >= 5 and \
+ not property in self._properties:
+ default = attributes[4]
+
+ defaults[property] = default
+
+ if len(defaults) > 0:
+ # Use do_copy=True so that each new object gets its own copy of strong
+ # objects, lists, and dicts.
+ self.UpdateProperties(defaults, do_copy=True)
+
+
+class XCHierarchicalElement(XCObject):
+ """Abstract base for PBXGroup and PBXFileReference. Not represented in a
+ project file."""
+
+ # TODO(mark): Do name and path belong here? Probably so.
+ # If path is set and name is not, name may have a default value. Name will
+ # be set to the basename of path, if the basename of path is different from
+ # the full value of path. If path is already just a leaf name, name will
+ # not be set.
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'comments': [0, str, 0, 0],
+ 'fileEncoding': [0, str, 0, 0],
+ 'includeInIndex': [0, int, 0, 0],
+ 'indentWidth': [0, int, 0, 0],
+ 'lineEnding': [0, int, 0, 0],
+ 'sourceTree': [0, str, 0, 1, '<group>'],
+ 'tabWidth': [0, int, 0, 0],
+ 'usesTabs': [0, int, 0, 0],
+ 'wrapsLines': [0, int, 0, 0],
+ })
+
+ def __init__(self, properties=None, id=None, parent=None):
+ # super
+ XCObject.__init__(self, properties, id, parent)
+ if 'path' in self._properties and not 'name' in self._properties:
+ path = self._properties['path']
+ name = posixpath.basename(path)
+ if name != '' and path != name:
+ self.SetProperty('name', name)
+
+ if 'path' in self._properties and \
+ (not 'sourceTree' in self._properties or \
+ self._properties['sourceTree'] == '<group>'):
+ # If the pathname begins with an Xcode variable like "$(SDKROOT)/", take
+ # the variable out and make the path be relative to that variable by
+ # assigning the variable name as the sourceTree.
+ (source_tree, path) = SourceTreeAndPathFromPath(self._properties['path'])
+ if source_tree != None:
+ self._properties['sourceTree'] = source_tree
+ if path != None:
+ self._properties['path'] = path
+ if source_tree != None and path == None and \
+ not 'name' in self._properties:
+ # The path was of the form "$(SDKROOT)" with no path following it.
+ # This object is now relative to that variable, so it has no path
+ # attribute of its own. It does, however, keep a name.
+ del self._properties['path']
+ self._properties['name'] = source_tree
+
+ def Name(self):
+ if 'name' in self._properties:
+ return self._properties['name']
+ elif 'path' in self._properties:
+ return self._properties['path']
+ else:
+ # This happens in the case of the root PBXGroup.
+ return None
+
+ def Hashables(self):
+ """Custom hashables for XCHierarchicalElements.
+
+ XCHierarchicalElements are special. Generally, their hashes shouldn't
+ change if the paths don't change. The normal XCObject implementation of
+ Hashables adds a hashable for each object, which means that if
+ the hierarchical structure changes (possibly due to changes caused when
+ TakeOverOnlyChild runs and encounters slight changes in the hierarchy),
+ the hashes will change. For example, if a project file initially contains
+ a/b/f1 and a/b becomes collapsed into a/b, f1 will have a single parent
+ a/b. If someone later adds a/f2 to the project file, a/b can no longer be
+ collapsed, and f1 winds up with parent b and grandparent a. That would
+ be sufficient to change f1's hash.
+
+ To counteract this problem, hashables for all XCHierarchicalElements except
+ for the main group (which has neither a name nor a path) are taken to be
+ just the set of path components. Because hashables are inherited from
+ parents, this provides assurance that a/b/f1 has the same set of hashables
+ whether its parent is b or a/b.
+
+ The main group is a special case. As it is permitted to have no name or
+ path, it is permitted to use the standard XCObject hash mechanism. This
+ is not considered a problem because there can be only one main group.
+ """
+
+ if self == self.PBXProjectAncestor()._properties['mainGroup']:
+ # super
+ return XCObject.Hashables(self)
+
+ hashables = []
+
+ # Put the name in first, ensuring that if TakeOverOnlyChild collapses
+ # children into a top-level group like "Source", the name always goes
+ # into the list of hashables without interfering with path components.
+ if 'name' in self._properties:
+ # Make it less likely for people to manipulate hashes by following the
+ # pattern of always pushing an object type value onto the list first.
+ hashables.append(self.__class__.__name__ + '.name')
+ hashables.append(self._properties['name'])
+
+ # NOTE: This still has the problem that if an absolute path is encountered,
+ # including paths with a sourceTree, they'll still inherit their parents'
+ # hashables, even though the paths aren't relative to their parents. This
+ # is not expected to be much of a problem in practice.
+ path = self.PathFromSourceTreeAndPath()
+ if path != None:
+ components = path.split(posixpath.sep)
+ for component in components:
+ hashables.append(self.__class__.__name__ + '.path')
+ hashables.append(component)
+
+ hashables.extend(self._hashables)
+
+ return hashables
+
+ def Compare(self, other):
+ # Allow comparison of these types. PBXGroup has the highest sort rank;
+ # PBXVariantGroup is treated as equal to PBXFileReference.
+ valid_class_types = {
+ PBXFileReference: 'file',
+ PBXGroup: 'group',
+ PBXVariantGroup: 'file',
+ }
+ self_type = valid_class_types[self.__class__]
+ other_type = valid_class_types[other.__class__]
+
+ if self_type == other_type:
+ # If the two objects are of the same sort rank, compare their names.
+ return cmp(self.Name(), other.Name())
+
+ # Otherwise, sort groups before everything else.
+ if self_type == 'group':
+ return -1
+ return 1
+
+ def CompareRootGroup(self, other):
+ # This function should be used only to compare direct children of the
+ # containing PBXProject's mainGroup. These groups should appear in the
+ # listed order.
+ # TODO(mark): "Build" is used by gyp.generator.xcode, perhaps the
+ # generator should have a way of influencing this list rather than having
+ # to hardcode for the generator here.
+ order = ['Source', 'Intermediates', 'Projects', 'Frameworks', 'Products',
+ 'Build']
+
+ # If the groups aren't in the listed order, do a name comparison.
+ # Otherwise, groups in the listed order should come before those that
+ # aren't.
+ self_name = self.Name()
+ other_name = other.Name()
+ self_in = isinstance(self, PBXGroup) and self_name in order
+ other_in = isinstance(self, PBXGroup) and other_name in order
+ if not self_in and not other_in:
+ return self.Compare(other)
+ if self_name in order and not other_name in order:
+ return -1
+ if other_name in order and not self_name in order:
+ return 1
+
+ # If both groups are in the listed order, go by the defined order.
+ self_index = order.index(self_name)
+ other_index = order.index(other_name)
+ if self_index < other_index:
+ return -1
+ if self_index > other_index:
+ return 1
+ return 0
+
+ def PathFromSourceTreeAndPath(self):
+ # Turn the object's sourceTree and path properties into a single flat
+ # string of a form comparable to the path parameter. If there's a
+ # sourceTree property other than "<group>", wrap it in $(...) for the
+ # comparison.
+ components = []
+ if self._properties['sourceTree'] != '<group>':
+ components.append('$(' + self._properties['sourceTree'] + ')')
+ if 'path' in self._properties:
+ components.append(self._properties['path'])
+
+ if len(components) > 0:
+ return posixpath.join(*components)
+
+ return None
+
+ def FullPath(self):
+ # Returns a full path to self relative to the project file, or relative
+ # to some other source tree. Start with self, and walk up the chain of
+ # parents prepending their paths, if any, until no more parents are
+ # available (project-relative path) or until a path relative to some
+ # source tree is found.
+ xche = self
+ path = None
+ while isinstance(xche, XCHierarchicalElement) and \
+ (path == None or \
+ (not path.startswith('/') and not path.startswith('$'))):
+ this_path = xche.PathFromSourceTreeAndPath()
+ if this_path != None and path != None:
+ path = posixpath.join(this_path, path)
+ elif this_path != None:
+ path = this_path
+ xche = xche.parent
+
+ return path
+
+
+class PBXGroup(XCHierarchicalElement):
+ """
+ Attributes:
+ _children_by_path: Maps pathnames of children of this PBXGroup to the
+ actual child XCHierarchicalElement objects.
+ _variant_children_by_name_and_path: Maps (name, path) tuples of
+ PBXVariantGroup children to the actual child PBXVariantGroup objects.
+ """
+
+ _schema = XCHierarchicalElement._schema.copy()
+ _schema.update({
+ 'children': [1, XCHierarchicalElement, 1, 1, []],
+ 'name': [0, str, 0, 0],
+ 'path': [0, str, 0, 0],
+ })
+
+ def __init__(self, properties=None, id=None, parent=None):
+ # super
+ XCHierarchicalElement.__init__(self, properties, id, parent)
+ self._children_by_path = {}
+ self._variant_children_by_name_and_path = {}
+ for child in self._properties.get('children', []):
+ self._AddChildToDicts(child)
+
+ def _AddChildToDicts(self, child):
+ # Sets up this PBXGroup object's dicts to reference the child properly.
+ child_path = child.PathFromSourceTreeAndPath()
+ if child_path:
+ if child_path in self._children_by_path:
+ raise ValueError, 'Found multiple children with path ' + child_path
+ self._children_by_path[child_path] = child
+
+ if isinstance(child, PBXVariantGroup):
+ child_name = child._properties.get('name', None)
+ key = (child_name, child_path)
+ if key in self._variant_children_by_name_and_path:
+ raise ValueError, 'Found multiple PBXVariantGroup children with ' + \
+ 'name ' + str(child_name) + ' and path ' + \
+ str(child_path)
+ self._variant_children_by_name_and_path[key] = child
+
+ def AppendChild(self, child):
+ # Callers should use this instead of calling
+ # AppendProperty('children', child) directly because this function
+ # maintains the group's dicts.
+ self.AppendProperty('children', child)
+ self._AddChildToDicts(child)
+
+ def GetChildByName(self, name):
+ # This is not currently optimized with a dict as GetChildByPath is because
+ # it has few callers. Most callers probably want GetChildByPath. This
+ # function is only useful to get children that have names but no paths,
+ # which is rare. The children of the main group ("Source", "Products",
+ # etc.) is pretty much the only case where this likely to come up.
+ #
+ # TODO(mark): Maybe this should raise an error if more than one child is
+ # present with the same name.
+ if not 'children' in self._properties:
+ return None
+
+ for child in self._properties['children']:
+ if child.Name() == name:
+ return child
+
+ return None
+
+ def GetChildByPath(self, path):
+ if not path:
+ return None
+
+ if path in self._children_by_path:
+ return self._children_by_path[path]
+
+ return None
+
+ def GetChildByRemoteObject(self, remote_object):
+ # This method is a little bit esoteric. Given a remote_object, which
+ # should be a PBXFileReference in another project file, this method will
+ # return this group's PBXReferenceProxy object serving as a local proxy
+ # for the remote PBXFileReference.
+ #
+ # This function might benefit from a dict optimization as GetChildByPath
+ # for some workloads, but profiling shows that it's not currently a
+ # problem.
+ if not 'children' in self._properties:
+ return None
+
+ for child in self._properties['children']:
+ if not isinstance(child, PBXReferenceProxy):
+ continue
+
+ container_proxy = child._properties['remoteRef']
+ if container_proxy._properties['remoteGlobalIDString'] == remote_object:
+ return child
+
+ return None
+
+ def AddOrGetFileByPath(self, path, hierarchical):
+ """Returns an existing or new file reference corresponding to path.
+
+ If hierarchical is True, this method will create or use the necessary
+ hierarchical group structure corresponding to path. Otherwise, it will
+ look in and create an item in the current group only.
+
+ If an existing matching reference is found, it is returned, otherwise, a
+ new one will be created, added to the correct group, and returned.
+
+ If path identifies a directory by virtue of carrying a trailing slash,
+ this method returns a PBXFileReference of "folder" type. If path
+ identifies a variant, by virtue of it identifying a file inside a directory
+ with an ".lproj" extension, this method returns a PBXVariantGroup
+ containing the variant named by path, and possibly other variants. For
+ all other paths, a "normal" PBXFileReference will be returned.
+ """
+
+ # Adding or getting a directory? Directories end with a trailing slash.
+ is_dir = False
+ if path.endswith('/'):
+ is_dir = True
+ normpath = posixpath.normpath(path)
+ if is_dir:
+ normpath = path + '/'
+ else:
+ normpath = path
+
+ # Adding or getting a variant? Variants are files inside directories
+ # with an ".lproj" extension. Xcode uses variants for localization. For
+ # a variant path/to/Language.lproj/MainMenu.nib, put a variant group named
+ # MainMenu.nib inside path/to, and give it a variant named Language. In
+ # this example, grandparent would be set to path/to and parent_root would
+ # be set to Language.
+ variant_name = None
+ parent = posixpath.dirname(path)
+ grandparent = posixpath.dirname(parent)
+ parent_basename = posixpath.basename(parent)
+ (parent_root, parent_ext) = posixpath.splitext(parent_basename)
+ if parent_ext == '.lproj':
+ variant_name = parent_root
+ if grandparent == '':
+ grandparent = None
+
+ # Putting a directory inside a variant group is not currently supported.
+ assert not is_dir or variant_name == None
+
+ path_split = path.split(posixpath.sep)
+ if len(path_split) == 1 or \
+ ((is_dir or variant_name != None) and len(path_split) == 2) or \
+ not hierarchical:
+ # The PBXFileReference or PBXVariantGroup will be added to or gotten from
+ # this PBXGroup, no recursion necessary.
+ if variant_name == None:
+ # Add or get a PBXFileReference.
+ file_ref = self.GetChildByPath(normpath)
+ if file_ref != None:
+ assert file_ref.__class__ == PBXFileReference
+ else:
+ file_ref = PBXFileReference({'path': path})
+ self.AppendChild(file_ref)
+ else:
+ # Add or get a PBXVariantGroup. The variant group name is the same
+ # as the basename (MainMenu.nib in the example above). grandparent
+ # specifies the path to the variant group itself, and path_split[-2:]
+ # is the path of the specific variant relative to its group.
+ variant_group_name = posixpath.basename(path)
+ variant_group_ref = self.AddOrGetVariantGroupByNameAndPath(
+ variant_group_name, grandparent)
+ variant_path = posixpath.sep.join(path_split[-2:])
+ variant_ref = variant_group_ref.GetChildByPath(variant_path)
+ if variant_ref != None:
+ assert variant_ref.__class__ == PBXFileReference
+ else:
+ variant_ref = PBXFileReference({'name': variant_name,
+ 'path': variant_path})
+ variant_group_ref.AppendChild(variant_ref)
+ # The caller is interested in the variant group, not the specific
+ # variant file.
+ file_ref = variant_group_ref
+ return file_ref
+ else:
+ # Hierarchical recursion. Add or get a PBXGroup corresponding to the
+ # outermost path component, and then recurse into it, chopping off that
+ # path component.
+ next_dir = path_split[0]
+ group_ref = self.GetChildByPath(next_dir)
+ if group_ref != None:
+ assert group_ref.__class__ == PBXGroup
+ else:
+ group_ref = PBXGroup({'path': next_dir})
+ self.AppendChild(group_ref)
+ return group_ref.AddOrGetFileByPath(posixpath.sep.join(path_split[1:]),
+ hierarchical)
+
+ def AddOrGetVariantGroupByNameAndPath(self, name, path):
+ """Returns an existing or new PBXVariantGroup for name and path.
+
+ If a PBXVariantGroup identified by the name and path arguments is already
+ present as a child of this object, it is returned. Otherwise, a new
+ PBXVariantGroup with the correct properties is created, added as a child,
+ and returned.
+
+ This method will generally be called by AddOrGetFileByPath, which knows
+ when to create a variant group based on the structure of the pathnames
+ passed to it.
+ """
+
+ key = (name, path)
+ if key in self._variant_children_by_name_and_path:
+ variant_group_ref = self._variant_children_by_name_and_path[key]
+ assert variant_group_ref.__class__ == PBXVariantGroup
+ return variant_group_ref
+
+ variant_group_properties = {'name': name}
+ if path != None:
+ variant_group_properties['path'] = path
+ variant_group_ref = PBXVariantGroup(variant_group_properties)
+ self.AppendChild(variant_group_ref)
+
+ return variant_group_ref
+
+ def TakeOverOnlyChild(self, recurse=False):
+ """If this PBXGroup has only one child and it's also a PBXGroup, take
+ it over by making all of its children this object's children.
+
+ This function will continue to take over only children when those children
+ are groups. If there are three PBXGroups representing a, b, and c, with
+ c inside b and b inside a, and a and b have no other children, this will
+ result in a taking over both b and c, forming a PBXGroup for a/b/c.
+
+ If recurse is True, this function will recurse into children and ask them
+ to collapse themselves by taking over only children as well. Assuming
+ an example hierarchy with files at a/b/c/d1, a/b/c/d2, and a/b/c/d3/e/f
+ (d1, d2, and f are files, the rest are groups), recursion will result in
+ a group for a/b/c containing a group for d3/e.
+ """
+
+ # At this stage, check that child class types are PBXGroup exactly,
+ # instead of using isinstance. The only subclass of PBXGroup,
+ # PBXVariantGroup, should not participate in reparenting in the same way:
+ # reparenting by merging different object types would be wrong.
+ while len(self._properties['children']) == 1 and \
+ self._properties['children'][0].__class__ == PBXGroup:
+ # Loop to take over the innermost only-child group possible.
+
+ child = self._properties['children'][0]
+
+ # Assume the child's properties, including its children. Save a copy
+ # of this object's old properties, because they'll still be needed.
+ # This object retains its existing id and parent attributes.
+ old_properties = self._properties
+ self._properties = child._properties
+ self._children_by_path = child._children_by_path
+
+ if not 'sourceTree' in self._properties or \
+ self._properties['sourceTree'] == '<group>':
+ # The child was relative to its parent. Fix up the path. Note that
+ # children with a sourceTree other than "<group>" are not relative to
+ # their parents, so no path fix-up is needed in that case.
+ if 'path' in old_properties:
+ if 'path' in self._properties:
+ # Both the original parent and child have paths set.
+ self._properties['path'] = posixpath.join(old_properties['path'],
+ self._properties['path'])
+ else:
+ # Only the original parent has a path, use it.
+ self._properties['path'] = old_properties['path']
+ if 'sourceTree' in old_properties:
+ # The original parent had a sourceTree set, use it.
+ self._properties['sourceTree'] = old_properties['sourceTree']
+
+ # If the original parent had a name set, keep using it. If the original
+ # parent didn't have a name but the child did, let the child's name
+ # live on. If the name attribute seems unnecessary now, get rid of it.
+ if 'name' in old_properties and old_properties['name'] != None and \
+ old_properties['name'] != self.Name():
+ self._properties['name'] = old_properties['name']
+ if 'name' in self._properties and 'path' in self._properties and \
+ self._properties['name'] == self._properties['path']:
+ del self._properties['name']
+
+ # Notify all children of their new parent.
+ for child in self._properties['children']:
+ child.parent = self
+
+ # If asked to recurse, recurse.
+ if recurse:
+ for child in self._properties['children']:
+ if child.__class__ == PBXGroup:
+ child.TakeOverOnlyChild(recurse)
+
+ def SortGroup(self):
+ self._properties['children'] = \
+ sorted(self._properties['children'], cmp=lambda x,y: x.Compare(y))
+
+ # Recurse.
+ for child in self._properties['children']:
+ if isinstance(child, PBXGroup):
+ child.SortGroup()
+
+
+class XCFileLikeElement(XCHierarchicalElement):
+ # Abstract base for objects that can be used as the fileRef property of
+ # PBXBuildFile.
+
+ def PathHashables(self):
+ # A PBXBuildFile that refers to this object will call this method to
+ # obtain additional hashables specific to this XCFileLikeElement. Don't
+ # just use this object's hashables, they're not specific and unique enough
+ # on their own (without access to the parent hashables.) Instead, provide
+ # hashables that identify this object by path by getting its hashables as
+ # well as the hashables of ancestor XCHierarchicalElement objects.
+
+ hashables = []
+ xche = self
+ while xche != None and isinstance(xche, XCHierarchicalElement):
+ xche_hashables = xche.Hashables()
+ for index in xrange(0, len(xche_hashables)):
+ hashables.insert(index, xche_hashables[index])
+ xche = xche.parent
+ return hashables
+
+
+class XCContainerPortal(XCObject):
+ # Abstract base for objects that can be used as the containerPortal property
+ # of PBXContainerItemProxy.
+ pass
+
+
+class XCRemoteObject(XCObject):
+ # Abstract base for objects that can be used as the remoteGlobalIDString
+ # property of PBXContainerItemProxy.
+ pass
+
+
+class PBXFileReference(XCFileLikeElement, XCContainerPortal, XCRemoteObject):
+ _schema = XCFileLikeElement._schema.copy()
+ _schema.update({
+ 'explicitFileType': [0, str, 0, 0],
+ 'lastKnownFileType': [0, str, 0, 0],
+ 'name': [0, str, 0, 0],
+ 'path': [0, str, 0, 1],
+ })
+
+ # Weird output rules for PBXFileReference.
+ _should_print_single_line = True
+ # super
+ _encode_transforms = XCFileLikeElement._alternate_encode_transforms
+
+ def __init__(self, properties=None, id=None, parent=None):
+ # super
+ XCFileLikeElement.__init__(self, properties, id, parent)
+ if 'path' in self._properties and self._properties['path'].endswith('/'):
+ self._properties['path'] = self._properties['path'][:-1]
+ is_dir = True
+ else:
+ is_dir = False
+
+ if 'path' in self._properties and \
+ not 'lastKnownFileType' in self._properties and \
+ not 'explicitFileType' in self._properties:
+ # TODO(mark): This is the replacement for a replacement for a quick hack.
+ # It is no longer incredibly sucky, but this list needs to be extended.
+ extension_map = {
+ 'a': 'archive.ar',
+ 'app': 'wrapper.application',
+ 'bdic': 'file',
+ 'bundle': 'wrapper.cfbundle',
+ 'c': 'sourcecode.c.c',
+ 'cc': 'sourcecode.cpp.cpp',
+ 'cpp': 'sourcecode.cpp.cpp',
+ 'css': 'text.css',
+ 'cxx': 'sourcecode.cpp.cpp',
+ 'dylib': 'compiled.mach-o.dylib',
+ 'framework': 'wrapper.framework',
+ 'h': 'sourcecode.c.h',
+ 'hxx': 'sourcecode.cpp.h',
+ 'icns': 'image.icns',
+ 'java': 'sourcecode.java',
+ 'js': 'sourcecode.javascript',
+ 'm': 'sourcecode.c.objc',
+ 'mm': 'sourcecode.cpp.objcpp',
+ 'nib': 'wrapper.nib',
+ 'o': 'compiled.mach-o.objfile',
+ 'pdf': 'image.pdf',
+ 'pl': 'text.script.perl',
+ 'plist': 'text.plist.xml',
+ 'pm': 'text.script.perl',
+ 'png': 'image.png',
+ 'py': 'text.script.python',
+ 'r': 'sourcecode.rez',
+ 'rez': 'sourcecode.rez',
+ 's': 'sourcecode.asm',
+ 'strings': 'text.plist.strings',
+ 'ttf': 'file',
+ 'xcconfig': 'text.xcconfig',
+ 'xib': 'file.xib',
+ 'y': 'sourcecode.yacc',
+ }
+
+ if is_dir:
+ file_type = 'folder'
+ else:
+ basename = posixpath.basename(self._properties['path'])
+ (root, ext) = posixpath.splitext(basename)
+ # Check the map using a lowercase extension.
+ # TODO(mark): Maybe it should try with the original case first and fall
+ # back to lowercase, in case there are any instances where case
+ # matters. There currently aren't.
+ if ext != '':
+ ext = ext[1:].lower()
+
+ # TODO(mark): "text" is the default value, but "file" is appropriate
+ # for unrecognized files not containing text. Xcode seems to choose
+ # based on content.
+ file_type = extension_map.get(ext, 'text')
+
+ self._properties['lastKnownFileType'] = file_type
+
+
+class PBXVariantGroup(PBXGroup, XCFileLikeElement):
+ """PBXVariantGroup is used by Xcode to represent localizations."""
+ # No additions to the schema relative to PBXGroup.
+ pass
+
+
+# PBXReferenceProxy is also an XCFileLikeElement subclass. It is defined below
+# because it uses PBXContainerItemProxy, defined below.
+
+
+class XCBuildConfiguration(XCObject):
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'baseConfigurationReference': [0, PBXFileReference, 0, 0],
+ 'buildSettings': [0, dict, 0, 1, {}],
+ 'name': [0, str, 0, 1],
+ })
+
+ def HasBuildSetting(self, key):
+ return key in self._properties['buildSettings']
+
+ def GetBuildSetting(self, key):
+ return self._properties['buildSettings'][key]
+
+ def SetBuildSetting(self, key, value):
+ # TODO(mark): If a list, copy?
+ self._properties['buildSettings'][key] = value
+
+ def AppendBuildSetting(self, key, value):
+ if not key in self._properties['buildSettings']:
+ self._properties['buildSettings'][key] = []
+ self._properties['buildSettings'][key].append(value)
+
+ def DelBuildSetting(self, key):
+ if key in self._properties['buildSettings']:
+ del self._properties['buildSettings'][key]
+
+ def SetBaseConfiguration(self, value):
+ self._properties['baseConfigurationReference'] = value
+
+class XCConfigurationList(XCObject):
+ # _configs is the default list of configurations.
+ _configs = [ XCBuildConfiguration({'name': 'Debug'}),
+ XCBuildConfiguration({'name': 'Release'}) ]
+
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'buildConfigurations': [1, XCBuildConfiguration, 1, 1, _configs],
+ 'defaultConfigurationIsVisible': [0, int, 0, 1, 1],
+ 'defaultConfigurationName': [0, str, 0, 1, 'Release'],
+ })
+
+ def Name(self):
+ return 'Build configuration list for ' + \
+ self.parent.__class__.__name__ + ' "' + self.parent.Name() + '"'
+
+ def ConfigurationNamed(self, name):
+ """Convenience accessor to obtain an XCBuildConfiguration by name."""
+ for configuration in self._properties['buildConfigurations']:
+ if configuration._properties['name'] == name:
+ return configuration
+
+ raise KeyError, name
+
+ def DefaultConfiguration(self):
+ """Convenience accessor to obtain the default XCBuildConfiguration."""
+ return self.ConfigurationNamed(self._properties['defaultConfigurationName'])
+
+ def HasBuildSetting(self, key):
+ """Determines the state of a build setting in all XCBuildConfiguration
+ child objects.
+
+ If all child objects have key in their build settings, and the value is the
+ same in all child objects, returns 1.
+
+ If no child objects have the key in their build settings, returns 0.
+
+ If some, but not all, child objects have the key in their build settings,
+ or if any children have different values for the key, returns -1.
+ """
+
+ has = None
+ value = None
+ for configuration in self._properties['buildConfigurations']:
+ configuration_has = configuration.HasBuildSetting(key)
+ if has == None:
+ has = configuration_has
+ elif has != configuration_has:
+ return -1
+
+ if configuration_has:
+ configuration_value = configuration.GetBuildSetting(key)
+ if value == None:
+ value = configuration_value
+ elif value != configuration_value:
+ return -1
+
+ if not has:
+ return 0
+
+ return 1
+
+ def GetBuildSetting(self, key):
+ """Gets the build setting for key.
+
+ All child XCConfiguration objects must have the same value set for the
+ setting, or a ValueError will be raised.
+ """
+
+ # TODO(mark): This is wrong for build settings that are lists. The list
+ # contents should be compared (and a list copy returned?)
+
+ value = None
+ for configuration in self._properties['buildConfigurations']:
+ configuration_value = configuration.GetBuildSetting(key)
+ if value == None:
+ value = configuration_value
+ else:
+ if value != configuration_value:
+ raise ValueError, 'Variant values for ' + key
+
+ return value
+
+ def SetBuildSetting(self, key, value):
+ """Sets the build setting for key to value in all child
+ XCBuildConfiguration objects.
+ """
+
+ for configuration in self._properties['buildConfigurations']:
+ configuration.SetBuildSetting(key, value)
+
+ def AppendBuildSetting(self, key, value):
+ """Appends value to the build setting for key, which is treated as a list,
+ in all child XCBuildConfiguration objects.
+ """
+
+ for configuration in self._properties['buildConfigurations']:
+ configuration.AppendBuildSetting(key, value)
+
+ def DelBuildSetting(self, key):
+ """Deletes the build setting key from all child XCBuildConfiguration
+ objects.
+ """
+
+ for configuration in self._properties['buildConfigurations']:
+ configuration.DelBuildSetting(key)
+
+ def SetBaseConfiguration(self, value):
+ """Sets the build configuration in all child XCBuildConfiguration objects.
+ """
+
+ for configuration in self._properties['buildConfigurations']:
+ configuration.SetBaseConfiguration(value)
+
+
+class PBXBuildFile(XCObject):
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'fileRef': [0, XCFileLikeElement, 0, 1],
+ 'settings': [0, str, 0, 0], # hack, it's a dict
+ })
+
+ # Weird output rules for PBXBuildFile.
+ _should_print_single_line = True
+ _encode_transforms = XCObject._alternate_encode_transforms
+
+ def Name(self):
+ # Example: "main.cc in Sources"
+ return self._properties['fileRef'].Name() + ' in ' + self.parent.Name()
+
+ def Hashables(self):
+ # super
+ hashables = XCObject.Hashables(self)
+
+ # It is not sufficient to just rely on Name() to get the
+ # XCFileLikeElement's name, because that is not a complete pathname.
+ # PathHashables returns hashables unique enough that no two
+ # PBXBuildFiles should wind up with the same set of hashables, unless
+ # someone adds the same file multiple times to the same target. That
+ # would be considered invalid anyway.
+ hashables.extend(self._properties['fileRef'].PathHashables())
+
+ return hashables
+
+
+class XCBuildPhase(XCObject):
+ """Abstract base for build phase classes. Not represented in a project
+ file.
+
+ Attributes:
+ _files_by_path: A dict mapping each path of a child in the files list by
+ path (keys) to the corresponding PBXBuildFile children (values).
+ _files_by_xcfilelikeelement: A dict mapping each XCFileLikeElement (keys)
+ to the corresponding PBXBuildFile children (values).
+ """
+
+ # TODO(mark): Some build phase types, like PBXShellScriptBuildPhase, don't
+ # actually have a "files" list. XCBuildPhase should not have "files" but
+ # another abstract subclass of it should provide this, and concrete build
+ # phase types that do have "files" lists should be derived from that new
+ # abstract subclass. XCBuildPhase should only provide buildActionMask and
+ # runOnlyForDeploymentPostprocessing, and not files or the various
+ # file-related methods and attributes.
+
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'buildActionMask': [0, int, 0, 1, 0x7fffffff],
+ 'files': [1, PBXBuildFile, 1, 1, []],
+ 'runOnlyForDeploymentPostprocessing': [0, int, 0, 1, 0],
+ })
+
+ def __init__(self, properties=None, id=None, parent=None):
+ # super
+ XCObject.__init__(self, properties, id, parent)
+
+ self._files_by_path = {}
+ self._files_by_xcfilelikeelement = {}
+ for pbxbuildfile in self._properties.get('files', []):
+ self._AddBuildFileToDicts(pbxbuildfile)
+
+ def FileGroup(self, path):
+ # Subclasses must override this by returning a two-element tuple. The
+ # first item in the tuple should be the PBXGroup to which "path" should be
+ # added, either as a child or deeper descendant. The second item should
+ # be a boolean indicating whether files should be added into hierarchical
+ # groups or one single flat group.
+ raise NotImplementedError, \
+ self.__class__.__name__ + ' must implement FileGroup'
+
+ def _AddPathToDict(self, pbxbuildfile, path):
+ """Adds path to the dict tracking paths belonging to this build phase.
+
+ If the path is already a member of this build phase, raises an exception.
+ """
+
+ if path in self._files_by_path:
+ raise ValueError, 'Found multiple build files with path ' + path
+ self._files_by_path[path] = pbxbuildfile
+
+ def _AddBuildFileToDicts(self, pbxbuildfile, path=None):
+ """Maintains the _files_by_path and _files_by_xcfilelikeelement dicts.
+
+ If path is specified, then it is the path that is being added to the
+ phase, and pbxbuildfile must contain either a PBXFileReference directly
+ referencing that path, or it must contain a PBXVariantGroup that itself
+ contains a PBXFileReference referencing the path.
+
+ If path is not specified, either the PBXFileReference's path or the paths
+ of all children of the PBXVariantGroup are taken as being added to the
+ phase.
+
+ If the path is already present in the phase, raises an exception.
+
+ If the PBXFileReference or PBXVariantGroup referenced by pbxbuildfile
+ are already present in the phase, referenced by a different PBXBuildFile
+ object, raises an exception. This does not raise an exception when
+ a PBXFileReference or PBXVariantGroup reappear and are referenced by the
+ same PBXBuildFile that has already introduced them, because in the case
+ of PBXVariantGroup objects, they may correspond to multiple paths that are
+ not all added simultaneously. When this situation occurs, the path needs
+ to be added to _files_by_path, but nothing needs to change in
+ _files_by_xcfilelikeelement, and the caller should have avoided adding
+ the PBXBuildFile if it is already present in the list of children.
+ """
+
+ xcfilelikeelement = pbxbuildfile._properties['fileRef']
+
+ paths = []
+ if path != None:
+ # It's best when the caller provides the path.
+ if isinstance(xcfilelikeelement, PBXVariantGroup):
+ paths.append(path)
+ else:
+ # If the caller didn't provide a path, there can be either multiple
+ # paths (PBXVariantGroup) or one.
+ if isinstance(xcfilelikeelement, PBXVariantGroup):
+ for variant in xcfilelikeelement._properties['children']:
+ paths.append(variant.FullPath())
+ else:
+ paths.append(xcfilelikeelement.FullPath())
+
+ # Add the paths first, because if something's going to raise, the
+ # messages provided by _AddPathToDict are more useful owing to its
+ # having access to a real pathname and not just an object's Name().
+ for a_path in paths:
+ self._AddPathToDict(pbxbuildfile, a_path)
+
+ # If another PBXBuildFile references this XCFileLikeElement, there's a
+ # problem.
+ if xcfilelikeelement in self._files_by_xcfilelikeelement and \
+ self._files_by_xcfilelikeelement[xcfilelikeelement] != pbxbuildfile:
+ raise ValueError, 'Found multiple build files for ' + \
+ xcfilelikeelement.Name()
+ self._files_by_xcfilelikeelement[xcfilelikeelement] = pbxbuildfile
+
+ def AppendBuildFile(self, pbxbuildfile, path=None):
+ # Callers should use this instead of calling
+ # AppendProperty('files', pbxbuildfile) directly because this function
+ # maintains the object's dicts. Better yet, callers can just call AddFile
+ # with a pathname and not worry about building their own PBXBuildFile
+ # objects.
+ self.AppendProperty('files', pbxbuildfile)
+ self._AddBuildFileToDicts(pbxbuildfile, path)
+
+ def AddFile(self, path, settings=None):
+ (file_group, hierarchical) = self.FileGroup(path)
+ file_ref = file_group.AddOrGetFileByPath(path, hierarchical)
+
+ if file_ref in self._files_by_xcfilelikeelement and \
+ isinstance(file_ref, PBXVariantGroup):
+ # There's already a PBXBuildFile in this phase corresponding to the
+ # PBXVariantGroup. path just provides a new variant that belongs to
+ # the group. Add the path to the dict.
+ pbxbuildfile = self._files_by_xcfilelikeelement[file_ref]
+ self._AddBuildFileToDicts(pbxbuildfile, path)
+ else:
+ # Add a new PBXBuildFile to get file_ref into the phase.
+ if settings is None:
+ pbxbuildfile = PBXBuildFile({'fileRef': file_ref})
+ else:
+ pbxbuildfile = PBXBuildFile({'fileRef': file_ref, 'settings': settings})
+ self.AppendBuildFile(pbxbuildfile, path)
+
+
+class PBXHeadersBuildPhase(XCBuildPhase):
+ # No additions to the schema relative to XCBuildPhase.
+
+ def Name(self):
+ return 'Headers'
+
+ def FileGroup(self, path):
+ return self.PBXProjectAncestor().RootGroupForPath(path)
+
+
+class PBXResourcesBuildPhase(XCBuildPhase):
+ # No additions to the schema relative to XCBuildPhase.
+
+ def Name(self):
+ return 'Resources'
+
+ def FileGroup(self, path):
+ return self.PBXProjectAncestor().RootGroupForPath(path)
+
+
+class PBXSourcesBuildPhase(XCBuildPhase):
+ # No additions to the schema relative to XCBuildPhase.
+
+ def Name(self):
+ return 'Sources'
+
+ def FileGroup(self, path):
+ return self.PBXProjectAncestor().RootGroupForPath(path)
+
+
+class PBXFrameworksBuildPhase(XCBuildPhase):
+ # No additions to the schema relative to XCBuildPhase.
+
+ def Name(self):
+ return 'Frameworks'
+
+ def FileGroup(self, path):
+ (root, ext) = posixpath.splitext(path)
+ if ext != '':
+ ext = ext[1:].lower()
+ if ext == 'o':
+ # .o files are added to Xcode Frameworks phases, but conceptually aren't
+ # frameworks, they're more like sources or intermediates. Redirect them
+ # to show up in one of those other groups.
+ return self.PBXProjectAncestor().RootGroupForPath(path)
+ else:
+ return (self.PBXProjectAncestor().FrameworksGroup(), False)
+
+
+class PBXShellScriptBuildPhase(XCBuildPhase):
+ _schema = XCBuildPhase._schema.copy()
+ _schema.update({
+ 'inputPaths': [1, str, 0, 1, []],
+ 'name': [0, str, 0, 0],
+ 'outputPaths': [1, str, 0, 1, []],
+ 'shellPath': [0, str, 0, 1, '/bin/sh'],
+ 'shellScript': [0, str, 0, 1],
+ 'showEnvVarsInLog': [0, int, 0, 0],
+ })
+
+ def Name(self):
+ if 'name' in self._properties:
+ return self._properties['name']
+
+ return 'ShellScript'
+
+
+class PBXCopyFilesBuildPhase(XCBuildPhase):
+ _schema = XCBuildPhase._schema.copy()
+ _schema.update({
+ 'dstPath': [0, str, 0, 1],
+ 'dstSubfolderSpec': [0, int, 0, 1],
+ 'name': [0, str, 0, 0],
+ })
+
+ # path_tree_re matches "$(DIR)/path" or just "$(DIR)". Match group 1 is
+ # "DIR", match group 3 is "path" or None.
+ path_tree_re = re.compile('^\\$\\((.*)\\)(/(.*)|)$')
+
+ # path_tree_to_subfolder maps names of Xcode variables to the associated
+ # dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase object.
+ path_tree_to_subfolder = {
+ 'BUILT_PRODUCTS_DIR': 16, # Products Directory
+ # Other types that can be chosen via the Xcode UI.
+ # TODO(mark): Map Xcode variable names to these.
+ # : 1, # Wrapper
+ # : 6, # Executables: 6
+ # : 7, # Resources
+ # : 15, # Java Resources
+ # : 10, # Frameworks
+ # : 11, # Shared Frameworks
+ # : 12, # Shared Support
+ # : 13, # PlugIns
+ }
+
+ def Name(self):
+ if 'name' in self._properties:
+ return self._properties['name']
+
+ return 'CopyFiles'
+
+ def FileGroup(self, path):
+ return self.PBXProjectAncestor().RootGroupForPath(path)
+
+ def SetDestination(self, path):
+ """Set the dstSubfolderSpec and dstPath properties from path.
+
+ path may be specified in the same notation used for XCHierarchicalElements,
+ specifically, "$(DIR)/path".
+ """
+
+ path_tree_match = self.path_tree_re.search(path)
+ if path_tree_match:
+ # Everything else needs to be relative to an Xcode variable.
+ path_tree = path_tree_match.group(1)
+ relative_path = path_tree_match.group(3)
+
+ if path_tree in self.path_tree_to_subfolder:
+ subfolder = self.path_tree_to_subfolder[path_tree]
+ if relative_path == None:
+ relative_path = ''
+ else:
+ # The path starts with an unrecognized Xcode variable
+ # name like $(SRCROOT). Xcode will still handle this
+ # as an "absolute path" that starts with the variable.
+ subfolder = 0
+ relative_path = path
+ elif path.startswith('/'):
+ # Special case. Absolute paths are in dstSubfolderSpec 0.
+ subfolder = 0
+ relative_path = path[1:]
+ else:
+ raise ValueError, 'Can\'t use path %s in a %s' % \
+ (path, self.__class__.__name__)
+
+ self._properties['dstPath'] = relative_path
+ self._properties['dstSubfolderSpec'] = subfolder
+
+
+class PBXBuildRule(XCObject):
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'compilerSpec': [0, str, 0, 1],
+ 'filePatterns': [0, str, 0, 0],
+ 'fileType': [0, str, 0, 1],
+ 'isEditable': [0, int, 0, 1, 1],
+ 'outputFiles': [1, str, 0, 1, []],
+ 'script': [0, str, 0, 0],
+ })
+
+ def Name(self):
+ # Not very inspired, but it's what Xcode uses.
+ return self.__class__.__name__
+
+ def Hashables(self):
+ # super
+ hashables = XCObject.Hashables(self)
+
+ # Use the hashables of the weak objects that this object refers to.
+ hashables.append(self._properties['fileType'])
+ if 'filePatterns' in self._properties:
+ hashables.append(self._properties['filePatterns'])
+ return hashables
+
+
+class PBXContainerItemProxy(XCObject):
+ # When referencing an item in this project file, containerPortal is the
+ # PBXProject root object of this project file. When referencing an item in
+ # another project file, containerPortal is a PBXFileReference identifying
+ # the other project file.
+ #
+ # When serving as a proxy to an XCTarget (in this project file or another),
+ # proxyType is 1. When serving as a proxy to a PBXFileReference (in another
+ # project file), proxyType is 2. Type 2 is used for references to the
+ # producs of the other project file's targets.
+ #
+ # Xcode is weird about remoteGlobalIDString. Usually, it's printed without
+ # a comment, indicating that it's tracked internally simply as a string, but
+ # sometimes it's printed with a comment (usually when the object is initially
+ # created), indicating that it's tracked as a project file object at least
+ # sometimes. This module always tracks it as an object, but contains a hack
+ # to prevent it from printing the comment in the project file output. See
+ # _XCKVPrint.
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'containerPortal': [0, XCContainerPortal, 0, 1],
+ 'proxyType': [0, int, 0, 1],
+ 'remoteGlobalIDString': [0, XCRemoteObject, 0, 1],
+ 'remoteInfo': [0, str, 0, 1],
+ })
+
+ def __repr__(self):
+ props = self._properties
+ name = '%s.gyp:%s' % (props['containerPortal'].Name(), props['remoteInfo'])
+ return '<%s %r at 0x%x>' % (self.__class__.__name__, name, id(self))
+
+ def Name(self):
+ # Admittedly not the best name, but it's what Xcode uses.
+ return self.__class__.__name__
+
+ def Hashables(self):
+ # super
+ hashables = XCObject.Hashables(self)
+
+ # Use the hashables of the weak objects that this object refers to.
+ hashables.extend(self._properties['containerPortal'].Hashables())
+ hashables.extend(self._properties['remoteGlobalIDString'].Hashables())
+ return hashables
+
+
+class PBXTargetDependency(XCObject):
+ # The "target" property accepts an XCTarget object, and obviously not
+ # NoneType. But XCTarget is defined below, so it can't be put into the
+ # schema yet. The definition of PBXTargetDependency can't be moved below
+ # XCTarget because XCTarget's own schema references PBXTargetDependency.
+ # Python doesn't deal well with this circular relationship, and doesn't have
+ # a real way to do forward declarations. To work around, the type of
+ # the "target" property is reset below, after XCTarget is defined.
+ #
+ # At least one of "name" and "target" is required.
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'name': [0, str, 0, 0],
+ 'target': [0, None.__class__, 0, 0],
+ 'targetProxy': [0, PBXContainerItemProxy, 1, 1],
+ })
+
+ def __repr__(self):
+ name = self._properties.get('name') or self._properties['target'].Name()
+ return '<%s %r at 0x%x>' % (self.__class__.__name__, name, id(self))
+
+ def Name(self):
+ # Admittedly not the best name, but it's what Xcode uses.
+ return self.__class__.__name__
+
+ def Hashables(self):
+ # super
+ hashables = XCObject.Hashables(self)
+
+ # Use the hashables of the weak objects that this object refers to.
+ hashables.extend(self._properties['targetProxy'].Hashables())
+ return hashables
+
+
+class PBXReferenceProxy(XCFileLikeElement):
+ _schema = XCFileLikeElement._schema.copy()
+ _schema.update({
+ 'fileType': [0, str, 0, 1],
+ 'path': [0, str, 0, 1],
+ 'remoteRef': [0, PBXContainerItemProxy, 1, 1],
+ })
+
+
+class XCTarget(XCRemoteObject):
+ # An XCTarget is really just an XCObject, the XCRemoteObject thing is just
+ # to allow PBXProject to be used in the remoteGlobalIDString property of
+ # PBXContainerItemProxy.
+ #
+ # Setting a "name" property at instantiation may also affect "productName",
+ # which may in turn affect the "PRODUCT_NAME" build setting in children of
+ # "buildConfigurationList". See __init__ below.
+ _schema = XCRemoteObject._schema.copy()
+ _schema.update({
+ 'buildConfigurationList': [0, XCConfigurationList, 1, 1,
+ XCConfigurationList()],
+ 'buildPhases': [1, XCBuildPhase, 1, 1, []],
+ 'dependencies': [1, PBXTargetDependency, 1, 1, []],
+ 'name': [0, str, 0, 1],
+ 'productName': [0, str, 0, 1],
+ })
+
+ def __init__(self, properties=None, id=None, parent=None,
+ force_outdir=None, force_prefix=None, force_extension=None):
+ # super
+ XCRemoteObject.__init__(self, properties, id, parent)
+
+ # Set up additional defaults not expressed in the schema. If a "name"
+ # property was supplied, set "productName" if it is not present. Also set
+ # the "PRODUCT_NAME" build setting in each configuration, but only if
+ # the setting is not present in any build configuration.
+ if 'name' in self._properties:
+ if not 'productName' in self._properties:
+ self.SetProperty('productName', self._properties['name'])
+
+ if 'productName' in self._properties:
+ if 'buildConfigurationList' in self._properties:
+ configs = self._properties['buildConfigurationList']
+ if configs.HasBuildSetting('PRODUCT_NAME') == 0:
+ configs.SetBuildSetting('PRODUCT_NAME',
+ self._properties['productName'])
+
+ def AddDependency(self, other):
+ pbxproject = self.PBXProjectAncestor()
+ other_pbxproject = other.PBXProjectAncestor()
+ if pbxproject == other_pbxproject:
+ # The easy case. Add a dependency to another target in the same
+ # project file.
+ container = PBXContainerItemProxy({'containerPortal': pbxproject,
+ 'proxyType': 1,
+ 'remoteGlobalIDString': other,
+ 'remoteInfo': other.Name()})
+ dependency = PBXTargetDependency({'target': other,
+ 'targetProxy': container})
+ self.AppendProperty('dependencies', dependency)
+ else:
+ # The hard case. Add a dependency to a target in a different project
+ # file. Actually, this case isn't really so hard.
+ other_project_ref = \
+ pbxproject.AddOrGetProjectReference(other_pbxproject)[1]
+ container = PBXContainerItemProxy({
+ 'containerPortal': other_project_ref,
+ 'proxyType': 1,
+ 'remoteGlobalIDString': other,
+ 'remoteInfo': other.Name(),
+ })
+ dependency = PBXTargetDependency({'name': other.Name(),
+ 'targetProxy': container})
+ self.AppendProperty('dependencies', dependency)
+
+ # Proxy all of these through to the build configuration list.
+
+ def ConfigurationNamed(self, name):
+ return self._properties['buildConfigurationList'].ConfigurationNamed(name)
+
+ def DefaultConfiguration(self):
+ return self._properties['buildConfigurationList'].DefaultConfiguration()
+
+ def HasBuildSetting(self, key):
+ return self._properties['buildConfigurationList'].HasBuildSetting(key)
+
+ def GetBuildSetting(self, key):
+ return self._properties['buildConfigurationList'].GetBuildSetting(key)
+
+ def SetBuildSetting(self, key, value):
+ return self._properties['buildConfigurationList'].SetBuildSetting(key, \
+ value)
+
+ def AppendBuildSetting(self, key, value):
+ return self._properties['buildConfigurationList'].AppendBuildSetting(key, \
+ value)
+
+ def DelBuildSetting(self, key):
+ return self._properties['buildConfigurationList'].DelBuildSetting(key)
+
+
+# Redefine the type of the "target" property. See PBXTargetDependency._schema
+# above.
+PBXTargetDependency._schema['target'][1] = XCTarget
+
+
+class PBXNativeTarget(XCTarget):
+ # buildPhases is overridden in the schema to be able to set defaults.
+ #
+ # NOTE: Contrary to most objects, it is advisable to set parent when
+ # constructing PBXNativeTarget. A parent of an XCTarget must be a PBXProject
+ # object. A parent reference is required for a PBXNativeTarget during
+ # construction to be able to set up the target defaults for productReference,
+ # because a PBXBuildFile object must be created for the target and it must
+ # be added to the PBXProject's mainGroup hierarchy.
+ _schema = XCTarget._schema.copy()
+ _schema.update({
+ 'buildPhases': [1, XCBuildPhase, 1, 1,
+ [PBXSourcesBuildPhase(), PBXFrameworksBuildPhase()]],
+ 'buildRules': [1, PBXBuildRule, 1, 1, []],
+ 'productReference': [0, PBXFileReference, 0, 1],
+ 'productType': [0, str, 0, 1],
+ })
+
+ # Mapping from Xcode product-types to settings. The settings are:
+ # filetype : used for explicitFileType in the project file
+ # prefix : the prefix for the file name
+ # suffix : the suffix for the filen ame
+ _product_filetypes = {
+ 'com.apple.product-type.application': ['wrapper.application',
+ '', '.app'],
+ 'com.apple.product-type.bundle': ['wrapper.cfbundle',
+ '', '.bundle'],
+ 'com.apple.product-type.framework': ['wrapper.framework',
+ '', '.framework'],
+ 'com.apple.product-type.library.dynamic': ['compiled.mach-o.dylib',
+ 'lib', '.dylib'],
+ 'com.apple.product-type.library.static': ['archive.ar',
+ 'lib', '.a'],
+ 'com.apple.product-type.tool': ['compiled.mach-o.executable',
+ '', ''],
+ 'com.googlecode.gyp.xcode.bundle': ['compiled.mach-o.dylib',
+ '', '.so'],
+ }
+
+ def __init__(self, properties=None, id=None, parent=None,
+ force_outdir=None, force_prefix=None, force_extension=None):
+ # super
+ XCTarget.__init__(self, properties, id, parent)
+
+ if 'productName' in self._properties and \
+ 'productType' in self._properties and \
+ not 'productReference' in self._properties and \
+ self._properties['productType'] in self._product_filetypes:
+ products_group = None
+ pbxproject = self.PBXProjectAncestor()
+ if pbxproject != None:
+ products_group = pbxproject.ProductsGroup()
+
+ if products_group != None:
+ (filetype, prefix, suffix) = \
+ self._product_filetypes[self._properties['productType']]
+ # Xcode does not have a distinct type for loadable modules that are
+ # pure BSD targets (not in a bundle wrapper). GYP allows such modules
+ # to be specified by setting a target type to loadable_module without
+ # having mac_bundle set. These are mapped to the pseudo-product type
+ # com.googlecode.gyp.xcode.bundle.
+ #
+ # By picking up this special type and converting it to a dynamic
+ # library (com.apple.product-type.library.dynamic) with fix-ups,
+ # single-file loadable modules can be produced.
+ #
+ # MACH_O_TYPE is changed to mh_bundle to produce the proper file type
+ # (as opposed to mh_dylib). In order for linking to succeed,
+ # DYLIB_CURRENT_VERSION and DYLIB_COMPATIBILITY_VERSION must be
+ # cleared. They are meaningless for type mh_bundle.
+ #
+ # Finally, the .so extension is forcibly applied over the default
+ # (.dylib), unless another forced extension is already selected.
+ # .dylib is plainly wrong, and .bundle is used by loadable_modules in
+ # bundle wrappers (com.apple.product-type.bundle). .so seems an odd
+ # choice because it's used as the extension on many other systems that
+ # don't distinguish between linkable shared libraries and non-linkable
+ # loadable modules, but there's precedent: Python loadable modules on
+ # Mac OS X use an .so extension.
+ if self._properties['productType'] == 'com.googlecode.gyp.xcode.bundle':
+ self._properties['productType'] = \
+ 'com.apple.product-type.library.dynamic'
+ self.SetBuildSetting('MACH_O_TYPE', 'mh_bundle')
+ self.SetBuildSetting('DYLIB_CURRENT_VERSION', '')
+ self.SetBuildSetting('DYLIB_COMPATIBILITY_VERSION', '')
+ if force_extension == None:
+ force_extension = suffix[1:]
+
+ if force_extension is not None:
+ # If it's a wrapper (bundle), set WRAPPER_EXTENSION.
+ if filetype.startswith('wrapper.'):
+ self.SetBuildSetting('WRAPPER_EXTENSION', force_extension)
+ else:
+ # Extension override.
+ suffix = '.' + force_extension
+ self.SetBuildSetting('EXECUTABLE_EXTENSION', force_extension)
+
+ if filetype.startswith('compiled.mach-o.executable'):
+ product_name = self._properties['productName']
+ product_name += suffix
+ suffix = ''
+ self.SetProperty('productName', product_name)
+ self.SetBuildSetting('PRODUCT_NAME', product_name)
+
+ # Xcode handles most prefixes based on the target type, however there
+ # are exceptions. If a "BSD Dynamic Library" target is added in the
+ # Xcode UI, Xcode sets EXECUTABLE_PREFIX. This check duplicates that
+ # behavior.
+ if force_prefix is not None:
+ prefix = force_prefix
+ if filetype.startswith('wrapper.'):
+ self.SetBuildSetting('WRAPPER_PREFIX', prefix)
+ else:
+ self.SetBuildSetting('EXECUTABLE_PREFIX', prefix)
+
+ if force_outdir is not None:
+ self.SetBuildSetting('TARGET_BUILD_DIR', force_outdir)
+
+ # TODO(tvl): Remove the below hack.
+ # http://code.google.com/p/gyp/issues/detail?id=122
+
+ # Some targets include the prefix in the target_name. These targets
+ # really should just add a product_name setting that doesn't include
+ # the prefix. For example:
+ # target_name = 'libevent', product_name = 'event'
+ # This check cleans up for them.
+ product_name = self._properties['productName']
+ prefix_len = len(prefix)
+ if prefix_len and (product_name[:prefix_len] == prefix):
+ product_name = product_name[prefix_len:]
+ self.SetProperty('productName', product_name)
+ self.SetBuildSetting('PRODUCT_NAME', product_name)
+
+ ref_props = {
+ 'explicitFileType': filetype,
+ 'includeInIndex': 0,
+ 'path': prefix + product_name + suffix,
+ 'sourceTree': 'BUILT_PRODUCTS_DIR',
+ }
+ file_ref = PBXFileReference(ref_props)
+ products_group.AppendChild(file_ref)
+ self.SetProperty('productReference', file_ref)
+
+ def GetBuildPhaseByType(self, type):
+ if not 'buildPhases' in self._properties:
+ return None
+
+ the_phase = None
+ for phase in self._properties['buildPhases']:
+ if isinstance(phase, type):
+ # Some phases may be present in multiples in a well-formed project file,
+ # but phases like PBXSourcesBuildPhase may only be present singly, and
+ # this function is intended as an aid to GetBuildPhaseByType. Loop
+ # over the entire list of phases and assert if more than one of the
+ # desired type is found.
+ assert the_phase == None
+ the_phase = phase
+
+ return the_phase
+
+ def HeadersPhase(self):
+ headers_phase = self.GetBuildPhaseByType(PBXHeadersBuildPhase)
+ if headers_phase == None:
+ headers_phase = PBXHeadersBuildPhase()
+
+ # The headers phase should come before the resources, sources, and
+ # frameworks phases, if any.
+ insert_at = len(self._properties['buildPhases'])
+ for index in xrange(0, len(self._properties['buildPhases'])):
+ phase = self._properties['buildPhases'][index]
+ if isinstance(phase, PBXResourcesBuildPhase) or \
+ isinstance(phase, PBXSourcesBuildPhase) or \
+ isinstance(phase, PBXFrameworksBuildPhase):
+ insert_at = index
+ break
+
+ self._properties['buildPhases'].insert(insert_at, headers_phase)
+ headers_phase.parent = self
+
+ return headers_phase
+
+ def ResourcesPhase(self):
+ resources_phase = self.GetBuildPhaseByType(PBXResourcesBuildPhase)
+ if resources_phase == None:
+ resources_phase = PBXResourcesBuildPhase()
+
+ # The resources phase should come before the sources and frameworks
+ # phases, if any.
+ insert_at = len(self._properties['buildPhases'])
+ for index in xrange(0, len(self._properties['buildPhases'])):
+ phase = self._properties['buildPhases'][index]
+ if isinstance(phase, PBXSourcesBuildPhase) or \
+ isinstance(phase, PBXFrameworksBuildPhase):
+ insert_at = index
+ break
+
+ self._properties['buildPhases'].insert(insert_at, resources_phase)
+ resources_phase.parent = self
+
+ return resources_phase
+
+ def SourcesPhase(self):
+ sources_phase = self.GetBuildPhaseByType(PBXSourcesBuildPhase)
+ if sources_phase == None:
+ sources_phase = PBXSourcesBuildPhase()
+ self.AppendProperty('buildPhases', sources_phase)
+
+ return sources_phase
+
+ def FrameworksPhase(self):
+ frameworks_phase = self.GetBuildPhaseByType(PBXFrameworksBuildPhase)
+ if frameworks_phase == None:
+ frameworks_phase = PBXFrameworksBuildPhase()
+ self.AppendProperty('buildPhases', frameworks_phase)
+
+ return frameworks_phase
+
+ def AddDependency(self, other):
+ # super
+ XCTarget.AddDependency(self, other)
+
+ static_library_type = 'com.apple.product-type.library.static'
+ shared_library_type = 'com.apple.product-type.library.dynamic'
+ framework_type = 'com.apple.product-type.framework'
+ if isinstance(other, PBXNativeTarget) and \
+ 'productType' in self._properties and \
+ self._properties['productType'] != static_library_type and \
+ 'productType' in other._properties and \
+ (other._properties['productType'] == static_library_type or \
+ ((other._properties['productType'] == shared_library_type or \
+ other._properties['productType'] == framework_type) and \
+ ((not other.HasBuildSetting('MACH_O_TYPE')) or
+ other.GetBuildSetting('MACH_O_TYPE') != 'mh_bundle'))):
+
+ file_ref = other.GetProperty('productReference')
+
+ pbxproject = self.PBXProjectAncestor()
+ other_pbxproject = other.PBXProjectAncestor()
+ if pbxproject != other_pbxproject:
+ other_project_product_group = \
+ pbxproject.AddOrGetProjectReference(other_pbxproject)[0]
+ file_ref = other_project_product_group.GetChildByRemoteObject(file_ref)
+
+ self.FrameworksPhase().AppendProperty('files',
+ PBXBuildFile({'fileRef': file_ref}))
+
+
+class PBXAggregateTarget(XCTarget):
+ pass
+
+
+class PBXProject(XCContainerPortal):
+ # A PBXProject is really just an XCObject, the XCContainerPortal thing is
+ # just to allow PBXProject to be used in the containerPortal property of
+ # PBXContainerItemProxy.
+ """
+
+ Attributes:
+ path: "sample.xcodeproj". TODO(mark) Document me!
+ _other_pbxprojects: A dictionary, keyed by other PBXProject objects. Each
+ value is a reference to the dict in the
+ projectReferences list associated with the keyed
+ PBXProject.
+ """
+
+ _schema = XCContainerPortal._schema.copy()
+ _schema.update({
+ 'attributes': [0, dict, 0, 0],
+ 'buildConfigurationList': [0, XCConfigurationList, 1, 1,
+ XCConfigurationList()],
+ 'compatibilityVersion': [0, str, 0, 1, 'Xcode 3.1'],
+ 'hasScannedForEncodings': [0, int, 0, 1, 1],
+ 'mainGroup': [0, PBXGroup, 1, 1, PBXGroup()],
+ 'projectDirPath': [0, str, 0, 1, ''],
+ 'projectReferences': [1, dict, 0, 0],
+ 'projectRoot': [0, str, 0, 1, ''],
+ 'targets': [1, XCTarget, 1, 1, []],
+ })
+
+ def __init__(self, properties=None, id=None, parent=None, path=None):
+ self.path = path
+ self._other_pbxprojects = {}
+ # super
+ return XCContainerPortal.__init__(self, properties, id, parent)
+
+ def Name(self):
+ name = self.path
+ if name[-10:] == '.xcodeproj':
+ name = name[:-10]
+ return posixpath.basename(name)
+
+ def Path(self):
+ return self.path
+
+ def Comment(self):
+ return 'Project object'
+
+ def Children(self):
+ # super
+ children = XCContainerPortal.Children(self)
+
+ # Add children that the schema doesn't know about. Maybe there's a more
+ # elegant way around this, but this is the only case where we need to own
+ # objects in a dictionary (that is itself in a list), and three lines for
+ # a one-off isn't that big a deal.
+ if 'projectReferences' in self._properties:
+ for reference in self._properties['projectReferences']:
+ children.append(reference['ProductGroup'])
+
+ return children
+
+ def PBXProjectAncestor(self):
+ return self
+
+ def _GroupByName(self, name):
+ if not 'mainGroup' in self._properties:
+ self.SetProperty('mainGroup', PBXGroup())
+
+ main_group = self._properties['mainGroup']
+ group = main_group.GetChildByName(name)
+ if group == None:
+ group = PBXGroup({'name': name})
+ main_group.AppendChild(group)
+
+ return group
+
+ # SourceGroup and ProductsGroup are created by default in Xcode's own
+ # templates.
+ def SourceGroup(self):
+ return self._GroupByName('Source')
+
+ def ProductsGroup(self):
+ return self._GroupByName('Products')
+
+ # IntermediatesGroup is used to collect source-like files that are generated
+ # by rules or script phases and are placed in intermediate directories such
+ # as DerivedSources.
+ def IntermediatesGroup(self):
+ return self._GroupByName('Intermediates')
+
+ # FrameworksGroup and ProjectsGroup are top-level groups used to collect
+ # frameworks and projects.
+ def FrameworksGroup(self):
+ return self._GroupByName('Frameworks')
+
+ def ProjectsGroup(self):
+ return self._GroupByName('Projects')
+
+ def RootGroupForPath(self, path):
+ """Returns a PBXGroup child of this object to which path should be added.
+
+ This method is intended to choose between SourceGroup and
+ IntermediatesGroup on the basis of whether path is present in a source
+ directory or an intermediates directory. For the purposes of this
+ determination, any path located within a derived file directory such as
+ PROJECT_DERIVED_FILE_DIR is treated as being in an intermediates
+ directory.
+
+ The returned value is a two-element tuple. The first element is the
+ PBXGroup, and the second element specifies whether that group should be
+ organized hierarchically (True) or as a single flat list (False).
+ """
+
+ # TODO(mark): make this a class variable and bind to self on call?
+ # Also, this list is nowhere near exhaustive.
+ # INTERMEDIATE_DIR and SHARED_INTERMEDIATE_DIR are used by
+ # gyp.generator.xcode. There should probably be some way for that module
+ # to push the names in, rather than having to hard-code them here.
+ source_tree_groups = {
+ 'DERIVED_FILE_DIR': (self.IntermediatesGroup, True),
+ 'INTERMEDIATE_DIR': (self.IntermediatesGroup, True),
+ 'PROJECT_DERIVED_FILE_DIR': (self.IntermediatesGroup, True),
+ 'SHARED_INTERMEDIATE_DIR': (self.IntermediatesGroup, True),
+ }
+
+ (source_tree, path) = SourceTreeAndPathFromPath(path)
+ if source_tree != None and source_tree in source_tree_groups:
+ (group_func, hierarchical) = source_tree_groups[source_tree]
+ group = group_func()
+ return (group, hierarchical)
+
+ # TODO(mark): make additional choices based on file extension.
+
+ return (self.SourceGroup(), True)
+
+ def AddOrGetFileInRootGroup(self, path):
+ """Returns a PBXFileReference corresponding to path in the correct group
+ according to RootGroupForPath's heuristics.
+
+ If an existing PBXFileReference for path exists, it will be returned.
+ Otherwise, one will be created and returned.
+ """
+
+ (group, hierarchical) = self.RootGroupForPath(path)
+ return group.AddOrGetFileByPath(path, hierarchical)
+
+ def RootGroupsTakeOverOnlyChildren(self, recurse=False):
+ """Calls TakeOverOnlyChild for all groups in the main group."""
+
+ for group in self._properties['mainGroup']._properties['children']:
+ if isinstance(group, PBXGroup):
+ group.TakeOverOnlyChild(recurse)
+
+ def SortGroups(self):
+ # Sort the children of the mainGroup (like "Source" and "Products")
+ # according to their defined order.
+ self._properties['mainGroup']._properties['children'] = \
+ sorted(self._properties['mainGroup']._properties['children'],
+ cmp=lambda x,y: x.CompareRootGroup(y))
+
+ # Sort everything else by putting group before files, and going
+ # alphabetically by name within sections of groups and files. SortGroup
+ # is recursive.
+ for group in self._properties['mainGroup']._properties['children']:
+ if not isinstance(group, PBXGroup):
+ continue
+
+ if group.Name() == 'Products':
+ # The Products group is a special case. Instead of sorting
+ # alphabetically, sort things in the order of the targets that
+ # produce the products. To do this, just build up a new list of
+ # products based on the targets.
+ products = []
+ for target in self._properties['targets']:
+ if not isinstance(target, PBXNativeTarget):
+ continue
+ product = target._properties['productReference']
+ # Make sure that the product is already in the products group.
+ assert product in group._properties['children']
+ products.append(product)
+
+ # Make sure that this process doesn't miss anything that was already
+ # in the products group.
+ assert len(products) == len(group._properties['children'])
+ group._properties['children'] = products
+ else:
+ group.SortGroup()
+
+ def AddOrGetProjectReference(self, other_pbxproject):
+ """Add a reference to another project file (via PBXProject object) to this
+ one.
+
+ Returns [ProductGroup, ProjectRef]. ProductGroup is a PBXGroup object in
+ this project file that contains a PBXReferenceProxy object for each
+ product of each PBXNativeTarget in the other project file. ProjectRef is
+ a PBXFileReference to the other project file.
+
+ If this project file already references the other project file, the
+ existing ProductGroup and ProjectRef are returned. The ProductGroup will
+ still be updated if necessary.
+ """
+
+ if not 'projectReferences' in self._properties:
+ self._properties['projectReferences'] = []
+
+ product_group = None
+ project_ref = None
+
+ if not other_pbxproject in self._other_pbxprojects:
+ # This project file isn't yet linked to the other one. Establish the
+ # link.
+ product_group = PBXGroup({'name': 'Products'})
+
+ # ProductGroup is strong.
+ product_group.parent = self
+
+ # There's nothing unique about this PBXGroup, and if left alone, it will
+ # wind up with the same set of hashables as all other PBXGroup objects
+ # owned by the projectReferences list. Add the hashables of the
+ # remote PBXProject that it's related to.
+ product_group._hashables.extend(other_pbxproject.Hashables())
+
+ # The other project reports its path as relative to the same directory
+ # that this project's path is relative to. The other project's path
+ # is not necessarily already relative to this project. Figure out the
+ # pathname that this project needs to use to refer to the other one.
+ this_path = posixpath.dirname(self.Path())
+ projectDirPath = self.GetProperty('projectDirPath')
+ if projectDirPath:
+ if posixpath.isabs(projectDirPath[0]):
+ this_path = projectDirPath
+ else:
+ this_path = posixpath.join(this_path, projectDirPath)
+ other_path = gyp.common.RelativePath(other_pbxproject.Path(), this_path)
+
+ # ProjectRef is weak (it's owned by the mainGroup hierarchy).
+ project_ref = PBXFileReference({
+ 'lastKnownFileType': 'wrapper.pb-project',
+ 'path': other_path,
+ 'sourceTree': 'SOURCE_ROOT',
+ })
+ self.ProjectsGroup().AppendChild(project_ref)
+
+ ref_dict = {'ProductGroup': product_group, 'ProjectRef': project_ref}
+ self._other_pbxprojects[other_pbxproject] = ref_dict
+ self.AppendProperty('projectReferences', ref_dict)
+
+ # Xcode seems to sort this list case-insensitively
+ self._properties['projectReferences'] = \
+ sorted(self._properties['projectReferences'], cmp=lambda x,y:
+ cmp(x['ProjectRef'].Name().lower(),
+ y['ProjectRef'].Name().lower()))
+ else:
+ # The link already exists. Pull out the relevnt data.
+ project_ref_dict = self._other_pbxprojects[other_pbxproject]
+ product_group = project_ref_dict['ProductGroup']
+ project_ref = project_ref_dict['ProjectRef']
+
+ self._SetUpProductReferences(other_pbxproject, product_group, project_ref)
+
+ return [product_group, project_ref]
+
+ def _SetUpProductReferences(self, other_pbxproject, product_group,
+ project_ref):
+ # TODO(mark): This only adds references to products in other_pbxproject
+ # when they don't exist in this pbxproject. Perhaps it should also
+ # remove references from this pbxproject that are no longer present in
+ # other_pbxproject. Perhaps it should update various properties if they
+ # change.
+ for target in other_pbxproject._properties['targets']:
+ if not isinstance(target, PBXNativeTarget):
+ continue
+
+ other_fileref = target._properties['productReference']
+ if product_group.GetChildByRemoteObject(other_fileref) == None:
+ # Xcode sets remoteInfo to the name of the target and not the name
+ # of its product, despite this proxy being a reference to the product.
+ container_item = PBXContainerItemProxy({
+ 'containerPortal': project_ref,
+ 'proxyType': 2,
+ 'remoteGlobalIDString': other_fileref,
+ 'remoteInfo': target.Name()
+ })
+ # TODO(mark): Does sourceTree get copied straight over from the other
+ # project? Can the other project ever have lastKnownFileType here
+ # instead of explicitFileType? (Use it if so?) Can path ever be
+ # unset? (I don't think so.) Can other_fileref have name set, and
+ # does it impact the PBXReferenceProxy if so? These are the questions
+ # that perhaps will be answered one day.
+ reference_proxy = PBXReferenceProxy({
+ 'fileType': other_fileref._properties['explicitFileType'],
+ 'path': other_fileref._properties['path'],
+ 'sourceTree': other_fileref._properties['sourceTree'],
+ 'remoteRef': container_item,
+ })
+
+ product_group.AppendChild(reference_proxy)
+
+ def SortRemoteProductReferences(self):
+ # For each remote project file, sort the associated ProductGroup in the
+ # same order that the targets are sorted in the remote project file. This
+ # is the sort order used by Xcode.
+
+ def CompareProducts(x, y, remote_products):
+ # x and y are PBXReferenceProxy objects. Go through their associated
+ # PBXContainerItem to get the remote PBXFileReference, which will be
+ # present in the remote_products list.
+ x_remote = x._properties['remoteRef']._properties['remoteGlobalIDString']
+ y_remote = y._properties['remoteRef']._properties['remoteGlobalIDString']
+ x_index = remote_products.index(x_remote)
+ y_index = remote_products.index(y_remote)
+
+ # Use the order of each remote PBXFileReference in remote_products to
+ # determine the sort order.
+ return cmp(x_index, y_index)
+
+ for other_pbxproject, ref_dict in self._other_pbxprojects.iteritems():
+ # Build up a list of products in the remote project file, ordered the
+ # same as the targets that produce them.
+ remote_products = []
+ for target in other_pbxproject._properties['targets']:
+ if not isinstance(target, PBXNativeTarget):
+ continue
+ remote_products.append(target._properties['productReference'])
+
+ # Sort the PBXReferenceProxy children according to the list of remote
+ # products.
+ product_group = ref_dict['ProductGroup']
+ product_group._properties['children'] = sorted(
+ product_group._properties['children'],
+ cmp=lambda x, y: CompareProducts(x, y, remote_products))
+
+
+class XCProjectFile(XCObject):
+ _schema = XCObject._schema.copy()
+ _schema.update({
+ 'archiveVersion': [0, int, 0, 1, 1],
+ 'classes': [0, dict, 0, 1, {}],
+ 'objectVersion': [0, int, 0, 1, 45],
+ 'rootObject': [0, PBXProject, 1, 1],
+ })
+
+ def SetXcodeVersion(self, version):
+ version_to_object_version = {
+ '2.4': 45,
+ '3.0': 45,
+ '3.1': 45,
+ '3.2': 46,
+ }
+ if not version in version_to_object_version:
+ supported_str = ', '.join(sorted(version_to_object_version.keys()))
+ raise Exception(
+ 'Unsupported Xcode version %s (supported: %s)' %
+ ( version, supported_str ) )
+ compatibility_version = 'Xcode %s' % version
+ self._properties['rootObject'].SetProperty('compatibilityVersion',
+ compatibility_version)
+ self.SetProperty('objectVersion', version_to_object_version[version]);
+
+ def ComputeIDs(self, recursive=True, overwrite=True, hash=None):
+ # Although XCProjectFile is implemented here as an XCObject, it's not a
+ # proper object in the Xcode sense, and it certainly doesn't have its own
+ # ID. Pass through an attempt to update IDs to the real root object.
+ if recursive:
+ self._properties['rootObject'].ComputeIDs(recursive, overwrite, hash)
+
+ def Print(self, file=sys.stdout):
+ self.VerifyHasRequiredProperties()
+
+ # Add the special "objects" property, which will be caught and handled
+ # separately during printing. This structure allows a fairly standard
+ # loop do the normal printing.
+ self._properties['objects'] = {}
+ self._XCPrint(file, 0, '// !$*UTF8*$!\n')
+ if self._should_print_single_line:
+ self._XCPrint(file, 0, '{ ')
+ else:
+ self._XCPrint(file, 0, '{\n')
+ for property, value in sorted(self._properties.iteritems(),
+ cmp=lambda x, y: cmp(x, y)):
+ if property == 'objects':
+ self._PrintObjects(file)
+ else:
+ self._XCKVPrint(file, 1, property, value)
+ self._XCPrint(file, 0, '}\n')
+ del self._properties['objects']
+
+ def _PrintObjects(self, file):
+ if self._should_print_single_line:
+ self._XCPrint(file, 0, 'objects = {')
+ else:
+ self._XCPrint(file, 1, 'objects = {\n')
+
+ objects_by_class = {}
+ for object in self.Descendants():
+ if object == self:
+ continue
+ class_name = object.__class__.__name__
+ if not class_name in objects_by_class:
+ objects_by_class[class_name] = []
+ objects_by_class[class_name].append(object)
+
+ for class_name in sorted(objects_by_class):
+ self._XCPrint(file, 0, '\n')
+ self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n')
+ for object in sorted(objects_by_class[class_name],
+ cmp=lambda x, y: cmp(x.id, y.id)):
+ object.Print(file)
+ self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n')
+
+ if self._should_print_single_line:
+ self._XCPrint(file, 0, '}; ')
+ else:
+ self._XCPrint(file, 1, '};\n')
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xml_fix.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xml_fix.py
new file mode 100644
index 0000000..20f782d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xml_fix.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Applies a fix to CR LF TAB handling in xml.dom.
+
+Fixes this: http://code.google.com/p/chromium/issues/detail?id=76293
+Working around this: http://bugs.python.org/issue5752
+TODO(bradnelson): Consider dropping this when we drop XP support.
+"""
+
+
+import xml.dom.minidom
+
+
+def _Replacement_write_data(writer, data, is_attrib=False):
+ """Writes datachars to writer."""
+ data = data.replace("&", "&amp;").replace("<", "&lt;")
+ data = data.replace("\"", "&quot;").replace(">", "&gt;")
+ if is_attrib:
+ data = data.replace(
+ "\r", "&#xD;").replace(
+ "\n", "&#xA;").replace(
+ "\t", "&#x9;")
+ writer.write(data)
+
+
+def _Replacement_writexml(self, writer, indent="", addindent="", newl=""):
+ # indent = current indentation
+ # addindent = indentation to add to higher levels
+ # newl = newline string
+ writer.write(indent+"<" + self.tagName)
+
+ attrs = self._get_attributes()
+ a_names = attrs.keys()
+ a_names.sort()
+
+ for a_name in a_names:
+ writer.write(" %s=\"" % a_name)
+ _Replacement_write_data(writer, attrs[a_name].value, is_attrib=True)
+ writer.write("\"")
+ if self.childNodes:
+ writer.write(">%s" % newl)
+ for node in self.childNodes:
+ node.writexml(writer, indent + addindent, addindent, newl)
+ writer.write("%s</%s>%s" % (indent, self.tagName, newl))
+ else:
+ writer.write("/>%s" % newl)
+
+
+class XmlFix(object):
+ """Object to manage temporary patching of xml.dom.minidom."""
+
+ def __init__(self):
+ # Preserve current xml.dom.minidom functions.
+ self.write_data = xml.dom.minidom._write_data
+ self.writexml = xml.dom.minidom.Element.writexml
+ # Inject replacement versions of a function and a method.
+ xml.dom.minidom._write_data = _Replacement_write_data
+ xml.dom.minidom.Element.writexml = _Replacement_writexml
+
+ def Cleanup(self):
+ if self.write_data:
+ xml.dom.minidom._write_data = self.write_data
+ xml.dom.minidom.Element.writexml = self.writexml
+ self.write_data = None
+
+ def __del__(self):
+ self.Cleanup()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples b/src/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples
new file mode 100755
index 0000000..804b618
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os.path
+import shutil
+import sys
+
+
+gyps = [
+ 'app/app.gyp',
+ 'base/base.gyp',
+ 'build/temp_gyp/googleurl.gyp',
+ 'build/all.gyp',
+ 'build/common.gypi',
+ 'build/external_code.gypi',
+ 'chrome/test/security_tests/security_tests.gyp',
+ 'chrome/third_party/hunspell/hunspell.gyp',
+ 'chrome/chrome.gyp',
+ 'media/media.gyp',
+ 'net/net.gyp',
+ 'printing/printing.gyp',
+ 'sdch/sdch.gyp',
+ 'skia/skia.gyp',
+ 'testing/gmock.gyp',
+ 'testing/gtest.gyp',
+ 'third_party/bzip2/bzip2.gyp',
+ 'third_party/icu38/icu38.gyp',
+ 'third_party/libevent/libevent.gyp',
+ 'third_party/libjpeg/libjpeg.gyp',
+ 'third_party/libpng/libpng.gyp',
+ 'third_party/libxml/libxml.gyp',
+ 'third_party/libxslt/libxslt.gyp',
+ 'third_party/lzma_sdk/lzma_sdk.gyp',
+ 'third_party/modp_b64/modp_b64.gyp',
+ 'third_party/npapi/npapi.gyp',
+ 'third_party/sqlite/sqlite.gyp',
+ 'third_party/zlib/zlib.gyp',
+ 'v8/tools/gyp/v8.gyp',
+ 'webkit/activex_shim/activex_shim.gyp',
+ 'webkit/activex_shim_dll/activex_shim_dll.gyp',
+ 'webkit/build/action_csspropertynames.py',
+ 'webkit/build/action_cssvaluekeywords.py',
+ 'webkit/build/action_jsconfig.py',
+ 'webkit/build/action_makenames.py',
+ 'webkit/build/action_maketokenizer.py',
+ 'webkit/build/action_useragentstylesheets.py',
+ 'webkit/build/rule_binding.py',
+ 'webkit/build/rule_bison.py',
+ 'webkit/build/rule_gperf.py',
+ 'webkit/tools/test_shell/test_shell.gyp',
+ 'webkit/webkit.gyp',
+]
+
+
+def Main(argv):
+ if len(argv) != 3 or argv[1] not in ['push', 'pull']:
+ print 'Usage: %s push/pull PATH_TO_CHROME' % argv[0]
+ return 1
+
+ path_to_chrome = argv[2]
+
+ for g in gyps:
+ chrome_file = os.path.join(path_to_chrome, g)
+ local_file = os.path.join(os.path.dirname(argv[0]), os.path.split(g)[1])
+ if argv[1] == 'push':
+ print 'Copying %s to %s' % (local_file, chrome_file)
+ shutil.copyfile(local_file, chrome_file)
+ elif argv[1] == 'pull':
+ print 'Copying %s to %s' % (chrome_file, local_file)
+ shutil.copyfile(chrome_file, local_file)
+ else:
+ assert False
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(Main(sys.argv))
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples.bat b/src/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples.bat
new file mode 100644
index 0000000..5683255
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/samples/samples.bat
@@ -0,0 +1,5 @@
+@rem Copyright (c) 2009 Google Inc. All rights reserved.
+@rem Use of this source code is governed by a BSD-style license that can be
+@rem found in the LICENSE file.
+
+@python %~dp0/samples %*
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/setup.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/setup.py
new file mode 100755
index 0000000..ed2b41a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/setup.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from distutils.core import setup
+from distutils.command.install import install
+from distutils.command.install_lib import install_lib
+from distutils.command.install_scripts import install_scripts
+
+setup(
+ name='gyp',
+ version='0.1',
+ description='Generate Your Projects',
+ author='Chromium Authors',
+ author_email='chromium-dev@googlegroups.com',
+ url='http://code.google.com/p/gyp',
+ package_dir = {'': 'pylib'},
+ packages=['gyp', 'gyp.generator'],
+
+ scripts = ['gyp'],
+ cmdclass = {'install': install,
+ 'install_lib': install_lib,
+ 'install_scripts': install_scripts},
+)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/gyptest-bare.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/gyptest-bare.py
new file mode 100644
index 0000000..b0c1093
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/gyptest-bare.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies actions which are not depended on by other targets get executed.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('bare.gyp', chdir='src')
+test.relocate('src', 'relocate/src')
+test.build('bare.gyp', chdir='relocate/src')
+
+file_content = 'Hello from bare.py\n'
+
+test.built_file_must_match('out.txt', file_content, chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.gyp
new file mode 100644
index 0000000..3d28f09
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.gyp
@@ -0,0 +1,25 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'bare',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'action1',
+ 'inputs': [
+ 'bare.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/out.txt',
+ ],
+ 'action': ['python', 'bare.py', '<(PRODUCT_DIR)/out.txt'],
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.py
new file mode 100644
index 0000000..970450e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.py
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+f = open(sys.argv[1], 'wb')
+f.write('Hello from bare.py\n')
+f.close()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/gyptest-all.py
new file mode 100644
index 0000000..7b94fef
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/gyptest-all.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies two actions can be attached to the same input files.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('actions.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+# Test that two actions can be attached to the same inputs.
+test.build('actions.gyp', test.ALL, chdir='relocate/src')
+test.must_contain('relocate/src/output1.txt', 'hello there')
+test.must_contain('relocate/src/output2.txt', 'hello there')
+test.must_contain('relocate/src/output3.txt', 'hello there')
+test.must_contain('relocate/src/output4.txt', 'hello there')
+
+# Test that process_outputs_as_sources works in conjuction with merged
+# actions.
+test.run_built_executable(
+ 'multiple_action_source_filter',
+ chdir='relocate/src',
+ stdout=(
+ '{\n'
+ 'bar\n'
+ 'car\n'
+ 'dar\n'
+ 'ear\n'
+ '}\n'
+ ),
+)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/actions.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/actions.gyp
new file mode 100644
index 0000000..b38df45
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/actions.gyp
@@ -0,0 +1,165 @@
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ # Have a long string so that actions will exceed xp 512 character
+ # command limit on xp.
+ 'long_string':
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ 'abcdefghijklmnopqrstuvwxyz0123456789'
+ },
+ 'targets': [
+ {
+ 'target_name': 'multiple_action_target',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'action1',
+ 'inputs': [
+ 'copy.py',
+ 'input.txt',
+ ],
+ 'outputs': [
+ 'output1.txt',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ {
+ 'action_name': 'action2',
+ 'inputs': [
+ 'copy.py',
+ 'input.txt',
+ ],
+ 'outputs': [
+ 'output2.txt',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ {
+ 'action_name': 'action3',
+ 'inputs': [
+ 'copy.py',
+ 'input.txt',
+ ],
+ 'outputs': [
+ 'output3.txt',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ {
+ 'action_name': 'action4',
+ 'inputs': [
+ 'copy.py',
+ 'input.txt',
+ ],
+ 'outputs': [
+ 'output4.txt',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ {
+ 'target_name': 'multiple_action_source_filter',
+ 'type': 'executable',
+ 'sources': [
+ 'main.c',
+ # TODO(bradnelson): add foo.c here once this issue is fixed:
+ # http://code.google.com/p/gyp/issues/detail?id=175
+ ],
+ 'actions': [
+ {
+ 'action_name': 'action1',
+ 'inputs': [
+ 'foo.c',
+ 'filter.py',
+ ],
+ 'outputs': [
+ 'output1.c',
+ ],
+ 'process_outputs_as_sources': 1,
+ 'action': [
+ 'python', 'filter.py', 'foo', 'bar', 'foo.c', '<(_outputs)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ {
+ 'action_name': 'action2',
+ 'inputs': [
+ 'foo.c',
+ 'filter.py',
+ ],
+ 'outputs': [
+ 'output2.c',
+ ],
+ 'process_outputs_as_sources': 1,
+ 'action': [
+ 'python', 'filter.py', 'foo', 'car', 'foo.c', '<(_outputs)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ {
+ 'action_name': 'action3',
+ 'inputs': [
+ 'foo.c',
+ 'filter.py',
+ ],
+ 'outputs': [
+ 'output3.c',
+ ],
+ 'process_outputs_as_sources': 1,
+ 'action': [
+ 'python', 'filter.py', 'foo', 'dar', 'foo.c', '<(_outputs)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ {
+ 'action_name': 'action4',
+ 'inputs': [
+ 'foo.c',
+ 'filter.py',
+ ],
+ 'outputs': [
+ 'output4.c',
+ ],
+ 'process_outputs_as_sources': 1,
+ 'action': [
+ 'python', 'filter.py', 'foo', 'ear', 'foo.c', '<(_outputs)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/copy.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/copy.py
new file mode 100644
index 0000000..7ba2911
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/copy.py
@@ -0,0 +1,9 @@
+#!/usr/bin/python
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import shutil
+import sys
+
+shutil.copyfile(sys.argv[1], sys.argv[2])
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/filter.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/filter.py
new file mode 100644
index 0000000..d0a0a95
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/filter.py
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+import sys
+
+data = open(sys.argv[3], 'r').read()
+fh = open(sys.argv[4], 'w')
+fh.write(data.replace(sys.argv[1], sys.argv[2]))
+fh.close()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/foo.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/foo.c
new file mode 100644
index 0000000..23c4ef7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/foo.c
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2011 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <stdio.h>
+
+void foo(void) {
+ printf("foo\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/input.txt b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/input.txt
new file mode 100644
index 0000000..c7c7da3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/input.txt
@@ -0,0 +1 @@
+hello there
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/main.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/main.c
new file mode 100644
index 0000000..0a420b9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-multiple/src/main.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2011 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <stdio.h>
+
+void bar(void);
+void car(void);
+void dar(void);
+void ear(void);
+
+int main() {
+ printf("{\n");
+ bar();
+ car();
+ dar();
+ ear();
+ printf("}\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/gyptest-action.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/gyptest-action.py
new file mode 100644
index 0000000..09cfef1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/gyptest-action.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Test actions that output to PRODUCT_DIR.
+"""
+
+import TestGyp
+
+# TODO fix this for xcode: http://code.google.com/p/gyp/issues/detail?id=88
+test = TestGyp.TestGyp(formats=['!xcode'])
+
+test.run_gyp('none.gyp', chdir='src')
+
+test.build('none.gyp', test.ALL, chdir='src')
+
+file_content = 'Hello from make-file.py\n'
+subdir_file_content = 'Hello from make-subdir-file.py\n'
+
+test.built_file_must_match('file.out', file_content, chdir='src')
+test.built_file_must_match('subdir_file.out', subdir_file_content, chdir='src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/make-file.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/make-file.py
new file mode 100644
index 0000000..74e5581
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/make-file.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = 'Hello from make-file.py\n'
+
+open(sys.argv[1], 'wb').write(contents)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/none.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/none.gyp
new file mode 100644
index 0000000..23f8d25
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/none.gyp
@@ -0,0 +1,31 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'file',
+ 'type': 'none',
+ 'msvs_cygwin_shell': 0,
+ 'actions': [
+ {
+ 'action_name': 'make-file',
+ 'inputs': [
+ 'make-file.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/file.out',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ }
+ ],
+ 'dependencies': [
+ 'subdir/subdir.gyp:subdir_file',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/make-subdir-file.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/make-subdir-file.py
new file mode 100644
index 0000000..80ce19a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/make-subdir-file.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = 'Hello from make-subdir-file.py\n'
+
+open(sys.argv[1], 'wb').write(contents)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/subdir.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/subdir.gyp
new file mode 100644
index 0000000..0315d4e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions-subdir/src/subdir/subdir.gyp
@@ -0,0 +1,28 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'subdir_file',
+ 'type': 'none',
+ 'msvs_cygwin_shell': 0,
+ 'actions': [
+ {
+ 'action_name': 'make-subdir-file',
+ 'inputs': [
+ 'make-subdir-file.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/subdir_file.out',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ }
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-all.py
new file mode 100644
index 0000000..8db38d5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-all.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simple actions when using an explicit build target of 'all'.
+"""
+
+import glob
+import os
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('actions.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+# Test that an "always run" action increases a counter on multiple invocations,
+# and that a dependent action updates in step.
+test.build('actions.gyp', test.ALL, chdir='relocate/src')
+test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1')
+test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1')
+test.build('actions.gyp', test.ALL, chdir='relocate/src')
+test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
+test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
+
+# The "always run" action only counts to 2, but the dependent target will count
+# forever if it's allowed to run. This verifies that the dependent target only
+# runs when the "always run" action generates new output, not just because the
+# "always run" ran.
+test.build('actions.gyp', test.ALL, chdir='relocate/src')
+test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
+test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
+
+expect = """\
+Hello from program.c
+Hello from make-prog1.py
+Hello from make-prog2.py
+"""
+
+if test.format == 'xcode':
+ chdir = 'relocate/src/subdir1'
+else:
+ chdir = 'relocate/src'
+test.run_built_executable('program', chdir=chdir, stdout=expect)
+
+
+test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n")
+
+
+expect = "Hello from generate_main.py\n"
+
+if test.format == 'xcode':
+ chdir = 'relocate/src/subdir3'
+else:
+ chdir = 'relocate/src'
+test.run_built_executable('null_input', chdir=chdir, stdout=expect)
+
+
+# Clean out files which may have been created if test.ALL was run.
+def clean_dep_files():
+ for file in (glob.glob('relocate/src/dep_*.txt') +
+ glob.glob('relocate/src/deps_all_done_*.txt')):
+ if os.path.exists(file):
+ os.remove(file)
+
+# Confirm our clean.
+clean_dep_files()
+test.must_not_exist('relocate/src/dep_1.txt')
+test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
+
+# Make sure all deps finish before an action is run on a 'None' target.
+# If using the Make builder, add -j to make things more difficult.
+arguments = []
+if test.format == 'make':
+ arguments = ['-j']
+test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src',
+ arguments=arguments)
+test.must_exist('relocate/src/deps_all_done_first_123.txt')
+
+# Try again with a target that has deps in reverse. Output files from
+# previous tests deleted. Confirm this execution did NOT run the ALL
+# target which would mess up our dep tests.
+clean_dep_files()
+test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src',
+ arguments=arguments)
+test.must_exist('relocate/src/deps_all_done_first_321.txt')
+test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-default.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-default.py
new file mode 100644
index 0000000..c877867
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-default.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simple actions when using the default build target.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('actions.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+# Test that an "always run" action increases a counter on multiple invocations,
+# and that a dependent action updates in step.
+test.build('actions.gyp', chdir='relocate/src')
+test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1')
+test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1')
+test.build('actions.gyp', chdir='relocate/src')
+test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
+test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
+
+# The "always run" action only counts to 2, but the dependent target will count
+# forever if it's allowed to run. This verifies that the dependent target only
+# runs when the "always run" action generates new output, not just because the
+# "always run" ran.
+test.build('actions.gyp', test.ALL, chdir='relocate/src')
+test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
+test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
+
+expect = """\
+Hello from program.c
+Hello from make-prog1.py
+Hello from make-prog2.py
+"""
+
+if test.format == 'xcode':
+ chdir = 'relocate/src/subdir1'
+else:
+ chdir = 'relocate/src'
+test.run_built_executable('program', chdir=chdir, stdout=expect)
+
+
+test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n")
+
+
+expect = "Hello from generate_main.py\n"
+
+if test.format == 'xcode':
+ chdir = 'relocate/src/subdir3'
+else:
+ chdir = 'relocate/src'
+test.run_built_executable('null_input', chdir=chdir, stdout=expect)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-errors.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-errors.py
new file mode 100644
index 0000000..4a2aa07
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-errors.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies behavior for different action configuration errors:
+exit status of 1, and the expected error message must be in stderr.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+
+test.run_gyp('action_missing_name.gyp', chdir='src', status=1, stderr=None)
+expect = [
+ "Anonymous action in target broken_actions2. An action must have an 'action_name' field.",
+]
+test.must_contain_all_lines(test.stderr(), expect)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/action_missing_name.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/action_missing_name.gyp
new file mode 100644
index 0000000..00424c3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/action_missing_name.gyp
@@ -0,0 +1,24 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'broken_actions2',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'inputs': [
+ 'no_name.input',
+ ],
+ 'action': [
+ 'python',
+ '-c',
+ 'print \'missing name\'',
+ ],
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/actions.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/actions.gyp
new file mode 100644
index 0000000..5d2db19
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/actions.gyp
@@ -0,0 +1,114 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'pull_in_all_actions',
+ 'type': 'none',
+ 'dependencies': [
+ 'subdir1/executable.gyp:*',
+ 'subdir2/none.gyp:*',
+ 'subdir3/null_input.gyp:*',
+ ],
+ },
+ {
+ 'target_name': 'depend_on_always_run_action',
+ 'type': 'none',
+ 'dependencies': [ 'subdir1/executable.gyp:counter' ],
+ 'actions': [
+ {
+ 'action_name': 'use_always_run_output',
+ 'inputs': [
+ 'subdir1/actions-out/action-counter.txt',
+ 'subdir1/counter.py',
+ ],
+ 'outputs': [
+ 'subdir1/actions-out/action-counter_2.txt',
+ ],
+ 'action': [
+ 'python', 'subdir1/counter.py', '<(_outputs)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+
+ # Three deps which don't finish immediately.
+ # Each one has a small delay then creates a file.
+ # Delays are 1.0, 1.1, and 2.0 seconds.
+ {
+ 'target_name': 'dep_1',
+ 'type': 'none',
+ 'actions': [{
+ 'inputs': [ 'actions.gyp' ],
+ 'outputs': [ 'dep_1.txt' ],
+ 'action_name': 'dep_1',
+ 'action': [ 'python', '-c',
+ 'import time; time.sleep(1); open(\'dep_1.txt\', \'w\')' ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ }],
+ },
+ {
+ 'target_name': 'dep_2',
+ 'type': 'none',
+ 'actions': [{
+ 'inputs': [ 'actions.gyp' ],
+ 'outputs': [ 'dep_2.txt' ],
+ 'action_name': 'dep_2',
+ 'action': [ 'python', '-c',
+ 'import time; time.sleep(1.1); open(\'dep_2.txt\', \'w\')' ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ }],
+ },
+ {
+ 'target_name': 'dep_3',
+ 'type': 'none',
+ 'actions': [{
+ 'inputs': [ 'actions.gyp' ],
+ 'outputs': [ 'dep_3.txt' ],
+ 'action_name': 'dep_3',
+ 'action': [ 'python', '-c',
+ 'import time; time.sleep(2.0); open(\'dep_3.txt\', \'w\')' ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ }],
+ },
+
+ # An action which assumes the deps have completed.
+ # Does NOT list the output files of it's deps as inputs.
+ # On success create the file deps_all_done_first.txt.
+ {
+ 'target_name': 'action_with_dependencies_123',
+ 'type': 'none',
+ 'dependencies': [ 'dep_1', 'dep_2', 'dep_3' ],
+ 'actions': [{
+ 'inputs': [ 'actions.gyp' ],
+ 'outputs': [ 'deps_all_done_first_123.txt' ],
+ 'action_name': 'action_with_dependencies_123',
+ 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ }],
+ },
+ # Same as above but with deps in reverse.
+ {
+ 'target_name': 'action_with_dependencies_321',
+ 'type': 'none',
+ 'dependencies': [ 'dep_3', 'dep_2', 'dep_1' ],
+ 'actions': [{
+ 'inputs': [ 'actions.gyp' ],
+ 'outputs': [ 'deps_all_done_first_321.txt' ],
+ 'action_name': 'action_with_dependencies_321',
+ 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ }],
+ },
+
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/confirm-dep-files.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/confirm-dep-files.py
new file mode 100644
index 0000000..34efe28
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/confirm-dep-files.py
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+# Confirm presence of files generated by our targets we depend on.
+# If they exist, create a new file.
+#
+# Note target's input files are explicitly NOT defined in the gyp file
+# so they can't easily be passed to this script as args.
+
+import os
+import sys
+
+outfile = sys.argv[1] # Example value we expect: deps_all_done_first_123.txt
+if (os.path.exists("dep_1.txt") and
+ os.path.exists("dep_2.txt") and
+ os.path.exists("dep_3.txt")):
+ open(outfile, "w")
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/counter.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/counter.py
new file mode 100644
index 0000000..3612d7d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/counter.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+import time
+
+output = sys.argv[1]
+persistoutput = "%s.persist" % sys.argv[1]
+
+count = 0
+try:
+ count = open(persistoutput, 'r').read()
+except:
+ pass
+count = int(count) + 1
+
+if len(sys.argv) > 2:
+ max_count = int(sys.argv[2])
+ if count > max_count:
+ count = max_count
+
+oldcount = 0
+try:
+ oldcount = open(output, 'r').read()
+except:
+ pass
+
+# Save the count in a file that is undeclared, and thus hidden, to gyp. We need
+# to do this because, prior to running commands, scons deletes any declared
+# outputs, so we would lose our count if we just wrote to the given output file.
+# (The other option is to use Precious() in the scons generator, but that seems
+# too heavy-handed just to support this somewhat unrealistic test case, and
+# might lead to unintended side-effects).
+open(persistoutput, 'w').write('%d' % (count))
+
+# Only write the given output file if the count has changed.
+if int(oldcount) != count:
+ open(output, 'w').write('%d' % (count))
+ # Sleep so the next run changes the file time sufficiently to make the build
+ # detect the file as changed.
+ time.sleep(1)
+
+sys.exit(0)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/executable.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/executable.gyp
new file mode 100644
index 0000000..6a1ce4f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/executable.gyp
@@ -0,0 +1,74 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'msvs_cygwin_shell': 0,
+ 'sources': [
+ 'program.c',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'make-prog1',
+ 'inputs': [
+ 'make-prog1.py',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/prog1.c',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ },
+ {
+ 'action_name': 'make-prog2',
+ 'inputs': [
+ 'make-prog2.py',
+ ],
+ 'outputs': [
+ 'actions-out/prog2.c',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ {
+ 'target_name': 'counter',
+ 'type': 'none',
+ 'actions': [
+ {
+ # This action should always run, regardless of whether or not it's
+ # inputs or the command-line change. We do this by creating a dummy
+ # first output, which is always missing, thus causing the build to
+ # always try to recreate it. Actual output files should be listed
+ # after the dummy one, and dependent targets should list the real
+ # output(s) in their inputs
+ # (see '../actions.gyp:depend_on_always_run_action').
+ 'action_name': 'action_counter',
+ 'inputs': [
+ 'counter.py',
+ ],
+ 'outputs': [
+ 'actions-out/action-counter.txt.always',
+ 'actions-out/action-counter.txt',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', 'actions-out/action-counter.txt', '2',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog1.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog1.py
new file mode 100644
index 0000000..7ea1d8a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog1.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = r"""
+#include <stdio.h>
+
+void prog1(void)
+{
+ printf("Hello from make-prog1.py\n");
+}
+"""
+
+open(sys.argv[1], 'w').write(contents)
+
+sys.exit(0)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog2.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog2.py
new file mode 100644
index 0000000..0bfe497
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/make-prog2.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = r"""
+#include <stdio.h>
+
+void prog2(void)
+{
+ printf("Hello from make-prog2.py\n");
+}
+"""
+
+open(sys.argv[1], 'w').write(contents)
+
+sys.exit(0)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/program.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/program.c
new file mode 100644
index 0000000..f155939
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir1/program.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+extern void prog1(void);
+extern void prog2(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from program.c\n");
+ prog1();
+ prog2();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/make-file.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/make-file.py
new file mode 100644
index 0000000..fff0653
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/make-file.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = "Hello from make-file.py\n"
+
+open(sys.argv[1], 'wb').write(contents)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/none.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/none.gyp
new file mode 100644
index 0000000..2caa97d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir2/none.gyp
@@ -0,0 +1,33 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'file',
+ 'type': 'none',
+ 'msvs_cygwin_shell': 0,
+ 'actions': [
+ {
+ 'action_name': 'make-file',
+ 'inputs': [
+ 'make-file.py',
+ ],
+ 'outputs': [
+ 'file.out',
+ # TODO: enhance testing infrastructure to test this
+ # without having to hard-code the intermediate dir paths.
+ #'<(INTERMEDIATE_DIR)/file.out',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ }
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/generate_main.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/generate_main.py
new file mode 100644
index 0000000..b90b3aa
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/generate_main.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = """
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from generate_main.py\\n");
+ return 0;
+}
+"""
+
+open(sys.argv[1], 'w').write(contents)
+
+sys.exit(0)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/null_input.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/null_input.gyp
new file mode 100644
index 0000000..9b0bea5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/src/subdir3/null_input.gyp
@@ -0,0 +1,29 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'null_input',
+ 'type': 'executable',
+ 'msvs_cygwin_shell': 0,
+ 'actions': [
+ {
+ 'action_name': 'generate_main',
+ 'process_outputs_as_sources': 1,
+ 'inputs': [],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/main.c',
+ ],
+ 'action': [
+ # TODO: we can't just use <(_outputs) here?!
+ 'python', 'generate_main.py', '<(INTERMEDIATE_DIR)/main.c',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/gyptest-additional.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/gyptest-additional.py
new file mode 100644
index 0000000..02e7d7a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/gyptest-additional.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simple actions when using an explicit build target of 'all'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('all.gyp', chdir='src')
+test.relocate('src', 'relocate/src')
+
+# Build all.
+test.build('all.gyp', chdir='relocate/src')
+
+if test.format=='xcode':
+ chdir = 'relocate/src/dir1'
+else:
+ chdir = 'relocate/src'
+
+# Output is as expected.
+file_content = 'Hello from emit.py\n'
+test.built_file_must_match('out2.txt', file_content, chdir=chdir)
+
+test.built_file_must_not_exist('out.txt', chdir='relocate/src')
+test.built_file_must_not_exist('foolib1',
+ type=test.SHARED_LIB,
+ chdir=chdir)
+
+# TODO(mmoss) Make consistent with scons, with 'dir1' before 'out/Default'?
+if test.format == 'make':
+ chdir='relocate/src'
+else:
+ chdir='relocate/src/dir1'
+
+# Build the action explicitly.
+test.build('actions.gyp', 'action1_target', chdir=chdir)
+
+# Check that things got run.
+file_content = 'Hello from emit.py\n'
+test.built_file_must_exist('out.txt', chdir=chdir)
+
+# Build the shared library explicitly.
+test.build('actions.gyp', 'foolib1', chdir=chdir)
+
+test.built_file_must_exist('foolib1',
+ type=test.SHARED_LIB,
+ chdir=chdir)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/all.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/all.gyp
new file mode 100644
index 0000000..21c8308
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/all.gyp
@@ -0,0 +1,13 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'all_targets',
+ 'type': 'none',
+ 'dependencies': ['dir1/actions.gyp:*'],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/actions.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/actions.gyp
new file mode 100644
index 0000000..5089c80
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/actions.gyp
@@ -0,0 +1,56 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'action1_target',
+ 'type': 'none',
+ 'suppress_wildcard': 1,
+ 'actions': [
+ {
+ 'action_name': 'action1',
+ 'inputs': [
+ 'emit.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/out.txt',
+ ],
+ 'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out.txt'],
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ {
+ 'target_name': 'action2_target',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'action2',
+ 'inputs': [
+ 'emit.py',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/out2.txt',
+ ],
+ 'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out2.txt'],
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ {
+ 'target_name': 'foolib1',
+ 'type': 'shared_library',
+ 'suppress_wildcard': 1,
+ 'sources': ['lib1.c'],
+ },
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'target_defaults': {
+ 'cflags': ['-fPIC'],
+ },
+ }],
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/emit.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/emit.py
new file mode 100644
index 0000000..5638c43
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/emit.py
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+f = open(sys.argv[1], 'wb')
+f.write('Hello from emit.py\n')
+f.close()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/lib1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/lib1.c
new file mode 100644
index 0000000..df4cb10
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/additional-targets/src/dir1/lib1.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int func1(void) {
+ return 42;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/gyptest-assembly.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/gyptest-assembly.py
new file mode 100644
index 0000000..40d0a06
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/gyptest-assembly.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that .hpp files are ignored when included in the source list on all
+platforms.
+"""
+
+import sys
+import TestGyp
+
+# TODO(bradnelson): get this working for windows.
+test = TestGyp.TestGyp(formats=['make', 'scons', 'xcode'])
+
+test.run_gyp('assembly.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('assembly.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from program.c
+Got 42.
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/as.bat b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/as.bat
new file mode 100644
index 0000000..0a47382
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/as.bat
@@ -0,0 +1,4 @@
+@echo off
+:: Mock windows assembler.
+cl /c %1 /Fo"%2"
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/assembly.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/assembly.gyp
new file mode 100644
index 0000000..872dd5e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/assembly.gyp
@@ -0,0 +1,59 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': ['PLATFORM_WIN'],
+ }],
+ ['OS=="mac"', {
+ 'defines': ['PLATFORM_MAC'],
+ }],
+ ['OS=="linux"', {
+ 'defines': ['PLATFORM_LINUX'],
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'dependencies': ['lib1'],
+ 'sources': [
+ 'program.c',
+ ],
+ },
+ {
+ 'target_name': 'lib1',
+ 'type': 'static_library',
+ 'sources': [
+ 'lib1.S',
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'target_defaults': {
+ 'rules': [
+ {
+ 'rule_name': 'assembler',
+ 'msvs_cygwin_shell': 0,
+ 'extension': 'S',
+ 'inputs': [
+ 'as.bat',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
+ ],
+ 'action':
+ ['as.bat', 'lib1.c', '<(_outputs)'],
+ 'message': 'Building assembly file <(RULE_INPUT_PATH)',
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ },],
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.S b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.S
new file mode 100644
index 0000000..e7102bf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.S
@@ -0,0 +1,10 @@
+#if PLATFORM_WINDOWS || PLATFORM_MAC
+# define IDENTIFIER(n) _##n
+#else /* Linux */
+# define IDENTIFIER(n) n
+#endif
+
+.globl IDENTIFIER(lib1_function)
+IDENTIFIER(lib1_function):
+ movl $42, %eax
+ ret
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.c
new file mode 100644
index 0000000..be21ecd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/lib1.c
@@ -0,0 +1,3 @@
+int lib1_function(void) {
+ return 42;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/program.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/program.c
new file mode 100644
index 0000000..ecce3b0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/assembly/src/program.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+extern int lib1_function(void);
+
+int main(int argc, char *argv[])
+{
+ fprintf(stdout, "Hello from program.c\n");
+ fflush(stdout);
+ fprintf(stdout, "Got %d.\n", lib1_function());
+ fflush(stdout);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-all.py
new file mode 100644
index 0000000..324d7fc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-all.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verify the settings that cause a set of programs to be created in
+a specific build directory, and that no intermediate built files
+get created outside of that build directory hierarchy even when
+referred to with deeply-nested ../../.. paths.
+"""
+
+import TestGyp
+
+# TODO(mmoss): Make only supports (theoretically) a single, global build
+# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than
+# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other
+# generators support, so this doesn't work yet for make.
+# TODO(mmoss) Make also has the issue that the top-level Makefile is written to
+# the "--depth" location, which is one level above 'src', but then this test
+# moves 'src' somewhere else, leaving the Makefile behind, so make can't find
+# its sources. I'm not sure if make is wrong for writing outside the current
+# directory, or if the test is wrong for assuming everything generated is under
+# the current directory.
+test = TestGyp.TestGyp(formats=['!make'])
+
+test.run_gyp('prog1.gyp', '--depth=..', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.subdir('relocate/builddir')
+
+# Make sure that all the built ../../etc. files only get put under builddir,
+# by making all of relocate read-only and then making only builddir writable.
+test.writable('relocate', False)
+test.writable('relocate/builddir', True)
+
+# Suppress the test infrastructure's setting SYMROOT on the command line.
+test.build('prog1.gyp', test.ALL, SYMROOT=None, chdir='relocate/src')
+
+expect1 = """\
+Hello from prog1.c
+Hello from func1.c
+"""
+
+expect2 = """\
+Hello from subdir2/prog2.c
+Hello from func2.c
+"""
+
+expect3 = """\
+Hello from subdir2/subdir3/prog3.c
+Hello from func3.c
+"""
+
+expect4 = """\
+Hello from subdir2/subdir3/subdir4/prog4.c
+Hello from func4.c
+"""
+
+expect5 = """\
+Hello from subdir2/subdir3/subdir4/subdir5/prog5.c
+Hello from func5.c
+"""
+
+def run_builddir(prog, expect):
+ dir = 'relocate/builddir/Default/'
+ test.run(program=test.workpath(dir + prog), stdout=expect)
+
+run_builddir('prog1', expect1)
+run_builddir('prog2', expect2)
+run_builddir('prog3', expect3)
+run_builddir('prog4', expect4)
+run_builddir('prog5', expect5)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-default.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-default.py
new file mode 100644
index 0000000..6171d15
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/gyptest-default.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verify the settings that cause a set of programs to be created in
+a specific build directory, and that no intermediate built files
+get created outside of that build directory hierarchy even when
+referred to with deeply-nested ../../.. paths.
+"""
+
+import TestGyp
+
+# TODO(mmoss): Make only supports (theoretically) a single, global build
+# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than
+# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other
+# generators support, so this doesn't work yet for make.
+# TODO(mmoss) Make also has the issue that the top-level Makefile is written to
+# the "--depth" location, which is one level above 'src', but then this test
+# moves 'src' somewhere else, leaving the Makefile behind, so make can't find
+# its sources. I'm not sure if make is wrong for writing outside the current
+# directory, or if the test is wrong for assuming everything generated is under
+# the current directory.
+test = TestGyp.TestGyp(formats=['!make'])
+
+test.run_gyp('prog1.gyp', '--depth=..', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.subdir('relocate/builddir')
+
+# Make sure that all the built ../../etc. files only get put under builddir,
+# by making all of relocate read-only and then making only builddir writable.
+test.writable('relocate', False)
+test.writable('relocate/builddir', True)
+
+# Suppress the test infrastructure's setting SYMROOT on the command line.
+test.build('prog1.gyp', SYMROOT=None, chdir='relocate/src')
+
+expect1 = """\
+Hello from prog1.c
+Hello from func1.c
+"""
+
+expect2 = """\
+Hello from subdir2/prog2.c
+Hello from func2.c
+"""
+
+expect3 = """\
+Hello from subdir2/subdir3/prog3.c
+Hello from func3.c
+"""
+
+expect4 = """\
+Hello from subdir2/subdir3/subdir4/prog4.c
+Hello from func4.c
+"""
+
+expect5 = """\
+Hello from subdir2/subdir3/subdir4/subdir5/prog5.c
+Hello from func5.c
+"""
+
+def run_builddir(prog, expect):
+ dir = 'relocate/builddir/Default/'
+ test.run(program=test.workpath(dir + prog), stdout=expect)
+
+run_builddir('prog1', expect1)
+run_builddir('prog2', expect2)
+run_builddir('prog3', expect3)
+run_builddir('prog4', expect4)
+run_builddir('prog5', expect5)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/builddir.gypi b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/builddir.gypi
new file mode 100644
index 0000000..e3c6147
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/builddir.gypi
@@ -0,0 +1,21 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'configurations': {
+ 'Default': {
+ 'msvs_configuration_attributes': {
+ 'OutputDirectory': '<(DEPTH)\\builddir\Default',
+ },
+ },
+ },
+ },
+ 'scons_settings': {
+ 'sconsbuild_dir': '<(DEPTH)/builddir',
+ },
+ 'xcode_settings': {
+ 'SYMROOT': '<(DEPTH)/builddir',
+ },
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func1.c
new file mode 100644
index 0000000..b8e6a06
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func1.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void func1(void)
+{
+ printf("Hello from func1.c\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func2.c
new file mode 100644
index 0000000..14aabac
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func2.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void func2(void)
+{
+ printf("Hello from func2.c\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func3.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func3.c
new file mode 100644
index 0000000..3b4edea
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func3.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void func3(void)
+{
+ printf("Hello from func3.c\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func4.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func4.c
new file mode 100644
index 0000000..732891b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func4.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void func4(void)
+{
+ printf("Hello from func4.c\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func5.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func5.c
new file mode 100644
index 0000000..18fdfab
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/func5.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void func5(void)
+{
+ printf("Hello from func5.c\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.c
new file mode 100644
index 0000000..674ca74
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void func1(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from prog1.c\n");
+ func1();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.gyp
new file mode 100644
index 0000000..5b96f03
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/prog1.gyp
@@ -0,0 +1,30 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ 'builddir.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'pull_in_all',
+ 'type': 'none',
+ 'dependencies': [
+ 'prog1',
+ 'subdir2/prog2.gyp:prog2',
+ 'subdir2/subdir3/prog3.gyp:prog3',
+ 'subdir2/subdir3/subdir4/prog4.gyp:prog4',
+ 'subdir2/subdir3/subdir4/subdir5/prog5.gyp:prog5',
+ ],
+ },
+ {
+ 'target_name': 'prog1',
+ 'type': 'executable',
+ 'sources': [
+ 'prog1.c',
+ 'func1.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.c
new file mode 100644
index 0000000..bbdf4f0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void func2(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from subdir2/prog2.c\n");
+ func2();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.gyp
new file mode 100644
index 0000000..96299b6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/prog2.gyp
@@ -0,0 +1,19 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ '../builddir.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'prog2',
+ 'type': 'executable',
+ 'sources': [
+ 'prog2.c',
+ '../func2.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.c
new file mode 100644
index 0000000..10c530b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void func3(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from subdir2/subdir3/prog3.c\n");
+ func3();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp
new file mode 100644
index 0000000..d7df43c
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp
@@ -0,0 +1,19 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ '../../builddir.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'prog3',
+ 'type': 'executable',
+ 'sources': [
+ 'prog3.c',
+ '../../func3.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c
new file mode 100644
index 0000000..dcba9a9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void func4(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from subdir2/subdir3/subdir4/prog4.c\n");
+ func4();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp
new file mode 100644
index 0000000..862a8a1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp
@@ -0,0 +1,19 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ '../../../builddir.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'prog4',
+ 'type': 'executable',
+ 'sources': [
+ 'prog4.c',
+ '../../../func4.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c
new file mode 100644
index 0000000..69132e5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void func5(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from subdir2/subdir3/subdir4/subdir5/prog5.c\n");
+ func5();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp
new file mode 100644
index 0000000..fe1c9cb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp
@@ -0,0 +1,19 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ '../../../../builddir.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'prog5',
+ 'type': 'executable',
+ 'sources': [
+ 'prog5.c',
+ '../../../../func5.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.c
new file mode 100644
index 0000000..c1e2452
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.c
@@ -0,0 +1,15 @@
+/* Copyright (c) 2010 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+#ifdef __OPTIMIZE__
+ printf("Using an optimization flag\n");
+#else
+ printf("Using no optimization flag\n");
+#endif
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.gyp
new file mode 100644
index 0000000..9003fb1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/cflags.gyp
@@ -0,0 +1,16 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'cflags',
+ 'type': 'executable',
+ 'opt': '-Os',
+ 'sources': [
+ 'cflags.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/gyptest-cflags.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/gyptest-cflags.py
new file mode 100644
index 0000000..acc424a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cflags/gyptest-cflags.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable with C++ define specified by a gyp define, and
+the use of the environment during regeneration when the gyp file changes.
+"""
+
+import os
+import TestGyp
+
+env_stack = []
+
+
+def PushEnv():
+ env_copy = os.environ.copy()
+ env_stack.append(env_copy)
+
+def PopEnv():
+ os.eniron=env_stack.pop()
+
+# Regenerating build files when a gyp file changes is currently only supported
+# by the make generator.
+test = TestGyp.TestGyp(formats=['make'])
+
+try:
+ PushEnv()
+ os.environ['CFLAGS'] = '-O0'
+ test.run_gyp('cflags.gyp')
+finally:
+ # We clear the environ after calling gyp. When the auto-regeneration happens,
+ # the same define should be reused anyway. Reset to empty string first in
+ # case the platform doesn't support unsetenv.
+ PopEnv()
+
+test.build('cflags.gyp')
+
+expect = """\
+Using no optimization flag
+"""
+test.run_built_executable('cflags', stdout=expect)
+
+test.sleep()
+
+try:
+ PushEnv()
+ os.environ['CFLAGS'] = '-O2'
+ test.run_gyp('cflags.gyp')
+finally:
+ # We clear the environ after calling gyp. When the auto-regeneration happens,
+ # the same define should be reused anyway. Reset to empty string first in
+ # case the platform doesn't support unsetenv.
+ PopEnv()
+
+test.build('cflags.gyp')
+
+expect = """\
+Using an optimization flag
+"""
+test.run_built_executable('cflags', stdout=expect)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/gyptest-headers.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/gyptest-headers.py
new file mode 100644
index 0000000..9176021
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/gyptest-headers.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that .hpp files are ignored when included in the source list on all
+platforms.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('headers.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('headers.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from program.c
+Hello from lib1.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/headers.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/headers.gyp
new file mode 100644
index 0000000..b6c2a88
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/headers.gyp
@@ -0,0 +1,26 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'dependencies': [
+ 'lib1'
+ ],
+ 'sources': [
+ 'program.cpp',
+ ],
+ },
+ {
+ 'target_name': 'lib1',
+ 'type': 'static_library',
+ 'sources': [
+ 'lib1.hpp',
+ 'lib1.cpp',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.cpp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.cpp
new file mode 100644
index 0000000..51bc31a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.cpp
@@ -0,0 +1,7 @@
+#include <stdio.h>
+#include "lib1.hpp"
+
+void lib1_function(void) {
+ fprintf(stdout, "Hello from lib1.c\n");
+ fflush(stdout);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.hpp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.hpp
new file mode 100644
index 0000000..72e63e8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/lib1.hpp
@@ -0,0 +1,6 @@
+#ifndef _lib1_hpp
+#define _lib1_hpp
+
+extern void lib1_function(void);
+
+#endif
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/program.cpp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/program.cpp
new file mode 100644
index 0000000..81420ba
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/compilable/src/program.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include "lib1.hpp"
+
+int main(int argc, char *argv[]) {
+ fprintf(stdout, "Hello from program.c\n");
+ fflush(stdout);
+ lib1_function();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.c
new file mode 100644
index 0000000..6c1f900
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+#ifdef FOO
+ printf("Foo configuration\n");
+#endif
+#ifdef DEBUG
+ printf("Debug configuration\n");
+#endif
+#ifdef RELEASE
+ printf("Release configuration\n");
+#endif
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.gyp
new file mode 100644
index 0000000..93f1d8d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/configurations.gyp
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'executable',
+ 'sources': [
+ 'configurations.c',
+ ],
+ 'configurations': {
+ 'Debug': {
+ 'defines': [
+ 'DEBUG',
+ ],
+ },
+ 'Release': {
+ 'defines': [
+ 'RELEASE',
+ ],
+ },
+ 'Foo': {
+ 'defines': [
+ 'FOO',
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/gyptest-configurations.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/gyptest-configurations.py
new file mode 100644
index 0000000..27cd2e8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/basics/gyptest-configurations.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable in three different configurations.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('configurations.gyp')
+
+test.set_configuration('Release')
+test.build('configurations.gyp')
+test.run_built_executable('configurations', stdout="Release configuration\n")
+
+test.set_configuration('Debug')
+test.build('configurations.gyp')
+test.run_built_executable('configurations', stdout="Debug configuration\n")
+
+test.set_configuration('Foo')
+test.build('configurations.gyp')
+test.run_built_executable('configurations', stdout="Foo configuration\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.c
new file mode 100644
index 0000000..2d5565e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+#ifdef BASE
+ printf("Base configuration\n");
+#endif
+#ifdef COMMON
+ printf("Common configuration\n");
+#endif
+#ifdef COMMON2
+ printf("Common2 configuration\n");
+#endif
+#ifdef DEBUG
+ printf("Debug configuration\n");
+#endif
+#ifdef RELEASE
+ printf("Release configuration\n");
+#endif
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.gyp
new file mode 100644
index 0000000..9441376
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/configurations.gyp
@@ -0,0 +1,40 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'configurations': {
+ 'Base': {
+ 'abstract': 1,
+ 'defines': ['BASE'],
+ },
+ 'Common': {
+ 'abstract': 1,
+ 'inherit_from': ['Base'],
+ 'defines': ['COMMON'],
+ },
+ 'Common2': {
+ 'abstract': 1,
+ 'defines': ['COMMON2'],
+ },
+ 'Debug': {
+ 'inherit_from': ['Common', 'Common2'],
+ 'defines': ['DEBUG'],
+ },
+ 'Release': {
+ 'inherit_from': ['Common', 'Common2'],
+ 'defines': ['RELEASE'],
+ },
+ },
+ },
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'executable',
+ 'sources': [
+ 'configurations.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/gyptest-inheritance.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/gyptest-inheritance.py
new file mode 100644
index 0000000..22c73a3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/inheritance/gyptest-inheritance.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable in three different configurations.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('configurations.gyp')
+
+test.set_configuration('Release')
+test.build('configurations.gyp')
+test.run_built_executable('configurations',
+ stdout=('Base configuration\n'
+ 'Common configuration\n'
+ 'Common2 configuration\n'
+ 'Release configuration\n'))
+
+test.set_configuration('Debug')
+test.build('configurations.gyp')
+test.run_built_executable('configurations',
+ stdout=('Base configuration\n'
+ 'Common configuration\n'
+ 'Common2 configuration\n'
+ 'Debug configuration\n'))
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/actions.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/actions.gyp
new file mode 100644
index 0000000..a6e4208
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/actions.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'actions': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/all_dependent_settings.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/all_dependent_settings.gyp
new file mode 100644
index 0000000..b16a245
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/all_dependent_settings.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'all_dependent_settings': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/configurations.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/configurations.gyp
new file mode 100644
index 0000000..2cfc960
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/configurations.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'configurations': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/dependencies.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/dependencies.gyp
new file mode 100644
index 0000000..74633f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/dependencies.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'dependencies': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/direct_dependent_settings.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/direct_dependent_settings.gyp
new file mode 100644
index 0000000..8a0f2e9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/direct_dependent_settings.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'direct_dependent_settings': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/gyptest-configurations.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/gyptest-configurations.py
new file mode 100644
index 0000000..d76cded
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/gyptest-configurations.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable in three different configurations.
+"""
+
+import TestGyp
+
+# Keys that do not belong inside a configuration dictionary.
+invalid_configuration_keys = [
+ 'actions',
+ 'all_dependent_settings',
+ 'configurations',
+ 'dependencies',
+ 'direct_dependent_settings',
+ 'libraries',
+ 'link_settings',
+ 'sources',
+ 'target_name',
+ 'type',
+]
+
+test = TestGyp.TestGyp()
+
+if test.format == 'scons':
+ test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n')
+
+for test_key in invalid_configuration_keys:
+ test.run_gyp('%s.gyp' % test_key, status=1, stderr=None)
+ expect = ['%s not allowed in the Debug configuration, found in target '
+ '%s.gyp:configurations#target' % (test_key, test_key)]
+ test.must_contain_all_lines(test.stderr(), expect)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/libraries.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/libraries.gyp
new file mode 100644
index 0000000..c4014ed
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/libraries.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'libraries': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/link_settings.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/link_settings.gyp
new file mode 100644
index 0000000..2f0e1c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/link_settings.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'link_settings': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/sources.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/sources.gyp
new file mode 100644
index 0000000..b38cca0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/sources.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'sources': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/target_name.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/target_name.gyp
new file mode 100644
index 0000000..83baad9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/target_name.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'target_name': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/type.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/type.gyp
new file mode 100644
index 0000000..bc55898
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/invalid/type.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'none',
+ 'configurations': {
+ 'Debug': {
+ 'type': [
+ ],
+ },
+ }
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/configurations.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/configurations.gyp
new file mode 100644
index 0000000..d15429f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/configurations.gyp
@@ -0,0 +1,58 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'configurations': {
+ 'Debug_Win32': {
+ 'msvs_configuration_platform': 'Win32',
+ },
+ 'Debug_x64': {
+ 'msvs_configuration_platform': 'x64',
+ },
+ },
+ },
+ 'targets': [
+ {
+ 'target_name': 'left',
+ 'type': 'static_library',
+ 'sources': [
+ 'left.c',
+ ],
+ 'configurations': {
+ 'Debug_Win32': {
+ 'msvs_target_platform': 'x64',
+ },
+ },
+ },
+ {
+ 'target_name': 'right',
+ 'type': 'static_library',
+ 'sources': [
+ 'right.c',
+ ],
+ },
+ {
+ 'target_name': 'front_left',
+ 'type': 'executable',
+ 'dependencies': ['left'],
+ 'sources': [
+ 'front.c',
+ ],
+ 'configurations': {
+ 'Debug_Win32': {
+ 'msvs_target_platform': 'x64',
+ },
+ },
+ },
+ {
+ 'target_name': 'front_right',
+ 'type': 'executable',
+ 'dependencies': ['right'],
+ 'sources': [
+ 'front.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/front.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/front.c
new file mode 100644
index 0000000..12b1d0a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/front.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+const char *message(void);
+
+int main(int argc, char *argv[]) {
+ printf("%s\n", message());
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/gyptest-target_platform.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/gyptest-target_platform.py
new file mode 100644
index 0000000..ae4e9e5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/gyptest-target_platform.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Tests the msvs specific msvs_target_platform option.
+"""
+
+import TestGyp
+import TestCommon
+
+
+def RunX64(exe, stdout):
+ try:
+ test.run_built_executable(exe, stdout=stdout)
+ except WindowsError, e:
+ # Assume the exe is 64-bit if it can't load on 32-bit systems.
+ # Both versions of the error are required because different versions
+ # of python seem to return different errors for invalid exe type.
+ if e.errno != 193 and '[Error 193]' not in str(e):
+ raise
+
+
+test = TestGyp.TestGyp(formats=['msvs'])
+
+test.run_gyp('configurations.gyp')
+
+test.set_configuration('Debug|x64')
+test.build('configurations.gyp', rebuild=True)
+RunX64('front_left', stdout=('left\n'))
+RunX64('front_right', stdout=('right\n'))
+
+test.set_configuration('Debug|Win32')
+test.build('configurations.gyp', rebuild=True)
+RunX64('front_left', stdout=('left\n'))
+test.run_built_executable('front_right', stdout=('right\n'))
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/left.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/left.c
new file mode 100644
index 0000000..1ce2ea1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/left.c
@@ -0,0 +1,3 @@
+const char *message(void) {
+ return "left";
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/right.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/right.c
new file mode 100644
index 0000000..b157849
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/target_platform/right.c
@@ -0,0 +1,3 @@
+const char *message(void) {
+ return "right";
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.c
new file mode 100644
index 0000000..72c97e3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+ if (sizeof(void*) == 4) {
+ printf("Running Win32\n");
+ } else if (sizeof(void*) == 8) {
+ printf("Running x64\n");
+ } else {
+ printf("Unexpected platform\n");
+ }
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.gyp
new file mode 100644
index 0000000..06ffa37
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/configurations.gyp
@@ -0,0 +1,26 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'configurations': {
+ 'Debug': {
+ 'msvs_configuration_platform': 'Win32',
+ },
+ 'Debug_x64': {
+ 'inherit_from': ['Debug'],
+ 'msvs_configuration_platform': 'x64',
+ },
+ },
+ },
+ 'targets': [
+ {
+ 'target_name': 'configurations',
+ 'type': 'executable',
+ 'sources': [
+ 'configurations.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/gyptest-x86.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/gyptest-x86.py
new file mode 100644
index 0000000..254ea6f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/configurations/x64/gyptest-x86.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable in three different configurations.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['msvs'])
+
+test.run_gyp('configurations.gyp')
+
+for platform in ['Win32', 'x64']:
+ test.set_configuration('Debug|%s' % platform)
+ test.build('configurations.gyp', rebuild=True)
+ try:
+ test.run_built_executable('configurations',
+ stdout=('Running %s\n' % platform))
+ except WindowsError, e:
+ # Assume the exe is 64-bit if it can't load on 32-bit systems.
+ if platform == 'x64' and (e.errno == 193 or '[Error 193]' in str(e)):
+ continue
+ raise
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/gyptest-copies-link.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/gyptest-copies-link.py
new file mode 100644
index 0000000..fe7b602
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/gyptest-copies-link.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies using the build tool default.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('copies-link.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('copies-link.gyp', chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copies-link.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copies-link.gyp
new file mode 100644
index 0000000..9d2530a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copies-link.gyp
@@ -0,0 +1,61 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'func1',
+ 'type': 'static_library',
+ 'sources': ['func1.c'],
+ },
+ {
+ 'target_name': 'clone_func1',
+ 'type': 'none',
+ 'dependencies': ['func1'],
+ 'actions': [
+ {
+ 'action_name': 'cloning library',
+ 'inputs': [
+ '<(LIB_DIR)/<(STATIC_LIB_PREFIX)func1<(STATIC_LIB_SUFFIX)'
+ ],
+ 'outputs': ['<(PRODUCT_DIR)/alternate/'
+ '<(STATIC_LIB_PREFIX)cloned<(STATIC_LIB_SUFFIX)'],
+ 'destination': '<(PRODUCT_DIR)',
+ 'action': ['python', 'copy.py', '<@(_inputs)', '<@(_outputs)'],
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ },
+ {
+ 'target_name': 'copy_cloned',
+ 'type': 'none',
+ 'dependencies': ['clone_func1'],
+ 'copies': [
+ {
+ 'destination': '<(LIB_DIR)',
+ 'files': [
+ '<(PRODUCT_DIR)/alternate/'
+ '<(STATIC_LIB_PREFIX)cloned<(STATIC_LIB_SUFFIX)',
+ ],
+ },
+ ],
+ },
+ {
+ 'target_name': 'use_cloned',
+ 'type': 'executable',
+ 'sources': ['main.c'],
+ 'dependencies': ['copy_cloned'],
+ 'link_settings': {
+ 'conditions': [
+ ['OS=="win"', {
+ 'libraries': ['-l"<(LIB_DIR)/cloned.lib"'],
+ }, {
+ 'libraries': ['-lcloned'],
+ 'ldflags': ['-L <(LIB_DIR)'],
+ }],
+ ],
+ },
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copy.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copy.py
new file mode 100644
index 0000000..a1dd871
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/copy.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import shutil
+import sys
+
+
+def main(argv):
+ if len(argv) != 3:
+ print 'USAGE: copy.py <src> <dst>'
+ return 1
+
+ shutil.copy(argv[1], argv[2])
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/func1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/func1.c
new file mode 100644
index 0000000..cceccdd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/func1.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+void func1(void) {
+ printf("hello from func1\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/main.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/main.c
new file mode 100644
index 0000000..56fd2f0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies-link/src/main.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+extern void func1(void);
+
+int main(int argc, char *argv[]) {
+ printf("hello from link1\n");
+ func1();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-all.py
new file mode 100644
index 0000000..8542ab7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-all.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies using an explicit build target of 'all'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('copies.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('copies.gyp', test.ALL, chdir='relocate/src')
+
+test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n')
+
+test.built_file_must_match('copies-out/file2',
+ 'file2 contents\n',
+ chdir='relocate/src')
+
+test.built_file_must_match('copies-out/directory/file3',
+ 'file3 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/file4',
+ 'file4 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/subdir/file5',
+ 'file5 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/subdir/file6',
+ 'file6 contents\n',
+ chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-default.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-default.py
new file mode 100644
index 0000000..a5d1bf9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/gyptest-default.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies using the build tool default.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('copies.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('copies.gyp', chdir='relocate/src')
+
+test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n')
+
+test.built_file_must_match('copies-out/file2',
+ 'file2 contents\n',
+ chdir='relocate/src')
+
+test.built_file_must_match('copies-out/directory/file3',
+ 'file3 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/file4',
+ 'file4 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/subdir/file5',
+ 'file5 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/subdir/file6',
+ 'file6 contents\n',
+ chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/copies.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/copies.gyp
new file mode 100644
index 0000000..ce2e0ca
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/copies.gyp
@@ -0,0 +1,70 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'copies1',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': 'copies-out',
+ 'files': [
+ 'file1',
+ ],
+ },
+ ],
+ },
+ {
+ 'target_name': 'copies2',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'file2',
+ ],
+ },
+ ],
+ },
+ # Copy a directory tree.
+ {
+ 'target_name': 'copies_recursive',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'directory/',
+ ],
+ },
+ ],
+ },
+ # Copy a directory from deeper in the tree (this should not reproduce the
+ # entire directory path in the destination, only the final directory).
+ {
+ 'target_name': 'copies_recursive_depth',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'parentdir/subdir/',
+ ],
+ },
+ ],
+ },
+ # Verify that a null 'files' list doesn't gag the generators.
+ {
+ 'target_name': 'copies_null',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-null',
+ 'files': [],
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file3 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file3
new file mode 100644
index 0000000..43f16f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file3
@@ -0,0 +1 @@
+file3 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file4 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file4
new file mode 100644
index 0000000..5f7270a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/file4
@@ -0,0 +1 @@
+file4 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/subdir/file5 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/subdir/file5
new file mode 100644
index 0000000..41f4718
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/directory/subdir/file5
@@ -0,0 +1 @@
+file5 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file1 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file1
new file mode 100644
index 0000000..84d55c5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file1
@@ -0,0 +1 @@
+file1 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file2 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file2
new file mode 100644
index 0000000..af1b8ae
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/file2
@@ -0,0 +1 @@
+file2 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/parentdir/subdir/file6 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/parentdir/subdir/file6
new file mode 100644
index 0000000..f5d5757
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/copies/src/parentdir/subdir/file6
@@ -0,0 +1 @@
+file6 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.cc b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.cc
new file mode 100644
index 0000000..c1e2452
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.cc
@@ -0,0 +1,15 @@
+/* Copyright (c) 2010 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+#ifdef __OPTIMIZE__
+ printf("Using an optimization flag\n");
+#else
+ printf("Using no optimization flag\n");
+#endif
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.gyp
new file mode 100644
index 0000000..24d883a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/cxxflags.gyp
@@ -0,0 +1,16 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'cxxflags',
+ 'type': 'executable',
+ 'opt': '-Os',
+ 'sources': [
+ 'cxxflags.cc',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/gyptest-cxxflags.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/gyptest-cxxflags.py
new file mode 100644
index 0000000..2e5a6d9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/cxxflags/gyptest-cxxflags.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable with C++ define specified by a gyp define, and
+the use of the environment during regeneration when the gyp file changes.
+"""
+
+import os
+import TestGyp
+
+env_stack = []
+
+
+def PushEnv():
+ env_copy = os.environ.copy()
+ env_stack.append(env_copy)
+
+def PopEnv():
+ os.eniron=env_stack.pop()
+
+# Regenerating build files when a gyp file changes is currently only supported
+# by the make generator.
+test = TestGyp.TestGyp(formats=['make'])
+
+try:
+ PushEnv()
+ os.environ['CXXFLAGS'] = '-O0'
+ test.run_gyp('cxxflags.gyp')
+finally:
+ # We clear the environ after calling gyp. When the auto-regeneration happens,
+ # the same define should be reused anyway. Reset to empty string first in
+ # case the platform doesn't support unsetenv.
+ PopEnv()
+
+test.build('cxxflags.gyp')
+
+expect = """\
+Using no optimization flag
+"""
+test.run_built_executable('cxxflags', stdout=expect)
+
+test.sleep()
+
+try:
+ PushEnv()
+ os.environ['CXXFLAGS'] = '-O2'
+ test.run_gyp('cxxflags.gyp')
+finally:
+ # We clear the environ after calling gyp. When the auto-regeneration happens,
+ # the same define should be reused anyway. Reset to empty string first in
+ # case the platform doesn't support unsetenv.
+ PopEnv()
+
+test.build('cxxflags.gyp')
+
+expect = """\
+Using an optimization flag
+"""
+test.run_built_executable('cxxflags', stdout=expect)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.c
new file mode 100644
index 0000000..4407572
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.c
@@ -0,0 +1,11 @@
+/* Copyright (c) 2010 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf(TEST_FORMAT, TEST_ARGS);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.gyp
new file mode 100644
index 0000000..6f0f3fd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/defines-escaping.gyp
@@ -0,0 +1,19 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'defines_escaping',
+ 'type': 'executable',
+ 'sources': [
+ 'defines-escaping.c',
+ ],
+ 'defines': [
+ 'TEST_FORMAT="<(test_format)"',
+ 'TEST_ARGS=<(test_args)',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/gyptest-defines-escaping.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/gyptest-defines-escaping.py
new file mode 100644
index 0000000..69574b3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines-escaping/gyptest-defines-escaping.py
@@ -0,0 +1,182 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable with C++ define specified by a gyp define using
+various special characters such as quotes, commas, etc.
+"""
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+# Tests string literals, percents, and backslash escapes.
+try:
+ os.environ['GYP_DEFINES'] = (
+ r"""test_format='\n%s\n' """
+ r"""test_args='"Simple test of %s with a literal"'""")
+ test.run_gyp('defines-escaping.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.build('defines-escaping.gyp')
+
+expect = """
+Simple test of %s with a literal
+"""
+test.run_built_executable('defines_escaping', stdout=expect)
+
+
+# Test multiple comma-and-space-separated string literals.
+try:
+ os.environ['GYP_DEFINES'] = \
+ r"""test_format='\n%s and %s\n' test_args='"foo", "bar"'"""
+ test.run_gyp('defines-escaping.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines-escaping.c')
+test.build('defines-escaping.gyp')
+
+expect = """
+foo and bar
+"""
+test.run_built_executable('defines_escaping', stdout=expect)
+
+
+# Test string literals containing quotes.
+try:
+ os.environ['GYP_DEFINES'] = (
+ r"""test_format='\n%s %s %s %s %s\n' """
+ r"""test_args='"\"These,\"","""
+ r""" "\"words,\"","""
+ r""" "\"are,\"","""
+ r""" "\"in,\"","""
+ r""" "\"quotes.\""'""")
+ test.run_gyp('defines-escaping.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines-escaping.c')
+test.build('defines-escaping.gyp')
+
+expect = """
+"These," "words," "are," "in," "quotes."
+"""
+test.run_built_executable('defines_escaping', stdout=expect)
+
+
+# Test string literals containing single quotes.
+try:
+ os.environ['GYP_DEFINES'] = (
+ r"""test_format='\n%s %s %s %s %s\n' """
+ r"""test_args="\"'These,'\","""
+ r""" \"'words,'\","""
+ r""" \"'are,'\","""
+ r""" \"'in,'\","""
+ r""" \"'quotes.'\"" """)
+ test.run_gyp('defines-escaping.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines-escaping.c')
+test.build('defines-escaping.gyp')
+
+expect = """
+'These,' 'words,' 'are,' 'in,' 'quotes.'
+"""
+test.run_built_executable('defines_escaping', stdout=expect)
+
+
+# Test string literals containing different numbers of backslashes before quotes
+# (to exercise Windows' quoting behaviour).
+try:
+ os.environ['GYP_DEFINES'] = (
+ r"""test_format='\n%s\n%s\n%s\n' """
+ r"""test_args='"\\\"1 visible slash\\\"","""
+ r""" "\\\\\"2 visible slashes\\\\\"","""
+ r""" "\\\\\\\"3 visible slashes\\\\\\\""'""")
+ test.run_gyp('defines-escaping.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines-escaping.c')
+test.build('defines-escaping.gyp')
+
+expect = r"""
+\"1 visible slash\"
+\\"2 visible slashes\\"
+\\\"3 visible slashes\\\"
+"""
+test.run_built_executable('defines_escaping', stdout=expect)
+
+
+# Test that various scary sequences are passed unfettered.
+try:
+ os.environ['GYP_DEFINES'] = (
+ r"""test_format='\n%s\n' """
+ r"""test_args='"$foo, &quot; `foo`;"'""")
+ test.run_gyp('defines-escaping.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines-escaping.c')
+test.build('defines-escaping.gyp')
+
+expect = """
+$foo, &quot; `foo`;
+"""
+test.run_built_executable('defines_escaping', stdout=expect)
+
+
+# VisualStudio 2010 can't handle passing %PATH%
+if not (test.format == 'msvs' and test.uses_msbuild):
+ try:
+ os.environ['GYP_DEFINES'] = (
+ """test_format='%s' """
+ """test_args='"%PATH%"'""")
+ test.run_gyp('defines-escaping.gyp')
+ finally:
+ del os.environ['GYP_DEFINES']
+
+ test.sleep()
+ test.touch('defines-escaping.c')
+ test.build('defines-escaping.gyp')
+
+ expect = "%PATH%"
+ test.run_built_executable('defines_escaping', stdout=expect)
+
+
+# Test commas and semi-colons preceded by backslashes (to exercise Windows'
+# quoting behaviour).
+try:
+ os.environ['GYP_DEFINES'] = (
+ r"""test_format='\n%s\n%s\n' """
+ r"""test_args='"\\, \\\\;","""
+ # Same thing again, but enclosed in visible quotes.
+ r""" "\"\\, \\\\;\""'""")
+ test.run_gyp('defines-escaping.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines-escaping.c')
+test.build('defines-escaping.gyp')
+
+expect = r"""
+\, \\;
+"\, \\;"
+"""
+test.run_built_executable('defines_escaping', stdout=expect)
+
+# We deliberately do not test having an odd number of quotes in a string
+# literal because that isn't feasible in MSVS.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines-env.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines-env.gyp
new file mode 100644
index 0000000..1781546
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines-env.gyp
@@ -0,0 +1,22 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'value%': '5',
+ },
+ 'targets': [
+ {
+ 'target_name': 'defines',
+ 'type': 'executable',
+ 'sources': [
+ 'defines.c',
+ ],
+ 'defines': [
+ 'VALUE=<(value)',
+ ],
+ },
+ ],
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.c
new file mode 100644
index 0000000..33657ac
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.c
@@ -0,0 +1,14 @@
+/* Copyright (c) 2009 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+#ifdef FOO
+ printf("FOO is defined\n");
+#endif
+ printf("VALUE is %d\n", VALUE);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.gyp
new file mode 100644
index 0000000..3db66e5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/defines.gyp
@@ -0,0 +1,36 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'defines',
+ 'type': 'executable',
+ 'sources': [
+ 'defines.c',
+ ],
+ 'defines': [
+ 'FOO',
+ 'VALUE=1',
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="fakeos"', {
+ 'targets': [
+ {
+ 'target_name': 'fakeosprogram',
+ 'type': 'executable',
+ 'sources': [
+ 'defines.c',
+ ],
+ 'defines': [
+ 'FOO',
+ 'VALUE=1',
+ ],
+ },
+ ],
+ }],
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-define-override.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-define-override.py
new file mode 100644
index 0000000..82e325a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-define-override.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that a default gyp define can be overridden.
+"""
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+# Command-line define
+test.run_gyp('defines.gyp', '-D', 'OS=fakeos')
+test.build('defines.gyp')
+test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE)
+# Clean up the exe so subsequent tests don't find an old exe.
+os.remove(test.built_file_path('fakeosprogram', type=test.EXECUTABLE))
+
+# Without "OS" override, fokeosprogram shouldn't be built.
+test.run_gyp('defines.gyp')
+test.build('defines.gyp')
+test.built_file_must_not_exist('fakeosprogram', type=test.EXECUTABLE)
+
+# Environment define
+os.environ['GYP_DEFINES'] = 'OS=fakeos'
+test.run_gyp('defines.gyp')
+test.build('defines.gyp')
+test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env-regyp.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env-regyp.py
new file mode 100644
index 0000000..70c9ba7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env-regyp.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable with C++ define specified by a gyp define, and
+the use of the environment during regeneration when the gyp file changes.
+"""
+
+import os
+import TestGyp
+
+# Regenerating build files when a gyp file changes is currently only supported
+# by the make generator.
+test = TestGyp.TestGyp(formats=['make'])
+
+try:
+ os.environ['GYP_DEFINES'] = 'value=50'
+ test.run_gyp('defines.gyp')
+finally:
+ # We clear the environ after calling gyp. When the auto-regeneration happens,
+ # the same define should be reused anyway. Reset to empty string first in
+ # case the platform doesn't support unsetenv.
+ os.environ['GYP_DEFINES'] = ''
+ del os.environ['GYP_DEFINES']
+
+test.build('defines.gyp')
+
+expect = """\
+FOO is defined
+VALUE is 1
+"""
+test.run_built_executable('defines', stdout=expect)
+
+# Sleep so that the changed gyp file will have a newer timestamp than the
+# previously generated build files.
+test.sleep()
+test.write('defines.gyp', test.read('defines-env.gyp'))
+
+test.build('defines.gyp', test.ALL)
+
+expect = """\
+VALUE is 50
+"""
+test.run_built_executable('defines', stdout=expect)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env.py
new file mode 100644
index 0000000..6b4e717
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines-env.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable with C++ define specified by a gyp define.
+"""
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+# With the value only given in environment, it should be used.
+try:
+ os.environ['GYP_DEFINES'] = 'value=10'
+ test.run_gyp('defines-env.gyp')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.build('defines-env.gyp')
+
+expect = """\
+VALUE is 10
+"""
+test.run_built_executable('defines', stdout=expect)
+
+
+# With the value given in both command line and environment,
+# command line should take precedence.
+try:
+ os.environ['GYP_DEFINES'] = 'value=20'
+ test.run_gyp('defines-env.gyp', '-Dvalue=25')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines.c')
+test.build('defines-env.gyp')
+
+expect = """\
+VALUE is 25
+"""
+test.run_built_executable('defines', stdout=expect)
+
+
+# With the value only given in environment, it should be ignored if
+# --ignore-environment is specified.
+try:
+ os.environ['GYP_DEFINES'] = 'value=30'
+ test.run_gyp('defines-env.gyp', '--ignore-environment')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines.c')
+test.build('defines-env.gyp')
+
+expect = """\
+VALUE is 5
+"""
+test.run_built_executable('defines', stdout=expect)
+
+
+# With the value given in both command line and environment, and
+# --ignore-environment also specified, command line should still be used.
+try:
+ os.environ['GYP_DEFINES'] = 'value=40'
+ test.run_gyp('defines-env.gyp', '--ignore-environment', '-Dvalue=45')
+finally:
+ del os.environ['GYP_DEFINES']
+
+test.sleep()
+test.touch('defines.c')
+test.build('defines-env.gyp')
+
+expect = """\
+VALUE is 45
+"""
+test.run_built_executable('defines', stdout=expect)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines.py
new file mode 100644
index 0000000..a21a617
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/defines/gyptest-defines.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies build of an executable with C++ defines.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('defines.gyp')
+
+test.build('defines.gyp')
+
+expect = """\
+FOO is defined
+VALUE is 1
+"""
+test.run_built_executable('defines', stdout=expect)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/a.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/a.c
new file mode 100755
index 0000000..3bba111
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/a.c
@@ -0,0 +1,9 @@
+/* Copyright (c) 2009 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+extern int funcB();
+
+int funcA() {
+ return funcB();
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.c
new file mode 100755
index 0000000..b5e771b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.c
@@ -0,0 +1,3 @@
+int funcB() {
+ return 2;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.gyp
new file mode 100755
index 0000000..f09e1ff
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/b/b.gyp
@@ -0,0 +1,15 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'b',
+ 'type': 'static_library',
+ 'sources': [
+ 'b.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.c
new file mode 100644
index 0000000..4949daf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.c
@@ -0,0 +1,4 @@
+int funcC() {
+ return 3
+ // Intentional syntax error. This file should never be compiled, so this
+ // shouldn't be a problem.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.gyp
new file mode 100644
index 0000000..eabebea
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/c.gyp
@@ -0,0 +1,22 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'c_unused',
+ 'type': 'static_library',
+ 'sources': [
+ 'c.c',
+ ],
+ },
+ {
+ 'target_name': 'd',
+ 'type': 'static_library',
+ 'sources': [
+ 'd.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/d.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/d.c
new file mode 100644
index 0000000..05465fc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/c/d.c
@@ -0,0 +1,3 @@
+int funcD() {
+ return 4;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/extra_targets.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/extra_targets.gyp
new file mode 100644
index 0000000..c1a26de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/extra_targets.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'a',
+ 'type': 'static_library',
+ 'sources': [
+ 'a.c',
+ ],
+ # This only depends on the "d" target; other targets in c.gyp
+ # should not become part of the build (unlike with 'c/c.gyp:*').
+ 'dependencies': ['c/c.gyp:d'],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-extra-targets.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-extra-targets.py
new file mode 100644
index 0000000..3752f74
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-extra-targets.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verify that dependencies don't pull unused targets into the build.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('extra_targets.gyp')
+
+# This should fail if it tries to build 'c_unused' since 'c/c.c' has a syntax
+# error and won't compile.
+test.build('extra_targets.gyp', test.ALL)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-lib-only.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-lib-only.py
new file mode 100755
index 0000000..d90d88f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/gyptest-lib-only.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verify that a link time only dependency will get pulled into the set of built
+targets, even if no executable uses it.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('lib_only.gyp')
+
+test.build('lib_only.gyp', test.ALL)
+
+# Make doesn't put static libs in a common 'lib' directory, like it does with
+# shared libs, so check in the obj path corresponding to the source path.
+test.built_file_must_exist('a', type=test.STATIC_LIB, libdir='obj.target')
+
+# TODO(bradnelson/mark):
+# On linux and windows a library target will at least pull its link dependencies
+# into the generated sln/_main.scons, since not doing so confuses users.
+# This is not currently implemented on mac, which has the opposite behavior.
+if test.format == 'xcode':
+ test.built_file_must_not_exist('b', type=test.STATIC_LIB)
+else:
+ test.built_file_must_exist('b', type=test.STATIC_LIB, libdir='obj.target/b')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/lib_only.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/lib_only.gyp
new file mode 100755
index 0000000..f6c84de
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependencies/lib_only.gyp
@@ -0,0 +1,16 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'a',
+ 'type': 'static_library',
+ 'sources': [
+ 'a.c',
+ ],
+ 'dependencies': ['b/b.gyp:b'],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/gyptest-copy.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/gyptest-copy.py
new file mode 100644
index 0000000..5ba7c73
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/gyptest-copy.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies dependencies do the copy step.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('copies.gyp', chdir='src')
+
+test.build('copies.gyp', 'proj2', chdir='src')
+
+test.run_built_executable('proj1',
+ chdir='src',
+ stdout="Hello from file1.c\n")
+test.run_built_executable('proj2',
+ chdir='src',
+ stdout="Hello from file2.c\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/copies.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/copies.gyp
new file mode 100644
index 0000000..4176b18
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/copies.gyp
@@ -0,0 +1,25 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'proj1',
+ 'type': 'executable',
+ 'sources': [
+ 'file1.c',
+ ],
+ },
+ {
+ 'target_name': 'proj2',
+ 'type': 'executable',
+ 'sources': [
+ 'file2.c',
+ ],
+ 'dependencies': [
+ 'proj1',
+ ]
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file1.c
new file mode 100644
index 0000000..3caf5d6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file1.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from file1.c\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file2.c
new file mode 100644
index 0000000..ed45cc0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/dependency-copy/src/file2.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from file2.c\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/exclusion.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/exclusion.gyp
new file mode 100644
index 0000000..1232dab
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/exclusion.gyp
@@ -0,0 +1,23 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'hello',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ 'bogus.c',
+ 'also/not/real.c',
+ 'also/not/real2.c',
+ ],
+ 'sources!': [
+ 'bogus.c',
+ 'also/not/real.c',
+ 'also/not/real2.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/gyptest-exclusion.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/gyptest-exclusion.py
new file mode 100644
index 0000000..1fc32bf
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/gyptest-exclusion.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that exclusions (e.g. sources!) are respected. Excluded sources
+that do not exist should not prevent the build from succeeding.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('exclusion.gyp')
+test.build('exclusion.gyp')
+
+# executables
+test.built_file_must_exist('hello' + test._exe, test.EXECUTABLE, bare=True)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/hello.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/hello.c
new file mode 100644
index 0000000..30e8d54
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/exclusion/hello.c
@@ -0,0 +1,15 @@
+/* Copyright (c) 2010 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int func1(void) {
+ return 42;
+}
+
+int main(int argc, char *argv[]) {
+ printf("Hello, world!\n");
+ printf("%d\n", func1());
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/actions.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/actions.gyp
new file mode 100644
index 0000000..dded59a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/actions.gyp
@@ -0,0 +1,16 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'pull_in_all_actions',
+ 'type': 'none',
+ 'dependencies': [
+ 'subdir1/executable.gyp:*',
+ 'subdir2/none.gyp:*',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/actions-out/README.txt b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/actions-out/README.txt
new file mode 100644
index 0000000..90ef886
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/actions-out/README.txt
@@ -0,0 +1,4 @@
+A place-holder for this Xcode build output directory, so that the
+test script can verify that .xcodeproj files are not created in
+their normal location by making the src/ read-only, and then
+selectively making this build directory writable.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/executable.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/executable.gyp
new file mode 100644
index 0000000..6bdd60a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/executable.gyp
@@ -0,0 +1,44 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'msvs_cygwin_shell': 0,
+ 'sources': [
+ 'program.c',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'make-prog1',
+ 'inputs': [
+ 'make-prog1.py',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/prog1.c',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ },
+ {
+ 'action_name': 'make-prog2',
+ 'inputs': [
+ 'make-prog2.py',
+ ],
+ 'outputs': [
+ 'actions-out/prog2.c',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog1.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog1.py
new file mode 100644
index 0000000..7ea1d8a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog1.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = r"""
+#include <stdio.h>
+
+void prog1(void)
+{
+ printf("Hello from make-prog1.py\n");
+}
+"""
+
+open(sys.argv[1], 'w').write(contents)
+
+sys.exit(0)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog2.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog2.py
new file mode 100644
index 0000000..0bfe497
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/make-prog2.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = r"""
+#include <stdio.h>
+
+void prog2(void)
+{
+ printf("Hello from make-prog2.py\n");
+}
+"""
+
+open(sys.argv[1], 'w').write(contents)
+
+sys.exit(0)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/program.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/program.c
new file mode 100644
index 0000000..f155939
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir1/program.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+extern void prog1(void);
+extern void prog2(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from program.c\n");
+ prog1();
+ prog2();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/actions-out/README.txt b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/actions-out/README.txt
new file mode 100644
index 0000000..90ef886
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/actions-out/README.txt
@@ -0,0 +1,4 @@
+A place-holder for this Xcode build output directory, so that the
+test script can verify that .xcodeproj files are not created in
+their normal location by making the src/ read-only, and then
+selectively making this build directory writable.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/make-file.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/make-file.py
new file mode 100644
index 0000000..fff0653
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/make-file.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = "Hello from make-file.py\n"
+
+open(sys.argv[1], 'wb').write(contents)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/none.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/none.gyp
new file mode 100644
index 0000000..f98f527
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/actions/subdir2/none.gyp
@@ -0,0 +1,31 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'file',
+ 'type': 'none',
+ 'msvs_cygwin_shell': 0,
+ 'actions': [
+ {
+ 'action_name': 'make-file',
+ 'inputs': [
+ 'make-file.py',
+ ],
+ 'outputs': [
+ 'actions-out/file.out',
+ # TODO: enhance testing infrastructure to test this
+ # without having to hard-code the intermediate dir paths.
+ #'<(INTERMEDIATE_DIR)/file.out',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ }
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies-out/README.txt b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies-out/README.txt
new file mode 100644
index 0000000..90ef886
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies-out/README.txt
@@ -0,0 +1,4 @@
+A place-holder for this Xcode build output directory, so that the
+test script can verify that .xcodeproj files are not created in
+their normal location by making the src/ read-only, and then
+selectively making this build directory writable.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies.gyp
new file mode 100644
index 0000000..479a3d9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/copies.gyp
@@ -0,0 +1,50 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'pull_in_subdir',
+ 'type': 'none',
+ 'dependencies': [
+ 'subdir/subdir.gyp:*',
+ ],
+ },
+ {
+ 'target_name': 'copies1',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': 'copies-out',
+ 'files': [
+ 'file1',
+ ],
+ },
+ ],
+ },
+ {
+ 'target_name': 'copies2',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'file2',
+ ],
+ },
+ ],
+ },
+ # Verify that a null 'files' list doesn't gag the generators.
+ {
+ 'target_name': 'copies_null',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-null',
+ 'files': [],
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file1 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file1
new file mode 100644
index 0000000..84d55c5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file1
@@ -0,0 +1 @@
+file1 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file2 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file2
new file mode 100644
index 0000000..af1b8ae
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/file2
@@ -0,0 +1 @@
+file2 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/copies-out/README.txt b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/copies-out/README.txt
new file mode 100644
index 0000000..90ef886
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/copies-out/README.txt
@@ -0,0 +1,4 @@
+A place-holder for this Xcode build output directory, so that the
+test script can verify that .xcodeproj files are not created in
+their normal location by making the src/ read-only, and then
+selectively making this build directory writable.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file3 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file3
new file mode 100644
index 0000000..43f16f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file3
@@ -0,0 +1 @@
+file3 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file4 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file4
new file mode 100644
index 0000000..5f7270a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/file4
@@ -0,0 +1 @@
+file4 contents
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/subdir.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/subdir.gyp
new file mode 100644
index 0000000..af031d2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/copies/subdir/subdir.gyp
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'copies3',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': 'copies-out',
+ 'files': [
+ 'file3',
+ ],
+ },
+ ],
+ },
+ {
+ 'target_name': 'copies4',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'file4',
+ ],
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-actions.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-actions.py
new file mode 100644
index 0000000..73ac5ae
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-actions.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies --generator-output= behavior when using actions.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+# All the generated files should go under 'gypfiles'. The source directory
+# ('actions') should be untouched.
+test.writable(test.workpath('actions'), False)
+test.run_gyp('actions.gyp',
+ '--generator-output=' + test.workpath('gypfiles'),
+ chdir='actions')
+
+test.writable(test.workpath('actions'), True)
+
+test.relocate('actions', 'relocate/actions')
+test.relocate('gypfiles', 'relocate/gypfiles')
+
+test.writable(test.workpath('relocate/actions'), False)
+
+# Some of the action outputs use "pure" relative paths (i.e. without prefixes
+# like <(INTERMEDIATE_DIR) or <(PROGRAM_DIR)). Even though we are building under
+# 'gypfiles', such outputs will still be created relative to the original .gyp
+# sources. Projects probably wouldn't normally do this, since it kind of defeats
+# the purpose of '--generator-output', but it is supported behaviour.
+test.writable(test.workpath('relocate/actions/build'), True)
+test.writable(test.workpath('relocate/actions/subdir1/build'), True)
+test.writable(test.workpath('relocate/actions/subdir1/actions-out'), True)
+test.writable(test.workpath('relocate/actions/subdir2/build'), True)
+test.writable(test.workpath('relocate/actions/subdir2/actions-out'), True)
+
+test.build('actions.gyp', test.ALL, chdir='relocate/gypfiles')
+
+expect = """\
+Hello from program.c
+Hello from make-prog1.py
+Hello from make-prog2.py
+"""
+
+if test.format == 'xcode':
+ chdir = 'relocate/actions/subdir1'
+else:
+ chdir = 'relocate/gypfiles'
+test.run_built_executable('program', chdir=chdir, stdout=expect)
+
+test.must_match('relocate/actions/subdir2/actions-out/file.out',
+ "Hello from make-file.py\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-copies.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-copies.py
new file mode 100644
index 0000000..414b7c3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-copies.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies using an explicit build target of 'all'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.writable(test.workpath('copies'), False)
+
+test.run_gyp('copies.gyp',
+ '--generator-output=' + test.workpath('gypfiles'),
+ chdir='copies')
+
+test.writable(test.workpath('copies'), True)
+
+test.relocate('copies', 'relocate/copies')
+test.relocate('gypfiles', 'relocate/gypfiles')
+
+test.writable(test.workpath('relocate/copies'), False)
+
+test.writable(test.workpath('relocate/copies/build'), True)
+test.writable(test.workpath('relocate/copies/copies-out'), True)
+test.writable(test.workpath('relocate/copies/subdir/build'), True)
+test.writable(test.workpath('relocate/copies/subdir/copies-out'), True)
+
+test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles')
+
+test.must_match(['relocate', 'copies', 'copies-out', 'file1'],
+ "file1 contents\n")
+
+if test.format == 'xcode':
+ chdir = 'relocate/copies/build'
+elif test.format == 'make':
+ chdir = 'relocate/gypfiles/out'
+else:
+ chdir = 'relocate/gypfiles'
+test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n")
+
+test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'],
+ "file3 contents\n")
+
+if test.format == 'xcode':
+ chdir = 'relocate/copies/subdir/build'
+elif test.format == 'make':
+ chdir = 'relocate/gypfiles/out'
+else:
+ chdir = 'relocate/gypfiles'
+test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-relocate.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-relocate.py
new file mode 100644
index 0000000..dd1c2bd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-relocate.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that a project hierarchy created with the --generator-output=
+option can be built even when it's relocated to a different path.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.writable(test.workpath('src'), False)
+
+test.run_gyp('prog1.gyp',
+ '-Dset_symroot=1',
+ '--generator-output=' + test.workpath('gypfiles'),
+ chdir='src')
+
+test.writable(test.workpath('src'), True)
+
+test.relocate('src', 'relocate/src')
+test.relocate('gypfiles', 'relocate/gypfiles')
+
+test.writable(test.workpath('relocate/src'), False)
+
+test.writable(test.workpath('relocate/src/build'), True)
+test.writable(test.workpath('relocate/src/subdir2/build'), True)
+test.writable(test.workpath('relocate/src/subdir3/build'), True)
+
+test.build('prog1.gyp', test.ALL, chdir='relocate/gypfiles')
+
+chdir = 'relocate/gypfiles'
+
+expect = """\
+Hello from %s
+Hello from inc.h
+Hello from inc1/include1.h
+Hello from inc2/include2.h
+Hello from inc3/include3.h
+Hello from subdir2/deeper/deeper.h
+"""
+
+if test.format == 'xcode':
+ chdir = 'relocate/src'
+test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c')
+
+if test.format == 'xcode':
+ chdir = 'relocate/src/subdir2'
+test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c')
+
+if test.format == 'xcode':
+ chdir = 'relocate/src/subdir3'
+test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-rules.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-rules.py
new file mode 100644
index 0000000..05b674f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-rules.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies --generator-output= behavior when using rules.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.writable(test.workpath('rules'), False)
+
+test.run_gyp('rules.gyp',
+ '--generator-output=' + test.workpath('gypfiles'),
+ chdir='rules')
+
+test.writable(test.workpath('rules'), True)
+
+test.relocate('rules', 'relocate/rules')
+test.relocate('gypfiles', 'relocate/gypfiles')
+
+test.writable(test.workpath('relocate/rules'), False)
+
+test.writable(test.workpath('relocate/rules/build'), True)
+test.writable(test.workpath('relocate/rules/subdir1/build'), True)
+test.writable(test.workpath('relocate/rules/subdir2/build'), True)
+test.writable(test.workpath('relocate/rules/subdir2/rules-out'), True)
+
+test.build('rules.gyp', test.ALL, chdir='relocate/gypfiles')
+
+expect = """\
+Hello from program.c
+Hello from function1.in1
+Hello from function2.in1
+Hello from define3.in0
+Hello from define4.in0
+"""
+
+if test.format == 'xcode':
+ chdir = 'relocate/rules/subdir1'
+else:
+ chdir = 'relocate/gypfiles'
+test.run_built_executable('program', chdir=chdir, stdout=expect)
+
+test.must_match('relocate/rules/subdir2/rules-out/file1.out',
+ "Hello from file1.in0\n")
+test.must_match('relocate/rules/subdir2/rules-out/file2.out',
+ "Hello from file2.in0\n")
+test.must_match('relocate/rules/subdir2/rules-out/file3.out',
+ "Hello from file3.in1\n")
+test.must_match('relocate/rules/subdir2/rules-out/file4.out',
+ "Hello from file4.in1\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-subdir2-deep.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-subdir2-deep.py
new file mode 100644
index 0000000..ea1b472
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-subdir2-deep.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies building a target from a .gyp file a few subdirectories
+deep when the --generator-output= option is used to put the build
+configuration files in a separate directory tree.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.writable(test.workpath('src'), False)
+
+test.writable(test.workpath('src/subdir2/deeper/build'), True)
+
+test.run_gyp('deeper.gyp',
+ '-Dset_symroot=1',
+ '--generator-output=' + test.workpath('gypfiles'),
+ chdir='src/subdir2/deeper')
+
+test.build('deeper.gyp', test.ALL, chdir='gypfiles')
+
+chdir = 'gypfiles'
+
+if test.format == 'xcode':
+ chdir = 'src/subdir2/deeper'
+test.run_built_executable('deeper',
+ chdir=chdir,
+ stdout="Hello from deeper.c\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-top-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-top-all.py
new file mode 100644
index 0000000..902ceb2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-top-all.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies building a project hierarchy created when the --generator-output=
+option is used to put the build configuration files in a separate
+directory tree.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.writable(test.workpath('src'), False)
+
+test.run_gyp('prog1.gyp',
+ '-Dset_symroot=1',
+ '--generator-output=' + test.workpath('gypfiles'),
+ chdir='src')
+
+test.writable(test.workpath('src/build'), True)
+test.writable(test.workpath('src/subdir2/build'), True)
+test.writable(test.workpath('src/subdir3/build'), True)
+
+test.build('prog1.gyp', test.ALL, chdir='gypfiles')
+
+chdir = 'gypfiles'
+
+expect = """\
+Hello from %s
+Hello from inc.h
+Hello from inc1/include1.h
+Hello from inc2/include2.h
+Hello from inc3/include3.h
+Hello from subdir2/deeper/deeper.h
+"""
+
+if test.format == 'xcode':
+ chdir = 'src'
+test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c')
+
+if test.format == 'xcode':
+ chdir = 'src/subdir2'
+test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c')
+
+if test.format == 'xcode':
+ chdir = 'src/subdir3'
+test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/copy-file.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/copy-file.py
new file mode 100644
index 0000000..938c336
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/copy-file.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+contents = open(sys.argv[1], 'r').read()
+open(sys.argv[2], 'wb').write(contents)
+
+sys.exit(0)
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/rules.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/rules.gyp
new file mode 100644
index 0000000..dded59a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/rules.gyp
@@ -0,0 +1,16 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'pull_in_all_actions',
+ 'type': 'none',
+ 'dependencies': [
+ 'subdir1/executable.gyp:*',
+ 'subdir2/none.gyp:*',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define3.in0 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define3.in0
new file mode 100644
index 0000000..cc29c64
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define3.in0
@@ -0,0 +1 @@
+#define STRING3 "Hello from define3.in0\n"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define4.in0 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define4.in0
new file mode 100644
index 0000000..c9b0467
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/define4.in0
@@ -0,0 +1 @@
+#define STRING4 "Hello from define4.in0\n"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/executable.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/executable.gyp
new file mode 100644
index 0000000..2fd89a0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/executable.gyp
@@ -0,0 +1,59 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'msvs_cygwin_shell': 0,
+ 'sources': [
+ 'program.c',
+ 'function1.in1',
+ 'function2.in1',
+ 'define3.in0',
+ 'define4.in0',
+ ],
+ 'include_dirs': [
+ '<(INTERMEDIATE_DIR)',
+ ],
+ 'rules': [
+ {
+ 'rule_name': 'copy_file_0',
+ 'extension': 'in0',
+ 'inputs': [
+ '../copy-file.py',
+ ],
+ 'outputs': [
+ # TODO: fix SCons and Make to support generated files not
+ # in a variable-named path like <(INTERMEDIATE_DIR)
+ #'<(RULE_INPUT_ROOT).c',
+ '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).h',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 0,
+ },
+ {
+ 'rule_name': 'copy_file_1',
+ 'extension': 'in1',
+ 'inputs': [
+ '../copy-file.py',
+ ],
+ 'outputs': [
+ # TODO: fix SCons and Make to support generated files not
+ # in a variable-named path like <(INTERMEDIATE_DIR)
+ #'<(RULE_INPUT_ROOT).c',
+ '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).c',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function1.in1 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function1.in1
new file mode 100644
index 0000000..545e7ca
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function1.in1
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void function1(void)
+{
+ printf("Hello from function1.in1\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function2.in1 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function2.in1
new file mode 100644
index 0000000..6bad43f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/function2.in1
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void function2(void)
+{
+ printf("Hello from function2.in1\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/program.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/program.c
new file mode 100644
index 0000000..27fd31e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir1/program.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include "define3.h"
+#include "define4.h"
+
+extern void function1(void);
+extern void function2(void);
+extern void function3(void);
+extern void function4(void);
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from program.c\n");
+ function1();
+ function2();
+ printf("%s", STRING3);
+ printf("%s", STRING4);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file1.in0 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file1.in0
new file mode 100644
index 0000000..7aca64f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file1.in0
@@ -0,0 +1 @@
+Hello from file1.in0
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file2.in0 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file2.in0
new file mode 100644
index 0000000..80a281a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file2.in0
@@ -0,0 +1 @@
+Hello from file2.in0
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file3.in1 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file3.in1
new file mode 100644
index 0000000..60ae2e7
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file3.in1
@@ -0,0 +1 @@
+Hello from file3.in1
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file4.in1 b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file4.in1
new file mode 100644
index 0000000..5a3c307
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/file4.in1
@@ -0,0 +1 @@
+Hello from file4.in1
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/none.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/none.gyp
new file mode 100644
index 0000000..664cbd9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/none.gyp
@@ -0,0 +1,49 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'files',
+ 'type': 'none',
+ 'msvs_cygwin_shell': 0,
+ 'sources': [
+ 'file1.in0',
+ 'file2.in0',
+ 'file3.in1',
+ 'file4.in1',
+ ],
+ 'rules': [
+ {
+ 'rule_name': 'copy_file_0',
+ 'extension': 'in0',
+ 'inputs': [
+ '../copy-file.py',
+ ],
+ 'outputs': [
+ 'rules-out/<(RULE_INPUT_ROOT).out',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 0,
+ },
+ {
+ 'rule_name': 'copy_file_1',
+ 'extension': 'in1',
+ 'inputs': [
+ '../copy-file.py',
+ ],
+ 'outputs': [
+ 'rules-out/<(RULE_INPUT_ROOT).out',
+ ],
+ 'action': [
+ 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/rules-out/README.txt b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/rules-out/README.txt
new file mode 100644
index 0000000..90ef886
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/rules/subdir2/rules-out/README.txt
@@ -0,0 +1,4 @@
+A place-holder for this Xcode build output directory, so that the
+test script can verify that .xcodeproj files are not created in
+their normal location by making the src/ read-only, and then
+selectively making this build directory writable.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc.h
new file mode 100644
index 0000000..57aa1a5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc.h
@@ -0,0 +1 @@
+#define INC_STRING "inc.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc1/include1.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc1/include1.h
new file mode 100644
index 0000000..1d59065
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/inc1/include1.h
@@ -0,0 +1 @@
+#define INCLUDE1_STRING "inc1/include1.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.c
new file mode 100644
index 0000000..656f81d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+#include "inc.h"
+#include "include1.h"
+#include "include2.h"
+#include "include3.h"
+#include "deeper.h"
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from prog1.c\n");
+ printf("Hello from %s\n", INC_STRING);
+ printf("Hello from %s\n", INCLUDE1_STRING);
+ printf("Hello from %s\n", INCLUDE2_STRING);
+ printf("Hello from %s\n", INCLUDE3_STRING);
+ printf("Hello from %s\n", DEEPER_STRING);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.gyp
new file mode 100644
index 0000000..d50e6fb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/prog1.gyp
@@ -0,0 +1,28 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ 'symroot.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'prog1',
+ 'type': 'executable',
+ 'dependencies': [
+ 'subdir2/prog2.gyp:prog2',
+ ],
+ 'include_dirs': [
+ '.',
+ 'inc1',
+ 'subdir2/inc2',
+ 'subdir3/inc3',
+ 'subdir2/deeper',
+ ],
+ 'sources': [
+ 'prog1.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.c
new file mode 100644
index 0000000..56c49d1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from deeper.c\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp
new file mode 100644
index 0000000..8648770
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ '../../symroot.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'deeper',
+ 'type': 'executable',
+ 'sources': [
+ 'deeper.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.h
new file mode 100644
index 0000000..f6484a0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/deeper/deeper.h
@@ -0,0 +1 @@
+#define DEEPER_STRING "subdir2/deeper/deeper.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/inc2/include2.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/inc2/include2.h
new file mode 100644
index 0000000..1ccfa5d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/inc2/include2.h
@@ -0,0 +1 @@
+#define INCLUDE2_STRING "inc2/include2.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.c
new file mode 100644
index 0000000..38d6c84
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+#include "inc.h"
+#include "include1.h"
+#include "include2.h"
+#include "include3.h"
+#include "deeper.h"
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from prog2.c\n");
+ printf("Hello from %s\n", INC_STRING);
+ printf("Hello from %s\n", INCLUDE1_STRING);
+ printf("Hello from %s\n", INCLUDE2_STRING);
+ printf("Hello from %s\n", INCLUDE3_STRING);
+ printf("Hello from %s\n", DEEPER_STRING);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.gyp
new file mode 100644
index 0000000..7176ed8
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir2/prog2.gyp
@@ -0,0 +1,28 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ '../symroot.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'prog2',
+ 'type': 'executable',
+ 'include_dirs': [
+ '..',
+ '../inc1',
+ 'inc2',
+ '../subdir3/inc3',
+ 'deeper',
+ ],
+ 'dependencies': [
+ '../subdir3/prog3.gyp:prog3',
+ ],
+ 'sources': [
+ 'prog2.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/inc3/include3.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/inc3/include3.h
new file mode 100644
index 0000000..bf53bf1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/inc3/include3.h
@@ -0,0 +1 @@
+#define INCLUDE3_STRING "inc3/include3.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.c
new file mode 100644
index 0000000..7848b45
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+#include "inc.h"
+#include "include1.h"
+#include "include2.h"
+#include "include3.h"
+#include "deeper.h"
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from prog3.c\n");
+ printf("Hello from %s\n", INC_STRING);
+ printf("Hello from %s\n", INCLUDE1_STRING);
+ printf("Hello from %s\n", INCLUDE2_STRING);
+ printf("Hello from %s\n", INCLUDE3_STRING);
+ printf("Hello from %s\n", DEEPER_STRING);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.gyp
new file mode 100644
index 0000000..46c5e00
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/subdir3/prog3.gyp
@@ -0,0 +1,25 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes': [
+ '../symroot.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'prog3',
+ 'type': 'executable',
+ 'include_dirs': [
+ '..',
+ '../inc1',
+ '../subdir2/inc2',
+ 'inc3',
+ '../subdir2/deeper',
+ ],
+ 'sources': [
+ 'prog3.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/symroot.gypi b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/symroot.gypi
new file mode 100644
index 0000000..5199164
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/generator-output/src/symroot.gypi
@@ -0,0 +1,16 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'set_symroot%': 0,
+ },
+ 'conditions': [
+ ['set_symroot == 1', {
+ 'xcode_settings': {
+ 'SYMROOT': '<(DEPTH)/build',
+ },
+ }],
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-all.py
new file mode 100644
index 0000000..9ecff55
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-all.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simplest-possible build of a "Hello, world!" program
+using an explicit build target of 'all'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('hello.gyp')
+
+test.build('hello.gyp', test.ALL)
+
+test.run_built_executable('hello', stdout="Hello, world!\n")
+
+test.up_to_date('hello.gyp', test.ALL)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-default.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-default.py
new file mode 100644
index 0000000..76fffb3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-default.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simplest-possible build of a "Hello, world!" program
+using the default build target.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('hello.gyp')
+
+test.build('hello.gyp')
+
+test.run_built_executable('hello', stdout="Hello, world!\n")
+
+test.up_to_date('hello.gyp', test.DEFAULT)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-disable-regyp.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-disable-regyp.py
new file mode 100644
index 0000000..1e4b306
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-disable-regyp.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that Makefiles don't get rebuilt when a source gyp file changes and
+the disable_regeneration generator flag is set.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('hello.gyp', '-Gauto_regeneration=0')
+
+test.build('hello.gyp', test.ALL)
+
+test.run_built_executable('hello', stdout="Hello, world!\n")
+
+# Sleep so that the changed gyp file will have a newer timestamp than the
+# previously generated build files.
+test.sleep()
+test.write('hello.gyp', test.read('hello2.gyp'))
+
+test.build('hello.gyp', test.ALL)
+
+# Should still be the old executable, as regeneration was disabled.
+test.run_built_executable('hello', stdout="Hello, world!\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-regyp.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-regyp.py
new file mode 100644
index 0000000..827c723
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-regyp.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that Makefiles get rebuilt when a source gyp file changes.
+"""
+
+import TestGyp
+
+# Regenerating build files when a gyp file changes is currently only supported
+# by the make generator.
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('hello.gyp')
+
+test.build('hello.gyp', test.ALL)
+
+test.run_built_executable('hello', stdout="Hello, world!\n")
+
+# Sleep so that the changed gyp file will have a newer timestamp than the
+# previously generated build files.
+test.sleep()
+test.write('hello.gyp', test.read('hello2.gyp'))
+
+test.build('hello.gyp', test.ALL)
+
+test.run_built_executable('hello', stdout="Hello, two!\n")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-target.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-target.py
new file mode 100755
index 0000000..2f0a2a3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/gyptest-target.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simplest-possible build of a "Hello, world!" program
+using an explicit build target of 'hello'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('hello.gyp')
+
+test.build('hello.gyp', 'hello')
+
+test.run_built_executable('hello', stdout="Hello, world!\n")
+
+test.up_to_date('hello.gyp', 'hello')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.c
new file mode 100644
index 0000000..8dbecc0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.c
@@ -0,0 +1,11 @@
+/* Copyright (c) 2009 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello, world!\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.gyp
new file mode 100644
index 0000000..1974d51
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello.gyp
@@ -0,0 +1,15 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'hello',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.c
new file mode 100644
index 0000000..19ef3fb
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.c
@@ -0,0 +1,11 @@
+/* Copyright (c) 2009 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello, two!\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.gyp
new file mode 100644
index 0000000..25b08ca
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/hello/hello2.gyp
@@ -0,0 +1,15 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'hello',
+ 'type': 'executable',
+ 'sources': [
+ 'hello2.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py
new file mode 100644
index 0000000..a2b9f30
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies inclusion of $HOME/.gyp/includes.gypi works properly with relocation
+and with regeneration.
+"""
+
+import os
+import TestGyp
+
+# Regenerating build files when a gyp file changes is currently only supported
+# by the make generator.
+test = TestGyp.TestGyp(formats=['make'])
+
+os.environ['HOME'] = os.path.abspath('home')
+
+test.run_gyp('all.gyp', chdir='src')
+
+# After relocating, we should still be able to build (build file shouldn't
+# contain relative reference to ~/.gyp/includes.gypi)
+test.relocate('src', 'relocate/src')
+
+test.build('all.gyp', test.ALL, chdir='relocate/src')
+
+test.run_built_executable('printfoo',
+ chdir='relocate/src',
+ stdout="FOO is fromhome\n");
+
+# Building should notice any changes to ~/.gyp/includes.gypi and regyp.
+test.sleep()
+
+test.write('home/.gyp/include.gypi', test.read('home2/.gyp/include.gypi'))
+
+test.build('all.gyp', test.ALL, chdir='relocate/src')
+
+test.run_built_executable('printfoo',
+ chdir='relocate/src',
+ stdout="FOO is fromhome2\n");
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes.py
new file mode 100644
index 0000000..6a0e965
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies inclusion of $HOME/.gyp/includes.gypi works.
+"""
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+os.environ['HOME'] = os.path.abspath('home')
+
+test.run_gyp('all.gyp', chdir='src')
+
+# After relocating, we should still be able to build (build file shouldn't
+# contain relative reference to ~/.gyp/includes.gypi)
+test.relocate('src', 'relocate/src')
+
+test.build('all.gyp', test.ALL, chdir='relocate/src')
+
+test.run_built_executable('printfoo',
+ chdir='relocate/src',
+ stdout="FOO is fromhome\n");
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home/.gyp/include.gypi b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home/.gyp/include.gypi
new file mode 100644
index 0000000..fcfb39b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home/.gyp/include.gypi
@@ -0,0 +1,5 @@
+{
+ 'variables': {
+ 'foo': '"fromhome"',
+ },
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home2/.gyp/include.gypi b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home2/.gyp/include.gypi
new file mode 100644
index 0000000..f0d84b3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/home2/.gyp/include.gypi
@@ -0,0 +1,5 @@
+{
+ 'variables': {
+ 'foo': '"fromhome2"',
+ },
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/all.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/all.gyp
new file mode 100644
index 0000000..14b6aea
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/all.gyp
@@ -0,0 +1,22 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'foo%': '"fromdefault"',
+ },
+ 'targets': [
+ {
+ 'target_name': 'printfoo',
+ 'type': 'executable',
+ 'sources': [
+ 'printfoo.c',
+ ],
+ 'defines': [
+ 'FOO=<(foo)',
+ ],
+ },
+ ],
+}
+
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/printfoo.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/printfoo.c
new file mode 100644
index 0000000..92d2cba
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/home_dot_gyp/src/printfoo.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("FOO is %s\n", FOO);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-all.py
new file mode 100644
index 0000000..94a1338
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-all.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies use of include_dirs when using an explicit build target of 'all'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+if test.format == 'scons':
+ test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n')
+
+test.run_gyp('includes.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('includes.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from includes.c
+Hello from inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+Hello from shadow2/shadow.h
+"""
+test.run_built_executable('includes', stdout=expect, chdir='relocate/src')
+
+if test.format == 'xcode':
+ chdir='relocate/src/subdir'
+else:
+ chdir='relocate/src'
+
+expect = """\
+Hello from subdir/subdir_includes.c
+Hello from subdir/inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+"""
+test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-default.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-default.py
new file mode 100644
index 0000000..42acd1f
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/gyptest-default.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies use of include_dirs when using the default build target.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+if test.format == 'scons':
+ test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n')
+
+test.run_gyp('includes.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('includes.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from includes.c
+Hello from inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+Hello from shadow2/shadow.h
+"""
+test.run_built_executable('includes', stdout=expect, chdir='relocate/src')
+
+if test.format == 'xcode':
+ chdir='relocate/src/subdir'
+else:
+ chdir='relocate/src'
+
+expect = """\
+Hello from subdir/subdir_includes.c
+Hello from subdir/inc.h
+Hello from include1.h
+Hello from subdir/inc2/include2.h
+"""
+test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc.h
new file mode 100644
index 0000000..0398d69
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc.h
@@ -0,0 +1 @@
+#define INC_STRING "inc.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc1/include1.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc1/include1.h
new file mode 100644
index 0000000..43356b5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/inc1/include1.h
@@ -0,0 +1 @@
+#define INCLUDE1_STRING "include1.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.c
new file mode 100644
index 0000000..e2afbd3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+#include "inc.h"
+#include "include1.h"
+#include "include2.h"
+#include "shadow.h"
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from includes.c\n");
+ printf("Hello from %s\n", INC_STRING);
+ printf("Hello from %s\n", INCLUDE1_STRING);
+ printf("Hello from %s\n", INCLUDE2_STRING);
+ /* Test that include_dirs happen first: The gyp file has a -Ishadow1
+ cflag and an include_dir of shadow2. Including shadow.h should get
+ the shadow.h from the include_dir. */
+ printf("Hello from %s\n", SHADOW_STRING);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.gyp
new file mode 100644
index 0000000..3592690
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/includes.gyp
@@ -0,0 +1,27 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'includes',
+ 'type': 'executable',
+ 'dependencies': [
+ 'subdir/subdir_includes.gyp:subdir_includes',
+ ],
+ 'cflags': [
+ '-Ishadow1',
+ ],
+ 'include_dirs': [
+ '.',
+ 'inc1',
+ 'shadow2',
+ 'subdir/inc2',
+ ],
+ 'sources': [
+ 'includes.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow1/shadow.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow1/shadow.h
new file mode 100644
index 0000000..80f6de2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow1/shadow.h
@@ -0,0 +1 @@
+#define SHADOW_STRING "shadow1/shadow.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow2/shadow.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow2/shadow.h
new file mode 100644
index 0000000..fad5ccd
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/shadow2/shadow.h
@@ -0,0 +1 @@
+#define SHADOW_STRING "shadow2/shadow.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc.h
new file mode 100644
index 0000000..0a68d7b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc.h
@@ -0,0 +1 @@
+#define INC_STRING "subdir/inc.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc2/include2.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc2/include2.h
new file mode 100644
index 0000000..721577e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/inc2/include2.h
@@ -0,0 +1 @@
+#define INCLUDE2_STRING "subdir/inc2/include2.h"
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.c
new file mode 100644
index 0000000..727f682
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+#include "inc.h"
+#include "include1.h"
+#include "include2.h"
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from subdir/subdir_includes.c\n");
+ printf("Hello from %s\n", INC_STRING);
+ printf("Hello from %s\n", INCLUDE1_STRING);
+ printf("Hello from %s\n", INCLUDE2_STRING);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.gyp
new file mode 100644
index 0000000..257d052
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/include_dirs/src/subdir/subdir_includes.gyp
@@ -0,0 +1,20 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'subdir_includes',
+ 'type': 'executable',
+ 'include_dirs': [
+ '.',
+ '../inc1',
+ 'inc2',
+ ],
+ 'sources': [
+ 'subdir_includes.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/README.txt b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/README.txt
new file mode 100644
index 0000000..b3d7245
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/README.txt
@@ -0,0 +1,17 @@
+Supporting modules for GYP testing.
+
+ TestCmd.py
+ TestCommon.py
+
+ Modules for generic testing of command-line utilities,
+ specifically including the ability to copy a test configuration
+ to temporary directories (with default cleanup on exit) as part
+ of running test scripts that invoke commands, compare actual
+ against expected output, etc.
+
+ Our copies of these come from the SCons project,
+ http://www.scons.org/.
+
+ TestGyp.py
+
+ Modules for GYP-specific tests, of course.
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCmd.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCmd.py
new file mode 100644
index 0000000..029c1d0
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCmd.py
@@ -0,0 +1,1591 @@
+"""
+TestCmd.py: a testing framework for commands and scripts.
+
+The TestCmd module provides a framework for portable automated testing
+of executable commands and scripts (in any language, not just Python),
+especially commands and scripts that require file system interaction.
+
+In addition to running tests and evaluating conditions, the TestCmd
+module manages and cleans up one or more temporary workspace
+directories, and provides methods for creating files and directories in
+those workspace directories from in-line data, here-documents), allowing
+tests to be completely self-contained.
+
+A TestCmd environment object is created via the usual invocation:
+
+ import TestCmd
+ test = TestCmd.TestCmd()
+
+There are a bunch of keyword arguments available at instantiation:
+
+ test = TestCmd.TestCmd(description = 'string',
+ program = 'program_or_script_to_test',
+ interpreter = 'script_interpreter',
+ workdir = 'prefix',
+ subdir = 'subdir',
+ verbose = Boolean,
+ match = default_match_function,
+ diff = default_diff_function,
+ combine = Boolean)
+
+There are a bunch of methods that let you do different things:
+
+ test.verbose_set(1)
+
+ test.description_set('string')
+
+ test.program_set('program_or_script_to_test')
+
+ test.interpreter_set('script_interpreter')
+ test.interpreter_set(['script_interpreter', 'arg'])
+
+ test.workdir_set('prefix')
+ test.workdir_set('')
+
+ test.workpath('file')
+ test.workpath('subdir', 'file')
+
+ test.subdir('subdir', ...)
+
+ test.rmdir('subdir', ...)
+
+ test.write('file', "contents\n")
+ test.write(['subdir', 'file'], "contents\n")
+
+ test.read('file')
+ test.read(['subdir', 'file'])
+ test.read('file', mode)
+ test.read(['subdir', 'file'], mode)
+
+ test.writable('dir', 1)
+ test.writable('dir', None)
+
+ test.preserve(condition, ...)
+
+ test.cleanup(condition)
+
+ test.command_args(program = 'program_or_script_to_run',
+ interpreter = 'script_interpreter',
+ arguments = 'arguments to pass to program')
+
+ test.run(program = 'program_or_script_to_run',
+ interpreter = 'script_interpreter',
+ arguments = 'arguments to pass to program',
+ chdir = 'directory_to_chdir_to',
+ stdin = 'input to feed to the program\n')
+ universal_newlines = True)
+
+ p = test.start(program = 'program_or_script_to_run',
+ interpreter = 'script_interpreter',
+ arguments = 'arguments to pass to program',
+ universal_newlines = None)
+
+ test.finish(self, p)
+
+ test.pass_test()
+ test.pass_test(condition)
+ test.pass_test(condition, function)
+
+ test.fail_test()
+ test.fail_test(condition)
+ test.fail_test(condition, function)
+ test.fail_test(condition, function, skip)
+
+ test.no_result()
+ test.no_result(condition)
+ test.no_result(condition, function)
+ test.no_result(condition, function, skip)
+
+ test.stdout()
+ test.stdout(run)
+
+ test.stderr()
+ test.stderr(run)
+
+ test.symlink(target, link)
+
+ test.banner(string)
+ test.banner(string, width)
+
+ test.diff(actual, expected)
+
+ test.match(actual, expected)
+
+ test.match_exact("actual 1\nactual 2\n", "expected 1\nexpected 2\n")
+ test.match_exact(["actual 1\n", "actual 2\n"],
+ ["expected 1\n", "expected 2\n"])
+
+ test.match_re("actual 1\nactual 2\n", regex_string)
+ test.match_re(["actual 1\n", "actual 2\n"], list_of_regexes)
+
+ test.match_re_dotall("actual 1\nactual 2\n", regex_string)
+ test.match_re_dotall(["actual 1\n", "actual 2\n"], list_of_regexes)
+
+ test.tempdir()
+ test.tempdir('temporary-directory')
+
+ test.sleep()
+ test.sleep(seconds)
+
+ test.where_is('foo')
+ test.where_is('foo', 'PATH1:PATH2')
+ test.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4')
+
+ test.unlink('file')
+ test.unlink('subdir', 'file')
+
+The TestCmd module provides pass_test(), fail_test(), and no_result()
+unbound functions that report test results for use with the Aegis change
+management system. These methods terminate the test immediately,
+reporting PASSED, FAILED, or NO RESULT respectively, and exiting with
+status 0 (success), 1 or 2 respectively. This allows for a distinction
+between an actual failed test and a test that could not be properly
+evaluated because of an external condition (such as a full file system
+or incorrect permissions).
+
+ import TestCmd
+
+ TestCmd.pass_test()
+ TestCmd.pass_test(condition)
+ TestCmd.pass_test(condition, function)
+
+ TestCmd.fail_test()
+ TestCmd.fail_test(condition)
+ TestCmd.fail_test(condition, function)
+ TestCmd.fail_test(condition, function, skip)
+
+ TestCmd.no_result()
+ TestCmd.no_result(condition)
+ TestCmd.no_result(condition, function)
+ TestCmd.no_result(condition, function, skip)
+
+The TestCmd module also provides unbound functions that handle matching
+in the same way as the match_*() methods described above.
+
+ import TestCmd
+
+ test = TestCmd.TestCmd(match = TestCmd.match_exact)
+
+ test = TestCmd.TestCmd(match = TestCmd.match_re)
+
+ test = TestCmd.TestCmd(match = TestCmd.match_re_dotall)
+
+The TestCmd module provides unbound functions that can be used for the
+"diff" argument to TestCmd.TestCmd instantiation:
+
+ import TestCmd
+
+ test = TestCmd.TestCmd(match = TestCmd.match_re,
+ diff = TestCmd.diff_re)
+
+ test = TestCmd.TestCmd(diff = TestCmd.simple_diff)
+
+The "diff" argument can also be used with standard difflib functions:
+
+ import difflib
+
+ test = TestCmd.TestCmd(diff = difflib.context_diff)
+
+ test = TestCmd.TestCmd(diff = difflib.unified_diff)
+
+Lastly, the where_is() method also exists in an unbound function
+version.
+
+ import TestCmd
+
+ TestCmd.where_is('foo')
+ TestCmd.where_is('foo', 'PATH1:PATH2')
+ TestCmd.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4')
+"""
+
+# Copyright 2000-2010 Steven Knight
+# This module is free software, and you may redistribute it and/or modify
+# it under the same terms as Python itself, so long as this copyright message
+# and disclaimer are retained in their original form.
+#
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+# THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+# DAMAGE.
+#
+# THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,
+# AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
+# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+__author__ = "Steven Knight <knight at baldmt dot com>"
+__revision__ = "TestCmd.py 0.37.D001 2010/01/11 16:55:50 knight"
+__version__ = "0.37"
+
+import errno
+import os
+import os.path
+import re
+import shutil
+import stat
+import string
+import sys
+import tempfile
+import time
+import traceback
+import types
+import UserList
+
+__all__ = [
+ 'diff_re',
+ 'fail_test',
+ 'no_result',
+ 'pass_test',
+ 'match_exact',
+ 'match_re',
+ 'match_re_dotall',
+ 'python_executable',
+ 'TestCmd'
+]
+
+try:
+ import difflib
+except ImportError:
+ __all__.append('simple_diff')
+
+def is_List(e):
+ return type(e) is types.ListType \
+ or isinstance(e, UserList.UserList)
+
+try:
+ from UserString import UserString
+except ImportError:
+ class UserString:
+ pass
+
+if hasattr(types, 'UnicodeType'):
+ def is_String(e):
+ return type(e) is types.StringType \
+ or type(e) is types.UnicodeType \
+ or isinstance(e, UserString)
+else:
+ def is_String(e):
+ return type(e) is types.StringType or isinstance(e, UserString)
+
+tempfile.template = 'testcmd.'
+if os.name in ('posix', 'nt'):
+ tempfile.template = 'testcmd.' + str(os.getpid()) + '.'
+else:
+ tempfile.template = 'testcmd.'
+
+re_space = re.compile('\s')
+
+_Cleanup = []
+
+_chain_to_exitfunc = None
+
+def _clean():
+ global _Cleanup
+ cleanlist = filter(None, _Cleanup)
+ del _Cleanup[:]
+ cleanlist.reverse()
+ for test in cleanlist:
+ test.cleanup()
+ if _chain_to_exitfunc:
+ _chain_to_exitfunc()
+
+try:
+ import atexit
+except ImportError:
+ # TODO(1.5): atexit requires python 2.0, so chain sys.exitfunc
+ try:
+ _chain_to_exitfunc = sys.exitfunc
+ except AttributeError:
+ pass
+ sys.exitfunc = _clean
+else:
+ atexit.register(_clean)
+
+try:
+ zip
+except NameError:
+ def zip(*lists):
+ result = []
+ for i in xrange(min(map(len, lists))):
+ result.append(tuple(map(lambda l, i=i: l[i], lists)))
+ return result
+
+class Collector:
+ def __init__(self, top):
+ self.entries = [top]
+ def __call__(self, arg, dirname, names):
+ pathjoin = lambda n, d=dirname: os.path.join(d, n)
+ self.entries.extend(map(pathjoin, names))
+
+def _caller(tblist, skip):
+ string = ""
+ arr = []
+ for file, line, name, text in tblist:
+ if file[-10:] == "TestCmd.py":
+ break
+ arr = [(file, line, name, text)] + arr
+ atfrom = "at"
+ for file, line, name, text in arr[skip:]:
+ if name in ("?", "<module>"):
+ name = ""
+ else:
+ name = " (" + name + ")"
+ string = string + ("%s line %d of %s%s\n" % (atfrom, line, file, name))
+ atfrom = "\tfrom"
+ return string
+
+def fail_test(self = None, condition = 1, function = None, skip = 0):
+ """Cause the test to fail.
+
+ By default, the fail_test() method reports that the test FAILED
+ and exits with a status of 1. If a condition argument is supplied,
+ the test fails only if the condition is true.
+ """
+ if not condition:
+ return
+ if not function is None:
+ function()
+ of = ""
+ desc = ""
+ sep = " "
+ if not self is None:
+ if self.program:
+ of = " of " + self.program
+ sep = "\n\t"
+ if self.description:
+ desc = " [" + self.description + "]"
+ sep = "\n\t"
+
+ at = _caller(traceback.extract_stack(), skip)
+ sys.stderr.write("FAILED test" + of + desc + sep + at)
+
+ sys.exit(1)
+
+def no_result(self = None, condition = 1, function = None, skip = 0):
+ """Causes a test to exit with no valid result.
+
+ By default, the no_result() method reports NO RESULT for the test
+ and exits with a status of 2. If a condition argument is supplied,
+ the test fails only if the condition is true.
+ """
+ if not condition:
+ return
+ if not function is None:
+ function()
+ of = ""
+ desc = ""
+ sep = " "
+ if not self is None:
+ if self.program:
+ of = " of " + self.program
+ sep = "\n\t"
+ if self.description:
+ desc = " [" + self.description + "]"
+ sep = "\n\t"
+
+ at = _caller(traceback.extract_stack(), skip)
+ sys.stderr.write("NO RESULT for test" + of + desc + sep + at)
+
+ sys.exit(2)
+
+def pass_test(self = None, condition = 1, function = None):
+ """Causes a test to pass.
+
+ By default, the pass_test() method reports PASSED for the test
+ and exits with a status of 0. If a condition argument is supplied,
+ the test passes only if the condition is true.
+ """
+ if not condition:
+ return
+ if not function is None:
+ function()
+ sys.stderr.write("PASSED\n")
+ sys.exit(0)
+
+def match_exact(lines = None, matches = None):
+ """
+ """
+ if not is_List(lines):
+ lines = string.split(lines, "\n")
+ if not is_List(matches):
+ matches = string.split(matches, "\n")
+ if len(lines) != len(matches):
+ return
+ for i in range(len(lines)):
+ if lines[i] != matches[i]:
+ return
+ return 1
+
+def match_re(lines = None, res = None):
+ """
+ """
+ if not is_List(lines):
+ lines = string.split(lines, "\n")
+ if not is_List(res):
+ res = string.split(res, "\n")
+ if len(lines) != len(res):
+ return
+ for i in range(len(lines)):
+ s = "^" + res[i] + "$"
+ try:
+ expr = re.compile(s)
+ except re.error, e:
+ msg = "Regular expression error in %s: %s"
+ raise re.error, msg % (repr(s), e[0])
+ if not expr.search(lines[i]):
+ return
+ return 1
+
+def match_re_dotall(lines = None, res = None):
+ """
+ """
+ if not type(lines) is type(""):
+ lines = string.join(lines, "\n")
+ if not type(res) is type(""):
+ res = string.join(res, "\n")
+ s = "^" + res + "$"
+ try:
+ expr = re.compile(s, re.DOTALL)
+ except re.error, e:
+ msg = "Regular expression error in %s: %s"
+ raise re.error, msg % (repr(s), e[0])
+ if expr.match(lines):
+ return 1
+
+try:
+ import difflib
+except ImportError:
+ pass
+else:
+ def simple_diff(a, b, fromfile='', tofile='',
+ fromfiledate='', tofiledate='', n=3, lineterm='\n'):
+ """
+ A function with the same calling signature as difflib.context_diff
+ (diff -c) and difflib.unified_diff (diff -u) but which prints
+ output like the simple, unadorned 'diff" command.
+ """
+ sm = difflib.SequenceMatcher(None, a, b)
+ def comma(x1, x2):
+ return x1+1 == x2 and str(x2) or '%s,%s' % (x1+1, x2)
+ result = []
+ for op, a1, a2, b1, b2 in sm.get_opcodes():
+ if op == 'delete':
+ result.append("%sd%d" % (comma(a1, a2), b1))
+ result.extend(map(lambda l: '< ' + l, a[a1:a2]))
+ elif op == 'insert':
+ result.append("%da%s" % (a1, comma(b1, b2)))
+ result.extend(map(lambda l: '> ' + l, b[b1:b2]))
+ elif op == 'replace':
+ result.append("%sc%s" % (comma(a1, a2), comma(b1, b2)))
+ result.extend(map(lambda l: '< ' + l, a[a1:a2]))
+ result.append('---')
+ result.extend(map(lambda l: '> ' + l, b[b1:b2]))
+ return result
+
+def diff_re(a, b, fromfile='', tofile='',
+ fromfiledate='', tofiledate='', n=3, lineterm='\n'):
+ """
+ A simple "diff" of two sets of lines when the expected lines
+ are regular expressions. This is a really dumb thing that
+ just compares each line in turn, so it doesn't look for
+ chunks of matching lines and the like--but at least it lets
+ you know exactly which line first didn't compare correctl...
+ """
+ result = []
+ diff = len(a) - len(b)
+ if diff < 0:
+ a = a + ['']*(-diff)
+ elif diff > 0:
+ b = b + ['']*diff
+ i = 0
+ for aline, bline in zip(a, b):
+ s = "^" + aline + "$"
+ try:
+ expr = re.compile(s)
+ except re.error, e:
+ msg = "Regular expression error in %s: %s"
+ raise re.error, msg % (repr(s), e[0])
+ if not expr.search(bline):
+ result.append("%sc%s" % (i+1, i+1))
+ result.append('< ' + repr(a[i]))
+ result.append('---')
+ result.append('> ' + repr(b[i]))
+ i = i+1
+ return result
+
+if os.name == 'java':
+
+ python_executable = os.path.join(sys.prefix, 'jython')
+
+else:
+
+ python_executable = sys.executable
+
+if sys.platform == 'win32':
+
+ default_sleep_seconds = 2
+
+ def where_is(file, path=None, pathext=None):
+ if path is None:
+ path = os.environ['PATH']
+ if is_String(path):
+ path = string.split(path, os.pathsep)
+ if pathext is None:
+ pathext = os.environ['PATHEXT']
+ if is_String(pathext):
+ pathext = string.split(pathext, os.pathsep)
+ for ext in pathext:
+ if string.lower(ext) == string.lower(file[-len(ext):]):
+ pathext = ['']
+ break
+ for dir in path:
+ f = os.path.join(dir, file)
+ for ext in pathext:
+ fext = f + ext
+ if os.path.isfile(fext):
+ return fext
+ return None
+
+else:
+
+ def where_is(file, path=None, pathext=None):
+ if path is None:
+ path = os.environ['PATH']
+ if is_String(path):
+ path = string.split(path, os.pathsep)
+ for dir in path:
+ f = os.path.join(dir, file)
+ if os.path.isfile(f):
+ try:
+ st = os.stat(f)
+ except OSError:
+ continue
+ if stat.S_IMODE(st[stat.ST_MODE]) & 0111:
+ return f
+ return None
+
+ default_sleep_seconds = 1
+
+
+
+try:
+ import subprocess
+except ImportError:
+ # The subprocess module doesn't exist in this version of Python,
+ # so we're going to cobble up something that looks just enough
+ # like its API for our purposes below.
+ import new
+
+ subprocess = new.module('subprocess')
+
+ subprocess.PIPE = 'PIPE'
+ subprocess.STDOUT = 'STDOUT'
+ subprocess.mswindows = (sys.platform == 'win32')
+
+ try:
+ import popen2
+ popen2.Popen3
+ except AttributeError:
+ class Popen3:
+ universal_newlines = 1
+ def __init__(self, command, **kw):
+ if sys.platform == 'win32' and command[0] == '"':
+ command = '"' + command + '"'
+ (stdin, stdout, stderr) = os.popen3(' ' + command)
+ self.stdin = stdin
+ self.stdout = stdout
+ self.stderr = stderr
+ def close_output(self):
+ self.stdout.close()
+ self.resultcode = self.stderr.close()
+ def wait(self):
+ resultcode = self.resultcode
+ if os.WIFEXITED(resultcode):
+ return os.WEXITSTATUS(resultcode)
+ elif os.WIFSIGNALED(resultcode):
+ return os.WTERMSIG(resultcode)
+ else:
+ return None
+
+ else:
+ try:
+ popen2.Popen4
+ except AttributeError:
+ # A cribbed Popen4 class, with some retrofitted code from
+ # the Python 1.5 Popen3 class methods to do certain things
+ # by hand.
+ class Popen4(popen2.Popen3):
+ childerr = None
+
+ def __init__(self, cmd, bufsize=-1):
+ p2cread, p2cwrite = os.pipe()
+ c2pread, c2pwrite = os.pipe()
+ self.pid = os.fork()
+ if self.pid == 0:
+ # Child
+ os.dup2(p2cread, 0)
+ os.dup2(c2pwrite, 1)
+ os.dup2(c2pwrite, 2)
+ for i in range(3, popen2.MAXFD):
+ try:
+ os.close(i)
+ except: pass
+ try:
+ os.execvp(cmd[0], cmd)
+ finally:
+ os._exit(1)
+ # Shouldn't come here, I guess
+ os._exit(1)
+ os.close(p2cread)
+ self.tochild = os.fdopen(p2cwrite, 'w', bufsize)
+ os.close(c2pwrite)
+ self.fromchild = os.fdopen(c2pread, 'r', bufsize)
+ popen2._active.append(self)
+
+ popen2.Popen4 = Popen4
+
+ class Popen3(popen2.Popen3, popen2.Popen4):
+ universal_newlines = 1
+ def __init__(self, command, **kw):
+ if kw.get('stderr') == 'STDOUT':
+ apply(popen2.Popen4.__init__, (self, command, 1))
+ else:
+ apply(popen2.Popen3.__init__, (self, command, 1))
+ self.stdin = self.tochild
+ self.stdout = self.fromchild
+ self.stderr = self.childerr
+ def wait(self, *args, **kw):
+ resultcode = apply(popen2.Popen3.wait, (self,)+args, kw)
+ if os.WIFEXITED(resultcode):
+ return os.WEXITSTATUS(resultcode)
+ elif os.WIFSIGNALED(resultcode):
+ return os.WTERMSIG(resultcode)
+ else:
+ return None
+
+ subprocess.Popen = Popen3
+
+
+
+# From Josiah Carlson,
+# ASPN : Python Cookbook : Module to allow Asynchronous subprocess use on Windows and Posix platforms
+# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554
+
+PIPE = subprocess.PIPE
+
+if subprocess.mswindows:
+ from win32file import ReadFile, WriteFile
+ from win32pipe import PeekNamedPipe
+ import msvcrt
+else:
+ import select
+ import fcntl
+
+ try: fcntl.F_GETFL
+ except AttributeError: fcntl.F_GETFL = 3
+
+ try: fcntl.F_SETFL
+ except AttributeError: fcntl.F_SETFL = 4
+
+class Popen(subprocess.Popen):
+ def recv(self, maxsize=None):
+ return self._recv('stdout', maxsize)
+
+ def recv_err(self, maxsize=None):
+ return self._recv('stderr', maxsize)
+
+ def send_recv(self, input='', maxsize=None):
+ return self.send(input), self.recv(maxsize), self.recv_err(maxsize)
+
+ def get_conn_maxsize(self, which, maxsize):
+ if maxsize is None:
+ maxsize = 1024
+ elif maxsize < 1:
+ maxsize = 1
+ return getattr(self, which), maxsize
+
+ def _close(self, which):
+ getattr(self, which).close()
+ setattr(self, which, None)
+
+ if subprocess.mswindows:
+ def send(self, input):
+ if not self.stdin:
+ return None
+
+ try:
+ x = msvcrt.get_osfhandle(self.stdin.fileno())
+ (errCode, written) = WriteFile(x, input)
+ except ValueError:
+ return self._close('stdin')
+ except (subprocess.pywintypes.error, Exception), why:
+ if why[0] in (109, errno.ESHUTDOWN):
+ return self._close('stdin')
+ raise
+
+ return written
+
+ def _recv(self, which, maxsize):
+ conn, maxsize = self.get_conn_maxsize(which, maxsize)
+ if conn is None:
+ return None
+
+ try:
+ x = msvcrt.get_osfhandle(conn.fileno())
+ (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
+ if maxsize < nAvail:
+ nAvail = maxsize
+ if nAvail > 0:
+ (errCode, read) = ReadFile(x, nAvail, None)
+ except ValueError:
+ return self._close(which)
+ except (subprocess.pywintypes.error, Exception), why:
+ if why[0] in (109, errno.ESHUTDOWN):
+ return self._close(which)
+ raise
+
+ #if self.universal_newlines:
+ # read = self._translate_newlines(read)
+ return read
+
+ else:
+ def send(self, input):
+ if not self.stdin:
+ return None
+
+ if not select.select([], [self.stdin], [], 0)[1]:
+ return 0
+
+ try:
+ written = os.write(self.stdin.fileno(), input)
+ except OSError, why:
+ if why[0] == errno.EPIPE: #broken pipe
+ return self._close('stdin')
+ raise
+
+ return written
+
+ def _recv(self, which, maxsize):
+ conn, maxsize = self.get_conn_maxsize(which, maxsize)
+ if conn is None:
+ return None
+
+ try:
+ flags = fcntl.fcntl(conn, fcntl.F_GETFL)
+ except TypeError:
+ flags = None
+ else:
+ if not conn.closed:
+ fcntl.fcntl(conn, fcntl.F_SETFL, flags| os.O_NONBLOCK)
+
+ try:
+ if not select.select([conn], [], [], 0)[0]:
+ return ''
+
+ r = conn.read(maxsize)
+ if not r:
+ return self._close(which)
+
+ #if self.universal_newlines:
+ # r = self._translate_newlines(r)
+ return r
+ finally:
+ if not conn.closed and not flags is None:
+ fcntl.fcntl(conn, fcntl.F_SETFL, flags)
+
+disconnect_message = "Other end disconnected!"
+
+def recv_some(p, t=.1, e=1, tr=5, stderr=0):
+ if tr < 1:
+ tr = 1
+ x = time.time()+t
+ y = []
+ r = ''
+ pr = p.recv
+ if stderr:
+ pr = p.recv_err
+ while time.time() < x or r:
+ r = pr()
+ if r is None:
+ if e:
+ raise Exception(disconnect_message)
+ else:
+ break
+ elif r:
+ y.append(r)
+ else:
+ time.sleep(max((x-time.time())/tr, 0))
+ return ''.join(y)
+
+# TODO(3.0: rewrite to use memoryview()
+def send_all(p, data):
+ while len(data):
+ sent = p.send(data)
+ if sent is None:
+ raise Exception(disconnect_message)
+ data = buffer(data, sent)
+
+
+
+try:
+ object
+except NameError:
+ class object:
+ pass
+
+
+
+class TestCmd(object):
+ """Class TestCmd
+ """
+
+ def __init__(self, description = None,
+ program = None,
+ interpreter = None,
+ workdir = None,
+ subdir = None,
+ verbose = None,
+ match = None,
+ diff = None,
+ combine = 0,
+ universal_newlines = 1):
+ self._cwd = os.getcwd()
+ self.description_set(description)
+ self.program_set(program)
+ self.interpreter_set(interpreter)
+ if verbose is None:
+ try:
+ verbose = max( 0, int(os.environ.get('TESTCMD_VERBOSE', 0)) )
+ except ValueError:
+ verbose = 0
+ self.verbose_set(verbose)
+ self.combine = combine
+ self.universal_newlines = universal_newlines
+ if not match is None:
+ self.match_function = match
+ else:
+ self.match_function = match_re
+ if not diff is None:
+ self.diff_function = diff
+ else:
+ try:
+ difflib
+ except NameError:
+ pass
+ else:
+ self.diff_function = simple_diff
+ #self.diff_function = difflib.context_diff
+ #self.diff_function = difflib.unified_diff
+ self._dirlist = []
+ self._preserve = {'pass_test': 0, 'fail_test': 0, 'no_result': 0}
+ if os.environ.has_key('PRESERVE') and not os.environ['PRESERVE'] is '':
+ self._preserve['pass_test'] = os.environ['PRESERVE']
+ self._preserve['fail_test'] = os.environ['PRESERVE']
+ self._preserve['no_result'] = os.environ['PRESERVE']
+ else:
+ try:
+ self._preserve['pass_test'] = os.environ['PRESERVE_PASS']
+ except KeyError:
+ pass
+ try:
+ self._preserve['fail_test'] = os.environ['PRESERVE_FAIL']
+ except KeyError:
+ pass
+ try:
+ self._preserve['no_result'] = os.environ['PRESERVE_NO_RESULT']
+ except KeyError:
+ pass
+ self._stdout = []
+ self._stderr = []
+ self.status = None
+ self.condition = 'no_result'
+ self.workdir_set(workdir)
+ self.subdir(subdir)
+
+ def __del__(self):
+ self.cleanup()
+
+ def __repr__(self):
+ return "%x" % id(self)
+
+ banner_char = '='
+ banner_width = 80
+
+ def banner(self, s, width=None):
+ if width is None:
+ width = self.banner_width
+ return s + self.banner_char * (width - len(s))
+
+ if os.name == 'posix':
+
+ def escape(self, arg):
+ "escape shell special characters"
+ slash = '\\'
+ special = '"$'
+
+ arg = string.replace(arg, slash, slash+slash)
+ for c in special:
+ arg = string.replace(arg, c, slash+c)
+
+ if re_space.search(arg):
+ arg = '"' + arg + '"'
+ return arg
+
+ else:
+
+ # Windows does not allow special characters in file names
+ # anyway, so no need for an escape function, we will just quote
+ # the arg.
+ def escape(self, arg):
+ if re_space.search(arg):
+ arg = '"' + arg + '"'
+ return arg
+
+ def canonicalize(self, path):
+ if is_List(path):
+ path = apply(os.path.join, tuple(path))
+ if not os.path.isabs(path):
+ path = os.path.join(self.workdir, path)
+ return path
+
+ def chmod(self, path, mode):
+ """Changes permissions on the specified file or directory
+ path name."""
+ path = self.canonicalize(path)
+ os.chmod(path, mode)
+
+ def cleanup(self, condition = None):
+ """Removes any temporary working directories for the specified
+ TestCmd environment. If the environment variable PRESERVE was
+ set when the TestCmd environment was created, temporary working
+ directories are not removed. If any of the environment variables
+ PRESERVE_PASS, PRESERVE_FAIL, or PRESERVE_NO_RESULT were set
+ when the TestCmd environment was created, then temporary working
+ directories are not removed if the test passed, failed, or had
+ no result, respectively. Temporary working directories are also
+ preserved for conditions specified via the preserve method.
+
+ Typically, this method is not called directly, but is used when
+ the script exits to clean up temporary working directories as
+ appropriate for the exit status.
+ """
+ if not self._dirlist:
+ return
+ os.chdir(self._cwd)
+ self.workdir = None
+ if condition is None:
+ condition = self.condition
+ if self._preserve[condition]:
+ for dir in self._dirlist:
+ print "Preserved directory", dir
+ else:
+ list = self._dirlist[:]
+ list.reverse()
+ for dir in list:
+ self.writable(dir, 1)
+ shutil.rmtree(dir, ignore_errors = 1)
+ self._dirlist = []
+
+ try:
+ global _Cleanup
+ _Cleanup.remove(self)
+ except (AttributeError, ValueError):
+ pass
+
+ def command_args(self, program = None,
+ interpreter = None,
+ arguments = None):
+ if program:
+ if type(program) == type('') and not os.path.isabs(program):
+ program = os.path.join(self._cwd, program)
+ else:
+ program = self.program
+ if not interpreter:
+ interpreter = self.interpreter
+ if not type(program) in [type([]), type(())]:
+ program = [program]
+ cmd = list(program)
+ if interpreter:
+ if not type(interpreter) in [type([]), type(())]:
+ interpreter = [interpreter]
+ cmd = list(interpreter) + cmd
+ if arguments:
+ if type(arguments) == type(''):
+ arguments = string.split(arguments)
+ cmd.extend(arguments)
+ return cmd
+
+ def description_set(self, description):
+ """Set the description of the functionality being tested.
+ """
+ self.description = description
+
+ try:
+ difflib
+ except NameError:
+ def diff(self, a, b, name, *args, **kw):
+ print self.banner('Expected %s' % name)
+ print a
+ print self.banner('Actual %s' % name)
+ print b
+ else:
+ def diff(self, a, b, name, *args, **kw):
+ print self.banner(name)
+ args = (a.splitlines(), b.splitlines()) + args
+ lines = apply(self.diff_function, args, kw)
+ for l in lines:
+ print l
+
+ def fail_test(self, condition = 1, function = None, skip = 0):
+ """Cause the test to fail.
+ """
+ if not condition:
+ return
+ self.condition = 'fail_test'
+ fail_test(self = self,
+ condition = condition,
+ function = function,
+ skip = skip)
+
+ def interpreter_set(self, interpreter):
+ """Set the program to be used to interpret the program
+ under test as a script.
+ """
+ self.interpreter = interpreter
+
+ def match(self, lines, matches):
+ """Compare actual and expected file contents.
+ """
+ return self.match_function(lines, matches)
+
+ def match_exact(self, lines, matches):
+ """Compare actual and expected file contents.
+ """
+ return match_exact(lines, matches)
+
+ def match_re(self, lines, res):
+ """Compare actual and expected file contents.
+ """
+ return match_re(lines, res)
+
+ def match_re_dotall(self, lines, res):
+ """Compare actual and expected file contents.
+ """
+ return match_re_dotall(lines, res)
+
+ def no_result(self, condition = 1, function = None, skip = 0):
+ """Report that the test could not be run.
+ """
+ if not condition:
+ return
+ self.condition = 'no_result'
+ no_result(self = self,
+ condition = condition,
+ function = function,
+ skip = skip)
+
+ def pass_test(self, condition = 1, function = None):
+ """Cause the test to pass.
+ """
+ if not condition:
+ return
+ self.condition = 'pass_test'
+ pass_test(self = self, condition = condition, function = function)
+
+ def preserve(self, *conditions):
+ """Arrange for the temporary working directories for the
+ specified TestCmd environment to be preserved for one or more
+ conditions. If no conditions are specified, arranges for
+ the temporary working directories to be preserved for all
+ conditions.
+ """
+ if conditions is ():
+ conditions = ('pass_test', 'fail_test', 'no_result')
+ for cond in conditions:
+ self._preserve[cond] = 1
+
+ def program_set(self, program):
+ """Set the executable program or script to be tested.
+ """
+ if program and not os.path.isabs(program):
+ program = os.path.join(self._cwd, program)
+ self.program = program
+
+ def read(self, file, mode = 'rb'):
+ """Reads and returns the contents of the specified file name.
+ The file name may be a list, in which case the elements are
+ concatenated with the os.path.join() method. The file is
+ assumed to be under the temporary working directory unless it
+ is an absolute path name. The I/O mode for the file may
+ be specified; it must begin with an 'r'. The default is
+ 'rb' (binary read).
+ """
+ file = self.canonicalize(file)
+ if mode[0] != 'r':
+ raise ValueError, "mode must begin with 'r'"
+ return open(file, mode).read()
+
+ def rmdir(self, dir):
+ """Removes the specified dir name.
+ The dir name may be a list, in which case the elements are
+ concatenated with the os.path.join() method. The dir is
+ assumed to be under the temporary working directory unless it
+ is an absolute path name.
+ The dir must be empty.
+ """
+ dir = self.canonicalize(dir)
+ os.rmdir(dir)
+
+ def start(self, program = None,
+ interpreter = None,
+ arguments = None,
+ universal_newlines = None,
+ **kw):
+ """
+ Starts a program or script for the test environment.
+
+ The specified program will have the original directory
+ prepended unless it is enclosed in a [list].
+ """
+ cmd = self.command_args(program, interpreter, arguments)
+ cmd_string = string.join(map(self.escape, cmd), ' ')
+ if self.verbose:
+ sys.stderr.write(cmd_string + "\n")
+ if universal_newlines is None:
+ universal_newlines = self.universal_newlines
+
+ # On Windows, if we make stdin a pipe when we plan to send
+ # no input, and the test program exits before
+ # Popen calls msvcrt.open_osfhandle, that call will fail.
+ # So don't use a pipe for stdin if we don't need one.
+ stdin = kw.get('stdin', None)
+ if stdin is not None:
+ stdin = subprocess.PIPE
+
+ combine = kw.get('combine', self.combine)
+ if combine:
+ stderr_value = subprocess.STDOUT
+ else:
+ stderr_value = subprocess.PIPE
+
+ return Popen(cmd,
+ stdin=stdin,
+ stdout=subprocess.PIPE,
+ stderr=stderr_value,
+ universal_newlines=universal_newlines)
+
+ def finish(self, popen, **kw):
+ """
+ Finishes and waits for the process being run under control of
+ the specified popen argument, recording the exit status,
+ standard output and error output.
+ """
+ popen.stdin.close()
+ self.status = popen.wait()
+ if not self.status:
+ self.status = 0
+ self._stdout.append(popen.stdout.read())
+ if popen.stderr:
+ stderr = popen.stderr.read()
+ else:
+ stderr = ''
+ self._stderr.append(stderr)
+
+ def run(self, program = None,
+ interpreter = None,
+ arguments = None,
+ chdir = None,
+ stdin = None,
+ universal_newlines = None):
+ """Runs a test of the program or script for the test
+ environment. Standard output and error output are saved for
+ future retrieval via the stdout() and stderr() methods.
+
+ The specified program will have the original directory
+ prepended unless it is enclosed in a [list].
+ """
+ if chdir:
+ oldcwd = os.getcwd()
+ if not os.path.isabs(chdir):
+ chdir = os.path.join(self.workpath(chdir))
+ if self.verbose:
+ sys.stderr.write("chdir(" + chdir + ")\n")
+ os.chdir(chdir)
+ p = self.start(program,
+ interpreter,
+ arguments,
+ universal_newlines,
+ stdin=stdin)
+ if stdin:
+ if is_List(stdin):
+ for line in stdin:
+ p.stdin.write(line)
+ else:
+ p.stdin.write(stdin)
+ p.stdin.close()
+
+ out = p.stdout.read()
+ if p.stderr is None:
+ err = ''
+ else:
+ err = p.stderr.read()
+ try:
+ close_output = p.close_output
+ except AttributeError:
+ p.stdout.close()
+ if not p.stderr is None:
+ p.stderr.close()
+ else:
+ close_output()
+
+ self._stdout.append(out)
+ self._stderr.append(err)
+
+ self.status = p.wait()
+ if not self.status:
+ self.status = 0
+
+ if chdir:
+ os.chdir(oldcwd)
+ if self.verbose >= 2:
+ write = sys.stdout.write
+ write('============ STATUS: %d\n' % self.status)
+ out = self.stdout()
+ if out or self.verbose >= 3:
+ write('============ BEGIN STDOUT (len=%d):\n' % len(out))
+ write(out)
+ write('============ END STDOUT\n')
+ err = self.stderr()
+ if err or self.verbose >= 3:
+ write('============ BEGIN STDERR (len=%d)\n' % len(err))
+ write(err)
+ write('============ END STDERR\n')
+
+ def sleep(self, seconds = default_sleep_seconds):
+ """Sleeps at least the specified number of seconds. If no
+ number is specified, sleeps at least the minimum number of
+ seconds necessary to advance file time stamps on the current
+ system. Sleeping more seconds is all right.
+ """
+ time.sleep(seconds)
+
+ def stderr(self, run = None):
+ """Returns the error output from the specified run number.
+ If there is no specified run number, then returns the error
+ output of the last run. If the run number is less than zero,
+ then returns the error output from that many runs back from the
+ current run.
+ """
+ if not run:
+ run = len(self._stderr)
+ elif run < 0:
+ run = len(self._stderr) + run
+ run = run - 1
+ return self._stderr[run]
+
+ def stdout(self, run = None):
+ """Returns the standard output from the specified run number.
+ If there is no specified run number, then returns the standard
+ output of the last run. If the run number is less than zero,
+ then returns the standard output from that many runs back from
+ the current run.
+ """
+ if not run:
+ run = len(self._stdout)
+ elif run < 0:
+ run = len(self._stdout) + run
+ run = run - 1
+ return self._stdout[run]
+
+ def subdir(self, *subdirs):
+ """Create new subdirectories under the temporary working
+ directory, one for each argument. An argument may be a list,
+ in which case the list elements are concatenated using the
+ os.path.join() method. Subdirectories multiple levels deep
+ must be created using a separate argument for each level:
+
+ test.subdir('sub', ['sub', 'dir'], ['sub', 'dir', 'ectory'])
+
+ Returns the number of subdirectories actually created.
+ """
+ count = 0
+ for sub in subdirs:
+ if sub is None:
+ continue
+ if is_List(sub):
+ sub = apply(os.path.join, tuple(sub))
+ new = os.path.join(self.workdir, sub)
+ try:
+ os.mkdir(new)
+ except OSError:
+ pass
+ else:
+ count = count + 1
+ return count
+
+ def symlink(self, target, link):
+ """Creates a symlink to the specified target.
+ The link name may be a list, in which case the elements are
+ concatenated with the os.path.join() method. The link is
+ assumed to be under the temporary working directory unless it
+ is an absolute path name. The target is *not* assumed to be
+ under the temporary working directory.
+ """
+ link = self.canonicalize(link)
+ os.symlink(target, link)
+
+ def tempdir(self, path=None):
+ """Creates a temporary directory.
+ A unique directory name is generated if no path name is specified.
+ The directory is created, and will be removed when the TestCmd
+ object is destroyed.
+ """
+ if path is None:
+ try:
+ path = tempfile.mktemp(prefix=tempfile.template)
+ except TypeError:
+ path = tempfile.mktemp()
+ os.mkdir(path)
+
+ # Symlinks in the path will report things
+ # differently from os.getcwd(), so chdir there
+ # and back to fetch the canonical path.
+ cwd = os.getcwd()
+ try:
+ os.chdir(path)
+ path = os.getcwd()
+ finally:
+ os.chdir(cwd)
+
+ # Uppercase the drive letter since the case of drive
+ # letters is pretty much random on win32:
+ drive,rest = os.path.splitdrive(path)
+ if drive:
+ path = string.upper(drive) + rest
+
+ #
+ self._dirlist.append(path)
+ global _Cleanup
+ try:
+ _Cleanup.index(self)
+ except ValueError:
+ _Cleanup.append(self)
+
+ return path
+
+ def touch(self, path, mtime=None):
+ """Updates the modification time on the specified file or
+ directory path name. The default is to update to the
+ current time if no explicit modification time is specified.
+ """
+ path = self.canonicalize(path)
+ atime = os.path.getatime(path)
+ if mtime is None:
+ mtime = time.time()
+ os.utime(path, (atime, mtime))
+
+ def unlink(self, file):
+ """Unlinks the specified file name.
+ The file name may be a list, in which case the elements are
+ concatenated with the os.path.join() method. The file is
+ assumed to be under the temporary working directory unless it
+ is an absolute path name.
+ """
+ file = self.canonicalize(file)
+ os.unlink(file)
+
+ def verbose_set(self, verbose):
+ """Set the verbose level.
+ """
+ self.verbose = verbose
+
+ def where_is(self, file, path=None, pathext=None):
+ """Find an executable file.
+ """
+ if is_List(file):
+ file = apply(os.path.join, tuple(file))
+ if not os.path.isabs(file):
+ file = where_is(file, path, pathext)
+ return file
+
+ def workdir_set(self, path):
+ """Creates a temporary working directory with the specified
+ path name. If the path is a null string (''), a unique
+ directory name is created.
+ """
+ if (path != None):
+ if path == '':
+ path = None
+ path = self.tempdir(path)
+ self.workdir = path
+
+ def workpath(self, *args):
+ """Returns the absolute path name to a subdirectory or file
+ within the current temporary working directory. Concatenates
+ the temporary working directory name with the specified
+ arguments using the os.path.join() method.
+ """
+ return apply(os.path.join, (self.workdir,) + tuple(args))
+
+ def readable(self, top, read=1):
+ """Make the specified directory tree readable (read == 1)
+ or not (read == None).
+
+ This method has no effect on Windows systems, which use a
+ completely different mechanism to control file readability.
+ """
+
+ if sys.platform == 'win32':
+ return
+
+ if read:
+ def do_chmod(fname):
+ try: st = os.stat(fname)
+ except OSError: pass
+ else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|stat.S_IREAD))
+ else:
+ def do_chmod(fname):
+ try: st = os.stat(fname)
+ except OSError: pass
+ else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~stat.S_IREAD))
+
+ if os.path.isfile(top):
+ # If it's a file, that's easy, just chmod it.
+ do_chmod(top)
+ elif read:
+ # It's a directory and we're trying to turn on read
+ # permission, so it's also pretty easy, just chmod the
+ # directory and then chmod every entry on our walk down the
+ # tree. Because os.path.walk() is top-down, we'll enable
+ # read permission on any directories that have it disabled
+ # before os.path.walk() tries to list their contents.
+ do_chmod(top)
+
+ def chmod_entries(arg, dirname, names, do_chmod=do_chmod):
+ for n in names:
+ do_chmod(os.path.join(dirname, n))
+
+ os.path.walk(top, chmod_entries, None)
+ else:
+ # It's a directory and we're trying to turn off read
+ # permission, which means we have to chmod the directoreis
+ # in the tree bottom-up, lest disabling read permission from
+ # the top down get in the way of being able to get at lower
+ # parts of the tree. But os.path.walk() visits things top
+ # down, so we just use an object to collect a list of all
+ # of the entries in the tree, reverse the list, and then
+ # chmod the reversed (bottom-up) list.
+ col = Collector(top)
+ os.path.walk(top, col, None)
+ col.entries.reverse()
+ for d in col.entries: do_chmod(d)
+
+ def writable(self, top, write=1):
+ """Make the specified directory tree writable (write == 1)
+ or not (write == None).
+ """
+
+ if sys.platform == 'win32':
+
+ if write:
+ def do_chmod(fname):
+ try: os.chmod(fname, stat.S_IWRITE)
+ except OSError: pass
+ else:
+ def do_chmod(fname):
+ try: os.chmod(fname, stat.S_IREAD)
+ except OSError: pass
+
+ else:
+
+ if write:
+ def do_chmod(fname):
+ try: st = os.stat(fname)
+ except OSError: pass
+ else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|0200))
+ else:
+ def do_chmod(fname):
+ try: st = os.stat(fname)
+ except OSError: pass
+ else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~0200))
+
+ if os.path.isfile(top):
+ do_chmod(top)
+ else:
+ col = Collector(top)
+ os.path.walk(top, col, None)
+ for d in col.entries: do_chmod(d)
+
+ def executable(self, top, execute=1):
+ """Make the specified directory tree executable (execute == 1)
+ or not (execute == None).
+
+ This method has no effect on Windows systems, which use a
+ completely different mechanism to control file executability.
+ """
+
+ if sys.platform == 'win32':
+ return
+
+ if execute:
+ def do_chmod(fname):
+ try: st = os.stat(fname)
+ except OSError: pass
+ else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|stat.S_IEXEC))
+ else:
+ def do_chmod(fname):
+ try: st = os.stat(fname)
+ except OSError: pass
+ else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~stat.S_IEXEC))
+
+ if os.path.isfile(top):
+ # If it's a file, that's easy, just chmod it.
+ do_chmod(top)
+ elif execute:
+ # It's a directory and we're trying to turn on execute
+ # permission, so it's also pretty easy, just chmod the
+ # directory and then chmod every entry on our walk down the
+ # tree. Because os.path.walk() is top-down, we'll enable
+ # execute permission on any directories that have it disabled
+ # before os.path.walk() tries to list their contents.
+ do_chmod(top)
+
+ def chmod_entries(arg, dirname, names, do_chmod=do_chmod):
+ for n in names:
+ do_chmod(os.path.join(dirname, n))
+
+ os.path.walk(top, chmod_entries, None)
+ else:
+ # It's a directory and we're trying to turn off execute
+ # permission, which means we have to chmod the directories
+ # in the tree bottom-up, lest disabling execute permission from
+ # the top down get in the way of being able to get at lower
+ # parts of the tree. But os.path.walk() visits things top
+ # down, so we just use an object to collect a list of all
+ # of the entries in the tree, reverse the list, and then
+ # chmod the reversed (bottom-up) list.
+ col = Collector(top)
+ os.path.walk(top, col, None)
+ col.entries.reverse()
+ for d in col.entries: do_chmod(d)
+
+ def write(self, file, content, mode = 'wb'):
+ """Writes the specified content text (second argument) to the
+ specified file name (first argument). The file name may be
+ a list, in which case the elements are concatenated with the
+ os.path.join() method. The file is created under the temporary
+ working directory. Any subdirectories in the path must already
+ exist. The I/O mode for the file may be specified; it must
+ begin with a 'w'. The default is 'wb' (binary write).
+ """
+ file = self.canonicalize(file)
+ if mode[0] != 'w':
+ raise ValueError, "mode must begin with 'w'"
+ open(file, mode).write(content)
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCommon.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCommon.py
new file mode 100644
index 0000000..4aa7185
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestCommon.py
@@ -0,0 +1,581 @@
+"""
+TestCommon.py: a testing framework for commands and scripts
+ with commonly useful error handling
+
+The TestCommon module provides a simple, high-level interface for writing
+tests of executable commands and scripts, especially commands and scripts
+that interact with the file system. All methods throw exceptions and
+exit on failure, with useful error messages. This makes a number of
+explicit checks unnecessary, making the test scripts themselves simpler
+to write and easier to read.
+
+The TestCommon class is a subclass of the TestCmd class. In essence,
+TestCommon is a wrapper that handles common TestCmd error conditions in
+useful ways. You can use TestCommon directly, or subclass it for your
+program and add additional (or override) methods to tailor it to your
+program's specific needs. Alternatively, the TestCommon class serves
+as a useful example of how to define your own TestCmd subclass.
+
+As a subclass of TestCmd, TestCommon provides access to all of the
+variables and methods from the TestCmd module. Consequently, you can
+use any variable or method documented in the TestCmd module without
+having to explicitly import TestCmd.
+
+A TestCommon environment object is created via the usual invocation:
+
+ import TestCommon
+ test = TestCommon.TestCommon()
+
+You can use all of the TestCmd keyword arguments when instantiating a
+TestCommon object; see the TestCmd documentation for details.
+
+Here is an overview of the methods and keyword arguments that are
+provided by the TestCommon class:
+
+ test.must_be_writable('file1', ['file2', ...])
+
+ test.must_contain('file', 'required text\n')
+
+ test.must_contain_all_lines(output, lines, ['title', find])
+
+ test.must_contain_any_line(output, lines, ['title', find])
+
+ test.must_exist('file1', ['file2', ...])
+
+ test.must_match('file', "expected contents\n")
+
+ test.must_not_be_writable('file1', ['file2', ...])
+
+ test.must_not_contain('file', 'banned text\n')
+
+ test.must_not_contain_any_line(output, lines, ['title', find])
+
+ test.must_not_exist('file1', ['file2', ...])
+
+ test.run(options = "options to be prepended to arguments",
+ stdout = "expected standard output from the program",
+ stderr = "expected error output from the program",
+ status = expected_status,
+ match = match_function)
+
+The TestCommon module also provides the following variables
+
+ TestCommon.python_executable
+ TestCommon.exe_suffix
+ TestCommon.obj_suffix
+ TestCommon.shobj_prefix
+ TestCommon.shobj_suffix
+ TestCommon.lib_prefix
+ TestCommon.lib_suffix
+ TestCommon.dll_prefix
+ TestCommon.dll_suffix
+
+"""
+
+# Copyright 2000-2010 Steven Knight
+# This module is free software, and you may redistribute it and/or modify
+# it under the same terms as Python itself, so long as this copyright message
+# and disclaimer are retained in their original form.
+#
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+# THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+# DAMAGE.
+#
+# THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,
+# AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
+# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+__author__ = "Steven Knight <knight at baldmt dot com>"
+__revision__ = "TestCommon.py 0.37.D001 2010/01/11 16:55:50 knight"
+__version__ = "0.37"
+
+import copy
+import os
+import os.path
+import stat
+import string
+import sys
+import types
+import UserList
+
+from TestCmd import *
+from TestCmd import __all__
+
+__all__.extend([ 'TestCommon',
+ 'exe_suffix',
+ 'obj_suffix',
+ 'shobj_prefix',
+ 'shobj_suffix',
+ 'lib_prefix',
+ 'lib_suffix',
+ 'dll_prefix',
+ 'dll_suffix',
+ ])
+
+# Variables that describe the prefixes and suffixes on this system.
+if sys.platform == 'win32':
+ exe_suffix = '.exe'
+ obj_suffix = '.obj'
+ shobj_suffix = '.obj'
+ shobj_prefix = ''
+ lib_prefix = ''
+ lib_suffix = '.lib'
+ dll_prefix = ''
+ dll_suffix = '.dll'
+elif sys.platform == 'cygwin':
+ exe_suffix = '.exe'
+ obj_suffix = '.o'
+ shobj_suffix = '.os'
+ shobj_prefix = ''
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = ''
+ dll_suffix = '.dll'
+elif string.find(sys.platform, 'irix') != -1:
+ exe_suffix = ''
+ obj_suffix = '.o'
+ shobj_suffix = '.o'
+ shobj_prefix = ''
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = 'lib'
+ dll_suffix = '.so'
+elif string.find(sys.platform, 'darwin') != -1:
+ exe_suffix = ''
+ obj_suffix = '.o'
+ shobj_suffix = '.os'
+ shobj_prefix = ''
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = 'lib'
+ dll_suffix = '.dylib'
+elif string.find(sys.platform, 'sunos') != -1:
+ exe_suffix = ''
+ obj_suffix = '.o'
+ shobj_suffix = '.os'
+ shobj_prefix = 'so_'
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = 'lib'
+ dll_suffix = '.dylib'
+else:
+ exe_suffix = ''
+ obj_suffix = '.o'
+ shobj_suffix = '.os'
+ shobj_prefix = ''
+ lib_prefix = 'lib'
+ lib_suffix = '.a'
+ dll_prefix = 'lib'
+ dll_suffix = '.so'
+
+def is_List(e):
+ return type(e) is types.ListType \
+ or isinstance(e, UserList.UserList)
+
+def is_writable(f):
+ mode = os.stat(f)[stat.ST_MODE]
+ return mode & stat.S_IWUSR
+
+def separate_files(flist):
+ existing = []
+ missing = []
+ for f in flist:
+ if os.path.exists(f):
+ existing.append(f)
+ else:
+ missing.append(f)
+ return existing, missing
+
+if os.name == 'posix':
+ def _failed(self, status = 0):
+ if self.status is None or status is None:
+ return None
+ return _status(self) != status
+ def _status(self):
+ return self.status
+elif os.name == 'nt':
+ def _failed(self, status = 0):
+ return not (self.status is None or status is None) and \
+ self.status != status
+ def _status(self):
+ return self.status
+
+class TestCommon(TestCmd):
+
+ # Additional methods from the Perl Test::Cmd::Common module
+ # that we may wish to add in the future:
+ #
+ # $test->subdir('subdir', ...);
+ #
+ # $test->copy('src_file', 'dst_file');
+
+ def __init__(self, **kw):
+ """Initialize a new TestCommon instance. This involves just
+ calling the base class initialization, and then changing directory
+ to the workdir.
+ """
+ apply(TestCmd.__init__, [self], kw)
+ os.chdir(self.workdir)
+
+ def must_be_writable(self, *files):
+ """Ensures that the specified file(s) exist and are writable.
+ An individual file can be specified as a list of directory names,
+ in which case the pathname will be constructed by concatenating
+ them. Exits FAILED if any of the files does not exist or is
+ not writable.
+ """
+ files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files)
+ existing, missing = separate_files(files)
+ unwritable = filter(lambda x, iw=is_writable: not iw(x), existing)
+ if missing:
+ print "Missing files: `%s'" % string.join(missing, "', `")
+ if unwritable:
+ print "Unwritable files: `%s'" % string.join(unwritable, "', `")
+ self.fail_test(missing + unwritable)
+
+ def must_contain(self, file, required, mode = 'rb'):
+ """Ensures that the specified file contains the required text.
+ """
+ file_contents = self.read(file, mode)
+ contains = (string.find(file_contents, required) != -1)
+ if not contains:
+ print "File `%s' does not contain required string." % file
+ print self.banner('Required string ')
+ print required
+ print self.banner('%s contents ' % file)
+ print file_contents
+ self.fail_test(not contains)
+
+ def must_contain_all_lines(self, output, lines, title=None, find=None):
+ """Ensures that the specified output string (first argument)
+ contains all of the specified lines (second argument).
+
+ An optional third argument can be used to describe the type
+ of output being searched, and only shows up in failure output.
+
+ An optional fourth argument can be used to supply a different
+ function, of the form "find(line, output), to use when searching
+ for lines in the output.
+ """
+ if find is None:
+ find = lambda o, l: string.find(o, l) != -1
+ missing = []
+ for line in lines:
+ if not find(output, line):
+ missing.append(line)
+
+ if missing:
+ if title is None:
+ title = 'output'
+ sys.stdout.write("Missing expected lines from %s:\n" % title)
+ for line in missing:
+ sys.stdout.write(' ' + repr(line) + '\n')
+ sys.stdout.write(self.banner(title + ' '))
+ sys.stdout.write(output)
+ self.fail_test()
+
+ def must_contain_any_line(self, output, lines, title=None, find=None):
+ """Ensures that the specified output string (first argument)
+ contains at least one of the specified lines (second argument).
+
+ An optional third argument can be used to describe the type
+ of output being searched, and only shows up in failure output.
+
+ An optional fourth argument can be used to supply a different
+ function, of the form "find(line, output), to use when searching
+ for lines in the output.
+ """
+ if find is None:
+ find = lambda o, l: string.find(o, l) != -1
+ for line in lines:
+ if find(output, line):
+ return
+
+ if title is None:
+ title = 'output'
+ sys.stdout.write("Missing any expected line from %s:\n" % title)
+ for line in lines:
+ sys.stdout.write(' ' + repr(line) + '\n')
+ sys.stdout.write(self.banner(title + ' '))
+ sys.stdout.write(output)
+ self.fail_test()
+
+ def must_contain_lines(self, lines, output, title=None):
+ # Deprecated; retain for backwards compatibility.
+ return self.must_contain_all_lines(output, lines, title)
+
+ def must_exist(self, *files):
+ """Ensures that the specified file(s) must exist. An individual
+ file be specified as a list of directory names, in which case the
+ pathname will be constructed by concatenating them. Exits FAILED
+ if any of the files does not exist.
+ """
+ files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files)
+ missing = filter(lambda x: not os.path.exists(x), files)
+ if missing:
+ print "Missing files: `%s'" % string.join(missing, "', `")
+ self.fail_test(missing)
+
+ def must_match(self, file, expect, mode = 'rb'):
+ """Matches the contents of the specified file (first argument)
+ against the expected contents (second argument). The expected
+ contents are a list of lines or a string which will be split
+ on newlines.
+ """
+ file_contents = self.read(file, mode)
+ try:
+ self.fail_test(not self.match(file_contents, expect))
+ except KeyboardInterrupt:
+ raise
+ except:
+ print "Unexpected contents of `%s'" % file
+ self.diff(expect, file_contents, 'contents ')
+ raise
+
+ def must_not_contain(self, file, banned, mode = 'rb'):
+ """Ensures that the specified file doesn't contain the banned text.
+ """
+ file_contents = self.read(file, mode)
+ contains = (string.find(file_contents, banned) != -1)
+ if contains:
+ print "File `%s' contains banned string." % file
+ print self.banner('Banned string ')
+ print banned
+ print self.banner('%s contents ' % file)
+ print file_contents
+ self.fail_test(contains)
+
+ def must_not_contain_any_line(self, output, lines, title=None, find=None):
+ """Ensures that the specified output string (first argument)
+ does not contain any of the specified lines (second argument).
+
+ An optional third argument can be used to describe the type
+ of output being searched, and only shows up in failure output.
+
+ An optional fourth argument can be used to supply a different
+ function, of the form "find(line, output), to use when searching
+ for lines in the output.
+ """
+ if find is None:
+ find = lambda o, l: string.find(o, l) != -1
+ unexpected = []
+ for line in lines:
+ if find(output, line):
+ unexpected.append(line)
+
+ if unexpected:
+ if title is None:
+ title = 'output'
+ sys.stdout.write("Unexpected lines in %s:\n" % title)
+ for line in unexpected:
+ sys.stdout.write(' ' + repr(line) + '\n')
+ sys.stdout.write(self.banner(title + ' '))
+ sys.stdout.write(output)
+ self.fail_test()
+
+ def must_not_contain_lines(self, lines, output, title=None):
+ return self.must_not_contain_any_line(output, lines, title)
+
+ def must_not_exist(self, *files):
+ """Ensures that the specified file(s) must not exist.
+ An individual file be specified as a list of directory names, in
+ which case the pathname will be constructed by concatenating them.
+ Exits FAILED if any of the files exists.
+ """
+ files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files)
+ existing = filter(os.path.exists, files)
+ if existing:
+ print "Unexpected files exist: `%s'" % string.join(existing, "', `")
+ self.fail_test(existing)
+
+
+ def must_not_be_writable(self, *files):
+ """Ensures that the specified file(s) exist and are not writable.
+ An individual file can be specified as a list of directory names,
+ in which case the pathname will be constructed by concatenating
+ them. Exits FAILED if any of the files does not exist or is
+ writable.
+ """
+ files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files)
+ existing, missing = separate_files(files)
+ writable = filter(is_writable, existing)
+ if missing:
+ print "Missing files: `%s'" % string.join(missing, "', `")
+ if writable:
+ print "Writable files: `%s'" % string.join(writable, "', `")
+ self.fail_test(missing + writable)
+
+ def _complete(self, actual_stdout, expected_stdout,
+ actual_stderr, expected_stderr, status, match):
+ """
+ Post-processes running a subcommand, checking for failure
+ status and displaying output appropriately.
+ """
+ if _failed(self, status):
+ expect = ''
+ if status != 0:
+ expect = " (expected %s)" % str(status)
+ print "%s returned %s%s" % (self.program, str(_status(self)), expect)
+ print self.banner('STDOUT ')
+ print actual_stdout
+ print self.banner('STDERR ')
+ print actual_stderr
+ self.fail_test()
+ if not expected_stdout is None and not match(actual_stdout, expected_stdout):
+ self.diff(expected_stdout, actual_stdout, 'STDOUT ')
+ if actual_stderr:
+ print self.banner('STDERR ')
+ print actual_stderr
+ self.fail_test()
+ if not expected_stderr is None and not match(actual_stderr, expected_stderr):
+ print self.banner('STDOUT ')
+ print actual_stdout
+ self.diff(expected_stderr, actual_stderr, 'STDERR ')
+ self.fail_test()
+
+ def start(self, program = None,
+ interpreter = None,
+ arguments = None,
+ universal_newlines = None,
+ **kw):
+ """
+ Starts a program or script for the test environment.
+
+ This handles the "options" keyword argument and exceptions.
+ """
+ try:
+ options = kw['options']
+ del kw['options']
+ except KeyError:
+ pass
+ else:
+ if options:
+ if arguments is None:
+ arguments = options
+ else:
+ arguments = options + " " + arguments
+ try:
+ return apply(TestCmd.start,
+ (self, program, interpreter, arguments, universal_newlines),
+ kw)
+ except KeyboardInterrupt:
+ raise
+ except Exception, e:
+ print self.banner('STDOUT ')
+ try:
+ print self.stdout()
+ except IndexError:
+ pass
+ print self.banner('STDERR ')
+ try:
+ print self.stderr()
+ except IndexError:
+ pass
+ cmd_args = self.command_args(program, interpreter, arguments)
+ sys.stderr.write('Exception trying to execute: %s\n' % cmd_args)
+ raise e
+
+ def finish(self, popen, stdout = None, stderr = '', status = 0, **kw):
+ """
+ Finishes and waits for the process being run under control of
+ the specified popen argument. Additional arguments are similar
+ to those of the run() method:
+
+ stdout The expected standard output from
+ the command. A value of None means
+ don't test standard output.
+
+ stderr The expected error output from
+ the command. A value of None means
+ don't test error output.
+
+ status The expected exit status from the
+ command. A value of None means don't
+ test exit status.
+ """
+ apply(TestCmd.finish, (self, popen,), kw)
+ match = kw.get('match', self.match)
+ self._complete(self.stdout(), stdout,
+ self.stderr(), stderr, status, match)
+
+ def run(self, options = None, arguments = None,
+ stdout = None, stderr = '', status = 0, **kw):
+ """Runs the program under test, checking that the test succeeded.
+
+ The arguments are the same as the base TestCmd.run() method,
+ with the addition of:
+
+ options Extra options that get appended to the beginning
+ of the arguments.
+
+ stdout The expected standard output from
+ the command. A value of None means
+ don't test standard output.
+
+ stderr The expected error output from
+ the command. A value of None means
+ don't test error output.
+
+ status The expected exit status from the
+ command. A value of None means don't
+ test exit status.
+
+ By default, this expects a successful exit (status = 0), does
+ not test standard output (stdout = None), and expects that error
+ output is empty (stderr = "").
+ """
+ if options:
+ if arguments is None:
+ arguments = options
+ else:
+ arguments = options + " " + arguments
+ kw['arguments'] = arguments
+ try:
+ match = kw['match']
+ del kw['match']
+ except KeyError:
+ match = self.match
+ apply(TestCmd.run, [self], kw)
+ self._complete(self.stdout(), stdout,
+ self.stderr(), stderr, status, match)
+
+ def skip_test(self, message="Skipping test.\n"):
+ """Skips a test.
+
+ Proper test-skipping behavior is dependent on the external
+ TESTCOMMON_PASS_SKIPS environment variable. If set, we treat
+ the skip as a PASS (exit 0), and otherwise treat it as NO RESULT.
+ In either case, we print the specified message as an indication
+ that the substance of the test was skipped.
+
+ (This was originally added to support development under Aegis.
+ Technically, skipping a test is a NO RESULT, but Aegis would
+ treat that as a test failure and prevent the change from going to
+ the next step. Since we ddn't want to force anyone using Aegis
+ to have to install absolutely every tool used by the tests, we
+ would actually report to Aegis that a skipped test has PASSED
+ so that the workflow isn't held up.)
+ """
+ if message:
+ sys.stdout.write(message)
+ sys.stdout.flush()
+ pass_skips = os.environ.get('TESTCOMMON_PASS_SKIPS')
+ if pass_skips in [None, 0, '0']:
+ # skip=1 means skip this function when showing where this
+ # result came from. They only care about the line where the
+ # script called test.skip_test(), not the line number where
+ # we call test.no_result().
+ self.no_result(skip=1)
+ else:
+ # We're under the development directory for this change,
+ # so this is an Aegis invocation; pass the test (exit 0).
+ self.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestGyp.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestGyp.py
new file mode 100644
index 0000000..23228d2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/lib/TestGyp.py
@@ -0,0 +1,724 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+TestGyp.py: a testing framework for GYP integration tests.
+"""
+
+import os
+import re
+import shutil
+import stat
+import sys
+
+import TestCommon
+from TestCommon import __all__
+
+__all__.extend([
+ 'TestGyp',
+])
+
+
+class TestGypBase(TestCommon.TestCommon):
+ """
+ Class for controlling end-to-end tests of gyp generators.
+
+ Instantiating this class will create a temporary directory and
+ arrange for its destruction (via the TestCmd superclass) and
+ copy all of the non-gyptest files in the directory hierarchy of the
+ executing script.
+
+ The default behavior is to test the 'gyp' or 'gyp.bat' file in the
+ current directory. An alternative may be specified explicitly on
+ instantiation, or by setting the TESTGYP_GYP environment variable.
+
+ This class should be subclassed for each supported gyp generator
+ (format). Various abstract methods below define calling signatures
+ used by the test scripts to invoke builds on the generated build
+ configuration and to run executables generated by those builds.
+ """
+
+ build_tool = None
+ build_tool_list = []
+
+ _exe = TestCommon.exe_suffix
+ _obj = TestCommon.obj_suffix
+ shobj_ = TestCommon.shobj_prefix
+ _shobj = TestCommon.shobj_suffix
+ lib_ = TestCommon.lib_prefix
+ _lib = TestCommon.lib_suffix
+ dll_ = TestCommon.dll_prefix
+ _dll = TestCommon.dll_suffix
+
+ # Constants to represent different targets.
+ ALL = '__all__'
+ DEFAULT = '__default__'
+
+ # Constants for different target types.
+ EXECUTABLE = '__executable__'
+ STATIC_LIB = '__static_lib__'
+ SHARED_LIB = '__shared_lib__'
+
+ def __init__(self, gyp=None, *args, **kw):
+ self.origin_cwd = os.path.abspath(os.path.dirname(sys.argv[0]))
+
+ if not gyp:
+ gyp = os.environ.get('TESTGYP_GYP')
+ if not gyp:
+ if sys.platform == 'win32':
+ gyp = 'gyp.bat'
+ else:
+ gyp = 'gyp'
+ self.gyp = os.path.abspath(gyp)
+
+ self.initialize_build_tool()
+
+ if not kw.has_key('match'):
+ kw['match'] = TestCommon.match_exact
+
+ if not kw.has_key('workdir'):
+ # Default behavior: the null string causes TestCmd to create
+ # a temporary directory for us.
+ kw['workdir'] = ''
+
+ formats = kw.get('formats', [])
+ if kw.has_key('formats'):
+ del kw['formats']
+
+ super(TestGypBase, self).__init__(*args, **kw)
+
+ excluded_formats = set([f for f in formats if f[0] == '!'])
+ included_formats = set(formats) - excluded_formats
+ if ('!'+self.format in excluded_formats or
+ included_formats and self.format not in included_formats):
+ msg = 'Invalid test for %r format; skipping test.\n'
+ self.skip_test(msg % self.format)
+
+ self.copy_test_configuration(self.origin_cwd, self.workdir)
+ self.set_configuration(None)
+
+ def built_file_must_exist(self, name, type=None, **kw):
+ """
+ Fails the test if the specified built file name does not exist.
+ """
+ return self.must_exist(self.built_file_path(name, type, **kw))
+
+ def built_file_must_not_exist(self, name, type=None, **kw):
+ """
+ Fails the test if the specified built file name exists.
+ """
+ return self.must_not_exist(self.built_file_path(name, type, **kw))
+
+ def built_file_must_match(self, name, contents, **kw):
+ """
+ Fails the test if the contents of the specified built file name
+ do not match the specified contents.
+ """
+ return self.must_match(self.built_file_path(name, **kw), contents)
+
+ def built_file_must_not_match(self, name, contents, **kw):
+ """
+ Fails the test if the contents of the specified built file name
+ match the specified contents.
+ """
+ return self.must_not_match(self.built_file_path(name, **kw), contents)
+
+ def copy_test_configuration(self, source_dir, dest_dir):
+ """
+ Copies the test configuration from the specified source_dir
+ (the directory in which the test script lives) to the
+ specified dest_dir (a temporary working directory).
+
+ This ignores all files and directories that begin with
+ the string 'gyptest', and all '.svn' subdirectories.
+ """
+ for root, dirs, files in os.walk(source_dir):
+ if '.svn' in dirs:
+ dirs.remove('.svn')
+ dirs = [ d for d in dirs if not d.startswith('gyptest') ]
+ files = [ f for f in files if not f.startswith('gyptest') ]
+ for dirname in dirs:
+ source = os.path.join(root, dirname)
+ destination = source.replace(source_dir, dest_dir)
+ os.mkdir(destination)
+ if sys.platform != 'win32':
+ shutil.copystat(source, destination)
+ for filename in files:
+ source = os.path.join(root, filename)
+ destination = source.replace(source_dir, dest_dir)
+ shutil.copy2(source, destination)
+
+ def initialize_build_tool(self):
+ """
+ Initializes the .build_tool attribute.
+
+ Searches the .build_tool_list for an executable name on the user's
+ $PATH. The first tool on the list is used as-is if nothing is found
+ on the current $PATH.
+ """
+ for build_tool in self.build_tool_list:
+ if not build_tool:
+ continue
+ if os.path.isabs(build_tool):
+ self.build_tool = build_tool
+ return
+ build_tool = self.where_is(build_tool)
+ if build_tool:
+ self.build_tool = build_tool
+ return
+
+ if self.build_tool_list:
+ self.build_tool = self.build_tool_list[0]
+
+ def relocate(self, source, destination):
+ """
+ Renames (relocates) the specified source (usually a directory)
+ to the specified destination, creating the destination directory
+ first if necessary.
+
+ Note: Don't use this as a generic "rename" operation. In the
+ future, "relocating" parts of a GYP tree may affect the state of
+ the test to modify the behavior of later method calls.
+ """
+ destination_dir = os.path.dirname(destination)
+ if not os.path.exists(destination_dir):
+ self.subdir(destination_dir)
+ os.rename(source, destination)
+
+ def report_not_up_to_date(self):
+ """
+ Reports that a build is not up-to-date.
+
+ This provides common reporting for formats that have complicated
+ conditions for checking whether a build is up-to-date. Formats
+ that expect exact output from the command (make, scons) can
+ just set stdout= when they call the run_build() method.
+ """
+ print "Build is not up-to-date:"
+ print self.banner('STDOUT ')
+ print self.stdout()
+ stderr = self.stderr()
+ if stderr:
+ print self.banner('STDERR ')
+ print stderr
+
+ def run_gyp(self, gyp_file, *args, **kw):
+ """
+ Runs gyp against the specified gyp_file with the specified args.
+ """
+ # TODO: --depth=. works around Chromium-specific tree climbing.
+ args = ('--depth=.', '--format='+self.format, gyp_file) + args
+ return self.run(program=self.gyp, arguments=args, **kw)
+
+ def run(self, *args, **kw):
+ """
+ Executes a program by calling the superclass .run() method.
+
+ This exists to provide a common place to filter out keyword
+ arguments implemented in this layer, without having to update
+ the tool-specific subclasses or clutter the tests themselves
+ with platform-specific code.
+ """
+ if kw.has_key('SYMROOT'):
+ del kw['SYMROOT']
+ super(TestGypBase, self).run(*args, **kw)
+
+ def set_configuration(self, configuration):
+ """
+ Sets the configuration, to be used for invoking the build
+ tool and testing potential built output.
+ """
+ self.configuration = configuration
+
+ def configuration_dirname(self):
+ if self.configuration:
+ return self.configuration.split('|')[0]
+ else:
+ return 'Default'
+
+ def configuration_buildname(self):
+ if self.configuration:
+ return self.configuration
+ else:
+ return 'Default'
+
+ #
+ # Abstract methods to be defined by format-specific subclasses.
+ #
+
+ def build(self, gyp_file, target=None, **kw):
+ """
+ Runs a build of the specified target against the configuration
+ generated from the specified gyp_file.
+
+ A 'target' argument of None or the special value TestGyp.DEFAULT
+ specifies the default argument for the underlying build tool.
+ A 'target' argument of TestGyp.ALL specifies the 'all' target
+ (if any) of the underlying build tool.
+ """
+ raise NotImplementedError
+
+ def built_file_path(self, name, type=None, **kw):
+ """
+ Returns a path to the specified file name, of the specified type.
+ """
+ raise NotImplementedError
+
+ def built_file_basename(self, name, type=None, **kw):
+ """
+ Returns the base name of the specified file name, of the specified type.
+
+ A bare=True keyword argument specifies that prefixes and suffixes shouldn't
+ be applied.
+ """
+ if not kw.get('bare'):
+ if type == self.EXECUTABLE:
+ name = name + self._exe
+ elif type == self.STATIC_LIB:
+ name = self.lib_ + name + self._lib
+ elif type == self.SHARED_LIB:
+ name = self.dll_ + name + self._dll
+ return name
+
+ def run_built_executable(self, name, *args, **kw):
+ """
+ Runs an executable program built from a gyp-generated configuration.
+
+ The specified name should be independent of any particular generator.
+ Subclasses should find the output executable in the appropriate
+ output build directory, tack on any necessary executable suffix, etc.
+ """
+ raise NotImplementedError
+
+ def up_to_date(self, gyp_file, target=None, **kw):
+ """
+ Verifies that a build of the specified target is up to date.
+
+ The subclass should implement this by calling build()
+ (or a reasonable equivalent), checking whatever conditions
+ will tell it the build was an "up to date" null build, and
+ failing if it isn't.
+ """
+ raise NotImplementedError
+
+
+class TestGypGypd(TestGypBase):
+ """
+ Subclass for testing the GYP 'gypd' generator (spit out the
+ internal data structure as pretty-printed Python).
+ """
+ format = 'gypd'
+
+
+class TestGypMake(TestGypBase):
+ """
+ Subclass for testing the GYP Make generator.
+ """
+ format = 'make'
+ build_tool_list = ['make']
+ ALL = 'all'
+ def build(self, gyp_file, target=None, **kw):
+ """
+ Runs a Make build using the Makefiles generated from the specified
+ gyp_file.
+ """
+ arguments = kw.get('arguments', [])[:]
+ if self.configuration:
+ arguments.append('BUILDTYPE=' + self.configuration)
+ if target not in (None, self.DEFAULT):
+ arguments.append(target)
+ # Sub-directory builds provide per-gyp Makefiles (i.e.
+ # Makefile.gyp_filename), so use that if there is no Makefile.
+ chdir = kw.get('chdir', '')
+ if not os.path.exists(os.path.join(chdir, 'Makefile')):
+ print "NO Makefile in " + os.path.join(chdir, 'Makefile')
+ arguments.insert(0, '-f')
+ arguments.insert(1, os.path.splitext(gyp_file)[0] + '.Makefile')
+ kw['arguments'] = arguments
+ return self.run(program=self.build_tool, **kw)
+ def up_to_date(self, gyp_file, target=None, **kw):
+ """
+ Verifies that a build of the specified Make target is up to date.
+ """
+ if target in (None, self.DEFAULT):
+ message_target = 'all'
+ else:
+ message_target = target
+ kw['stdout'] = "make: Nothing to be done for `%s'.\n" % message_target
+ return self.build(gyp_file, target, **kw)
+ def run_built_executable(self, name, *args, **kw):
+ """
+ Runs an executable built by Make.
+ """
+ configuration = self.configuration_dirname()
+ libdir = os.path.join('out', configuration, 'lib')
+ # TODO(piman): when everything is cross-compile safe, remove lib.target
+ os.environ['LD_LIBRARY_PATH'] = libdir + '.host:' + libdir + '.target'
+ # Enclosing the name in a list avoids prepending the original dir.
+ program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)]
+ return self.run(program=program, *args, **kw)
+ def built_file_path(self, name, type=None, **kw):
+ """
+ Returns a path to the specified file name, of the specified type,
+ as built by Make.
+
+ Built files are in the subdirectory 'out/{configuration}'.
+ The default is 'out/Default'.
+
+ A chdir= keyword argument specifies the source directory
+ relative to which the output subdirectory can be found.
+
+ "type" values of STATIC_LIB or SHARED_LIB append the necessary
+ prefixes and suffixes to a platform-independent library base name.
+
+ A libdir= keyword argument specifies a library subdirectory other
+ than the default 'obj.target'.
+ """
+ result = []
+ chdir = kw.get('chdir')
+ if chdir:
+ result.append(chdir)
+ configuration = self.configuration_dirname()
+ result.extend(['out', configuration])
+ if type == self.STATIC_LIB:
+ result.append(kw.get('libdir', 'obj.target'))
+ elif type == self.SHARED_LIB:
+ result.append(kw.get('libdir', 'lib.target'))
+ result.append(self.built_file_basename(name, type, **kw))
+ return self.workpath(*result)
+
+
+class TestGypMSVS(TestGypBase):
+ """
+ Subclass for testing the GYP Visual Studio generator.
+ """
+ format = 'msvs'
+
+ u = r'=== Build: (\d+) succeeded, 0 failed, (\d+) up-to-date, 0 skipped ==='
+ up_to_date_re = re.compile(u, re.M)
+
+ # Initial None element will indicate to our .initialize_build_tool()
+ # method below that 'devenv' was not found on %PATH%.
+ #
+ # Note: we must use devenv.com to be able to capture build output.
+ # Directly executing devenv.exe only sends output to BuildLog.htm.
+ build_tool_list = [None, 'devenv.com']
+
+ def initialize_build_tool(self):
+ """ Initializes the Visual Studio .build_tool and .uses_msbuild parameters.
+
+ We use the value specified by GYP_MSVS_VERSION. If not specified, we
+ search %PATH% and %PATHEXT% for a devenv.{exe,bat,...} executable.
+ Failing that, we search for likely deployment paths.
+ """
+ super(TestGypMSVS, self).initialize_build_tool()
+ possible_roots = ['C:\\Program Files (x86)', 'C:\\Program Files']
+ possible_paths = {
+ '2010': r'Microsoft Visual Studio 10.0\Common7\IDE\devenv.com',
+ '2008': r'Microsoft Visual Studio 9.0\Common7\IDE\devenv.com',
+ '2005': r'Microsoft Visual Studio 8\Common7\IDE\devenv.com'}
+ msvs_version = os.environ.get('GYP_MSVS_VERSION', 'auto')
+ if msvs_version in possible_paths:
+ # Check that the path to the specified GYP_MSVS_VERSION exists.
+ path = possible_paths[msvs_version]
+ for r in possible_roots:
+ bt = os.path.join(r, path)
+ if os.path.exists(bt):
+ self.build_tool = bt
+ self.uses_msbuild = msvs_version >= '2010'
+ return
+ else:
+ print ('Warning: Environment variable GYP_MSVS_VERSION specifies "%s" '
+ 'but corresponding "%s" was not found.' % (msvs_version, path))
+ if self.build_tool:
+ # We found 'devenv' on the path, use that and try to guess the version.
+ for version, path in possible_paths.iteritems():
+ if self.build_tool.find(path) >= 0:
+ self.uses_msbuild = version >= '2010'
+ return
+ else:
+ # If not, assume not MSBuild.
+ self.uses_msbuild = False
+ return
+ # Neither GYP_MSVS_VERSION nor the path help us out. Iterate through
+ # the choices looking for a match.
+ for version, path in possible_paths.iteritems():
+ for r in possible_roots:
+ bt = os.path.join(r, path)
+ if os.path.exists(bt):
+ self.build_tool = bt
+ self.uses_msbuild = msvs_version >= '2010'
+ return
+ print 'Error: could not find devenv'
+ sys.exit(1)
+ def build(self, gyp_file, target=None, rebuild=False, **kw):
+ """
+ Runs a Visual Studio build using the configuration generated
+ from the specified gyp_file.
+ """
+ configuration = self.configuration_buildname()
+ if rebuild:
+ build = '/Rebuild'
+ else:
+ build = '/Build'
+ arguments = kw.get('arguments', [])[:]
+ arguments.extend([gyp_file.replace('.gyp', '.sln'),
+ build, configuration])
+ # Note: the Visual Studio generator doesn't add an explicit 'all'
+ # target, so we just treat it the same as the default.
+ if target not in (None, self.ALL, self.DEFAULT):
+ arguments.extend(['/Project', target])
+ if self.configuration:
+ arguments.extend(['/ProjectConfig', self.configuration])
+ kw['arguments'] = arguments
+ return self.run(program=self.build_tool, **kw)
+ def up_to_date(self, gyp_file, target=None, **kw):
+ """
+ Verifies that a build of the specified Visual Studio target is up to date.
+ """
+ result = self.build(gyp_file, target, **kw)
+ if not result:
+ stdout = self.stdout()
+ m = self.up_to_date_re.search(stdout)
+ up_to_date = False
+ if m:
+ succeeded = m.group(1)
+ up_to_date = m.group(2)
+ up_to_date = succeeded == '0' and up_to_date == '1'
+ # Figuring out if the build is up to date changed with VS2010.
+ # For builds that should be up to date, I sometimes get
+ # "1 succeeded and 0 up to date". As an ad-hoc measure, we check
+ # this and also verify that th number of output lines is small.
+ # I don't know if this is caused by VS itself or is due to
+ # interaction with virus checkers.
+ if self.uses_msbuild and (succeeded == '1' and
+ up_to_date == '0' and
+ stdout.count('\n') <= 6):
+ up_to_date = True
+ if not up_to_date:
+ self.report_not_up_to_date()
+ self.fail_test()
+ return result
+ def run_built_executable(self, name, *args, **kw):
+ """
+ Runs an executable built by Visual Studio.
+ """
+ configuration = self.configuration_dirname()
+ # Enclosing the name in a list avoids prepending the original dir.
+ program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)]
+ return self.run(program=program, *args, **kw)
+ def built_file_path(self, name, type=None, **kw):
+ """
+ Returns a path to the specified file name, of the specified type,
+ as built by Visual Studio.
+
+ Built files are in a subdirectory that matches the configuration
+ name. The default is 'Default'.
+
+ A chdir= keyword argument specifies the source directory
+ relative to which the output subdirectory can be found.
+
+ "type" values of STATIC_LIB or SHARED_LIB append the necessary
+ prefixes and suffixes to a platform-independent library base name.
+ """
+ result = []
+ chdir = kw.get('chdir')
+ if chdir:
+ result.append(chdir)
+ result.append(self.configuration_dirname())
+ if type == self.STATIC_LIB:
+ result.append('lib')
+ result.append(self.built_file_basename(name, type, **kw))
+ return self.workpath(*result)
+
+
+class TestGypSCons(TestGypBase):
+ """
+ Subclass for testing the GYP SCons generator.
+ """
+ format = 'scons'
+ build_tool_list = ['scons', 'scons.py']
+ ALL = 'all'
+ def build(self, gyp_file, target=None, **kw):
+ """
+ Runs a scons build using the SCons configuration generated from the
+ specified gyp_file.
+ """
+ arguments = kw.get('arguments', [])[:]
+ dirname = os.path.dirname(gyp_file)
+ if dirname:
+ arguments.extend(['-C', dirname])
+ if self.configuration:
+ arguments.append('--mode=' + self.configuration)
+ if target not in (None, self.DEFAULT):
+ arguments.append(target)
+ kw['arguments'] = arguments
+ return self.run(program=self.build_tool, **kw)
+ def up_to_date(self, gyp_file, target=None, **kw):
+ """
+ Verifies that a build of the specified SCons target is up to date.
+ """
+ if target in (None, self.DEFAULT):
+ up_to_date_targets = 'all'
+ else:
+ up_to_date_targets = target
+ up_to_date_lines = []
+ for arg in up_to_date_targets.split():
+ up_to_date_lines.append("scons: `%s' is up to date.\n" % arg)
+ kw['stdout'] = ''.join(up_to_date_lines)
+ arguments = kw.get('arguments', [])[:]
+ arguments.append('-Q')
+ kw['arguments'] = arguments
+ return self.build(gyp_file, target, **kw)
+ def run_built_executable(self, name, *args, **kw):
+ """
+ Runs an executable built by scons.
+ """
+ configuration = self.configuration_dirname()
+ os.environ['LD_LIBRARY_PATH'] = os.path.join(configuration, 'lib')
+ # Enclosing the name in a list avoids prepending the original dir.
+ program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)]
+ return self.run(program=program, *args, **kw)
+ def built_file_path(self, name, type=None, **kw):
+ """
+ Returns a path to the specified file name, of the specified type,
+ as built by Scons.
+
+ Built files are in a subdirectory that matches the configuration
+ name. The default is 'Default'.
+
+ A chdir= keyword argument specifies the source directory
+ relative to which the output subdirectory can be found.
+
+ "type" values of STATIC_LIB or SHARED_LIB append the necessary
+ prefixes and suffixes to a platform-independent library base name.
+ """
+ result = []
+ chdir = kw.get('chdir')
+ if chdir:
+ result.append(chdir)
+ result.append(self.configuration_dirname())
+ if type in (self.STATIC_LIB, self.SHARED_LIB):
+ result.append('lib')
+ result.append(self.built_file_basename(name, type, **kw))
+ return self.workpath(*result)
+
+
+class TestGypXcode(TestGypBase):
+ """
+ Subclass for testing the GYP Xcode generator.
+ """
+ format = 'xcode'
+ build_tool_list = ['xcodebuild']
+
+ phase_script_execution = ("\n"
+ "PhaseScriptExecution /\\S+/Script-[0-9A-F]+\\.sh\n"
+ " cd /\\S+\n"
+ " /bin/sh -c /\\S+/Script-[0-9A-F]+\\.sh\n"
+ "(make: Nothing to be done for `all'\\.\n)?")
+
+ strip_up_to_date_expressions = [
+ # Various actions or rules can run even when the overall build target
+ # is up to date. Strip those phases' GYP-generated output.
+ re.compile(phase_script_execution, re.S),
+
+ # The message from distcc_pump can trail the "BUILD SUCCEEDED"
+ # message, so strip that, too.
+ re.compile('__________Shutting down distcc-pump include server\n', re.S),
+ ]
+
+ up_to_date_endings = (
+ 'Checking Dependencies...\n** BUILD SUCCEEDED **\n', # Xcode 3.0/3.1
+ 'Check dependencies\n** BUILD SUCCEEDED **\n\n', # Xcode 3.2
+ )
+
+ def build(self, gyp_file, target=None, **kw):
+ """
+ Runs an xcodebuild using the .xcodeproj generated from the specified
+ gyp_file.
+ """
+ # Be sure we're working with a copy of 'arguments' since we modify it.
+ # The caller may not be expecting it to be modified.
+ arguments = kw.get('arguments', [])[:]
+ arguments.extend(['-project', gyp_file.replace('.gyp', '.xcodeproj')])
+ if target == self.ALL:
+ arguments.append('-alltargets',)
+ elif target not in (None, self.DEFAULT):
+ arguments.extend(['-target', target])
+ if self.configuration:
+ arguments.extend(['-configuration', self.configuration])
+ symroot = kw.get('SYMROOT', '$SRCROOT/build')
+ if symroot:
+ arguments.append('SYMROOT='+symroot)
+ kw['arguments'] = arguments
+ return self.run(program=self.build_tool, **kw)
+ def up_to_date(self, gyp_file, target=None, **kw):
+ """
+ Verifies that a build of the specified Xcode target is up to date.
+ """
+ result = self.build(gyp_file, target, **kw)
+ if not result:
+ output = self.stdout()
+ for expression in self.strip_up_to_date_expressions:
+ output = expression.sub('', output)
+ if not output.endswith(self.up_to_date_endings):
+ self.report_not_up_to_date()
+ self.fail_test()
+ return result
+ def run_built_executable(self, name, *args, **kw):
+ """
+ Runs an executable built by xcodebuild.
+ """
+ configuration = self.configuration_dirname()
+ os.environ['DYLD_LIBRARY_PATH'] = os.path.join('build', configuration)
+ # Enclosing the name in a list avoids prepending the original dir.
+ program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)]
+ return self.run(program=program, *args, **kw)
+ def built_file_path(self, name, type=None, **kw):
+ """
+ Returns a path to the specified file name, of the specified type,
+ as built by Xcode.
+
+ Built files are in the subdirectory 'build/{configuration}'.
+ The default is 'build/Default'.
+
+ A chdir= keyword argument specifies the source directory
+ relative to which the output subdirectory can be found.
+
+ "type" values of STATIC_LIB or SHARED_LIB append the necessary
+ prefixes and suffixes to a platform-independent library base name.
+ """
+ result = []
+ chdir = kw.get('chdir')
+ if chdir:
+ result.append(chdir)
+ configuration = self.configuration_dirname()
+ result.extend(['build', configuration])
+ result.append(self.built_file_basename(name, type, **kw))
+ return self.workpath(*result)
+
+
+format_class_list = [
+ TestGypGypd,
+ TestGypMake,
+ TestGypMSVS,
+ TestGypSCons,
+ TestGypXcode,
+]
+
+def TestGyp(*args, **kw):
+ """
+ Returns an appropriate TestGyp* instance for a specified GYP format.
+ """
+ format = kw.get('format')
+ if format:
+ del kw['format']
+ else:
+ format = os.environ.get('TESTGYP_FORMAT')
+ for format_class in format_class_list:
+ if format == format_class.format:
+ return format_class(*args, **kw)
+ raise Exception, "unknown format %r" % format
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared-obj-install-path.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared-obj-install-path.py
new file mode 100644
index 0000000..2cf1a28
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared-obj-install-path.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that .so files that are order only dependencies are specified by
+their install location rather than by their alias.
+"""
+
+# Python 2.5 needs this for the with statement.
+from __future__ import with_statement
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('shared_dependency.gyp',
+ chdir='src')
+test.relocate('src', 'relocate/src')
+
+test.build('shared_dependency.gyp', test.ALL, chdir='relocate/src')
+
+with open('relocate/src/Makefile') as makefile:
+ make_contents = makefile.read()
+
+# If we remove the code to generate lib1, Make should still be able
+# to build lib2 since lib1.so already exists.
+make_contents = make_contents.replace('include lib1.target.mk', '')
+with open('relocate/src/Makefile', 'w') as makefile:
+ makefile.write(make_contents)
+
+test.build('shared_dependency.gyp', test.ALL, chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared.py
new file mode 100644
index 0000000..a1d2985
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-shared.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simple build of a "Hello, world!" program with shared libraries,
+including verifying that libraries are rebuilt correctly when functions
+move between libraries.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('library.gyp',
+ '-Dlibrary=shared_library',
+ '-Dmoveable_function=lib1',
+ chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('library.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from program.c
+Hello from lib1.c
+Hello from lib2.c
+Hello from lib1_moveable.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.run_gyp('library.gyp',
+ '-Dlibrary=shared_library',
+ '-Dmoveable_function=lib2',
+ chdir='relocate/src')
+
+# Update program.c to force a rebuild.
+test.sleep()
+contents = test.read('relocate/src/program.c')
+contents = contents.replace('Hello', 'Hello again')
+test.write('relocate/src/program.c', contents)
+
+test.build('library.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello again from program.c
+Hello from lib1.c
+Hello from lib2.c
+Hello from lib2_moveable.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.run_gyp('library.gyp',
+ '-Dlibrary=shared_library',
+ '-Dmoveable_function=lib1',
+ chdir='relocate/src')
+
+# Update program.c to force a rebuild.
+test.sleep()
+contents = test.read('relocate/src/program.c')
+contents = contents.replace('again', 'again again')
+test.write('relocate/src/program.c', contents)
+
+# TODO(sgk): we have to force a rebuild of lib2 so that it weeds out
+# the "moved" module. This should be done in gyp by adding a dependency
+# on the generated .vcproj file itself.
+test.touch('relocate/src/lib2.c')
+
+test.build('library.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello again again from program.c
+Hello from lib1.c
+Hello from lib2.c
+Hello from lib1_moveable.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-static.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-static.py
new file mode 100644
index 0000000..4bc71c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/gyptest-static.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simple build of a "Hello, world!" program with static libraries,
+including verifying that libraries are rebuilt correctly when functions
+move between libraries.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('library.gyp',
+ '-Dlibrary=static_library',
+ '-Dmoveable_function=lib1',
+ chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('library.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello from program.c
+Hello from lib1.c
+Hello from lib2.c
+Hello from lib1_moveable.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.run_gyp('library.gyp',
+ '-Dlibrary=static_library',
+ '-Dmoveable_function=lib2',
+ chdir='relocate/src')
+
+# Update program.c to force a rebuild.
+test.sleep()
+contents = test.read('relocate/src/program.c')
+contents = contents.replace('Hello', 'Hello again')
+test.write('relocate/src/program.c', contents)
+
+test.build('library.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello again from program.c
+Hello from lib1.c
+Hello from lib2.c
+Hello from lib2_moveable.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.run_gyp('library.gyp',
+ '-Dlibrary=static_library',
+ '-Dmoveable_function=lib1',
+ chdir='relocate/src')
+
+# Update program.c and lib2.c to force a rebuild.
+test.sleep()
+contents = test.read('relocate/src/program.c')
+contents = contents.replace('again', 'again again')
+test.write('relocate/src/program.c', contents)
+
+# TODO(sgk): we have to force a rebuild of lib2 so that it weeds out
+# the "moved" module. This should be done in gyp by adding a dependency
+# on the generated .vcproj file itself.
+test.touch('relocate/src/lib2.c')
+
+test.build('library.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+Hello again again from program.c
+Hello from lib1.c
+Hello from lib2.c
+Hello from lib1_moveable.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1.c
new file mode 100644
index 0000000..3866b1b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void lib1_function(void)
+{
+ fprintf(stdout, "Hello from lib1.c\n");
+ fflush(stdout);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1_moveable.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1_moveable.c
new file mode 100644
index 0000000..5d3cc1d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib1_moveable.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void moveable_function(void)
+{
+ fprintf(stdout, "Hello from lib1_moveable.c\n");
+ fflush(stdout);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2.c
new file mode 100644
index 0000000..21dda72
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void lib2_function(void)
+{
+ fprintf(stdout, "Hello from lib2.c\n");
+ fflush(stdout);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2_moveable.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2_moveable.c
new file mode 100644
index 0000000..f645071
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/lib2_moveable.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void moveable_function(void)
+{
+ fprintf(stdout, "Hello from lib2_moveable.c\n");
+ fflush(stdout);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/library.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/library.gyp
new file mode 100644
index 0000000..bc35516
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/library.gyp
@@ -0,0 +1,58 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'moveable_function%': 0,
+ },
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'dependencies': [
+ 'lib1',
+ 'lib2',
+ ],
+ 'sources': [
+ 'program.c',
+ ],
+ },
+ {
+ 'target_name': 'lib1',
+ 'type': '<(library)',
+ 'sources': [
+ 'lib1.c',
+ ],
+ 'conditions': [
+ ['moveable_function=="lib1"', {
+ 'sources': [
+ 'lib1_moveable.c',
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'lib2',
+ 'type': '<(library)',
+ 'sources': [
+ 'lib2.c',
+ ],
+ 'conditions': [
+ ['moveable_function=="lib2"', {
+ 'sources': [
+ 'lib2_moveable.c',
+ ],
+ }],
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'target_defaults': {
+ # Support 64-bit shared libs (also works fine for 32-bit).
+ 'cflags': ['-fPIC'],
+ },
+ }],
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/program.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/program.c
new file mode 100644
index 0000000..d7712cc
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/program.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+extern void lib1_function(void);
+extern void lib2_function(void);
+extern void moveable_function(void);
+
+int main(int argc, char *argv[])
+{
+ fprintf(stdout, "Hello from program.c\n");
+ fflush(stdout);
+ lib1_function();
+ lib2_function();
+ moveable_function();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/shared_dependency.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/shared_dependency.gyp
new file mode 100644
index 0000000..7d29f5d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/library/src/shared_dependency.gyp
@@ -0,0 +1,33 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'lib1',
+ 'type': 'shared_library',
+ 'sources': [
+ 'lib1.c',
+ ],
+ },
+ {
+ 'target_name': 'lib2',
+ 'type': 'shared_library',
+ 'sources': [
+ 'lib2.c',
+ ],
+ 'dependencies': [
+ 'lib1',
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'target_defaults': {
+ # Support 64-bit shared libs (also works fine for 32-bit).
+ 'cflags': ['-fPIC'],
+ },
+ }],
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/base.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/base.c
new file mode 100644
index 0000000..2bc29a1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/base.c
@@ -0,0 +1,6 @@
+void extra();
+
+int main(int argc, char** argv) {
+ extra();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/extra.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/extra.c
new file mode 100644
index 0000000..1d7ee09
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/extra.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+void extra() {
+ printf("PASS\n");
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/gyptest-all.py
new file mode 100644
index 0000000..b58a396
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/gyptest-all.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Put an object file on the sources list.
+Expect the result to link ok.
+"""
+
+import TestGyp
+
+# Currently only works under the make build.
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('link-objects.gyp')
+
+test.build('link-objects.gyp', test.ALL)
+
+test.run_built_executable('link-objects', stdout="PASS\n")
+
+test.up_to_date('link-objects.gyp', test.ALL)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/link-objects.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/link-objects.gyp
new file mode 100644
index 0000000..ab72855
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/link-objects/link-objects.gyp
@@ -0,0 +1,24 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'link-objects',
+ 'type': 'executable',
+ 'actions': [
+ {
+ 'action_name': 'build extra object',
+ 'inputs': ['extra.c'],
+ 'outputs': ['extra.o'],
+ 'action': ['gcc', '-o', 'extra.o', '-c', 'extra.c'],
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ 'sources': [
+ 'base.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/dependencies.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/dependencies.gyp
new file mode 100644
index 0000000..e2bee24
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/dependencies.gyp
@@ -0,0 +1,15 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'main',
+ 'type': 'executable',
+ 'sources': [
+ 'main.cc',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-dependencies.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-dependencies.py
new file mode 100644
index 0000000..76cfd0e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-dependencies.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that .d files and all.deps are properly generated.
+"""
+
+import os
+import TestGyp
+
+# .d files are only used by the make build.
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('dependencies.gyp')
+
+test.build('dependencies.gyp', test.ALL)
+
+deps_file = test.built_file_path(".deps/out/Default/obj.target/main/main.o.d")
+test.must_contain(deps_file, "main.h")
+
+# Build a second time to make sure we generate all.deps.
+test.build('dependencies.gyp', test.ALL)
+
+all_deps_file = test.built_file_path(".deps/all.deps")
+test.must_contain(all_deps_file, "main.h")
+test.must_contain(all_deps_file, "cmd_")
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-noload.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-noload.py
new file mode 100644
index 0000000..1f51033
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/gyptest-noload.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Tests the use of the NO_LOAD flag which makes loading sub .mk files
+optional.
+"""
+
+# Python 2.5 needs this for the with statement.
+from __future__ import with_statement
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['make'])
+
+test.run_gyp('all.gyp', chdir='noload')
+
+test.relocate('noload', 'relocate/noload')
+
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload')
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+# Just sanity test that NO_LOAD=lib doesn't break anything.
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=lib'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=z'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+# Make sure we can rebuild without reloading the sub .mk file.
+with open('relocate/noload/main.c', 'a') as src_file:
+ src_file.write("\n")
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=lib'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+# Change shared.c, but verify that it doesn't get rebuild if we don't load it.
+with open('relocate/noload/lib/shared.c', 'w') as shared_file:
+ shared_file.write(
+ '#include "shared.h"\n'
+ 'const char kSharedStr[] = "modified";\n'
+ )
+test.build('build/all.gyp', test.ALL, chdir='relocate/noload',
+ arguments=['NO_LOAD=lib'])
+test.run_built_executable('exe', chdir='relocate/noload',
+ stdout='Hello from shared.c.\n')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/main.cc b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/main.cc
new file mode 100644
index 0000000..70ac6e4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/main.cc
@@ -0,0 +1,12 @@
+/* Copyright (c) 2009 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+#include "main.h"
+
+int main(int argc, char *argv[]) {
+ printf("hello world\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/WebCore/dom/PositionCreationFunctions.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/main.h
index e69de29..e69de29 100644
--- a/src/3rdparty/webkit/WebCore/dom/PositionCreationFunctions.h
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/main.h
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/all.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/all.gyp
new file mode 100644
index 0000000..1617a9e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/all.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'exe',
+ 'type': 'executable',
+ 'sources': [
+ 'main.c',
+ ],
+ 'dependencies': [
+ 'lib/shared.gyp:shared',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.c
new file mode 100644
index 0000000..51776c5
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.c
@@ -0,0 +1,3 @@
+#include "shared.h"
+
+const char kSharedStr[] = "shared.c";
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.gyp
new file mode 100644
index 0000000..8a8841b
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.gyp
@@ -0,0 +1,16 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'shared',
+ 'type': 'shared_library',
+ 'sources': [
+ 'shared.c',
+ 'shared.h',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.h b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.h
new file mode 100644
index 0000000..a21da75
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/lib/shared.h
@@ -0,0 +1 @@
+extern const char kSharedStr[];
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/main.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/main.c
new file mode 100644
index 0000000..46d3c52
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/make/noload/main.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#include "lib/shared.h"
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from %s.\n", kSharedStr);
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/gyptest-default.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/gyptest-default.py
new file mode 100644
index 0000000..6b1c9b6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/gyptest-default.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simple build of a "Hello, world!" program with loadable modules. The
+default for all platforms should be to output the loadable modules to the same
+path as the executable.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('module.gyp', chdir='src')
+
+test.build('module.gyp', test.ALL, chdir='src')
+
+expect = """\
+Hello from program.c
+Hello from lib1.c
+Hello from lib2.c
+"""
+test.run_built_executable('program', chdir='src', stdout=expect)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib1.c
new file mode 100644
index 0000000..8de0e94
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void module_main(void)
+{
+ fprintf(stdout, "Hello from lib1.c\n");
+ fflush(stdout);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib2.c
new file mode 100644
index 0000000..266396d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/lib2.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void module_main(void)
+{
+ fprintf(stdout, "Hello from lib2.c\n");
+ fflush(stdout);
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/module.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/module.gyp
new file mode 100644
index 0000000..bb43c30
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/module.gyp
@@ -0,0 +1,55 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'target_defaults': {
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': ['PLATFORM_WIN'],
+ }],
+ ['OS=="mac"', {
+ 'defines': ['PLATFORM_MAC'],
+ }],
+ ['OS=="linux"', {
+ 'defines': ['PLATFORM_LINUX'],
+ # Support 64-bit shared libs (also works fine for 32-bit).
+ 'cflags': ['-fPIC'],
+ 'ldflags': ['-ldl'],
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'dependencies': [
+ 'lib1',
+ 'lib2',
+ ],
+ 'sources': [
+ 'program.c',
+ ],
+ },
+ {
+ 'target_name': 'lib1',
+ 'type': 'loadable_module',
+ 'product_name': 'lib1',
+ 'product_prefix': '',
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''},
+ 'sources': [
+ 'lib1.c',
+ ],
+ },
+ {
+ 'target_name': 'lib2',
+ 'product_name': 'lib2',
+ 'product_prefix': '',
+ 'type': 'loadable_module',
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''},
+ 'sources': [
+ 'lib2.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/program.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/program.c
new file mode 100644
index 0000000..b2f3320
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/module/src/program.c
@@ -0,0 +1,111 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#if defined(PLATFORM_WIN)
+#include <windows.h>
+#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
+#include <dlfcn.h>
+#include <libgen.h>
+#include <string.h>
+#include <sys/param.h>
+#define MAX_PATH PATH_MAX
+#endif
+
+#if defined(PLATFORM_WIN)
+#define MODULE_SUFFIX ".dll"
+#elif defined(PLATFORM_MAC)
+#define MODULE_SUFFIX ".so"
+#elif defined(PLATFORM_LINUX)
+#define MODULE_SUFFIX ".so"
+#endif
+
+typedef void (*module_symbol)(void);
+char bin_path[MAX_PATH + 1];
+
+
+void CallModule(const char* module) {
+ char module_path[MAX_PATH + 1];
+ const char* module_function = "module_main";
+ module_symbol funcptr;
+#if defined(PLATFORM_WIN)
+ HMODULE dl;
+ char drive[_MAX_DRIVE];
+ char dir[_MAX_DIR];
+
+ if (_splitpath_s(bin_path, drive, _MAX_DRIVE, dir, _MAX_DIR,
+ NULL, 0, NULL, 0)) {
+ fprintf(stderr, "Failed to split executable path.\n");
+ return;
+ }
+ if (_makepath_s(module_path, MAX_PATH, drive, dir, module, MODULE_SUFFIX)) {
+ fprintf(stderr, "Failed to calculate module path.\n");
+ return;
+ }
+
+ dl = LoadLibrary(module_path);
+ if (!dl) {
+ fprintf(stderr, "Failed to open module: %s\n", module_path);
+ return;
+ }
+
+ funcptr = (module_symbol) GetProcAddress(dl, module_function);
+ if (!funcptr) {
+ fprintf(stderr, "Failed to find symbol: %s\n", module_function);
+ return;
+ }
+ funcptr();
+
+ FreeLibrary(dl);
+#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
+ void* dl;
+ char* path_copy = strdup(bin_path);
+ char* bin_dir = dirname(path_copy);
+ int path_size = snprintf(module_path, MAX_PATH, "%s/%s%s", bin_dir, module,
+ MODULE_SUFFIX);
+ free(path_copy);
+ if (path_size < 0 || path_size > MAX_PATH) {
+ fprintf(stderr, "Failed to calculate module path.\n");
+ return;
+ }
+ module_path[path_size] = 0;
+
+ dl = dlopen(module_path, RTLD_LAZY);
+ if (!dl) {
+ fprintf(stderr, "Failed to open module: %s\n", module_path);
+ return;
+ }
+
+ funcptr = dlsym(dl, module_function);
+ if (!funcptr) {
+ fprintf(stderr, "Failed to find symbol: %s\n", module_function);
+ return;
+ }
+ funcptr();
+
+ dlclose(dl);
+#endif
+}
+
+int main(int argc, char *argv[])
+{
+ fprintf(stdout, "Hello from program.c\n");
+ fflush(stdout);
+
+#if defined(PLATFORM_WIN)
+ if (!GetModuleFileName(NULL, bin_path, MAX_PATH)) {
+ fprintf(stderr, "Failed to determine executable path.\n");
+ return;
+ }
+#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
+ // Using argv[0] should be OK here since we control how the tests run, and
+ // can avoid exec and such issues that make it unreliable.
+ if (!realpath(argv[0], bin_path)) {
+ fprintf(stderr, "Failed to determine executable path (%s).\n", argv[0]);
+ return;
+ }
+#endif
+
+ CallModule("lib1");
+ CallModule("lib2");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/base/base.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/base/base.gyp
new file mode 100644
index 0000000..b7c9fc6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/base/base.gyp
@@ -0,0 +1,22 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'a',
+ 'type': 'static_library',
+ 'sources': [
+ 'a.c',
+ ],
+ },
+ {
+ 'target_name': 'b',
+ 'type': 'static_library',
+ 'sources': [
+ 'b.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/express.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/express.gyp
new file mode 100644
index 0000000..917abe2
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/express.gyp
@@ -0,0 +1,19 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'express',
+ 'type': 'executable',
+ 'dependencies': [
+ 'base/base.gyp:a',
+ 'base/base.gyp:b',
+ ],
+ 'sources': [
+ 'main.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/gyptest-express.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/gyptest-express.py
new file mode 100644
index 0000000..54c06f6
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/express/gyptest-express.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that flat solutions get generated for Express versions of
+Visual Studio.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['msvs'])
+
+test.run_gyp('express.gyp', '-G', 'msvs_version=2005')
+test.must_contain('express.sln', '(base)')
+
+test.run_gyp('express.gyp', '-G', 'msvs_version=2008')
+test.must_contain('express.sln', '(base)')
+
+test.run_gyp('express.gyp', '-G', 'msvs_version=2005e')
+test.must_not_contain('express.sln', '(base)')
+
+test.run_gyp('express.gyp', '-G', 'msvs_version=2008e')
+test.must_not_contain('express.sln', '(base)')
+
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/gyptest-all.py
new file mode 100644
index 0000000..c8d566a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/gyptest-all.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that precompiled headers can be specified.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['msvs'])
+
+test.run_gyp('hello.gyp')
+
+test.build('hello.gyp', 'hello')
+
+test.run_built_executable('hello', stdout="Hello, world!\nHello, two!\n")
+
+test.up_to_date('hello.gyp', test.ALL)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.c
new file mode 100644
index 0000000..d1abbb9
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.c
@@ -0,0 +1,14 @@
+/* Copyright (c) 2011 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+// Note the abscence of a stdio.h include. This will be inserted because of the
+// precompiled header.
+
+extern int hello2();
+
+int main(int argc, char *argv[]) {
+ printf("Hello, world!\n");
+ hello2();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.gyp
new file mode 100644
index 0000000..b9533ef
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello.gyp
@@ -0,0 +1,19 @@
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'hello',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ 'hello2.c',
+ 'precomp.c',
+ ],
+ 'msvs_precompiled_header': 'stdio.h',
+ 'msvs_precompiled_source': 'precomp.c',
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello2.c
new file mode 100644
index 0000000..d6d5311
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/hello2.c
@@ -0,0 +1,13 @@
+/* Copyright (c) 2011 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+// Unlike hello.c, this file specifies the headers.
+
+#include <windows.h>
+#include <stdio.h>
+
+int hello2() {
+ printf("Hello, two!\n");
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/precomp.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/precomp.c
new file mode 100644
index 0000000..517c61a
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/msvs/precompiled/precomp.c
@@ -0,0 +1,8 @@
+/* Copyright (c) 2011 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+// The precompiled header does not have to be the first one in the file.
+
+#include <windows.h>
+#include <stdio.h>
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-all.py
new file mode 100644
index 0000000..9f157c4
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-all.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('multiple.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+# TODO(sgk): remove stderr=None when the --generator-output= support
+# gets rid of the scons warning
+test.build('multiple.gyp', test.ALL, chdir='relocate/src', stderr=None)
+
+expect1 = """\
+hello from prog1.c
+hello from common.c
+"""
+
+expect2 = """\
+hello from prog2.c
+hello from common.c
+"""
+
+test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src')
+test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-default.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-default.py
new file mode 100644
index 0000000..8d5072d
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/gyptest-default.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('multiple.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+# TODO(sgk): remove stderr=None when the --generator-output= support
+# gets rid of the scons warning
+test.build('multiple.gyp', chdir='relocate/src', stderr=None)
+
+expect1 = """\
+hello from prog1.c
+hello from common.c
+"""
+
+expect2 = """\
+hello from prog2.c
+hello from common.c
+"""
+
+test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src')
+test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/common.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/common.c
new file mode 100644
index 0000000..f1df7c1
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/common.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void common(void)
+{
+ printf("hello from common.c\n");
+ return;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/multiple.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/multiple.gyp
new file mode 100644
index 0000000..3db4ea3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/multiple.gyp
@@ -0,0 +1,24 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'prog1',
+ 'type': 'executable',
+ 'sources': [
+ 'prog1.c',
+ 'common.c',
+ ],
+ },
+ {
+ 'target_name': 'prog2',
+ 'type': 'executable',
+ 'sources': [
+ 'prog2.c',
+ 'common.c',
+ ],
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog1.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog1.c
new file mode 100644
index 0000000..d55f8af
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void common(void);
+
+int main(int argc, char *argv[])
+{
+ printf("hello from prog1.c\n");
+ common();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog2.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog2.c
new file mode 100644
index 0000000..760590e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/multiple-targets/src/prog2.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern void common(void);
+
+int main(int argc, char *argv[])
+{
+ printf("hello from prog2.c\n");
+ common();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/gyptest-no-output.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/gyptest-no-output.py
new file mode 100644
index 0000000..8431241
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/gyptest-no-output.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verified things don't explode when there are targets without outputs.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('nooutput.gyp', chdir='src')
+test.relocate('src', 'relocate/src')
+test.build('nooutput.gyp', chdir='relocate/src')
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/src/nooutput.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/src/nooutput.gyp
new file mode 100644
index 0000000..c40124e
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/no-output/src/nooutput.gyp
@@ -0,0 +1,17 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'no_output',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'NADA',
+ ],
+ },
+ },
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/gyptest-product.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/gyptest-product.py
new file mode 100644
index 0000000..e9790f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/gyptest-product.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies simplest-possible build of a "Hello, world!" program
+using the default build target.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('product.gyp')
+test.build('product.gyp')
+
+# executables
+test.built_file_must_exist('alt1' + test._exe, test.EXECUTABLE, bare=True)
+test.built_file_must_exist('hello2.stuff', test.EXECUTABLE, bare=True)
+test.built_file_must_exist('yoalt3.stuff', test.EXECUTABLE, bare=True)
+
+# shared libraries
+test.built_file_must_exist(test.dll_ + 'alt4' + test._dll,
+ test.SHARED_LIB, bare=True)
+test.built_file_must_exist(test.dll_ + 'hello5.stuff',
+ test.SHARED_LIB, bare=True)
+test.built_file_must_exist('yoalt6.stuff', test.SHARED_LIB, bare=True)
+
+# static libraries
+test.built_file_must_exist(test.lib_ + 'alt7' + test._lib,
+ test.STATIC_LIB, bare=True)
+test.built_file_must_exist(test.lib_ + 'hello8.stuff',
+ test.STATIC_LIB, bare=True)
+test.built_file_must_exist('yoalt9.stuff', test.STATIC_LIB, bare=True)
+
+# alternate product_dir
+test.built_file_must_exist('bob/yoalt10.stuff', test.EXECUTABLE, bare=True)
+test.built_file_must_exist('bob/yoalt11.stuff', test.EXECUTABLE, bare=True)
+test.built_file_must_exist('bob/yoalt12.stuff', test.EXECUTABLE, bare=True)
+
+test.pass_test()
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/hello.c b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/hello.c
new file mode 100644
index 0000000..94798f3
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/hello.c
@@ -0,0 +1,15 @@
+/* Copyright (c) 2009 Google Inc. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include <stdio.h>
+
+int func1(void) {
+ return 42;
+}
+
+int main(int argc, char *argv[]) {
+ printf("Hello, world!\n");
+ printf("%d\n", func1());
+ return 0;
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/product.gyp b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/product.gyp
new file mode 100644
index 0000000..c25eaaa
--- /dev/null
+++ b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/product/product.gyp
@@ -0,0 +1,128 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'hello1',
+ 'product_name': 'alt1',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello2',
+ 'product_extension': 'stuff',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello3',
+ 'product_name': 'alt3',
+ 'product_extension': 'stuff',
+ 'product_prefix': 'yo',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+
+ {
+ 'target_name': 'hello4',
+ 'product_name': 'alt4',
+ 'type': 'shared_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello5',
+ 'product_extension': 'stuff',
+ 'type': 'shared_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello6',
+ 'product_name': 'alt6',
+ 'product_extension': 'stuff',
+ 'product_prefix': 'yo',
+ 'type': 'shared_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+
+ {
+ 'target_name': 'hello7',
+ 'product_name': 'alt7',
+ 'type': 'static_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello8',
+ 'product_extension': 'stuff',
+ 'type': 'static_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello9',
+ 'product_name': 'alt9',
+ 'product_extension': 'stuff',
+ 'product_prefix': 'yo',
+ 'type': 'static_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello10',
+ 'product_name': 'alt10',
+ 'product_extension': 'stuff',
+ 'product_prefix': 'yo',
+ 'product_dir': '<(PRODUCT_DIR)/bob',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello11',
+ 'product_name': 'alt11',
+ 'product_extension': 'stuff',
+ 'product_prefix': 'yo',
+ 'product_dir': '<(PRODUCT_DIR)/bob',
+ 'type': 'shared_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ {
+ 'target_name': 'hello12',
+ 'product_name': 'alt12',
+ 'product_extension': 'stuff',
+ 'product_prefix': 'yo',
+ 'product_dir': '<(PRODUCT_DIR)/bob',
+ 'type': 'static_library',
+ 'sources': [
+ 'hello.c',
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'target_defaults': {
+ 'cflags': ['-fPIC'],
+ },
+ }],
+ ],
+}
diff --git a/src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/gyptest-all.py b/src/3rdparty/webkit/Source/ThirdParty/gyp/test/rules-rebuild/gyptest-all.py
new file mode 100644